fixMozillaZIndex=true; //Fixes Z-Index problem  with Mozilla browsers but causes odd scrolling problem, toggle to see if it helps
_menuCloseDelay=500;
_menuOpenDelay=150;
_subOffsetTop=2;
_subOffsetLeft=-2;




with(menuStyle=new mm_style()){
styleid=1;
bordercolor1="#ffffff";
borderstyle="none";
borderwidth=1;
fontfamily="Verdana, Tahoma, Arial";
fontsize="8pt";
fontstyle="normal";
fontweight="bold";
headerbgcolor="#ffffff";
headercolor="#000000";
image1="";
imagepadding=6;
offbgcolor="#000000";
offcolor="#ffffff";
onbgcolor="#9F823E";
oncolor="#ffffff";
outfilter1="randomdissolve(duration=0.3)";
overfilter1="Fade(duration=0.2);Alpha(opacity=90);Shadow(color=#777777', Direction=135, Strength=5)";
overimage1="";
padding=2;
pagebgcolor="#82B6D7";
pagecolor="black";
separatorcolor="#ffffff";
separatorsize=1;
subimage1="";
subimagepadding=2;

}

with(submenuStyle=new mm_style()){
bordercolor="#ffffff";
borderstyle="solid";
borderwidth=1;
fontfamily="Verdana, Tahoma, Arial";
fontsize="8pt";
fontstyle="normal";
headerbgcolor="#ffffff";
headercolor="#000000";
offbgcolor1="#5871B3";
offbgcolor="#000000";
offcolor="#ffffff";
onbgcolor="#DC9B5B";
oncolor="#ffffff";
outfilter1="randomdissolve(duration=0.3)";
overfilter1="Fade(duration=0.2);Alpha(opacity=90);Shadow(color=#777777', Direction=135, Strength=5)";
padding=4;
pagebgcolor="#82B6D7";
pagecolor="black";
separatorcolor1="#758CC9";
separatorcolor="#AAAAAA";
separatorsize=1;
subimage="SiteFrame/Images/menu_arrow_left.gif";
subimageposition="left";
subimagepadding=2;
}

with(userInfoMenuStyle=new mm_style()){
styleid=3;
bordercolor1="#ffffff";
borderstyle="none";
borderwidth=1;
fontfamily1="Verdana, Tahoma, Arial";
fontsize1="8pt";
fontstyle="normal";
fontweight1="bold";
headerbgcolor="#ffffff";
headercolor="#000000";
image1="";
imagepadding=6;
offbgcolor="#4C3913";
offcolor="#ffffff";
onbgcolor="#9F823E";
oncolor="#ffffff";
outfilter1="randomdissolve(duration=0.3)";
overfilter1="Fade(duration=0.2);Alpha(opacity=90);Shadow(color=#777777', Direction=135, Strength=5)";
overimage1="";
padding=2;
pagebgcolor="#82B6D7";
pagecolor="black";
separatorcolor="#ffffff";
separatorsize=1;
subimage1="";
subimagepadding=2;

}


var mIndex = 0, mqueue = []

function preprocess1MenuItem ( xml ) {
	var children = xml.selectNodes("item")
	if (children.length==0) return
	var i
	for (i=0;i<children.length;i++) {
		preprocess1MenuItem(children[i])
	}
	var res, nm = "menu" + mIndex, i;
	mIndex++
	with(res=new menuname(nm)){		
		margin=2;
		style=submenuStyle;
		openstyle="rtl";		
	}
	for (i=0;i<children.length;i++) {
		buildMenuItem(res, children[i],false)
	}
	xml.setAttribute("_menuName", nm)
}

function buildMenuItem ( target, xml, isMainPart ) {
	var cmds = [], s = xml.getAttribute("title")
	if (isMainPart) s = "&nbsp;" + s + "&nbsp;"
	
	cmds[cmds.length] = "text=" + s
	if (xml.getAttribute("_menuName")) {
		cmds[cmds.length] = "showmenu=" + xml.getAttribute("_menuName")
	} else {
		if (xml.getAttribute("id")) {
			cmds[cmds.length] = "clickfunction=navigateSite('" + xml.getAttribute("id") + "')"
		} else if (xml.getAttribute("action")) {
			cmds[cmds.length] = "clickfunction=execAction('" + xml.getAttribute("action") + "')"
		}
	}
	target.aI(cmds.join(";") + ";")
}

function buildTopMenu(xml) {
	var root = xml 
	
	var i, children = root.selectNodes("item")
	for (i=0;i<children.length;i++) preprocess1MenuItem(children[i])
	
	with(topMenu = new menuname("TopMenu")){
		alwaysvisible=1;
		orientation="horizontal";
		style=menuStyle;
		position="relative";		
	}

	
	for (i=0;i<children.length;i++) {
		buildMenuItem(topMenu,children[i],true)
	}
	drawMenus();
}

function buildUserInfoMenu(xml, userName) {
	preprocess1MenuItem(xml)
	
	with(m = new menuname("UserInfoMenu")){
		alwaysvisible=1;
		orientation="horizontal";
		style=userInfoMenuStyle;
		position="relative";		
	}

	xml.setAttribute("title", userName)
	buildMenuItem(m,xml,false)
	drawMenus();	
	
	UserInfoMenuMenu = m
}


