<?php use_helper('I18N', 'Object', 'Validation', 'Javascript', 'tvtl','ModalBox'); ?>
<?php echo form_tag('/admin/updateadvert', array('class'=>'mainform', 'id'=>'mainform'), $sf_request->getUri(), 1) ?>
  <?php echo input_hidden_tag('oldblock', $block) ?>
  <?php echo input_hidden_tag('advert', $advert) ?>
  <?php if (!$block) $block = 'banner';?>

  <div class="span-2">Khối</div>
  <div class="span-10"><?php echo
    select_tag('block', options_for_select($blocklist, $block),
    array('onchange'=>'onChangeBlock();'))?>
  </div>

  <div class="span-2">Tiêu đề</div>
  <div class="span-10"><?php echo input_tag('title', @$item['title'], 'style="width:400px"')?></div>
  
  <div class="span-2">Hình ảnh</div>
  <div class="span-10"><?php echo input_tag('imgUrl', @$item['imgUrl'], 'style="width:400px"')?></div>

  <div class="span-2">Mã nhúng</div>
  <div class="span-10"><?php echo textarea_tag('embed', @$item['embed'], 'style="width:400px;height:80px"')?></div>

  <div class="span-2">Liên kết</div>
  <div class="span-10"><?php echo input_tag('link', @$item['link'], 'style="width:400px"')?></div>

  <div id="posbox" <?php if ($block!='banner') echo 'style="display:none"';?>>
    <div class="span-2">Tọa độ</div>
    <div class="span-10"><?php echo input_tag('pos', @$item['pos'], 'style="width:80px"')?></div>
  </div>

  <div id="gapbox" <?php if ($block=='banner') echo 'style="display:none"';?>>
    <div class="span-2">Lề ngoài</div>
    <div class="span-10"><?php echo input_tag('gap', @$item['gap'], 'style="width:80px"'), ' (điểm ảnh)'?></div>
  </div>

  <div class="span-2">Kích thước</div>
  <div class="span-10"><?php echo input_tag('size', @$item['width']? $item['width'].'x'.$item['height']: "", 'style="width:80px"'), ' (điểm ảnh)'?></div>

  <div class="span-2">&nbsp;</div>
  <div class="span-10"><?php echo submit_tag('Cập nhật', 'style="width:80px"')?></div>
</form>

<script>
  onChangeBlock = function() {
    if ($('block').value=='banner') {
      Element.show('posbox');
      Element.hide('gapbox');
    } else {
      Element.hide('posbox');
      Element.show('gapbox');
    }
  }
</script>
