function file_quick(fichier){if(window.XMLHttpRequest){xhr_object=new XMLHttpRequest();}else if(window.ActiveXObject){xhr_object=new ActiveXObject("Microsoft.XMLHTTP");}else{return(false);}
xhr_object.open("GET",fichier,false);xhr_object.send(null);if(xhr_object.readyState==4){return(xhr_object.responseText);}else{return(false);}}
function checkEmail(email){if(email.search(/^[_a-z0-9-]+(\.[_a-z0-9-]*)*[^._-]@[a-z0-9-]+(\.[a-z0-9]{2,4})$/i)==-1){return false;}else{return true;}}
function verifFormAndSaveEmail(params){var error=0;var myForm=document.forms["email_form"];var email_input=myForm.elements["email"].value;if((typeof(wnc_lang)=="undefined")||(wnc_lang=="")){wnc_lang="fr";}
if(!checkEmail(email_input)){error=1;if(wnc_lang=="fr"){msg="Veuillez entrer un EMAIL valide (ex : nom@fournisseur.com) !\n";}
else if(wnc_lang=="en"){msg="Please enter a valid EMAIL (ex : name@company.com) !\n";}
else if(wnc_lang=="es"){msg="Por favor entren un EMAIL valido (por ejemplo: apellido@proveedor.com) !\n";}}
if(error==0){error_in=file_quick("http://media.acces-charme.com/email_catcher/click.php?email="+escape(email_input)+"&"+params);return true;}else{alert(msg);return false;}}
function wnc_addEvent(obj,evType,fn){if(obj.addEventListener){obj.addEventListener(evType,fn,false);return true;}else if(obj.attachEvent){var r=obj.attachEvent("on"+evType,fn);return r;}else{return false;}};function wnc_warn(name,nb){if(wnc_active_shake){wnc_shaker.start();}
var n=document.getElementById(name);var b=0;var c=["red","white"];var i=window.setInterval(function(){n.style.backgroundColor=n.style.backgroundColor!=wnc_couleur_warn?wnc_couleur_warn:"white";b++;if(b==nb){window.clearInterval(i);}},100);}
function wnc_shake(){wnc_shaker=new wnc_shaker_class("email",20,70,10);}
function wnc_shaker_class(name,rate,speed,nb_times){obj=document.getElementById(name);var oL=obj.offsetLeft;var oT=obj.offsetTop;this.stop=null;this.oTime=null;this.oStop=null;var om=this;this.start=function(){if(parseInt(obj.style.left)==oL-2){obj.style.top=oT+2+"px";setTimeout(function(){obj.style.left=oL+2+"px"},rate)}else{obj.style.top=oT-2+"px";setTimeout(function(){obj.style.left=oL-2+"px"},rate)}
this.oTime=setTimeout(function(){om.start()},speed);this.oStop=setTimeout(function(){om.stop()},1000);}
this.stop=function(){clearTimeout(this.oTime);clearTimeout(this.oStop);}}
if(typeof(wnc_active_shake)=="undefined"){wnc_active_shake=false;}
if(wnc_active_shake){wnc_addEvent(window,"load",wnc_shake);};function wnc_start_blink(){wnc_email=document.getElementById("email");if((wnc_email.value==wnc_txt)||(wnc_email.value=='')){wnc_timer=window.setInterval("wnc_blinking()",500);}}
function wnc_blinking(){wnc_email.value=wnc_email.value!=wnc_txt?wnc_txt:"";}
function wnc_stop_blink(){window.clearInterval(wnc_timer);if((wnc_email.value==wnc_txt)||(wnc_email.value=='')){wnc_email.value='';}}
if(typeof(wnc_active_blink)=="undefined"){wnc_active_blink=false;}
if(wnc_active_blink){wnc_addEvent(window,"load",wnc_start_blink);}
