{include file="page_header.htm"}
{insert_scripts files="../js/utils.js"}
<form enctype="multipart/form-data" name="theForm" action="ad_manage.php" method="post" onsubmit="return validate()">
<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="table_form1" >	
	<tr>
	<td class="label">语言:</td>
	<td>
	<select name="language_id" class="select_input">
	{section name=loop loop=$sel_language}
	<option value="{$sel_language[loop].language_id}" {if $sel_language[loop].language_id==$ad.language_id} selected="selected" {/if}>{$sel_language[loop].name}</option>
	{/section}
	</select>
	</td>
	</tr>
	<tr>
	<td class="label">广告位置:</td>
	<td>
		<input type="hidden" name="category" id="category" value="{$category}" />
		<select name="position" id="position" onChange="change_position(this)" class="select_input">
			<option value="0" selected="selected">------选择广告位置------</option>
			{section name=loop loop=$adv_array}
			<option value="{$adv_array[loop].adv_flag}"  advSize="{$adv_array[loop].adv_size}" {if $ad.category == $adv_array[loop].adv_flag} selected="selected" {/if}>{$adv_array[loop].adv_description}</option>
			{/section}
		</select>
		<span class="required">&nbsp;</span>

		<div class="" id="positionMsg" style="display:none;"></div>
		
	</td>
	</tr>
	
	<tr>
	<td class="label">广告名称:</td>
	<td>
	<input type="input" name="name" class="FormSmall" style="width:250px;" id="name" value="{$ad.name|escape}" /> <span class="required">&nbsp;</span>
	</td>
	</tr>

	<tr>
	<td class="label">广告文件:</td>
	<td>
	<input type="file"  class="FormSmall" name="file" id="file" />
	<a href="#" title="最佳尺寸请根据前台页面来定，可以通过QQ截图的方式框出图片大小" style="margin-left:5px;" ><img src="images/help.gif" border="0" alt=""/></a>
	  <span class="required">&nbsp;</span>&nbsp;&nbsp;
	  <span style="color:#FF0000;" id="adv_size"></span>
	{if $ad.ad_file}
	  <br />
	  <a href="{$ad.ad_file}" target="_blank"><img src="{$ad.ad_file}" border="0" style="margin:5px 0px" /></a>
	  <br /><div style="font-size:12px;"><input name="delimg" type="checkbox" />&nbsp;删除</div>
	{/if}				
	</td>
	</tr>	
	
	<tr>
	<td class="label">链接地址:</td>
	<td>
	<input type="input" name="url" value="{$ad.url}" class="FormSmall" style="width:250px;" id="url" />	</td>
	</tr>	
	
	<tr>
	<td class="label">排序:</td>
	<td>
	<input type="input" class="FormSmall"  name="sort_order" style="width:50px;" value="{$ad.sort_order}" /> 
	从小到大排列	</td>
	</tr>	
	
	<tr>
	<td class="label">状态:</td>
	<td>
    <label><input type="radio" name="status" value="1" {if $ad.status == 1}checked="checked"{/if} /> 启用</label>
    <label><input type="radio" name="status" value="0" {if $ad.status == 0}checked="checked"{/if}/> 禁用</label>
	</td>
	</tr>		
	

	<tr>
	<td style="border:none;"></td>
	<td style="border:none;">
		<input type="hidden" name="act" value="{$form_act}" />
		<input type="hidden" id="ad_id" name="ad_id" value="{$ad.ad_id}" />
	<input type="submit" value="提交" class="bginput" />
	<input type="reset" value="重置" class="bginput" />
	</td>
	</tr> 
</table>
</form>

<script type="text/javascript">
{literal}
function change_position(selObj){
	var current = selObj.options[selObj.selectedIndex];
	var adv_size = current.getAttribute('advSize');
	if (adv_size){
		document.getElementById('adv_size').innerHTML=adv_size;
	}else{
		document.getElementById('adv_size').innerHTML='';
	}
	document.getElementById('position').value=current.value;
	document.getElementById('category').value=current.value;
}

change_position(document.getElementById('position'));

function validate(){
	validator = new Validator("theForm");
	validator.required("name",      "请输入广告名称");
	return validator.passed();
}
{/literal}
</script>
{insert_scripts files="validator.js"}
{include file="page_footer.htm"}