var iSelectedOptionId;
function SetMenuOption(sId){
    iSelectedOptionId = sId;
    objImg = document.getElementById("img_"+ sId);
    if(objImg) objImg.src = objImg.src.replace('-off', '-on'); 
}
function SetMenuOptionClass(sId, sClassName){
    iSelectedOptionId = sId;
    document.getElementById(sId).className = sClassName;
}
/********* TOPLEVEL FUNCTIONS ************/
var	ie=document.all;
var sCurrentMenu="";
var sOldCurrentMenu ="";
var bMenuCurrent = false;
function GetPageElement(sName)
{
	if ( document.getElementById )
	{
		return document.getElementById(sName);
	}
	if ( document.all )
	{
		return document.all[sName];
	}
	eval( "if (document" + sName + ")" )
	{
		return eval ( "document" + sName );
	}
	return null;
}

function hideElement( elmID, overDiv )
{
    if( ie )
    {
    for( i = 0; i < document.all.tags( elmID ).length; i++ )
    {
        obj = document.all.tags( elmID )[i];
        if( !obj || !obj.offsetParent )
        {
        continue;
        }
        // Find the element's offsetTop and offsetLeft relative to the BODY tag.
        objLeft   = obj.offsetLeft;
        objTop    = obj.offsetTop;
        objParent = obj.offsetParent;
        while( objParent.tagName.toUpperCase() != "BODY" )
        {
        objLeft  += objParent.offsetLeft;
        objTop   += objParent.offsetTop;
        objParent = objParent.offsetParent;
        }
        objHeight = obj.offsetHeight;
        objWidth = obj.offsetWidth;
        if(( overDiv.offsetLeft + overDiv.offsetWidth ) <= objLeft );
        else if(( overDiv.offsetTop + overDiv.offsetHeight ) <= objTop );
        else if( overDiv.offsetTop >= ( objTop + objHeight ));
        else if( overDiv.offsetLeft >= ( objLeft + objWidth ));
        else
        {
        obj.style.visibility = "hidden";
        }
    }
    }
}

function showElement( elmID )
{
    if( ie )
    {
    for( i = 0; i < document.all.tags( elmID ).length; i++ )
    {
        obj = document.all.tags( elmID )[i];
        
        if( !obj || !obj.offsetParent )
        {
        continue;
        }
    
        obj.style.visibility = "";
    }
    }
}

function MouseOver(sMenuName, sId)
{
	var sName = "";
	var obj = null;
	if (sId)
	{
		var oOption = oMenuCollection.getoption( sMenuName, sId );
		if ( oOption != null )
		{
			obj1 = GetPageElement( oOption.name );
			if (obj1)
			{
			    obj1.style.cursor="pointer";
			    var objParent = obj1.parentNode;
				while ( ( objParent ) && ( objParent.className != "jsmenumenuTabPage" ) )
				{
					objParent = objParent.parentNode;
				}
				if( objParent )
				{
					sCurrentMenu = obj1.id;
				}
				//alert( oOption.cssselectedstyle + " - " + obj1.className);
				obj1.className = oOption.cssselectedstyle;
			}
			
			objImg = GetPageElement("img_" + sId);
		    if (objImg)
		    {
			    objImg.src = objImg.src.replace('-off', '-on');
			}
		    
			if ( oOption.submenu != null )
			{
				sName = oOption.submenu.name;
				obj = GetPageElement( sName );
				if ( obj )
				{
					if ( oOption.submenu.timerid != null )
					{
						clearTimeout( oOption.submenu.timerid );
						oOption.submenu.timerid = null;
					}
					obj.style.visibility = "visible";/**/
					obj.style.display = "block";/**/
					
					if ( !oMenuCollection.notie ) {
					    hideElement( "SELECT", obj ); 
					} else if ( (oMenuCollection.isfirefox) && (oMenuCollection.ismac) ) {
					    hideDivScroll( obj, "list", "listhidescroll" );
					}
				}
			}
		}
	}
	else
	{
		obj = GetPageElement( sMenuName );
		if (obj)
		{
			obj.style.visibility = "visible";
			if ( !oMenuCollection.notie ) hideElement("SELECT", obj); else if ( oMenuCollection.isfirefox && oMenuCollection.ismac ) hideDivScroll(obj,"list","listhidescroll");
		}
		//if ( !oMenuCollection.ismac )
		{
			var oMenu = oMenuCollection.getmenu( sMenuName );
			if ( oMenu )
			{
				if ( oMenu.parent )
				{
					if ( oMenu.parent.cssselectedstyle != "" )
					{
						var oParentOption = GetPageElement( oMenu.parent.name );
						if (oParentOption)
						{
							oParentOption.className = oMenu.parent.cssselectedstyle;
						}
					}
				}
			}
		}
	}
}


