<{include file="index/header.html"}> 
<div class="cnav"><a href="javascript:;" class="back">编辑广告</a></div>
<!--datapiker-->
<script src="<{$__PUBLIC__}>plug/laydate/laydate.js"></script>
<link href="<{$__PUBLIC__}>plug/laydate/need/laydate.css" rel="stylesheet" type="text/css"> 
<link href="<{$__PUBLIC__}>plug/laydate/skins/default/laydate.css" rel="stylesheet" type="text/css"> 
<!--data end---> 
<style type="text/css">
table tbody tr td{ padding:15px 0; }
#type_1{}
#type_2{ display:none;}
#type_3{ display:none;} 
</style>  
<div class="main"> 
<form action="?m=ad&a=save" method="post">
	<{if $row.id}><input type="hidden" name="id" value="<{$row.id}>" /><{/if}> 
	<table width="100%" class="etable"> 
		<tr>
			<td width="120">广告位置：</td>
			<td>
			<select name="postion">
				<{section name=p loop=$postion}>	
					<option value="<{$postion[p].id}>" <{if $postion[p].id == $row.postion}>selected="selected"<{/if}>><{$postion[p].name}></option>
				<{/section}>	
			</select>
			</td>
		</tr> 
	  	<tr>
			<td>广告名称：</td>
			<td><input type="text" name="name" value="<{$row.name}>" id="name" size="50"/></td>
		</tr>
		<tr>
			<td>广告类型：</td>
			<td>
				<label><input type="radio" name="type" class="chose_type" value="1" <{if $smarty.get.a == 'add'}>checked="checked"<{/if}><{if $row.type == '1'}>checked="checked"<{/if}>/>文字</label>
				<label><input type="radio" name="type" class="chose_type" value="2" <{if $row.type == '2'}>checked="checked"<{/if}>/>图片</label> 
				<label><input type="radio" name="type" class="chose_type" value="3" <{if $row.type == '3'}>checked="checked"<{/if}>/>代码广告</label> 
			</td>
		</tr>
		<tr>
			<td>开始时间：</td>
			<td><input type="text" name="start_time" id="start_time" value="<{$row.start_time}>" size="50"/></td>
		</tr>
		<tr>
			<td>结束时间：</td>
			<td><input type="text" name="end_time" id="end_time" value="<{$row.end_time}>" size="50"/></td>
		</tr>
		<tr id="type_3_1">
			<td>地址链接：</td>
			<td><input type="text" name="link" value="<{$row.link}>" size="50"/></td>
		</tr>
		<tr id="type_1">
			<td valign="top">文字内容：</td>
			<td><textarea name="content" cols="50" rows="5"><{if $row.type == '1'}><{$row.content}><{/if}></textarea></td>
		</tr>
		<tr id="type_2">
			<td>广告图片：</td>
			<td>
				<div class="upload_button">
					<input type="text" name="images" value="<{$row.content}>"/>
					<a class="file" href="javascript:;">选择文件<input type="file" name="imgFile" id="imgFile"/></a>
				</div>
				<div class="upload_tip vtip" data-img="<{if $row.content}><{$__IMG__}><{$row.content}><{/if}>"></div>
			</td> 
		</tr>
		<tr id="type_3">
			<td valign="top">粘贴代码：</td>
			<td><textarea name="code" cols="50" rows="5"><{if $row.type == '3'}><{$row.content}><{/if}></textarea></td> 
		</tr>
		<tr>
			<td>样式色块：</td>
			<td><input type="text" name="color" value="<{$row.color}>" size="50"/></td>
		</tr>
		<tr>
			<td>是否开启：</td>
			<td>
				<label><input type="radio" name="status" value="1" <{if $smarty.get.a == 'add'}>checked="checked"<{/if}><{if $row.status == '1'}>checked="checked"<{/if}>/>开启</label>
				<label><input type="radio" name="status" value="2" <{if $row.status == '2'}>checked="checked"<{/if}>/>关闭</label>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td><input type="submit" name="submit" value="保存"/></td>
		</tr>

	</table>
</form> 
</div>
<{include file="index/footer.html"}> 
<script type="text/javascript" src="<{$__PUBLIC__}>js/ajaxfileupload.js"></script>
<script language="javascript">
laydate({ elem: '#start_time', event: 'focus' });
laydate({ elem: '#end_time', event: 'focus' });
upload('spd','imgFile');
function get_box(){
	var val = $('input:radio[name="type"]:checked').val(); 
	if(val == '1'){
		$("#type_1").show();
		$("#type_2").hide();
		$("#type_3").hide();
		$("#type_3_1").show();
	}else if(val == '2'){
		$("#type_1").hide();
		$("#type_2").show(); 
		$("#type_3").hide(); 
		$("#type_3_1").show();
	}else if(val == '3'){
		$("#type_1").hide();
		$("#type_2").hide(); 
		$("#type_3").show();
		$("#type_3_1").hide();
	}
}
$(function(){
	$(".chose_type").click(function(){ 
		get_box();
	});
	get_box(); 
});
</script>