$("a.thickbox b").addClass("dida_code");
// GALLERY PRODUCT
$(function(){
	var icone = $('.galleryIconImage img');
	var n = icone.length;
	var pos = 0;
	var altSx = "foto precedente";
	var altDx = "foto successiva";
	var altClick = "clicca per ingrandire l'immagine";		
	var altImgBig = "immagine galleria";		

	if (n>6) {
		icone.parent().parent().css({ 'width' : (n*78)+'px', 'text-align' : 'left' }).wrap("<div id='galleryMask'></div>");
		icone.parent().parent().parent().before("<img class='galleryNav' id='galleryNavDx' border=0 src='img/frecciaDX.gif' alt='>' title='"+altDx+"' />").before("<img class='galleryNav' id='galleryNavSx' border=0 src='img/frecciaSX.gif' alt='<' title='"+altSx+"' />");
		$('#galleryNavDx').css('cursor','pointer').click(
			function(event){
				if (Math.abs(pos)>=(n-6))	{
					pos=0;		
					$('.galleryIconImage').animate({ marginLeft: "0px" }, 2000 );				
				} else {
					pos--;
					$('.galleryIconImage').animate({ marginLeft: (78*pos)+"px" }, 1000 );
				}		
			}
		);

		$('#galleryNavSx').css('cursor','pointer').click(
			function(event){
				if (Math.abs(pos)<=0)	{
					pos=-(n-6);		
					$('.galleryIconImage').animate({ marginLeft: (78*pos)+"px" }, 2000 );				
				} else {
					pos++;
					$('.galleryIconImage').animate({ marginLeft: (78*pos)+"px" }, 1000 );
				}
			}
		);			
	}
	
	icone.attr('title',altClick).attr('alt',altImgBig).css('cursor','pointer');

	/*icone.attr('title',altClick).attr('alt',altImgBig).css('cursor','pointer').click(
		function(event){
			//var urlTarget = $(this).attr('src')
			//$('#galleryBigImage img').attr('src',urlTarget.replace('gallery/icone/','gallery/'));
			//var htmlStr = $('#dida'+urlTarget.substr(urlTarget.lastIndexOf(".")-1,1)).html();
	        //$('#galleryDida').html(htmlStr);			
		}
	);*/
});
