<!--	
	var recoverPwdURL = "content/xmlhttprequest/processforgotpwd.jsp";
	var loginURL = "content/xmlhttprequest/processlogin.jsp";
	var securityImgURL = "";
	
	
	function toggleSectionView(sectionToShow, sectionToHide)
	{
		var showObj = document.getElementById(sectionToShow);
		var hideObj = document.getElementById(sectionToHide);
		showObj.style.display='block';
		hideObj.style.display='none';
		var statusbarObj = document.getElementById("statusbar");
		statusbarObj.innerHTML = '&nbsp;'
	}
	
	function positionToolTip()
	{
		var target = document.getElementById("ajax_tooltipObj");
		ajax_tooltipObj.style.left = ajax_tooltipObj.offsetLeft - (ajax_tooltipObj.offsetWidth /2);
	}
	
	function processForgotPwd()
	{
	 if (statreq.readyState == 4)
   {
		if (statreq.status == 200)
		{
			loadBgColor ('testresults', false, document.teststatistics);
			div = document.getElementById("testresults");
			div.innerHTML = "";
			div.innerHTML = statreq.responseText;
		}
    else
    {
      alert("There was a problem retrieving ConsumerPoint usage statistics:\n" + statreq.statusText);
    }
   }   
	}
	
	function validateLogin()
	{
		showErrorMsg("&nbsp;");
		if("" == document.loginfrm.userid.value)
		{
			showErrorMsg('*&nbsp;Please enter the user id.')
			document.loginfrm.userid.focus();
			return;
		}
		else if("" == document.loginfrm.password.value)
		{
			showErrorMsg('*&nbsp;Please enter the password.')
			document.loginfrm.password.focus();
			return;
		}
		else if(null != document.loginfrm.code && "" == document.loginfrm.code.value)
		{
			showErrorMsg('*&nbsp;Please enter the security code.');
			document.loginfrm.code.focus();
			return;
		}
		else
		{
			if(null != document.loginfrm.login)
				document.loginfrm.login.disabled = true;
			tryLogin();
		}
	}

	var isprepay = false;
	
	function acceptTerms()
	{
		if(!document.loginfrm.termsconditions.checked)
		{
			var trmStatusBar = document.getElementById("termsstatusbar");
			trmStatusBar.innerHTML = "*&nbsp;Please accept the terms and conditions.";
		}
		else
		{
			var url = loginURL;
			if(-1 != url.indexOf("?"))
				url += "&";
			else
				url += "?";
			url += "userid=" + document.loginfrm.userid.value;
			url += "&password=" + document.loginfrm.password.value;
			url += "&actiontoperform=checktermsacceptance";
			url += "&ms=" + new Date().getTime();
			url += "&termsconditions=1";
			if(isprepay) url += "&isprepay=1";
			loadXMLDocWithMessage(url,processLogin, 'loginstatus',"&nbsp;");
		}
	}
	
	function tryLogin()
	{
		isprepay = false;
		var  url = loginURL;
		if(-1 != url.indexOf("?"))
			url += "&";
		else
			url += "?";
		url += "userid=" + document.loginfrm.userid.value;
		url += "&password=" + document.loginfrm.password.value;
		if(null != document.loginfrm.code)
			url += "&captcharesponse=" + document.loginfrm.code.value;
		url += "&captchaid=" + curCaptchaID;
		url += "&actiontoperform=login";
		url += "&ms=" + new Date().getTime();
		var firstJessionIDIndex = document.cookie.indexOf("JSESSIONID");
		var lastJessionIDIndex = document.cookie.lastIndexOf("JSESSIONID");
		if(firstJessionIDIndex != -1 && lastJessionIDIndex != -1 && firstJessionIDIndex != lastJessionIDIndex){
			document.cookie = document.cookie.substring(firstJessionIDIndex,lastJessionIDIndex) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT;";
		}
		loadXMLDocWithMessage(url,processLogin, 'loginstatus',"&nbsp;");
	}
	
	var chngPwdSuccessURL;
	
	function processLogin()
	{
	 if (4 == req.readyState)
   {
		if (200 == req.status)
		{
			var responseval = req.responseXML;
			var status = responseval.getElementsByTagName("status")[0].firstChild.nodeValue;
			var msg = responseval.getElementsByTagName("msg")[0].firstChild.nodeValue;
			if("1" == status) 
				window.location = msg;
			else if(status == "2" || status == "3")
			{
				var termsSection = document.getElementById("termsSection");
				termsSection.style.display = "block";
				var loginSection = document.getElementById("loginSection");
				loginSection.style.display = "none";
				if(status == "3")	isprepay = true;
			}
			else if(status == "4" || status == "5")
			{
				var termsSection = document.getElementById("termsSection");
				termsSection.style.display = "none";
				var loginSection = document.getElementById("loginSection");
				loginSection.style.display = "none";
				var chngPwdSection = document.getElementById("chngPwdSection");
				chngPwdSection.style.display = "block";
				document.loginfrm.oldpassword.focus();
				if(status == "5")	isprepay = true;
			}
			else if(status == "6")
			{
				showErrorMsg("*&nbsp;" + msg, "chngpwdstatusbar");
				document.loginfrm.submitchngpwd.disabled = false;
			}
			else if(status == "7")
			{
				var chngPwdSection = document.getElementById("chngPwdSection");
				chngPwdSection.style.display = "none";
				var chngPwdMsgSection = document.getElementById("chngPwdMsgSection");
				chngPwdMsgSection.style.display = "block";
				chngPwdSuccessURL = msg;
			}
			else
			{
				if(null != document.loginfrm.code)
				{
					document.loginfrm.code.value = "";
					var captchaImg = document.getElementById('captchaimg');
					if(null != responseval.getElementsByTagName("codeurl")[0])	
						captchaImg.src= responseval.getElementsByTagName("codeurl")[0].firstChild.nodeValue 
					else
						captchaImg.src= securityImgURL + '&ms=' + new Date().getTime();
					curCaptchaID = captchaImg.src.substring(captchaImg.src.indexOf("captchaId=") + 10 );
					captchaImg.src = captchaImg.src + '&ms=' + new Date().getTime();
					
				}
				showErrorMsg("*&nbsp;" + msg);
				
			}
			if(null != document.loginfrm.login)
				document.loginfrm.login.disabled = false;
		}
    else
      alert("There was a problem:\n" + req.statusText);
   }   
	}
	
	var curCaptchaID = "";
	
	
	function setLoginURL(url)
	{
		loginURL = url;
	}
	
	function setSecurityImgURL(url)
	{
		securityImgURL = url;
		curCaptchaID = securityImgURL.substring(securityImgURL.indexOf("captchaId=") + 10 );
	}
	
	function checkTermsAcceptance()
	{
		var url = loginURL;
		if(-1 != url.indexOf("?"))
			url += "&";
		else
			url += "?";
		url += "userid=" + document.loginfrm.userid.value;
		url += "&actiontoperform=checktermsacceptance";
		url += "&ms=" + new Date().getTime();
		loadXMLDocWithMessage(url,processTrmsCondsAcceptance, 'loginstatus',"&nbsp;");
	}
	
	function processTrmsCondsAcceptance()
	{
	 if (4 == req.readyState)
   {
		if (200 == req.status)
		{
			div = document.getElementById("trmsconditionsrow");
			if(req.responseText == "0" )
			{
				div.style.display = 'block';
			}
			else
				div.style.display = 'none';
		}
   }   
	}
	
	function setRecoverPasswordURL(url)
	{
		recoverPwdURL = url;
	}
	
	function recoverPwd()
	{
		var url = recoverPwdURL;
		if("" != document.loginfrm.useridforpwd.value)
		{
			url += "?userid=" + document.loginfrm.useridforpwd.value;
			url += "&ms=" + new Date().getTime();
			var div = document.getElementById("statusbar");
			div.innerHTML = '&nbsp;';
			loadXMLDocWithMessage(url,processRecoverPwd, 'loginstatus',"&nbsp;");
		}
		else
		{
			var div = document.getElementById("statusbar");
			div.innerHTML = '<font style=\"color:red\">Please enter a user id.</font>';
			return;
		}	
	}
	
	function processRecoverPwd()
	{
	 if(4 == req.readyState)
   {
		if(200 == req.status)
		{
			var div = document.getElementById("statusbar");
			div.innerHTML = req.responseText;
		}
    else
    {
      alert("There was a problem retrieving password:\n" + req.statusText);
    }
   }   
	}
	
	function autoLogin(oEvent)
	{
		if(!oEvent) oEvent = window.event;
	  var charCode = (oEvent.which)?oEvent.which : oEvent.keyCode
	  if(13 == charCode)
	  {
			validateLogin();
			return false;
		}
		return true;
	}

	
	
	function showErrorMsg(sMsg, statusbarID)
	{
		var valStatusBar;
		if(!statusbarID)
			valStatusBar = document.getElementById("validationstatusbar");
		else
			valStatusBar = document.getElementById(statusbarID);
		valStatusBar.innerHTML = sMsg;
	}
	
	function validateCharacters(textToValidate,validChars)
	{
	  var allValid = true;
	  for(i = 0;  i < textToValidate.length;  i++)
		{
		  ch = textToValidate.charAt(i);
		  for (j = 0;  j < validChars.length;  j++)
		    if (ch == validChars.charAt(j)) break;
		  if (j == validChars.length)
		  {
		    allValid = false;
		    break;
		  }
		}
	  if(!allValid) return false;
		return true;
	}

	function autoPwdChange(oEvent)
	{
		if(!oEvent) oEvent = window.event;
	  var charCode = (oEvent.which)?oEvent.which : oEvent.keyCode
	  if(13 == charCode)
	  {
			changePassword();
			return false;
		}
		return true;
	}
	
	function changePassword()
	{
		showErrorMsg("&nbsp;", "chngpwdstatusbar");
		if("" == document.loginfrm.oldpassword.value)
		{
			showErrorMsg('*&nbsp;Please enter your existing password.',"chngpwdstatusbar")
			document.loginfrm.oldpassword.focus();
			return;
		}
		else if("" == document.loginfrm.newpassword.value)
		{
			showErrorMsg('*&nbsp;Please enter your new password.',"chngpwdstatusbar")
			document.loginfrm.newpassword.focus();
			return;
		}
		else if("" == document.loginfrm.newpassword2.value)
		{
			showErrorMsg('*&nbsp;Please confirm your new password.',"chngpwdstatusbar");
			document.loginfrm.newpassword2.focus();
			return;
		}
		else if (document.loginfrm.newpassword.value == document.loginfrm.oldpassword.value)
		{
			showErrorMsg('*&nbsp;Your new password cannot be the same as your existing password.',"chngpwdstatusbar");
			document.loginfrm.newpassword.focus();
			return;
		}
		else if (document.loginfrm.newpassword.value != document.loginfrm.newpassword2.value)
		{
			showErrorMsg('*&nbsp;Your new password confirmation does not match your new password.',"chngpwdstatusbar");
			document.loginfrm.newpassword2.focus();
			return;
		}
	  else if (document.loginfrm.newpassword.value.length < 2 || document.loginfrm.newpassword.value.length > 15)
		{
			showErrorMsg('*&nbsp;Your password must contain a minimum of 2 characters and can have a maximum of 15 characters.',"chngpwdstatusbar");
			document.loginfrm.newpassword.focus();
			return;
		}
		else
		{
			var validPwdChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-*_";
			if (!validateCharacters(document.loginfrm.newpassword.value,validPwdChars))
			{
				showErrorMsg('*&nbsp;Your new password should contain only letters, numbers and \"-*_\" characters.',"chngpwdstatusbar");
				document.loginfrm.newpassword.focus();
				return;
			}
			else
			{	
				if(null != document.loginfrm.submitchngpwd)
					document.loginfrm.submitchngpwd.disabled = true;
				tryPwdChange();
			}
			return;
		}
	}
	
	function continueChgPwd()
	{
		window.location = chngPwdSuccessURL;
	}
	
	function tryPwdChange()
	{
		isprepay = false;
		var  url = loginURL;
		if(-1 != url.indexOf("?"))
			url += "&";
		else
			url += "?";
		url += "userid=" + document.loginfrm.userid.value;
		url += "&password=" + document.loginfrm.password.value;
		url += "&oldpassword=" + document.loginfrm.oldpassword.value;
		url += "&newpassword=" + document.loginfrm.newpassword.value;
		url += "&newpassword2=" + document.loginfrm.newpassword2.value;
		url += "&actiontoperform=changepwd";
		if(isprepay) url += "&isprepay=1";
		url += "&ms=" + new Date().getTime();
		loadXMLDocWithMessage(url,processLogin, 'loginstatus',"&nbsp;");
	}
	
//-->


