
function numberFormat(amount) {
    var rawNumStr = round(amount) + '';
    rawNumStr = (rawNumStr.charAt(0) == '.' ? '0' + rawNumStr : rawNumStr);
    if (rawNumStr.charAt(rawNumStr.length - 3) == '.') {
        return rawNumStr
        }
    else if (rawNumStr.charAt(rawNumStr.length - 2) == '.') {
        return rawNumStr + '0';
        }
    else { return rawNumStr + '.00'; }
    }

function round(number,decPlace) {
    decPlace = (!decPlace ? 2 : decPlace);
    return Math.round(number * Math.pow(10,decPlace)) / Math.pow(10,decPlace);
}
