if (document.all)    {n=0;ie=1;ns6=0;fShow="visible";fHide="hidden";}
if (document.getElementById&&!document.all)    {n=0;ie=0;ns6=1;fShow="visible";fHide="hidden";}
if (document.layers) {n=1;ie=0;ns6=0;fShow="show";fHide="hide";}

//**************************
//n=1;ie=0;ns6=0;fShow="show";fHide="hide";
RawRun = false; //  set to true to get non-javascript menu output
MnuOut = false; //  set to true to get complete menu HTML output strings
//**************************

//Top Nav bar script v2.1- http://www.dynamicdrive.com/dynamicindex1/sm/index.htm
//with substantial un-generified modifications by James E. White

opr6=ie&&navigator.userAgent.indexOf("Opera")!=-1

//new***
var CurMenu = "";
var CurPart = "";
var SkipFirstEntry = false;
var MenuLabel = "";
var RawTableStart = "<table width='99%' cellpadding='2' cellspacing='1' bgcolor='Black' border='1' align='center'>\n<tr bgcolor='White'>\n" ;
var RawTableEnd = "</tr>\n</table>\n\n" ;
var WasMainRet = false;
var MenuIDsDone = "";

// n=1;ie=0;ns6=0;fShow="show";fHide="hide";  // fake it to NS4

//uncomment***
window.onerror=new Function("return true")
//NOTICE: there is some unstability about "lastMenu" in the hideAll function being left undefined. The problem appears to be that during some mouse movements---perhaps fast ones or whatever---the proper precursor stuff doesn't get executed or gets reset or whatever.


////////////////////////////////////////////////////////////////////////////
// Function Menu()                                                        //
////////////////////////////////////////////////////////////////////////////
rightX = 0;
function RawMenu()
{
	var RawMenu="";  //new for storing the no-javascript table page top static menus
	RawMenu += "<p>.</p><FORM  METHOD=\"POST\" ACTION=\"\">\n" +
"<P align=\"center\"><TEXTAREA NAME=\"TextArea1\" ROWS=\"40\" COLS=\"100\">"
	RawMenu += RawTableStart ;

	RawMenu += "<!-- MAIN MENU STARTS -->\n";
	RawMenu += "<!-- MAIN_MENU -->\n";
	RawMenu += "<!-- MAIN MENU ENDS -->\n";
//??	if (n) HTMLstr += "</td>";
//HTMLstr += "<td width=\"32\"><img align=\"right\" border=\"0\" alt=\"Inventor Home house, gears, light bulb logo\" src=\"InvHome32Rev.jpg\" height=\"32\" width=\"32\"></td>";
	RawMenu += RawTableEnd + "<hr>\n<hr>\n\n" ;

	RawMenu += "<!-- SUB MENUS START -->\n";
	RawMenu += "<!-- SUB_MENU -->\n";
	RawMenu += "<!-- SUB MENUS END -->\n";
	RawMenu += "\n";

	RawMenu += "</TEXTAREA></P>" + "</FORM>";
return RawMenu;
}

