 <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!--#include file="Ex_Cls/Ex_SkinCls.asp"-->
<!--#include file="Ex_Cls/Ex_SplitPageCls.asp"-->
<%
Dim ExComm
Set ExComm=new Ex_CommonCls
ExComm.GetConfigCache("runmode,ShowName,CmtPageSize,IsCheckCode,cmtmsgcheckre,iscmtmsgcheck,LogNum,blogname,BlogDescription,BlogKeyWord,IndexAddWord,blogurl,logourl,DefaultSkin")
ExComm.CheckInstall
ExComm.IsIpAllow
Dim Title,Show_logids,show_blogKeyword
'**********************************
'图片宽度控制函数js代码
'**********************************
Function ResizeWH()
	Dim Temp
	Temp="<script>"&vbcrlf
	Temp=Temp&"function ResizeWH(o,s)"&vbcrlf
	Temp=Temp&"{"&vbcrlf
	Temp=Temp&"var image=new Image();"
	Temp=Temp&"image.src=o.src;"
	Temp=Temp&"if(image.height>=image.width && image.height>s){o.width=s*(image.width/image.height);}"&vbcrlf
	Temp=Temp&"if(image.width>=image.height && image.width>s){o.width=s;}"&vbcrlf
	Temp=Temp&"}"&vbcrlf
	Temp=Temp&"</script>"&vbcrlf
	ResizeWH=Temp
