<!-- $Id: goods_info.htm 17126 2010-04-23 10:30:26Z liuhui $ -->
<?php echo $this->fetch('pageheader.htm'); ?>
<?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js')); ?>
<script type="text/javascript" src="../js/calendar.php?lang=<?php echo $this->_var['cfg_lang']; ?>"></script>
<script charset="utf-8" src="../includes/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="../includes/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript">
     var editor;
        KindEditor.ready(function(K) {
                editor = K.create('#editor_id');
        });
</script>
<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />

<?php if ($this->_var['warning']): ?>
<ul style="padding:0; margin: 0; list-style-type:none; color: #CC0000;">
  <li style="border: 1px solid #CC0000; background: #FFFFCC; padding: 10px; margin-bottom: 5px;" ><?php echo $this->_var['warning']; ?></li>
</ul>
<?php endif; ?>

<!-- start goods form -->
<div class="tab-div">

    <!-- tab body -->
    <div id="tabbody-div">
      <form enctype="multipart/form-data" action="" method="post" name="theForm" >
        <table width="90%" id="web-table" align="center" class="goods_info">
          <tr>
            <td>文章標題</td>
            <td><input type="text" name="subject" value="<?php echo $this->_var['news']['subject']; ?>" size="50" />
            <?php echo $this->_var['lang']['require_field']; ?></td>
          </tr>
          <tr>
            <td>文章內容</td>
            <td><textarea id="editor_id" name="content" style="width:100%;height:300px;">
			<?php echo $this->_var['news']['content']; ?>
			</textarea>
            </td>
          </tr>
          <tr>
            <td>上傳新聞圖</td>
            <td>
              <input type="file" name="image" size="35" />
              <?php if ($this->_var['news']['image']): ?>
                <a href="news.php?act=show_image&img_url=<?php echo $this->_var['news']['image']; ?>" target="_blank">
					<img src="../<?php echo $this->_var['news']['image']; ?>" width="100" />
					<img src="images/yes.gif" border="0" />
				</a>
              <?php else: ?>
                <img src="images/no.gif" />
              <?php endif; ?>
            </td>
          </tr>
		  <tr>
			<td>
			開始日期
			</td>
			<td>
			  <input name="start_time" type="text" id="start_time" size="22" value='<?php echo $this->_var['news']['start_time']; ?>' readonly="readonly" />
			  <input name="selbtn1" type="button" id="selbtn1" onclick="return showCalendar('start_time', '%Y-%m-%d', false, false, 'selbtn1');" value="<?php echo $this->_var['lang']['btn_select']; ?>" class="button"/>
			</td>
		  </tr>
		  <tr>
			<td>結束日期</td>
			<td>
			  <input name="end_time" type="text" id="end_time" size="22" value='<?php echo $this->_var['news']['end_time']; ?>' readonly="readonly" />
			  <input name="selbtn2" type="button" id="selbtn2" onclick="return showCalendar('end_time', '%Y-%m-%d', false, false, 'selbtn2');" value="<?php echo $this->_var['lang']['btn_select']; ?>" class="button"/>    </td>
		  </tr>
        </table>

        <div class="button-div">
          <input type="hidden" name="id" value="<?php echo $this->_var['news']['id']; ?>" />
          <input type="button" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" onclick="validate('<?php echo $this->_var['news']['id']; ?>')" />
          <input type="reset" value="<?php echo $this->_var['lang']['button_reset']; ?>" class="button" />
        </div>
        <input type="hidden" name="act" value="<?php echo $this->_var['form_act']; ?>" />
      </form>
    </div>
</div>
<!-- end goods form -->
<?php echo $this->smarty_insert_scripts(array('files'=>'validator.js')); ?>

<script language="JavaScript">
  
  onload = function()
  {
//      handlePromote(document.forms['theForm'].elements['is_promote'].checked);

      if (document.forms['theForm'].elements['auto_thumb'])
      {
          handleAutoThumb(document.forms['theForm'].elements['auto_thumb'].checked);
      }

      document.forms['theForm'].reset();
  }

  function validate(id)
  {
      var validator = new Validator('theForm');
      editor.sync();

//      validator.required('domain', '網址不能為空');
//      validator.required('cname', '名稱不能為空');

      if(validator.passed())
      {
         document.forms['theForm'].submit();
      }
	}

  function searchGoods(szObject, catId, brandId, keyword)
  {
      var filters = new Object;

      filters.cat_id = elements[catId].value;
      filters.brand_id = elements[brandId].value;
      filters.keyword = Utils.trim(elements[keyword].value);
      filters.exclude = document.forms['theForm'].elements['goods_id'].value;

      szObject.loadOptions('get_goods_list', filters);
  }

  
</script>
<?php echo $this->fetch('pagefooter.htm'); ?>
