<%@page import="java.util.*,javax.sql.*,java.sql.*,javax.naming.*,m05bClasses.*" %>
<%@include file="/mantenimientosJSP/includes/m05b.inc"%>

<%
	// _______________________________XLNETs______________________________________
	// Evaluar variable de session que indica si esta conectado a XLNets
	if (session.getAttribute("objetoSeguridad") == null) {
		// Verificar que no ha transcurrido el tiempo de sesion (web.xml) %>
			<%@ include file="/m05bControlAcceso.inc"%>
<%
	}
	String persona = (String)session.getAttribute("persona");
	String origen = "opener.document." + request.getParameter("Origen");
%>
	<%@ include file="/m05bIdioma.inc"%>

<HTML>
	<head>
		<title><%= resTit.getString("titBusquedaDepartamentos")%></title>
		<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
		<link rel="stylesheet" href="<%=m05bConstantesPaginas.PATH_ESTILOS%>/m05bestilos.css" type="text/css">
	</head>

	<SCRIPT language=JavaScript>
		function fncSeleccionar (origen, codDepto, descDeptoC, descDeptoE) {

			origen.CodDepto.value 	= codDepto;
			origen.DescDeptoC.value = descDeptoC;
			origen.DescDeptoE.value = descDeptoE;

			window.close();
		}
	</SCRIPT>
	
	<BODY style="cursor: wait" onkeydown="cancelaEnter();" onload="document.body.style.cursor='default';" onunload="document.body.style.cursor='wait';">
		<%//@include file="/mantenimientosJSP/includes/m05Cabecera_c.jsp"%>
		<FORM NAME="FormRelDepartamentosXLNETs" METHOD="POST">
			<TABLE class="general">
				<tr align="right">
					<td colspan="5">
						<input type="button" class="boton" name="<%= res.getString("etBOT_RETORNAR")%>" value="<%= res.getString("etBOT_RETORNAR")%>" ONCLICK="JavaScript:window.close();return false;" onMouseOver="top.status='<%= res.getString("etBOT_STATUSRETORNAR")%>'; return false" onMouseOut="top.status=''; return false" />
					</td>
				</tr>
				<tr>
				</tr>
			</TABLE>

			<TABLE class="general">
				<tr>
					<td class="searchTitle" width="9%"><%= res.getString("etCodigo")%></td>
					<td class="searchTitle" width="46%"><%= res.getString("etDescripcion")%></td>
					<td class="searchTitle" width="45%"><%= res.getString("etEDescripcion")%></td>
				</tr>
			<%

			SecurityHelpperXLNets sh = new SecurityHelpperXLNets();
			sh.setHttpRequest(request);
			ArrayList listaD = sh.getDepartamentosYOrganismosXLNETs();
			int i=0;
			if (listaD != null) {
				String codigo = "";
				String descC = "";
				String descE = "";
				for (i=0; i < listaD.size(); i++) {
					codigo	= ((m05bDepartamentoXLNET)listaD.get(i)).getCodigo();
					descC 	= ((m05bDepartamentoXLNET)listaD.get(i)).getDescC();
					descE 	= ((m05bDepartamentoXLNET)listaD.get(i)).getDescE();
					%>
					<tr>
					   <td class="inputFieldTitle"><FONT size="2"><A href="#" onclick="javascript:fncSeleccionar(<%=origen%>,'<%=codigo%>','<%=descC%>','<%=descE%>');return false;"><%=codigo%></A></FONT></td>
		   			   <td class="inputFieldTitle"><FONT size="2"><%=descC%></FONT></td>
		   			   <td class="inputFieldTitle"><FONT size="2"><%=descE%></FONT></td>
					</tr>
			<%
				}
			}
			%>
			    <tr align="center">
					<td class="inputField" colspan="5"><%= res.getString("etTotal")%><%=i%></td>
			    </tr>

			</TABLE>
		</FORM>

	</BODY>
</HTML>