// JavaScript Document
function Form1_Validator(theForm)
{

	  if (theForm.txtUsername.value == "")
	  {
		alert("Please enter your Username.");
		theForm.txtUsername.focus();
		return (false);
	  }

	  if (theForm.txtPassword.value == "")
	  {
		alert("Please enter your password.");
		theForm.txtPassword.focus();
		return (false);
	  }
 
	  if (theForm.txtCPassword.value == "")
	  {
		alert("Please confirm your password.");
		theForm.txtCPassword.focus();
		return (false);
	  }
	  
	  if (theForm.txtEmail.value == "")
	  {
		alert("Please enter your email.");
		theForm.txtEmail.focus();
		return (false);
	  }

	  if (theForm.txtTitle.value == "")
	  {
		alert("Please enter your Title.");
		theForm.txtTitle.focus();
		return (false);
	  }

	  if (theForm.txtFirstName.value == "")
	  {
		alert("Please enter your Firstname.");
		theForm.txtFirstName.focus();
		return (false);
	  }

	  if (theForm.txtLastName.value == "")
	  {
		alert("Please enter your Lastname.");
		theForm.txtLastName.focus();
		return (false);
	  }

	  if (theForm.txtICNumber.value == "")
	  {
		alert("Please enter your IC Number.");
		theForm.txtICNumber.focus();
		return (false);
	  }

	  if (theForm.txtSpecialty.value == "")
	  {
		alert("Please enter your password.");
		theForm.txtSpecialty.focus();
		return (false);
	  }

	  if (theForm.txtClinic.value == "")
	  {
		alert("Please enter your Clinic/Hospital.");
		theForm.txtClinic.focus();
		return (false);
	  }

	  if (theForm.txtAddress.value == "")
	  {
		alert("Please enter your Address.");
		theForm.txtAddress.focus();
		return (false);
	  }
}
function Feedback_Validator(theForm)
{

	  if (theForm.txtTitle.value == "")
	  {
		alert("Please enter your Title.");
		theForm.txtTitle.focus();
		return (false);
	  }

	  if (theForm.txtFirstName.value == "")
	  {
		alert("Please enter your Firstname.");
		theForm.txtFirstName.focus();
		return (false);
	  }

	  if (theForm.txtMiddleName.value == "")
	  {
		alert("Please enter your Middle Name.");
		theForm.txtMiddleName.focus();
		return (false);
	  }

	  if (theForm.txtLastName.value == "")
	  {
		alert("Please enter your Lastname.");
		theForm.txtLastName.focus();
		return (false);
	  }

	  if (theForm.radGender[0].checked==false && theForm.radGender[1].checked==false)
	  {
		alert("Please select your gender.");
		theForm.radGender[0].focus();
		return (false);
	  }

	if (theForm.txtBDay.value == "")
	  {
		alert("Please enter your birth date.");
		theForm.txtBDay.focus();
		return (false);
	  }

	if (theForm.txtNationality.value == "")
	  {
		alert("Please enter your Nationality.");
		theForm.txtNationality.focus();
		return (false);
	  }

	  if (theForm.txtClinic.value == "")
	  {
		alert("Please enter your Clinic/Hospital.");
		theForm.txtClinic.focus();
		return (false);
	  }

	  if (theForm.txtEmail.value == "")
	  {
		alert("Please enter your Email.");
		theForm.txtEmail.focus();
		return (false);
	  }

	  if (theForm.txtComment.value == "")
	  {
		alert("Please enter your Comment.");
		theForm.txtComment.focus();
		return (false);
	  }
	  /*if (theForm.txtAddress.value == "")
	  {
		alert("Please enter your Address.");
		theForm.txtAddress.focus();
		return (false);
	  }

	  if (theForm.txtCity.value == "")
	  {
		alert("Please enter your City.");
		theForm.txtCity.focus();
		return (false);
	  }

	  if (theForm.txtPostalCode.value == "")
	  {
		alert("Please enter your Clinic/Hospital.");
		theForm.txtPostalCode.focus();
		return (false);
	  }*/

}

function ComparePassword()
{
	var pword1 = document.formSubmit.txtPassword.value;
	var pword2 = document.formSubmit.txtCPassword.value;
	if(pword1 != pword2)
	{
		alert("Password mismatch.");
		document.formSubmit.txtCPassword.focus();
		return false;
	}
}
function checkmmc(x) {
	if(x.value.length > 6){
	alert("Invalid MMC Number");
	x.focus();
	return (false);
	}
	
	if(x.value.length < 6) {
	alert("Invalid MMC number");
	x.focus();
	return(false);
	}
}
	
function isEmail(t) {
	if (t.value!="" )
		{
		if(t.value.indexOf('@',0)==0) 
		{ 
		 alert("Invalid email address");
		t.value="";
		t.focus();}
		else
		if(t.value.indexOf('@',0) == -1)
			{ alert("Invalid email address");
		t.value="";
		t.focus();}
	   else 
	   if (t.value.indexOf("@") >= t.value.lastIndexOf("."))
		 { alert("Invalid email address");
		t.value="";
		t.focus();}
	   else
	   if (t.value.length == (t.value.lastIndexOf(".") + 1))
		  {alert("Invalid email address");
		t.value="";
		t.focus();}
		 }
}