function MouseOut(sMenuName, sId)
{
	var sName = "";
	var obj = null;
	if (sId)
	{
		var oOption = oMenuCollection.getoption(sMenuName, sId);
		if (oOption != null)
		{
			obj1 = GetPageElement(oOption.name);
			if (obj1)
			{
			    obj1.style.cursor="pointer";
			    var objMenuCurrent = document.getElementById(sCurrentMenu);
			    var objOldMenuCurrent = document.getElementById(sOldCurrentMenu);
				if (objMenuCurrent.id != obj1.id)
				obj1.className = oOption.cssstyle;
				else
				{
					if((!bMenuCurrent)) 
					{
			            if (iSelectedOptionId == null || iSelectedOptionId!=sId){
						    obj1.className = oOption.cssstyle;
						}
					}
					else
					{
						if ( objMenuCurrent.id != objOldMenuCurrent.id )
							obj1.className = oOption.cssstyle;
					}
				}
			}
		
			objImg = GetPageElement("img_" + sId);
		    if (objImg)
		    {
			    if (iSelectedOptionId == null || iSelectedOptionId!=sId){
			        objImg.src = objImg.src.replace('-on', '-off');
			    }
		    }
		    
			if ( oOption.submenu != null )
			{
				sName = oOption.submenu.name;
				obj = GetPageElement(sName);
				if (obj)
				{
					obj.style.visibility = "hidden";
					if (!oMenuCollection.notie) showElement("SELECT"); else if (oMenuCollection.isfirefox && oMenuCollection.ismac) /*if (!isPopinOpen())*/ showDivScroll("list","listhidescroll");
				}
			}
		}
	}
	else
	{
		obj = GetPageElement(sMenuName);
		if (obj)
		{
			obj.style.visibility = "hidden";
			if (!oMenuCollection.notie) showElement("SELECT"); else if (oMenuCollection.isfirefox && oMenuCollection.ismac) /*if (!isPopinOpen())*/ showDivScroll("list","listhidescroll");
		}
		//if (!oMenuCollection.ismac)
		{
			var oMenu = oMenuCollection.getmenu(sMenuName);
			if (oMenu)
			{
				if (oMenu.parent)
				{
					if ( oMenu.parent.cssselectedstyle != "" )
					{
						var oParentOption = GetPageElement(oMenu.parent.name);
						if (oParentOption)
						{
						    var objMenuCurrent = document.getElementById(sCurrentMenu);
						    var objOldMenuCurrent = document.getElementById(sOldCurrentMenu);
							if ( objMenuCurrent.id != oParentOption.id )
								oParentOption.className = oMenu.parent.cssstyle;
							else 
							{
								if((!bMenuCurrent)) 
								{
								    if (iSelectedOptionId == null || iSelectedOptionId!=oParentOption.id){
                                        oParentOption.className = oMenu.parent.cssstyle;
                                    }
								}
								else 
								{
									if ( objMenuCurrent.id != objOldMenuCurrent.id )
									
										oParentOption.className = oMenu.parent.cssstyle;
								}
							}
						}
					}
				}
			}
		}
	}
}
function StartScroll(sDirection, sOuterDivId, sInnerDivId)
{
	var oInnerDiv = GetPageElement(sInnerDivId);
	var oOuterDiv = GetPageElement(sOuterDivId);
	if (oInnerDiv && oOuterDiv)
	{
		var iTop = parseInt(oInnerDiv.style.top);
		var iHeight = 0;
		var iOuterHeight = 0;
		iHeight = parseInt(oInnerDiv.offsetHeight);
		iOuterHeight = parseInt(oOuterDiv.offsetHeight);
		if (sDirection == 'up')
		{
			iTop = iTop + oMenuCollection.scrollstep;
		}
		else
		{
			iTop = iTop - oMenuCollection.scrollstep;
		}
		if ( iTop > 0 ) iTop = 0;
		if ( iTop < ( iOuterHeight - iHeight ) ) iTop = iOuterHeight - iHeight;
		oInnerDiv.style.top = "" + iTop + "px";
		oMenuCollection.timerid = setTimeout(function(){StartScroll(sDirection, sOuterDivId, sInnerDivId)}, oMenuCollection.scrollfrequency);
	}
}
function StopScroll()
{
	if ( oMenuCollection.timerid != null )
	{
		clearTimeout(oMenuCollection.timerid);
		oMenuCollection.timerid = null;
	}
}
/******************* TIMER ******************/
function MouseOverTimer(sMenuName, sId)
{
	var oMenu = oMenuCollection.getmenu(sMenuName);
	if (oMenu)
	{
		if ( oMenu.timerid != null )
		{
			clearTimeout(oMenu.timerid);
			oMenu.timerid = null;
		}
		if (sId)
		{
			MouseOver(sMenuName, sId);
		}
		else
		{
			MouseOver(sMenuName);
		}
	}
}
function MouseOutTimer(sMenuName, sId)
{
	var oMenu = oMenuCollection.getmenu(sMenuName);
	if (oMenu)
	{
		if (oMenu.timerid == null)
		{
			if (sId)
			{
				oMenu.timerid = setTimeout(function(){if ( typeof(MouseOut) == "function" ) MouseOut(sMenuName,sId)}, 400);
			}
			else
			{
				oMenu.timerid = setTimeout(function(){if ( typeof(MouseOut) == "function" ) MouseOut(sMenuName)}, 400);
			}
		}
	}
}
/************* CLASS MENUCOLLECTION **************/
function CMenuCollection()
{
	this.type = "MenuCollection";
	this.submenuarrow = "<img src='images/Bullets.gif'/>";
	this.submenuarrowup = "...";
	this.submenuarrowdown = "...";
	this.submenuarrowupstyle = "";
	this.submenuarrowdownstyle = "";
	this.submenuscrolldivstyle = "";
	this.maxitemsforscroll = 12;
	this.submenurowheight = 20;
	this.scrollfrequency = 30;
	this.scrollstep = 8;
	this.menucount = 0;
	this.optioncount = 0;
	this.numoptions = 0;
	this.option = new Array();
	this.addmenu = AddMenu;
	this.getmenu = GetMenu;
	this.getoption = GetMenuOption;
	this.setsubmenuarrow = SetSubmenuArrow;
	this.setsubmenuarrowup = SetSubmenuArrowUp;
	this.setsubmenuarrowdown = SetSubmenuArrowDown;
	this.setsubmenuarrowupstyle = SetSubmenuArrowUpStyle;
	this.setsubmenuarrowdownstyle = SetSubmenuArrowDownStyle;
	this.setmaxitemsforscroll = SetMaxItemsForScroll;
	this.setsubmenurowheight = SetSubmenuRowHeight;
	this.setsubmenuscrolldivstyle = SetSubmenuScrollDivStyle;
	this.buildmenuname = BuildMenuName;
	this.buildoptionname = BuildOptionName;
	this.notie = !document.all;
	this.ismac = ( navigator.appVersion.toLowerCase().indexOf("mac") != -1 );//true
	this.isopera = (navigator.userAgent.indexOf("Opera")!=-1);
	this.isfirefox = ( navigator.userAgent.indexOf("Firefox") != -1 );
	this.timerid = null;
}
function BuildMenuName()
{
	var sMenuName = "menu" + this.menucount;
	this.menucount++;
	return sMenuName;
}
function BuildOptionName()
{
	var sOptionName = "option" + this.optioncount;
	this.optioncount++;
	return sOptionName;
}
function SetSubmenuArrow(sText)
{
	this.submenuarrow = sText;
}
function SetSubmenuArrowUp(sText)
{
	this.submenuarrowup = sText;
}
function SetSubmenuArrowDown(sText)
{
	this.submenuarrowdown = sText;
}
function SetSubmenuArrowUpStyle(sText)
{
	this.submenuarrowupstyle = sText;
}
function SetSubmenuArrowDownStyle(sText)
{
	this.submenuarrowdownstyle = sText;
}
function SetMaxItemsForScroll(nCount)
{
	this.maxitemsforscroll = nCount;
}
function SetSubmenuRowHeight(iHeight)
{
	this.submenurowheight = iHeight;
}
function SetSubmenuScrollDivStyle(sText)
{
	this.submenuscrolldivstyle = sText;
}
function AddMenu(nLeft, nTop, sStyle, nWidth, sDirection)
{
	this.option[this.numoptions] = new CMenu(this, nLeft, nTop, sStyle, sDirection, nWidth);
	this.numoptions++;
	return this.option[this.numoptions-1];
}
function GetMenu(sName)
{
	var j = 0;
	var i = 0;
	var bFound = false;
	var oMenu = null;
	while ( ( i < this.numoptions ) && ( !bFound ) )
	{
		if ( this.option[i].name == sName )
		{
			bFound = true;
		}
		else
		{
			j = 0;
			while ( ( j < this.option[i].numoptions ) && ( oMenu == null ) )
			{
				oMenu = this.option[i].option[j].getmenu( sName );
				j++;
			}
			if ( oMenu != null )
			{
				bFound = true;
			}
			else
			{
				i++;
			}
		}
	}
	if ( bFound )
	{
		if ( oMenu != null )
		{
			return oMenu;
		}
		else
		{
			return this.option[i];
		}
	}
	else
	{
		return null;
	}
}
function GetMenuOption(sMenuName, sOptionName)
{
	var i = 0;
	var bFound = false;
	var oOption = null;
	while ( ( i < this.numoptions ) && ( !bFound ) )
	{
		oOption = this.option[i].getoptionrecursive( sMenuName, sOptionName );
		if ( oOption != null )
		{
			bFound = true;
		}
		else
		{
			i++;
		}
	}
	if (bFound)
	{
		return oOption;
	}
	else
	{
		return null;
	}
}
/****************** CLASS MENU **********************/
function CMenu(oParent, nLeft, nTop, sStyle, sDirection, nWidth)
{
	this.type = "Menu";
	this.name = oMenuCollection.buildmenuname();
	this.left = nLeft;
	this.top = nTop;
	this.width = (nWidth != null) ? nWidth : 0;
	this.cssstyle = (sStyle != null) ? sStyle : "";
	this.numoptions = 0;
	this.direction = (sDirection == "Horizontal") ? "Horizontal" : "Vertical";
	this.option = new Array();
	this.parent = oParent;
	if (oParent) oParent.submenu = this;
	this.addoption = AddOption;
	this.getoption = GetOption;
	this.getoptionrecursive = GetOptionRecursive;
	this.getcode = GetMenuCode;
	this.draw = DrawMenu;
	this.getDraw = getDrawMenu;
	this.timerid = null;
}
function AddOption(sText, sUrl, sStyle, sSelectedStyle, bActive, sIcon, sWidth)
{
	this.option[this.numoptions] = new COptionMenu(this, sText, sUrl, sStyle, sSelectedStyle, bActive, sIcon, sWidth);
	this.numoptions++;
	return this.option[this.numoptions-1];
}
function GetOption(sName)
{
	var i = 0;
	var bFound = false;
	while ( ( i < this.numoptions) && ( !bFound ) )
	{
		if ( this.option[i].name == sName )
		{
			bFound = true;
		}
		else
		{
			i++;
		}
	}
	if ( bFound )
	{
		return this.option[i];
	}
	else
	{
		return null;
	}
}
//recursive
function GetOptionRecursive( sMenuName, sOptionName )
{
//alert( "GetOptionRecursive( " + sMenuName + ", " + sOptionName + " )" );
	var i = 0;
	var bFound = false;
	var oOption = null;
	while ( ( i < this.numoptions ) && ( !bFound ) )
	{
		oOption = this.option[i];
		if ( ( ( oOption.name + "" ) == ( sOptionName + "" ) ) && ( ( oOption.parent.name + "" ) == ( sMenuName + "" ) ) )
		{
//alert( "oOption.name:" + oOption.name + "==" +  sOptionName + " ? AND " + oOption.parent.name + "=" + oOption.parent.name + "*" );
			bFound = true;
		}
		else
		{
			if ( oOption.submenu != null )
			{
				oOption = oOption.submenu.getoptionrecursive( sMenuName, sOptionName );
				if ( oOption != null )
				{
					bFound = true;
				}
				else
				{
					i++;
				}
			}
			else
			{
				i++;
			}
		}
	}
	if (bFound)
	{
		return oOption;
	}
	else
	{
		return null;
	}
}
function DrawMenu()
{
	var sCode = this.getcode();
	document.write(sCode);
}
function getDrawMenu()
{
	var sCode = this.getcode();
	return sCode;
}
//recursive
function GetMenuCode()
{
	var sReturn = "";
	var i = 0;
	var oOption = null;
	var j = 0;
	sReturn += "<div id=\"" + this.name + "\"";
	sReturn += " style=\"";
	sReturn += "top:" + this.top + "px;";
	sReturn += "left:" + this.left + "px;";
		if ( this.width > 0 )
		{
			sReturn += "width:" + this.width + "px;";
		}
	if (this.parent != null)
	{
		if (this.parent.type == "MenuCollection")
		{
			sReturn += "position:relative;";
			sReturn += "visibility:visible;";
		}
		else
		{
			sReturn += "position:absolute;";
			sReturn += "visibility:hidden;";
		}
	}
	else
	{
		sReturn += "position:absolute;";
		sReturn += "visibility:hidden;";
	}
	sReturn += "\"";
	if (this.parent != null)
	{
		if (this.parent.type != "MenuCollection")
		{
			if (oMenuCollection.notie)
			{
				sReturn += " onmouseover=\"javascript:MouseOverTimer('" + this.name + "');\"";
				sReturn += " onmouseout=\"javascript:MouseOutTimer('" + this.name + "');\"";
			}
			else
			{
				sReturn += " onmouseover=\"javascript:MouseOver('" + this.name + "');\"";
				sReturn += " onmouseout=\"javascript:MouseOut('" + this.name + "');\"";
			}
		}
	}
	sReturn += " >\n";
	if ( this.parent.type == "MenuCollection" )
	{
		sReturn += "<table style=\"border-left:#000000 0px solid;\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
		sReturn += "<tr><td nowrap>\n";	
	}
	else
	{
		sReturn += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"3\">\n";
		sReturn += "<tr><td nowrap>\n";	
	}
	if ((this.parent.type != "MenuCollection") || (this.direction != "Horizontal"))
	{
		sReturn += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"";
		if ( this.width > 0 )
		{
			sReturn += " width=\"" + this.width + "\"";
		}
		sReturn += ">";
		if ( this.numoptions > oMenuCollection.maxitemsforscroll )
		{
			sReturn += "<tr><td align=\"center\"";
			if (oMenuCollection.submenuarrowupstyle != "")
			{
				sReturn += " class=\"" + oMenuCollection.submenuarrowupstyle + "\"";
			}
			sReturn += " onmouseover=\"javascript:StartScroll('up','scrollouterdiv__" + this.name + "','scrollinnerdiv__" + this.name + "');\" onmouseout=\"javascript:StopScroll();\"";
			sReturn += ">\n";
			sReturn += oMenuCollection.submenuarrowup;
			sReturn += "</td></tr>";
		}
		sReturn += "<tr><td>\n";
		sReturn += "<div id=\"scrollouterdiv__" + this.name + "\"";
		if ( this.numoptions > oMenuCollection.maxitemsforscroll )
		{
			sReturn += " style=\"overflow:hidden; height: " + (oMenuCollection.maxitemsforscroll * oMenuCollection.submenurowheight) + "px;";
			if ( ( this.width > 0 ) && ( ( oMenuCollection.notie ) || ( oMenuCollection.isopera ) ) )
			{
				sReturn += " width: " + this.width + "px;";
			}
			sReturn += "\"";
			if ( ( this.width > 0 ) && ( ( oMenuCollection.notie ) || ( oMenuCollection.isopera ) ) )
			{
				sReturn += " class=\"" + oMenuCollection.submenuscrolldivstyle + "\"";
			}
			sReturn += ">";
			sReturn += "<div id=\"scrollinnerdiv__" + this.name + "\" style=\"position:relative;top:0px;left:0px;\"";
		}
		sReturn += ">";
	}
	sReturn += "<table border=\"0\" cellpadding=\"0\" nowrap cellspacing=\"0\" class=\"" + this.cssstyle + "\"";
	sReturn += " width=\"100%\"";
	sReturn += ">\n";	
	if ( this.direction == "Horizontal" )
		sReturn += "<tr>\n";
	while ( i < this.numoptions )
	{
		oOption = this.option[i];
		if ( this.direction == "Vertical" )
			sReturn += "<tr valign=\"middle\">\n";
		sReturn += oOption.getcode();	
		if ( this.direction == "Vertical" )
			sReturn += "</tr>\n";
		i++;
	}
	if ( this.direction == "Horizontal" )
		sReturn += "</tr>\n";
	sReturn += "</table>\n";
	if ( ( this.parent.type != "MenuCollection" ) || ( this.direction != "Horizontal" ) )
	{
		if ( this.numoptions > oMenuCollection.maxitemsforscroll )
		{
			sReturn += "</div>";
		}
		sReturn += "</div>";
		sReturn += "</td></tr>";
		if ( this.numoptions > oMenuCollection.maxitemsforscroll )
		{
			sReturn += "<tr><td align=\"center\"";
			if ( oMenuCollection.submenuarrowdownstyle != "" )
			{
				sReturn += " class=\"" + oMenuCollection.submenuarrowdownstyle + "\"";
			}
			sReturn += " onmouseover=\"javascript:StartScroll('down','scrollouterdiv__" + this.name + "','scrollinnerdiv__" + this.name + "');\" onmouseout=\"javascript:StopScroll();\"";
			sReturn += ">\n";
			sReturn += oMenuCollection.submenuarrowdown;
			sReturn += "</td></tr>";
		}
		sReturn += "</table>\n";
	}
	sReturn += "</td></tr>\n";
	sReturn += "</table>\n";
	if ( ( this.parent.type == "MenuCollection" ) && ( this.direction == "Horizontal" ) )
	{
		sReturn += "</div>\n";
		sReturn += "<div style='LEFT:7px;VISIBILITY:visible;POSITION:absolute;TOP:24px;height:0px;z-index:1000'>\n";
	}
	i = 0;
	while ( i < this.numoptions )
	{
		oOption = this.option[i];
		if (oOption.submenu != null)
		{
			sReturn += oOption.submenu.getcode(1);
		}
		i++;
	}
		sReturn += "</div>\n";

	return sReturn;
}
/************* CLASS OPTIONMENU ************/
function COptionMenu(oParent, sText, sUrl, sStyle, sSelectedStyle, bActive, sIcon, sWidth)
{
	this.type = "Option";
	this.name = oMenuCollection.buildoptionname();
	this.text = sText;
	this.url = sUrl;
	this.cssstyle = sStyle;
	this.cssselectedstyle = sSelectedStyle;
	this.active = (bActive == false) ? false : true;
	this.icon = (sIcon != null) ? sIcon : "";
	this.submenu = null;
	this.parent = oParent;
	this.setsubmenu = SetSubmenu;
	this.getmenu = GetMenuRecursive;
	this.getcode = GetOptionCode;
	this.swidth = (sWidth) ? sWidth : "";
}
function SetSubmenu(oSubmenu)
{
	this.submenu = oSubmenu;
	oSubmenu.parent = this;
}
function GetOptionCode()
{
	var sReturn = "";// class=\"tdMenuTabPage\"
	sReturn += "<td height=\"22px\" id=\"" + this.name + "\" nowrap";
	sReturn += " align=\"center\"";
	if ( this.active )
	{
		sReturn += " onmouseover=\"javascript:MouseOver('" + this.parent.name + "','" + this.name + "');\" onmouseout=\"javascript:MouseOut('" + this.parent.name + "','" + this.name + "');\"";
	}
	sReturn += " class=\"" + this.cssstyle + "\"";

	sReturn += ( ( this.swidth != "") ? " width=\"" + this.swidth + "\"" : "");

	if ((this.submenu != null) || (!this.active))
	{
		sReturn += ">\n";
	}
	else
	{
		sReturn += " onclick=\"javascript:document.location='" + this.url + "';\"";
		sReturn += ">\n";
	}
	if ( this.parent.direction == "Vertical" )
	{
		sReturn += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"20\"";
		sReturn += "><tr>\n";
		if (this.icon != "")
		{
			sReturn += "<td align=\"left\" nowrap width=\"16\"><img src=\"" + this.icon + "\" border=\"0\"></td>\n";
		}
		sReturn += "<td align=\"left\" nowrap";
		sReturn += ">\n";
		sReturn += this.text;
		sReturn += "</td>\n";
		if (this.submenu != null)
		{
			sReturn += "<td align=\"center\" nowrap width=\"25\">" + oMenuCollection.submenuarrow + "</td>\n";
		}
		sReturn += "</tr></table>\n"
	}
	else
	{
		if (this.icon != "")
		{
			sReturn += "<table cellspacing=0 cellpadding=0 width=\"100%\"><tr><td width=\"17px\" align=right><img id='img_" + this.name + "' src=\"" + this.icon + "\" border=\"0\" ></td>\n";
		}
		sReturn += "<td class=\"tdTextMenuTabPage\">" + this.text + "</td></tr></table>";
	}
	sReturn += "</td>\n";
	return sReturn;
}
function GetMenuRecursive(sName)
{
	var i = 0;
	var oMenu = null;
	if ( this.submenu )
	{
		if ( this.submenu.name == sName )
		{
			return this.submenu;
		}
		else
		{
			i = 0;
			while ( ( i < this.submenu.numoptions) && ( oMenu == null ) )
			{
				oMenu = this.submenu.option[i].getmenu(sName);
				i++;
			}
			if (oMenu != null)
			{
				return oMenu;
			}
			else
			{
				return null;
			}
		}
	}
	else
	{
		return null;
	}
}
function SetImageMenu(img)
{
	 var oldsrc = img.src;
	 var newsrc =""; 
	 if(oldsrc.indexOf("_light")!=-1) newsrc = oldsrc.replace("_light","");
	 else 
	 {
		var image = oldsrc.substring(oldsrc.lastIndexOf("/"),oldsrc.length);
		var vImageName = image.split(".");
		var newName = vImageName[0]+"_light"+"."+vImageName[1];
		newsrc = oldsrc.substring(0,oldsrc.lastIndexOf("/"))+newName;
	 }
	img.src = newsrc;
}
function GetElementImage(objId)
{
	if(objId.hasChildNodes())
	{
		var cmenu=objId.childNodes;
		for ( var i = 0 ; i < cmenu.length; i++ )
		{
			if ( cmenu[i].nodeName.toLowerCase() == "img" ) return cmenu[i];
		} 
	}
	else return null;
}
function SetCurrentMenu()
{
 bMenuCurrent=true;
  if ( sCurrentMenu != "" )
  {
	var objMenuCurrent = document.getElementById(sCurrentMenu);
	if( sOldCurrentMenu != "" ) 
	{
	   var objOldMenuCurrent = document.getElementById(sOldCurrentMenu);
	   objOldMenuCurrent.className="menuoptionTabPage";
	   SetImageMenu(GetElementImage(objOldMenuCurrent));
	}
	objMenuCurrent.className="selectedoption";
	SetImageMenu(GetElementImage(objMenuCurrent));
	objMenuCurrent.className="selectedoption";
	sOldCurrentMenu = sCurrentMenu;
  }	
}
function MenuCurrent( objCurrentMenu)
{
 if((bMenuCurrent)) return true;
 else return false;
}
/******** INSTANCE OF MENUCOLLECTION CLASS ***********/
var oMenuCollection = new CMenuCollection();