var protocol = window.location.protocol;
var currentURLSSL = window.location.href;
var currentURLLC = window.location.href.toLowerCase();
// check if page loaded over https
if (protocol != "https:") {
	// if not redirect to current location with https:
	document.write ("Redirecting to secure connection<br />");
	var new_location = "https://" + currentURLSSL.substr(7);
	if (currentURLLC.indexOf("http://nab.com.au") >= 0) {
		new_location = "https://www." + currentURLSSL.substr(7);
	}
	window.location.replace(new_location);
} else if (protocol == "https:") {
	if (currentURLLC.indexOf("https://nab.com.au") >= 0) {
		new_location = "https://www." + currentURLSSL.substr(8);
		window.location.replace(new_location);	
	}
}
