// ---------------------------------------------------------------
 var NE, NE6, IE = false;
 var ref;
  if (navigator.appName == "Netscape") {
    if ( parseInt(navigator.appVersion) == 4) {
		//alert ("NE");
        NE = true;
    }else if(parseInt(navigator.appVersion) >= 5) {
		//alert ("NE6");
        NE6 = true;
    }
  }else if(navigator.appName == "Microsoft Internet Explorer") {
    // alert ("IE");
    IE = true;
  }
// ---------------------------------------------------------------
function CheckRegForm() {
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
	// alert ("ref: " + ref);
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        }
  language = ref.document.reguserform.language.value.toLowerCase();
  // language = ref.document.reguserform.i_cus_language.value.toLowerCase();
  // alert ("Language is " + ref.document.reguserform.i_cus_language.value + " --- " +  language);  
  // prepare error messages based on language in form
   if ( language == 'i' ) {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Conferma registrazione ?";	 
  	 var userfirst_err_msg = "Nome non valido - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "Cognome non valido - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "E-mail non valido - min. 5 chars, max. 50 chars - devono corrispondere\n";
	 var nosnake_err_msg = "Formato e-mail non valido - manca il carattere \"\@\"\n";
  	 var nodot_err_msg = "Formato e-mail non valido - manca il carattere \".\" \n";
 	 var userstreet_err_msg = "Via non valida - min. 4 chars, max. 30 chars\n";
  	 var userzip_err_msg = "NAP non valido - min. 4 chars, max. 5 chars\n";
  	 var usercity_err_msg = "Citta' non valida - min. 2 chars, max. 30 chars\n";
  	 var userprefix_err_msg = "Prefisso non valido - min. 4 chars, max. 5 chars\n";
  	 var userphone_err_msg = "Telefono non valido - min. 10 chars, max. 15 chars\n";
  	 var usermobile_err_msg = "Telefono mobile non valido - min. 10 chars, max. 15 chars\n";
	 var userdateday_err_msg = "Giorno data di nascita non valido - controllare il formato gg\n";
 	 var userdatemonth_err_msg = "Mese data di nascita non valido - controllare il formato mm\n";
	 var userdateyear_err_msg = "Anno di nascita non valido - controllare il formato aaaa\n";
	 var accept_err_msg = "Accettazione delle Condizioni obbligatoria !\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars!\n";
	} else {}
  if (language == 'd') {
     var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
  	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
  	 var userstreet_err_msg = "Street not valid - min. 4 chars, max. 30 chars\n";
  	 var userzip_err_msg = "ZIP code invalid - min. 4 chars, max. 5 chars\n";
  	 var usercity_err_msg = "City invalid - min. 2 chars, max. 30 chars\n";
  	 var userprefix_err_msg = "Prefix invalid - min. 4 chars, max. 5 chars\n";
  	 var userphone_err_msg = "Phone number invalid - min. 10 chars, max. 12 chars\n";
  	 var usermobile_err_msg = "Mobile number invalid - min. 10 chars, max. 12 chars\n";
	 var userdateday_err_msg = "Giorno data di nascita non valido - contollare il formato gg\n";
 	 var userdatemonth_err_msg = "Mese data di nascita non valido - contollare il formato mm\n";
	 var userdateyear_err_msg = "Anno di nascita non valido - contollare il formato aaaa\n";
	 var accept_err_msg = "Accettazione delle Condizioni obbligatoria !\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars!\n";
  } else {}
  if (language == 'f') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
  	 var userstreet_err_msg = "Street not valid - min. 4 chars, max. 30 chars\n";
	 var userzip_err_msg = "ZIP code invalid - min. 4 chars, max. 5 chars\n";
  	 var usercity_err_msg = "City invalid - min. 2 chars, max. 30 chars\n";
  	 var userprefix_err_msg = "Prefix invalid - min. 4 chars, max. 5 chars\n";
  	 var userphone_err_msg = "Phone number invalid - min. 10 chars, max. 12 chars\n";
  	 var usermobile_err_msg = "Mobile number invalid - min. 10 chars, max. 12 chars\n";
	 var userdateday_err_msg = "Giorno data di nascita non valido - contollare il formato gg\n";
 	 var userdatemonth_err_msg = "Mese data di nascita non valido - contollare il formato mm\n";
	 var userdateyear_err_msg = "Anno di nascita non valido - contollare il formato aaaa\n";
	 var accept_err_msg = "Accettazione delle Condizioni obbligatoria !\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars!\n";
  } else {}
  if (language == 'e') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
   	 var userstreet_err_msg = "Street not valid - min. 4 chars, max. 30 chars\n";
	 var userzip_err_msg = "ZIP code invalid - min. 4 chars, max. 5 chars\n";
  	 var usercity_err_msg = "City invalid - min. 2 chars, max. 30 chars\n";
  	 var userprefix_err_msg = "Prefix invalid - min. 4 chars, max. 5 chars\n";
  	 var userphone_err_msg = "Phone number invalid - min. 10 chars, max. 12 chars\n";
  	 var usermobile_err_msg = "Mobile number invalid - min. 10 chars, max. 12 chars\n";
	 var userdateday_err_msg = "Birth day invalid - check format dd\n";
 	 var userdatemonth_err_msg = "Birth month invalid - check format mm\n";
	 var userdateyear_err_msg = "Birth year invalid - check format yyyy\n";
	 var accept_err_msg = "General Conditions acceptance is mandatory !\n";
	 var security_code_err_msg = "Security Code is mandatory - min. 6 chars, max. 7 chars!\n";
  } else {}
  // ----- user last name
  var userlastval = ref.document.reguserform.i_cus_lastname.value;
  strre = userlastval.replace(/ /gi, "_");
  userlastval = strre;
  if ( userlastval.length <= 1 || userlastval.length > 30 ) {
	 errors += userlast_err_msg;
    }else{    
   }		
  // ----- user first name
  var userfirstval = ref.document.reguserform.i_cus_name.value;
  strre = userfirstval.replace(/ /gi, "_");
  userfirstval = strre;
  if ( userfirstval.length <= 1 || userfirstval.length > 30 ) {
	 errors += userfirst_err_msg;
    }else{
   }
  // ----- user street code
  var userstreetval = ref.document.reguserform.i_cus_street1.value;
  if ( userstreetval.length <= 3 || userstreetval.length > 30 ) {
	 errors += userstreet_err_msg;
    }else{    
   }    
  // ----- user zip code
  var userzipval = ref.document.reguserform.i_cus_zip.value;
  if ( userzipval.length <= 3 || userzipval.length > 5 ) {
	 errors += userzip_err_msg;
    }else{    
   } 
  // ----- user city
  var usercityval = ref.document.reguserform.i_cus_city.value;
  strre = usercityval.replace(/ /gi, "_");
  usercityval = strre;
  if ( usercityval.length <= 2 || usercityval.length > 30 ) {
	 errors += usercity_err_msg;
    }else{    
   } 
  // ----- user prefix
  var userprefixval = ref.document.reguserform.i_cus_int_prefix.value;
  if ( userprefixval.length != 0 ) {
  if ( userprefixval.length <= 2 || userprefixval.length > 30 ) {
	 errors += userprefix_err_msg;
    }else{}
  } else {}
  // ----- user phone
  var userphoneval = ref.document.reguserform.i_cus_phone_number.value;
  if ( userphoneval.length <= 9 || userphoneval.length > 15 ) {
	 errors += userphone_err_msg;
    }else{    
   }  
  // ----- user mobile
  var usermobileval = ref.document.reguserform.i_cus_mobile_number.value;
  if ( usermobileval.length != 0 ) {
  if ( usermobileval.length <= 9 || usermobileval.length > 15 ) {
	 errors += usermobile_err_msg;
    }else{}    
   } else {}
  // ----- user email address
  var emailval1 = ref.document.reguserform.i_cus_email1.value;
  var emailval2 = ref.document.reguserform.i_cus_email2.value;    
  // alert ("Emailval is: " + emailval1 + " - " + emailval2);  
  if (emailval1 != emailval2) {
     errors += useremail_err_msg;
  }else{}  
  emailval = emailval1;
  strre = emailval.replace(/ /gi, "_");
  emailval = strre;
  emailsplitted = emailval.split("@");	
  if ( emailval.length <= 0 || emailval.length > 50 ) {
     errors += useremail_err_msg;
  }else if ( emailval.length <= 5 ) {
     errors += useremail_err_msg;
  	}else{
     emailsplitted = emailval.split("@");
     if ( emailsplitted.length < 2 || emailsplitted.length > 2 ) {
       errors += nosnake_err_msg;
     }
     if ( emailsplitted.length == 2 ) {
       if ( emailsplitted[0].length == 0 || emailsplitted[1].length == 0 ) {
         errors += useremail_err_msg;
       }
     }
     emailsplitted = emailval.split(".");
     if ( emailsplitted.length <= 1 ) {
       errors += nodot_err_msg;
     }
   }
  // ----- user birth date
  var userbirthdayval = ref.document.reguserform.i_cus_birth_day.value;
  if ( userbirthdayval.length != 0 ) {
  if ( userbirthdayval.length < 1 || userbirthdayval.length > 2 ) {
	 errors += userdateday_err_msg;
    }else{}    
   } else {}
  if ( userbirthdayval < 1 || userbirthdayval > 31 ) {
	 errors += userdateday_err_msg;
    }else{}    
  //
  var userbirthmonthval = ref.document.reguserform.i_cus_birth_month.value;
  if ( userbirthmonthval.length != 0 ) {
  if ( userbirthmonthval.length < 1 || userbirthmonthval.length > 2 ) {
	 errors += userdatemonth_err_msg;
    }else{}    
   } else {}
  if ( userbirthmonthval < 1 || userbirthmonthval > 12 ) {
	 errors += userdatemonth_err_msg;
    }else{} 
  //
  var userrthyearhval = ref.document.reguserform.i_cus_birth_year.value;
  if ( userrthyearhval.length != 0 ) {
  if ( userrthyearhval.length < 4 || userrthyearhval.length > 4 ) {
	 errors += userdateyear_err_msg;
    }else{}    
   } else {}
  if ( userrthyearhval < 1880 || userrthyearhval > 2010 ) {
	 errors += userdateyear_err_msg;
    }else{} 
   
   
   // ----- condition acceptance
  if (!ref.document.reguserform.i_condition.checked) {
	 errors += accept_err_msg;
    }
   
  // ----- security code
  var securitycodeval = ref.document.reguserform.security_code.value;
  if ( securitycodeval.length <= 5 || securitycodeval.length > 7 ) {
	 errors += security_code_err_msg;
    }else{    
   }


   // Ready to continue:
  // alert ("Parameters: "  + userfirstval + userlastval + emailval);
  // ----- final confirmation required
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{  
      res = window.confirm(confirm_msg);
      if (res == true) {
	  	return true;
	  } else {
	    return false;
	  }	
  }
}
// ---------------------------------------------------------------
function CheckUpdForm() {
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
	// alert ("ref: " + ref);
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        }
  language = ref.document.reguserform.language.value.toLowerCase();
  //language = ref.document.reguserform.i_cus_language.value.toLowerCase();
  // alert ("Language is " + ref.document.reguserform.i_cus_language.value + " --- " +  language);  
  // prepare error messages based on language in form
   if ( language == 'i' ) {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Conferma aggiornamento ?";	 
  	 var userfirst_err_msg = "Nome non valido - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "Cognome non valido - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "E-mail non valido - min. 5 chars, max. 50 chars - devono corrispondere\n";
	 var nosnake_err_msg = "Formato e-mail non valido - manca il carattere \"\@\"\n";
  	 var nodot_err_msg = "Formato e-mail non valido - manca il carattere \".\" \n";
 	 var userstreet_err_msg = "Via non valida - min. 4 chars, max. 30 chars\n";
  	 var userzip_err_msg = "NAP non valido - min. 4 chars, max. 5 chars\n";
  	 var usercity_err_msg = "Citta' non valida - min. 2 chars, max. 30 chars\n";
  	 var userprefix_err_msg = "Prefisso non valido - min. 4 chars, max. 5 chars\n";
  	 var userphone_err_msg = "Telefono non valido - min. 10 chars, max. 15 chars\n";
  	 var usermobile_err_msg = "Telefono mobile non valido - min. 10 chars, max. 15 chars\n";
	 var userdateday_err_msg = "Giorno data di nascita non valido - controllare il formato gg\n";
 	 var userdatemonth_err_msg = "Mese data di nascita non valido - controllare il formato mm\n";
	 var userdateyear_err_msg = "Anno di nascita non valido - controllare il formato aaaa\n";
   	 var name_err_msg = "Username non valido - min. 5 chars, max. 50 chars\n";
  	 var word_err_msg = "Password non valida - min. 6 chars, max. 20 chars\n";
  	 var wordmatch_err_msg = "E-mail non valido - min. 6 chars, max. 20 chars - devono corrispondere\n";
	 var accept_err_msg = "Accettazione delle Condizioni obbligatoria !\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars!\n";
	} else {}
  if (language == 'd') {
     var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
  	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
  	 var userstreet_err_msg = "Street not valid - min. 4 chars, max. 30 chars\n";
  	 var userzip_err_msg = "ZIP code invalid - min. 4 chars, max. 5 chars\n";
  	 var usercity_err_msg = "City invalid - min. 2 chars, max. 30 chars\n";
  	 var userprefix_err_msg = "Prefix invalid - min. 4 chars, max. 5 chars\n";
  	 var userphone_err_msg = "Phone number invalid - min. 10 chars, max. 12 chars\n";
  	 var usermobile_err_msg = "Mobile number invalid - min. 10 chars, max. 12 chars\n";
	 var userdateday_err_msg = "Giorno data di nascita non valido - contollare il formato gg\n";
 	 var userdatemonth_err_msg = "Mese data di nascita non valido - contollare il formato mm\n";
	 var userdateyear_err_msg = "Anno di nascita non valido - contollare il formato aaaa\n";
   	 var name_err_msg = "Username not valid - min. 5 chars, max. 50 chars\n";
   	 var word_err_msg = "Password not valid - min. 6 chars, max. 20 chars\n";
  	 var wordmatch_err_msg = "Password not valid - min. 6 chars, max. 20 chars - should match\n";
	 var accept_err_msg = "Accettazione delle Condizioni obbligatoria !\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars!\n";
  } else {}
  if (language == 'f') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
  	 var userstreet_err_msg = "Street not valid - min. 4 chars, max. 30 chars\n";
	 var userzip_err_msg = "ZIP code invalid - min. 4 chars, max. 5 chars\n";
  	 var usercity_err_msg = "City invalid - min. 2 chars, max. 30 chars\n";
  	 var userprefix_err_msg = "Prefix invalid - min. 4 chars, max. 5 chars\n";
  	 var userphone_err_msg = "Phone number invalid - min. 10 chars, max. 12 chars\n";
  	 var usermobile_err_msg = "Mobile number invalid - min. 10 chars, max. 12 chars\n";
	 var userdateday_err_msg = "Giorno data di nascita non valido - contollare il formato gg\n";
 	 var userdatemonth_err_msg = "Mese data di nascita non valido - contollare il formato mm\n";
	 var userdateyear_err_msg = "Anno di nascita non valido - contollare il formato aaaa\n";
   	 var name_err_msg = "Username not valid - min. 5 chars, max. 50 chars\n";
   	 var word_err_msg = "Password not valid - min. 6 chars, max. 20 chars\n";
  	 var wordmatch_err_msg = "Password not valid - min. 6 chars, max. 20 chars - should match\n";
	 var accept_err_msg = "Accettazione delle Condizioni obbligatoria !\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars!\n";
  } else {}
  if (language == 'e') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
   	 var userstreet_err_msg = "Street not valid - min. 4 chars, max. 30 chars\n";
	 var userzip_err_msg = "ZIP code invalid - min. 4 chars, max. 5 chars\n";
  	 var usercity_err_msg = "City invalid - min. 2 chars, max. 30 chars\n";
  	 var userprefix_err_msg = "Prefix invalid - min. 4 chars, max. 5 chars\n";
  	 var userphone_err_msg = "Phone number invalid - min. 10 chars, max. 12 chars\n";
  	 var usermobile_err_msg = "Mobile number invalid - min. 10 chars, max. 12 chars\n";
	 var userdateday_err_msg = "Birth day invalid - check format dd\n";
 	 var userdatemonth_err_msg = "Birth month invalid - check format mm\n";
	 var userdateyear_err_msg = "Birth year invalid - check format yyyy\n";
   	 var name_err_msg = "Username not valid - min. 5 chars, max. 50 chars\n";
   	 var word_err_msg = "Password not valid - min. 6 chars, max. 20 chars\n";
  	 var wordmatch_err_msg = "Password not valid - min. 6 chars, max. 20 chars - should match\n";
	 var accept_err_msg = "General Conditions acceptance is mandatory !\n";
	 var security_code_err_msg = "Security Code is mandatory - min. 6 chars, max. 7 chars!\n";
  } else {}
  // ----- user last name
  var userlastval = ref.document.reguserform.i_cus_lastname.value;
  strre = userlastval.replace(/ /gi, "_");
  userlastval = strre;
  if ( userlastval.length <= 1 || userlastval.length > 30 ) {
	 errors += userlast_err_msg;
    }else{    
   }		
  // ----- user first name
  var userfirstval = ref.document.reguserform.i_cus_name.value;
  strre = userfirstval.replace(/ /gi, "_");
  userfirstval = strre;
  if ( userfirstval.length <= 1 || userfirstval.length > 30 ) {
	 errors += userfirst_err_msg;
    }else{
   }
  // ----- user street code
  var userstreetval = ref.document.reguserform.i_cus_street1.value;
  if ( userstreetval.length <= 3 || userstreetval.length > 30 ) {
	 errors += userstreet_err_msg;
    }else{    
   }    
  // ----- user zip code
  var userzipval = ref.document.reguserform.i_cus_zip.value;
  if ( userzipval.length <= 3 || userzipval.length > 5 ) {
	 errors += userzip_err_msg;
    }else{    
   } 
  // ----- user city
  var usercityval = ref.document.reguserform.i_cus_city.value;
  strre = usercityval.replace(/ /gi, "_");
  usercityval = strre;
  if ( usercityval.length <= 2 || usercityval.length > 30 ) {
	 errors += usercity_err_msg;
    }else{    
   } 
  // ----- user prefix
  var userprefixval = ref.document.reguserform.i_cus_int_prefix.value;
  if ( userprefixval.length != 0 ) {
  if ( userprefixval.length <= 2 || userprefixval.length > 30 ) {
	 errors += userprefix_err_msg;
    }else{}
  } else {}
  // ----- user phone
  var userphoneval = ref.document.reguserform.i_cus_phone_number.value;
  if ( userphoneval.length <= 9 || userphoneval.length > 15 ) {
	 errors += userphone_err_msg;
    }else{    
   }  
  // ----- user mobile
  var usermobileval = ref.document.reguserform.i_cus_mobile_number.value;
  if ( usermobileval.length != 0 ) {
  if ( usermobileval.length <= 9 || usermobileval.length > 15 ) {
	 errors += usermobile_err_msg;
    }else{}    
   } else {}
  // ----- user email address
  var emailval1 = ref.document.reguserform.i_cus_email1.value;
  var emailval2 = ref.document.reguserform.i_cus_email2.value;    
  // alert ("Emailval is: " + emailval1 + " - " + emailval2);  
  if (emailval1 != emailval2) {
     errors += useremail_err_msg;
  }else{}  
  emailval = emailval1;
  strre = emailval.replace(/ /gi, "_");
  emailval = strre;
  emailsplitted = emailval.split("@");	
  if ( emailval.length <= 0 || emailval.length > 50 ) {
     errors += useremail_err_msg;
  }else if ( emailval.length <= 5 ) {
     errors += useremail_err_msg;
  	}else{
     emailsplitted = emailval.split("@");
     if ( emailsplitted.length < 2 || emailsplitted.length > 2 ) {
       errors += nosnake_err_msg;
     }
     if ( emailsplitted.length == 2 ) {
       if ( emailsplitted[0].length == 0 || emailsplitted[1].length == 0 ) {
         errors += useremail_err_msg;
       }
     }
     emailsplitted = emailval.split(".");
     if ( emailsplitted.length <= 1 ) {
       errors += nodot_err_msg;
     }
   }
  // ----- user birth date
  var userbirthdayval = ref.document.reguserform.i_cus_birth_day.value;
  if ( userbirthdayval.length != 0 ) {
  if ( userbirthdayval.length < 1 || userbirthdayval.length > 2 ) {
	 errors += userdateday_err_msg;
    }else{}    
   } else {}
  if ( userbirthdayval < 1 || userbirthdayval > 31 ) {
	 errors += userdateday_err_msg;
    }else{}    
  //
  var userbirthmonthval = ref.document.reguserform.i_cus_birth_month.value;
  if ( userbirthmonthval.length != 0 ) {
  if ( userbirthmonthval.length < 1 || userbirthmonthval.length > 2 ) {
	 errors += userdatemonth_err_msg;
    }else{}    
   } else {}
  if ( userbirthmonthval < 1 || userbirthmonthval > 12 ) {
	 errors += userdatemonth_err_msg;
    }else{} 
  //
  var userrthyearhval = ref.document.reguserform.i_cus_birth_year.value;
  if ( userrthyearhval.length != 0 ) {
  if ( userrthyearhval.length < 4 || userrthyearhval.length > 4 ) {
	 errors += userdateyear_err_msg;
    }else{}    
   } else {}
  if ( userrthyearhval < 1880 || userrthyearhval > 2010 ) {
	 errors += userdateyear_err_msg;
    }else{} 

  //   

  // alert ("Check word");  
  var userpasswordval1 = ref.document.reguserform.i_cus_passw1.value;	
  var userpasswordval2 = ref.document.reguserform.i_cus_passw2.value;
  if (userpasswordval1 != userpasswordval2) {
     errors += wordmatch_err_msg;
  }else{
  	if ( userpasswordval1.length <= 5 || userpasswordval1.length > 20 ) {
		 errors += word_err_msg;
    	}else{    
   	}	
  }
     
   
  // ----- security code
  var securitycodeval = ref.document.reguserform.security_code.value;
  if ( securitycodeval.length <= 5 || securitycodeval.length > 7 ) {
	 errors += security_code_err_msg;
    }else{    
   }


   // Ready to continue:
  // alert ("Parameters: "  + userfirstval + userlastval + emailval);
  // ----- final confirmation required
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{  
      res = window.confirm(confirm_msg);
      if (res == true) {
	  	return true;
	  } else {
	    return false;
	  }	
  }
}
// ---------------------------------------------------------------
function CheckContactForm() {
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        }
   language = ref.document.contactform.language.value;
  // alert ("Language is " + ref.document.contactform.i_con_language.value);  
  // prepare error messages based on language in form
  if (language == 'i') {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Conferma invio messaggio ?";	 
  	 var userfirst_err_msg = "Nome non valido - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "Cognome non valido - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "E-mail non valido - min. 5 chars, max. 50 chars\n";
	 var usermessageobject_err_msg = "Oggetto del messaggio non valido - min. 2 chars, max. 30 chars\n";
  	 var usermessage_err_msg = "Messaggio non valido - min. 2 chars, max. 2000 chars\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars\n";
	} else {}
  if (language == 'd') {
     var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
  	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
	 var usermessageobject_err_msg = "Oggetto del messaggio non valido - min. 2 chars, max. 30 chars\n";
  	 var usermessage_err_msg = "Messaggio non valido - min. 3 chars, max. 2000 chars\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars\n";

  } else {}
  if (language == 'f') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
	 var usermessageobject_err_msg = "Oggetto del messaggio non valido - min. 2 chars, max. 30 chars\n";
  	 var usermessage_err_msg = "Messaggio non valido - min. 3 chars, max. 2000 chars\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars\n";
  } else {}
  if (language == 'e') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
	 var usermessageobject_err_msg = "Subject invalid - min. 2 chars, max. 30 chars\n";
  	 var usermessage_err_msg = "Message invalid - min. 3 chars, max. 2000 chars\n";
	 var security_code_err_msg = "Security Code is mandatory - min. 6 chars, max. 7 chars\n";
  } else {}
  // ----- user last name 
  var userlastval = ref.document.contactform.i_con_lastname.value;
  strre = userlastval.replace(/ /gi, "_");
  userlastval = strre;
  if ( userlastval.length <= 1 || userlastval.length > 30 ) {
	 errors += userlast_err_msg;
    }else{    
   }		
 // ----- user name
 var usernameval = ref.document.contactform.i_con_name.value;
  strre = usernameval.replace(/ /gi, "_");
  usernameval = strre;
  if ( usernameval.length <= 1 || usernameval.length > 30 ) {
	 errors += userfirst_err_msg;
    }else{    
   }		
 // ----- user email address  
  var emailval = ref.document.contactform.i_con_email1.value;  
  strre = emailval.replace(/ /gi, "_");
  emailval = strre;
  emailsplitted = emailval.split("@");	
  if ( emailval.length <= 0 || emailval.length > 50 ) {
     errors += useremail_err_msg;
  }else if ( emailval.length <= 5 ) {
     errors += useremail_err_msg;
  	}else{
     emailsplitted = emailval.split("@");
     if ( emailsplitted.length < 2 || emailsplitted.length > 2 ) {
       errors += nosnake_err_msg;
     }
     if ( emailsplitted.length == 2 ) {
       if ( emailsplitted[0].length == 0 || emailsplitted[1].length == 0 ) {
         errors += useremail_err_msg;
       }
     }
     emailsplitted = emailval.split(".");
     if ( emailsplitted.length <= 1 ) {
       errors += nodot_err_msg;
     }
   }
