setEventHandlers = function(a, img_found)
{
	a.onmouseover = function()
	{
		rx = /[/]highlight[/]/g;
		if (!img_found.src.match(rx))
		{
			img_found.oldsrc = img_found.src;
			img_found.src = img_found.src.replace(/[/]normal[/]/, "/highlight/");
		}
	}
	a.onmouseout = function()
	{
		rx = /[/]highlight[/]/g;
		if (img_found.src.match(rx))
		{
			if (img_found.oldsrc)
				img_found.src = img_found.oldsrc;
		}
	}
}

setLiHandler = function(li, li_collapsed)
{
	li.onmouseover = function()
	{
		for (i = 0; i < li_collapsed.length; i++)
		{
			li_collapsed[i].style.display = "block";
		}
	}
}

setOutHandler = function(li, collapsed)
{
	var oldhandler = li.onmouseover;
	var self = li;
	if (typeof(oldhandler) == 'function')
		self.oldhandler = oldhandler;
	li.onmouseover = function()
	{
		for (i = 0; i < collapsed.length; i++)
		{
			collapsed[i].style.display = "none";
		}
		if (typeof(self.oldhandler) == 'function')
			self.oldhandler();
	}
}


startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("topMenu");
for (i=0; i<navRoot.childNodes.length; i++) {
    node = navRoot.childNodes[i];
    if (node.nodeName=="LI") {
        node.onmouseover=function() {
            this.className+=" over";
        }
        node.onmouseout=function() {
            this.className=this.className.replace(" over", "");
        }
    }
  }
}

if (document.getElementById)
{
	var navRoot = document.getElementById("topMenu");
	var ul_elements = navRoot.getElementsByTagName("UL");
	var collapsed = [];
	for (j = 0; j < ul_elements.length; j++)
	{
		ul = ul_elements[j];
		var li_collapsed = [];
		var prev_li = null;
		for (k = ul.childNodes.length - 1; k >= 0; --k)
		{
			li = ul.childNodes.item(k);
			if (li.nodeName == "LI")
			{
				if (li.className.match(/collapsed/g))
				{
					li_collapsed.push(li);
					collapsed.push(li);
				}
				else
				{
					if (li_collapsed.length > 0)
					{
						setLiHandler(li, li_collapsed);
						li_collapsed = [];
					}
				}
			}
		}
	}

	if (collapsed.length > 0)
	{
		var first = true;
		for (i=0; i<navRoot.childNodes.length; i++)
		{
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI")
			{
				if (first)
					first = false;
				else
					setOutHandler(node, collapsed);
			}
		}
	}
}

if (document.getElementById) {
navRoot = document.getElementById("topMenu");
 elements = navRoot.getElementsByTagName("A");
 for (j = 0; j < elements.length; j++)
{
	a = elements[j];
	var img_found = null;
	for (k = 0; k < a.childNodes.length; k++)
	{
		img = a.childNodes.item(k);
		if (img.nodeName == "IMG" && !img.src.match(/[/]l[to]*[/]/g))
		{
			img_found = img;
			break;
		}
	}
	if (img_found == null)
		continue;
	setEventHandlers(a, img_found);
}


 }
}

preloaded_images = new Array();
function MM_preloadImages() {
	if (document.getElementById) {
	navRoot = document.getElementById("topMenu");

	elements = navRoot.getElementsByTagName("IMG");
	for (j = 0; j < elements.length; j++)
	{
		img = elements[j];
		if (img.src.match(/[/]menu-images.aspx[/]r[to]*[/]/g))
		{
			if (img.src.match(/[/]highlight[/]/g))
				newsrc = img.src.replace("/highlight/", "/normal/");
			else
				newsrc = img.src.replace("/normal/", "/highlight/");
			newimg = new Image();
			newimg.src = newsrc;
			preloaded_images.push(newimg);
		}
	}
 }
}

if (typeof(images_ready) == "boolean")
{
	startList();
	MM_preloadImages();
}

