/**
 * @author batman
 */
$(document).ready(


	function() {
		
		$('.shop_sez').mouseover (
			function() {
				$('#showcase_dida img:visible').not('#dida_'+$(this).attr("id")).slideUp();
				$('#dida_'+$(this).attr("id")).slideDown();
				$('#showcase_foto img:visible').not('#foto_'+$(this).attr("id")).slideUp();
				$('#foto_'+$(this).attr("id")).slideDown();
			}
		);
		
		if($('#happening_foto').length>0) {
			$('#happening_foto').cycle({ 
			    fx:     'fade', 
			    /*speed:  'fast',*/ 
			    timeout: 0, 
			    pager:  '.happening_elenco',
					pagerEvent: 'mouseover', 
			    pagerAnchorBuilder: function(idx, slide) { 
			        // return selector string for existing anchor 
			        return 'a#happening_' + idx; 
			    } 
			});
		}

		if($('#happening_foto_dett').length>0) {
			$('#happening_foto_dett').cycle({ 
			    fx:     'fade', 
			    /*speed:  'fast',*/ 
			    timeout: 0, 
			    pager:  '#happening_thumbs',
					pagerEvent: 'mouseover', 
			    pagerAnchorBuilder: function(idx, slide) { 
			        // return selector string for existing anchor 
			        return '#happening_thumbs div:eq(' + idx + ') a'; 
			    } 
			});
		}
		
		
		for(var i=0; i<3; i++) {
			if($('#thumbgallery_'+i).length>0 && $('#prev_thumbgallery_'+i).length>0 ) {
				$('#thumbgallery_'+i).cycle({ 
			    fx: 'shuffle', 
			    timeout: 0,
					prev: '#prev_thumbgallery_' + i,
					next: '#next_thumbgallery_' + i
				});
			}
		}

		
		$("a.zoomable").fancybox({
				zoomSpeedIn: 300,
				zoomSpeedOut: 300,
				imageScale: true
		});
		
		for(var i=0; i<3; i++) {
			if($('#the_zoom_'+i).length>0) {
				$('#the_zoom_'+i).click(
					function() {
						listina = $(this).attr("id").split("_");
						my_i = listina[listina.length-1];
						$('#thumbgallery_'+my_i).find('.zoomable:visible').triggerHandler('click');
						return false;
					}
				);
			}
		}



		$('.incarrello').click(
			function() {
				var lid = $(this).attr("href") + $('#variante_' + $(this).attr("id")).val();
				location.href=lid;
				return false;
			}
		);
		
		
		/*$(document).pngFix();*/
	}
	
);

