<%
Response.Buffer = EW_RESPONSE_BUFFER
%>
<!--#include file="ewcfg7.asp"-->
<!--#include file="xwfbinfo.asp"-->
<!--#include file="bhlminfo.asp"-->
<!--#include file="xwlminfo.asp"-->
<!--#include file="zlogininfo.asp"-->
<!--#include file="sjlminfo.asp"-->
<!--#include file="aspfn7.asp"-->
<!--#include file="userfn7.asp"-->
<% Session.Timeout = 900 %>
<%
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", "private, no-cache, no-store, must-revalidate"
%>
<%

' Define page object
Dim xwfb_list
Set xwfb_list = New cxwfb_list
Set Page = xwfb_list

' Page init processing
Call xwfb_list.Page_Init()

' Page main processing
Call xwfb_list.Page_Main()
%>
<!--#include file="header.asp"-->
<% If xwfb.Export = "" Then %>
<script type="text/javascript">
<!--
// Create page object
var xwfb_list = new ew_Page("xwfb_list");
// page properties
xwfb_list.PageID = "list"; // page ID
var EW_PAGE_ID = xwfb_list.PageID; // for backward compatibility
// extend page with Form_CustomValidate function
xwfb_list.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!
 	// Your custom validation code here, return false if invalid. 
 	return true;
 }
xwfb_list.SelectAllKey = function(elem) {
	ew_SelectAll(elem);
}
<% If EW_CLIENT_VALIDATE Then %>
xwfb_list.ValidateRequired = true; // uses JavaScript validation
<% Else %>
xwfb_list.ValidateRequired = false; // no JavaScript validation
<% End If %>
//-->
</script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];
//-->
</script>
<link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-win2k-1.css" title="win2k-1">
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="calendar/calendar-setup.js"></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>
<% End If %>

<%

' Load recordset
Set Rs = xwfb_list.LoadRecordset()
	xwfb_list.lTotalRecs = Rs.RecordCount
	xwfb_list.lStartRec = 1
	If xwfb_list.lDisplayRecs <= 0 Then ' Display all records
		xwfb_list.lDisplayRecs = xwfb_list.lTotalRecs
	End If
	If Not (xwfb.ExportAll And xwfb.Export <> "") Then
		xwfb_list.SetUpStartRec() ' Set up start record position
	End If
%>
<p style='display:none'><span class="aspmaker" style="white-space: nowrap;">表: 信息管理
</span></p>
<% If Security.CanSearch Then %>
<% If xwfb.Export = "" And xwfb.CurrentAction = "" Then %>
<a href="javascript:ew_ToggleSearchPanel(xwfb_list);" style="text-decoration: none;"><img id="xwfb_list_SearchImage" src="images/collapse.gif" alt="" width="9" height="9" border="0"></a><span class="aspmaker">&nbsp;搜索</span><br>
<div id="xwfb_list_SearchPanel">
<form name="fxwfblistsrch" id="fxwfblistsrch" class="ewForm" action="<%= ew_CurrentPage %>">
<input type="hidden" id="t" name="t" value="xwfb">
<table class="ewBasicSearch">
	<tr>
		<td><span class="aspmaker">
			<a href="<%= xwfb_list.PageUrl %>cmd=reset">全部显示</a>&nbsp;
			<a href="xwfbsrch.asp">高级搜索</a>&nbsp;
		</span></td>
	</tr>
</table>
</form>
</div>
<% End If %>
<% End If %>
<% xwfb_list.ShowMessage %>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<% If xwfb.Export = "" Then %>
<div class="ewGridUpperPanel">
<% If xwfb.CurrentAction <> "gridadd" And xwfb.CurrentAction <> "gridedit" Then %>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<%= ew_CurrentPage %>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td>
<% If Not IsObject(xwfb_list.Pager) Then Set xwfb_list.Pager = ew_NewPrevNextPager(xwfb_list.lStartRec, xwfb_list.lDisplayRecs, xwfb_list.lTotalRecs) %>
<% If xwfb_list.Pager.RecordCount > 0 Then %>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="aspmaker">页&nbsp;</span></td>
<!--first page button-->
	<% If xwfb_list.Pager.FirstButton.Enabled Then %>
	<td><a href="<%= xwfb_list.PageUrl %>start=<%= xwfb_list.Pager.FirstButton.Start %>"><img src="images/first.gif" alt="首页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/firstdisab.gif" alt="首页" width="16" height="16" border="0"></td>
	<% End If %>
<!--previous page button-->
	<% If xwfb_list.Pager.PrevButton.Enabled Then %>
	<td><a href="<%= xwfb_list.PageUrl %>start=<%= xwfb_list.Pager.PrevButton.Start %>"><img src="images/prev.gif" alt="上一页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/prevdisab.gif" alt="上一页" width="16" height="16" border="0"></td>
	<% End If %>
<!--current page number-->
	<td><input type="text" name="<%= EW_TABLE_PAGE_NO %>" id="<%= EW_TABLE_PAGE_NO %>" value="<%= xwfb_list.Pager.CurrentPage %>" size="4"></td>
<!--next page button-->
	<% If xwfb_list.Pager.NextButton.Enabled Then %>
	<td><a href="<%= xwfb_list.PageUrl %>start=<%= xwfb_list.Pager.NextButton.Start %>"><img src="images/next.gif" alt="下一页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/nextdisab.gif" alt="下一页" width="16" height="16" border="0"></td>
	<% End If %>
<!--last page button-->
	<% If xwfb_list.Pager.LastButton.Enabled Then %>
	<td><a href="<%= xwfb_list.PageUrl %>start=<%= xwfb_list.Pager.LastButton.Start %>"><img src="images/last.gif" alt="尾页" width="16" height="16" border="0"></a></td>	
	<% Else %>
	<td><img src="images/lastdisab.gif" alt="尾页" width="16" height="16" border="0"></td>
	<% End If %>
	<td><span class="aspmaker">&nbsp;的 <%= xwfb_list.Pager.PageCount %></span></td>
	</tr></table>
	</td>	
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td>
	<span class="aspmaker">记录数 <%= xwfb_list.Pager.FromIndex %> 到 <%= xwfb_list.Pager.ToIndex %> 的 <%= xwfb_list.Pager.RecordCount %></span>
<% Else %>
	<% If Security.CanList Then %>
	<% If xwfb_list.sSrchWhere = "0=101" Then %>
	<span class="aspmaker">请输入查询条件</span>
	<% Else %>
	<span class="aspmaker">没有找到记录</span>
	<% End If %>
	<% Else %>
	<span class="aspmaker">你无权查看</span>
	<% End If %>
<% End If %>
		</td>
	</tr>
</table>
</form>
<% End If %>
<span class="aspmaker">
<% If Security.CanAdd Then %>
<a href="<%= xwfb.AddUrl %>">增加</a>&nbsp;&nbsp;
<% End If %>
<% If xwfb_list.lTotalRecs > 0 Then %>
<% If Security.CanDelete Then %>
<a href="" onclick="if (!ew_KeySelected(document.fxwfblist)) alert('没有选择记录'); else {document.fxwfblist.action='xwfbdelete.asp';document.fxwfblist.encoding='application/x-www-form-urlencoded';document.fxwfblist.submit();};return false;">删除所选记录</a>&nbsp;&nbsp;
<% End If %>
<% If Security.CanEdit Then %>
<a href="" onclick="if (!ew_KeySelected(document.fxwfblist)) alert('没有选择记录'); else {document.fxwfblist.action='xwfbupdate.asp';document.fxwfblist.encoding='application/x-www-form-urlencoded';document.fxwfblist.submit();};return false;">更新所选记录</a>&nbsp;&nbsp;
<% End If %>
<% End If %>
</span>
</div>
<% End If %>
<div class="ewGridMiddlePanel">
<form name="fxwfblist" id="fxwfblist" class="ewForm" action="" method="post">
<% If xwfb_list.lTotalRecs > 0 Then %>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<%
	xwfb_list.lOptionCnt = 0
