function Trm(strr)
{
	var trimStr	= strr.replace(/(^\s*)|(\s*$)/g,"");
	return trimStr;
}

function TestEmail(email)
{
	var tag		= 0;
	var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
	var chkFlag = pattern.test(email);
	if(chkFlag)
	{
		tag = 1;
	}
	return tag;

}

function TestPassword(Password,ConfirmePassword){
  var tag   =  0;
  if(Password == ConfirmePassword){
       tag  = 1;
  }
  return tag;
}

function checkForm(){
	var cell	     = document.getElementById("prompt");

	var firstname    = document.getElementById("firstName").value;
	var trmfirstname = Trm(firstname);
	var lastname     = document.getElementById("lastName").value;
	var trmlastname  = Trm(lastname);

	var phone       = document.getElementById("phone").value;
	var trmphone    = Trm(phone);

	var email       = document.getElementById("email").value;
	var trmemail    = Trm(email);
	var emailtag    = TestEmail(email);

	if(trmfirstname.length == 0){

	  cell.innerHTML ="Please enter your first name.";
	  cell.focus();
	  return false;
	}
	if(trmlastname.length == 0){

		cell.innerHTML ="Please enter your last name.";
		cell.focus();
		return false;
	}
	if(trmphone.length == 0){

		cell.innerHTML = "Please enter your phone number.";
		cell.focus();
		return false;
	}
	if(trmemail.length == 0){

		cell.innerHTML ="please enter your e-mail address.";
		cell.focus();
		return false;
	}
	if(emailtag != 1){
		cell.innerHTML ="Please enter a correct e-mail address.";
		cell.focus();
		return false;
	}
}