<?


//saber si es movil


if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$_SERVER['HTTP_USER_AGENT'])||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($_SERVER['HTTP_USER_AGENT'],0,4))) {
	$es_movil = 'si';
	} else {
		$es_movil = 'no';
	}



//scrap clima

$stringreal  = substr($infoclima, 0, 22);
//abro if para saber si es infoclima
if ($stringreal == 'https://infoclima.com/') {

$timeA = time();

$timeG = $icon;

$totaltime = $timeA - $timeG;
//aabro if
if ($totaltime > 900) {

$url = "$infoclima";
$codigohtml = GetHTML($url);

preg_match_all("(<p>(.*)</p>)siU", $codigohtml, $temp);
preg_match_all("(Estado\", \"(.*)\")siU", $codigohtml, $estado);


$tempA =  utf8_encode($temp[1][0]);

$tempA = str_replace('C','',$tempA);
$tempA = str_replace("째",'',$tempA);
$estadoA =  $estado[1][0];

$sSQL=" UPDATE `configuracion` SET `como_esta` = '$estadoA', `grados` = '$tempA', `icon` = '$timeA' LIMIT 1";
$conn->query($sSQL);

}; //cierro if
}; //cierro if que comprueba si la url es infoclima
//fin scrap clima
echo "<!-- climainfo $estadoA $tempA $timeA $totaltime -->"
?>

    <style>
