doInit = function() {

	//custom scroll layout

	$('.scrollable').jScrollPane({
		showArrows:true,
		dragMaxHeight:'16',
		scrollbarWidth:'18',
		wheelSpeed: '30',
		topCapHeight: '1'
	});

	//menu opschuiven als ie niet meer past
	$('#nav ul').each(function (i) {
		while ($(this).height() > 50) $(this).css('width', ($(this).width() + 5) + 'px');
		if ($(this).parents('ul').width() - ($(this).parent().position().left + $(this).width()) < 0) {
			$(this).css('left', ($(this).parents('ul').width() - $(this).width()) + 'px');
		}
	});
	
	$('.item').mouseover(function(){
		$(this).addClass('hover');
	}).mouseout(function(){
		$(this).removeClass('hover');
	});
}

checkPlayer = function(){
	$('a.player-visual').each(function(i){
		$(this).click(function(e){		
			var rel = $(this).attr('rel');
			$(this).hide();
			$('#' + rel).show();			

			return false;		
		});
	});
}

player = function(){
	return document.getElementById('myKaapsPlayer');
}

function onYouTubePlayerReady(playerId){
	playVideo();
}

playVideo = function(){
	player().loadVideoById(kaapsVideoId)
}

$(document).ready(function() {
	doInit();
	checkPlayer();
});

$(document).ready(function() {
	$('#nav li').mouseover(function (ev) {
		if (!$(this).hasClass('open')) $('.open', $(this).parent('ul')).addClass('notopen');
	});
	$('#nav li').mouseout(function (ev) {
		$('.notopen', $(this).parent('ul')).removeClass('notopen');
	});
});
