<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">var mapapropiedades;
var marcadores_propiedad = new Array();
var map;
var posActual;
var posActualRoute;
var posProyecto;
$(document).ready(function () {

    //////////////////
    $.fancybox.defaults.toolbar = "false";
    $.fancybox.defaults.infobar = "false";

    $('.linkgaleria').fancybox({
        'toolbar' : false,
        'infobar' : false,
    });

    

    $("#ver-proyecto .ctn-info .infor-proyecto .infor").hover(function () {
        $(this).find(".ctn-oculto").slideDown();
    }, function () {
        $(this).find(".ctn-oculto").slideUp();
    });
    
    //Eventos
    $("#ver-proyecto .ctn-descargar a").click(function(){
        gtag('event', 'descargainfo', { 'event_category': 'herramienta', 'event_label': 'proyecto-'+$("#idproyectoajax").val()+"-"+$("#tituloproyectoesc").val(), 'value': '2'});
    });
    
    $(".modal .modal-dialog .modal-content .modal-body .ctn-form button").click(function(){
        gtag('event', 'enviar-descargarinfo', { 'event_category': 'prospecto', 'event_label': 'proyecto-'+$("#idproyectoajax").val()+"-"+$("#tituloproyectoesc").val(), 'value': '5'});
    });
    
    $("#contact-lateral .form .ctn-btn button").click(function(){
        gtag('event', 'enviar-contactoproyecto', { 'event_category': 'prospecto', 'event_label': 'proyecto-'+$("#idproyectoajax").val()+"-"+$("#tituloproyectoesc").val(), 'value': '5'});
    });
    
    $("#ver-proyecto .btn-calculadora").click(function(){
        gtag('event', 'calculadora', { 'event_category': 'herramienta', 'event_label': 'proyecto-'+$("#idproyectoajax").val()+"-"+$("#tituloproyectoesc").val(), 'value': '2'});
    });
    
    $("#modalcalc .modal-body .ctn-btn button").click(function(){
        gtag('event', 'calcular', { 'event_category': 'herramienta', 'event_label': 'proyecto-'+$("#idproyectoajax").val()+"-"+$("#tituloproyectoesc").val(), 'value': '2'});
    });
    
    $("#ver-proyecto .btn-disponibilidad").click(function(){
        gtag('event', 'disponibilidad', { 'event_category': 'herramienta', 'event_label': 'proyecto-'+$("#idproyectoajax").val()+"-"+$("#tituloproyectoesc").val(), 'value': '2'});
    });
    
    
    



    $(".ctn-btn-form .btn-form, #desplegar_usuario_contacto").click(function (e) {
        e.preventDefault();
//                $(this).hide();
        $("#ver-proyecto .ctn-info-dos, #ver-proyecto .ctn-info-dos.ctn-fixed").show();

    });

    $("#ver-proyecto .ctn-info-dos .ctn-close span").click(function () {
        $("#ver-proyecto .ctn-info-dos, #ver-proyecto .ctn-info-dos.ctn-fixed").hide();
    });


    $(".navbar-toggle").click(function () {
        $("#sidenav").slideDown("slow");
    });


    $(".btn_desplazamiento:not(.btn_precios)").click(function (e) {
        e.preventDefault();

        var destino_desplazamiento = $(this).data("destino");

        $('html, body').animate({scrollTop: $("." + destino_desplazamiento).offset().top - 80}, 'slow');

    });


    $(".btn-close-menu").click(function () {
        $("#sidenav").slideUp("slow");
    });

    $("#header #sidenav .ul-menu li:nth-child(2) a:not(.dropdown-toggle)").click(function () {
        $("#sidenav").slideUp("slow");
    });



    $(this).scroll(function () {
//                $alto = ($("#header").height())+($(".ctn-slide-proyecto").height());

        if ($(this).scrollTop() &gt; 0) {
            if (!$("#header").hasClass("navbar-fixed-top")) {
                $("#header").addClass("navbar-fixed-top");
                $("#header .ctn-header-inf").addClass("ctn-fixed");
            }
        } else {
            $("#header").removeClass("navbar-fixed-top");
            $("#header .ctn-header-inf").removeClass("ctn-fixed");
        }
    });
//            $(".relleno").css("display" ,"none!important");
    $("#ver-proyecto .opciones .justy").addClass("css");
    $(this).scroll(function () {
        var alto = $(".ctn-slide-proyecto").height() + $("#ver-proyecto .opciones").height() + $("#header").height();

        if ($(this).scrollTop() &gt;= alto) {
            $("#ver-proyecto .opciones .justy").removeClass("css");
            $("#ver-proyecto .opciones .logo-scroll").show();
            $("#header").hide();
            // if (!$("#ver-proyecto .ctn-opciones").hasClass("fixed")) {
            //     $("#ver-proyecto .ctn-opciones").addClass("fixed");
            // }
            // if ($(window).width() &lt; 991) {
            //     $("#ver-proyecto .ctn-opciones .opciones").hide();
            // }


        } else {
            $("#ver-proyecto .opciones .logo-scroll").hide();
            // $("#ver-proyecto .ctn-opciones").css("top", "0");
            $("#ver-proyecto .opciones .justy").addClass("css");

            $("#header").show();
            // $("#ver-proyecto .ctn-opciones").removeClass("fixed");
            // $("#ver-proyecto .ctn-opciones").show();
            // $("#ver-proyecto .ctn-opciones .opciones").show();
        }
    });

    $(this).scroll(function () {
        var lheader = ($("#header").height()) + ($(".ctn-slide-proyecto").height()) + ($(".ctn-descargar").height()) + 60;
        if ($(this).scrollTop() &gt; lheader) {
            if (!$(".ctn-info-dos").hasClass("ctn-fixed")) {
                $(".ctn-info-dos").addClass("ctn-fixed");
            }
        } else {

            $(".ctn-info-dos").removeClass("ctn-fixed");
        }
    });




    $("#header .menu-ppal .navbar-default .menu_visible li a").hover(function () {
        $("#header .menu-ppal .navbar-default .menu_visible li a").addClass("hover");
        $(this).removeClass("hover");
    }, function () {
        $("#header .menu-ppal .navbar-default .menu_visible li a").removeClass("hover");
    });

    $("#ver-proyecto .opciones .ul-opciones li a").click(function () {
        $("#ver-proyecto .opciones .ul-opciones li a").removeClass("hover");
        $(this).addClass("hover");
    });
    $("#mostrar-opciones").click(function () {

        // if ($("#ver-proyecto .ctn-opciones").hasClass("fixed")) {
        //     if (!$(".fixed .opciones").is(":visible")) {
        //         $(".fixed .opciones").slideDown('slow');
        //     } else {
        //         $(".fixed .opciones").slideUp('slow');
        //     }
        // }


    });




    $(window).resize(function () {
        $("#ver-proyecto .opciones .ul-opciones li a").click(function () {

            windowsizeproyecto = $(window).width();
            if (windowsizeproyecto &lt; 991) {
                //if the window is greater than 440px wide then turn on jScrollPane..
                $(".fixed .opciones").slideUp('slow');
            }
            ;
        });
    });

    $("#slide-proyecto").owlCarousel({
        nav: true,
        items: 1,
        navText: [
            "&lt;i class=' icon-keyboard_arrow_left'&gt;&lt;/i&gt;",
            "&lt;i class=' icon-keyboard_arrow_right'&gt;&lt;/i&gt;",
        ],
        dots: true,
        margin: 0,
        lazyLoad: false,
    });

    $("#slide-ubicacion").owlCarousel({
        nav: true,
        items: 1,
        navText: [
            "&lt;i class=' icon-keyboard_arrow_left'&gt;&lt;/i&gt;",
            "&lt;i class=' icon-keyboard_arrow_right'&gt;&lt;/i&gt;",
        ],
        dots: true,
        margin: 0,
        lazyLoad: false,
    });

    $("#slide-urbanismo").owlCarousel({
        nav: true,
        items: 1,
        navText: [
            "&lt;i class=' icon-keyboard_arrow_left'&gt;&lt;/i&gt;",
            "&lt;i class=' icon-keyboard_arrow_right'&gt;&lt;/i&gt;",
        ],
        dots: true,
        margin: 0,
        lazyLoad: false,
    });




    $(".slide-proyecto:not(#slide-plantas, #slide-formapago)").owlCarousel({
        nav: true,
        dots: true,
        margin: 5,
        navText: [
            "&lt;i class=' icon-keyboard_arrow_left'&gt;&lt;/i&gt;",
            "&lt;i class=' icon-keyboard_arrow_right'&gt;&lt;/i&gt;",
        ],
        lazyLoad: false,
        items: 1,
        loop: true,
        autoplay: true,
        autoplayHoverPause: true
    });

    $("#slide-plantas").owlCarousel({
        nav: true,
        dots: true,
        margin: 5,
        navText: [
            "&lt;i class=' icon-keyboard_arrow_left'&gt;&lt;/i&gt;",
            "&lt;i class=' icon-keyboard_arrow_right'&gt;&lt;/i&gt;",
        ],
        lazyLoad: false,
        items: 2,
        loop: true,
        autoplay: true,
        autoplayHoverPause: true,
        center: true,
    });

    $("#slide-formapago").owlCarousel({
        nav: false,
        dots: true,
        margin: 5,
        lazyLoad: false,
        responsive: {
            0: {
                items: 1,
            },
            480: {
                items: 2,
            },

            767: {
                items: 3,
            },
            991: {
                items: 4
            },
            1200: {
                items: 5
            }
        }
    });
    





    //////////////////////





    $(".btn-recorrido").click(function () {
        var url = $(this).data("url");
        $("#ctn-iframe-recorrido").find("iframe").attr("src", url);

    });




    $('.scroll-pane').jScrollPane();

    $('#slide-img').owlCarousel({
        items: 1,
        scrollBar: true,
        loop: true,
        nav: true,
        dots: false,
        lazyLoad: true,
        center: false,
        navText: [
            "&lt;img src='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/left-slide-arrow.png' srcset='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/2x/left-slide-arrow.png 2x'/&gt;",
            "&lt;img src='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/right-slide-arrow.png' srcset='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/2x/right-slide-arrow.png 2x'/&gt;"
        ]

    });

//    $('#proyecto-detalle #categoria4 .owl-carousel').on('refreshed.owl.carousel', function(){
//        $("#proyecto-detalle .ctn-mapa").height($("#proyecto-detalle .ctn-detalle-proyecto #categoria4 .item .img-responsive").height());
//    })

    $('#proyecto-detalle .owl-carousel').owlCarousel({
        items: 1,
        scrollBar: true,
        loop: true,
        nav: true,
        dots: false,
        lazyLoad: true,
        center: false,
        navText: [
            "&lt;img src='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/left-slide-arrow.png' srcset='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/2x/left-slide-arrow.png 2x'/&gt;",
            "&lt;img src='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/right-slide-arrow.png' srcset='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/2x/right-slide-arrow.png 2x'/&gt;"
        ]

    });

    $('#slide-proyectos').owlCarousel({
        items: 4,
        scrollBar: true,
        loop: true,
        nav: true,
        dots: false,
        lazyLoad: true,
        center: false,
        navText: [
            "&lt;img src='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/flecha-izq-slide.png' srcset='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/2x/flecha-izq-slide.png 2x'/&gt;",
            "&lt;img src='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/flecha-der-slide.png' srcset='" + _RUTA + "/Imagenes/Sistema/sitio-nuevo/2x/flecha-der-slide.png 2x'/&gt;"
        ],
        responsive: {
            320: {
                items: 2
            },
            480: {
                items: 3
            },
            768: {
                items: 3
            },
            992: {
                items: 4
            }
        }
    });

    $('input[type="radio"],input[type="checkbox"]').iCheck({
        checkboxClass: 'icheckbox_minimal',
        radioClass: 'iradio_minimal',
        increaseArea: '20%' // optional
    });

    $('#proyecto-detalle .ctn-share').click(function () {
        $(this).hide();
        $(".ctn-share-widget").show();
        return false;
    })

    $("#modal-infoproyecto .btn-enviar").click(function () {

        var correo = $("#email_Proyecto").val()
        var cedula = $("#cedula_Proyecto").val()
        var aceptocondiciones = $("#aceptocondiciones_Proyecto").is(":checked");
        var idproyecto = $("#idproyecto_modal").val();

        $.ajax({
            type: "POST",
            dataType: "json",
            url: _RUTA + "/Proyecto.php",
            data: "op=RegistroDetalle&amp;noheaders=all&amp;correo=" + correo + "&amp;aceptocondiciones=" + aceptocondiciones + "&amp;cedula=" + cedula + "&amp;idproyecto=" + idproyecto,
            error: function (xhr, ajaxOptions, thrownError) {
                alert(thrownError);
            },
            success: function (datos) {
                if (datos.resultado == "confirmacion") {
                    $("#link-descarga").html(datos.html_enlace);
                    window.location.href = $('#link-descarga').find('a').attr("href");
                    $("#modal-infoproyecto").modal("hide");
                } else {
                    alert(datos.mensajeajax);
                }
            }
        });

        return false;
    });

    $("#proyectos .numero-proyectos, #proyectos-mapa-lista .ctn-numero-proyectos").click(function () {
        var sectorfiltro = $(this).data("sectorfiltro");
        $("#sectorfiltro").val(sectorfiltro);
        $("#filtrosReporte").submit();
    });

    //$("#proyecto-detalle .ctn-detalle-proyecto .tab-pane").css("min-height",$("#proyecto-detalle .ctn-detalle-proyecto .tab-pane.active").height());


    $(".menu-detalle li a").click(function () {
        $(".menu-detalle li a").removeClass('item-detalle-sel');
        $(this).addClass('item-detalle-sel');

        var total = $('.ctn-detalle-proyecto .menu-detalle li:visible').size();
        var index = $(this).closest('li').index();
        if (index == 0)
            $('.ctn-detalle-proyecto .prev-next .ant').hide();
        else
            $('.ctn-detalle-proyecto .prev-next .ant').show();

        if (index == (total - 1))
            $('.ctn-detalle-proyecto .prev-next .sig').hide();
        else
            $('.ctn-detalle-proyecto .prev-next .sig').show();

    });

    $('#proyecto-detalle .ctn-detalle-proyecto .prev-next .ant').hide();

    $('#proyecto-detalle .ctn-detalle-proyecto .prev-next .ant').click(function () {
        var activo = $('.ctn-detalle-proyecto .menu-detalle li.active');
        var ant = activo.prev('li');
        if (ant.length &gt; 0)
            $('a', ant).click();

        //var total = $('.ctn-detalle-proyecto .menu-detalle li:visible').size();
        var indexAnt = ant.index();
        if (indexAnt == 0)
            $(this).hide();

        $('.ctn-detalle-proyecto .prev-next .sig').show();

        return false;
    })

    $('#proyecto-detalle .ctn-detalle-proyecto .prev-next .sig').click(function () {
        var activo = $('.ctn-detalle-proyecto .menu-detalle li.active');
        var sig = activo.next('li');
        if (sig.length &gt; 0)
            $('a', sig).click();

        var total = $('.ctn-detalle-proyecto .menu-detalle li:visible').size();
        var indexSig = sig.index();
        if (indexSig == (total - 1))
            $(this).hide();

        $('.ctn-detalle-proyecto .prev-next .ant').show();

        return false;
    });

    if ($("#cedula_Proyecto").length &gt; 0) {
        if ($("#cedula_Proyecto").val().trim().length &gt; 0) {
            ExisteContactoProyecto($("#cedula").val().trim());
        }
    }

//    if($("#cedula_Proyecto").length &gt; 0){
//        if($("#cedula_Proyecto").val().trim().length &gt; 0){
//            ValidarContactoExisteProyecto($("#cedula_Proyecto").val().trim());
//        }
//
//        $(".btn-proyecto-info").click(function (){
//           ValidarContactoExisteProyecto($("#cedula_Proyecto").val().trim());
//        });
//    }

    $("#cedula_Proyecto").blur(function () {
        ExisteContactoProyecto($(this).val());
    });

//    $("#cedula_Proyecto").blur(function() {
//        ValidarContactoExisteProyecto($(this).val());
//    });
//
    $('#modal-mapahorarios').on('shown.bs.modal', function () {
        initMapHorario();
    });
//
    if ($('#ver-proyecto').length &gt; 0) {
        initMap();
        
        
        
        
        
        
    }

//    $('#modal-mapaproyecto').on('shown.bs.modal', function () {
//        initMap();
//      })

    if ($('#proyectos-mapa-lista').length &gt; 0) {
        iniciarMapaProyectos();
    }


    var owlVideo = $('#carousel-videos').owlCarousel({
        nav: true,
        items: 1,
        navText: ['&lt;img src="'+_RUTA+'/Imagenes/Sistema/home_2021/arrow-left.png" alt="" class="img-responsive"&gt;', '&lt;img src="'+_RUTA+'/Imagenes/Sistema/home_2021/arrow-right.png" alt="" class="img-responsive"&gt;',],
        dots: false,
        margin: 0,
        loop: true,
        lazyLoad: false,
        autoplay: false
    });
    
    owlVideo.on('translated.owl.carousel', function(event) {
        //$("#carousel-videos .owl-item .item-video .playerIframe").html("");
        
        let codigo = $("#carousel-videos .owl-item.active .item-video .playerIframe").data("codigo");
        let tipovideo = $("#carousel-videos .owl-item.active .item-video .playerIframe").data("tipo");
        
        console.log("codigo video", codigo);
        console.log("tipo video", codigo);
        
        

        if(tipovideo == "vimeo"){  
            /// control para video en Vimeo
            var iframe_vimeo = $('#carousel-videos .owl-item.active .item-video .playerIframe');
            var player_vimeo = new Vimeo.Player(iframe_vimeo);
    
        }
        else if(tipovideo == "youtube"){
            
            console.log("entro al cargar el video");

            if($("#carousel-videos .owl-item.active .item-video iframe").length ==0){
                //console.log("carga de video");

                //$("#carousel-videos .owl-item.active .item-video .playerIframe").html(`&lt;div id="player_${codigo}"&gt;&lt;/div&gt;`);

                //onYouTubePlayerAPIReady()

                CargarVideoHome();

            }
    
        }



    });


    CargarVideoHome();

    // $("#slide-videos").revolution({
    //     sliderType:"carousel",
    //     sliderLayout:"auto",
    //     delay:5000,
    //     navigation: {
    //         keyboardNavigation:"off",
    //         keyboard_direction: "horizontal",
    //         mouseScrollNavigation:"off",
    //         onHoverStop:"off",
    //         touch:{
    //                 touchenabled:"on",
    //                 swipe_threshold: 75,
    //                 swipe_min_touches: 1,
    //                 swipe_direction: "horizontal",
    //                 drag_block_vertical: false
    //         }
    //         ,
    //         arrows: {
    //                 style:"gyges",
    //                 enable:true,
    //                 hide_onmobile:false,
    //                 hide_onleave:false,
    //                 tmp:'',
    //                 left: {
    //                         h_align:"left",
    //                         v_align:"center",
    //                         h_offset:20,
    //                         v_offset:0
    //                 },
    //                 right: {
    //                         h_align:"right",
    //                         v_align:"center",
    //                         h_offset:20,
    //                         v_offset:0
    //                 }
    //         }
    //         ,
    //         tabs: {
    //                 style:"gyges",
    //                 enable:true,
    //                 width:250,
    //                 height:80,
    //                 min_width:250,
    //                 wrapper_padding:30,
    //                 wrapper_color:"#26292b",
    //                 wrapper_opacity:"1",
    //                 tmp:'&lt;div class="tp-tab-content"&gt;  &lt;span class="tp-tab-date"&gt;{{param1}}&lt;/span&gt;  &lt;span class="tp-tab-title"&gt;{{title}}&lt;/span&gt;&lt;/div&gt;&lt;div class="tp-tab-image"&gt;&lt;/div&gt;',
    //                 visibleAmount: 5,
    //                 hide_onmobile: false,
    //                 hide_onleave:false,
    //                 hide_delay:200,
    //                 direction:"horizontal",
    //                 span:true,
    //                 position:"outer-bottom",
    //                 space:0,
    //                 h_align:"center",
    //                 v_align:"bottom",
    //                 h_offset:0,
    //                 v_offset:0
    //         }
    //     },
    //     carousel: {
    //             horizontal_align: "center",
    //             vertical_align: "center",
    //             fadeout: "on",
    //             vary_fade: "on",
    //             maxVisibleItems: 3,
    //             infinity: "on",
    //             space: 0,
    //             stretch: "off"
    //     },
    //     gridwidth:720,
    //     gridheight:405,
    //     lazyType:"none",
    //     shadow:0,
    //     spinner:"off",
    //     stopLoop:"on",
    //     stopAfterLoops:0,
    //     stopAtSlide:1,
    //     shuffle:"off",
    //     autoHeight:"off",
    //     disableProgressBar:"on",
    //     hideThumbsOnMobile:"off",
    //     hideSliderAtLimit:0,
    //     hideCaptionAtLimit:0,
    //     hideAllCaptionAtLilmit:0,
    //     debugMode:false,
    //     fallbacks: {
    //             simplifyAll:"off",
    //             nextSlideOnWindowFocus:"off",
    //             disableFocusListener:false,
    //     }

    // });







});


