	<?php
	$tmp = $thisUrl."adm1n/functions/php_functions.php";
	include ($tmp);
	

	$id = (isset($_REQUEST["id"]) ? $_REQUEST["id"] : null);
    if ($id) {
		echo '
		<div class="rowInner">
			<div class="col l-col12 m-col12 s-col12">
				<div class="teasers">
					<div class="col l-col12 m-col12 s-col12 effect8" style="background-color:#cc3333; padding:30px">
					<div style="margin-bottom:15px;" class="teasers">
						<h2 style="margin-bottom:25px; color:#ffffff;">HOW TO BOOK?</h2>
						<h2 style="margin:0; width:100%; display:block; padding:0; font-weight:normal; color:#ffffff;">
							For direct booking, please contact <br>your preferred hotel\'s contact person as listed below, 
						</h2>
					</div>
					</div>
					<p>
						<img class="spacerRowImage" src="'.$thisPage.'images/spacer-bg.png" alt="" title="">
					</p>
				</div>
			</div>
		</div>';
		include ("hotel_list_detil.php");	
	} else {
		
		$sql2 = 
		" select idKategoriHotel, idKategoriName ".
		" from hotel_list_kategori ";
		if ($hasil2 = mysql_query($sql2)) {
			if (mysql_num_rows($hasil2) > 0) {
				$array_tab = array ();
				while ($data2 = mysql_fetch_array($hasil2)) {
					$array_tab[$data2["idKategoriHotel"]] = $data2["idKategoriName"];
				}
			}
		}

		$function_ = function ($key) {
			global $thisPage, $curPage;
			$table = ""; $ctr = 1; 
			$mobile_view = '<tr valign="top" style="border:0; margin:0; padding:0">';
			$sql2 = 
			" SELECT hotelID, kategori, hotelName, rating, idKategoriName, ".
			" hotelImageName, to_hotel_id, idKategoriHotel, maxwidth ".
			" FROM hotel_list, hotel_list_images, hotel_list_kategori ".
			" WHERE to_hotel_id = hotelID ".
			" AND kategori = idKategoriHotel ".
			" AND idKategoriHotel = '".$key."' ".
			" ORDER BY kategori asc, rating desc, hotelORDER ASC ";
			//return '<p>Sql: '.$sql2.'</p>';			
			if ($hasil2 = mysql_query($sql2)) {
				if (mysql_num_rows($hasil2) > 0) {
					while ($data2 = mysql_fetch_array($hasil2)) {
						if (!isset(${"column$ctr"})) ${"column$ctr"} = ''; //else ${"column$ctr"} .= '|';
						//<a class=""  data-teaserId="M00601"></a>
						$linkImage = "window.location.href='".$thisPage.$curPage."?id=".$data2["hotelID"]."'";
						$thisImage = '
						<div onclick="'.$linkImage.'" class="menuDiv effect8 teaserTextBlock" style="cursor:pointer; text-align:center;">
							<div class="img-frame">';
								if (isset($data2["hotelImageName"])) {
									$imageName = $thisPage.$curPage.'images/'.$data2["hotelImageName"];
									//echo "<br>imageName: ".$imageName;
									$thisImage .= '
									<img style="'.(isset($data2["maxwidth"]) ? 'max-width:'.$data2["maxwidth"].'px' : '').'" src="'.$imageName.'" border="0" />';
								} else {
									$thisImage .= '
									<img src="'.$thisPage.'images/no-image-slide.png" border="0" />';
								}
								$thisImage .= '
							</div>
							<div class="rating">';
								for($i=1; $i<=(int)$data2["rating"]; $i++) {
									$thisImage .= '
									<span>&#9734;</span>';
								}
								$thisImage .= '	
							</div>
							<h3 style="line-height:normal; padding:2px 12px">
								'.strtoupper($data2["hotelName"]).'
							</h3>
						</div>';

						${"column$ctr"} .= $thisImage.'<div style="clear:both; display:block; margin:0; padding:0px 0px 15px 0px"></div>';
						
						$stylePadd = 'style="border:0; margin:0; padding:0px 0px 15px 0px"';
						if ($ctr == 2 || $ctr == 4) {
							$stylePadd = 'style="border:0; margin:0; padding:0px 0px 15px 20px"';
						}
						
						$mobile_view .= '
						<td '.$stylePadd.'>'.$thisImage.'</td>';
						
						if ($ctr == 2 || $ctr == 4) {
							$mobile_view .= '
							</tr><tr valign="top" style="border:0; margin:0; padding:0">';
						}
						
						if ($ctr == 4) $ctr = 0;
						$ctr++;
					}
				}
			}			
			
			$table = '
			<table width="100%" class="hide-for-small" style="width:100%; border:0; margin:0; padding:0">
				<tr valign="top" style="border:0; margin:0; padding:0">
					<td width="25%" style="width:25%; border:0; margin:0; padding:0">'.$column1.'</td>
					<td width="25%" style="width:25%; border:0; margin:0; padding:0 0px 0px 20px">'.$column2.'</td>
					<td width="25%" style="width:25%; border:0; margin:0; padding:0 0px 0px 20px">'.$column3.'</td>
					<td width="25%" style="width:25%; border:0; margin:0; padding:0 0px 0px 20px">'.$column4.'</td>
				</tr>	
			</table>
			<table class="hide-for-medium-up" style="border:0; margin:0; padding:0">
				'.$mobile_view.'
			</table>';			
			return $table;
		};
		
		echo '
		<div class="col l-col12 m-col12 s-col12">
			<div class="tabsy">';
				foreach ($array_tab as $key => $value) {
					echo '
					<input type="radio" id="tab'.$key.'" name="tab" '.($key == 1 ? "checked" : "").'>
					<label style="margin:0;" class="tabButton" for="tab'.$key.'">'.$value.'</label>
					<div class="tab">
						<div class="content">	
							<h2 style="padding:10px 0px 0px 0px">'.strtoupper($value).'</h2>
							'.$function_($key).'
						</div>
					</div>';
				}
				echo '
			</div>
		</div>';
	}
		
		/** 
		$ctr = 1;
		$kategori = '';
		$sql = 
		" select hotelID, kategori, hotelName, rating, idKategoriName, ".
		" hotelImageName, to_hotel_id, idKategoriHotel, maxwidth " .
		" from hotel_list, hotel_list_images, hotel_list_kategori ".
		" where to_hotel_id = hotelID " .
		" and kategori = idKategoriHotel " .
		" order by kategori asc, rating desc, hotelORDER asc ";
		$max = mysql_num_rows(mysql_query($sql));
		$perhalaman = 120;
		$page = (isset($_SESSION['page']) ? $_SESSION['page'] : isset($_REQUEST["page"]) ? $_REQUEST["page"] : null);
		//if (!$page) $page = $_REQUEST["page"];
		if ($page){
			$start=($page - 1) * $perhalaman;
		} else {
			$start=0;
		}
		//$sql .= " LIMIT 0,3 ";
		$sql .= " LIMIT $start, $perhalaman ";
		if ($hasil = mysql_query($sql)) {
			if (mysql_num_rows($hasil) > 0) {
				while ($data = mysql_fetch_array($hasil)) {
					if (!isset(${"column$ctr"})) ${"column$ctr"} = ''; else ${"column$ctr"} .= '|';
					${"column$ctr"} = '
					<div class="col l-col3 m-col6 s-col6">
						<a href="'.$thisPage.$curPage.'?id='.$data["hotelID"].'" data-teaserId="M00601" title="">';
							${"column$ctr"} .= '
							<div class="menuDiv effect8 teaserTextBlock" style="text-align:center;">
								<div class="img-frame">';
									if (isset($data["hotelImageName"])) {
										$imageName = $thisPage.$curPage.'images/'.$data["hotelImageName"];
										//echo "<br>imageName: ".$imageName;
										${"column$ctr"} .= '
										<img '.(isset($data["maxwidth"]) ? 'width="'.$data["maxwidth"].'"' : '').' src="'.$imageName.'" border="0" />';
									} else {
										${"column$ctr"} .= '
										<img src="'.$thisPage.'images/no-image-slide.png" border="0" />';
									}
									${"column$ctr"} .= '
								</div>
								<div class="rating">';
									for($i=1; $i<=(int)$data["rating"]; $i++) {
										${"column$ctr"} .= '
										<span>&#9734;</span>';
									}
									${"column$ctr"} .= '	
								</div>
								<h3 style="line-height:normal; padding:0px 8px">
									'.strtoupper($data["hotelName"]).'
								</h3>
							</div>
						</a>
						<div style="margin-bottom:2px;">&nbsp;</div>
					</div>'; 
					//echo '<p>column'.$ctr.': <br>'.${"column$ctr"}.'</p>';
					if ($kategori != $data["kategori"]) {
						if (!isset($dis_produk)) {
							$dis_produk = '
							<div class="col l-col12 m-col12 s-col12">
								<h2>'.$data["idKategoriName"].'</h1>
							</div>
							<div class="col l-col12 m-col12 s-col12">';
							
						} else {
							$dis_produk .= '
							</div>
							<div class="col l-col12 m-col12 s-col12">
								<p>
									<img class="spacerRowImage" src="'.$thisPage.'images/spacer-bg.png" alt="" title="">
									<br>
								</p>
								<h2>'.$data["idKategoriName"].'</h1>
							</div>
							<div class="col l-col12 m-col12 s-col12">';
						}
					}
					$dis_produk .= ${"column$ctr"};
					$kategori = $data["kategori"];
					
					if ($ctr == 4) $ctr = 0;
					$ctr++;
				}
			}
		}
	}
	if (isset($dis_produk)) {
		$dis_produk .= '
		</div>';
	}
	
	echo (isset($dis_produk) ? $dis_produk : '').'
	<section class="M00601 M0060101 teaserModule layout-centered" data-modul="M00601" style="background-color:#fff;">
		<div class="col l-col12 m-col12 s-col12">
			<div class="teasers">';
				$tmp = $thisUrl."functions/fungsi_paging.php";
				include($tmp);
				halaman($max, $perhalaman, 3, "?");
				echo '
			</div>
		</div>
		<div style="height:60px"></div>
	</section>';
	**/
	?>