function IsNumeric(value)

{

    var validCharacters = "0123456789.";

    var pointCount = 0;

    var digitCount = 0;

    

    //Make sure the entered text is non-empty

    if(value == null || value.length == 0)

    {

        return false;

    }

    

    //Test each character to ensure it is numeric:

    for (i = 0; i < value.length; i++)

    {

        var currentCharacter = value.charAt(i);

        

        if(validCharacters.indexOf(currentCharacter) == -1)

        {

            return false;

        }

        

        if(currentCharacter == '.')

        {

            pointCount++;

        }

        else

        {

            digitCount++;

        }

    }

    

    if(pointCount > 1 || digitCount < 1)

    {

        return false;

    }

    

    //If we get here, then the number must be valid

    return true;

}

 

function RoundToTwoDecimalPlaces(value)

{

    value = value * Math.pow(10, 2)

    value = Math.round(value)

    value = value / Math.pow(10, 2)

    return value;

}

 

function FormatStringForTwoDecimalPlaces(value) 

{

    //Convert the number to a string

    var valueString = value.toString()

    

    //Locate the decimal point

    var decimalLocation = valueString.indexOf(".")

 

    //Is there a decimal point?

    if (decimalLocation == -1) 

    {        

        valueString += ".00"

    }

    else 

    {

        var decimalPlaces = valueString.length - decimalLocation - 1;

        var additionalZeros = 2 - decimalPlaces;

        

        for(var i = 0; i < additionalZeros; i++)

        {

            valueString += "0";    

        }

    }

    

    return valueString;

}

// JavaScript Document