var CargarVideoHome = () =&gt;{

    Cargando("","body");
    
    let codigoactual = $("#carousel-videos .owl-item.active .item-video .playerIframe").data("codigo");
    let idvideo = $("#carousel-videos .owl-item.active .item-video .playerIframe").data("idvideo");


    $.ajax({
        type: "POST",
        dataType: "json",
        url: _RUTA+"/Proyecto.php",
        cache: false,
        data: {
            op: "CargarVideoHome",
            noheaders: "all",
            codigoactual: codigoactual,
            idvideo: idvideo
        }
    }).done(function(datos){
        CerrarCargando();
        
        if(datos.tipomensaje == "Confirmacion"){

            console.log("listo el video id", idvideo);

            $(".owl-item.active .item-video .player_"+idvideo).html(datos.video);
        }
       

    }).fail(function(xhr,textstatus,textmesagge){
        CerrarCargando();
        alert("ajax error\n"+textstatus+": "+textmesagge);
        
    }).always(function(){
       
    }); 


}



function ExisteContactoProyecto(cedula)
{



    $("#nombre_Proyecto").val('');
    $("#apellido_Proyecto").val('');
    $("#telefono_Proyecto").val('');
    $("#email_Proyecto").val('');
    $("#pais_Proyecto").val('48');
    $("#ciudad_Proyecto").val('');
    $("#direccion_Proyecto").val('');

    if (cedula.trim().length == 0) {
        $("#existe_Proyecto").val("0");
        $(".datos-usuario-proyecto").hide();
        $(".nombre-completo-proyecto").hide();
        $(".nuevo-cliente-proyecto").hide();
    } else {

        Cargando("", "body");

        $.ajax({
            type: "POST",
            dataType: "json",
            url: _RUTA + "/contacto",
            data: "op=ExisteContactoProyecto&amp;noheaders=all&amp;cedula=" + cedula,
            error: function (xhr, ajaxOptions, thrownError) {
                CerrarCargando();
                alert(thrownError);
            },
            success: function (datos) {
                if (datos.resultado) {
                    $(".nuevo-cliente-proyecto").hide();
                    $("#nombre_Proyecto").val(datos.nombrecontacto);
                    $("#apellido_Proyecto").val(datos.apellidocontacto);
                    $("#email_Proyecto").val(datos.email);
                    $(".nombre-completo-proyecto").html(datos.html_infocontacto);

                    $(".nombre-completo-proyecto").fadeIn();

                    $("#modificar-contactoProyecto").click(function () {
                        $(".datos-usuario-proyecto").fadeIn();
                    });

//                    $("&lt;p&gt;Tus datos ya estan registrados&lt;/p&gt;").dialog();
                    $("#existe_Proyecto").val("1");

                    if (datos.enviarinformacion == "1")
                    {
                        $("#aceptocondiciones_Proyecto").attr('checked', 'checked');
                    } else
                    {
                        $("#aceptocondiciones_Proyecto").removeAttr('checked');
                    }
                } else {
                    $(".datos-usuario-proyecto").show();
                    $(".nuevo-cliente-proyecto").show();
                    $("#existe_Proyecto").val("0");
                }
                CerrarCargando();

            }
        });
    }

}




