var oFormExpo = new function(){ var erEmail = RegExp('^[a-z0-9_\.\-]+@[a-z0-9_\-]+(\.[a-z0-9_\-]{2,5})*\.[a-z]{2,4}$'); var erNumero = RegExp('^[0-9]+$'); var erFecha = RegExp('^(0[1-9]|[1-2][0-9]|3[0-1])/(0[1-9]|1[0-2])/[1-2][0-9]{3}$'); var erSiNo = RegExp('^[01]$'); var errorClass = 'fieldsetError'; //C this.enviarForm = function(evt){ var error = false, t = '',i; if(evt){ StopEvent(evt); } if(wait || !iniciado){ return false; } nombreR.onblur(); if(nombreR.parentNode.className == errorClass){ error = true; } apellidoR.onblur(); if(apellidoR.parentNode.className == errorClass){ error = true; } emailR.onblur(); if(emailR.parentNode.className == errorClass){ error = true; } colegio.onblur(); if(colegio.parentNode.className == errorClass){ error = true; } dia.onblur(); if(dia.parentNode.className == errorClass){ error = true; } mes.onblur(); if(mes.parentNode.className == errorClass){ error = true; } anio.onblur(); if(anio.parentNode.className == errorClass){ error = true; } var v =''; if(error){ errorR.innerHTML = 'Complete o corrija los campos resaltados'; errorR.style.display = 'block'; return false; } errorR.style.display = 'none'; wait = true; reqType = 'enviarForm'; t += getDatosPersonales(); Blocker.show(); Loader.show(); $('iframeFree').src = '/requests/descargaFreePass.php?idUsuario=2'; req.pedir(DIR_ROOT + 'requests/registroExpo15.php', t); } //G var getDatosPersonales = function(){ datosPersonales = ''; datosPersonales += 'nombre' + SEP_IGUAL + trim(nombreR.value) + SEP_AND; datosPersonales += 'apellido' + SEP_IGUAL + trim(apellidoR.value) + SEP_AND; datosPersonales += 'email' + SEP_IGUAL + trim(emailR.value) + SEP_AND; datosPersonales += 'colegio' + SEP_IGUAL + trim(colegio.value) + SEP_AND; datosPersonales += 'dia' + SEP_IGUAL + trim(dia.value) + SEP_AND; datosPersonales += 'mes' + SEP_IGUAL + trim(mes.value) + SEP_AND; datosPersonales += 'anio' + SEP_IGUAL + trim(anio.value) + SEP_AND; return datosPersonales; } //I var inicializarFormulario = function(){ nombreR = $('nombreExpo'); if(!nombreR.onblur){ nombreR.onblur = function(){ var v = trim(this.value); if(v == '' || v.length < 3){ this.parentNode.className = errorClass; } else{ this.parentNode.className = ''; } }.closure(nombreR); } apellidoR = $('apellidoExpo'); if(!apellidoR.onblur){ apellidoR.onblur = function(){ var v = trim(this.value); if(v == '' || v.length < 3){ this.parentNode.className = errorClass; } else{ this.parentNode.className = ''; } }.closure(apellidoR); } colegio = $('colegioExpo'); if(!colegio.onblur){ colegio.onblur = function(){ var v = trim(this.value); if(v == '' || v.length < 3){ this.parentNode.className = errorClass; } else{ this.parentNode.className = ''; } }.closure(colegio); } emailR = $('emailExpo'); if(!emailR.onblur){ emailR.onblur = function(){ var v = trim(this.value); if(v == '' || !erEmail.test(v)){ this.parentNode.className = errorClass; } else{ this.parentNode.className = ''; } }.closure(emailR); } dia = $('diaCumpleExpo'); if(!dia.onchange){ dia.onchange = function(){ }; } if(!dia.onblur){ dia.onblur = function(){ var v = trim(this.value); if(v == '' || !erNumero.test(v)){ this.parentNode.className = errorClass; } else{ this.parentNode.className = ''; if(mes.value == '-1'){ this.parentNode.className = errorClass; } if(anio.value == '-1'){ this.parentNode.className = errorClass; } } }.closure(dia); } mes = $('mesCumpleExpo'); if(!mes.onchange){ mes.onchange = function(){ }; } if(!mes.onblur){ mes.onblur = function(){ var v = trim(this.value); if(v == '-1'){ this.parentNode.className = errorClass; } else{ this.parentNode.className = ''; if(dia.value == '-1'){ this.parentNode.className = errorClass; } if(anio.value == '-1'){ this.parentNode.className = errorClass; } } }.closure(mes); } anio = $('anioCumpleExpo'); if(!anio.onchange){ anio.onchange = function(){ }; } if(!anio.onblur){ anio.onblur = function(){ var v = trim(this.value); if(v == '' || !erNumero.test(v)){ this.parentNode.className = errorClass; } else{ this.parentNode.className = ''; if(dia.value == '-1'){ this.parentNode.className = errorClass; } if(mes.value == '-1'){ this.parentNode.className = errorClass; } } }.closure(anio); } errorR = $('errorExpo'); iniciado = true; } //L var listener = function(){ var d = req.respuestaXML; wait = false; if(!d){ alert(req.respuestaHTML); } // else if(reqType == 'enviarForm'){ if(d.getAttribute('exito') != 'si'){ errorR.innerHTML = d.firstChild.data; errorR.style.display = 'block'; } else{ Blocker.hide(); Loader.hide(); } } }.closure(this); // Envio de Consulta del Clasificado var datosPersonales = ''; var idPlus, nombreR, apellidoR, emailR, colegio, dia, mes, anio, errorR, cargandoR, exitoR; var consultaTabIndex = 0; var iniciado = false; var clasInfo; var wait = false, reqType; var req = new Request(listener); inicializarFormulario(); }