<? 

//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 > 700) {

        $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

?>

<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;
    }

    .navbar{
        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{
    }

    .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;
    }

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

    .submenu{
        font-size: 12px;
        font-weight: 200;
    }

    #logo4{
        fill: <? echo $d_color_menu?>;
        max-width: 18px;
    }

    /* menu unico sticky */
    #navigato.menu-unico{
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 9999;
        background-color: <? echo $d_color_fondo_menu?>;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }

    #navigato.menu-unico .navbar-collapse{
        align-items: center;
    }

    #navigato.menu-unico .menu-principal{
        margin: 0;
        padding: 0;
    }

    #navigato.menu-unico .menu-utilidades{
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        align-items: center;
    }

    #navigato.menu-unico .menu-utilidades > li{
        border-left: 1px solid #e4e4e4;
    }

    #navigato.menu-unico .menu-utilidades .btn{
        border-radius: 0;
        box-shadow: none !important;
    }

    @media (max-width: 991.98px){
        #navigato.menu-unico .menu-utilidades{
            width: 100%;
            justify-content: flex-end;
            margin-top: 10px;
        }
    }
</style>

<div id="header-wrapper" style="background-color:transparent!important;">
    <div class="d-none topbar container">
        <div class="container">
            <div class="row">

                <div class="d-none d-sm-block col-sm-6 col-md-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'); ?>
                        <?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-4 p-0">
                    <?php include 'marquesina3.php'; ?>
                </div>

                <div class="col-12 col-sm-6 col-md-4 text-right">
                    <ul class="mb-0 d-flex justify-content-end">

                        <li class="" style="border-left:1px solid #e4e4e4;">
                            <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="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 ($whatsapp == NULL) {} else {?>
                            <li class="" style="border-left:1px solid #e4e4e4;">
                                <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 ($facebook == NULL) {} else {?>
                            <li class="" style="border-left:1px solid #e4e4e4;">
                                <a class="btn" target="_blank" href="<?php echo $facebook ?>"><i class="fab fa-facebook" aria-hidden="true" style=" color: <? echo $d_color_menu?>;"></i></a>
                            </li>
                        <?php };?>

                        <?php if ($social_aim == NULL) {} else {?>
                            <li class="" style="border-left:1px solid #e4e4e4;">
                                <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="" style="border-left:1px solid #e4e4e4;">
                                <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="" style="border-left:1px solid #e4e4e4;">
                                <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="" style="border-left:1px solid #e4e4e4;">
                                <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="" style="border-left:1px solid #e4e4e4;">
                                <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="" style="border-left:1px solid #e4e4e4;">
                                <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="" style="border-left:1px solid #e4e4e4;">
                                <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="" style="border-left:1px solid #e4e4e4;">
                                <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="" style="border-left:1px solid #e4e4e4;">
                                <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 };?>

                        <? include 'weather_magazine2.php';?>

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

    <header class="container bg-light p-0 header">
        <div class="container p-0">

            <div class="d-none row">

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

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

                    <div class="col-12 col-md-12 col-lg-12 text-center">
                        <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>
                    </div>

                <?php } else { ?>

                    <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';}  ?>">
                        <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>
                    </div>

                    <? if ($weather2 == 'si'){?>
                        <div class="col-6 col-md-6 d-flex justify-content-center align-items-center">
                            <? include 'weather4_magazine.php';?>
                        </div>
                    <?} else {}?>

                <? } ?>

            </div>

            <div class="col-12 p-0 text-center">
                <a href="<?php echo $dom ?>/principal.php">
                    <img src="<? echo $logo_g; ?>"
                         class="img-fluid"
                         style="width:100%;"
                         alt="<?php echo $nombresitio ?>"
                         title="<?php echo $nombresitio ?>">
                </a>
            </div>

        </div>
    </header>

</div>

