<?php require_once("../connection/conn_marseille.php");

session_start();    

function limpa($word, $nChar=999) {

$word = substr($word, 0, $nChar);

$word = strip_tags($word);
$word = addslashes($word);
$word = trim($word);
$word = htmlspecialchars($word);

return $word;	
}
	

function pegaTopo($config){

if(!$_SESSION['m4rseillecl1']){
$sqlgeral       =       mysql_fetch_array(mysql_query("SELECT * FROM tb_geral WHERE pagina = 'geral'"));

$_SESSION['m4rseillecl1']     = array("geral_email" => $sqlgeral['email'], "geral_texto" => $sqlgeral['texto_empresa'], "geral_missao" => $sqlgeral['missao'], "geral_visao" => $sqlgeral['visao'], "geral_valores" => $sqlgeral['valores'], "geral_telefone" => $sqlgeral['telefone'], "geral_telefone2" => $sqlgeral['telefone_2'], "geral_fachada" => $sqlgeral['foto_fachada'], "geral_obras" => $sqlgeral['obras'], "texto_parceiros" => $sqlgeral['texto_parceiros'], "texto_projetos" => $sqlgeral['texto_projetos']);
}


//$_SESSION['M4rseille']++;

?>

<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta name="description" content="<?php echo $config["description"] ?>" />
    <?php if($config["og_title"] == true){?>
    <meta property="og:title" content="<?php echo $config["og_title"] ?>" />
    <meta property="og:type" content="product" />
    <meta property="og:url" content="<?php echo $config["og_url"] ?>" />
    <meta property="og:image" content="<?php echo $config["og_imagem"] ?>" />
    <meta property="og:description" content="<?php echo $config["og_desc"] ?>" />
    <meta property="og:site_name" content="Marseille Arq e Decor" />
    <?php }
    if($config["canonical"] == true){?>
    <link rel="canonical" href="<?php echo $config["canonical"] ?>" />
    <?php } ?>
    <meta name="distributor" content="Global">
    <meta name="rating" content="General">
    <meta name="robots" content="INDEX, FOLLOW" />
    <title><?php echo $config["title"] ?></title>
    <link rel="icon" href="<?php echo HOST ?>images/favicon.png" type="image/x-icon" />
    <link rel="apple-touch-icon-precomposed" href="meu-touch-icon-precomposed.png" />
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link rel="stylesheet" media="screen and (max-width: 768px)" href="<?php echo HOST ?>css/style-mobile.css?v=<?php echo filemtime("css/style-mobile.css"); ?>" />
    <link rel="stylesheet" media="screen and (min-width: 769px)" href="<?php echo HOST ?>css/style.css?v=<?php echo filemtime("css/style.css"); ?>" />
    <link href="<?php echo HOST ?>css/modal.css" rel="stylesheet">
    <link rel="icon" href="<?php echo HOST ?>images/favicon.png" type="image/x-icon" />
    <style type="text/css">
  @font-face{font-family:'Josefin Sans';font-style:normal;font-weight:200;font-display:swap;src:url(https://fonts.gstatic.com/s/josefinsans/v15/Qw3aZQNVED7rKGKxtqIqX5EUA3x4RHw.woff2) format('woff2');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Josefin Sans';font-style:normal;font-weight:200;font-display:swap;src:url(https://fonts.gstatic.com/s/josefinsans/v15/Qw3aZQNVED7rKGKxtqIqX5EUDXx4.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:'Josefin Sans';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/josefinsans/v15/Qw3aZQNVED7rKGKxtqIqX5EUA3x4RHw.woff2) format('woff2');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Josefin Sans';font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/josefinsans/v15/Qw3aZQNVED7rKGKxtqIqX5EUDXx4.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
  @font-face{font-family:'Josefin Sans';font-style:normal;font-weight:300;src:url(https://fonts.gstatic.com/s/josefinsans/v15/Qw3PZQNVED7rKGKxtqIqX5E-AVSJrOCfjY46_GbQbMhhLzTs.woff2) format('woff2');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:'Josefin Sans';font-style:normal;font-weight:300;src:url(https://fonts.gstatic.com/s/josefinsans/v15/Qw3PZQNVED7rKGKxtqIqX5E-AVSJrOCfjY46_GbQbMZhLw.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
    </style>
</head>

<body class="<?php echo $config["pag"] ?>">
	
    <header id="header">
        <div class="content-align">


            <div id="menu-mobile">

                <input type="checkbox" id="control-nav" />
                    <label for="control-nav" class="control-nav"></label>
                    <label for="control-nav" class="control-nav-close"></label>
                    
                    <nav>
                        <a href="<?php echo HOST ?>" title="Marseille Arq. e Décor"><img src="<?php echo HOST ?>images/logo-marseille.png" alt="Marseille Arq. e Déco" id="logo" /></a>
                        <ul class="ulmenu">

                            <li><a href="<?php echo HOST ?>sobre/" title="Sobre nós">Sobre nós</a></li>
                            <li><a href="<?php echo HOST ?>projetos/" title="Projetos">Projetos</a></li>
                            <li><a href="<?php echo HOST ?>contato/" title="Contato">Contato</a></li>
                            <li><a href="<?php echo HOST ?>parceiros/" title="Parceiros">Parceiros</a></li>

                        <?php

                        function categoryTreeM($filiacao = 0){


                           if($filiacao > 0){
                            $cpl        = ", nome";
                           } else { $cpl = "";}

                           $selectmenu  =   mysql_query("SELECT * FROM tb_categoria WHERE filiacao = $filiacao AND status = 1 AND menu = 1 ORDER BY ordem $cpl ASC");
                           
                           if(mysql_num_rows($selectmenu) > 0){
                            if($filiacao > 0){
                                $nivelcat = "";
                            echo "<ul>";
                            } else{

                                $nivelcat = "mcat";
                            }
                            $e=0;
                            while($sqlmenu = mysql_fetch_array($selectmenu)){


                                echo '<li><a class="'.$nivelcat.'" href="'.HOST.'c/'.$sqlmenu['url_seo'].'">'.$sqlmenu['nome'].'</a>';
                                    categoryTreeM($sqlmenu['cod']);
                                    echo '</li>';
                              
                                
                            
                            }

                            if($filiacao > 0){
                            
                            echo "</ul>";
                            }

                            }      
                        }

                        categoryTreeM(); 

                        ?>
                    </ul>

                </nav>

                

            </div>

            <a href="<?php echo HOST ?>" title="Marseille Arq e Decor"><img src="<?php echo HOST ?>images/logo-marseille.png" alt="Marseille Arq e Decor" id="logo" /></a>

         <label for="open-mobile">
                    <div class="fa-mobile" onClick="onClick();"><img src="<?php echo HOST ?>images/lupa.png" id="icon-busca" alt="Buscar"></div>
            </label>
                  

            <form action="<?php echo HOST ?>categoria.php" method="get" id="formbuscamobile">
                
              <input type="checkbox" id="open-mobile">
              
              <input type="search" name="search" id="search_data" autocomplete="off" placeholder="Nome ou código" />

            </form>

            <div id="menu">

                <nav id="nav-1">

                    <ul>

                        <li><a href="<?php echo HOST ?>sobre/" title="Sobre nós">Sobre nós</a></li>
                        <li><a href="<?php echo HOST ?>projetos/" title="Projetos">Projetos</a></li>
                        <li><a href="<?php echo HOST ?>contato/" title="Contato">Contato</a></li>
                        <li><a href="<?php echo HOST ?>parceiros/" title="Parceiros">Parceiros</a></li>

                    </ul>

                </nav>

                <nav id="nav-2">

                    <ul>

                        <?php

                        function categoryTree($filiacao = 0){


                           $selectmenu  =   mysql_query("SELECT * FROM tb_categoria WHERE filiacao = $filiacao AND status = 1 AND menu = 1 ORDER BY ordem ASC");
                           
                           if(mysql_num_rows($selectmenu) > 0){
                            if($filiacao > 0){
                            echo "<ul>";
                            }

                            while($sqlmenu = mysql_fetch_array($selectmenu)){


                                if($filiacao == 0) {
                                    if(isMobile()){
                                        if(mysql_num_rows($selectmenu) > 0){
                                        $url = "javascript:void(0);";
                                        } else {
                                            $url = HOST.'c/'.$sqlmenu['url_seo'];
                                        }
                                        } else {
                                            $url = HOST.'c/'.$sqlmenu['url_seo'];
                                        }
                                } else {
                                    $url = HOST.'c/'.$sqlmenu['url_seo'];
                                }

                                echo '<li><a href="'.$url.'">'.$sqlmenu['nome'].'</a>';
                                    categoryTree($sqlmenu['cod']);
                                    echo '</li>';
                                
                            
                            }

                            if($filiacao > 0){
                            echo "</ul>";
                            }
                            }      
                        }

                        categoryTree(); 

                        ?>


                    </ul>

                </nav>

                <form action="<?php echo HOST ?>categoria.php" method="get" id="formbusca">
                <label for="open">
                    <div class="fa"><img src="<?php echo HOST ?>images/lupa.png" id="icon-busca" alt="Buscar"></div>
                 </label>
                  
                  <input type="checkbox" id="open">
                  
                  <input type="search" name="search" id="search_data2" autocomplete="off" placeholder="Nome ou código" />

                </form>
                
            </div>
        </div>
    </header>
    
<?php 
	
}

function isMobile() {
    $is_mobile = false;

    //Se tiver em branco, não é mobile
    if ( empty($_SERVER['HTTP_USER_AGENT']) ) {
        $is_mobile = false;

    //Senão, se encontrar alguma das expressões abaixo, será mobile
    } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false
        || strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false
        || strpos($_SERVER['HTTP_USER_AGENT'], 'Silk/') !== false
        || strpos($_SERVER['HTTP_USER_AGENT'], 'Kindle') !== false
        || strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false
        || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false
        || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false ) {
            $is_mobile = true;

    //Senão encontrar nada, não será mobile
    } else {
        $is_mobile = false;
    }

    return $is_mobile;
}

function priceF($preco){
    //$preco = explode(".", $preco);
    //$preco = $preco[0];
    $preco = str_replace(".", ",", $preco);

    return $preco;
}

function pegaFooter(){ ?>

	
    
    <footer>

        <div id="newsletter">

            <div id="resposta_news"></div>

            <div class="content-align">

                <p>Acompanha nossas campanhas e novidades</p>

                <form action="" method="post" id="cadNews">

                    <input type="text" placeholder="Nome" name="nome_cli" required="" />

                    <input type="email" name="email_cli" placeholder="E-mail" required="" />

                    <input type="submit" name="enviar_newsletter" value="Cadastrar" id="salvar_news" />

                </form>

            </div>

        </div>

        <div class="content-align">

            <div class="items-rodape">

                <ul class="links-rodape">
                    <li><a href="<?php echo HOST ?>sobre-nos/" title="Sobre nós">Sobre nós</a> -</li>
                    <li><a href="<?php echo HOST ?>projetos/" title="Projetos">Projetos</a> -</li>
                    <li><a href="<?php echo HOST ?>contato/" title="Contato">Contato</a></li>
                </ul>

                <ul class="redes-sociais">
                    <li>Nos Siga</li>
                    <li><a href="https://www.instagram.com/marseillestudio" target="_blank"><img src="<?php echo HOST ?>images/icones/icon-instagram.png" alt="Instagram Marseille" /></a></li>
                    <li><a href="https://www.facebook.com/marseillestudio" target="_blank"><img src="<?php echo HOST ?>images/icones/icon-facebook.png" alt="Facebook Marseille" /></a></li>
                </ul>

                <ul class="metodos-pagamento">

                    <li>Aceitamos</li>
                    <li><img src="<?php echo HOST ?>images/icones/formas-de-pagamento.png" alt="Formas de Pagamentos aceitas: Dinheiro, Boleto e Cartão de Crédito" /></li>

                </ul>

            </div>

            <div class="info-rodape">

                <p class="email-rodape">E-mail: <a href="mailto:<?php echo $_SESSION['m4rseillecl1']['geral_email'] ?>"><?php echo $_SESSION['m4rseillecl1']['geral_email'] ?></a> | Telefone: <?php echo $_SESSION['m4rseillecl1']['geral_telefone2'] ?></p>

                <p class="empresa">Marseille Studio Arq. e Décor - CNPJ: 37.434.790/0001-23</p>

                <p class="rights">2020 © Todos os direitos reservados</p>

            </div>

            <div class="desenvolvedor">

                <p>Desenvolvedor:</p>

                <a href="https://www.julianoenning.com.br/" target="_blank"><img src="<?php echo HOST ?>images/logo-web-designer.jpg" alt="Desenvolvedor do Site: Julian Oenning" /></a>

            </div>

        </div>

    </footer>
    <div id="bt-whatsapp">
        <a href="https://api.whatsapp.com/send?phone=5554991021221&text=Ol%C3%A1!" target="_blank" onclick="gtag('event', 'Whatsapp', {  'event_category': 'Icones - Whatsapp',  'event_label': 'Flutuante Desktop' });"><img src="<?php echo HOST ?>images/bt-whatsapp2.png" alt="Whatsapp Marseille" /></a>
    </div>

    <div id="bt-whatsapp-mobile">
        <a href="https://api.whatsapp.com/send?phone=5554991021221&text=Ol%C3%A1!" target="_blank" onclick="gtag('event', 'Whatsapp', {  'event_category': 'Icones - Whatsapp',  'event_label': 'Flutuante Mobile' });"><img src="<?php echo HOST ?>images/bt-whatsapp-mobile.png" alt="Whatsapp Marseille" /></a>
    </div>

  
	<script type="text/javascript" src="<?php echo HOST ?>js/jquery-1.10.2.min.js"></script>

    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js"></script>


    <script type="text/javascript" language="javascript">

        $('#salvar_news').click(function() {
               
            var dados = $('#cadNews').serialize();

            $.ajax({
                type: 'POST',
                dataType: 'json',
                url: '<?php echo HOST ?>script/salvar_news.php',
                async: true,
                data: dados,
                success: function(response) {
                        if(response.status == 1){
                            $("#resposta_news").html(response.msg);
                            $('#resposta_news').fadeIn(500);
                        } else {
                            $("#resposta_news").html(response.msg);
                            $('#resposta_news').fadeIn(500);
                        }

                    },
                    error: function (request, status, error) {
                        alert(error);
                    }
            });

            return false;
        });

        $("#enviar_popup").click(function(){
            var email_cli = $("#emailPopup").val();
            if(email_cli == ""){
                alert("Preencha o e-mail corretamente");
                return false;
            } else {
                

                var dados = $('#popupForm').serialize();
                
                $.ajax({
                    type: 'POST',
                    dataType: 'json',
                    url: 'script/salvar_news.php',
                    async: true,
                    data: dados,
                    success: function(response) {
                        if(response.status == 1){
                            $(".response-popup").html("<p style='color:#008C46'><?php echo $sqlpopup['msg_agradecimento'] ?></p>");
                            $("#enviar_popup").css("display", "none");
                            $("#emailPopup").css("display", "none");
                            $('.response-popup').fadeIn(500);
                        } else {
                            $(".response-popup").html(response.msg);
                            $('.response-popup').fadeIn(500);
                        }

                    },
                    error: function (request, status, error) {
                        alert("Error!");
                    }
                });
                return false;
                
                //$('#myForm').submit();
            }
         });

         $('.fa-mobile').click(function() {
            $( "#formbuscamobile" ).toggle();
        });

        $(function () {
        $('#menu-mobile nav > ul > li a.mcat').click(function (e) {
             
            var $parentli = $(this).closest('li');
            $parentli.siblings('li').find('ul:visible').hide();
            $parentli.find('> ul').stop().slideToggle('slow');
            if($parentli.find('> ul').text()){
   
            e.preventDefault();
            e.stopPropagation();
            }
        });

        });
        $(document).click(function() {
            $("#menu-mobile nav ul li ul").hide();
        });
    </script>
    </script>

    <script>

        $(document).ready(function(){

            
            $("#search_data").autocomplete({

            source: "<?php echo HOST ?>script/autocomplete.php",
            minLength: 1,
            select: function(event, ui) {
                
            $("#search_data").val(ui.item.value);
            }
            }).data("ui-autocomplete")._renderItem = function( ul, item ) {
            return $( "<li class='ui-autocomplete-row'></li>" )
            .data( "item.autocomplete", item )
            .append( item.label )
            .appendTo( ul );
            };
            $("#search_data2").autocomplete({
            source: "<?php echo HOST ?>script/autocomplete.php",
            minLength: 1,
            select: function(event, ui) {
            $("#search_data2").val(ui.item.value);;
            }
            }).data("ui-autocomplete")._renderItem = function( ul, item ) {
            return $( "<li class='ui-autocomplete-row'></li>" )
            .data( "item.autocomplete", item )
            .append( item.label )
            .appendTo( ul );
            };
        });

         $(".fa").click(function(){
                setTimeout(function(){
                $("#search_data2").focus();
            });

            });


    </script>

    <script>

    $(document).ready(function() {
      $("#banner-principal").owlCarousel({
        autoPlay : 3000,
        stopOnHover : true,
        navigation:true,
        paginationSpeed : 1000,
        goToFirstSpeed : 2000,
        singleItem : true,
        autoHeight : true,
        transitionStyle:"fade"
      });

      $("#banner-linhas").owlCarousel({
        itemsDesktop : [1920,3],
          itemsDesktopSmall : [1199,3],
          itemsTablet : [899,3],
          itemsMobile : [599,2],
        autoPlay : 3000,
        stopOnHover : true,
        navigation:true,
        paginationSpeed : 1000,
        goToFirstSpeed : 2000
      });

     $("#depoimentos").owlCarousel({
         itemsDesktop : [1920,3],
          itemsDesktopSmall : [1199,3],
          itemsTablet : [899,3],
          itemsMobile : [599,1],
        autoPlay : 3000,
        stopOnHover : true,
        navigation:true,
        paginationSpeed : 1000,
        goToFirstSpeed : 2000
      });

     $("#nossas-marcas").owlCarousel({
        itemsDesktop : [1920,4],
          itemsDesktopSmall : [1199,4],
          itemsTablet : [899,3],
          itemsMobile : [599,2],
        autoPlay : 3000,
        stopOnHover : true,
        navigation:true,
        paginationSpeed : 1000,
        goToFirstSpeed : 2000
      });

     $("#fotos-projetos").owlCarousel({
        itemsDesktop : [1920,4],
          itemsDesktopSmall : [1199,3],
          itemsTablet : [899,3],
          itemsMobile : [599,2],
        autoPlay : 3000,
        stopOnHover : true,
        navigation:true,
        paginationSpeed : 1000,
        goToFirstSpeed : 2000
      });
     $("#fotos-produtos").owlCarousel({
        itemsDesktop : [1920,4],
          itemsDesktopSmall : [1199,4],
          itemsTablet : [899,4],
          itemsMobile : [599,4],
        autoPlay : 3000,
        stopOnHover : true,
        navigation:true,
        paginationSpeed : 1000,
        goToFirstSpeed : 2000,
         navigationText : ['<span><img src="<?php echo HOST ?>images/seta-voltar.png" /></span>','<span><img src="<?php echo HOST ?>images/seta-avancar.png" /></span>'],
      });
     $("#produtos-destaques").owlCarousel({
        itemsDesktop : [1920,4],
          itemsDesktopSmall : [1199,4],
          itemsTablet : [899,4],
          itemsMobile : [599,2],
        autoPlay : 3000,
        stopOnHover : true,
        navigation:true,
        paginationSpeed : 1000,
        goToFirstSpeed : 2000
      });


     

    });

    </script>

    
	<script type="text/javascript">
		/* Máscaras ER */
	function mascara(o,f){
		v_obj=o
		v_fun=f
		setTimeout("execmascara()",1)
	}
	function execmascara(){
		v_obj.value=v_fun(v_obj.value)
	}
	function mtel(v){
		v=v.replace(/\D/g,"");             //Remove tudo o que não é dígito
		v=v.replace(/^(\d{2})(\d)/g,"($1) $2"); //Coloca parênteses em volta dos dois primeiros dígitos
		v=v.replace(/(\d)(\d{4})$/,"$1-$2");    //Coloca hífen entre o quarto e o quinto dígitos
		return v;
	}
	function id( el ){
		return document.getElementById( el );
	}
	window.onload = function(){
		id('telefone').onkeyup = function(){
            mascara( this, mtel );
        }
        id('celular').onkeyup = function(){
            mascara( this, mtel );
        }
	}

    window.onscroll = function() {myFunction()};

        var navbar = document.getElementById("header");
        var sticky = navbar.offsetTop;

        function myFunction() {
          if (window.pageYOffset > sticky) {
            navbar.classList.add("fixed");
          } else {
            navbar.classList.remove("fixed");
          }
        }


function onClick() {

  // create invisible dummy input to receive the focus first
  const fakeInput = document.createElement('input')
  fakeInput.setAttribute('type', 'text')
  fakeInput.style.position = 'absolute'
  fakeInput.style.opacity = 0
  fakeInput.style.height = 0
  fakeInput.style.fontSize = '16px' // disable auto zoom

  // you may need to append to another element depending on the browser's auto 
  // zoom/scroll behavior
  document.body.prepend(fakeInput)

  // focus so that subsequent async focus will work
  fakeInput.focus()

  setTimeout(() => { 

    // now we can focus on the target input
    $("#search_data").focus()

    // cleanup
    fakeInput.remove()

  }, 10)

}


    
	</script>

    <script src="<?php echo HOST ?>js/gallery.js"></script>
    <script type="text/javascript" src="<?php echo HOST ?>js/lazy.js?v=2"></script>
    <script type="text/javascript" src="<?php echo HOST ?>js/modal.js"></script>

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-41159468-40"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'UA-41159468-40');
    </script>


	<?php } ?>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css">