function Twice(MainTable,Vis,Num)
{
	var HTMLstr="";
		
//	if (ie||ns6) HTMLstr += "<div id='" + MainTable + "' style='position:absolute;top:9;left:0;visibility:" + Vis +";'>\n";
	if (ie||ns6) HTMLstr += "<div id='" + MainTable + "' style='position:absolute;top:.2em;left:0;visibility:" + Vis +";'>\n"; //$$JW 10/23/06 test

//recomment out*** added bgcolor and top
	if (n)  HTMLstr += "<layer name='" + MainTable + "' visibility='" + Vis + "' bgcolor='Black' top='1'>\n";


	HTMLstr += "<table width='100%' cellpadding='0' bgcolor='Black' border='2'>\n";
//	HTMLstr += "<table width='100%' cellpadding='0' bgcolor='Black' border='2' style='height: 3em;'>\n"; //$$JW 10/23/06 test
	HTMLstr += "<tr>\n\n";

//uncomment***
//	if (n) HTMLstr += "<td>&nbsp;";


	HTMLstr += "<!-- MAIN MENU STARTS -->\n";
	HTMLstr += "<!-- MAIN_MENU" + Num + " -->\n";
	HTMLstr += "<!-- MAIN MENU ENDS -->\n";
//	if (n) HTMLstr += "</td>";
//HTMLstr += "<td width=\"32\"><img align=\"right\" border=\"0\" alt=\"Inventor Home house, gears, light bulb logo\" src=\"InvHome32Rev.jpg\" height=\"32\" width=\"32\"></td>";
	HTMLstr += "</tr>\n";
	HTMLstr += "</table>\n";


//moved from below, recomment out***
	if (n)  HTMLstr+= "</layer>\n";
	if (ie||ns6) HTMLstr+= "</div>\n";

return HTMLstr;
}
function Menu()
{
	this.bgColor     = menucolor;
	if (ie) this.menuFont = "bold 12px Arial"; //default font settings. Don't change. Instead, modify stylesheet in sample.htm
	if (n)  this.menuFont = "bold 12px Verdana";
	this.fontColor   = "black";

	this.addItem    = addItem;
	this.addSubItem = addSubItem;
	this.showMenu   = showMenu;
	this.mainPaneBorder = 2;
	this.subMenuPaneBorder = 1;

	this.subMenuPaneWidth = submenuwidth;

	lastMenu = null;
	
	rightY = 0;
	leftY = 0;
	leftX = 0;

	HTMLstr = "";
	HTMLstr += "<!-- MENU PANE DECLARATION BEGINS -->\n";
	HTMLstr += "\n";
//new**
if (ie||ns6) HTMLstr += "<div id='blob' style='position:absolute;top:0;left:0;'>\n"
		+ "<table bgcolor='#000000' width='100%'><tr><td height='58'>.</td></tr></table>\n"
		+ "</div>\n";
if (n) HTMLstr += "<layer bgcolor='#000000'>\n"
		+ "<table bgcolor='#000000' width='100%'><tr><td height='52'>.</td></tr></table>\n"
		+ "</layer>\n\n";

//new*** to create HTMLstr2
//	HTMLstr2 = HTMLstr
	HTMLstr += Twice("MainTable", fShow,"") + "\n\n" + Twice("MainTable2", fHide,"2");

	HTMLstr += "\n\n";
	HTMLstr += "<!-- SUB MENU STARTS -->\n";
	HTMLstr += "<!-- SUB_MENU -->\n";
	HTMLstr += "<!-- SUB MENU ENDS -->\n";
	HTMLstr += "\n";
//	if (ie||ns6) HTMLstr+= "</div>\n";

//recomment out***
//	if (n)  HTMLstr+= "</layer>\n";
	HTMLstr += "<!-- MENU PANE DECALARATION ENDS -->\n";

	if (RawRun) {RawMenu = RawMenu();}
	else {RawMenu = "";};
}

function ampFix(inStr,splitStr) //added this function 10/18/04
{
	switch (splitStr){ 
		case " & " : extraStr = " "; break; 
		case "&" : extraStr = ""; break; 
		default : extraStr = "";
	} 
	xAry = inStr.split(splitStr);
	outpt="";
	
	for(i=0;i<xAry.length - 1;i++)
	{
		outpt += xAry[i] + extraStr + "&amp;" + extraStr ;
	};    
	outpt += xAry[xAry.length - 1];
//	alert(outpt);
return outpt;
}

