var url = 'captcheck.asp?code='; 



var captchaOK = 2; 

// 2 - not yet checked, 1 - correct, 0 - failed 

function getHTTPObject()

 {

  try

   { 

   req = new XMLHttpRequest();

    }

	 catch (err1)

	  {

	   try

	    {

		 req = new ActiveXObject("Msxml12.XMLHTTP");

		  } 

		  catch (err2) 

		  { 

		  try

		   { 

		   req = new ActiveXObject("Microsoft.XMLHTTP"); 

		   }

		    catch (err3) 

			{ 

			req = false;

			 } 

			 } 

			 }

			  return req;

			   } 

			   var http = getHTTPObject(); 

// We create the HTTP Object 

function handleHttpResponse() 

{

 if (http.readyState == 4) 

 { 

 //alert(http.responseText);

// return false;

 captchaOK = http.responseText; 

 

 if(captchaOK != 1) 

 {

  alert('The entered code was not correct. Please try again');

   document.frm.code.value=''; document.frm.code.focus(); 

   return false; 

   }

    document.frm.submit(); 

	}

	 }

		function checkcode(thecode)

		{ 

		

		http.open("GET", url + escape(thecode), true); 

		//alert(url + escape(thecode));

		//return false;

		//alert(handleHttpResponse);

		http.onreadystatechange = handleHttpResponse;

		http.send(null); 

		}



function checkform(frm)

{			

		v1=frm.Name

		if(isblank(v1)==false) 

	 		{

			alert("Name cannot be blank.");

			v1.focus(); 

			return false;

			}	
			
			
			
			
			v1=frm.email

		if(isblank(v1)==false) 

			{

			alert("E-mail cannot be blank.");

			v1.focus(); 

			return false

			}

		if(isemail(v1)==false) 

			{

			alert("The email \""+ v1.value+" \"is not valid email");

			v1.focus(); 

			return false;

			}
			
			
			v1=frm.DC2
		if(isblank(v1)=="") 
	 		{
			alert("Country code cannot be blank.");
			v1.focus(); 
			return false;
			}
			
			if(isblank(v1)!="")
 			{
			if (isNaN(frm.DC2.value)==true)
			{
			alert("Please enter numerics value for country code!");
			frm.DC2.value=""
			frm.DC2.focus();
			return false;
			}
}	
v1=frm.DC3
		if(isblank(v1)=="") 
	 		{
			alert("Area code cannot be blank.");
			v1.focus(); 
			return false;
			}
			
			if(isblank(v1)!="")
 			{
			if (isNaN(frm.DC3.value)==true)
			{
			alert("Please enter numerics value for area code!");
			frm.DC3.value=""
			frm.DC3.focus();
			return false;
			}
}

v1=frm.DC
		if(isblank(v1)=="") 
	 		{
			alert("Daytime contact cannot be blank.");
			v1.focus(); 
			return false;
			}
			
			if(isblank(v1)!="")
 			{
			if (isNaN(frm.DC.value)==true)
			{
			alert("Please enter numerics value for date!");
			frm.DC.value=""
			frm.DC.focus();
			return false;
			}
}
			
			
			v1=frm.address1

		if(isblank(v1)==false) 

	 		{

			alert("Address cannot be blank.");

			v1.focus(); 

			return false;

			}
				v1=frm.TourName

		if(isblank(v1)==false) 

	 		{

			alert("Tour name cannot be blank.");

			v1.focus(); 

			return false;

			}
			
			v1=frm.fname

		if(isblank(v1)==false) 

	 		{

			alert("First name cannot be blank.");

			v1.focus(); 

			return false;

			}
			
			v1=frm.sname

		if(isblank(v1)==false) 

	 		{

			alert("Surname cannot be blank.");

			v1.focus(); 

			return false;

			}
			
			v1=frm.dob1

		if(isblank(v1)==false) 

	 		{

			alert("Date of birth cannot be blank.");

			v1.focus(); 

			return false;

			}	
			
			
			v1=frm.ArrivalDate

		if(isblank(v1)==false) 

	 		{

			alert("Arrival date cannot be blank.");

			v1.focus(); 

			return false;

			}	
			
					

v1=frm.Duration
		if(isblank(v1)=="") 
	 		{
			alert("Duration of stay Can not be Blank.");
			v1.focus(); 
			return false;
			}
			
			if(isblank(v1)!="")
 			{
			if (isNaN(frm.Duration.value)==true)
			{
			alert("Please enter numerics value for Year!");
			frm.Duration.value=""
			frm.Duration.focus();
			return false;
			}
}	
			



			v1=frm.code

		if(isblank(v1)==false) 

			{

			alert("You must enter verification code");

			v1.value=''; 

			v1.focus(); 

			return false

			}

			checkcode(document.frm.code.value); 

return false;

}



function isblank(s3) 

{

	if (s3.value == "") 

	{

	return false;

	}

else 

	{

	return true;

   }

}







function isemail(s2) 
{
	if(s2.value!='')
    {
        if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(s2.value))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
	/*if ((s2.value == "" || s2.value.indexOf('@', 0) == -1) || s2.value.indexOf('.')<5){
	return false;
	}else{
	return true;
   	}*/
}
