<link href="styles/general.css" rel="stylesheet" type="text/css" />
<link href="styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/validator.js"></script>
<body>
<h1>
<span class="action-span"><a href="?ctl=ad&act=ad_manage"><tpl>$ad_list</tpl><!--广告列表--></a></span>
<span class="action-span1"><a href="?ctl=index&act=admin_main"><tpl>$common_admin_index</tpl><!--管理首页--></a> >> <tpl>$ad_js</tpl><!--js广告调用--></span>
<div style="clear:both"></div>
</h1>
<div class="form-div">
<form action="" method="post" name="js_code">
  <table width="98%" >
    <tr>
      <td class="label"><tpl>$ad_js_charset</tpl><!--选择编码-->：</td>
      <td><select name="charset" id="charset" onChange="get_code();auto_select();">
        <option value="utf8"><tpl>$ad_js_utf8</tpl><!--国际化编码（utf8）--></option>
		<option value="gb2312"><tpl>$ad_js_gb2312</tpl><!--简体中文（gb2312）--></option>
		<option value="big5"><tpl>$ad_js_big5</tpl><!--繁体中文（big5）--></option>
      </select></td>
    </tr>
    <tr>
      <td colspan="2">
        <div align="center">
          <textarea name="ads_js" cols="60" rows="5"><script src="<tpl>WEB_HOST</tpl>/index.php?ctl=ad&act=front_ad&charset=utf8&ad_id=<tpl>$_GET['ad_id']</tpl>"></script></textarea>
        </div></td>
    </tr>
  </table>
 </form>
</div>
<div id="footer">
<tpl>$common_copyright</tpl>
</div>
<script type="text/javascript">
var elements = document.forms['js_code'].elements;
/**
 * 生成代码
 */
function get_code()
{
    // 生成代码
    var code = '<script src="<tpl>WEB_HOST</tpl>';
        code += '/index.php?ctl=ad&act=front_ad&charset=' + elements['charset'].value;
		code += '&ad_id=<tpl>$_GET['ad_id']</tpl>';
        code += '"></script\>';
        elements['ads_js'].value = code;
}

function auto_select()
{
    document.forms['js_code'].elements['ads_js'].select();
}

auto_select();
</script>
</body>