﻿
// Login tonen na klik op login-balkje
function toonLogin() {
  $("#site").animate({ width: "916" }, 400);
  $("#login_breed").animate({ width: "9" }, 10);
  $("#login_smal").attr({ style: "display: none" });
  $("#login_breed").attr({ style: "display: block" });
  $("#login_breed").animate({ width: "136" }, 400);
};

// Login verbergen na klik op sluit-knop
function verbergLogin() {
  $("#site").animate({ width: "810" }, 300);
  //$("#login_breed").animate({ width: "9" }, 400);
  
  $("#login_smal").attr({ style: "display: block" });
  $("#login_breed").attr({ style: "display: none" });
};


// Algemene functie voor selectie op css-klasse
getElementsByClassName = function(el, cl) {
  var retnode = [];
  var myclass = new RegExp('\\b' + cl + '\\b');
  var elem = el.getElementsByTagName('*');
  for (var i = 0; i < elem.length; i++) {
    var classes = elem[i].className;
    if (myclass.test(classes)) retnode.push(elem[i]);
  }
  return retnode;
};


// Blokken voorzien van gelijke hoogte
function fixHoogte(blok1, padding1, blok2, padding2) {
  if (document.getElementById(blok1) && document.getElementById(blok2)) {
    var hoogte1 = getElementsByClassName(document.getElementById(blok1), "panel_inner")[0].offsetHeight - padding1;
    var hoogte2 = getElementsByClassName(document.getElementById(blok2), "panel_inner")[0].offsetHeight - padding2;
    var maxHoogte = Math.max(hoogte1, hoogte2);
    getElementsByClassName(document.getElementById(blok1), "panel_inner")[0].style.minHeight = maxHoogte + "px";
    getElementsByClassName(document.getElementById(blok2), "panel_inner")[0].style.minHeight = maxHoogte + Math.abs(padding1 - padding2) + "px";
  }
}
function playerStopped()
{
  jQuery('.jcarousel-container-horizontal [@id^="caseflashplayer"]').html("");
}

function casescarousel_initCallback(carousel) {
  jQuery('#casescontrol a').bind('click', function() {
    jQuery('.jcarousel-container-horizontal [@id^="caseflashplayer"]').html('');
    carousel.startAuto();
    carousel.scroll(jQuery.jcarousel.intval(jQuery(this).attr("title")));
    jQuery('.jcarousel-container-horizontal [@id^="caseflashplayer"]').bind('click', function() {
      carousel.stopAuto();
      jQuery(this).unbind("click");
      jQuery(jQuery(this)).flash(null, { version: 9 }, function(htmlOptions) {
					var params = jQuery(this).attr('id').split(':');
						htmlOptions.src = '/interface/flash/player2.swf';
					if(params.length > 3) 
					{
					  htmlOptions.src = params[3];  
					}				
					var img = '';
					if(params.length > 2)
					{
					  img = params[2];  
					}
					if(img == '')
					{
					  img = 'case0videobg.jpg';
					}
					htmlOptions.flashvars.debug = false;
					htmlOptions.flashvars.autoplay = true;
					htmlOptions.flashvars.image = img;
					htmlOptions.flashvars.video = params[1];
					htmlOptions.width = 467;
					htmlOptions.height = 274;
					//htmlOptions.allowFullscreen = 'true';
					//htmlOptions.wmode = 'transparent';
					htmlOptions.allowScriptAccess = 'always';			
					jQuery(this).innerHTML = '<div class="alt">'+jQuery(this).innerHTML+'</div>';
					jQuery(this).addClass('flash-replaced').prepend(jQuery.fn.flash.transform(htmlOptions));
				});
    return false;
  });
    return false;
  });

   jQuery('.jcarousel-container-horizontal [@id^="caseflashplayer"]').bind('click', function() {
    carousel.stopAuto();
    jQuery(this).unbind("click");
     jQuery(jQuery(this)).flash(null, { version: 9 }, function(htmlOptions) {
        carousel.stopAuto();
					var params = jQuery(this).attr('id').split(':');
						htmlOptions.src = '/interface/flash/player.swf';
					if(params.length > 3) 
					{
					  htmlOptions.src = params[3];  
					}				
					var img = '';
					if(params.length > 2)
					{
					  img = params[2];  
					}
					if(img == '')
					{
					  img = 'case0videobg.jpg';
					}
					htmlOptions.flashvars.debug = false;
					htmlOptions.flashvars.autoplay = true;
					htmlOptions.flashvars.image = img;
					htmlOptions.flashvars.video = params[1];
					htmlOptions.width = 467;
					htmlOptions.height = 274;
					//htmlOptions.allowFullscreen = 'true';
					//htmlOptions.wmode = 'transparent';
					htmlOptions.allowScriptAccess = 'always';			
					jQuery(this).innerHTML = '<div class="alt">'+jQuery(this).innerHTML+'</div>';
					jQuery(this).addClass('flash-replaced').prepend(jQuery.fn.flash.transform(htmlOptions));
				});
    return false;
  });
 
};

