﻿
/* ---------------------------------------------------------------------------------- */
/* ----- Functies: onLoad ----------------------------------------------------------- */
/* ---------------------------------------------------------------------------------- */

$(document).ready(function() {
  // Lightbox activeren
  $("a[rel*=lightbox]").lightbox();
  $("#overlay").css({ "opacity": "0.6" });
  formtest = $().formtest($("#fbtnLink a"));
  $("a.linkedin-profileinsider-popup").attr("style", "")
  //setTimeout('$("a.linkedin-profileinsider-popup").attr("style", "")', 1000);

  // Carousel top activeren (indien meer dan 1 item)
  if ($("#carousel_top li").length > 1) {
    var deinnerfade2 = $('#carousel_top ul').innerFadePN({
      speed: 'normal',
      timeout: 7000,
      type: 'sequence',
      prevLink: '.carousel_prev',
      nextLink: '.carousel_next'
    }, "carousel_top");
  }
  /* // Carousels home activeren (indien meer dan 1 item)
  if ($("#carousel_home_1 li").length > 1) {
  $("#carousel_home_controls_1").parent().show();
  var deinnerfade = $('#carousel_home_1').innerfade({
  speed: 'normal',
  timeout: 80000,
  type: 'sequence',
  containerheight: '198px'
  }, null, "carousel_home_controls_1", "slide_1_");
  }
  // Home carousel 2
  if ($("#carousel_home_2 li").length > 1) {
  $("#carousel_home_controls_2").parent().show();
  var deinnerfade = $('#carousel_home_2').innerfade({
  speed: 'normal',
  timeout: 80000,
  type: 'sequence',
  containerheight: '198px'
  }, null, "carousel_home_controls_2", "slide_2_");
  }
  // Home carousel 3
  if ($("#carousel_home_3 li").length > 1) {
  $("#carousel_home_controls_3").parent().show();
  var deinnerfade = $('#carousel_home_3').innerfade({
  speed: 'normal',
  timeout: 80000,
  type: 'sequence',
  containerheight: '198px'
  }, null, "carousel_home_controls_3", "slide_3_");
  }*/

  // FAQ activeren
  $("#faq .question").bind("click", function(e) {
    $(this).parent().toggleClass("active");
    $(this).next(".answer").slideToggle(300)
  });
  $("#faq .answer").css({ "position": "static" }).hide();

  // Video activeren
  $('#top_inner .flashvideo').flash(null, { version: 9 }, function(htmlOptions) {
    var $this = $(this);
    var params = $this.attr('id').split(':');
    htmlOptions.src = '/interface/flash/player.swf';
    var img = '';
    if (params.length > 2) { img = params[2]; }
    if ($(this).find("img").attr("src")) { img = $(this).find("img").attr("src"); }
    htmlOptions.flashvars.image = img;
    htmlOptions.flashvars.url = $(this).find("a").attr("href");
    htmlOptions.flashvars.smoothing = 'true';
    htmlOptions.flashvars.autoplay = 'false';
    htmlOptions.flashvars.skin = 'false';
    htmlOptions.flashvars.fullscreen = 'false';
    htmlOptions.flashvars.scale = 'exactfit';
    htmlOptions.flashvars.centerBtn = 'true';
    htmlOptions.flashvars.maincolor = 'f8892b';
    htmlOptions.flashvars.gaEnabled = 'true';
    htmlOptions.flashvars.gaCode = 'UA-11659842-1';
    htmlOptions.flashvars.gaDebug = 'false';

    htmlOptions.width = 990;
    htmlOptions.height = 442;
    htmlOptions.allowFullscreen = 'true';
    htmlOptions.wmode = 'transparent';
    htmlOptions.allowScriptAccess = 'always';
    this.innerHTML = '<div class="alt">' + this.innerHTML + '</div>';
    $this.addClass('flash-replaced').prepend($.fn.flash.transform(htmlOptions));
  });
//  $("#main .video").flash(null, { version: 9 }, function(htmlOptions) {
//    var $this = $(this);
//    htmlOptions.src = '/interface/flash/player.swf';
//    htmlOptions.flashvars.image = $this.find("img").attr("src");
//    htmlOptions.flashvars.url = $this.find("span").text();
//    htmlOptions.width = 300;
//    htmlOptions.height = 200;
//    htmlOptions.allowFullscreen = 'true';
//    htmlOptions.flashvars.maincolor = 'f8892b';
//    htmlOptions.wmode = 'transparent';
//    htmlOptions.flashvars.debug = 'false'
//    htmlOptions.allowScriptAccess = 'always';
//    $this.html('');
//    $this.addClass('flash-replaced').prepend($.fn.flash.transform(htmlOptions));
//  });
  $("#main .video.onder").flash(null, { version: 9 }, function(htmlOptions) {
    var $this = $(this);
    htmlOptions.src = '/interface/flash/player.swf';
    htmlOptions.flashvars.image = $this.find("img").attr("src");
    htmlOptions.flashvars.url = $(this).find("a").attr("href");
    htmlOptions.width = 610;
    htmlOptions.height = 350;
    if ($(this).find("span.height").length > 0) {
      htmlOptions.height = $(this).find("span.height").text();
    }
    htmlOptions.allowFullscreen = 'true';
    htmlOptions.flashvars.maincolor = 'f8892b';
    htmlOptions.wmode = 'transparent';
    htmlOptions.flashvars.debug = 'false'
    htmlOptions.allowScriptAccess = 'always';
    $this.html('');
    $this.addClass('flash-replaced').prepend($.fn.flash.transform(htmlOptions));
  });
  $("#main .video.rechts").flash(null, { version: 9 }, function(htmlOptions) {
    var $this = $(this);
    htmlOptions.src = '/interface/flash/player.swf';
    htmlOptions.flashvars.image = $this.find("img").attr("src");
    htmlOptions.flashvars.url = $(this).find("a").attr("href");
    htmlOptions.flashvars.skin = 'false';
    htmlOptions.flashvars.centerBtn = 'true';
    htmlOptions.width = 300;
    htmlOptions.height = 200;
    if ($(this).find("span.height").length > 0) {
      htmlOptions.height = $(this).find("span.height").text();
    }
    htmlOptions.allowFullscreen = 'true';
    htmlOptions.flashvars.maincolor = 'f8892b';
    htmlOptions.wmode = 'transparent';
    htmlOptions.flashvars.debug = 'false'
    htmlOptions.allowScriptAccess = 'always';
    $this.html('');
    $this.addClass('flash-replaced').prepend($.fn.flash.transform(htmlOptions));
  });
});
var playing = false;
function animatemenu() {
   if ($("#top.video_active").height() > 304) {
      return false;
   }
  $("#nav").animate({ top: '-94px' }, { queue: false })

  $("#top.video_active").animate({ height: '442px' }, { queue: false })
  $("#searchbox").fadeOut(100);
  $("#logo").fadeOut(100);
//  if ($(".subactive").length > 0) {
//    $("#searchbox").animate({ top: '110px' }, { queue: false })
//    $("#logo").animate({ top: '110px' }, { queue: false })
//  } else {
//    $("#searchbox").animate({ top: '70px' }, { queue: false })
//    $("#logo").animate({ top: '70px' }, { queue: false })
//  }
}
function playVideo() {
  playing = true;
  animatemenu();
}

