var requiredJvmBuild = "3309";
var gStatus = 0;
var waitCounter = 0;
var canWork = true;
var nextComponent='Sistema Operativo';
var nextComponentHelp='help-OS.html';
var currComponent='';
var checkedList='';
var lastError='';
var details='';
var destinazione='';
var formErrors = 1;

function setDefault() {
  if (document.loginForm.useCRP.checked==false &&
      document.loginForm.useEllips.checked==false &&
      document.loginForm.useSSL.checked==false)Sign
  {
         document.loginForm.useCRP.checked=true;  
  }
}

function JumpHandler(list) {
 if (document.EllipsLoginForm.sunjvm.value=="1") {
     jumpPrfx = '/CA/Start/EllipsPlugin-';
 } else {
     jumpPrfx = '/CA/Start/Ellips-';
 }
 window.location.href = jumpPrfx+list.options[list.selectedIndex].value;
}
 
function setUseCRP(o) {
  if (o.checked == true) {
     document.loginForm.useCRP.value="1";
     document.loginForm.useEllips.value="0";
     document.loginForm.useSSL.value="0";
     document.loginForm.useSSL.checked=false;
     document.loginForm.useEllips.checked=false;
     sc = document.getElementById('SimpleCredentials1');
     sc.style.display='block';
     sc = document.getElementById('SimpleCredentials2');
     sc.style.display='block';
     setPermanentCookie("ACTALIS-SPA-SP-useCRP", "1");
     setPermanentCookie("ACTALIS-SPA-SP-useSSL", "0");
     setPermanentCookie("ACTALIS-SPA-SP-useEllips", "0");
     alert("Accesso mediante Utente-CRP attivato.");
  }   
  else {
       document.loginForm.useCRP.value="0";
       setPermanentCookie("ACTALIS-SPA-SP-"+o.name, "0");
  }
}


function setUseSSL(o) {
  if (o.checked == true) {
     document.loginForm.useSSL.value="1";
     document.loginForm.useEllips.value="0";
     document.loginForm.useEllips.checked=false;
     document.loginForm.useCRP.checked=false;
     sc = document.getElementById('SimpleCredentials1');
     sc.style.display='none';
     sc = document.getElementById('SimpleCredentials2');
     sc.style.display='none'; 
     setPermanentCookie("ACTALIS-SPA-SP-useSSL", "1");
     setPermanentCookie("ACTALIS-SPA-SP-useEllips", "0");
     alert("Accesso mediante SSL attivato.");
     setPermanentCookie("ACTALIS-SPA-SP-useCRP", "0");
  }   
  else {
       document.loginForm.useEllips.value="0";
       setPermanentCookie("ACTALIS-SPA-SP-"+o.name, "0");
       if (document.loginForm.useEllips.checked==false) {
         sc = document.getElementById('SimpleCredentials1');
         sc.style.display='block';
         sc = document.getElementById('SimpleCredentials2');
         sc.style.display='block';
       }
  }
}


function setUseEllips(o) {
  if (o.checked == true) {
     document.loginForm.useEllips.value="1";
     document.loginForm.useSSL.value="0";
     document.loginForm.useSSL.checked=false;
     document.loginForm.useCRP.value="0";
     document.loginForm.useCRP.checked=false;

     sc = document.getElementById('SimpleCredentials1');
     sc.style.display='none';
     sc = document.getElementById('SimpleCredentials2');
     sc.style.display='none'; 
     setPermanentCookie("ACTALIS-SPA-SP-useSSL", "0");
     setPermanentCookie("ACTALIS-SPA-SP-useCRP", "0");
     setPermanentCookie("ACTALIS-SPA-SP-useEllips", "1");
     alert("Accesso mediante Firma Digitale attivato.");
  }   
  else {
       document.loginForm.useEllips.value="0";
       setPermanentCookie("ACTALIS-SPA-SP-"+o.name, "0");
       if (document.loginForm.useEllips.checked==false) {
         sc = document.getElementById('SimpleCredentials1');
         sc.style.display='block';
         sc = document.getElementById('SimpleCredentials2');
         sc.style.display='block';
       }
  }
}

