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_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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//FUNZIONI MENU

jkmegamenu.definemenu("megaanchor", "megamenu1", "click")

jkmegamenu.definemenu("megaanchor2", "megamenu2", "click")




//FUNZIONI ACCESSO LOGIN

function check_sub_login() {
	var error=""
	if (document.frm_login.username.value =="")      error+="\n -  Inserire una username"
	if (document.frm_login.password.value =="")      error+="\n -  Inserire una password"

	if(error != "") {
		alert("Attenzione: " + error)
	}
	else {
		document.frm_login.submit()
	}
}


//FUNZIONI FORM PROVA GRATUITA

function formSub()
	{
	var ns = navigator.appName == "Netscape";
	if (ns) document.manda.submit()
	           else document.manda.submit()
	}

function formRst()
	{
	var ns = navigator.appName == "Netscape";
	if (ns) document.manda.reset()
	           else document.manda.reset()
	}

function EmailCheck(email)
{
var ok=true
var error=""
if ((email.length>0) && ((email.lastIndexOf("@")==-1) || (email.lastIndexOf(".")==-1))) ok = false
if (!(ok)) error="non specificata correttamente\n -  Il formato corretto č: esempio@tin.it"
return error
}

function check_sub()
{
var error=""
//OBBLIGATORI
 var ns = navigator.appName == "Netscape";

if (document.manda['nome'].value =="")		error+="\n - Nome e Cognome non inserito"
if (document.manda['telefono'].value =="")		error+="\n - Telefono non inserito"
if (document.manda['indirizzo'].value =="")		error+="\n - Indirizzo non inserito"
if (document.manda['cap'].value =="")		error+="\n - CAP non inserito"
if (document.manda['citta'].value =="")		error+="\n - Cittā non inserita"
if (document.manda['provincia'].value =="")		error+="\n - Provincia non inserita"


if (!document.manda.consenso.checked)	error+='\n - Attenzione - al fine di poterLe rispondere le chiediamo di dare il Suo consenso alla legge sulla privacy.'

if (error!="") {alert ("Si sono verificati i seguenti errori:\n"+error+"\n\n")}
			else 
                 formSub();

}

function email()
	{
	if (document.manda.destinatario.selectedIndex>-1) location="mailto:"+document.manda.destinatario.options[document.manda.destinatario.selectedIndex].value
			else alert("nessun indirizzo email selezionato!")
	}



// FUNZIONI NEWSLETTER MIBTEL

function formSubMib()
	{
	var ns = navigator.appName == "Netscape";
	if (ns) document.manda.submit()
	           else document.manda.submit()
	}

function formRstMib()
	{
	var ns = navigator.appName == "Netscape";
	if (ns) document.manda.reset()
	           else document.manda.reset()
	}

function EmailCheckMib(email)
{
var ok=true
var error=""
if ((email.length>0) && ((email.lastIndexOf("@")==-1) || (email.lastIndexOf(".")==-1))) ok = false
if (!(ok)) error="non specificata correttamente\n -  Il formato corretto č: esempio@tin.it"
return error
}

function check_subMib()
{
var error=""
//OBBLIGATORI
 var ns = navigator.appName == "Netscape";

if (document.manda['nome'].value =="")		error+="\n - Nome non inserito"
if (document.manda['cognome'].value =="")		error+="\n - Cognome non inserito"

if (!document.manda.consenso.checked)	error+='\n - Attenzione - al fine di poterLe rispondere le chiediamo di dare il Suo consenso alla legge sulla privacy.'

if (ns) {
		if (document.manda['email'].value =="")		error+="\n - Email non inserita"
				else { if (EmailCheck(document.manda['email'].value)) error+="\n - Email non inseritacorrettamente"}
		}
		else
		{
		if (document.manda['email'].value =="")		error+="\n - Email non inserita"
				else { if (EmailCheck(document.manda['email'].value)) error+="\n - Email non inserita correttamente"}
		}

if (error!="") {alert ("Si sono verificati i seguenti errori:\n"+error+"\n\n")}
			else 
			 formSubMib()
}

function emailMib()
	{
	if (document.manda.destinatario.selectedIndex>-1) location="mailto:"+document.manda.destinatario.options[document.manda.destinatario.selectedIndex].value
			else alert("nessun indirizzo email selezionato!")
	}




//FUNZIONI RECUPERA PASSWORD

function check_sub_recpwd() {
	var error=""
	if(document.frm.nome.value=="") error+="\n - Nome non inserito"
	if(document.frm.cognome.value=="") error+="\n - Cognome non inserito"
	if(document.frm.email.value=="") error+="\n - E-mail non inserita"
			
	if(error!="") {
		alert("Attenzione:"+error)
	}
	else
		document.frm.submit()
}



//FUNZIONI SU LOGIN ACCESSO

function invioform(inField, e) {
    var charCode;
    
    if(e && e.which){
        charCode = e.which;
    }else if(window.event){
        e = window.event;
        charCode = e.keyCode;
    }

    if(charCode == 13) {
        document.frm_login.submit()
    }
}



//FUNZIONI DIMENTICATO PASSWORD

function check_RecPwd() {
	var error=""
	if(document.frmRecPwd.nome.value=="") error+="\n - Nome non inserito"
	if(document.frmRecPwd.cognome.value=="") error+="\n - Cognome non inserito"
	if(document.frmRecPwd.email.value=="") error+="\n - E-mail non inserita"
			
	if(error!="") {
		alert("Attenzione:"+error)
	}
	else
		document.frmRecPwd.submit()
}
