// JavaScript Document
function animatemenu(){
		$('#sub_chisiamo').hide();
		$('#sub_prodotti').hide();
		
		// applico l'hover al chisiamo
		$('.chisiamo').hover(function(){
			$('#sub_chisiamo').slideDown("50");
			//$('#sub_chisiamo').hide();
		}, function(){
			$('#sub_chisiamo').slideUp("10");
			//$('#sub_chisiamo').show();
		});
		
		// applico l'hover a prodotti
		$('.prodotti').hover(function(){
			$('#sub_prodotti').slideDown("50");;
		}, function(){
			$('#sub_prodotti').slideUp("10");
		});
}

/* PRODOTTI */
function createGallery(){
	
		$('#screen').scrollShow({
			view:'#view',
			content:'#images',
			easing:'linear',
			wrappers:'simple',
			navigators:'a[id]',
			circular:false,
			start:0
		});
	
	$.easing.backout = function(x, t, b, c, d){
			var s=1.70158;
			return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
		};

	/*$("#table_dimensioni tr").hover(function(){
			var riga = $(this).attr("class");
			riga = "#imm_" + riga.replace("riga_", ""); //tolgo riga
			$(riga).show();


			// scorro i td
			$(this).find("td").each(function(){
				if($(this).attr("class") != "immagine"){
					old_back = $(this).css("background-color");
					$(this).css("background-color", "#FFEFAF");
				};
			});
		}, 
		function(){
			for(i=2; i<=14; i++){
				$("#imm_" + i).hide();
			}

			$(this).find("td").each(function(){
				$(this).css("background-color", old_back);
				
			});
		});
	
	/*for(i=2; i<=14; i++){
    	$("#imm_" + i).hide();
    }
	
	*/
	var old_back_color;
	
	// cursore riga
	$("#table_dimensioni tr").css("cursor", "pointer"); // applico il cursore
	$("#table_dimensioni tr:first").css("cursor", "default"); // tolgo il cursore alla prima
	$("#table_dimensioni tr:first").attr("class", ""); // tolgo la prima classe;
	
	$("#table_dimensioni tr:even").css("background-color", "#ccc");
	$("#table_dimensioni tr:odd").css("background-color", "#fff");
	// hover 
	
	$("#table_dimensioni tr").hover(function(){
		$(this).css("color", "#f00");
	},function(){
		$(this).css("color", "#000");
	});
	
	$("#table_dimensioni tr").click(function(){
		var riga = "";
		riga = $(this).attr("class");
		if(riga.length > 0){
			
			for(i=1; i<=14; i++){
				$("#imm_" + i).hide();
			}
			
			sistematabella();
			
			riga = "#imm_" + riga.replace("riga_", ""); //tolgo riga
			$(riga).fadeIn();
			
			$(this).css("background-color", "#CE9105");
		}
	});
	
	
	
	// elementi di default
	$("#table_dimensioni tr:eq(1)").css("background-color", "#CE9105");
	$("#imm_1").show();
	$("#table_dimensioni tr:first").css("background-color", "#fff");
}

function sistematabella(){
	var i = 0;
	$("#table_dimensioni").find("tr").each(function(){
		if(i%2 == 0) 
			$(this).css("background-color", "#ccc")
		else
			$(this).css("background-color", "#fff");
		i++;
	});
	$("#table_dimensioni tr:first").css("background-color", "#fff");
}
	
