function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function checkMail(src) {
	var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
	var regex = new RegExp(emailReg);
	return regex.test(src);
}

function checkFormIt(f){
	var error="";
	for(var i=0; i< f.length; i++){
		var e=f.elements[i];
		if (e.name=="f_nome") if ((e.value==null ) || (e.value=="")) error +=" - Nome non presente\n";
		if (e.name=="f_email")
			if ((e.value==null ) || (e.value=="") || !checkMail(e.value)) error +=" - Indirizzo e-mail non presente o errato\n";
		if (e.name=="f_privacy")
			if (!(e.checked)) error +=' - Privacy non accettata';
	}
	if (error){
		var s="Form non corretto per i seguenti errori:\n";
		s +=error;
		s +="\nCorreggete gli errori e riprovate";
		alert(s);
		return false;
	}else{
		return true;
	}
}

function checkFormEn(f){
	var error="";
	for(var i=0; i< f.length; i++){
		var e=f.elements[i];
		if (e.name=="f_nome") if ((e.value==null ) || (e.value=="")) error +=" - Name not present\n";
		if (e.name=="f_email")
			if ((e.value==null ) || (e.value=="") || !checkMail(e.value)) error +=" - E-mail adress not present o wrong\n";
		if (e.name=="f_privacy")
			if (!(e.checked)) error +=' - Privacy non accepted';
	}
	if (error){
		var s="Form uncorrect due following errors:\n";
		s +=error;
		s +="\nPlease correct errors and try again...";
		alert(s);
		return false;
	}else{
		return true;
	}
}
