<?php
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
//if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
//
$HW=V($_SESSION['SYS_HW']);
$PRO_KOD=vbval(V($_GET['ID']));
if($PRO_KOD==0){
	$PRO_KOD=vbval(V($_POST['TXT_PRO_KOD']));
}
//
$LIMPIAR=0;
$DET_ID=vbval(V($_POST['DET_ID']));
//
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
$SYS_MSG="";
$SYS_FOC="Des";
//
include("productos_img_fun.php");
//
$TI=0;
?>

<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Productos - Imagenes</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/productos_img.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:550px;width:825px;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 Id="DivFRM"  class="cF" style="background-color:#FDE1A8">
<form id="Frm" name="Frm" method="post" autocomplete="off" enctype="multipart/form-data"
action="productos_img.php"  onSubmit="return false;">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" style="width:825px" >
<img src="png/ndd_mot.png" class="iTb"  />
<div class="tT">PRODUCTOS - IMAGENES</div>
</div>
<!--FIN_TITULO--------------------------------->


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

<div class="s1" style="left:35px; top:112px; width: 198px;">
DESCRIPCION</div>
<input name="Des"  type="text" id="Des"
class="lt" style="left:35px; top: 130px; width: 224px"
tabindex="<?php echo ++$TI;?>" maxlength="30"
value="<?php echo $Des;?>"/>

<input name="CmdAdd" type="button" id="CmdAdd"  
value="Guardar" onClick="fAdd()" tabindex="<?php echo ++$TI;?>"
style="left: 35px; top: 160px; width: 147px; position:absolute">

<div class="datagrid" style="position: absolute; left: 35px; top: 189px; width: 454px; height: 330px;">
<table width="100%">
<thead>
<tr>
<th width="25%">IMAGEN</th>
<th width="63%">DESCRIPCION</th>
<th width="6%">&nbsp;</th>
<th width="6%">&nbsp;</th>
</tr>
</thead>
<tbody>          
<?php
$BX=0;
$s="SELECT * FROM web_productos_img 
	WHERE id_pi>0 AND pi_id_pro=$PRO_KOD ORDER BY id_pi DESC ";
$rs=grs($s);
while($r=$rs->fetch_assoc()){
	$BX++;
	$CSS="";
	if($BX%2==0)$CSS='style="background-color:#E2E2E2"';
?>
    <tr <?php echo $CSS;?> >
    <!----------------------------------------------->
    <td ><?php echo $r['pi_archivo'];?></td>
    <td ><?php echo $r['pi_des'];?></td>
    <!----------------------------------------------->
    <td align="center">
    <a href="javascript:void(0)" onClick="fVer(<?php echo $r['id_pi'];?>);">
    <img src="img/icono.png"  border="0"/></a></td>
    <td align="center">
    <a href="javascript:void(0)" onClick="fEli(<?php echo $r['id_pi'];?>);">
    <img src="img/eliminar.png"  border="0"/></a></td>
    </tr>
<?php
}    
?>	  
</tbody>
</table>
</div>

<?php
$IMG="banners/vacio.png";
if($DET_ID>0){
	$FN=gs("pi_archivo","web_productos_img","id_pi=$DET_ID");
	if(strlen($FN)>0){
		$FN="banners/".$FN;
		if(file_exists($FN)){
			$IMG=$FN;
		}
	}
}
?>

<div id="FA" class="s1" style="left: 510px; top: 83px; width: 279px; height: 438px; overflow:auto">
<img src="<?php echo $IMG; ?>" ></div>

<!--INI_OCULTOS-------------------------------->
<?php include("ocultos.php");?>
<input name="TXT_PRO_KOD" type="hidden" id="TXT_PRO_KOD" value="<?php echo $PRO_KOD;?>" />
<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;?>" />
<input name="DET_ID" type="hidden" id="DET_ID" value="<?php echo $DET_ID;?>" />
<!--FIN_OCULTOS-------------------------------->

</form>
</div>
</div>
</body>
</html>