function addItem(idItem, text, hint, location, altLocation)
{
	var Lookup = "<!-- ITEM "+idItem+" -->";
	hint = ampFix(hint," & ") //" & " will be converted to " &amp; ", added this line 10/18/04
	text = ampFix(text," & ") //" & " will be converted to " &amp; ", added this line 10/18/04
	
	if (HTMLstr.indexOf(Lookup) != -1)
	{
		alert(idItem + " already exist");
		return;
	}
	var MENUitem = "";
//new***
var MENUitem2 = "";
var MENUend = "";
	MENUend += "\n<!-- ITEM "+idItem+" -->\n";
	if (n)
	{

// new***
		MENUitem2 += "<td align=\"center\">\n";
		MENUitem2 += "<ilayer id='"+idItem+"2' z-index=\"3\">";

//		MENUitem += "<td align=\"center\" height=\"35\">\n"; 
		MENUitem += "<td align='center' style='height:2.5em;'>\n"; //$$JW 10/23/06 test
		MENUitem += "<ilayer id='"+idItem+"' z-index='2'>";

//change ilayer to layer & name to id***
//		MENUitem += "<ilayer name="+idItem+">";
//replaced below MENUitem with MENUend
//		MENUend += "<ilayer id="+idItem+" z-index=\"2\">";


		MENUend += "<a href='"
		if (location != null)
			MENUend += location;
		else
			MENUend += window.location;
		MENUend += "' class='clsMenuItemNS' onmouseover=\"displaySubMenu('"+idItem+"')\"";
		if (altLocation != null) MENUend += " target='" + altLocation + "'";
		MENUend += ">";
/* replaced by above block
		MENUend += "<a href='.' class=clsMenuItemNS onmouseover=\"displaySubMenu('"+idItem+"')\" onclick=\"return false;\">";
		MENUend += "<a href='.' class=clsMenuItemNS onmouseover=\"displaySubMenu('"+idItem+"')\">";
*/
		MENUend += "&nbsp;";//<!-- | -->
		if (idItem == SubMenu){
			MENUend += SubPart;
		}
		else{
			MENUend += text;
		};
		MENUend += "&nbsp;</a>";


//change ilayer to layer***
//		MENUitem += "</ilayer>\n"; //added \n ***
		MENUend += "</ilayer>\n";

//new***
		MENUend += "</td>\n";

//new*** to add MENUend to MENUitem and MENUitem2
		MENUitem += MENUend
		MENUitem2 += MENUend

	}
	if (ie||ns6)
	{
// new***
		MENUitem2 += "<td align=\"center\">\n";
//		MENUitem2 += "<div id='"+idItem+"2' style='position:relative; font: "+this.menuFont+";'>\n";
		MENUitem2 += "<div id='"+idItem+"2' style='position:relative;'>\n"; //$$JW 10/23/06 test

//		MENUitem += "<td align=\"center\" height=\"35\">\n";
//		MENUitem += "<div id='"+idItem+"' style='position:relative; font: "+this.menuFont+";'>\n";
		MENUitem += "<td align=\"center\" style='height:2.5em;'>\n"; //$$JW 10/23/06 test
		MENUitem += "<div id='"+idItem+"' style='position:relative;'>\n"; //$$JW 10/23/06 test

//changed MENUitem to MENUend
//		MENUend += "<div id='"+idItem+"' style='position:relative; font: "+this.menuFont+";'>\n";
		MENUend += "<a ";
		MENUend += "class='clsMenuItemIE' ";
//		MENUitem += "style='text-decoration: none; font: "+this.menuFont+"; color: "+this.fontColor+"; cursor: auto;' ";
		if (hint != null)
			MENUend += "title=\""+hint+"\" "; // replaced 's with \"s 10/18/04

//replaces below comment block
		if (location != null)
		{
			MENUend += "href='"+location+"' ";
		};
//			MENUitem += "onmouseover=\"hideAll()\" ";
			MENUend += "onmouseover=\"displaySubMenu('"+idItem+"')\"";
		if (altLocation != null) MENUend += " target='"+altLocation+"'";
		
/* old version of block above that I'm not sure what the plan was
		if (location != null)
		{
			MENUend += "href='"+location+"' ";
//			MENUitem += "onmouseover=\"hideAll()\" ";
			MENUend += "onmouseover=\"displaySubMenu('"+idItem+"')\" ";
		}
		else
		{
			if (altLocation != null)
				MENUend += "href='"+altLocation+"' ";
			else
				MENUend += "href='.' ";
			MENUend += "onmouseover=\"displaySubMenu('"+idItem+"')\" ";
			MENUend += "onclick=\"return false;\" ";
		}
*/
		MENUend += ">";
		MENUend += "&nbsp;\n"<!-- | -->
		if (idItem == SubMenu){
			MENUend += SubPart;
		}
		else{
			MENUend += text;
		};
		MENUend += "&nbsp;</a>\n";
		MENUend += "</div>\n";
		MENUend += "</td>\n";

//new*** to add MENUend to MENUitem and MENUitem2    *******may be moveable to outside ifs
		MENUitem += MENUend;
		MENUitem2 += MENUend;

	}
	MENUitem += "<!-- END OF ITEM "+idItem+" -->\n\n";
	MENUitem += "<!-- MAIN_MENU -->\n";
//new*** to add to MENUitem2
	MENUitem2 += "<!-- END OF ITEM "+idItem+" -->\n\n";
	MENUitem2 += "<!-- MAIN_MENU2 -->\n";
	
	HTMLstr = HTMLstr.replace("<!-- MAIN_MENU -->\n", MENUitem);

//new*** to keep HTMLstr2 up and handle raw menus
	HTMLstr = HTMLstr.replace("<!-- MAIN_MENU2 -->\n", MENUitem2);

	if (RawRun){
		hint = ampFix(hint,"&");
		text = ampFix(text,"&");
		
		MENUitem = "<td align='center'><a href=\"" + location + "\" title=\"" + hint 
			+ "\"><strong>" + text + "</strong></a></td>\n<!-- MAIN_MENU -->\n" ;
		RawMenu = RawMenu.replace("<!-- MAIN_MENU -->\n", MENUitem);
	
		MENUitem = "<!-- " + idItem + " sub-menu -->\n";
		MENUitem += RawTableStart ;
		MENUitem += "<td align='center'>" + text 
			+ " Menu &amp;gt;&amp;gt;</td>\n<!-- "  // replaced >> with &amp;gt;&amp;gt; 10/18/04
			+ idItem + "_MENU -->\n" +RawTableEnd+ "<hr>\n\n<!-- SUB_MENU -->\n";
		RawMenu = RawMenu.replace("<!-- SUB_MENU -->\n", MENUitem);
	};
}

