  //document.oncontextmenu=function(){return false};
  function NumberFormat(num, numDec, decSep, thousandSep){ 
    var arg; 
    var Dec; 
    Dec = Math.pow(10, numDec);  
    if (typeof(num) == 'undefined') return;  
    if (typeof(decSep) == 'undefined') decSep = ','; 
    if (typeof(thousandSep) == 'undefined') thousandSep = '.'; 
    if (thousandSep == '.') 
     arg=/./g; 
    else 
     if (thousandSep == ',') arg=/,/g; 
    if (typeof(arg) != 'undefined') num = num.toString().replace(arg,''); 
    num = num.toString().replace(/,/g, '.');  
    if (isNaN(num)) num = "0"; 
    sign = (num == (num = Math.abs(num))); 
    num = Math.floor(num * Dec + 0.50000000001); 
    cents = num % Dec; 
    num = Math.floor(num/Dec).toString();  
    if (cents < (Dec / 10)) cents = "0" + cents;  
    for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) 
     num = num.substring(0, num.length - (4 * i + 3)) + thousandSep + num.substring(num.length - (4 * i + 3)); 
    if (Dec == 1) 
     return (((sign)? '': '-') + num); 
    else 
     return (((sign)? '': '-') + num + decSep + cents); 
   }  

   function EvaluateText(cadena, obj){ 
    opc = false;  
    if (cadena == "%d") 
     if (event.keyCode > 47 && event.keyCode < 58) 
      opc = true; 
    if (cadena == "%f"){  
     if (event.keyCode > 47 && event.keyCode < 58) 
      opc = true; 
     if (obj.value.search("[.*]") == -1 && obj.value.length != 0) 
      if (event.keyCode == 46) 
       opc = true; 
    } 
    if(opc == false) 
     event.returnValue = false;  
   } 
   
   
   /**************************************************
     Nombre: CleanString
     Descripcion: Funcion que elimina las comas de una cadena.
     Uso:  variable= CleanString(Valor_con_comas):
   **************************************************/
   	function CleanString(Qty){
	   var sCantidad = new String();
	   sCantidad=Qty;
	   while (sCantidad.indexOf(",",0) > 0 )
	   {
	      sCantidad=sCantidad.replace(",","")
	   }

         sCantidad=sCantidad.replace("$","")
  
	   return trim(sCantidad);
	}
	
	/*
   funcion : trim
   Descripcion: Funcion que limpia los espacios que tiene una cadena tanto inicial como final
   Parametros: p_Cadena el string a evaluar
   Devuelve:   la cadena limpia
*/
   function trim(p_Cadena) {
      worker = new String(p_Cadena);

      if (worker.indexOf(" ") != -1) {
         if (worker.indexOf(" ") == 0) {
            worker = worker.substring(1,worker.length);
            trim(worker);
         }
      }
   
      if (worker.lastIndexOf(" ") != -1) {
         if (worker.lastIndexOf(" ") >= worker.length-1) {
            worker = worker.substring(0,worker.length-1);
            trim(worker);
        }
      }
      return worker;
   }

