//-------------------------------------------------------------

function TrimLeft( str ) 
{
var resultStr = "";
var i = len = 0;
// Return immediately if an invalid value was passed in
if (str+"" == "undefined" || str == null)	
 return null;
// Make sure the argument is a string
 str += "";
if (str.length == 0) 
 resultStr = "";
else {	
 // Loop through string starting at the beginning as long as there
 // are spaces.
 //	  	len = str.length - 1;
  len = str.length;
 while ((i <= len) && (str.charAt(i) == " "))
 i++;
// When the loop is done, we're sitting at the first non-space char,
// so return that char plus the remaining chars of the string.
  resultStr = str.substring(i, len);
  }
 return resultStr;
}
//-------------------------------------------------------------
function TrimRight( str ) 
{
var resultStr = "";
var i = 0;
// Return immediately if an invalid value was passed in
if (str+"" == "undefined" || str == null)	
 return null;
// Make sure the argument is a string
 str += "";
if (str.length == 0) 
  resultStr = "";
 else {
// Loop through string starting at the end as long as there
// are spaces.
i = str.length - 1;
while ((i >= 0) && (str.charAt(i) == " "))
i--;
// When the loop is done, we're sitting at the last non-space char,
// so return that char plus all previous chars of the string.
 resultStr = str.substring(0, i + 1);
}

return resultStr;  	
}
//-------------------------------------------------------------
function trim( str ) 
{
var resultStr = "";
resultStr = TrimLeft(str);
resultStr = TrimRight(resultStr);
return resultStr;
}
//-------------------------------------------------------------
function no_es_numero(lector)
{
if(lector.length>0)
{ var long = lector.length;
  lector   = lector.toLowerCase();
  for(k=0;k<long;k++) 
  { caracter= lector.charAt(k); 
    if ((caracter <'0')||(caracter>'9')) 
       { return true; }  
  }
 }
}
//-------------------------------------------------------------
function vale_texto(xnum,valor)
{
var criter
valor=trim(valor);
criter=document.form1.criterio.value;
eval("document.form1.texto"+xnum+".value=trim(document.form1.texto"+xnum+".value.toLowerCase());");
if((criter=="NI")&&(valor!=""))
{if (no_es_numero(valor))
 { alert('Solo debe ingresar digitos porque va a realizar una busqueda por Numero de Ingreso');
   eval("document.form1.texto"+xnum+".value='';");
   eval("document.form1.texto"+xnum+".select();");
 }
} 

if((valor.length<3)&&(criter!="NI")&&(valor!=""))
{ document.form1.truco.value="no";
  eval("document.form1.texto"+xnum+".value='';");
  eval("document.form1.texto"+xnum+".focus();");
}  
}


//-------------------------------------------------------------


//-------------------------------------------------------------

//-------------------------------------------------------------

//-------------------------------------------------------------

//-------------------------------------------------------------


//-------------------------------------------------------------


//-------------------------------------------------------------


//-------------------------------------------------------------


//-------------------------------------------------------------




function sobre(src,Color) 
{ if (!src.contains(event.fromElement)) 
   { src.style.cursor = 'hand';
     src.bgColor = Color;}
}


function fuera(src,Color2) 
{ if (!src.contains(event.toElement)) 
   {  src.style.cursor = 'default';
      src.bgColor = Color2; }
}


function pulsar(src) 
{ if(event.srcElement.tagName=='TD')
   { src.children.tags('A')[0].click();}
}



<!--
var message="";

function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
// --> 



