function showCPR(s) {
       var y = new Date().getYear();
       if (y<1900) y+=1900;
       if (s!=y)
          document.write(s + " - " + y);
	       else
          document.write(y);
}


function isEmail(obj) {
       if (obj.value.indexOf(" ") + "" == "-1"
       && obj.value.indexOf("@") + "" != "-1"
       && (obj.value.lastIndexOf(".") > obj.value.indexOf("@"))
       && obj.value != "") return true;
       else return false;
}

function verifCode(obj) {
       return (obj.value == "") || (obj.value.length == 5 && !isNaN(obj.value));
	   //si le champ est vide, je retourne vrai (parce que ca n est pas un champ obligatoire)
	   // ou si le champ a une longueur de 5 caractères et que c'est un nombre, je returne vrai
}

function checkKeyFull(field, evt, fld, len) {
	if (checkKey(field, evt)) {
		if ((field.value).length==len) {
			eval("document." + fld + ".focus();");
		}
		return true;
	} else return false;
}

function checkKey(field, evt) {
  var keyCode = 
    document.layers ? evt.which :
    document.all ? event.keyCode :
    document.getElementById ? evt.keyCode : 0;
  //alert(keyCode);
  if ((document.all || document.getElementById) && evt.shiftKey) {
    if (keyCode == 9) return true;
	return false;
  }
  if (document.layers && evt.modifiers & event.SHIFT_MASK) {
    if (keyCode == 9) return true;
	return false;
  }
  // 0 .. 9, 0 .. 9 on right keyboard, Backspace, Tab, End, Home, Left Arrow, Right Arrow, Del button
  if ((keyCode > 47 && keyCode < 58) || (keyCode > 95 && keyCode < 106) || keyCode == 8 || keyCode == 9 || keyCode == 35 || keyCode == 36 || keyCode == 37 || keyCode == 39  || keyCode == 46) return true;
  return false;
}

function setChkBtn(fldName,setIndex,maxIndex) {
 var i, t;
 t = eval("document." + fldName + setIndex + ".checked");
 if (t) {
  for (i=1; i<=maxIndex; i++) 
   if (i!=setIndex) eval("document." + fldName + i + ".checked = false;");
 }
}
function TestParam() 
{
	var Form = document.forms["FormContact"];
	if (Form.eNom.value == "") 
		{ alert("Attention, le nom est nécessaire"); Form.eNom.focus(); return }
	if (Form.ePrenom.value == "") 
		{ alert("Attention, le prénom est nécessaire"); Form.ePrenom.focus(); return }
	if (!isEmail(Form.eEmail))
		{ alert("Merci d'indiquer un email correct"); Form.eEmail.focus(); return }	
	if (!verifCode(Form.eCodePostal))
		{ alert("Merci d'indiquer un code postal correct"); Form.eCodePostal.focus(); return }
	if (Form.eTel.value != "" && (Form.eTel.value).length!=10)
		{ alert("Attention, le téléphone est nécessaire"); Form.eTel.focus(); return }		
	if (Form.eMessage.value == "")
		{ alert("Attention, le champ 'Message' doit être renseigné."); Form.eMessage.focus();
			return }		
	Form.action = "Procs/psContact.asp";
	Form.submit();															
}

function CacheMail(mail,domain) {
 this.location = 'mailto:' + mail + '@'+ domain;
}


function RefreshCaptcha() {
	var i = new Image();
	var d = new Date();
	i.src = 'Includes/modCaptcha.asp?Type=4&Dt=' + d.getHours().toString() + d.getMinutes().toString() + d.getSeconds().toString() ;
	document.getElementById("Captcha").src =  i.src;
}

function checkEMail(strEMail) {
   if (strEMail.indexOf(" ")!=-1) return false;
   var tmpPos = strEMail.indexOf("@");
   if (tmpPos<2 || (strEMail.indexOf("@",tmpPos+1)>-1) )  return false;
   if ((strEMail.charAt(0)=='@') || (strEMail.charAt(strEMail.length-1)=='@')) return false;
   return true;
   // var goodEmail = strEMail.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
 }

function myPopup2() {
window.open( "/interview-Karl-Touzalin.asp", "myWindow", 
"scrollbars=yes,toolbar=no,menubar=no,status=no,width = 885, height=750, resizable = 0" )
}