function casesoverzichtcarousel_initCallback(carousel) {
  carousel.options.size = Math.ceil(carousel.options.size / 2);
};

function itemVisibleIn(carousel, li, index, state) {
  $("#casescontrol #case" + index).addClass('puntjecurrent');
}

function itemVisibleOut(carousel, li, index, state) {
  $("#casescontrol #case" + index).removeClass('puntjecurrent');
}
function laadFilmpje(strFilm,divId)
{
   car.stopAuto();

}

// Functies uitvoeren na inladen van de DOM
jQuery(document).ready(function() {
  if(blnVideo == false){
    // Blokken voorzien van gelijke hoogte
    try{
      fixHoogte("content", 39, "login", 20);
    }catch(e){}
  }
  try{
    getElementsByClassName(document.getElementById("login"), "panel_inner")[0].style.height = (document.getElementById("medewerkers").offsetHeight-19)+"px";
  }catch(e){}
  // Jcarousel home initialiseren
  jQuery('#nieuws_home_inner').jcarousel({
    scroll: 2,
    vertical: true
  });

  // Jcarousel vacatures initialiseren
  jQuery('#vacature_overzicht_inner').jcarousel({
    scroll: 3,
    vertical: true
  });
    // Jcarousel cases initialiseren
  var casesoverzicht = jQuery('#cases_overzicht').jcarousel({
    initCallback: casesoverzichtcarousel_initCallback,
    scroll: 3,
    start:Math.floor(scrollto/2),
    vertical: true
  });
  
  // Jcarousel case-afbeeldingen initialiseren
  car = jQuery('#cases_afbeeldingen').jcarousel({
    initCallback: casescarousel_initCallback,
    itemVisibleInCallback: itemVisibleIn,
    itemVisibleOutCallback: itemVisibleOut,
    scroll: 1,
    auto:4,
    wrap: 'both',
    vertical: false
  });
  $('[@id^="flashplayer"]').flash(null, { version: 9 }, function(htmlOptions) {
					var $this = $(this);
					var params = $this.attr('id').split(':');
					htmlOptions.src = '/interface/flash/vosenlibert_player.swf';
					var img = '';
					if(params.length > 2)
					{
					  img = params[2];  
					}
					if(img == '')
					{
					  img = 'videobg.jpg';
					}
					htmlOptions.flashvars.image = img;
					htmlOptions.flashvars.video = params[1];
					htmlOptions.width = 370;
					htmlOptions.height = 372;
					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));
				});
				   try{
      document.getElementById('cases_afbeeldingen').style.visibility='visible';
      document.getElementById('cases_afbeeldingen').style.overflow='';
      document.getElementById('cases_afbeeldingen').style.height='';
         
      document.getElementById('cases_overzicht').style.visibility='visible';
      document.getElementById('cases_overzicht').style.overflow='';
      document.getElementById('cases_overzicht').style.height='';
       }catch(e){}
      try{
        document.getElementById('vlist').style.visibility='visible';
        document.getElementById('vlist').style.overflow='visible';
        document.getElementById('vlist').style.height='auto';
      }catch(e){}

});

function unhide(elid, el) {
 var eldiv = document.getElementById(elid);
 if (eldiv) {
   eldiv.style.display = "inline";
   el.style.display = "none";
 }
}
function textFieldFocus(object,defaultValue) {
  if (object.value == defaultValue) {
    object.value = "";
  }
}

function textFieldBlur(object,defaultValue) {
  if (object.value == "") {
    object.value = defaultValue;
  }
}
function selectMedewerker(el)
{
  $("#medewerkers .medewerker").removeClass("active");
  $(el).addClass("active");
}