/* boton de whats app */
    .botonWasap {
        position: fixed;
        bottom: 26px;
        right: 26px;
        z-index: 1000;
        border-radius: 50% !important;
    }

    .botonWasap > i {
        font-size: 2rem;
        padding: 10px 6px;
    }

    .en-vivo-mobile-li {
        background: transparent !important;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 3px;
        margin: 0;
    }

    .en-vivo-mobile-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        border-radius: 50%;
        background: #e60000;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 !important;
        margin-top: 5px;
        box-shadow: 0 2px 6px rgba(0,0,0,.20);
        text-decoration: none !important;
        line-height: 1;
    }

    .en-vivo-mobile-btn i {
        color: #fff !important;
        font-size: 11px;
        margin-left: 2px;
        line-height: 1;
    }


        .navbar{
            /* padding: 0px 0px 0px 15px!important;
            box-shadow: 2px 2px 3px #ccc;
            margin-bottom: 15px!important;*/
            background-color: <?php echo $d_color_fondo_menu ?>;
        }
        .nav-link {

            color: <?php echo $d_color_menu ?>;
            font-family: <?php echo $style_titulo ?>;
            font-weight: 700;
        }

        .caret{
        color: <?php echo $d_color_fondo_menu ?>;

        }

        .dropdown-menu {

            padding: 0;
        }

        .dropdown-menu li a{

            padding: .5rem;
            font-size: 1rem;

        }

            .dropdown-menu .nav-item .nav-link:hover{

            background-color: <?php echo $d_color_fondo_menu ?>;
            color: <?php echo $d_color_menu_sobre ?>;

        }


        .nav-item .dropdown:hover ul{
            display: block;

        }
        .topbar{
            /*border-bottom: 1px solid #e4e4e4;
            height: 42px!important;
            line-height: 38px;*/
        }
        .menuBusqueda{
            border: 0px none;
            width: 100%;
            position: absolute;
            will-change: transform;
            top: 0px;
            left: 0px;
            transform: translate3d(0px, 0px, 0px)!important;
            -webkit-transition: all 1s ease-in;
            -moz-transition: all 1s ease-in;
            -o-transition: all 1s ease-in;
            transition: all 1s ease-in;
        }

        .menuBusqueda2{
            border: 0px none;
            position: absolute;
            will-change: transform;
            top: 0px;
            left: 0px;
            transform: translate3d(0px, 0px, 0px)!important;
            -webkit-transition: all 1s ease-in;
            -moz-transition: all 1s ease-in;
            -o-transition: all 1s ease-in;
            transition: all 1s ease-in;

        }

        .menuBusqueda2 > form > input {
            min-height: 56px;
        }

        .submenu{
            font-size: 12px;
            font-weight: 200;
        }
        #logo4{
            fill: <? echo $d_color_menu?>;
            max-width: 18px;
        }
    </style>

    <div id="header-wrapper" class="">
            <div class="topbar">
                <div class="<?if ($opcion101 == 1) { echo 'container-fluid';}if ($opcion101 == 0){echo 'container';}?>">
                    <div class="row">

                        <div class="d-none d-sm-block col-sm-5 col-md-3 col-lg-4 pr-0" style="max-height: 40px;overflow: hidden;">
                                <?
                                    $A = date('Y');
                                    $M = date('m');
                                    $D = date('j');
                                    $H = date('H');
                                    $MIN = date('i');
                                    $date = "$Y$M$D";
                                    if ($M == '01') {$m = $lang_enero;}
                                    if ($M == '02') {$m = $lang_febrero;}
                                    if ($M == '03') {$m = $lang_marzo;}
                                    if ($M == '04') {$m = $lang_abril;}
                                    if ($M == '05') {$m = $lang_mayo;}
                                    if ($M == '06') {$m = $lang_junio;}
                                    if ($M == '07') {$m = $lang_julio;}
                                    if ($M == '08') {$m = $lang_agosto;}
                                    if ($M == '09') {$m = $lang_septiembre;}
                                    if ($M == '10') {$m = $lang_octubre;}
                                    if ($M == '11') {$m = $lang_noviembre;}
                                    if ($M == '12') {$m = $lang_diciembre;}
                                ?>
                                <p class="mb-0 texto-fecha" id="text-fecha">
                                        <?php $diasemana=date('N'); // asignamos el numero del dia de hoy a la variable $diasemana ?>
                                        <?php //Procedemos a verificar si el dia de hoy es 1 lunes si es 2 martes... etc..  ?>
                                        <?php if($diasemana == "1" ){ echo $lang_lunes  ;}?>
                                        <?php if($diasemana == "2" ){ echo $lang_martes ;}?>
                                        <?php if($diasemana == "3" ){ echo $lang_miercoles ;}?>
                                        <?php if($diasemana == "4" ){ echo $lang_jueves ;}?>
                                        <?php if($diasemana == "5" ){ echo $lang_viernes ;}?>
                                        <?php if($diasemana == "6" ){ echo $lang_sabado ;}?>
                                        <?php if($diasemana == "7" ){ echo $lang_domingo;}?>
                                        <?php echo $D ;?> de <?php echo $m ;?> de <?php echo $A ;?>
                                </p>
                        </div>
                        <div class="d-none d-md-block col-md-4 col-lg-3 p-0">



                            <?php  include 'marquesina3.php'; ?>





                        </div>
                        <div class="col-12 col-sm-7 col-md-5 col-lg-5 p-0 text-right">
                            <ul class="mb-0 px-3 d-flex justify-content-end">

                                        <li class="">

                                                <a href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn">
                                                    <i class="fas fa-search" style="color: <? echo $d_color_menu?>;"></i>
                                                </a>
                                                <div class="dropdown-menu menuBusqueda" style="border:0;width:100%;" aria-labelledby="dropdownMenuLink">
                                                    <form id="form1" name="form1" method="GET" action="<? echo $dom ?>/buscar.php">
                                                        <input name="busqueda" type="text" class="form-control" size="30" value="" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" />
                                                        <input name="Submit" type="submit" class="btn btn-outline-primary my-2 my-sm-0" value="<? echo $lang_buscar ?>" />
                                                    </form>

                                                </div>

                                        </li>

                                        <?php if ($funcion1 == 'si'){ ?>

                                            <?php if ($es_movil == 'si') { ?>

                                                <li class="en-vivo-mobile-li">
                                                    <a class="en-vivo-mobile-btn" target="_blank" href="<?php echo $dom."/envivo"?>" aria-label="EN VIVO">
                                                        <i class="fas fa-play"></i>
                                                    </a>
                                                </li>

                                            <?php } else { ?>

                                                <li class="" style="background: red">
                                                    <a class="px-2" target="_blank" href="<?php echo $dom."/envivo"?>">
                                                        <small style="color: white;"><i class="fa fa-headphones"></i> <b>EN VIVO</b></small>
                                                    </a>
                                                </li>

                                            <?php } ?>

                                        <?php } else { } ?>

                                        <?php  if ($whatsapp == NULL) {} else {?>

                                            <li class="">

                                                <a class="btn" target="_blank" href="https://api.whatsapp.com/send?phone=<?php echo $whatsapp ?>"><i class="fab fa-whatsapp" aria-hidden="true"  style=" color: <? echo $d_color_menu?>;"></i></a>

                                            </li>

                                        <?php };?>

                        <?php if ($twitter == NULL) {} else { ?>
    <li class="">
        <a class="btn" target="_blank" href="https://x.com/<?php echo $twitter ?>" aria-label="X">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
                 width="15" height="15" style="margin-bottom: 2px;vertical-align:middle; fill: <?php echo $d_color_menu; ?>;">
                <path d="M18.901 1.153h3.409l-7.446 8.514 8.76 13.18h-6.86l-5.37-7.99-6.99 7.99H1.0l7.97-9.12L.56 1.153h7.03l4.85 7.3 6.46-7.3zM17.706 20.73h1.89L6.58 3.16H4.55l13.156 17.57z"/>
            </svg>
        </a>
    </li>
<?php } ?>