function initMapHorario() {
    var map;
    var position = new google.maps.LatLng(parseFloat($("#latitudubicacionhorario").val()), parseFloat($("#longitudubicacionhorario").val())),
            map = new google.maps.Map(document.getElementById('maphorario'), {
                center: position,
                zoom: 13
            });

    var marker = new google.maps.Marker({
        position: position,
        map: map,
        icon: _RUTA + "/Imagenes/Sistema/sitio-nuevo/icon-marker.png"
    });

//    var html_proyecto ='&lt;div class="col-xs-12 no-padd-l no-padd-r item-proyecto item-interna"&gt;\n\
//                            &lt;div class="col-xs-12 no-padd-l no-padd-r link-hover"&gt;\n\
//                                &lt;div class="col-xs-12 logo-proyecto"&gt;\n\
//                                    &lt;a href="#"&gt;&lt;img class="img-responsive" src="'+_RUTA+'/Imagenes/Sistema/sitio-nuevo/BORRAR-proyecto-mapa.png"/&gt;&lt;/a&gt;\n\
//                                &lt;/div&gt;\n\
//                            &lt;/div&gt;\n\
//                        &lt;/div&gt;\n\
//                        ';


//    var infowindow = new google.maps.InfoWindow({
//        content: '&lt;div class="hook"&gt;'+html_proyecto+'&lt;/div&gt;'
//    });

//    marker.addListener('click', function() {
//        infowindow.open(map, marker);
//    });

//    google.maps.event.addListener(infowindow, 'domready', function() {
//        var l = $(".hook").parent().parent().parent().siblings().find("div").eq(2).next();
//
//        for (var i = 0; i &lt; l.length; i++) {
//            if($(l[i]).css('z-index') == 'auto') {
//                $(l[i]).addClass("globo-mapa");
//            }
//        }
//
//        var flecha_mapa_izq = $(".hook").parent().parent().parent().siblings().find("div").eq(2).find("div").eq(0).find("div");
//        for (var i = 0; i &lt; flecha_mapa_izq.length; i++) {
//            if($(flecha_mapa_izq[i]).css('z-index') == 'auto') {
//                $(flecha_mapa_izq[i]).addClass("flecha-mapa-izq");
//            }
//        }
//
//        var flecha_mapa_der = $(".hook").parent().parent().parent().siblings().find("div").eq(2).find("div").next().find("div").addClass("listo")
//        for (var i = 0; i &lt; flecha_mapa_der.length; i++) {
//            if($(flecha_mapa_der[i]).css('z-index') == 'auto') {
//                $(flecha_mapa_der[i]).addClass("flecha-mapa-der");
//            }
//        }
//    });
}

