﻿
/* ---------------------------------------------------------------------------------- */
/* ----- Functies: onLoad ----------------------------------------------------------- */
/* ---------------------------------------------------------------------------------- */

$(document).ready(function() {
  // Lightbox activeren
  $("a[rel^='lightbox']").lightbox();

  // Popup overlay doorzichtig maken
  $("#overlay_ruis").css({ opacity: 0.75 }).height($(document).height());
});


/* ---------------------------------------------------------------------------------- */
/* ----- Functies: Algemeen --------------------------------------------------------- */
/* ---------------------------------------------------------------------------------- */

// Servicemenu tonen/verbergen
function toggleServiceMenu(evt){
  if (!evt) {
    var evt = window.event;
  }
  if (document.getElementById("service_dropdown").style.display != 'block'){
    document.getElementById("service_dropdown").style.display='block';
    evt.cancelBubble = true;
    document.body.onclick = toggleServiceMenu;
    return false;
  } else {
    document.getElementById("service_dropdown").style.display='none';
    document.body.onclick = null;
    return true;
  }
}

// Standaard-tekst in een veld verbergen on focus
function textFieldFocus(object,defaultValue) {
  object.className = "text_focus";
  if (object.value == defaultValue) {
    object.value = "";
  }
}

// Standaard-tekst in een veld tonen on blur
function textFieldBlur(object,defaultValue) {
  object.className = "text";
  if (object.value == "") {
    object.value = defaultValue;
  }
}


/* ---------------------------------------------------------------------------------- */
/* ----- Functies: Actie Ruis van de Buis ------------------------------------------- */
/* ---------------------------------------------------------------------------------- */

// Gewenste popup tonen, anders alle popups verbergen
function togglePopup(popupId) {
  if (popupId) {
    if ($("#" + popupId + ":hidden").length > 0 && $("#overlay_ruis:hidden").length > 0) {
      $("html, body").scrollTop(0);
      $("#overlay_ruis").height($(document).height());
      $("#overlay_ruis").fadeIn(300, function() { $("#" + popupId).show() });
    } else {
      $("#" + popupId).hide();
      $("#overlay_ruis").fadeOut(300);
    }
  }
}
