
/*_________________________________________________________________________________*/

	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("strLoginUsername").value.length <= 0) || (document.getElementById("strLoginUsername").value == "(email address)")) {
				alert("Please provide your login username.");
				document.getElementById("strLoginUsername").focus();
				return false;
			}
			if (document.getElementById("strLoginPassword").value.length <= 0) {
				alert("Please provide your password.");
				document.getElementById("strLoginPassword").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("strLoginUsername").value; 
			vals['strLoginPassword']=document.getElementById("strLoginPassword").value;
			DWREngine._execute(_ajaxConfig.userAjaxCFC,null,'SponsorshipsLoginPopup',vals,resultSponsorshipsLoginPopup);
		}
	}
	
	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("strLoginUsername").focus();
		}
		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";
		document.getElementById("tdForgotTopMsg").innerHTML = "";
		
		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;			
		}
		
		DWREngine._execute(_ajaxConfig.userAjaxCFC,null,'forGotUserName',vals,resultForgotUserName);
	}
	
	function resultForgotUserName (r) {
		turnOffForgotButtons ("ON");
		document.getElementById("imgTopWaitGif").style.visibility = "hidden";
		if (r.blnerror == "true") {
			document.getElementById("tdForgotTopMsg").innerHTML = r.html;
		}
		else {
			document.getElementById("tdTopForm").innerHTML = r.html;
		}
	}
	
	function forgotUserNameEmail (strObjID) {
		turnOffForgotButtons ("OFF");
		document.getElementById("imgBottomWaitGif").style.visibility = "visible";
		document.getElementById("tdForgotBottomMsg").innerHTML = "";
		
		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";
		if (r.blnerror == "true") {
			document.getElementById("tdForgotBottomMsg").innerHTML = r.html;
		}
		else {
			document.getElementById("tdBottomForm").innerHTML = r.html;
		}
	}