function makeHttps (url) {

	var doHttps = true;
	
	if(doHttps) {
		var hostname = window.location.hostname;
		var loc = new String(window.location);
		if (document.location.href.indexOf("https") === -1) {
			loc = loc.replace("http", "https");
			document.location.href = loc;
		} 
		return "https://" + hostname + url;
	
	} else {
		return url;
	}

}

function openLoginWindow(theURL, winName) {
	
	var windowDest = makeHttps(theURL);
	
	//popup window dimensions
	var width = 350;
	var height = 275;
	
	//determine parent window position taking into account dual monitors
	var a = typeof window.screenX !== 'undefined' ? window.screenX : window.screenLeft;
    var i = typeof window.screenY !== 'undefined' ? window.screenY : window.screenTop;
    var g = typeof window.outerWidth!=='undefined' ? window.outerWidth : document.documentElement.clientWidth;
    var f = typeof window.outerHeight !== 'undefined' ? window.outerHeight : (document.documentElement.clientHeight - 22);
    var h = (a < 0) ? window.screen.width + a : a;
    var left = parseInt(h + ((g - width) / 2), 10);
    var top = parseInt(i + ((f - height) / 2.5), 10);

	var features = "width=" + width + ",height=" + height + ",resizable=Yes,location=Yes,scrollbars=Yes" + " ,top=" + top + ", left=" + left;
	
	window.open(windowDest, winName, features);
}


