<script type="text/javascript">
  $(document).ready(function() {
    $('.update_stt').keyup(function(event) {
      var id = $(this).attr('rel');
      var table = 'seopage';
      var value = $(this).val();
      $.ajax ({
        type: "POST",
        url: "ajax/update_stt.php",
        data: {id:id,table:table,value:value},
        success: function(result) {
        }
      });
    });
    $('.timkiem button').click(function(event) {
      var keyword = $(this).parent().find('input').val();
      window.location.href="index.php?com=seopage&act=man&type=<?=$_GET['type']?>&keyword="+keyword;
    });
    $("#xoahet").click(function(){
      var listid="";
      $("input[name='chon']").each(function(){
        if (this.checked) listid = listid+","+this.value;
      })
      listid=listid.substr(1);   //alert(listid);
      if (listid=="") { alert("Bạn chưa chọn mục nào"); return false;}
      hoi= confirm("Bạn có chắc chắn muốn xóa?");
      if (hoi==true) document.location = "index.php?com=seopage&act=delete&type=<?=$_GET['type']?>&curPage=<?=$_GET['curPage']?>&listid=" + listid;
    });
  });
</script>
<div class="control_frm" style="margin-top:25px;">
  <div class="bc">
    <ul id="breadcrumbs" class="breadcrumbs">
     <li><a href="index.php?com=seopage&act=man<?php if($_REQUEST['type']!='') echo'&type='. $_REQUEST['type'];?>"><span>Quản lý <?=$title_main ?></span></a></li>
     <?php if($_GET['keyword']!=''){ ?>
      <li class="current"><a href="#" onclick="return false;">Kết quả tìm kiếm " <?=$_GET['keyword']?> " </a></li>
    <?php }  else { ?>
     <li class="current"><a href="#" onclick="return false;">Tất cả</a></li>
   <?php } ?>
 </ul>
 <div class="clear"></div>
</div>
</div>


<form name="f" id="f" method="post">
  <div class="control_frm" style="margin-top:0;">
    <div style="float:left;">
     <input type="button" class="blueB" value="Thêm" onclick="location.href='index.php?com=seopage&act=add<?php if($_REQUEST['type']!='') echo'&type='. $_REQUEST['type'];?>'" />
     <input type="button" class="blueB" value="Xoá Chọn" id="xoahet" />

   </div>  
 </div>

 <div class="widget">
  <div class="title"><span class="titleIcon">
    <input type="checkbox" id="titleCheck" name="titleCheck" />
  </span>
  <h6>Chọn tất cả</h6>
  <div class="timkiem">
   <input type="text" value="" placeholder="Nhập từ khóa tìm kiếm ">
   <button type="button" class="blueB"  value="">Tìm kiếm</button>
 </div>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="sTable withCheck mTable" id="checkAll">
  <thead>
    <tr>
      <td></td>
      <td class="tb_data_small"><a href="#" class="tipS" style="margin: 5px;">Thứ tự</a></td>     
      <?php if($config_images=='true'){?><td class="sortCol"><div>Hình ảnh<span></span></div></td><?php } ?>
      <td class="sortCol"><div>Tên <span></span></div></td>
      <td class="tb_data_small">Ẩn/Hiện</td>
      <td width="200">Thao tác</td>
    </tr>
  </thead>

  <tbody>
   <?php for($i=0, $count=count($items); $i<$count; $i++){?>
    <tr>
     <td>
      <input type="checkbox" name="chon" value="<?=$items[$i]['id']?>" id="check<?=$i?>" />
    </td>


    <td align="center">
      <input type="text" value="<?=$items[$i]['stt']?>" name="ordering[]" onkeypress="return OnlyNumber(event)" class="tipS smallText update_stt" original-title="Nhập số thứ tự bài viết" rel="<?=$items[$i]['id']?>" />

      <div id="ajaxloader"><img class="numloader" id="ajaxloader<?=$items[$i]['id']?>" src="images/loader.gif" alt="loader" /></div>
    </td> 
    <?php if($config_images=='true'){?>
      <td class="title_photo_data">
        <img src="<?= _upload_images.$items[$i]['photo'] ?>" width="100">
      </td>
    <?php } ?>
    <td class="title_name_data">
      <a href="index.php?com=seopage&act=edit<?php if($_REQUEST['type']!='') echo'&type='. $_REQUEST['type'];?>" class="tipS SC_bold"><?=$items[$i]['ten']?></a>
    </td>
    <td align="center">
      <a data-val2="table_<?=$_GET['com']?>" rel="<?=$items[$i]['hienthi']?>" data-val3="hienthi" class="diamondToggle <?=($items[$i]['hienthi']==1)?"diamondToggleOff":""?>" data-val0="<?=$items[$i]['id']?>" ></a>   
    </td>
    <td class="actBtns">
      <a href="index.php?com=seopage&act=edit&id=<?=$items[$i]['id']?><?php if($_REQUEST['type']!='') echo'&type='. $_REQUEST['type'];?>" title="" class="smallButton tipS" original-title="Sửa bài viết"><img src="./images/icons/dark/pencil.png" alt=""></a>

      <a href="index.php?com=seopage&act=delete&id=<?=$items[$i]['id']?><?php if($_REQUEST['type']!='') echo'&type='. $_REQUEST['type'];?>" onClick="if(!confirm('Xác nhận xóa')) return false;" title="" class="smallButton tipS" original-title="Xóa bài viết"><img src="./images/icons/dark/close.png" alt=""></a>
    </td>
  </tr>
<?php } ?>
</tbody>
</table>
</div>
</form>  

<div class="paging"><?=$paging?></div>