function initMap() {
    
//    posProyecto = {lat: $("#latitudubicacionproyecto").val(), lng: parseFloat($("#longitudubicacionproyecto").val())};
    
    var position = new google.maps.LatLng(parseFloat($("#latitudubicacionproyecto").val()), parseFloat($("#longitudubicacionproyecto").val()));
            
           posProyecto =  position;
            
            map = new google.maps.Map(document.getElementById('mapproyecto'), {
                center: position,
                zoom: 13
            });

    var marker = new google.maps.Marker({
        position: position,
        map: map,
        icon: _RUTA + "/Imagenes/Sistema/sitio-nuevo/icon-marker.png"
    });

//     $(".btn-llegar").click(function(){
        
//         if (navigator.geolocation) {
//             navigator.geolocation.getCurrentPosition(function (position) {
//                 posActual = {
//                     lat: parseFloat(position.coords.latitude),
//                     lng: parseFloat(position.coords.longitude)
//                 };
                
//                 posActualRoute = new google.maps.LatLng(parseFloat(position.coords.latitude), parseFloat(position.coords.longitude));

//                 //map.setCenter(new google.maps.LatLng(pos));

//                 var marker = new google.maps.Marker({
//                     position: posActual,

//                     map: map,
//                     title: 'Tu ubicación actual'
//                 });
                
                
// //                console.log("Obtenida ubicacion")


//                 var ventanainfo_actual = new google.maps.InfoWindow({
//                     content: 'Tu ubicación actual'
//                 });

//                 marker.addListener('click', function () {
//                     ventanainfo_actual.open(map, marker);
//                 });

//                dibujarRuta();

//             },
//             function(){

//             });
//         }
//         else
//         {

//         }
        
//     });


    
        









//    var html_proyecto ='&lt;div class="col-xs-12 no-padd-l no-padd-r item-proyecto item-interna"&gt;\n\
//                            &lt;div class="col-xs-12 no-padd-l no-padd-r link-hover"&gt;\n\
//                                &lt;div class="col-xs-12 logo-proyecto"&gt;\n\
//                                    &lt;a href="#"&gt;&lt;img class="img-responsive" src="'+_RUTA+'/Imagenes/Sistema/sitio-nuevo/BORRAR-proyecto-mapa.png"/&gt;&lt;/a&gt;\n\
//                                &lt;/div&gt;\n\
//                            &lt;/div&gt;\n\
//                        &lt;/div&gt;\n\
//                        ';


//    var infowindow = new google.maps.InfoWindow({
//        content: '&lt;div class="hook"&gt;'+html_proyecto+'&lt;/div&gt;'
//    });

//    marker.addListener('click', function() {
//        infowindow.open(map, marker);
//    });

//    google.maps.event.addListener(infowindow, 'domready', function() {
//        var l = $(".hook").parent().parent().parent().siblings().find("div").eq(2).next();
//
//        for (var i = 0; i &lt; l.length; i++) {
//            if($(l[i]).css('z-index') == 'auto') {
//                $(l[i]).addClass("globo-mapa");
//            }
//        }
//
//        var flecha_mapa_izq = $(".hook").parent().parent().parent().siblings().find("div").eq(2).find("div").eq(0).find("div");
//        for (var i = 0; i &lt; flecha_mapa_izq.length; i++) {
//            if($(flecha_mapa_izq[i]).css('z-index') == 'auto') {
//                $(flecha_mapa_izq[i]).addClass("flecha-mapa-izq");
//            }
//        }
//
//        var flecha_mapa_der = $(".hook").parent().parent().parent().siblings().find("div").eq(2).find("div").next().find("div").addClass("listo")
//        for (var i = 0; i &lt; flecha_mapa_der.length; i++) {
//            if($(flecha_mapa_der[i]).css('z-index') == 'auto') {
//                $(flecha_mapa_der[i]).addClass("flecha-mapa-der");
//            }
//        }
//    });
}


