menu = new Array();
offerte = new Array();
set_off = new Array();


function visualizza_offerte(){ setTimeout(	"$(\"#offerte\").css(\"visibility\",\"visible\")", 1000);$("#offerte li").addClass("fl1");}

$(window).load(function () { 
		h_corpo = $("#corpo").height();		
		$("#copricorpo").animate({height:h_corpo});
		
		$("#logo").fadeIn(2000);
		
		setTimeout("$(\"#slogan\").fadeIn(3000)", 1000);	
		setTimeout("resto()", 2000);
		setTimeout("$(\"#copricorpo\").fadeOut(1000)",3000);
		setTimeout("$(\"#footer\").fadeIn(1000)", 3000);
	  	setTimeout("$(\"#lingue\").fadeIn(1000)", 5000);
						
});				


function resto(){
	
	
	
	
	$("#menu").fadeIn();
		h_corpo = $("#corpo").height();
		h_corpo2 = $("#corpo2").height();
		$("#offerte").css("top",h_corpo-30+"px");
		

			$(".green").each(function(i, val) {
			  this.id = "green_"+i;
			  $(this).attr("rel", i);
			  menu[i] = $(this).height();
			  
			  $(this).stop().animate({height:'40px'},{queue:false, duration:1000})
			
			});
			
			$("#menu li").addClass("fl");
			
			
			
			$(".yellow").each(function(i, val) {
			  this.id = i;
			  offerte[i] = $(this).height();
			  set_off[i] = 0;
			  
			  $(this).stop().animate({height:'30px'},{queue:false, duration:1000})
				
			}, visualizza_offerte());
			
			var pos = $("#offerte").position();
						$("#footer_int").css("top",pos.top+"px");
						$("#footer_int").fadeIn(1000);
			
			//if($("#offerte_elenco li").length>0)	{setTimeout("apri_offerte()", 2000);}
			// if($("#sconti_elenco li").length>0)	{setTimeout("apri_sconti()", 2500);}
			
			
			
			
			
			//When mouse rolls over
			$(".green").mouseover(function(){
				id = $(this).attr("rel");
				$("#menu #green_"+id).stop().animate({height:(h_corpo+h_corpo2+110)+'px'},{queue:false, duration:600})
				$("#menu #green_"+id).css("z-index","100");
				$("#menu #green_"+id).fadeTo("slow", 0.80);

			});
			
			//When mouse is removed
			$(".green").mouseout(function(){
				id = $(this).attr("id");
				
				$("#menu #"+id).stop().animate({height:'40px'},{queue:false, duration:600})
				$("#menu #green_"+id).fadeIn();
			});
	





			//When mouse rolls over
			
										
				
						$(".yellow").click(function(){
							id_off = $(this).attr("id");
							
							if(set_off[id_off]==1)
									{
										$("#offerte #"+id_off).animate({"top": "0px",height:'30px'});
										
										set_off[id_off]=0;
										
								}else{	
										$("#offerte #"+id_off).animate({"top": "-"+(offerte[id_off]-20)+"px",height:offerte[id_off]+'px'});
										
										set_off[id_off]=1;
									}
										
						});
	
	
	
	
	
	
	}



		

function apri_offerte()
{
	$("#offerte #"+0).animate({"top": "-"+(offerte[0]-20)+"px",height:offerte[0]+'px'});
	set_off[0]=1;
}
function apri_sconti()
{
	$("#offerte #"+1).animate({"top": "-"+(offerte[1]-20)+"px",height:offerte[1]+'px'});
	set_off[1]=1;
}



