text: /*
   * Material Deesign Checkboxes non Polymer updated for use in bootstrap.
   * Tested and working in: IE9+, Chrome (Mobile + Desktop), Safari, Opera, Firefox.
   * @author Jason Mayes 2014, www.jasonmayes.com
   * @update Sergey Kupletsky 2014, www.design4net.ru
  */
  
  var wskCheckbox = function() {
      var wskCheckboxes = [];
      var SPACE_KEY = 32;
    
      function addEventHandler(elem, eventType, handler) {
        if (elem.addEventListener) {
          elem.addEventListener (eventType, handler, false);
        }
        else if (elem.attachEvent) {
          elem.attachEvent ('on' + eventType, handler);
        }
      }
    
      function clickHandler(e) {
        e.stopPropagation();
        if (this.className.indexOf('checked') < 0) {
          this.className += ' checked';
        } else {
          this.className = 'chk-span';
        }
      }
    
      function keyHandler(e) {
        e.stopPropagation();
        if (e.keyCode === SPACE_KEY) {
          clickHandler.call(this, e);
          // Also update the checkbox state.
    
          var cbox = document.getElementById(this.parentNode.getAttribute('for'));
          cbox.checked = !cbox.checked;
        }
      }
    
      function clickHandlerLabel(e) {
        var id = this.getAttribute('for');
        var i = wskCheckboxes.length;
        while (i--) {
          if (wskCheckboxes[i].id === id) {
            if (wskCheckboxes[i].checkbox.className.indexOf('checked') < 0) {
              wskCheckboxes[i].checkbox.className += ' checked';
            } else {
              wskCheckboxes[i].checkbox.className = 'chk-span';
            }
            break;
          }
        }
      }
    
      function findCheckBoxes() {
        var labels =  document.getElementsByTagName('label');
        var i = labels.length;
        while (i--) {
          var posCheckbox = document.getElementById(labels[i].getAttribute('for'));
          if (posCheckbox !== null && posCheckbox.type === 'checkbox') {
            var text = labels[i].innerText;
            var span = document.createElement('span');
            span.className = 'chk-span';
            span.tabIndex = i;
            labels[i].insertBefore(span, labels[i].firstChild);
            addEventHandler(span, 'click', clickHandler);
            addEventHandler(span, 'keyup', keyHandler);
            addEventHandler(labels[i], 'click', clickHandlerLabel);
            wskCheckboxes.push({'checkbox': span,
                'id': labels[i].getAttribute('for')});
          }
        }
      }
    
      return {
        init: findCheckBoxes
      };
    }();
    
    wskCheckbox.init();
    
  
    function checkValue(element) {
      // check if the input has any value (if we've typed into it)
      if ($(element).val())
        $(element).addClass('has-value');
      else
        $(element).removeClass('has-value');
    }
    
    $(document).ready(function() {
      // Run on page load
      $('.form-control').each(function() {
        checkValue(this);
      })
      // Run on input exit
      $('.form-control').blur(function() {
        checkValue(this);
      });
    });
    