<%template _header%>
<!--header end-->

<!--NtForumLocation start-->
<div id="foruminfo">
	<div class="userinfo">
		<h2><a href="{config.forumurl}" class="home">{config.forumtitle}</a> <span><a href="usercp.aspx">用户中心</a></span><strong>个性设置</strong></h2>	</div>
	<div class="forumstats">
		<div id="search">
				<%template _quicksearch%>
		</div>
	</div>
</div>

<!--NtForumLocation end-->

<!--主体-->
<div class="controlpannel">
   <%template _menu%>
	<div class="pannelcontent">
		<div class="pcontent">
			<div class="panneldetail">
				<%template _permenu%>	
				<div class="pannelbody">
					<div class="pannellist">
					<%if {page_err}==0%>
						<%if {ispost}%>
							<%template _msgbox%>
						<%else%>
						<form action="" method="post" ID="Form1" enctype="multipart/form-data">
								<label for="templateid" class="labellong2" style="line-height:220%;">风格:</label>
								<select name="templateid" id="templateid" >
								<option value="0" <%if {user.templateid}==0%>selected<%/if%>>默认</option>
								<%loop template templatelist%>
								<option value="{template[templateid]}" 
								<%if {user.templateid}=={strtoint({template[templateid]})}%>selected<%/if%>
								>{template[name]}</option>
								<%/loop%>
							    </select>
								<br />
								<div class="photoimg" style="border-top:1px dashed #CCC; margin-bottom:10px; ">
								<img src="{user.avatar}" <%if {user.avatarwidth}>0%>width="{user.avatarwidth}" height="{user.avatarheight}"<%/if%> id="usingavatarimg" alt="形象图"/>
									<ul>
									<li>
										<input type="radio" id="avatartype1" name="avatartype" value="2" onclick="$('enterurl').style.display='block';$('uploadfile').style.display='none';"
										<%if {avatartype}==2%>
											checked="checked"
										<%/if%>/>使用外部图片
										<div id="enterurl" style="display: none;">
											URL地址: <input name="avatarurl" type="text" class="colorblue" id="avatarurl" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" value="{avatarurl}" size="40" />
											宽度:
											<input name="avatarwidth" type="text" id="avatarwidth" value="{avatarwidth}" size="3" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" maxlength="3" style="width: 30px;" /> &nbsp; &nbsp; 
											高度:
											<input name="avatarheight" type="text" id="avatarheight" value="{avatarheight}" size="3" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" maxlength="3" style="width: 30px;" />	
										</div>
									</li>
									<li>
										<input type="radio" id="avatartype2" name="avatartype" value="1" onclick="$('enterurl').style.display='none';$('uploadfile').style.display='block';"
										<%if {avatartype}==1%>
											checked="checked"
										<%/if%>/>上传头像图片
										<div id="uploadfile" style="display: none;">
										选择本地图片文件: <input name="file" id="file" type="file" size="40" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" />
										</div>
									</li>
									<li>
										<input type="radio" id="avatartype3" name="avatartype" value="0" onclick="$('enterurl').style.display='none';$('uploadfile').style.display='none';$('templateid').style.display='none';BOX_show('fromsystem');" 
										<%if {avatartype}==0%>
											checked="checked"
										<%/if%>
										/>使用系统头像 (点击选择...)
										<input type="hidden" name="usingavatar" id="usingavatar" value="{avatar}" />
									</li>
									</ul>
								</div>
								<input id="sendmsg" class="sbutton" type="submit" value="确定" name="sendmsg"/>
						</form>
						<%/if%>
						</div>
					<%else%>
					<%template _usercperrmsgbox%>
					<%/if%>
			  </div>
			</div>
		</div>
	</div>
</div>
<!--主体-->
</div>
<%template _copyright%>
<%if {page_err}==0 && !{ispost}%>
	<div id="BOX_overlay" style="background: #000; position: absolute; z-index:100; filter:alpha(opacity=50);-moz-opacity: 0.6;opacity: 0.6;"></div>
	<script type="text/javascript" src="templates/{templatepath}/album.js"></script>
	<script type="text/javascript">
		function usethisavatar(e)
		{
			$('usingavatar').value = e.src;
			
			var avatars = $('fromsystem').getElementsByTagName('div');
			for (var i=0; i < avatars.length;i++)
			{
				avatars[i].style.border = "2px dashed white";
			}
			e.parentNode.style.border = "2px dashed black";
		}
		function selectionborder(e)
		{
			if (e.style.border != "2px dashed black" && e.style.border != "black 2px dashed")
			{				
				if (e.style.border == "2px dashed red" || e.style.border == "red 2px dashed" )
				{
					e.style.border = "2px dashed white";
				}
				else
				{
					e.style.border = "2px dashed red";
				}
			}
		}
	</script>

	<div id="fromsystem" class="avatarbackground" style="display: none; position: relative;">
			<div class="avatarlist">
				<ul>
					<%loop avatarfile avatarfilelist%>
						<li>
							<div onmouseover="selectionborder(this)" onmouseout="selectionborder(this)" style="<%if {avatarfile[filename]}=={avatar}%>border: 2px dashed black;<%else%>border: 2px dashed white;<%/if%>cursor: pointer; overflow:hidden; zoom:1;" ><img src="{avatarfile[filename]}" onclick="usethisavatar(this);" alt="形象图名称"/></div>
						</li>
					<%/loop%>
				</ul>
			</div>
			<span class="avatarbutton">
				<input type="button" name="userthisavatar" id="userthisavatar" class="sbutton" value="确定" onclick="$('templateid').style.display='';$('usingavatarimg').src=$('usingavatar').value;BOX_remove('fromsystem');" />
				<input type="button" name="canceluserthisavatar" id="canceluserthisavatar" class="sbutton" value="取消" onclick="$('templateid').style.display='';BOX_remove('fromsystem');" />
			</span>
	</div>
<%/if%>
<%template _footer%>