function RegStatus(NewStatus)
	{
		if (parseInt(NewStatus) == 1)
			{
				// Hide // 
				document.getElementById('UNRow').style.display = 'none';
				document.getElementById('PWCRow').style.display = document.getElementById('UNRow').style.display
				document.getElementById('InfoRow').style.display = document.getElementById('UNRow').style.display
				document.getElementById('RefRow').style.display = document.getElementById('UNRow').style.display
			}
		else
			{
				// Show
				document.getElementById('UNRow').style.display = 'block';
				document.getElementById('PWCRow').style.display = ''
				document.getElementById('InfoRow').style.display = ''
				document.getElementById('RefRow').style.display = document.getElementById('UNRow').style.display

			}				
		document.frmMain.UserType.value = NewStatus;
	}
	
function CheckAndSubmitForm()
	{
		var sErrorText = ''; 

		if (!IsCompleted(document.frmMain.txtClientEmail)) 
			{ sErrorText += 'Your e-mail address is a required field.\n'; }
		else
			{
				// Simple e-mail checks //
				if ((document.frmMain.txtClientEmail.value.indexOf('@') == -1) || (document.frmMain.txtClientEmail.value.indexOf('.') == -1)) 
					{
						sErrorText += 'Invalid e-mail address.\n';
					}
			}
	
		if (!IsCompleted(document.frmMain.txtPwdMain)) { sErrorText += 'Your password is a required field.\n'; }

		if (document.frmMain.optRegStatus[0].checked == true)
			{
				// New user
				if (!IsCompleted(document.frmMain.txtClientName)) { sErrorText += 'Your name is a required field.\n'; }
				if (!IsCompleted(document.frmMain.txtPwdConfirm)) { sErrorText += 'Password confirmation is a required field.\n'; }
				
				if (sErrorText == '')
					{
						if (document.frmMain.txtPwdMain.value != document.frmMain.txtPwdConfirm.value)
							{
								sErrorText += 'Your password does not match the password confirmation.\n'; 
							}
					}
			}

		if (sErrorText != '')
			{
				alert(sErrorText);
				return false;
			}
		else
			{
				if (document.frmMain.optRegStatus[0].checked == true) { document.frmMain.UserType.value = 0 } else { document.frmMain.UserType.value = 1; }
				
				document.frmMain.sPageAction.value = 'LoginUser';
				document.frmMain.submit();						
			}
	}

