<SCRIPT LANGUAGE="JavaScript">
function ifdel()
{
	return confirm("您确定要删除吗？");
}
function open_new_ad()
{
	with(document.getElementById('new_ad').style)
	{
		display = display == "none"?"":"none";
	}
}
</SCRIPT>

<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF">
<form action="admin.php?action=savead"  method="post" name="" >
<table width="100%" border="0" cellspacing="1" cellpadding="5">

<tr id="cat">
	<td class="tblhead" colspan="5"><b>自定义模板变量</b></td>
</tr>
<tr align="center" bgcolor="#F3F3F3">
<td width="10%"><b>Name</b></td>
<td width="20%"><b>描述</b></td>
<td width="50%"><b>内容</b></td>
<td width="5%"><b>启用</b></td>
<td width="15%"><b>操作</b></td>
</tr>

<?php
if (is_array($ads1))
{

foreach($ads1 as $item)
{
?>
<tr  class="listbg">
	<td align="center"><input type="text" name="tag[]" value="<?php echo $item['tag'];?>" size="10"  class="formfield"></td>
	<td align="center"><input type="text" name="description[]" value="<?php echo $item['description'];?>" size="20"  class="formfield"></td>
	<td align="center"><textarea name="content[]" rows=3 style='width:100%'><?php echo htmlspecialchars($item['content']);?></textarea></td>
	<td>
	<select name="tag_open[]">
		<option value="1" <?php if ($item['tag_open'] == "1") echo 'selected';?>>是</option>
		<option value="0" <?php if ($item['tag_open'] == "0") echo 'selected';?>>否</option>
	 </select>
	</td>
	<td align="center">[<a href="admin.php?action=delad&id=<?php echo $item['id'];?>" onclick="return ifdel()">删除</a>]</td>
</tr>
<?php
}
}
?>



<tr>
<td colspan="5" align="center">
 <input class="button"  type="submit" name="" value="更新" > &nbsp;<input type="reset" class="button" value="重置" /> &nbsp;
 <input class="button" type="button" value="新增" onclick="open_new_ad()" />
</td></tr>
</table>

<table width="100%" border="0" cellspacing="1" cellpadding="5" id='new_ad' style="display:none">
<tr id="cat">
	<td class="tblhead" colspan="5"><b>新增模板变量</b></td>
</tr>
<tr align="center" bgcolor="#F3F3F3">
<td width="10%"><b>Name</b></td>
<td width="20%"><b>描述</b></td>
<td width="50%"><b>内容</b></td>
<td width="5%"><b>启用</b></td>
<td width="15%"><b>操作</b></td>
</tr>
<tr  class="listbg">
	<td align="center"><input type="text" name="tag[]" value="" size="10"  class="formfield"></td>
	<td align="center"><input type="text" name="description[]" value="" size="20"  class="formfield"></td>
	<td align="center"><textarea name="content[]" rows=3 style='width:100%'></textarea></td>
	<td><input type="checkbox" name="tag_open[]" checked /></td>
	<td align="center"><input type="submit" value="添加" name="add" /></td>
</tr>
</table>

</form>

</td>
</tr>
</table>

</body>
</html>