// ----- user message object
  var usermessageobjectval = ref.document.contactform.i_con_message_object.value;
  strre = usermessageobjectval.replace(/ /gi, "_");
  usermessageobjectval = strre;
  if ( usermessageobjectval.length <= 1 || usermessageobjectval.length > 30 ) {
	 errors += usermessageobject_err_msg;
    }else{    
   }		

 // ----- user message
  var usermessageval = ref.document.contactform.i_con_message_msg.value;
  strre = usermessageval.replace(/ /gi, "_");
  usermessageval = strre;
  if ( usermessageval.length <= 1 || usermessageval.length > 2000 ) {
	 errors += usermessage_err_msg;
    }else{    
   }	

  // ----- security code
  var securitycodeval = ref.document.contactform.security_code.value;
  if ( securitycodeval.length <= 5 || securitycodeval.length > 7 ) {
	 errors += security_code_err_msg;
    }else{    
   }
	
  // Ready to continue:
  // alert ("Parameters: "  + userfirstval + userlastval + emailval);
  // ----- final confirmation required
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{  
      res = window.confirm(confirm_msg);
      if (res == true) {
	  	return true;
	  } else {
	    return false;
	  }	
  }
}
// ---------------------------------------------------------------
function CheckRmaForm() {
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        }
  language = ref.document.rmaform.language.value;
  // alert ("Language is " + ref.document.rmaform.i_rma_language.value);  
  // prepare error messages based on language in form
  if (language == 'i') {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Conferma invio messaggio ?";	 
  	 var userfirst_err_msg = "Nome non valido - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "Cognome non valido - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "E-mail non valido - min. 5 chars, max. 50 chars\n";
	 var usermessageobject_err_msg = "Oggetto del messaggio non valido - min. 2 chars, max. 30 chars\n";
  	 var usermessage_err_msg = "Motivo della richiesta non valido - min. 2 chars, max. 2000 chars\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars\n";
	} else {}
  if (language == 'd') {
     var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
  	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
	 var usermessageobject_err_msg = "Oggetto del messaggio non valido - min. 2 chars, max. 30 chars\n";
  	 var usermessage_err_msg = "Messaggio non valido - min. 3 chars, max. 2000 chars\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars\n";

  } else {}
  if (language == 'f') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
	 var usermessageobject_err_msg = "Oggetto del messaggio non valido - min. 2 chars, max. 30 chars\n";
  	 var usermessage_err_msg = "Messaggio non valido - min. 3 chars, max. 2000 chars\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars\n";
  } else {}
  if (language == 'e') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
	 var usermessageobject_err_msg = "Subject invalid - min. 2 chars, max. 30 chars\n";
  	 var usermessage_err_msg = "Message invalid - min. 3 chars, max. 2000 chars\n";
	 var security_code_err_msg = "Security Code is mandatory - min. 6 chars, max. 7 chars\n";
  } else {}
  // ----- user last name 
  var userlastval = ref.document.rmaform.i_rma_lastname.value;
  strre = userlastval.replace(/ /gi, "_");
  userlastval = strre;
  if ( userlastval.length <= 1 || userlastval.length > 30 ) {
	 errors += userlast_err_msg;
    }else{    
   }		
 // ----- user name
 var usernameval = ref.document.rmaform.i_rma_name.value;
  strre = usernameval.replace(/ /gi, "_");
  usernameval = strre;
  if ( usernameval.length <= 1 || usernameval.length > 30 ) {
	 errors += userfirst_err_msg;
    }else{    
   }		
 // ----- user email address  
  var emailval = ref.document.rmaform.i_rma_email1.value;  
  strre = emailval.replace(/ /gi, "_");
  emailval = strre;
  emailsplitted = emailval.split("@");	
  if ( emailval.length <= 0 || emailval.length > 50 ) {
     errors += useremail_err_msg;
  }else if ( emailval.length <= 5 ) {
     errors += useremail_err_msg;
  	}else{
     emailsplitted = emailval.split("@");
     if ( emailsplitted.length < 2 || emailsplitted.length > 2 ) {
       errors += nosnake_err_msg;
     }
     if ( emailsplitted.length == 2 ) {
       if ( emailsplitted[0].length == 0 || emailsplitted[1].length == 0 ) {
         errors += useremail_err_msg;
       }
     }
     emailsplitted = emailval.split(".");
     if ( emailsplitted.length <= 1 ) {
       errors += nodot_err_msg;
     }
   }
 // ----- user message
  var usermessageval = ref.document.rmaform.i_rma_message_msg.value;
  strre = usermessageval.replace(/ /gi, "_");
  usermessageval = strre;
  if ( usermessageval.length <= 1 || usermessageval.length > 2000 ) {
	 errors += usermessage_err_msg;
    }else{    
   }		

  // ----- security code
  var securitycodeval = ref.document.rmaform.security_code.value;
  if ( securitycodeval.length <= 5 || securitycodeval.length > 7 ) {
	 errors += security_code_err_msg;
    }else{    
   }

  // Ready to continue:
  // alert ("Parameters: "  + userfirstval + userlastval + emailval);
  // ----- final confirmation required
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{  
      res = window.confirm(confirm_msg);
      if (res == true) {
	  	return true;
	  } else {
	    return false;
	  }	
  }
}
// ---------------------------------------------------------------
function CheckAddArticleForm() {
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        }
   language = ref.document.addArticleForm.language.value;
   // alert ("Language is " + ref.document.addArticleForm.language.value);  
  // prepare error messages based on language in form
  if (language == 'i') {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Conferma invio messaggio ?";	 
	 var image_path_err_msg = "Immagine non selezionata o non valida\n";
  	 var short_description_err_msg = "Descrizione corta non valida - min. 5 chars, max. 255 chars\n";
	 var description_err_msg = "Descrizione lunga non valida - min. 5 chars, max. 10.024 chars\n";
  	 var weight_err_msg = "Peso non valido - min. 1 chars, max. 10 chars\n";
	 var weight_numeric_err_msg = "Peso deve essere numerico\n";
	 var price_err_msg = "Prezzo non valido - min. 1 chars, max. 10 chars\n";
	 var price_numeric_err_msg = "Prezzo deve essere numerico\n";
	} else {}
  if (language == 'd') {
     var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
	 var image_path_err_msg = "Image not selected or invalid\n";
  	 var short_description_err_msg = "Short description invalid - min. 5 chars, max. 255 chars\n";
	 var description_err_msg = "Description invalid - min. 5 chars, max. 10.024 chars\n";
  	 var weight_err_msg = "Weight invalid - min. 1 chars, max. 10 chars\n";
	 var weight_numeric_err_msg = "Weight must be a numeric value\n";
	 var price_err_msg = "Price invalid - min. 1 chars, max. 10 chars\n";
	 var price_numeric_err_msg = "Price must be a numeric value\n";

  } else {}
  if (language == 'f') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
	 var image_path_err_msg = "Image not selected or invalid\n";
  	 var short_description_err_msg = "Short description invalid - min. 5 chars, max. 255 chars\n";
	 var description_err_msg = "Description invalid - min. 5 chars, max. 10.024 chars\n";
  	 var weight_err_msg = "Weight invalid - min. 1 chars, max. 10 chars\n";
	 var weight_numeric_err_msg = "Weight must be a numeric value\n";
	 var price_err_msg = "Price invalid - min. 1 chars, max. 10 chars\n";
	 var price_numeric_err_msg = "Price must be a numeric value\n";
  } else {}
  if (language == 'e') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
	 var image_path_err_msg = "Image not selected or invalid\n";
  	 var short_description_err_msg = "Short description invalid - min. 5 chars, max. 255 chars\n";
	 var description_err_msg = "Description invalid - min. 5 chars, max. 10.024 chars\n";
  	 var weight_err_msg = "Weight invalid - min. 1 chars, max. 10 chars\n";
	 var weight_numeric_err_msg = "Weight must be a numeric value\n";
	 var price_err_msg = "Price invalid - min. 1 chars, max. 10 chars\n";
	 var price_numeric_err_msg = "Price must be a numeric value\n";
  } else {}
	

