if (!ICFO) {
	var ICFO = {};
}

ICFO.months = ['',
              'Январь',
              'Февраль',
              'Март',
              'Апрель',
              'Май',
              'Июнь',
              'Июль',
              'Август',
              'Сентябрь',
              'Октябрь',
              'Ноябрь',
              'Декабрь'];
              
ICFO.monthsEnglish = {'January'   : 'января',
					  'February'  : 'февраля',
					  'March'     : 'марта',
					  'April'     : 'апреля',
					  'May'       : 'мая',
					  'June'      : 'июня',
					  'July'      : 'июля',
					  'August'    : 'августа',
					  'September' : 'сентября',
					  'October'   : 'октября',
					  'November'  : 'ноября',
					  'December'  : 'декабря'};

ICFO.monthsRodPad = ['',
              'Января',
              'Февраля',
              'Марта',
              'Апреля',
              'Мая',
              'Июня',
              'Июля',
              'Августа',
              'Сентября',
              'Октября',
              'Ноября',
              'Декабря'];

ICFO.daysOfWeek = ['',
              'Понедельник',
              'Вторник',
              'Среда',
              'Четверг',
              'Пятница',
              'Суббота',
              'Воскресение'];

ICFO.applyInputsWithTip = function (tipInput, realInput, tipString) {
    tipInput.value = tipString;
    tipInput.onfocus = function() {
        tipInput.style.display = "none";
        realInput.style.display = "";
        realInput.focus();
    };
    realInput.onblur = function() {
        if (this.value == "") {
            tipInput.style.display = "";
            realInput.style.display = "none";
        }
    };
};


/**
 * Convert money value to string
 *
 * @param value
 * @param zeroCent {Boolean} trim zero cents
 * @param groupDigits {Boolean} add space between group of digits
 */
(function () {
    var zeroCentPattern = /^\d+\.00$/;
    var groupDigitsPattern = /(\d)((\d\d\d)+\b)/g;

    ICFO.formatMoney = function (value, groupDigits) {

        value = Math.abs(value).toString();
        //if (zeroCent && zeroCentPattern.test(value)) {
        //  value = value.substr(0, value.length - 3);
        //}
        if (groupDigits) {
            while (groupDigitsPattern.test(value)) {
                value = value.replace(groupDigitsPattern, '$1&nbsp;$2');
            }
        }
        return value;
    };

})();

(function () {
    ICFO.formatCents = function (value) {

		cents = Math.round(value).toString();
		len = cents.length;
		
		return cents.substring(0, len - 2) + "." + cents.substring(len - 2, len);
    };

})();

(function () {
    ICFO.formatPrcnts = function (value) {

		return new Number(value).toFixed(2);
    };

})();

(function () {
    ICFO.formatLeadersDate = function (value) {
		
		var datas = value.split(" ");
		
		eval ('var month = ICFO.monthsEnglish.' + datas[0]);
		
		return datas[1].replace(',', '') + " " + month + " " + datas[2] + "г.";
		
    };

})();
