<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp" -->
<!--#include file="Dv_Plus/Avatar/Plus_Avatar_Const.asp"-->
<%
Dim ShopID, PhotoID, CurPage, CurType, isBig, PhotoPageSize, TotalRec, PageCount, CurTypeName, CurSubTypeName

If Dvbbs.Forum_Setting(82) <> "0" Then
	Response.Redirect "showerr.asp?ErrCodes=<li>该论坛尚未开启虚拟形象功能，不能进行形象照相！&action=plus"
Else
	ShopID = Request("ShopID")
	If Not IsNumeric(ShopID) Or IsNull(ShopID) Or ShopID = "" Then
		ShopID = 197
	End If
	CurType = (Abs(ShopID) Mod 100)
	If CurType = 97 Then
		isBig = 0
		If ShopID <> 197 And ShopID <> 297 And ShopID <> 397 And ShopID <> 497 And ShopID <> 597 And ShopID <> 697 Then
			ShopID = 197
		End If
		CurTypeName = GetTypeName(ShopID)
		CurSubTypeName = GetSubTypeName(ShopID)
	ElseIf CurType = 94 Then
		Response.Write "<script>parent.location='Plus_Avatar_Match.asp?ShopID=" & ShopID & "';</script>"
		Response.End
	Else
		Response.Write "<script>parent.location='Plus_Avatar_Center.asp?ShopID=" & ShopID & "';</script>"
		Response.End
	End If
	PhotoID = Trim(Request("PhotoID"))
	If Not IsNumeric(PhotoID) Or IsNull(PhotoID) Or PhotoID = "" Then
		PhotoID = ""
	Else
		PhotoID = CLng(PhotoID)
	End If
	If PhotoID <> "" And (ShopID = 297 Or ShopID = 397 Or ShopID = 497) Then
		If ShopID = 297 Then
			AvatarSQL = "Select Top 1 ID From Dv_Plus_Avatar_Photo Where ID=" & PhotoID & " And FromUser='" & Dvbbs.MemberName & "' And Confirmed=0"
		ElseIf ShopID = 397 Then
			AvatarSQL = "Select u.PhotoID From Dv_Plus_Avatar_PhotoUser u Inner Join Dv_Plus_Avatar_Photo p On u.PhotoID=p.ID Where u.PhotoID=" & PhotoID & " And u.UserName='" & Dvbbs.MemberName & "' And p.Confirmed=0"
		ElseIf ShopID = 497 Then
			AvatarSQL = "Select u.PhotoID From Dv_Plus_Avatar_PhotoUser u Inner Join Dv_Plus_Avatar_Photo p On u.PhotoID=p.ID Where u.PhotoID=" & PhotoID & " And u.UserName='" & Dvbbs.MemberName & "' And p.Confirmed=1 And p.Finished=0"
		End If
		If Dvbbs.Plus_Execute(AvatarSQL).Eof Then
			Response.Redirect "Plus_Avatar_PhotoDetail.asp?ShopID=" & ShopID
		End If
	End If
	CurPage = Request("page")
	If CurPage = "" Or Not isInteger(CurPage) Then
		CurPage = 1
	Else
		CurPage = CLng(CurPage)
	End If
	If (ShopID = 297 Or ShopID = 397 Or ShopID = 497) And PhotoID = "" Then
		PhotoPageSize = 10
	ElseIf ShopID = 597 Or ShopID = 697 Then
		PhotoPageSize = 4
	Else
		PhotoPageSize = 1
	End If
	Dvbbs.LoadTemplates ("Avatar")
	Call GetCurrentUserInfoXML(AvatarXMLDOM, ShopID)
	Call GetCurrentPhotoXML(AvatarXMLDOM)
	Call GetCurrentSearchXML(AvatarXMLDOM)
	If PhotoID = "" And (ShopID = 297 Or ShopID = 397 Or ShopID = 497 Or ShopID = 597 Or ShopID = 697) Then
		Call PhotoListToXML(AvatarXMLDOM)
	ElseIf ShopID = 197 Then
		Call LoadPhotoItem(AvatarXMLDOM)
	End If
	If Request("action") = "xml" Then
		Response.Clear
		Response.Charset = "gb2312"
		Response.ContentType = "text/xml"
		Response.Write "<?xml version=""1.0"" encoding=""gb2312""?>" & vbNewLine
		Response.Write AvatarXMLDOM.documentElement.XML
	Else
		Response.Expires=0
		Dvbbs.Head
		Response.Write vbNewLine
		Response.Write "<script>if (parent.location==self.location) parent.location='Plus_Avatar_Photo.asp';</script>"
		Response.Write vbNewLine
		If NeedShowMsg Then Call ShowMessage
		Call Main
		Response.Write "</body></html>"
	End If
	Set AvatarXMLDOM = Nothing
