var globale=false;
function chiudi()
{
	var testo;
	var divNew=document.getElementById("divInvisibile");
	var divOld=document.getElementById("navigazione");

	divNew.style.display="block";
	divOld.style.display="none";
}

function apri()
{
	var divNew=document.getElementById("divInvisibile");
	var divOld=document.getElementById("navigazione");
	divNew.style.display="none";
	divOld.style.display="block";
	divOld.style.zIndex="0"
}


function cambiaPiano()
{
	var el=document.getElementById("tastoPiano");
	if (!globale)
	{
		var el2=document.getElementById("navigazione");
		el2.style.zIndex="2";
		el.style.borderStyle="outset";
		el.setAttribute("title","Porta in secondo piano");
		globale=true;
	}
	else if (globale)
	{
		var el2=document.getElementById("navigazione");
		el2.style.zIndex="0";
		el.style.borderStyle="inset";
		el.setAttribute("title","Porta in primo piano");
		globale=false;
	}
	
}

function chiudiAiuto()
{
	var el=document.getElementById("aiuto");
		el.style.display="none";
}

function apriAiuto()
{
	var el=document.getElementById("aiuto");
	var e=getPageSize();
	el.style.top=Math.round((e[3]/2)-150) + "px";
	el.style.left=Math.round((e[0]/2)-350) + "px";
	el.style.display="block";
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ 
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { 
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) {
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { 
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { 
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}











