function ArtMenu_GetElement(e, name)
{
	name = name.toLowerCase();
	for (var n = e.firstChild; null != n; n = n.nextSibling)
		if (1 == n.nodeType && name == n.nodeName.toLowerCase())
			return n;
	return null;
}

function ArtMenu_GetElements(e, name) 
{
	name = name.toLowerCase();
	var elements = [];
	for (var n = e.firstChild; null != n; n = n.nextSibling)
		if (1 == n.nodeType && name == n.nodeName.toLowerCase())
			elements[elements.length] = n;
	return elements;
}

function ArtMenu_SpansSetup(menu)
{
	var menuUL = ArtMenu_GetElement(menu, 'ul');
	if (null == menuUL) return;
	var menuULLI = ArtMenu_GetElements(menuUL, 'li');
	for (var i = 0; i < menuULLI.length; i++) {
		var li = menuULLI[i];
		if ('separator' == li.className) continue;
		var a = ArtMenu_GetElement(li, 'a');
		if (null == a) continue;
		if (isIncluded(a.href, window.location.href)) {
			a.className = 'active';
		}
		var span1 = document.createElement('span');
		var span2 = span1.appendChild(document.createElement('span'));
		while (a.firstChild)
			span2.appendChild(a.firstChild);
		a.appendChild(span1);
	}
}

function ArtMenu_GetMenuContainer(e)
{
    var container = e;
    while (null == ArtMenu_GetElement(container, 'ul')) {
        container = ArtMenu_GetElement(container, 'div');
        if (null == container) return;
    }
    return container;
}

function load_ADxMenu(sender)
{
    if (sender.id && sender.id != "") {
        var isIE = navigator.userAgent.toLowerCase().indexOf("msie") != -1;
        var isIE6 = navigator.userAgent.toLowerCase().indexOf("msie 6.0") != -1;
        var container = ArtMenu_GetMenuContainer(sender);
        if (null != container) ArtMenu_SpansSetup(container);
    }
}

