var EWK = window.EWK || {};

EWK = {
    settings: null,
    init: function(settings){
        this.settings = settings;
        EWK.MainNavigation.init();
        EWK.Layout.Box.intersectionHelper();
        //$('.subNavigation a.hide').parent().hide();
        $('.subNavigation .marginBottom').parent().addClass('marginBottom');
    //EWK.l18n.init();
    }
}
EWK.l18n = {
    /*init: function(){
        this._jQueryTools();
    },
    _jQueryTools: function(){
        $.tools.dateinput.localize('de',  {
            months:        'Januar,Februar,M√§rz,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember',
            shortMonths:   'Jan,Feb,M√§r,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez',
            days:          'Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag',
            shortDays:     'So,Mo,Di,Mi,Do,Fr,Sa'
        });
    },*/
    monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'],
    monthNames: ['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
    dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
    dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
    dayNamesShort: ['Son','Mon','Die','Mit','Don','Fre','Sam']
}
EWK.teaserWithBubbleRotator = {
    delay: 5000,
    animationDelay: 500,
    currentIndex: 0,
    indexMax: 0,
    init: function(){
        var self = this;

        this.indexMax = $('.stageTeaser').length - 1;

        $('.stageTeaser .bubble, .stageTeaser .image').hide();
        $('.stageTeaser:eq('+self.currentIndex+') .bubble, .stageTeaser:eq('+self.currentIndex+') .image').show();

        window.setInterval(function(){
            self._next();

        }, self.delay);

    },
    _next: function(){

        var self = this;

        $('.stageTeaser:eq('+self.currentIndex+') .bubble').fadeOut(self.animationDelay, function(){
            $('.stageTeaser:eq('+self.currentIndex+') .image').fadeOut(self.animationDelay);

            if(self.currentIndex == self.indexMax){
                self.currentIndex = 0;
            }
            else {
                self.currentIndex++;
            }

            $('.stageTeaser:eq('+self.currentIndex+') .image').fadeIn(self.animationDelay, function(){
                $('.stageTeaser:eq('+self.currentIndex+') .bubble').fadeIn(self.animationDelay);
            });
        });

    }
}
EWK.News = {
    init: function(){
        this._bindElements();
        this._checkURLHash();
    },
    _checkURLHash: function(){
        var hash = location.hash;
        hash = hash.replace(/^.*#/, '');

        if(hash != ''){
            var el = $('.newsBoxSmall[data-permalink='+hash+']');
            if(el.length == 1){
                var id = el.attr('data-id');

                this._openTextBox(id);

            }

        }

    },
    _bindElements: function(){
        this._bindNewsBoxes();
        this._bindCloseButtons();

    },
    _bindNewsBoxes: function(){
        var self = this;
        $('.newsBoxSmall').bind('click',function(){
            var id = $(this).attr('data-id');
            var permalink = $(this).attr('data-permalink');

            self._closeTextBox();

            if(!$('.newsTextBox[data-id='+id+']').is(':visible')){
                self._openTextBox(id);
                location.hash = permalink;
            }

        });
    },
    _bindCloseButtons: function(){
        var self = this;
        $('.newsTextBox .btnClose').bind('click', function(){
            self._closeTextBox();
        });
    },
    _openTextBox: function(id){

        $('.newsTextBox[data-id='+id+']').slideDown('fast');
        $.scrollTo($('.newsBoxSmall[data-id='+id+']').position().top - 13 + 'px', 500);

    },
    _closeTextBox: function(){
        $('.newsTextBox').slideUp('fast');
        location.hash = 'alle';
    }
};

EWK.TabNavigation = {
    init: function(){
        $('#tabNavigation ul li:first').css('padding-left', '10px');
        $('#tabNavigation ul li.active').prev().addClass('curve');
    }
};
EWK.MainNavigation = {
    _subMenuActive: false,
    init: function(){
        var self = this,
        timeout;
        $('#menu-productsAndServices').bind('mouseenter', function(){

            $('#submenu-productsAndServices').show();
            self._subMenuActive = true;

        }).bind('mouseleave', function(){

            timeout = window.setTimeout(function(){
                $('#submenu-productsAndServices').hide();
                self._subMenuActive = false;
            }, 500);

        });
        $('#submenu-productsAndServices').bind('mouseenter', function(){

            clearTimeout(timeout);
            $(this).show();
            self._subMenuActive = true;

        }).bind('mouseleave', function(){

            timeout = window.setTimeout(function(){
                $('#submenu-productsAndServices').hide();
                self._subMenuActive = false;
            }, 500);

        });

    }
};
EWK.Products = {
    Calculator: {
        init: function(type){
            if(type == 'powerRegio'){
                EWK.Products.Calculator.Power.init('powerRegio');
            }
            else if(type == 'powerStandard'){
                EWK.Products.Calculator.Power.init('powerStandard');
            }
            else if(type == 'water'){
                EWK.Products.Calculator.Water.init();
            }
            else if(type == 'gas'){
                EWK.Products.Calculator.Gas.init();
            }
        },
        formatValue: function(number){
            return EWK.Helper.number_format(number, 0, ',', '.');
        }
    },
    PricingTableSwitch: {
        init: function(){
            $('.tableSwitch').bind('click', function(e){
                e.preventDefault();
                $('.tableSwitch').removeClass('active');
                $(this).addClass('active');
                $('.pricingTableGasExakt').removeClass('orange green').addClass($(this).attr('data-color'));
                $('.exakt, .exaktBio10, .exaktBio30').hide();
                $('.'+$(this).attr('data-table')).show();
            });
        }
    }
};

EWK.Products.Calculator.Power = {
    settings: {
        type: null,
        selectB: '#powerCalculatorSelectBeautified',
        selectBO: '#powerCalculatorSelectBeautifiedOptions',
        input: '#powerCalculatorUserInput',
        availableClasses: 'single twoPersons family house factory'
    },
    init: function(type){
        this.settings.type = type;
        this._processSelect();

        var self = this;
        window.setTimeout(function(){
            self._getResult('standard', $('#powerCalculatorUserInput').val());
        }, 1000);

    },
    _processSelect: function(){

        var self = this;

        $('#powerCalculatorSelect').hide();

        $(self.settings.selectB).show().find('.select')
        .bind('click', function(){
            if($(self.settings.selectBO).is(':visible')){
                $(self.settings.selectBO).slideUp();
            }
            else {
                $(self.settings.selectBO).slideDown();
            }
        });
        this._bindOptions();
        this._bindSwitch();
        this._bindUserInput();
    },
    _bindOptions: function(){
        var self = this;
        $(self.settings.selectBO + ' .options li').bind('click', function(){
            var option = $.parseJSON($(this).attr('data-option'));
            self._setOption(option , $(this).find('.value').text());
            $(self.settings.selectBO).slideUp();
        });
    },
    _bindSwitch: function(){
        var self = this;
        $('#powerCalculatorSwitchDayNight').bind('click', function(){
            if($(this).is(':checked')){
                $('#powerCalculatorUserInputContainer').slideUp();
                $('#powerCalculatorUserInputDayNightContainer').slideDown();
                self._hideSelectBoxContainer();
                self._unbindUserInput();
                self._bindUserInputHTNT();
            }
            else {
                $('#powerCalculatorUserInputContainer').slideDown();
                $('#powerCalculatorUserInputDayNightContainer').slideUp();
                self._showSelectBoxContainer();
                self._unbindUserInputHTNT();
                self._bindUserInput();
            }
        });
    },
    _bindUserInput: function(){
        var self = this;
        $('#powerCalculatorUserInput').bind('focusout keydown', function(event){

            if(event.type == 'focusout' || (event.type == 'keydown' && event.keyCode == '13')){

                var value = $(this).val();
                value = value.replace (/[^\d]/g, ''); // remove everything except of [0-9]
                $(this).val(EWK.Products.Calculator.formatValue(value));

                self._getResult('standard',value);
            }
        });
    },
    _unbindUserInput: function(){
        $('#powerCalculatorUserInput').unbind();
    },
    _bindUserInputHTNT: function(){

        var self = this,
        htReady = false,
        ntReady = false,
        htValue = null,
        ntValue = null;

        $('#powerCalculatorUserInputDay').bind('focusout keydown', function(event){

            if(event.type == 'focusout' || (event.type == 'keydown' && event.keyCode == '13')){

                var value = $(this).val();
                value = value.replace (/[^\d]/g, ''); // remove everything except of [0-9]
                $(this).val(EWK.Products.Calculator.formatValue(value));
                htReady = (value == '') ? false : true;
                htValue = value;
                if(htReady && ntReady && htValue != null && ntValue != null){

                    self._getResult('HTNT', htValue, ntValue);

                }
            }

        });
        $('#powerCalculatorUserInputNight').bind('focusout keydown', function(event){

            if(event.type == 'focusout' || (event.type == 'keydown' && event.keyCode == '13')){

                var value = $(this).val();
                value = value.replace (/[^\d]/g, ''); // remove everything except of [0-9]
                $(this).val(EWK.Products.Calculator.formatValue(value));
                ntReady = (value == '') ? false : true;
                ntValue = value;
                if(htReady && ntReady && htValue != null && ntValue != null){

                    self._getResult('HTNT', htValue, ntValue);

                }

            }
        });

    },
    _unbindUserInputHTNT: function(){
        $('#powerCalculatorUserInputDay, #powerCalculatorUserInputNight').unbind();
    },
    _setOption: function(option, valueFormated){
        var self = this;
        var select = $(self.settings.selectB+' .selection');
        select.find('.icon').removeClass(self.settings.availableClasses).addClass(option.cssClass);
        select.find('.icon').text(option.description);
        select.find('.description .value').text(valueFormated);
        $(self.settings.input).val(valueFormated);
        self._getResult('standard', option.value);
    },
    _getResult: function(type, value, valueNT){
        var data;
        switch(type){
            case 'standard':
                data = {
                    'type': this.settings.type,
                    'value': value
                };
                break;
            case 'HTNT':
                data = {
                    'type': this.settings.type,
                    'value': value,
                    'valueNT': valueNT
                };
                break;
        }

        var self = this;

        self._addLoader('#powerCalculatorResultContainer');
        $.ajax({
            url: EWK.settings.apiUrl + 'calculator',
            data: data,
            type: 'POST',
            dataType: 'json',
            success: function(data){
                self._showResult(data.response.content);
                self._removeLoader('#powerCalculatorResultContainer');
            },
            error: function(jqXHR, textStatus, errorThrown){

            }
        });

    },
    _showResult: function(result){
        $('#powerCalculatorResultContainer').html(result.rate);
        $('#powerCalculatorAlternativeResultContainer').html(result.alternativeRate);
    },
    _addLoader: function(el){
        $(el).addClass('loading');
    },
    _removeLoader: function(el){
        $(el).removeClass('loading');
    },
    _hideSelectBoxContainer: function(){
        $('.boxLightBlue:eq(1)').slideUp();
        $('.boxLightBlue:eq(0) .intersection').text('=');
    },
    _showSelectBoxContainer: function(){
        $('.boxLightBlue:eq(1)').slideDown();
        $('.boxLightBlue:eq(0) .intersection').text('oder');
    }
}


EWK.Products.Calculator.Water = {
    settings: {
        type: null,
        input: '#powerCalculatorUserInput'
    },
    init: function(){
        this._processSelect();

        var self = this;
        window.setTimeout(function(){
            self._getResult($('#powerCalculatorUserInput').val());
        }, 1000);
    },
    _processSelect: function(){
        this._bindUserInput();
    },

    _bindUserInput: function(){
        var self = this;
        $('#powerCalculatorUserInput').bind('focusout keydown', function(event){
            if(event.type == 'focusout' || (event.type == 'keydown' && event.keyCode == '13')){
                var value = $(this).val();
                value = value.replace (/[^\d]/g, ''); // remove everything except of [0-9]
                $(this).val(EWK.Products.Calculator.formatValue(value));

                self._getResult(value);
            }
        });
    },
    _unbindUserInput: function(){
        $('#powerCalculatorUserInput').unbind();
    },
    _getResult: function(value){
        var data;
        data = {
            'type': 'water',
            'value': value
        };

        var self = this;

        self._addLoader('#powerCalculatorResultContainer');
        $.ajax({
            url: EWK.settings.apiUrl + 'calculator',
            data: data,
            type: 'POST',
            dataType: 'json',
            success: function(data){
                self._showResult(data.response.content);
                self._removeLoader('#powerCalculatorResultContainer');
            },
            error: function(jqXHR, textStatus, errorThrown){

            }
        });

    },
    _showResult: function(result){
        $('#powerCalculatorResultPrice span').text(result.pricePerYear);
    },
    _addLoader: function(el){
        $(el).addClass('loading');
    },
    _removeLoader: function(el){
        $(el).removeClass('loading');
    }
}

EWK.Products.Calculator.Gas = {
    settings: {
        type: null,
        input: '#powerCalculatorUserInput',
        inputPower: '#powerCalculatorUserInputPower',
        select: '#powerCalculatorSelect',
        value: null,
        valuePower: null
    },
    init: function(){
        this.settings.type = $('#powerCalculatorSelect option:selected').val();

        this._processSelect();

        var self = this;

        window.setTimeout(function(){
            $('#powerCalculatorUserInput').trigger('focusout');
        }, 100);

    },
    _processSelect: function(){
        this._bindSelect();
        this._bindUserInput();
    //this._slider();
    },
    _slider: function(){
        $('#apartmentSizeSlider').slider({
            value: 40,
            min: 40,
            max: 160,
            step: 40,
            slide: function(event, ui){
            // ui.value
            }
        });
    },
    _bindSelect: function(){
        var self = this;
        $('#powerCalculatorSelect').bind('change', function(){
            var value = $(this).val();

            self.settings.type = value;

            if(value == 'gasAllgemein'){
                $('#powerCalculatorUserInputPowerContainer').slideDown();
            }
            else { // val == gasExakt | gasExaktBio10 | gasExaktBio30
                $('#powerCalculatorUserInputPowerContainer').slideUp();
            }

            self._getResult();

        });
    },
    _bindUserInput: function(){
        var self = this;
        $('#powerCalculatorUserInput').bind('focusout keydown', function(event){

            if(event.type == 'focusout' || (event.type == 'keydown' && event.keyCode == '13')){
                var value = $(this).val();
                value = value.replace (/[^\d]/g, ''); // remove everything except of [0-9]
                $(this).val(EWK.Products.Calculator.formatValue(value));
                self.settings.value = value;
                self._getResult();
            }

        });
        $('#powerCalculatorUserInputPower').bind('focusout keydown', function(event){

            if(event.type == 'focusout' || (event.type == 'keydown' && event.keyCode == '13')){
                var value = $(this).val();
                value = value.replace (/[^\d]/g, ''); // remove everything except of [0-9]
                $(this).val(value);
                self.settings.valuePower = value;
                self._getResult();
            }
        });
    },
    _unbindUserInput: function(){
        $('#powerCalculatorUserInput').unbind();
    },
    _getResult: function(){
        var data;
        data = {
            'type': 'gas',
            'tariff': this.settings.type,
            'value': this.settings.value,
            'valuePower': this.settings.valuePower
        };

        var self = this;

        self._addLoader('#powerCalculatorResultContainer');
        $.ajax({
            url: EWK.settings.apiUrl + 'calculator',
            data: data,
            type: 'POST',
            dataType: 'json',
            success: function(data){
                self._showResult(data.response.content);
                self._removeLoader('#powerCalculatorResultContainer');
            },
            error: function(jqXHR, textStatus, errorThrown){

            }
        });

    },
    _showResult: function(result){
        $('#powerCalculatorResultContainer').html(result.rate);
        $('#powerCalculatorAlternativeResultContainer').html(result.alternativeRate);
        /*
        if(this.settings.type == 'gasAllgemein'){
                }
            $('#powerCalculatorAlternativeResultContainer').slideUp(300);
        }
        else {
            $('#powerCalculatorAlternativeResultContainer').slideDown(300);

            $('#powerCalculatorAlternativeResultName1').html(result.alternativeRate1.name);
            $('#powerCalculatorAlternativeResultPrice1 span').text(result.alternativeRate1.pricePerYear);
            $('#powerCalculatorAlternativeResultName2').html(result.alternativeRate2.name);
            $('#powerCalculatorAlternativeResultPrice2 span').text(result.alternativeRate2.pricePerYear);
        }*/
    },
    _addLoader: function(el){
        if(!$(el).hasClass('loading')){
            $(el).addClass('loading');
        }
    },
    _removeLoader: function(el){
        window.setTimeout(function(){
            $(el).removeClass('loading');
        }, 100);
    }
}

EWK.Helper = {
    array_key_exists: function(key, search){
        if(!search || (search.constructor !== Array && search.constructor !== Object)){
            return false;
        }
        return key in search;
    },
    isDigit: function(digit){
        var reg = new RegExp("^[0-9]$");
        console.log(reg.test(digit));
        return (reg.test(digit));
    },
    number_format: function(number, decimals, dec_point, thousands_sep){
        number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
        var n = !isFinite(+number) ? 0 : +number,
        prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
        sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
        dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
        s = '',
        toFixedFix = function (n, prec) {
            var k = Math.pow(10, prec);
            return '' + Math.round(n * k) / k;
        };
        // Fix for IE parseFloat(0.55).toFixed(0) = 0;
        s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
        if (s[0].length > 3) {
            s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
        }
        if ((s[1] || '').length < prec) {
            s[1] = s[1] || '';
            s[1] += new Array(prec - s[1].length + 1).join('0');
        }
        return s.join(dec);
    }
};
EWK.Layout = {
    Box: {
        intersectionHelper: function(){
            $('.intersection').each(function(){
                $(this).css('left', (($(this).parent().innerWidth() - $(this).outerWidth()) / 2) + 'px');
            });
        }
    }
};
EWK.Forms = {
    Helper: {
        tabindex: function(elements){
            $.map(elements, function(element, index){
                $(element).attr('tabindex', index+1);
            });
        },
        groupSwitch: function(){
            $('.groupSwitch').bind('click', function(){
                var group = $('#'+$(this).attr('id')+'Group');
                if(group.hasClass('disabled')){
                    group.removeClass('disabled').find('input').removeClass('disabled').attr('disabled', false);
                }
                else {
                    group.addClass('disabled').find('input').addClass('disabled').attr('disabled', true);
                }
            });
        },
        standardInputBehaviour: function(){
            $('.inputText').bind('focusin focusout', function(){
                if($(this).val() == ''){
                    $(this).val($(this).attr('data-value'));
                }
                else if($(this).val() == $(this).attr('data-value')){
                    $(this).val('');
                }
            });
            $('.inputTextarea').bind('focusin focusout', function(){
                if($(this).text() == ''){
                    $(this).text($(this).attr('data-value'));
                }
                else if($(this).text() == $(this).attr('data-value')){
                    $(this).text('');
                }
            });
        },
        dateInput: function(selector, settings){

            var _settings = {
                dateFormat: 'dd.mm.yy',
                showAnim: 'slide',
                firstDay: 1,
                monthNames: EWK.l18n.monthNames,
                monthNamesShort: EWK.l18n.monthNamesShort,
                dayNames: EWK.l18n.dayNames,
                dayNamesMin: EWK.l18n.dayNamesMin,
                dayNamesShort: EWK.l18n.dayNamesShort
            };

            $.extend(_settings, settings);

            $(selector).datepicker(_settings);
        },
        formWithSteps: function(){
            $('#formWithSteps').css({
                'width': '580px',
                'height': $('#formWithSteps').find('.page').eq(0).innerHeight()+60+'px'
            });

            var root = $("#formWithSteps").scrollable();
            var api = root.scrollable();
            api.onSeek(function(event, i){

                $('#formWithSteps').animate({
                    height: root.find('.page').eq(i).innerHeight()+60+'px'
                }, 'slow', function(){
                    $.scrollTo($('#content').position().top+'px', 500);
                });

            });
            api.onBeforeSeek(function(event, i){

                if(api.getIndex() < i){
                    var page = root.find('.page').eq(api.getIndex()),
                    inputs = page.find('input.required').removeClass('error'),
                    empty = inputs.filter(function(){
                        return $(this).val().replace(/\s*/g, '') == '';
                    });
                    if(empty.length){
                        empty.addClass('error');
                        return false;
                    }
                    else {

                }
                }
                $('#status li').removeClass('active').eq(i).addClass('active');
            });
        // if tab is pressed on the next button seek to next page
        /*root.find("a.next").keydown(function(e) {
                if (e.keyCode == 9) {

                    // seeks to next tab by executing our validation routine
                    api.next();
                    e.preventDefault();
                }
            });*/
        },
        emptyFieldsBeforeSend: function(){

            $('form').bind('submit', function(e){
                //e.preventDefault();
                $('.inputText').each(function(){
                    if($(this).val() == $(this).attr('data-value')){
                        $(this).val('').attr('disabled', 'disabled');
                    }
                /*else {
                        $(this).attr('disabled', '');
                    }*/
                //console.log($(this).attr('name')+' - '+$(this).attr('disabled'))
                });
                $('.inputTextarea').each(function(){
                    if($(this).val() == $(this).attr('data-value')){
                        $(this).val('').attr('disabled', 'disabled');
                    }
                });
            });

        }
    },
    Registration: {
        init: function(){
            EWK.Forms.Helper.formWithSteps();
            EWK.Forms.Helper.groupSwitch();
            EWK.Forms.Helper.standardInputBehaviour();
            EWK.Forms.Helper.dateInput('.inputDateBirthday', {
                changeMonth: true,
                changeYear: true,
                showOtherMonths: true,
                selectOtherMonths: true,
                yearRange: '-100:+0',
                maxDate: '+0d'
            });
            EWK.Forms.Helper.dateInput('.inputDateSupplyFrom', {
                changeMonth: true,
                changeYear: true,
                showOtherMonths: true,
                yearRange: '-1:+1'
            });
            EWK.Forms.Helper.emptyFieldsBeforeSend();

            var formElements = [
            '[name=personFirstname]','[name=personLastname]','[name=personBirthday]',
            '[name=personStreet]','[name=personHouseNumber]','[name=personPostalcode]','[name=personCity]','[name=personPhone]','[name=personMail]',
            '[name=invoiceAddressSelected]',
            '[name=invoiceFirstname]','[name=invoiceLastname]',
            '[name=invoiceStreet]','[name=invoiceHouseNumber]','[name=invoicePostalcode]','[name=invoiceCity]',
            '.page:eq(0) a.next',
            '[name=housePreviousTenant]'
            ];
        //EWK.Forms.Helper.tabindex(formElements);

        }
    },
    Deregistration: {
        init: function(){
            EWK.Forms.Helper.formWithSteps();
            EWK.Forms.Helper.groupSwitch();
            EWK.Forms.Helper.standardInputBehaviour();
            EWK.Forms.Helper.dateInput('.inputDateBirthday', {
                changeMonth: true,
                changeYear: true,
                showOtherMonths: true,
                selectOtherMonths: true,
                yearRange: '-100:+0',
                maxDate: '+0d'
            });
            EWK.Forms.Helper.dateInput('.inputDateDeregistrationTo', {
                changeMonth: true,
                changeYear: true,
                showOtherMonths: true,
                yearRange: '-1:+1'
            });
            EWK.Forms.Helper.emptyFieldsBeforeSend();
        }
    },
    DirectDebitAuthorization: {
        init: function(){
            EWK.Forms.Helper.formWithSteps();
            EWK.Forms.Helper.groupSwitch();
            EWK.Forms.Helper.standardInputBehaviour();
            EWK.Forms.Helper.dateInput('.inputDateMeterReadingAt', {
                changeMonth: true,
                changeYear: true,
                showOtherMonths: true,
                selectOtherMonths: true,
                yearRange: '0:+2',
                minDate: '+1d'
            });
            EWK.Forms.Helper.emptyFieldsBeforeSend();
        }
    },
    MeterCount: {
        init: function(){
            EWK.Forms.Helper.formWithSteps();
            EWK.Forms.Helper.groupSwitch();
            EWK.Forms.Helper.standardInputBehaviour();
            EWK.Forms.Helper.dateInput('.inputDateMeterReadingAt', {
                changeMonth: true,
                changeYear: true,
                showOtherMonths: true,
                selectOtherMonths: true,
                yearRange: '-2:+2'
            });
            EWK.Forms.Helper.emptyFieldsBeforeSend();
        }
    },
    Contact: {
        init: function(){
            EWK.Forms.Helper.standardInputBehaviour();
            EWK.Forms.Helper.emptyFieldsBeforeSend();
        }
    }
};
