
	/* Validation Checks */

function checkFabBooking(formObj) {

	if (formObj.departureAirport) {

		if (formObj.departureAirport.value == -1) {

			alert('Please select a departure airport. Thank you.');

			return false;

		}

	}
	if (formObj.hotelId) {

		if (formObj.hotelId.value == -1) {

			alert('Please select a hotel. Thank you.');

			return false;

		}

	}
	if (formObj.hotelId) {

		if (formObj.hotelId.value == -1) {

			alert('Please select a resort. Thank you.');

			return false;

		}

	}
	return true;
}

function update_rooms() 
{
	for($i=1;$i<=2;$i++) 
	{
		if (document.getElementById("frm_RoomsRequired").value >= $i) 
		{
			document.getElementById("room"+$i).style.display = '';
		} 
		else 
		{
			document.getElementById("room"+$i).style.display = 'none';
		}
	}
}

function update_childages(room_no) 
{
	for (var $i=1;$i<=room_no;$i++) 
	{
		var no_of_children = document.getElementById("children"+$i).value;
		for (var j=1;j<=Number(no_of_children);j++) 
		{
			document.getElementById("childage_span_"+$i+"_"+j).style.display='';
		}
		for (var k=(Number(no_of_children)+1);k<=4;k++) 
		{
			document.getElementById("childage_span_"+$i+"_"+k).style.display='none';
		}
	}
}

// Roshan's Ajax dropdown code with php
// This notice must stay intact for legal use
// Copyright reserved to Roshan Bhattarai - nepaliboy007@yahoo.com

function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){

				try{

				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

				}

				catch(e1){

					xmlhttp=false;

				}
			}
		}

		return xmlhttp;
    }

	function getData(resortId) {		

		var strURL="holidaybooking/includes/booking/gethotel.php?getHotel="+resortId;

		var req = getXMLHTTP();

		elem = document.getElementById('hotel');

		elem.innerHTML = "<label> Please Wait </label>";

		if (req) {

			req.onreadystatechange = function() {

				if (req.readyState == 4) {

					// only if "OK"

					if (req.status == 200) {						

						document.getElementById('hotel').innerHTML=req.responseText;						

					} else {

						alert("There was a problem while using XMLHTTP:\n" + req.statusText);

					}

				}				

			}			

			req.open("GET", strURL, true);

			req.send(null);

		}

	}



	function getAirport(resortId) {		

		var strURL="holidaybooking/includes/booking/getairports.php?getAirport="+resortId;

		var req = getXMLHTTP();

		elem = document.getElementById('airport');

		elem.innerHTML = "<label> Please Wait </label>";

		if (req) {	

			req.onreadystatechange = function() {

				if (req.readyState == 4) {

					// only if "OK"

					if (req.status == 200) {						

						document.getElementById('airport').innerHTML=req.responseText;						

					} else {

						alert("There was a problem while using XMLHTTP:\n" + req.statusText);

					}

				}				

			}			

			req.open("GET", strURL, true);

			req.send(null);

		}

	}

