<?
session_start();
if ($_SESSION['estado'] != "ON")
		{
		?>
		<script>
			parent.location.href = '../index.php';
		</script>
		<? 
		exit();
		}
		

?>
<?php
include("../conex.php");
$id_empresa = $_SESSION['ss_empresa'];
$id_user = $_SESSION['ss_user'];
?>
<!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>Seleccion Empresa</title>
</head>
<body>
<div align="center"><b><font size="5" face="Tahoma" color="#000080">Seleccione Sucursal</font></b></div>
<form name="form1" action="" method="post" target="_blank">

<table width="60%" border="0" style="border:3px solid #000080" align="center">
	<tr> 
		<td width="35%"><font color="#000080">
			Seleccione Bodega:
		</font></td>
		<td width="65%">
		<select name="id_bodega" id="id_bodega" size="1" style="width:270px">
		<? 
		$sql_buem= mysql_query("SELECT * FROM bodega WHERE empresa=$id_empresa",$enlace);
		$buem_cont = 0;
		while ( mysql_fetch_object($sql_buem))
			{
			$sqlbuem_codigo=mysql_result($sql_buem, $buem_cont, "id");
			$sqlbuem_rsoc=mysql_result($sql_buem, $buem_cont, "descripcion");
			?>
			<option value="<?=$sqlbuem_codigo?>" <? if ($sqlbuem_codigo==$id_empresa){?> selected="selected" <? }?> >
				<?=$sqlbuem_rsoc?>
			</option>
			<? 
			$buem_cont += 1;
			} 
		?>
		</select></td>
	</tr>
</table>

<div align="center">
	<input type="button" name="Submit" value="Ingresar" onClick="enviar();">
	<input type="button" name="Submit2" value="Salir" onClick="window.top.open('','_parent','');window.top.close();">
</div>

</form>


</body>
</html>
<script language="javascript">
function enviar()
	{
	document.form1.action="index2.php";
	document.form1.target="_self";
	document.form1.submit();
	}
</script>