
var Pulsante = "";
//var Menu;
var su = false;
var LastAvvio = "";

var nome=(navigator.appName=="Microsoft Internet Explorer")?true:false;
var wt=nome?(navigator.appVersion.split(';').toString().split(" ").toString().split(',')[4] ):null;
var isie5=((wt)>=5 && nome)?true:false;
var isie4=((wt <5 && wt >=4) && nome)?true:false;
var isNS4=(document.layers)?true:false;
var isNS6=document.getElementById && (navigator.appName=="Netscape")?true:false;

var ax=0;
var ay=0;

var req;

var yyns4=window.Event?true:false;
if (yyns4) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = move;

//window.onresize = Res;


function PRODOTTIELENCO_DoFSCommand(command, args) {
alert("nbbnbn");
  if (command == "ApriFinestra") {
    loadXMLDoc(args);
  }
}


function loadXMLDoc(url) {
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", url, true);
        req.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send();
        }
    }
}


function processReqChange() {
    // only if req shows "complete"
	//alert("Stato");
    if (req.readyState == 4) {
		document.getElementById("MSGPOP").innerHTML = req.responseText;
		MSGVIS('vero');        
		if (req.status == 200) {
            //alert("Caricamento...");
        } else {
            alert("There was a problem retrieving the XML data:\n" + req.statusText);
        }
	}
}

function Res(){
            //document.getElementById('MSGPOP').width=400;
			//alert(document.getElementById('MSGPOP').width);
//alert(document.getElementById('MSGPOP').style.left);
alert(document.getElementById('MSGPOP').style.position);
   if (document.layers) 
      { 
	  //alert("layers");
      document.layers['MSGPOP'].width=400; 
      document.layers['MSGPOP'].pageX =(window.innerWidth/2)-(document.layers['MSGPOP'].width/2); 
      } 
   else 
      if (document.all) 
         { 
	  //alert("all");
         document.all.MSGPOP.width=400; 
         document.all.MSGPOP.style.posLeft =(document.body.clientWidth/2)-(document.all.MSGPOP.width/2); 
         } 
      else 
         if (document.getElementById && (navigator.userAgent.indexOf("gecko")==-1)) 
            { 
            //document.getElementById('MSGPOP').width= 200; 
            document.getElementById('MSGPOP').style.left = (window.innerWidth/2)-(document.getElementById('MSGPOP').width/2); 
	  		//alert("get");
            } 
			

 }

function move(e){
   if (isie4 || isie5)ax=window.event.clientX+document.body.scrollLeft, ay=window.event.clientY+document.body.scrollTop;
   else if (isNS4 || isNS6)ax=e.pageX, ay=e.pageY;
   return ax;ay;
 }


	function MSGVISMOUSE(az) {
	//alert(nome);
		if (az=="falso") {
			document.getElementById("MSGPOP").style.visibility= "hidden";
		}
		if (az=="vero") {
			document.getElementById("MSGPOP").style.visibility= "visible"; 
			//XX = (screen.availHeight/2)-200
			//YY = (screen.availWidth/2)-110
			//alert(ax);
			//document.getElementById("MSGPOP").style.left= ax+"px"; //ax; 
			//document.getElementById("MSGPOP").style.top= ay+"px"; //ay; 
		}
	} 

	function MSGVIS(az) {
	//alert(nome);
		if (az=="falso") {
			document.getElementById("MSGPOP").style.visibility= "hidden";
			document.getElementById("MMM").style.zIndex= "2";
			document.getElementById("MSGPOP").style.zIndex= "500";
		}
		if (az=="vero") {
			document.getElementById("MSGPOP").style.visibility= "visible";
			document.getElementById("MMM").style.zIndex= "2";
			document.getElementById("MSGPOP").style.zIndex= "500";
			//Res();
		}
	}
	
  function QualePulsante() {
	var IE = navigator.appName.indexOf("Microsoft") != -1;
	var filmato = IE ? window.Menu01 : window.document.Menu01;
	return(filmato.GetVariable("Puls"));
	}

  function SetPulsante(quale) {
	Pulsante = quale;
	//alert(QualePulsante() + " - " + Pulsante);
	}
 
    function NascondiLayerDaTendina(L,Stato)
	{
				var id = L;
				var IE = navigator.appName.indexOf("Microsoft") != -1;
				var filmato = IE ? window.Menu01 : window.document.Menu01;	
				if (Stato == "on") {
					Pulsante = L;
				} else {
					Pulsante = "";	
				}		
					NascondiLayer(L , Stato);
				//alert(filmato.GetVariable("su"));
				if (filmato.GetVariable("su") == "false") { 
				}
    }
	
    function NascondiLayerDaFlash(L,Stato)
    {
		if (Stato == "on") {
			PulsanteF = L;
		} else {
			PulsanteF = "";	
		}		
		
		if (Pulsante == "") { 
			NascondiLayer(L , Stato);
		}
    }
	
    function NascondiLayerEsegui(L,Stato) 
    {
				var id = L
				if (Stato == "on") {
					mode = "show";
				} else {
					mode = "hidden";
				}
				
				
			  var NNtype = (mode == "show") ? mode : "hidden";
			  var IEtype = (mode == "show") ? "visible" : "hidden";
			  var WC3type = (mode == "show") ? "visible" : "hidden";
			  if (document.getElementById) {
					//eval("document.getElementById(id).style.visibility=\"" + WC3type + "\"");
					//alert(id);
				eval("document.getElementById(id).style.visibility=\"" + WC3type + "\"");
				//eval("document.getElementById(id).style.z-index=500");
			  } else {
					if (document.layers) {
						  document.layers[id].visibility = NNtype;
						  //document.layers[id].z-index = 500;
					} else {
						  if (document.all) {
								eval("document.all." + id + ".style.visibility=\"" + IEtype + "\"");
								//eval("document.all." + id + ".style.z-index=500");
						  }
					}
			  }
	  }
	  
    function NascondiLayer(L,Stato) {
	//alert("prova da Opera");
	for (var i = 1; i <= 2; i++) {
		V = "P" + i;
		//alert(V); 
		if (V == L) {
			NascondiLayerEsegui("P" + i,Stato);
			  if (L != LastAvvio) {
				  avviaFilmato("t" + L.substring(2,1));
				  LastAvvio = L;
			  }
			} else  {
			//alert(L);
			NascondiLayerEsegui("P" + i,"off");
		}
	}
	}



	function avviaFilmato(N) {
	
        var IE = navigator.appName.indexOf("Microsoft") != -1;
        var filmato = IE ? eval("window." + N) : eval("window.document." + N);
    	filmato.Play();

	}


	function SwitchLingua(IdLingua) {
	
	alert("Switch " + IdLingua);
    	window.open("switchlingua.asp?IdLingua=" + IdLingua,"");

	}
	



