
/*=========** Object Functions **=========*/
	/* *  Ajax Objects * */
	function GetXmlHttpObject(){var objXMLHttp=null;if (window.XMLHttpRequest){objXMLHttp=new XMLHttpRequest()}else if (window.ActiveXObject){objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")}return objXMLHttp;}
	/* *  Ajax Objects * */
/*=========** Object Functions **=========*/


/*=========**  Form Object **=========*/
	
	function SearchFormSubmit(){
			f = document.Search
			
			if(!f.CountryValue.value){
				alert("Please select Hotel/Country.");
				f.CountryValue.focus();
				return false;
				}

			if(!f.CityValue.value){
				alert("Please select Hotel/City.");
				f.CityValue.focus();
				return false;
				}

			if(f.CheckIn.value=="dd/mm/yy"){
				alert("Please select check-in date.");
				f.CheckIn.focus();
				return false;
				}

			if(f.CheckOut.value=="dd/mm/yy"){
				alert("Please select check-out date.");
				f.CheckOut.focus();
				return false;
				}
			
			ChkIn	= f.CheckIn.value
			ChkOut	= f.CheckOut.value
			ChkIn	= ChkIn.replace("/","").replace("/","")
			ChkOut	= ChkOut.replace("/","").replace("/","")
			
			/*if(ChkIn>ChkOut){
				alert("Please check check-in and check-out date.");
				f.CheckIn.focus();
				f.CheckOut.focus();
				return false;
				}*/
				
			f.action="/Search.html";
		}
		
		function FindMap(x,y,n){
			
			window.open("SeeOnMap.html?x="+x+"&y="+y+"&n="+n+"","mapwin","status=0,toolbar=0,menubar=0,resizable=0,width=400,height=330"); 
			
		}
		
		function SubmitRoom(HotelNo){
			
				FR = document.getElementById("HotelForm"+HotelNo)
				RE = document.getElementById("ResponseElement"+HotelNo)
				RO = document.getElementById("RequestObject")
				
				
				
				RE.innerHTML = RO.innerHTML
				FR.submit();
				
				
			}
	
	
	/* *  Country Objects * */
	function CountryList(){
			f = document.Search
			i = document.getElementById("CountryList")
			CntValue = f.Country.value
			if(CntValue.length<3){return false;}
			Url = "application.asp?n=1&country="+CntValue
			xmlHttp = GetXmlHttpObject()
			xmlHttp.onreadystatechange=function(){
					if (xmlHttp.readyState==4){
						DataResponse = xmlHttp.responseText
						if (DataResponse==""){
							i.style.display='none';
						}else{

							i.innerHTML = DataResponse
							i.style.display='';
						}
					}
				}
			currentTime = new Date();
			PostUrl		= Url
			xmlHttp.open("GET",""+PostUrl+"&l="+currentTime,true)
			xmlHttp.send(null);
		}
	
	function CountrySelect(CountryName){
			
			f = document.Search
			i = document.getElementById("CountryList")
			
			c = f.Country
			c.value = CountryName
			
			v = f.CountryValue
			v.value = CountryName
			
			i.innerHTML = "";
			i.style.display="none";
		}
	/* *  Country Objects * */
	
	
	/* *  City Objects * */
	function CityList(){
			f = document.Search
			i = document.getElementById("CityList")
			CntValue = f.City.value
			if(!f.CountryValue.value){
				alert("Please search Country first.");
				f.City.value = "";
				f.Country.focus();
				return false;
				}
			if(CntValue.length<3){return false;}
			Url = "application.asp?n=2&city="+CntValue+"&country="+f.CountryValue.value
			xmlHttp = GetXmlHttpObject()
			xmlHttp.onreadystatechange=function(){
					if (xmlHttp.readyState==4){
						DataResponse = xmlHttp.responseText
						if (DataResponse==""){
							i.style.display='none';
						}else{
							i.innerHTML = DataResponse
							i.style.display='';
						}
					}
				}
			currentTime = new Date();
			PostUrl		= Url
			xmlHttp.open("GET",""+PostUrl+"&l="+currentTime,true)
			xmlHttp.send(null);
		}
		
	function CitySelect(CityName,CityValue){
			
			f = document.Search
			i = document.getElementById("CityList")
			
			c = f.City
			c.value = CityName
			
			v = f.CityValue
			v.value = CityValue
			
			i.innerHTML = "";
			i.style.display="none";
		}
	/* *  City Objects * */	
	
	
	/* *  Hotel Objects * */
	function HotelList(){
			f = document.Search
			i = document.getElementById("HotelList")
			CntValue = f.Hotel.value
			
			if(!f.CountryValue.value){
				alert("Please search Country be first.");
				f.Hotel.value = "";
				f.Country.focus();
				return false;
				}
				
			if(!f.CityValue.value){
				alert("Please search City be first.");
				f.Hotel.value = "";
				f.City.focus();
				return false;
				}
				

				
			if(CntValue.length<3){return false;}
			Url = "/application.asp?n=3&city="+f.CityValue.value+"&country="+f.CountryValue.value+"&hotel="+CntValue
			xmlHttp = GetXmlHttpObject()
			xmlHttp.onreadystatechange=function(){
					if (xmlHttp.readyState==4){
						DataResponse = xmlHttp.responseText
						if (DataResponse==""){
							i.style.display='none';
						}else{
							i.innerHTML = DataResponse
							i.style.display='';
						}
					}
				}
			currentTime = new Date();
			PostUrl		= Url
			xmlHttp.open("GET",""+PostUrl+"&l="+currentTime,true)
			xmlHttp.send(null);
		}
		
	function HotelSelect(HotelName,HotelValue){
			
			f = document.Search
			i = document.getElementById("HotelList")
			
			c = f.Hotel
			c.value = HotelName
			
			v = f.HotelValue
			v.value = HotelValue
			
			i.innerHTML = "";
			i.style.display="none";
		}
	/* *  Hotel Objects * */
	
	
	
	/* *  Room Objects * */
	function RoomList(RoomCount){
		for(i=1;i<4;i++){
			
			if(i<=RoomCount){
					document.getElementById("Room"+i).style.display='';
				}else{
					document.getElementById("Room"+i).style.display='none';
				}
				
			}
		}
		
	function RoomGuestList(RoomId,RoomGuestValue){
		
			ValueSplit = RoomGuestValue.split("+");
			AdultCount = ValueSplit[0]
			ChildCount = ValueSplit[1]
			for(i=1;i<3;i++){
					if(i<=ChildCount){
						document.getElementById("ChildAge"+RoomId+""+i+"").style.display='';
					}else{
						document.getElementById("ChildAge"+RoomId+""+i+"").style.display='none';
					}
				}
		
		}
	/* *  Room Objects * */
	
/*=========** Object Functions **=========*/