If Security.CanView Then
	xwfb_list.lOptionCnt = xwfb_list.lOptionCnt + 1 ' View
End If
If Security.CanEdit Then
	xwfb_list.lOptionCnt = xwfb_list.lOptionCnt + 1 ' Edit
End If
If Security.CanAdd Then
	xwfb_list.lOptionCnt = xwfb_list.lOptionCnt + 1 ' Copy
End If
If Security.CanEdit Or Security.CanDelete Then
	xwfb_list.lOptionCnt = xwfb_list.lOptionCnt + 1 ' Multi-select
End If
	xwfb_list.lOptionCnt = xwfb_list.lOptionCnt + xwfb_list.ListOptions.Items.Count ' Custom list options
%>
<%= xwfb.TableCustomInnerHTML %>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<% If xwfb.id.Visible Then ' id %>
	<% If xwfb.SortUrl(xwfb.id) = "" Then %>
		<td>编号</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= xwfb.SortUrl(xwfb.id) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>编号</td><td style="width: 10px;"><% If xwfb.id.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf xwfb.id.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If xwfb.bh.Visible Then ' bh %>
	<% If xwfb.SortUrl(xwfb.bh) = "" Then %>
		<td>一级栏目</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= xwfb.SortUrl(xwfb.bh) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>一级栏目</td><td style="width: 10px;"><% If xwfb.bh.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf xwfb.bh.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If xwfb.lmid.Visible Then ' lmid %>
	<% If xwfb.SortUrl(xwfb.lmid) = "" Then %>
		<td>二级栏目</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= xwfb.SortUrl(xwfb.lmid) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>二级栏目</td><td style="width: 10px;"><% If xwfb.lmid.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf xwfb.lmid.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If xwfb.sj.Visible Then ' sj %>
	<% If xwfb.SortUrl(xwfb.sj) = "" Then %>
		<td>三级栏目</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= xwfb.SortUrl(xwfb.sj) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>三级栏目</td><td style="width: 10px;"><% If xwfb.sj.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf xwfb.sj.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If xwfb.xwbt.Visible Then ' xwbt %>
	<% If xwfb.SortUrl(xwfb.xwbt) = "" Then %>
		<td>标题</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= xwfb.SortUrl(xwfb.xwbt) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>标题</td><td style="width: 10px;"><% If xwfb.xwbt.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf xwfb.xwbt.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If xwfb.fbsj.Visible Then ' fbsj %>
	<% If xwfb.SortUrl(xwfb.fbsj) = "" Then %>
		<td>发布时间</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= xwfb.SortUrl(xwfb.fbsj) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>发布时间</td><td style="width: 10px;"><% If xwfb.fbsj.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf xwfb.fbsj.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If xwfb.ishome.Visible Then ' ishome %>
	<% If xwfb.SortUrl(xwfb.ishome) = "" Then %>
		<td>首页显示</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= xwfb.SortUrl(xwfb.ishome) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>首页显示</td><td style="width: 10px;"><% If xwfb.ishome.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf xwfb.ishome.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If xwfb.px.Visible Then ' px %>
	<% If xwfb.SortUrl(xwfb.px) = "" Then %>
		<td>排序</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= xwfb.SortUrl(xwfb.px) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>排序</td><td style="width: 10px;"><% If xwfb.px.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf xwfb.px.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If xwfb.Export = "" Then %>
<% If Security.CanView Then %>
<td style="white-space: nowrap;">&nbsp;</td>
<% End If %>
<% If Security.CanEdit Then %>
<td style="white-space: nowrap;">&nbsp;</td>
<% End If %>
<% If Security.CanAdd Then %>
<td style="white-space: nowrap;">&nbsp;</td>
<% End If %>
<% If Security.CanEdit Or Security.CanDelete Then %>
<td style="white-space: nowrap;">
<input type="checkbox" name="key" id="key" class="aspmaker" onclick="xwfb_list.SelectAllKey(this);">
</td>
<% End If %>
<%

' Custom list options
For i = 0 to xwfb_list.ListOptions.Items.Count -1
	If xwfb_list.ListOptions.Items(i).Visible Then Response.Write xwfb_list.ListOptions.Items(i).HeaderCellHtml
Next
%>
<% End If %>
	</tr>
</thead>
<tbody><!-- Table body -->
<%
If (xwfb.ExportAll And xwfb.Export <> "") Then
	xwfb_list.lStopRec = xwfb_list.lTotalRecs
Else
	xwfb_list.lStopRec = xwfb_list.lStartRec + xwfb_list.lDisplayRecs - 1 ' Set the last record to display
End If

' Move to first record
xwfb_list.lRecCnt = xwfb_list.lStartRec - 1
If Not Rs.Eof Then
	Rs.MoveFirst
	If xwfb_list.lStartRec > 1 Then Rs.Move xwfb_list.lStartRec - 1
End If
xwfb_list.lRowCnt = 0

' Output date rows
Do While (Not Rs.Eof Or xwfb.CurrentAction = "gridadd") And (xwfb_list.lRecCnt < xwfb_list.lStopRec)
	xwfb_list.lRecCnt = xwfb_list.lRecCnt + 1
	If CLng(xwfb_list.lRecCnt) >= CLng(xwfb_list.lStartRec) Then
		xwfb_list.lRowCnt = xwfb_list.lRowCnt + 1
	xwfb.CssClass = ""
	xwfb.CssStyle = ""
	xwfb.RowClientEvents = "onmouseover='ew_MouseOver(event, this);' onmouseout='ew_MouseOut(event, this);' onclick='ew_Click(event, this);'"
	If xwfb.CurrentAction = "gridadd" Then
		Call xwfb_list.LoadDefaultValues() ' Load default values
	Else
		Call xwfb_list.LoadRowValues(Rs) ' Load row values
	End If
	xwfb.RowType = EW_ROWTYPE_VIEW ' Render view

	' Render row
	Call xwfb_list.RenderRow()
%>
	<tr<%= xwfb.RowAttributes %>>
	<% If xwfb.id.Visible Then ' id %>
		<td<%= xwfb.id.CellAttributes %>>
<div<%= xwfb.id.ViewAttributes %>><%= xwfb.id.ListViewValue %></div>
</td>
	<% End If %>
	<% If xwfb.bh.Visible Then ' bh %>
		<td<%= xwfb.bh.CellAttributes %>>
<div<%= xwfb.bh.ViewAttributes %>><%= xwfb.bh.ListViewValue %></div>
</td>
	<% End If %>
	<% If xwfb.lmid.Visible Then ' lmid %>
		<td<%= xwfb.lmid.CellAttributes %>>
<div<%= xwfb.lmid.ViewAttributes %>><%= xwfb.lmid.ListViewValue %></div>
</td>
	<% End If %>
	<% If xwfb.sj.Visible Then ' sj %>
		<td<%= xwfb.sj.CellAttributes %>>
<div<%= xwfb.sj.ViewAttributes %>><%= xwfb.sj.ListViewValue %></div>
</td>
	<% End If %>
	<% If xwfb.xwbt.Visible Then ' xwbt %>
		<td<%= xwfb.xwbt.CellAttributes %>>
<div<%= xwfb.xwbt.ViewAttributes %>><%= xwfb.xwbt.ListViewValue %></div>
</td>
	<% End If %>
	<% If xwfb.fbsj.Visible Then ' fbsj %>
		<td<%= xwfb.fbsj.CellAttributes %>>
<div<%= xwfb.fbsj.ViewAttributes %>><%= xwfb.fbsj.ListViewValue %></div>
</td>
	<% End If %>
	<% If xwfb.ishome.Visible Then ' ishome %>
		<td<%= xwfb.ishome.CellAttributes %>>
<div<%= xwfb.ishome.ViewAttributes %>><%= xwfb.ishome.ListViewValue %></div>
</td>
	<% End If %>
	<% If xwfb.px.Visible Then ' px %>
		<td<%= xwfb.px.CellAttributes %>>
<div<%= xwfb.px.ViewAttributes %>><%= xwfb.px.ListViewValue %></div>
</td>
	<% End If %>