End Function 
'**********************************
'普通方式浏览
'**********************************
Function NormalView()
	Dim ClsId,photourl,PRs,Vt,I
	I=0
	Clsid=CLng(request("clsid"))
	vt=ExComm.G(request("vt"))
	Dim ExPages,page
	Set ExPages=new  Ex_SplitPageCls
	Expages.letConn=Conn
	Expages.letColumns="select *"
	ExPages.letDataFrom="from Ex_Photos"
	If clsid<>0 Then 
		ExPages.LetWhere="where clsid="&clsid
	End If 
	ExPages.LetOrder="order by id desc"
	Set PRs=server.CreateObject("adodb.recordset")
	Expages.letPageSize="18"
	If ExComm.G(request("page"))="" Then
		page=1
	Else
		page=ExComm.G(request("page"))
	End if
	ExPages.letPage=CInt(page)
	ExPages.letStrPage="&action=view&clsid="&clsid&"&vt="&vt&""
	ExPages.Execute()
	Set PRs=ExPages.getRs
	If ExPages.getRsCount<>0 Then
		NormalView=ResizeWH
		NormalView=NormalView&"<form action=""?action=view"" method=""post"" style=""margin-top:30px;"">"&vbcrlf
		NormalView=NormalView&"像册分类&nbsp;&nbsp;<select name=""clsid"" id=""clsid"">"&ExComm.GetPhotoClassSelectCache(0)&"</select>&nbsp;&nbsp;&nbsp;&nbsp;"
		'NormalView=NormalView&"浏览方式&nbsp;&nbsp;<select name=""vt"" id=""vt""><option value=""普通"">普通</option><option value=""幻灯片"">幻灯片</option></select>&nbsp;&nbsp;&nbsp;&nbsp;"
		NormalView=NormalView&"<INPUT TYPE=""submit"" value=""浏览"">"
		NormalView=NormalView&"</form>"&vbcrlf
		NormalView=NormalView& "<div align=""center"" style=""width:90%;"" id=""photos"">"
		NormalView=NormalView&"<style>"
		NormalView=NormalView&".pkuang{float:left;width:130px;height:153px;margin:5px;}"
		NormalView=NormalView&".pxian{height:133px;border:1px solid #cccccc}"
		NormalView=NormalView&".pover{height:133px;border:1px solid #99AFE8;}"
		NormalView=NormalView&".pout{height:133px;border:1px solid #cccccc;}"
		NormalView=NormalView&"</style>"
		Do While Not PRs.eof
			If Trim(PRs("sphotourl"))<>"" Then 
				photourl=PRs("sphotourl")
			Else 
				photourl=PRs("photourl")
			End If 
			NormalView=NormalView& "<div class=""pkuang"">"&vbcrlf&"<div class=""pxian"" onmouseover=""this.className='pover';"" onmouseout=""this.className='pout';"">"&vbcrlf&"<a href=""?action=view&vt=%B5%A5%D5%C5&clsid="&ClsId&"&id="&PRs("id")&"&fid="&(page-1)*18+I&""" title="""&PRs("photoname")&""" id="""&PRs("photourl")&""" target=_blank><img src="""&photourl&""" style=""border:0px;margin:3px;"" onload=""ResizeWH(this,115)""></a>"&vbcrlf&"</div>"&vbcrlf&"<div style=""margin-top:5px""><a href="""&PRs("photourl")&""" target=""_blank"">"&PRs("photoname")&"</a></div></div>"&vbcrlf
			PRs.movenext
			I=I+1
		Loop
		NormalView=NormalView&"</div>"
	End If
	NormalView=NormalView&"<div style=""text-align:center;clear:both;"">"
	NormalView=NormalView&ExPages.Show
	NormalView=NormalView&"</div>"
End Function 
'**********************************
'幻灯片浏览
'**********************************
Function FlashView()
	Dim ClsId,photourl,PRs,pics,links,texts,Vt,I
	Clsid=CLng(request("clsid"))
	vt=ExComm.G(Request("vt"))
	Dim ExPages,page
	Set ExPages=new  Ex_SplitPageCls
	Expages.letConn=Conn
	Expages.letColumns="select *"
	ExPages.letDataFrom="from Ex_Photos"
	If clsid<>0 Then 
		ExPages.LetWhere="where clsid="&clsid
	End If 
	ExPages.LetOrder="order by id desc"
	Set PRs=server.CreateObject("adodb.recordset")
	Expages.letPageSize="10000"
	If ExComm.G(request("page"))="" Then
		page=1
	Else
		page=ExComm.G(request("page"))
	End If
	If ExComm.G(request("fid"))="" And Instr(Request("action"),"幻灯片")=0 Then
		I=0
	ElseIf ExComm.G(request("fid"))="" And Instr(Request("action"),"幻灯片")<>0 Then 
		I=Replace(LCase(Request("action")),"view幻灯片","")
	Else 
		I=ExComm.G(request("fid"))
	End If
	ExPages.letPage=CInt(page)
	ExPages.letStrPage="&action=view&clsid="&clsid&"&vt="&vt&""
	ExPages.Execute()
	Set PRs=ExPages.getRs
	If ExPages.getRsCount<>0 Then
		FlashView=FlashView&"<form action=""?action=view"" method=""post"" style=""margin-top:30px;"">"&vbcrlf
		FlashView=FlashView&"像册分类&nbsp;&nbsp;<select name=""clsid"" id=""clsid"">"&ExComm.GetPhotoClassSelectCache(0)&"</select>&nbsp;&nbsp;&nbsp;&nbsp;"
		'FlashView=FlashView&"浏览方式&nbsp;&nbsp;<select name=""vt"" id=""vt""><option value=""普通"">普通</option><option value=""幻灯片"">幻灯片</option></select>&nbsp;&nbsp;&nbsp;&nbsp;"
		FlashView=FlashView&"<INPUT TYPE=""submit"" value=""浏览"">"
		FlashView=FlashView&"</form>"&vbcrlf
		FlashView=FlashView& "<div align=""center"" style=""width:90%;"">"
		FlashView=FlashView&"<script type=""text/javascript"">"&vbcrlf
		Do While Not PRs.eof 
				pics=pics&Replace(PRs("photourl"),"\","/")&"|"
				If InStr(PRs("photourl"),"http://")=0 Then 
					links=links&Application(sn&"blogurl")&Replace(PRs("photourl"),"\","/")&"|"
				Else 
					links=links&PRs("photourl")&"|"
				End If
				texts=texts&PRs("photoname")&"|"
			PRs.movenext
		Loop 
		FlashView=FlashView&"var flashViewPics="""&pics&""&vbcrlf
		FlashView=FlashView&"var flashViewLinks="""&links&""&vbcrlf
		FlashView=FlashView&"var flashViewTexts="""&texts&""&vbcrlf
		FlashView=FlashView&"</script>"&vbcrlf
		FlashView=FlashView&"<script src=""inc/slide.js""></script>"&vbcrlf
		FlashView=FlashView&"</div>"
	End If
	FlashView=FlashView&"<div style=""text-align:center;clear:both;"">"
	'FlashView=FlashView&ExPages.Show
	FlashView=FlashView&"</div>"
