<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp" -->
<!--#include file="inc/plus_check.asp"-->
<!--#include file="Dv_Plus/Avatar/Plus_Avatar_Const.asp"-->
<%
Dim ShopID, CurPage, Sex, CurType, isBig, AvatarPageSize, 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 = 199
	ElseIf ShopID < 1 And Abs(ShopID Mod 100) <> 95 Then
		ShopID = 199
	End If
	Select Case Abs(ShopID) Mod 100
	Case 0, 95, 96, 94, 97
		CurType = (Abs(ShopID) Mod 100)
		isBig = 0
		CurTypeName = GetTypeName(ShopID)
		CurSubTypeName = GetSubTypeName(ShopID)
	Case Else
		Set AvatarRs = Dvbbs.Plus_Execute("SELECT s.TypeID, s.isBig, t.TypeName, s.SubTypeName, s.ParentSubType, p.SubTypeName AS ParentName FROM (Dv_Plus_Avatar_SubType AS s LEFT JOIN Dv_Plus_Avatar_SubType AS p ON s.ParentSubType = p.ID) INNER JOIN Dv_Plus_Avatar_Type AS t ON t.ID = s.TypeID Where s.MyType=" & ShopID)
		If AvatarRs.EOF Or AvatarRs.Bof Then
			ShopID = 199
			CurType = 2
			isBig = 0
			CurTypeName = GetTypeName(ShopID)
			CurSubTypeName = GetSubTypeName(ShopID)
		Else
			CurType = AvatarRs(0)
			isBig = AvatarRs(1)
			CurTypeName = AvatarRs(2)
			If AvatarRs(4) <> 0 Then
				CurSubTypeName = AvatarRs(5) & "(" & AvatarRs(3) & ")"
			Else
				CurSubTypeName = AvatarRs(3)
			End If
		End If
		Set AvatarRs = Nothing
	End Select
	Sex = Dvbbs.CheckStr(Request("Sex"))
	If IsNull(Sex) Or Sex = "" Then Sex = v_CurSex
	If Sex = 2 Then Sex = ""
	CurPage = 1
	AvatarPageSize = CInt(AvatarXMLDOM.documentElement.selectSingleNode("AvatarInfo").Attributes.getNamedItem("ItemListCount").Text)
	Dv_Plus.Name = "Plus_Avatar"
	Dvbbs.LoadTemplates ("Avatar")
	Call GetCurrentUserInfoXML(AvatarXMLDOM, ShopID)
	Call GetCurrentAvatarXML(AvatarXMLDOM)
	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
		Dv_Plus.CheckLogin
		Dvbbs.Stats = template.Strings(0)
		Dvbbs.Nav()
		Dvbbs.Head_Var 2, 0, "", ""
		Dvbbs.ActiveOnline()
		Call AvatarNav
		Call Main
		Dvbbs.Footer
	End If
	Set AvatarXMLDOM = Nothing
	Set Dv_plus = Nothing
End If

Sub Main()
	Dim AvatarXSLT, AvatarXMLStyle, AvatarProc
	
	Set AvatarXMLStyle = Server.CreateObject("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
	'AvatarXMLStyle.loadXML template.HTML(1)
	AvatarXMLStyle.load Server.MapPath("Dv_Plus/Avatar/Plus_Avatar_Center.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
%>