
function name()
{
var nam = document.myforum.name.value;
myString = new String(nam)

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");
  document.myforum.name.focus();
  return false;
  }
  else
  document.myforum.name.focus();
  return true;
  }
  else
  {
  alert("Please enter Name");
  document.myforum.name.focus();
  return false; 
  }
}


function email()
{
var testresults;
var str=document.myforum.email.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");
document.myforum.email.focus();
testresults=false;
}
return (testresults);
}


function number()
{
var x=document.myforum.phno.value;
var anum=/(^\d+$)|(^\d+\.\d+$)/
if (anum.test(x))
testresult=true;
else
{
alert("Please enter phone number");
document.myforum.phno.focus();
testresult=false;
}
return (testresult);
}


function country1()
{
var cot = document.myforum.country.value;
if(cot=="Select")
{
alert("please Select Country");
document.myforum.country.focus();
return false;
}
else
return true;
}

//topic
function topic()
{
var cot = document.myforum.topic.value;
if(cot=="Select")
{
alert("please Select Topic");
document.myforum.topic.focus();
return false;
}
else
return true;
}

//comment
function comment(){
var cot = document.myforum.S1.value;
if(cot=="")
{
alert("please Enter Comment");
document.myforum.S1.focus();
return false;
}
else
return true;
}


function check() {
if(name() && email() && country1() && number() && topic() && comment())
return true;
else
return false;
}


