
function formatToCurrency(num){
    
    var strCopy = "";
    
    num = num.toString();
    
    var i;
    
    for(i = num.length - 1; i >= 0; i--){
    
        if(i % 3 == 0 && i != 0){
        
            strCopy = strCopy + num.charAt(num.length-i-1) + ",";
        
        }
        else{
            strCopy = strCopy + num.charAt(num.length-i-1);
        }
    
    }
    
    return "$" + strCopy + ".00";

}

function formatToFloat(str){

    str = str.replace(",", "");
    str = str.replace("$", "");
    str = parseFloat(str);
    return str;

}

function addLeadingZeros(num, count){

    var i;
    for(i = 0; i < count; i++){
        num = "0" + num;
    }
    
    return num;
    
}