// ----- article image path
  var image_pathval = ref.document.addArticleForm.artimage.value;
  // alert ("image path read is " + image_pathval);
  strre = image_pathval.replace(/ /gi, "_");
  image_pathval = strre;
  if ( image_pathval.length <= 1 || image_pathval.length > 255) {
	 errors += image_path_err_msg;
    }else{    
   }	
// ----- article short description
  var short_descriptionval = ref.document.addArticleForm.i_art_short_description.value;
  strre = short_descriptionval.replace(/ /gi, "_");
  short_descriptionval = strre;
  if ( short_descriptionval.length <= 1 || short_descriptionval.length > 255 ) {
	 errors += short_description_err_msg;
    }else{    
   }		
 // ----- article description
  var descriptionval = ref.document.addArticleForm.i_art_description.value;
  strre = descriptionval.replace(/ /gi, "_");
  descriptionval = strre;
  if ( descriptionval.length <= 1 || descriptionval.length > 10024 ) {
	 errors += description_err_msg;
    }else{    
   }	
 // ----- article weight
  var weightval = ref.document.addArticleForm.i_art_weight.value;
  strre = weightval.replace(/ /gi, "_");
  weightval = strre;
  if ( weightval.length <= 1 || weightval.length > 10 ) {
	 errors += weight_err_msg;
    }else{    
   }	
 // test numericness, full or float
 if (weightval != parseInt(weightval)) {
	if (weightval != parseFloat(weightval)) {
		errors += weight_numeric_err_msg;
	}
 }
 // ----- price weight
  var priceval = ref.document.addArticleForm.i_art_price.value;
  strre = priceval.replace(/ /gi, "_");
  priceval = strre;
  if ( priceval.length <= 1 || priceval.length > 10 ) {
	 errors += price_err_msg;
    }else{    
   }
 // test numericness, full or float
 if (priceval != parseInt(priceval)) {
	if (priceval != parseFloat(priceval)) {
		errors += price_numeric_err_msg;
	}
 }	
 //

  var size_type = ref.document.addArticleForm.elements['i_size_type'].value;
  // alert ("checking Size type:..." + size_type );
  if (size_type == 1) {
	alert ("Size type is 1 ");
	var x = ref.document.addArticleForm.elements['i_art_size_eurfull'];
	for (i=0;i<x.length;i++) { ref.document.addArticleForm.i_art_size_eurfull.elements[i].checked = false;} 
	var x = ref.document.addArticleForm.elements['i_art_size_literal'];
	for (i=0;i<eur.length;i++) {ref.document.addArticleForm.i_art_size_literal.elements[i].checked = false;} 
  }
  if (size_type == 2) {
	alert ("Size type is 2 ");
	var x = ref.document.addArticleForm.elements['i_art_size_usafull'];
	for (i=0;i<x.length;i++) { ref.document.addArticleForm.i_art_size_usafull.elements[i].checked = false;} 
	var x = ref.document.addArticleForm.elements['i_art_size_literal'];
	for (i=0;i<eur.length;i++) {ref.document.addArticleForm.i_art_size_literal.elements[i].checked = false;} 
  }
  if (size_type == 3) {
	alert ("Size type is 3 ");
	var x = ref.document.addArticleForm.elements['i_art_size_usafull'];
	for (i=0;i<x.length;i++) { ref.document.addArticleForm.i_art_size_usafull.elements[i].checked = false;} 
	var x = ref.document.addArticleForm.elements['i_art_size_eurfull'];
	for (i=0;i<x.length;i++) { ref.document.addArticleForm.i_art_size_eurfull.elements[i].checked = false;} 
  }
  // Ready to continue:
  // alert ("Parameters: "  + userfirstval + userlastval + emailval);
  // ----- final confirmation required
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{  
      res = window.confirm(confirm_msg);
      if (res == true) {
	  	return true;
	  } else {
	    return false;
	  }	
  }
}
// ---------------------------------------------------------------
function CheckSurveyForm() {
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        }
   language = ref.document.surveyform.language.value;
  // alert ("Language is " + ref.document.surveyform.language.value);  
  // prepare error messages based on language in form
  if (language == 'i') {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Conferma invio indagine ?";	 
   	 var useremail_err_msg = "E-mail non valido - min. 5 chars, max. 50 chars\n";
	 var nosnake_err_msg = "Formato e-mail non valido - manca il carattere \"\@\"\n";
  	 var nodot_err_msg = "Formato e-mail non valido - manca il carattere \".\" \n";
	} else {}
  if (language == 'd') {
     var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
	 var nosnake_err_msg = "E-mail format not valid - missing character \"\@\"\n";
  	 var nodot_err_msg = "E-mail format not valid - missing character\".\" \n";
  } else {}
  if (language == 'f') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";	
 	 var nosnake_err_msg = "E-mail format not valid - missing character \"\@\"\n";
  	 var nodot_err_msg = "E-mail format not valid - missing character\".\" \n";
  } else {}
  if (language == 'e') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
	 var nosnake_err_msg = "E-mail format not valid - missing character \"\@\"\n";
  	 var nodot_err_msg = "E-mail format not valid - missing character\".\" \n";
  } else {}
 // ----- survey email address  
  var emailval = ref.document.surveyform.t_18.value; 
  strre = emailval.replace(/ /gi, "_");
  emailval = strre;
  emailsplitted = emailval.split("@");	
  // email not set is accepted in surveys
  if ( emailval.length == 0) {
   	
  } else { 
  if ( emailval.length <= 0 || emailval.length > 50 ) {
     errors += useremail_err_msg;
  }else if ( emailval.length <= 5 ) {
     errors += useremail_err_msg;
  	}else{
     emailsplitted = emailval.split("@");
     if ( emailsplitted.length < 2 || emailsplitted.length > 2 ) {
       errors += nosnake_err_msg;
     }
     if ( emailsplitted.length == 2 ) {
       if ( emailsplitted[0].length == 0 || emailsplitted[1].length == 0 ) {
         errors += useremail_err_msg;
       }
     }
     emailsplitted = emailval.split(".");
     if ( emailsplitted.length <= 1 ) {
       errors += nodot_err_msg;
     }
   }
}
  // Ready to continue:
  // alert ("Parameters: "  + userfirstval + userlastval + emailval);
  // ----- final confirmation required
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{  
      res = window.confirm(confirm_msg);
      if (res == true) {
	  	return true;
	  } else {
	    return false;
	  }	
  }
}
// ---------------------------------------------------------------
function UpdateCartForm($form_id) { 
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        } 	
  if (ref.document.forms[$form_id].i_cartform_language.value == 'i') {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Conferma invio messaggio ?";	 
  	 var qty_length_err_msg = "Quantita' non valida - min. 1 chars, max. 3 chars\n";
  	 var qty_value_err_msg = "Quantita' non valida - minimo valore: 1, massimo valore: 10\n";
 	} else {}	
  if (ref.document.forms[$form_id].i_cartform_language.value == 'E') {
     var errorilabel  = "Error in form:\n\n";
     var confirm_msg  = "Confirm ?";	 
  	 var qty_length_err_msg = "Quantity is not valid - min. 1 chars, max. 3 chars\n";
  	 var qty_value_err_msg = "Quantity is not valid - minimo valore: 1, massimo valore: 10\n";
 	} else {}		
  // alert ("UpdateCartForm:" + ref); 
  //var numberForms = ref.document.forms.length;	
  //var formIndex;
  //for (formIndex = 0;formIndex < numberForms; formIndex++)
  //{
  //   alert ("Form:" + formIndex + " - " + document.forms[formIndex].name);	 
  // } 
  var qty = ref.document.forms[$form_id].qty.value;
  if ( qty.length < 1 || qty.length > 3 ) {
       errors += qty_length_err_msg;
  }	
  if ( qty < 1 || qty > 10 ) {
       errors += qty_value_err_msg;
  }	
  
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{  
      	return true;
	
  }
 
}
// ---------------------------------------------------------------
function CheckShipForm() { 
  var errors = "";
  var reply   = "";
  var i = 0;
  var thevalue = " ";
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        } 	

  var x = ref.document.forms[1].elements['radio_ship_1'];
  var x1 = ref.document.forms[1].elements['ship_type'];
  for (i=0;i<x.length;i++) {
  	  if (x[i].checked)
	  { 
	  	thevalue = x[i].value;
	  	// alert ("..looping with i= " + i + " value " + thevalue);
	  break;
	  }
  }
  if (!thevalue) {
     // No radio button is checked
	 // alert ("Not checked" + thevalue);
  } else {
  	// alert ("ship type:" + thevalue);
	ref.document.forms[1].elements['ship_type'].value = thevalue;
	// ref.document.forms[1].elements['ship_cost'].value = 111.00;	
	ref.document.forms[1].elements['radio_ship_1'].checked;
  }
  var sURL = unescape(window.location.pathname);
  window.location.href = sURL;
  
  return true;
 
}
// ---------------------------------------------------------------
function CheckOrderForm() {
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        }
	
  // alert ("Language is " + ref.document.shipform.i_rma_language.value);  
  // prepare error messages based on language in form
  if (ref.document.forms[1].elements['i_order_language'].value == 'i') {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Conferma invio Ordine ?";	 
	} else {}
  if (ref.document.shipform.i_order_language.value == 'd') {
     var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
   } else {}
  if (ref.document.shipform.i_order_language.value == 'f') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
  } else {}
  if (ref.document.shipform.i_order_language.value == 'e') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm operation ?";	 
  } else {}
  // ----- user last name 
 
  // ----- final confirmation required
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{  
      res = window.confirm(confirm_msg);
      if (res == true) {
	  	return true;
	  } else {
	    return false;
	  }	
  }
}
// ---------------------------------------------------------------
function CheckLoginForm() { 
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        } 
  lang = ref.document.loginform.loginlang.value;
  // alert ("Check Login: " + ref);   
  if (ref.document.loginform.loginlang.value == 'i') {
     var errorilabel  = "Errori nel formulario:\n\n";
   	 var name_err_msg = "Username non valido - min. 5 chars, max. 50 chars\n";
  	 var word_err_msg = "Password non valida - min. 5 chars, max. 15 chars\n";
   } else {}
   if (ref.document.loginform.loginlang.value == 'd') {
   	 var name_err_msg = "Username not valid - min. 5 chars, max. 50 chars\n";
   	 var word_err_msg = "Password not valid - min. 5 chars, max. 15 chars\n";
     var errorilabel  = "Errors in form:\n\n";
   } else {}
  if (ref.document.loginform.loginlang.value == 'f') {
   	 var name_err_msg = "Username not valid - min. 5 chars, max. 50 chars\n";
   	 var word_err_msg = "Password not valid - min. 5 chars, max. 15 chars\n";
     var errorilabel  = "Errors in form:\n\n";
  	
   } else {}
  if (ref.document.loginform.loginlang.value == 'e') {
   	 var name_err_msg = "Username not valid - min. 5 chars, max. 50 chars\n";
   	 var word_err_msg = "Password not valid - min. 5 chars, max. 15 chars\n";
     var errorilabel  = "Errors in form:\n\n";
  
   } else {}
  
