/* exported NewsLetter */
/* global Style, WrapperController, CONST */

function NewsLetter() {
    'use strict';

    // Default properties
    this.showButton = true;
    this.joinButton = true;
    this.rightToLeft = false;
    this.buttonPosition = 'right';

    this.button = new Style('Button');
    this.input = new Style("inputs");
    
    this.newsletterBtnText = "OK";
    this.placeholder = 'Enter your e-mail';

    WrapperController.make(this, NewsLetter);
}

NewsLetter.prototype.beforeBuild = function() {
    'use strict';

    var inputWidth = this.find('input').rawCss('width') || '';
    this.prop('_inputPercentWidth', inputWidth.charAt(inputWidth.length - 1) === '%');

    CONST.RESPONSIVE_MODES.forEach(function (responsive) {
        var inputWidth = this.find('input').rawCss(responsive, 'width') || '';
        this.prop('_inputPercentWidth' + responsive.toUpperCase(), inputWidth.charAt(inputWidth.length - 1) === '%');
    }, this);
};