/* MENU */
function initMenu() {
  $('#navigatie_zijkant ul').hide();
  $('#navigatie_zijkant ul:first').show();
  $('#navigatie_zijkant li a').click(
    function() {
      var checkElement = $(this).next();
	  var displayVolgende = checkElement.css("display");
	  
	  var href = $(this).attr("rel") + "ee";
	  var test = $(this).attr("href") + "";

	  // $(this).css("border","1px solid red");
	  //alert(href);
	  //if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
	  if((checkElement.is('ul')) && displayVolgende == "none") {
		checkElement.slideDown('normal');
		if (test != "") { document.location.href = test; }
		return false;
	  }
	  if((checkElement.is('ul')) && displayVolgende == "block") {
		checkElement.slideUp('normal');
		return false;
	  }
	  if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
		$('#navigatie_zijkant ul:visible').slideUp('normal');
		checkElement.slideDown('normal');
		return false;
		}
	  }
/*	  if (test != "") {
		document.location.href = test;
	  }
*/	  
    );
  }

$(document).ready(function() {
	
	// Navigatie
	initMenu();
		
	// Tabs Poll / Blog / Speel mee
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	
	// Tabs Domeinen
	//$(".tab_content2").hide(); //Hide all content
	//$("ul.tabs2 li:first").addClass("active").show(); //Activate first tab
	//$(".tab_content2:first").show(); //Show first tab content
	//$("ul.tabs2 li").click(function() {
	//	$("ul.tabs2 li").removeClass("active"); //Remove any "active" class
	//	$(this).addClass("active"); //Add "active" class to selected tab
	//	$(".tab_content2").hide(); //Hide all tab content
	//	var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
	//	$(activeTab).fadeIn(); //Fade in the active content
	//	return false;
	//});
	
});

$(document).ready(function() {
	//alert(navigation_tree);
	
	/*
	$(".level2 a").click(function(){
		return false;								  	
		alert("lel");															
	});
	*/
	
	arSplit = navigation_tree.split(",")
	$("#navigatie_zijkant ul").hide();
	for(i=0;i<arSplit.length;i++) {
		if($("#navigatie_zijkant_" + arSplit[i]).length !== 0) $("#navigatie_zijkant_" + arSplit[i]).slideDown();
		if($("#navigatie_zijkant_" + arSplit[i] + "_children").length !== 0) $("#navigatie_zijkant_" + arSplit[i] + "_children").slideDown();
	}
	//alert("lel");
});
