<%
'定义一个类应用
Dim w, o
'输出信息
Class clsResponse
	Sub w(s)
		Response.Write s
	End Sub
	Sub a(s)
		Response.Write "<script language=javascript>alert('" & s & "');history.go(-1)</script>"
	End Sub
	Sub r(s)
		Response.Redirect s
	End Sub
	Sub e
		Response.End
	End Sub
End Class
'参数信息
Class clsRequest
	Function f(s)
		f = Request.Form(s)
	End Function
	Function q(s)
		q = Request.QueryString(s)
	End Function
	Function s(a)
		s = Request.ServerVariables(a)
	End Function
	Function t(s)
		t = Trim(Request(s))
	End Function
End Class
'创建新类
Set w = New clsResponse
Set o = New clsRequest
' ow.w ow.r ow.e ot.f ot.q ot.s
'-------------------------------------------------
'描述: 读取当前IP地址
'-------------------------------------------------
Function GetIP()			
	GetIp = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
	If GetIp = "" Then GetIp = Request.ServerVariables("REMOTE_ADDR") 
End Function
Dim MYIP
MYIP = GetIP()
'-------------------------------------------------
'描述: 是否判断
'-------------------------------------------------
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 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 GetGUID()
	Dim oTypeLib
	Set oTypeLib = CreateObject("Scriptlet.TypeLib")
	GetGUID = Trim(oTypeLib.Guid)
	'GetGUID = Mid(GetGUID, 2, Len(GetGUID) - 4)
	GetGUID = Mid(oTypeLib.Guid,2,36)
	GetGUID = Replace(GetGUID,"-","")
	GetGUID = LCase(GetGUID)
End Function
Dim sGuid,sGlen
sGuid = GetGuid()
sGlen = len(sGuid)
'-------------------------------------------------
'描述: 关闭数据库连接
'语法: ConnClose()
'-------------------------------------------------
Sub ConnClose()
	On Error Resume Next
	oConn.Close
	Set oConn = Nothing
	If Err Then Exit Sub
End Sub
'-------------------------------------------------
'描述: IP地址只读取前三位
'语法: HideIp(s)
'-------------------------------------------------
Function HideIP(s)
	Dim HIP
	HIP = Split(s, ".")
	HideIP = HIP(0) & "." & HIP(1) & "." & HIP(2) & ".***"
End Function
'语法: Tel4(s) 读手机前三位和后四位
'-------------------------------------------------
Function TelL4(s)
	TelL4 = left(s,3) & "****" & right(s,4)
End Function
'-----------------------------------------
'描述: 补0函数
'-----------------------------------------
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 "5" 
    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)
	
	page = request("page")						'page的传递参数
	If page="" Then page=1
	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
End Sub
'=================================================
'ASP翻页函数
'=================================================
Sub PageUrl(purl,nber)
	response.write "<div id=""page""><ul>"
	response.write "<li><span>共"&total&"条</span></li>"
	response.write "<li><span>分"&pagecount&"页</span></li>"
	response.write "<li><span>每"&nber&"条</span></li>"
	response.write "<li><span>第"&page&"页</span></li>"
	if page=1 and not page=pagecount Then
	response.write "<li><span>首页</span></li><li><span>上页</span></li><li><span><a href='"&purl&"&page="&page+1&"'>下页</a></span></li><li><span><a href='"&purl&"&page="&pagecount&"'>末页</a></span></li>"
	elseif page<>1 and not page=pagcount then
	response.write"<li><span><a href='"&purl&"&page=1'>首页</a></span></li><li><span><a href='"&purl&"&page="&page-1&"'>上页</a></span></li>"
		If page=pagecount Then
		response.write"<li><span>下页</span></li><li><span>末页</span></li>"
		Else
		response.write"<li><span><a href='"&purl&"&page="&page+1&"'>下页</a></span></li><li><span><a href='"&purl&"&page="&pagecount&"'>末页</a></span></li>"
		End If
	End If


	response.write"</ul></div>"
