function formatearNumero(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 quitarDecimales(num){
if(num!=""){
  num=num.replace(/,/gi, '')
  var cents
  cents=num.split('.')
  if(cents[1]!=""){
    if (cents[1]==00){
    num=cents[0]
    }
  }
}
return num
}