End Function 
'**********************************
'单张图片浏览
'**********************************
Function ViewPic
	Dim Id,Rs,Html,ClsId,Photos,PhotoUrl,P,preUrl,nextUrl
	Id=CLng(Request.queryString("id"))
	If id=0 Then 
		Id=Replace(Request.QueryString("action"),"view单张","")
	End If 
	Set Rs=Conn.Execute("Select * from Ex_Photos where id="&Id)
	ClsId=Rs("ClsId")
	Set P=Conn.Execute("select top 1 * from Ex_Photos where id<"&id&" and clsid="&clsid&" order by id desc")
	If Not P.eof And Not P.bof Then 
		preUrl="?action=view&vt=%B5%A5%D5%C5&clsid="&ClsId&"&id="&p("id")
	Else 
		PreUrl="javascript:alert('已经到第一张了哦');"
	End If 
	Set P=Conn.Execute("select top 1 * from Ex_Photos where id>"&id&" and clsid="&clsid&" order by id asc")
	If Not P.eof And Not P.bof Then 
		nextUrl="?action=view&vt=%B5%A5%D5%C5&clsid="&ClsId&"&id="&p("id")
	Else 
		nextUrl="javascript:alert('已经到最后一张了哦');"
	End If 
	Html=Html&ResizeWH
	Html=Html&"<form action=""?action=view"" method=""post"" style=""margin-top:30px;"">"&vbcrlf
	Html=Html&"像册分类&nbsp;&nbsp;<select name=""clsid"" id=""clsid"">"&ExComm.GetPhotoClassSelectCache(0)&"</select>&nbsp;&nbsp;&nbsp;&nbsp;"
	'Html=Html&"浏览方式&nbsp;&nbsp;<select name=""vt"" id=""vt""><option value=""普通"">普通</option><option value=""幻灯片"">幻灯片</option></select>&nbsp;&nbsp;&nbsp;&nbsp;"
	Html=Html&"<INPUT TYPE=""submit"" value=""浏览"">"
	Html=Html&"</form>"&vbcrlf
	Html=Html& "<div align=""center"" style=""width:100%;text-align:center;margin-top:20px""><div style=""width:420px"">"
	Html=Html&"<a href="""&preUrl&""" title=""上一张""><img src=""images/photos/h_prev_yes.gif"" border=""0"" style=""float:left""></a><a href="""&Rs("photourl")&""" title=""点击图片可进行幻灯片播放""><img src="""&Rs("photourl")&""" style=""border:0px;margin:0px;float:left"" onload=""ResizeWH(this,350)""></a><a href="""&nextUrl&""" title=""下一张""><img src=""images/photos/h_next_yes.gif"" border=""0"" style=""float:left""></a>"
	Html=Html& "</div></div>"
	Rs.Close
	Set Rs=Conn.Execute("select * from Ex_photos where clsid="&ClsId)
	Do While Not Rs.eof 
		PhotoUrl=Application(Sn&"blogurl")&Rs("photourl")
		Html=Html&"<a href="""&PhotoUrl&"""></a>"
		Photos=Photos&PhotoUrl&"#"&Application(Sn&"blogurl")&"Photos.asp?action=view单张"&Rs("id")&"#"&Rs("PhotoName")&"|"
		Rs.Movenext
	Loop 
	Photos=Left(Photos,Len(Photos)-1)
	Photos=Replace(Photos,"\","/")
	Html=Html&"<div style=""text-align:center;clear:both;"">"
	'Html=Html&ExPages.Show
	Html=Html&"<div id=FlashShow></div>"
	Html=Html&"<script src=""inc/sinaflash.js""></script>"
	Html=Html&"<script type=text/javascript>"&vbcrlf
	Html=Html&"var FlashShow = new sinaFlash(""photos.swf"", ""FlashShow"", ""600"", ""170"", ""6"", ""#ffffff"");"&vbcrlf
	Html=Html&"FlashShow.addParam(""quality"", ""best"");"&vbcrlf
	Html=Html&"FlashShow.addParam(""wmode"", ""transparent"");"&vbcrlf
	Html=Html&"FlashShow.addVariable(""mypic_add"", """&Photos&""");"&vbcrlf
	Html=Html&"FlashShow.write(""FlashShow"");"
	Html=Html&"</script>"
	Html=Html&"</div>"
	ViewPic=Html
End Function 
'**********************************
'作用：显示相册分类封面
'**********************************
Function Covers()
	Dim CRs,photo
	Set CRs=server.CreateObject("adodb.recordset")
	CRs.open "select * from Ex_PhotoCls order by ClsOrder desc",conn,1,1
	If Not CRs.eof And Not CRs.bof Then 
		Covers=ResizeWH
		Covers=Covers&"<form action=""?action=view"" method=""post"">"&vbcrlf
		Covers=Covers&"像册分类&nbsp;&nbsp;<select name=""clsid"" id=""clsid"">"&ExComm.GetPhotoClassSelectCache(0)&"</select>&nbsp;&nbsp;&nbsp;&nbsp;"
		'Covers=Covers&"浏览方式&nbsp;&nbsp;<select name=""vt"" id=""vt""><option value=""普通"">普通</option><option value=""幻灯片"">幻灯片</option></select>&nbsp;&nbsp;&nbsp;&nbsp;"
		Covers=Covers&"<INPUT TYPE=""submit"" value=""浏览"">"
		Covers=Covers&"</form>"&vbcrlf
		Covers=Covers& "<div align=""center"" style=""width:90%;"">"
		Do While Not CRs.eof
			If CRs("ClsPhoto")="" Then 
				photo="photo/Covers/default.jpg"
			Else 
				photo=CRs("Clsphoto")
			End If 
			Covers=Covers& "<div style=""float:left;width:130px;height:150px;margin:5px;""><div style=""height:125px;border:1px solid #cccccc"" onmouseover=""this.style.borderColor='#99AFE8';"" onmouseout=""this.style.borderColor='#cccccc';""><a href=""?action=view&clsid="&CRs("id")&""" title=""点击查看此相册""><img src="""&photo&""" style=""border:0px;margin:3px;"" onload=""ResizeWH(this,120)""></a></div><div style=""margin-top:5px""><a href=""?action=view&clsid="&CRs("id")&""">"&CRs("ClsName")&"</a></div></div>"&vbcrlf
			CRs.movenext
		Loop
		Covers=Covers&"</div>"
	End If 
