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-9$#%&{}+-_^*\/!`]{1,30}@ezb.ido.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@ezc.ido.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@ezd.ido.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@eze.ido.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@ezf.ido.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@ezg.ido.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@ezh.ido.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@ezi.ido.ne.jp;';
		filterSpecificJP +='^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@ezj.ido.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@sky.tu-ka.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@tkk.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@sky.tkk.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@sky.tkc.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,10}@mozio.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,10}@phone.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@moco.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@i.softbank.ne.jp;^[a-zA-Z0-9$#%&{}+-_^*\/!`]{1,30}@i.softbank.jp';

var filtragesEmail=new Array();
filtragesEmail["-10"]=new Array();
filtragesEmail["-10"][0]=filterSpecificJP;
filtragesEmail["-10"][1]="\u30cb\u30e5\u30fc\u30b9\u30ec\u30bf\u30fc\u306f\u30e2\u30d0\u30a4\u30eb\u30e1\u30fc\u30eb\u3067\u306f\u3054\u89a7\u3044\u305f\u3060\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<br />\u6b63\u3057\u3044PC\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u518d\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002";
filtragesEmail["-18"]=new Array();
filtragesEmail["-18"][0]=filterSpecificJP;
filtragesEmail["-18"][1]="message mobile JP-en";


var validationMailDirect=false;

var corrsMsgLangId=new Array();
corrsMsgLangId["-1"]=1;
corrsMsgLangId["-2"]=2;
corrsMsgLangId["-3"]=3;
corrsMsgLangId["-5"]=5;
corrsMsgLangId["-10"]=6;
corrsMsgLangId["-11"]=1;
corrsMsgLangId["-12"]=4;
corrsMsgLangId["-13"]=2;
corrsMsgLangId["-14"]=2;
corrsMsgLangId["-15"]=3;
corrsMsgLangId["-16"]=4;
corrsMsgLangId["-17"]=2;
corrsMsgLangId["-18"]=1;
corrsMsgLangId["-19"]=1;
corrsMsgLangId["-4"]=13;

var AlertEmailEmpty = new Array();
AlertEmailEmpty[1] = "Please enter an email address";
AlertEmailEmpty[2] = "Merci de saisir votre adresse e-mail";
AlertEmailEmpty[3] = "Bitte geben Sie Ihre E-Mail-Adresse ein.";
AlertEmailEmpty[4] = "Gelieve uw e-mail adres in te vullen";
AlertEmailEmpty[5] = "Por favor, introduzca una direcciÃ³n de correo electrÃ³nico vÃ¡lida";
AlertEmailEmpty[6] = "æœ‰åŠ¹ã?ªEãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’å…¥åŠ›ã?—ã?¦ä¸‹ã?•ã?„ã€‚";
AlertEmailEmpty[7] = "Please enter an email address.";
AlertEmailEmpty[8] = "Please enter an email address.";
AlertEmailEmpty[9] = "Eãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’å…¥åŠ›ã?—ã?¦ä¸‹ã?•ã?„";
AlertEmailEmpty[10] = "Please enter an email address.";
AlertEmailEmpty[11] = "Please enter an email address.";
AlertEmailEmpty[12] = "Please enter an email address.";
AlertEmailEmpty[13] = "La invitiamo ad inserire il suo indirizzo e-mail.";

var AlertEmailInvalid = new Array();
AlertEmailInvalid[1] = "Invalid e-mail address.<br />Please try again.";
AlertEmailInvalid[2] = "L'adresse Ã©lectronique que vous avez saisie est erronÃ©e.<br />Nous vous remercions de bien vouloir la saisir Ã  nouveau.";
AlertEmailInvalid[3] = "UngÃ¼ltige E-Mail-Adresse.<br />Bitte versuchen Sie es erneut.";
AlertEmailInvalid[4] = "Het ingevulde e-mailadres is onjuist.<br />Gelieve het nogmaals te willen invullen.";
AlertEmailInvalid[5] = "El correo electrÃ³nico indicado no es correcto.<br />Por favor, indique lo de nuevo.";
AlertEmailInvalid[6] = "\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u5165\u529b\u5185\u5bb9\u306b\u8aa4\u308a\u304c\u3042\u308a\u307e\u3059\u3002<br />\u6050\u308c\u5165\u308a\u307e\u3059\u304c\u3001\u3082\u3046\u4e00\u5ea6\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002";
AlertEmailInvalid[7] = "The email address is not valid";
AlertEmailInvalid[8] = "The email address is not valid";
AlertEmailInvalid[9] = "æœ‰åŠ¹ã?ªEãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’å…¥åŠ›ã?—ã?¦ä¸‹ã?•ã?„ã€‚";
AlertEmailInvalid[10] = "Please enter a valid email.";
AlertEmailInvalid[11] = "Please enter a valid email.";
AlertEmailInvalid[12] = "Please enter a valid email.";
AlertEmailInvalid[13] = "L'indirizzo elettronico da lei inserito \u00e8 sbagliato.<br />La invitiamo ad inserirlo nuovamente.";

