
//name
function firstname()
{
var nam = document.myform.firstname.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 Firts Name");
	  return false;
  	 }
  }
  if(whiteCount == myString.length)
  {
  alert("Please enter Firts Name");
  document.myform.firstname.focus();
  return false;
  }
  else
  document.myform.firstname.focus();
  return true;
  }
  else
  {
  alert("Please enter Firts Name");
  document.myform.firstname.focus();
  return false; 
  }
}
//email
function checkemail()
{
var testresults;
var str=document.myform.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.myform.email.focus();
testresults=false;
}
return (testresults);
}

function country()
{
var cot = document.myform.country.value;
if(cot=="sac")
{
alert("please Select Country");
document.myform.country.focus();
return false;
}
else
return true;
}


function arrday()
{
var cot = document.myform.arrday.value;
if(cot=="Dt")
{
alert("please Select Arrival Date");
document.myform.arrday.focus();
return false;
}
else
return true;
}


function arrmonth()
{
var cot = document.myform.arrmonth.value;
if(cot=="Month")
{
alert("please Select Arrival Month");
document.myform.arrmonth.focus();
return false;
}
else
return true;
}

function arryear()
{
var cot = document.myform.arryear.value;
if(cot=="Year")
{
alert("please Select Year");
document.myform.arryear.focus();
return false;
}
else
return true;
}


function depday()
{
var cot = document.myform.depday.value;
if(cot=="Dt")
{
alert("please Select Departure Date");
document.myform.depday.focus();
return false;
}
else
return true;
}


function depmonth()
{
var cot = document.myform.depmonth.value;
if(cot=="Month")
{
alert("please Select Departure Month");
document.myform.depmonth.focus();
return false;
}
else
return true;
}

function depyear()
{
var cot = document.myform.depyear.value;
if(cot=="Year")
{
alert("please Select Year");
document.myform.depyear.focus();
return false;
}
else
return true;
}


function checknumber()
{
var x=document.myform.noofpeople.value;
var anum=/(^\d+$)|(^\d+\.\d+$)/
if (anum.test(x))
testresult=true;
else
{
alert("Please enter Valid Number of People");
document.myform.noofpeople.focus();
testresult=false;
}
return (testresult);
}

function treatreq()
{
var cot = document.myform.treatreq.value;
if(cot=="syn")
{
alert("Please Select if, treatment required needed");
document.myform.treatreq.focus();
return false;
}
else
return true;
}

function rates()
{
if(firstname() && checkemail() && country() && arrday() && arrmonth() && arryear() && depday() && depmonth() && depyear() && checknumber() && treatreq())
return true;
else
return false;
}
