function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="" || value==0)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 
function chkboxchked()
{
	for(i=1; i <= 7; i++)
	{
	 var cb = document.getElementById("Interests"+i);
	
	 if(cb.checked)
		 return true;
	}
	
	return false;
}
function isChecked(radioObj) {
	if(!radioObj)
		return -1;
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return 1;
		else
			return -1;
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return 1;
		}
	}
	return -1;
}
function emailvalidation(entered, alertbox)
{
with (entered)
{
apos=value.indexOf("@"); 
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
} 


function phonevalidation(entered, alertbox)
{
with (entered)
{
if (isNaN(value))
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 




function formvalidation(thisform)
{
		with (thisform)
		{
				if (emptyvalidation(fname,"Error ! Please type in your First Name !")==false) {fname.focus(); document.getElementById('fname').className='txtfieldstyle_enq error';return false;}
				if (emptyvalidation(nationality,"Error ! Please type in your Nationality !")==false) {nationality.focus(); document.getElementById('nationality').className='txtfieldstyle_enq error'; return false;}
				if (emptyvalidation(mailing_add,"Error ! Please type in your Mailing Address !")==false) {mailing_add.focus(); document.getElementById('mailing_add').className='txtfieldstyle_enq error'; return false;}
				if (emptyvalidation(country,"Error ! Please type in your Country !")==false) {country.focus(); document.getElementById('country').className='txtfieldstyle_enq error'; return false;}
				if (emptyvalidation(email_add,"Error ! Please type in your Email Address !")==false) {email_add.focus(); document.getElementById('email_add').className='txtfieldstyle_enq error'; return false;}
				if (emailvalidation(email_add,"Error ! Please provide with your valid Email Address !")==false) {email_add.focus(); document.getElementById('email_add').className='txtfieldstyle_enq error'; return false;}
				if (emailvalidation(fren_email,"Error ! Please provide with your valid Email Address !")==false) {fren_email.focus(); document.getElementById('fren_email').className='txtfieldstyle_enq error'; return false;}
				if (emptyvalidation(no_person,"Error ! Please type in Number of Persons !")==false) {no_person.focus(); document.getElementById('no_person').className='txtfieldstyle_enq error'; return false;}
				if (emptyvalidation(arrival_date,"Error ! Please type in Arrival Date !")==false) {arrival_date.focus(); document.getElementById('arrival_date').className='txtfieldstyle_enq error'; return false;}
				if (emptyvalidation(departure_date,"Error ! Please type in Arrival Date !")==false) {departure_date.focus(); document.getElementById('departure_date').className='txtfieldstyle_enq error'; return false;}
				
				//if (emailvalidation(email_add,"Error ! Please provide with your valid Email Address !")==false) {email_add.focus(); return false;}
				else
				{
					document.inquiry.submit();
				}
		}
}

function formvalidation1(thisform)
{
	with (thisform)
	{
		if (emailvalidation(fren_email,"Error ! Please provide with your valid Email Address !")==false) {
			fren_email.focus(); 

			//document.getElementById('fren_email').className='txtfieldstyle_enq error';
			return false;
		}
		else
		{
			document.recommend.submit();
		}
	}
}
function formvalidation2(thisform)
{
	with (thisform)
	{
		if (emptyvalidation(name,"Error ! Please type in your First Name !")==false) 
		{
			name.focus(); 
			//document.getElementById('name').className='txtfieldstyle_enq error';
			return false;
			}
		if (emailvalidation(email_add,"Error ! Please provide with your valid Email Address !")==false) {
			email_add.focus(); 

			//document.getElementById('email_add').className='txtfieldstyle_enq error';
			return false;
		}
		else
		{
			document.mailinglist.submit();
		}
	}
}
function formvalidation3(thisform)
{
	with (thisform)
	{
		if (emptyvalidation(program,"Error ! Please type in your tour program/code !")==false) 
			{
			program.focus(); 
			document.getElementById('program').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(budget,"Error ! Please type in your budget per person !")==false) 
			{
			budget.focus(); 
			document.getElementById('budget').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(no_of_persons,"Error ! Please type in your no of persons !")==false) 
			{
			no_of_persons.focus(); 
			document.getElementById('no_of_persons').className='txtfieldstyle_enq error';
			return false;
			}
		if (!chkboxchked()) 
			{
			alert("Error ! Please select at least one additional interest !");
			Interests1.focus(); 
			//document.getElementById('accom').className='txtfieldstyle_enq error';
			return false;
			}
		if (isChecked(accom,"Error ! Please select one required accomodation !")==false) 
			{
			accom.focus(); 
			//document.getElementById('accom').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(full_name,"Error ! Please type in your full name !")==false) 
			{
			full_name.focus(); 
			document.getElementById('full_name').className='txtfieldstyle_enq error';
			return false;
			}

		if (emptyvalidation(mailing_add,"Error ! Please provide with your valid Email Address !")==false) 
			{
			mailing_add.focus(); 
			document.getElementById('mailing_add').className='txtfieldstyle_enq error';
			return false;
			}
		if (emailvalidation(mailing_add,"Error ! Please provide with your valid Email Address !")==false) 
			{
			mailing_add.focus(); 
			document.getElementById('mailing_add').className='txtfieldstyle_enq error';
			return false;
			}	
		if (emptyvalidation(cbocountry,"Error ! Please select country!")==false) 
			{
			cbocountry.focus(); 
			//document.getElementById('cbocountry').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(phone,"Error ! Please type in your phone no !")==false) 
			{
			phone.focus(); 
			document.getElementById('phone').className='txtfieldstyle_enq error';
			return false;
			}
		if (phonevalidation(phone,"Error ! Please type in valid phone no !")==false) 
			{
			phone.focus(); 
			document.getElementById('phone').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(airlines,"Error ! Please type in airlines name !")==false) 
			{
			airlines.focus(); 
			document.getElementById('airlines').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(cboarrivalday,"Error ! Please select arrival day !")==false) 
			{
			cboarrivalday.focus(); 
			//document.getElementById('flight_no').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(cboarrivalmonth,"Error ! Please select arrival month!")==false) 
			{
			cboarrivalmonth.focus(); 
			//document.getElementById('flight_no').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(cboarrivalyear,"Error ! Please select arrival year !")==false) 
			{
			cboarrivalyear.focus(); 
			//document.getElementById('flight_no').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(cbodeptday,"Error ! Please select departure day !")==false) 
			{
			cbodeptday.focus(); 
			//document.getElementById('flight_no').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(cbodeptmonth,"Error ! Please select departure month!")==false) 
			{
			cbodeptmonth.focus(); 
			//document.getElementById('flight_no').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(cbodeptyear,"Error ! Please select departure year!")==false) 
			{
			cbodeptyear.focus(); 
			//document.getElementById('flight_no').className='txtfieldstyle_enq error';
			return false;
			}
			
			
			
		if (emptyvalidation(flight_no,"Error ! Please type in flight number !")==false) 
			{
			flight_no.focus(); 
			document.getElementById('flight_no').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(time,"Error ! Please type in time of flight!")==false) 
			{
			time.focus(); 
			document.getElementById('time').className='txtfieldstyle_enq error';
			return false;
			}
		if (isChecked(pickup,"Error ! Please select one mode of payment !")==false) 
			{
			pickup.focus(); 
			//document.getElementById('pickup').className='txtfieldstyle_enq error';
			return false;
			}
		if (isChecked(mode_of_payment,"Error ! Please select one mode of payment !")==false) 
			{
			mode_of_payment.focus(); 
			//document.getElementById('mode_of_payment').className='txtfieldstyle_enq error';
			return false;
			}
		if (emptyvalidation(others,"Error ! Please type in any extra information !")==false) 
			{
			others.focus(); 
			document.getElementById('others').className='txtfieldstyle_enq error';
			return false;
			}
		else
		{
			document.book_now.submit();
		}
	}
}
function checkFormMsg(theForm){
	if(theForm.name.value==""){
		window.alert("Please supply your \"Full Name\"");
		theForm.name.focus();
		return false;
	}
	if(theForm.comments.value.length<30){
		window.alert("Please supply your \"Comments\" with minimum 30 characters");
		theForm.comments.focus();
		return false;
	}
	return true;
}
function searchvalidation(theForm){
	if(theForm.keyword.value==""){
		window.alert("Please supply the \"keyword\"");
		theForm.keyword.focus();
		return false;
	}
	return true;
}