// prepare error messages based on language in form
   // alert ("Check name");  
  var usernameval = ref.document.loginform.loginname.value;	
  if ( usernameval.length <= 4 || usernameval.length > 50 ) {
	 errors += name_err_msg;
    }else{    
   }
  // alert ("Check word");  
  var userpasswordval = ref.document.loginform.loginword.value;	
  if ( userpasswordval.length <= 4 || userpasswordval.length > 15 ) {
	 errors += word_err_msg;
    }else{    
   }	
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{
  	    return true;
  }
}
// ---------------------------------------------------------------
function CheckLoginForm_2() { 
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        } 
  lang = ref.document.loginform_2.loginlang_2.value;
 	// alert ("Check Login: " + ref);   
  if (ref.document.loginform_2.loginlang_2.value == 'i') {
     var errorilabel  = "Errori nel formulario:\n\n";
   	 var name_err_msg = "Username non valido - min. 5 chars, max. 50 chars\n";
  	 var word_err_msg = "Password non valida - min. 5 chars, max. 15 chars\n";
   } else {}
   if (ref.document.loginform_2.loginlang_2.value == 'd') {
   	 var name_err_msg = "Username not valid - min. 5 chars, max. 50 chars\n";
   	 var word_err_msg = "Password not valid - min. 5 chars, max. 15 chars\n";
     var errorilabel  = "Errors in form:\n\n";
   } else {}
  if (ref.document.loginform_2.loginlang_2.value == 'f') {
   	 var name_err_msg = "Username not valid - min. 5 chars, max. 50 chars\n";
   	 var word_err_msg = "Password not valid - min. 5 chars, max. 15 chars\n";
     var errorilabel  = "Errors in form:\n\n";
  	
   } else {}
  if (ref.document.loginform_2.loginlang_2.value == 'e') {
   	 var name_err_msg = "Username not valid - min. 5 chars, max. 50 chars\n";
   	 var word_err_msg = "Password not valid - min. 5 chars, max. 15 chars\n";
     var errorilabel  = "Errors in form:\n\n";
  
   } else {}
  
