// GLOBAL FUNCTION
var oldMenu = null;
var oldMenu2 = null;
var oldSez = null;
var c
function showMenu(id,id2,h) {
	hideMenu();
	document.getElementById(id).style.display="block";
	oldMenu = id;
}
function hideMenu() {
	clearInterval(c);
	if (oldMenu) {
		document.getElementById(oldMenu).style.display="none";
	}
}
function show(show) {
	if (oldSez) {
		document.getElementById(oldSez).style.display="none";
	}
	document.getElementById(show).style.display="block";
	oldSez = show;
}
function apriechiudi(divId) {
	var el=document.getElementById(divId);
	if(el.style.display == 'none'){
		el.style.display = 'block';
	}else{
		el.style.display = 'none';
	}
}
function startHide() {
	clearInterval(c);
	c = setInterval('hideMenu()', 1000);
}
function stopHide() {
	clearInterval(c);
}

function popupwindow(LarghezzaCont,AltezzaCont,Pagina,nome,scrol,stat) {
	var lsBrowser = navigator.appName;
	var navInfo = navigator.userAgent;
	if (scrol == "yes") {
		if (navInfo == "Mac" && lsBrowser.indexOf("Microsoft") >= 0) {
				aw = 0;
		} else {
		aw = 17;
		}		
	} else {
	aw = 0;
	}		
    var iMyWidth;
    var iMyHeight;
    var LarghezzaPagina;
    var AltezzaPagina;
    LarghezzaPagina = screen.availWidth;
    AltezzaPagina = screen.availHeight;
    LarghezzaCont=LarghezzaCont.toUpperCase()
    AltezzaCont=AltezzaCont.toUpperCase()
				
    if (LarghezzaCont == "FULL") {
            LarghezzaWindow = screen.availWidth;
        } else {
            LarghezzaWindow = parseInt(LarghezzaCont) + aw;
        }
    if (AltezzaCont == "FULL") {
            AltezzaWindow = screen.availHeight;
        } else {
            AltezzaWindow = AltezzaCont;
        }
    iMyWidth = (LarghezzaPagina/2) - (LarghezzaWindow/2);
    iMyHeight = (AltezzaPagina/2) - (AltezzaWindow/2);
    win = window.open(Pagina,nome,"height=" + AltezzaWindow + ",width="	+ LarghezzaWindow 
	+ ",menubar=0,resizable=yes,scrollbars=" + scrol + ",status=" + stat + ",titlebar=0,toolbar=0,left="
	+ iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + "");
    win.focus();
}
function flashWriter(mov,w,h){
	var swfCurrPage=mov;
	//paramtri per il flash detect
	var requiredMajorVersion = 8;// Major version of Flash required
	var requiredMinorVersion = 0;// Minor version of Flash required
	var requiredRevision = 0;// Revision of Flash required
	var jsVersion = 1.0;// the version of javascript supported
	var alternateTextSwfInsert="contenuto alternativo all'inserto flash";
	var alternateTextSwf="contenuto alternativo all'inserto flash";
	var hasRightFlashVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightFlashVersion){
		document.getElementById("flash").innerHTML=AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,19,0','width',w,'height',h,'src',swfCurrPage,'quality','high','wmode','transparent','pluginspage','http://www.macromedia.com/go/getflashplayer','movie',swfCurrPage ,'id','flashobj');
	}else{
		document.getElementById("flash").innerHTML=alternateTextSwf;
	}				
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
