/**
 * Foto selection event handler
 * @return
 */
function selectFotoEvent() {
	ProductFotoService.getFoto($(this).attr('id'), selectFoto);
}

/**
 * Handles the logic of selection a photo
 *
 * @param foto
 * @return
 */
function selectFoto(foto) {
	// remove active state of thumbs
	$('.fotosproduct a').removeClass('current_frame');

	// if the picture isn't already active, make it active
	if (!$('#' + foto.id).hasClass('current_frame')) {
		$('#' + foto.id).addClass('current_frame');
	}

	var activeFoto = $('.fotoviewer img');

	// replace slide image with active one
	activeFoto.attr('alt', foto.merk + ' ' + foto.productType);
	activeFoto.attr('src', foto.slidePath);

	// replace description with active one
	var description = '<p class="productTitle"><strong>' + foto.merk
			+ '</strong> <span class="prodNum">' + foto.productType
			+ '</span></p><p>' + foto.description + '</p>';
	$('.fotoviewer .description').html(description);
}
