(function () {
  document.addEventListener("DOMContentLoaded", function(ev) {
    var forms = [];
    forms = forms.concat([].slice.call(document.querySelectorAll('.Ezine2 form')));
    forms = forms.concat([].slice.call(document.querySelectorAll('.c2Form')));

    if (!/gdpr\-/.test(window.location.pathname)) {
      forms = forms.concat([].slice.call(document.querySelectorAll('[class^=" FormBlock"]')));
      forms = forms.concat([].slice.call(document.querySelectorAll('[class^="FormBlock"]')));

      var userDomain = window.location.origin.replace(/sbi([A-za-z0-9]+)\.sitesell\./, "");
      var hostForms = [].slice.call(document.querySelectorAll('form[action^="' + userDomain + '"]'));
    hostForms = hostForms.concat([].slice.call(document.querySelectorAll('form[action^="/"]')));

      for (var i = 0, ilen = hostForms.length; i < ilen; i++) {
        if (forms.indexOf(hostForms[i]) === -1) {
          forms.push(hostForms[i]);
        }
      }
    }

    var blockForm = function (el) {
      el.addEventListener('submit', function (ev) {
        ev.preventDefault();
      }, false);

      var buttons = el.querySelectorAll('input[type="submit"], button[type="submit"], input[value="Submit"], input[type="button"]');

      for (var i = 0, ilen = buttons.length; i < ilen; i++) {
        buttons[i].setAttribute("disabled", "disabled");
        buttons[i].style.cursor = "no-drop";
      }
    };
    
    for (var i = 0, ilen = forms.length; i < ilen; i++) {
      blockForm(forms[i]);
    }
  });
}());