End Sub
'=================================================
'搜索带红色
'=================================================
Function ADDRED(AAA,BBB)
ADDRED = replace(AAA, BBB, "<font color=red>"&BBB&"</font>")
End Function
'=================================================
'今日时间红色
'=================================================
Function REDTIME(AAA)
If FormatTime(AAA,3)=FormatTime(Now(),3) Then
response.write "<font color=red>"&FormatTime(AAA,3)&"</font>"
Else
response.write "<font color=#4B628C>"&FormatTime(AAA,3)&"</font>"
End If
End Function
'-------------------------------------------------
'描述: 景点星级5A
'-------------------------------------------------
Function J5A(lev) 
	select case lev
	case "2"
	J5A="2A级"
	case "3"
	J5A="3A级"
	case "4"
	J5A="4A级"
	case "5"
	J5A="5A级"
	case Else
end select
End Function
'-------------------------------------------------
'描述: 酒店星级5A
'-------------------------------------------------
Function STARTTT(xxx) 
	select case xxx
		case "0"
		STARTTT="☆☆☆☆☆"
		case "1"
		STARTTT="★☆☆☆☆"
		case "2"
		STARTTT="★★☆☆☆"
		case "3"
		STARTTT="★★★☆☆"
		case "4"
		STARTTT="★★★★☆"
		case "5"
		STARTTT="★★★★★"
		case Else
	end select
End Function
'-------------------------------------------------
'描述: 酒店星级5A
'-------------------------------------------------
Function STARTTT2(xxx) 
	select case xxx
		case "0"
		STARTTT2="☆☆☆☆☆"
		case "1"
		STARTTT2="★☆☆☆☆"
		case "2"
		STARTTT2="经济客栈"
		case "3"
		STARTTT2="三星舒适"
		case "4"
		STARTTT2="四星高档"
		case "5"
		STARTTT2="五星豪华"
		case Else
	end select
End Function
'=================================================
'处理订单
'=================================================
Function CHULINNN(lev) 
	select case lev
	case "0"
	CHULINNN="<b class=fred>暂未处理</b>"
	case "1"
	CHULINNN="<b class=fgreen>有效订单</b>"
	case "2"
	CHULINNN="<del>无效订单</del>"
	case "3"
	CHULINNN="<del>退款订单</del>"
	case Else
end select
End Function
'=================================================
'处理退款
'=================================================
Function TTTKKK(lev) 
	select case lev
	case "0"
	TTTKKK=""
	case "1"
	TTTKKK="<b class=fred>退款申请中</b>"
	case "2"
	TTTKKK="<b class=fblue>退款成功</b>"
	case Else
end select
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 WHODAY(lev)
Dim shuzi,zhongwen
shuzi = Split("0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20","|")
zhongwen = Split("零|一|二|三|四|五|六|七|八|九|十|十一|十二|十三|十四|十五|十六|十七|十八|十九|二十","|")
If lev<11 Then
WHODAY = zhongwen(lev)&"日游"
Else 
WHODAY = zhongwen(lev)&"日"
End If
End Function

'-------------------------------------------------
'描述: 景点星级5A
'-------------------------------------------------
Function USERSTAR(lev) 
If lev<100 Then 
	response.write "一级会员"
ElseIf lev<500 Then 
	response.write "二级会员"
ElseIf lev<1500 Then 
	response.write "三级会员"
ElseIf lev<2500 Then 
	response.write "四级会员"
ElseIf lev<4000 Then 
	response.write "五级会员"
Else 
	response.write "五级会员"
