// THIS FUNCTION REQUIRES THE isNumber_str.js FILE

function isCurrencyValid(strAmount)
{
  // VALIDATE NO ALPHA CHARS EXCEPT DECIMAL POINT
  for (i=1; i < strAmount.length; i++)
  {
    if (!isNumber(strAmount.substring(i, i+1)) && strAmount.substring(i, i+1) != ".")
    {
       return false;
    }
  } 

  // VALIDATE NO $ SIGN
  for (i=1; i < strAmount.length; i++)
  {
    if (strAmount.substring(i, i+1) == "$")
    {
       return false;
    }
  }
  
  // VALIDATE NO COMMA
  for (i=1; i < strAmount.length; i++)
  {
    if (strAmount.substring(i, i+1) == ",")
    {
       return false;
    }
  }
  
  // VALIDATE DECIMAL POINT
  var bolDecSign = false;
  for (i=1; i < strAmount.length && !bolDecSign; i++)
  {
    if (strAmount.substring(i, i+1) == ".")
    {
       var intDecPos = i;
       bolDecSign = true;
    }
  }
  if (!bolDecSign)
  {
    return false;
  }
  
  // VALIDATE TWO BYTES AFTER DECIMAL POINT
  if (parseInt(strAmount.length - 1) != parseInt(parseInt(intDecPos) + 2))
  {
    //alert("parseInt(strAmount.length - 1) = " + parseInt(strAmount.length) - 1);
    //alert("parseInt(parseInt(intDecPos) + 2) = " + parseInt(parseInt(intDecPos) + 2));
    alert("Invalid cents length.")
    return false;
  }
  else
  {
    return true;
  }
}