<?php include('concha.php'); ?>

  <script language=javascript>
function ventanaSecundaria56 (URL){
   window.open(URL,"ventana1","width=960,height=630,scrollbars=NO")
}
  </script>

<style>
    
    
    .navbar{
       /* padding: 0px 0px 0px 15px!important;
        box-shadow: 2px 2px 3px #ccc;
                margin-bottom: 15px!important;*/
            }
    .nav-link {
                                    
        color: <?php echo $d_color_menu ?>;
        font-family: <?php echo $style_menu ?>;
        line-height: ;
    }
    
 .nav-item:active,   
.nav-item:focus,
    .nav-item:hover span{
        background-color: <?php echo $d_color_fondo_menu ?>;
        color:#fff!important;
        
    }
    .caret{
        
      color: <?php echo $d_color_fondo_menu ?>;  
        
    }
    
    .dropdown-menu {
        
        padding: 0;
    }
    
    .show{
    
    
}
    .dropdown-menu li a{
    
    padding: .5rem;
    font-size: 1rem;
    
}
    
    .dropdown-menu li a:hover{
    
    background-color: <?php echo $d_color_fondo_menu ?>;
    color:#fff!important;
        
}
    
    
   .nav-item .dropdown:hover ul{
        display: block;
        
    }
    
</style>

<nav class="<? if ($estiloweb <= 3){echo "navbar navbar-default navbar-affix-top ";} else {echo "navbar navbar-default sticky-top navbar-expand-lg navbar-light bg-light";} ?>" data-spy="affix" data-offset-top="<?php echo $alto_logo_nuevo ?>">
    
            
<button class="<? if ($estiloweb <= 3){echo "navbar-toggle";} else {echo "navbar-toggler";} ?>" type="button" data-toggle="collapse" data-target="#myNavbar" style="float: left;margin:8px;">
                      
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                      
                    <span class="navbar-toggler-icon"></span>
                  
                    </button>
                
<a rel="home" href="<?php $dom ;?>/principal.php" class="navbar-brand d-lg-none " style="margin:0 auto;"><img class="img-fluid" style="max-height:35px;" src="<?php 
							$logo_C = str_replace('https:', '',  $logo_C); 
							$logo_C = str_replace('http:', '',  $logo_C); 
							echo $logo_C; ?>"></a>
                
<div class="collapse navbar-collapse" id="myNavbar" style="max-width:1920px;">
  <ul class="<? if ($estiloweb <= 3){echo "nav navbar-nav";} else {echo "navbar-nav mr-auto";} ?>" >
                      

  <?php include('concha.php'); ?>  
  <?





$sql = "SELECT * FROM menu WHERE IDsub = '0' ORDER BY ID";

$consulta = $conn->query($sql);
while ($row = $consulta->fetch_assoc())

{
$nombre = $row["nombre"];
$tipo = $row["tipo"];
$link = $row["link"];
$ID_menu = $row["ID"];

  $hay_sub = 'no';
$sql55 = "SELECT * FROM menu WHERE IDsub = '$ID_menu' LIMIT 1";
$consulta55 = $conn->query($sql55);
while ($row55 = $consulta55->fetch_assoc())
{
$hay_sub = 'si';

}
$consulta55->free_result();


?> 
<li <?php if($hay_sub == 'si') { ?> class="nav-item dropdown" <? } else { ?>  class="nav-item" <?php };?>>
    
    <a class="nav-link" <?php if($hay_sub == 'si') { ?> class="dropdown-toggle" data-toggle="dropdown" <?php };?> href="<?php
    if ($tipo == 'noticias'){  

$sql55 = "SELECT * FROM categorias WHERE ID = '$link'";
$consulta55 = $conn->query($sql55);
while ($row55 = $consulta55->fetch_assoc())
{
$titulo_cat = $row55["nombre"];

}
$consulta55->free_result();

	
	 $titulo_cat = urls_amigables($titulo_cat);
	
	
	 echo "$dom/noticias/$link/$titulo_cat";
	 
	 
	 };

	  if ($tipo == 'seccion'){ 
	  
	  

$sql22 = "SELECT * FROM menu WHERE ID = '$ID_menu'";


$consulta22 = $conn->query($sql22);


while ($row22 = $consulta22->fetch_assoc())


{
$titulo_sec = $row22["nombre"];
 }


$consulta22->free_result();
 $titulo_sec = urls_amigables($titulo_sec);
	  
	  
	    echo "$dom/seccion/$ID_menu/$titulo_sec";};
	    if ($tipo == 'link'){   echo $link;};
    if ($tipo == 'precargado'){  
	
	if ($link == "javascript:ventanaSecundaria56('envivo')") {
	
	$link = "javascript:ventanaSecundaria56('$dom/envivo')";
	 echo "$link";
	 
	 
	 } else { echo "$dom/$link";}; }; 
  ?>" <? if ($tipo == 'link'){ ?> target="_blank" <? }; ?>>
    
    <? if($hay_sub == 'si') { ?><span><? echo $nombre ?></span> <? } else { ?> <span><? echo $nombre ?></span><? } ;?></a>
  
  
  
  <?
  
  
  
  if ($hay_sub == 'si') {
  ?>
   <ul class="dropdown-menu">
  <?
  
  
$sql66 = "SELECT * FROM menu WHERE IDsub = '$ID_menu' ORDER BY ID";

$consulta66 = $conn->query($sql66);
while ($row66 = $consulta66->fetch_assoc())
{
$nombre = $row66["nombre"];
$tipo = $row66["tipo"];
$link = $row66["link"];
$ID_menu = $row66["ID"];

?> 
<li><a href="<?php
    if ($tipo == 'noticias'){  

$sql55 = "SELECT * FROM categorias WHERE ID = '$link'";
$consulta55 = $conn->query($sql55);
while ($row55 = $consulta55->fetch_assoc())
{
$titulo_cat = $row55["nombre"];

}
$consulta55->free_result();

	
	 $titulo_cat = urls_amigables($titulo_cat);
	
	
	 echo "$dom/noticias/$link/$titulo_cat";
	 
	 
	 };

	  if ($tipo == 'seccion'){ 
	  
	  

$sql22 = "SELECT * FROM menu WHERE ID = '$ID_menu'";


$consulta22 = $conn->query($sql22);


while ($row22 = $consulta22->fetch_assoc())


{
$titulo_sec = $row22["nombre"];
 }


$consulta22->free_result();;
 $titulo_sec = urls_amigables($titulo_sec);
	  
	  
	    echo "$dom/seccion/$ID_menu/$titulo_sec";};
	    if ($tipo == 'link'){   echo $link;};
    if ($tipo == 'precargado'){  
	
	if ($link == "javascript:ventanaSecundaria56('envivo')") {
	
	$link = "javascript:ventanaSecundaria56('$dom/envivo')";
	 echo "$link";
	 
	 
	 } else { echo "$dom/$link";}; }; 
  ?>" <? if ($tipo == 'link'){ ?> target="_blank"<? }; ?> class="nav-item" ><?php echo $nombre ?></a>
</li>
<?
}
$consulta66->free_result();

?>
 </ul> <?
  
  }

 ?> 
 </li>
<?
}
$consulta->free_result();
?>

                    </ul>
                    
                  </div>
     
</nav>