End If

Sub PhotoListToXML(XMLDOM)
	Dim AvatarSQL, i, CurCount, objFSO
	Dim Node, SubNode, EmptyNode, Rs, ChildNode, FrameHeight, isFirst, PhotoUserStr

	If ShopID = 297 Or ShopID = 397 Or ShopID = 497 Then
		If ShopID = 297 Then
			AvatarSQL = "Select ID,Name,Fromuser,Status,AddDate,EndDate,Child From Dv_Plus_Avatar_Photo Where FromUser='" & Dvbbs.MemberName & "' And Confirmed=0 Order By ID Desc"
		ElseIf ShopID = 397 Then
			AvatarSQL = "Select p.ID,p.Name,p.FromUser,p.Status,p.AddDate,p.EndDate,p.Child From Dv_Plus_Avatar_PhotoUser u Inner Join Dv_Plus_Avatar_Photo p On u.PhotoID=p.ID Where p.FromUser<>'" & Dvbbs.MemberName & "' And p.Confirmed=0 And u.UserName='" & Dvbbs.MemberName & "' Order By p.ID Desc"
		Else
			AvatarSQL = "Select p.ID,p.Name,p.FromUser,p.Status,p.AddDate,p.EndDate,p.Child From Dv_Plus_Avatar_PhotoUser u Inner Join Dv_Plus_Avatar_Photo p On u.PhotoID=p.ID Where u.UserName='" & Dvbbs.MemberName & "' And p.Confirmed<>0 And p.Finished=0 Order By p.ID Desc"
		End If
		CurCount = 0
		Set EmptyNode = XMLDOM.documentElement.selectSingleNode("PhotoList/Photo").CloneNode(True)
		Set AvatarRs = Server.CreateObject("ADODB.Recordset")
		If Cint(Dvbbs.Forum_Setting(92))=1 Then
			If Not IsObject(Plus_Conn) Then Plus_ConnectionDatabase
			AvatarRs.Open AvatarSQL,Plus_Conn,1,1
		Else
			If Not IsObject(Conn) Then ConnectionDatabase
			AvatarRs.Open AvatarSQL,Conn,1,1
		End If
		FrameHeight = 155
		If Not AvatarRs.EOF Then
			TotalRec = AvatarRs.RecordCount
			Set Node = XMLDOM.documentElement.selectSingleNode("CurrentInfo")
			Set SubNode = XMLDOM.createNode(2, "TotalRec", "")
			SubNode.text = TotalRec
			Node.Attributes.setNamedItem (SubNode)
			If TotalRec Mod PhotoPageSize = 0 Then
				PageCount = TotalRec \ PhotoPageSize
			Else
				PageCount = TotalRec \ PhotoPageSize + 1
			End If
			Set SubNode = XMLDOM.createNode(2, "PageCount", "")
			SubNode.text = PageCount
			Node.Attributes.setNamedItem (SubNode)
			If CurPage > PageCount Then CurPage = PageCount
			If CurPage < 1 Then CurPage = 1
			Set SubNode = XMLDOM.createNode(2, "CurPage", "")
			SubNode.text = CurPage
			Node.Attributes.setNamedItem (SubNode)
			AvatarRs.MoveFirst
			If CurPage > 1 Then
				AvatarRs.Move (CurPage - 1) * PhotoPageSize
			End If
			AvatarSQL = AvatarRs.GetRows(PhotoPageSize)
			Set SubNode = XMLDOM.documentElement.selectSingleNode("PhotoList")
			For i = 0 To UBound(AvatarSQL, 2)
				If i > 0 Then
					Set Node = EmptyNode.CloneNode(True)
					SubNode.appendChild (Node)
				Else
					Set Node = XMLDOM.documentElement.selectSingleNode("PhotoList/Photo")
				End If
				Node.Attributes.getNamedItem("PhotoID").text = AvatarSQL(0, i)
				Node.Attributes.getNamedItem("PhotoName").text = AvatarSQL(1, i)
				Node.Attributes.getNamedItem("PhotoSponsor").text = AvatarSQL(2, i)
				Node.Attributes.getNamedItem("URLEncode").text = Server.URLEncode(AvatarSQL(2, i))
				Node.Attributes.getNamedItem("PhotoStatus").text = AvatarSQL(3, i)
				Node.Attributes.getNamedItem("AddDate").text = FormatDateTime(AvatarSQL(4, i), 2)
				Node.Attributes.getNamedItem("EndDate").text = FormatDateTime(AvatarSQL(5, i), 2)
				Node.Attributes.getNamedItem("PhotoUserCount").text = AvatarSQL(6, i)
				Set Rs = Dvbbs.Plus_Execute("Select Confirmed,Finished From Dv_Plus_Avatar_PhotoUser Where PhotoID=" & AvatarSQL(0, i) & " And UserName='" & AvatarSQL(2, i) & "'")
				Node.Attributes.getNamedItem("IsConfirmed").text = Rs(0)
				Node.Attributes.getNamedItem("IsDesigned").text = Rs(1)
				Rs.Close
				Set Rs = Dvbbs.Plus_Execute("Select UserName,Confirmed,ConfirmTime,Finished From Dv_Plus_Avatar_PhotoUser Where PhotoID=" & AvatarSQL(0, i) & " And UserName<>'" & AvatarSQL(2, i) & "'")
				isFirst = True
				Do While Not Rs.Eof
					Set ChildNode = XMLDOM.createNode(1, "PhotoUser", "")
					ChildNode.attributes.setNamedItem(XMLDOM.createNode(2, "UserName", ""))
					ChildNode.Attributes.getNamedItem("UserName").text = Rs(0)
					ChildNode.attributes.setNamedItem(XMLDOM.createNode(2, "URLEncode", ""))
					ChildNode.Attributes.getNamedItem("URLEncode").text = Server.URLEncode(Rs(0))
					ChildNode.attributes.setNamedItem(XMLDOM.createNode(2, "IsConfirmed", ""))
					ChildNode.Attributes.getNamedItem("IsConfirmed").text = Rs(1)
					ChildNode.attributes.setNamedItem(XMLDOM.createNode(2, "ConfirmTime", ""))
					If IsNull(Rs(2)) Then
						ChildNode.Attributes.getNamedItem("ConfirmTime").text = ""
					Else
						ChildNode.Attributes.getNamedItem("ConfirmTime").text = FormatDateTime(Rs(2), 2)
					End If
					ChildNode.attributes.setNamedItem(XMLDOM.createNode(2, "IsAgreed", ""))
					ChildNode.Attributes.getNamedItem("IsAgreed").text = Rs(3)
					Node.appendChild (ChildNode)
					If Not isFirst Then
						FrameHeight = FrameHeight + 15
					Else
						isFirst = False
					End If
					Rs.MoveNext
				Loop
				Rs.Close
				FrameHeight = FrameHeight + 25
				CurCount = CurCount + 1
			Next
			Set Node = XMLDOM.documentElement.selectSingleNode("CurrentInfo")
			Set SubNode = XMLDOM.createNode(2, "FrameHeight", "")
			SubNode.text = FrameHeight
			Node.Attributes.setNamedItem (SubNode)
		Else
			Set Node = XMLDOM.documentElement.selectSingleNode("CurrentInfo")
			Set SubNode = XMLDOM.createNode(2, "TotalRec", "")
			SubNode.text = 0
			Node.Attributes.setNamedItem (SubNode)
			Set SubNode = XMLDOM.createNode(2, "PageCount", "")
			SubNode.text = 0
			Node.Attributes.setNamedItem (SubNode)
			Set SubNode = XMLDOM.createNode(2, "CurPage", "")
			SubNode.text = 0
			Node.Attributes.setNamedItem (SubNode)
			FrameHeight = FrameHeight + 30
			Set SubNode = XMLDOM.createNode(2, "FrameHeight", "")
			SubNode.text = FrameHeight
			Node.Attributes.setNamedItem (SubNode)
			Set SubNode = XMLDOM.documentElement.selectSingleNode("PhotoList")
			Set Node = XMLDOM.documentElement.selectSingleNode("PhotoList/Photo")
			SubNode.removeChild(Node)
		End If
		AvatarRs.Close
		Set AvatarRs = Nothing
	Else
		If ShopID = 597 Then
			AvatarSQL = "Select p.ID,p.Name,p.AddDate,p.URL,p.Status,p.FromUser,p.Child,p.Background,p.UploadFile,p.BackBody,p.ForeBody,p.Foreground,p.Width,p.Height,p.PhotoNameLeft,p.PhotoNameTop,p.PhotoNameFont,p.PhotoNameSize,p.PhotoNameBold,p.PhotoNameItalic,p.PhotoNameColor,p.PhotoNameDirection,p.DateLeft,p.DateTop,p.DateFont,p.DateSize,p.DateBold,p.DateItalic,p.DateColor,p.DateDirection From Dv_Plus_Avatar_PhotoUser u Inner Join Dv_Plus_Avatar_Photo p On u.PhotoID=p.ID Where u.UserName='" & Dvbbs.MemberName & "' And p.Finished<>0 And u.Deleted=0"
		Else
			If Dvbbs.Master Then
				AvatarSQL = "Select ID,Name,AddDate,URL,Status,FromUser,Child,Background,UploadFile,BackBody,ForeBody,Foreground,Width,Height,PhotoNameLeft,PhotoNameTop,PhotoNameFont,PhotoNameSize,PhotoNameBold,PhotoNameItalic,PhotoNameColor,PhotoNameDirection,DateLeft,DateTop,DateFont,DateSize,DateBold,DateItalic,DateColor,DateDirection From Dv_Plus_Avatar_Photo Where Finished<>0"
			Else
				AvatarSQL = "Select ID,Name,AddDate,URL,Status,FromUser,Child,Background,UploadFile,BackBody,ForeBody,Foreground,Width,Height,PhotoNameLeft,PhotoNameTop,PhotoNameFont,PhotoNameSize,PhotoNameBold,PhotoNameItalic,PhotoNameColor,PhotoNameDirection,DateLeft,DateTop,DateFont,DateSize,DateBold,DateItalic,DateColor,DateDirection From Dv_Plus_Avatar_Photo Where Status=1 And Finished<>0"
			End If
		End If
		If Not (IsNull(Request("search_sponsor")) Or Request("search_sponsor") = "") Then
			If ShopID = 597 Then
				AvatarSQL = AvatarSQL & " And p.FromUser Like '%" & Dvbbs.CheckStr(Trim(Request("search_sponsor"))) & "%'"
			Else
				AvatarSQL = AvatarSQL & " And FromUser Like '%" & Dvbbs.CheckStr(Trim(Request("search_sponsor"))) & "%'"
			End If
		End If
		If Not (IsNull(Request("selusercount_l")) Or Request("selusercount_l") = "") Then
			If isInteger(Request("selusercount_l")) Then
				If ShopID = 597 Then
					AvatarSQL = AvatarSQL & " And p.Child>=" & Request("selusercount_l")
				Else
					AvatarSQL = AvatarSQL & " And Child>=" & Request("selusercount_l")
				End If
			End If
		End If
		If Not (IsNull(Request("selusercount_h")) Or Request("selusercount_h") = "") Then
			If isInteger(Request("selusercount_h")) Then
				If ShopID = 597 Then
					AvatarSQL = AvatarSQL & " And p.Child<=" & Request("selusercount_h")
				Else
					AvatarSQL = AvatarSQL & " And Child<=" & Request("selusercount_h")
				End If
			End If
		End If
		Select Case Request("selURL")
		Case "1"
			If ShopID = 597 Then
				AvatarSQL = AvatarSQL & " And Not (p.URL Is Null) And p.URL<>''"
			Else
				AvatarSQL = AvatarSQL & " And Not (URL Is Null) And URL<>''"
			End If
		Case "2"
			If ShopID = 597 Then
				AvatarSQL = AvatarSQL & " And (p.URL Is Null Or p.URL='')"
			Else
				AvatarSQL = AvatarSQL & " And (URL Is Null Or URL='')"
			End If
		End Select
		Select Case Request("selUpload")
		Case "1"
			If ShopID = 597 Then
				AvatarSQL = AvatarSQL & " And Not (p.UploadFile Is Null) And p.UploadFile<>''"
			Else
				AvatarSQL = AvatarSQL & " And Not (UploadFile Is Null) And UploadFile<>''"
			End If
		Case "2"
			If ShopID = 597 Then
				AvatarSQL = AvatarSQL & " And (p.UploadFile Is Null Or p.UploadFile='')"
			Else
				AvatarSQL = AvatarSQL & " And (UploadFile Is Null Or UploadFile='')"
			End If
		End Select
		If ShopID = 597 Then
			AvatarSQL = AvatarSQL & " Order By p.FinishDate Desc"
		Else
			AvatarSQL = AvatarSQL & " Order By FinishDate Desc"
		End If
		CurCount = 0
		Set EmptyNode = XMLDOM.documentElement.selectSingleNode("PhotoList/Photo").CloneNode(True)
		Set AvatarRs = Server.CreateObject("ADODB.Recordset")
		If Cint(Dvbbs.Forum_Setting(92))=1 Then
			If Not IsObject(Plus_Conn) Then Plus_ConnectionDatabase
			AvatarRs.Open AvatarSQL,Plus_Conn,1,1
		Else
			If Not IsObject(Conn) Then ConnectionDatabase
			AvatarRs.Open AvatarSQL,Conn,1,1
		End If
		If Not AvatarRs.EOF Then
			TotalRec = AvatarRs.RecordCount
			Set Node = XMLDOM.documentElement.selectSingleNode("CurrentInfo")
			Set SubNode = XMLDOM.createNode(2, "TotalRec", "")
			SubNode.text = TotalRec
			Node.Attributes.setNamedItem (SubNode)
			If TotalRec Mod PhotoPageSize = 0 Then
				PageCount = TotalRec \ PhotoPageSize
			Else
				PageCount = TotalRec \ PhotoPageSize + 1
			End If
			Set SubNode = XMLDOM.createNode(2, "PageCount", "")
			SubNode.text = PageCount
			Node.Attributes.setNamedItem (SubNode)
			If CurPage > PageCount Then CurPage = PageCount
			If CurPage < 1 Then CurPage = 1
			Set SubNode = XMLDOM.createNode(2, "CurPage", "")
			SubNode.text = CurPage
			Node.Attributes.setNamedItem (SubNode)
			AvatarRs.MoveFirst
			If CurPage > 1 Then
				AvatarRs.Move (CurPage - 1) * PhotoPageSize
			End If
			AvatarSQL = AvatarRs.GetRows(PhotoPageSize)
			AvatarRs.Close
			Set SubNode = XMLDOM.documentElement.selectSingleNode("PhotoList")
			For i = 0 To UBound(AvatarSQL, 2)
				If i > 0 Then
					Set Node = EmptyNode.CloneNode(True)
					SubNode.appendChild (Node)
				Else
					Set Node = XMLDOM.documentElement.selectSingleNode("PhotoList/Photo")
				End If
				With Node.Attributes
					.getNamedItem("PhotoID").text = AvatarSQL(0, i)
					.getNamedItem("PhotoName").text = AvatarSQL(1, i)
					.getNamedItem("PhotoDate").text = FormatDateTime(AvatarSQL(2, i), 2)
					On Error Resume Next
					Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
					If Err = 0 Then
						If objFSO.FileExists(Server.MapPath(AvatarXMLDOM.documentElement.selectSingleNode("AvatarInfo").Attributes.getNamedItem("PhotoPath").text & AvatarSQL(3, i))) Then
							.getNamedItem("PhotoURL").text = AvatarSQL(3, i)
						Else
							.getNamedItem("PhotoURL").text = ""
						End If
					End If
					Set objFSO = Nothing
					On Error GoTo 0
					.getNamedItem("PhotoStatus").text = AvatarSQL(4, i)
					If LCase(AvatarSQL(5, i)) = LCase(Dvbbs.MemberName) Then
						.getNamedItem("PhotoIsOwner").text = 1
					Else
						.getNamedItem("PhotoIsOwner").text = 0
					End If
					.getNamedItem("PhotoUserCount").text = AvatarSQL(6, i)
					If AvatarSQL(8, i) <> "" And Not IsNull(AvatarSQL(8, i)) Then
						.getNamedItem("PhotoBackground").text = ""
						.getNamedItem("PhotoUploadFile").text = AvatarSQL(8, i)
					ElseIf Not IsNull(AvatarSQL(7, i)) Then
						Set Rs = Dvbbs.Plus_Execute("Select Top 1 ID,Content From Dv_Plus_Avatar_Items Where ID=" & AvatarSQL(7, i))
						If Not Rs.Eof Then
							.getNamedItem("PhotoBackground").text = Rs.GetString(, 1, ".", "", "")
						Else
							.getNamedItem("PhotoBackground").text = ""
						End If
						Rs.Close
						.getNamedItem("PhotoUploadFile").text = ""
					Else
						.getNamedItem("PhotoBackground").text = ""
						.getNamedItem("PhotoUploadFile").text = ""
					End If
					If Not IsNull(AvatarSQL(9, i)) Then
						Set Rs = Dvbbs.Plus_Execute("Select Top 1 ID,Content From Dv_Plus_Avatar_Items Where ID=" & AvatarSQL(9, i))
						If Not Rs.Eof Then
							.getNamedItem("PhotoBodyBack").text = Rs.GetString(, 1, ".", "", "")
						Else
							.getNamedItem("PhotoBodyBack").text = ""
						End If
						Rs.Close
					Else
						.getNamedItem("PhotoBodyBack").text = ""
					End If
					If Not IsNull(AvatarSQL(10, i)) Then
						Set Rs = Dvbbs.Plus_Execute("Select Top 1 ID,Content From Dv_Plus_Avatar_Items Where ID=" & AvatarSQL(10, i))
						If Not Rs.Eof Then
							.getNamedItem("PhotoBodyFront").text = Rs.GetString(, 1, ".", "", "")
						Else
							.getNamedItem("PhotoBodyFront").text = ""
						End If
						Rs.Close
					Else
						.getNamedItem("PhotoBodyFront").text = ""
					End If
					If Not IsNull(AvatarSQL(11, i)) Then
						Set Rs = Dvbbs.Plus_Execute("Select Top 1 ID,Content From Dv_Plus_Avatar_Items Where ID=" & AvatarSQL(11, i))
						If Not Rs.Eof Then
							.getNamedItem("PhotoForeground").text = Rs.GetString(, 1, ".", "", "")
						Else
							.getNamedItem("PhotoForeground").text = ""
						End If
						Rs.Close
					Else
						.getNamedItem("PhotoForeground").text = ""
					End If
					.getNamedItem("PhotoBgWidth").text = AvatarSQL(12, i)
					.getNamedItem("PhotoBgHeight").text = AvatarSQL(13, i)
					.getNamedItem("PhotoNameLeft").text = AvatarSQL(14, i)
					.getNamedItem("PhotoNameTop").text = AvatarSQL(15, i)
					.getNamedItem("PhotoNameFontName").text = AvatarSQL(16, i)
					.getNamedItem("PhotoNameFontSize").text = AvatarSQL(17, i)
					.getNamedItem("PhotoNameFontBold").text = AvatarSQL(18, i)
					.getNamedItem("PhotoNameFontItalic").text = AvatarSQL(19, i)
					If AvatarSQL(20, i) <> "" And Not IsNull(AvatarSQL(20, i)) Then
						.getNamedItem("PhotoNameFontColor").text = AvatarSQL(20, i)
					Else
						.getNamedItem("PhotoNameFontColor").text = ""
					End If
					.getNamedItem("PhotoNameDirection").text = AvatarSQL(21, i)
					.getNamedItem("PhotoDateLeft").text = AvatarSQL(22, i)
					.getNamedItem("PhotoDateTop").text = AvatarSQL(23, i)
					.getNamedItem("PhotoDateFontName").text = AvatarSQL(24, i)
					.getNamedItem("PhotoDateFontSize").text = AvatarSQL(25, i)
					.getNamedItem("PhotoDateFontBold").text = AvatarSQL(26, i)
					.getNamedItem("PhotoDateFontItalic").text = AvatarSQL(27, i)
					If AvatarSQL(28, i) <> "" And Not IsNull(AvatarSQL(28, i)) Then
						.getNamedItem("PhotoDateFontColor").text = AvatarSQL(28, i)
					Else
						.getNamedItem("PhotoDateFontColor").text = ""
					End If
					.getNamedItem("PhotoDateDirection").text = AvatarSQL(29, i)
					Set Rs = Dvbbs.Plus_Execute("Select UserName From Dv_Plus_Avatar_PhotoUser Where PhotoID=" & AvatarSQL(0, i) & " And UserName<>'" & AvatarSQL(5, i) & "'")
					If Not Rs.Eof Then
						PhotoUserStr = AvatarSQL(5, i) & "，" & Rs(0)
					Else
						PhotoUserStr = AvatarSQL(5, i)
					End If
					Rs.Close
					If CLng(.getNamedItem("PhotoUserCount").text) > 2 Then
						PhotoUserStr = PhotoUserStr & " 等" & .getNamedItem("PhotoUserCount").text & "人"
					End If
					.getNamedItem("PhotoParticipator").text = PhotoUserStr
				End With
				Call LoadPhotoUserInfo(XMLDOM, Node, AvatarSQL(0, i), ShopID)
				Call LoadPhotoAccoutermentInfo(XMLDOM, Node, AvatarSQL(0, i))
				CurCount = CurCount + 1
			Next
		Else
			Set Node = XMLDOM.documentElement.selectSingleNode("CurrentInfo")
			Set SubNode = XMLDOM.createNode(2, "TotalRec", "")
			SubNode.text = 0
			Node.Attributes.setNamedItem (SubNode)
			Set SubNode = XMLDOM.createNode(2, "PageCount", "")
			SubNode.text = 0
			Node.Attributes.setNamedItem (SubNode)
			Set SubNode = XMLDOM.createNode(2, "CurPage", "")
			SubNode.text = 0
			Node.Attributes.setNamedItem (SubNode)
		End If
		Set AvatarRs = Nothing
		Set SubNode = XMLDOM.documentElement.selectSingleNode("PhotoList")
		For i = CurCount + 1 To PhotoPageSize
			If i > 1 Then
				Set Node = EmptyNode.CloneNode(True)
			Else
				Set Node = XMLDOM.documentElement.selectSingleNode("PhotoList/Photo")
			End If
			If i > 1 Then SubNode.appendChild (Node)
		Next
		Set Node = XMLDOM.documentElement.selectSingleNode("CurrentInfo")
		Set SubNode = XMLDOM.createNode(2, "FrameHeight", "")
		SubNode.text = 835
		Node.Attributes.setNamedItem (SubNode)
	End If
	Set Node = Nothing
	Set SubNode = Nothing
	Set ChildNode = Nothing
	Set EmptyNode = Nothing
End Sub

Sub Main()
	Dim AvatarXSLT, AvatarXMLStyle, AvatarProc

	Set AvatarXMLStyle = Server.CreateObject("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
	'AvatarXMLStyle.loadXML template.HTML(4)
	AvatarXMLStyle.load Server.MapPath("Dv_Plus/Avatar/Plus_Avatar_PhotoDetail.xslt")
	Set AvatarXSLT = Server.CreateObject("Msxml2.XSLTemplate" & MsxmlVersion)
	AvatarXSLT.stylesheet = AvatarXMLStyle
	Set AvatarProc = AvatarXSLT.createProcessor()
	AvatarProc.input = AvatarXMLDOM
	AvatarProc.transform()
	Response.Write AvatarProc.output
	Set AvatarXSLT = Nothing
	Set AvatarXMLStyle = Nothing
End Sub
%>