// prepare error messages based on language in form
   // alert ("Check name");  
  var usernameval = ref.document.loginform_2.loginname.value;	
  if ( usernameval.length <= 4 || usernameval.length > 50 ) {
	 errors += name_err_msg;
    }else{    
   }
  // alert ("Check word");  
  var userpasswordval = ref.document.loginform_2.loginword.value;	
  if ( userpasswordval.length <= 4 || userpasswordval.length > 15 ) {
	 errors += word_err_msg;
    }else{    
   }	
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{
  	    return true;
  }
}
// ---------------------------------------------------------------
function CheckRecoverForm() { 
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        } 
  lang = ref.document.recoverform.loginlang_2.value;
 	// alert ("Check Login: " + ref);   
  if (ref.document.recoverform.loginlang_2.value == 'i') {
     	 var errorilabel  = "Errori nel formulario:\n\n";
   	 var name_err_msg = "Indirizzo email non valido - min. 5 chars, max. 50 chars\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars!\n";
   } else {}
   if (ref.document.recoverform.loginlang_2.value == 'd') {
   	 var name_err_msg = "Email address not valid - min. 5 chars, max. 50 chars\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars!\n";
     	 var errorilabel  = "Errors in form:\n\n";
   } else {}
  if (ref.document.recoverform.loginlang_2.value == 'f') {
   	 var name_err_msg = "Email address not valid - min. 5 chars, max. 50 chars\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars!\n";
     	 var errorilabel  = "Errors in form:\n\n";
  	
   } else {}
  if (ref.document.recoverform.loginlang_2.value == 'e') {
   	 var name_err_msg = "Email address not valid - min. 5 chars, max. 50 chars\n";
	 var security_code_err_msg = "Security Code obbligatorio - min. 6 chars, max. 7 chars!\n";
     	 var errorilabel  = "Errors in form:\n\n";
  
   } else {}
  
