function NewWindow(theURL, hauteur, largeur) { var winl = (screen.width - largeur) / 2; var wint = (screen.height - hauteur) / 2; winprops = 'height='+hauteur+',width='+largeur+',top='+wint+',left='+winl+',scrollbars=0' win = window.open(theURL, "", winprops) } function NewWindowScroll(theURL, hauteur, largeur) { var winl = (screen.width - largeur) / 2; var wint = (screen.height - hauteur) / 2; winprops = 'height='+hauteur+',width='+largeur+',top='+wint+',left='+winl+',scrollbars=1' win = window.open(theURL, "", winprops) } function NewWindowScrollResize(theURL, hauteur, largeur) { var winl = (screen.width - largeur) / 2; var wint = (screen.height - hauteur) / 2; winprops = 'height='+hauteur+',width='+largeur+',top='+wint+',left='+winl+',scrollbars=1,resizable=1' win = window.open(theURL, "", winprops) } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i porque siempre se quedan por encima de las capas var sels=document.getElementsByTagName("select"); for (var i=0; i "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag){ var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function daysInFebruary (year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 ); } function DaysArray(n) { for (var i = 1; i <= n; i++) { this[i] = 31 if (i==4 || i==6 || i==9 || i==11) {this[i] = 30} if (i==2) {this[i] = 29} } return this } function isDate(dtStr){ var daysInMonth = DaysArray(12) var pos1=dtStr.indexOf(dtCh) var pos2=dtStr.indexOf(dtCh,pos1+1) var strMonth=dtStr.substring(0,pos1) var strDay=dtStr.substring(pos1+1,pos2) var strYear=dtStr.substring(pos2+1) strYr=strYear if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1) if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) for (var i = 1; i <= 3; i++) { if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1) } month=parseInt(strMonth) day=parseInt(strDay) year=parseInt(strYr) if (pos1==-1 || pos2==-1){ alert("Date must be in the following format : mm/dd/yyyy") return false } if (strMonth.length<1 || month<1 || month>12){ alert("Please, insert a correct month") return false } if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){ alert("Please, insert a correct date") return false } if (strYear.length != 4 || year==0 || yearmaxYear){ alert("Please insert a valid year of 4 digits between... "+minYear+" and "+maxYear) return false } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ alert("Please, insert a valid date") return false } return true } function trim(str) { return str.replace(/^\s*|\s*$/g,""); } //compruebo el correo function validarformnews() { var registro=document.form; registro.realname.value = trim(registro.realname.value); registro.email.value = trim(registro.email.value); registro.amigo1.value = trim(registro.amigo1.value); registro.amigo2.value = trim(registro.amigo2.value); registro.amigo3.value = trim(registro.amigo3.value); if( registro.realname.value.length == 0 ){ alert('You must insert your name'); registro.realname.focus(); return false; }else if (registro.email.value.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig)){ alert('You must insert a correct email address'); registro.email.focus(); return false; }else if (registro.email.value != registro.confemail.value){ alert('La confirmación del e-mail no coincide con el e-mail", $idioma); ?>'); registro.confemail.focus(); return false; }else if(registro.amigo1.value.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig) && registro.amigo1.value.length != 0){ alert('You must insert a correct email address for your 1st friend'); registro.amigo1.focus(); return false; }else if(registro.amigo2.value.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig) && registro.amigo2.value.length != 0){ alert('You must insert a correct email address for your 2nd friend'); registro.amigo2.focus(); return false; }else if(registro.amigo3.value.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig) && registro.amigo3.value.length != 0){ alert('You must insert a correct email address for your 3rd friend'); registro.amigo3.focus(); return false; }else if (!registro.newsletter.checked){ alert('You must accept to receive the newsletter'); registro.newsletter.focus(); return false; }else if (!registro.aviso_legal.checked){ alert('You must accept the legal advise'); registro.aviso_legal.focus(); return false; }else if (isDate(registro.mes.value + '/' + registro.dia.value + '/' + registro.anyo.value)==false){ registro.dia.focus(); return false; }else if (registro.email.value == registro.amigo1.value){ alert('Your email and your 1st friend are the same'); registro.amigo1.focus(); return false; }else if (registro.email.value == registro.amigo2.value){ alert('Tu email y el de tu amigo2 son iguales'); registro.amigo2.focus(); return false; }else if (registro.email.value == registro.amigo3.value){ alert('Your email and your 3rd friend are the same'); registro.amigo3.focus(); return false; }else if ((registro.amigo1.value == registro.amigo2.value) && (registro.amigo1.value.length != 0)){ alert('The email of your 1st and 2nd friend is the same'); registro.amigo2.focus(); return false; }else if ((registro.amigo1.value == registro.amigo3.value) && (registro.amigo1.value.length != 0)){ alert('The email of your 1st and 3rd friend is the same'); registro.amigo3.focus(); return false; }else if ((registro.amigo2.value == registro.amigo3.value) && (registro.amigo2.value.length != 0)){ alert('The email of your second and 3rd friend is the same'); registro.amigo3.focus(); return false; }else if (registro.email.value.length > 255) { alert('Email too long, maximum 255 characters'); registro.email.focus(); return false; }else if (registro.realname.value.length > 255) { alert('Name too long, maximum 255 characters'); registro.realname.focus(); return false; }else if (registro.amigo1.value.length > 255) { alert('Email of your 1st friend is too long, maximum 255 characters'); registro.amigo1.focus(); return false; }else if (registro.amigo2.value.length > 255) { alert('Email of your 2nd friend is too long, maximum 255 characters'); registro.amigo2.focus(); return false; }else if (registro.amigo3.value.length > 255) { alert('Email of your 3rd friend is too long, maximum 255 characters'); registro.amigo3.focus(); return false; }else{ return true; } } //window.onload=iniciaTexto; window.onload=iniciaFormularios;