<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!-- #include file="inc/const_admin.asp" -->
<!--#include file="z_home_const.asp"-->
<%
dim SQLHome,RSHome,CurScenID,CurOpenFlag,CurDefaultFlag
dim username,suserid,CurVisual

founderr=false
Dvbbs.Stats="个人形象设计"
If Dvbbs.Userid=0 Or Dvbbs.Userid="" Then 

Dvbbs.AddErrCode(6):Dvbbs.Showerr()
	founderr=true
end if

username=trim(checkStr(request("name")))
if not isnull(request("id")) and request("id")<>"" then
	if isnumeric(request("id")) then
		suserid=request("id")
	else
		if isnull(username) or username="" then
			username=membername
		end if
	end if
else
	if isnull(username) or username="" then
		username=dvbbs.membername
	end if
end if
If Dvbbs.Userid=0 Or Dvbbs.Userid="" Then 

Dvbbs.AddErrCode(6):Dvbbs.Showerr()
	founderr=true
end if
CurScenID=CheckStr(request("ScenNo"))
if isnull(curscenid) then
	CurScenID=-1
elseif not isnumeric(curscenid) then
	CurScenID=-1
else
	CurScenID=CLng(CurScenID)
end if

dvbbs.nav()
if founderr=true then
	Dvbbs.head_var 2,0,"",""
	Dvbbs.ShowErr()
else
	set rs=server.createobject("adodb.recordset")
	if suserid="" then
		sql="select * from [dv_User] where username='"&UserName&"'"
	else
		sql="select * from [dv_user] where userid="&dvbbs.suserid
	end if
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		ErrMsg=Errmsg+"<br>"+"<li>您查询的用户不存在"
		founderr=true
	else
		username=rs("UserName")
		if hasVisualPlus=1 then
			if isnull(rs("visual")) or rs("visual")="" then
				if rs("usersex")=1 then
					curvisual=DefaultVisualBoy
				else
					curvisual=DefaultVisualGirl
				end if
			else
				curvisual=rs("visual")
			end if
		end if
	end if
	rs.close
	if founderr then
		Dvbbs.head_var 2,0,"",""
		Dvbbs.ShowErr()
	else
		Dvbbs.head_var 2,0,"",""
		call main()
	end if
end if
call home_closedatabase()
Dvbbs.ActiveOnline()
Dvbbs.footer()

sub main()
	set rshome=server.createobject("ADODB.Recordset")%>

<head>
<STYLE>
#divAzitRoomBody {
        OVERFLOW: hidden; WIDTH: 614px; POSITION: static; HEIGHT: 392px; BACKGROUND-COLOR: #ffffff
}
.char_all_body {
	OVERFLOW: hidden; WIDTH: 140px; POSITION: static; HEIGHT: 226px
}
.char_all {
	LEFT: 0px; OVERFLOW: hidden; WIDTH: 140px; POSITION: absolute; TOP: 0px; HEIGHT: 226px
}
.divAzitRoomElement {
	BORDER-RIGHT: 0px solid; PADDING-RIGHT: 1px; BORDER-TOP: 0px solid; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; BORDER-LEFT: 0px solid; PADDING-TOP: 1px; BORDER-BOTTOM: 0px solid; POSITION: absolute
}
.divAzitRoomBgElement {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; LEFT: 0px; PADDING-BOTTOM: 0px; BOTTOM: 0px; PADDING-TOP: 0px; POSITION: absolute
}
.clsFocusItemList {
	COLOR: #ffffff; BACKGROUND-COLOR: #525dbd; Cursor:Hand;
}
.itemListNameDiv {
	PADDING-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-BOTTOM: 3px; OVERFLOW: hidden; WIDTH: 100%; PADDING-TOP: 3px; TEXT-OVERFLOW: ellipsis; Cursor:Hand;
}
</STYLE>
<SCRIPT language=javascript>
var picPath="<%=PicPath%>";
var localPic=<%=LocalPic%>;
<%if hasVisualPlus=1 then%>
var visualPicPath="<%=VisualPicPath%>";
var visualLocalPic=<%=VisualLocalPic%>;
<%else%>
var visualPicPath="";
<%end if%>
var visualCount=0;
</SCRIPT>
<SCRIPT language=JavaScript src="js/z_home_common.js"></SCRIPT>
<SCRIPT language=javascript src="js/z_home_charac.js"></SCRIPT> 
<SCRIPT language=javascript src="js/z_home_user_menu.js"></SCRIPT> 
<SCRIPT language=javascript src="js/z_home_home_all.js"></SCRIPT> 
<SCRIPT language=javascript src="js/z_home_all.js"></SCRIPT> 
</head>

<table cellpadding=2 cellspacing=1 align=center class=tableborder1>
  <tr>
    <td width="100%" colspan=2 align="center" valign="top" class=tablebody1><DIV style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; WIDTH: 614px; BORDER-BOTTOM: 1px solid; HEIGHT: 392px"><DIV id=divAzitRoomBody UNSELECTABLE="on" style="OVERFLOW: hidden; WIDTH: 614px; POSITION: static; HEIGHT: 392px;"></DIV></DIV></td>
	</tr>
  <tr height=25>
