var loginDown = false;

$(document).ready(function(){
	$("#menu_login").click(function(){ toggleLogin(); });
	
	$("#menu_logout").click(function(){	
		$.ajax({ url: "logout.php" });
		$("#menu_login").css("display","inline");
		$("#menu_logout").css("display","none");
		});
		
	$("a[rel^='prettyphoto']").prettyPhoto();

});

function sottomenu(id) {
	var options = {};
if ($('#ts'+id).is(":hidden"))
   {
	$('.togglesection').hide();
	$('#ts'+id).toggle("slide",options,500);
	$("#menu_sezioni > li > a").each(function(){ this.style.color="white";});
	document.getElementById('a'+id).style.color = "#000";
   } else {
	$('#ts'+id).toggle("slide",options,500);
	document.getElementById('a'+id).style.color = "#FFF";
   }
};

function sottoapp() {
	var options = {};
if ($('#ts_appro').is(":hidden"))
   {
	$('.togglesection').hide();
	$('#ts_appro').toggle("slide",options,500);
	$("#menu_sezioni > li > a").each(function(){ this.style.color="white"; });
	document.getElementById('menuappro').style.color = "#000";
   } else {
	$('#ts_appro').toggle("slide",options,500);
	document.getElementById('menuappro').style.color = "#FFF";
   }
};

function sottorubriche() {
	var options = {};
if ($('#ts_rub').is(":hidden"))
   {
	$('.togglesection').hide();
	$('#ts_rub').toggle("slide",options,500);
	$("#menu_sezioni > li > a").each(function(){ this.style.color="white"; });
	document.getElementById('menurub').style.color = "#000";
   } else {
	$('#ts_rub').toggle("slide",options,500);
	document.getElementById('menurub').style.color = "#FFF";
   }
};

function toggleLogin(){
	if (!loginDown){
		$("#panelWrapper").animate({height:"80px"}, {duration: 400, easing: "easeInOutQuint"});
		loginDown = true;
	}else{		
		$("#panelWrapper").animate({height:"0px"}, {duration: 400, easing: "easeInOutQuint"});
		loginDown = false;
	}
}

function risoluzione() {
var larghezza = window.screen.width;
if (larghezza >= 1280) {
	document.getElementById('container').style.left = "50%";
	document.getElementById('container').style.marginLeft = "-590px";
	}
}
