function check_itinerary_details() {
	var res = true;
	var err = '';
	var nwl = '\n';
	var frm = document.request1;
arrivalyear = frm.my.options[frm.my.selectedIndex].value.substr(3,4);
arrivalmonth = frm.my.options[frm.my.selectedIndex].value.substr(0,3);
if(arrivalmonth == "Jan") {arrivalmonth = 1;}
if(arrivalmonth == "Feb") {arrivalmonth = 2;}
if(arrivalmonth == "Mar") {arrivalmonth = 3;}
if(arrivalmonth == "Apr") {arrivalmonth = 4;}
if(arrivalmonth == "May") {arrivalmonth = 5;}
if(arrivalmonth == "Jun") {arrivalmonth = 6;}
if(arrivalmonth == "Jul") {arrivalmonth = 7;}
if(arrivalmonth == "Aug") {arrivalmonth = 8;}
if(arrivalmonth == "Sep") {arrivalmonth = 9;}
if(arrivalmonth == "Oct") {arrivalmonth = 10;}
if(arrivalmonth == "Nov") {arrivalmonth = 11;}
if(arrivalmonth == "Dec") {arrivalmonth = 12;}
arrivalday = frm.day.options[frm.day.selectedIndex].value;
theday = new Date();
arrivaldate = new Date(arrivalyear,arrivalmonth-1,arrivalday);

	if(arrivaldate < theday){
		err += 'Sorry, Lounges must be booked with 24 hours notice' + nwl;
	}

	if (document.getElementById('hiddenLocation')) {
	} else {	
		if(frm.Location.options[frm.Location.options.selectedIndex].value == '') {
			err += 'Please select the airport from which you will be flying' + nwl;
		}
	}
	//if(frm.ArrivalDate.value == 'select') {
	//	err += 'Please select the date for which you wish to book a lounge' + nwl;
	//}
	if(frm.ArrivalTime.value == '') {
		err += 'Please select the time from which you will require the lounge' + nwl;
	}
	if((frm.Adults.value == 0) && (frm.Children.value == 0) && (frm.Infants.value == 0)) {
		err += 'Please select the number of customers' + nwl;
	} else if(parseInt(frm.Adults.value) + parseInt(frm.Children.value) + parseInt(frm.Infants.value) > 9) {

		err += 'You cannot book for more than 10 passengers using this site. Please contact Group Bookings on 0870 844 4115 for large parties' + nwl;

	} else if(frm.Adults.value == 0) {	
		err += 'You must select at least one adult to accompany any children' + nwl;
	}
	
	if(!err == '') {
		alert(err);
		res = false;
	}
	
	return res;
}


function WriteLayer(ID,parentID,sText) {

        if (document.layers) { var oLayer = (parentID)? eval('document.' + parentID + '.document.' + ID + '.document') :  document.layers[ID].document;
		oLayer.open();
		oLayer.write(sText);
		oLayer.close();

        }

        else if (document.all) {
		 document.all[ID].innerHTML = sText;
		}

        else if (parseInt(navigator.appVersion)>=5&&navigator.appName=="Netscape") {

                document.getElementById(ID).innerHTML = sText;

        }
}



function checkoccupants(airport) {

var frm = document.request1;
	document.getElementById('babies').style.display='none';
	if(airport=='LGW' || airport =='LHR' ||airport=='LPL') {
		document.getElementById('children').style.display='';
		document.getElementById('infants').style.display='';
		WriteLayer('childtext',null,'Children (3-12 yrs):');
		WriteLayer('adultstext',null,'Adults (12 + yrs):');
		WriteLayer('adultsaddtext',null,'');
	} else {
		document.getElementById('children').style.display='none';
		document.getElementById('infants').style.display='none';
	}

	// Adapted TW - 28/Feb/2006 to allow for new child fields at Manchester.
	if(airport=='MAN' ) {
		document.getElementById('children').style.display='';
		document.getElementById('infants').style.display='';
		document.getElementById('babies').style.display='';
		WriteLayer('adultstext',null,'Adults (12 + yrs):');
		WriteLayer('childtext',null,'Children (8-12 yrs):');
		WriteLayer('infanttext',null,'Children (3-7 yrs):');
		WriteLayer('babiestext',null,'Children (2 yrs):');
		WriteLayer('adultsaddtext',null,'');
	}
	
	if(airport=='EMA' ) {
		document.getElementById('children').style.display='';
		WriteLayer('adultstext',null,'Adults (14 + yrs):');
		WriteLayer('childtext',null,'Children (8-13 yrs):');
		WriteLayer('adultsaddtext',null,'');
	}

	if(airport=='CWL' ) {
		WriteLayer('adultstext',null,'Passengers:');
		WriteLayer('adultsaddtext',null,'(No under 18s):');
	}

	// Added TW 08/Feb/2006 to account for the opening of a new lounge at Glasgow
	if (airport == 'GLA') {
		if (frm.my.options[frm.my.selectedIndex].value == 'Feb2006' || frm.my.options[frm.my.selectedIndex].value == 'Mar2006') {
			WriteLayer('adultstext',null,'Adults (12 + yrs):');
			WriteLayer('adultsaddtext',null,' (No under 12s)');
		} else {
			document.getElementById('children').style.display='';
			WriteLayer('adultstext',null,'Adults (12 + yrs):');
			WriteLayer('childtext',null,'Children (0-12 yrs):');
			WriteLayer('adultsaddtext',null,'');
		}
	}
	
	if(airport != 'LGW' && airport !='LHR' && airport != 'LPL' && airport !='MAN' && airport!='CWL' && airport !='EMA' && airport !='GLA') {
		WriteLayer('adultstext',null,' Passengers:');
		WriteLayer('adultsaddtext',null,' (No under 12s)');
		frm.Children.value = 0;
		frm.Infants.value = 0;
	}
}
