
/*_________________________________________________________________________________*/

	function focusLoginBox (obj) {
		if (obj.value.length <= 0)	{
			obj.style.color = "black";
			obj.value = "";
		}
		else if (obj.value == "(email address)") {
			obj.value = "";
			obj.style.color = "black";
		}
		else {
			obj.style.color = "black";
		}
	}

	function setLoginBox (obj) {
		if (obj.value.length <= 0)	{
			obj.style.color = "#CCCCCC";
			obj.value = "(email address)";
		}
		else {
			obj.style.color = "black";
		}
	}


	function getLoginForm () {
		window.scrollTo(0,0);
		displayFloatingDiv('Login',388,229,'hidden');
		DWREngine._execute(_ajaxConfig.userAjaxCFC,null,'getPublicPage',"../login.cfm",resultGetLoginForm);
	}

	
	function resultGetLoginForm (r) {
		document.getElementById("divHiddenForm").innerHTML = r.html;
	}
	
	function validateLogin () {
		if (document.getElementById("hidClicked").value == 0) {
			if ((document.getElementById("strLoginUsername2").value.length <= 0) || (document.getElementById("strLoginUsername2").value == "(email address)")) {
				alert("Please provide your login username.");
				document.getElementById("strLoginUsername2").focus();
				return false;
			}
			if (document.getElementById("strLoginPassword2").value.length <= 0) {
				alert("Please provide your password.");
				document.getElementById("strLoginPassword2").focus();
				return false;
			}
			document.getElementById("hidClicked").value = 1;
			document.getElementById("loginStage").style.display = "none";
			document.getElementById("loginLogging").style.display = "";
			
			var vals = {}; 
			vals['strLoginUsername']=document.getElementById("strLoginUsername2").value; 
			vals['strLoginPassword']=document.getElementById("strLoginPassword2").value;
			DWREngine._execute(_ajaxConfig.userAjaxCFC,null,'SponsorshipsLoginPopup',vals,resultSponsorshipsLoginPopup);
		}
	}
	
	curriculumRes = 0;
	function resultSponsorshipsLoginPopup (r) {
		if (r.blnerror == "true") {
			document.getElementById("hidClicked").value = 0;
			document.getElementById("loginStage").style.display = "";
			document.getElementById("loginLogging").style.display = "none";
			document.getElementById("loginErr").innerHTML = r.html;
			document.getElementById("strLoginUsername2").focus();
		}
		else if (r.html == '_to_registration_') {
			location.href = '/register/form_RegisterUser.cfm?forwardURL=/login.cfm';
		}
		else {
			
			// need to get forward url param
			if(curriculumRes!=1){
				forwardURL = "/nextStep.cfm";
			}else{
				forwardURL = newURL;
			}

			aUrl = String(window.location.href);
			aUrl = aUrl.split("?");
			if (aUrl.length == 2){
				aUrl = String(aUrl[1]);
				aUrl = aUrl.split("&");
				for (var i = 0; i < aUrl.length; i++) {
					temp = aUrl[i].split("=");
					if (temp[0].toLowerCase() == "forward") {
						forwardURL=temp[1];
						break;
					}
				}
			}
			
			if (forwardURL != "") {
				window.location.href=forwardURL;
			}
			else {
				window.location.reload();
			}
			
		}
	}
	
/*_________________________________________________________________________________*/
// Forgot Username

	function turnOffForgotButtons (strAction) {
		if (strAction == "OFF") 	{
			if (document.getElementById("btnSubmit1")) {
				document.getElementById("btnSubmit1").value = "Wait ...";
				document.getElementById("btnSubmit1").disabled = true;
			}
			if (document.getElementById("btnSubmit2")) {
				document.getElementById("btnSubmit2").value = "Wait ...";
				document.getElementById("btnSubmit2").disabled = true;
			}
		}
		else {
			if (document.getElementById("btnSubmit1")) {
				document.getElementById("btnSubmit1").value = " continue ";
				document.getElementById("btnSubmit1").disabled = false;
			}
			if (document.getElementById("btnSubmit2"))	{
				document.getElementById("btnSubmit2").value = " continue ";
				document.getElementById("btnSubmit2").disabled = false;
			}
		}
	}
	
	function forgotUserName (strObjID) {
		turnOffForgotButtons ("OFF");
		document.getElementById("imgTopWaitGif").style.visibility = "visible";
		
		
		if (strObjID == "strForgotUsername") {
			var vals = {}; 
			vals['strforgotusername']=document.getElementById("strForgotUsername").value; 	
		}
		
		
		if (strObjID == "strSecurityQuestionAnswer") {
			var vals = {}; 
			vals['strSecurityQuestionAnswer']=document.getElementById("strSecurityQuestionAnswer").value; 
			vals['hidSPONSORUSERGUID']=document.getElementById("hidSPONSORUSERGUID").value; 			
		}
		
		if (strObjID == "txtForgotPassword") {
			var vals = {}; 
			vals['txtForgotPassword']=document.getElementById("txtForgotPassword").value; 
			vals['txtForgotConfirmPassword']=document.getElementById("txtForgotConfirmPassword").value;
			vals['hidSPONSORUSERGUID']=document.getElementById("hidSPONSORUSERGUID").value;
			vals['hidSPONSORUSERNAME']=document.getElementById("hidSPONSORUSERNAME").value;			
		}
		
		
		document.getElementById("responseMsgForgotPassword").innerHTML = "&nbsp;";
		DWREngine._execute(_ajaxConfig.userAjaxCFC,null,'forGotUserName',vals,resultForgotUserName);
	}
	
	function resultForgotUserName (r) {
		turnOffForgotButtons ("ON");
		document.getElementById("imgTopWaitGif").style.visibility = "hidden";
		document.getElementById("responseMsgForgotPassword").innerHTML = r.html;
	}
	
	function forgotUserNameEmail (strObjID) {
		turnOffForgotButtons ("OFF");
		document.getElementById("imgBottomWaitGif").style.visibility = "visible";
		document.getElementById("responseMsgForgotUsername").innerHTML = "&nbsp;";
		
		if (strObjID == "strForgotEmail") {
			var vals = {}; 
			vals['strForgotEmail']=document.getElementById("strForgotEmail").value; 	
		}
		
		DWREngine._execute(_ajaxConfig.userAjaxCFC,null,'forGotUserNameEmail',vals,resultForGotUserNameEmail);
	}
	
	function resultForGotUserNameEmail (r) {
		turnOffForgotButtons ("ON");
		document.getElementById("imgBottomWaitGif").style.visibility = "hidden";
		document.getElementById("responseMsgForgotUsername").innerHTML = r.html;
		
	}