End If
End Function
'=================================================
'小类名称
'=================================================
Function MENUNAMETT(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

'=================================================
'线路调用IMG
'=================================================
Function Lstroadlstimg(aaa,ccc)
If ccc ="" Then
	Response.Write "<li>·参数调用错误,没有合适的参数.</li>"
ElseIf ccc < 1 Or ccc > 20 Then
	Response.Write "<li>·最多读取1-20条该类信息.</li>"
else
	Dim oRsli
	Set oRsli= Server.CreateObject("ADODB.Recordset")
	sSql= "Select TOP "&ccc&" Id,PTitle,PBID,PSID,Phymoney,Pscmoney,PSmallPic,PJian FROM [LstNewsInfo] where PBId ="&aaa&" order by Pindex desc,Id desc"
	oRsli.open sSql,oconn,1,1
	if oRsli.eof and oRsli.bof Then
			Response.Write "<li>·暂无任何信息.</li>"
	Else
			Do While Not oRsli.eof
					Response.write "<li>"
					Response.write "<div class=""liimg"">"
					Response.write "<div class=""img""><a title="""&oRsli(1)&""" href='LstListRoadInfo.asp?Id="&oRsli(0)&"'><img src="&oRsli(6)&"></a></div></div>"
					Response.write "<div class=""litxt""><a title="""&oRsli(1)&""" href='LstListRoadInfo.asp?Id="&oRsli(0)&"'><b>"&Left(oRsli(1),30)&"</b><br><span class=""fmoney"">￥"&oRsli(4)&"元/人</span></a></div></li>"
			oRsli.movenext 
			loop
	End if
	oRsli.close
	Set oRsli=Nothing
End If
End Function
'=================================================
'内页小类
'=================================================
Function MENU2LST(aaa)
	If aaa ="" Then
else
	Dim oRsme,sqlme
	sqlme= "Select Id,MenuTitle,MenuId,MenuType,MenuUrl FROM [LstMenuSmall] where MenuId= "&aaa&" order by MenuIndex asc, 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)=6 Then
			Response.write "<li><a target=_blank href="&oRsme(4)&">"&oRsme(1)&"</a></li>"
		Else
			Response.write "<li><a href=LstList.Asp?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,PBId,PSId,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 "<a target=_blank href=LstInfo.asp?TT="&oRsme(1)&"&SS="&oRsme(2)&"&Id="&oRsme(0)&">"&Left(oRsme(3),10)&"..</a>"
	End if
	oRsme.close
	set oRsme=Nothing
End If
end Function
'-------------------------------------------------
'描述: 货币形式展示
'-------------------------------------------------
Function GZMONEY(s)
   Response.Write FormatCurrency(s,2)
End Function
Function FAHUO(xxx) 
	select case xxx
		case "0"
		FAHUO="暂未处理"
		case "1"
		FAHUO="正在服务"
		case "2"
		FAHUO="无效订单"
		case "3"
		FAHUO="退款订单"
		case "9"
		FAHUO="完成订单"
		case Else
	end select
End Function
'=================================================
'是否登陆
'=================================================
Function MYUSERINFO(AAA,BBB)
	If AAA="" Then 
		MYUSERINFO="" 
	Else 
		If BBB=1 Then 
			MYUSERINFO=Uid("UserTel")
		ElseIf BBB=2 Then 
			MYUSERINFO=Uid("UserName")
		ElseIf BBB=3 Then 
			MYUSERINFO=Uid("UserAddress")
		ElseIf BBB=4 Then 
			MYUSERINFO=Uid("UserQQ")
		Else 
			MYUSERINFO="没有赋值"
		End If
	End If
End Function
'=================================================
'生成订单号
'=================================================
function getOrdernum()
        dim yyear,mmonth,dday,min,hou,miao,ordernum
        yyear=year(now())
        mmonth=month(now())
        dday=day(now())
		hou=hour(now())
		min=minute(now())
		miao=second(now())
        if mmonth<10 then
            mmonth="0" & mmonth
        end if 
        if dday<10 then
            dday="0" & dday
        end if 
        ordernum= yyear & mmonth & dday & hou & min & miao
        getOrdernum=ordernum        '返回订单编号
end Function
Dim OrderNumber
OrderNumber = getOrdernum()
'=================================================
'房间名称
'=================================================
Function FANGNAME(aaa)
If aaa ="" Then
	Response.Write ""
else
	Dim oRsme,sqlme
	sqlme= "Select TOP 1 Id,roomTitle FROM [LstRoom] 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 ""&Left(oRsme(1),10)&".."
	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
%>
