$(document).ready(function(){var lengTrs=$('.tablaDetalleOperacion tbody tr').length;for(var i=0;i<lengTrs;i++){if(i>0){$('.tablaDetalleOperacion tbody tr').find("td:first").css("border-left","#046680 2px solid");$('.tablaDetalleOperacion tbody tr').find("td:last").css("border-right","#046680 2px solid");}}
$('.confirmar tbody tr').find("td:first").css("border-left","none");$('.confirmar tbody tr').find("td:last").css("border-right","none");$('.agrupacion').eq(0).css('border-radius','5px 5px 0 0');$("#mySubmit").click(function(e){if($("#enviarForm").val()=='false'){e.preventDefault();var invalidField=$(".DHTMLSuite_invalidInputImage")[0];var invalidFieldId=$(invalidField).closest("td").attr("id");if(typeof invalidFieldId!='undefined'){invalidFieldId=invalidFieldId.substring(1);var invalidFieldLabel=$("label[for='"+invalidFieldId+"']").text();var msgCampoInvalido='';msgCampoInvalido=msgCampoInvalido.replace("#NOMBRE#",invalidFieldLabel);showAlert(msgCampoInvalido,'Formulario Incompleto','#FF0000','fa fa-exclamation-triangle',function(){$("#"+invalidFieldId).focus();$("#"+invalidFieldId).select();jQuery('#mySubmit').removeAttr('disabled');jQuery('#mypreSubmit').removeAttr('disabled');jQuery('#mycomSubmit').removeAttr('disabled');});return false;}}
var msj;$("#preguardar").val('0');$("#autoguardar").val('');if($("#AREA_NUMERO").val()!=""&&$("#USRIO_RESPONSABLE_DESC").val()==""&&$("#id_objeto").val()=="5031"){$("#mySubmit").removeAttr('disabled');showAlert($("#mensaje_error").val(),'Mensaje de Error','#FF0000','fa fa-exclamation-triangle');return false;}
var resultado=comprobar_validacion();if(resultado==false){$("#mySubmit").removeAttr('disabled');return false;}
$.each($("input:password"),function(index,value){$('#'+value.name).val(SHA256($('#'+value.name).val()));});var lengFormInputFile=$("#formOperacion input[type='file']").length;if(lengFormInputFile>0){var ifm=document.createElement('iframe');ifm.style.display='none';ifm.name='tmpfrm';ifm.onload=function(e){var respuesta=ifm.contentWindow.document.body.innerHTML;if(respuesta==""){respuesta=ifm.contentDocument.document.body.innerHTML;}
var regexCad=new RegExp('&amp;','g');respuesta=respuesta.replace(regexCad,'&');if($("#go").val()=='lista_transacc'){msj=respuesta.split('*****');$('#'+msj[1],window.opener.document).val(msj[3]);$('#'+msj[2],window.opener.document).val(msj[4]);$('#'+msj[2],window.opener.document).trigger('click');var func=jQuery("#"+msj[2],window.opener.document).attr("onChange");if(func!=""&&func!=null&&func!="undefined"){eval(func);}else{if(window.showModalDialog&&movilidad!='1'){window.returnValue=true;window.close();}else{window.close();this.close();}}}else{$('#cboxClose',window.parent.document).trigger('click');window.parent.loading();msj=respuesta.split('*****');if(msj[1]!=""){window.parent.location=msj[1];}}}
var eform=document.getElementById('formOperacion');eform.target='tmpfrm';var ebody=document.getElementsByTagName('body')[0];ebody.appendChild(ifm);$("#formOperacion :input").removeAttr('disabled');jQuery('#mySubmit').attr('disabled','disabled');jQuery('#mypreSubmit').attr('disabled','disabled');jQuery('#mycomSubmit').attr('disabled','disabled');eform.submit();return false;}
var cadena=$("#formOperacion").serialize();var cadena2=$("#formOperacion").serializeDisabled();cadena=cadena.replace(/\%2B/g,"[[mas]]");cadena=cadena.replace(/\%26/g,"[[amp]]");cadena2=cadena2.replace(/\%2B/g,"[[mas]]");cadena2=cadena2.replace(/\%26/g,"[[amp]]");cadena=decodeURIComponent(cadena+"&"+cadena2);cadena=cadena+"&preguardar="+$("#preguardar").val();$.ajax({type:'post',url:'phrame.php',data:cadena,success:function(res){if(res.indexOf("----")!=-1){showAlert(res,'Depurador de C�digo','#4B69C3','fa fa-file-code-o',function(){if($("#go").val()=='lista_transacc'){msj=res.split('*****');$('#'+msj[1],window.opener.document).val(msj[3]);$('#'+msj[2],window.opener.document).val(msj[4]);$('#'+msj[2],window.opener.document).trigger('click');var func=jQuery("#"+msj[2],window.opener.document).attr("onChange");if(func!=""&&func!=null&&func!="undefined"){eval(func);}else{if(window.showModalDialog&&movilidad!='1'){window.returnValue=true;window.close();}else{window.close();this.close();}}}else if($("#go").val()=='carga_Excel'){msj=res.split('*****');if(msj[1]!=""){window.location=msj[1];}}else{$('#cboxClose',window.parent.document).trigger('click');window.parent.loading();msj=res.split('*****');if(msj[1]!=""){window.parent.location=msj[1];}}});}else{if($("#go").val()=='lista_transacc'){msj=res.split('*****');$('#'+msj[1],window.opener.document).val(msj[3]);$('#'+msj[2],window.opener.document).val(msj[4]);$('#'+msj[2],window.opener.document).trigger('click');var func=jQuery("#"+msj[2],window.opener.document).attr("onChange");if(func!=""&&func!=null&&func!="undefined"){eval(func);}else{if(window.showModalDialog&&movilidad!='1'){window.returnValue=true;window.close();}else{window.close();this.close();}}}else if($("#go").val()=='carga_Excel'){msj=res.split('*****');if(msj[1]!=""){window.location=msj[1];}}else{$('#cboxClose',window.parent.document).trigger('click');window.parent.loading();msj=res.split('*****');if(msj[1]!=""){window.parent.location=msj[1];}}}}});});$("#mypreSubmit").click(function(e){if($("#enviarForm").val()=='false'){e.preventDefault();var invalidField=$(".DHTMLSuite_invalidInputImage")[0];var invalidFieldId=$(invalidField).closest("td").attr("id");if(typeof invalidFieldId!='undefined'){invalidFieldId=invalidFieldId.substring(1);var invalidFieldLabel=$("label[for='"+invalidFieldId+"']").text();var msgCampoInvalido='';msgCampoInvalido=msgCampoInvalido.replace("#NOMBRE#",invalidFieldLabel);showAlert(msgCampoInvalido,'Formulario Incompleto','#FF0000','fa fa-exclamation-triangle',function(){$("#"+invalidFieldId).focus();$("#"+invalidFieldId).select();jQuery('#mypreSubmit').removeAttr('disabled');jQuery('#mySubmit').removeAttr('disabled');jQuery('#mycomSubmit').removeAttr('disabled');});return false;}}
var msj;$("#preguardar").val('1');$("#autoguardar").val('');if($("#AREA_NUMERO").val()!=""&&$("#USRIO_RESPONSABLE_DESC").val()==""&&$("#id_objeto").val()=="5031"){$("#mySubmit").removeAttr('disabled');showAlert($("#mensaje_error").val(),'Mensaje de Error','#FF0000','fa fa-exclamation-triangle');return false;}
var url_despliegue="";var resultado=comprobar_validacion();if(resultado==false){$("#mySubmit").removeAttr('disabled');return false;}
$.each($("input:password"),function(index,value){$('#'+value.name).val(SHA256($('#'+value.name).val()));});var lengFormInputFile=$("#formOperacion input[type='file']").length;if(lengFormInputFile>0){var ifm=document.createElement('iframe');ifm.style.display='none';ifm.name='tmpfrm';ifm.onload=function(e){var respuesta=ifm.contentWindow.document.body.innerHTML;if(respuesta==""){respuesta=ifm.contentDocument.document.body.innerHTML;}
window.parent.loading();var regexCad=new RegExp('&amp;','g');respuesta=respuesta.replace(regexCad,'&');msj=respuesta.split('*****');if(msj[1]!=""){url_despliegue=encodeURIComponent(msj[1]);window.location=$("#url_modal").val()+"&url_despliegue="+url_despliegue;window.parent.unloading();}}
var eform=document.getElementById('formOperacion');eform.target='tmpfrm';var ebody=document.getElementsByTagName('body')[0];ebody.appendChild(ifm);$("#formOperacion :input").removeAttr('disabled');jQuery('#mySubmit').attr('disabled','disabled');jQuery('#mypreSubmit').attr('disabled','disabled');jQuery('#mycomSubmit').attr('disabled','disabled');eform.submit();return false;}
var cadena=$("#formOperacion").serialize();var cadena2=$("#formOperacion").serializeDisabled();cadena=cadena.replace(/\%2B/g,"[[mas]]");cadena=cadena.replace(/\%26/g,"[[amp]]");cadena2=cadena2.replace(/\%2B/g,"[[mas]]");cadena2=cadena2.replace(/\%26/g,"[[amp]]");cadena=decodeURIComponent(cadena+"&"+cadena2);$.ajax({type:'post',url:'phrame.php',data:cadena,success:function(res){if(res.indexOf("----")!=-1){showAlert(res,'Depurador de C�digo','#4B69C3','fa fa-file-code-o',function(){window.parent.loading();msj=res.split('*****');if(msj[1]!=""){url_despliegue=encodeURIComponent(msj[1]);window.location=$("#url_modal").val()+"&url_despliegue="+url_despliegue;window.parent.unloading();}});}else{window.parent.loading();msj=res.split('*****');if(msj[1]!=""){url_despliegue=encodeURIComponent(msj[1]);window.location=$("#url_modal").val()+"&url_despliegue="+url_despliegue;window.parent.unloading();}}}});});$("#mycomSubmit").click(function(e){if($("#enviarForm").val()=='false'){e.preventDefault();var invalidField=$(".DHTMLSuite_invalidInputImage")[0];var invalidFieldId=$(invalidField).closest("td").attr("id");if(typeof invalidFieldId!='undefined'){invalidFieldId=invalidFieldId.substring(1);var invalidFieldLabel=$("label[for='"+invalidFieldId+"']").text();var msgCampoInvalido='';msgCampoInvalido=msgCampoInvalido.replace("#NOMBRE#",invalidFieldLabel);showAlert(msgCampoInvalido,'Formulario Incompleto','#FF0000','fa fa-exclamation-triangle',function(){$("#"+invalidFieldId).focus();$("#"+invalidFieldId).select();jQuery('#mycomSubmit').removeAttr('disabled');jQuery('#mySubmit').removeAttr('disabled');jQuery('#mypreSubmit').removeAttr('disabled');});return false;}}
var msj;$("#autoguardar").val('');if($("#preguardar").val()==1||$("#operacion").val().toUpperCase()=='MODIFICAR'){showConfirm('�'+$("#confGuardaComo").val()+'?',function(){$('#'+$('#campos_borrar').val()).val('');$("#operacion").val('ADICIONAR');$("#preguardar").val('1');if($("#AREA_NUMERO").val()!=""&&$("#USRIO_RESPONSABLE_DESC").val()==""&&$("#id_objeto").val()=="5031"){$("#mySubmit").removeAttr('disabled');showAlert($("#mensaje_error").val(),'Mensaje de Error','#FF0000','fa fa-exclamation-triangle');return false;}
var url_despliegue="";var resultado=comprobar_validacion();if(resultado==false){$("#mySubmit").removeAttr('disabled');return false;}
$.each($("input:password"),function(index,value){$('#'+value.name).val(SHA256($('#'+value.name).val()));});var lengFormInputFile=$("#formOperacion input[type='file']").length;if(lengFormInputFile>0){var ifm=document.createElement('iframe');ifm.style.display='none';ifm.name='tmpfrm';ifm.onload=function(e){var respuesta=ifm.contentWindow.document.body.innerHTML;if(respuesta==""){respuesta=ifm.contentDocument.document.body.innerHTML;}
window.parent.loading();var regexCad=new RegExp('&amp;','g');respuesta=respuesta.replace(regexCad,'&');msj=respuesta.split('*****');if(msj[1]!=""){url_despliegue=encodeURIComponent(msj[1]);window.location=$("#url_modal").val()+"&campo_llave="+msj[2]+"&valor_llave="+msj[3]+"&operacion=Modificar&url_despliegue="+url_despliegue;window.parent.unloading();}}
var eform=document.getElementById('formOperacion');eform.target='tmpfrm';var ebody=document.getElementsByTagName('body')[0];ebody.appendChild(ifm);$("#formOperacion :input").removeAttr('disabled');jQuery('#mySubmit').attr('disabled','disabled');jQuery('#mypreSubmit').attr('disabled','disabled');jQuery('#mycomSubmit').attr('disabled','disabled');eform.submit();return false;}
var cadena=$("#formOperacion").serialize();var cadena2=$("#formOperacion").serializeDisabled();cadena=cadena.replace(/\%2B/g,"[[mas]]");cadena=cadena.replace(/\%26/g,"[[amp]]");cadena2=cadena2.replace(/\%2B/g,"[[mas]]");cadena2=cadena2.replace(/\%26/g,"[[amp]]");cadena=decodeURIComponent(cadena+"&"+cadena2);$.ajax({type:'post',url:'phrame.php',data:cadena,success:function(res){if(res.indexOf("----")!=-1){showAlert(res,'Depurador de C�digo','#4B69C3','fa fa-file-code-o',function(){window.parent.loading();msj=res.split('*****');if(msj[1]!=""){url_despliegue=encodeURIComponent(msj[1]);window.location=$("#url_modal").val()+"&campo_llave="+msj[2]+"&valor_llave="+msj[3]+"&operacion=Modificar&url_despliegue="+url_despliegue;window.parent.unloading();}});}else{window.parent.loading();msj=res.split('*****');if(msj[1]!=""){url_despliegue=encodeURIComponent(msj[1]);window.location=$("#url_modal").val()+"&campo_llave="+msj[2]+"&valor_llave="+msj[3]+"&operacion=Modificar&url_despliegue="+url_despliegue;window.parent.unloading();}}}});});}else{$('#'+$('#campos_borrar').val()).val('');$("#operacion").val('ADICIONAR');$("#preguardar").val('1');if($("#AREA_NUMERO").val()!=""&&$("#USRIO_RESPONSABLE_DESC").val()==""&&$("#id_objeto").val()=="5031"){$("#mySubmit").removeAttr('disabled');showAlert($("#mensaje_error").val(),'Mensaje de Error','#FF0000','fa fa-exclamation-triangle');return false;}
var url_despliegue="";var resultado=comprobar_validacion();if(resultado==false){$("#mySubmit").removeAttr('disabled');return false;}
$.each($("input:password"),function(index,value){$('#'+value.name).val(SHA256($('#'+value.name).val()));});var lengFormInputFile=$("#formOperacion input[type='file']").length;if(lengFormInputFile>0){var ifm=document.createElement('iframe');ifm.style.display='none';ifm.name='tmpfrm';ifm.onload=function(e){var respuesta=ifm.contentWindow.document.body.innerHTML;if(respuesta==""){respuesta=ifm.contentDocument.document.body.innerHTML;}
window.parent.loading();var regexCad=new RegExp('&amp;','g');respuesta=respuesta.replace(regexCad,'&');msj=respuesta.split('*****');if(msj[1]!=""){url_despliegue=encodeURIComponent(msj[1]);window.location=$("#url_modal").val()+"&campo_llave="+msj[2]+"&valor_llave="+msj[3]+"&operacion=Modificar&url_despliegue="+url_despliegue;window.parent.unloading();}}
var eform=document.getElementById('formOperacion');eform.target='tmpfrm';var ebody=document.getElementsByTagName('body')[0];ebody.appendChild(ifm);$("#formOperacion :input").removeAttr('disabled');jQuery('#mySubmit').attr('disabled','disabled');jQuery('#mypreSubmit').attr('disabled','disabled');jQuery('#mycomSubmit').attr('disabled','disabled');eform.submit();return false;}
var cadena=$("#formOperacion").serialize();var cadena2=$("#formOperacion").serializeDisabled();cadena=cadena.replace(/\%2B/g,"[[mas]]");cadena=cadena.replace(/\%26/g,"[[amp]]");cadena2=cadena2.replace(/\%2B/g,"[[mas]]");cadena2=cadena2.replace(/\%26/g,"[[amp]]");cadena=decodeURIComponent(cadena+"&"+cadena2);$.ajax({type:'post',url:'phrame.php',data:cadena,success:function(res){if(res.indexOf("----")!=-1){showAlert(res,'Depurador de C�digo','#4B69C3','fa fa-file-code-o',function(){window.parent.loading();msj=res.split('*****');if(msj[1]!=""){url_despliegue=encodeURIComponent(msj[1]);window.location=$("#url_modal").val()+"&campo_llave="+msj[2]+"&valor_llave="+msj[3]+"&operacion=Modificar&url_despliegue="+url_despliegue;window.parent.unloading();}});}else{window.parent.loading();msj=res.split('*****');if(msj[1]!=""){url_despliegue=encodeURIComponent(msj[1]);window.location=$("#url_modal").val()+"&campo_llave="+msj[2]+"&valor_llave="+msj[3]+"&operacion=Modificar&url_despliegue="+url_despliegue;window.parent.unloading();}}}});}
$("#mycomSubmit").removeAttr('disabled');});$("#formOperacion :input").change(function(e){var msj;if('AUTOGUARDAR'!='1')
return;$("#autoguardar").val('1');var lengFormInputFile=$("#formOperacion input[type='file']").length;if(lengFormInputFile>0){var ifm=document.createElement('iframe');ifm.style.display='none';ifm.name='tmpfrm';ifm.onload=function(e){var respuesta=ifm.contentWindow.document.body.innerHTML;if(respuesta==""){respuesta=ifm.contentDocument.document.body.innerHTML;}
var regexCad=new RegExp('&amp;','g');respuesta=respuesta.replace(regexCad,'&');msj=respuesta.split('*****');if(msj[2]!=""&&msj[3]!=""){$('#'+msj[2]).val(msj[3]);}}
var eform=document.getElementById('formOperacion');eform.target='tmpfrm';var ebody=document.getElementsByTagName('body')[0];ebody.appendChild(ifm);$("#formOperacion :input").removeAttr('disabled');jQuery('#mySubmit').attr('disabled','disabled');jQuery('#mypreSubmit').attr('disabled','disabled');jQuery('#mycomSubmit').attr('disabled','disabled');eform.submit();$("#operacion").val('MODIFICAR');return false;}
var cadena=$("#formOperacion").serialize();var cadena2=$("#formOperacion").serializeDisabled();cadena=cadena.replace(/\%2B/g,"[[mas]]");cadena=cadena.replace(/\%26/g,"[[amp]]");cadena2=cadena2.replace(/\%2B/g,"[[mas]]");cadena2=cadena2.replace(/\%26/g,"[[amp]]");cadena=decodeURIComponent(cadena+"&"+cadena2);$.ajax({type:'post',url:'phrame.php',data:cadena,success:function(res){if(res.indexOf("----")!=-1){showAlert(res,'Depurador de C�digo','#4B69C3','fa fa-file-code-o',function(){msj=res.split('*****');if(msj[2]!=""&&msj[3]!=""){$('#'+msj[2]).val(msj[3]);}});}else{msj=res.split('*****');if(msj[2]!=""&&msj[3]!=""){$('#'+msj[2]).val(msj[3]);}}}});$("#operacion").val('MODIFICAR');});});jQuery.fn.serializeDisabled=function(ur){var obj={};$(':disabled[name]',this).each(function(){obj[this.name]=$(this).val();});return $.param(obj);};function alertaMainPage(url){window.opener.openFocusAndGO(url);}