<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="com.csc.library.entry.HelpEntry,com.csc.library.system.*,com.csc.library.report.ReportUDF"%>
<jsp:useBean id="AS03HELP_3" class="com.csc.library.system.Task" scope="page" />
<%
	AS03HELP_3.setChannel(request, response);
	HelpEntry screen = (HelpEntry) AS03HELP_3.process("HelpEntry","AS03HELP_3");
	screen.process();
%>
<html>
	<head>
		<title></title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="../CSS/TISCO.css" rel="stylesheet" type="text/css">
		<script  language="JavaScript" src="../JS/SCREEN.js"></script>
		<script  language="JavaScript" src="../JS/APSSCREEN.js"></script>
		<script type='text/javascript' src='../JS/ICONSMENU.js'></script>
		<script language='javascript' src='../JS/HOTKEY.js'></script>
		<script language='javascript'>setLang('<%=screen.getUProfile().get("lang")%>');</script>
		<script src="../JS/jquery-1.11.3.min.js"></script>

		<script language="JavaScript" type="text/JavaScript">
			<!--
			function MM_preloadImages() { //v3.0
				var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
				var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
				if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
			}

					//---------------------------------- Set myArray----------------------
			/*
			function countChecked(){
				var count=0;
				with(document.cscform){
					if((typeof _selectit)!="undefined"){				
						for(i=0;i<_selectit.length;i++){
							if(_selectit[i].checked){
								count++;
							}
						}
					}else{
						count=1;
					}
				}
				return count;
			}
			*/			
			/*
			function addlist(){
				var cCount=countChecked();
				var j=0;
				with(document.cscform){
					newDatalist  = new Array(cCount);

					if((typeof _selectit)!="undefined"){
						for(i=0;i<_selectit.length;i++){
							if(_selectit[i].checked){
								newDatalist[ j++ ] = new Option(""+__mykey[i].value+""+__myvalue[i].value, _selectit[i].value);
							}
						}
					}else{
						if((typeof __mykey)!="undefined"){
							newDatalist[ j++ ] = new Option(""+__mykey.value+""+__myvalue.value, _selectit.value);
						}
					}		
				}
				//	alert(newDatalist);
				return newDatalist;			
			}
			*/
			function countChecked(){  // new Function By Nutfreedom 8/8/2559
				return ($("input[name='_selectit'][type='checkbox']:checked").length);
			}
			function addlist(){    // new Function By Nutfreedom 8/8/2559
				var cCount=countChecked();
				var j=0;
				with(document.cscform){
				newDatalist  = new Array(cCount);
					$("table#tb tr").not(':eq(0)').each(function() {
						if ($(this).find(':checkbox').is(':checked')) {
							var mykey = $(this).find("input[type='hidden'][name='__mykey']").val();
							var myvalue = $(this).find("input[type='hidden'][name='__myvalue']").val();
							newDatalist[ j++ ] = new Option(""+mykey+""+myvalue, $(this).find(':checkbox').val() );
						}
					});
				}
				console.log(newDatalist);
				return newDatalist;			
			}

			function addParen(){
				if(window.opener.findKey(addlist(),window.opener.getMyChildoption())){
					window.focus();
				}else{
					window.opener.addOption(addlist());
					window.close();
				}
			}

			//-----------------------------------------------------------------


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

			function setSelectAll(){
				setkSelectAll(document.forms[0]._selectit,"_selectit");
			}

			function setDeselectAll(){
				setkDisselectAll(document.forms[0]._selectit,"_selectit");
			}

			//-->
		</script>

	</head>
	<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
		<form name="cscform" method="post" action="#">
			<!----------BEGIN CSC INITIAL ZONE ------------------------>
			<%=screen.InitialVariable()%>
			<!----------END CSC INITIAL ZONE -------------------------->

			<input type="hidden" name="__cmd" value="">
			<input type="hidden" name="__help" value="">
			<input type="hidden" name="__asgid" value="<%=request.getParameter("__asgid")%>">
			<input type="hidden" name="__pageCall" value="<%=request.getParameter("__screen")%>">
			<input type="hidden" name="__language" value ="<%=screen.getUProfile().get("lang")%>"> 
			<input type="hidden" name="__goPage" value="">  
			<br>
			<div align="center">
				<table  cellpadding="0"  cellspacing="0">
					<tr > 
						<td  class="header">AS03HELP_3,
							<script language="javascript">swapLang('Assess Group Table Detail');</script>&nbsp;
						</td>
					</tr>
					<tr> 
						<td  colspan="2"> 
							<div align="center"> 
								<table  cellpadding="0" cellspacing="0" >
									<tr> 
										<td width="570"  class="blankspace"></td>
									</tr>
									<tr> 
										<td>
											<div align="right"><strong><%=screen.getPageTag()%>&nbsp;</strong></div>
										</td>
									</tr>
									<tr > 
										<td bgcolor="#FFFFFF">
											<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#666666" class="inframe" id="tb">
												<tr> 
													<td class="title1"width="84">
														<div align="center">
															<script language="javascript">swapLang('Select');</script>
														</div>
													</td>
													<td class="title1"width="84">
														<div align="center">
															<script language="javascript">swapLang('Code');</script>
														</div>
													</td>
													<td class="title1"width="485">
														<div align="center">
															<script language="javascript">swapLang('Description');</script>
														</div>
													</td>
												</tr>
												<%
													while(screen.nextRec()){
													if(screen.checkLinePage()){
												%>
												<tr> 
													<td> 
														<div align="center"> 
															<input name="_selectit" type="checkbox" value="<%=request.getParameter("__asgid")%>#<%=screen.getString("asid")%>,"  >
															<input type="hidden" name="__myvalue" value="<%=screen.getString("tdesc")%>">
															<input type="hidden" name="__mykey" value="<%=screen.getString("asid")%>">
														</div>
													</td>
													<td>
														<div align="center"><%=screen.getString("asid")%></div>
													</td>
													<td>
														<%=screen.getString("tdesc")%>
													</td>
												</tr>
												<%
															if(screen.outLinePage()){ break; }
														}
													}			
												%>
											</table>
										</td>
									</tr>
									<tr > 
										<td class="blankspace">&nbsp;</td>
									</tr>
									<tr >
										<td class="blankspace"><div align="center"><a href="javascript:setSelectAll();"><img SRC="../IMAGES/BUTTON/SELECTALL.gif" border="0" ></a> 
										&nbsp;<a href="javascript:setDeselectAll();"><img SRC="../IMAGES/BUTTON/DESELECTALL.gif" border="0" ></a> 
										&nbsp; <a href="javascript:addParen();"><img SRC="../IMAGES/BUTTON/ADD.gif"  border="0"></a> 
										&nbsp; <a href="javascript:setClose();"><img SRC="../IMAGES/BUTTON/CANCEL.gif" border="0"></a></div></td>
									</tr>
									<tr > 
										<td class="blankspace"><div align="right"></div></td>
									</tr>
								</table>
							</div>
						</td>
					</tr>
					<tr bordercolor="0069B3"> 
						<td  class="bottom"></td>
					</tr>
				</table>
			</div>
		</form>
	</body>
</html>
