// Functie om het contentVlak de juiste hoogte te geven, en daarna de 
// scrollbar op het blok toe te passen indien nodig.

function resizeBlock(object) {

	var windowHeight = $(window).height();
	var start = object.offset().top;
	var margin = object.margin().bottom + object.margin().top;
	var padding = object.padding().bottom + object.padding().top;
	
	var totalHeight = windowHeight - start - padding - 9;
	
	object.height(totalHeight);
	
	// Hoogtes van scroll-ding fixen
	object.find(".scroll_pane").height(totalHeight);
	object.find(".jScrollPaneContainer").height(totalHeight);
	object.find(".jScrollPaneTrack").height(totalHeight);
	object.find(".jScrollPaneDrag").height(totalHeight - 32);
	
	// Object opnieuw toevoegen	
	$(".scroll_pane").jScrollPane({ showArrows: true, scrollbarWidth: 16 });
	

}
		
$(document).ready(function () {
		
		// Functie zie hierboven
		resizeBlock($("#content"));
		$(".scroll_pane").jScrollPane({ showArrows: true, scrollbarWidth: 16 });

		$(window).resize(function() {
			resizeBlock($("#content"));
		});
		
		
		// Custom selectboxes
		
		if($(".default-usage-select").length > 0) {
			$(".default-usage-select").selectbox();
		}
		
		
		// Watermarks op homepage
		
		if($("#relatiecode").length > 0) {
			$("#relatiecode").Watermark("relatiecode", "#808285");
		}
		
		if($("#wachtwoord").length > 0) {
			$("#wachtwoord").Watermark("wachtwoord", "#808285");
		}
		
		// Accordion box
		
		if($(".accordion").length > 0) {
			$('.accordion').accordion({ 
    			header: '.accordionTrigger',
    			autoheight: true,
    			animate: '100'
			});
			
			if($(".accordionTrigger").hasClass("selected")) {
				$("#accordionLastTrigger").addClass("activeLastTrigger");
			}
		}
		
		// Tabbladen 
		
		if($("#tabContainer").length > 0) {
        	$('#tabContainer > ul').tabs();
   		}
   		
   		// IE 6 Hover fix voor menu's
   		
   		if (jQuery.browser.msie) {
  			if(parseInt(jQuery.browser.version) == 6) {
    		$('ul li').hover(function() {
        		$(this).addClass('ie6hover');
    		}, function() {
        		$(this).removeClass('ie6hover');
    		});  
  		}
  		
	} 

	
	
});