function setUseJavaPlugin(o) {
  if (o.checked == true) {
     document.EllipsLoginForm.sunjvm.value="1";
     document.loginForm.sunjvm.value="1";
     setPermanentCookie("ACTALIS-SPA-SP-"+o.name, "1");
     alert("Sun Java Plug-in abilitato.");
  }   
  else {
       document.EllipsLoginForm.sunjvm.value="0";
       document.loginForm.sunjvm.value="0";
       setPermanentCookie("ACTALIS-SPA-SP-"+o.name, "0");
       alert("Sun Java Plug-in disabilitato.\nVerra' utilizzata la Java VM nativa del browser.");
  }
}

function EllipsLogin() {

   if (document.EllipsLoginForm.sunjvm.value != "1") 
   {
      // autoCheckEnvWithCookie("/CA/LoginEllips");
      autoCheckEnvWithCookie("/CA/CertificateLogin");
      document.EllipsLoginForm.submit();
   }
   else {
     document.location="/CA/LoginEllipsPlugin";
   }
}


function validate( object, strexp )
{
    if (document.all) // IE
    {
    var strvalue = object.value;
    var regexp = new RegExp( "^" + strexp + "$" );
     
    if ( regexp.test( strvalue ) )
    {
        object.style.borderColor = "#004080";
        object.style.backgroundColor = "#E0E0E0";
        formErrors=0
    }
    else
    {
        object.style.borderColor = "#FF0000";
        object.style.backgroundColor = "#FFFFFF";
        formErrors=1
    }
    } else formErrors=0;
    
}

function checkAndGo() {
 if (document.loginForm.useEllips.checked==true) {
    EllipsLogin();
    return true;
 }
 if (document.loginForm.useSSL.checked==true) {
     document.location=document.SSLLoginForm.action;
     //document.SSLLoginForm.submit();
 }
 if (formErrors == 0)
 {
    // autoCheckEnvWithCookie("");  
    document.loginForm.submit();
 }
 else {
    return;
 }
}

function searchCertificates() {
 validate(document.searchCertificateForm.name, '[a-zA-Z]{2,20}')
 if (formErrors == 1) {
        alert("Controllare il campo Nome.\nIl campo e' obbligatorio.\nSono ammessi solo caratteri alfabetici.");
        return;
 }
 validate(document.searchCertificateForm.surname, '[a-zA-Z]{2,20}')
 if (formErrors == 1) {
        alert("Controllare il campo Cognome.\nIl campo e' obbligatorio.\nSono ammessi solo caratteri alfabetici.");
        return;
 }

 document.searchCertificateForm.submit();
}


function confirmDialog(msg, location) {

   if(confirm(msg)) {
      document.location=location;
   }
}

function initPageDefaults(){
  forms = document.forms;
  for (f=0; f<forms.length; f++) {
      form = forms[f];
      for (e=0; e<form.elements.length; e++) {
         elm = form[e];
         getUserPreferences(elm);
      }
  }
}

function getUserPreferences(o) {
  disableSimpleLogin=false;
  value = getCookie("ACTALIS-SPA-SP-"+o.name);
  if (value == null){
     if (o.name=="useSunjvm") {
        o.checked=true;
        document.EllipsLoginForm.sunjvm.value="1";
        document.loginForm.sunjvm.value="1";
    }
    return;
  }
  if (value == "1") { 
    if (o.name=="useSunjvm") {
         o.checked=true;
         document.EllipsLoginForm.sunjvm.value="1";
         document.loginForm.sunjvm.value="1";
    }
    else if (o.name=='useEllips') {
       document.loginForm.useEllips.checked=true;
       disableSimpleLogin=true;
    }
    else if (o.name=='useSSL') {
       document.loginForm.useSSL.checked=true;
       disableSimpleLogin=true;
    }
    else if (o.name=='useCRP') {
       document.loginForm.useCRP.checked=true;
       disableSimpleLogin=false;
    }

   }
   else {
    if (o.name=="useSunjvm") {
         o.checked=false;
         document.EllipsLoginForm.sunjvm.value="0";
         document.loginForm.sunjvm.value="0";
    }
    else if (o.name=='useSSL') {
       document.loginForm.useSSL.checked=false;
    }
    else if (o.name=='useEllips') {
       document.loginForm.useEllips.checked=false;
    }
    else if (o.name=='useCRP') {
       document.loginForm.useCRP.checked=false;
    }
   }
   if (disableSimpleLogin) {
     sc = document.getElementById('SimpleCredentials1');
     sc.style.display='none';
     sc = document.getElementById('SimpleCredentials2');
     sc.style.display='none'; 
   }
   return value
}

