function markActiveLink(currentitem) {
		$('.active').removeClass('active');
		currentitem.parent('li').addClass('active');
 }

jQuery.fn.toggleMenu = function(speed, easing, callback) {
   return this.animate({height: 'toggle'}, speed, easing, callback);
}; 
if($.browser.msie){
	 jQuery.fn.toggleFade = function(speed, easing, callback) {
	   return this.toggle();
	}; 
	jQuery.fn.toggleFadeIn = function(speed, easing, callback) {
	   return this.css({visibility:'visible'});
	};
	jQuery.fn.toggleFadeOut = function(speed, easing, callback) {
	   return this.css({visibility:'hidden'});
	};		
}
else {
	 jQuery.fn.toggleFade = function(speed, easing, callback) {
	   return this.animate({opacity: 'toggle'}, speed, easing, callback);
	}; 
	jQuery.fn.toggleFadeIn = function(speed, easing, callback) {
	   return this.animate({opacity: 100}, speed, easing, callback);
	};
	jQuery.fn.toggleFadeOut = function(speed, easing, callback) {
	   return this.animate({opacity: 0}, speed, easing, callback);
	};
}

function scrollbarWidth() {
	var div = $('<div style="width:50px;height:50px;overflow:hidden;position:absolute;top:-200px;left:-200px;"><div style="height:100px;"></div>');
	// Append our div, do our calculation and then remove it
	$('body').append(div);
	var w1 = $('div', div).innerWidth();
	div.css('overflow-y', 'scroll');
	var w2 = $('div', div).innerWidth();
	$(div).remove();
	return (w1 - w2);
}

	var $i=1;
function togglemenu(){	
	var $height = $("#menu").css('top').replace(/[^\d\.]/g, '');
	if($height>0 && $i==1 && $("#ropeleft").css('top') != '150'){
		$i=0;
		$("#ropes #ropeleft,#ropes #roperight").animate({
			top: 160
		},1500,function(){ $i=1; });
		$("#ropessmall").animate({
			top: 160
		},1500,function(){ $i=1; });
		$("#ropessmall").toggleFadeOut(1500);
		$("#ropes-bottom").toggleFadeOut('slow');
	}
	if($height==0 && $i==1 && $("#ropeleft").css('top') != '-40'){
		$i=0;
		$("#ropes #ropeleft,#ropes #roperight").animate({
			top: -40
		},1500,function(){ $i=1; });
		$("#ropessmall").animate({
			top: -5
		},1500,function(){ $i=1; });
		$("#ropessmall").toggleFadeIn(1500);
		$("#ropes-bottom").toggleFadeIn('slow');
	}
}

function center (){
	if($(window).width()<1025){ $("body > #container").css('padding-left','200px'); }
	else { $("body > #container").css('padding-left','0'); }
	
	if($('.overlay').width()>$('.lijst').width()){
		var $width = ($('.overlay').width()-$('.lijst').width())/2;
		$('.lijst,.layer img').css('margin-left',$width+'px');
	}
	$width = ($('.overlay').width()-$('.lijst').width())/2;
	$('.hands .left').css('left',$width-247+'px');
	$('.hands .right').css('left',$width-162+$('.lijst').width()+'px');
	if($(window).height()>800){
		var $height = $(window).height()-506;
		$('.hands div').css('height', $height+'px');
	}
	if($(window).height()<800){
		$('.hands div').css('height','352px');
	}
	
}

function kaarten (group){
	//$('#'+group).find('.overlay').hide();
	//$('#'+group).css('z-index',-2);
	//setTimeout(function(){ $('#'+group).css('visibility','visible');} , 400);	
	$('a.interactieblok[rel="'+group+'"]').click(function(){
		$ = window.parent.$;
		$('#'+group).css({visibility:'visible',display:'block',zIndex:99});
		center();
		//$('#'+group).css('z-index',99);
		$('#'+group).find('.overlay').fadeIn('slow');
		$('#'+group).find('.layer').css('top',$(window).height()+'px').animate({top: 0},700);
	});
	$('#'+group).click(function(){
		$(this).find('.overlay').fadeOut('slow');
		$(this).find('.layer').animate({top: $(window).height()+'px'},700,function(){
			$('#'+group).css('z-index',-1);
		});
		$(this).find('.overlay').show();
	});
}