function addSubItem(idParent, text, hint, location, linktarget, level)
{

//alert(SubMenu + SubPart + ", " + CurMenu + CurPart);
	//new***
	hint = ampFix(hint," & ") //" & " will be converted to " &amp; ", added this line 10/18/04
	text = ampFix(text," & ") //" & " will be converted to " &amp; ", added this line 10/18/04

	MENUitem = "";
	
	if (RawRun){
		SubLev = "";
		hintX = ampFix(hint,"&");
		textX = ampFix(text,"&");
		
		if (level == "mainreturn") {
			MENUitem += "<!-- " + idParent + "_MENU -->" ;
			MENUitem += "\n" + RawTableEnd ;
			MENUitem += "<!-- " + idParent + "__NewSubLevel__MENU start -->\n"
			MENUitem += RawTableStart ;
			MENUitem += "<!-- " + idParent + "__NewSubLevel__MENU -->"
			MenuLabel = text;
			RawMenu = RawMenu.replace("<!-- " + idParent + "_MENU -->", MENUitem);
		}
		else{
			MENUitem += "<td align='center'>" ;
			if (MenuLabel != ""){
				RawMenu = RawMenu.replace("_NewSubLevel_", level);
				RawMenu = RawMenu.replace("_NewSubLevel_", level); //replace the second one also
				MENUitem += MenuLabel + "&amp;gt;&amp;gt; " ; // replaced >> with &amp;gt;&amp;gt; 10/18/04
				MenuLabel = "";
				SubLev = " &amp;gt;";  // replaced > with &amp;gt; 10/18/04
				//now add item to main menu sublevel
				MAINitem = "<td align='center'>" ;
				MAINitem += "<a href=\"" + location + "\" title=\"" + hintX // added X 10/18/04
					+ "\" target='" + linktarget + "'><strong>" + textX // added X 10/18/04 
					+ "</strong></a>" + SubLev + "</td>\n" ;
				MAINitem += "<!-- " + idParent + "_MENU -->" ;
				RawMenu = RawMenu.replace("<!-- " + idParent + "_MENU -->", MAINitem);
			};
			MENUitem += "<a href=\"" + location + "\" title=\"" + hintX // added X 10/18/04
				+ "\" target='" + linktarget + "'><strong>" + textX // added X 10/18/04
				+ "</strong></a>" + SubLev + "</td>\n" ;
			MENUitem += "<!-- " + idParent ;
			if (level != "Main") MENUitem +=  "_" + level ;
			MENUitem += "_MENU -->" ;
			if (level == "Main")
				RawMenu = RawMenu.replace("<!-- " + idParent + "_MENU -->", MENUitem);
			else
				RawMenu = RawMenu.replace("<!-- " + idParent + "_" + level + "_MENU -->", MENUitem);
		};
	};

	if (WasMainRet) SubLev = " &gt;";  // replaced > with &gt; 10/18/04
	else SubLev = "";
	
	UpLev = "";
	
	if (level == "mainreturn") WasMainRet = true ;
	else WasMainRet = false ;

	if (SubMenu == ""){ //Doing a main level menu
		if (level == "mainreturn"){ //a Return to Main for inclusion in submenus only
			return false;
		};
		if (CurPart != "Main"){ //Always process "Main" level menu items BUT
			if (CurPart == level){ //only process the first submenu item at each sublevel
				return false;
			};
		};
	}
	else{ //Doing a sublevel menu for one of the menu lists SO
		if (idParent == SubMenu){ //when the Parent Id matches AND UNLESS
			if (level == "mainreturn"){ //a Return to Main is being set prepare to skip first sublevel entry
				SkipFirstEntry = true;
				if (MenuIDsDone.indexOf("_" + level + "_") == -1) MenuIDsDone += "_" + level + "_" ;
				else return false; //another submenu for this main menu was already processed so skip
				UpLev = "&lt; "; // replaced < with &lt;
			}
			else{
				if (SkipFirstEntry){
					SkipFirstEntry = false;
					return false;
				}
				if (level != SubPart){ //the Sub Level matches them process otherwise return
					return false;
				};
			};
		}
		else{ //this submenu gets normal top-level treatment
			if (level == "mainreturn"){ //a Return to Main for inclusion in submenus only
				return false;
			};
			if (CurPart != "Main"){
				if (CurPart == level){
					return false;
				};
			};
		};
	};
	CurPart = level;
	CurMenu = idParent;
	
	var MENUitem = "";
	Lookup = "<!-- ITEM "+idParent+" -->";
	if (HTMLstr.indexOf(Lookup) == -1)
	{
		alert(idParent + " not found");
		return false;
	}
	Lookup = "<!-- NEXT ITEM OF SUB MENU "+ idParent +" -->";
	if (HTMLstr.indexOf(Lookup) == -1)
	{
		if (n)
		{
			MENUitem += "\n";
			MENUitem += "<layer id='"+idParent+"submenu' visibility=hide bgcolor='"+this.bgColor+"'>\n";
			MENUitem += "<table border='"+this.subMenuPaneBorder+"' bgcolor='"+this.bgColor+"' width="+this.subMenuPaneWidth+">\n";
			MENUitem += "<!-- NEXT ITEM OF SUB MENU "+ idParent +" -->\n";
			MENUitem += "</table>\n";
			MENUitem += "</layer>\n";
			MENUitem += "\n";
		}
		if (ie||ns6)
		{
			MENUitem += "\n";
//			MENUitem += "<div id='"+idParent+"submenu' onmouseout=operahide() style='position:absolute; visibility: hidden; z-index:100; width: "+this.subMenuPaneWidth+"; font: "+this.menuFont+"; top: -300;'>\n";
			MENUitem += "<div id='"+idParent+"submenu' onmouseout=operahide() style='position:absolute; visibility: hidden; z-index:100; width: "+this.subMenuPaneWidth+"; top: -300;'>\n"; //$$JW 10/23/06 test
			MENUitem += "<table border='"+this.subMenuPaneBorder+"' bgcolor='"+this.bgColor+"' width="+this.subMenuPaneWidth+">\n";
			MENUitem += "<!-- NEXT ITEM OF SUB MENU "+ idParent +" -->\n";
			MENUitem += "</table>\n";
			MENUitem += "</div>\n";
			MENUitem += "\n";
		}
		MENUitem += "<!-- SUB_MENU -->\n";
		HTMLstr = HTMLstr.replace("<!-- SUB_MENU -->\n", MENUitem);
//new***
//		HTMLstr2 = HTMLstr2.replace("<!-- SUB_MENU -->\n", MENUitem);
	}

	Lookup = "<!-- NEXT ITEM OF SUB MENU "+ idParent +" -->\n";
	if (n) {
		MENUitem = "<tr><td><a class=clsMenuItemNS title=\""+hint+"\" href='"+location ; //replaced 's with \"s 10/18/04
		if ( !(level == "Main") && !(level == "mainreturn") ){
			MENUitem += "?m=" + idParent + "_" + level
		};
		MENUitem += "' target='"+linktarget+"'>"+UpLev+text+SubLev+"</a><br></td></tr>\n";
	};
	if (ie||ns6) {
		MENUitem = "<tr><td><a class=clsMenuItemIE title=\""+hint+"\" href='"+location; //replaced 's with \"s 10/18/04
		if ( !(level == "Main") && !(level == "mainreturn") ){
			MENUitem += "?m=" + idParent + "_" + level
		};
		MENUitem += "' target='"+linktarget+"'>"+UpLev+text+SubLev+"</a><br></td></tr>\n";
	};
	MENUitem += Lookup;
	HTMLstr = HTMLstr.replace(Lookup, MENUitem);

return true;
}

