<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<title>Hotel list provide by R24</title>
<meta content="en-us" http-equiv="Content-Language">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<style type="text/css">
.r24hotellist1 {width:970px; margin:0 auto; font-family:Arial, Helvetica, sans-serif;}
.r24hotellist1 .hotellisting {height:350px; border:1px #C0C0C0 solid; overflow:scroll;} /* change to hidden to remove scrollbars */
.r24hotellist1 .hotelimg {border:1px #C0C0C0 solid; padding:3px; margin-right:10px; float:left;}
.r24hotellist1 ul {margin:0; padding:0;}
.r24hotellist1 li {list-style:none; margin:0 5px; padding:10px 0; width:460px; float:left; border-bottom:1px #C0C0C0 dotted;}
.r24hotellist1 .hotelname, .r24hotellist1 .hotelname:visited {color:blue; font-weight:bold; text-decoration:none;}
.r24hotellist1 .hotelname:hover {color:red; text-decoration:underline;}
.r24hotellist1 a.linkdetail, .r24hotellist1 a.recommend {color:white; font-weight:bold; padding:3px 5px; text-decoration:none; font-size:11px;}
.r24hotellist1 a.linkdetail {background-color:#0099FF;}
.r24hotellist1 a.linkdetail:hover {background-color:gray;}
.r24hotellist1 .recommend {color:red; font-style:italic; font-size:14px;}
</style>
</head>


<?php
$today = getdate();
$monnam = array ("Jan.","Feb.","Mar.","Apr.","May", "Jun.","Jul.","Aug.","Sep.","Oct.","Nov.", "Dec.");
function date2stay ($d,$m,$y) { if (!$y) list($y,$m) = explode(",",$m); return sprintf("%4s-%'02s-%'02s",$y,$m,$d); }
$stay = $_REQUEST['date11'] ? date2stay($_REQUEST['date11'],$_REQUEST['date12'],"") ."/". date2stay($_REQUEST['date21'],$_REQUEST['date22'],"") : "";
if ($stay)
{ $stay0 = strtr(trim($stay),"/*","~~"); list($d1, $d2) = explode("~", $stay0);
$today1 = getdate(strtotime($d1)); $today2 = getdate(strtotime($d2));
$stay = date("Y-m-d",strtotime($d1))."~".date("Y-m-d",strtotime($d2));
}
if (!$stay || $today[0] >= $today1[0])
{ $today1 = getdate(strtotime("+1 days")); $today2 = getdate(strtotime("+2 days"));
$stay = date("Y-m-d",strtotime("+1 days"))."~".date("Y-m-d",strtotime("+2 days"));
}

$partner = $_REQUEST['p'] ? $_REQUEST['p'] : "AGENCY.DOMAIN"; # replace it by your R24-registered domain name. Required.
$defcur = $_REQUEST['cur'] ? $_REQUEST['cur'] : "THB"; # optional. To set a DEFAULT currency.
#$province = $_REQUEST['pv'] ? $_REQUEST['pv'] : "01"; # optional. Use province code instead of province (alternative to 'province' parameter).
#$region = $_REQUEST['r']; # optional. Use region code instead of region (alternative to 'region' parameter).
$location = $_REQUEST['loc']; # optional. Use the hotel location description. Example: $location = "silom"
$promote = $_REQUEST['promote']; # optional. To filter by recommended and promoted hotels $_REQUEST['promote'] $promote = "1";
$adult = $_REQUEST['person'] ? $_REQUEST['person'] : 2;
$child = $_REQUEST['person2'] ? $_REQUEST['person2'] : 0;
$lg = "en"; # optional. To set a DEFAULT language. en,th,de
$sorting = "name"; # optional. To set a DEFAULT sorting &s=[-]region,name,location,rate,hno. Example: $sorting = "location,-rate" (default)
# &s=[-]region,name,location,rate,hno
# sort result by one or more of the options above
# [-] is descending, otherwise ascending.

$url3 = "http://th.R24.org/xmlR24.php?p=".$partner."&r=".$region."&c=".$defcur."&v=".$province."&kl=".$location."&s=".$sorting."&d=".$stay;
$xml3 = @simplexml_load_file($url3) or die("Sorry, can't open this: ".$url3);
?>



<body>
<div class="r24hotellist1">
<div id="modhotellist1navi" class="hotellisting">
<ul>
<?php foreach ($xml3->hotel as $hotel) { # loop for display hotel list
if ($promote == "1") { if ($hotel->promote == '') continue; } # check for hotel which have promotion
$attr = $hotel['hno'];
?>
<li><img alt="" class="hotelimg " height="100" src="http://th.r24.org/R24pic.php?i=icon&x=150&y=100&h=<?php echo $attr;?>" width="150">
<div style="height:90px">
<a href="<?php echo $hotel->hotellink2; ?>&lg=<?php echo $lg; ?>&stay=<?php echo $stay;?>&cur=<?php echo $defcur;?>&adult=<?php echo $adult;?>&child=<?php echo $child;?>" class="hotelname"><?php echo $hotel->hotelname; ?>
</a><br><span style="font-size:11px"><strong>Location : </strong><?php echo $hotel->location; ?><br>
<strong>Destination : </strong><?php echo ucfirst($hotel->region); ?>
<br><strong>Rates From : </strong><span style="color:red"><?php echo $hotel->minrate." ".$hotel->minrate['cur']; ?></span><br>
<strong>Breakfast : </strong><?php echo ($hotel->breakfast == "incl") ? "YES" : "NO"; ?>
</span></div>
<a href="<?php echo $hotel->hotellink2; ?>&lg=<?php echo $lg; ?>&stay=<?php echo $stay;?>&cur=<?php echo $defcur;?>&adult=<?php echo $adult;?>&child=<?php echo $child;?>" class="linkdetail">Book Now</a>
<a href="R24reviews.php?h=<?php echo $attr;?>&p=<?php echo $partner;?>" class="linkdetail">Reviews</a>
<?php if ($hotel->promote != '') { ?>
<span class="recommend"><?php echo ($hotel->promote == "recommend") ? "Recommended" : ""; ?></span>
<?php } ?>
</li>

<?php } /* foreach */ ?>
</ul>
</div>

<div style="clear:both">
<input name="pgfirst" id="pgfirst" type="button" value="first page">
<input name="pgprev" id="pgprev" type="button" value="prev. page">
<input name="pgnext" id="pgnext" type="button" value="next page" style=" font-weight:bold">
<input name="pglast" id="pglast" type="button" value="last page">
</div>

</div>


<script type="text/javascript">
var mod_objid;
function onload_R24hotellist1navi(objid)
{ var p;
mod_objid = document.getElementById(objid);
if (p = document.getElementById('pgfirst')) p.onclick=function(){ mod_objid.scrollTop = 0; return false }
if (p = document.getElementById('pgprev')) p.onclick=function(){ mod_objid.scrollTop -= 500; return false }
if (p = document.getElementById('pgnext')) p.onclick=function(){ mod_objid.scrollTop += 500; return false }
if (p = document.getElementById('pglast')) p.onclick=function(){ mod_objid.scrollTop = mod_objid.scrollHeight; return false }
}
onload_R24hotellist1navi('modhotellist1navi');
</script>


</body>
</html>