
/* ------------------------------------------------------------------ */
/* --- Functies: onLoad --------------------------------------------- */
/* ------------------------------------------------------------------ */

$(document).ready(function() {
  // Lightbox activeren
  $(".lightbox").lightbox();

  /* Beursschmea laten in en uitklappen */
  $("#beursoverzicht h3").bind("click", function(e) {
    $("#beursoverzicht .item.active .detail").not($(this).nextAll(".detail")).slideUp(300);
    $("#beursoverzicht .item.active").not($(this).parent()).removeClass("active");
    $(this).parent().toggleClass("active");
    $(this).nextAll(".detail").slideToggle(300);
  });
  $("#beursoverzicht .item:not(.active) .detail").css({ "position": "static" }).hide();
//  $("#beursoverzicht h3").bind("mouseout", function(e) {
//    $(this).parent().removeClass("active");
//    $(this).nextAll(".detail").slideUp(300);
//  });
  /* Nieuws-carousel op home activeren */
  var deinnerfade = $('#nieuws_carousel').innerfade({
    speed: 'slow',
    timeout: 9000,
    type: 'sequence',
    containerheight: '211px'
  });
  var rand_no = Math.floor((5)*Math.random());

  $("#el" + rand_no).click();
  

  // Veelgestelde vragen (faq) initialiseren (indien aanwezig)
  $("#faq .antwoord").css({ "position": "absolute", "left": "-9001px" });
  $("#faq .show").css({ "position": "absolute", "left": "0px" });
  
//  $('.formulier .button a').each(function() {
//    if (this && typeof(this.click) == 'undefined') {
//      this.click = function() {  
//        var result = true;
//        if (this.onclick) result = this.onclick();
//        if (typeof(result) == 'undefined' || result) {
//            eval(this.getAttribute('href'));
//        }
//      }
//    }  
//  });
});


function changePic(srcPic, srcPG){
    var imgHoofd = document.getElementById('imgTonen');
    var laagPG = document.getElementById('divPG')   
    imgHoofd.src = srcPic
    
    if (srcPG != ''){
      laagPG.style.display = 'block';
      laagPG.innerHTML = "<a style='font-size: 11px;font-weight: bold; ' href='/upload/" + srcPG + "' class='lightbox-enabled' onclick='$(this).lightbox({start:true,events:false}); return false;'>Bekijk de plattegrond</a>"
     }else{
      laagPG.style.display = 'none';
    }
  }
  
  function changeKlant(srcPic, srcPG, strVan){
    var imgHoofd = document.getElementById('imgKlant');
    var laagKlant = document.getElementById('divKlant')   
    imgHoofd.src = srcPic
    
    if (srcPG != ''){
      laagKlant.style.display = 'block';
      laagKlant.innerHTML = "<a style='font-size: 11px;font-weight: bold; ' href='" + srcPG + "'>Bekijk de ervaring van: " + strVan + "</a>"
     }else{
      laagKlant.style.display = 'none';
    }
  }


/* ------------------------------------------------------------------ */
/* --- Functies: Algemeen ------------------------------------------- */
/* ------------------------------------------------------------------ */

function ToggleDoorstuurformulier() {
  $('#doorsturen_outer').toggle();
}


/* ------------------------------------------------------------------ */
/* --- Functies: Veelgestelde Vragen (faq) -------------------------- */
/* ------------------------------------------------------------------ */

function toggleFaqAntwoord(object) {
  $(object).toggleClass("vraag_actief");
  if ($(object).next().css("position") == "absolute") {
    $(object).next().css("display", "none");
    $(object).next().css("position", "static");
  }
  $(object).next().slideToggle(200);
}

