// Nascondi layer

	function hideLayer(whichLayer) {

		if (document.getElementById) {

			// this is the way the standards work

			document.getElementById(whichLayer).style.display = "none";

		}

		else if (document.all) {

			// this is the way old msie versions work

			document.all[whichlayer].style.display = "none";

		}

		else if (document.layers) {

			// this is the way nn4 works

			document.layers[whichLayer].display = "none";

		}

	}

	

// Visualizza layer

	function showLayer(whichLayer) {

			//	alert(whichLayer);

		if (document.getElementById) {

			// this is the way the standards work

			document.getElementById(whichLayer).style.display = "block";

		}

		else if (document.all) {

			// this is the way old msie versions work

			document.all[whichlayer].style.display = "block";

		}

		else if (document.layers) {

			// this is the way nn4 works

			document.layers[whichLayer].display = "block";

		}

	}

	

	// JavaScript Document

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.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];}

}

function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}



function MM_jumpMenuGo(selName,targ,restore){ //v3.0

  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);

}

function open_window( bm )

{

	mywin = window.open( '/assistenza/popup.php?bm=' + bm, 'win', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=380,height=420' );

	mywin.focus();

}

// JavaScript Document

function safemail(name, domain, display) {

	displayed=(typeof(display)=="undefined") ? name+"@"+domain : display

	document.write('<a href=mailto:' + name + '@' + domain + '>' + displayed + '</a>');

}

//Funzione per validare quantità caratteri

function digitvalidation(entered, smin, smax, alertbox) {

	with (entered) {

		checkvalue=parseFloat(value);
		if ((value.length<smin) || (value.length>smax)) {

				if (alertbox!="") {alert(alertbox);

			}

			return false; 

		}

		else {

			return true; 

		}

	}

} 

//Funzione per convalida se campo vuoto

function emptyvalidation(entered, alertbox) {

	with (entered) {

		if (value==null || value=="") {

			if (alertbox!="") {alert(alertbox);

		} 

			return false;

		}

		else {

			return true;

		}

	}

} 

//Funzione per convalida username

function emptyvalidationuser(entered, alertbox) {

	with (entered) {

		var patternvalido = "^[a-zA-Z][a-zA-Z0-9]+$";

		var reg = new RegExp(patternvalido);

		if (!value.match(reg)) {

			if (alertbox!="") {alert(alertbox);

		} 

			return false;

		}

		else {

			return true;

		}

	}

} 



//Funzione per validare campo email

function domainvalidation(entered, alertbox) {

	with (entered) {

		inizio = value.substring (0,4)

		pospunto = value.indexOf(".",0)

		if (pospunto > -1) {

			value = value.substr (0,pospunto)

		}

		for (i=0; i < value.length; i++) {

			carattere = value.charCodeAt(i)

			if  ( (carattere < 48) && (carattere != 45) || (carattere > 57) && (carattere < 65) || (carattere > 90) && (carattere < 97) || (carattere > 122) ) {

				if (carattere == 32) {

					alert(alertbox);

				} else {

					alert("il carattere " + value.charAt(i) + " non è ammesso per un nome di dominio")

				}

				return false 

			}

		}

		if (value.charAt(0) == "-") {

			alert("Il carattere - non può essere all'inizio del nome")

			return false

		}

		ultimo = value.length -1

		if (value.charAt(ultimo) == "-") {

			alert("Il carattere - non può essere alla fine del nome")

			return false

		}

		return true

	}

} 

//Funzione per convalida se checked selezionato

function emptyvalidationchecked(entered, alertbox) {

		if (entered == "") {

			if (alertbox!="") {alert(alertbox);

		} 

			return false;

		}

		else {

			return true;

		}

} 

//Funzione per convalida se checked selezionato

function doublepassword(entered, entered2, alertbox) {

		if (entered.value != entered2.value) {

			if (alertbox!="") {

				alert(alertbox);

			} 

			return false;

		} else {

			return true;

		}

} 

//Funzione per convalida se password continene username 

function checkupassword(entered, entered2, alertbox) {

		upos=entered.value.indexOf(entered2.value);

		if (upos == 0) {

			if (alertbox!="") {

				alert(alertbox);

			} 

			return false;

		} else {

			return true;

		}

} 

//Funzione per validare campo email

function emailvalidation(entered, alertbox) {

	with (entered) {

		apos=value.indexOf("@"); 

		dotpos=value.lastIndexOf(".");

		lastpos=value.length-1;

		if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) {

			if (alertbox) {

			alert(alertbox);

			} 

			return false;

		}

		else {

		return true;

		}

	}

} 

function puliscitext(elm){

	if (!elm.base) elm.base = elm.value

	if (elm.value == elm.base) elm.value = "";

	else if (elm.value == "") elm.value = elm.base;

}



function formvalidation2(thisform) {

	with (thisform) {

		if (emptyvalidation(thisform.domain,"Attenzione!\nSpecificare un nome.")==false) {thisform.domain.focus(); return false;};

		if (ext.value=='ws'){

			if (digitvalidation(thisform.domain,4,100,"Attenzione!\nIl nome del dominio deve avere\nalmeno 4 caratteri.")==false) {thisform.domain.focus(); return false;};

		} else {

			if (digitvalidation(thisform.domain,3,100,"Attenzione!\nIl nome del dominio deve avere\nalmeno 3 caratteri.")==false) {thisform.domain.focus(); return false;};

		}
		if (ext.value!='name'){
			if (domainvalidation(thisform.domain,"Il nome del dominio non può contenere spazi")==false) {thisform.domain.focus(); return false;};
		}

	}

}



function MM_showHideLayers() { //v6.0

  var i,p,v,obj,args=MM_showHideLayers.arguments;

  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];

    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }

    obj.visibility=v; }

}





//largeur = screen.width;

//cach.left = Math.round((largeur/2)-250);

//cach = document.getElementById("cache").style.display="block";

function cacheOff() {

	document.getElementById("cache").style.display = "none";

}



// Messaggi alert

	function MM_popupMsg(msg) { //v1.0

		document.MM_returnValue = confirm(msg);

	}



function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}

//controllo che i domini .ws non siano inferiori a 4 caratteri


		function checkAge(yeara,montha,daya)
		{
			/* the minumum age you want to allow in */
			var min_age = 18;
			/* change "age_form" to whatever your form has for a name="..." */
			var year = parseInt(yeara);
			var month = parseInt(montha) - 1;
			var day = parseInt(daya);

			var theirDate = new Date((year + min_age), month, day);
			var today = new Date;
			if ( (today.getTime() - theirDate.getTime()) < 0) {
				alert("Attenzione, l'intestatario del dominio deve essere maggiorenne!");
				return false;
			}
			else {
				return true;
			}
		}