function isMobileMail(mail,emailMob){	
	var tabDomaine = emailMob.split(";");
	for(i=0; i<tabDomaine.length; i++){
		var ExReg = new RegExp(tabDomaine[i]);
		if(ExReg.test(mail)){
			return true;
		}
	}
	return false;
}

function verifForm(email,langId,eleMsg,classe,style,functionCall) {
  filterSpecific=null;
  
  msgAlertEmailEmpty=AlertEmailEmpty[1];
  msgAlertEmailInvalid=AlertEmailInvalid[1];
  try {
    langdesc=corrsMsgLangId[document.getElementById(langId).value];
    if(langdesc>=1 && langdesc<=13){
        msgAlertEmailEmpty=AlertEmailEmpty[langdesc];
        msgAlertEmailInvalid=AlertEmailInvalid[langdesc];
    }
  }
  catch (err){}
  try {
    filterSpecific=filtragesEmail[document.getElementById(langId).value];
  }
  catch (err){
    filterSpecific=null;
  }
  
  validationPourExecution=false;
	if(email== "") {
		if (eleMsg != 'undefined' && eleMsg!=null ){
        if (document.getElementById(eleMsg)!= 'undefined' && document.getElementById(eleMsg)!= null){
          if (classe != 'undefined' && classe!=null ){
            document.getElementById(eleMsg).className=classe;
          }
          document.getElementById(eleMsg).innerHTML=msgAlertEmailEmpty;
        }
        else {
          msgAlert(msgAlertEmailEmpty);
        }
    }
    else {
      msgAlert(msgAlertEmailEmpty);
    }
	}
	else {
		if(!isValidEmail(email)) {
  		if (eleMsg != 'undefined' && eleMsg!=null ){
        if (document.getElementById(eleMsg)!= 'undefined' && document.getElementById(eleMsg)!= null){
          if (classe != 'undefined' && classe!=null ){
            document.getElementById(eleMsg).className=classe;
          }
          document.getElementById(eleMsg).innerHTML=msgAlertEmailInvalid;
        }
        else {
    			msgAlert(msgAlertEmailInvalid);
    		}
      }
      else {
  			msgAlert(msgAlertEmailInvalid);
  		}
		}
		else {
		  filtreOK=true;
      if (filterSpecific!=null){
        if (isMobileMail(email,filterSpecific[0])){
          filtreOK=false;
          if (document.getElementById(eleMsg)!= 'undefined' && document.getElementById(eleMsg)!= null){
            if (classe != 'undefined' && classe!=null ){
              document.getElementById(eleMsg).className=classe;
            }
            //alert(filterSpecific[1]);
            document.getElementById(eleMsg).innerHTML=filterSpecific[1];
          }
          else {
      			msgAlert(filterSpecific[1]);
      		}
        }
      }
      if (filtreOK==true){
  		  if (document.getElementById(eleMsg)!= 'undefined' && document.getElementById(eleMsg)!= null){
  		    document.getElementById(eleMsg).innerHTML='';
  		  }
        validationPourExecution=true;
      }
		}
	}
	return validationPourExecution;
}

/*
function verifForm(langId) {
	if(document.inscriptPopup.email.value == "") {
		alert(AlertEmailEmpty[langId]);
	}
	else {	
		if(!isValidEmail(document.inscriptPopup.email.value)) {
			alert(AlertEmailInvalid[langId]);
		}
		else {	
      if (validationMailDirect!='undefined' && validationMailDirect==true){
        window.location = "http://195.154.55.128/hermes_ombrelle/confirm-mail-us.html";
      }
      else {
        document.inscriptPopup.submit();
			}
		}
	}
}
*/

function isValidEmail(p_string)
{
	if(p_string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) return true;
	else return false;
}