<?php if ($facebook == NULL) {} else { ?>
    <li class="">
        <a class="btn" target="_blank" href="https://www.facebook.com/<?php echo $facebook; ?>" aria-label="Facebook">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
                 width="18" height="18" style="margin-bottom: 2px; vertical-align:middle; fill: <?php echo $d_color_menu; ?>;">
                <!-- Facebook "f" -->
                <path d="M13.5 22v-8h2.7l.4-3h-3.1V9.1c0-.9.2-1.5 1.5-1.5h1.7V5c-.3 0-1.4-.1-2.7-.1-2.7 0-4.6 1.7-4.6 4.9V11H7v3h2.4v8h4.1z"/>
            </svg>
        </a>
    </li>
<?php } ?>



                                        <?php if ($social_aim == NULL) {} else {?>
                                            <li class=""  >
                                                <a class="btn" target="_blank" href="<?php echo "https://instagram.com/".$social_aim ?>"><i class="fab fa-instagram" aria-hidden="true" style=" color: <? echo $d_color_menu?>;"></i></a>
                                            </li>
                                        <?php };?>

                                        <?php if ($twitter_btn == NULL) {} else {?>
                                        <li class=""  >
                                            <a class="btn" target="_blank" href="<?php echo $twitter_btn ?>"><i class="fab fa-twitter" style=" color: <? echo $d_color_menu?>;"></i></a>
                                        </li>
                                        <?php };?>

                                        <?php if ($social_blogger == NULL) {} else {?>
                                        <li class=""  >
                                            <a class="btn" target="_blank" href="<?php echo $social_blogger ?>"><i class="fab fa-blogger" style=" color: <? echo $d_color_menu?>;"></i></a>
                                        </li>
                                        <?php };?>

                                        <?php if ($social_flickr == NULL) {} else {?>
                                        <li class=""  >
                                            <a class="btn" target="_blank" href="<?php echo $social_flickr ?>"><i class="fab fa-flickr" style=" color: <? echo $d_color_menu?>;"></i></a>
                                        </li>
                                        <?php };?>

                                        <?php if ($social_google == NULL) {} else {?>
                                        <li class=""  >
                                            <a class="btn" target="_blank" href="<?php echo $social_google ?>"><i class="fab fa-google" style=" color: <? echo $d_color_menu?>;"></i></a>
                                        </li>
                                        <?php };?>

                                        <?php  if ($social_tumblr == NULL) {} else {?>
                                        <li class=""  >
                                            <a class="btn" target="_blank" href="<?php echo $social_tumblr ?>"><i class="fab fa-instagram" style=" color: <? echo $d_color_menu?>;"></i></a>
                                        </li>
                                        <?php };?>

                                        <?php if ($social_vimeo == NULL) {} else {?>
                                        <li class=""  >
                                            <a class="btn" target="_blank" href="<?php echo $social_vimeo ?>"><i class="fab fa-vimeo-v" style=" color: <? echo $d_color_menu?>;"></i></a>
                                        </li>
                                        <?php };?>

                                        <?php if ($social_yahoo == NULL) {} else {?>
                                        <li class=" "  >
                                            <a class="btn" target="_blank" href="<?php echo $social_yahoo ?>"><i class="fab fa-yahoo" style=" color: <? echo $d_color_menu?>;"></i></a>
                                        </li>
                                        <?php };?>

                                        <?php  if ($social_youtube == NULL) {} else {?>
                                        <li class=" "  >
                                            <a  class="btn" target="_blank" href="<?php echo $social_youtube ?>"><i class="fab fa-youtube" style=" color: <? echo $d_color_menu?>;"></i></a>
                                        </li>
                                        <?php };?>

                                      <?   //abro if para saber si es infoclima
                                        if ($stringreal == 'https://infoclima.com/') { ?> 
                                        
                                        <img style="margin-top: 12px;"
  src='data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24"><path d="M10 14.76V5a2 2 0 114 0v9.76a4 4 0 11-4 0z" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 17v-6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>'
  width="18"
  height="18"
  alt="Termómetro"
  style="vertical-align:middle; color:#000;"
/> <?

                                         include 'weather_magazine2.php';

                                          };
                                         ?>


                            </ul>

                        </div>
                    </div>
                </div>
            </div>

            <header class="container-fluid header">


                    <div class="<?if ($opcion101 == 1) { echo 'container-fluid';}if ($opcion101 == 0){echo 'container';}?>">


                        <div class="row">