function showMenu()
{
	document.writeln(HTMLstr);

	if (RawRun) {document.writeln(RawMenu);};

	if (MnuOut) {
		BigStr = "<FORM  METHOD=\"POST\" ACTION=\"feedback.cfm\">\n" +
			"<P align=\"center\"><TEXTAREA NAME=\"TextArea1\" ROWS=\"40\" COLS=\"110\">" + HTMLstr +
			"</TEXTAREA></P>" + "</FORM>";
		document.writeln(BigStr);
	}
	
}

////////////////////////////////////////////////////////////////////////////
// Private declaration
function displaySubMenu(idMainMenu)
{
var outpt = "Output list\n\n" + idMainMenu + "\n\nLayers";

	var menu;
	var submenu;

//alert(window.pageXOffset + "  " + window.pageYOffset)
//	alert(window.onmousemove)
/* var mcnt=0
			for(fred in document.events)
//		for(fred=0;fred<document.layers.length;fred++)
        {
		if(mcnt>50)
          outpt = outpt + "\n" + fred ; //+ "=" + document.layers[0].[fred].value ;
//          outpt = outpt + "\n" + document.layers[0].name ;
	mcnt++
        };
      alert( outpt + "\n\n");
*/
	if (n)
	{
//	for (fred=0;fred<window.captureEvents[fred];fred++)
//			for(fred in document.forms[0])
//		for(fred=0;fred<document.layers.length;fred++)
//        {
//          outpt = outpt + "\n" + document.forms[0] ; //+ "=" + document.layers[0].[fred].value ;
//          outpt = outpt + "\n" + document.layers[0].name ;
 //       };
//		outpt = output + "\nLayers[0]\n";
//		for(fred=0;fred<document.layers.length;fred++)
 //       {
  //        outpt = outpt + "\n" + document.layers.layers[fred].name ;
   //     };    
//		outpt = outpt + "\n\nLayers.Layers";
//		for(fred=0;fred<document.layers[0].layers.length;fred++)
//      for (fred in document.layers.length) //.layers[1])
//        {
//          outpt = outpt + "\n" + document.layers[0].layers[fred].name ; // ???: + "=" + fred.value;
 //         /* for (xxx in fred)
//            {
//              outpt = outpt + xxx + ", ";
//            };
//          outpt = outpt + ")"; 
 //       };
   //   alert( outpt + "\n\n" + document.layers[0].layers.length);




		submenu = document.layers[idMainMenu+"submenu"];
//alert(submenu.visibility + " " + submenu.id + " " + submenu.zIndex);
//submenu.zIndex = 10
		if (lastMenu != null && lastMenu != submenu) hideAll();
		submenu.left = document.layers[1].layers[idMainMenu].pageX;
//		submenu.top  = document.layers[1].layers[idMainMenu].pageY + 25;
		if (window.pageYOffset<14) submenu.top = window.pageYOffset + 53 ;
		else submenu.top = window.pageYOffset + 26 ;
		submenu.visibility = fShow;

		leftX  = document.layers[idMainMenu+"submenu"].left;
		rightX = leftX + document.layers[idMainMenu+"submenu"].clip.width;
		leftY  = document.layers[idMainMenu+"submenu"].top+
			document.layers[idMainMenu+"submenu"].clip.height;
		rightY = leftY;
	} else if (ie||ns6) {
		menu = ie? eval(idMainMenu) : document.getElementById(idMainMenu);
		submenu = ie? eval(idMainMenu+"submenu.style") : document.getElementById(idMainMenu+"submenu").style;
		submenu.left = calculateSumOffset(menu, 'offsetLeft');
//		submenu.top  = calculateSumOffset(menu, 'offsetTop') + 30;
		if (document.body.scrollTop <10) submenu.top  = document.body.scrollTop + 53;
		else  submenu.top  = document.body.scrollTop + 22; //menu.style.top+39;
		submenu.visibility = fShow;
		if (lastMenu != null && lastMenu != submenu) hideAll();

		leftX  = ie? document.all[idMainMenu+"submenu"].style.posLeft : parseInt(document.getElementById(idMainMenu+"submenu").style.left);
		rightX = ie? leftX + document.all[idMainMenu+"submenu"].offsetWidth : leftX+parseInt(document.getElementById(idMainMenu+"submenu").offsetWidth);

		leftY  = ie? document.all[idMainMenu+"submenu"].style.posTop+
			document.all[idMainMenu+"submenu"].offsetHeight : parseInt(document.getElementById(idMainMenu+"submenu").style.top)+parseInt(document.getElementById(idMainMenu+"submenu").offsetHeight);
		rightY = leftY;
	};
	lastMenu = submenu;
}

