

<!--
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];}
}
//-->
var win = null;
function apri(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
win = window.open(mypage,myname,settings);
}

var win = null;
function apri(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;
win = window.open(mypage,myname,settings);
}

function controlRecupera(thisForm) {
	pattern = new RegExp("^[a-zA-Z0-9\._-]+\@[a-zA-Z0-9\._-]+\.[a-zA-Z]{2,4}$");
	if (recupera.email.value.search(pattern) == -1){
		alert("EMAIL non corretta");
		recupera.email.focus();
		return false;
	}
}

function controlForm(thisForm) {
	if (!registra.consenso[0].checked && !registra.consenso[0].checked){
		alert("Per continuare è obbligatorio dare il proprio consenso");
		return false;
	}
	if (!registra.consenso[0].checked){
		alert("Per continuare è obbligatorio dare il proprio consenso");
		return false;
	}

	if((registra.email.value=="")){
		alert("Inserire un valore per EMAIL");
		registra.email.focus();
		return false;
	}
	if((registra.email_di_conferma.value=="")){
		alert("inserire un valore per CONFERMA EMAIL");
		registra.email_di_conferma.focus();
		return false;
	}
	if(registra.email.value != registra.email_di_conferma.value){
		alert("Le EMAIL non coincidono");
		registra.email_di_conferma.focus();
		return false;
	}
	pattern = new RegExp("^[a-zA-Z0-9\._-]+\@[a-zA-Z0-9\._-]+\.[a-zA-Z]{2,4}$");
	if (registra.email.value.search(pattern) == -1){
		alert("EMAIL non corretta");
		registra.email.focus();
		return false;
	}
	if((registra.pwd.value.length<6)){
		alert("La PASSWORD deve essere di almeno 6 caratteri");
		registra.pwd.focus();
		return false;
	}
	if((registra.pwd.value!=registra.pwd_conferma.value)){
		alert("Le PASSWORD non corrispondono");
		registra.pwd.focus();
		return false;
	}
	for (el = 0; el < thisForm.length; el++) {

		thisElement = thisForm[el];
		logElement = "";
		
		if (thisElement.type != "hidden"){
			if (!thisElement.disabled && thisElement.parentNode.innerHTML.indexOf('controllo') > 0) {
				if (thisElement.type == "radio") {
					radioSelect = false;
					for (i = 0; i < thisForm[thisElement.name].length; i++) {
						if (thisForm[thisElement.name][i].checked) {
							radioSelect = true;
						}
					}
					if (!radioSelect) {
						logElement = "devi selezionare il campo " + thisElement.name.replace(/_/gi, " ");
					}
				} else if (thisElement.type == "checkbox") {
				
					if (!thisForm[thisElement.name].checked){
						logElement = "devi selezionare il campo "+thisElement.name.replace(/_/gi, " ");
					}
				}else if (thisElement.type != "radio" && thisElement.value == "") {
					logElement = "devi inserire il campo " + thisElement.name.replace(/_/gi, " ");
				}
			} else if (!thisElement.disabled && thisElement.parentNode.innerHTML.indexOf('isemail') > 0) {
				if (thisElement.value == "") {
					logElement = "devi inserire il campo "+thisElement.name.replace(/_/gi, " ");
				} else if (isEmail(thisElement.value) == false) {
					logElement = "Attenzione: l'indirizzo email che hai scritto non e' valido.";
				}
			}
		}
		
		if (logElement != "") {
			alert("Attenzione: " + logElement + "!");
			thisElement.focus();
			return false;
		}
	}
}
function controlForm_dati(thisForm) {
	if((registra.pwd.value.length<6)){
		alert("La PASSWORD deve essere di almeno 6 caratteri");
		registra.pwd.focus();
		return false;
	}
	if((registra.pwd.value!=registra.pwd_conferma.value)){
		alert("Le PASSWORD non corrispondono");
		registra.pwd.focus();
		return false;
	}
}

function accedere() {
//alert("qua");
ritorno="si";	
	if((accedi.user.value=="")){
		alert("Inserire un valore per USER");
		accedi.user.focus();
		ritorno="no";
		return false;
		
	}
	if((accedi.pwd.value=="")){
		alert("inserire un valore nel campo PASSWORD");
		accedi.pwd.focus();
		ritorno="no";
		return false;
		
	}
	if (ritorno!="no"){return true;}
}
