<?php (!defined('IN_ADMIN') || !defined('IN_MUDDER')) && exit('Access Denied'); ?>
<div id="body">
<script type="text/javascript">
function showAttr(id) {
    $("tr").each(function(i){
        if(this.id.length>0 && (this.id==id||this.id.substr(0,id.length+1)==id+'_')) {
            this.style.display="";
        }
        if(this.id.length>0 && (this.id==id||this.id.substr(0,id.length+1)!=id+'_')) {
            this.style.display="none";
        }
    });
}
</script>
<form method="post" action="admincp.php?action=<?=$action?>&file=<?=$file?>&">
	<div class="space">
		<div class="subtitle">增加广告</div>
		<table class="maintable" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="altbg1" width="20%">广告主题：</td>
				<td width="80%"><input name="ad[subject]" type="text" class="txtbox" value="<?=$ad['subject']?>" /></td>
			</tr>
			<tr>
				<td class="altbg1">广告类型：</td>
				<td>
                    <div>
                    <input type="radio" name="ad[adtype]" id="adtype_1" value="1"<?if($ad[adtype]==1)echo 'checked';?> onclick="showAttr('font');" /><label for="adtype_1">超链接</label>
                    <input type="radio" name="ad[adtype]" id="adtype_2" value="2"<?if($ad[adtype]==2)echo 'checked';?> onclick="showAttr('img');" /><label for="adtype_2">图片</label>
                    <input type="radio" name="ad[adtype]" id="adtype_3" value="3"<?if($ad[adtype]==3)echo 'checked';?> onclick="showAttr('flash');" /><label for="adtype_3">Flash</label>
                    <input type="radio" name="ad[adtype]" id="adtype_4" value="4"<?if($ad[adtype]==4)echo 'checked';?> onclick="showAttr('html');" /><label for="adtype_4">html代码</label>
                    </div>
                </td>
			</tr>
			<tr>
				<td class="altbg1">有效期：</td>
				<td><input type="tetx" name="ad[begintime]" class="txtbox3" value="<?=$ad['begintime']?>" />&nbsp;-&nbsp;<input type="tetx" name="ad[endtime]" class="txtbox3" value="<?=$ad['endtime']?>" />&nbsp;格式：2008-10-11，留空为长期有效。</td>
			</tr>
            <!--------------------------文字-------------------------->
			<tr id="font_title"<?if($ad['adtype']!=1)echo' style="display:none;"';?>>
				<td class="altbg1">文字标题：</td>
				<td><input name="ad[content][font_title]" type="text" class="txtbox" value="<?=htmlspecialchars(str_replace('\\"','"',$ad['content']['font_title']))?>" /></td>
			</tr>
			<tr id="font_src"<?if($ad['adtype']!=1)echo' style="display:none;"';?>>
				<td class="altbg1">文字大小：</td>
				<td><input name="ad[content][font_size]" type="text" class="txtbox4" value="<?=$ad['content']['font_size']?>" />&nbsp;px</td>
			</tr>
			<tr id="font_href"<?if($ad['adtype']!=1)echo' style="display:none;"';?>>
				<td class="altbg1">文字连接：</td>
				<td><input name="ad[content][font_href]" type="text" class="txtbox" value="<?=$ad['content']['font_href']?>" /></td>
			</tr>
            <!--------------------------图片-------------------------->
			<tr id="img_title"<?if($ad['adtype']!=2)echo' style="display:none;"';?>>
				<td class="altbg1">图片标题：</td>
				<td><input name="ad[content][title]" type="text" class="txtbox" value="<?=htmlspecialchars(str_replace('\\"','"',$ad['content']['img_title']))?>" /></td>
			</tr>
			<tr id="img_src"<?if($ad['adtype']!=2)echo' style="display:none;"';?>>
				<td class="altbg1">图片地址：</td>
				<td><input name="ad[content][img_src]" type="text" class="txtbox" value="<?=$ad['content']['img_src']?>" /></td>
			</tr>
			<tr id="img_size"<?if($ad['adtype']!=2)echo' style="display:none;"';?>>
				<td class="altbg1">图片尺寸(宽x高)：</td>
				<td><input name="ad[content][img_width]" type="text" class="txtbox4" value="<?=$ad['content']['img_width']?>" />&nbsp;x&nbsp;<input name="ad[content][img_height]" type="text" class="txtbox4" value="<?=$ad['content']['img_height']?>" /></td>
			</tr>
			<tr id="img_href"<?if($ad['adtype']!=2)echo' style="display:none;"';?>>
				<td class="altbg1">图片连接：</td>
				<td><input name="ad[content][img_href]" type="text" class="txtbox" value="<?=$ad['content']['img_href']?>" /></td>
			</tr>
            <!--------------------------Flash-------------------------->
			<tr id="flash_src"<?if($ad['adtype']!=3)echo' style="display:none;"';?>>
				<td class="altbg1">Flash地址：</td>
				<td><input name="ad[content][flash_src]" type="text" class="txtbox" value="<?=$ad['content']['flash_src']?>" /></td>
			</tr>
			<tr id="flash_size"<?if($ad['adtype']!=3)echo' style="display:none;"';?>>
				<td class="altbg1">Flash(宽x高)：</td>
				<td><input name="ad[content][flash_width]" type="text" class="txtbox4" value="<?=$ad['content']['flash_width']?>" />&nbsp;x&nbsp;<input name="ad[content][flash_height]" type="text" class="txtbox4" value="<?=$ad['content']['flash_height']?>" /></td>
			</tr>
            <!--------------------------代码-------------------------->
			<tr id="html_code"<?if($ad['adtype']!=4)echo' style="display:none;"';?>>
				<td class="altbg1">HTML代码：</td>
				<td><textarea name="ad[content][code]" rows="8" cols="65"><?=$ad['code']?></textarea></td>
			</tr>
			<tr>
				<td class="altbg1">自定义属性：</td>
				<td><input type="tetx" name="ad[attr]" class="txtbox5" value="<?=$ad['attr']?>" />&nbsp;限 10 字符。</td>
			</tr>
		</table>
	    <center>
        <?if($isedit) {?>
        <input type="hidden" name="adid" value="<?=$adid?>" />
        <input type="hidden" name="isedit" value="1" />
        <?}?>
        <button type="submit" name="dosubmit" value="yes" class="btn" /> 提交 </button>
        </center>
	</div>
</form>
</div>