<%
'-------------------------------------------------
'描述: 错误信息提示
'-------------------------------------------------
Function Alert(message,gourl) 
    message = replace(message,"'","\'")
    If gourl="-1" then
        Response.Write ("<script language=javascript>alert('" & message & "');history.go(-1)</script>")
    ElseIf gourl="-2" then
        Response.Write ("<script language=javascript>alert('" & message & "');history.go(-2)</script>")
    ElseIf gourl="-3" then
        Response.Write ("<script language=javascript>alert('" & message & "');window.close();</script>")
    Else
        Response.Write ("<script language=javascript>alert('" & message & "');location='" & gourl &"'</script>")
    End If
    Response.End()
End Function
'-------------------------------------------------
Function backurl(goourl) 
    If goourl="-1" then
        Response.Write ("<script language=javascript>history.go(-1)</script>")
    ElseIf goourl="-2" then
        Response.Write ("<script language=javascript>history.go(-2)</script>")
    Else
        Response.Write ("<script language=javascript>location='" & goourl &"'</script>")
    End If
    Response.End()
End Function
'-----------------------------------------
'描述: 时间格式转换
'-----------------------------------------
Function GetCount2(i)
   GetCount2 = Replace(Space(2-Len(i)), " ", "0") & i
End Function
Function FormatTime(DateTime,Format) 
  select case Format
	case "1"
    FormatTime=""&year(DateTime)&"年"&month(DateTime)&"月"&day(DateTime)&"日"
	case "2"
    FormatTime=""&month(DateTime)&"月"&day(DateTime)&"日"
	case "3" 
    FormatTime=""&year(DateTime)&"-"&month(DateTime)&"-"&day(DateTime)&""
	case "4"
    FormatTime=""&month(DateTime)&"-"&day(DateTime)&""
case Else
FormatTime=DateTime
end select
End Function
'=================================================
'分页函数PageNum(每页显示条数),PageClose(关闭数据),PageUrl(翻页)
'=================================================
Sub PageNum(nber)
	'oRs.open sSql,oconn,1,1
	'if oRs.bof and oRs.eof Then
	'response.write "暂无数据..."
	'Else
	page = request("page")						'page的传递参数
	total=oRs.recordcount 						'读取信息数目
	oRs.PageSize=nber							'设置页码 
	pagecount=oRs.PageCount 					'获取总页码 
	page=int(page)								'接收页码 
	if page<=0 then page=1						'判断页码
	oRs.AbsolutePage=page 						'本页页码
	mypage = total-(page-1)*oRs.PageSize
	If mypage > oRs.PageSize Then
	mypage = oRs.PageSize
	Else
	mypage = total-(page-1)*oRs.PageSize
	End If
	'for i=1 to mypage
End Sub
'=================================================
Sub PageUrl(purl,nber)
	response.write "<table border=""0"" cellspacing=""5"" cellpadding=""5"" width=""100%"" id=""pages""><tr><td align=""center"">"
	response.write "共<font color='red'>"&total&"</font>条  分<font color='red'>"&pagecount&"</font>页  每页<font color='red'>"&nber&"</font>条  第<font color='red'>"&page&"</font>页  "
	if page=1 and not page=pagecount then
	response.write "首页  上页  <a href='"&purl&"&page="&page+1&"'>下页</a>  <a href='"&purl&"&page="&pagecount&"'>末页</a>"
	elseif page<>1 and not page=pagcount then
	response.write"<a href='"&purl&"&page=1'>首页</a>  <a href='"&purl&"&page="&page-1&"'>上页</a>"
		If page=pagecount Then
		response.write"下页 末页"
		Else
		response.write"<a href='"&purl&"&page="&page+1&"'>下页</a>  <a href='"&purl&"&page="&pagecount&"'>末页</a>"
		End If
	End If
	response.write"</td></tr></table>"
End Sub
'=================================================
'搜索带红色
'=================================================
Function ADDRED(AAA,BBB)
	ADDRED = BBB'replace(AAA, BBB, "<font color=red>"&BBB&"</font>")
