	function Trim(str)
	{	while(str.charAt(0) == (" ") )
		{	str = str.substring(1);
		}
		while(str.charAt(str.length-1) == " " )
		{	str = str.substring(0,str.length-1);
		}
		return str;
	}

	JSserializerOnLoad = function(result)
	{
		if (result[0]["value"]=="hotelsListing"){ 
			if (result.length > 1) {
				document.f2.hotelName2.disabled=false;
				lengthHotels = document.f2.hotelName2.length;
				for (var i=1; i < lengthHotels; ++i){
					document.f2.hotelName2[i] = null;
				}
				document.f2.hotelName2.length = 0; 
				document.f2.hotelName2[0] = new Option('All Hotels',''); 
				for (var i=1; i < result.length; ++i){
					lengthHotels = document.f2.hotelName2.length; 
					if (Trim(document.f2.hotelNameHidden.value) == Trim(result[i]["display"])) {
						document.f2.hotelName2[lengthHotels] = new Option(result[i]["display"],result[i]["value"],true,true);
					}
					else {
						document.f2.hotelName2[lengthHotels] = new Option(result[i]["display"],result[i]["value"]); 
					}
				}
			}
		}		
		else{ 
			document.f2.city.disabled=false; 
			lengthCities = document.f2.city.length;
			for (var i=0; i < lengthCities; ++i){
				document.f2.city[i] = null;
			}
			document.f2.city.length = 0;
			document.f2.city[0] = new Option('All Cities',''); 
			for (var i=0; i < result.length; ++i){
				lengthCities = document.f2.city.length; 
				if (Trim(document.f2.cityHidden.value) == Trim(result[i]["display"])) {
					document.f2.city[lengthCities] = new Option(result[i]["display"],result[i]["value"],true,true);
				}
				else {
					document.f2.city[lengthCities] = new Option(result[i]["display"],result[i]["value"]);
				}
			}
		}
	}

	AsiaRoomsUpdateList = function(sGet)
	{
		if ((sGet!=undefined) && (sGet!=null) && (sGet!='')){ 
		 	var domJSserializer,xScript;
			xScript = document.createElement('SCRIPT');
			xScript.setAttribute('type','text/javascript');
			xScript.setAttribute('id','JSserializerLoader');
			xScript.setAttribute('src','http://www.asiarooms.com/jsWebservice/js_ws_mini_search.php?' + sGet);
			document.getElementsByTagName('BODY')[0].appendChild(xScript);
		}
		else{
			lengthCities = document.f2.city.length;
			for (var i=0; i < lengthCities; ++i){
				document.f2.city[i] = null;
			}
			document.f2.city.length = 0;
		}
	}

	AsiaRoomsUpdateListHotels = function(sGet,sGet2)
	{
		if ((sGet!=undefined) && (sGet!=null) && (sGet!='') && (sGet2!=undefined) && (sGet2!=null) && (sGet2!='')){
		 	var domJSserializer,xScript;
			xScript = document.createElement('SCRIPT');
			xScript.setAttribute('type','text/javascript');
			xScript.setAttribute('id','JSserializerLoader');
			xScript.setAttribute('src','http://www.asiarooms.com/jsWebservice/js_ws_mini_search2.php?' + sGet + '|' + sGet2);
			document.getElementsByTagName('BODY')[0].appendChild(xScript);
		}
		else{
			lengthHotels = document.f2.hotelName2.length;
			for (var i=0; i < lengthHotels; ++i){
				document.f2.hotelName2[i] = null;
			}
			document.f2.hotelName2.length = 0;
		}
	}

	function loading(elemID){
		var selectName = window.document.getElementById(elemID);
		var length = selectName.length; 
		for (var i=0; i < length; ++i){
			selectName[i] = null;
		}
		selectName.length = 0;
		selectName[0] = new Option('Loading...','loading');
		selectName.disabled=true;
	}