<? if ($tres_imagenes == 1 and $es_movil != 'si') {

////logo cabecera nueva con 3 imagenes


?>


<div class="col-4 text-center" style="text-aling:center; heigth:100%;  align-items: center;     top: 0;
   bottom: 0;
   left: 0;
   right: 0;
   width: 50%;
   height: 30%;
   margin: auto;">


<?
    if ($cabecera_uno != null){?>

        <a href="<?  echo $cabecera_uno_url; ?>">
      <img src="<? echo $dom ?>/<?  echo $cabecera_uno_carpetafoto; ?>/<?  echo $cabecera_uno; ?>"
            class="img-fluid"
            style="padding-top:20px; padding-bottom: 20px;max-height: 170px; vertical-align: middle;
border-style: none;"
            alt="<?php echo $nombresitio ?>" title="<?php echo $nombresitio ?>"></a>
    <? } else {

    }
?>

</div>




<div class="col-4 text-center" style="text-aling:center; heigth:100%;  align-items: center;     top: 0;
   bottom: 0;
   left: 0;
   right: 0;
   width: 50%;
   height: 30%;
   margin: auto;">


<?
    if ($logo_C != null){?>

        <a href="<?php echo $dom ?>/principal.php">
        <img src="<? $logo_C = str_replace('http://', 'https://', $logo_C); echo $logo_C; ?>"
            class="img-fluid"
            style="padding-top:20px; padding-bottom: 20px;max-height: 170px; vertical-align: middle;
border-style: none;"
            alt="<?php echo $nombresitio ?>" title="<?php echo $nombresitio ?>"></a>
    <? } else {

    }
?>

</div>

<?
    if ($cabecera_dos != null){?>
<div class="col-4 text-center" style="text-aling:center; heigth:100%;  align-items: center;     top: 0;
   bottom: 0;
   left: 0;
   right: 0;
   width: 50%;
   height: 30%;
   margin: auto;">





        <a href="<?  echo $cabecera_dos_url; ?>">
        <img src="<? echo $dom ?>/<?  echo $cabecera_dos_carpetafoto; ?>/<?  echo $cabecera_dos; ?>"
            class="img-fluid"
            style="padding-top:20px; padding-bottom: 20px;max-height: 170px; vertical-align: middle;
border-style: none;">


</div>

 <? } else {

    }
?>
<?
} else {
  /// logo normal de una imagen ?>


                            <div class="d-none d-block  d-lg-block <? if ($weather2 == 'si'){ echo 'col-6 col-md-6';} else { echo 'col-12 col-md-12 text-center';}  ?>">


                            <?
                                if ($logo_C != null){?>

                                    <a href="<?php echo $dom ?>/principal.php">
                                    <img src="<? $logo_C = str_replace('http://', 'https://', $logo_C); echo $logo_C; ?>"
                                        class="img-fluid"
                                        style="padding-top:20px; padding-bottom: 20px;max-height: 170px;"
                                        alt="<?php echo $nombresitio ?>" title="<?php echo $nombresitio ?>"></a>
                                <? } else {

                                }
                            ?>

                            </div>

<? } ?>

                            <? if ($weather2 == 'si'){?>

                                <div  class="col-6 col-md-6 d-flex justify-content-center align-items-center">

                                  <? if ($stringreal == 'https://infoclima.com/') {


                                     include 'weather4_magazine.php';
                                   };

                                     ?>



                                </div>

                            <?}  ?>

                        </div>
                    </div>
            </header>

    </div>

    <script>
            $(function(){

                jQuery('img.svg').each(function(){
                   var $img = jQuery(this);
                   var imgID = $img.attr('id');
                   var imgClass = $img.attr('class');
                   var imgURL = $img.attr('src');
                   //console.log('lalasl', imgURL);
                   jQuery.get(imgURL, function(data) {

                       // Get the SVG tag, ignore the rest
                       var $svg = jQuery(data).find('svg');

                       // Add replaced image's ID to the new SVG
                       if(typeof imgID !== 'undefined') {
                           $svg = $svg.attr('id', imgID);
                       }
                       // Add replaced image's classes to the new SVG
                       if(typeof imgClass !== 'undefined') {
                           $svg = $svg.attr('class', imgClass+' replaced-svg');
                       }

                       // Remove any invalid XML tags as per http://validator.w3.org
                       $svg = $svg.removeAttr('xmlns:a');

                       // Check if the viewport is set, else we gonna set it if we can.
                       /*if(!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) {
                           $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width'))
                       }*/

                       // Replace image with new SVG
                       $img.replaceWith($svg);

                   }, 'xml');

                });
                });
        </script>

    <nav id="navigato" class="navbar navbar-default navbar-expand-lg">

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#myNavbar">

            <i class="fas fa-bars" style="color: <? echo $d_color_menu?>;"></i>

        </button>

        <!--a rel="home" href="<?php echo $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 justify-content-center" id="myNavbar" style="">

                        <ul class="<? if ($estiloweb <= 3){echo "nav navbar-nav";} else {echo "navbar-nav ";} ?>" >


                            <?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' LIMIT 1";
                                            $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' LIMIT 1";
    $consulta22 = $conn->query($sql22);

    $titulo_sec = '';

    while ($row22 = $consulta22->fetch_assoc())
    {
        $titulo_sec = $row22["nombre"];
    }

    $consulta22->free_result();

    if (trim($titulo_sec) == '') {
        $titulo_sec = 'a';
    }

    $titulo_sec = urls_amigables($titulo_sec);

    if (trim($titulo_sec) == '') {
        $titulo_sec = 'a';
    }

    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') { ?><? if ($utf == 1) {echo utf8_decode($nombre);} else {echo $nombre;}; ?> <? } else { ?> <? if ($utf == 1) {echo utf8_decode($nombre);} else {echo $nombre;}; ?><? } ;?></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 class="nav-item">
                                                <a href="<?php if ($tipo == 'noticias'){
                                                            $sql55 = "SELECT * FROM categorias WHERE ID = '$link' LIMIT 1";
                                                            $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' LIMIT 1";
                                                        $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-link" ><?php if ($utf == 1) {echo utf8_decode($nombre);} else {echo $nombre;}; ?>
                                                </a>
                                            </li>
                                            <?
                                            }
                                            $consulta66->free_result();
                                            ?>
                                        </ul>
                                    <?
                                    }
                                    ?>
                                </li>
                            <?
                            }
                            $consulta->free_result();
                            ?>

                        </ul>

        </div>


    </nav>

    <?
    if($tag1 != '' || $tag2 != '' || $tag3 != '' || $tag4 != '' || $tag5 != ''){?>
        <div class="container bg-light">
            <div class="row">
                <div class="col-12 d-flex justify-content-center">
                    <ul class="nav">
                        <li class="nav-item">
                            <a class="nav-link submenu" href="<? echo $dom ?>/buscar.php?busqueda=<? echo $tag1?>&Submit=Buscar"><? echo $tag1?></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link submenu" href="<? echo $dom ?>/buscar.php?busqueda=<? echo $tag2?>&Submit=Buscar"><? echo $tag2?></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link submenu" href="<? echo $dom ?>/buscar.php?busqueda=<? echo $tag3?>&Submit=Buscar"><? echo $tag3?></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link submenu" href="<? echo $dom ?>/buscar.php?busqueda=<? echo $tag4?>&Submit=Buscar"><? echo $tag4?></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link submenu" href="<? echo $dom ?>/buscar.php?busqueda=<? echo $tag5?>&Submit=Buscar"><? echo $tag5?></a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    <?} else {}
    ?>