function hideAll()
{
	if (lastMenu != null) {lastMenu.visibility = fHide;lastMenu.left = 0;}
}

function calculateSumOffset(idItem, offsetName)
{
	var totalOffset = 0;
	var item = eval('idItem');
	do
	{
		totalOffset += eval('item.'+offsetName);
		item = eval('item.offsetParent');
	} while (item != null);
	return totalOffset;
}

function updateIt(e)
{
	if (ie&&!opr6)
	{
		var x = window.event.clientX;
		var y = window.event.clientY;

		if (x > rightX || x < leftX) hideAll();
		else if (y > rightY) hideAll();
	}
	if (n||ns6)
	{
		var x = e.pageX;
		var y = e.pageY;

		if (x > rightX || x < leftX) hideAll();
		else if (y > rightY) hideAll();
	}
}

function operahide(){
        if (opr6){
        if (!MainTable.contains(event.toElement))
        hideAll()
}
}

if (ie||ns6)
{
	document.body.onclick=hideAll;
	document.body.onscroll=hideAll;
	document.body.onmousemove=updateIt;
}
if (document.layers)
{
	window.captureEvents(Event.MOUSEMOVE);
	window.captureEvents(Event.CLICK);
	window.onmousemove=updateIt;
	window.onclick=hideAll;
}