<%@ page contentType="text/html; charset=UTF-8"
	import="java.net.URLEncoder"
    import="java.util.Date"
	import="java.util.List"
    import="java.text.SimpleDateFormat"
	import="javax.jdo.PersistenceManager"
    import="javax.jdo.Transaction"
	import="kr.co.kihyun.beans.entity.*"
	import="kr.co.kihyun.beans.entity.util.*"
	import="kr.co.kihyun.beans.user.HttpSSOLogin"
	import="kr.co.kihyun.lang.Encoder"
    import="kr.co.kihyun.util.MDate"
	import="kr.co.kihyun.lang.MInteger"
    import="kr.co.kihyun.lang.MString"
	import="kr.co.kihyun.moumi.Moumi"
	import="kr.co.kihyun.moumi.report.MReport"
	import="kr.co.kihyun.moumi.doc.MDoc"
	import="kr.co.kihyun.beans.totsys.doc.Doc"
	import="kr.co.kihyun.beans.user.UserView"
	import="kr.co.kihyun.beans.user.DeptView"
    import="kr.co.kihyun.beans.user.DeptAdd"
    import="kr.co.kihyun.lang.MLong"
    import="kr.co.kihyun.moumi.MoumiConfig"
	import="kr.co.kihyun.db.DBUtil"
    import="kr.co.kihyun.beans.user.MultiCheck"
    import="java.net.URLEncoder"
    import="kr.co.kihyun.lang.StringConverter"
    import="kr.co.kihyun.lang.Encoder" %>
<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>
<%
        PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
        Transaction tx = pm.currentTransaction();
        request.setCharacterEncoding("UTF-8");

       	int endPage = 0;
	    int pageSize =0 ;
	    int currentPage = 0;
	    int absolutePage = 0;
	    int currentPageSetUp = 0;
	    int recordSize = 10;      

	    currentPageSetUp = (int)(currentPage/10)*10;
	    if (currentPage%10 == 0){
		  currentPageSetUp-=10;
	    }

        String[] DeptID=null;
        String[] DeptName=null;
        String[] UserId=null;

        String id=request.getParameter("id");
        String password=request.getParameter("password");

        MultiCheck mc = new MultiCheck();
        //mc.IdCheck(id,password);
        mc.IdCheck(id);

        DeptID=mc.getDeptID();
        DeptName=mc.getDeptName();
        UserId = mc.getUserId();
        Integer count = mc.getCount();

        currentPage=1;

        if((count%recordSize) == 0){
            pageSize = (int)(count/recordSize);
        }else{
		    pageSize = (int)(count/recordSize)+1;
	    }
%>
<html>
<head>
<title></title>
<script>
  var state = 0;

    function cancelGO(){
        window.close();
    }

  function loginGO(){
        state=1;
        var checkedval;
        var dummyDeptId;
        var tmpId;

  for(i=0; i<f.deptID.length; i++){
            if(f.deptID[i].checked==true){
                     checkedval = f.deptID[i].value;
                     tmpId = f.userId[i].value;
                   //여기서 muser 테이블을 업데이트 한다. 
               opener.login.href="dept_update_in.jsp?deptId="+checkedval+"&id="+tmpId;
			   document.submit();
               break;
            }
        }
   }

</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
 <tr>
 <td>
 <!--스타일시트-->
 <link rel="stylesheet" href="/totsys/common/css/kecttep.css" type="text/css">
 <!--타이틀-->
<tr>
	<td style=" padding-bottom:10">
		<table width="100%" height="29" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td width="39" background="images/title1.gif">&nbsp;</td>
				<td class="kecttep_title" background="images/titlebg.gif">부서선택</td>
				<td width="13" background="images/title2.gif">&nbsp;</td>
			</tr>
		</table>
	</td>
</tr>
<!--타이틀 끝-->
</td>
</tr>
<!--1픽셀 띄우기-->
<tr>
	<td height="10">
	</td>
<tr>
<tr>
<td>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-left:10">
<form name="f" method="post">
<%
     for(int i = 0; (i < count); i++){
		if(i==0){
			out.print("<input type='radio' name='deptID' value='"+DeptID[i]+"' checked>"+DeptName[i]+"<br>\n");
            out.print("<input type='hidden' name='userId' value='"+UserId[i]+"'>");
		}else{
			out.print("<input type='radio' name='deptID' value='"+DeptID[i]+"'>"+DeptName[i]+"<br>\n");
            out.print("<input type='hidden' name='userId' value='"+UserId[i]+"'>");
		}
    }            
%>
</form>
</td>
</tr>
</table>
<!--1픽셀 띄우기-->
<tr>
	<td height="10">
	</td>
<tr>
<!--1픽셀 띄우기-->
<tr>
	<td height="10">
	</td>
<tr>
<tr>
	<td align="center">
		<a href="#" onclick="loginGO()"><img src="images/bt_enter.gif" border="0"></a>
		<a href="#" onclick="cancelGO()"><img src="images/bt_cancel3.gif" border="0"></a>
	</td>
</tr></td>
</tr>
</table>
</body>
</html>
