﻿var path='../';

//显示选框
function intoManage(){
  if(confirmAdmin()==true || confirmBbsAdmin(getArea(1))==true){
    var mBox=document.getElementsByName("article[]");
    if(mBox && mBox.length>0){
      for(var i=0;i<mBox.length;i++){
        if(mBox[i].style.display=="inline")
          mBox[i].style.display="none";
        else
          mBox[i].style.display="inline";
      }
    }
  }else{
    alert('管理员或总版主或版区版主才能执行！你可能尚未具备此权限');
  }
  return false;
}

//编辑
function editD(){
  if(get_checkbox()==''){
    alert('数据为空或尚未点选！');
    return;
  }
  if(confirmAdmin()==true || confirmBbsAdmin(getArea(1))==true)
    location.href=get_checkbox()+'?act=edit#edit_area';
  else
    alert("你不能编辑此文章！");
}

//管理
function manage(type,myp){
  if(myp!='' && myp!='../')myp='';
  if(get_checkbox()==''){
    alert('数据为空或尚未点选！');
    return;
  }
  if(confirmAdmin()==true || confirmBbsAdmin(getArea(1))==true){
    var runType=new Array();
    runType['essence']='推荐';
    runType['top']='置顶';
    runType['down']='取消置顶';
    runType['del']='删除';
    if(confirm('确定'+runType[type]+'吗？')){
      document.manageform.action='../'+myp+'run.php?run=run_article&act='+type+'&area='+getArea(1)+'';
      document.manageform.submit();
    }
  }else{
    alert("操作越权！");
  }
}

function get_checkbox(){
  var allCheckBox=document.getElementsByName("article[]");
  var article='';
  if(allCheckBox!=null && allCheckBox.length>0){
    for(var i=0;i<allCheckBox.length;i++){
      if(allCheckBox[i].checked==true && allCheckBox[i].disabled==false){
        article=allCheckBox[i].value;
        break;
      }
    }
  }
  return article;
}

  function allChoose(v1,v2){
    var a=document.getElementsByName("article[]");
    for(var i=0;i<a.length;i++){
      if(a[i].checked==false)
        a[i].checked=v1;
      else
        a[i].checked=v2;
    }
  }