<% If xwfb.Export = "" Then %>
<% If Security.CanView Then %>
<td style="white-space: nowrap;"><span class="aspmaker">
<a href="<%= xwfb.ViewUrl %>">查看</a>
</span></td>
<% End If %>
<% If Security.CanEdit Then %>
<td style="white-space: nowrap;"><span class="aspmaker">
<a href="<%= xwfb.EditUrl %>">编辑</a>
</span></td>
<% End If %>
<% If Security.CanAdd Then %>
<td style="white-space: nowrap;"><span class="aspmaker">
<a href="<%= xwfb.CopyUrl %>">复制</a>
</span></td>
<% End If %>
<% If Security.CanEdit Or Security.CanDelete Then %>
<td style="white-space: nowrap;"><span class="aspmaker">
<input type="checkbox" name="key_m" id="key_m" value="<%= Server.HtmlEncode(xwfb.id.CurrentValue) %>" class="aspmaker" onclick='ew_ClickMultiCheckbox(this);'>
</span></td>
<% End If %>
<%

' Custom list options
For i = 0 to xwfb_list.ListOptions.Items.Count -1
	If xwfb_list.ListOptions.Items(i).Visible Then Response.Write xwfb_list.ListOptions.Items(i).BodyCellHtml
Next
%>
<% End If %>
	</tr>
<%
	End If
	If xwfb.CurrentAction <> "gridadd" Then Rs.MoveNext
Loop
%>
</tbody>
</table>
<% End If %>
</form>
<%

' Close recordset and connection
Rs.Close
Set Rs = Nothing
%>
</div>
<% If xwfb_list.lTotalRecs > 0 Then %>
<% If xwfb.Export = "" Then %>
<div class="ewGridLowerPanel">
<% If xwfb.CurrentAction <> "gridadd" And xwfb.CurrentAction <> "gridedit" Then %>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<%= ew_CurrentPage %>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td>
<% If Not IsObject(xwfb_list.Pager) Then Set xwfb_list.Pager = ew_NewPrevNextPager(xwfb_list.lStartRec, xwfb_list.lDisplayRecs, xwfb_list.lTotalRecs) %>
<% If xwfb_list.Pager.RecordCount > 0 Then %>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="aspmaker">页&nbsp;</span></td>
<!--first page button-->
	<% If xwfb_list.Pager.FirstButton.Enabled Then %>
	<td><a href="<%= xwfb_list.PageUrl %>start=<%= xwfb_list.Pager.FirstButton.Start %>"><img src="images/first.gif" alt="首页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/firstdisab.gif" alt="首页" width="16" height="16" border="0"></td>
	<% End If %>
<!--previous page button-->
	<% If xwfb_list.Pager.PrevButton.Enabled Then %>
	<td><a href="<%= xwfb_list.PageUrl %>start=<%= xwfb_list.Pager.PrevButton.Start %>"><img src="images/prev.gif" alt="上一页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/prevdisab.gif" alt="上一页" width="16" height="16" border="0"></td>
	<% End If %>
<!--current page number-->
	<td><input type="text" name="<%= EW_TABLE_PAGE_NO %>" id="<%= EW_TABLE_PAGE_NO %>" value="<%= xwfb_list.Pager.CurrentPage %>" size="4"></td>
<!--next page button-->
	<% If xwfb_list.Pager.NextButton.Enabled Then %>
	<td><a href="<%= xwfb_list.PageUrl %>start=<%= xwfb_list.Pager.NextButton.Start %>"><img src="images/next.gif" alt="下一页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/nextdisab.gif" alt="下一页" width="16" height="16" border="0"></td>
	<% End If %>
<!--last page button-->
	<% If xwfb_list.Pager.LastButton.Enabled Then %>
	<td><a href="<%= xwfb_list.PageUrl %>start=<%= xwfb_list.Pager.LastButton.Start %>"><img src="images/last.gif" alt="尾页" width="16" height="16" border="0"></a></td>	
	<% Else %>
	<td><img src="images/lastdisab.gif" alt="尾页" width="16" height="16" border="0"></td>
	<% End If %>
	<td><span class="aspmaker">&nbsp;的 <%= xwfb_list.Pager.PageCount %></span></td>
	</tr></table>
	</td>	
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td>
	<span class="aspmaker">记录数 <%= xwfb_list.Pager.FromIndex %> 到 <%= xwfb_list.Pager.ToIndex %> 的 <%= xwfb_list.Pager.RecordCount %></span>
<% Else %>
	<% If Security.CanList Then %>
	<% If xwfb_list.sSrchWhere = "0=101" Then %>
	<span class="aspmaker">请输入查询条件</span>
	<% Else %>
	<span class="aspmaker">没有找到记录</span>
	<% End If %>
	<% Else %>
	<span class="aspmaker">你无权查看</span>
	<% End If %>
<% End If %>
		</td>
	</tr>
</table>
</form>
<% End If %>
<% 'If xwfb_list.lTotalRecs > 0 Then %>
<span class="aspmaker">
<% If Security.CanAdd Then %>
<a href="<%= xwfb.AddUrl %>">增加</a>&nbsp;&nbsp;
<% End If %>
<% If xwfb_list.lTotalRecs > 0 Then %>
<% If Security.CanDelete Then %>
<a href="" onclick="if (!ew_KeySelected(document.fxwfblist)) alert('没有选择记录'); else {document.fxwfblist.action='xwfbdelete.asp';document.fxwfblist.encoding='application/x-www-form-urlencoded';document.fxwfblist.submit();};return false;">删除所选记录</a>&nbsp;&nbsp;
<% End If %>
<% If Security.CanEdit Then %>
<a href="" onclick="if (!ew_KeySelected(document.fxwfblist)) alert('没有选择记录'); else {document.fxwfblist.action='xwfbupdate.asp';document.fxwfblist.encoding='application/x-www-form-urlencoded';document.fxwfblist.submit();};return false;">更新所选记录</a>&nbsp;&nbsp;
<% End If %>
<% End If %>
</span>
<% 'End If %>
</div>
<% End If %>
<% End If %>
</td></tr></table>
<% If xwfb.Export = "" And xwfb.CurrentAction = "" Then %>
<script type="text/javascript">
<!--
//ew_ToggleSearchPanel(xwfb_list); // uncomment to init search panel as collapsed
//-->
</script>
<% End If %>
<% If xwfb.Export = "" Then %>
<script language="JavaScript" type="text/javascript">
<!--
// Write your table-specific startup script here
// document.write("page loaded");
//-->
</script>
<% End If %>
<!--#include file="footer.asp"-->
<%

' Drop page object
Set xwfb_list = Nothing
%>
<%

