/* MENU */
function initMenu() {
  $('#navigatie_zijkant ul').hide();
  $('#navigatie_zijkant ul:first').show();
  $('#navigatie_zijkant li a').click(
    function() {
	  var checkElement = $(this).next();
	  //alert(checkElement.attr("id")) //children
	  var displayVolgende = checkElement.css("display");
	  
	  var href = $(this).attr("href") + "";
	  //alert(href);
	  
	  if(href + "" == "#") {
		  $('#navigatie_zijkant ul').slideUp();
	  }
	  
	  if(href + "" !== "") {
		document.location.href = 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');
        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;
        }
      }
    );
  }

$(document).ready(function() {
	$("#ticker div").css("border","0px solid red");
	$("#ticker div").css("height","70px");
	$("#ticker div").css("line-height","70px");
	$("#ticker div").css("width","170px");
	$("#ticker div").css("margin-top","5px");
	$("#ticker div").css("margin-left","10px");
	$("#ticker div").css("text-align","center");
	$("#ticker div a").css("line-height","16px");
	$("#ticker div a").css("font-size","12px");

	var agent= navigator.userAgent.toLowerCase();
	var ver = parseInt(navigator.appVersion);
	 
	var ie = agent.indexOf("msie")>=0;
	var ie6=ie && agent.indexOf("msie 6")>=0;
	var ie7=ie && agent.indexOf("msie 7")>=0;
	 
	var ff=!ie && agent.indexOf("mozilla")>=0;
	var ff2=ff && ver==4;
	var ff3=ff && ver==5;
	 
	if (ff3){
	//do somthing for ff3
	} else if (ie7 || ie6){
		//alert("lel")
		$("#ticker div").css("margin-left","-80px");
		$("#ticker div").css("position","absolute");
/*		$("#ticker div").css("background-color","#00FF00");
		$("#ticker").css("background-color","#FF0000");
		$("#ticker").css("border","1px solid red");
		*/
	//do somthing for ie7
	}else{
	//not supported sorry
	}

//	alert("ell");
	
	initMenu();
	/* TABS */
	$(".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;
	});
	/* EINDE TABS */

/*
	$(".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) {
			//alert("lel");
			$("#navigatie_zijkant_" + arSplit[i]).slideDown();
		}
		if($("#navigatie_zijkant_" + arSplit[i] + "_children").length !== 0) {
			//$("#navigatie_zijkant_" + arSplit[i] + "_children").slideDown();
			$("#navigatie_zijkant_" + arSplit[i] + "_children").show();
		}
			
	}
	//alert("lel");
});
