<?php
	session_start();
	include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
	
	//-------------------------	
	$StrGT="";
	$VP_RegXPag=10;
	$LStrMsg="";
	$LStrFoc="";
	$LStrMM="";
	$LStrPag=V($_POST['TxtPag']);
	$LStrTR=gn("count(*)","menus","");
	include("sys_menus_fun.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sub menus del sistema</title>
<script type="text/javascript" src="funciones.js"></script>
<script type="text/javascript" src="sys_menus.js"></script>
<style type="text/css">
<!--
body {
	background-color: #CCC;
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}
.centrarFrm{
     width:700px;
     height:600px;
     position:absolute;
     left:50%;
     top:50%;
	 background-color:#006699;
	 margin:-300px 0 0 -350px;

}
#Layer2 {
	position:absolute;
	left:409px;
	top:205px;
	width:82px;
	height:24px;
	z-index:1;
}
.Estilo1 {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	color: #FFFFFF;
}
.Estilo2 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FFFFFF; font-size: 12px; }
.Estilo3 {color: #FFFFFF; font-size: 12px; font-family: Arial, Helvetica, sans-serif;}
.Estilo4 {
	color: #000099;
	font-weight: normal;
	text-align: left;
}
.Estilo5 {color: #000000}
#Frm center #DivFRM #layer .Estilo1 strong {
	color: #900;
}
.AB {	position:absolute;
	z-index: 2;
	text-align: left;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	height: 18px;
	color:#CCC
}

-->
</style>

</head>
<body  <?php echo $LStrMsg;?>>
<form id="Frm" name="Frm" method="post" action="sys_menus.php">
<center> 
  <div Id="DivFRM"  class="centrarFrm" >
    <div id="layer5" style="position:absolute; left: 50px; top: 189px; width: 107px;">
      <div align="left" class="Estilo2">MENUS</div>
    </div>
    <div id="layer4" style="position:absolute; left: 60px; top: 85px; width: 442px; height: 26px;">
      <div align="left" class="Estilo2">
        <input name="CmdB" type="button" id="CmdG"
		<?php
		if(strlen($StrId)==0){
			echo "value=\"Guardar\"";
		}else{
			echo "value=\"Modificar\"";
		}
		?>
		onclick="fGuardar();" style="width:80px" tabindex="2"/>
		<input name="CmdB" type="button" id="CmdC" value="Cancelar" 
        onclick="fCancelar();"  tabindex="3"/>
		<input name="CmdB" type="button" id="CmdE" value="Eliminar" onclick="fEliminar();"
		<?php
		if(strlen($StrId)==0){
			echo "disabled=\"disabled\"";
		}
		?>
		 tabindex="4"/>
		<input name="CmdB" type="button" id="CmdZ" 
         value="Menu" onclick="fBuscar('menu.php');"  tabindex="3"/>
      </div>
    </div>
    <div id="layer3" style="position:absolute; left: 28px; top: 246px; width: 657px; height: 200px;">
      <div align="left" class="Estilo2">
        <table width="659" height="19" border="1" cellpadding="0" cellspacing="0">
          <tr>
<td width="208" bgcolor="#999999"><span class="Estilo4">MENU</span></td>
<td width="165" bgcolor="#999999"><span class="Estilo4">SUB MENU</span></td>
<td width="153" bgcolor="#999999"><span class="Estilo4">URL</span></td>
<td width="54" bgcolor="#999999" ><span class="Estilo4">SM ORD</span></td>
            <td width="12" bgcolor="#999999">&nbsp;</td>
          </tr>
		  <?php
		  		$StrTemp=$LStrPag * $VP_RegXPag;
				$s="SELECT ID,MN,SN,SU,SO
					FROM vmenus WHERE ID>0 ORDER BY MC,MO,MN,SO,SN";
		  		if($LStrTR<=$VP_RegXPag){
				}else{
					$s=$s." LIMIT $StrTemp,$VP_RegXPag";
				}		  				
				$result = grs($s);
				while ($row = $result->fetch_row()){
					echo "<tr ondblclick=\"fActivar($row[0]);\">";
					echo "<td bgcolor=\"#FFFFFF\"> <span class=\"Estilo4\">$row[1]</span></td>";
					echo "<td bgcolor=\"#FFFFFF\"> <span class=\"Estilo4\">$row[2]</span></td>";
					echo "<td bgcolor=\"#FFFFFF\"> <span class=\"Estilo4\"><a target=\"_blank\" href=\"$row[3]\">$row[3]</a></span></td>";
					echo "<td bgcolor=\"#FFFFFF\" ><span class=\"Estilo4\">$row[4]</span></td>";
					echo "<td bgcolor=\"#FFFFFF\" align=\"center\">
						 <a href=\"javascript:void(0)\" onclick=\"fActivar($row[0]);\">
						 <img src=\"img/b_edit.png\"  border=\"0\"/>
						 </a>
						 </td>";
					echo "</tr>";
				}

		  ?>		  
          <tr  >
            <td bgcolor="#FFFFFF">
			<?php
				if($LStrTR>$VP_RegXPag){
					if($LStrPag==0){
						echo "<input style=\"width:40px\" name=\"CmdNP\" type=\"button\" id=\"CmdNP\" value=\"|&lt;\" tabindex=\"5\" onclick=\"fPrimero();\" disabled=\"disabled\"/>";
						echo "<input style=\"width:40px\" name=\"CmdNA\" type=\"button\" id=\"CmdNA\" value=\"<\" tabindex=\"6\" onclick=\"fAnterior();\" disabled=\"disabled\" />";
					}else{
						echo "<input style=\"width:40px\" name=\"CmdNP\" type=\"button\" id=\"CmdNP\" value=\"|&lt;\" tabindex=\"5\" onclick=\"fPrimero();\"/>";
						echo "<input style=\"width:40px\" name=\"CmdNA\" type=\"button\" id=\"CmdNA\" value=\"<\" tabindex=\"6\" onclick=\"fAnterior();\"/>";
					}
					if($LStrPag==(floor($LStrTR / $VP_RegXPag)) ){
						echo "<input style=\"width:40px\" name=\"CmdNS\" type=\"button\" id=\"CmdNS\" value=\">\" tabindex=\"7\" onclick=\"fSiguiente();\"  disabled=\"disabled\" />";
						echo "<input style=\"width:40px\" name=\"CmdNU\" type=\"button\" id=\"CmdNU\" value=\"&gt;|\" tabindex=\"8\" onclick=\"fUltimo();\"  disabled=\"disabled\"/>";				
					}else{
						echo "<input style=\"width:40px\" name=\"CmdNS\" type=\"button\" id=\"CmdNS\" value=\">\" tabindex=\"7\" onclick=\"fSiguiente();\" />";
						echo "<input style=\"width:40px\" name=\"CmdNU\" type=\"button\" id=\"CmdNU\" value=\"&gt;|\" tabindex=\"8\" onclick=\"fUltimo();\"/>";				
					}
				}
			?>
			</td>
            <td bgcolor="#FFFFFF" ></td>
            <td bgcolor="#FFFFFF" ></td>
            <td bgcolor="#FFFFFF" ></td>
            <td bgcolor="#FFFFFF" ></td>
           
          </tr>
        </table>
      </div>
    </div>
    <div id="layer" style="position:absolute; left: 116px; top: 21px; width: 412px; height: 45px; z-index: 100;">
      <div align="left" class="Estilo1">
        <input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
		<input name="TxtAc" type="hidden" id="TxtAc" value="" />
		<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
      <strong>SUB MENUS DEL SISTEMA</strong></div>
    </div>
    <div id="layer2" style="position:absolute; left: 237px; top: 208px; width: 152px; height: 25px;">
      <div align="left" class="Estilo2">        
          <input name="TxtNom" type="text" id="TxtNom" style="width:150px" 
          value="<?php echo $StrNom;?>"  
          onKeyDown="return SoloTextoEx(event,'TxtUrl');"  onkeyup="fVistaPrevia();"
          tabindex="1" />
      </div>
    </div>
    <div id="LblTit" style="position:absolute; left: 52px; top: 15px; width: 64px; z-index: 100;">
    <div align="left" class="Estilo1"><img src="img/marcas.gif" width="48" height="48" /></div>
  </div>
    <div id="layer8" style="position:absolute; left: 0px; top: 0px; width: 700px; height: 79px; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; z-index: 0;">
      <div align="left" class="Estilo1">        
      </div>
</div>
    <div id="layer26" style="position:absolute; left: 48px; top: 208px; width: 130px; height: 25px;">
      <div align="left" class="Estilo2">
        <select name="CboMen" id="CboMen" style="width:170px" 
onkeydown="return SoloTextoEx(event,'TxtNom');" tabindex="0">
<?php
$s="SELECT nombre FROM menu ORDER BY col,ord,nombre";
$result = grs($s);
while ($row = $result->fetch_row()){
if($StrMen==$row[0]){
echo "<option value=\"$row[0]\" selected=\"selected\">$row[0]</option>";
}else{
echo "<option value=\"$row[0]\" >$row[0]</option>";
}
}
?>
        </select>
      </div>
</div>
    <div id="layer19" style="position:absolute; left: 533px; top: 208px; width: 53px; height: 25px;">
      <div align="left" class="Estilo2">
        <input name="TxtOrd" type="text" id="TxtOrd" style="width:50px" 
          value="<?php echo $StrOrd;?>"  
          onkeydown="return SoloNum(this,event,'TxtNl');" 
          tabindex="13" 
          onfocus="selecciona_value(this);"
          />
      </div>
  </div>
    <div id="layer12" style="position:absolute; left: 600px; top: 188px; width: 62px;">
      <div align="left" class="Estilo2">N&ordm; lineas</div>
    </div>
    <div id="layer13" style="position:absolute; left: 397px; top: 189px; width: 71px;">
      <div align="left" class="Estilo2">URL </div>
    </div>
    <div id="layer6" style="position:absolute; left: 399px; top: 208px; width: 121px; height: 25px;">
      <div align="left" class="Estilo2">
        <input name="TxtUrl" type="text" id="TxtUrl" style="width:120px" 
          value="<?php echo $StrUrl;?>"  
          onkeydown="return SoloTextoEx(event,'TxtOrd');" 
          tabindex="1" />
      </div>
    </div>
    <div id="layer7" style="position:absolute; left: 239px; top: 189px; width: 147px;">
      <div align="left" class="Estilo2">NOMBRE DE SUB MENU</div>
    </div>
    <div id="layer9" style="position:absolute; left: 598px; top: 208px; width: 53px; height: 25px;">
      <div align="left" class="Estilo2">
        <input name="TxtNl" type="text" id="TxtNl" style="width:50px" 
          value="<?php echo $StrNl;?>"  
          onkeydown="return SoloNum(this,event,'CmdB');" 
          tabindex="13" 
          onfocus="selecciona_value(this);"
          />
      </div>
    </div>
    <div id="layer10" style="position:absolute; left: 532px; top: 188px; width: 62px;">
      <div align="left" class="Estilo2">N&ordm; Orden</div>
    </div>
    <div  
id="DivDEMO" style="left: 489px; top: 108px; width: 154px; display:block; text-align:justify" class="AB"></div>
    <div style="left: 489px; top: 92px; width: 154px" class="AB">Vista previa :</div>
  </div>
</center>	
        </form>
</body>
</html>
