<{include file="index/header.html"}>
<!--datapiker--> 
<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> 
<form id="form" action="<{$__ADMIN__}>ad/ad_save" method="post" back="frame_reload">
	<{if $row.id}><input type="hidden" name="id" value="<{$row.id}>" /><{/if}> 
	
	<input type="hidden" name="postion" value="<{$smarty.get.pid}>"/>
	<table class="etable">
		<tr>
			<td width="100">标题：</td>
			<td><input type="text" name="name" value="<{$row.name}>" id="name" size="50"/><i>必须</i></td>
		</tr>
		<tr>
			<td>描述：</td>
			<td><input type="text" name="desc" value="<{$row.desc}>" id="name" size="50"/></td>
		</tr> 
		<tr>
			<td>开始时间：</td>
			<td><input type="text" name="start_time" id="start_time" value="<{$row.start_time}>" size="50" autocomplete="off"/><i>必须</i></td>
		</tr>
		<tr>
			<td>结束时间：</td>
			<td><input type="text" name="end_time" id="end_time" value="<{$row.end_time}>" size="50" autocomplete="off"/><i>必须</i></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="type" class="chose_type" value="1" <{if $row.type == '' || $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 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_1">
			<td>链接：</td>
			<td><input type="text" name="link" value="<{$row.link}>" size="50"/></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="px" value="<{$row.px}>" size="50"/></td> 
		</tr>
		<tr>
			<td>状态：</td>
			<td>
				<label><input type="radio" name="status" value="1" <{if $row.status == '1' || $samrty.get.id == ''}>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> 
<{include file="index/footer.html"}> 
<script src="<{$__PUBLIC__}>plug/laydate/laydate.js"></script> 
<script type="text/javascript"> 
admin_upload('spd', '#imgFile'); 

laydate({elem:'#start_time', event:'focus', type:'datetime',  istime:true, istoday:true, format:'YYYY-MM-DD hh:mm:ss'});
laydate({elem:'#end_time', event:'focus', type:'datetime',  istime:true, istoday:true, format:'YYYY-MM-DD hh:mm:ss' });
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>