function dibujarRuta(){
  
    let directionsService = new google.maps.DirectionsService();
    let directionsRenderer = new google.maps.DirectionsRenderer({suppressMarkers: true});
    directionsRenderer.setMap(map); // Existing map object displays directions

    // Create route from existing points used for markers
    const route = {
        origin: posActual,
        destination: posProyecto,
        travelMode: 'DRIVING'
    }

    directionsService.route(route,
            function (response, status) { // anonymous function to capture directions
                if (status !== 'OK') {
                    window.alert('Directions request failed due to ' + status);
                    return;
                } else {
                    directionsRenderer.setDirections(response); // Add route to the map
                    var directionsData = response.routes[0].legs[0]; // Get data about the mapped route
                    if (!directionsData) {
                        window.alert('Directions request failed');
                        return;
                    } else {

                        console.log("exito");

//                        sumarTotalDistancia(response)
//                        dibujarMarcadores();
                    }
                }
            });


    
    
}



function initMap1() {
    var map;
    var position = {lat: 4.8047743, lng: -75.7312711};
    var position2 = {lat: 4.8178152, lng: -75.7061555};

    map = new google.maps.Map(document.getElementById('map'), {
        center: position,
        zoom: 13
    });

    var marker = new google.maps.Marker({
        position: position,
        map: map,
        icon: _RUTA + "/Imagenes/Sistema/sitio-nuevo/icon-marker.png"
    });

    var marker2 = new google.maps.Marker({
        position: position2,
        map: map,
        icon: _RUTA + "/Imagenes/Sistema/sitio-nuevo/icon-marker.png"
    });

    var html_proyecto = '&lt;div class="col-xs-12 no-padd-l no-padd-r item-proyecto"&gt;\n\
                        &lt;div class="col-xs-12 no-padd-l no-padd-r link-hover"&gt;\n\
                            &lt;div class="col-xs-12 logo-proyecto"&gt;\n\
                                &lt;a href="#"&gt;&lt;img class="img-responsive" src="' + _RUTA + '/Imagenes/Sistema/sitio-nuevo/BORRAR-proyecto-mapa.png"/&gt;&lt;/a&gt;\n\
                            &lt;/div&gt;\n\
                            &lt;div class="col-xs-12 no-padd-l no-padd-r ctn-txt"&gt;\n\
                            &lt;h2 class="col-xs-12"&gt;Casas 60m2&lt;/h2&gt;\n\
                            &lt;div class="ctn-label col-xs-12"&gt;\n\
                                &lt;label&gt;Desde $ &lt;span&gt;134`900.000&lt;/span&gt;&lt;/label&gt;\n\
                            &lt;/div&gt;\n\
                            &lt;a href="proyectos/mirador-de-villavento/32" class="col-xs-12"&gt;Click para ver detalles&lt;/a&gt;\n\
                        &lt;/div&gt;\n\
                        &lt;/div&gt;\n\
                        &lt;/div&gt;\n\
';


    var infowindow = new google.maps.InfoWindow({
        content: '&lt;div class="hook"&gt;' + html_proyecto + '&lt;/div&gt;'
    });

    marker.addListener('click', function () {
        infowindow.open(map, marker);
    });

    marker2.addListener('click', function () {
        infowindow.open(map, marker2);
    });

    google.maps.event.addListener(infowindow, 'domready', function () {
        var l = $("#hook").parent().parent().parent().siblings().find("div").eq(2).next();

        for (var i = 0; i &lt; l.length; i++) {
            if ($(l[i]).css('z-index') == 'auto') {
                $(l[i]).addClass("globo-mapa");
            }
        }

        var flecha_mapa_izq = $("#hook").parent().parent().parent().siblings().find("div").eq(2).find("div").eq(0).find("div");
        for (var i = 0; i &lt; flecha_mapa_izq.length; i++) {
            if ($(flecha_mapa_izq[i]).css('z-index') == 'auto') {
                $(flecha_mapa_izq[i]).addClass("flecha-mapa-izq");
            }
        }

        var flecha_mapa_der = $("#hook").parent().parent().parent().siblings().find("div").eq(2).find("div").next().find("div").addClass("listo")
        for (var i = 0; i &lt; flecha_mapa_der.length; i++) {
            if ($(flecha_mapa_der[i]).css('z-index') == 'auto') {
                $(flecha_mapa_der[i]).addClass("flecha-mapa-der");
            }
        }
    });
}

