var longRfc=13;
function habilitaCampos(habilitado){
document.getElementsByName('tipoPersona')[0].disabled = !habilitado;
document.getElementsByName('tipoPersona')[1].disabled = !habilitado;
//Deshabilita elementos
document.getElementsByName('razonSocialText')[0].disabled = !habilitado;
document.getElementsByName('rfcText')[0].disabled = !habilitado;
document.getElementsByName('nomRepLegalText')[0].disabled = !habilitado;
document.getElementsByName('emailText')[0].disabled = !habilitado;
document.getElementsByName('calleText')[0].disabled = !habilitado;
document.getElementsByName('numLetIntText')[0].disabled = !habilitado;
document.getElementsByName('numLetExtText')[0].disabled = !habilitado;
document.getElementsByName('entreCalle1Text')[0].disabled = !habilitado;
document.getElementsByName('entreCalle2Text')[0].disabled = !habilitado;
document.getElementsByName('coloniaText')[0].disabled = !habilitado;
document.getElementsByName('localidadText')[0].disabled = !habilitado;
document.getElementsByName('codigoPostalText')[0].disabled = !habilitado;
document.getElementsByName('curpText')[0].disabled = !habilitado;
//Pone el estilo
//Deshabilita elementos
document.getElementsByName('razonSocialText')[0].className = "mediano_disable_" + !habilitado;
document.getElementsByName('rfcText')[0].className = "mediano_disable_" + !habilitado;
document.getElementsByName('nomRepLegalText')[0].className = "mediano_disable_" + !habilitado;
document.getElementsByName('emailText')[0].className = "mediano_disable_" + !habilitado;
document.getElementsByName('calleText')[0].className = "mediano_disable_" + !habilitado;
document.getElementsByName('numLetIntText')[0].className = "pequenio_disable_" + !habilitado;
document.getElementsByName('numLetExtText')[0].className = "pequenio_disable_" + !habilitado;
document.getElementsByName('entreCalle1Text')[0].className = "mediano_disable_" + !habilitado;
document.getElementsByName('entreCalle2Text')[0].className = "mediano_disable_" + !habilitado;
document.getElementsByName('codigoPostalText')[0].className = "mediano_disable_" + !habilitado;
document.getElementsByName('curpText')[0].className = "mediano_disable_" + !habilitado;
document.getElementsByName('coloniaText')[0].className = "largo_disable_" + !habilitado;
document.getElementsByName('localidadText')[0].className = "largo_disable_" + !habilitado;
document.getElementsByName('munDelText')[0].className = "largo_disable_true";
document.getElementsByName('entFederativaText')[0].className = "largo_disable_true";
if(document.getElementById('moralRadio').checked){
document.getElementsByName('razonSocialText')[0].maxlength="12";
longRfc=12;
document.getElementsByName('curpText')[0].value = "";
document.getElementsByName('curpText')[0].disabled = habilitado;
document.getElementsByName('curpText')[0].className = "mediano_disable_true";
} else if(document.getElementById('fisicaRadio').checked){
document.getElementsByName('razonSocialText')[0].maxlength="13";
longRfc=13;
document.getElementsByName('curpText')[0].disabled = !habilitado;
}
}
function validarExistenciaRFC(){
var textoErrores = "";
var forma = document.forms[0];
// forma.rfcText.value = trim(forma.rfcText.value.toUpperCase().replace('ý','Ñ'));
var dato = forma.rfcText.value;
var bandera = false;
if( dato == null || dato == "" ){
bandera = false;
// textoErrores += "
Debe de ingresar su RFC.";
} else {
moralRadioUno=document.getElementById('moralRadio');
if ( moralRadioUno.checked && (moralRadioUno.value == "moral") ) {
if( dato != "" && dato.length != 12 ){
//textoErrores += "La longitud del RFC que ingreso, no corresponde al Tipo de Persona seleccionado.";
bandera = false;
} else {
if( dato != "" && !validaRfc( dato ) ){
textoErrores += "El RFC que ingreso es incorrecto.";
bandera = false;
} else {
bandera = true;
}
}
} else if ( document.getElementById('fisicaRadio').checked && (document.getElementById('fisicaRadio').value == "fisica") ) {
if( dato != "" && dato.length != 13 ){
//textoErrores += "La longitud del RFC que ingreso, no corresponde al Tipo de Persona seleccionado.";
bandera = false;
} else {
if( dato != "" && !validaRfc( dato ) ){
textoErrores += "El RFC que ingreso es incorrecto.";
bandera = false;
} else {
bandera = true;
}
}
}
}
// Muestra mensajes de errores
if( textoErrores.length > 0 ){
document.getElementById('textoError').innerHTML = "";
document.getElementById('textoError').style.visibility = "visible";
bloqueaBotones( false );
} else {
if( bandera == true ){
document.getElementById('textoError').innerHTML = "";
document.getElementById('textoError').style.visibility = "hidden";
/*AgregaCodigo*/
bloqueaBotones( true );
// document.forms[0].parameter.value="validaExistencia";
document.forms[0].parameter.value="buscarRegistro";
document.forms[0].submit();
/*AgregaCodigo*/
}
}
}
function valida(){
var forma = document.forms[0];
if( ( forma.rfcText.value != null && forma.rfcText.value != "" ) &&
document.getElementsByName('rfcText')[0].disabled == true ) {
document.getElementsByName('rfcText')[0].disabled = false;
enviaControlSipress();
} else {
if( document.getElementById('fisicaRadio').checked ){
// document.getElementById('fisicaRadio').checked;
validaFisica();
} else if ( document.getElementById('moralRadio').checked ){
// document.getElementById('moralRadio').checked
validaMoral();
} else{
textoErrores = "Debe seleccionar si es persona física o moral.";
document.getElementById('textoError').innerHTML = "";
document.getElementById('textoError').style.visibility = "visible";
bloqueaBotones( false );
}
}
}
/******************************************
* VALIDA LOS CAMPOS PARA LA PERSONA MORAL *
******************************************/
function validaMoral(){
var dato = "";
var longitud = 0;
var textoErrores = "";
var forma = document.forms[0];
if( forma.razonSocialText.value == "" && forma.rfcText.value == "" && forma.nomRepLegalText.value == "" &&
forma.emailText.value == "" && forma.calleText.value == "" &&
forma.numLetIntText.value == "" && forma.numLetExtText.value == "" && forma.entreCalle1Text.value == "" &&
forma.entreCalle2Text.value == "" && forma.coloniaText.value == "" && forma.localidadText.value == "" &&
forma.munDelText.value == "" && forma.entFederativaText.value == "" && forma.codigoPostalText ){
textoErrores += "Debe de ingresar todos los campos solicitados.";
} else { // SECCION DE VALIDACION DE CAMPOS
// **************************** SECCION DE DATOS PERSONALES DEL BENEFICIARIO ****************************
// **************************** RFC ****************************
// forma.rfcText.value = trim(forma.rfcText.value.toUpperCase().replace('ý','Ñ') );
dato = forma.rfcText.value;
if( dato == null || dato == "" ){
textoErrores += "Debe de ingresar su RFC.";
} else {
if( dato.length != 12 ) { // RFC PERSONA MORAL
textoErrores += "La longitud del RFC que ingreso, no corresponde al Tipo de Persona seleccionado.";
} else {
if( !validaRfc( dato ) ){
textoErrores += "El RFC que ingreso es incorrecto.";
}
}
}
// **************************** RAZON SOCIAL ****************************
// forma.razonSocialText.value = trim(forma.razonSocialText.value.toUpperCase().replace('ý','Ñ') );
dato = forma.razonSocialText.value;
longitud = forma.razonSocialText.length;
if( dato == null || dato == "" ){
textoErrores += "Debe de ingresar su Razón Social.";
// } else {
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "Verifique que su Razón Social sea correcta.";
// }
}
// **************************** NOMBRE REPRESENTANTE LEGAL ****************************
forma.nomRepLegalText.value = trim( forma.nomRepLegalText.value );
dato = forma.nomRepLegalText.value;
if( ( dato.split(" ").length == dato.length+1 ) || ( dato == "" ) ){
textoErrores += "Debe de ingresar el Nombre del Representante Legal.";
// } else {
// if( !validaSoloLetras( dato ) ){
// textoErrores += "El nombre del representante legal contiene caracteres inválidos.";
// }
}
// **************************** CURP ****************************
/*forma.curpText.value = trim( forma.curpText.value );
dato = forma.curpText.value;
if( dato == null || dato == "" ){
textoErrores += "Debe de ingresar la CURP del Beneficiario.";
} else {
if( dato.length < 18 ){
textoErrores += "La longitud de la CURP es incorrecta, verifíquela.";
// } else {
// if( !validaCurp( dato ) ){
// textoErrores += "La CURP contiene caracteres inválidos.";
// }
}
}*/
// **************************** CORREO ELECTRONICO ****************************
forma.emailText.value = trim(forma.emailText.value);
dato = forma.emailText.value;
if( dato == null || dato == "" ){
textoErrores += "Debe de ingresar su Correo Electrónico.";
// } else {
// if( !validaEmail( dato ) ){
// textoErrores += "Verifique que su Correo Electrónico sea correcto.";
// }
}
// **************************** SECCION DE DATOS DEL DOMICILIO FISCAL DEL BENEFICIARIO ****************************
// **************************** CALLE ****************************
forma.calleText.value = trim( forma.calleText.value );
dato = forma.calleText.value;
if( dato == null || dato == "" ){
textoErrores += "Debe de ingresar la Calle del Domicilio Fiscal.";
// } else {
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "La calle no puede contener caracteres numéricos.";
// }
}
// **************************** NUM LET INT ****************************
forma.numLetIntText.value = trim( forma.numLetIntText.value );
dato = forma.numLetIntText.value;
if( dato != null && dato != "" ){
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "El Número Interior debe de ser numérico.";
// }
}
// **************************** NUM LET EXT ****************************
forma.numLetExtText.value = trim( forma.numLetExtText.value);
dato = forma.numLetExtText.value;
if( dato == null || dato == "" ){
textoErrores += "Debe de ingresar el Número Exterior del Domicilio Fiscal.";
// } else {
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "El Número Exterior debe de ser numérico.";
// }
}
// **************************** ENTRE CALLE 1 ****************************
forma.entreCalle1Text.value = trim( forma.entreCalle1Text.value);
dato = forma.entreCalle1Text.value;
var errorCalles = false;
if( dato != null && dato != "" ){
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "El campo de entre calle no puede ser numérico.";
// }
} else {
textoErrores += "Debe de indicar entre que calles se encuentra el Domicilio Fiscal.";
errorCalles = true;
}
// **************************** ENTRE CALLE 2 ****************************
forma.entreCalle2Text.value = trim( forma.entreCalle2Text.value );
dato = forma.entreCalle2Text.value;
if( dato != null && dato != "" ){
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "El campo 'y entre' no puede ser numérico.";
// }
} else {
if(!errorCalles){
textoErrores += "Debe de indicar entre que calles se encuentra el Domicilio Fiscal.";
}
}
// **************************** COLONIA, LOCALIDAD, MUNICIPIO DELEGACION Y ENTIDAD FEDERATIVA ****************************
var colonia = forma.coloniaText.value;
var localidad = forma.localidadText.value;
if( colonia == 0 && localidad == 0 ){
textoErrores += "Debe de seleccionar la Colonia y/ó la Localidad.";
}
/** ACTUALIZACION PARA TOMAR EL VALOR DEL INDICE DE COLONIA, LOCALIDAD, MUNICIPIO/DELEGACION Y ENTIDAD FEDERATIVA */
var indiceCol = forma.coloniaText.selectedIndex;
var indiceLocalidad = forma.localidadText.selectedIndex;
var indiceMunDel = forma.munDelText.selectedIndex;
var indiceEntFed = forma.entFederativaText.selectedIndex;
// -- SE ASIGNAN VALORES A LAS VARIABLES OCULTAS DEL JSP
forma.claveColonia.value = document.forms[0].coloniaText.options[ indiceCol ].text;
forma.claveLocalidad.value = document.forms[0].localidadText.options[ indiceLocalidad ].text;
forma.claveMunicipioDelegacion.value = document.forms[0].munDelText.options[ indiceMunDel ].text;
forma.claveEntidadFederativa.value = document.forms[0].entFederativaText.options[ indiceEntFed ].text;
/** ----------------------------------------------------------------------- Terminan nuevos campos */
// **************************** CODIGO POSTAL ****************************
forma.codigoPostalText.value = trim( forma.codigoPostalText.value );
dato = forma.codigoPostalText.value;
if( dato != null && dato != "" ){
// if( !validaSoloNumeros( dato ) ){
// textoErrores += "El Código Postal debe de ser numérico";
// }
if( dato.length != 5 ){
textoErrores += "La longitud del Código Postal es incorrecta";
}
} else {
textoErrores += "Debe de ingresar el Código Postal del Domicilio Fiscal.";
}
}
// Muestra mensajes de errores
if( textoErrores.length > 0 ){
document.getElementById('textoError').innerHTML = "";
document.getElementById('textoError').style.visibility = "visible";
bloqueaBotones( false );
} else {
document.getElementById('textoError').innerHTML = "";
document.getElementById('textoError').style.visibility = "hidden";
// Se habilitan los combos para poder llevar el valor al action
document.getElementsByName('munDelText')[0].disabled = false;
document.getElementsByName('entFederativaText')[0].disabled = false;
// --- Finaliza
/*AgregaCodigo*/
bloqueaBotones( true );
document.forms[0].parameter.value="guardarRegistro";
document.forms[0].submit();
/*AgregaCodigo*/
}
}
function validaFisica(){
var dato = "";
var longitud = 0;
var textoErrores = "";
var forma = document.forms[0];
if( forma.nomRepLegalText.value == "" && forma.razonSocialText.value == "" && forma.rfcText.value == "" &&
forma.curpText.value == "" && forma.emailText.value == "" && forma.calleText.value == "" &&
forma.numLetExtText.value == "" && forma.entreCalle1Text.value == "" && forma.entreCalle2Text.value == "" &&
forma.coloniaText.value == "" && forma.localidadText.value == "" && forma.munDelText.value == "" &&
forma.entFederativaText.value == "" && forma.codigoPostalText.value == "" ){
textoErrores += "Debe de ingresar todos los campos solicitados.";
} else { // SECCION DE VALIDACION DE CAMPOS
// **************************** SECCION DE DATOS PERSONALES DEL BENEFICIARIO ****************************
// **************************** RFC ****************************
forma.rfcText.value = trim( forma.rfcText.value );
dato = forma.rfcText.value;
if( dato != null && dato != "" ){
if ( dato.length == 13 ) { // RFC PERSONA FISICA
if( !validaRfc( dato ) ){
textoErrores += "El RFC que ingreso es incorrecto.";
}
} else {
textoErrores += "La longitud del RFC que ingreso, no corresponde al Tipo de Persona seleccionado.";
}
} else {
textoErrores += "Debe de ingresar su RFC.";
}
// **************************** RAZON SOCIAL / NOMBRE DEL BENEFICIARIO ****************************
forma.razonSocialText.value = trim( forma.razonSocialText.value );
dato = forma.razonSocialText.value;
longitud = forma.razonSocialText.length;
if( ( dato.split(" ").length == dato.length+1 ) || ( dato == "" ) ){
textoErrores += "Debe de ingresar su Razón Social.";
} else {
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "Verifique que su Razón Social sea correcta.";
// }
}
// **************************** NOMBRE REPRESENTANTE LEGAL ****************************
forma.nomRepLegalText.value = trim( forma.nomRepLegalText.value );
dato = forma.nomRepLegalText.value;
if( dato != null && dato != "" ){
// if( !validaSoloLetras( dato ) ){
// textoErrores += "El nombre del representante legal contiene caracteres inválidos.";
// }
}
// **************************** CURP ****************************
forma.curpText.value = trim( forma.curpText.value );
dato = forma.curpText.value;
if( dato != null && dato != "" ){
if( dato.length < 18 ){
textoErrores += "La longitud de la CURP es incorrecta, verifíquela.";
} else {
// if( !validaCurp( dato ) ){
// textoErrores += "La CURP contiene caracteres inválidos.";
// }
}
} else {
textoErrores += "Debe de ingresar la CURP del Beneficiario.";
}
// **************************** CORREO ELECTRONICO ****************************
forma.emailText.value = trim(forma.emailText.value);
dato = forma.emailText.value;
if( dato != null && dato != "" ){
// if( !validaEmail( dato ) ){
// textoErrores += "Verifique que su Correo Electrónico sea correcto.";
// }
} else {
textoErrores += "Debe de ingresar su Correo Electrónico.";
}
// **************************** SECCION DE DATOS DEL DOMICILIO FISCAL DEL BENEFICIARIO ****************************
// **************************** CALLE ****************************
forma.calleText.value = trim( forma.calleText.value );
dato = forma.calleText.value;
if( ( dato.split(" ").length == dato.length+1 ) || ( dato == "" ) ){
textoErrores += "Debe de ingresar la Calle del Domicilio Fiscal.";
} else {
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "La calle no puede contener caracteres numéricos.";
// }
}
// **************************** NUM LET INT ****************************
forma.numLetIntText.value = trim( forma.numLetIntText.value.toUpperCase() );
dato = forma.numLetIntText.value;
if( dato != null && dato != "" ){
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "El Número Interior debe de ser numérico.";
// }
}
// **************************** NUM LET EXT ****************************
forma.numLetExtText.value = trim( forma.numLetExtText.value.toUpperCase() );
dato = forma.numLetExtText.value;
if( dato != null && dato != "" ){
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "El Número Exterior debe de ser numérico.";
// }
} else {
textoErrores += "Debe de ingresar el Número Exterior del Domicilio Fiscal.";
}
// **************************** ENTRE CALLE 1 ****************************
forma.entreCalle1Text.value = trim( forma.entreCalle1Text.value );
dato = forma.entreCalle1Text.value;
if( dato != null && dato != "" ){
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "El campo de entre calle no puede ser numérico.";
// }
} else {
textoErrores += "Debe de indicar entre que calles se encuentra el Domicilio Fiscal.";
}
// **************************** ENTRE CALLE 2 ****************************
forma.entreCalle2Text.value = trim( forma.entreCalle2Text.value );
dato = forma.entreCalle2Text.value;
if( dato != null && dato != "" ){
// if( !validaAlfanumerico( dato ) ){
// textoErrores += "El campo 'y entre' no puede ser numérico.";
// }
} else {
textoErrores += "Debe de indicar entre que calles se encuentra el Domicilio Fiscal.";
}
// **************************** COLONIA, LOCALIDAD, MUNICIPIO DELEGACION Y ENTIDAD FEDERATIVA ****************************
var colonia = forma.coloniaText.value;
var localidad = forma.localidadText.value;
if( colonia == 0 && localidad == 0 ){
textoErrores += "Debe de seleccionar la Colonia y/ó la Localidad.";
}
/** ACTUALIZACION PARA TOMAR EL VALOR DEL INDICE DE COLONIA, LOCALIDAD, MUNICIPIO/DELEGACION Y ENTIDAD FEDERATIVA */
var indiceCol = forma.coloniaText.selectedIndex;
var indiceLocalidad = forma.localidadText.selectedIndex;
var indiceMunDel = forma.munDelText.selectedIndex;
var indiceEntFed = forma.entFederativaText.selectedIndex;
// -- SE ASIGNAN VALORES A LAS VARIABLES OCULTAS DEL JSP
forma.claveColonia.value = document.forms[0].coloniaText.options[ indiceCol ].text;
forma.claveLocalidad.value = document.forms[0].localidadText.options[ indiceLocalidad ].text;
forma.claveMunicipioDelegacion.value = document.forms[0].munDelText.options[ indiceMunDel ].text;
forma.claveEntidadFederativa.value = document.forms[0].entFederativaText.options[ indiceEntFed ].text;
/** ----------------------------------------------------------------------- Terminan nuevos campos */
// **************************** CODIGO POSTAL ****************************
forma.codigoPostalText.value = trim( forma.codigoPostalText.value.toUpperCase() );
dato = forma.codigoPostalText.value;
if( dato != null && dato != "" ){
// if( !validaSoloNumeros( dato ) ){
// textoErrores += "El Código Postal debe de ser numérico";
// }
if( dato.length != 5 ){
textoErrores += "La longitud del Código Postal es incorrecta";
}
} else {
textoErrores += "Debe de ingresar el Código Postal del Domicilio Fiscal.";
}
}
// Muestra mensajes de errores
if( textoErrores.length > 0 ){
document.getElementById('textoError').innerHTML = "";
document.getElementById('textoError').style.visibility = "visible";
bloqueaBotones( false );
} else {
document.getElementById('textoError').innerHTML = "";
document.getElementById('textoError').style.visibility = "hidden";
// Se habilitan los combos para poder llevar el valor al action
document.getElementsByName('munDelText')[0].disabled = false;
document.getElementsByName('entFederativaText')[0].disabled = false;
// --- Finaliza
/*AgregaCodigo*/
bloqueaBotones( true );
document.forms[0].parameter.value="guardarRegistro";
document.forms[0].submit();
/*AgregaCodigo*/
}
}
/** VALIDA EL RFC MORAL * /
/** VALIDA EL RFC FISICO * /
/** ELIMINA LOS ESPACIOS AL PRINCIPIO Y AL FINAL * /
function trim(str) {
str.replace(/^ *| *$/g,"");
return str;
}
/** VALIDA CARACTERES VALIDOS EN EL MAIL * /
function validaEmail(email){
var regx = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;
return regx.test(email);
}
/** VALIDA CURP * /
function validaCurp(curp){
// COHA840806HDFRRL03
var regx = /^([A-Z]{4})(\d\d)(0[1-9]|1[012])(0[1-9]|[12]\d|30|31)(H|M)([A-Z]{5})\d{2}$/;
return regx.test(curp);
}
/** VALIDA QUE EL CAMPO CONTENGA SOLO LETRAS * /
function validaSoloLetras(cadena){
var regx = /^([a-zA-ZÁÉÍÓÚÑáéíóúñ ()#&@%.]+)$/;
return regx.test(cadena);
}
/** VALIDA QUE EL CAMPO CONTENGA SOLO NUMEROS * /
function validaSoloNumeros(cadena){
var regx = /^(\d+)$/;
return regx.test(cadena);
}
/** BLOQUEA TODOS LOS BOTONES DEL FORMULARIO * /
function bloqueaBotones(bloquea){
var botones = document.getElementsByName("boton");
var lenBotones = botones.length;
for (var i = 0; i < lenBotones; i+=1) {
botones[i].disabled = bloquea;
}
}
*/
/** BOTON PARA REDIRECCIONAR A LAS PAGINAS */
function ir( pagina ){
bloqueaBotones( true );
location.href = pagina;
}
/** BOTON PARA REALIZAR LA FUNCION DE IMPRIMIR */
function imprimir(){
window.print();
}
function enviaMensaje(){
alert('El pre-llenado del presente formato NO ACREDITA el cumplimiento de la obligación establecida ' +
'en el párrafo quinto del artículo 15-A de la Ley del Seguro Social. Para tal efecto ' +
'ES NECESARIO ACUDIR A LA SUBDELEGACIÓN DEL IMSS QUE CORRESPONDA, dentro de los siguientes 10 días hábiles.');
imprimir();
}
/** REDIRECCIONA A LA PAGINA DE EXITO DEL REGISTRO */
function exito(){
bloqueaBotones( true );
document.forms[0].action = '/sipress/imss.sipress';
document.forms[0].submit();
}
function errorRegistro(){
bloqueaBotones( true );
document.forms[0].action = '/sipress/jsp/registraRfc.jsp';
document.forms[0].submit();
}
/** FUNCIONALIDAD INCOMPLETA, FALTA VALIDAR EL FORMULARIO */
function guardaRegistro(){
/*AgregaCodigo*/
bloqueaBotones( true );
document.forms[0].parameter.value="guardarRegistro";
document.forms[0].submit();
/*AgregaCodigo*/
}
/*
function IsAlphaNum( str ) {
if (str+"" == "undefined" || str+"" == "null" || str+"" == "") { // Regresa inmediatamente si no hay valores definidos
return false;
}
var isValid = true;
str += ""; // convertimos a string para realizar validacion
for (i = 0; i < str.length; i++) { // buscamos en la longitud de la cadena valores invalidos
// Valores Alfanumericos deben de ser entre "0"-"9", "A"-"Z", or "a"-"z"
if (!(((str.charAt(i) >= "0") && (str.charAt(i) <= "9")) ||
((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
((str.charAt(i) == " ")) || ((str.charAt(i) == "ñ")) || ((str.charAt(i) == "Ñ")) ||
((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")))) {
isValid = false;
break;
}
}
return isValid;
}
*/
/** FUNCION PARA VALIDAR LOS RADIO BUTTON */
function validaRadioButton(){
var dato = "";
var forma = document.forms[0];
if( document.getElementById('tipoPersona').value == "moral" ){
escribeAst();
} else if ( document.getElementById('tipoPersona').value == "fisica" ) {
escribeAst();
}
}
/**
* Funcion para escribir el asterisco dinamicamente
*/
function escribeAst(){
var len = document.getElementsByName("tipoPersona").length;
if( document.getElementById('fisicaRadio').checked && document.getElementById('fisicaRadio').value == "fisica" ){
// datos personales
document.getElementById("ast0").innerHTML = "*";
document.getElementById("ast1").innerHTML = "*";
document.getElementById("ast3").innerHTML = " ";
document.getElementById("ast4").innerHTML = "*";
document.getElementById("ast5").innerHTML = "*";
// domicilio
document.getElementById("ast6").innerHTML = "*";
document.getElementById("ast7").innerHTML = "*";
document.getElementById("ast8").innerHTML = "*";
document.getElementById("ast9").innerHTML = "*";
document.getElementById("ast12").innerHTML = "*";
document.getElementById("ast13").innerHTML = "*";
document.getElementById("ast14").innerHTML = "*";
} else if ( document.getElementById('moralRadio').checked && document.getElementById('moralRadio').value == "moral" ) {
// datos personales
document.getElementById("ast0").innerHTML = "*";
document.getElementById("ast1").innerHTML = "*";
document.getElementById("ast3").innerHTML = "*";
document.getElementById("ast4").innerHTML = " ";
document.getElementById("ast5").innerHTML = "*";
// domicilio
document.getElementById("ast6").innerHTML = "*";
document.getElementById("ast7").innerHTML = "*";
document.getElementById("ast8").innerHTML = "*";
document.getElementById("ast9").innerHTML = "*";
document.getElementById("ast12").innerHTML = "*";
document.getElementById("ast13").innerHTML = "*";
document.getElementById("ast14").innerHTML = "*";
}
}
function inicio(){
document.forms[0].action = 'http://www.imss.gob.mx/';
document.forms[0].submit();
}
function enviaControlSipress(){
/*AgregaCodigo*/
bloqueaBotones( true );
document.forms[0].existencia.value = "existencia";
document.forms[0].parameter.value="capturaContrato";
document.getElementsByName('tipoPersona')[0].disabled = false;
document.getElementsByName('tipoPersona')[1].disabled = false;
if(document.getElementById('fisicaRadio').checked){
document.forms[0].tipoPersona.value = "fisica";
}else {
document.forms[0].tipoPersona.value = "moral";
}
document.forms[0].submit();
/*AgregaCodigo*/
}