var promo={code:"HP",lastId:"",timer:"",server:"http://harrypotter.canalcinco.com.mx/",loops:0,maxloops:350,msg:"",isMail:function(a){return/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/.test(a)},isAlphaNum:function(a){return/^\w+$/i.test(a)},isDigit:function(a){return/^\d+$/i.test(a)},minlen:function(b,a){if($(b).val().length>=a){return true}else{return false}},playSound:function(c){if(!this.pSound){return}if(this.sPying){return}this.sPying=true;var b=document.getElementById("comm_sound");var a='<embed src="'+this.server+"sounds/"+c+'.swf" width="1" height="1" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash">';b.innerHTML=a;setTimeout("promo.sPying=false;",3000)},chkDate:function(f){var d=new String(f);var b=new Date();var a=new String(d.substring(d.lastIndexOf("-")+1,d.length));var e=new String(d.substring(d.indexOf("-")+1,d.lastIndexOf("-")));var c=new String(d.substring(0,d.indexOf("-")));if(isNaN(a)||a.length<4||parseFloat(a)<1900){return false}if(isNaN(e)||parseFloat(e)<1||parseFloat(e)>12){return false}if(isNaN(c)||parseInt(c,10)<1||parseInt(c,10)>31){return false}if(e==4||e==6||e==9||e==11||e==2){if(e==2&&c>28||c>30){return false}}return true},loadJS:function(a){var c=document.createElement("script");c.setAttribute("type","text/javascript");c.setAttribute("src",a);var b=document.getElementsByTagName("head")[0];b.appendChild(c);return true},addCss:function(b){var a=document.createElement("style");a.type="text/css";if(a.styleSheet){a.styleSheet.cssText=b}else{a.appendChild(document.createTextNode(b))}document.getElementsByTagName("head")[0].appendChild(a)},chkPromo:function(){promo.loadJS(this.server+"check/usr/")},wait:function(){if(this.loops==this.maxloops){document.location.href="#"+this.code;this.lastId="#"+this.code;this.loops=0;alert("Se supero el tiempo maximo de espera");return false}else{this.loops++}if(location.hash!=this.lastId){this.lastId=location.hash;var a=false;switch(this.lastId){case"#RE":$("#register").show("slow");a=true;break;case"#LG":$("#login").show("slow");a=true;break;case"#E1":alert("error de seguridad");a=true;break;case"#AR":$("#bgBlack").show("slow");$("#modalContainer").html($("#recived").html());$("#modalContainer").show("slow");a=true;break;case"#NF":$("#bgBlack").show("slow");$("#modalContainer").html($("#participante").html());$("#modalContainer").show("slow");a=true;break;case"#NT":promo.loadJS(this.server+"check/date/");a=true;break;case"#FN":alert("Ingresa tu contraseña para participar.");$("#login").show("slow");a=true;break;case"#RC":$("#bgBlack").show("slow");$("#email_show").html($("#email02").val());$("#pass_show").html($("#pass01").val());$("#modalContainer").html($("#register_complete").html());$("#modalContainer").show("slow");a=true;break;case"#NU":$("#block_login").hide("slow");$("#errLogin").show("slow");$("#errLogin").removeClass("alerta");$("#errLogin").addClass("error");$("#errLogin").html("No se encontró el correo electrónico..");a=true;break;case"#CE":a=true;break;case"#NA":alert("Contesta todas las preguntas");$("#btn_submit").show("slow");a=true;break;case"#WP":$("#block_login").hide("slow");$("#errLogin").show("slow");$("#errLogin").removeClass("alerta");$("#errLogin").addClass("error");$("#errLogin").html("La constraseña introducida es incorrecta.");a=true;break}if(a){this.setView();document.getElementById("promo_frame").src=this.server+"blank.html";document.location.href="#"+this.code;this.lastId="#"+this.code;this.loops=0}else{promo.timer=setTimeout("promo.wait()",500)}}else{promo.timer=setTimeout("promo.wait()",500)}},chkMail:function(){wait4me=promo.fillmail();if(!this.isMail($("#email01").val())){alert("El correo electrónico parece no ser válido. Por favor revísalo.");return false}$("#work01").show("slow");promo.wait();return true},chkLogin:function(){msg="";$("#errLogin").hide("slow");if(!this.isMail($("#email03").val())){msg+="El correo electrónico parece no ser válido. Por favor revísalo.<br>"}if(!this.minlen("#pass03",1)){msg+="Favor de introducir una contraseña.<br>"}if(msg==""){$("#errLogin").html(msg);$("#block_login").show("slow");$("#work01").show("slow");promo.wait();return true}else{$("#errLogin").show("slow");$("#errLogin").removeClass("error");$("#errLogin").addClass("alerta");$("#errLogin").html(msg);return false}},alertNo:function(){alert("¿Estás seguro? Si eliges no registrarte, no podrás participar en la promoción.")},chkReg:function(){msg="";date="";if(!this.isMail($("#email02").val())){msg+="El correo electrónico parece no ser válido. Por favor revísalo.<br>"}if(!this.minlen("#name",4)){msg+="Introduce un nombre válido.<br>"}if(!this.minlen("#last_name",4)){msg+="Introduce tus apellidos.<br>"}if(!this.isDigit($("#zip_code").val())){msg+="Introduce un código postal válido..<br>"}if($("#state").val()==""){msg+="Selecciona el estado donde vives.<br>"}if($("#gender").val()==""){msg+="Selecciona tu sexo.<br>"}if($("#field01").val()==""){msg+="Selecciona tu nivel educativo.<br>"}if($("#field02").val()==""){msg+="Selecciona el lugar desde donde te conectas.<br>"}if($("#pass01").val()==""){msg+="La contraseña no puede estar vacia.<br>"}if($("#pass02").val()!=$("#pass01").val()){msg+="Tu contraseña y la confirmación no coinciden.<br>"}if($("#mm").val()==""){date="La fecha de nacimiento es obligatoria.<br>"}if($("#dd").val()==""){date="La fecha de nacimiento es obligatoria.<br>"}if($("#yyyy").val()==""){date="La fecha de nacimiento es obligatoria.<br>"}if(date!=""){msg+=date}else{if(!this.chkDate($("#dd").val()+"-"+$("#mm").val()+"-"+$("#yyyy").val())){msg+="La fecha de nacimiento parece no ser válida. Por favor revísala.<br>"}}if(msg==""){$("#block_register").show("slow");promo.wait();return true}else{this.msg=msg;$("#errRegister").show("slow");$("#errRegister").removeClass("error");$("#errRegister").addClass("alerta");$("#errRegister").html(msg);return false}},objhide:function(a){a.style.display="none"},login:function(){wait4me=promo.fillmail();$("#errLogin").hide("slow");document.location.href="#LG";promo.wait();return false},fillmail:function(){$("#register").hide("fast");$("#login").hide("fast");if(promo.isMail($("#email01").val())){$("#email02").val($("#email01").val());$("#email03").val($("#email01").val())}},setView:function(){try{urchinTracker(window.location);var b=new Image();b.src=doStats("return")}catch(a){}}};function chkPromo(){promo.chkPromo()}function send_form(current_form){var radio_group="";var ok_form=1;for(var ctr=0;ctr<current_form.length;ctr++){if(current_form[ctr].type=="radio"&&current_form[ctr].name!=radio_group){if(check_radio(eval("current_form."+current_form[ctr].name))){ok_form--;radio_group=current_form[ctr];break}radio_group=current_form[ctr].name}}if(ok_form){current_form.submit()}else{alert("Por favor, complete el cuestionario.");radio_group.focus()}}function check_radio(a){for(var b=0;b<a.length;b++){if(a[b].checked){return false}}return true};
