// JavaScript Document
 $(document).ready(function(){
       
	
	
		
	//accordion
			
			//apro di default un blocco se necessario, andando a leggere le variabili openMenu e n  negli header delle pagine
			//n = il numero del blocco da aprire
		$("a[id^='"+thisP+"']").removeClass("linkAccordion").addClass("linkAccordionSwapped");
		if(openMenu){
		
		$('.menu_body:eq('+n+')').show();
		
		$("a[id^='"+subP+"']").addClass("linkGrey");
		
		}
		
		//slides the element with class "menu_body" when paragraph with class "menu_head" is clicked 
		$("#firstpane div.menu_head").click(function()
		{
		$(this).css({backgroundImage:"url(template/images/nav/bgBottone_f1.jpg)"}).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
       //	$(this).siblings().css({backgroundImage:"url(template/images/nav/bgBottone.jpg)"});
		});
		
		
		$("#firstpane div.menu_head").hover(null,function()
		{
			$(this).css({backgroundImage:"url(template/images/nav/bgBottone.jpg)"})
		});
	
		
		
		
	//ANCORE

	$('a[href*=#]').click(function(event) {
								   
		event.preventDefault();
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target   || $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				$('html,body').animate({scrollTop: targetOffset}, 800);
				return false;
	   		}
	 	}
  });
   		
			
			
	
	
	
	if(thisP=="home"){
	$('#slider').s3Slider({
            timeOut: 6000
        });
	}
	
	
	});
 
 
 
 
 
 
 



