<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title>增加廣告</title>
<link href="css/base.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/calendar/calendar.js"></script>
<script src="../include/js/jquery/jquery.js" language="javascript" type="text/javascript"></script>
<script language="javascript">
function checkSubmit()
{
	if(document.form1.tagname.value=="")
	{
		alert("廣告標識不能為空！");
		document.form1.tagname.focus();
		return false;
	}
}

</script>
</head>
<body background="images/allbg.gif" leftmargin='8' topmargin='8'>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D6D6D6">
  <tr>
    <td height="28" background="images/tbg.gif" style="padding-left:10px;"><b><a href="ad_main.php"><u>廣告管理</u></a></b> &gt;&gt; 增加廣告位置 </td>
  </tr>
  <tr>
    <td height="200" bgcolor="#FFFFFF" valign="top"><table width="100%" border="0" cellspacing="4" cellpadding="4">
        <form action="ad_add.php" method="post" name="form1" onSubmit="return checkSubmit()">
          <input type='hidden' name='dopost' value='save'>
          <tr>
            <td height="25" colspan="3">廣告代碼的調用方法：{dede:myad name='廣告位標識'/} </td>
          </tr>
          <tr>
            <td height="25" align="center">廣告位標識：</td>
            <td colspan="2"><input name="tagname" type="text" id="tagname" class='iptxt' />
              （使用英文或數字表示的簡潔標識）</td>
          </tr>
          <tr>
            <td width="15%" height="25" align="center">廣告投放範圍：</td>
            <td colspan="2"><?php
			$tl = new TypeLink(0);
			$typeOptions = $tl->GetOptionArray(0,0,0);
			echo "<select name='typeid' style='width:300px'>\r\n";
			echo "<option value='0' selected>投放在沒有同名標識的所有欄目</option>\r\n";
			echo $typeOptions;
			echo "</select>";
			?>
              <br>
              （如果在所選欄目找不到指定標識的廣告內容，系統會自動搜索父欄目）</td>
          </tr>
          <tr>
            <td height="25" align="center">廣告位名稱：</td>
            <td colspan="2"><input name="adname" type="text" id="adname" size="30" class='iptxt' /></td>
          </tr>
          <tr>
            <td height="25" align="center">時間限制：</td>
            <td colspan="2"><input name="timeset" type="radio" class="np" value="0" checked='1' id="notimelimit" />
              <label for="notimelimit">永不過期</label>
              <input type="radio" name="timeset" class="np" value="1" id="timelimit"/>
              <label for="timelimit">在設內時間內有效</label></td>
          </tr>
          <tr>
            <td height="25" align="center">開始時間：</td>
            <td colspan="2"><input name="starttime" type="text" id="starttime" value="<?php echo $startDay?>" class='iptxt'/>
              <script language="javascript" type="text/javascript">
						Calendar.setup({
							inputField     :    "starttime",
							ifFormat       :    "%Y-%m-%d %H:%M",
							showsTime      :    true,
							timeFormat     :    "24"
						});
				 </script></td>
          </tr>
          <tr>
            <td height="25" align="center">結束時間：</td>
            <td colspan="2"><input name="endtime" type="text" id="endtime" value="<?php echo $endDay?>" class='iptxt'/>
              <script language="javascript" type="text/javascript">
						Calendar.setup({
							inputField     :    "endtime",
							ifFormat       :    "%Y-%m-%d %H:%M",
							showsTime      :    true,
							timeFormat     :    "24"
						});
				 </script></td>
          </tr>
          <tr>
            <td height="80" align="center">展現方式：</td>
            <td width="76%"><select id="adstyle" name="normbody[style]" onChange="showcode(this.options[this.selectedIndex].value)">
                <option value="code" >代碼</option>
                <option value="txt" >文字</option>
                <option value="img" >圖片</option>
                <option value="flash" >Flash</option>
              </select></td>
            <td width="9%">&nbsp;</td>
          </tr>
          <tr>
            <td height="80" align="center">廣告內容：</td>
            <td><div id='advert'>
               <div id="code" style="display:none;">
                <table width="100%" cellpadding="3" cellspacing="1" class="i_table">
                  <tr class="b">
                    <td width="30%"><b>廣告代碼:</b><br>
                      請填寫廣告代碼，支持html代碼</td>
                    <td><textarea name="normbody[htmlcode]" rows="5" cols="50"></textarea></td>
                  </tr>
                </table>
              </div>
              <div id="txt" style="display:none;">
                <table width="100%" cellpadding=3 cellspacing=1 class=i_table>
                  <tr>
                    <td class="b" width="30%"><b>文字內容*</b></td>
                    <td class="b"><input type="text" size="70" name="normbody[title]" value="" class='iptxt'/></td>
                  </tr>
                  <tr>
                    <td class="b"><b>文字鏈接*</b></td>
                    <td class="b"><input type="text" size="70" name="normbody[link]" value="" class='iptxt'/></td>
                  </tr>
                  <tr>
                    <td class="b"><b>文字顏色</b>(例如:red,#EF8684)</td>
                    <td class="b"><input type="text" size="10" name="normbody[color]" value="" class='iptxt'/></td>
                  </tr>
                  <tr>
                    <td class="b"><b>文字大小</b>(例如:4px,12px)</td>
                    <td class="b"><input type="text" size="10" name="normbody[size]" value="" class='iptxt'/></td>
                  </tr>
                </table>
              </div>
              <div id="img" style="display:none;">
                <table width="100%" cellpadding=3 cellspacing=1 class=i_table>
                  <tr>
                    <td class="b" width="30%"><b>圖片地址*</b></td>
                    <td class="b"><input type="text" size="40" name="normbody[url]" value="" class='iptxt'/></td>
                  </tr>
                  <tr>
                    <td class="b"><b>圖片鏈接*</b></td>
                    <td class="b"><input type="text" size="40" name="normbody[link]" value="" class='iptxt'/></td>
                  </tr>
                  <tr>
                    <td class="b"><b>圖片寬度</b></td>
                    <td class="b"><input type="text" size="10" name="normbody[width]" value="" class='iptxt'/></td>
                  </tr>
                  <tr>
                    <td class="b"><b>圖片高度</b></td>
                    <td class="b"><input type="text" size="10" name="normbody[height]" value="" class='iptxt'/></td>
                  </tr>
                  <tr>
                    <td class="b"><b>圖片描述</b></td>
                    <td class="b"><input type="text" size="40" name="normbody[descrip]" value="" class='iptxt'/></td>
                  </tr>
                </table>
              </div>
              <div id="flash" style="display:none;">
                <table width="100%" cellpadding=3 cellspacing=1 class=i_table>
                  <tr>
                    <td class="b" width="30%"><b>flash鏈接</b></td>
                    <td class="b"><input type="text" size="40" name="normbody[link]" value="" class='iptxt'/></td>
                  </tr>
                  <tr>
                    <td class="b"><b>flash寬度</b></td>
                    <td class="b"><input type="text" size="40" name="normbody[width]" value="" class='iptxt'/></td>
                  </tr>
                  <tr>
                    <td class="b"><b>flash高度</b></td>
                    <td class="b"><input type="text" size="40" name="normbody[height]" value="" class='iptxt'/></td>
                  </tr>
                </table>
              </div>           
            
            
            </div>
</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td height="80" align="center">過期顯示內容：</td>
            <td><textarea name="expbody" rows="10" id="expbody" style="width:60%;height:100"></textarea></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td height="53" align="center">&nbsp;</td>
            <td colspan="2"><input name="imageField" type="image" src="images/button_ok.gif" width="60" height="22" border="0" class="np" /></td>
          </tr>
        </form>
      </table></td>
  </tr>
</table>
<script language="JavaScript">
function showcode(idName){
	jQuery("#advert>div").hide();
	jQuery("#advert>#"+idName).show()
}
showcode('code');
</script>
</body>
</html>