/*Slide boxes homepage and chapters*/

$(document).ready(function(){
	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
	
	//Horizontal Sliding
	$('.boxgrid.slideright').hover(function(){
		$(".cover", this).stop().animate({left:'-245px'},{queue:false,duration:150,easing:'easeInSine'});
	}, function() {
		$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:750,easing:'easeInQuart'});
	});
	
});


/*Slide boxes homepage What Matters Most*/

$(document).ready(function(){
	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
	
	//Horizontal Sliding
	$('.boxgrid.slideright-small').hover(function(){
		$(".cover", this).stop().animate({left:'-190px'},{queue:false,duration:150,easing:'easeInSine'});
	}, function() {
		$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:750,easing:'easeInQuart'});
	});
	
});


//FAQ slide up and down content, 1 Zichtbaar!

	$(document).ready(function()

{

	//hide the all of the elements [div] within list and div with id 'faq'

	$('#faq > li > div').hide();

	
	//show div next to h3 when [h3]  is clicked 

	$('#faq h3').click(function()

    {

        //hide all divs

		$('#faq > li > div').slideUp('normal');

		//slide down the selected div

		$(this).next().slideToggle('fast');

	});

});







//News Home slide up and down content
// independently show and hide
$(document).ready(function() {
  $('.sIFR-alternate').css('display','none');
  $('dl#news-dl > dd').hide();
  $('dl#news-dl > dt').mouseover(function() {
	$(this).next('dd:hidden').slideDown('fast')
	.siblings('dd:visible').slideUp('slow');
	
  });
});

;

/*

Folks, addLoadEvent is a function made by Simon Willison that serves as a manageable window.onload replacement.  Jeremy Keith gave it a thumbs up in his book, DOM Scripting, and it's difficult to walk away from that book without incorporating it into every project.

*/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}


/*
	Copyright Robert Nyman, http://www.robertnyman.com
	Free to use if this text is included
	
	
Here's the function that allows us to retrieve elements by their class name, something that everyone wishes were part of JavaScript to begin with.  To read more about it, visit Robert Nyman's site.


*/
function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];		
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}	
	}
	return (arrReturnElements)
}

/*

Below are the functions that let me add and remove classes, which I'm using to get the hover effect.  "hovering" is the class that is added or removed, and you can see in the style sheet how .hovering is defined.


*/

function addClassName(oElm, strClassName){
	var strCurrentClass = oElm.className;
	if(!new RegExp(strClassName, "i").test(strCurrentClass)){
		oElm.className = strCurrentClass + ((strCurrentClass.length > 0)? " " : "") + strClassName;
	}
}


function removeClassName(oElm, strClassName){
	var oClassToRemove = new RegExp((strClassName + "\s?"), "i");
	oElm.className = oElm.className.replace(oClassToRemove, "").replace(/^\s?|\s?$/g, "");
}


/*

Here's the part I wrote that uses the functions above to create our "link boxes".

*/
/*Voor de pagina Links*/


function prepareBoxes() {
	var boxes = getElementsByClassName(document, "li", "aandacht");
	for (var i=0; i<boxes.length; i++){
		var fullstories = getElementsByClassName(document, "h4", "fullstory");
		for (var k=0; k<fullstories.length; k++){
			fullstories[k].parentNode.tabIndex = k+1;
			fullstories[k].style.display = "inline";
			fullstories[k].parentNode.onmouseover = function() {
				addClassName(this, "hovering");
			}
			fullstories[k].parentNode.onmouseout = function() {
				removeClassName(this, "hovering");
			}
			fullstories[k].parentNode.onclick = function() {
				var destin = this.getElementsByTagName("a");
				window.location = destin[0].href;
			}
			fullstories[k].parentNode.onkeypress = fullstories[k].parentNode.onclick;
		}
	}
}
addLoadEvent(prepareBoxes);

/*Easy Slider Business Principles*/

		$(document).ready(function(){
			
	
			
			// Slider op BP
			$("#slider-bp").easySlider({
				loop: true,
				auto: true,
				orientation: 'fade',  //slide ed
				easing: 'cross',   // linear
				autoplayDuration: 3300,
        autogeneratePagination: false,
				restartDuration: null,
				pauseable: false,
				pauseButtons: false,
				controlsShow: false
			});
			
		});

		



	/*Tabs*/

		
	
	
	jQuery(document).ready(function() {

       $('.tab_content').hide();

       $(".htabs a,.tabs a.more").click(function() {
           stringref = $(this).attr("href").split('#')[1];
           if (stringref == 'overview') {
               $('.tab').show();
               $('.tab_content').hide();
               $('a.more').show();
           } else {
               $('.tab').hide();
               $('.tab#' + stringref).show();
               $('.tab#' + stringref + '_content').show();
               $('a.more').hide();
           }
				$(".tabblad").removeClass("active");
           	$(".tabblad#htab_" + stringref).addClass("active"); 
           return false;
       });

   }); 
   /*Grote foto's employee zone*/
  //$(document).ready(function(){

        // Hide all large images except the first one
      //  $('#ez-home img').hide().filter(':first').show();

        // Select all thumb links
      //  $('#list-ezhome a').hover(function(event) {

                // Hide all large images except for the one with the same hash as our thumb link
             //   $('#ez-home img').hide().filter(this.hash).show();
          //  },
           // function () {$('#ez-home img').hide().filter(':first').fadeIn('normal');} // Because the hover method has a mouseout state we need to define too
     //   );
   // });

/*slider met navigatie op Employee Zone*/

	$(document).ready(function(){	
			$("#slider").easySlider({
				auto: false, 
				continuous: true,
				controlsShow: true
			});
		});	




	// initialise plugins
	    $(document).ready(function() { 
		// Preload all rollovers
		$(".content_staff a").children(".slideimg_on").fadeTo(0, 0);

		$(".content_staff a").mouseover(function(){
			$(this).children(".slideimg").fadeTo(500, 0);
			$(this).children(".slideimg_on").fadeTo(500, 1);
			
		});
		$(".content_staff a").mouseout(function(){
			$(this).children(".slideimg").fadeTo(500, 1);
			$(this).children(".slideimg_on").fadeTo(500, 0);
	
			
		});
	
		
			
   }); 
	 
   
   /*Tooltip*/
   /*
   $(function() {

// select all desired input fields and attach tooltips to them 

 $(".content_staff ,a").tooltip({

    // place tooltip on the right edge 
   position: ['center', 'right'], 
 
    // a little tweaking of the position 
   offset: [-2, 10], 
 
    // use a simple show/hide effect 
   effect: 'toggle', 
     
   // custom opacity setting 
   opacity: 0.7 
   });
   });
   */