function centerWindow(page_location, page_name, dimx, dimy, options) {
    var rv="";
    if (document.all)
        var xMax = screen.width, yMax = screen.height;
    else
        if (document.layers)
            var xMax = window.outerWidth, yMax = window.outerHeight;
        else
            var xMax = 640, yMax=480;

    var xOffset = (xMax - dimx)/2, yOffset = (yMax - dimy)/2;
    if (document.all) // IE - ModalDialog
    {
    rv=window.showModalDialog(page_location, "", "center:yes; dialogHeight: "+dimy+"px; dialogWidth: "+dimx+"px; status:no; edge: sunken");
          
    }
    else
    {
    window.open(page_location, page_name,
          'width='+dimx+
          ',height='+dimy+
          ',screenX='+xOffset+
          ',screenY='+yOffset+
          ',top='+yOffset+
          ',left='+xOffset+'; '+options);

    }
    return rv;
}


function getCookie(name)
{
        var dcookie = document.cookie;
        var cname = name + "=";
        var clen = dcookie.length;
        var cbegin = 0;
        while (cbegin < clen)
        {
                var vbegin = cbegin + cname.length;
                if (dcookie.substring(cbegin, vbegin) == cname)
                {
                        var vend=dcookie.indexOf(";", vbegin);
                        if (vend == -1) vend=clen;
                        return unescape(dcookie.substring(vbegin, vend));
                }
                cbegin=dcookie.indexOf(" ", cbegin) + 1;
                if (cbegin == 0) break;
        }
        return null;
}

function ExecutionEnv()
{
  if (navigator.appName.indexOf("Netscape")!=-1) {
 	this.jvmBuild = "4000";	
  }
  else {
      if (window.document.MSJVMapplet != null) {
  	    this.jvmBuild = window.document.MSJVMapplet.getJVMBuild();
	    this.jvmProvider='MS';
      } 
	else
	{
	    this.jvmProvider='SUN';
	    this.jvbBuild="000";
	}
  }
}

function checkJavascript ()
{
	canWork=false;
	canWork=true;
}
function checkJVM ()
{
	canWork = false;
	var env = new ExecutionEnv();
	var is = new Is();
	if (env.jvmBuild < requiredJvmBuild) 
	{
		if (!is.win2k)
		{
		errorMsg(
 		"E' necessario aggiornare la Java Virtual Machine.<br><br>"+
		"Versione rilevata: " + env.jvmBuild + "<br>" +
		"Versione minima richiesta: "+  requiredJvmBuild
		);
		canWork = true;
		return (false);
		}
		else
		{
 		  errorMsg( 
		   "E' necessario installare l'ultimo  Service Pack di Windows 2000.<br><br>"+
		   "Versione rilevata: " + env.jvmBuild + "<br>" +
		   "Versione minima richiesta: "+  requiredJvmBuild);
		  canWork = true;
		  return (false);
		}
	}
	canWork = true;
	return (true);
}

function checkSessionCookie ()
{
	canWork = false;
	var okFlag = false;
      setCookie('ACTALIS-SPA-CA-SESSION-TESTCOOKIE', "OK");
      if (getCookie('ACTALIS-SPA-CA-SESSION-TESTCOOKIE') != "OK")
      {
             okFlag=false;
	}
      else
      {
            okFlag=true;
	}
	
      if (!okFlag) 
	{
 	  errorMsg( 
	  "E' necessario attivare i cookie di sessione.<br><br>"+
	  "Impossibile proseguire.");
	  canWork = true;
	  return (false);
	}
	canWork = true;
	return (true);
}

