
function sslRedirect() {   
   var pageURL = document.URL
   var a = document.URL.split("//"); // split at protocol       

   if(a[0] == "http:") {
      //then replace it with https and redirect 
      if(a[1].indexOf("www") == -1) {
           document.location.href = "https://" + "www." + a[1];
      } else {
           document.location.href = "https://" + a[1];
      }    
     // document.location.href = "https://" + a[1];
   }
 }


function httpRedirect() {   
   var pageURL = document.URL
   var a = document.URL.split("//"); // split at protocol    
   if(a[0] == "https:") { 
      //then replace it with https and redirect to whatever URL
      document.location.href = "http://" + a[1];      
   }
}

function submitOverSSL(f) {   
   //change the  action url to https
   var actionURL = f.action;
   var proto = actionURL.split("//"); //split at protocol   
   //replace form action with the new action url
   f.action = "https://" + proto[1];
}




