//da a un numero el formato de precio
function priceFormat(num)
{
  num = "" + num  //lo convierte a string
  num = num.split('.')

  //enteros
  var numLet   = num[0].length
  var spaces   = Math.floor(numLet/3)
  var cociente = numLet - (spaces * 3)

  var enteros = ""
  var i = 0;
  while( i < numLet )
  {
    if(i > 0)
      enteros += ","

    var cant = 3
    if(i == 0 && cociente != 0)
      cant = cociente

    enteros += num[0].substr(i,cant);

    i += cant
  }
  num[0] = enteros

  //decimales
  if(num.length == 1)
    return num[0] + ".00"
  else
  {
    if(num[1].length == 1)
      num[1] = num[1] + "0"
  }

  //completo
  var numero = num[0] + "." + num[1].substr(0,2)
  return numero
 }
