//Funzione iniziale in Index e Prodotti
function ACDinit()
{
	jQuery.fn.fadeTo = function(speed,to,callback) { 
    return this.animate({opacity: to}, speed, function() { 
        if (to == 1 && jQuery.browser.msie)  
            this.style.removeAttribute('filter');  
        if (jQuery.isFunction(callback)) 
            callback();  
    }); 
	}; 
	animaMenu();
	//nascondo le voci del menu

	$('.contentLi').animate({
			 marginTop: "50px",
			 marginBottom: "0px"
			}, 0, function() {
    		// Animation complete.
  	});
	
	$('.contentLi a').fadeTo(0,1);			
	
	$("#contentList li a").hover(
	  function () 
	  {
		$(this).stop(true);

	 //	alert($(this).parent().parents('h1:eq(0)').html())
	    	$(this).fadeTo(500,0.5)
	  }, 
	  function () 
	  {
		  $(this).stop(true);
		  $(this).fadeTo(400,0)
	  }
	);
}

function entrataBlocchiMenu(id)
{
    $('#content'+id+" a").fadeTo(400,0);
    //$("#content"+id).show();
    $('#content'+id).animate({
     marginBottom: "50px",
     marginTop: "0px"
    }, 300, function() {
      entrataBlocchiMenu((id+1))
          });
}

function animaMenu()
{
	$(".menuTitle").hover(
	  function () 
	  {
		$(this).stop(true);
	    	$(this).fadeTo(200,0.5)
	  }, 
	  function () 
	  {
		  $(this).stop(true);
		  $(this).fadeTo(500,1)
	  }
	);
}


function lineaRossa()
{
	 $('#lineaRossa').animate({
	    width: '990px'
	  }, {
	    duration: 500, 
	    complete: function() {
	      
	    }
	  });
}

var urlChiusura;

function chiudi(_url)
{
	urlChiusura = _url
	$('#footer').fadeOut(100);
	$('#body').fadeOut(300, function(){
		//alert(urlChiusura)
		open(urlChiusura, "_self");
		urlChiusura = "";
	})
}

function chiudiHome(_url)
{
	alert("Sito in aggiornamento");
  return void(0);
  /*
  urlChiusura = _url;
	uscitaBlocchiMenuHome(1)
  */
}

function uscitaBlocchiMenuHome(id)
{
	if (jQuery.support.opacity) {
	
		//
		//$("#content"+id).show();
		$('#content'+id).animate({
		opacity: '0',
		 marginBottom: "0px",
		 marginTop: "50px"
		}, 100, function() {
		$('#content'+id+"").fadeOut();
   		uscitaBlocchiMenuHome((id+1))
   		if(id == 4)
   		{
   			open(urlChiusura, "_self");
			urlChiusura = "";
   		}
 		});
 	}
 	else
 	{
	
		//
		//$("#content"+id).show();
		$('#content'+id).animate({
		filter: 'alpha(opacity=100)',
		 marginBottom: "0px",
		 marginTop: "50px"
		}, 100, function() {
		$('#content'+id+"").fadeOut();
   		uscitaBlocchiMenuHome((id+1))
   		if(id == 4)
   		{
   			open(urlChiusura, "_self");
			urlChiusura = "";
   		}
 		});
 	}
}

//funzione che apre il form per l'iscrizione
function apriIscrizione()
{
	open("n_login.php", "_self");	
}