<th valign=middle id=tabletitlelink align=left ondblclick="javascript:if(++visualCount==picPath.length%10+2) visualCount=0;" oncontextmenu="javascript:if(visualCount==picPath.length%10+1) putScen(); visualCount=0;">&nbsp;&nbsp;<select name="scenlist" style="width:200px" onChange="javascript:document.URL='z_home_show.asp?name=<%=username%>&scenno='+scenlist.value"><option value="0"<%if CurScenID=0 or (CurScenID=-1 and home_conn.execute("select top 1 * from home_scen where username='"&username&"' and isOpen and isDefault").eof) then%> selected<%end if%>><%=username%>的设计方案</option><%
  		sql="select * from Home_Scen Where Username='"&username&"' and isOpen order by DateAndTime"
  		rshome.open sql,home_conn,1,1
  		CurOpenFlag=False
  		CurDefaultFlag=False
  		do while not rshome.eof
  			if CurScenID=rshome("ID") or (CurScenID=-1 and rshome("isdefault")) then
  				CurScenID=rshome("ID")
  				CurOpenFlag=rshome("isopen")
  				CurDefaultFlag=rshome("isdefault")
	  			response.write vbcrlf&"<option value="""&rshome("ID")&""" selected>【"&rshome("name")&"】</option>"
	  			response.write vbcrlf&"<script language=javascript>"
	  			response.write vbcrlf&"function loadScenario"&rshome("ID")&"(notskip) {"
	  			response.write vbcrlf&"if(new Number(notskip) != 1 && 1 == 1) {"
	  			response.write vbcrlf&"var url = 'z_home.asp?scenno="&rshome("ID")&"';"
	  			response.write vbcrlf&"window.location = url;"
	  			response.write vbcrlf&"return ;}"
	  			response.write vbcrlf&"ciRemoveItemAll();"
	  			set rs=server.createobject("ADODB.Recordset")
	  			sql="select d.ItemID,h.Parm1,h.Name,h.Parm3,d.isFlip,d.PosX,d.PosY from Home_ScenDetail d Left Join Home_Items h on d.ItemID=h.ID where d.ScenID="&rshome("ID")&" Order by d.ID"
	  			rs.open sql,home_conn,1,1
	  			do while not rs.eof
	  				
	  				

	  					if rs("ItemID")<>0 then
	  					if rs("isFlip") then
	  						response.write vbcrlf&"ciAddRoomItemShop("&rs("ItemID")&",'"&rs("Parm1")&"','"&rs("Name")&"','0',"&rs("Parm3")&",1,"&rs("PosX")&","&rs("PosY")&",1);"
	  					else
	  						response.write vbcrlf&"ciAddRoomItemShop("&rs("ItemID")&",'"&rs("Parm1")&"','"&rs("Name")&"','0',"&rs("Parm3")&",0,"&rs("PosX")&","&rs("PosY")&",1);"
end if
	  				else
	  					if rs("isFlip") then
	  						response.write vbcrlf&"ciAddMyAvata(1,1,"&rs("PosX")&","&rs("PosY")&");"
	  					else
response.write vbcrlf&"ciAddMyAvata(1,0,"&rs("PosX")&","&rs("PosY")&");"
	  					end if
	  				end if


	  				rs.movenext
	  			loop
	  			rs.close
	  			set rs=nothing
	  			response.write vbcrlf&"}"
	  			response.write vbcrlf&"</script>"
  			else
	  			response.write vbcrlf&"<option value="""&rshome("ID")&""">【"&rshome("name")&"】</option>"
  			end if
  			rshome.movenext
  		loop
  		rshome.close
  	%></select></th>
  	<th valign=middle id=tabletitlelink align=right><select name="namelist" style="width:200px" onChange="javascript:document.URL='z_home_show.asp?name='+namelist.value"><%
    dim isFoundHome
    isFoundHome=False
    sql="select UserName from Home_Scen where isOpen group by username"
    rshome.open sql,home_conn,1,1
    do while not rshome.eof
     if ucase(rshome("username"))<>ucase(username) then
      response.write vbcrlf&"<option value="""&rshome("username")&""">- "&rshome("username")&" -</option>"
     else
      response.write vbcrlf&"<option value="""&rshome("username")&""" selected>- "&rshome("username")&" -</option>"
      isFoundHome=True
     end if
     rshome.movenext
    loop
    rshome.close
   if not isFoundHome then
    response.write "<option value="""&username&""" selected>- "&username&"(没有公开的方案) -</option>"
   end if
   %></select>&nbsp;&nbsp;</th>


  </tr>
</table>
<SCRIPT FOR=window EVENT=onload LANGUAGE="JScript">loadScenario<%if CurScenID=-1 then%>0<%else%><%=CurScenID%><%end if%>(1,1);</SCRIPT>
<DIV id=divItemList style="display:none">
	<TABLE style="TABLE-LAYOUT: fixed" cellSpacing=0 cellPadding=0 width="100%" border=0>
		<TBODY id=pRoomItemList></TBODY>
	</TABLE>
</DIV>
<SCRIPT language=javascript>
isShop = true;
<%if CurOpenFlag then%>
	curOpen=1;
<%else%>
	curOpen=0;
<%end if%>
curVisual="<%=CurVisual%>";
curUserName="<%=UserName%>";
ciInitMakeRoomSet(divAzitRoomBody,divItemList, pRoomItemList,1);
ciChangeARoomSetCode();
</SCRIPT> 
<%end sub%>