// prepare error messages based on language in form
   // alert ("Check name");  
  var usernameval = ref.document.recoverform.loginname.value;	
  if ( usernameval.length <= 4 || usernameval.length > 50 ) {
	 errors += name_err_msg;
    }else{    
   }
  // ----- security code
  var securitycodeval = ref.document.recoverform.security_code.value;
  if ( securitycodeval.length <= 5 || securitycodeval.length > 7 ) {
	 errors += security_code_err_msg;
    }else{    
   }  

// alert ("Check word");  
   if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{
  	    return true;
  }
}
// ---------------------------------------------------------------
function VerifyCartForm(id) { 
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        } 
  cartformname = 'cartform' + id;
  orderlangname = 'orderlang' + id;
  alert ("....ref.document." + cartformname + "." + orderlangname + ".value");
  language = ref.document.cartformname.orderlangname.value;
  alert ("   language:" + language);
  if ( language == 'i' ) {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Aggiungi articolo nel carrello ?";	 
  } else {}
  if ( language == 'd' ) {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Aggiungi articolo nel carrello ?";	 
  } else {}
  if ( language == 'f' ) {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Aggiungi articolo nel carrello ?";	 
  } else {}
  if ( language == 'e' ) {
     var errorilabel  = "Errors in form:\n\n";
     var confirm_msg  = "Add article to shopping cart ?";	 
  } else {}
   // alert ("Check quantity");  
   // qtyval = ref.document.cartform.order_quantity.value;	
  // ----- final confirmation required
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{  
      res = window.confirm(confirm_msg);
      if (res == true) {
	  	return true;
	  } else {
	    return false;
	  }	
  }
}
// ---------------------------------------------------------------
function ConfirmOrderForm() { 
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        } 
  // alert ("Verify Cart Form:" + ref);  
  // if ( ref.document.orderconfirmform.orderlang.value == 'i' ) {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Conferma invio ordine ?";	 
  //	} else {}
   // alert ("Check quantity");  
   // qtyval = ref.document.orderconfirmform.order_quantity.value;	
  // ----- final confirmation required
  //if ( errors.length > 1 ) {
  //  alert(errorilabel + errors);
  //  return false;  // FORM NOT submitted
  //}else{  
      res = window.confirm(confirm_msg);
      if (res == true) {
	  	return true;
	  } else {
	    return false;
	  }	
  // }
}
// ---------------------------------------------------------------
function CheckPaymentMethod()
{
var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        }
 
  var x = ref.document.forms[1].elements['radio_pay_1'];
  for (i=0;i<x.length;i++) {
  	  if (x[i].checked)
	  { 
	  	thevalue = x[i].value;
	  	//alert ("..looping with i= " + i + " value " + thevalue);
	  break;
	  }
  }
  if (!thevalue) {
     // No radio button is checked
	 // alert ("Not checked" + thevalue);
  } else {
  	// alert ("payment type:" + thevalue);
	ref.document.forms[1].elements['radio_pay_1'].checked;
	ref.document.forms[1].elements['payment_method'].value = thevalue;
  }
  return true;

}
// ---------------------------------------------------------------
function CheckContestForm() {
  var errors = "";
  var reply   = "";
  var i = 0;
  if ( NE ) { 
    ref = document.formlayer;
	// alert ("ref: " + ref);
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        }
   language = ref.document.reguserform.i_cus_language.value.toLowerCase();
  // alert ("Language is " + ref.document.reguserform.i_cus_language.value + " --- " +  language);  
  // prepare error messages based on language in form
   if ( language == 'i' ) {
     var errorilabel  = "Errori nel formulario:\n\n";
     var confirm_msg  = "Conferma partecipazione ?";	 
  	 var userfirst_err_msg = "Nome non valido - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "Cognome non valido - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "E-mail non valido - min. 5 chars, max. 50 chars\n";
	 var nosnake_err_msg = "Formato e-mail non valido - manca il carattere \"\@\"\n";
  	 var nodot_err_msg = "Formato e-mail non valido - manca il carattere \".\" \n";
	} else {}
  if (language == 'd') {
     var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm participation ?";	 
  	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
	 var nosnake_err_msg = "Formato e-mail non valido - manca il carattere \"\@\"\n";
  	 var nodot_err_msg = "Formato e-mail non valido - manca il carattere \".\" \n";
  } else {}
  if (language == 'f') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm participation ?";	 
	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
	 var nosnake_err_msg = "Formato e-mail non valido - manca il carattere \"\@\"\n";
  	 var nodot_err_msg = "Formato e-mail non valido - manca il carattere \".\" \n";
  } else {}
  if (language == 'e') {
  	 var errorilabel  = "Errors in form:\n\n";
	 var confirm_msg  = "Confirm participation ?";	 
	 var userfirst_err_msg = "User First Name invalid - min. 2 chars, max. 30 chars\n";
  	 var userlast_err_msg = "User Last Name invalid - min. 2 chars, max. 30 chars\n";
  	 var useremail_err_msg = "User Email Address invalid - min. 5 chars, max. 30 chars\n";
	 var nosnake_err_msg = "E-Mail format not valid - missing \"\@\"\n";
  	 var nodot_err_msg = "E-Mail format not valid - missing \".\" \n";
   } else {}
  // ----- user last name
  var userlastval = ref.document.reguserform.i_cus_lastname.value;
  strre = userlastval.replace(/ /gi, "_");
  userlastval = strre;
  if ( userlastval.length <= 1 || userlastval.length > 30 ) {
	 errors += userlast_err_msg;
    }else{    
   }		
  // ----- user first name
  var userfirstval = ref.document.reguserform.i_cus_name.value;
  strre = userfirstval.replace(/ /gi, "_");
  userfirstval = strre;
  if ( userfirstval.length <= 1 || userfirstval.length > 30 ) {
	 errors += userfirst_err_msg;
    }else{
   }
  // ----- user email address
  var emailval1 = ref.document.reguserform.i_cus_email1.value;
  // alert ("Emailval is: " + emailval1 + " - " + emailval2);  
  emailval = emailval1;
  strre = emailval.replace(/ /gi, "_");
  emailval = strre;
  emailsplitted = emailval.split("@");	
  if ( emailval.length <= 0 || emailval.length > 50 ) {
     errors += useremail_err_msg;
  }else if ( emailval.length <= 5 ) {
     errors += useremail_err_msg;
  	}else{
     emailsplitted = emailval.split("@");
     if ( emailsplitted.length < 2 || emailsplitted.length > 2 ) {
       errors += nosnake_err_msg;
     }
     if ( emailsplitted.length == 2 ) {
       if ( emailsplitted[0].length == 0 || emailsplitted[1].length == 0 ) {
         errors += useremail_err_msg;
       }
     }
     emailsplitted = emailval.split(".");
     if ( emailsplitted.length <= 1 ) {
       errors += nodot_err_msg;
     }
   }
   
   // Ready to continue:
  // alert ("Parameters: "  + userfirstval + userlastval + emailval);
  // ----- final confirmation required
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{  
      res = window.confirm(confirm_msg);
      if (res == true) {
	  	return true;
	  } else {
	    return false;
	  }	
  }
}
// ---------------------------------------------------------------
function confirmSubmit()
{

var agree=confirm("Confirm operation ?");
if (agree)
	return true ;
else
	return false ;
}

