<!--
n=0;
ie=0;
ok=0;
isMac=0;
if (document.layers)    {n=1;ie=0;fShow="show";fHide="hide";ok=1;}
if (document.all!=null) {
	n=0;ie=1;fShow="visible";fHide="hidden";ok=1;
	if(navigator.platform=="MacPPC"){ok=0;}
}
lastMenu=null;

window.onerror=new Function("return true")
rightX =0;
rightY =0;
leftY = 0;
leftX = 0;


////////////////////////////////////////////////////////////////////////////
// Function Menu()                                                        //
////////////////////////////////////////////////////////////////////////////
function Menu()
{
	this.bgColor     = "#992A11";
	if (ie) this.menuFont = "bold xx-small Verdana";
	if (n)  this.menuFont = "bold x-small Verdana";
//	this.fontColor   = "white";

	this.addItem    = addItem;
	this.addSubItem = addSubItem;
	this.showMenu   = showMenu;
	this.mainPaneBorder = 0;
	this.subMenuPaneBorder = 0;
	this.subMenuPaneWidth = 150;
	lastMenu = null;

	

	HTMLstr="";
	if (ok==1){
	HTMLstr += "<!-- MENU PANE DECLARATION BEGINS -->\n";
	HTMLstr += "\n";
	if (ie) HTMLstr += "<div id='MainTable'>\n";

//	if (n)  HTMLstr += "<layer name='MainTable 'style='position:absolute'>\n";
	HTMLstr += "<table cellspacing='0' cellpadding='0' align='center' border='"+this.mainPaneBorder+"'>\n";
	HTMLstr += "<tr>";
	if (n) HTMLstr += "<td>";
	HTMLstr += "<!-- MAIN MENU STARTS -->\n";
	HTMLstr += "<!-- MAIN_MENU -->\n";
	HTMLstr += "<!-- MAIN MENU ENDS -->\n";
	if (n) HTMLstr += "</td>";
	HTMLstr += "</tr>\n";
	HTMLstr += "</table>\n";
	HTMLstr += "\n";
	HTMLstr += "<!-- SUB MENU STARTS -->\n";
	HTMLstr += "<!-- SUB_MENU -->\n";
	HTMLstr += "<!-- SUB MENU ENDS -->\n";
	if (ie) HTMLstr+= "</div>\n";
//	if (n)  HTMLstr+= "</layer>\n";
	HTMLstr += "<!-- MENU PANE DECALARATION ENDS -->\n";
	}
}

function addItem(idItem, text, hint, location, altLocation)
{
	var Lookup = "<!-- ITEM "+idItem+" -->";

	if (HTMLstr.indexOf(Lookup) != -1)
	{
		alert(idParent + " already exist");
		return;
	}
	var MENUitem = "";
	MENUitem += "\n<!-- ITEM "+idItem+" -->\n";
	if (n)
	{
		MENUitem += "<ilayer name="+idItem+">";
		if (location != null)
		{
			MENUitem += "<a class='clsMenuItemNS' href=\""+location+"\"> ";
		}
		else
		{
			if (altLocation != null)
				{
				MENUitem += "<a href='"+altLocation+"' onmouseover=\"displaySubMenu('"+idItem+"')\"onMouseDown=\"window.location='"+altLocation+"'\" >";
				}
			if (altLocation ==null)
			{MENUitem += "<a href='.'>";}

		}
		MENUitem += text;
		MENUitem += "</a>";
		MENUitem += "</ilayer></td><td>";
	}
	if (ie)
	{
		MENUitem += "<td>";
		MENUitem += "<div id='"+idItem+"' >";//style='position: relative; font: "+this.menuFont+";'
		MENUitem += "\n<a ";
//		MENUitem += "class=clsMenuItemIE ";
//		MENUitem += "style='text-decoration: none; font: "+this.menuFont+"; color: "+this.fontColor+"; cursor: hand;' ";
		if (hint != null)
			MENUitem += "title='"+hint+"' ";
		if (location != null)
		{

			MENUitem += "href=\""+location+"\" ";
		}
		else
		{
			if (altLocation != null)
				{
				
				MENUitem += "href=\""+altLocation+"\" ";
				MENUitem += "onMouseOver=\"displaySubMenu('"+idItem+"');\" ";
				MENUitem += "onMouseDown=\"window.location='"+altLocation+"';\" "
			}
			else
			{MENUitem += "href='.' ";}

		}
		MENUitem += ">";
		MENUitem += text;
		MENUitem += "</a>";
		MENUitem += "</div>";
		MENUitem += "</td>\n";
	}
	MENUitem += "<!-- END OF ITEM "+idItem+" -->\n\n";
	MENUitem += "<!-- MAIN_MENU -->\n";

	HTMLstr = HTMLstr.replace("<!-- MAIN_MENU -->\n", MENUitem);
}