<nav id="navigato" class="navbar navbar-default navbar-expand-lg container border-right border-left menu-unico">

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#myNavbar" aria-controls="myNavbar" aria-expanded="false" aria-label="Toggle navigation">
        <i class="fas fa-bars" style="color: <? echo $d_color_menu?>;"></i>
    </button>

    <div class="collapse navbar-collapse justify-content-between" id="myNavbar">

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

            <?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') { echo ' dropdown-toggle'; } ?>"
                    <?php if($hay_sub == 'si') { ?>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"<? } ?>
                >
                    <?php if ($utf == 1) { echo utf8_decode($nombre); } else { echo $nombre; } ?>
                </a>

                <?php 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_hijo = $row66["ID"];
                        ?>
                            <li class="nav-item">
                                <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_hijo'";
                                            $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_hijo/$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>
                <?php } ?>

            </li>

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

            <?php if ($funcion1 == 'si'){ ?>
                <li class="nav-item">
                    <a class="btn" style="background:red; margin-left:8px;" target="_blank" href="<?php echo $dom."/envivo"?>">
                        <span style="color:white;">EN VIVO</span>
                    </a>
                </li>
            <?php } ?>

        </ul>

        <ul class="menu-utilidades">
            <li>
                <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 menuBusqueda" style="border:0;width:100%;" aria-labelledby="dropdownMenuLink2">
                    <form id="form2" name="form2" method="GET" action="buscar.php">
                        <input name="busqueda" type="text" class="form-control" size="30" value="" id="inputString2" 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>

            <? include 'weather_magazine2.php';?>
        </ul>

    </div>

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

<?
if($tag1 != '' || $tag2 != '' || $tag3 != '' || $tag4 != '' || $tag5 != ''){?>
    <div class="container bg-light border-right border-left">
        <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="buscar.php?busqueda=<? echo $tag1?>&Submit=Buscar"><? echo $tag1?></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link submenu" href="buscar.php?busqueda=<? echo $tag2?>&Submit=Buscar"><? echo $tag2?></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link submenu" href="buscar.php?busqueda=<? echo $tag3?>&Submit=Buscar"><? echo $tag3?></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link submenu" href="buscar.php?busqueda=<? echo $tag4?>&Submit=Buscar"><? echo $tag4?></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link submenu" href="buscar.php?busqueda=<? echo $tag5?>&Submit=Buscar"><? echo $tag5?></a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
<?} else {}
?>

<? if($funcion10 == 'si'){?>
<div class="container bg-light border-left border-right py-3">
    <div class="row mb-3">
        <div class="col-12 text-center p-0 d-flex justify-content-center align-items-center" style="height:150px;background-image:url('https://www.argentina.gob.ar/sites/default/files/styles/jumbotron/public/2020-header-web-coronavirus-2.jpg?itok=mn2bHUNt');">
            <a class="stretched-link" href="https://www.argentina.gob.ar/salud/coronavirus-COVID-19" target="_blank">
                <h2>MÁS INFORMACIÓN SOBRE COVID-19</h2>
            </a>
        </div>
        <div class="col-12 d-flex justify-content-center" style="background-color:red;">

            <div class="container-fluid p-0">
                <div class="row">
                    <div class="col-6 col-md-3 ">
                        <ul style="list-style:none;padding:0;">
                            <li style="list-style:none;text-align:center;"><p style="color:#ffffff;">Fecha</p></li>
                            <li style="list-style:none;text-align:center;"><h2 class="colorTitulo info" style="color:#ffffff;"></h2></li>
                        </ul>
                    </div>
                    <div class="col-6 col-md-3 ">
                        <ul style="list-style:none;padding:0;">
                            <li style="list-style:none;text-align:center;"><p style="color:#ffffff;">Contagios</p></li>
                            <li style="list-style:none;text-align:center;"><h2 class="colorTitulo info2" style="color:#ffffff;"></h2></li>
                        </ul>
                    </div>
                    <div class="col-6 col-md-3 ">
                        <ul style="list-style:none;padding:0;">
                            <li style="list-style:none;text-align:center;"><p style="color:#ffffff;">Recuperados</p></li>
                            <li style="list-style:none;text-align:center;"><h2 class="colorTitulo info4" style="color:#ffffff;"></h2></li>
                        </ul>
                    </div>
                    <div class="col-6 col-md-3 ">
                        <ul style="list-style:none;padding:0;">
                            <li style="list-style:none;text-align:center;"><p style="color:#ffffff;">Muertes</p></li>
                            <li style="list-style:none;text-align:center;"><h2 class="colorTitulo info3" style="color:#ffffff;"></h2></li>
                        </ul>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
<?} else {} ?>

<script>
fetch("https://pomber.github.io/covid19/timeseries.json")
.then(response => response.json())
.then(data => {
    let yi = data["Argentina"].reverse();
    const str = yi[0].date;
    const words = str.split('-');
    $('.info').text(words[2]+'-'+words[1]+'-'+words[0]);
    $('.info2').text(yi[0].confirmed);
    $('.info3').text(yi[0].deaths);
    $('.info4').text(yi[0].recovered);
});
</script>

<!-- boton de whatsapp -->
<? if ($whatsapp == '') {} else { ?>
    <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>
<? } ?>