// JavaScript Document

function sethotelcontent(strHotel){
	var creditTxt = " ";
	var faxTxt = " ";
	var emailTxt = " ";
	var selectionName = 'roomTypeSelect';
	
	if(strHotel == 'bangkok'){
		addTblContent('hotelTbl',1,0,'ASIA HOTEL BANGKOK');
		addFormElement('Hotel','Asia Hotel Bangkok');
		addFormElement('recipient','Bangkok');
		addFormElement('subject','Manual Reservation Bangkok.');
		
		creditTxt = "<a href='credit_bkk.htm' target='new'><img src='../images/share/cradit.gif' border='0' width='136' height='25' /></a>";
		addTblContent('creditTbl',1,0,creditTxt);
		
		faxTxt = "To guarantee your reservation, please print out this form and fill in all the information required with your signature and fax this form to  <span class='Verdana12_0000ff_B'>+66(0)2 217 0109</span> ";
		addTblContent('creditTbl',2,0,faxTxt);
		
		emailTxt = "<a href='mailto:Asia Bangkok &lt;booking@asiahotel.co.th&gt;' class='Verdana10_B'>Contact e-mail : booking@asiahotel.co.th</a>";
		addTblContent('emailTbl',0,1,emailTxt);
		
		clearSelection(selectionName);
		getXmlData(strHotel);
						
	}else if(strHotel == 'iait'){
		addTblContent('hotelTbl',1,0,'ASIA HOTEL BANGKOK');
		addFormElement('Hotel','Asia Hotel Bangkok');
		addFormElement('recipient','Bangkok');
		addFormElement('subject','Reservation Bangkok IAIT promotion.');
				
		creditTxt = "<a href='credit_bkk.htm' target='new'><img src='../images/share/cradit.gif' border='0' width='136' height='25' /></a>";
		addTblContent('creditTbl',1,0,creditTxt);
		
		faxTxt = "To guarantee your reservation, please print out this form and fill in all the information required with your signature and fax this form to  <span class='Verdana12_0000ff_B'>+66(0)2 217 0109</span> ";
		addTblContent('creditTbl',2,0,faxTxt);
		
		emailTxt = "<a href='mailto:Asia Bangkok &lt;booking@asiahotel.co.th&gt;' class='Verdana10_B'>Contact e-mail : booking@asiaahotel.co.th</a>";
		addTblContent('emailTbl',0,1,emailTxt);
		
		clearSelection(selectionName);
		getXmlData(strHotel);
	
	
	}else if(strHotel == 'bangkok_th' || strHotel == 'bangkok_th_pro'){
		addTblContent('hotelTbl',1,0,'ASIA HOTEL BANGKOK');
		addFormElement('Hotel','Asia Hotel Bangkok');
		addFormElement('recipient','Bangkok');
		addFormElement('subject','Manual Reservation Bangkok.');
		
		creditTxt = "<a href='credit_bkk.htm' target='new'><img src='../images/share/cradit.gif' border='0' width='136' height='25' /></a>";
		addTblContent('creditTbl',1,0,creditTxt);
		
	faxTxt = "สำหรับการยืนยัน การจองห้องพักของคุณ กรุณาพิมพ์แบบฟอร์ม และกรอกข้อความให้ครบ พร้อมลงชื่อ และแฟกซ์มาหาเราที่  <br /><span class='MsSanSerif12_0000ff_B'>+66(0)2 217 0109</span> ";
		addTblContent('creditTbl',2,0,faxTxt);
		
		emailTxt = "<a href='mailto:Asia Bangkok &lt;booking@asiahotel.co.th&gt;' class='Verdana10_B'>Contact e-mail : booking@asiahotel.co.th</a>";
		addTblContent('emailTbl',0,1,emailTxt);
		
		clearSelection(selectionName);
		getXmlData(strHotel);

	}else if(strHotel == 'tfbo'){
		addTblContent('hotelTbl',1,0,'ASIA HOTEL BANGKOK');
		addFormElement('Hotel','Asia Hotel Bangkok');
		addFormElement('recipient','Bangkok');
		addFormElement('subject','Reservation Bangkok tfbo promotion.');
				
		creditTxt = "<a href='credit_bkk.htm' target='new'><img src='../images/share/cradit.gif' border='0' width='136' height='25' /></a>";
		addTblContent('creditTbl',1,0,creditTxt);
		
		faxTxt = "To guarantee your reservation, please print out this form and fill in all the information required with your signature and fax this form to  <span class='Verdana12_0000ff_B'>+66(0)2 217 0109</span> ";
		addTblContent('creditTbl',2,0,faxTxt);
		
		emailTxt = "<a href='mailto:Asia Bangkok &lt;booking@asiahotel.co.th&gt;' class='Verdana10_B'>Contact e-mail : booking@asiahotel.co.th</a>";
		addTblContent('emailTbl',0,1,emailTxt);
		
		clearSelection(selectionName);
		getXmlData(strHotel);
	

	}else if(strHotel == 'pattaya' || strHotel == 'pattaya_her_own_pro'  || strHotel == 'pattaya_promotion'){
		//alert("pat_en " + strHotel);
		addTblContent('hotelTbl',1,0,'ASIA PATTAYA HOTEL');
		addFormElement('Hotel','Asia Pattaya Hotel');
		addFormElement('recipient','Pattaya');
		addFormElement('subject','Manual Reservation Pattaya.');
		
		creditTxt = "<a href='credit_pattaya.htm' target='new'><img src='../images/share/cradit.gif' border='0' width='136' height='25' /></a>";
		addTblContent('creditTbl',1,0,creditTxt);
		
		faxTxt = "To guarantee your reservation, please print out this form and fill in all the information required with your signature and fax this form to  <span class='Verdana12_0000ff_B'>+66(0)2 217 0109</span> ";
		addTblContent('creditTbl',2,0,faxTxt);
		
		emailTxt = "<a href='mailto:Asia Pattaya &lt;sale@asiahotel.co.th&gt;' class='Verdana10_B'>Contact e-mail : sale@asiahotel.co.th</a>";
		addTblContent('emailTbl',0,1,emailTxt);
		
		clearSelection(selectionName);
		getXmlData(strHotel);
		
		
			
	}else if(strHotel == 'pattaya_th' || strHotel == 'pattaya_th_pro'){
		//alert("pat_th " + strHotel);
		addTblContent('hotelTbl',1,0,'ASIA PATTAYA HOTEL');
		addFormElement('Hotel','Asia Pattaya Hotel');
		addFormElement('recipient','Pattaya');
		addFormElement('subject','Manual Reservation Pattaya.');
		
		creditTxt = "<a href='credit_pattaya.htm' target='new'><img src='../images/share/cradit.gif' border='0' width='136' height='25' /></a>";
		addTblContent('creditTbl',1,0,creditTxt);
		
		faxTxt = "สำหรับการยืนยัน การจองห้องพักของคุณ กรุณาพิมพ์แบบฟอร์ม และกรอกข้อความให้ครบ พร้อมลงชื่อ และแฟกซ์มาหาเราที่     <br /><span class='MsSanSerif12_0000ff_B'>+66(0)2 217 0109</span> ";
		addTblContent('creditTbl',2,0,faxTxt);
		
		emailTxt = "<a href='mailto:Asia Pattaya &lt;sale@asiahotel.co.th&gt;' class='Verdana10_B'>Contact e-mail : sale@asiahotel.co.th</a>";
		addTblContent('emailTbl',0,1,emailTxt);
		
		clearSelection(selectionName);
		getXmlData(strHotel);
			
	
	}else if(strHotel == 'airport_th' || strHotel == 'airport_th_pro'){
		addTblContent('hotelTbl',1,0,'ASIA AIRPORT HOTEL');
		addFormElement('Hotel','Asia Airport Hotel');
		addFormElement('recipient','Airport');
		addFormElement('subject','Manual Reservation Airport.');
		
		creditTxt = "<a href='credit_airport.htm' target='new'><img src='../images/share/cradit.gif' border='0' width='136' height='25' /></a>";
		addTblContent('creditTbl',1,0,creditTxt);
		
		faxTxt = "สำหรับการยืนยัน การจองห้องพักของคุณ กรุณาพิมพ์แบบฟอร์ม และกรอกข้อความให้ครบ พร้อมลงชื่อ	และแฟกซ์มาหาเราที่       <br /><span class='MsSanSerif12_0000ff_B'>+66(0)2 992 6828</span> ";
		addTblContent('creditTbl',2,0,faxTxt);
		
		emailTxt = "<a href='mailto:Asia Airport &lt;airport@asiahotel.co.th&gt;' class='Verdana10_B'>Contact e-mail : airport@asiahotel.co.th</a>";
		addTblContent('emailTbl',0,1,emailTxt);
		
		clearSelection(selectionName);
		getXmlData(strHotel);
		
	}else if(strHotel == 'airport' || strHotel == 'airport_her_own_pro'){
		addTblContent('hotelTbl',1,0,'ASIA AIRPORT HOTEL');
		addFormElement('Hotel','Asia Airport Hotel');
		addFormElement('recipient','Airport');
		addFormElement('subject','Manual Reservation Airport.');
		
		creditTxt = "<a href='credit_airport.htm' target='new'><img src='../images/share/cradit.gif' border='0' width='136' height='25' /></a>";
		addTblContent('creditTbl',1,0,creditTxt);
		
		faxTxt = "To guarantee your reservation, please print out this form and fill in all the information required with your signature and fax this form to  <span class='Verdana12_0000ff_B'>+66(0)2 992 6828</span> ";
		addTblContent('creditTbl',2,0,faxTxt);
		
		emailTxt = "<a href='mailto:Asia Airport &lt;airport@asiahotel.co.th&gt;' class='Verdana10_B'>Contact e-mail : airport@asiahotel.co.th</a>";
		addTblContent('emailTbl',0,1,emailTxt);
		
		clearSelection(selectionName);
		getXmlData(strHotel);
	}
}

