<!--
function verifica(form) {
 if(form == "login"){
 var str = document.login.username.value; 
 
  if (document.login.username.value == "") {
    document.login.username.focus();
    alert("Scrivi il tuo nome utente");
    return false;
  }
  else if (str.substr(0,4) != "mgm_") {
    document.login.username.focus();
    alert("Attenzione, il nome utente scritto non esiste.");
    return false;
  }
  else if (document.login.password.value == "") {
    document.login.password.focus();
    alert("Scrivi la tua password");
    return false;
  }
 }
 else if(form == "nuovoutente"){ 
  if (document.nuovoutente.ragione_sociale.value == "") {
    document.nuovoutente.ragione_sociale.focus();
    alert("RAGIONE SOCIALE e' un campo obbligatorio!");
    return false;
  }
  else if (document.nuovoutente.piva.value == "") {
    document.nuovoutente.piva.focus();
    alert("PARTITA IVA e' un campo obbligatorio!");
    return false;
  }
  else if (document.nuovoutente.sede_legale.value == "") {
    document.nuovoutente.sede_legale.focus();
    alert("SEDE LEGALE e' un campo obbligatorio!");
    return false;
  }
  else if (document.nuovoutente.cap.value == "") {
    document.nuovoutente.cap.focus();
    alert("C.A.P. e' un campo obbligatorio!");
    return false;
  }
  else if (document.nuovoutente.citta.value == "") {
    document.nuovoutente.citta.focus();
    alert("CITTA' e' un campo obbligatorio!");
    return false;
  }
  else if (document.nuovoutente.provincia.value == "") {
    document.nuovoutente.provincia.focus();
    alert("PROVINCIA e' un campo obbligatorio!");
    return false;
  }
  else if (document.nuovoutente.prefisso.value == "" || IsNumeric(document.nuovoutente.prefisso.value) == false) {
    document.nuovoutente.prefisso.focus();
    alert("PREFISSO non corretto oppure vuoto!");
    return false;
  }
  else if (document.nuovoutente.tel.value == "" || IsNumeric(document.nuovoutente.tel.value) == false) {
    document.nuovoutente.tel.focus();
    alert("TELEFONO non corretto oppure vuoto!");
    return false;
  }
  else if (document.nuovoutente.email.value == "") {
    document.nuovoutente.email.focus();
    alert("EMAIL e' un campo obbligatorio!");
    return false;
  }
  else if (checkEmail(document.nuovoutente.email.value) == false) {
    document.nuovoutente.email.focus();
    alert("Attenzione l'indirizzo EMAIL non e' corretto!");
   return false;   
  }
  else if (document.nuovoutente.tipo.value == "azienda") {
   if(document.nuovoutente.settore.value == ""){
    document.nuovoutente.settore.focus();
    alert("Occorre riempire il campo settore");
    return false;
   }
   else if (document.nuovoutente.privacy.checked == false) {
    document.nuovoutente.privacy.focus();
    alert("Non hai accettato la legge sulla privacy!");
    return false;
   }
  }
  else if (document.nuovoutente.privacy.checked == false) {
   document.nuovoutente.privacy.focus();
   alert("Non hai accettato la legge sulla privacy!");
   return false;
  }
 }
}

function IsNumeric(strString){
 var strValidChars = "0123456789.-";
 var strChar;
 var blnResult = true;

 if(strString.length == 0) return false;
 //  test strString consists of valid characters listed above
 for(i = 0; i < strString.length && blnResult == true; i++){
  strChar = strString.charAt(i);
  if(strValidChars.indexOf(strChar) == -1){
   blnResult = false;
  }
 }
 return blnResult;
}
   
function checkEmail(myMail) {
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myMail)){
  return (true)
 }
 return (false)
}

function apriPrivacy(){
 window.open('./privacy.php','apriPrivacy','left=150,top=80,scrollbars=yes,resizable=no,width=500,height=600,status=no,location=no,toolbar=no');
}

function getFile(id_file){
 window.open('./includes/action.php?action=download&id_file='+id_file,'getFile','left=80,top=80,scrollbars=yes,resizable=yes,width=600,height=500,status=yes,location=yes,toolbar=yes');
}

function apriVideoSpot(){
 window.open('./videoSpot.php','VideoSpot','left=5,top=5,scrollbars=yes,resizable=no,width=740,height=600,status=no,location=no,toolbar=no');
}
//-->
