<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.organize.SzDepart" %>
<%@ page import="net.sz600.organize.SzDepartInfo" %>
<%
    //读取全体用户
    //读取数据
    SzDepart szDepart = new SzDepart();
    SzDepartInfo szDepartInfo = null;
    String sCond = "1=1 AND BMGSID=" + szCOMPANY_SESSION;
    Iterator iter = szDepart.getArrayList(sCond).iterator();
%>

<table width="350" align="center">
  <form name="formUpdate" method="post">
  <tr>
    <td colspan="3">请选择系统部门
    </td>
  </tr>
  <tr>
    <td width="150" align="right">
      <select name="DepartSelecting" size="15" style="width:150;" OnDblClick="MoveSelectedOption(formUpdate.DepartSelecting, formUpdate.DepartSelected);">
<%
    while (iter!=null && iter.hasNext()) {
        szDepartInfo = (SzDepartInfo)iter.next();
%>
        <option value="<%=szDepartInfo.getBMID()%>"><%=szDepartInfo.getBMMC()%></option>
<%
    }
%>
      </select>
    </td>
    <td width="50">
      <table>
        <tr><td><input type="button" name="btnToRight" value=">>" OnClick="MoveAllOption(formUpdate.DepartSelecting, formUpdate.DepartSelected);"></td></tr>
        <tr><td><input type="button" name="btnToRight" value=" >"  OnClick="MoveSelectedOption(formUpdate.DepartSelecting, formUpdate.DepartSelected);"></td></tr>
        <tr><td><input type="button" name="btnToLeft"  value=" <"  OnClick="MoveSelectedOption(formUpdate.DepartSelected, formUpdate.DepartSelecting);"></td></tr>
        <tr><td><input type="button" name="btnToLeft"  value="<<" OnClick="MoveAllOption(formUpdate.DepartSelected, formUpdate.DepartSelecting);"></td></tr>
      </table>
    </td>
    <td width="150" align="left">
      <select name="DepartSelected" size="15" style="width:150;" OnDblClick="MoveSelectedOption(formUpdate.DepartSelected, formUpdate.DepartSelecting);">
      </select>
    </td>
  </tr>
  <tr>
    <td colspan="3" align="center">
      <input type="button" name="btnSave" value="保存">
      <input type="button" name="btnClose" value="关闭" OnCLick="javascript:window.close();">
    </td>
  </tr>
  </form>
</table>
<script language="javascript">
  //第一个表示对象，form，第二个表示字符串
  function FormSubmit(oFormName, vUrl) {
    oFormName.action = vUrl;
    oFormName.submit();
  }

  function GoUrl(vUrl) {
    document.location.href = vUrl;
  }

  //javascript参数的调用：
  //checkAll(formList,chkCheckAll,'chkId')
  //第一个表示对象，第二个表示对象，第三个表示字符串
  function CheckAll(oFormList, oChkCheckAll, vChkId) {
    var e;
    for (var i=0; i<oFormList.elements.length; i++) {
      e = oFormList.elements[i];
      if (e.name == vChkId) {
        e.checked = oChkCheckAll.checked;
      }
    }
  }

  //MoveSelectedOption(oFrom, oTo)
  //移动选中的option
  function MoveSelectedOption(oFrom, oTo) {
    var iLen = oFrom.length
    var i = 0;
    //将选中的oFrom的option加到to中
    for (i=0; i<iLen; i++) {
      if (oFrom.options[i].selected) {
        oTo.options[oTo.length] = new Option(oFrom.options[i].text,oFrom.options[i].value);
      }
    }
    //将选中的oFrom的option设置为null
    for (i=iLen-1; i>-1; i--) {
      if (oFrom.options[i].selected) {
        oFrom.options[i]=null;
      }
    }
    //选中一个后将按纽设置为disable
  }

  //MoveAllOption(oFrom, oTo)
  //移动选中的option
  function MoveAllOption(oFrom, oTo) {
    var iLen = oFrom.length
    var i = 0;

    //将oFrom的option加到to中
    for (i=0; i<iLen; i++) {
      oTo.options[oTo.length] = new Option(oFrom.options[i].text,oFrom.options[i].value);
    }
    //将oFrom的option设置为null
    for (i=iLen-1; i>-1; i--) {
      oFrom.options[i]=null;
    }
  }

</script>
