// JavaScript Document

var t;

function ApriMenu(i)
{
if (t){clearTimeout(t)}
    document.getElementById("SM1").style.visibility = "hidden";
    document.getElementById("SM2").style.visibility = "hidden";
    document.getElementById("SM3").style.visibility = "hidden";
    document.getElementById("SM4").style.visibility = "hidden";
    document.getElementById("SM5").style.visibility = "hidden";
    
    document.getElementById("SM" + i).style.top = "30px";
	document.getElementById("SM" + i).style.visibility = "visible";
	document.getElementById("menu-2").style.visibility = "visible";
}
function ChiudiMenu(i)
{
   t = setTimeout("ChiudiMenuDelay("+i+")",300);
}
function ChiudiMenuDelay(i){
document.getElementById("SM" + i).style.visibility = "hidden";
	document.getElementById("menu-2").style.visibility = "hidden";
}

function mostraNascondi(oggetto){
	var a;
	if (document.getElementById(oggetto).style.visibility=="visible"){
		a="hidden";
		document.getElementById("navigazione").style.visibility="visible";
	}
	if (document.getElementById(oggetto).style.visibility=="hidden"){
		a="visible";
		document.getElementById("navigazione").style.visibility="hidden";
	}
	document.getElementById(oggetto).style.visibility = a;
}

function mostra(oggetto){
	document.getElementById(oggetto).style.visibility = "visible";
}

function nascondi(oggetto){
	document.getElementById(oggetto).style.visibility = "hidden";
}

function getSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

function getScrollY() {
  scrOfY = 0;
  if( typeof( window.innerWidth) == 'number' ) {
    //Netscape compliant
    scrOfY = document.body.scrollHeight;
  } if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollHeight;
  } if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollHeight;
  }
  return scrOfY;
}

function finestraTesto(){
	var d_height = getScrollY();
	var c_height = getSize();
	var s_height=screen.height
	if (s_height > 768){
	if (c_height > d_height){
	document.getElementById("testo").style.height = (c_height - 400) + "px";
	document.getElementById("bottom-section").style.top = (c_height -40) + "px";
	document.getElementById("bottom-section").style.visibility = "visible";
	}
	}
	}

function getSize2() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return [ myWidth, myHeight ];
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function preview(cosa){
window.open(cosa+'.html', 'selection', 'fullscreen=yes,resizable=yes');
}

function centraMessaggio(mex){
if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
document.getElementById("fade").style.height = document.body.parentNode.scrollHeight + "px";
}
document.getElementById("fade").style.visibility="visible";
document.getElementById("alerts").style.top = "0px";
var wh = new Array();
wh = getSize2();
var xy = new Array();
xy = getScrollXY();
var x = wh[0]/2;
x = x - 200;
var y = (wh[1]/2)+xy[1];
y = y - 100;
document.getElementById("alerts").style.left = x+"px";
document.getElementById("alerts").style.top = y+"px";
document.getElementById("alerts").style.visibility="visible";
document.getElementById("alerts").innerHTML = mex + "<br /><br /><input type='button' value='OK' class='button' onClick=\"chiudiMessaggio()\"/>";
}

function chiudiMessaggio(){
document.getElementById("alerts").style.visibility="hidden";
document.getElementById("fade").style.visibility="hidden";
}

function allegaFile(){  
var wh = new Array();
wh = getSize2();
var xy = new Array();
xy = getScrollXY();
document.getElementById("sfoglia").style.left = ((wh[0]/2)+xy[0])-200+"px";
document.getElementById("sfoglia").style.top = ((wh[1]/2)+xy[1])-150+"px";
document.getElementById("fade").style.height = "100%";
if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
document.getElementById("fade").style.height = document.body.parentNode.scrollHeight + "px";
}
document.getElementById("fade").style.visibility='visible';
document.getElementById("sfoglia").style.visibility='visible';
void(0);
}

function popupprivacy() {
    window.open("privacy.aspx", "privacy");
}