function checkPermanentCookie ()
{
	canWork = false;
	var okFlag = false;
      setPermanentCookie('ACTALIS-SPA-CA-TESTCOOKIE', "OK");
      if (getCookie('ACTALIS-SPA-CA-TESTCOOKIE') != "OK")
      {
            okFlag=false;
      }
      else
      {
           okFlag=true;
           setPermanentCookie('ACTALIS-SPA-CA-TESTCOOKIE', "");
	}
	if (!okFlag) 
	{
   	  errorMsg(
  	  "E' necessario attivare i cookie permanenti.<br><br>"+
	  "Impossibile proseguire.");
        canWork = true;
	  return (false);
	}
	canWork = true;
	return (true);
}

function checkOS ()
{
	canWork = false;
	var okFlag = false;
	var is = new Is();
      if (is.win) 
	{
               okFlag = true;
        }
       else
       {
               okFlag=false;
        }
	if (!okFlag) 
	{
	errorMsg(
	  "Il sistema Operativo in uso non e' supportato.<br><br>"+
	  "Impossibile proseguire.<br>"+
	  "Versione rilevata: " + is.major 
      );
	canWork = true;
	return (false);
	}
	canWork = true;
	return (true);
}

function autoCheckEnvNS(dest) {
	var is = new Is();
	if (is.nav6 || is.nav6up) 
	{
	  errorMsg(
   	      "Il Browser Netscape 6 non e' attualmente supportato.\n\n"+
		"\nImpossibile proseguire.\n\n");
	  alert(lastError);
	  canWork = true;
	}
	if (gStatus == 0)
	{
		gStatus++;
		setTimeout ("autoCheckEnvNS()", 1000);
	}
	else 
	{
		document.location = "ok.html"
	}
}

function autoCheckEnvWithCookie(dest, typeFlag) {
        var is = new Is();
        destinazione=dest;
        if (getCookie('ACTALIS-SPA-SP-CHECKENV') == "DONE")
        {
            return
        }
        cursorWait(true);
        if (is.nav) {
            document.location="/Common/CheckEnvironment/CheckEnv_html";
           return
        }
        else {
              centerWindow("/Common/CheckEnvironment/CheckEnv_html", "", 400,400,"");
       }
}


function autoCheckEnv(dest) {
        var is = new Is();
        destinazione=dest;
        cursorWait(true);
        if (is.nav) {
              document.location="CheckEnvNS_html";
              return
        }
        else {
              centerWindow("CheckEnvIE_html", "", 400,400,"");
              window.close();
        }
}