' -----------------------------------------------------------------
' Page Class
'
Class cxwfb_list

	' Page ID
	Public Property Get PageID()
		PageID = "list"
	End Property

	' Table Name
	Public Property Get TableName()
		TableName = "xwfb"
	End Property

	' Page Object Name
	Public Property Get PageObjName()
		PageObjName = "xwfb_list"
	End Property

	' Page Name
	Public Property Get PageName()
		PageName = ew_CurrentPage()
	End Property

	' Page Url
	Public Property Get PageUrl()
		PageUrl = ew_CurrentPage() & "?"
		If xwfb.UseTokenInUrl Then PageUrl = PageUrl & "t=" & xwfb.TableVar & "&" ' add page token
	End Property

	' Message
	Public Property Get Message()
		Message = Session(EW_SESSION_MESSAGE)
	End Property

	Public Property Let Message(v)
		If Session(EW_SESSION_MESSAGE) <> "" Then ' Append
			Session(EW_SESSION_MESSAGE) = Session(EW_SESSION_MESSAGE) & "<br>" & v
		Else
			Session(EW_SESSION_MESSAGE) = v
		End If
	End Property

	' Show Message
	Public Sub ShowMessage()
		If Message <> "" Then ' Message in Session, display
			Response.Write "<p><span class=""ewMessage"">" & Message & "</span></p>"
			Session(EW_SESSION_MESSAGE) = "" ' Clear message in Session
		End If
	End Sub

	' -----------------------
	'  Validate Page request
	'
	Public Function IsPageRequest()
		If xwfb.UseTokenInUrl Then
			IsPageRequest = False
			If Not (ObjForm Is Nothing) Then
				IsPageRequest = (xwfb.TableVar = ObjForm.GetValue("t"))
			End If
			If Request.QueryString("t").Count > 0 Then
				IsPageRequest = (xwfb.TableVar = Request.QueryString("t"))
			End If
		Else
			IsPageRequest = True
		End If
	End Function

	' -----------------------------------------------------------------
	'  Class initialize
	'  - init objects
	'  - open ADO connection
	'
	Private Sub Class_Initialize()

		' Initialize table object
		Set xwfb = New cxwfb

		' Initialize other table object
		Set bhlm = New cbhlm

		' Initialize other table object
		Set xwlm = New cxwlm

		' Initialize other table object
		Set zlogin = New czlogin

		' Initialize other table object
		Set sjlm = New csjlm

		' Initialize form object
		Set ObjForm = Nothing

		' Intialize page id (for backward compatibility)
		EW_PAGE_ID = "list"

		' Initialize table name (for backward compatibility)
		EW_TABLE_NAME = "xwfb"

		' Open connection to the database
		Set Conn = Server.CreateObject("ADODB.Connection")
		Conn.Open EW_DB_CONNECTION_STRING

		' Initialize list options
		Set ListOptions = New cListOptions
	End Sub

	' -----------------------------------------------------------------
	'  Subroutine Page_Init
	'  - called before page main
	'  - check Security
	'  - set up response header
	'  - call page load events
	'
	Sub Page_Init()
		Set Security = New cAdvancedSecurity
		If Not Security.IsLoggedIn() Then Call Security.AutoLogin()
		If Not Security.IsLoggedIn() Then
			Call Security.SaveLastUrl()
			Call Page_Terminate("login.asp")
		End If

		' Table Permission loading event
		Call Security.TablePermission_Loading()
		Call Security.LoadCurrentUserLevel(TableName)

		' Table Permission loaded event
		Call Security.TablePermission_Loaded()
		If Not Security.CanList Then
			Call Security.SaveLastUrl()
			Call Page_Terminate("login.asp")
		End If
		xwfb.Export = Request.QueryString("export") ' Get export parameter
		gsExport = xwfb.Export ' Get export parameter, used in header
		gsExportFile = xwfb.TableVar ' Get export file, used in header

		' Global page loading event (in userfn7.asp)
		Call Page_Loading()

		' Page load event, used in current page
		Call Page_Load()
	End Sub

	' -----------------------------------------------------------------
	'  Class terminate
	'  - clean up page object
	'
	Private Sub Class_Terminate()
		Call Page_Terminate("")
	End Sub

	' -----------------------------------------------------------------
	'  Subroutine Page_Terminate
	'  - called when exit page
	'  - clean up ADO connection and objects
	'  - if url specified, redirect to url
	'
	Sub Page_Terminate(url)

		' Page unload event, used in current page
		Call Page_Unload()

		' Global page unloaded event (in userfn60.asp)
		Call Page_Unloaded()
		If Not (Conn Is Nothing) Then Conn.Close ' Close Connection
		Set Conn = Nothing
		Set Security = Nothing
		Set xwfb = Nothing
		Set ListOptions = Nothing

		' Go to url if specified
		If url <> "" Then
			Response.Clear
			Response.Redirect url
		End If
	End Sub

	'
	'  Subroutine Page_Terminate (End)
	' ----------------------------------------

	Dim lDisplayRecs ' Number of display records
	Dim lStartRec, lStopRec, lTotalRecs, lRecRange
	Dim sSrchWhere
	Dim lRecCnt
	Dim lEditRowCnt
	Dim lRowCnt, lRowIndex
	Dim lOptionCnt
	Dim lRecPerRow, lColCnt
	Dim sDeleteConfirmMsg ' Delete confirm message
	Dim sDbMasterFilter, sDbDetailFilter
	Dim bMasterRecordExists
	Dim ListOptions
	Dim sMultiSelectKey

	' -----------------------------------------------------------------
	' Page main processing
	'
	Sub Page_Main()
		lDisplayRecs = 20
		lRecRange = 10
		lRecCnt = 0 ' Record count

		' Search filters
		Dim sSrchAdvanced, sSrchBasic, sFilter
		sSrchAdvanced = "" ' Advanced search filter
		sSrchBasic = "" ' Basic search filter
		sSrchWhere = "" ' Search where clause
		sFilter = ""

		' Master/Detail
		sDbMasterFilter = "" ' Master filter
		sDbDetailFilter = "" ' Detail filter
		If IsPageRequest Then ' Validate request

			' Handle reset command
			ResetCmd()

			' Set up master detail parameters
			SetUpMasterDetail()

			' Get search criteria for advanced search
			Call LoadSearchValues() ' Get search values
			If ValidateSearch() Then
				sSrchAdvanced = AdvancedSearchWhere()
			Else
				Message = gsSearchError
			End If

			' Set Up Sorting Order
			SetUpSortOrder()
		End If ' End Validate Request

		' Restore display records
		If xwfb.RecordsPerPage <> "" Then
			lDisplayRecs = xwfb.RecordsPerPage ' Restore from Session
		Else
			lDisplayRecs = 20 ' Load default
		End If

		' Load Sorting Order
		LoadSortOrder()

		' Build search criteria
		If sSrchAdvanced <> "" Then
			If sSrchWhere <> "" Then
				sSrchWhere = "(" & sSrchWhere & ") AND (" & sSrchAdvanced & ")"
			Else
				sSrchWhere = sSrchAdvanced
			End If
		End If
		If sSrchBasic <> "" Then
			If sSrchWhere <> "" Then
				sSrchWhere = "(" & sSrchWhere & ") AND (" & sSrchBasic & ")"
			Else
				sSrchWhere = sSrchBasic
			End If
		End If

		' Call Recordset Searching event
		Call xwfb.Recordset_Searching(sSrchWhere)

		' Save search criteria
		If sSrchWhere <> "" Then
			If sSrchAdvanced = "" Then Call ResetAdvancedSearchParms()
			xwfb.SearchWhere = sSrchWhere ' Save to Session
			lStartRec = 1 ' Reset start record counter
			xwfb.StartRecordNumber = lStartRec
		Else
			Call RestoreSearchParms()
		End If

		' Build filter
		sFilter = ""
		If Not Security.CanList Then
			sFilter = "(0=1)" ' Filter all records
		End If

		' Restore master/detail filter
		sDbMasterFilter = xwfb.MasterFilter ' Restore master filter
		sDbDetailFilter = xwfb.DetailFilter ' Restore detail filter
		If sDbDetailFilter <> "" Then
			If sFilter <> "" Then
				sFilter = "(" & sFilter & ") AND (" & sDbDetailFilter & ")"
			Else
				sFilter = sDbDetailFilter
			End If
		End If
		If sSrchWhere <> "" Then
			If sFilter <> "" Then
				sFilter = "(" & sFilter & ") AND (" & sSrchWhere & ")"
			Else
				sFilter = sSrchWhere
			End If
		End If
		Dim RsMaster

		' Load master record
		If xwfb.MasterFilter <> "" And xwfb.CurrentMasterTable = "bhlm" Then
			Set RsMaster = bhlm.LoadRs(sDbMasterFilter)
			bMasterRecordExists = Not (RsMaster Is Nothing)
			If Not bMasterRecordExists Then
				xwfb.MasterFilter = "" ' Clear master filter
				xwfb.DetailFilter = "" ' Clear detail filter
				Message = "没有找到记录" ' Set no record found
				Call Page_Terminate(xwfb.ReturnUrl) ' Return to caller
			Else
				Call bhlm.LoadListRowValues(RsMaster)
				bhlm.RowType = EW_ROWTYPE_MASTER ' Master row
				Call bhlm.RenderListRow()
				RsMaster.Close
				Set RsMaster = Nothing
			End If
		End If

		' Load master record
		If xwfb.MasterFilter <> "" And xwfb.CurrentMasterTable = "xwlm" Then
			Set RsMaster = xwlm.LoadRs(sDbMasterFilter)
			bMasterRecordExists = Not (RsMaster Is Nothing)
			If Not bMasterRecordExists Then
				xwfb.MasterFilter = "" ' Clear master filter
				xwfb.DetailFilter = "" ' Clear detail filter
				Message = "没有找到记录" ' Set no record found
				Call Page_Terminate(xwfb.ReturnUrl) ' Return to caller
			Else
				Call xwlm.LoadListRowValues(RsMaster)
				xwlm.RowType = EW_ROWTYPE_MASTER ' Master row
				Call xwlm.RenderListRow()
				RsMaster.Close
				Set RsMaster = Nothing
			End If
		End If

		' Load master record
		If xwfb.MasterFilter <> "" And xwfb.CurrentMasterTable = "sjlm" Then
			Set RsMaster = sjlm.LoadRs(sDbMasterFilter)
			bMasterRecordExists = Not (RsMaster Is Nothing)
			If Not bMasterRecordExists Then
				xwfb.MasterFilter = "" ' Clear master filter
				xwfb.DetailFilter = "" ' Clear detail filter
				Message = "没有找到记录" ' Set no record found
				Call Page_Terminate(xwfb.ReturnUrl) ' Return to caller
			Else
				Call sjlm.LoadListRowValues(RsMaster)
				sjlm.RowType = EW_ROWTYPE_MASTER ' Master row
				Call sjlm.RenderListRow()
				RsMaster.Close
				Set RsMaster = Nothing
			End If
		End If

		' Set up filter in Session
		xwfb.SessionWhere = sFilter
		xwfb.CurrentFilter = ""
	End Sub

	' -----------------------------------------------------------------
	' Return Advanced Search Where based on QueryString parameters
	'
	Function AdvancedSearchWhere()
		Dim sWhere
		sWhere = ""
		If Not Security.CanSearch Then
			AdvancedSearchWhere = ""
			Exit Function
		End If

		' Field id
		Call BuildSearchSql(sWhere, xwfb.id, False)

		' Field bh
		Call BuildSearchSql(sWhere, xwfb.bh, False)

		' Field lmid
		Call BuildSearchSql(sWhere, xwfb.lmid, False)

		' Field sj
		Call BuildSearchSql(sWhere, xwfb.sj, False)

		' Field xwbt
		Call BuildSearchSql(sWhere, xwfb.xwbt, False)

		' Field fbsj
		Call BuildSearchSql(sWhere, xwfb.fbsj, False)

		' Field pic
		Call BuildSearchSql(sWhere, xwfb.pic, False)

		' Field content
		Call BuildSearchSql(sWhere, xwfb.content, False)

		' Field ishome
		Call BuildSearchSql(sWhere, xwfb.ishome, False)

		' Field px
		Call BuildSearchSql(sWhere, xwfb.px, False)
		AdvancedSearchWhere = sWhere

		' Set up search parm
		If AdvancedSearchWhere <> "" Then

			' Field id
			Call SetSearchParm(xwfb.id)

			' Field bh
			Call SetSearchParm(xwfb.bh)

			' Field lmid
			Call SetSearchParm(xwfb.lmid)

			' Field sj
			Call SetSearchParm(xwfb.sj)

			' Field xwbt
			Call SetSearchParm(xwfb.xwbt)

			' Field fbsj
			Call SetSearchParm(xwfb.fbsj)

			' Field pic
			Call SetSearchParm(xwfb.pic)

			' Field content
			Call SetSearchParm(xwfb.content)

			' Field ishome
			Call SetSearchParm(xwfb.ishome)

			' Field px
			Call SetSearchParm(xwfb.px)
		End If
	End Function

	' -----------------------------------------------------------------
	' Build search sql
	'
	' -----------------------------------------------------------------
	' Build search sql
	'
	Sub BuildSearchSql(Where, Fld, MultiValue)
		Dim FldParm, FldVal, FldOpr, FldCond, FldVal2, FldOpr2
		FldParm = Mid(Fld.FldVar, 3)
		FldVal = Request.QueryString("x_" & FldParm)
		FldOpr = Request.QueryString("z_" & FldParm)
		FldCond = Request.QueryString("v_" & FldParm)
		FldVal2 = Request.QueryString("y_" & FldParm)
		FldOpr2 = Request.QueryString("w_" & FldParm)
		Dim sWrk
		sWrk = ""
		FldOpr = UCase(Trim(FldOpr))
		If (FldOpr = "") Then FldOpr = "="
		FldOpr2 = UCase(Trim(FldOpr2))
		If FldOpr2 = "" Then FldOpr2 = "="
		If EW_SEARCH_MULTI_VALUE_OPTION = 1 Then MultiValue = False
		If FldOpr <> "LIKE" Then MultiValue = False
		If FldOpr2 <> "LIKE" And FldVal2 <> "" Then MultiValue = False
		If MultiValue Then
			Dim sWrk1, sWrk2

			' Field value 1
			If FldVal <> "" Then
				sWrk1 = ew_GetMultiSearchSql(Fld, FldVal)
			Else
				sWrk1 = ""
			End If

			' Field value 2
			If FldVal2 <> "" And FldCond <> "" Then
				sWrk2 = ew_GetMultiSearchSql(Fld, FldVal2)
			Else
				sWrk2 = ""
			End If

			' Build final SQL
			sWrk = sWrk1
			If sWrk2 <> "" Then
				If sWrk <> "" Then
					sWrk = "(" & sWrk & ") " & FldCond & " (" & sWrk2 & ")"
				Else
					sWrk = sWrk2
				End If
			End If
		Else
			FldVal = ConvertSearchValue(Fld, FldVal)
			FldVal2 = ConvertSearchValue(Fld, FldVal2)
			sWrk = ew_GetSearchSql(Fld, FldVal, FldOpr, FldCond, FldVal2, FldOpr2)
		End If
		If sWrk <> "" Then
			If Where <> "" Then Where = Where & " AND "
			Where = Where & "(" & sWrk & ")"
		End If
	End Sub

	' -----------------------------------------------------------------
	' Set search parm
	'
	Sub SetSearchParm(Fld)
		Dim FldParm
		FldParm = Mid(Fld.FldVar, 3)
		Call xwfb.SetAdvancedSearch("x_" & FldParm, Request.QueryString("x_" & FldParm))
		Call xwfb.SetAdvancedSearch("z_" & FldParm, Request.QueryString("z_" & FldParm))
		Call xwfb.SetAdvancedSearch("v_" & FldParm, Request.QueryString("v_" & FldParm))
		Call xwfb.SetAdvancedSearch("y_" & FldParm, Request.QueryString("y_" & FldParm))
		Call xwfb.SetAdvancedSearch("w_" & FldParm, Request.QueryString("w_" & FldParm))
	End Sub

	' -----------------------------------------------------------------
	' Convert search value
	'
	Function ConvertSearchValue(Fld, FldVal)
		ConvertSearchValue = FldVal
		If Fld.FldDataType = EW_DATATYPE_BOOLEAN Then
			If FldVal <> "" Then ConvertSearchValue = ew_IIf(FldVal="1", "True", "False")
		ElseIf Fld.FldDataType = EW_DATATYPE_DATE Then
			If FldVal <> "" Then ConvertSearchValue = ew_UnFormatDateTime(FldVal, Fld.FldDateTimeFormat)
		End If
	End Function

	' -----------------------------------------------------------------
	' Clear all search parameters
	'
	Sub ResetSearchParms()

		' Clear search where
		sSrchWhere = ""
		xwfb.SearchWhere = sSrchWhere

		' Clear advanced search parameters
		Call ResetAdvancedSearchParms()
	End Sub

	' -----------------------------------------------------------------
	' Clear all advanced search parameters
	'
	Sub ResetAdvancedSearchParms()

		' Clear advanced search parameters
		Call xwfb.SetAdvancedSearch("x_id", "")
		Call xwfb.SetAdvancedSearch("x_bh", "")
		Call xwfb.SetAdvancedSearch("x_lmid", "")
		Call xwfb.SetAdvancedSearch("x_sj", "")
		Call xwfb.SetAdvancedSearch("x_xwbt", "")
		Call xwfb.SetAdvancedSearch("x_fbsj", "")
		Call xwfb.SetAdvancedSearch("x_pic", "")
		Call xwfb.SetAdvancedSearch("x_content", "")
		Call xwfb.SetAdvancedSearch("x_ishome", "")
		Call xwfb.SetAdvancedSearch("x_px", "")
	End Sub

	' -----------------------------------------------------------------
	' Restore all search parameters
	'
	Sub RestoreSearchParms()
		sSrchWhere = xwfb.SearchWhere

		' Restore advanced search settings
		If gsSearchError = "" Then
			Call RestoreAdvancedSearchParms()
		End If
	End Sub

	' -----------------------------------------------------------------
	' Restore all advanced search parameters
	'
	Sub RestoreAdvancedSearchParms()

		' Restore advanced search parms
		xwfb.id.AdvancedSearch.SearchValue = xwfb.GetAdvancedSearch("x_id")
		xwfb.bh.AdvancedSearch.SearchValue = xwfb.GetAdvancedSearch("x_bh")
		xwfb.lmid.AdvancedSearch.SearchValue = xwfb.GetAdvancedSearch("x_lmid")
		xwfb.sj.AdvancedSearch.SearchValue = xwfb.GetAdvancedSearch("x_sj")
		xwfb.xwbt.AdvancedSearch.SearchValue = xwfb.GetAdvancedSearch("x_xwbt")
		xwfb.fbsj.AdvancedSearch.SearchValue = xwfb.GetAdvancedSearch("x_fbsj")
		xwfb.pic.AdvancedSearch.SearchValue = xwfb.GetAdvancedSearch("x_pic")
		xwfb.content.AdvancedSearch.SearchValue = xwfb.GetAdvancedSearch("x_content")
		xwfb.ishome.AdvancedSearch.SearchValue = xwfb.GetAdvancedSearch("x_ishome")
		xwfb.px.AdvancedSearch.SearchValue = xwfb.GetAdvancedSearch("x_px")
	End Sub

	' -----------------------------------------------------------------
	' Set up Sort parameters based on Sort Links clicked
	'
	Sub SetUpSortOrder()
		Dim sOrderBy
		Dim sSortField, sLastSort, sThisSort
		Dim bCtrl

		' Check for an Order parameter
		If Request.QueryString("order").Count > 0 Then
			xwfb.CurrentOrder = Request.QueryString("order")
			xwfb.CurrentOrderType = Request.QueryString("ordertype")

			' Field id
			Call xwfb.UpdateSort(xwfb.id)

			' Field bh
			Call xwfb.UpdateSort(xwfb.bh)

			' Field lmid
			Call xwfb.UpdateSort(xwfb.lmid)

			' Field sj
			Call xwfb.UpdateSort(xwfb.sj)

			' Field xwbt
			Call xwfb.UpdateSort(xwfb.xwbt)

			' Field fbsj
			Call xwfb.UpdateSort(xwfb.fbsj)

			' Field ishome
			Call xwfb.UpdateSort(xwfb.ishome)

			' Field px
			Call xwfb.UpdateSort(xwfb.px)
			xwfb.StartRecordNumber = 1 ' Reset start position
		End If
	End Sub

	' -----------------------------------------------------------------
	' Load Sort Order parameters
	'
	Sub LoadSortOrder()
		Dim sOrderBy
		sOrderBy = xwfb.SessionOrderBy ' Get order by from Session
		If sOrderBy = "" Then
			If xwfb.SqlOrderBy <> "" Then
				sOrderBy = xwfb.SqlOrderBy
				xwfb.SessionOrderBy = sOrderBy
			End If
		End If
	End Sub

	' -----------------------------------------------------------------
	' Reset command based on querystring parameter cmd=
	' - RESET: reset search parameters
	' - RESETALL: reset search & master/detail parameters
	' - RESETSORT: reset sort parameters
	'
	Sub ResetCmd()
		Dim sCmd

		' Get reset cmd
		If Request.QueryString("cmd").Count > 0 Then
			sCmd = Request.QueryString("cmd")

			' Reset search criteria
			If LCase(sCmd) = "reset" Or LCase(sCmd) = "resetall" Then
				Call ResetSearchParms()
			End If

			' Reset master/detail keys
			If LCase(sCmd) = "resetall" Then
				xwfb.CurrentMasterTable = "" ' Clear master table
				xwfb.MasterFilter = "" ' Clear master filter
				sDbMasterFilter = ""
				xwfb.DetailFilter = "" ' Clear detail filter
				sDbDetailFilter = ""
				xwfb.bh.SessionValue = ""
				xwfb.bh.SessionValue = ""
				xwfb.lmid.SessionValue = ""
				xwfb.bh.SessionValue = ""
				xwfb.lmid.SessionValue = ""
				xwfb.sj.SessionValue = ""
			End If

			' Reset Sort Criteria
			If LCase(sCmd) = "resetsort" Then
				Dim sOrderBy
				sOrderBy = ""
				xwfb.SessionOrderBy = sOrderBy
				xwfb.id.Sort = ""
				xwfb.bh.Sort = ""
				xwfb.lmid.Sort = ""
				xwfb.sj.Sort = ""
				xwfb.xwbt.Sort = ""
				xwfb.fbsj.Sort = ""
				xwfb.ishome.Sort = ""
				xwfb.px.Sort = ""
			End If

			' Reset start position
			lStartRec = 1
			xwfb.StartRecordNumber = lStartRec
		End If
	End Sub
	Dim Pager

	' -----------------------------------------------------------------
	' Set up Starting Record parameters based on Pager Navigation
	'
	Sub SetUpStartRec()
		Dim nPageNo

		' Exit if lDisplayRecs = 0
		If lDisplayRecs = 0 Then Exit Sub
		If IsPageRequest Then ' Validate request

			' Check for a START parameter
			If Request.QueryString(EW_TABLE_START_REC).Count > 0 Then
				lStartRec = Request.QueryString(EW_TABLE_START_REC)
				xwfb.StartRecordNumber = lStartRec
			ElseIf Request.QueryString(EW_TABLE_PAGE_NO).Count > 0 Then
				nPageNo = Request.QueryString(EW_TABLE_PAGE_NO)
				If IsNumeric(nPageNo) Then
					lStartRec = (nPageNo-1)*lDisplayRecs+1
					If lStartRec <= 0 Then
						lStartRec = 1
					ElseIf lStartRec >= ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 Then
						lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1
					End If
					xwfb.StartRecordNumber = lStartRec
				End If
			End If
		End If
		lStartRec = xwfb.StartRecordNumber

		' Check if correct start record counter
		If Not IsNumeric(lStartRec) Or lStartRec = "" Then ' Avoid invalid start record counter
			lStartRec = 1 ' Reset start record counter
			xwfb.StartRecordNumber = lStartRec
		ElseIf CLng(lStartRec) > CLng(lTotalRecs) Then ' Avoid starting record > total records
			lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to last page first record
			xwfb.StartRecordNumber = lStartRec
		ElseIf (lStartRec-1) Mod lDisplayRecs <> 0 Then
			lStartRec = ((lStartRec-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to page boundary
			xwfb.StartRecordNumber = lStartRec
		End If
	End Sub

	' -----------------------------------------------------------------
	'  Load search values for validation
	'
	Function LoadSearchValues()

		' Load search values
	End Function

	' -----------------------------------------------------------------
	' Load recordset
	'
	Function LoadRecordset()

		' Call Recordset Selecting event
		Call xwfb.Recordset_Selecting(xwfb.CurrentFilter)

		' Load list page sql
		Dim sSql
		sSql = xwfb.ListSQL
		If EW_DEBUG_ENABLED Then Response.Write sSql ' Show SQL for debugging

		' Load recordset
		Dim RsRecordset
		Set RsRecordset = Server.CreateObject("ADODB.Recordset")
		RsRecordset.CursorLocation = EW_CURSORLOCATION
		RsRecordset.Open sSql, Conn, 1, 2

		' Call Recordset Selected event
		Call xwfb.Recordset_Selected(RsRecordset)
		Set LoadRecordset = RsRecordset
	End Function

	' -----------------------------------------------------------------
	' Load row based on key values
	'
	Function LoadRow()
		Dim RsRow, sSql, sFilter
		sFilter = xwfb.KeyFilter

		' Call Row Selecting event
		Call xwfb.Row_Selecting(sFilter)

		' Load sql based on filter
		xwfb.CurrentFilter = sFilter
		sSql = xwfb.SQL
		If EW_DEBUG_ENABLED Then Response.Write sSql ' Show SQL for debugging
		Set RsRow = Server.CreateObject("ADODB.Recordset")
		RsRow.Open sSql, Conn
		If RsRow.Eof Then
			LoadRow = False
		Else
			LoadRow = True
			RsRow.MoveFirst
			Call LoadRowValues(RsRow) ' Load row values

			' Call Row Selected event
			Call xwfb.Row_Selected(RsRow)
		End If
		RsRow.Close
		Set RsRow = Nothing
	End Function

	' -----------------------------------------------------------------
	' Load row values from recordset
	'
	Sub LoadRowValues(RsRow)
		xwfb.id.DbValue = RsRow("id")
		xwfb.bh.DbValue = RsRow("bh")
		xwfb.lmid.DbValue = RsRow("lmid")
		xwfb.sj.DbValue = RsRow("sj")
		xwfb.xwbt.DbValue = RsRow("xwbt")
		xwfb.fbsj.DbValue = RsRow("fbsj")
		xwfb.pic.DbValue = RsRow("pic")
		xwfb.content.DbValue = RsRow("content")
		xwfb.ishome.DbValue = RsRow("ishome")
		xwfb.px.DbValue = RsRow("px")
	End Sub

	' -----------------------------------------------------------------
	' Render row values based on field settings
	'
	Sub RenderRow()

		' Call Row Rendering event
		Call xwfb.Row_Rendering()

		' ---------------------------------------
		'  Common render codes for all row types
		' ---------------------------------------
		' id

		xwfb.id.CellCssStyle = ""
		xwfb.id.CellCssClass = ""

		' bh
		xwfb.bh.CellCssStyle = ""
		xwfb.bh.CellCssClass = ""

		' lmid
		xwfb.lmid.CellCssStyle = ""
		xwfb.lmid.CellCssClass = ""

		' sj
		xwfb.sj.CellCssStyle = ""
		xwfb.sj.CellCssClass = ""

		' xwbt
		xwfb.xwbt.CellCssStyle = ""
		xwfb.xwbt.CellCssClass = ""

		' fbsj
		xwfb.fbsj.CellCssStyle = ""
		xwfb.fbsj.CellCssClass = ""

		' ishome
		xwfb.ishome.CellCssStyle = ""
		xwfb.ishome.CellCssClass = ""

		' px
		xwfb.px.CellCssStyle = ""
		xwfb.px.CellCssClass = ""

		' -----------
		'  View  Row
		' -----------

		If xwfb.RowType = EW_ROWTYPE_VIEW Then ' View row

			' id
			xwfb.id.ViewValue = xwfb.id.CurrentValue
			xwfb.id.CssStyle = ""
			xwfb.id.CssClass = ""
			xwfb.id.ViewCustomAttributes = ""

			' bh
			If xwfb.bh.CurrentValue & "" <> "" Then
				sSqlWrk = "SELECT [bhmc] FROM [bhlm] WHERE [bh] = " & ew_AdjustSql(xwfb.bh.CurrentValue) & ""
				Set RsWrk = Conn.Execute(sSqlWrk)
				If Not RsWrk.Eof Then
					xwfb.bh.ViewValue = RsWrk("bhmc")
				Else
					xwfb.bh.ViewValue = xwfb.bh.CurrentValue
				End If
				RsWrk.Close
				Set RsWrk = Nothing
			Else
				xwfb.bh.ViewValue = Null
			End If
			xwfb.bh.CssStyle = ""
			xwfb.bh.CssClass = ""
			xwfb.bh.ViewCustomAttributes = ""

			' lmid
			If xwfb.lmid.CurrentValue & "" <> "" Then
				sSqlWrk = "SELECT [lmmc] FROM [xwlm] WHERE [lmid] = " & ew_AdjustSql(xwfb.lmid.CurrentValue) & ""
				Set RsWrk = Conn.Execute(sSqlWrk)
				If Not RsWrk.Eof Then
					xwfb.lmid.ViewValue = RsWrk("lmmc")
				Else
					xwfb.lmid.ViewValue = xwfb.lmid.CurrentValue
				End If
				RsWrk.Close
				Set RsWrk = Nothing
			Else
				xwfb.lmid.ViewValue = Null
			End If
			xwfb.lmid.CssStyle = ""
			xwfb.lmid.CssClass = ""
			xwfb.lmid.ViewCustomAttributes = ""

			' sj
			If xwfb.sj.CurrentValue & "" <> "" Then
				sSqlWrk = "SELECT [sjmc] FROM [sjlm] WHERE [id] = " & ew_AdjustSql(xwfb.sj.CurrentValue) & ""
				Set RsWrk = Conn.Execute(sSqlWrk)
				If Not RsWrk.Eof Then
					xwfb.sj.ViewValue = RsWrk("sjmc")
				Else
					xwfb.sj.ViewValue = xwfb.sj.CurrentValue
				End If
				RsWrk.Close
				Set RsWrk = Nothing
			Else
				xwfb.sj.ViewValue = Null
			End If
			xwfb.sj.CssStyle = ""
			xwfb.sj.CssClass = ""
			xwfb.sj.ViewCustomAttributes = ""

			' xwbt
			xwfb.xwbt.ViewValue = xwfb.xwbt.CurrentValue
			xwfb.xwbt.CssStyle = ""
			xwfb.xwbt.CssClass = ""
			xwfb.xwbt.ViewCustomAttributes = ""

			' fbsj
			xwfb.fbsj.ViewValue = xwfb.fbsj.CurrentValue
			xwfb.fbsj.ViewValue = ew_FormatDateTime(xwfb.fbsj.ViewValue, 5)
			xwfb.fbsj.CssStyle = ""
			xwfb.fbsj.CssClass = ""
			xwfb.fbsj.ViewCustomAttributes = ""

			' ishome
			If Not IsNull(xwfb.ishome.CurrentValue) Then
				Select Case xwfb.ishome.CurrentValue
					Case "0"
						xwfb.ishome.ViewValue = "否"
					Case "1"
						xwfb.ishome.ViewValue = "是"
					Case Else
						xwfb.ishome.ViewValue = xwfb.ishome.CurrentValue
				End Select
			Else
				xwfb.ishome.ViewValue = Null
			End If
			xwfb.ishome.CssStyle = ""
			xwfb.ishome.CssClass = ""
			xwfb.ishome.ViewCustomAttributes = ""

			' px
			xwfb.px.ViewValue = xwfb.px.CurrentValue
			xwfb.px.CssStyle = ""
			xwfb.px.CssClass = ""
			xwfb.px.ViewCustomAttributes = ""

			' View refer script
			' id

			xwfb.id.HrefValue = ""

			' bh
			xwfb.bh.HrefValue = ""

			' lmid
			xwfb.lmid.HrefValue = ""

			' sj
			xwfb.sj.HrefValue = ""

			' xwbt
			xwfb.xwbt.HrefValue = ""

			' fbsj
			xwfb.fbsj.HrefValue = ""

			' ishome
			xwfb.ishome.HrefValue = ""

			' px
			xwfb.px.HrefValue = ""
		End If

		' Call Row Rendered event
		Call xwfb.Row_Rendered()
	End Sub

	' -----------------------------------------------------------------
	' Validate search
	'
	Function ValidateSearch()

		' Initialize
		gsSearchError = ""

		' Check if validation required
		If Not EW_SERVER_VALIDATE Then
			ValidateSearch = True
			Exit Function
		End If

		' Return validate result
		ValidateSearch = (gsSearchError = "")

		' Call Form Custom Validate event
		Dim sFormCustomError
		sFormCustomError = ""
		ValidateSearch = ValidateSearch And Form_CustomValidate(sFormCustomError)
		If sFormCustomError <> "" Then
			If gsSearchError <> "" Then gsSearchError = gsSearchError & "<br>"
			gsSearchError = gsSearchError & sFormCustomError
		End If
	End Function

	' -----------------------------------------------------------------
	' Load advanced search
	'
	Function LoadAdvancedSearch()
End Function

	' -----------------------------------------------------------------
	' Set up Master Detail based on querystring parameter
	'
	Sub SetUpMasterDetail()
		Dim bValidMaster, sMasterTblVar
		bValidMaster = False

		' Get the keys for master table
		If Request.QueryString(EW_TABLE_SHOW_MASTER).Count > 0 Then
			sMasterTblVar = Request.QueryString(EW_TABLE_SHOW_MASTER)
			If sMasterTblVar = "" Then
				bValidMaster = True
				sDbMasterFilter = ""
				sDbDetailFilter = ""
			End If
			If sMasterTblVar = "bhlm" Then
				bValidMaster = True
				sDbMasterFilter = xwfb.SqlMasterFilter_bhlm
				sDbDetailFilter = xwfb.SqlDetailFilter_bhlm
				If Request.QueryString("bh").Count > 0 Then
					bhlm.bh.QueryStringValue = Request.QueryString("bh")
					xwfb.bh.QueryStringValue = bhlm.bh.QueryStringValue
					xwfb.bh.SessionValue = xwfb.bh.QueryStringValue
					If Not IsNumeric(bhlm.bh.QueryStringValue) Then bValidMaster = False
					sDbMasterFilter = Replace(sDbMasterFilter, "@bh@", ew_AdjustSql(bhlm.bh.QueryStringValue))
					sDbDetailFilter = Replace(sDbDetailFilter, "@bh@", ew_AdjustSql(bhlm.bh.QueryStringValue))
				Else
					bValidMaster = False
				End If
			End If
			If sMasterTblVar = "xwlm" Then
				bValidMaster = True
				sDbMasterFilter = xwfb.SqlMasterFilter_xwlm
				sDbDetailFilter = xwfb.SqlDetailFilter_xwlm
				If Request.QueryString("bh").Count > 0 Then
					xwlm.bh.QueryStringValue = Request.QueryString("bh")
					xwfb.bh.QueryStringValue = xwlm.bh.QueryStringValue
					xwfb.bh.SessionValue = xwfb.bh.QueryStringValue
					If Not IsNumeric(xwlm.bh.QueryStringValue) Then bValidMaster = False
					sDbMasterFilter = Replace(sDbMasterFilter, "@bh@", ew_AdjustSql(xwlm.bh.QueryStringValue))
					sDbDetailFilter = Replace(sDbDetailFilter, "@bh@", ew_AdjustSql(xwlm.bh.QueryStringValue))
				Else
					bValidMaster = False
				End If
				If Request.QueryString("lmid").Count > 0 Then
					xwlm.lmid.QueryStringValue = Request.QueryString("lmid")
					xwfb.lmid.QueryStringValue = xwlm.lmid.QueryStringValue
					xwfb.lmid.SessionValue = xwfb.lmid.QueryStringValue
					If Not IsNumeric(xwlm.lmid.QueryStringValue) Then bValidMaster = False
					sDbMasterFilter = Replace(sDbMasterFilter, "@lmid@", ew_AdjustSql(xwlm.lmid.QueryStringValue))
					sDbDetailFilter = Replace(sDbDetailFilter, "@lmid@", ew_AdjustSql(xwlm.lmid.QueryStringValue))
				Else
					bValidMaster = False
				End If
			End If
			If sMasterTblVar = "sjlm" Then
				bValidMaster = True
				sDbMasterFilter = xwfb.SqlMasterFilter_sjlm
				sDbDetailFilter = xwfb.SqlDetailFilter_sjlm
				If Request.QueryString("bh").Count > 0 Then
					sjlm.bh.QueryStringValue = Request.QueryString("bh")
					xwfb.bh.QueryStringValue = sjlm.bh.QueryStringValue
					xwfb.bh.SessionValue = xwfb.bh.QueryStringValue
					If Not IsNumeric(sjlm.bh.QueryStringValue) Then bValidMaster = False
					sDbMasterFilter = Replace(sDbMasterFilter, "@bh@", ew_AdjustSql(sjlm.bh.QueryStringValue))
					sDbDetailFilter = Replace(sDbDetailFilter, "@bh@", ew_AdjustSql(sjlm.bh.QueryStringValue))
				Else
					bValidMaster = False
				End If
				If Request.QueryString("lmid").Count > 0 Then
					sjlm.lmid.QueryStringValue = Request.QueryString("lmid")
					xwfb.lmid.QueryStringValue = sjlm.lmid.QueryStringValue
					xwfb.lmid.SessionValue = xwfb.lmid.QueryStringValue
					If Not IsNumeric(sjlm.lmid.QueryStringValue) Then bValidMaster = False
					sDbMasterFilter = Replace(sDbMasterFilter, "@lmid@", ew_AdjustSql(sjlm.lmid.QueryStringValue))
					sDbDetailFilter = Replace(sDbDetailFilter, "@lmid@", ew_AdjustSql(sjlm.lmid.QueryStringValue))
				Else
					bValidMaster = False
				End If
				If Request.QueryString("id").Count > 0 Then
					sjlm.id.QueryStringValue = Request.QueryString("id")
					xwfb.sj.QueryStringValue = sjlm.id.QueryStringValue
					xwfb.sj.SessionValue = xwfb.sj.QueryStringValue
					If Not IsNumeric(sjlm.id.QueryStringValue) Then bValidMaster = False
					sDbMasterFilter = Replace(sDbMasterFilter, "@id@", ew_AdjustSql(sjlm.id.QueryStringValue))
					sDbDetailFilter = Replace(sDbDetailFilter, "@sj@", ew_AdjustSql(sjlm.id.QueryStringValue))
				Else
					bValidMaster = False
				End If
			End If
		End If
		If bValidMaster Then

			' Save current master table
			xwfb.CurrentMasterTable = sMasterTblVar

			' Reset start record counter (new master key)
			lStartRec = 1
			xwfb.StartRecordNumber = lStartRec
			xwfb.MasterFilter = sDbMasterFilter ' Set up master filter
			xwfb.DetailFilter = sDbDetailFilter ' Set up detail filter

			' Clear previous master session values
			If sMasterTblVar <> "bhlm" Then
				If xwfb.bh.QueryStringValue = "" Then xwfb.bh.SessionValue = ""
			End If
			If sMasterTblVar <> "xwlm" Then
				If xwfb.bh.QueryStringValue = "" Then xwfb.bh.SessionValue = ""
				If xwfb.lmid.QueryStringValue = "" Then xwfb.lmid.SessionValue = ""
			End If
			If sMasterTblVar <> "sjlm" Then
				If xwfb.bh.QueryStringValue = "" Then xwfb.bh.SessionValue = ""
				If xwfb.lmid.QueryStringValue = "" Then xwfb.lmid.SessionValue = ""
				If xwfb.sj.QueryStringValue = "" Then xwfb.sj.SessionValue = ""
			End If
		End If
	End Sub

	' Page Load event
	Sub Page_Load()

		'Response.Write "Page Load"
	End Sub

	' Page Unload event
	Sub Page_Unload()

		'Response.Write "Page Unload"
	End Sub

	' Form Custom Validate event
	Function Form_CustomValidate(CustomError)

		'Return error message in CustomError
		Form_CustomValidate = True
	End Function
End Class
%>
