	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]=='bychain') {
			document.formByHotelChain.hotelChains.disabled=false;
			lengthChains = document.formByHotelChain.hotelChains.length;
			for (var i=0; i < lengthChains; ++i){
				document.formByHotelChain.hotelChains[i] = null;
			}
			document.formByHotelChain.hotelChains.length = 0;
			for (var i=1; i < result.length; ++i){
				lengthChains = document.formByHotelChain.hotelChains.length;
				document.formByHotelChain.hotelChains[lengthChains] = new Option(result[i]['dsp'],result[i]['value']);
			}			
		}
		else {					
			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 if (result[0]["value"]=="AreasListing") { 
				lengthAreas = document.f2.area.length;

				if (result.length > 1) {
					document.f2.area.disabled=false; 
					
					for (var i=1; i < lengthAreas; ++i){
						document.f2.area[i] = null;
					}
					document.f2.area.length = 0;
					document.f2.area[0] = new Option('All Areas',''); 
					for (var i=1; i < result.length; ++i){ 
						lengthAreas = document.f2.area.length; 
						if (Trim(document.f2.areaHidden.value) == Trim(result[i]["display"])) {
							document.f2.area[lengthAreas] = new Option(result[i]["display"],result[i]["value"],true,true);
						}
						else {
							document.f2.area[lengthAreas] = new Option(result[i]["display"],result[i]["value"]);
						}
					}
				}
				else {
					for (var i=1; i < lengthAreas; ++i){
						document.f2.area[i] = null;
					}
					document.f2.area.length = 0;
					document.f2.area[0] = new Option('No Area',''); 
				}
			}
			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','/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','/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;
		}
	}

	AsiaRoomsUpdateListAreas = 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','/jsWebservice/js_ws_mini_search4.php?' + sGet + '|' + sGet2);
			document.getElementsByTagName('BODY')[0].appendChild(xScript);
		}
		else{
			lengthAreas = document.f2.area.length;
			for (var i=0; i < lengthAreas; ++i){
				document.f2.area[i] = null;
			}
			document.f2.area.length = 0;
		}
	}

	AsiaRoomsUpdateListAreaHotels = function(sGet,sGet2,sGet3)
	{  
		if ((sGet!=undefined) && (sGet!=null) && (sGet!='') && (sGet2!=undefined) && (sGet2!=null) && (sGet2!='') && (sGet3!=undefined) && (sGet3!=null)){
		 	var domJSserializer,xScript;
			xScript = document.createElement('SCRIPT');
			xScript.setAttribute('type','text/javascript');
			xScript.setAttribute('id','JSserializerLoader');
			xScript.setAttribute('src','/jsWebservice/js_ws_mini_search3.php?' + sGet + '|' + sGet2 + '|' + sGet3);
			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;
	}

	AsiaRoomsUpdateCityChain = function(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_index.html?' + sGet);
		document.getElementsByTagName('BODY')[0].appendChild(xScript);
	}