function fnValidateRegister(theForm){

	if (trim(theForm.txtPassword.value)!="" || trim(theForm.txtCPassword.value)!="") {
	  if (trim(theForm.txtPassword.value)=="") {
		alert("Password cannot be blank");
		theForm.txtPassword.focus();
		return false;
	  }

	  if (trim(theForm.txtCPassword.value)=="") {
		alert("Confirm Password cannot be blank");
		theForm.txtCPassword.focus();
		return false;
	  }

	  if (theForm.txtPassword.value!=theForm.txtCPassword.value) {
		alert("Password & Confirm password does not match");
		theForm.txtCPassword.focus();
		return false;
	  }
	}

	  if (trim(theForm.txtEmailId.value)=="" || !isEmail(trim(theForm.txtEmailId.value))) {
		alert("Email Id cannot be blank or Invalid Email address");
		theForm.txtEmailId.focus();
		return false;
	  }

	  if (trim(theForm.txtCEmailId.value)=="") {
		alert("Confirm Email Id cannot be blank");
		theForm.txtCEmailId.focus();
		return false;
	  }

	  if (theForm.txtEmailId.value!=theForm.txtCEmailId.value) {
		alert("Email & confirm E-mail Id does not match");
		theForm.txtEmailId.focus();
		return false;
	  }

	
	if (trim(theForm.txtName.value)=="") {
		alert("Accessor Name cannot be blank");
		theForm.txtName.focus();
		return false;
	}

	return true;
}

function fnValidateVisit(theForm){
  if (trim(theForm.txtPassword.value)=="") {
	alert("Password cannot be blank");
	theForm.txtPassword.focus();
	return false;
  }

  if (trim(theForm.txtPassword.value).length<5) {
	alert("Password must be atleast 5 characters");
	theForm.txtPassword.focus();
	return false;
  }

  if (trim(theForm.txtCPassword.value)=="") {
	alert("Confirm Password cannot be blank");
	theForm.txtCPassword.focus();
	return false;
  }

  if (theForm.txtPassword.value!=theForm.txtCPassword.value) {
	alert("Password & Confirm password does not match");
	theForm.txtCPassword.focus();
	return false;
  }
}
function fnValidateLogin(theForm){

	if (trim(theForm.txtUserId.value)=="") {
		alert("User Id cannot be blank");
		theForm.txtUserId.focus();
		return false;
	}

	if (trim(theForm.txtPassword.value)=="") {
		alert("Password cannot be blank");
		theForm.txtPassword.focus();
		return false;
	}

	return true;
}

function fnValidateFP(theForm){

	if (trim(theForm.user.value)=="") {
		alert("Username cannot be blank");
		theForm.user.focus();
		return false;
	}
	return true;
}