// ---------------------------------------------------------------
function confirmSubmitCart($inCart)
{

var agree=confirm($inCart + " ?");
if (agree)
	return true ;
else
	return false ;
}
// ---------------------------------------------------------------
function myopen(filename, windowname,properties)
{
 mywindow = window.open(filename,windowname,properties);
}
// ---------------------------------------------------------------
function checkCapsLock( e ) {
	var myKeyCode=0;
	var myShiftKey=false;
	var myMsg='Caps Lock is On.\n\nTo prevent entering your password incorrectly,\nyou should press Caps Lock to turn it off.';

	// Internet Explorer 4+
	if ( ref.document.all ) {
		myKeyCode=e.keyCode;
		myShiftKey=e.shiftKey;

	// Netscape 4
	} else if ( ref.document.layers ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	// Netscape 6
	} else if ( ref.document.getElementById ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	}

	// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
	if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
		alert( myMsg );

	// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
	} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
		alert( myMsg );

	}
}
function CheckKeyword() {
  var keyword_err_msg = "Keyword invalid - max 200 characters\n";
  var key_mm_err_msg = "Month mm invalid - 1 to 2 char, range is 01 - 12\n";    
    
  var key_yyyy_err_msg = "Year yyyy invalid - mandatory 4 char, range is 2002 - 3000\n";    
  var date_err_msg = "Date invalid - format should be dd/mm/yyyy\n";  
  var errorilabel  = "Errors in form:\n\n";
  var errors = "";
  var reply   = "";
  var i = 0;  
  if ( NE ) { 
    ref = document.formlayer;
	// alert ("ref: " + ref);
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        }
  var keywordval = ref.document.keywordform.keyword.value; 
  if ( keywordval.length > 200 ) {
	 errors += keyword_err_msg;
    }else{    
  }
  var key_mmval = ref.document.keywordform.key_mm.value;
  var key_yyyyval = ref.document.keywordform.key_yyyy.value;
  var key_ddval = ref.document.keywordform.key_dd.value;
  // if date omitted, assume starting date 01 01 2002 
  if ( key_ddval.length == 0 && key_mmval.length == 0 && key_yyyyval.length == 0) {
	  	key_ddval = 01;		
		key_mmval = 01;
		key_yyyyval = 2002;		
  } else {
  }
  
  if ( key_mmval.length <= 0 || key_mmval.length > 2 ) {
	 errors += key_mm_err_msg;
    }else{    
		  if ( key_mmval <= 0 || key_mmval > 12 ) {
			 errors += key_mm_err_msg;
		    }else{    
		  }       
  }
  if ( key_yyyyval.length <= 0 || key_yyyyval.length > 4 ) {
	 errors += key_yyyy_err_msg;
    }else{      
		  if ( key_yyyyval <= 2001 || key_yyyyval > 3000 ) {
			 errors += key_yyyy_err_msg;
		    }else{    
		  }
  } 
  
  var dd_limit = 31;
  if (key_mmval == 4 || key_mmval == 6 || key_mmval == 9 || key_mmval == 11) dd_limit = 30;
  if (key_mmval == 2 && (key_yyyyval/4) != Math.floor(key_yyyyval/4)) dd_limit = 28;
  if (key_mmval == 2 && (key_yyyyval/4) == Math.floor(key_yyyyval/4)) dd_limit = 29;
  var key_dd_err_msg = "Day dd invalid - 1 to 2 char, range for this month is 01 - " + dd_limit + "\n";  
  if ( key_ddval.length <= 0 || key_ddval.length > 2 ) {
	 errors += key_dd_err_msg;
    }else{      
		  if ( key_ddval <= 0 || key_ddval > dd_limit ) {
			 errors += key_dd_err_msg;
		    }else{    
		  }
  }       
  // alert (keywordval + " " + key_ddval + " " + key_mmval + " " + key_yyyyval + " -> dd limit: " + dd_limit);  
  if ( errors.length > 1 ) {
    alert(errorilabel + errors);
    return false;  // FORM NOT submitted
  }else{  
      return true;
  }    
}  
function CheckDate()
{
  if ( NE ) { 
    ref = document.formlayer;
	// alert ("ref: " + ref);
  }else if ( IE ) {
          ref = this; 
        }else{
          ref = this; 
        }
  var docloaddate = ref.document.documentform.docuploaddate_s.value;
  datesplitted = emailval.split("@");
  alert ("loaddate is " + docloaddate);	


 
  var DaysInMonth = 31;

  if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30;
  if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(WhichYear/4))	DaysInMonth = 28;
  if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(WhichYear/4))	DaysInMonth = 29;
  return DaysInMonth;

}


function CheckPwdGen()
{
	var agree = "Be extremely Carefull! This operation can compromise your entire site structure. Confirm operation ?";
	res = window.confirm(agree);
    if (res == true) {
  	    return true;
	} else {
	    return false;
	}	

}
  
