
/*************************************************************************************/

function ValidaNumOT(objNroOt)
	{

	NumOT = objNroOt.value;
	NumOT = Trim(NumOT);
	 /* Validar que la OT sea Obligatoria su Ingreso */
	 
     if (NumOT == 0 || NumOT == "")          
        {
        window.alert("Debe indicar correctamente el número de su Orden");
        objNroOt.focus();
        return false;
	    }
   
     if(!IsNum(NumOT))
     {
        alert('Debe ingresar sólamente números en su Orden')
        objNroOt.focus();
        return false;
     }
     
        
	    Largo  = NumOT.length                             /* Largo de la OT */ 
	    NumFol = NumOT.substring(0,Largo - 1)             /* Numero Folio de la OT */
	    DigFol = parseInt(NumOT.substring(Largo-1))       /* Digito Folio de la OT */
	    NewFol = parseInt(NumFol-Math.floor(NumFol/7)*7)  /* Nuevo Digito de la OT Calculado */
    
	    if (DigFol != NewFol || Largo <= 5)                /* Compara los Digito son Iguales */
		{
            window.alert("Debe indicar correctamente el número de su Orden");
            objNroOt.focus();
 		    return false;
		}

	    //if (DigFol == NewFol && Largo > 5)                /* Compara los Digito son Iguales */
	    //{
		//	return true;
        //}
        return true;


	}

function txtNumOT_onkeypress(objNroOT) {
      if (event.keyCode == 13)
         { 
         if (!ValidaNumOT(objNroOT))
            { 
            event.keyCode = 0;
            }
			else
			 {
				document.frmFormularioOT.numot.value=objNroOT.value;
				document.frmFormularioOT.submit();
			 }
         }
      else
         {
         /* Validar si numero OT sea numerica */
         if (!esnumero(event.keyCode))  
            {
            event.keyCode = 0
            }
         }   
}

function ConsultaNumOT(objNroOt)
{
	if(ValidaNumOT(objNroOt))
	{
		document.frmFormularioOT.numot.value = objNroOt.value;
		document.frmFormularioOT.submit();
		
	}
}



function consulta_detalle(nro_ot)
{
	document.frmFormularioOT.numot.value = nro_ot;
	document.frmFormularioOT.submit();
	
}
function LimpiaTexto(ObjTexto)
{
   ObjTexto.value='';
   ObjTexto.focus();
    
}