<nav id="navigato2" data-hidden="true" class="navbar navbar-default navbar-expand-lg">

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#myNavbar2">

            <i class="fas fa-bars" style="color: <? echo $d_color_menu?>;"></i>

        </button>

        <a id="fa" rel="home" href="<?php echo $dom ;?>/principal.php" class="navbar-brand d-lg-none yiyin text-center" style="margin:0 auto;">
            <img class="img-fluid" style="max-height:35px;" src="<? $logo_C = str_replace('https:', '',  $logo_C);
                    $logo_C = str_replace('http:', '',  $logo_C);
                    echo $logo_C; ?>">
        </a>

                    <div class="collapse navbar-collapse" id="myNavbar2" style="max-width:1140px;">

                        <ul class="navbar-nav mr-auto" >


                            <?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' LIMIT 1";
                                            $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' LIMIT 1";
                                            $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') { ?><? if ($utf == 1) {echo utf8_decode($nombre);} else {echo $nombre;}; ?> <? } else { ?> <? if ($utf == 1) {echo utf8_decode($nombre);} else {echo $nombre;}; ?><? } ;?></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 class="nav-item">
                                                <a href="<?php if ($tipo == 'noticias'){
                                                            $sql55 = "SELECT * FROM categorias WHERE ID = '$link' LIMIT 1";
                                                            $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' LIMIT 1";
                                                        $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-link" ><?php if ($utf == 1) {echo utf8_decode($nombre);} else {echo $nombre;}; ?>
                                                </a>
                                            </li>
                                            <?
                                            }
                                            $consulta66->free_result();
                                            ?>
                                        </ul>
                                    <?
                                    }
                                    ?>
                                </li>
                            <?
                            }
                            $consulta->free_result();
                            ?>


                        </ul>

                        <ul class="d-flex justify-content-end" style="list-style: none;padding:0;margin:0;">
                            <li class=""  >
                                <a href="#" role="button" id="dropdownMenuLink2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn">
                                    <i class="fas fa-search" style="color: <? echo $d_color_menu?>;"></i>
                                </a>

                                <div class="dropdown-menu menuBusqueda2" style="border:0;width:100%;" aria-labelledby="dropdownMenuLink2">
                                    <form id="form1" name="form1" method="GET" action="<? echo $dom ?>/buscar.php">
                                        <input name="busqueda" type="text" class="form-control" size="30" value="" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" />
                                        <input name="Submit" type="submit" class="btn btn-outline-primary my-2 my-sm-0" value="<? echo $lang_buscar ?>" />
                                    </form>

                                </div>

                            </li>

                              <?


                              //abro if para saber si es infoclima
                              if ($stringreal == 'https://infoclima.com/') {


                              include 'weather_magazine2.php';

};


                              ?>


                        </ul>

                    </div>
      <div id="result"></div>

    </nav>

    <style>
           #navigato2{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
  transform: translateY(-120%);
  transition: transform .35s ease;
  background-color: <? echo $d_color_fondo_menu?>;
}

#navigato2.show-top{
  transform: translateY(0);
}

.yiyin{
  width: calc(100% - 50px)!important;
}

    </style>




<!-- boton de whatsapp -->
    <? if ($whatsapp == '') {} else { ?>
        <!-- Button trigger modal -->
          <a rel="nofollow" target="_blank" href="<? if ($es_movil == 'si') {?>https://api.whatsapp.com/send?phone=<? echo $whatsapp ?>&text=Hola<? } else {?>https://web.whatsapp.com/send?phone=<? echo $whatsapp ?>&text=Hola<?} ?>">  <button type="button" class="btn btn-success botonWasap" >
          <i class="fab fa-whatsapp"></i>
          </button></a>
    <? } ?> <script>
(function($){
  var $nav2 = $('#navigato2');
  if(!$nav2.length) return;

  function toggleSticky(){
    if ($(window).scrollTop() > 120) {
      $nav2.addClass('show-top');
    } else {
      $nav2.removeClass('show-top');
    }
  }

  $(window).on('scroll', toggleSticky);
  toggleSticky();
})(jQuery);
</script>