<?php
ini_set("session.cookie_lifetime",60*60*10);
ini_set("session.gc_maxlifetime", 60*60*10);
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
//
if(vbval($_SESSION['SYS_USER_GI'])!=USU_GET_GI($_SESSION['SYS_USER_ID'])){
	JsDir("cerrar.php");	
	return;
}
//
//-------------------------	
$StrGT="";
$VP_RegXPag=100;
$LStrMsg="";
$LStrFoc="";
$LStrMM="";
$LStrPag=V($_POST['TxtPag']);
$LStrTR=gn("count(*)","menu","");
include("set_menu_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=utf-8" />
<title>Asignar imagenes a menus</title>
<script type="text/javascript" src="fe/funciones.js"></script>
<script type="text/javascript" src="fe/set_menu.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:<?php echo "50%";?>;
top:<?php echo "50%";?>;
background-color:#006699;
margin:<?php echo "-300px";?> 0 0 <?php echo "-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;
}
.f2 {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}
.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: 31px;
	color:#FF0
}

-->
</style>

</head>
<body  <?php echo $LStrMsg;?>>
<form id="Frm" name="Frm" method="post" 
action="set_menu.php" enctype="multipart/form-data">
<center> 
<div Id="DivFRM"  class="centrarFrm" >
<div id="layer5" style="position:absolute; left: 23px; top: 135px; width: 127px;">
<div align="left" class="f2">NOMBRE</div>
</div>
<div id="layer5" style="position:absolute; left: 207px; top: 135px; width: 221px;">
<div align="left" class="f2">SELECCIONAR ARCHIVO</div>
</div>

<div id="layer27" 
style="position:absolute; left: 207px; top:155px; width: 518px; height: 27px;">
<div align="left" class="f2">
<input name="CmdB" type="button" 
id="CmdImportar" value="Importar" onclick="fImportar();"
tabindex="4"/>
<input type="hidden" name="MAX_FILE_SIZE" value="1048576" />
<input name="userfile" type="file" id="userfile" 
tabindex="9"/>
</div>
</div>



<div id="layer4" style="position:absolute; left: 23px; top: 85px; width: 199px; height: 26px;">
<div align="left" class="f2">
<input name="CmdB" type="button" id="CmdC" value="Nuevo" onclick="fCancelar();"  tabindex="3"/>
<input name="CmdB" type="button" id="CmdZ" 
value="Menu" onclick="fBuscar('menu.php');"  tabindex="3"/>
</div>
</div>
<div id="layer3" style="position:absolute; left: 23px; top: 189px; width: 645px; height: 374px;">
<div align="left" class="f2">
<table width="643" height="19" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="365" bgcolor="#999999"><span class="Estilo4">MENU</span></td>
<td width="251" bgcolor="#999999"><span class="Estilo4">IMAGEN</span></td>
<td width="19" bgcolor="#999999">&nbsp;</td>
</tr>
<?php
$StrTemp=$LStrPag * $VP_RegXPag;
$s="SELECT id_menu,nombre,ni FROM menu ORDER BY col,ord,nombre";		  				
$result = grs($s);
while ($row = $result->fetch_row()){
//
$StrJPG=$row[2];
if($StrJPG>0){
	$StrJPG=$StrJPG.".jpg";
}else{
	$StrJPG="gdemo.png";
}
//
echo "<tr ondblclick=\"fActivar($row[0]);\">";
echo "<td bgcolor=\"#FFFFFF\"><span class=\"Estilo5\">$row[1]</span></td>";
echo "<td bgcolor=\"#FFFFFF\"><span class=\"Estilo5\"><img src=\"$StrJPG\" width=\"198\" height=\"27\" /></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>
</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>ASIGNAR IMAGENES A MENUS</strong></div>
</div>
<input name="TxtNom" type="text" id="TxtNom" 
style="position:absolute; left: 23px; top: 155px; width: 173px; background-color:#CCCCCC" 
readonly="readonly"
value="<?php echo $StrNom;?>"  
onKeyDown="return SoloTextoEx(event,'TxtCol');" 
tabindex="1"   onkeyup="fVistaPrevia()"/>

<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="DivDEMO" style="left: 316px; top: 92px; width: 205px; display:block; text-align:justify" class="AB">
<?php
if(strlen($StrId)>0){
	$StrJPG=gn("ni","menu","id_menu=$StrId");
	if($StrJPG>0){
		$StrJPG=$StrJPG.".jpg";
	}else{
		$StrJPG="gdemo.png";
	}
}else{
	$StrJPG="gdemo.png";
}

?>
<img id="Foto" src="<?php echo $StrJPG;?>" width="198" height="27" />
</div>
<div style="left: 207px; top: 92px; width: 109px" class="AB">Vista previa :</div>
</div>
</center>	
</form>
</body>
</html>
