function checkfield(loginform)
{
	ok=true
	var text=""
  	if ((loginform.name.value=="") || (!validateAlpha(loginform.name.value))) 
	{
		text  += "\n Please Enter Your Name.(Alphabets and Space Only)"
		ok=false
	}
	
	if(loginform.countrycode.value=="")
	{
		text += "\n Please Enter Country Code.(Numeric Only)"
		ok=false
	}
	if(loginform.areacode.value=="")
	{
		text += "\n Please Enter Area Code.(Numeric Only)"
		ok=false
	}
	if(loginform.phone.value=="")
	{
		text += "\n Please Enter Phone Number.(Numeric Only)"
		ok=false
	}
	if (loginform.address.value == "")
	{
		text += "\n Please specify your address."
		ok=false
	}
	if(loginform.country.value=="")
	{
		text += "\n Please Enter Country Name."
		ok=false
	}
	if (loginform.email.value == "" || (!isEmailAddr(loginform.email.value)))
	{
		text += "\n Please enter a valid value for the email field."
		ok=false
	}
	if (!(loginform.date_of_travel[0].checked) && !(loginform.date_of_travel[1].checked))
	{
		text += "\n Please select tentative date of travel."
		ok=false
	}
	if (loginform.hotel_category.value == "")
	{
		text += "\n Please specify hotel category."
		ok=false
	}
	if (loginform.specific_requirements.value == "")
	{
		text += "\n Please specify your requirements."
		ok=false
	}
	else if(!isInvalid(loginform.specific_requirements.value))
	{
		text += "\n Invalid Characters in requirements."
		ok=false
	}
	if (loginform.verif_box.value == "")
	{
		text += "\n Please enter verification code."
		ok=false
	}
	if(text!="")
	{
		alert(text)
	}
	return ok
	//return false
}

function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
	var pindex = theStr.indexOf(".",index);
	if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function isInvalid(text)
{
	//x=loginform.specific_requirements.value;
	y=text.search(/<a/i);
	y1=text.search(/href=/i);
	y2=text.search(/viagra/i);
	y3=text.search(/sex/i);
	y4=text.search(/porn/i);
	if((y!="-1") || (y1!="-1") || (y2!="-1") || (y3!="-1") || (y4!="-1"))
	{
		return false;
	}
	else
	{
		return true;
	}
}
	function ValidateNum(input,event){
		var keyCode = event.which ? event.which : event.keyCode;
		if(parseInt(keyCode)>=48 && parseInt(keyCode)<=57){
			return true;
		}
		return false;
	}

function CharName(input,event)
{
var keyCode = event.which ? event.which : event.keyCode;

	if((parseInt(keyCode)>=65 && parseInt(keyCode)<=90) || (parseInt(keyCode)>=97 && parseInt(keyCode)<=122) || parseInt(keyCode)==32)
	{
		return true;
			}
			return false;
		}

function validateAlpha ( text ) 
{
   for ( c=0; c < text.length; c ++ )
   {
      alpha = ( text.charCodeAt ( c ) >= 65 && text.charCodeAt ( c ) <=90 ) || ( text.charCodeAt ( c ) >= 97 && text.charCodeAt ( c ) <=122 )
      if (!alpha) 
	  {
         return false;
	  }
	  else
	  {
         return true;
	  }
	}
}
