var sslPort = null;
// Set SSL Port here if not running on default 443. Comment it out otherwise.
//sslPort = "9074"
var currentURL=location.href.substring(0,5)

if (currentURL.toLowerCase()!="https") {
	currentURL = location.href.substring(4,location.href.lastIndexOf(''))
	var portStartPos = currentURL.lastIndexOf(':')

	if (portStartPos!=0) {
		var relativeURL = currentURL.substring(portStartPos)
		var postPortURL = relativeURL.substring(relativeURL.indexOf('/'))
		var URL = currentURL.substring(0,portStartPos)
	
		if (sslPort == null)
			currentURL = URL + postPortURL
		else
			currentURL = URL + ":" + sslPort + postPortURL
	}
	window.self.location.replace("https" + currentURL);
}
