<?php
session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg7.php" ?>
<?php include "ewmysql7.php" ?>
<?php include "phpfn7.php" ?>
<?php include "tbl_hotelinfo.php" ?>
<?php include "tbl_countryinfo.php" ?>
<?php include "tbl_languageinfo.php" ?>
<?php include "tbl_hotel_originalinfo.php" ?>
<?php include "tbl_admininfo.php" ?>
<?php include "tbl_provinceinfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Create page object
$tbl_hotel_list = new ctbl_hotel_list();
$Page =& $tbl_hotel_list;

// Page init
$tbl_hotel_list->Page_Init();

// Page main
$tbl_hotel_list->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($tbl_hotel->Export == "") { ?>
<script type="text/javascript">
<!--

// Create page object
var tbl_hotel_list = new ew_Page("tbl_hotel_list");

// page properties
tbl_hotel_list.PageID = "list"; // page ID
tbl_hotel_list.FormID = "ftbl_hotellist"; // form ID
var EW_PAGE_ID = tbl_hotel_list.PageID; // for backward compatibility

// extend page with Form_CustomValidate function
tbl_hotel_list.Form_CustomValidate =  
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }
<?php if (EW_CLIENT_VALIDATE) { ?>
tbl_hotel_list.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
tbl_hotel_list.ValidateRequired = false; // no JavaScript validation
<?php } ?>

//-->
</script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->

</script>
<?php } ?>
<?php if ($tbl_hotel->Export == "") { ?>
<?php
$gsMasterReturnUrl = "tbl_hotel_originallist.php";
if ($tbl_hotel_list->sDbMasterFilter <> "" && $tbl_hotel->getCurrentMasterTable() == "tbl_hotel_original") {
	if ($tbl_hotel_list->bMasterRecordExists) {
		if ($tbl_hotel->getCurrentMasterTable() == $tbl_hotel->TableVar) $gsMasterReturnUrl .= "?" . EW_TABLE_SHOW_MASTER . "=";
?>
<?php include "tbl_hotel_originalmaster.php" ?>
<?php
	}
}
?>
<?php
$gsMasterReturnUrl = "tbl_languagelist.php";
if ($tbl_hotel_list->sDbMasterFilter <> "" && $tbl_hotel->getCurrentMasterTable() == "tbl_language") {
	if ($tbl_hotel_list->bMasterRecordExists) {
		if ($tbl_hotel->getCurrentMasterTable() == $tbl_hotel->TableVar) $gsMasterReturnUrl .= "?" . EW_TABLE_SHOW_MASTER . "=";
?>
<?php include "tbl_languagemaster.php" ?>
<?php
	}
}
?>
<?php
$gsMasterReturnUrl = "tbl_countrylist.php";
if ($tbl_hotel_list->sDbMasterFilter <> "" && $tbl_hotel->getCurrentMasterTable() == "tbl_country") {
	if ($tbl_hotel_list->bMasterRecordExists) {
		if ($tbl_hotel->getCurrentMasterTable() == $tbl_hotel->TableVar) $gsMasterReturnUrl .= "?" . EW_TABLE_SHOW_MASTER . "=";
?>
<?php include "tbl_countrymaster.php" ?>
<?php
	}
}
?>
<?php
$gsMasterReturnUrl = "tbl_provincelist.php";
if ($tbl_hotel_list->sDbMasterFilter <> "" && $tbl_hotel->getCurrentMasterTable() == "tbl_province") {
	if ($tbl_hotel_list->bMasterRecordExists) {
		if ($tbl_hotel->getCurrentMasterTable() == $tbl_hotel->TableVar) $gsMasterReturnUrl .= "?" . EW_TABLE_SHOW_MASTER . "=";
?>
<?php include "tbl_provincemaster.php" ?>
<?php
	}
}
?>
<?php } ?>
<?php
	$bSelectLimit = EW_SELECT_LIMIT;
	if ($bSelectLimit) {
		$tbl_hotel_list->lTotalRecs = $tbl_hotel->SelectRecordCount();
	} else {
		if ($rs = $tbl_hotel_list->LoadRecordset())
			$tbl_hotel_list->lTotalRecs = $rs->RecordCount();
	}
	$tbl_hotel_list->lStartRec = 1;
	if ($tbl_hotel_list->lDisplayRecs <= 0 || ($tbl_hotel->Export <> "" && $tbl_hotel->ExportAll)) // Display all records
		$tbl_hotel_list->lDisplayRecs = $tbl_hotel_list->lTotalRecs;
	if (!($tbl_hotel->Export <> "" && $tbl_hotel->ExportAll))
		$tbl_hotel_list->SetUpStartRec(); // Set up start record position
	if ($bSelectLimit)
		$rs = $tbl_hotel_list->LoadRecordset($tbl_hotel_list->lStartRec-1, $tbl_hotel_list->lDisplayRecs);
