<?php include "php/cabecera.inc";
	echo "<div><BR>";
	echo "<style>@media screen and (min-device-width:769px) {.product .desc p{font-size:20px;}}</style>";
	$consulta= "SELECT DISTINCT(DEPTO) FROM PRODUCTOS WHERE PRECIO>0 ORDER BY DEPTO";
	echo "<center><h1>".$_POST['CAT']."</h1></center>";
	$_SESSION['C']=$_POST['CAT'];
	$conexion = mysqli_connect($serv,$dbu,$dbp,$db);
	mysqli_set_charset($conexion, "utf8");
	$resultado = mysqli_query($conexion, $consulta);

	if (-1*(!empty($resultado))){
		while($fila = mysqli_fetch_array($resultado)) {
		$res2 = mysqli_query($conexion,"SELECT * FROM PRODUCTOS WHERE DEPTO ='".$fila['DEPTO']."' ORDER BY RAND() LIMIT 0,1");
		$prod = mysqli_fetch_array($res2);
		
		if($prod['IMAGEN']==NULL){$IMG="Default.png";}else{$IMG=$prod['IMAGEN'];}
			echo '<div class="product-holder"><div class="product"><a href="index.php?IDS=".$_GET['IDS']."&CAT='.$prod['DEPTO'].'&INI=0" class="tooltip"><img src="photo/'.$IMG.'" /><span><strong>'.$prod['DEPTO'].'<br></strong><br>'.$prod['NOMBRE'].'</span></a>';
		echo '<div class="desc"><p>'.$prod['DEPTO'].'</p><p class="precio"></p><a id="ag" href="index.php?IDS=".$_GET['IDS']."&CAT='.$prod['DEPTO'].'&INI=0" title="Ir"><img src="img/'.$st['C-ICON'].'/go.png"></a></div></div></div>';}
	}else{echo "<CENTER><h3 style='color: ".$st['C-TEXTO']."';>Ocurrio un problema con la conexión a la base de datos.</h3></CENTER>";}
	mysqli_close($conexion);
include "php/pie.inc" ?>