function buildRoomSelection(arrRoomType){
	var selectionName = 'roomTypeSelect';
	for(var i=0;i<arrRoomType.length;i+=1){
		addopt(arrRoomType[i],arrRoomType[i],selectionName);
	}
}

function getXmlData(strHotel)
 { 
	 var xmlHttpObj=GetXmlHttpObject();
	 if (xmlHttpObj==null)
	  {
	  	alert ("Browser does not support HTTP Request");
		return
	  } 
	 var url="../scripts/responsexml.php";
	 //url=url+"?hotel="+hotelName
	 url=url+"?sid="+Math.random();
	 xmlHttpObj.onreadystatechange=function(){stateChanged(xmlHttpObj,strHotel);};
	 xmlHttpObj.open("GET",url,true);
	 xmlHttpObj.send(null);
 }

function stateChanged(xmlHttp,strHotel) 
{
 	var arrRoomType = new Array();
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {
	var selectionName = 'roomTypeSelect';
 	var xmlDoc=xmlHttp.responseXML;

	var nlHotel = xmlDoc.getElementsByTagName("hotel");

	for (var i=0;i<nlHotel.length;i+=1){
		valHotelCode = nlHotel[i].attributes.getNamedItem("code").nodeValue;
		ndRoomType = nlHotel[i].getElementsByTagName("room");
		//alert(ndRoomType[0].attributes.getNamedItem("roomname").nodeValue);
		if (valHotelCode == strHotel){
			for (var j=0;j<ndRoomType.length;j+=1){
				//alert(j+" "+ndRoomType[j].attributes.getNamedItem("roomname").nodeValue);
				arrRoomType.push(ndRoomType[j].attributes.getNamedItem("roomname").nodeValue);
			}
		}
	}

 	buildRoomSelection(arrRoomType);
	var showElement = document.getElementById('loadingShow');
	var showTxt = "";
	showElement.innerHTML = showTxt;
 }else{
	var showElement = document.getElementById('loadingShow');
	var showTxt = "<img src='images/rscircle_loader.gif' /> Loading ...";
	showElement.innerHTML = showTxt;
	//alert(xmlHttp.readyState);
 }
 return arrRoomType;
}