$(document).ready(function(){

	var clearQueue = true;
	var gotoEnd = false;
													 
	$("li.hasSubSub").hover(
		function(){
			$("ul", this).stop(clearQueue, true).show("slow");
			$("div#content").stop(clearQueue, gotoEnd).animate( { marginLeft: "183px" }, "slow" );
			$("div#rechts").css("display", "none");
			$("div#topMenu").stop(clearQueue, true).hide("slow");
		},
		function(){
			$("ul", this).stop(clearQueue, true).hide("slow");
			$("div#content").stop(clearQueue, gotoEnd).animate( { marginLeft: "5px" }, "slow" );
			$("div#content").queue(function(){
				$("div#rechts").css("display", "block");
				$(this).dequeue();
			});
			$("div#topMenu").stop(clearQueue, true).show("slow");
		}
	);
	
	//Custom scrollbar
	$("div#cont1, div#cont2, div#cont3").jScrollPane({
		scrollbarMargin: 0,
		scrollbarWidth: 15,
		//Eigen variabele containerPaddingRight
		containerPaddingRight: 20,
		//Eigen variabele containerPaddingBottom, alleen in combo met containerFixedHeight
		//containerPaddingBottom: 20,
		//containerFixedHeight: 400,
		showArrows: true,
		reinitialiseOnImageLoad: true
	});
	
	//Toggle tabs - Template 4
	$("div.aTabTitle").click(function(){
				
			if (!($(this).hasClass("aTabTitleOpen"))) {
				$("div.aTabTitleOpen").removeClass("aTabTitleOpen");
				$("div.aTabContentOpen").hide("normal").removeClass("aTabContentOpen");
				$(this).parent().find("div.aTabContent").show("normal").addClass("aTabContentOpen");
				$(this).addClass("aTabTitleOpen");
			}

	});
	
	reinitialiseScrollPane = function(){
		$('div#cont3').jScrollPane({
			scrollbarMargin: 0,
			scrollbarWidth: 15,
			//Eigen variabele containerPaddingRight, containerPaddingTop, containerPaddingBottom
			containerPaddingRight: 20,
			showArrows: true,
			reinitialiseOnImageLoad: true
		})
	};

	
	//Artikelen - Template 6
	$("a.articleContainerLink").click(function(){
		var hrefStr = $(this).attr("href");
		var htmlStr = $("div"+hrefStr).html();
		$("div#cont3").css("height", "400px").html(htmlStr);
		reinitialiseScrollPane();
	});


$("#newslist img[align='right']").css({'margin-left':'10px','clear':'none'});
$("#newslist img[align='left']").css({'margin-right':'10px','clear':'none'});

	
});

function showSubSub(subSubMenu){
	
			if($("li#subsub"+subSubMenu).length == "1"){
			
					$("li#subsub"+subSubMenu).parent("ul").css("display", "block");
					$("div#content").css("margin-left", "183px");
					$("div#rechts").css("display", "none");
					$("li#subsub"+subSubMenu).parent("ul").parent("li").find("a:first").addClass("active");
				
			}
			
		}
