if (document.location.protocol == 'https:')
 {
  var myregex = new RegExp("https:", "g");
  myUrl = document.location.href.replace(myregex, "http:");
  document.location = myUrl;
 }

