<!--

function log10(x) { return Math.LOG10E * Math.log(x); }

// To ensure the input number (FROM TEXTBOX) is a positive integer:
// ---------------------------------------------------------------
function testPositiveInt(inputNum) {
  var parsedNum, bValid = 1;
  if( inputNum.value.length > 0 ) {
    parsedNum = parseInt(inputNum.value, 10);
    if( isNaN(parsedNum) )
        bValid = 0;
    else if( parsedNum < 1 )
        bValid = 0;
    else if( Math.ceil(log10( parsedNum + 0.3)) != inputNum.value.length )
        bValid = 0;
  }
  if( bValid == 0 ) {
      inputNum.value = '';
      alert("Please input a POSITIVE INTEGER to this field.\nAlso don't prefix any zero(0) to there.\nFor input of ZERO(0), simply leave it BLANK.");
      inputNum.focus();
  }
}

// To round a number to specified number of decimal place(s):
// ---------------------------------------------------------
function roundFloat(fNum, nDecPlace)
{
  var fRoundNoTail0, strRoundNum, nPointLoc, nZeroesNeeded, i;
    
  fRoundNoTail0 = Math.round( fNum * Math.pow(10, nDecPlace)) / Math.pow(10, nDecPlace);
  strRoundNum = fRoundNoTail0.toString();
  
  if( nDecPlace > 0 ) {
    nPointLoc = strRoundNum.indexOf('.');
    if( nPointLoc == -1 ) {
      strRoundNum += '.';
      nPointLoc = strRoundNum.indexOf('.');
    }
    nZeroesNeeded = nDecPlace - (strRoundNum.length - 1 - nPointLoc)
    for( i = 0; i < nZeroesNeeded; i++)
      strRoundNum += '0';
  }
  return strRoundNum;
}

// -->