﻿$(document).ready(function() {

	// Check of menu item een subsubmenu heeft, zo ja dan de href van hoofditem weghalen
	$(".nav>li").each(function(){	
			if ($(this).find('ul').length != 0 ) {
				// Als er een subsubmenu is de href legen
				$(this).find('>a').removeAttr('href');
			}
	});
	
	// Rollover ook werkend maken in IE6
	
	$(".nav li").hover(function(){
       		$(this).find('ul').show();
		}, function() {
			$(this).find('ul').hide();
	});

    $(".tabHome").click(function() {
        //alert("click home");
        $("#menuHome").show();
        $("#menuLeden").hide();
        $(".tabHome").hide();
        $(".tabLeden").show();
        $("#ledenCss").attr("href", "../../Styles/menu_home.css")
       
        var buildUrl = "http://" + location.host + "/default.aspx"
        window.location = buildUrl;
    });

    $(".tabLeden").click(function() {
        if ($("#menuLeden").length > 0) {
            //alert("Go to Page");

            //alert("click home");
            $("#menuLeden").show();
            $("#menuHome").hide();
            $(".tabHome").show();
            $(".tabLeden").hide();

            // ../../Styles/leden.css
            $("#ledenCss").attr("href", "../../Styles/menu_leden.css")
            
            // als 'homepage' leden nieuwsberichten tonen
            var buildUrl = "http://" + location.host + "/leden/nieuwsberichten/cDU2308_Nieuwsberichten.aspx"
            window.location = buildUrl;

        } else {
            var urlLeden = $(".tabLeden").attr("title");
            window.location = urlLeden;
        }
    });

    if ($("#menuLeden").is(':visible')) {
        $("#ledenCss").attr("href", "../../Styles/menu_leden.css")
    }
    else {
        $("#ledenCss").attr("href", "../../Styles/menu_home.css")
    }

});