/* IHS - 04/26/07 - QA 1201
   These functions where moved here from login.asp. Also used in login_later.asp
*/
<!--

// IHS - 06/06/07 - this is the login function that starts the login process.
function doLogin(jsURL) {
	// first check for cookie support
	if (isCookieEnabled() == false) {
		alert("Your browser's cookies are disabled. Please enable cookies for us to create a session for you.");
		return false;
	}
	else {
		// set secure login, if selected.
		SetSecure(jsURL);
		document.getElementById("frmLogIn").submit();
	}
}

// IHS - 06/06/07 - QA 1269 - determine cookie support
function isCookieEnabled() {
	var cookieEnabled=(navigator.cookieEnabled)? true : false;

	//if not IE4+ nor NS6+
	if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled) {
		document.cookie="is_cookie_ok";
		cookieEnabled = (document.cookie.indexOf("is_cookie_ok") != -1) ? true : false;
	}
	return cookieEnabled;
}

function SetSecure(jsURL) {
	if (document.getElementById("secure").checked == true) {
		//IHS - 04/26/07 - QA 1201 - fix URL for SSL
		eraseCookie('secure');
		createCookie('secure','1',30); // 30 days expiration
		document.getElementById("frmLogIn").action = "https://" + jsURL + "/software/formact/processlogin.asp";
	}
	else {
		//IHS - 04/26/07 - QA 1201 - fix URL for non SSL
		eraseCookie('secure');
		var tmpURL = jsURL.toLowerCase();
		if (tmpURL.indexOf('local') == -1){
		document.getElementById("frmLogIn").action = "https://" + jsURL + "/software/formact/processlogin.asp";}
		else
			{document.getElementById("frmLogIn").action = "http://" + jsURL + "/software/formact/processlogin.asp";}
	}
}

function CheckformPwd(form) {
	if (form.myUsername.value == '') {
		alert('Please enter your username to continue.');
		return false;
	}
	form.SendPass.value = "yes";
	//sg 8/31/2007 put a value into the password - suppress "password required" message 
	//QA issue 1343
	form.myPassword.value = "sendpass";
	form.submit();
}

// IHS - 04/26/07 - QA 1201 - do we pre-select or not SSL preference
function doSSLPref() {
	var sslpref = readCookie("sslpref");
	if (sslpref == "1") {
		document.getElementById("frmLogIn").secure.checked = true;
	}
	else {
		document.getElementById("frmLogIn").secure.checked = false;
	}
}
//-->

