// JavaScript Document
function agodahotel(hotelID,checkInDateString,checkOutDateString,adults,children,room)
{
	var agoda_posturl="http://ajaxsearch.partners.agoda.com/pages/agoda/default/waitpage.aspx";
	var objCID=1418964;
	var countryID=106;
    var cityID=16056;
    //var hotelID=5739;
	//var room = 1;
	//var adults = 2;
	//var children = 0;
	//var checkInDateString='5/10/2009';
    //var checkOutDateString='5/13/2009';
	var searchtype = "";
	var backlink = "";
	var headerlink = escape('http://www.phuketreport.com/header.html');
	var footerlink = escape('http://www.phuketreport.com/footer.html');
    var sidebarlink = "";
	var refurl=escape(document.URL);
	
	window.open(agoda_posturl+"?waitpage=hotel&fromInternal=1&cid="+objCID+"&countryID="+countryID+"&cityID="+cityID+"&HotelID="+hotelID+"&CheckIn="+checkInDateString+"&CheckOut="+checkOutDateString+"&Rooms="+room+"&Adults="+adults+"&Children="+children+"&searchtype="+searchtype+"&backlink="+backlink+"&refurl="+refurl+"&header="+headerlink+"&footer="+footerlink+"&sidebar="+sidebarlink);
}
function hotel_submit(value)// for login
		{
			
			var SelLocation=document.getElementById("SelLocation");
			var hotelcode=document.getElementById("hotelcode");
			var Day=document.getElementById("Day");
			var Mont=document.getElementById("Mont");
			var Year=document.getElementById("Year");
			var DayTo=document.getElementById("DayTo");
			var MontTo=document.getElementById("MontTo");
			var YearTo=document.getElementById("YearTo");
			
			var numadult=document.getElementById("numadult");
			var numchildren=document.getElementById("numchildren");
			var numrooms=document.getElementById("numrooms");
			var Night=document.getElementById("Night");
		
			var startdate=formatNumber(Year.value)+"-"+formatNumber(Mont.value)+"-"+formatNumber(Day.value);
			var enddate=formatNumber(YearTo.value)+"-"+formatNumber(MontTo.value)+"-"+formatNumber(DayTo.value);
			if(value==1){
		
			getdata("SerchResult.php?SelLocation=","main_content",SelLocation.value+"&hotelcode="+hotelcode.value+"&startdate="+startdate+"&enddate="+enddate+"&numadult="+numadult.value+"&numchildren="+numchildren.value+"&numrooms="+numrooms.value+"&night="+Night.value,' ');
			}
			else if(value==2)
			{
			var SelLocation1=document.getElementById("SelLocation1");
			var SortName=document.getElementById("SortName");
			var PerPage=document.getElementById("PerPage");
			
getdata("ajax_SerchResult.php?SelLocation=","ajax_SerchResult",SelLocation1.value+"&hotelcode="+hotelcode.value+"&startdate="+startdate+"&enddate="+enddate+"&numadult="+numadult.value+"&numchildren="+numchildren.value+"&numrooms="+numrooms.value+"&night="+Night.value+"&SortName="+SortName.value+"&PerPage="+PerPage.value,' ');
			}
			else if(value==3){
				
			getdata("SerchResult.php?SelLocation=","main_content",SelLocation.value+"&hotelcode="+hotelcode.value+"&startdate="+startdate+"&enddate="+enddate+"&numadult="+numadult.value+"&numchildren="+numchildren.value+"&numrooms="+numrooms.value+"&night="+Night.value,'2');
			}
			else if(value==4)
			{
			var SelLocation1=document.getElementById("SelLocation1");
			var SortName=document.getElementById("SortName");
			var PerPage=document.getElementById("PerPage");
			
getdata("ajax_SerchResult.php?SelLocation=","ajax_SerchResult",SelLocation1.value+"&hotelcode="+hotelcode.value+"&startdate="+startdate+"&enddate="+enddate+"&numadult="+numadult.value+"&numchildren="+numchildren.value+"&numrooms="+numrooms.value+"&night="+Night.value+"&SortName="+SortName.value+"&PerPage="+PerPage.value,'2');
			}
		}
		
