<%@ page contentType="text/html;charset=gbk" %>
<%@ 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.SzPost" %>
<%@ page import="net.sz600.organize.SzPostInfo" %>
<%
    //读取全体用户
    //读取数据
    SzPost szPost = new SzPost();
    SzPostInfo szPostInfo = null;
    String sCond = "1=1";
    Iterator iter = szPost.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="PostSelecting" size="15" style="width:150;" OnDblClick="MoveSelectedOption(formUpdate.PostSelecting, formUpdate.PostSelected);">
<%
    while (iter!=null && iter.hasNext()) {
        szPostInfo = (SzPostInfo)iter.next();
%>
        <option value="<%=szPostInfo.getZWID()%>"><%=szPostInfo.getZWMC()%></option>
<%
    }
%>
      </select>
    </td>
    <td width="50">
      <table>
        <tr><td><input type="button" name="btnToRight" value=">>" OnClick="MoveAllOption(formUpdate.PostSelecting, formUpdate.PostSelected);"></td></tr>
        <tr><td><input type="button" name="btnToRight" value=" >"  OnClick="MoveSelectedOption(formUpdate.PostSelecting, formUpdate.PostSelected);"></td></tr>
        <tr><td><input type="button" name="btnToLeft"  value=" <"  OnClick="MoveSelectedOption(formUpdate.PostSelected, formUpdate.PostSelecting);"></td></tr>
        <tr><td><input type="button" name="btnToLeft"  value="<<" OnClick="MoveAllOption(formUpdate.PostSelected, formUpdate.PostSelecting);"></td></tr>
      </table>
    </td>
    <td width="150" align="left">
      <select name="PostSelected" size="15" style="width:150;" OnDblClick="MoveSelectedOption(formUpdate.PostSelected, formUpdate.PostSelecting);">
      </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>