<%@ Page Inherits="Dvbbs.bbs.UI.Admin.admin_medal_setting" %>
<%@ Register tagPrefix="Dvbbs" namespace="Dvbbs.Controls" assembly="Dvbbs.Web"%>
<%@ Register tagPrefix="bbs" tagName="AdminHeader" src="controls/admin_header.ascx"%>
<%@ Register tagPrefix="bbs" tagName="AdminFooter" src="controls/admin_footer.ascx"%>
<bbs:AdminHeader title="设置论坛勋章" runat="server" ID="Adminheader1" />
<script language="javascript">
function chkPost()
{
	var i = 0;
	while(true)
	{
		var name = document.getElementById("name" + i ++);
		if (name == null) break;

		if (name.value == "")
		{
			alert("勋章名称必须填写!");
			name.focus();
			return false;
		}
	}
	return true;
}

function onInputIcon(obj)
{
	var e = document.getElementById(obj.name + "show");
	if (obj.value != "")
	{
	e.innerHTML = "<img src='" + "../templates/"+getCurrentSkin()+"/skins/" + getCurrentSkin() + "/medal/"+ icon.value + "' />";
//	e.innerHTML = "<img src='" + "../templates/default/skins/" + getCurrentSkin() + "/medal/"+ obj.value + "' />";	
	}
	
}
function getCurrentSkin()
{
	var str   = document.cookie;
	//var start = str.indexOf("skin=") + 5;
//	var end   = str.indexOf(";", start);
//	return str.substring(start, end);

	if(str.indexOf("skin=")>0) 
	{
	   var start=str.indexOf("skin=") + 5;
	   var end=str.indexOf(";",start);
	   if(str.substring(start,end).indexOf("=")>0 || str.substring(start,end)=='' ) //防止出现"skin=***=***;"或"skin=''"的情况
	     return "default";
	   else
	     return str.substring(start,end);
	}

	 return "default";

}
function init()
{
	var i = 0;
	while(true)
	{
		var icon = document.getElementById("icon" + i ++);
		if (icon == null) break;

		if (icon.value != "")
		{
			var e = document.getElementById(icon.name + "show");
		//	e.innerHTML = "<img src='" + "../templates/default/skins/" + getCurrentSkin() + "/medal/"+ icon.value + "' />";	
		e.innerHTML = "<img src='" + "../templates/"+getCurrentSkin()+"/skins/" + getCurrentSkin() + "/medal/"+ icon.value + "' />";
	
		}
	}
}

</script>
<form id="addnew" runat="server">
	<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="0">
		<tr>
			<th colspan="5">设置论坛勋章</th>
		</tr>
		<tr>
			<td>删除?</td>
			<td>名称</td>
			<td>描述</td>
			<td>图片地址</td>
			<td>图片</td>
		</tr>
		<Dvbbs:Place id="list" runat="server" />
		<tr>
			<td>新增：</td>
			<td><input name="newName" type="text" onFocus="IEvent('focus',this)" onBlur="IEvent('blur',this)" onMouseOver="IEvent('mouseover',this)" onMouseOut="IEvent('mouseout',this)" /></td>
			<td><input name="newRemark" type="text" size="40" onFocus="IEvent('focus',this)" onBlur="IEvent('blur',this)" onMouseOver="IEvent('mouseover',this)" onMouseOut="IEvent('mouseout',this)" /></td>
			<td><input name="newIcon" type="text" onblur="onInputIcon(this)" onFocus="IEvent('focus',this)" onBlur="IEvent('blur',this)" onMouseOver="IEvent('mouseover',this)" onMouseOut="IEvent('mouseout',this)" /></td>
			<td><span id="newiconshow"></span></td>
		</tr>
		<tr align="center" class="bottom">
			<td colspan="5"><input type="submit" id="save" class="button" value="提 交" onclick="return chkPost()" /></td>
		</tr>
	</table>
</form>
<bbs:AdminFooter runat="server" ID="Adminfooter1" />
<script>init();</script>