function autoCheckEnvIE(dest) 
{
	exitFlag = false;
	jump=false;
	var is = new Is();
        destinazione=dest;


	cHelp="javascript:Help('"+'HelpDocs/'+nextComponentHelp+"')";
        if (is.nav) {
      	  document.checkarea.innerHTML=checkedList+'<b><a class="information" href="'+cHelp+'">'+nextComponent+'</a></b>';
        }
	else
	{
	   	checkarea.innerHTML=checkedList+'<b><a class="information" href="#" onclick="'+cHelp+'">'+nextComponent+'</a></b>';
	}
	currComponent=nextComponent;
	if (canWork == true)
	{
	switch (gStatus) 
	{
		case 0:
			nextComponentHelp='help-Browser_html';
			nextComponent='Browser';
			if (!checkOS()) 
			{
				exitFlag = true;
			}
		break;
		case 1:
	             nextComponentHelp='help-java_html';
		     nextComponent='Java VM';
		     if (!checkBrowser()) 
	             {
				exitFlag = true;
		     }
		break;
		case 2:
			nextComponent='Cookie di sessione';
			nextComponentHelp='help-session-cookie_html';
			if (!checkJVM()) 
			{
				exitFlag = true;
			}
		break;
		
		case 3:
			nextComponent='Cookie permanenti';
			nextComponentHelp='help-permanent-cookie_html'
			if (!checkSessionCookie())
			{
				exitFlag = true;
			}
		break;

		case 4:
			nextComponent='';
			currComponentHelp='help-permanent-cookie_html'
			if (!checkPermanentCookie()) 
			{
				exitFlag = true;
			}
		break;

		default:
			exitFlag = true;
			jump=true;
		break;
	}
	}
	if (jump == true) {
                setPermanentCookie('ACTALIS-SPA-SP-CHECKENV', "DONE");
                cursorWait(false);
                if(is.nav) {
		   document.location=destinazione;
                }
                else
                {
                   centerWindow(destinazione, "", 415,415,"");
                   window.close();
                }
	}
      if (exitFlag == false) 
	{
		if (currComponent != '') {
		   checkedList=checkedList+currComponent+'&nbsp;&nbsp;<font size="-1" color=green><b>OK</b></font><br>';
		}
	}
	if (exitFlag == false) 
	{
		gStatus++;
		setTimeout ("autoCheckEnvIE(destinazione)", 1500);
	}
	else 
	{
                if (gStatus <= 4) {
		cHelp="vascript:Help('"+nextComponentHelp+"')";
		if (is.ie) {
			checkarea.innerHTML=checkedList+'<b><a href="'+'/start/'+cHelp+'">'+currComponent+'</a>&nbsp;&nbsp;<font size="+2"color=red>X</b></font></b>&nbsp;[&nbsp;<a href="javascript:helpDetails()"><font size="-1">Dettagli problema</font></a>&nbsp;]&nbsp;&nbsp;[&nbsp;<a href="javascript:skiperror()"><font size="-1">Ignora</font></a>&nbsp;]';
		}
		else {
			document.checkarea=checkedList+'<b><a href="'+'/start/'+cHelp+'">'+currComponent+'</a>&nbsp;&nbsp;<font size="+2"color=red>X</b></font></b>';
		}
		}
	}

}

function Is ()
{   
    var agt=navigator.userAgent.toLowerCase();
    
    this.agtstring = agt;
    this.agtstring= "kald";
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.nav   = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1)));
//MSIE
    this.ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    this.ie3    = (this.ie && (this.major < 4));
    this.ie4    = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) );
    this.ie4up  = (this.ie && (this.major >= 4));
    this.ie5    = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    this.ie5_5  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1));
    this.ie5_5  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1));
    this.ie5up  = (this.ie && !this.ie3 && !this.ie4);
    this.ie5_5up= (this.ie && !this.ie3 && !this.ie4 && !this.ie5);
    this.ie6    = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.")!=-1) );
    this.ie6up  = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5);
//Netscape Navigator
    this.nav    = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));  
    this.nav2   = (this.nav && (this.major == 2));
    this.nav3   = (this.nav && (this.major == 3));
    this.nav4   = (this.nav && (this.major == 4));
    this.nav4up = (this.nav && (this.major >= 4));
    this.navonly= (this.nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );
    this.nav6   = (this.nav && (this.major == 5));
    this.nav6up = (this.nav && (this.major >= 5));
    this.gecko  = (agt.indexOf('gecko') != -1);
//Opera
    this.opera    = (agt.indexOf("opera") != -1);
    this.opera2   = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
    this.opera3   = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
    this.opera4   = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
    this.opera5   = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
    this.opera5up = (this.opera && !this.opera2 && !this.opera3 && !this.opera4);
    this.opera6   = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1);
//Javascript
    if (this.nav2 || this.ie3) this.js = 1.0;
    else if (this.nav3) this.js = 1.1;
    else if (this.opera5up) this.js = 1.3;
    else if (this.opera) this.js = 1.1;
    else if ((this.nav4 && (this.minor <= 4.05)) || this.ie4) this.js = 1.2;
    else if ((this.nav4 && (this.minor > 4.05)) || this.ie5) this.js = 1.3;
    else if (this.nav6 || this.gecko) this.js = 1.5;
    else if (this.nav6up) this.js = 1.5;
    else if (this.ie5up) this.js = 1.3;
