﻿
/* ---------------------------------------------------------------------------------- */
/* ----- Functies: onLoad ----------------------------------------------------------- */
/* ---------------------------------------------------------------------------------- */

$(document).ready(function() {
    if ($.isFunction($.fn.lightbox)) {
        $("a[rel*='lightbox']").lightbox();
    }

    $('.share').click(function() {
        $('.send-overlay').fadeIn();
        $('.send-overlay-content').fadeIn();
        return false;
    });

    $('.send-overlay-content .close').click(function() {
        $('.send-overlay').fadeOut();
        $('.send-overlay-content').fadeOut();

        return false;
    });

    bindInputEvents("#ctl00_naam", "Uw naam",false);
    bindInputEvents("#ctl00_email", "E-mailadres", false);

});


/* ---------------------------------------------------------------------------------- */
/* ----- Functies: Algemeen --------------------------------------------------------- */
/* ---------------------------------------------------------------------------------- */

// Input-elementen voorzien van blur en focus events om standaard-tekst te tonen/verbergen
function bindInputEvents(inputElement, defaultValue, overruleVal) {
  if (overruleVal == true) {
    $(inputElement).val(defaultValue);
  }
  $(inputElement).bind("focus", function (e) {
    if (this.value == defaultValue) $(this).val("").addClass("active");
  }).bind("blur", function (e) {
    if (this.value == "") $(this).val(defaultValue).removeClass("active");
  });
}

function changeDestination(strLongLat) {
    if(strLongLat != ""){
        document.getElementById('tbx_route_van').value = strLongLat;
        var arrLongLat = strLongLat.split(", ")
        map = new GMap2(document.getElementById('googlemap'));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(arrLongLat[0], arrLongLat[1]), 14, G_NORMAL_MAP);
        var poolMarker = new GMarker(new GLatLng(arrLongLat[0], arrLongLat[1]));
        //poolMarker.bindInfoWindowHtml('<div class="marker" style="width:300px;height:115px;display:block;"><span class=\x27titel\x27>Ping Persoonlijk fincancieel advies<\/span><div><i>Bezoekadres:<\/i><br/>Werkplein, Tesselschadestraat 33-35<br/>Leeuwarden<br/>Telefoon: 06 125 81 075<br/><\/div><span id=\x27toonbeschrijving\x27>Routebeschrijving: <a href=\x22javascript:void(null);\x22 onclick=\x22document.getElementById(\x27route_straat\x27).focus();\x22>Hier naartoe<\/a><\/span><div class=\x27spacer\x27><\/div><div style=\x27width:300px;line-height:1px;height:1px;\x27>&nbsp;<\/div><\/div>');
        map.addOverlay(poolMarker);
    }
}