function change_reservation(max_person)
		{
			var citycode=document.getElementById("citycode");
			var hotelcode=document.getElementById("hotelcode");
			var Day=document.getElementById("Day");
			var Mont=document.getElementById("Mont");
			var Year=document.getElementById("Year");
			var DayTo=document.getElementById("DayTo");
			var MontTo=document.getElementById("MontTo");
			var YearTo=document.getElementById("YearTo");
			
			var numadult=document.getElementById("numadult");
			var numchildren=document.getElementById("numchildren");
			var numrooms=document.getElementById("numrooms");
			var Night=document.getElementById("Night");
		
			var startdate=formatNumber(Year.value)+"-"+formatNumber(Mont.value)+"-"+formatNumber(Day.value);
			var enddate=formatNumber(YearTo.value)+"-"+formatNumber(MontTo.value)+"-"+formatNumber(DayTo.value);
			
			var person=parseInt(numadult.value)+parseInt(numchildren.value);
			var TotalRooms=parseInt(numrooms.value*max_person);
			if(person>TotalRooms)
			alert("Sory ,We can reserve max person per room more "+max_person+" person");
			else{
			getbooking("../agodaengine.php?citycode="+citycode.value+"&hotelcode="+hotelcode.value+"&startdate="+startdate+"&enddate="+enddate+"&numadult="+numadult.value+"&numchildren="+numchildren.value+"&numrooms="+numrooms.value,Night.value,hotelcode.value,startdate,enddate,numadult.value,numchildren.value,numrooms.value,0);
			document.getElementById("HBooking").style.backgroundColor="#c1d7e4";
			document.getElementById("HInfo").style.backgroundColor="#eee";
			document.getElementById("HAmenities").style.backgroundColor="#eee";
			document.getElementById("HMap").style.backgroundColor="#eee";
			document.getElementById("HImage").style.backgroundColor="#eee";
			}
			//getbooking("../agodaengine.php?hotelcode=<?= $_GET[hotelcode]?>&startdate=<?= $_GET[startdate]?>&enddate=<?= $_GET[enddate]?>&numadult=<?= $_GET[numadult]?>&numchildren=<?= $_GET[numchildren]?>&numrooms=<?= $_GET[numrooms]?>",<?= $_GET[night]?>);
		
		}
function book_hotel(citycode,hotelcode,startdate,enddate,numadult,numchildren,numrooms,night,totalhotel_img)
{
	
	if(startdate!="-1" && enddate!="-1" && numadult!="-1" && numchildren!="-1" && numrooms!="-1" && night!="-1")
	getbooking("../agodaengine.php?citycode="+citycode+"&hotelcode="+hotelcode+"&startdate="+startdate+"&enddate="+enddate+"&numadult="+numadult+"&numchildren="+numchildren+"&numrooms="+numrooms,night,hotelcode,startdate,enddate,numadult,numchildren,numrooms,totalhotel_img);
	//else
	//alert(enddate);
}
function ChangeCurrency(value)
{

	getCurrency("../agodacurrency.php?currency_abbr="+value,value);
	
}
function show_popup(index,txt)
{
/*var p=window.createPopup();
var pbody=p.document.body;
pbody.style.backgroundColor="lime";
pbody.style.border="solid black 1px";
pbody.innerHTML=txt;
p.show(150,150,200,50,document.body);*/
if(txt=="CLOSE")
document.getElementById("mydiv["+(index)+"]").innerHTML="";
else{
document.getElementById("mydiv["+(index)+"]").innerHTML="<div style=\"position:absolute;border:#000000 solid 1px;background-color:#99FF33;margin-left:-20px;width:300px;\">"+txt+"</div><div style=\"position:absolute;border:#000000 solid 1px;background-color:#636363;margin-left:-20px;width:300px;\" ><span class='style10' style='cursor:pointer;' onclick=\"show_popup("+index+",'CLOSE')\">CLOSE</span></div>";
}
}

