<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/function.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p19")
'''''''''''''''''''''''''''''''''''''''''''''''
%>
<html>
<head>
<title>旅游线路管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../JS/PublicJS.js"></script>
<script language="JavaScript" src="../js/areas.js"></script>
<style type="text/css">
<!--
.style1 {color: #FF0000}
.style2 {color: #CCCCCC}
.style3 {color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
<script language="javascript">
function check(obj){
	if(obj.Title.value==""){
		alert("名称不能为空!");
		obj.Title.focus();
		obj.Title.select();
		return false;
	}else if(obj.SignDate.value==""){
		alert("报名截止日期不能为空!");
		obj.SignDate.focus();
		obj.SignDate.select();
		return false;
	}
	return true;
}

function ConfirmDel()
{
   if(confirm("确认删除？并且不能恢复！确定要删除此信息吗？"))
     return true;
   else
     return false;
	 
}
</script>
<script src="../js/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="../js/jquery-ui-1.8.10/js/jquery-ui-1.8.10.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
        $("#dialog:ui-dialog").dialog("destroy");
        $("#dialog-win").dialog({
            autoOpen: false,
            width: 530,
						height: 430,            
            modal: true,
            buttons: {
                "确定": function () {
                    $(this).dialog("close");  
										 document.execCommand('Refresh');
                },
                "取消": function () {
                    $(this).dialog("close");
                }
            },
            close: function () {
                
            }
        });

        $( "#openmapbtn").click(function() {
				$( "#dialog-win" ).dialog( "open" );
			});
});
function CloseFrame() {
    $("#dialog-win").dialog("close");
}
</script>
<link href="../js/jquery-ui-1.8.10/css/ui-lightness/jquery-ui-1.8.10.custom.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<%
dim act,table
table="t_route"
act=trim(request.QueryString("act"))
if isempty(act) or act="" then
	call InnerKeys_List
elseif(act="add") then
	call InnerKeys_Add
elseif(act="addok") then
	call InnerKeys_AddOk
elseif(act="mod") then
	call InnerKeys_Mod
elseif(act="modok") then
	call InnerKeys_ModOk
elseif(act="delp") then
	call InnerKeys_DelPrice
elseif(act="rem") then
	dim val,id
	id=Clng(request.QueryString("id"))
	val=cint(request.QueryString("val"))
	conn.execute("update t_route set IsRem="&val&" where id="&id)
	response.Redirect(request.ServerVariables("HTTP_REFERER"))
elseif(act="bat") then
	dim obj,objArr,flags,do_type
	do_type=request.form("do_type")
	if not isempty(request.Form("obj")) then
		obj=request.Form("obj")
	else
		response.Write("请选择需要操作的记录")
		response.Write("<a href=""#"" onClick=""javascript:history.back();"">返回</a>")
		response.End()
	end if
	response.write("<br><br><br><br><p align=""center"">")
	objArr=split(obj,",")
		for i=0 to ubound(objArr)	
			if(do_type="del") then
				conn.execute("delete from t_route where id="&objArr(i))
				response.Write("批量删除成功:id"&objArr(i)&"！")
			elseif(do_type="recommend") then
				conn.execute("update t_route set IsRem=1 where id="&objArr(i))
				response.Write("批量推荐成功！")
			elseif(do_type="unrecommend") then
				conn.execute("update t_route set IsRem=0 where id="&objArr(i))
				response.Write("批量取消推荐成功！")
			elseif(do_type="check") then
				conn.execute("update t_route set IsCheck=1 where id="&objArr(i))				
			elseif(do_type="uncheck") then
				conn.execute("update t_route set IsCheck=0 where id="&objArr(i))				
			end if				
		next
	response.Redirect(request.ServerVariables("HTTP_REFERER"))
end if
%>
<%
Sub InnerKeys_DelPrice
	dim id,pid
	id=Clng(request.QueryString("id"))
	pid=Clng(request.QueryString("pid"))
	if(id>0 and pid>0) then
		conn.execute("delete from t_route_price where id="&pid)
	end if
	response.Redirect(request.ServerVariables("HTTP_REFERER"))
end Sub
Sub InnerKeys_Add
%>
<FORM method="POST" name="form1" action="?act=addok" style="margin:0 0 0 0;" onSubmit="return check(this)">
  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<TR bgcolor="#FF9900">
  <TD height="24" colspan="2"><div align="center" class="style3">添加旅游线路</div></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD align="right">分类：</TD>
  <TD>
  <select name="ClassId" id="ClassId">
  <%=getSourceOption(0,"t_route_catalog")%>
  </select>
  <a href="routes_catalog.asp">分类管理？ </a></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD width="14%"><div align="right">名称：</div></TD>
  <TD width="86%"><input name="Title" type="text" id="Title" size="55">
  色彩&nbsp;<input type="text" size="8" name="Color">
  &nbsp;<input type="button" name="title_colors" value="选色" onClick="OpenWindowAndSetValue('editor/selcolor.htm',230,190,window,document.form1.Color);">
  </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>价格：</TD>
  <TD align=left><input name="Price" type="text" id="Price" value="0" size="12">
    元</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>地区：</TD>
  <TD align=left>
  <select name="Province" id="Province" onChange="GetChilds(this.options[this.selectedIndex].value,0,'City')">
  <script type="text/javascript">
	 document.write(GetFirst(0,''));
	</script>
  </select>
  <select name="City" id="City">
  </select>
 
 </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>线路说明：</TD>
  <TD align=left>
  <INPUT type="hidden" name="Routing" id="Routing" value="">
	<IFRAME ID="eWebEditor1" src="webedits/ewebeditor.htm?id=Routing&style=coolblue" frameborder="0" scrolling="no" width="98%" height="350"></IFRAME>
  </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>线路服务接待标准：</TD>
  <TD align=left>
  <INPUT type="hidden" name="Servers" id="Servers" value="">
	<IFRAME ID="eWebEditor1" src="webedits/ewebeditor.htm?id=Servers&style=coolblue" frameborder="0" scrolling="no" width="98%" height="350"></IFRAME>
  </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>线路详细报价：</TD>
  <TD align=left><table width="100%" border="0" cellspacing="1" cellpadding="0">
    <tr>
      <td height="22" bgcolor="#F7F7F7">人数/类型</td>
      <td bgcolor="#F7F7F7">标准等</td>
      <td bgcolor="#F7F7F7">豪华等</td>
      <td bgcolor="#F7F7F7">豪华A等</td>
      <td bgcolor="#F7F7F7">超豪华等</td>
    </tr>
    <%
		for i=1 to 5
		%>
    <tr>
      <td><input name="<%=i%>_title" type="text" id="<%=i%>_title"></td>
      <td><input name="<%=i%>_price1" type="text" id="<%=i%>_price1" value="0" size="6">
        元</td>
      <td><input name="<%=i%>_price2" type="text" id="<%=i%>_price2" value="0" size="6">
        元</td>
      <td><input name="<%=i%>_price3" type="text" id="<%=i%>_price3" value="0" size="6">
        元</td>
      <td><input name="<%=i%>_price4" type="text" id="<%=i%>_price4" value="0" size="6">
        元</td>
    </tr>
    <%
		next
		%>
  </table></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>联系信息：</TD>
  <TD align=left><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="50%">公司：
        <input type="text" name="ComName" id="ComName">
        <br>
        电话：
        <input type="text" name="Tel" id="Tel"></td>
      <td width="50%">联 系 人：
        <input type="text" name="ContactMan" id="ContactMan">
        <br>
        发团周期：
        <input type="text" name="StartCycle" id="StartCycle"></td>
      </tr>
    <tr>
      <td>截止报名日期：
        <input name="SignDate" type="text" id="SignDate" value="<%=date()%>" size="15"><input name="sdaf" type="button" id="sdaf" onClick="OpenWindowAndSetValue('Inc/SelectDate.asp',280,120,window,document.form1.SignDate);document.form1.SignDate.focus();" value="选择日期"></td>
      <td>&nbsp;</td>
      </tr>
  </table></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>相关线路关键字：</TD>
  <TD align=left><input type="text" name="RelateKey" id="RelateKey"></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>&nbsp;	  </TD>
  <TD align=right><div align="left"> 
    <input type=submit name=b1 value="提 交">&nbsp;&nbsp;
    <input type=reset name=b2 value="重 填">       
    </div></TD>
</TR>
</TABLE>
</FORM>
<%
end Sub
Sub InnerKeys_AddOk
	dim title,ClassId,Routing,Servers,RelateKey,Price,LastId,j,ComName,Tel,ContactMan,StartCycle,SignDate,Color,Province,City
	title=replace(request.Form("Title"),"'","")
	Color=request.Form("Color")
	ClassId=Clng(request.Form("ClassId"))
	Routing=request.Form("Routing")
	Servers=request.Form("Servers")
	RelateKey=request.Form("RelateKey")
	Price=Clng(request.Form("Price"))
	ComName=request.Form("ComName")
	Tel=request.Form("Tel")
	ContactMan=request.Form("ContactMan")
	StartCycle=request.Form("StartCycle")
	SignDate=request.Form("SignDate")
	Province=request.Form("Province")
	City=request.Form("City")
	if(Province<>"") then
		Province=clng(Province)
	else
		Province=0
	end if
	if(City<>"") then
		City=Clng(City)
	else
		City=0
	end if
	set rs=server.createobject("adodb.recordset")
	rs.open "select top 1 * from "&table&" where Title='"&title&"'",conn,3,3
	if not rs.eof then
		response.Write("<script>alert(""该名称已存在!"");history.back();</script>")
		response.End()
	else		
		rs.addnew
		rs("ClassId")=ClassId
		rs("Title")=title	
		rs("Color")=Color
		rs("Routing")=Routing	
		rs("Servers")=Servers	
		rs("RelateKey")=RelateKey
		rs("Price")=Price
		rs("Hits")=1
		rs("PubDate")=now()
		rs("IsRem")=0
		rs("IsHot")=0
		rs("UserId")=""
		rs("ComName")=ComName
		rs("Tel")=Tel
		rs("ContactMan")=ContactMan
		rs("StartCycle")=StartCycle
		rs("SignDate")=SignDate
		rs("IsCheck")=1
		rs("Province")=Province
		rs("City")=City
		rs.update			
	end if
	rs.close
	set rs=nothing
	'ID
	set rs=server.createobject("adodb.recordset")
	rs.open "select top 1 id from "&table&" order by id desc",conn,3,1
	if not rs.eof then
		LastId=rs(0)
	else
		LastId=1
	end if
	rs.close
	set rs=nothing
	'添加价格
	for j=1 to 5
		if(request.Form(j&"_title")<>"") then
			set rs=server.createobject("adodb.recordset")
			rs.open "select top 1 * from t_route_price where 1=0",conn,3,3
			rs.addnew
			rs("RouteId")=LastId
			rs("Title")=request.Form(j&"_title")
			rs("Price1")=request.Form(j&"_price1")
			rs("Price2")=request.Form(j&"_price2")
			rs("Price3")=request.Form(j&"_price3")
			rs("Price4")=request.Form(j&"_price4")
			rs.update
			rs.close
			set rs=nothing
		end if
	next
	response.Write("<p align=""center"">添加旅游线路成功~!")
		response.Write("<br><a href=?>返回</a></p>")
end Sub
Sub InnerKeys_ModOk	
	dim id,title,ClassId,Routing,Servers,RelateKey,Price,LastId,j,Hits,ComName,Tel,ContactMan,StartCycle,SignDate,Color
	id=Clng(request.QueryString("id"))
	title=replace(request.Form("Title"),"'","")
	Color=request.Form("Color")
	ClassId=Clng(request.Form("ClassId"))
	Routing=request.Form("Routing")
	Servers=request.Form("Servers")
	RelateKey=request.Form("RelateKey")
	Price=Clng(request.Form("Price"))
	ComName=request.Form("ComName")
	Tel=request.Form("Tel")
	ContactMan=request.Form("ContactMan")
	StartCycle=request.Form("StartCycle")
	SignDate=request.Form("SignDate")
	Province=request.Form("Province")
	City=request.Form("City")
	if(Province<>"") then
		Province=clng(Province)
	else
		Province=0
	end if
	if(City<>"") then
		City=Clng(City)
	else
		City=0
	end if
	set rs=server.createobject("adodb.recordset")
	rs.open "select top 1 * from "&table&" where id="&id,conn,3,3
	rs("ClassId")=ClassId
	rs("Title")=title
	rs("Color")=Color
	rs("Routing")=Routing	
	rs("Servers")=Servers	
	rs("RelateKey")=RelateKey
	rs("Price")=Price
	rs("PubDate")=now()
	rs("ComName")=ComName
	rs("Tel")=Tel
	rs("UserId")=""
	rs("ContactMan")=ContactMan
	rs("StartCycle")=StartCycle
	rs("SignDate")=SignDate
	rs("Province")=Province
	rs("City")=City
	rs.update			
	rs.close
	set rs=nothing
	
	response.Write("<p align=""center"">修改旅游线路成功~!")
		response.Write("<br><br><a href=""javascript:history.go(-2)"">返回</a></p>")
end Sub
Sub InnerKeys_Mod
	dim rs,id,ClassId,Title,title_colors,Routing,Servers,RelateKey,Price,Hits,PubDate,IsRem,IsHot,OrderNum,Color,Photo,IsCheck,UserId,ComName,Tel,ContactMan,StartCycle,SignDate
	id=Clng(request.QueryString("id"))
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from "&table&" where id="&id,conn,3,1
	if not rs.eof then
		ClassId=rs("ClassId")
		Title=rs("Title")
		Routing=rs("Routing")
		Servers=rs("Servers")
		RelateKey=rs("RelateKey")
		Price=rs("Price")
		Hits=rs("Hits")
		PubDate=rs("PubDate")
		IsRem=rs("IsRem")
		IsHot=rs("IsHot")
		OrderNum=rs("OrderNum")
		Color=rs("Color")
		Photo=rs("Photo")
		IsCheck=rs("IsCheck")
		UserId=rs("UserId")
		ComName=rs("ComName")
		Tel=rs("Tel")
		ContactMan=rs("ContactMan")
		StartCycle=rs("StartCycle")
		SignDate=rs("SignDate")
		Province=rs("Province")
		City=rs("City")
  end if
	rs.close
	set rs=nothing
	dim price_num
	price_num=conn.execute("select count(*) from t_route_price where RouteId="&id)(0)
%>
<FORM method="POST" name="form1" action="?act=modok&id=<%=id%>" style="margin:0 0 0 0;" onSubmit="return check(this)">
  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<TR bgcolor="#FF9900">
  <TD height="24" colspan="2"><div align="center" class="style3">修改线路</div></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD align="right">分类：</TD>
  <TD>
    <select name="ClassId" id="ClassId">
      <%=getSourceOption(Clng(ClassId),"t_route_catalog")%>
      </select>
    <a href="routes_catalog.asp">分类管理？ </a></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD width="14%"><div align="right">名称：</div></TD>
  <TD width="86%"><input name="Title" type="text" id="Title" value="<%=Title%>" size="55">
  色彩&nbsp;<input type="text" size="8" name="Color" value="<%=Color%>" />
  &nbsp;<input type="button" name="title_colors" value="选色" onClick="OpenWindowAndSetValue('editor/selcolor.htm',230,190,window,document.form1.Color);">
  </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>价格：</TD>
  <TD align=left><input name="Price" type="text" id="Price" value="<%=Price%>" size="12">
    元</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>地区：</TD>
  <TD align=left>
  <select name="Province" id="Province" onChange="GetChilds(this.options[this.selectedIndex].value,0,'City')">
  <script type="text/javascript">
	 document.write(GetFirst(<%=Province%>,''));
	</script>
  </select>
  <select name="City" id="City">
  </select>
 <script type="text/javascript">
 GetChilds(<%=Province%>,<%=City%>,'City')
 </script>
 </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>线路说明：</TD>
  <TD align=left>
  <textarea name="Routing" style="display:none; "><%=Routing%></textarea>
	<IFRAME ID="eWebEditor1" src="webedits/ewebeditor.htm?id=Routing&style=coolblue" frameborder="0" scrolling="no" width="98%" height="350"></IFRAME>
  </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>线路服务接待标准：</TD>
  <TD align=left>
  <textarea name="Servers" style="display:none; "><%=Servers%></textarea>
	<IFRAME ID="eWebEditor1" src="webedits/ewebeditor.htm?id=Servers&style=coolblue" frameborder="0" scrolling="no" width="98%" height="350"></IFRAME>
  </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>线路详细报价：</TD>
  <TD align=left>
  <iframe frameborder="0" width="100%" height="<%=price_num*35+25%>" src="routes_ah.asp?id=<%=id%>"></iframe>
  </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>联系信息：</TD>
  <TD align=left><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="50%">公司：
        <input name="ComName" type="text" id="ComName" value="<%=ComName%>">
        <br>
        电话：
        <input name="Tel" type="text" id="Tel" value="<%=Tel%>"></td>
      <td width="50%">联 系 人：
        <input name="ContactMan" type="text" id="ContactMan" value="<%=ContactMan%>">
        <br>
        发团周期：
        <input name="StartCycle" type="text" id="StartCycle" value="<%=StartCycle%>"></td>
      </tr>
    <tr>
      <td>截止报名日期：
        <input name="SignDate" type="text" id="SignDate" value="<%=SignDate%>"><input name="sdaf" type="button" id="sdaf" onClick="OpenWindowAndSetValue('Inc/SelectDate.asp',280,120,window,document.form1.SignDate);document.form1.SignDate.focus();" value="选择日期"></td>
      <td>&nbsp;</td>
      </tr>
  </table></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>相关线路关键字：</TD>
  <TD align=left><input name="RelateKey" type="text" id="RelateKey" value="<%=RelateKey%>">
   </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>&nbsp;	  </TD>
  <TD align=right><div align="left"> 
    <input type=submit name=b1 value="提 交">&nbsp;&nbsp;
    <input type=reset name=b2 value="重 填">       
    </div></TD>
</TR>
</TABLE>
</FORM>
<div id="dialog-win" title="添加线路价格" style="display:none;">
	<iframe src="routes_ah.asp?id=<%=id%>" width="100%" height="350" frameborder="0"></iframe>	
</div>
<%
end Sub
Sub InnerKeys_List
	dim BeginTime,i,currentpage,allrec,totalpage,n,p,IsCheck,sql,ClassId,key
	BeginTime=Timer
	const recpage=20
	if not isempty(request("page")) and request("page")<>"" then 
		currentpage=Clng(request("page"))
	else
		currentpage=1
	end if
	IsCheck=request.QueryString("IsCheck")
	if(IsCheck<>"") then
		IsCheck=Cint(IsCheck)
	else
		IsCheck=-1
	end if
	ClassId=request.QueryString("ClassId")
	if(ClassId<>"") then
		ClassId=cint(ClassId)
	else
		ClassId=0
	end if
	key=request.QueryString("key")
%>
<script type="text/javascript">
function goto(frm)
{
	var gourl ="?IsCheck=<%=IsCheck%>&ClassId=<%=ClassId%>&key=<%=key%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href(gourl);
}
</script>
<div class="thead"><a href="?act=add"><strong>添加新旅游线路</strong>--&gt;</a></div>

<form name="form2" method="get" action="?">
  类别：
  <select name="ClassId" id="ClassId">
  	<option value="0">不限</option>
    <%=getSourceOption(Clng(ClassId),"t_route_catalog")%>
  </select>
  <select name="ischeck" id="ischeck">
    <option value="-1" <%if(IsCheck=-1) then response.Write(" selected") end if%>>不限</option>
    <option value="1" <%if(IsCheck=1) then response.Write(" selected") end if%>>已审核</option>
    <option value="0" <%if(IsCheck=0) then response.Write(" selected") end if%>>未审核</option>
  </select>
  关键字：
<input type="text" name="key" id="key" value="<%=key%>">
  <input type="submit" name="button" id="button" value="查询">
</form>
<form action="?act=bat" method="post" name="mem" style="margin:0px; padding:0px;">
  <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#eeeeee">
  <tr bgcolor="#FF9900">
    <td height="22" colspan="11"><div align="center"><span class="style3">◆ 旅游线路管理 ◆</span></div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="3%" height="22"><div align="center"></div></td>
    <td width="44%" height="25"><div align="center">名称</div></td>
    <td width="8%" align="center">价格</td>
    <td width="9%" align="center">景点图片</td>
    <td width="5%" align="center">审核</td>
    <td width="10%" align="center">推荐</td>
    <td width="8%" align="center">查看预定</td>
    <td width="7%"><div align="center">修改</div></td>
    <td width="6%"><div align="center">删除</div></td>
  </tr>
  <%
		sql="select count(*) AS co from "&table&" where 1=1"
		if(IsCheck>=0) then
			sql=sql&" and IsCheck="&IsCheck
		end if
		if(ClassId>0) then
			sql=sql&" and ClassId="&ClassId
		end if
		if(key<>"") then
			sql=sql&" and Title like '%"&key&"%'"
		end if
		set rs=server.createobject("adodb.recordset")
		rs.open sql,conn,3,1
		allrec=rs(0)
		totalpage=int((allrec+recpage-1)/recpage)
		rs.close
		set rs=nothing
		set rs=server.createobject("adodb.recordset")
		sql="select top "&recpage&" id,Title,Price,IsRem,IsCheck,Color from "&table&" where id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from "&table&" where 1=1"
		if(IsCheck>=0) then
			sql=sql&" and IsCheck="&IsCheck
		end if
		if(ClassId>0) then
			sql=sql&" and ClassId="&ClassId
		end if
		if(key<>"") then
			sql=sql&" and Title like '%"&key&"%'"
		end if
		sql=sql&" order by id desc) as t)"
		if(IsCheck>=0) then
			sql=sql&" and IsCheck="&IsCheck
		end if
		if(ClassId>0) then
			sql=sql&" and ClassId="&ClassId
		end if
		if(key<>"") then
			sql=sql&" and Title like '%"&key&"%'"
		end if
		sql=sql&" order by id desc "
		rs.open sql,conn,3,1		
		do while not rs.eof		
	%>
  <tr>
    <td height="20" bgcolor="#FFFFFF"><div align="center"><input type="checkbox" name="obj" value="<%=rs(0)%>" /></div></td>    
    <td height="25" bgcolor="#FFFFFF"><div align="left">&nbsp;<a href="../routes_show.asp?id=<%=rs(0)%>" style="color:<%=rs(5)%>"><%=rs(1)%></a></div></td>
    <td align="center" bgcolor="#FFFFFF">￥<%=rs(2)%></td>
    <td align="center" bgcolor="#FFFFFF"><a href="routes_pic.asp?act=add&routesid=<%=rs(0)%>">添加</a>|<a href="routes_pic.asp?routesid=<%=rs(0)%>">管理</a></td>
    <td align="center" bgcolor="#FFFFFF"><%
		if(Cint(rs(4))=1) then
			response.Write("<font color=""red"">Y</font>")
		else
			response.Write("N")
		end if
		%></td>
    <td align="center" bgcolor="#FFFFFF">
    <%
		if(Cint(rs(3))=0) then
			response.Write("<a href=""?id="&rs(0)&"&act=rem&val=1"" style=""color:red;"">推荐线路？</a>")
		else
			response.Write("<a href=""?id="&rs(0)&"&act=rem&val=0"" style=""color:green;"">取消推荐？</a>")
		end if
		%>
    </td>
    <td align="center" bgcolor="#FFFFFF"><a href="routes_order.asp?routeid=<%=rs(0)%>">查看</a></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="?act=mod&id=<%=rs(0)%>">修改</a></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="dele.asp?id=<%=rs(0)%>&table=<%=table%>" onClick="return ConfirmDel()">删除</a></div></td>
  </tr>
  
  <%
    		rs.movenext
	  loop
	  rs.close
	  set rs=nothing
  %>
  <tr>
    <td height="25" colspan="11" bgcolor="#FFFFFF">
    <div align="center">
  <input class=Button type="button" name="chksel" value="反选" onClick="ContraSel(this.form)">
  &nbsp;
  <select name="do_type" id="do_type">
    <option value="del">批量删除</option>	
    <option value="recommend">批量推荐</option>
		<option value="unrecommend">取消推荐</option>
    <option value="check">批量审核</option>
    <option value="uncheck">取消审核</option>
  </select>
  &nbsp;
  <input class=Button type="submit" name="Submit2" value="执行所选 的操作" onClick="return confirm('您确定执行该操作吗?')">
</div>
	</td>
  </tr>
</table>
</form>
<div align="center">
	<form name="form1" method="post" action="" style="margin:0 0 0 0">
	<%
	n=currentpage+1
	p=currentpage-1
	if p>0then
		response.write("["&"<a href='?ClassId="&ClassId&"&key="&key&"&IsCheck="&IsCheck&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
	else response.write("上一页&nbsp;&nbsp;&nbsp;")
	end if 
	if (n-1)*recpage>=allrec then 
		response.write("下一页" )
	else
		response.Write("["&"<a href='?ClassId="&ClassId&"&key="&key&"&IsCheck="&IsCheck&"&page="&cstr(n)&"'>下一页</a>]")
	end if
	response.write("&nbsp;共"&allrec&"条&nbsp;")
	response.Write("&nbsp;共"&totalpage&"页&nbsp;")
	response.Write("&nbsp;第"&currentpage&"页&nbsp;")
	%>
          <input type="hidden" name="hid" value="<%=totalpage%>">
&nbsp;&nbsp;跳至
          <input name="page" type="text" size="5" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
          页
          <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
  </form></div>
<%end Sub%>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="40"><div align="center"></div></td>
  </tr>
</table>
<script type="text/javascript">
function ContraSel(form) {
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.name =='obj')
		e.checked=!e.checked;
	}
}
</script>
</body>
</html>
<%
call connclose()
%>