<?php
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
include("phpmnu_fun.php");
//if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
//
$HW=V($_SESSION['SYS_HW']);
$IdUsu=vbval(V($_SESSION['SYS_USER_ID']));
$StrGT="";
$SYS_MSG="";
$SYS_FOC="";
//
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
$LStrPag=V($_POST['TxtPag']);
//
include("banners_fun.php");
//
$VP_RegXPag=5;
$LStrTR=gn("count(*)","vis_web_contenidos","ID>0");
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Productos</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/banners.js"></script>
<!--FIN_SCRIPT------------------------------------->
<link rel="stylesheet" type="text/css" href="css/estiloss.css"  />
<link rel="stylesheet" type="text/css" href="css/basic.css"  />
<link rel="stylesheet" type="text/css" href="css/mnu.css"  />

<style type="text/css">
.cF {height:600px;width:1250px;position:relative;top:0px}
.mM {height:34px;width:1250px;position:relative;top:0px;background-color:#09C; z-index:500;}

</style>
<script>
$(document).ready(function(){  
   Inicializar();
   //
   SYS_LOAD();
});
</script>
</head>

<body  <?php echo $LStrMsg;?>>
<div align="center">

<div class="mM" align="left" style="font-size:12px">
<?php
echo GEN_MENU($IdUsu);
?>
</div>

<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;">
<form id="Frm" name="Frm" method="post" autocomplete="off"
action="banners.php" enctype="multipart/form-data" 
style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" >
<img src="img/categorias.png" width="128" height="128" class="iT" />
<div class="tT">BANNERS</div>
</div>
<!--FIN_TITULO--------------------------------->

<div class="s1" style="left:35px; top: 115px; width: 222px;">TIPO DE BANNER</div>
<select name="Tip" id="Tip" 
class="lt" style="left: 35px; top: 135px; width: 234px"
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO("ban_nom","web_banners","id_ban>0",$Tip,"","S");?>
</select>

<div class="s1" style="left: 281px; top: 115px; width: 189px;">
TITULO / DESCRIPCION </div>
<input name="Des"  type="text" id="Des"
class="lt" style="left: 280px; top: 135px; width: 373px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Des;?>"/>

<?php if(strlen($Hab)==0)$Hab="SI";?>
<div class="s1" style="left: 661px; top: 115px; width: 102px;">
HABILITADO </div>
<select name="Hab" id="Hab" 
class="lt" style="left: 661px; top: 135px; width: 77px;"
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO("aux_nom","web_auxiliar","aux_des='SN'",$Hab,"","S")?> 
</select>

<!--INI_BOTONES-------------------------------->
<div id="DivBtn" align="left" style="position:absolute; left: 33px; top: 71px; width:1000px; height: 26px;">
<input name="CmdB" type="button" id="CmdG" class="btm" 
<?php GOM($StrId);?>
onclick="fGuardar();"  
tabindex="<?php echo ++$TI;?>"/>

<input name="CmdB" type="button" id="CmdC"  class="btm" 
value="Nuevo" onClick="fCancelar();"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdE" class="btm" 
value="Eliminar" onClick="fEliminar();"
<?php DIS($StrId);?>
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdB" class="btm"
value="Buscar" onClick="fBuscar('productos_buscar.php?CmdB=CallBack');"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdB"  class="btm"
value="Stock" onClick="fBuscar('rep_stock.php');"
tabindex="<?php echo ++$TI;?>" />
</div>
<!--FIN_BOTONES-------------------------------->


<div class="datagrid" style="position: absolute; left:35px; top: 224px; ; width: 703px; height: 349px; overflow:auto">
<table width="100%">
<thead>
<tr>
<td colspan="10" height="18" align="center">
<?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
</td>
</tr>
<tr>
<th width="26%">TIPO</th>
<th width="43%">TITULO</th>
<th width="22%">IMAGEN</th>
<th width="5%">HAB</th>
<th width="4%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php	
$s="SELECT * FROM vis_web_contenidos WHERE ID>0 ORDER BY ID DESC ";	
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
$rs=grs($s);
while($r=$rs->fetch_assoc()){
	if(strlen(trim($r['ARC']))==0){
		$r['ARC']="NO ASIGNADA";
	}else{
		$FX="banners/".$r['ARC'];
		if(!file_exists($FX)){
			$r['ARC']="NO DISPONIBLE";
		}
	}
?>
<tr onDblClick="fActivar(<?php echo $r['ID'];?>);">
<!----------------------------------------------->
<td><?php echo $r['TIP_NOM'];?></td>
<td><?php echo $r['TIT'];?></td>
<td><?php echo $r['ARC'];?></td>
<td><?php echo $r['HAB'];?></td>
<!----------------------------------------------->
<td align="center">
<a href="javascript:void(0)" onClick="fActivar(<?php echo $r['ID'];?>);">
<img src="img/b_edit.png"  border="0"/></a></td>
</tr>
<?php
}
?>		  

</tbody>
</table>
</div>

<!--INI_OCULTOS-------------------------------->
<?php include("ocultos.php");?>

<div class="s1" style="left: 35px; top: 168px; width: 433px;">
SELECCIONE UNA IMAGEN ( Las imagenes deben del formato <b>jpg</b>)
</div>
<div  align="left" style="position:absolute; left:35px; top: 187px; width: 702px; height: 24px">
<input name="Foto" type="file" id="Foto" tabindex="<?php echo ++$TI;?>"/>
</div>

<?php
	$IOK=1;
	$IMG="banners/vacio.png";
	if(vbval($StrId)>0){
		$IOK=0;
		$FN=gs("con_archivo","web_contenidos","id_con=$StrId");
		if(strlen($FN)>0){
			$FX="banners/".$FN;
			if(file_exists($FX)){
				$IMG=$FX;
				$IOK=1;
			}
		}
	}
?>

<?php if($IOK>0){?>
<div id="FA" class="s1" style="left: 748px; top: 133px; width: 456px; height: 436px; overflow:auto">
    <img src="<?php echo $IMG; ?>" >    
    <div class="s1" style="left: 460px; top: 1px; width: 15px; height: 15px; color: #00F; cursor: pointer;" 
    onClick="fEfoto()"><img src="img/el1.png" width="15" height="15">
    </div>
</div>
<?php }?>

<input name="SYS_MSG" type="hidden" id="SYS_MSG" value="<?php echo $SYS_MSG;?>" />
<input name="SYS_FOC" type="hidden" id="SYS_FOC" value="<?php echo $SYS_FOC;?>" />
</form>
</div>
</div>
</body>
</html>
