// JavaScript Document

function chkform1(){
	var obj1=document.getElementById("from1");
	var obj2=document.getElementById("to1");
	
	if(obj1.value=="" || obj2.value==""){
		alert("Please enter your start and destination first!");
		obj1.focus();
		return false;
	}
	return true;
}
function chkform2(){
	var obj1=document.getElementById("tstop");
	if(obj1.value==""){
		alert("Please enter a city first!");
		obj1.focus();
		return false;
	}
	return true;
}
function chkform3(){
	var obj1=document.getElementById("trainno1");
	if(obj1.value==""){
		alert("Please enter a train no. first!");
		obj1.focus();
		return false;
	}
	return true;
}
function checkAll()
{
	try{
  	if(document.FlightSearch.T1.value.length == 0 || document.FlightSearch.T1.value=="")
	{
		window.alert("Choose your departure place!");
		document.FlightSearch.T1.focus();
		return false;
	}
	else if(document.FlightSearch.T2.value.length == 0 || document.FlightSearch.T2.value=="")
	{
		window.alert("Choose your destination place!");
		document.FlightSearch.T2.focus();
		return false;
	}
	else if(document.FlightSearch.T1.value == document.FlightSearch.T2.value)
	{
		window.alert("Destination place is the same as departure place, choose again!");
		document.FlightSearch.T1.focus();
		return false;
	}
	else if(document.FlightSearch.D1.value.length == 0 ||document.FlightSearch.D1.value == "")
	{
		window.alert("Please input departure date");
		document.FlightSearch.D1.focus();
		return false;
	}
	
	if (document.FlightSearch.triptype.value == '2')
	{
		if(document.FlightSearch.D2.value.length == 0 ||document.FlightSearch.D2.value == "")
		{
			window.alert("Please input return date");
			//document.FlightSearch.D2.focus();
			return false;
		}
	}
	if (document.FlightSearch.triptype.value == '3')
	{
		if (document.FlightSearch.T3.value.length == 0 )
		{
			window.alert("Since you have chosen to book an Multiple Destinations ticket, you have to choose at least destination city!");
			document.FlightSearch.T3.focus();
			return false;
		}
		if (document.FlightSearch.T4.value.length == 0 )
		{
			window.alert("Since you have chosen to book an Multiple Destinations ticket, you have to choose at least destination city!");
			document.FlightSearch.T4.focus();
			return false;
		}
		if (document.FlightSearch.T5.value.length == 0 )
		{
			window.alert("Since you have chosen to book an Multiple Destinations ticket, you have to choose at least destination city!");
			document.FlightSearch.T5.focus();
			return false;
		}
		if (document.FlightSearch.T6.value.length == 0 )
		{
			window.alert("Since you have chosen to book an Multiple Destinations ticket, you have to choose at least destination city!");
			document.FlightSearch.T6.focus();
			return false;
		}
		if (document.FlightSearch.T1.value == document.FlightSearch.T3.value)
		{
			window.alert("Your departure city of Flight 1 is the same as your departure city of Flight 2. Please Choose again!");
			document.FlightSearch.T3.focus();
			return false;
		}
		if (document.FlightSearch.T2.value.length == 0 || document.FlightSearch.T2.value=="")
		{
			window.alert("Your destination city is the same as your destination city . Please choose again!");
			document.FlightSearch.T3.focus();
			return false;
		}
		if(document.FlightSearch.D2.value.length == 0 ||document.FlightSearch.D2.value == "")
		{
			window.alert("Please input departure date of Flight 2");
			//document.FlightSearch.D2.focus();
			return false;
		}
		if(document.FlightSearch.D3.value.length == 0 ||document.FlightSearch.D3.value == "")
		{
			window.alert("Please input departure date of Flight 3");
			document.FlightSearch.D3.focus();
			return false;
		}
	}
	return true;
	
	        }
	        catch (e)
	        {
				alert(e);}
}