?>
<p><span class="phpmaker" style="white-space: nowrap;"><?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $tbl_hotel->TableCaption() ?>
</span></p>
<?php if ($Security->IsLoggedIn()) { ?>
<?php if ($tbl_hotel->Export == "" && $tbl_hotel->CurrentAction == "") { ?>
<a href="javascript:ew_ToggleSearchPanel(tbl_hotel_list);" style="text-decoration: none;"><img id="tbl_hotel_list_SearchImage" src="images/collapse.gif" alt="" width="9" height="9" border="0"></a><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("Search") ?></span><br>
<div id="tbl_hotel_list_SearchPanel">
<form name="ftbl_hotellistsrch" id="ftbl_hotellistsrch" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<input type="hidden" id="t" name="t" value="tbl_hotel">
<table class="ewBasicSearch">
	<tr>
		<td><span class="phpmaker">
			<input type="text" name="<?php echo EW_TABLE_BASIC_SEARCH ?>" id="<?php echo EW_TABLE_BASIC_SEARCH ?>" size="20" value="<?php echo ew_HtmlEncode($tbl_hotel->getSessionBasicSearchKeyword()) ?>">
			<input type="Submit" name="Submit" id="Submit" value="<?php echo ew_BtnCaption($Language->Phrase("QuickSearchBtn")) ?>">&nbsp;
			<a href="<?php echo $tbl_hotel_list->PageUrl() ?>cmd=reset"><?php echo $Language->Phrase("ShowAll") ?></a>&nbsp;
		</span></td>
	</tr>
	<tr>
	<td><span class="phpmaker"><label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value=""<?php if ($tbl_hotel->getSessionBasicSearchType() == "") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("ExactPhrase") ?></label>&nbsp;&nbsp;<label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="AND"<?php if ($tbl_hotel->getSessionBasicSearchType() == "AND") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AllWord") ?></label>&nbsp;&nbsp;<label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="OR"<?php if ($tbl_hotel->getSessionBasicSearchType() == "OR") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AnyWord") ?></label></span></td>
	</tr>
</table>
</form>
</div>
<?php } ?>
<?php } ?>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$tbl_hotel_list->ShowMessage();
?>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<form name="ftbl_hotellist" id="ftbl_hotellist" class="ewForm" action="" method="post">
<div id="gmp_tbl_hotel" class="ewGridMiddlePanel">
<?php if ($tbl_hotel_list->lTotalRecs > 0) { ?>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<?php echo $tbl_hotel->TableCustomInnerHtml ?>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<?php

// Render list options
$tbl_hotel_list->RenderListOptions();

// Render list options (header, left)
$tbl_hotel_list->ListOptions->Render("header", "left");
?>
<?php if ($tbl_hotel->language_id->Visible) { // language_id ?>
	<?php if ($tbl_hotel->SortUrl($tbl_hotel->language_id) == "") { ?>
		<td><?php echo $tbl_hotel->language_id->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $tbl_hotel->SortUrl($tbl_hotel->language_id) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $tbl_hotel->language_id->FldCaption() ?></td><td style="width: 10px;"><?php if ($tbl_hotel->language_id->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($tbl_hotel->language_id->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($tbl_hotel->country_id->Visible) { // country_id ?>
	<?php if ($tbl_hotel->SortUrl($tbl_hotel->country_id) == "") { ?>
		<td><?php echo $tbl_hotel->country_id->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $tbl_hotel->SortUrl($tbl_hotel->country_id) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $tbl_hotel->country_id->FldCaption() ?></td><td style="width: 10px;"><?php if ($tbl_hotel->country_id->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($tbl_hotel->country_id->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($tbl_hotel->province_id->Visible) { // province_id ?>
	<?php if ($tbl_hotel->SortUrl($tbl_hotel->province_id) == "") { ?>
		<td><?php echo $tbl_hotel->province_id->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $tbl_hotel->SortUrl($tbl_hotel->province_id) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $tbl_hotel->province_id->FldCaption() ?></td><td style="width: 10px;"><?php if ($tbl_hotel->province_id->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($tbl_hotel->province_id->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($tbl_hotel->category->Visible) { // category ?>
	<?php if ($tbl_hotel->SortUrl($tbl_hotel->category) == "") { ?>
		<td><?php echo $tbl_hotel->category->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $tbl_hotel->SortUrl($tbl_hotel->category) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $tbl_hotel->category->FldCaption() ?></td><td style="width: 10px;"><?php if ($tbl_hotel->category->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($tbl_hotel->category->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($tbl_hotel->photo->Visible) { // photo ?>
	<?php if ($tbl_hotel->SortUrl($tbl_hotel->photo) == "") { ?>
		<td><?php echo $tbl_hotel->photo->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $tbl_hotel->SortUrl($tbl_hotel->photo) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $tbl_hotel->photo->FldCaption() ?></td><td style="width: 10px;"><?php if ($tbl_hotel->photo->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($tbl_hotel->photo->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($tbl_hotel->hotel_name->Visible) { // hotel_name ?>
	<?php if ($tbl_hotel->SortUrl($tbl_hotel->hotel_name) == "") { ?>
		<td><?php echo $tbl_hotel->hotel_name->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $tbl_hotel->SortUrl($tbl_hotel->hotel_name) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $tbl_hotel->hotel_name->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($tbl_hotel->hotel_name->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($tbl_hotel->hotel_name->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($tbl_hotel->order_by->Visible) { // order_by ?>
	<?php if ($tbl_hotel->SortUrl($tbl_hotel->order_by) == "") { ?>
		<td><?php echo $tbl_hotel->order_by->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $tbl_hotel->SortUrl($tbl_hotel->order_by) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $tbl_hotel->order_by->FldCaption() ?></td><td style="width: 10px;"><?php if ($tbl_hotel->order_by->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($tbl_hotel->order_by->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php

// Render list options (header, right)
$tbl_hotel_list->ListOptions->Render("header", "right");
?>
	</tr>
</thead>
<?php
if ($tbl_hotel->ExportAll && $tbl_hotel->Export <> "") {
	$tbl_hotel_list->lStopRec = $tbl_hotel_list->lTotalRecs;
} else {
	$tbl_hotel_list->lStopRec = $tbl_hotel_list->lStartRec + $tbl_hotel_list->lDisplayRecs - 1; // Set the last record to display
}
$tbl_hotel_list->lRecCount = $tbl_hotel_list->lStartRec - 1;
if ($rs && !$rs->EOF) {
	$rs->MoveFirst();
	if (!$bSelectLimit && $tbl_hotel_list->lStartRec > 1)
		$rs->Move($tbl_hotel_list->lStartRec - 1);
}

// Initialize aggregate
$tbl_hotel->RowType = EW_ROWTYPE_AGGREGATEINIT;
$tbl_hotel_list->RenderRow();
$tbl_hotel_list->lRowCnt = 0;
while (($tbl_hotel->CurrentAction == "gridadd" || !$rs->EOF) &&
	$tbl_hotel_list->lRecCount < $tbl_hotel_list->lStopRec) {
	$tbl_hotel_list->lRecCount++;
	if (intval($tbl_hotel_list->lRecCount) >= intval($tbl_hotel_list->lStartRec)) {
		$tbl_hotel_list->lRowCnt++;

	// Init row class and style
	$tbl_hotel->CssClass = "";
	$tbl_hotel->CssStyle = "";
	$tbl_hotel->RowAttrs = array('onmouseover'=>'ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);');
	if ($tbl_hotel->CurrentAction == "gridadd") {
		$tbl_hotel_list->LoadDefaultValues(); // Load default values
	} else {
		$tbl_hotel_list->LoadRowValues($rs); // Load row values
	}
	$tbl_hotel->RowType = EW_ROWTYPE_VIEW; // Render view

	// Render row
	$tbl_hotel_list->RenderRow();

	// Render list options
	$tbl_hotel_list->RenderListOptions();
?>
	<tr<?php echo $tbl_hotel->RowAttributes() ?>>
<?php

// Render list options (body, left)
$tbl_hotel_list->ListOptions->Render("body", "left");
?>
	<?php if ($tbl_hotel->language_id->Visible) { // language_id ?>
		<td<?php echo $tbl_hotel->language_id->CellAttributes() ?>>
<div<?php echo $tbl_hotel->language_id->ViewAttributes() ?>><?php echo $tbl_hotel->language_id->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($tbl_hotel->country_id->Visible) { // country_id ?>
		<td<?php echo $tbl_hotel->country_id->CellAttributes() ?>>
<div<?php echo $tbl_hotel->country_id->ViewAttributes() ?>><?php echo $tbl_hotel->country_id->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($tbl_hotel->province_id->Visible) { // province_id ?>
		<td<?php echo $tbl_hotel->province_id->CellAttributes() ?>>
<div<?php echo $tbl_hotel->province_id->ViewAttributes() ?>><?php echo $tbl_hotel->province_id->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($tbl_hotel->category->Visible) { // category ?>
		<td<?php echo $tbl_hotel->category->CellAttributes() ?>>
<div<?php echo $tbl_hotel->category->ViewAttributes() ?>><?php echo $tbl_hotel->category->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($tbl_hotel->photo->Visible) { // photo ?>
		<td<?php echo $tbl_hotel->photo->CellAttributes() ?>>
<?php if ($tbl_hotel->photo->HrefValue <> "" || $tbl_hotel->photo->TooltipValue <> "") { ?>
<?php if (!empty($tbl_hotel->photo->Upload->DbValue)) { ?>
<img src="<?php echo ew_UploadPathEx(FALSE, $tbl_hotel->photo->UploadPath) . $tbl_hotel->photo->Upload->DbValue ?>" border=0<?php echo $tbl_hotel->photo->ViewAttributes() ?>>
<?php } elseif (!in_array($tbl_hotel->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($tbl_hotel->photo->Upload->DbValue)) { ?>
<img src="<?php echo ew_UploadPathEx(FALSE, $tbl_hotel->photo->UploadPath) . $tbl_hotel->photo->Upload->DbValue ?>" border=0<?php echo $tbl_hotel->photo->ViewAttributes() ?>>
<?php } elseif (!in_array($tbl_hotel->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($tbl_hotel->hotel_name->Visible) { // hotel_name ?>
		<td<?php echo $tbl_hotel->hotel_name->CellAttributes() ?>>
<div<?php echo $tbl_hotel->hotel_name->ViewAttributes() ?>><?php echo $tbl_hotel->hotel_name->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($tbl_hotel->order_by->Visible) { // order_by ?>
		<td<?php echo $tbl_hotel->order_by->CellAttributes() ?>>
<div<?php echo $tbl_hotel->order_by->ViewAttributes() ?>><?php echo $tbl_hotel->order_by->ListViewValue() ?></div>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$tbl_hotel_list->ListOptions->Render("body", "right");
?>
	</tr>
<?php
	}
	if ($tbl_hotel->CurrentAction <> "gridadd")
		$rs->MoveNext();
}
?>
</tbody>
</table>
<?php } ?>
</div>
</form>
<?php

// Close recordset
if ($rs)
	$rs->Close();
?>
<?php if ($tbl_hotel->Export == "") { ?>
<div class="ewGridLowerPanel">
<?php if ($tbl_hotel->CurrentAction <> "gridadd" && $tbl_hotel->CurrentAction <> "gridedit") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td nowrap>
<span class="phpmaker">
<?php if (!isset($tbl_hotel_list->Pager)) $tbl_hotel_list->Pager = new cNumericPager($tbl_hotel_list->lStartRec, $tbl_hotel_list->lDisplayRecs, $tbl_hotel_list->lTotalRecs, $tbl_hotel_list->lRecRange) ?>
<?php if ($tbl_hotel_list->Pager->RecordCount > 0) { ?>
	<?php if ($tbl_hotel_list->Pager->FirstButton->Enabled) { ?>
	<a href="<?php echo $tbl_hotel_list->PageUrl() ?>start=<?php echo $tbl_hotel_list->Pager->FirstButton->Start ?>"><b><?php echo $Language->Phrase("PagerFirst") ?></b></a>&nbsp;
	<?php } ?>
	<?php if ($tbl_hotel_list->Pager->PrevButton->Enabled) { ?>
	<a href="<?php echo $tbl_hotel_list->PageUrl() ?>start=<?php echo $tbl_hotel_list->Pager->PrevButton->Start ?>"><b><?php echo $Language->Phrase("PagerPrevious") ?></b></a>&nbsp;
	<?php } ?>
	<?php foreach ($tbl_hotel_list->Pager->Items as $PagerItem) { ?>
		<?php if ($PagerItem->Enabled) { ?><a href="<?php echo $tbl_hotel_list->PageUrl() ?>start=<?php echo $PagerItem->Start ?>"><?php } ?><b><?php echo $PagerItem->Text ?></b><?php if ($PagerItem->Enabled) { ?></a><?php } ?>&nbsp;
	<?php } ?>
	<?php if ($tbl_hotel_list->Pager->NextButton->Enabled) { ?>
	<a href="<?php echo $tbl_hotel_list->PageUrl() ?>start=<?php echo $tbl_hotel_list->Pager->NextButton->Start ?>"><b><?php echo $Language->Phrase("PagerNext") ?></b></a>&nbsp;
	<?php } ?>
	<?php if ($tbl_hotel_list->Pager->LastButton->Enabled) { ?>
	<a href="<?php echo $tbl_hotel_list->PageUrl() ?>start=<?php echo $tbl_hotel_list->Pager->LastButton->Start ?>"><b><?php echo $Language->Phrase("PagerLast") ?></b></a>&nbsp;
	<?php } ?>
	<?php if ($tbl_hotel_list->Pager->ButtonCount > 0) { ?>&nbsp;&nbsp;&nbsp;&nbsp;<?php } ?>
	<?php echo $Language->Phrase("Record") ?>&nbsp;<?php echo $tbl_hotel_list->Pager->FromIndex ?>&nbsp;<?php echo $Language->Phrase("To") ?>&nbsp;<?php echo $tbl_hotel_list->Pager->ToIndex ?>&nbsp;<?php echo $Language->Phrase("Of") ?>&nbsp;<?php echo $tbl_hotel_list->Pager->RecordCount ?>
<?php } else { ?>	
	<?php if ($tbl_hotel_list->sSrchWhere == "0=101") { ?>
	<?php echo $Language->Phrase("EnterSearchCriteria") ?>
	<?php } else { ?>
	<?php echo $Language->Phrase("NoRecord") ?>
	<?php } ?>
<?php } ?>
</span>
		</td>
	</tr>
</table>
</form>
<?php } ?>
<?php //if ($tbl_hotel_list->lTotalRecs > 0) { ?>
<span class="phpmaker">
<?php if ($Security->IsLoggedIn()) { ?>
<a href="<?php echo $tbl_hotel_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>&nbsp;&nbsp;
<?php } ?>
</span>
<?php //} ?>
</div>
<?php } ?>
</td></tr></table>
<?php if ($tbl_hotel->Export == "" && $tbl_hotel->CurrentAction == "") { ?>
<?php } ?>
<?php if ($tbl_hotel->Export == "") { ?>
<script language="JavaScript" type="text/javascript">
<!--

// Write your table-specific startup script here
// document.write("page loaded");
//-->

</script>
<?php } ?>
<?php include "footer.php" ?>
<?php
$tbl_hotel_list->Page_Terminate();
?>
<?php

//
// Page class
//
class ctbl_hotel_list {

	// Page ID
	var $PageID = 'list';

	// Table name
	var $TableName = 'tbl_hotel';

	// Page object name
	var $PageObjName = 'tbl_hotel_list';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		global $tbl_hotel;
		if ($tbl_hotel->UseTokenInUrl) $PageUrl .= "t=" . $tbl_hotel->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Page URLs
	var $AddUrl;
	var $EditUrl;
	var $CopyUrl;
	var $DeleteUrl;
	var $ViewUrl;
	var $ListUrl;

	// Export URLs
	var $ExportPrintUrl;
	var $ExportHtmlUrl;
	var $ExportExcelUrl;
	var $ExportWordUrl;
	var $ExportXmlUrl;
	var $ExportCsvUrl;

	// Update URLs
	var $InlineAddUrl;
	var $InlineCopyUrl;
	var $InlineEditUrl;
	var $GridAddUrl;
	var $GridEditUrl;
	var $MultiDeleteUrl;
	var $MultiUpdateUrl;

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
			$_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
		} else {
			$_SESSION[EW_SESSION_MESSAGE] = $v;
		}
	}

	// Show message
	function ShowMessage() {
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage);
		if ($sMessage <> "") { // Message in Session, display
			echo "<p><span class=\"ewMessage\">" . $sMessage . "</span></p>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm, $tbl_hotel;
		if ($tbl_hotel->UseTokenInUrl) {
			if ($objForm)
				return ($tbl_hotel->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($tbl_hotel->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function ctbl_hotel_list() {
		global $conn, $Language;

		// Language object
		$Language = new cLanguage();

		// Table object (tbl_hotel)
		$GLOBALS["tbl_hotel"] = new ctbl_hotel();

		// Initialize URLs
		$this->ExportPrintUrl = $this->PageUrl() . "export=print";
		$this->ExportExcelUrl = $this->PageUrl() . "export=excel";
		$this->ExportWordUrl = $this->PageUrl() . "export=word";
		$this->ExportHtmlUrl = $this->PageUrl() . "export=html";
		$this->ExportXmlUrl = $this->PageUrl() . "export=xml";
		$this->ExportCsvUrl = $this->PageUrl() . "export=csv";
		$this->AddUrl = $GLOBALS["tbl_hotel"]->AddUrl();
		$this->InlineAddUrl = $this->PageUrl() . "a=add";
		$this->GridAddUrl = $this->PageUrl() . "a=gridadd";
		$this->GridEditUrl = $this->PageUrl() . "a=gridedit";
		$this->MultiDeleteUrl = "tbl_hoteldelete.php";
		$this->MultiUpdateUrl = "tbl_hotelupdate.php";

		// Table object (tbl_country)
		$GLOBALS['tbl_country'] = new ctbl_country();

		// Table object (tbl_language)
		$GLOBALS['tbl_language'] = new ctbl_language();

		// Table object (tbl_hotel_original)
		$GLOBALS['tbl_hotel_original'] = new ctbl_hotel_original();

		// Table object (tbl_admin)
		$GLOBALS['tbl_admin'] = new ctbl_admin();

		// Table object (tbl_province)
		$GLOBALS['tbl_province'] = new ctbl_province();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'list', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'tbl_hotel', TRUE);

		// Start timer
		$GLOBALS["gsTimer"] = new cTimer();

		// Open connection
		$conn = ew_Connect();

		// List options
		$this->ListOptions = new cListOptions();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
		global $tbl_hotel;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

		// Get export parameters
		if (@$_GET["export"] <> "") {
			$tbl_hotel->Export = $_GET["export"];
		} elseif (ew_IsHttpPost()) {
			if (@$_POST["exporttype"] <> "")
				$tbl_hotel->Export = $_POST["exporttype"];
		} else {
			$tbl_hotel->setExportReturnUrl(ew_CurrentUrl());
		}
		$gsExport = $tbl_hotel->Export; // Get export parameter, used in header
		$gsExportFile = $tbl_hotel->TableVar; // Get export file, used in header

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		$this->Page_Redirecting($url);
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}

	// Class variables
	var $ListOptions; // List options
	var $lDisplayRecs = 15;
	var $lStartRec;
	var $lStopRec;
	var $lTotalRecs = 0;
	var $lRecRange = 10;
	var $sSrchWhere = ""; // Search WHERE clause
	var $lRecCnt = 0; // Record count
	var $lEditRowCnt;
	var $lRowCnt;
	var $lRowIndex; // Row index
	var $lRecPerRow = 0;
	var $lColCnt = 0;
	var $sDbMasterFilter = ""; // Master filter
	var $sDbDetailFilter = ""; // Detail filter
	var $bMasterRecordExists;	
	var $sMultiSelectKey;
	var $RestoreSearch;

	//
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsSearchError, $Security, $tbl_hotel;

		// Search filters
		$sSrchAdvanced = ""; // Advanced search filter
		$sSrchBasic = ""; // Basic search filter
		$sFilter = "";
		if ($this->IsPageRequest()) { // Validate request

			// Handle reset command
			$this->ResetCmd();

			// Set up master detail parameters
			$this->SetUpMasterDetail();

			// Set up list options
			$this->SetupListOptions();

			// Get basic search values
			$this->LoadBasicSearchValues();

			// Restore search parms from Session
			$this->RestoreSearchParms();

			// Call Recordset SearchValidated event
			$tbl_hotel->Recordset_SearchValidated();

			// Set up sorting order
			$this->SetUpSortOrder();

			// Get basic search criteria
			if ($gsSearchError == "")
				$sSrchBasic = $this->BasicSearchWhere();
		}

		// Restore display records
		if ($tbl_hotel->getRecordsPerPage() <> "") {
			$this->lDisplayRecs = $tbl_hotel->getRecordsPerPage(); // Restore from Session
		} else {
			$this->lDisplayRecs = 15; // Load default
		}

		// Load Sorting Order
		$this->LoadSortOrder();

		// Build search criteria
		if ($sSrchAdvanced <> "")
			$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchAdvanced . ")" : $sSrchAdvanced;
		if ($sSrchBasic <> "")
			$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchBasic. ")" : $sSrchBasic;

		// Call Recordset_Searching event
		$tbl_hotel->Recordset_Searching($this->sSrchWhere);

		// Save search criteria
		if ($this->sSrchWhere <> "") {
			if ($sSrchBasic == "")
				$this->ResetBasicSearchParms();
			$tbl_hotel->setSearchWhere($this->sSrchWhere); // Save to Session
			if (!$this->RestoreSearch) {
				$this->lStartRec = 1; // Reset start record counter
				$tbl_hotel->setStartRecordNumber($this->lStartRec);
			}
		} else {
			$this->sSrchWhere = $tbl_hotel->getSearchWhere();
		}

		// Build filter
		$sFilter = "";

		// Restore master/detail filter
		$this->sDbMasterFilter = $tbl_hotel->getMasterFilter(); // Restore master filter
		$this->sDbDetailFilter = $tbl_hotel->getDetailFilter(); // Restore detail filter
		if ($this->sDbDetailFilter <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
		if ($this->sSrchWhere <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;

		// Load master record
		if ($tbl_hotel->getMasterFilter() <> "" && $tbl_hotel->getCurrentMasterTable() == "tbl_hotel_original") {
			global $tbl_hotel_original;
			$rsmaster = $tbl_hotel_original->LoadRs($this->sDbMasterFilter);
			$this->bMasterRecordExists = ($rsmaster && !$rsmaster->EOF);
			if (!$this->bMasterRecordExists) {
				$tbl_hotel->setMasterFilter(""); // Clear master filter
				$tbl_hotel->setDetailFilter(""); // Clear detail filter
				$this->setMessage($Language->Phrase("NoRecord")); // Set no record found
				$this->Page_Terminate($tbl_hotel->getReturnUrl()); // Return to caller
			} else {
				$tbl_hotel_original->LoadListRowValues($rsmaster);
				$tbl_hotel_original->RowType = EW_ROWTYPE_MASTER; // Master row
				$tbl_hotel_original->RenderListRow();
				$rsmaster->Close();
			}
		}

		// Load master record
		if ($tbl_hotel->getMasterFilter() <> "" && $tbl_hotel->getCurrentMasterTable() == "tbl_language") {
			global $tbl_language;
			$rsmaster = $tbl_language->LoadRs($this->sDbMasterFilter);
			$this->bMasterRecordExists = ($rsmaster && !$rsmaster->EOF);
			if (!$this->bMasterRecordExists) {
				$tbl_hotel->setMasterFilter(""); // Clear master filter
				$tbl_hotel->setDetailFilter(""); // Clear detail filter
				$this->setMessage($Language->Phrase("NoRecord")); // Set no record found
				$this->Page_Terminate($tbl_hotel->getReturnUrl()); // Return to caller
			} else {
				$tbl_language->LoadListRowValues($rsmaster);
				$tbl_language->RowType = EW_ROWTYPE_MASTER; // Master row
				$tbl_language->RenderListRow();
				$rsmaster->Close();
			}
		}

		// Load master record
		if ($tbl_hotel->getMasterFilter() <> "" && $tbl_hotel->getCurrentMasterTable() == "tbl_country") {
			global $tbl_country;
			$rsmaster = $tbl_country->LoadRs($this->sDbMasterFilter);
			$this->bMasterRecordExists = ($rsmaster && !$rsmaster->EOF);
			if (!$this->bMasterRecordExists) {
				$tbl_hotel->setMasterFilter(""); // Clear master filter
				$tbl_hotel->setDetailFilter(""); // Clear detail filter
				$this->setMessage($Language->Phrase("NoRecord")); // Set no record found
				$this->Page_Terminate($tbl_hotel->getReturnUrl()); // Return to caller
			} else {
				$tbl_country->LoadListRowValues($rsmaster);
				$tbl_country->RowType = EW_ROWTYPE_MASTER; // Master row
				$tbl_country->RenderListRow();
				$rsmaster->Close();
			}
		}

		// Load master record
		if ($tbl_hotel->getMasterFilter() <> "" && $tbl_hotel->getCurrentMasterTable() == "tbl_province") {
			global $tbl_province;
			$rsmaster = $tbl_province->LoadRs($this->sDbMasterFilter);
			$this->bMasterRecordExists = ($rsmaster && !$rsmaster->EOF);
			if (!$this->bMasterRecordExists) {
				$tbl_hotel->setMasterFilter(""); // Clear master filter
				$tbl_hotel->setDetailFilter(""); // Clear detail filter
				$this->setMessage($Language->Phrase("NoRecord")); // Set no record found
				$this->Page_Terminate($tbl_hotel->getReturnUrl()); // Return to caller
			} else {
				$tbl_province->LoadListRowValues($rsmaster);
				$tbl_province->RowType = EW_ROWTYPE_MASTER; // Master row
				$tbl_province->RenderListRow();
				$rsmaster->Close();
			}
		}

		// Set up filter in session
		$tbl_hotel->setSessionWhere($sFilter);
		$tbl_hotel->CurrentFilter = "";
	}

	// Return basic search SQL
	function BasicSearchSQL($Keyword) {
		global $tbl_hotel;
		$sKeyword = ew_AdjustSql($Keyword);
		$sWhere = "";
		$this->BuildBasicSearchSQL($sWhere, $tbl_hotel->category, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $tbl_hotel->photo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $tbl_hotel->hotel_name, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $tbl_hotel->descriptioin, $Keyword);
		return $sWhere;
	}

	// Build basic search SQL
	function BuildBasicSearchSql(&$Where, &$Fld, $Keyword) {
		$sFldExpression = ($Fld->FldVirtualExpression <> "") ? $Fld->FldVirtualExpression : $Fld->FldExpression;
		$lFldDataType = ($Fld->FldIsVirtual) ? EW_DATATYPE_STRING : $Fld->FldDataType;
		if ($lFldDataType == EW_DATATYPE_NUMBER) {
			$sWrk = $sFldExpression . " = " . ew_QuotedValue($Keyword, $lFldDataType);
		} else {
			$sWrk = $sFldExpression . " LIKE " . ew_QuotedValue("%" . $Keyword . "%", $lFldDataType);
		}
		if ($Where <> "") $Where .= " OR ";
		$Where .= $sWrk;
	}

	// Return basic search WHERE clause based on search keyword and type
	function BasicSearchWhere() {
		global $Security, $tbl_hotel;
		$sSearchStr = "";
		$sSearchKeyword = $tbl_hotel->BasicSearchKeyword;
		$sSearchType = $tbl_hotel->BasicSearchType;
		if ($sSearchKeyword <> "") {
			$sSearch = trim($sSearchKeyword);
			if ($sSearchType <> "") {
				while (strpos($sSearch, "  ") !== FALSE)
					$sSearch = str_replace("  ", " ", $sSearch);
				$arKeyword = explode(" ", trim($sSearch));
				foreach ($arKeyword as $sKeyword) {
					if ($sSearchStr <> "") $sSearchStr .= " " . $sSearchType . " ";
					$sSearchStr .= "(" . $this->BasicSearchSQL($sKeyword) . ")";
				}
			} else {
				$sSearchStr = $this->BasicSearchSQL($sSearch);
			}
		}
		if ($sSearchKeyword <> "") {
			$tbl_hotel->setSessionBasicSearchKeyword($sSearchKeyword);
			$tbl_hotel->setSessionBasicSearchType($sSearchType);
		}
		return $sSearchStr;
	}

	// Clear all search parameters
	function ResetSearchParms() {
		global $tbl_hotel;

		// Clear search WHERE clause
		$this->sSrchWhere = "";
		$tbl_hotel->setSearchWhere($this->sSrchWhere);

		// Clear basic search parameters
		$this->ResetBasicSearchParms();
	}

	// Clear all basic search parameters
	function ResetBasicSearchParms() {
		global $tbl_hotel;
		$tbl_hotel->setSessionBasicSearchKeyword("");
		$tbl_hotel->setSessionBasicSearchType("");
	}

	// Restore all search parameters
	function RestoreSearchParms() {
		global $tbl_hotel;
		$bRestore = TRUE;
		if (@$_GET[EW_TABLE_BASIC_SEARCH] <> "") $bRestore = FALSE;
		$this->RestoreSearch = $bRestore;
		if ($bRestore) {

			// Restore basic search values
			$tbl_hotel->BasicSearchKeyword = $tbl_hotel->getSessionBasicSearchKeyword();
			$tbl_hotel->BasicSearchType = $tbl_hotel->getSessionBasicSearchType();
		}
	}

	// Set up sort parameters
	function SetUpSortOrder() {
		global $tbl_hotel;

		// Check for "order" parameter
		if (@$_GET["order"] <> "") {
			$tbl_hotel->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
			$tbl_hotel->CurrentOrderType = @$_GET["ordertype"];
			$tbl_hotel->UpdateSort($tbl_hotel->language_id); // language_id
			$tbl_hotel->UpdateSort($tbl_hotel->country_id); // country_id
			$tbl_hotel->UpdateSort($tbl_hotel->province_id); // province_id
			$tbl_hotel->UpdateSort($tbl_hotel->category); // category
			$tbl_hotel->UpdateSort($tbl_hotel->photo); // photo
			$tbl_hotel->UpdateSort($tbl_hotel->hotel_name); // hotel_name
			$tbl_hotel->UpdateSort($tbl_hotel->order_by); // order_by
			$tbl_hotel->setStartRecordNumber(1); // Reset start position
		}
	}

	// Load sort order parameters
	function LoadSortOrder() {
		global $tbl_hotel;
		$sOrderBy = $tbl_hotel->getSessionOrderBy(); // Get ORDER BY from Session
		if ($sOrderBy == "") {
			if ($tbl_hotel->SqlOrderBy() <> "") {
				$sOrderBy = $tbl_hotel->SqlOrderBy();
				$tbl_hotel->setSessionOrderBy($sOrderBy);
				$tbl_hotel->order_by->setSort("ASC");
			}
		}
	}

	// Reset command
	// cmd=reset (Reset search parameters)
	// cmd=resetall (Reset search and master/detail parameters)
	// cmd=resetsort (Reset sort parameters)
	function ResetCmd() {
		global $tbl_hotel;

		// Get reset command
		if (@$_GET["cmd"] <> "") {
			$sCmd = $_GET["cmd"];

			// Reset search criteria
			if (strtolower($sCmd) == "reset" || strtolower($sCmd) == "resetall")
				$this->ResetSearchParms();

			// Reset master/detail keys
			if (strtolower($sCmd) == "resetall") {
				$tbl_hotel->getCurrentMasterTable = ""; // Clear master table
				$tbl_hotel->setMasterFilter(""); // Clear master filter
				$this->sDbMasterFilter = "";
				$tbl_hotel->setDetailFilter(""); // Clear detail filter
				$this->sDbDetailFilter = "";
				$tbl_hotel->hotel_or_id->setSessionValue("");
				$tbl_hotel->language_id->setSessionValue("");
				$tbl_hotel->country_id->setSessionValue("");
				$tbl_hotel->province_id->setSessionValue("");
			}

			// Reset sorting order
			if (strtolower($sCmd) == "resetsort") {
				$sOrderBy = "";
				$tbl_hotel->setSessionOrderBy($sOrderBy);
				$tbl_hotel->language_id->setSort("");
				$tbl_hotel->country_id->setSort("");
				$tbl_hotel->province_id->setSort("");
				$tbl_hotel->category->setSort("");
				$tbl_hotel->photo->setSort("");
				$tbl_hotel->hotel_name->setSort("");
				$tbl_hotel->order_by->setSort("");
			}

			// Reset start position
			$this->lStartRec = 1;
			$tbl_hotel->setStartRecordNumber($this->lStartRec);
		}
	}

	// Set up list options
	function SetupListOptions() {
		global $Security, $tbl_hotel;

		// "view"
		$this->ListOptions->Add("view");
		$item =& $this->ListOptions->Items["view"];
		$item->CssStyle = "white-space: nowrap;";
		$item->Visible = $Security->IsLoggedIn();
		$item->OnLeft = FALSE;

		// "edit"
		$this->ListOptions->Add("edit");
		$item =& $this->ListOptions->Items["edit"];
		$item->CssStyle = "white-space: nowrap;";
		$item->Visible = $Security->IsLoggedIn();
		$item->OnLeft = FALSE;

		// "copy"
		$this->ListOptions->Add("copy");
		$item =& $this->ListOptions->Items["copy"];
		$item->CssStyle = "white-space: nowrap;";
		$item->Visible = $Security->IsLoggedIn();
		$item->OnLeft = FALSE;

		// "delete"
		$this->ListOptions->Add("delete");
		$item =& $this->ListOptions->Items["delete"];
		$item->CssStyle = "white-space: nowrap;";
		$item->Visible = $Security->IsLoggedIn();
		$item->OnLeft = FALSE;

		// "detail_tbl_hotel_submenu"
		$this->ListOptions->Add("detail_tbl_hotel_submenu");
		$item =& $this->ListOptions->Items["detail_tbl_hotel_submenu"];
		$item->CssStyle = "white-space: nowrap;";
		$item->Visible = $Security->IsLoggedIn();
		$item->OnLeft = FALSE;

		// Call ListOptions_Load event
		$this->ListOptions_Load();
		if ($tbl_hotel->Export <> "" ||
			$tbl_hotel->CurrentAction == "gridadd" ||
			$tbl_hotel->CurrentAction == "gridedit")
			$this->ListOptions->HideAllOptions();
	}

	// Render list options
	function RenderListOptions() {
		global $Security, $Language, $tbl_hotel;
		$this->ListOptions->LoadDefault();

		// "view"
		$oListOpt =& $this->ListOptions->Items["view"];
		if ($Security->IsLoggedIn() && $oListOpt->Visible)
			$oListOpt->Body = "<a href=\"" . $this->ViewUrl . "\">" . $Language->Phrase("ViewLink") . "</a>";

		// "edit"
		$oListOpt =& $this->ListOptions->Items["edit"];
		if ($Security->IsLoggedIn() && $oListOpt->Visible) {
			$oListOpt->Body = "<a href=\"" . $this->EditUrl . "\">" . $Language->Phrase("EditLink") . "</a>";
		}

		// "copy"
		$oListOpt =& $this->ListOptions->Items["copy"];
		if ($Security->IsLoggedIn() && $oListOpt->Visible) {
			$oListOpt->Body = "<a href=\"" . $this->CopyUrl . "\">" . $Language->Phrase("CopyLink") . "</a>";
		}

		// "delete"
		$oListOpt =& $this->ListOptions->Items["delete"];
		if ($Security->IsLoggedIn() && $oListOpt->Visible)
			$oListOpt->Body = "<a" . " onclick=\"ew_ClickDelete(this);return ew_ConfirmDelete(ewLanguage.Phrase('DeleteConfirmMsg'), this);\"" . " href=\"" . $this->DeleteUrl . "\">" . $Language->Phrase("DeleteLink") . "</a>";

		// "detail_tbl_hotel_submenu"
		$oListOpt =& $this->ListOptions->Items["detail_tbl_hotel_submenu"];
		if ($Security->IsLoggedIn()) {
			$oListOpt->Body = $Language->Phrase("DetailLink") . $Language->TablePhrase("tbl_hotel_submenu", "TblCaption");
			$oListOpt->Body = "<a href=\"tbl_hotel_submenulist.php?" . EW_TABLE_SHOW_MASTER . "=tbl_hotel&hotel_or_id=" . urlencode(strval($tbl_hotel->hotel_or_id->CurrentValue)) . "\">" . $oListOpt->Body . "</a>";
		}
		$this->RenderListOptionsExt();

		// Call ListOptions_Rendered event
		$this->ListOptions_Rendered();
	}

	function RenderListOptionsExt() {
		global $Security, $Language, $tbl_hotel;
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		global $tbl_hotel;
		if ($this->lDisplayRecs == 0)
			return;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
				$this->lStartRec = $_GET[EW_TABLE_START_REC];
				$tbl_hotel->setStartRecordNumber($this->lStartRec);
			} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
				$this->nPageNo = $_GET[EW_TABLE_PAGE_NO];
				if (is_numeric($this->nPageNo)) {
					$this->lStartRec = ($this->nPageNo-1)*$this->lDisplayRecs+1;
					if ($this->lStartRec <= 0) {
						$this->lStartRec = 1;
					} elseif ($this->lStartRec >= intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1) {
						$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1;
					}
					$tbl_hotel->setStartRecordNumber($this->lStartRec);
				}
			}
		}
		$this->lStartRec = $tbl_hotel->getStartRecordNumber();

		// Check if correct start record counter
		if (!is_numeric($this->lStartRec) || $this->lStartRec == "") { // Avoid invalid start record counter
			$this->lStartRec = 1; // Reset start record counter
			$tbl_hotel->setStartRecordNumber($this->lStartRec);
		} elseif (intval($this->lStartRec) > intval($this->lTotalRecs)) { // Avoid starting record > total records
			$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to last page first record
			$tbl_hotel->setStartRecordNumber($this->lStartRec);
		} elseif (($this->lStartRec-1) % $this->lDisplayRecs <> 0) {
			$this->lStartRec = intval(($this->lStartRec-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to page boundary
			$tbl_hotel->setStartRecordNumber($this->lStartRec);
		}
	}

	// Load basic search values
	function LoadBasicSearchValues() {
		global $tbl_hotel;
		$tbl_hotel->BasicSearchKeyword = @$_GET[EW_TABLE_BASIC_SEARCH];
		$tbl_hotel->BasicSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
	}

	// Load recordset
	function LoadRecordset($offset = -1, $rowcnt = -1) {
		global $conn, $tbl_hotel;

		// Call Recordset Selecting event
		$tbl_hotel->Recordset_Selecting($tbl_hotel->CurrentFilter);

		// Load List page SQL
		$sSql = $tbl_hotel->SelectSQL();
		if ($offset > -1 && $rowcnt > -1)
			$sSql .= " LIMIT $offset, $rowcnt";

		// Load recordset
		$rs = ew_LoadRecordset($sSql);

		// Call Recordset Selected event
		$tbl_hotel->Recordset_Selected($rs);
		return $rs;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $tbl_hotel;
		$sFilter = $tbl_hotel->KeyFilter();

		// Call Row Selecting event
		$tbl_hotel->Row_Selecting($sFilter);

		// Load SQL based on filter
		$tbl_hotel->CurrentFilter = $sFilter;
		$sSql = $tbl_hotel->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values

			// Call Row Selected event
			$tbl_hotel->Row_Selected($rs);
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $tbl_hotel;
		$tbl_hotel->hotel_id->setDbValue($rs->fields('hotel_id'));
		$tbl_hotel->hotel_or_id->setDbValue($rs->fields('hotel_or_id'));
		$tbl_hotel->language_id->setDbValue($rs->fields('language_id'));
		$tbl_hotel->country_id->setDbValue($rs->fields('country_id'));
		$tbl_hotel->province_id->setDbValue($rs->fields('province_id'));
		$tbl_hotel->category->setDbValue($rs->fields('category'));
		$tbl_hotel->photo->Upload->DbValue = $rs->fields('photo');
		$tbl_hotel->hotel_name->setDbValue($rs->fields('hotel_name'));
		$tbl_hotel->descriptioin->setDbValue($rs->fields('descriptioin'));
		$tbl_hotel->order_by->setDbValue($rs->fields('order_by'));
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language, $tbl_hotel;

		// Initialize URLs
		$this->ViewUrl = $tbl_hotel->ViewUrl();
		$this->EditUrl = $tbl_hotel->EditUrl();
		$this->InlineEditUrl = $tbl_hotel->InlineEditUrl();
		$this->CopyUrl = $tbl_hotel->CopyUrl();
		$this->InlineCopyUrl = $tbl_hotel->InlineCopyUrl();
		$this->DeleteUrl = $tbl_hotel->DeleteUrl();

		// Call Row_Rendering event
		$tbl_hotel->Row_Rendering();

		// Common render codes for all row types
		// language_id

		$tbl_hotel->language_id->CellCssStyle = ""; $tbl_hotel->language_id->CellCssClass = "";
		$tbl_hotel->language_id->CellAttrs = array(); $tbl_hotel->language_id->ViewAttrs = array(); $tbl_hotel->language_id->EditAttrs = array();

		// country_id
		$tbl_hotel->country_id->CellCssStyle = ""; $tbl_hotel->country_id->CellCssClass = "";
		$tbl_hotel->country_id->CellAttrs = array(); $tbl_hotel->country_id->ViewAttrs = array(); $tbl_hotel->country_id->EditAttrs = array();

		// province_id
		$tbl_hotel->province_id->CellCssStyle = ""; $tbl_hotel->province_id->CellCssClass = "";
		$tbl_hotel->province_id->CellAttrs = array(); $tbl_hotel->province_id->ViewAttrs = array(); $tbl_hotel->province_id->EditAttrs = array();

		// category
		$tbl_hotel->category->CellCssStyle = ""; $tbl_hotel->category->CellCssClass = "";
		$tbl_hotel->category->CellAttrs = array(); $tbl_hotel->category->ViewAttrs = array(); $tbl_hotel->category->EditAttrs = array();

		// photo
		$tbl_hotel->photo->CellCssStyle = ""; $tbl_hotel->photo->CellCssClass = "";
		$tbl_hotel->photo->CellAttrs = array(); $tbl_hotel->photo->ViewAttrs = array(); $tbl_hotel->photo->EditAttrs = array();

		// hotel_name
		$tbl_hotel->hotel_name->CellCssStyle = ""; $tbl_hotel->hotel_name->CellCssClass = "";
		$tbl_hotel->hotel_name->CellAttrs = array(); $tbl_hotel->hotel_name->ViewAttrs = array(); $tbl_hotel->hotel_name->EditAttrs = array();

		// order_by
		$tbl_hotel->order_by->CellCssStyle = ""; $tbl_hotel->order_by->CellCssClass = "";
		$tbl_hotel->order_by->CellAttrs = array(); $tbl_hotel->order_by->ViewAttrs = array(); $tbl_hotel->order_by->EditAttrs = array();
		if ($tbl_hotel->RowType == EW_ROWTYPE_VIEW) { // View row

			// hotel_id
			$tbl_hotel->hotel_id->ViewValue = $tbl_hotel->hotel_id->CurrentValue;
			$tbl_hotel->hotel_id->CssStyle = "";
			$tbl_hotel->hotel_id->CssClass = "";
			$tbl_hotel->hotel_id->ViewCustomAttributes = "";

			// hotel_or_id
			if (strval($tbl_hotel->hotel_or_id->CurrentValue) <> "") {
				$sFilterWrk = "`hote_or_id` = " . ew_AdjustSql($tbl_hotel->hotel_or_id->CurrentValue) . "";
			$sSqlWrk = "SELECT `name` FROM `tbl_hotel_original`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$tbl_hotel->hotel_or_id->ViewValue = $rswrk->fields('name');
					$rswrk->Close();
				} else {
					$tbl_hotel->hotel_or_id->ViewValue = $tbl_hotel->hotel_or_id->CurrentValue;
				}
			} else {
				$tbl_hotel->hotel_or_id->ViewValue = NULL;
			}
			$tbl_hotel->hotel_or_id->CssStyle = "";
			$tbl_hotel->hotel_or_id->CssClass = "";
			$tbl_hotel->hotel_or_id->ViewCustomAttributes = "";

			// language_id
			if (strval($tbl_hotel->language_id->CurrentValue) <> "") {
				$sFilterWrk = "`language_id` = " . ew_AdjustSql($tbl_hotel->language_id->CurrentValue) . "";
			$sSqlWrk = "SELECT `language` FROM `tbl_language`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$tbl_hotel->language_id->ViewValue = $rswrk->fields('language');
					$rswrk->Close();
				} else {
					$tbl_hotel->language_id->ViewValue = $tbl_hotel->language_id->CurrentValue;
				}
			} else {
				$tbl_hotel->language_id->ViewValue = NULL;
			}
			$tbl_hotel->language_id->CssStyle = "";
			$tbl_hotel->language_id->CssClass = "";
			$tbl_hotel->language_id->ViewCustomAttributes = "";

			// country_id
			if (strval($tbl_hotel->country_id->CurrentValue) <> "") {
				$sFilterWrk = "`country_id` = " . ew_AdjustSql($tbl_hotel->country_id->CurrentValue) . "";
			$sSqlWrk = "SELECT `country_name` FROM `tbl_country`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$tbl_hotel->country_id->ViewValue = $rswrk->fields('country_name');
					$rswrk->Close();
				} else {
					$tbl_hotel->country_id->ViewValue = $tbl_hotel->country_id->CurrentValue;
				}
			} else {
				$tbl_hotel->country_id->ViewValue = NULL;
			}
			$tbl_hotel->country_id->CssStyle = "";
			$tbl_hotel->country_id->CssClass = "";
			$tbl_hotel->country_id->ViewCustomAttributes = "";

			// province_id
			if (strval($tbl_hotel->province_id->CurrentValue) <> "") {
				$sFilterWrk = "`province_id` = " . ew_AdjustSql($tbl_hotel->province_id->CurrentValue) . "";
			$sSqlWrk = "SELECT `province_name` FROM `tbl_province`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$tbl_hotel->province_id->ViewValue = $rswrk->fields('province_name');
					$rswrk->Close();
				} else {
					$tbl_hotel->province_id->ViewValue = $tbl_hotel->province_id->CurrentValue;
				}
			} else {
				$tbl_hotel->province_id->ViewValue = NULL;
			}
			$tbl_hotel->province_id->CssStyle = "";
			$tbl_hotel->province_id->CssClass = "";
			$tbl_hotel->province_id->ViewCustomAttributes = "";

			// category
			if (strval($tbl_hotel->category->CurrentValue) <> "") {
				switch ($tbl_hotel->category->CurrentValue) {
					case "34":
						$tbl_hotel->category->ViewValue = "3 Starts Hotel";
						break;
					case "43":
						$tbl_hotel->category->ViewValue = "4 Starts Hotel";
						break;
					case "5":
						$tbl_hotel->category->ViewValue = "5 Starts Hotel";
						break;
					case "boutiqu":
						$tbl_hotel->category->ViewValue = "Boutique";
						break;
					case "eco":
						$tbl_hotel->category->ViewValue = "Eco-Lodge & Resort";
						break;
					default:
						$tbl_hotel->category->ViewValue = $tbl_hotel->category->CurrentValue;
				}
			} else {
				$tbl_hotel->category->ViewValue = NULL;
			}
			$tbl_hotel->category->CssStyle = "";
			$tbl_hotel->category->CssClass = "";
			$tbl_hotel->category->ViewCustomAttributes = "";

			// photo
			if (!ew_Empty($tbl_hotel->photo->Upload->DbValue)) {
				$tbl_hotel->photo->ViewValue = $tbl_hotel->photo->Upload->DbValue;
				$tbl_hotel->photo->ImageWidth = 180;
				$tbl_hotel->photo->ImageHeight = 0;
				$tbl_hotel->photo->ImageAlt = $tbl_hotel->photo->FldAlt();
			} else {
				$tbl_hotel->photo->ViewValue = "";
			}
			$tbl_hotel->photo->CssStyle = "";
			$tbl_hotel->photo->CssClass = "";
			$tbl_hotel->photo->ViewCustomAttributes = "";

			// hotel_name
			$tbl_hotel->hotel_name->ViewValue = $tbl_hotel->hotel_name->CurrentValue;
			$tbl_hotel->hotel_name->CssStyle = "";
			$tbl_hotel->hotel_name->CssClass = "";
			$tbl_hotel->hotel_name->ViewCustomAttributes = "";

			// order_by
			$tbl_hotel->order_by->ViewValue = $tbl_hotel->order_by->CurrentValue;
			$tbl_hotel->order_by->CssStyle = "";
			$tbl_hotel->order_by->CssClass = "";
			$tbl_hotel->order_by->ViewCustomAttributes = "";

			// language_id
			$tbl_hotel->language_id->HrefValue = "";
			$tbl_hotel->language_id->TooltipValue = "";

			// country_id
			$tbl_hotel->country_id->HrefValue = "";
			$tbl_hotel->country_id->TooltipValue = "";

			// province_id
			$tbl_hotel->province_id->HrefValue = "";
			$tbl_hotel->province_id->TooltipValue = "";

			// category
			$tbl_hotel->category->HrefValue = "";
			$tbl_hotel->category->TooltipValue = "";

			// photo
			$tbl_hotel->photo->HrefValue = "";
			$tbl_hotel->photo->TooltipValue = "";

			// hotel_name
			$tbl_hotel->hotel_name->HrefValue = "";
			$tbl_hotel->hotel_name->TooltipValue = "";

			// order_by
			$tbl_hotel->order_by->HrefValue = "";
			$tbl_hotel->order_by->TooltipValue = "";
		}

		// Call Row Rendered event
		if ($tbl_hotel->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$tbl_hotel->Row_Rendered();
	}

	// Set up master/detail based on QueryString
	function SetUpMasterDetail() {
		global $tbl_hotel;
		$bValidMaster = FALSE;

		// Get the keys for master table
		if (@$_GET[EW_TABLE_SHOW_MASTER] <> "") {
			$sMasterTblVar = $_GET[EW_TABLE_SHOW_MASTER];
			if ($sMasterTblVar == "") {
				$bValidMaster = TRUE;
				$this->sDbMasterFilter = "";
				$this->sDbDetailFilter = "";
			}
			if ($sMasterTblVar == "tbl_hotel_original") {
				$bValidMaster = TRUE;
				$this->sDbMasterFilter = $tbl_hotel->SqlMasterFilter_tbl_hotel_original();
				$this->sDbDetailFilter = $tbl_hotel->SqlDetailFilter_tbl_hotel_original();
				if (@$_GET["hote_or_id"] <> "") {
					$GLOBALS["tbl_hotel_original"]->hote_or_id->setQueryStringValue($_GET["hote_or_id"]);
					$tbl_hotel->hotel_or_id->setQueryStringValue($GLOBALS["tbl_hotel_original"]->hote_or_id->QueryStringValue);
					$tbl_hotel->hotel_or_id->setSessionValue($tbl_hotel->hotel_or_id->QueryStringValue);
					if (!is_numeric($GLOBALS["tbl_hotel_original"]->hote_or_id->QueryStringValue)) $bValidMaster = FALSE;
					$this->sDbMasterFilter = str_replace("@hote_or_id@", ew_AdjustSql($GLOBALS["tbl_hotel_original"]->hote_or_id->QueryStringValue), $this->sDbMasterFilter);
					$this->sDbDetailFilter = str_replace("@hotel_or_id@", ew_AdjustSql($GLOBALS["tbl_hotel_original"]->hote_or_id->QueryStringValue), $this->sDbDetailFilter);
				} else {
					$bValidMaster = FALSE;
				}
			}
			if ($sMasterTblVar == "tbl_language") {
				$bValidMaster = TRUE;
				$this->sDbMasterFilter = $tbl_hotel->SqlMasterFilter_tbl_language();
				$this->sDbDetailFilter = $tbl_hotel->SqlDetailFilter_tbl_language();
				if (@$_GET["language_id"] <> "") {
					$GLOBALS["tbl_language"]->language_id->setQueryStringValue($_GET["language_id"]);
					$tbl_hotel->language_id->setQueryStringValue($GLOBALS["tbl_language"]->language_id->QueryStringValue);
					$tbl_hotel->language_id->setSessionValue($tbl_hotel->language_id->QueryStringValue);
					if (!is_numeric($GLOBALS["tbl_language"]->language_id->QueryStringValue)) $bValidMaster = FALSE;
					$this->sDbMasterFilter = str_replace("@language_id@", ew_AdjustSql($GLOBALS["tbl_language"]->language_id->QueryStringValue), $this->sDbMasterFilter);
					$this->sDbDetailFilter = str_replace("@language_id@", ew_AdjustSql($GLOBALS["tbl_language"]->language_id->QueryStringValue), $this->sDbDetailFilter);
				} else {
					$bValidMaster = FALSE;
				}
			}
			if ($sMasterTblVar == "tbl_country") {
				$bValidMaster = TRUE;
				$this->sDbMasterFilter = $tbl_hotel->SqlMasterFilter_tbl_country();
				$this->sDbDetailFilter = $tbl_hotel->SqlDetailFilter_tbl_country();
				if (@$_GET["country_id"] <> "") {
					$GLOBALS["tbl_country"]->country_id->setQueryStringValue($_GET["country_id"]);
					$tbl_hotel->country_id->setQueryStringValue($GLOBALS["tbl_country"]->country_id->QueryStringValue);
					$tbl_hotel->country_id->setSessionValue($tbl_hotel->country_id->QueryStringValue);
					if (!is_numeric($GLOBALS["tbl_country"]->country_id->QueryStringValue)) $bValidMaster = FALSE;
					$this->sDbMasterFilter = str_replace("@country_id@", ew_AdjustSql($GLOBALS["tbl_country"]->country_id->QueryStringValue), $this->sDbMasterFilter);
					$this->sDbDetailFilter = str_replace("@country_id@", ew_AdjustSql($GLOBALS["tbl_country"]->country_id->QueryStringValue), $this->sDbDetailFilter);
				} else {
					$bValidMaster = FALSE;
				}
			}
			if ($sMasterTblVar == "tbl_province") {
				$bValidMaster = TRUE;
				$this->sDbMasterFilter = $tbl_hotel->SqlMasterFilter_tbl_province();
				$this->sDbDetailFilter = $tbl_hotel->SqlDetailFilter_tbl_province();
				if (@$_GET["province_id"] <> "") {
					$GLOBALS["tbl_province"]->province_id->setQueryStringValue($_GET["province_id"]);
					$tbl_hotel->province_id->setQueryStringValue($GLOBALS["tbl_province"]->province_id->QueryStringValue);
					$tbl_hotel->province_id->setSessionValue($tbl_hotel->province_id->QueryStringValue);
					if (!is_numeric($GLOBALS["tbl_province"]->province_id->QueryStringValue)) $bValidMaster = FALSE;
					$this->sDbMasterFilter = str_replace("@province_id@", ew_AdjustSql($GLOBALS["tbl_province"]->province_id->QueryStringValue), $this->sDbMasterFilter);
					$this->sDbDetailFilter = str_replace("@province_id@", ew_AdjustSql($GLOBALS["tbl_province"]->province_id->QueryStringValue), $this->sDbDetailFilter);
				} else {
					$bValidMaster = FALSE;
				}
			}
		}
		if ($bValidMaster) {

			// Save current master table
			$tbl_hotel->setCurrentMasterTable($sMasterTblVar);

			// Reset start record counter (new master key)
			$this->lStartRec = 1;
			$tbl_hotel->setStartRecordNumber($this->lStartRec);
			$tbl_hotel->setMasterFilter($this->sDbMasterFilter); // Set up master filter
			$tbl_hotel->setDetailFilter($this->sDbDetailFilter); // Set up detail filter

			// Clear previous master key from Session
			if ($sMasterTblVar <> "tbl_hotel_original") {
				if ($tbl_hotel->hotel_or_id->QueryStringValue == "") $tbl_hotel->hotel_or_id->setSessionValue("");
			}
			if ($sMasterTblVar <> "tbl_language") {
				if ($tbl_hotel->language_id->QueryStringValue == "") $tbl_hotel->language_id->setSessionValue("");
			}
			if ($sMasterTblVar <> "tbl_country") {
				if ($tbl_hotel->country_id->QueryStringValue == "") $tbl_hotel->country_id->setSessionValue("");
			}
			if ($sMasterTblVar <> "tbl_province") {
				if ($tbl_hotel->province_id->QueryStringValue == "") $tbl_hotel->province_id->setSessionValue("");
			}
		} else {
			$this->sDbMasterFilter = $tbl_hotel->getMasterFilter(); //  Restore master filter
			$this->sDbDetailFilter = $tbl_hotel->getDetailFilter(); // Restore detail filter
		}
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	function Message_Showing(&$msg) {

		// Example:
		//$msg = "your new message";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}

	// ListOptions Load event
	function ListOptions_Load() {

		// Example: 
		//$this->ListOptions->Add("new");
		//$this->ListOptions->Items["new"]->OnLeft = TRUE; // Link on left
		//$this->ListOptions->MoveItem("new", 0); // Move to first column

	}

	// ListOptions Rendered event
	function ListOptions_Rendered() {

		// Example: 
		//$this->ListOptions->Items["new"]->Body = "xxx";

	}
}
?>