function addSubItem(idParent, text, hint, location, bgColor, width)
{
	var MENUitem = "";
	Lookup = "<!-- ITEM "+idParent+" -->";
	if (HTMLstr.indexOf(Lookup) == -1)
	{
		alert(idParent + " not found");
		return;
	}
	Lookup = "<!-- NEXT ITEM OF SUB MENU "+ idParent +" -->";
	if (HTMLstr.indexOf(Lookup) == -1)
	{
		if (n)
		{
			MENUitem += "\n";
			MENUitem += "<layer id='"+idParent+"submenu' visibility=hide bgcolor='"+bgColor+"' below=''>\n";
			MENUitem += "<table border='0' bgcolor='"+bgColor+"' width="+width +">\n";
			MENUitem += "<!-- NEXT ITEM OF SUB MENU "+ idParent +" -->\n";
			MENUitem += "</table>\n";
			MENUitem += "</layer>\n";
			MENUitem += "\n";
		}
		if (ie)
		{
			MENUitem += "\n";
			if (isMac==0){
			MENUitem += "<div id='"+idParent+"submenu' style='position:absolute; visibility: hidden; width: "+width +"; font: "+this.menuFont+"; top: -300;'>";
			}
			if (isMac==1){
			MENUitem += "<div id='"+idParent+"submenu' style='position:absolute; visibility: hidden; width: "+width +"; font: "+this.menuFont+"z-index: 20;'>";
			}
			MENUitem += "<table border='0' cellpadding='0' cellspacing='0' bordercolor='#B3B5F9' bgcolor='"+bgColor+"' width=100%>";
			MENUitem += "<!-- NEXT ITEM OF SUB MENU "+ idParent +" -->\n";
			MENUitem += "</table>";
			MENUitem += "</div>\n";
		}
		MENUitem += "<!-- SUB_MENU -->\n";
		HTMLstr = HTMLstr.replace("<!-- SUB_MENU -->\n", MENUitem);
	}

	Lookup = "<!-- NEXT ITEM OF SUB MENU "+ idParent +" -->\n";
	if (n)  MENUitem = "<tr><td ><a class=clsMenuItemNS href='"+location+"'>"+text+"</a><br></td></tr>\n";
	if (ie) MENUitem = "<tr><td width=100%><a class=clsMenuItemIE href='"+location+"'>"+text+"</a>\n</td></tr>";
	MENUitem += Lookup;
	HTMLstr = HTMLstr.replace(Lookup, MENUitem);

}

function showMenu()
{

//	document.writeln(banner);
	document.writeln(HTMLstr);

}

////////////////////////////////////////////////////////////////////////////
// Private declaration
function displaySubMenu(idMainMenu)
{
	var menu;
	var submenu;
	if (n)
	{
		if (document.layers[idMainMenu+"submenu"]){
		submenu = document.layers[idMainMenu+"submenu"];
		if (lastMenu != null && lastMenu != submenu) hideAll();
		submenu.left = document.layers[idMainMenu].pageX;
		submenu.top  = document.layers[idMainMenu].pageY + 23;
		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) {
		menu = eval(idMainMenu);
		if (eval(idMainMenu+"submenu.style")){
		submenu = eval(idMainMenu+"submenu.style");
		submenu.left = calculateSumOffset(menu, 'offsetLeft');
		submenu.top  = calculateSumOffset(menu, 'offsetTop') + document.all[idMainMenu].style.posTop+23;
//		submenu.top  = document.all[idMainMenu].style.postop +16;
		if (lastMenu != null && lastMenu != submenu) hideAll();
		submenu.visibility = fShow;
		leftX  = document.all[idMainMenu+"submenu"].style.posLeft;
		rightX = leftX + document.all[idMainMenu+"submenu"].offsetWidth;
		leftY  = document.all[idMainMenu+"submenu"].style.posTop+
		document.all[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');
	while (item != null){
		totalOffset += eval('item.'+offsetName);
		item = eval('item.offsetParent');
	}

	return totalOffset;	
}

function updateItn(e)
{
	
	if (n)
	{
		var x = e.pageX;
		var y = e.pageY;

		if (x > rightX || x < leftX) hideAll();
		else if (y > rightY) hideAll();
	}
}
function updateIt(e)
{
		var x = window.event.clientX;
		var y = window.event.clientY;

		if (x > rightX+2 || x < leftX-2) hideAll();
		else if (y > rightY+2) hideAll();
}

if (document.all)
{
	document.onclick=hideAll;
	document.onscroll=hideAll;
	document.onmousemove=updateIt;
}
if (document.layers)
{
	document.onmousedown=hideAll;
	window.captureEvents(Event.MOUSEMOVE);
	window.onmousemove=updateItn;
}

//-->
	

