//SuckerTree Horizontal Menu (Sept 14th, 06)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

// Ameen:
// first menu level will position by js automatically down of the top menu, if you want to move updown change 
// this variable "adjustFirstTop" value to bxxx pixel.
var br = navigator.appName;
var vr = navigator.appVersion;
var adjustFirstTop = (br=='Microsoft Internet Explorer' && vr.indexOf('MSIE 7')==-1)?9:9;

//alert(navigator.appName);
//alert(navigator.appVersion);


var menuids=["treemenu1"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_horizontal(){
for (var i=0; i<menuids.length; i++)
	{
	var litags=document.getElementById(menuids[i]).getElementsByTagName("li")
	for (var b=0; b<litags.length; b++)
		{
		if(litags[b].parentNode.id==menuids[i] && litags[b].className != 'delim')	// is this li parent is the top ul
			{litags[b].className="topper"}	// give it special class name
		}
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")	// get all ul tags under the top one
	for (var t=0; t<ultags.length; t++)
		{
		if (ultags[t].parentNode.parentNode.id==menuids[i])
			{ //if this is a first level submenu
			ultags[t].style.top= parseInt(ultags[t].parentNode.offsetHeight+adjustFirstTop)+"px" //dynamically position first level submenus to be height of main menu item
			ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
			}
		else
			{ //else if this is a sub level menu (ul)
			ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
			ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
			}

		ultags[t].parentNode.onmouseover=function()
			{
			this.getElementsByTagName("ul")[0].style.visibility="visible";
			var thisImage = this.getElementsByTagName("ul")[0].parentNode.getElementsByTagName("a")[0].getElementsByTagName("img")[0];
			if(typeof thisImage != 'undefined'){thisImage.src = thisImage.getAttribute('srchover');}
			}
    ultags[t].parentNode.onmouseout=function()
			{
			this.getElementsByTagName("ul")[0].style.visibility="hidden";
			var thisImage = this.getElementsByTagName("ul")[0].parentNode.getElementsByTagName("a")[0].getElementsByTagName("img")[0];
			if(typeof thisImage != 'undefined'){thisImage.src = thisImage.getAttribute('srcmain');}
	    }
    }
  }
}

//if (window.addEventListener)
//window.addEventListener("load", buildsubmenus_horizontal, false);
//else if (window.attachEvent)
//window.attachEvent("onload", buildsubmenus_horizontal);

