function emptyvalidation(entered, alertbox)
{
	with (entered)
{
	if (entered.value==null || entered.value=="")
	{if (alertbox!="") {alert(alertbox);} return false;}
	else {return true;}
	}
} 

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 numbervalidation(entered, alertbox)
{
	with(entered)	
{
	if (isNaN(entered.value) || entered.value=="")
{
	if (alertbox!="") {alert(alertbox);} return false;
}
	else 
{
	return true;
}
}
}

function phonevalidation(entered, alertbox)
{
	with(entered)	
	{
		var pattern = "^[0-9]{10}$";
		if(!entered.value.match(pattern))
		{
			alert(alertbox);	
			return false;
		}
		else
		{
			return true;
		}
	}
}

function zipvalidation(entered, alertbox)
{
	with(entered)	
	{
		var pattern = "^[0-9]{5}$";
		if(!entered.value.match(pattern))
		{
			alert(alertbox);	
			return false;
		}
		else
		{
			return true;
		}
	}
}

function timevalidation(entered, alertbox)
{
	with(entered)	
	{
		var pattern = "^[0-9]{2}\\:[0-9]{2}[A-Z,a-z]{2}$";
		if(!entered.value.match(pattern))
		{
			alert(alertbox);	
			return false;
		}
		else
		{
			return true;
		}
	}
}

function expvalidation(entered, alertbox)
{
	with(entered)	
	{
		var pattern = "^[0-9]{2}\\/[0-9]{4}$";
		if(!entered.value.match(pattern))
		{
			alert(alertbox);	
			return false;
		}
		else
		{
			return true;
		}
	}
}

function formvalidation(thisform)
{
	with (thisform)
{
	if (emptyvalidation(Name,"Error ! Please Type Your Full Name !")==false) {Name.focus(); return false;}
   if (emailvalidation(Email,"Error ! Please Type Your Valid Email Address !")==false) {Email.focus(); return false;}
	if (emptyvalidation(Phone,"Error ! Please Type Your Correct Cell Phone Number !")==false) {Phone.focus(); return false;}
	if(thisform.pickLoc.options[thisform.pickLoc.selectedIndex].value == 'select')
		{
			alert("Error ! Please Select Pickup Location !");
			thisform.pickLoc.focus();
			return false;
		}
	if(document.getElementById('showThis1').style.display == 'block')
	{
	if (emptyvalidation(Arrival_Date,"Error ! Please Type Your Arrival Date !")==false) {Arrival_Date.focus(); return false;}
		//if (emptyvalidation(arrivalday,"Error ! Please Type Your Arrival Day !")==false) {arrivalday.focus(); return false;}
		if (thisform.Arrival_Day.options[thisform.Arrival_Day.selectedIndex].value == 'select')
		{
			alert("Error ! Please Select Arrival Day !");
			thisform.Arrival_Day.focus();
			return false;
		}
		
		//if (emptyvalidation(arrivalampm,"Error ! Please Select AM or PM !")==false) {arrivalampm.focus(); return false;}
		
  if (emptyvalidation(Pick_up_airport,"Error ! Please Type Your Pick Up Airport !")==false) {Pick_up_airport.focus(); return false;}
  if (emptyvalidation(Airline_name,"Error ! Please Type Your Airline Name !")==false) {Airline_name.focus(); return false;}
  if (numbervalidation(Flight_Number,"Error ! Please Type Your Flight No. !")==false) {Flight_Number.focus(); return false;}		
  if (emptyvalidation(Comming_From,"Error ! Please Type Where Are You Coming From ?")==false) {Comming_From.focus(); return false;}
  if (emptyvalidation(Arrival_time,"Error ! Please Type Your Arrival Time !")==false) {Arrival_time.focus(); return false;}
  if (emptyvalidation(M_Air,"Error ! Please Type  How Many Male !")==false) {M_Air.focus(); return false;}
  if (emptyvalidation(F_Air,"Error ! Please Type  How Many Female !")==false) {F_Air.focus(); return false;}
  if (emptyvalidation(CH_Air,"Error ! Please Type  How Many Child !")==false) {CH_Air.focus(); return false;}
    if ( ( thisform.Check_in_luggage[0].checked == false ) && ( thisform.Check_in_luggage[1].checked == false ) )
{ alert ( "Please choose  Luggage : Yes Or No" ); return false; }
  if (emptyvalidation(Going_To,"Error ! Please Type  Where you want to Go !")==false) {Going_To.focus(); return false;}
  if (emptyvalidation(Going_city,"Error ! Please Type  Which City want to Go !")==false) {Going_city.focus(); return false;}

		//if (thisform.arrivalampm.options[thisform.arrivalampm.selectedIndex].value == 'select')
		//{
			////alert("Error ! Please Select AM or PM !");
			//thisform.arrivalampm.focus();
			//return false;
		//}
		//if (numbervalidation(maleair,"Error ! Please Type No. of Male !")==false) {maleair.focus(); return false;}
		//if (numbervalidation(femaleair,"Error ! Please Type No. of Female !")==false) {femaleair.focus(); return false;}
		//if (numbervalidation(childair,"Error ! Please Type No. of Child !")==false) {childair.focus(); return false;}
		<!--if (emptyvalidation(luggageair,"Error ! Please Type No. Your Check In Luggage!")==false) {luggageair.focus(); return false;}-->
	}
	
	//if (emptyvalidation(card,"Error ! Please Select The Credit Card Type !")==false) {card.focus(); return false;}
	
	//indrajeet 
	//if (thisform.card.options[thisform.card.selectedIndex].value == 'select')
//		{
//			alert("Error ! Please Select The Credit Card Type !");
//			thisform.card.focus();
//			return false;
//		}
//	if (emptyvalidation(cardname,"Error ! Please Type Your Name on Card !")==false) {cardname.focus(); return false;}
//	if (numbervalidation(cardnumber,"Error ! Please Type Your Credit Card Number !")==false) {cardnumber.focus(); return false;}
//	if (emptyvalidation(cardexpiration,"Error ! Please Type Your Valid Card Exp. Date !")==false) {cardexpiration.focus(); return false;}
//	if (numbervalidation(cardsecurity,"Error ! Please Type Your Card Security Code CVV !")==false) {cardsecurity.focus(); return false;}
//	if (zipvalidation(zip2,"Error ! Please Type Your Billing Zip Code in 5 Digit !")==false) {zip2.focus(); return false;}
//indrajeet
	//if (emptyvalidation(instructions,"Error ! Please Type Your Brief Message !")==false) {instructions.focus(); return false;}
	
	//if (emptyvalidation(code_checkres,"Error ! Please Type the Code Text Correctly !")==false) {code_checkres.focus(); return false;}

	else
{
	document.reservation.submit();
}

}
} 