End Function
'''''''''''''''''''''''''''''''''''''''''
Function MenuTTBB(xxx) 
	select case xxx
		case "0"
		MenuTTBB="单页"
		case "1"
		MenuTTBB="分级"
		case "2"
		MenuTTBB="链接"
		case Else
	end select
End Function
Function MenuTT(xxx) 
	select case xxx
		case "0"
		MenuTT="单页信息"
		case "1"
		MenuTT="新闻列表"
		case "2"
		MenuTT="旅游小图"
		case "3"
		MenuTT="景点相册"
		case "4"
		MenuTT="酒店列表"
		case "5"
		MenuTT="车辆服务"
		case "6"
		MenuTT="外部连接"
		case Else
	end select
End Function
Function TTOOPP(xxx) 
	select case xxx
		case "0"
		TTOOPP="不推荐"
		case "1"
		TTOOPP="推荐"
		case Else
	end select
End Function
Function TTOOPP2(xxx) 
	select case xxx
		case "0"
		TTOOPP2="不推荐"
		case "1"
		TTOOPP2="普通推荐"
		case "2"
		TTOOPP2="图片推荐"
		case "3"
		TTOOPP2="幻灯片"
		case Else
	end select
End Function
'=================================================
'菜单名称
'=================================================
Function MENUNAME(aaa)
If aaa ="" Then
Response.Write "所有分类"
else
	Dim oRsme,sqlme
	sqlme= "Select TOP 1 Id,MenuTitle FROM [LstMenuBig] where Id= "&aaa
	Set oRsme= Server.CreateObject("ADODB.Recordset")
	oRsme.open sqlme,oconn,1,1
	if oRsme.eof and oRsme.bof Then
		Response.Write "无此分类"
	Else
		Response.write ""&oRsme(1)&""
	End if
	oRsme.close
	set oRsme=Nothing
End If
end Function
'=================================================
'小类名称
'=================================================
Function MENUNAMESS(aaa)
If aaa ="" Then
Response.Write "所有分类"
else
	Dim oRsme,sqlme
	sqlme= "Select TOP 1 Id,MenuTitle FROM [LstMenuSmall] where Id= "&aaa
	Set oRsme= Server.CreateObject("ADODB.Recordset")
	oRsme.open sqlme,oconn,1,1
	if oRsme.eof and oRsme.bof Then
		Response.Write "无此分类"
	Else
		Response.write ""&oRsme(1)&""
	End if
	oRsme.close
	set oRsme=Nothing
End If
end Function
'=================================================
'小类循环名称
'=================================================
Function MENUNAMESMALL(aaa)
If aaa ="" Then
Response.Write "所有分类"
else
	Dim oRsme,sqlme
	sqlme= "Select Id,MenuTitle FROM [LstMenuSmall] where MenuType>0 and MenuId= "&aaa
	Set oRsme= Server.CreateObject("ADODB.Recordset")
	oRsme.open sqlme,oconn,1,1
	if oRsme.eof and oRsme.bof Then
		Response.Write "<option value=0>无此分类</option>"
	Else
		do while not oRsme.eof
			Response.write "<option value="&oRsme(0)&">"&oRsme(1)&"</option>"
		oRsme.movenext
		loop
	End if
	oRsme.close
	set oRsme=Nothing
End If
end Function
'=================================================
'小类循环名称
'=================================================
Function MENU2LST(aaa)
	If aaa ="" Then
else
	Dim oRsme,sqlme
	sqlme= "Select Id,MenuTitle,MenuId,MenuType FROM [LstMenuSmall] where MenuId= "&aaa&" order by id asc"
	Set oRsme= Server.CreateObject("ADODB.Recordset")
	oRsme.open sqlme,oconn,1,1
	if oRsme.eof and oRsme.bof Then
	Else
		do while not oRsme.eof
			If oRsme(3) = 0 Then
			Response.write "<li><a target=""main"" href=LstMenuSmall.asp?gaozhen=eddinfo&Id="&oRsme(0)&">"&oRsme(1)&"</a></li>"

			Else 
			Response.write "<li><a target=""main"" href=Lstnewsinfo.asp?gaozhen=mylist&TT="&oRsme(2)&"&SS="&oRsme(0)&">"&oRsme(1)&"</a></li>"
			End If
		oRsme.movenext
		loop
	End if
	oRsme.close
	set oRsme=Nothing
End If
end Function
'=================================================
'线路名称
'=================================================
Function NEWSNAME(aaa)
If aaa ="" Then
Response.Write "所有分类"
else
	Dim oRsme,sqlme
	sqlme= "Select TOP 1 Id,PTitle FROM [LstNewsInfo] where Id= "&aaa
	Set oRsme= Server.CreateObject("ADODB.Recordset")
	oRsme.open sqlme,oconn,1,1
	if oRsme.eof and oRsme.bof Then
		Response.Write "无此分类"
	Else
		Response.write ""&oRsme(1)&""
	End if
	oRsme.close
	set oRsme=Nothing
End If
end Function
'=================================================
'保存文件
'=================================================
function SaveFile(LocalFileName,RemoteFileUrl) 
Dim Ads, Retrieval, GetRemoteData 
On Error Resume Next 
Set Retrieval = Server.CreateObject("Microso" & "ft.XM" & "LHTTP") 
With Retrieval 
.Open "Get", RemoteFileUrl, False, "", "" 
.Send 
GetRemoteData = .ResponseBody 
End With 
Set Retrieval = Nothing 
Set Ads = Server.CreateObject("Ado" & "db.Str" & "eam") 
With Ads 
.Type = 1 
.Open 
.Write GetRemoteData 
.SaveToFile Server.MapPath(LocalFileName), 2 
.Cancel() 
.Close() 
End With 
Set Ads=nothing 
If err <> 0 then 
SaveFile = false 
err.clear 
Else 
SaveFile = true 
End If 
End Function
'''''''''''''''''''''''''''''''''''''
Function YESORNO(lev) 
	select case lev
	case "0"
	YESORNO="<b class=fred>否</b>"
	case "1"
	YESORNO="<b class=fblue>是</b>"
	case Else
end select
End Function
'=================================================
'菜单类型
'=================================================
Function MENUTYPE(aaa)
If aaa ="" Then
	MENUTYPE = -1
else
	Dim oRsme,sqlme
	sqlme= "Select TOP 1 Id,MenuType FROM [LstMenuSmall] where Id= "&aaa
	Set oRsme= Server.CreateObject("ADODB.Recordset")
	oRsme.open sqlme,oconn,1,1
	if oRsme.eof and oRsme.bof Then
		MENUTYPE = -1
	Else
		MENUTYPE = oRsme(1)
	End if
	oRsme.close
	set oRsme=Nothing
End If
end Function
''''2013.4.1凌晨检查，这里分页应该还有BUG
Function WHOPAGE(aaa)
	Dim pagaa,sTiao,oRsme,sqlme'1 2 3 6
		Set pagaa = oConn.Execute("SELECT COUNT(ID) as ID FROM [LstNewsInfo] where PSId = "&aaa)
		sqlme = "Select TOP 1 Id,MenuType FROM [LstMenuSmall] where Id= "&aaa
		Set oRsme= Server.CreateObject("ADODB.Recordset")
		oRsme.open sqlme,oconn,1,1
		If oRsme(1) = 1 Then 
		sTiao = nm1
			If pagaa(0)=sTiao Then 
			WHOPAGE = 1
			Else
			WHOPAGE = int(pagaa(0)/sTiao)+1
			End If
		ElseIf oRsme(1) = 2 Then 
		sTiao = nm2
			If pagaa(0)=sTiao Then 
			WHOPAGE = 1
			Else
			WHOPAGE = int(pagaa(0)/sTiao)+1
			End If
		ElseIf oRsme(1) = 3 Then 
		sTiao = nm3
			If pagaa(0)=sTiao Then 
			WHOPAGE = 1
			Else
			WHOPAGE = int(pagaa(0)/sTiao)+1
			End If
		ElseIf oRsme(1) = 4 Then 
		sTiao = nm4
			If pagaa(0)=sTiao Then 
			WHOPAGE = 1
			Else
			WHOPAGE = int(pagaa(0)/sTiao)+1
			End If
		ElseIf oRsme(1) = 5 Then 
		sTiao = nm5
			If pagaa(0)=sTiao Then 
			WHOPAGE = 1
			Else
			WHOPAGE = int(pagaa(0)/sTiao)+1
			End If
		End If
End Function

''''2013.4.1凌晨检查，这里分页应该还有BUG
Function WHOJOBPAGE()
	Dim pagaas,sTiao,oRsme,sqlme'1 2 3 6
	Set pagaas = oConn.Execute("SELECT COUNT(ID) as ID FROM [LstJob]")
		If pagaas(0)=nm7 Then 
		WHOJOBPAGE = 1
		Else
		WHOJOBPAGE = int(pagaas(0)/nm7)+1
		End If
End Function
%>
