// JavaScript Document
function Trim(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
} //function Trim(sInString)

function GoValidateRegistration()
{
	msg1 = 'Please enter your name!';
	msg2 = 'Please enter your phone number!';
	msg3 = 'Please enter your e-mail address!';
	msg4 = 'Please enter a valid e-mail address!';
	msg5 = 'Please enter a user name!';
	msg6 = 'Please enter your password!';
	msg7 = 'Please re-enter your password!';
	msg8 = 'Please make sure both passwords are the same!';
	    
	Name = document.frmMain.txtname;
	phone_no = document.frmMain.txtphone;
	mobile_no = document.frmMain.txtmobile;
	email_address = document.frmMain.txtemail;
	user_name = document.frmMain.txtusername;
	pass_word1 = document.frmMain.txtpassword;
	pass_word2 = document.frmMain.txtpassword2;
		
	if (Trim(Name.value) == "")
	{
		alert(msg1);
		Name.focus();
		return false;
	}
	
	if (Trim(phone_no.value) == "")
	{
		alert(msg2);
		phone_no.focus();
		return false;
	}
	if (Trim(email_address.value) == "")
	{
		alert(msg3);
		email_address.focus();
		return false;
	}
	if (email_address.value.indexOf('@') == -1 || email_address.value.indexOf('.') == -1)
	{
		alert(msg4);
		email_address.focus();
		return false;
	}
	
	if (Trim(user_name.value) == "")
	{
		alert(msg5);
		user_name.focus();
		return false;
	}
	if (Trim(pass_word1.value) == "")
	{
		alert(msg6);
		pass_word1.focus();
		return false;
	}
	if (Trim(pass_word2.value) == "")
	{
		alert(msg7);
		pass_word2.focus();
		return false;
	}
	if (pass_word1.value != pass_word2.value)
	{
		alert(msg8);
		pass_word2.focus();
		pass_word2.select();
		return false;
	}
	
} // function GoValidateRegistration()

function GoValidateForm()
{
	msg1 = 'Please enter your name!';
	msg2 = 'Please enter your phone number!';
	msg3 = 'Please enter your e-mail address!';
	msg4 = 'Please enter a valid e-mail address!';
	msg5 = 'Please enter a user name!';
	msg6 = 'Please enter your password!';
	    
	Name = document.frmMain.txtname;
	phone_no = document.frmMain.txtphone;
	mobile_no = document.frmMain.txtmobile;
	email_address = document.frmMain.txtemail;
	user_name = document.frmMain.txtusername;
	pass_word1 = document.frmMain.txtpassword;
	
		
	if (Trim(Name.value) == "")
	{
		alert(msg1);
		Name.focus();
		return false;
	}
	
	if (Trim(phone_no.value) == "")
	{
		alert(msg2);
		phone_no.focus();
		return false;
	}
	if (Trim(email_address.value) == "")
	{
		alert(msg3);
		email_address.focus();
		return false;
	}
	if (email_address.value.indexOf('@') == -1 || email_address.value.indexOf('.') == -1)
	{
		alert(msg4);
		email_address.focus();
		return false;
	}
	
	if (Trim(user_name.value) == "")
	{
		alert(msg5);
		user_name.focus();
		return false;
	}
	if (Trim(pass_word1.value) == "")
	{
		alert(msg6);
		pass_word1.focus();
		return false;
	}

} // function GoValidateForm()
