<? ini_set("display_errors",0);session_start();

if($_SESSION[user]=='') {
	header("location: ../../login.php");
}else{
	include("../../comun/conexion3.php");
	include("../../comun/conex_ver.php");
	include("../../comun/funciones.php");
	
 $link_impo=con_impo();
	$rDat = data($link_impo,"select U.tipoe,U.id,U.nombre as nom,U.rol,U.perfil,A.area,U.empresa,U.email,U.gafete  from usuarioslpv U,areaslpv A where U.usuario like '".strtoupper($_SESSION[user])."' and U.tipoe=A.abreviatura");
 
	$_SESSION[area] = $rDat[tipoe];
	$_SESSION[idusuario] = $rDat[id];
	$_SESSION[area_long] = $rDat[area];
	$_SESSION[rol] = $rDat[rol]; // admin o ejecutivo
	$_SESSION[tipo] = $rDat[tipoe]; // comercial expo o impo
	$_SESSION[perfil] = $rDat[perfil]; // superadmin consulta general o personalizado
 	$_SESSION[email] = $rDat[email];
 $_SESSION["gafete"]=$rDat[gafete];
 
	$tipo = $rDat[tipoe];
	$nombre = $rDat[nom];
	$rol = $rDat[rol];
	$empresa = $rDat[empresa];
	
	$_SESSION[nombre_usuario] = $nombre;
	//echo $_SESSION[idusuario].' 3';
}
?>
<!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" />
<link rel="stylesheet" type="text/css" href="../../style.css" media="all" />
	<!--[if IE 7]>
	<link rel="stylesheet" type="text/css" href="style-ie.css" />
	<![endif]-->
<!-- estilos para popup-->

 <link rel="stylesheet" type="text/css" media="screen" href="../../css/ui.datepicker.css" />

<!-- estilos para popup-->
    
<title>VERACRUZ</title>
<script type="text/javascript" src="../../js/jquery.js"></script>
<script type="text/javascript" src="../../js/validator.js"></script>
<script type="text/javascript" src="../../js/funciones.js"></script>
<script type="text/javascript" src="../../js/autocomplete/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="../../js/autocomplete/jquery.autocomplete.css" media="all" />
<script src="../../js/windowfiles_subnivel2/dhtmlwindow.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../../js/windowfiles_subnivel2/dhtmlwindow.css" media="all" />
<script type="text/javascript" src="../../js/ui.datepicker.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/ui.datepicker.css" media="all" />

<!-- Begin DropDown -->
      
<script type="text/javascript">
$(function(){
   $("ul.dropdown li").hover(function(){
        $(this).addClass("hover");
        $('ul:first',this).css('visibility', 'visible');
    
    }, function(){
   $(this).removeClass("hover");
   $('ul:first',this).css('visibility', 'hidden');
});
$("ul.dropdown li ul li:has(ul)").find("a:first").append(" &raquo; ");
});
</script>

<script type="text/javascript">
var theObj="";
function toolTip(text,me) {
       theObj=me;
       theObj.onmousemove=updatePos;
       document.getElementById('toolTipBox').innerHTML=text;
       document.getElementById('toolTipBox').style.display="block";
       window.onscroll=updatePos;
}
function updatePos() {
       var ev=arguments[0]?arguments[0]:event;
       var x=ev.clientX;
       var y=ev.clientY;
       diffX=24;
       diffY=0;
       document.getElementById('toolTipBox').style.top  = y-2+diffY+document.body.scrollTop+ "px";
       document.getElementById('toolTipBox').style.left = x-2+diffX+document.body.scrollLeft+"px";
       theObj.onmouseout=hideMe;
}
function hideMe() {
       document.getElementById('toolTipBox').style.display="none";
}
</script>

 
</head>

<body>

 <style>
    tr.yellow td {
	border-top: 1px solid #333;
	border-bottom: 1px solid #333;
	background: #FFC;
	font-weight:bold;  
	}
	
	tr.comun td {
	border-top: 1px solid #333;
	border-bottom: 1px solid #333;
	border-right: 1px solid #333;
	border-left: 1px solid #333;
	text-align:center;
	
	/*background: #FFC;*/
	}
	
	table.tablas_con_bordes{
		border:1PX solid #333; border-collapse:collapse
	}
	</style>

<div id="home"> 
</div>

<div id="header">
<div id="social">Bienvenido usuario: <?=$_SESSION[user]?><br>
 <?=$nombre?><br />
 <?=$empresa?><br />
  Area: <?=$_SESSION[area_long]?> Rol: <?=$_SESSION[rol]?>
</div>
</div>


<? con_ver();
$query=mysqli_query("select * from menu where (tipoe = '$tipo' or tipoe='All') and (rol = 'All' or rol = '$rol') and visible=1 order by posicion");

?>


<ul class="dropdown"><!-- menu -->
<? while ($r=mysqli_fetch_array($query)){?>
<li>
           <a <?  if($r[programa]!='#' or $r[titulo]=='Salir'){?>href="<?="https://".$_SERVER["SERVER_NAME"]?>/VER/<?=$r[programa]?>" <? } ?> ><?=utf8_encode($r[titulo])?></a>
        <? $queryS=mysqli_query("select * from submenu where idmenu = '".$r[id]."' and (tipoe = '$tipo' or tipoe='All' ) and (rol = 'All' or rol = '$rol') and visible=1 order by posicion");
		
		if(mysqli_num_rows($queryS)>0){
		?>
        <ul >
                <? while($rS=mysqli_fetch_array($queryS)){?>
                <li><a href="<?="https://".$_SERVER["SERVER_NAME"]?>/VER/<?=$rS[programa]?>"><?=utf8_encode($rS[titulo])?></a>
                
							 <? $querySub=mysqli_query("select * from sub_submenu where idmenu = '".$rS[id]."' and visible=1 order by titulo");
                    
                            if(mysqli_num_rows($querySub)>0){
                            ?>
                            <ul><!-- class="sub_menu"-->
                              <? while($rSub=mysqli_fetch_array($querySub)){?>
                                <li><a href="<?="https://".$_SERVER["SERVER_NAME"]?>/VER/<?=$rSub[programa]?>"><?=$rSub[titulo]?></a></li>
                              <? } ?>  
                            </ul>
                            <? } ?>
                
                </li>
                <? } ?>
        </ul>
        <? } ?>
</li>
<? } ?>

<!-- end submenu -->

</ul><!-- close menu -->
