﻿// JScript File
// voor het openhouden van het menu

$(document).ready(function () {

	//  sUrl = "" + window.location;
	//  sUrl = sUrl.toLowerCase();

	//open submenu for this paging
	/*
	var url = ((window.location.pathname).split("/")[1] + "/" + (window.location.pathname).split("/")[2]).replace(".aspx", "");
	$("a[href*=" + url + "]").parent().parent().parent().show();
	*/

	if (document.all) {
		FixFooter();
	}

	//  $('#dsMenu li').each(function(){

	//    // Controleer of de categorie in een van de LI's voorkomt.
	//    if (this.getElementsByTagName("a")[0] != null) {
	//        //alert (this.getElementsByTagName("a")[0].innerHTML.toLowerCase());
	//        //console.log(this.getElementsByTagName("a")[0].getAttribute('title') + ' UNDJETZT ' +  sUrl);
	//      if (sUrl.indexOf(this.getElementsByTagName("a")[0].getAttribute('title')) != -1) {
	//        // Klap deze UL open, die gematched is.
	//        
	//        
	//        // Vervolgens dienen alle parents geopend te worden, die te maken hebben met de gematchte LI.
	//        var oCurrentNode = this.parentNode;
	//        
	//        while(oCurrentNode.id != 'dsMenu') {
	//          if (oCurrentNode.tagName == 'UL') {
	//            $(oCurrentNode).show("fast");
	//          }
	//          oCurrentNode = oCurrentNode.parentNode;
	//        }
	//        console.log(this.getElementsByTagName("a")[0].getAttribute('title') + ' en ' + sUrl);
	//        $(this.getElementsByTagName("ul")[0]).show("fast");
	//      }
	//    }
	//  });

	$("#shopcartMenu").click(function () {
		location.href = '/winkelwagen.aspx';
	});

	/*
	$('#dsMenu a').click(function () {
	var ul = $(this).parent().next()[0];
	if (ul.nodeName == "UL") {
	if (ul.style.display == "") {
	ul.style.display = 'none';
	return false;
	}
	}
	});
	*/

	$('#dsMenu a').hover(function () {
		$(this).addClass('hover');
	}, function () {
		$(this).removeClass('hover');
	});

	//Expand tree
	var menuItem = $('#menu .menu_blok:eq(0) a[href="' + document.location.pathname + '"]');
	if (menuItem.length > 0) {
		menuItem.css({ color: '#f98e26' });
		menuItem.parents('ul.sub').show();
		menuItem.parent().siblings().show();
	}
	else {
		var href = $('#crumbbar a').last()[0].pathname;
		if ($.browser.msie) href = "/" + href;
		menuItem = $('#menu .menu_blok:eq(0) a[href="' + href + '"]');
		menuItem.css({ color: '#f98e26' });
		menuItem.parents('ul.sub').show();
		menuItem.parent().siblings().show();
	}


	//Menu expand/collapse:
	/*
	$('#menu .menu_blok:eq(0) ul > li > div > a').each(function () {
	$(this).click(function () {
	var submenu = $(this).closest('li').find('ul');
	if (submenu.length > 0) {
	submenu = $(submenu).get(0);

	//Close nodes on same level
	$(submenu).parent().parent().find('li > ul').each(function () {
	this.collapsed = true;
	$(this).slideUp();
	});

	//Open selected node
	submenu.collapsed == null ? submenu.collapsed = true : void (0);
	if (submenu.collapsed) {
	$(submenu).slideDown()
	submenu.collapsed = false;
	} else {
	$(submenu).slideUp()
	submenu.collapsed = true;
	}
	return false;
	}
	});
	});

	*/

});
