<table width="100%" class="topmenu">
	<tr><td>
		<a href="banner.php"><em>Banner管理</em></a><span>|</span>
		<a href="bannerpic.php?bid={?$banner.id?}"><em>『{?$banner.title?}』图片列表</em></a><span>|</span>
		<a href="bannerpic.php?bid={?$banner.id?}&action=add" class="on"><em>添加图片</em></a>
	</td></tr>
</table>
<form id="formAdd" method="post" action="?action=add">
<input type="hidden" name="dosubmit" value="1">
<input type="hidden" name="bid" value="{?$banner.id?}">
{?if $row.id>0?}<input type="hidden" name="id" value="{?$row.id?}">{?/if?}
	<table width="100%" class="grid">
		<tr>
			<td class="tdleft" width="100">Banner位置：</td>
			<td>{?$banner.title?}</td>
		</tr>
		<tr>
			<td class="tdleft">图片地址：</td>
			<td><input type="text" class="text" name="url" id="url" size="60" maxlength="100" value="{?$row.url?}" readonly/>&nbsp;<input type="button" class="button" id="butimage" value="选择图片" /></td>
		</tr>
		<tr>
			<td class="tdleft">图片标题：</td>
			<td><input type="text" class="text" name="title" id="title" size="60" maxlength="20" value="{?$row.title?}" /></td>
		</tr>
		<tr>
			<td class="tdleft">链接地址：</td>
			<td><input type="text" class="text" name="link" id="link" size="60" maxlength="100" value="{?$row.link?}" /></td>
		</tr>
		<tr>
			<td class="tdleft">排序：</td>
			<td><input type="text" class="text" name="listorder" size="10" maxlength="2" value="{?$row.listorder?}" onkeyup="value=value.replace(/[^0-9]/g,'');" /></td>
		</tr>
	</table>
<div><br><input type="submit" name="submit" id="submit" class="button" value="提 交"/></div>
</form>
<script type="text/javascript" src="{?$saxue_skin_server?}/editor/kindeditor-min.js"></script>
<script type="text/javascript" src="{?$saxue_skin_server?}/editor/lang/zh_CN.js"></script>
<link type="text/css" rel="stylesheet" href="{?$saxue_skin_server?}/editor/themes/default/default.css" />
<script type="text/javascript">
KindEditor.ready(function(K) {
	var editor = K.editor({
		langType : 'zh_CN',
		urlType  : 'domain',
		uploadJson : '{?$saxue_url?}/api/upload_json.php',
		fileManagerJson : '{?$saxue_url?}/api/file_manager_json.php',
		allowFileManager : true
	});
	K('#butimage').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				imageUrl : K('#url').val(),
				clickFn : function(url, title, width, height, border, align) {
					K('#url').val(url);
					editor.hideDialog();
				}
			});
		});
	});
});
$(function(){
	$("#formAdd").ajaxForm({
        dataType: "json",
        success : function(data){
			if(data.flag == 0){
				doTip(data.msg);
			}else{
				window.top.mainframe.location.href='bannerpic.php?bid={?$banner.id?}';
				doDialogClose();
			}
        }
    });
})
</script>