End Function 
'**********************************
'作  用：显示日志列表
'**********************************
function show_log()
	Dim action,vt
	action=ExComm.G(Request("action"))
	vt=ExComm.G(Request("vt"))
	If InStr(action,"view")<>0 Then 
		If vt="幻灯片" Or InStr(action,"幻灯片")<>0 Then 
			Show_log=FlashView
		ElseIf vt="单张" Or InStr(action,"单张")<>0 Then 
			Show_log=ViewPic
		Else 
			show_log=NormalView
		End If 
	Else 
		Show_log=Covers
	End If 
End Function

'主模板标记替换开始
Dim ExSkin,Head,Body,Bottom,Skin1
Set ExSkin=new Ex_SkinCls
Skin1=ExSkin.GetTxtSkin("default.html")
Body=Replace(Skin1,"$show_log$",show_log)
Body=Replace(Body,"$show_info$",ExSkin.Info)
Body=Replace(Body,"$show_login$",ExSkin.Login)
Body=Replace(Body,"$show_calendar$",ExSkin.calendar("","",""))
Set ExSkin=Nothing    
Bottom=ExComm.BottomInfo
Title="我的相册"
'输出内容
Head=Head&"<html xmlns=""http://www.w3.org/1999/xhtml"">"&vbcrlf
Head=Head&"<head>"&vbcrlf
Head=Head&"<meta http-equiv=""content-type"" content=""text/html; charset=gb2312"">"&vbcrlf
Head=Head&"<meta name=""Description"" content="""&Application(sn&"BlogDscription")&""">"&vbcrlf
Head=Head&"<meta name=""Keywords"" content="""&Application(sn&"BlogKeyWord")&""">"&vbcrlf
Head=Head&"<title>"&Title&Application(sn&"IndexAddWord")&"</title>"&vbcrlf
Head=Head&"<script src=""inc/Main.js""></script>"
Head=Head&"<script src=""inc/UserInfo.js""></script>"
Head=Head&"<script src=""inc/jquery.js""></script>"
Head=Head&"<link href=""inc/OblogSkin.Css"" rel=""stylesheet"" type=""text/css"" />"&vbcrlf
Head=Head&"</head>"&vbcrlf
Head=Head&"<body>"&vbcrlf
If ExComm.IsOblogSkin Then 
	Response.Write Head
	Response.Write Body
	Response.Write "</body></html>"
Else
	Body=Replace(Body,"$show_blogtitle$",Title&Application(sn&"IndexAddWord"))
	Body=Replace(Body,"$show_blogkeyword$",Application(sn&"blogkeyword"))
	Body=Replace(Body,"$show_blogdescription$",Application(sn&"blogdescription"))
	Response.Write Body
End If 
If request.querystring("action")="add" Then
Call add()
End if
If Application(Sn&"Runmode")<>"静态" Then 
	ExComm.visitorCount
End If
Set ExComm=Nothing 
%>