

//email

var testresults

function checkemail(){

var str=document.frmContact.txtEmail.value

var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

if (filter.test(str))

testresults=true

else{

alert("Please enter a valid email address")

testresults=false

}

return (testresults)

}

// phone

function checknumber(){

var str = document.frmContact.txtPhone.value;
  if (str == "")
  {
  alert('Please enter phone number');return false;
  }
  else
  {
  return true;
  }
}




//firstname

function firstname(){

var str = document.frmContact.txtName.value;

myString = new String(str)



var i = 0

var whiteCount = 0



if(myString.length >0)

{

 for( i=0 ; i<myString.length ; i++)

 {

 	if((myString.charCodeAt(i) >= 65  && myString.charCodeAt(i) <= 90 ) || ( myString.charCodeAt(i) >= 97  && myString.charCodeAt(i) <= 122 ))

	 {

	 



	 }

	 else if(myString.charCodeAt(i) == 32)

	 {

	 whiteCount++

	 }

 	 else

 	 {

 	  alert("Please enter name");

	  return false;

  	 }

  }

  if(whiteCount == myString.length)

  {

  alert("Please enter name");

  return false;

  }

  else

  return true;

 }else

 {alert("Please enter name");

	  return false; }

}






function frmContact_onsubmit() {

if(firstname() &&  checknumber() && checkemail())



return true;

else

return false;

}




