	
	function doLogin()
	{
		var loginForm;
		if(loginForm = document.getElementById("loginForm"))
		{
			loginForm.jsenabled.value = "1";

			var sID, sPassword;
			sID = loginForm.Login.value;
			sPassword = loginForm.Password.value;
			if ((sID == "") && (sPassword == ""))
			{
				alert('Please enter a User ID and a Password.');
				loginForm.Login.focus();
				return false;
			}
			else if (sID == "")
			{
				alert('Please enter a User ID.');
				loginForm.Login.focus();
				return false;
			}
			else if (sPassword == "")
			{
				alert('Please enter a Password.');
				loginForm.Password.focus();
				return false;
			}
		}
		return true;
	}


	
	function doAccessCheck(SSNRequired,DOBRequired)
	{
		var accessForm;
		if(accessForm = document.getElementById("accessForm"))
		{
			accessForm.jsenabled.value = "1";

			var sAccessCode, sSSN, sDOB;
			var objAccessCode, lenCode;

			objAccessCode = accessForm.code;
			sAccessCode = "";
			sDOB="";
			lenCode = 0;
			lenCode = objAccessCode.length;

			if (lenCode)
			{
				for (var i=0; i < lenCode;i++)
				{
				  sAccessCode = sAccessCode + objAccessCode[i].value;
				}

			}
			else
			{
			  	sAccessCode = objAccessCode.value;
			}

			if ((accessForm.dob))
			{
			  sDOB = getObjectValue(accessForm.dob); 
			}
			else
			{
				sDOB = "***";  
			}

			if ((accessForm.ssn))
			{
			  sSSN = getObjectValue(accessForm.ssn); 
			}
			else
			{
				sSSN = "***";  
			}

			
			if (sAccessCode == "")
			{
				alert('Please enter your Access Code.');
				if (lenCode) accessForm.code[0].focus();
				else accessForm.code.focus();
				return false;
			}
			if (DOBRequired && ( sDOB== ""))
			{
				alert('Please enter your date of birth.');
				if (accessForm.dob[0]) accessForm.dob[0].focus();
				else accessForm.dob.focus();
				return false;
			}
			if (SSNRequired && (sSSN== ""))
			{
				alert('Please enter your social security number.');
				if (accessForm.ssn[0]) accessForm.ssn[0].focus();
				else accessForm.ssn.focus();
				return false;
			}
		}
		return true;
	}

	
	function doHintCheck(SSNRequired,DOBRequired)
	{
		var hintForm;
		if(hintForm = document.getElementById("hintForm"))
		{
			var sUserID, sSSN, sDOB;
			sUserID = hintForm.userID.value;
			sSSN = getObjectValue(hintForm.ssn);
			sDOB = getObjectValue(hintForm.dob);
				if (sUserID == ""){
				if (SSNRequired && (sSSN== "")){
					if (DOBRequired && ( sDOB== "")){
						alert('Please enter your ID, social security number and date of birth.');
					}else{
						alert('Please enter your ID and social security number.');
					}
				}
				else if (DOBRequired && ( sDOB== "")){
					alert('Please enter your ID and date of birth.');
				}
				else{
					alert('Please enter a User ID.');
				}
				hintForm.userID.focus();
				return false;
			}
			else if (SSNRequired && (sSSN== "")){
				if (DOBRequired && ( sDOB== "")){
					alert('Please enter your social security number and date of birth.');
				}else{
					alert('Please enter your social security number.');
				}
				if (hintForm.ssn[0]) {
					hintForm.ssn[0].focus();
			    }
			    else {
				    hintForm.ssn.focus();
				}
				return false;
			}
			else if (DOBRequired && ( sDOB== "")){
				alert('Please enter your date of birth.');
				if (hintForm.dob[0]){
				  hintForm.dob[0].focus();
			    }
			    else{
				  hintForm.dob.focus();
				}
				return false;
			}
		}
		return true;
	}


	
	function doRecoveryCheck(SSNRequired,DOBRequired,MRNRequired,ZIPRequired)
	{
		var recoveryForm;
		if(recoveryForm = document.getElementById("recoveryForm"))
		{
			var sFName, sLName, sSSN, sDOB, sMRN, sZIP;
			sFName = getObjectValue(recoveryForm.firstname);
			sLName = getObjectValue(recoveryForm.lastname);
			sSSN = getObjectValue(recoveryForm.ssn);
			sMRN = getObjectValue(recoveryForm.mrn);
			sDOB = getObjectValue(recoveryForm.dob);			
			sZIP = getObjectValue(recoveryForm.zip);
			if (sFName == "")
			{
				alert('Please enter your first name.');
				recoveryForm.firstname.focus();
				return false;
			}
			else if (sLName == "")
			{
				alert('Please enter your last name.');
				recoveryForm.lastname.focus();
				return false;
			}
			else if (DOBRequired && (sDOB == ""))
			{
				alert('Please enter your date of birth.');
				if (recoveryForm.dob[0])
				{
					recoveryForm.dob[0].focus();
				}
				else
				{
					recoveryForm.dob.focus();
				}
				return false;
			}
			else if (ZIPRequired && (sZIP == ""))
			{
				alert('Please enter your ZIP code.');
				recoveryForm.zip.focus();
				return false;
			}
			else if (SSNRequired && (sSSN == ""))
			{
				alert('Please enter your social security number.');
				if (recoveryForm.ssn[0])
				{
					recoveryForm.ssn[0].focus();
				}
				else
				{
					recoveryForm.ssn.focus();
				}				
				return false;
			}
			else if (MRNRequired && (sMRN == ""))
			{
				alert('Please enter your MRN.');
				if (recoveryForm.mrn[0])
				{
					recoveryForm.mrn[0].focus();
				}
				else
				{
					recoveryForm.mrn.focus();
				}
				return false;
			}

		}
		return true;
	}



	
	function accessCheckBodyLoad()
	{
		
		var fn = document.body.getAttribute('onload').toString();
		if (fn.indexOf('dataTileLoad') == -1)
		{
			breakOut();
		}

		var accessForm, signupForm, notifyForm;

		if (accessForm = document.getElementById("accessForm"))
		{
			var sAccessCode, sSSN, sDOB;

			sAccessCode = getObjectValue(accessForm.code);
			sSSN = getObjectValue(accessForm.ssn);
			sDOB = getObjectValue(accessForm.dob);

			if (((sAccessCode=="")&&(sSSN==""))&&(sDOB=="")){
				if (accessForm.code[0]){
	    				accessForm.code[0].focus();
	    			}
				else {
					accessForm.code.focus();
				}
			}

		}
   		else if (signupForm = document.getElementById("signupForm"))
		{
			var isTextEntered;

			isTextEntered = false;

			if (signupForm.pwdQuestion)
			{
				if ((signupForm.pwdQuestion.value != '') || (signupForm.pwdAnswer.value != ''))
				{
					isTextEntered = true;
				}
			}

			if (signupForm.hint)
			{
				if (signupForm.hint.value != '')
				{
					isTextEntered = true;
				}
			}

			   if (signupForm.Login)
			   {
				if ((!isTextEntered) && (signupForm.Login.value == '') && (signupForm.Password.value == '') && (signupForm.Retype.value == '')) 
				{
				    signupForm.Login.focus();
				}
			   }
			   else if (signupForm.Password)
		           {
		           	if ((!isTextEntered) && (signupForm.Password.value == '') && (signupForm.Retype.value == ''))  
		           	{
					
					signupForm.Password.focus();
				}
			   }
		}
		else if (notifyForm = document.getElementById("notifyForm"))
		{
			var sEmail, sRetype

			sEmail = getObjectValue(notifyForm.email);
			sRetype = getObjectValue(notifyForm.Retype);

			if ((sEmail=="")&&(sRetype==""))
			{
				notifyForm.email.focus();
			}
		}
		return true;
	}


	
	function loginBodyLoad()  {
		
		var fn = document.body.getAttribute('onload').toString();
		if (fn.indexOf('dataTileLoad') == -1)
		{
			breakOut();
		}

		var loginForm;

		if (loginForm = document.getElementById("loginForm")){
		  if ((loginForm.Login.value == '') && (loginForm.Password.value == '')) 
		  {
		     loginForm.Login.focus();
		  }
		}
		return true;
	}

	
	function doProxySignupCheck()
	{
		return true;
	}



	
	function checkUserId() {
		var signupForm;
		if(signupForm = document.getElementById("signupForm"))
		{
			var sID, sPassword, sRetype;

			for (var i in signupForm){

				if (i == "Login"){
					sID = signupForm.Login.value;
					if (sID == ""){
						alert("Please enter a User ID.");
						signupForm.Login.focus();
						return false;
					}
					if (containsPunctuation(sID)){
						alert('Your User ID cannot contain any spaces or punctuation other than \".\",\"_\" or \"@\".');
						signupForm.Login.focus();
						return false;
					}
			  }

				if (i == "Password"){
					sPassword = signupForm.Password.value;
					if (sPassword == ""){
						alert('Please enter a Password.');
						signupForm.Password.focus();
						return false;
					}
					if (containsSpace(sPassword)){
						alert("Your password cannot contain any spaces.");
						signupForm.Password.focus();
						return false;
					}
				}

				if (i == "Retype")   sRetype = signupForm.Retype.value;
			}


			if (sPassword != sRetype) {
				alert("Your password and the retyped password are not the same.");
				signupForm.Retype.focus();
				return false;
			}
		}
		return true;
	}


	
	function checkNotify()
	{
		var notifyForm;
		if(notifyForm = document.getElementById("notifyForm"))
		{
			var sEmail, sRetype;

			if(!notifyForm.send.value)
			{
				if(notifyForm.send[1].checked)
				{
					return true;	
				}
				else if(!notifyForm.send[0].checked)
				{
					alert("Please select Yes or No.");
					return false;	
				}
			}
			

			sEmail = notifyForm.email.value;
			if (sEmail == "")
			{
				alert("Please enter an e-mail address.");
				notifyForm.email.focus();
				return false;
			}
			if (containsPunctuation(sEmail))
			{
				alert("Your e-mail address cannot contain any spaces or punctuation.");
				notifyForm.email.focus();
				return false;
			}
			if((sEmail.indexOf('@') <= 0) ||
			   (sEmail.substring(sEmail.indexOf('@') + 1).indexOf('.') < 0) ||
			   (sEmail.substring(sEmail.length - 1) == "."))
			{
				alert("Please enter a valid e-mail address.");
				notifyForm.email.focus();
				return false;
			}

			sRetype = notifyForm.Retype.value;
			if (sEmail != sRetype)
			{
				alert('Your e-mail and the retyped e-mail are not the same.');
				notifyForm.Retype.focus();
				return false;
			}
		}
		return true;
	}

	
	

	function checkPassword(formObj){
		var sNewPasswd,sVerPasswd

		sNewPasswd = formObj.newpasswd.value;
		if (containsSpace(sNewPasswd)) {
		 alert("Your new password cannot contain any spaces.");
		 formObj.newpasswd.focus();
		 return false;
		}

		sVerPasswd = formObj.verifypasswd.value;
		if (sNewPasswd != sVerPasswd) {
			alert("_STR_ReTypeNewPasswordError_");
			formObj.verifypasswd.focus();
			return false;
	  }

		return true;
 }

