function set(target) { document.forms[0].method.value=target; } function setAndSubmitNewWindow(param){ //set(target); //Borro los datos del login //document.getElementById('user').value = ''; //document.getElementById('pass').value = ''; //var myBars = 'directories=no,location=no,menubar=no,status=no'; //myBars += ',titlebar=no,toolbar=no,screenX=0,screenY=0'; //var myOptions = 'hotkeys=no,scrollbars=yes,width=1024,height=768,resizeable=yes'; //var myFeatures = myBars + ',' + myOptions; //newWindow = window.open('?', 'Detailswindow', myFeatures); var browser=navigator.appName; var width=1024; var height=768; var from_top=0; var from_left=0; var toolbar='no'; var location='no'; var directories='no'; var status='yes'; var menubar='no'; var scrollbars='yes'; var resizable='yes'; var atts='width='+width+'show,height='+height+',top='+from_top+',screenY='; atts+= from_top+',left='+from_left+',screenX='+from_left+',toolbar='+toolbar; atts+=',location='+location+',directories='+directories+',status='+status; atts+=',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable; var newWindow; newWindow = window.open('', 'Detailswindow', atts); document.forms[0].target='Detailswindow'; document.forms[0].method.value=param; document.forms[0].submit(); //if (browser == "Microsoft Internet Explorer") { // this.focus(); // self.opener = this; // self.close(); // window.open('','_self',''); // window.close(); //} else { // window.close(); //} //window.close(); //var browserName = navigator.appName; //var browserVer = parseInt(navigator.appVersion); var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false; self.focus(); if (ie7 || browser == "Netscape") { //This method is required to close a window without any prompt for IE7 window.opener = null; window.open('','_self',''); window.close(); } else { //This method is required to close a window without any prompt for IE6 this.focus(); self.opener = this; self.close(); } } function openSpecialWindow(url) { var newWindow; var width=1024; var height=768; var from_top=0; var from_left=0; var toolbar='no'; var location='no'; var directories='no'; var status='yes'; var menubar='no'; var scrollbars='yes'; var resizable='yes'; var atts='width='+width+'show,height='+height+',top='+from_top+',screenY='; atts+= from_top+',left='+from_left+',screenX='+from_left+',toolbar='+toolbar; atts+=',location='+location+',directories='+directories+',status='+status; atts+=',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable; newWindow = window.open(url, 'myWindow', atts); } function setAndSubmit(target,form){ set(target); document.getElementById(form).submit(); } function setSubmitAndBlockButton(target,form, button){ set(target); document.getElementById(button).disabled= true; document.getElementById(form).submit(); } function setSubmitAndBlockButtonConfirm(target,form, button){ var answer = confirm("¿Está seguro que los datos capturados son los correctos?\n¿Desea enviar esta Información al IMSS?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } function setSubmitAndBlockButtonConfirm2(target,form, button){ var answer = confirm("¿Está seguro que los datos capturados son los correctos?\n¿Desea continuar?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } function setSubmitAndBlockButtonConfirm3(target,form, button){ var answer = confirm("¿Está seguro que los datos capturados son los correctos?\n¿Desea enviar esta Información al IMSS?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); }else { set("cancelarAlert"); document.getElementById(form).submit(); return; } } function setSubmitAndBlockButtonConfirmExplosionInsumos(target,form, button){ var answer = confirm("¿Está seguro que los datos capturados son los correctos?\n¿Desea enviar esta Información al IMSS?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById('BtnAgregar').disabled = true; document.getElementById('BtnQuitar').disabled = true; document.getElementById('BtnCancelar').disabled = true; document.getElementById('BtnBack').disabled = true; document.getElementById(form).submit(); } } function setSubmitAndBlockButtonConfirmObrasExternas(target, form, button){ var answer = confirm("¿Está seguro que los datos capturados son los correctos?\n¿Desea Continuar?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById('btnCancelar').disabled = true; document.getElementById('btnActualizarPatron').disabled = true; document.getElementById('BtnAgregar').disabled = true; document.getElementById('btnGuardar').disabled = true; document.getElementById(form).submit(); } } function setSubmitAndBlockButtonConfirmFEPrivadas(target, form, button){ var answer = confirm("Se pre-registrarán automáticamente obras privadas\npara las fuentes externas que posean número de licencia.\n¿Está seguro que desea continuar?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } function setSubmitAndBlockButtonConfirmFEPublicas(target,form, button){ var answer = confirm("Se pre-registrarán automáticamente obras públicas\npara las fuentes externas.\n¿Está seguro que desea continuar?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } function setSubmitAndBlockButtonConfirmFEPrivadaPre(target,form, button){ var answer = confirm("Se realizará el pre-registro de obra para la fuente externa actual.\n¿Está seguro que desea continuar?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } function setSubmitAndBlockButtonConfirmAprobarCambioNombre(target,form, button){ var answer = confirm("¿Aprobar Cambio?"); if (answer){ var answer2 = confirm("¿Está seguro que los datos son correctos?\n¿Desea Continuar?"); if(answer2) { set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } else { set("cancelar"); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } else { set("cancelarModificar"); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } function setSubmitAndBlockButtonConfirmarGuardar(target,form, button){ var answer = confirm("¿Está seguro que los datos son correctos?\n¿Desea Continuar?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } else { set("cancelarModificar"); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } function setSubmitAndBlockButtonConfirmarGuardar2(target,form, button){ var answer = confirm("¿Está seguro que los datos son correctos?\n¿Desea Continuar?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } else { set("cancelarGuardarDatos"); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } function setSubmitAndBlockButtonModificar(target,form, button){ var radio1 = document.getElementById('aprobar'); var radio2 = document.getElementById('noAprobar'); var radio3 = document.getElementById('modificar'); var radio4 = document.getElementById('noModificar'); if(radio1 != null) { if(radio1.checked == true) { var answer = confirm("¿Aprobar Cambio?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } else { set("cancelarAprobacion"); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } } if(radio1 != null && radio2 != null) { if(radio1.checked == false && radio2.checked == false) { set('cancelarAprobacion'); document.getElementById(form).submit(); } } if(radio3 != null) { if(radio3.checked == true) { var answer = confirm("¿Desea modificar el Nombre?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } else { set("cancelarAprobacion"); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } } if(radio4 != null) { if(radio4.checked == true) { var answer = confirm("¿Desea No Aprobar el Nombre?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } else { set("cancelarAprobacion"); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } } } if(radio3 != null && radio4 != null) { if(radio3.checked == false && radio4.checked == false) { set('cancelarAprobacion'); document.getElementById(form).submit(); } } } function setAndSubmitAtenderSolicitud(form){ var radioActualizarSolicitudPendiente = document.getElementById('radioActualizarSolicitudPendiente'); var radioActualizarSubdelegacion = document.getElementById('radioActualizarSubdelegacion'); if(document.getElementById('radioActualizarSolicitudPendiente').checked == true) { set('actualizarSolicitudPendientePorNormativoAdmin'); document.getElementById(form).submit(); } if(document.getElementById('radioActualizarSubdelegacion').checked == true) { set(''); document.getElementById(form).submit(); } } function setAndBlockButtonConfirmAprobarReasignacion(form){ var answer = confirm("¿Está seguro que los datos capturados son los correctos?\n¿Desea Continuar?"); if(answer) { set('aprobarReasignacion'); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } else { set('obtenerPaginador'); } } function setAndBlockButtonConfirmNoAprobarReasignacion(form){ var answer = confirm("¿Está seguro que los datos capturados son los correctos?\n¿Desea Continuar?"); if(answer) { set('aprobarReasignacion'); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } else { set('obtenerPaginador'); } } function setSubmitAndBlockButtonConfirmComplemento(target){ var answer = confirm("¿Está seguro que desea complementar la obra?\n¿Desea continuar?"); if (answer){ set(target); document.getElementById('btnGuardar').disabled = true; document.getElementById('complementaForm').submit(); } } //Acepta solo números y letras. function onKeyUpNoSpecialCharacters(field){ var val = field.value; if (!val.match(/^[a-zA-Z0-9]+$/)){ val = val.replace(/[^a-zA-Z0-9]/g,''); field.value = val; } } //Acepta solo números, letras y caracter especial '/'. //Esta función se utiliza para los Nros de Contratos y Nros de Oficios function onKeyUpNumbersCharactersAndAscii47(field){ var val = field.value; if (!val.match(/^[a-zA-Z0-9\/]+$/)){ val = val.replace(/[^a-zA-Z0-9\/]/g,''); field.value = val; } } //Acepta solo números function onKeyUpNumbers(field){ var val = field.value; if (!val.match(/^\d+$/)){ val = val.replace(/[^0-9]/g,''); field.value = val; } } //Acepta solo números function onKeyUpAlfabeticSP(field){ var val = field.value; if (!val.match(/^[a-zA-ZáéíóúüÁÉÍÓÚÜÑñ\s']+$/)){ val = val.replace(/[^a-zA-ZáéíóúüÁÉÍÓÚÜÑñ\s']/g,""); field.value = val; } } //Números, letras, apostrofes, tildes y espacios en blanco. function onKeyUpAlfaNumeric(field){ var val = field.value; if (!val.match(/^[a-zA-Z0-9áéíóúüÁÉÍÓÚÜñÑ'\s]+$/)){ val = val.replace(/[^a-zA-Z0-9áéíóúüÁÉÍÓÚÜñÑ'\s]/g,""); field.value = val; } } //No permite espacios. function onKeyUpNoSpace(field){ var val = field.value; if (val.match(/^[\s]+$/)){ val = val.replace(/[^\s]/g,''); field.value = val; } } function extractNumber(obj, decimalPlaces, allowNegative) { var temp = obj.value; // avoid changing things if already formatted correctly var reg0Str = '[0-9]*'; if (decimalPlaces > 0) { reg0Str += '\\.?[0-9]{0,' + decimalPlaces + '}'; } else if (decimalPlaces < 0) { reg0Str += '\\.?[0-9]*'; } reg0Str = allowNegative ? '^-?' + reg0Str : '^' + reg0Str; reg0Str = reg0Str + '$'; var reg0 = new RegExp(reg0Str); if (reg0.test(temp)) return true; // first replace all non numbers var reg1Str = '[^0-9' + (decimalPlaces != 0 ? '.' : '') + (allowNegative ? '-' : '') + ']'; var reg1 = new RegExp(reg1Str, 'g'); temp = temp.replace(reg1, ''); if (allowNegative) { // replace extra negative var hasNegative = temp.length > 0 && temp.charAt(0) == '-'; var reg2 = /-/g; temp = temp.replace(reg2, ''); if (hasNegative) temp = '-' + temp; } if (decimalPlaces != 0) { var reg3 = /\./g; var reg3Array = reg3.exec(temp); if (reg3Array != null) { // keep only first occurrence of . // and the number of places specified by decimalPlaces or the entire string if decimalPlaces < 0 var reg3Right = temp.substring(reg3Array.index + reg3Array[0].length); reg3Right = reg3Right.replace(reg3, ''); reg3Right = decimalPlaces > 0 ? reg3Right.substring(0, decimalPlaces) : reg3Right; temp = temp.substring(0,reg3Array.index) + '.' + reg3Right; } } obj.value = temp; } function blockNonNumbers(obj, e, allowDecimal, allowNegative) { var key; var isCtrl = false; var keychar; var reg; if(window.event) { key = e.keyCode; isCtrl = window.event.ctrlKey } else if(e.which) { key = e.which; isCtrl = e.ctrlKey; } if (isNaN(key)) return true; keychar = String.fromCharCode(key); // check for backspace or delete, or if Ctrl was pressed if (key == 8 || isCtrl) { return true; } reg = /\d/; var isFirstN = allowNegative ? keychar == '-' && obj.value.indexOf('-') == -1 : false; var isFirstD = allowDecimal ? keychar == '.' && obj.value.indexOf('.') == -1 : false; return isFirstN || isFirstD || reg.test(keychar); } //6.01 Reasignacion Obras function setSubmitAndBlockButtonConfirmReasignacion(target,form, button){ var answer = confirm("Está a punto de Reubicar una o más obras.\n¿Desea continuar?"); if (answer){ set(target); document.getElementById(button).disabled = true; document.getElementById(form).submit(); } }