// JavaScript Document
var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip
var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).
document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="http://www.abcthailandhotels.com/images/arrow2.gif">') //write out pointer image
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
//if (ie||ns6)
//var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
//var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""


	if(document.getElementById) {
		var tipobj=document.getElementById("dhtmltooltip");
		var pointerobj=document.getElementById("dhtmlpointer");
	} else {
		var tipobj=document.all("dhtmltooltip");
		var pointerobj=document.all("dhtmlpointer");
	}
		

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}
function isNull(val){return(val==null);}
function isdefined(a) {
  return typeof a == 'undefined';
}
var thetext;
function ShowExBed(whereidAD, whereidCH, XrateAD, XrateCH){
loadcookie();
var currencyValue;
var popCurrValue;
var currencyVal=cookieval.innerHTML;
if(isdefined(currencyVal)){ currencyVal="us";}
if(currencyVal==""){ currencyVal="us";}
//alert(currencyVal);
if(isNull(currencyVal)){ currencyVal="us";}
	if(currencyVal=="au"){
		popCurrValue="AUD";
		currencyValue=auRate;
	}
	if(currencyVal=="eu"){
		popCurrValue="EUR";
		currencyValue=euRate;
	}
	if(currencyVal=="hk"){
		popCurrValue="HKD";
		currencyValue=hkRate;
	}
	if(currencyVal=="jp"){
		popCurrValue=unescape("%A5");
		currencyValue=jpRate;
	}
	if(currencyVal=="ru"){
		popCurrValue="RUR";
		currencyValue=ruRate;
	}
	if(currencyVal=="sg"){
		popCurrValue="SGD";
		currencyValue=sgRate;
	}
	if(currencyVal=="th"){
		popCurrValue="THB";
		currencyValue=thRate;
	}
	if(currencyVal=="uk"){
		popCurrValue=unescape("%A3");
		currencyValue=ukRate;
	}
	if(currencyVal=="us"){
		popCurrValue="$";
		currencyValue=usRate;
	}
	if(currencyVal=="aed"){
		popCurrValue="AED";
		currencyValue=aedRate;
	}
if(XrateAD==0){
	XrateADVal="N/A";
}else{
	XrateADVal=doRound(XrateAD,currencyValue,popCurrValue);
}
if(XrateCH==0){
	XrateCHVal="N/A";
}else{
	XrateCHVal=doRound(XrateCH,currencyValue,popCurrValue);
}
thetext="<div id=extrarateDiv><b>Extra Bed Rate</b><br>Adult : <span id=Xrate"+whereidAD+">"+XrateADVal+"<br>Child : <span id=Xrate"+whereidCH+">"+XrateCHVal+"</div>"
if (ns6||ie){
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20
var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY
var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}
//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}
function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
document.onmousemove=positiontip

function showTemplate_old(id){
	var textinfo='';
	textinfo+='<table border="0" width="300" id="table1" cellspacing="0" cellpadding="0" style="border: 1px solid #6699FF">';
	textinfo+='<tr>';
	textinfo+='<td colspan="2" bgcolor="#D7E9E3" valign="top">';
	textinfo+='<p style="margin: 2px" align="center"><span lang="en-us">';
	textinfo+='<font style="font-weight: bold; font-size: 9pt; font-family: Arial, Helvetica, sans-serif" color="#000000">';
	textinfo+='<b>'+hotelname[id]+'</b>';
	textinfo+='</font>';
	textinfo+='<font color="#FFCC00" face="Arial, Helvetica, sans-serif" style="font-size: 9pt; font-weight: 700">'+hotelclass[id]+'</font></span></td>';
	textinfo+='	</tr>';
	textinfo+='	<tr>';
	textinfo+='<td bgcolor="#FFFFFF" width="71" valign="top" height="53">';
	textinfo+='<p align="center">';
	textinfo+='<img border="0" src="'+hotelimg[id]+'" width="'+hotelwidth[id]+'" height="'+hotelheight[id]+'"><br>';
	textinfo+='<font face="Arial" style="font-size: 8pt; font-weight: 700">Rate from<br>'+hotelratefrom[id]+'</font></td>';
	textinfo+='<td bgcolor="#FFFFFF" width="220" valign="top" height="53">';
	textinfo+='<p style="margin: 5px">';
	textinfo+=''+hoteldetail[id]+'';
	textinfo+='</td>';
	textinfo+='	</tr>';
	textinfo+='</table>';
//	return textinfo;
	ddrivetip(textinfo);
}

var xmlHttp;
var xmlHttp2;
var xmlHttp3;

//var g_URL="http://"+document.domain+"/"
var g_URL=""+document.location;
var ig=g_URL.lastIndexOf("/");
if(ig>=0)g_URL=g_URL.substring(0,ig+1);
	
function showTemplate(htl)
{
if (htl.length==0)
  { 
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return htldesc;
  } 
var url=URL_LINK+"xml/abc/gethoteldescription.asp";
//using get method
//var str=hotelcode[htl];
url=url+"?htl="+htl+"&rid="+REMOTE_ID+"&sid="+SESSION_ID;
//url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
//setTimeout(return htldesc, 500);
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
var str=xmlHttp.responseText;
str.replace(/'/g, "&rsquo;");
ddrivetip(str);
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function gohotel(htl) {

	document.fh.htl.value=htl;	
	document.fh.target="_self";
	document.fh.method = "post";
	document.fh.action = URL_LINK+"gohotel.asp";	
	document.fh.submit();
	
}

function gethotelpromotion(ar) {
if (ar.length==0)
  { 
  return;
  }
xmlHttp2=GetXmlHttpObject()
if (xmlHttp2==null)
  {
  alert ("Your browser does not support AJAX!");
  return htldesc;
  } 
var url=URL_LINK+"xml/abc/gethotelpromotion.asp";
//using get method
//var str=hotelcode[htl];
var str="ar="+encodeURIComponent(ar)+"&rid="+encodeURIComponent(REMOTE_ID)+"&sid="+(SESSION_ID);
//url=url+"&sid="+Math.random();
xmlHttp2.onreadystatechange=promotion_stateChanged;
xmlHttp2.open("POST",url,true);
xmlHttp2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 
xmlHttp2.send(str);
//setTimeout(return htldesc, 500);
} 


function promotion_stateChanged() 
{ 
if (xmlHttp2.readyState==4)
{ 
document.getElementById("hotel_promotion").innerHTML=xmlHttp2.responseText;
}
}

function showhotelPromotion(ar) {

	setTimeout("gethotelpromotion('"+ar+"')", 1500);
	
}

function gethotel_arealist(ar) {
if (ar.length==0)
  { 
  return;
  }
xmlHttp2=GetXmlHttpObject()
if (xmlHttp2==null)
  {
  alert ("Your browser does not support AJAX!");
  return htldesc;
  } 
var url=URL_LINK+"xml/abc/gethotelarealist.asp";
//using get method
//var str=hotelcode[htl];
var str="ar="+encodeURIComponent(ar)+"&rid="+encodeURIComponent(REMOTE_ID)+"&sid="+(SESSION_ID);
str=str+"&htllist="+encodeURIComponent(document.fh.htllist.value);
//url=url+"&sid="+Math.random();
xmlHttp2.onreadystatechange=arealist_stateChanged;
xmlHttp2.open("POST",url,true);
xmlHttp2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 
xmlHttp2.send(str);
//setTimeout(return htldesc, 500);
} 


function arealist_stateChanged() 
{ 
if (xmlHttp2.readyState==4)
{ 
document.getElementById("hotel_promotion").innerHTML=xmlHttp2.responseText;
}
}

function showhotelarealist(ar) {

	setTimeout("gethotel_arealist('"+ar+"')", 1500);
	
}

function getareaDescription(ar)
{
if (ar.length==0)
  { 
  return;
  }
xmlHttp3=GetXmlHttpObject()
if (xmlHttp3==null)
  {
  alert ("Your browser does not support AJAX!");
  return htldesc;
  } 
var url=URL_LINK+"jsscript/description/"+ar+".txt";
//using get method
xmlHttp3.onreadystatechange=description_stateChanged;
xmlHttp3.open("GET",url,true);
xmlHttp3.send(null);
//setTimeout(return htldesc, 500);
} 

function description_stateChanged() 
{ 
if (xmlHttp3.readyState==4)
{
var str=xmlHttp3.responseText;
str.replace(/'/g, "&rsquo;");
str.replace(/-/g, "&#45;");
document.getElementById("area_description").innerHTML=str; 
}
}

function showareaDescription(ar) {

	setTimeout("getareaDescription('"+ar+"')", 500);
	
}

function showmap(ar) {

//eval("document.getElementById(""td_map"").style.background=""url(http://admin.calypsosystem.com/xml/images/maps/thailand/chatuchak-map.gif) no-repeat"";document.getElementById(""map_area"").innerHTML=""<img src='images/blank.gif' width='490' height='640' border='0' usemap='#Map' />"";");

	setTimeout("getmap('"+ar+"')", 1000);
			
}

function getmap_post(ar) {
if (ar.length==0)
  { 
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return htldesc;
  } 
var url=URL_LINK+"xml/abc/ar_"+ar+".asp";
//using get method
//var str=hotelcode[htl];
var str="ar="+encodeURIComponent(ar)+"&rid="+encodeURIComponent(REMOTE_ID)+"&sid="+encodeURIComponent(SESSION_ID);
//url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=map_stateChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 
xmlHttp.send(str);
//setTimeout(return htldesc, 500);
} 

function getmap(ar) {
if (ar.length==0)
  { 
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return htldesc;
  } 
var url=URL_LINK+"xml/abc/ar_"+ar+".asp";
xmlHttp.onreadystatechange=map_stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function map_stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
eval(xmlHttp.responseText);
}
}

function showtravelguide(id) {

	gettravelguide(id);
	
//var url="http://www.tourismthailand.org/destinationguide/information_services.php?id="+id;
//	document.getElementById("frame1").src=url;

//document.getElementById("travel_guide").innerHTML=eval(document.write("<P style=\"TEXT-ALIGN: justify\" align=justify><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: Verdana\"><IMG alt=\"\" hspace=0 src=\"http://www.tourismthailand.org/upload/Destination/library/amnart_charoen.jpg\" align=baseline border=0><BR><IMG height=158 src=\"http://www.tourismthailand.org/upload/Destination/library/amGeneralInfo.jpg\" width=225 align=right border=0>&nbsp;&nbsp;</SPAN><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: Verdana\">&nbsp;</SPAN></P> <P style=\"TEXT-ALIGN: justify\" align=justify><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: Verdana\">&nbsp;&nbsp; <STRONG><FONT color=#003399>Amnart Charoen</FONT></STRONG> is located in the south of&nbsp;northern plateau approximately 583 kilometres from Bangkok. It is a newly established province upgraded from Amphur Amnart Charoen of Ubon Ratchathani Province in 1993.</SPAN></P> <P style=\"TEXT-ALIGN: justify\" align=justify><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: Verdana\">&nbsp;&nbsp; The province is divided into the following districts: <EM>Muang, Chanuman, Phana, Hua Taphan, Senangkhanikhom, Pathum Ratchawongsa and Lue Amnart</EM>.</SPAN></P> <P>&nbsp;</P> <TABLE cellSpacing=0 cellPadding=0 width=\"88%\" align=center border=0> <TBODY> <TR> <TD background=http://www.tourismthailand.org/upload/Destination/library/white_dot.gif> <P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: Verdana\"><IMG alt=\"\" hspace=0 src=\"http://www.tourismthailand.org/upload/Destination/library/white_dot.gif\" align=baseline border=0></SPAN></P></TD></TR></TBODY></TABLE> <P style=\"TEXT-ALIGN: justify\" align=justify>&nbsp;</P><br>Source by <a href=\"http://www.tourismthailand.org\" target=\"_blank\">TourismThailand.org</a> " ););	
	
//document.getElementById("travel_guide").innerHTML=eval(document.write('<script language="JavaScript" src="http://www.tourismthailand.org/destinationguide/information_services.php?id=00000011" type="text/JavaScript"></script>');

}

function gettravelguide(id) {
if (id.length==0)
  { 
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return htldesc;
  } 
var url=URL_LINK+"script/gettravelguide.asp"
url=url+"?id="+id+"&rid="+REMOTE_ID+"&sid="+SESSION_ID;
xmlHttp.onreadystatechange=travelguide_stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function travelguide_stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("travel_guide").innerHTML=xmlHttp.responseText;
}
}

function showTemplatearea(ar) {

ar="ar_"+ar;
ddrivetip(eval(ar));

}

function qsearch() {

	var frm=document.fq;
	var frm1=document.fq1;
	
	if (frm.o_cri.value=="") {
		alert("Please enter a criteria.");
	} else {
	frm1.quick.value="Y";
	frm1.page.value=1;
	frm1.cri.value=frm.o_cri.value;
	frm1.o_cri.value=frm.o_cri.value;
	frm1.sortby.value=3;
	frm1.target="_top";
	frm1.method="post";
	frm1.action=URL_LINK+"quicksearch.asp";
	frm1.submit();
	}
	
}

function go_quick() {

	var frm=document.fq;
	
	if (frm.o_cri.value=="") {
		alert("Please enter a criteria.");
		return (false);
	} else {
	frm.quick.value="Y";
	frm.page.value=1;
	frm.cri.value=frm.o_cri.value;
	frm.sortby.value=3;
	frm.target="_top";
	frm.method="post";
	frm.action=URL_LINK+"quicksearch.asp";
	return (true);
	}
	
}

function GoSort_q(i) {

	var frm=document.fq1;
	
	frm.sortby.value=i;
	frm.target="_top";
	frm.method="post";
	frm.action=URL_LINK+"quicksearch.asp";
	frm.submit();
	
}

function GoPage_q(p) {

	var frm=document.fq1;
	
	frm.page.value=p;
	frm.target="_top";
	frm.method="post";
	frm.action=URL_LINK+"quicksearch.asp";
	frm.submit();
	
}

function go_dst(fdst) {

	if (fdst.dst[fdst.dst.selectedIndex].value=="") {
		alert("Please select a destination.");
		fdst.dst.focus();
	} else {
		var lnk=URL_LINK+fdst.dst[fdst.dst.selectedIndex].value+".asp";
		window.location.replace(lnk);
	}
	
}

function GoCheckHtl(fhtl) {

	fhtl.indate.value=fhtl.indate_cal.value;
	fhtl.outdate.value=fhtl.outdate_cal.value;
	fhtl.indate_DMY_ID.value=fhtl.indate_cal.value;
	fhtl.outdate_DMY_ID.value=fhtl.outdate_cal.value;

	if (fhtl.indate.value=="") {
		alert("Please select a check in date.");
		}
	else if (fhtl.outdate.value=="") {
		alert("Please select a check out date.");
		}
	else if (fhtl.city.selectedIndex==0) {
			alert("Please select a city.");
			fhtl.city.focus();
		}
		else {
		fhtl.target="_top";
		fhtl.method = "post";
		fhtl.action = URL_LINK+"searchhotel.asp";	
		fhtl.submit();
		}
		
}

function GoCheckRate()
{

	var frm1 = document.fhtl;
	frm1.indate.value=frm1.indate_cal.value;
	frm1.outdate.value=frm1.outdate_cal.value;
	frm1.indate_DMY_ID.value=frm1.indate_cal.value;
	frm1.outdate_DMY_ID.value=frm1.outdate_cal.value;
	
	if (document.fhtl.indate.value=="") {
		alert("Please select a check in date.");
	}
	else if (document.fhtl.outdate.value=="") {
		alert("Please select a check out date.");
	}
		else {
		document.fhtl.target="_top";
		document.fhtl.method = "post";
		document.fhtl.action = URL_LINK+"checkrm.asp";
		document.fhtl.submit();	
		}
}

function GoSort_h(i) {

	var frm=document.fhtl_1;
	
	frm.sortby.value=i;
	frm.target="_top";
	frm.method="post";
	frm.action=URL_LINK+"searchhotel.asp";
	frm.submit();
	
}

function GoPage_h(p) {

	var frm=document.fhtl_1;
	
	frm.page.value=p;
	frm.target="_top";
	frm.method="post";
	frm.action=URL_LINK+"searchhotel.asp";
	frm.submit();
	
}

function GoSort_c(i) {

	var frm=document.fhtl_1;
	
	frm.sortby.value=i;
	frm.target="_top";
	frm.method="post";
	frm.action=frm.lnk.value;
	frm.submit();
	
}

function GoPage_c(p) {

	var frm=document.fhtl_1;
	
	frm.page.value=p;
	frm.target="_top";
	frm.method="post";
	frm.action=frm.lnk.value;
	frm.submit();
	
}

function Go_Book(htl, nme, rating) {

	var frm1 = document.fhtl_1;

	frm1.hotel_code.value=htl;
	frm1.hotel.value=nme;
	frm1.rating.value=rating;
	frm1.target="_self";
	frm1.method = "post";
	frm1.action = URL_LINK+"checkrm.asp";	
	frm1.submit();
}

function GoHotel(htl) {

	var frm1 = document.fhtl_1;

	frm1.htl.value=htl;
	frm1.target="_top";
	frm1.method="post";
	frm1.action=URL_LINK+"gohotel.asp";
	frm1.submit();
}

function Go_Room(rmt, occ) {

	document.f1.roomtype.value=rmt;
	document.f1.occ.value=occ;
	document.f1.target="_top";
	document.f1.method = "post";
	document.f1.action = URL_LINK+"checkrate_n1.asp";	
	document.f1.submit();
	
}