/*
 Modulo Javascript para dar soporte a la interaccion de las ventanas hijas con la ventana Principal  
 */
 // Funcion que devuelve el objeto dentro de document, segun el argumento [id]
 function _$() 
 {
    return document.getElementById(arguments[0]); 
 }
 
 function showProgressBar()
   {
   try{
	document.getElementById('pgbar').style.display='block';   
     }catch(e){alert(e.message);}
   }
   function hideProgressBar()
   {
   try{
	document.getElementById('pgbar').style.display='none';
   }catch(e){}
   }

function onInsert(item)
  {
    if (document.getElementById('chkConfirmInsert').checked)
      if (confirm("¿ Agrega registro ?"))
        return true; 
      else
        return false; 
    else
        return true; 
  }
  
  function onUpdate(item)
  {
   document.getElementById('lblMsg').innerText = "";
   if (document.getElementById('chkConfirmUpdate').checked)
      if (confirm("¿ Actualiza registro seleccionado ?"))
        return true; 
      else
        return false; 
    else
      return true; 
  }

  function onCallbackError(excString)
  {
    if (confirm('Datos incorrectos. ¿ Examina los detalles ?')) alert(excString); 
    grdTable.Page(grdTable.CurrentPageIndex); 
  }
  // FUNCIONES PARA PROCESAR EN EL CLIENTE EL CLICK EN EL CHECKBOX
  function chkNomyAp_onCheck()
  { 
    if ( document.getElementById('chkNomyAp').checked == false )
    {  
       document.getElementById('txtNomyAp').disabled = false;
       window.setTimeout("document.getElementById('txtNomyAp').focus();",200);       
    }  
    else
     document.getElementById('txtNomyAp').disabled = true;
  }
  
  function chkNroDoc_onCheck()
  { 
    if ( document.getElementById('chkNroDoc').checked == false )
    {  
       document.getElementById('dpdTipoDoc').disabled = false;
       document.getElementById('txtNroDoc').disabled = false;
       window.setTimeout("document.getElementById('txtNroDoc').focus();",200);       
    }  
    else
    { 
       document.getElementById('dpdTipoDoc').disabled = true;
       document.getElementById('txtNroDoc').disabled = true;
    }  
  }
  function chkCirc_onCheck()
  {
	 $("#dpdCir").attr('disabled',$("#chkCirc").is(":checked"));
	if($("#chkCirc").is(":checked"))
	   $("#dpdCir").focus();
  }
  function chkProf_onCheck()
  { 
    $("#dpdProf",$("#dvProfesiones")).attr('disabled',$("#chkProf").is(":checked"));
	if($("#chkProf").is(":checked"))
	   $("#dpdProf",$("#dvProfesiones")).focus();
  }
  
  function chkJuz_onCheck()
  { 
    if ( document.getElementById('chkJuzgado').checked == false )
    {  
       document.getElementById('dpdJuz').disabled = false;
       window.setTimeout("document.getElementById('dpdJuz').focus();",200);
    }  
    else
       document.getElementById('dpdJuz').disabled = true;
  }
  
  function chkMatricula_onCheck()
  { 
    if ( document.getElementById('chkMatricula').checked == false )
    {  
       document.getElementById('txtMatricula').disabled = false;
       window.setTimeout("document.getElementById('txtMatricula').focus();",200);
    }  
    else
    {        
       document.getElementById('txtMatricula').disabled = true;
    }  
  }
 /* Funciones que procesan eventos en los controles TextBox, para validar el ingreso de datos. */ 
 function validatectl() 
 { 
   if(!(window.event.keyCode>=48 && window.event.keyCode<=57))window.event.keyCode=0; 
 }
 
 function validateNroTel() 
 { 
   if(!(window.event.keyCode>=48 && window.event.keyCode<=57) && window.event.keyCode!=45 && window.event.keyCode!=40 && window.event.keyCode!=41 )window.event.keyCode=0; 
 }