//Operating System
    this.win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
    this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
    this.win16 = ((agt.indexOf("win16")!=-1) || 
               (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
               (agt.indexOf("windows 16-bit")!=-1) );  
    this.win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
                    (agt.indexOf("windows 16-bit")!=-1));

    this.winme = ((agt.indexOf("win 9x 4.90")!=-1));
    this.win2k = ((agt.indexOf("windows nt 5.0")!=-1));

    this.win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
    this.winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
    this.win32 = (this.win95 || this.winnt || this.win98 || 
                 ((this.major >= 4) && (navigator.platform == "Win32")) ||
                 (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

    this.os2   = ((agt.indexOf("os/2")!=-1) || 
                 (navigator.appVersion.indexOf("OS/2")!=-1) ||   
                 (agt.indexOf("ibm-webexplorer")!=-1));

    this.mac    = (agt.indexOf("mac")!=-1);
    if (this.mac && this.ie5up) this.js = 1.4;
    this.mac68k = (this.mac && ((agt.indexOf("68k")!=-1) || (agt.indexOf("68000")!=-1)));
    this.macppc = (this.mac && ((agt.indexOf("ppc")!=-1) || (agt.indexOf("powerpc")!=-1)));


}
function checkBrowser() 
{
	canWork = false;
	var okFlag = false;
	var is = new Is();
        if (is.win) {
  	if (is.nav) { 
	     if (is.nav4up) {
		   	  if (getCookie('SIA-SPA-Secure Server Root installed') == null) {
		  	  okFlag = false;
			  }
			  else 
			  {
			  okFlag = true;
			  }
	     }  
	     else
	     {
	     details = "utilizzare una versione differente di browser; la versione di Netscape rilevata non e' attualmente supportata.>";
	     }
	}
	else
	if (is.ie)
	{
	  if (is.ie5 || is.ie5_5up || is.ie6up) {
		okFlag = true;
	  }			
	 else
	 {
	 details = "Aggiornare il browser; la versione di Explorer utilizzata e' troppo vecchia.";
         }
       }
       else	 
       {
	  details ="Utilizzare Explorer o Netscape; il browser rilevato non e' attualmente supportato.";
	  okFlag=false;
       }
       }
       if (!okFlag)                                                              
       {
	  errorMsg(                                                                         
          "Il Browser in uso non e' supportato.<br><br>"+           
          "Impossibile proseguire.<br><br>"+                                  
           details
	  );                               
       canWork = true;                                                   
       return (false);                                                   
       }                                                                         
       canWork = true;                                                           
       return(true);
}
function setPermanentCookie(name, value) {
		 var today = new Date();
		 var expires = new Date();
		 expires.setTime(today.getTime() + 5000*60*60*24*365)
		 document.cookie=name+"="+escape(value)+";EXPIRES="+expires.toGMTString()+";DOMAIN="+escape(".actalis.it")+ ";PATH="+escape("/"); 
}
function setCookie(name, value)
{
        document.cookie = name +"="+escape(value)+"; path=/";
}


function helpDetails() {
	detailsWindow = window.open("","detailsWindow",'toolbar=no,scrollbars=yes,resizable=yes,width="50%",height="50%"');
        detailsWindow.document.writeln('<html>');
        detailsWindow.document.writeln('<body>');
        detailsWindow.document.writeln('<b>Dettagli problema:</b><br><br>');
        detailsWindow.document.writeln('<font face="Thaoma,Arial">');
        detailsWindow.document.writeln(lastError);
        detailsWindow.document.writeln('</font>');
        detailsWindow.document.writeln('<br><br>');
        detailsWindow.document.writeln('<a href="javascript:window.close()"><font face="Tahoma,Arial">Chiudi</font></a>');

        detailsWindow.document.writeln('</body></html>');
}

function errorMsg(msg) {
  lastError=msg;	
}



function Help(component)
{
	helpWindow = window.open(component,"helpWindow","height=500,width=800,toolbar=no,scrollbars=1,resizable=1");
}

function skiperror() {
	gStatus++;
	exitFlag=false;
	canWork=true;
	autoCheckEnv2(destinazione);
}


function cursorWait(stateFlag)
{
   if (stateFlag == true)
   {
   	if ( navigator.appName.indexOf("Netscape")==-1)
   	{
        	document.body.style.cursor="wait";
   	}
   }
   else
      {
        if ( navigator.appName.indexOf("Netscape")==-1)
        {
                document.body.style.cursor="default";
        }
   } 
}
