var maria_moneyUtils = function (myShowAlwaysDecimal) {

    var showAlwaysDecimal = myShowAlwaysDecimal;

    if (typeof(showAlwaysDecimal) !== "boolean") {
        showAlwaysDecimal = false;
    }
    
    this.setShowAlwaysDecimal = function (newVal) {
        if (typeof(newVal) === "boolean") {
            showAlwaysDecimal = newVal;
        }
    }

    this.cent2euro = function (cents,mySeparator) {
        var separator = ',';
        if (typeof(mySeparator) == "string" && (mySeparator == ',' || mySeparator == '.')) {
            separator = mySeparator;
        }
        
        var euro = Math.floor(cents/100);
        var newCents = cents-euro*100;
        if (newCents === 0 && !showAlwaysDecimal) {
            return euro;
        }
        if (newCents < 10) {
            newCents = "0"+newCents;
        }
        return euro+separator+newCents;
    }
    
    this.showDiscount = function (oldprice,newprice) {
        var frac = 1-(newprice/oldprice);
        return Math.round(frac*100);
    }
    
    /**
       calculates the absolute amount of tax in brutto
       @PARAM tax the tax in % * 100, eg 19,11% is 1911
       @PARAM brutto the brutto price in cents
       @RETURN tax the absolute amount of tax in cents
    */
    this.taxFromBrutto = function (tax,brutto) {
        var bruttoExp100 = Math.round(brutto*100);
        var res = Math.round((bruttoExp100/(tax+10000))*(tax));
        return Math.round(res/100);
    }

}