function closeVideo() {
  playing = false;
  animatemenuterug();
}

function animatemenuterug() {
  if ((playing == true) || ($("#top.video_active").height() < 442)) {
    return;
  }
  $("#nav").animate({ top: '0px' }, { queue: false })
  $("#searchbox").fadeIn(100);
  $("#logo").fadeIn(100);
//  $("#searchbox").animate({ top: '30px' }, { queue: false })
//  $("#logo").animate({ top: '30px' }, { queue: false })
  $("#top.video_active").animate({ height: '304px' }, { queue: false })
}
function animateopen() {
  $("#top.video_active").animate({ height: '442px' }, { queue: false })
}

//$('#top_inner').hover(function() { animateopen() }, function() { animatemenuterug() })
//$('#top_inner .flashvideo').click(function(){animatemenu();})


/* ---------------------------------------------------------------------------------- */
/* ----- Functies: Algemeen --------------------------------------------------------- */
/* ---------------------------------------------------------------------------------- */

// Standaard-tekst in input verbergen (onFocus)
function textFieldFocus(object, defaultValue) {
  if (object.value == defaultValue) {
    object.value = "";
  }
  object.className = "active";
}

// Standaard-tekst in input tonen (onBlur)
function textFieldBlur(object, defaultValue) {
  if (object.value == "") {
    object.value = defaultValue;
    object.className = "";
  }
}

// Zoekfunctie
function zoeken() {
  var inpZoek = document.getElementById('tbxSearch');
  var strZoek = inpZoek.value;
  if (strZoek.length > 0) {
    strZoek = escape(strZoek);
    strZoek = strZoek.replace(/ /g, '+').replace(/\%20/g, '+');
    document.location.href = "/pages/zoekresultaten.aspx?zoek=" + strZoek;
  }
}