function iniciarMapaProyectos()
{
    var sectorfiltro = $("#sectorfiltro").val();
    mapapropiedades = new google.maps.Map(document.getElementById('map'), {
        center: new google.maps.LatLng(parseFloat($("#latitudubicacion").val()), parseFloat($("#longitudubicacion").val())),
        zoom: 13
    });


    Mensaje("Cargando...")
    $.ajax({
        type: "POST",
        dataType: "json",
        url: "Proyecto.php?op=JsonCoordenadasProyectos&amp;noheaders=all",
        cache: false,
        data: "sectorfiltro=" + sectorfiltro,
        success: function (datos) {
            CerrarMensaje(0);

            for (i in datos) {
                var propiedad = datos[i];

                var position = {lat: parseFloat(propiedad.latitud), lng: parseFloat(propiedad.longitud)};

                var marker = new google.maps.Marker({
                    position: position,
                    map: mapapropiedades,
                    icon: _RUTA + "/Imagenes/Sistema/sitio-nuevo/icon-marker.png"
                });

                var contentString = propiedad.tag

                var infowindow = new google.maps.InfoWindow({
                    content: contentString
                });

//                var idpunto = parseInt(propiedad.idpunto);
                var idpunto = propiedad.idpunto;
                marcadores_propiedad[idpunto] = {marcador: marker, ventana: infowindow};

                google.maps.event.addListener(marker, 'mouseover', MostrarTooltipPropiedad(infowindow, marker));
                google.maps.event.addListener(marker, 'mouseoout', OcultarTooltipPropiedad(infowindow, marker));

                google.maps.event.addListener(infowindow, 'domready', function () {
                    var l = $(".hook").parent().parent().parent().siblings().find("div").eq(2).next();

                    for (var i = 0; i &lt; l.length; i++) {
                        if ($(l[i]).css('z-index') == 'auto') {
                            $(l[i]).addClass("globo-mapa");
                        }
                    }

                    var flecha_mapa_izq = $(".hook").parent().parent().parent().siblings().find("div").eq(2).find("div").eq(0).find("div");
                    for (var i = 0; i &lt; flecha_mapa_izq.length; i++) {
                        if ($(flecha_mapa_izq[i]).css('z-index') == 'auto') {
                            $(flecha_mapa_izq[i]).addClass("flecha-mapa-izq");
                        }
                    }

                    var flecha_mapa_der = $(".hook").parent().parent().parent().siblings().find("div").eq(2).find("div").next().find("div").addClass("listo")
                    for (var i = 0; i &lt; flecha_mapa_der.length; i++) {
                        if ($(flecha_mapa_der[i]).css('z-index') == 'auto') {
                            $(flecha_mapa_der[i]).addClass("flecha-mapa-der");
                        }
                    }
                });


            }

        }
    });
}

function MostrarTooltipPropiedad(infowindow, marker)
{
    return function () {
        CerrarTodosTooltips()
        infowindow.open(mapapropiedades, marker);
    };
}

function OcultarTooltipPropiedad(infowindow, marker)
{
    return function () {
        infowindow.close(mapapropiedades, marker);
    };
}

function CerrarTodosTooltips()
{
    for (i in marcadores_propiedad)
    {
        marcadores_propiedad[i].ventana.close(mapapropiedades, marcadores_propiedad[i].marcador);
    }
}


</pre></body></html>