try
{
    if( Sys && Sys.Application ){
        Sys.Application.notifyScriptLoaded();
    }
}
catch(ex){}

//
//		ASP EasyMenu
//	
//		Copyright obout inc      http://www.obout.com

// if menu should try to auto-position to avoid displaying out of the visible space
var ob_em_AutoPosition = true;
// the space around the menu where mouse can move without hiding the menu
var ob_em_displayOffset = 10;
// 
var isMenuOnTop = false;

function ob_EasyMenu(ob_em_menu_id, ob_em_oat_id, ob_em_ui, ob_em_il, ob_em_hz_o, ob_em_vt_o, ob_em_mc, ob_em_ds, ob_em_ds_mc, ob_em_ds_ec, ob_em_se, ob_em_zi, ob_em_isMSAJAXAvailable, ob_em_isAJAXPageAvailable, ob_em_ss, ob_em_vt, ob_em_sf, ob_em_ev, ob_em_uniqueid, ob_em_SelectTreeNode, ob_dropdownIncrement, ob_dropSpeed )
{	
    // show event
	this.showEvent = ob_em_se.toLowerCase();
	// z index
	this.ZIndex = ob_em_zi;
    // object id
	this.id = 'ob_em_' + ob_em_menu_id;
	// menu id
	this.menu_id = ob_em_menu_id;
	// items
	this.items = new Array();
	// submenus
	this.subMenus = new Array();
	// parentmenu
	this.parentMenu = null;
	// Object to Attach To array
	this.oat_id = ob_em_oat_id;
	this.oat_ids = new Array();
	// Uses Icons
	this.ui = ob_em_ui;
	// Icons are shown at left side
	this.il = ob_em_il;
	// Alignment (horizontal/vertical)
	this.vt = ob_em_vt;
	// Style Folder
	this.iconsFolder = ob_em_sf;
	// Events
	this.Events = ob_em_ev;
	// selected item
	this.selectedItemId = "";
	// specify if the treenode will be selected or not
	this.SelectTreeNode = ob_em_SelectTreeNode;

	//sliding values
	this.DropIncrement = (typeof ob_dropdownIncrement == 'undefined') ? 10 : ob_dropdownIncrement;
	this.DropTime = (typeof ob_dropSpeed == 'undefined') ? 10 : ob_dropSpeed;
	
	if (isIE) {
	    this.DropTime -= 3;
	    this.DropIncrement -= 2;
	}
		
	// menu classes
	this.classes = ob_em_mc; 
	ob_em_getDefaultClasses(this);
	this.styleSheet = ob_em_ss == null ? this.id : ob_em_ss;

	// horizontal and vertical offset to mouse pointer
	this.hz_o = ob_em_hz_o;
	if (isIE)
	{
	    this.hz_o = this.hz_o - Math.ceil(this.hz_o / 95); // 95 - a constant value - the amount of horizontal offset for which IE looses 1 px against FF
	}
	this.vt_o = ob_em_vt_o;
	// display style
	this.displayPosition = ob_em_ds.toLowerCase();
	this.menuCorner = ob_em_arrangeAlignProperty(ob_em_ds_mc.toLowerCase());
	this.elementCorner = ob_em_arrangeAlignProperty(ob_em_ds_ec.toLowerCase());
	// underlay offsets
	this.underlayOffsets;

	// element over which the show event occured
	this.el = null;
	// menu
	this.menu = document.getElementById(this.menu_id);
	this.menu.firstChild.cellPadding = "0";
	this.menu.firstChild.cellSpacing = "0";
	this.menu.firstChild.style.width = "100%";
	if (isIE || isSafari || !this.vt)
	    this.menu.style.display = "";
	else
	{
	    var overflowValue = ob_em_getStyle(this.menu, "overflow");
	    if (isOpera)
            overflowValue = this.menu.currentStyle.overflow;
	    
	    if (overflowValue == "auto" || overflowValue == "scroll")
	        this.menu.style.display = "";
	    else
	        this.menu.style.display = "";
	}
	
	this.menu.style.visibility = "visible";

	this.type = "ob_em_menu";
	this.menu.object = this;
	
	// underlay
	this.underlay = null;
	
	// additional properties
	this.showCoords = null;
	this.visibleFor = null;

	// the right click event handler
	this.documentMouseDown = ob_em_documentMouseDown;
	// the mouseOver, mouseOut handler
	this.mouseHover = ob_em_mouseHover;
	// shows the menu
	this.showMenu = ob_em_showMenu;
	// hides all menus
	this.hideMenu = ob_em_hideMenu;
	// the click on a menu item handler
	this.menuItemClick = ob_em_menuItemClick;
	// the attach to controls functions
	this.attachToControls = ob_em_attachToControls;
	this.attachToControl = ob_em_attachToControl;
	// the detach from controls functions
	this.detachFromControl = ob_em_detachFromControl;
	this.detachFromAllControls = ob_em_detachFromAllControls;
	// if the mouse is over the menu
	this.mouseOverMenu = ob_em_mouseOverMenu;
	// gets the menu top left coords
	this.getMenuCoords = ob_em_getMenuCoords;
	// computes menu coords from element
	this.GetMenuCoordsFromElement = ob_em_GetMenuCoordsFromElement;
	// variable to deternime if the menu was loaded
	this.IsLoaded = false;
	
	// adds a new item to this menu
	this.AddItem = ob_em_AddItem;
	// removes an item from this menu
	this.RemoveItem = ob_em_RemoveItem;
	// hides a menu item 
	this.HideItem = ob_em_HideItem;
	// show a hidden a menu item 
	this.ShowItem = ob_em_ShowItem;
	// set the new menu item innerHTML
	this.SetItemInnerHTML = ob_em_SetItemInnerHTML;
	
	// is MS.AJAX available
	this.isMSAJAXAvailable = ob_em_isMSAJAXAvailable;
	// is AJAXPage available
	this.isAJAXPageAvailable = ob_em_isAJAXPageAvailable;
	
	// IE fix
	try {document.execCommand("BackgroundImageCache", false, true);} catch(err) {}
	// if the menu is shown on first page load build the menu items
	if (this.showEvent == "always")
	    ob_em_buildMenuItems(this);
	else
	{ 
	    // if the menu is not shown on first page load 
	    // but it is attached to a html element other than menu item, build the menu items
	    for(var i=0;i<this.oat_id.length;i++)
	    {
	        try
	        {
	            //var pm = eval(this.oat_id[i]);
	            var pm = document.getElementById(this.oat_id[i]);
	            if (typeof(pm) == 'number') /* case with html elements with ids = numbers */
	            {
	                ob_em_buildMenuItems(this);        
	                break;
                }
                
                // this is the case the element is not yet rendered?
                if (pm == null && typeof(pm) == 'object')
                {
                    ob_em_buildMenuItems(this);        
	                break;
                }
	        }
	        catch(ex)
	        {
	            if (typeof pm == 'undefined')
	            {
	                ob_em_buildMenuItems(this);        
	                break;
	            }
	            continue;
	        }
	        
	        if (this.oat_id[i] == "" || (pm != null && pm.getAttribute('emType') != 'MenuItem'))
		    {
		        ob_em_buildMenuItems(this);        
		        break;
	        }
	    }
	}
	
	// this section is never called on page load
	if (this.showEvent != "always")
	{   
		// set the menu initial coords
		this.menu.style.top = "-2000px"; 
		this.menu.style.left = "0px"; 
        
		// the underlay that will be displayed around the menu
		ob_em_CreateMenuUnderlay (this.menu_id);
		this.underlay = document.getElementById(this.menu_id + "__underlay");
		
		// the iframe that will help display the menu
		/*if (isIE) */
		//{
			this.cover_iframe = document.getElementById(this.menu_id + "__iframe");
			if (this.cover_iframe != null)
			{
				this.cover_iframe.style.display = "";
				this.cover_iframe.style.position = "absolute";
				this.cover_iframe.style.visibility = "hidden"; 
				this.cover_iframe.style.top = "-2000px";
				this.cover_iframe.style.left = "0px"
			}
			else
				isIE = false;
		//}

		// make the menu direct child of the document (if not already)
		// if the menu is inside callback panel (MS AJAX, AJAXPage) don't make it document direct child - ignore this section
		if (!ob_em_isAJAXPageAvailable && !ob_em_isMSAJAXAvailable)
		{
		    if (document.body != this.underlay.parentNode)
		    {
			    /*if (isIE) */
				    document.body.insertBefore(this.cover_iframe, document.body.firstChild);
			    //document.body.insertBefore(this.underlay, document.body.firstChild);
			    document.body.insertBefore(this.menu, document.body.firstChild);
		    }
		}

		this.underlay.style.zIndex = 1 + parseInt(this.ZIndex, 10);
		this.menu.style.zIndex = 2 + parseInt(this.ZIndex, 10);

		// wire the event to hide the menu upon clicking on the document
		ob_em_safeAddOnEvent("onclick", "document", "document.ob_em_mouseclickcollection", "documentMouseDown(ev)", this.id);
		
		// if event is mouseover
		if (this.showEvent == "mouseover") 
		{
			// attach onmouseover and onmouseout events
			eval("this.menu.onmouseover = function(e) {heo_ProcessEvent(e, ob_em_MouseMoveProcess, null, '" + this.menu_id + "')};");
			eval("this.menu.onmouseout = function(e) {heo_ProcessEvent(e, null, ob_em_MouseMoveProcess, '" + this.menu_id + "')};");
			
			// attach onmouseover and onmouseout events
			eval("this.underlay.onmouseover = function(e) {heo_ProcessEvent(e, ob_em_MouseMoveProcess, null, '" + this.menu_id + "__underlay')};");
			eval("this.underlay.onmouseout = function(e) {heo_ProcessEvent(e, null, ob_em_MouseMoveProcess, '" + this.menu_id + "__underlay')};");
		}

		// attach EM to the AttachTo Items
		//ob_em_addLoadEvent(Function("ob_em_attachToControls(" + this.id + ")"));
		window.setTimeout(Function("ob_em_loadComplete(" + this.id + ")"), 1);
        
		this.underlay.oncontextmenu = ob_em_cancelEvent;
	}

	this.menu.oncontextmenu = ob_em_cancelEvent;

	// the onbeforeunload event
	window.onunload = ob_em_cleanUp;
	
	// unique menu id generated on each menu load
    this.uniqueid = ob_em_uniqueid;
}

// client side event triggered on menu load complete
// this event is triggered after all the available menus are loaded
function ob_em_loadComplete(menu) 
{
    var loadedMenus = 0;
    // loop thru the existent menus and check if are created
    for (var index = 0; index < ob_em_Menus.length; index++)
    {
        try
        {
            var isMenuLoaded = false;
            /*if (menu.isAJAXPageAvailable)
            {
                isMenuLoaded = typeof eval(ob_em_Menus[index]) == 'object' && eval(ob_em_Menus[index]).uniqueid == ob_em_MenusUniqueRep[eval(ob_em_Menus[index]).id];
            }
            else*/
            {
                isMenuLoaded = typeof eval(ob_em_Menus[index]) == 'object';
            }
                
            if (isMenuLoaded)
            {
                loadedMenus++;
                continue;
            } 
        }catch(ex){}
        break;
    }
    if (loadedMenus == ob_em_Menus.length)
        ob_em_attachToControls(menu);
    else
        window.setTimeout(Function("ob_em_loadComplete(" + eval(menu).id + ")"), 100);
}

/// menuObject - the EasyMenu object 
function ob_em_buildMenuItems(menuObject, isSubmenu)
{
    // wire the mouse over and mouse out events to the menu items
    var menuFirstChild2 = menuObject.menu.firstChild.firstChild;
	var itemsContainer = menuObject.vt ? menuFirstChild2.childNodes : menuFirstChild2.firstChild.childNodes;
	for (var i=0; i < itemsContainer.length; i++)
	{	
		// get the menu item
		obj = menuObject.vt ? itemsContainer[i].firstChild : itemsContainer[i];

		if (obj.id.toLowerCase().indexOf("_7r14l") == -1)
		{
		    if (isSubmenu)
		    {
		        // check if this item need to have any menu attached to
		        var hasMenuAttached = false;
	            for(var j=0;j<ob_em_Menus.length;j++)
                {
                    if (isOpera)
                    {
                        if (document.getElementById(ob_em_Menus[j].replace("ob_em_", "")) == null)
                        {
                            hasMenuAttached = false;
                            break;
                        }
                        
                        var attachToArray = document.getElementById(ob_em_Menus[j].replace("ob_em_", "")).getAttribute("attachTo").split(",");
                        
                        for (var index=0;index<attachToArray.length;index++)
                        {
                            if (attachToArray[index] == obj.id) 
                            {
                                hasMenuAttached = true;
                                break;
                            }    
                        }
                        
                        if (hasMenuAttached)
                            break;
                    }
                    else
                    {
                        if (eval(ob_em_Menus[j]).oat_id == obj.id) 
                        {
                            hasMenuAttached = true;
                            break;
                        }
                    }
                }
            }
            
		    if ((!isSubmenu || (isSubmenu && hasMenuAttached)) && !obj.alreadyAdded)
		    {
			    new ob_em_MenuItem(obj, menuObject);
			    if (isSubmenu && hasMenuAttached)
		            obj.alreadyAdded = true
			}
		}
			
		if (isOpera && obj.getAttribute("selected") != null && obj.getAttribute("selected") == "selected")
		    ob_em_SelectItem(obj.id); 
	}
	
	if (!isSubmenu)
	{
	    menuObject.itemsAdded = true;
	    menuObject.IsLoaded = true;
	}
}

function ob_em_buildSubmenu(id)
{
    // loop thru the existent menus on the page and check if any of the menu is attached to this item
    var menuObject = null;
    for(var i=0;i<ob_em_Menus.length;i++)
    {
        if (ob_em_searchArrayForElement (eval(ob_em_Menus[i]).oat_ids, id) != -1) 
        {
            menuObject = eval(ob_em_Menus[i]);
        }
    }
    
    // create menu object
    if (menuObject != null && typeof menuObject == 'object')
    {
        if (!menuObject.itemsAdded)
        {
            ob_em_buildMenuItems(menuObject);
        }
    }
}

function ob_em_getStyle(oElm, strCssRule)
{
    var strValue = "";
    if(document.defaultView && document.defaultView.getComputedStyle)
        strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
    else if(oElm.currentStyle)
    {
		try
		{
			strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){return p1.toUpperCase();});
			strValue = oElm.currentStyle[strCssRule];
        }
        catch(ex){}
    }
    return strValue;
}

function ob_em_MenuItem (obj, objMenu)
{
    var disabled = (obj.getAttribute("disabled") != null && obj.getAttribute("disabled") == "disabled");
    
	this.isSelected = (obj.getAttribute("selected") != null && obj.getAttribute("selected") == "true");

	// set initial style class
	obj.className = objMenu.classes[obj.getAttribute("emtype")]["c" + (this.isSelected ? "_o" : "")];
	
	objMenu.items.push (obj);
	
	// add a reference to the object
	obj.object = this;
	this.item = obj;
	this.menu = objMenu.menu;
	// set type
	this.type = "ob_em_menuitem";

	// set cellpadding, cellspacing and width properties
	obj.firstChild.cellPadding = "0";
	obj.firstChild.cellSpacing = "0";
	obj.firstChild.style.width = "100%";
	obj.firstChild.style.height = "100%";
	
	// the click link function
	this.clickLink = ob_em_clickLink;
	
	this.iconCell = null;
	this.leftroundcornerCell = obj.firstChild.firstChild.firstChild.firstChild;
	this.contentCell = obj.firstChild.firstChild.firstChild.firstChild.nextSibling;
	this.subMenuCell = obj.firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling;
	this.rightroundcornerCell = obj.firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling;
	if (objMenu.ui) 
	{
		this.iconCell = objMenu.il ? obj.firstChild.firstChild.firstChild.firstChild.nextSibling : obj.firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling;
		this.subMenuCell = objMenu.il ? obj.firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling : obj.firstChild.firstChild.firstChild.firstChild.nextSibling;
		this.contentCell = this.contentCell.nextSibling;
		this.rightroundcornerCell = obj.firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.nextSibling;
	}
	
	if (disabled)
	{
	    this.contentCell.style.color = "#A8A8A8";
	}
	
	if (!disabled)
	{
	    // add the events - do this with checking
	    ob_em_safeAddOnEvent("onmouseover", "document.getElementById('" + obj.id + "')", "document.getElementById('" + obj.id + "').ob_em_mouseovercollection", "heo_ProcessEvent(ev, function(ev){ob_em_buildSubmenu('" + obj.id + "');ob_em_ElementHover(ev, '" + obj.id + "', '" + objMenu.menu_id + "')}, null, '" + obj.id + "')", null);
	    ob_em_safeAddOnEvent("onmouseout", "document.getElementById('" + obj.id + "')", "document.getElementById('" + obj.id + "').ob_em_mouseoutcollection", "heo_ProcessEvent(ev, null, function(ev){ob_em_ElementHover(ev, '" + obj.id + "', '" + objMenu.menu_id + "')}, '" + obj.id + "')", null);
	}

	if (this.isSelected)
		objMenu.selectedItemId = obj.id;

    // empty the mouseclick collection - issues when using inside a callback panel
    if (objMenu.isAJAXPageAvailable || objMenu.isMSAJAXAvailable) document.getElementById(obj.id).ob_em_mouseclickcollection = undefined;
    
    if (!disabled)
    {
	    ob_em_safeAddOnEvent("onclick", "document.getElementById('" + obj.id + "')", "document.getElementById('" + obj.id + "').ob_em_mouseclickcollection", "menuItemClick(document.getElementById('" + obj.id + "'), ev)", objMenu.id);
	    obj.oncontextmenu = ob_em_cancelEvent;
    }
}

function ob_em_attachToControls (menuObject)
{
    // if the Items are menu items, need to be build first
	ob_em_buildMenuItems(menuObject, true);
		
	// loop through the array of controls ids
	var i=0;
	var IsMenuItemInitialized = true;
	while (i < menuObject.oat_id.length)
	{   
	    var itemObject = document.getElementById(menuObject.oat_id[i]);
	    if (itemObject != null && (itemObject.getAttribute('emType') != "MenuItem" || typeof itemObject.object != "undefined") && menuObject.attachToControl (menuObject.oat_id[i]))
	    {
			menuObject.oat_id.splice(i, 1);
        }
		else
		{
			if (itemObject != null && itemObject.getAttribute('emType') == "MenuItem" && typeof itemObject.object == "undefined")
			{
			    IsMenuItemInitialized = false;
			}
			
			i++;
        }
	}

	if ((menuObject.oat_id.length > 0 && !ob_em_wdl) || !IsMenuItemInitialized)
	{
		window.setTimeout(Function("ob_em_attachToControls(" + menuObject.id + ")"), 100);
		return;
    }
    
    menuObject.IsLoaded = true;
}

function ob_em_attachToControl (id)
{
	// if document is contained, we 'translate' this to document.body
	var ob_em_oat = id.toLowerCase() == "document" ? document.body : document.getElementById(id);
	if (ob_em_oat != null)
	{
		// if the menu is already attached to this element, don't attach again
		if (ob_em_searchArrayForElement (this.oat_ids, id) != -1) return;
		this.oat_ids.push (id);

		// attach the events
		if (ob_em_oat.id == "")
		{
			alert('The EasyMenu needs to be attached to some html element.\n\nPlease specify "AttachTo" value!');
		}
		else
		{
		    var obj = document.getElementById(ob_em_oat.id);
		    var disabled = (obj.getAttribute("disabled") != null && obj.getAttribute("disabled") == "disabled");
		    
		    if (!disabled)
		    {
			    if (this.showEvent == 'contextmenu')
			    {
				    ob_em_safeAddOnEvent("oncontextmenu", "document.getElementById('" + ob_em_oat.id + "')", "document.getElementById('" + ob_em_oat.id + "').ob_em_contextmenucollection", "documentMouseDown(" + (document.all ? "window.event" : "ev") + ");", this.id);
			    }
			    else if (this.showEvent == 'mouseclick')
			    {
				    ob_em_safeAddOnEvent("onclick", "document.getElementById('" + ob_em_oat.id + "')", "document.getElementById('" + ob_em_oat.id + "').ob_em_mouseclickcollection", "documentMouseDown(" + (document.all ? "window.event" : "ev") + ")", this.id);
				    ob_em_safeAddOnEvent("oncontextmenu", "document.getElementById('" + ob_em_oat.id + "')", "document.getElementById('" + ob_em_oat.id + "').ob_em_contextmenucollection", "hideMenu(" + (document.all ? "window.event" : "ev") + ", true, false, true)", this.id);
			    }
			    else if (this.showEvent == 'doubleclick')
			    {
				    ob_em_safeAddOnEvent("ondblclick", "document.getElementById('" + ob_em_oat.id + "')", "document.getElementById('" + ob_em_oat.id + "').ob_em_mouseclickcollection", "documentMouseDown(" + (document.all ? "window.event" : "ev") + ")", this.id);
				    ob_em_safeAddOnEvent("oncontextmenu", "document.getElementById('" + ob_em_oat.id + "')", "document.getElementById('" + ob_em_oat.id + "').ob_em_contextmenucollection", "hideMenu(" + (document.all ? "window.event" : "ev") + ", true, false, true)", this.id);
			    }
			    else if (this.showEvent == 'mouseover')
			    {
				    // do checking for onmouseover and onmouseout events
				    ob_em_safeAddOnEvent("onmouseover", "document.getElementById('" + ob_em_oat.id + "')", "document.getElementById('" + ob_em_oat.id + "').ob_em_mouseovercollection", "heo_ProcessEvent(ev, function(ev){ob_em_ElementHover(ev, '" + ob_em_oat.id + "', '" + this.menu_id + "')}, null, '" + ob_em_oat.id + "')", null);
				    ob_em_safeAddOnEvent("onmouseout", "document.getElementById('" + ob_em_oat.id + "')", "document.getElementById('" + ob_em_oat.id + "').ob_em_mouseoutcollection", "heo_ProcessEvent(ev, null, function(ev){ob_em_ElementHover(ev, '" + ob_em_oat.id + "', '" + this.menu_id + "')}, '" + ob_em_oat.id + "')", null);
			    }
			}
		}
			
		
		// if the control to attach to is a menu item belonging to a different menu
		var pm = ob_em_oat.object;
		if (pm != null && typeof pm.type != 'undefined' && pm.type == "ob_em_menuitem" && pm.menu.object.id != this.id)
		{
			pm = pm.menu.object;
			pm.subMenus.push (this);
			this.parentMenu = pm;
			this.parentItem = ob_em_oat;
			ob_em_oat.object.ob_em_submenu = this;
			// !!!
			document.getElementById(ob_em_oat.id).object.ob_em_submenu = this;
			
			if (this.showEvent == "mouseclick" || this.showEvent == "doubleclick" || this.showEvent == "contextmenu")
			{
				var noHide = ob_em_oat.getAttribute("nohide");
				ob_em_oat.object.wasNoHide = typeof noHide != 'undefined' && noHide != null && noHide.toLowerCase() == 'true';
				ob_em_oat.setAttribute("nohide", "true");
			}
			
			ob_em_oat.object.subMenuCell.style.display = "";
			ob_em_oat.object.contentCell.style.colspan = "1";

			// put underlay and menu over the parent menu
			if (pm.menu.style.zIndex != '')
			this.underlay.style.zIndex = parseInt(pm.menu.style.zIndex, 10) + 1;
			this.menu.style.zIndex = parseInt(this.underlay.style.zIndex, 10) + 1;
			
			// if attach to event is contextmenu then remove the cancel event function
			if (this.showEvent == 'contextmenu')
			ob_em_removeEvent(ob_em_oat, "oncontextmenu", ob_em_oat.ob_em_contextmenucollection, ob_em_cancelEvent);
		}
		
		if (typeof ob_em_oat.object == 'undefined' || ob_em_oat.object == null)
		{
			ob_em_oat.object = new Object();
			ob_em_oat.object.type = "ob_em_attachelement";
		}
		
		ob_em_oat.object.item = ob_em_oat;
		ob_em_oat.object.ob_em_submenu = this;
		this.parentItem = ob_em_oat;
		
		return true;
	}
	return false;
}

function ob_em_detachFromAllControls()
{
	var y = [];
	for (var i = 0; i < this.oat_ids.length; i++)
		y[i] = this.oat_ids[i];
		
	for (var j = 0; j < y.length; j++)
		this.detachFromControl (y[j]);
}

function ob_em_detachFromControl (id)
{
	// position of element in list of elements to which this element is attached
	var positionInArray = ob_em_searchArrayForElement (this.oat_ids, id);
	// if the menu didn't attach to this id
	if (positionInArray == -1) return;

	// if document is contained, we 'translate' this to document.body
	var ob_em_oat = id.toLowerCase() == "document" ? document.body : document.getElementById(id);

	// if the element is not null
	if (ob_em_oat != null)
	{
		try
		{
			// if menu is shown on right click
			if (this.showEvent == 'contextmenu')
			{
				// remove oncontextmenu
				ob_em_removeEvent (ob_em_oat, "oncontextmenu", ob_em_oat.ob_em_contextmenucollection, this.id + ".documentMouseDown");
			}
			// if menu is shown on mouse click
			else if (this.showEvent == 'mouseclick')
			{
				// remove onclick
				ob_em_removeEvent (ob_em_oat, "onclick", ob_em_oat.ob_em_mouseclickcollection, this.id + ".documentMouseDown");
				// remove oncontextmenu
				ob_em_removeEvent (ob_em_oat, "oncontextmenu", ob_em_oat.ob_em_contextmenucollection, this.id + ".hideMenu");
			}
			// if menu is shown on mouse double click
			else if (this.showEvent == 'doubleclick')
			{
				// remove ondblclick
				ob_em_removeEvent (ob_em_oat, "ondblclick", ob_em_oat.ob_em_mouseclickcollection, this.id + ".documentMouseDown");
				// remove oncontextmenu
				ob_em_removeEvent (ob_em_oat, "oncontextmenu", ob_em_oat.ob_em_contextmenucollection, this.id + ".hideMenu");
			}
			// if menu is shown on mouse over
			else if (this.showEvent == 'mouseover')
			{
				// remove onmouseover
				ob_em_removeEvent (ob_em_oat, "onmouseover", ob_em_oat.ob_em_mouseovercollection, 'ob_em_ElementHover(ev, \'' + ob_em_oat.id + '\', \'' + this.menu_id + '\')');
				// remove onmouseout
				ob_em_removeEvent (ob_em_oat, "onmouseout", ob_em_oat.ob_em_mouseoutcollection, 'ob_em_ElementHover(ev, \'' + ob_em_oat.id + '\', \'' + this.menu_id + '\')');
			}
		}
		catch (ex){}

		// if the control was attached to to a menu item belonging to a different menu
		var pm = ob_em_oat.object;
		if (pm != null && typeof pm.type != 'undefined' && pm.type == "ob_em_menuitem" && pm.menu.object.id != this.id)
		{
			pm = pm.menu.object;
			var subMenuPosition = ob_em_searchArrayForElement (pm.subMenus, this);
			if (subMenuPosition != -1) pm.subMenus.splice (subMenuPosition, 1);
			
			if ((this.showEvent == "mouseclick" || this.showEvent == "doubleclick" || this.showEvent == "contextmenu")
				&& (typeof ob_em_oat.object.wasNoHide == "undefined" || !ob_em_oat.object.wasNoHide))
				ob_em_oat.setAttribute("nohide", "false");
			ob_em_oat.object.ob_em_submenu = null;

			ob_em_oat.object.subMenuCell.style.display = "none";
			ob_em_oat.object.contentCell.colspan = "2";

			this.parentMenu = null;
			this.parentItem = null;
		}
	}

	// remove from list with elements to which it's attached
	this.oat_ids.splice(positionInArray, 1);
}

function ob_em_documentMouseDown (e)
{
	if (!e) e = window.event;
	if (!e) 
	{
		this.hideMenu(null, true, false, true);
		return false;
	}

	var eventType = e.type.toLowerCase();
	if (e.type.toLowerCase() == "click") eventType = "mouseclick";
	if (e.type.toLowerCase() == "dblclick") eventType = "doubleclick";
	if (!document.all && e.type.toLowerCase() == "click" && e.which == 3) eventType = "contextmenu";

	var evElems = ob_em_GetEventElements(e);

	var itemSource = ob_em_GetParentItemFromElement(evElems[1], eventType, this.showEvent);
	if (itemSource != null)
		var itemIndex = ob_em_searchArrayForElement(this.oat_ids, itemSource.id);
	else itemIndex = -1;

	if (eventType == this.showEvent && itemIndex != -1)
	{
		this.visibleFor = itemSource.object;

		// try to show menu
		this.showMenu(e);
		
		ob_em_cancelEvent(e);
	}
	else 
	{
		// get the menu over which the click took place
		var menu = ob_em_GetParentMenuFromElement(evElems[1]);
		var index = 0;

		// if click was not over a menu
		if (menu == null)
		{
			// get the item over which the click took place
			var item = ob_em_GetParentItemFromElement(evElems[1], eventType, this.showEvent);
			// if the item is not null
			if (item != null)
			{
				var index = -1;
				
				// if menu is visible for this item
				if (item.object.ob_em_submenu.menu.visibleFor == item)
				{
					// get the index of the menu attached to this item
					index = ob_em_VisibleArrayIndexOf(item.object.ob_em_submenu.menu);
				
					// if menu was visible, move the index after the menu
					if (index != -1) index += 2;
					else index = 0;
				}
				else return false;
			}
		}
		else
		{
			index = ob_em_VisibleArrayIndexOf(menu);
			if (index != -1) index += 2;
			else index = 0;
		}

		ob_em_HideAllFromIndex(index, false);

 		return true;
 	}

	return false;
}

function ob_em_MouseMoveProcess(e)
{
	if (!e) e = window.event;
	if (!e) return false;
	
	var over = e.type.toLowerCase() == "mouseover";

	var evElems = ob_em_GetEventElements(e);

	var targetMenu = ob_em_GetParentMenuFromElement(evElems[0]);
	var sourceMenu = ob_em_GetParentMenuFromElement(evElems[1]);

	targetMenu = targetMenu != null ? targetMenu : ob_em_GetUnderlayFromElement(evElems[0]);
	sourceMenu = sourceMenu != null ? sourceMenu : ob_em_GetUnderlayFromElement(evElems[1]);

	if (!over)
	{
		if (typeof sourceMenu.menu != 'undefined' && typeof sourceMenu.menu.object == 'object' && typeof sourceMenu.menu.object.type != 'undefined' && sourceMenu.menu.object.type == 'ob_em_menu')
			sourceMenu = sourceMenu.menu;

		if (targetMenu != null)
		{
			if (typeof targetMenu.menu != 'undefined' && typeof targetMenu.menu.object == 'object' && typeof targetMenu.menu.object.type != 'undefined' && targetMenu.menu.object.type == 'ob_em_menu')
				targetMenu = targetMenu.menu;

			// if moved from menu to submenu
			if (ob_em_VisibleArrayElementHasPrecedence (sourceMenu, targetMenu))
				return;
			// if moved from submenu to menu
			else if (ob_em_VisibleArrayElementHasPrecedence (targetMenu, sourceMenu))
			{
				var menuItem = ob_em_GetParentItemFromElement(evElems[0]);
				if (menuItem != null && ob_em_MenuIsSubmenuOfElement(sourceMenu, menuItem))
					return;

				var menuIndex = ob_em_VisibleArrayIndexOf(sourceMenu);
				if (menuIndex > 0)
					ob_em_HideAllFromIndex(menuIndex, true);
				return;
			}
			else if (targetMenu.object.showEvent == "always")
			{
				var menuItem = ob_em_GetParentItemFromElement(evElems[0]);
				if (menuItem != null && ob_em_VisibleArrayElementHasPrecedence (menuItem, sourceMenu))
					return;
			}
		}
		else
		{ 
			targetMenu = ob_em_GetParentItemFromElement(evElems[0]);
			if (targetMenu != null && ob_em_MenuIsSubmenuOfElement(sourceMenu, targetMenu) && ob_em_MenuIsVisibleForElement(sourceMenu, targetMenu)) 
				return;
		}

		ob_em_HideAll(true);
	}
	
	return false;
}

function ob_em_ElementHover(e, elementId, menuId)
{
	var over = e.type.toLowerCase() == "mouseover";
	var element = document.getElementById(elementId);
	var menu = document.getElementById(menuId);
	
	if (over)
	{
		if (ob_em_MenuIsSubmenuOfElement(menu, element))
		{
			menu.object.visibleFor = element.object;
			menu.object.showMenu(e);
		}
	}
	else
	{
		var mouseTo = ob_em_GetEventElements(e)[0];
		var elementTo = ob_em_GetParentMenuFromElement(mouseTo);
		elementTo = elementTo == null ? ob_em_GetUnderlayFromElement(mouseTo) : elementTo;
		if (elementTo == null)
		{
			if (menu.object.showEvent == "mouseover")
				ob_em_HideAllFromIndex(Math.max(0,ob_em_VisibleArrayIndexOf(element)), menu.object.showEvent == "mouseover");
		}
		else
		{
			if (typeof elementTo.menu != 'undefined' && typeof elementTo.menu.object == 'object' && typeof elementTo.menu.object.type != 'undefined' && elementTo.menu.object.type == 'ob_em_menu')
				elementTo = elementTo.menu;
			
			// mouse moved from item to menu containing the item
			if (element.object.type == "ob_em_menuitem" && element.object.menu == elementTo)
			{
			}
			else
			{
				var itemTo = ob_em_GetParentItemFromElement(mouseTo);
					
				if (itemTo != null && itemTo.object.type == "ob_em_menuitem" && ob_em_VisibleArrayElementHasPrecedence(itemTo.object.menu, menu))
				{
					return;
				}
				else if (!ob_em_MenuIsSubmenuOfElement(elementTo, element) && !ob_em_MenuIsVisibleForElement(elementTo, element))
				{
					ob_em_HideAllFromIndex(Math.max(0,ob_em_VisibleArrayIndexOf(menu)), menu.object.showEvent != "mouseover" || menu.object.showEvent == "always");
				}
				else
				{
					return;
				}
			}
		}
	}

	if (element.object.type == "ob_em_menuitem")
		ob_em_mouseHover (element, e, over, false);
}

function ob_em_mouseHover (obj, e, over, force) {

	// if mouse moved out of item and not forced, if submenu is not on mouseover and 
	// submenu is visible, don't deselect the item
	if (!force && !over && obj.object.ob_em_submenu != null
		&& obj.object.ob_em_submenu.showEvent != "mouseover"
		&& obj.object.ob_em_submenu.underlay != null
		&& obj.object.ob_em_submenu.underlay.style.visibility.toLowerCase() == "visible")
			return;

	// if item is selected and mouse moved out, do not do any changes to it
	if (!obj.object.isSelected || over)
	{
		// we set the class name to that of the element type (if over, concatenated with _o)
		obj.className = obj.object.menu.object.classes[obj.getAttribute("emtype")]["c" + (over ? "_o" : "")];

		try
		{
		    // the left round corner cell
		    obj.object.leftroundcornerCell.className = obj.object.menu.object.classes[obj.getAttribute("emtype")]["c_" + obj.object.leftroundcornerCell.getAttribute("emtype") + (over ? "_o" : "")];
			// the content cell
			obj.object.contentCell.className = obj.object.menu.object.classes[obj.getAttribute("emtype")]["c_" + obj.object.contentCell.getAttribute("emtype") + (over ? "_o" : "")];
			// the submenu cell - use the div element inside
			//obj.object.subMenuCell.className = obj.object.menu.object.classes[obj.getAttribute("emtype")]["c_" + obj.object.subMenuCell.getAttribute("emtype") + (over ? "_o" : "")];
			obj.object.subMenuCell.firstChild.className = obj.object.menu.object.classes[obj.getAttribute("emtype")]["c_" + obj.object.subMenuCell.getAttribute("emtype") + (over ? "_o" : "")];
			// the right round corner cell
		    obj.object.rightroundcornerCell.className = obj.object.menu.object.classes[obj.getAttribute("emtype")]["c_" + obj.object.rightroundcornerCell.getAttribute("emtype") + (over ? "_o" : "")];

			// if the menu uses icons
			if (this.ui)
				obj.object.iconCell.className = obj.object.menu.object.classes[obj.getAttribute("emtype")]["c_" + obj.object.iconCell.getAttribute("emtype") + (over ? "_o" : "")];
		}
		catch (ex) {}
	}

	// if has no submenu, close all siblings' submenus
	// items with submenus close the siblings in showmenu
	if (over && obj.object.ob_em_submenu == null)
	{
		var index = ob_em_VisibleArrayIndexOf(obj.object.menu);
		if (index >= 0)
			ob_em_HideAllFromIndex(index + 2, obj.object.menu.object.showEvent != "mouseover");
	}
	
	// if mouseout and has submenu, hide it
	if (!over && obj.object.ob_em_submenu != null)
	{
		var index = ob_em_VisibleArrayIndexOf(obj.object.ob_em_submenu.menu);
		// if menu in visible list, remove from visible
		if (index > -1) 
			ob_em_HideAllFromIndex(index, obj.object.menu.object.showEvent != "mouseover");
	}
}

var tp_increment = 0;

function ob_em_showMenu(e, virtualElement, left, top)
{

    // BEFORE MENU OPEN EVENT
	if (ob_em_eventSet(this, "OnBeforeMenuOpen"))
	{
		if (!ob_em_OnBeforeMenuOpen(this.menu)) 
			return;
	}

	// do not attempt redraw if menu already visible
	if (this.underlay.style.visibility.toLowerCase() == "visible" && this.visibleFor.item == this.parentItem)
		return;

	if (!e) e = window.event;
	
	// set the element over which the event has taken place
	if (virtualElement != null)
	    this.el = virtualElement;
	else
	    this.el = ob_em_GetParentItemFromElement(ob_em_GetEventElements(e)[1]);
	if (this.el != null && typeof this.el.object != 'undefined')
		if (typeof this.el.object.ob_em_submenu == 'undefined' || this.el.object.ob_em_submenu == null || this.el.object.ob_em_submenu != this)
			return;
	
	// if by any chance a menu is to be shown without having its parent visible, it will not be shown
	if (this.parentMenu != null && this.el.menu != null && this.el.menu == this.parentMenu 
		&& this.parentMenu.underlay.style.visibility.toLowerCase() == 'hidden') 
			return;

	this.parentItem = (this.visibleFor != null ? this.visibleFor.item : this.parentItem);

	// make sure no sibling menus are visible
	if (this.parentItem.object.type == "ob_em_menuitem" && this.parentItem.object.menu.object.showEvent != "always")
	{
		var index = ob_em_VisibleArrayIndexOf(this.parentItem.object.menu);
		if (index >= 0) ob_em_HideAllFromIndex(index + 2, false);
	}
	else
	{
		ob_em_HideAll(false);
		ob_em_VisibleArrayPush (this.parentItem);
	}
	
	// make sure the parent item is marked as hovered
	if (this.parentItem.object.type == "ob_em_menuitem")
		ob_em_mouseHover (this.parentItem, e, true, false);
	
	// add the menu and the underlay to the visible list
	ob_em_VisibleArrayPush (this.menu);
	ob_em_VisibleArrayPush (this.underlay);

	// change the stylesheet to that of the menu
	ob_em_changeStyle(this.styleSheet);

	// unmark all items
	for (var i=0; i < this.items.length; i++) if (this.items[i].id != obj.id) 
		this.mouseHover (this.items[i], null, false, true);

	// underlay offsets set default
	this.underlayOffsets = {'left' : ob_em_displayOffset, 'top' : ob_em_displayOffset, 'right' : ob_em_displayOffset, 'bottom' : ob_em_displayOffset};
	
	// set initial underlay dimensions
	this.underlay.style.width = this.menu.offsetWidth + this.underlayOffsets['left'] + this.underlayOffsets['right'] + "px";
	this.underlay.style.height = this.menu.offsetHeight + this.underlayOffsets['top'] + this.underlayOffsets['bottom'] + "px";

	// get the coords of the menu
	if (virtualElement != null) {
	    if (parseInt(left) > 0 && parseInt(top) > 0)
	        this.showCoords = new Array(parseInt(left), parseInt(top));
	    else
	        this.showCoords = new Array(e.clientX + this.hz_o, e.clientY + this.vt_o);
	}
	else {
	    this.showCoords = this.getMenuCoords(e, true);
	}

	// update underlay dimensions
	this.underlay.style.width = this.menu.offsetWidth + this.underlayOffsets['left'] + this.underlayOffsets['right'] + "px";
	this.underlay.style.height = this.menu.offsetHeight + this.underlayOffsets['top'] + this.underlayOffsets['bottom'] + "px";

	// set the menu coordinates
	this.menu.style.left = this.showCoords[0] + "px";
	this.menu.style.top = this.showCoords[1] + "px";
	
	// set the underlay coordinates
	this.underlay.style.left = this.showCoords[0] - this.underlayOffsets['left'] + "px";
	this.underlay.style.top = this.showCoords[1] - this.underlayOffsets['top'] + "px";
	
	this.menu.style.overflowY = "hidden";
	
	// make the menu visible
	this.menu.style.visibility = "visible";

	// make the underlay visible
	this.underlay.style.visibility = "visible";

	if (isMenuOnTop) {
	    this.menu.style.top = this.showCoords[1] + this.menu.offsetHeight + 'px';
	}
	tp_increment = this.menu.offsetHeight - this.menu.firstChild.offsetHeight;
	
	this.menu.style.height = '0px';
	
	slideContent(this.menu.id, this.DropIncrement, this.showCoords[1], this.DropTime);
	
	// stop event propagation
	if (virtualElement != null)
	    ob_em_cancelEvent(e);

    if (this.SelectTreeNode)
    {
	    // if element is a treenode, select it
	    try {if (this.el.tagName.toLowerCase() == 'td' && this.el.className == 'ob_t2' && typeof tree_node_exp_col != 'undefined') {tree_node_exp_col=true;this.el.onclick();tree_node_exp_col=false;}} catch (ex) {}
    }

	// AFTER MENU OPEN EVENT
	if (ob_em_eventSet(this, "OnAfterMenuOpen"))
		ob_em_OnAfterMenuOpen(this.menu)

	return false;
}

function ob_em_hideMenu(e, withVerify, force, closeParents) {
   
	if (force == null) force = false;
	if (!e) e = window.event;

	// if menu is already hidden
	if (this.showEvent == "always" || this.underlay.style.visibility == 'hidden') return true;

	// this seems to be useless
	var isMouseOverMenu = force ? false : e ? (this.showCoords != null ? this.mouseOverMenu(e, this.showCoords) : false) : false;
	if (!force && isMouseOverMenu == null) return true;

	// BEFORE MENU CLOSE EVENT
	if (ob_em_eventSet(this, "OnBeforeMenuClose"))
	{
		if (!ob_em_OnBeforeMenuClose(this.menu))
			return false;
	}

	// if forced
	if (force 
		// or show event is not mouseover
		|| (this.showEvent != 'mouseover' 
			// or is mouseover and we have an event object and 
			|| (e 
				// don't verify
				&& (!withVerify 
					// or verify and mouse not over menu
					|| !isMouseOverMenu
					) 
				)
			)
		)
	{
		// hide all submenus
		for (var i=0; i < this.subMenus.length; i++) 
			if (this.subMenus[i].hideMenu (e, false, true, false)) {}
			else return false;

		// hide the iframe
			/*if (isIE)	*/
			this.cover_iframe.style.visibility = "hidden";
		
		// set its coordinates to -2000,0 and visibility to hidden
		this.menu.style.left = "0px";
		this.menu.style.top = "-2000px";
		this.menu.style.visibility = "hidden";
		
		// set underlay coordinates to -2000,0 and visibility to hidden
		this.underlay.style.left = "0px";
		this.underlay.style.top = "-2000px";
		this.underlay.style.visibility = "hidden";

		// if menu has parentMenu
		if (this.parentMenu != null)
		{
			// unmark parent item
			this.parentMenu.mouseHover (this.parentItem, e, false, true);
			// close the parent menu if mouse is not over it
			if (closeParents && (force || (this.showEvent == "mouseover" && this.parentMenu.showEvent == "mouseover")))
				this.parentMenu.hideMenu (e, true, false, true);
		}
		
		this.showCoords = null;
		this.visibleFor = null;
	}

	// AFTER MENU CLOSE EVENT
	if (ob_em_eventSet(this, "OnAfterMenuClose"))
		ob_em_OnAfterMenuClose(this.menu);
	
	return true;

	
}

function slideContent(menuObj, Increment, el_top, _dropTime) {
    
    var dropTime = _dropTime;
    var menuTop = el_top;
    
    var top = null;
    var obj = document.getElementById(menuObj);
        
    var contentObj = obj.firstChild;

    height = obj.offsetHeight;
    height = height + Increment;
    rerunFunction = true;

    obj.style.height = height + 'px';

    if (obj.offsetHeight < height) {
        obj.style.overflow = 'auto';
        rerunFunction = false;
    }

    if (isMenuOnTop) {
        top = obj.offsetTop ;
        top = top - (Increment + tp_increment);
        obj.style.top = top + 'px';
    }
        
    
   if (height >= contentObj.offsetHeight) {
       height = contentObj.offsetHeight;
       rerunFunction = false;
   }


  
   
   if (rerunFunction) {
       setTimeout("slideContent('" + menuObj + "'," + Increment + "," + menuTop + "," + dropTime + ")", dropTime);
   }

   else {
   
       obj.style.height = height + 1 + 'px';      
       if (isMenuOnTop) {
           obj.style.top = menuTop + 'px';
       }
   }
}

function ob_em_menuItemClick (htmlItem, menuEvent)
{   
	if (!menuEvent) menuEvent = window.event;
	
	// set the params that the client can make use of
	var targetEl = this.el;
	var easyMenu = this;
	var menuObject = htmlItem.object;

	targetEl = ob_em_visibleMenus[0];
	if (this.showEvent == "always") targetEl = htmlItem;

	// BEFORE ITEM CLICK EVENT
	if (ob_em_eventSet(this, "OnBeforeItemClick"))
	{
		if (!ob_em_OnBeforeItemClick(this.menu, htmlItem, targetEl, menuEvent))
			return false;
	}

	// hide the menu
	if (htmlItem.getAttribute("nohide") == null || htmlItem.getAttribute("nohide").toString().toLowerCase() != "true")
		ob_em_HideAllFromIndex(0, false);
	else 
		this.mouseHover (htmlItem, menuEvent, true, true);

	// execute client script
	eval(htmlItem.getAttribute("OnClientClick"));

	// if item has a url set, click it
	if (typeof htmlItem.object.contentCell.firstChild != 'undefined' 
		&& htmlItem.object.contentCell.firstChild != null 
		&& htmlItem.object.contentCell.firstChild.nodeType == 1 
		&& htmlItem.object.contentCell.firstChild.tagName.toLowerCase() == "a")
			htmlItem.object.clickLink(menuEvent);

	// AFTER ITEM CLICK EVENT
	if (ob_em_eventSet(this, "OnAfterItemClick"))
		ob_em_OnAfterItemClick(htmlItem, this.menu, targetEl, menuEvent);

	return false;
}

function ob_em_clickLink (e)
{
	if (!e) e = window.event;
	if (!e) return;
	
	// get the source element of the event
	var el = null;
	if (e.target) el = e.target;
	else if (e.srcElement) el = e.srcElement;
	
	if (el != null)
	{
		// if click was done on the link, do nothing
		// or if the click was done on a link child, do nothing
		var hasLinkAsParent = (el.tagName.toLowerCase() == "a");
		var tmpEl = el;
		while(!hasLinkAsParent && tmpEl.tagName.toLowerCase() != "td" && tmpEl.getAttribute("emType") == null)
		{
		    hasLinkAsParent = (tmpEl.tagName.toLowerCase() == "a");
		    tmpEl = tmpEl.parentNode;
		}
		if (el.nodeType == 1 && hasLinkAsParent) {}
		// else, we clicked on the item that contains the link
		else
		{
			// if the link has a href
			if (this.contentCell.firstChild.href != null)
			{
				try
				{
					// if the link has a target
					if (typeof this.contentCell.firstChild.target != 'undefined' && this.contentCell.firstChild.target != null && this.contentCell.firstChild.target.length > 0)
					{
						// if target is self
						if (this.contentCell.firstChild.target.toLowerCase() == "_self")
							self.location.href = this.contentCell.firstChild.href;
						// if target is top window
						else if (this.contentCell.firstChild.target.toLowerCase() == "_top")
							top.location.href = this.contentCell.firstChild.href;
						// if target is parent window
						else if (this.contentCell.firstChild.target.toLowerCase() == "_parent")
							self.parent.location.href = this.contentCell.firstChild.href;
						// if target is blank window
						else if (this.contentCell.firstChild.target.toLowerCase() == "_blank")
							window.open(this.contentCell.firstChild.href, this.contentCell.firstChild.target);
						// if none of the above and top has frames
						else if (top.frames)
						{
							// if frame name was found, set the new href for it
							if (top.frames[this.contentCell.firstChild.target])
								top.frames[this.contentCell.firstChild.target].location.href = this.contentCell.firstChild.href;
							// else alert the user
							else
								window.alert("Frame '" + this.contentCell.firstChild.target + "' doesn't exist");
						}
						// if none of the above, open a new window with the name of the target
						else
							window.open(this.contentCell.firstChild.href, this.contentCell.firstChild.target);
					}
					// if no target, use self as target
					else
						self.location.href = this.contentCell.firstChild.href;
				}
				catch (ex) {}
			}
		}
	}
	
	return false;
}

function ob_em_SelectItem (id)
{
	var item = document.getElementById(id);
	if (item)
	{
		var itemObject = item.object;
		
		if (itemObject)
		{
			ob_em_DeselectItem (itemObject.menu.object.selectedItemId);

			itemObject.isSelected = true;
			itemObject.menu.object.selectedItemId = id;
			ob_em_mouseHover (item, null, true, false);
		}
	}
}

function ob_em_DeselectItem (id)
{
	var item = document.getElementById(id);
	if (item)
	{
		var itemObject = item.object;
		
		if (itemObject)
		{
			itemObject.isSelected = false;
			itemObject.menu.object.selectedItemId = "";
			ob_em_mouseHover (item, null, false, false);
		}
	}
}

function ob_em_HideItem (id)
{
    var item = document.getElementById(id);
    if (item != null) item.style.display = "none";
}

function ob_em_ShowItem (id)
{
    var item = document.getElementById(id);
    if (item != null) item.style.display = "";
}

function ob_em_SetItemInnerHTML(id, innerHTML)
{
    var item = document.getElementById(id);
    if (item != null)
    {
        var rows = item.getElementsByTagName("td");
        for (var i=0;i<rows.length;i++)
        {
            // in case of menu item or menu separator
            if (rows[i].getAttribute("emtype") == "c")
            {
                rows[i].innerHTML = innerHTML;
                break;
            }
        }
    }
}

function ob_em_AddItem (id, type, innerHTML, icon, url, urlTarget, onClientClick, AutoHideMenu, position)
{
    var itemsContainer = this.vt ? this.menu.firstChild : this.menu.firstChild.firstChild;
	if (typeof type == 'undefined' || typeof this.classes[type] == 'undefined' || this.classes[type] == null) type = "MenuItem";
	if (typeof AutoHideMenu == 'undefined') AutoHideMenu = true;
	
	var itemTD;
	
	if (position == null) position = this.items.length;
	
	// vertical menu
	if (this.vt)
	{
		itemsContainer = itemsContainer.insertRow(position);
		
		itemTD = document.createElement ("td");
	    itemTD.id = id;
	    itemsContainer.appendChild(itemTD);
	}
	// horizontal menu
	else
	{
	    itemTD = itemsContainer.rows[0].insertCell(position);
	    itemTD.id = id;
	}
	
	itemTD.setAttribute("emType", type);
	if (typeof onClientClick == 'string' && onClientClick.length > 0) 
		itemTD.setAttribute("OnClientClick", onClientClick);
	itemTD.setAttribute("nohide", AutoHideMenu ? "true" : "false");
	itemTD.className = this.classes[type]["c"];
	
	var table = document.createElement ("table");
	table.id = "ob_em_mc";
	itemTD.appendChild (table);
	
	var tr = table.appendChild(document.createElement("tbody")).appendChild(document.createElement("tr"));
	
	// create left round corder td element and add it to the item
	var leftroundcornerCell = document.createElement("td");
	leftroundcornerCell.setAttribute ("emType", "lrc");
	leftroundcornerCell.className = this.classes[type]["c_lrc"];
	tr.appendChild(leftroundcornerCell);
	
	if (this.ui)
	{
		var iconCell = document.createElement("td");
		tr.appendChild (iconCell);
		iconCell.setAttribute("emType", "i");
		iconCell.className = this.classes[type]["c_i"];

		if (typeof icon == 'string' && icon.length > 0)
		{
			var iconImg = document.createElement("img");
			iconCell.appendChild (iconImg);
			iconImg.src = this.iconsFolder + "/" + icon;
			iconImg.border = 0;
		}
		else
			iconCell.innerHTML = "&nbsp;";
	}
		
	var contentCell = document.createElement ("td");
	if (this.il) tr.appendChild(contentCell);
	else tr.insertBefore (contentCell, tr.firstChild.nextSibling);

	contentCell.className = this.classes[type]["c_c"];
	contentCell.setAttribute ("emType", "c");
	contentCell.colSpan = this.ui ? 2 : 3;
	if (typeof url == 'string' && url.length > 0)
	{
		var link = document.createElement("a");
		contentCell.appendChild (link);

		link.href = url;
		if (typeof urlTarget == 'string' && urlTarget.length > 0) 
			link.target = urlTarget;
		
		link.innerHTML = innerHTML;
	}
	else
		contentCell.innerHTML = innerHTML;
		
	var submenuCell = document.createElement("td");
	var submenuCellDiv = document.createElement("div");
	submenuCell.appendChild(submenuCellDiv);
	if (this.il) tr.appendChild(submenuCell);
	else tr.insertBefore (submenuCell, tr.firstChild.nextSibling);
	
	// create right round corder td element
	var rightroundcornerCell = document.createElement("td");
	rightroundcornerCell.setAttribute ("emType", "rrc");
	rightroundcornerCell.className = this.classes[type]["c_rrc"];
	tr.appendChild(rightroundcornerCell);
	
	//submenuCell.className = this.classes[type]["c_m"];
	submenuCell.setAttribute ("emType", "m");
	submenuCell.style.display = "none";
	submenuCell.style.width = "1px";
	
	submenuCellDiv.className = this.classes[type]["c_m"];
	submenuCellDiv.innerHTML = "&nbsp;";
	
	new ob_em_MenuItem(itemTD, this);
}

function ob_em_RemoveItem (id)
{
    var item = document.getElementById(id);
	if (item != null)
	{
		var index = ob_em_searchArrayForElement(this.items, item);
		if (index != -1)
		{
			this.items.splice (index, 1);
			if (this.vt)
				item.parentNode.parentNode.removeChild (item.parentNode);
			else
				item.parentNode.removeChild (item);
		}
	}
}

function ob_em_safeAddOnEvent(eventName, object, collection, functionToExecute, menuId)
{
    obj = eval (object);

	// if collection was not defined, define it now
	if (typeof eval(collection) != 'object') 
		eval(collection + " = new Array();");

	// if there are already functions wired for the event
	if (typeof eval("obj." + eventName) == "function" && eval("obj." + eventName).toString().indexOf("ob_em_safeOnEvent") == -1)
		eval(collection + "[0] = obj." + eventName);

	// add the current function
	if(((document.all)&&((navigator.appVersion.indexOf("Mac")!=-1))) && ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1))) 
		eval(collection + "[" + collection + ".length] = Function(" + (menuId != null ? menuId  + "." : "") + functionToExecute + ")");
	else
		eval(collection + "[" + collection + ".length] = function(ev){" + (menuId != null ? menuId  + "." : "") + functionToExecute + "}");

	// on event, execute collection
	eval('obj.' + eventName + ' = function(ev) {ob_em_safeOnEvent(collection, ev)}');
}

function ob_em_safeOnEvent(collection, ev) 
{
	for(var i = 0; i < eval(collection).length; i++) 
	{
		ran = false;

		// runs each function registered in collection
		try
		{
			eval(collection)[i](ev);
			ran = true;
		}
		catch (ex) {}
		
		// just to be on the safe side
		if (!ran)
		{
			try
			{
				eval (collection)[i];
			}
			catch (ex) {}
		}
	}
}

// returns all stylesheets in the page
function ob_em_getAllSheets()
{
	// for ICEbrowser support (if exists)
	if (!window.ScriptEngine && navigator.__ice_version)
		return document.styleSheets;

	if (document.getElementsByTagName)
	{
		// link tags
		var Lt = document.getElementsByTagName('link');
		// style tags
		var St = document.getElementsByTagName('style');
	} 
	else if (document.styleSheets && document.all)
	{
		// link tags
		var Lt = document.all.tags('LINK');
		// style tags
		var St = document.all.tags('STYLE');
	} 
	else 
	{ 
		return []; 
	} 

	// add all links
	for (var x = 0, os = []; Lt[x]; x++)
	{
		var rel = Lt[x].rel ? Lt[x].rel : Lt[x].getAttribute ? Lt[x].getAttribute('rel') : '';
		// if is a stylesheet link
		if (typeof(rel) == 'string' && rel.toLowerCase().indexOf('style') + 1)
		{
			os[os.length] = Lt[x];
		}
	} 

	// add all styles
	for (var x = 0; St[x]; x++ )
	{
		os[os.length] = St[x];
	} 
	return os;
}

// disables all style sheets except for those set as parameters
function ob_em_changeStyle()
{
	for (var x = 0, ss = ob_em_getAllSheets(); ss[x]; x++)
	{
		// disable it
		if (ss[x].title && typeof ss[x].rel == "string" && ss[x].rel.toLowerCase().indexOf("alternate") != -1)
		{
			ss[x].disabled = true;
		}
		// loop through the arguments
		for (var y = 0; y < arguments.length; y++) 
		{
			// if found in arguments
			if(ss[x].title == arguments[y])
			{
				// enable it
				ss[x].disabled = false; 
			} 
		}
	} 
}

function ob_em_getMenuCoords (e, returnCurrentIfVisible)
{
	if (this.el == null) return new Array (0,0);
	
	if (this.underlay.style.visibility == "hidden" || returnCurrentIfVisible)
	{
		var documentRtl = typeof document.dir == "string" && document.dir.toLowerCase() == "rtl";
		var windowWidth = 0;
		var windowHeight = 0;
		var documentScrollLeft = document.body.scrollLeft + document.documentElement.scrollLeft;
		var documentScrollTop = document.body.scrollTop + document.documentElement.scrollTop;
		if (isOpera){documentScrollLeft /= 2;documentScrollTop /= 2;}

		// compute the Window Width and Window Height
		if (typeof(window.innerWidth) == 'number')
		{
			windowWidth = window.innerWidth;
			windowHeight = window.innerHeight;
		}
		else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
		{
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		}
		else if (document.body && (document.body.clientWidth || document.body.clientHeight))
		{
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;	
		}
		
		if (documentRtl)
			documentScrollLeft = -15;

		// add scrolling and substract scroll bar height
		windowHeight += documentScrollTop - 15;
		windowWidth += documentScrollLeft - 15;

		// the corners we're working on (we don't modify the original ones)
		var elementCorner = [this.elementCorner[0], this.elementCorner[1]];
		var menuCorner = [this.menuCorner[0], this.menuCorner[1]];

		// compute initial menuLeft and menuTop
		if (this.displayPosition == 'cursor')
		{
			var menuLeft = e.clientX + this.hz_o;
			var menuTop = e.clientY + this.vt_o;
		}
		else
		{
		    // get the element coords
			var elementCoords = ob_em_GetElementCoords(this.el);
		
			// get menu coords with respect to the element and default aligning
			var menuElementCoords = this.GetMenuCoordsFromElement(elementCoords);

			var menuLeft = menuElementCoords['left'];
			var menuTop = menuElementCoords['top'];
		}

		if (!isSafari || this.displayPosition != "cursor")
		{
			// add scrolling
			menuTop += documentScrollTop;
			menuLeft += documentScrollLeft;
		}

		var changed = false;
		
		// if align is cursor then verify that the menu is inside the visible zone
		if (this.displayPosition == 'cursor' || ob_em_AutoPosition)
		{
			// if menu would be outside the document on the right but would fit in the left
			if ((menuLeft + this.menu.offsetWidth) > windowWidth && (menuLeft - this.menu.offsetWidth - (this.displayPosition != "cursor" && this.elementCorner[1] == "left" ? -this.el.offsetWidth : 0)) > documentScrollLeft)
			{
				if (this.displayPosition == "cursor") 
					menuLeft -= this.menu.offsetWidth;
				
				if (menuCorner[0] == elementCorner[0] || menuCorner[1] == elementCorner[1])
					elementCorner[1] = elementCorner[1] == "left" ? "right" : "left";
				menuCorner[1] = menuCorner[1] == "left" ? "right" : "left";
				
				changed = true;
			}
			// if menu would be outside the document on the left but would fit in the right
			else if (menuLeft < documentScrollLeft && (menuLeft + 2*this.menu.offsetWidth + (this.displayPosition != "cursor" && this.menuCorner[1] == "left" ? 0 : this.el.offsetWidth)) < windowWidth)
			{
				if (this.displayPosition == "cursor")
					menuLeft += this.menu.offsetWidth;
				
				if (menuCorner[0] == elementCorner[0] || menuCorner[1] == elementCorner[1])
					elementCorner[1] = elementCorner[1] == "left" ? "right" : "left";
				menuCorner[1] = menuCorner[1] == "left" ? "right" : "left";

				changed = true;
			}
			// if menu left and right are outside the visible area, show it so that at least one of them 
			// is visible - this case doesn't apply to cursor align
			else if ((menuLeft < documentScrollTop && (menuLeft + this.menu.offsetWidth) > windowWidth) || (menuLeft < documentScrollLeft && (menuLeft + this.menu.offsetWidth) < documentScrollLeft) || (menuLeft > windowWidth && (menuLeft + this.menu.offsetWidth) > windowWidth))
			{
				// try to make left visible
				if (menuLeft < documentScrollLeft && (menuLeft + this.menu.offsetWidth + this.el.offsetWidth) > documentScrollLeft)
				{
					menuCorner[0] = "left";
					elementCorner[0] = "right";

					changed = true;
				}
				// try to make bottom visible
				else if (menuLeft > windowWidth && (menuLeft - this.menu.offsetWidth - this.el.offsetWidth) < windowWidth)
				{
					menuCorner[0] = "right";
					elementCorner[0] = "left";

					changed = true;
				}
			}

			// if menu would be outside the document on the bottom but would fit in the top
			if ((menuTop + this.menu.offsetHeight) > windowHeight && (menuTop - this.menu.offsetHeight - (this.displayPosition != "cursor" && this.menuCorner[0] == "top" ? this.el.offsetHeight : 0)) > documentScrollTop)
			{
				if (this.displayPosition == "cursor")
					menuTop -= this.menu.offsetHeight;
				
				if (menuCorner[0] == elementCorner[0] || menuCorner[1] == elementCorner[1])
					elementCorner[0] = elementCorner[0] == "top" ? "bottom" : "top";
				menuCorner[0] = menuCorner[0] == "top" ? "bottom" : "top";
	
				changed = true;
			}
			// if menu would be outside the document on top but would fit in the bottom
			else if (menuTop < documentScrollTop && (menuTop + 2*this.menu.offsetHeight + (this.displayPosition != "cursor" && this.menuCorner[0] == "top" ? 0 : this.el.offsetHeight)) < windowHeight)
			{
				if (this.displayPosition == "cursor")
					menuTop += this.menu.offsetHeight;

	 			if (menuCorner[0] == elementCorner[0] || menuCorner[1] == elementCorner[1])
					elementCorner[0] = elementCorner[0] == "top" ? "bottom" : "top";
				menuCorner[0] = menuCorner[0] == "top" ? "bottom" : "top";

				changed = true;
			}
			// if menu top and bottom are outside the visible area, show it so that at least one of them 
			// is visible - this case doesn't apply to cursor align
			else if ((menuTop < documentScrollTop && (menuTop + this.menu.offsetHeight) > windowHeight) || (menuTop < documentScrollTop && (menuTop + this.menu.offsetHeight) < documentScrollTop) || (menuTop > windowHeight && (menuTop + this.menu.offsetHeight) > windowHeight))
			{
				// try to make top visible
				if (menuTop < documentScrollTop && (menuTop + this.menu.offsetHeight + this.el.offsetHeight) > documentScrollTop)
				{
					menuCorner[0] = "top";
					elementCorner[0] = "bottom";

					changed = true;
				}
				// try to make bottom visible
				else if (menuTop > windowHeight && (menuTop - this.menu.offsetHeight - this.el.offsetHeight) < windowHeight)
				{
					menuCorner[0] = "bottom";
					elementCorner[0] = "top";

					changed = true;
				}
			}
		}

		if (this.displayPosition != "cursor" && changed)
		{
			menuElementCoords = this.GetMenuCoordsFromElement(elementCoords, menuCorner, elementCorner);
			menuLeft = menuElementCoords['left'];
			menuTop = menuElementCoords['top'];

			// add scrolling
			menuTop += documentScrollTop;
			menuLeft += documentScrollLeft;
		}

		if (elementCorner[0] != menuCorner[0] && elementCorner[1] == menuCorner[1])
			this.underlayOffsets[menuCorner[0]] = 2 + Math.max(0, -this.vt_o);
		if (elementCorner[1] != menuCorner[1] && elementCorner[0] == menuCorner[0])
			this.underlayOffsets[menuCorner[1]] = 2 + Math.max(0, -this.hz_o);

		// adjust the offsets for right and bottom so underlay will not cause scroll (top and left don't cause scroll)
		this.underlayOffsets['bottom'] = Math.max(0,Math.min(this.underlayOffsets['bottom'], windowHeight - (menuTop + this.menu.offsetHeight) - 1));
		this.underlayOffsets['right'] = Math.max(0,Math.min(this.underlayOffsets['right'], windowWidth - (menuLeft + this.menu.offsetWidth) - 1));

		return new Array(menuLeft, menuTop);
	}
	else
		return new Array(this.underlay.offsetLeft, this.underlay.offsetTop);
}

function ob_em_GetMenuCoordsFromElement(elementCoords, menuCorner, elementCorner) {
    isMenuOnTop = false;
	if (menuCorner == null) menuCorner = this.menuCorner;
	if (elementCorner == null) elementCorner = this.elementCorner;
 
	var scrollLeft = document.body.scrollLeft + document.documentElement.scrollLeft;
	var scrollTop = document.body.scrollTop + document.documentElement.scrollTop;
	if (isOpera){scrollLeft /= 2;scrollTop /= 2;}

	// compute all scroll values (necesary when the element is inside one or more containers
	// that are scrolled)
	var cNode = this.el.object.type == "ob_em_attachelement" ? this.el : this.el.object.menu;
	do
	{
		cNode = cNode.parentNode;
		if (cNode != null && cNode != document.body)
		{
			if (typeof(cNode.scrollLeft) != 'undefined' && (!isOpera || cNode.scrollWidth != cNode.clientWidth)) scrollLeft += cNode.scrollLeft;
			if (typeof(cNode.scrollTop) != 'undefined' && (!isOpera || cNode.scrollHeight != cNode.clientHeight)) scrollTop += cNode.scrollTop;
		}
		else break;
	}
	while (true);

	var documentRtl = typeof document.dir == "string" && document.dir.toLowerCase() == "rtl";
	if (documentRtl)
		scrollLeft = -15;

	// add scrolling and offset data
	var menuTop = this.vt_o - scrollTop;
	var menuLeft = this.hz_o - scrollLeft;

	if (elementCorner[0] == 'top')
		menuTop += elementCoords['top'];
	else
		menuTop += elementCoords['bottom'];

	if (elementCorner[1] == 'left')
		menuLeft += elementCoords['left'];
	else
		menuLeft += elementCoords['right'];

if (menuCorner[0] == 'bottom') {
    menuTop -= this.menu.offsetHeight;
    isMenuOnTop = true;
}
	if (menuCorner[1] == 'right')
		menuLeft -= this.menu.offsetWidth;

	return {'left' : menuLeft, 'top' : menuTop};
}

function ob_em_mouseOverMenu (e, coords) {
   
	if (this.underlay.style.visibility != 'visible') 
		return false;

	if (!coords) coords = this.getMenuCoords(e, false);
	var menuLeft = eval(coords[0]);
	var menuTop = eval(coords[1]);

	var scrollLeft = document.body.scrollLeft + document.documentElement.scrollLeft
	var scrollTop = document.body.scrollTop + document.documentElement.scrollTop;
	if (isOpera) {scrollLeft /= 2;scrollTop /= 2;}

	var mouseLeft = e.clientX == -1 ? ob_em_getLeft(e.fromElement) - e.offsetX : e.clientX;
	var mouseTop = e.clientY == -1 ? ob_em_getTop(e.fromElement) - e.offsetY : e.clientY;
	
	var result = (this.underlay.style.visibility == 'visible' && 
				((mouseLeft + scrollLeft) >= menuLeft) && 
				((mouseLeft + scrollLeft) <= (menuLeft + this.underlay.offsetWidth)) && 
				((mouseTop + scrollTop) >= menuTop) && 
				((mouseTop + scrollTop) <= (menuTop + this.underlay.offsetHeight)));

	for (var i=0; i < this.subMenus.length; i++)
		result = result || this.subMenus[i].mouseOverMenu (e, null);

	return result;
}

function ob_em_GetElementCoords (element, coordLeft, coordTop, coordRight, coordBottom)
{
    // get the parent menu from element
    var parentelement = ob_em_GetParentMenuFromElement(element);
    var includeScroll = false;
    if (parentelement != null)
    {
        var parentmenu = eval("ob_em_" + ob_em_GetParentMenuFromElement(element).id);
        if (typeof(parentmenu) == "object" && parentmenu.showEvent != "always")
            includeScroll = true;
    }
		    
		    
	if (typeof element == 'undefined' || element == null) 
		return {'left' : 0, 'top' : 0, 'right' : 0, 'bottom' : 0};

	if (coordLeft == null) coordLeft = ob_em_getLeft(element, includeScroll);
	if (coordTop == null) coordTop = ob_em_getTop(element, includeScroll);
	if (coordRight == null) coordRight = coordLeft + element.offsetWidth;
	if (coordBottom == null) coordBottom = coordTop + element.offsetHeight;

	return {'left' : coordLeft, 'top' : coordTop, 'right' : coordRight, 'bottom' : coordBottom};
}

function ob_em_getLeft(obj, includeScroll)
{
    var pos = 0;
  
    if(isFF == true || isOpera == true) {
        var arrUsedElements = new Array();
        var oInitialObj = obj;
    }
    
    if (obj)
    {
        if(isIE)
        {
            if(!isNaN(parseInt(obj.currentStyle.borderLeftWidth)))
            {
                pos += parseInt(obj.currentStyle.borderLeftWidth);
            }                              
        }      
    }
      
    if (obj.offsetParent)
    {
        while (obj.offsetParent)
        {
            if(obj.nodeName != "TR" || isSafari == false) {
                if (includeScroll)
                    pos += obj.offsetLeft - ((obj.nodeName != "TR" && isOpera==false)  ? obj.scrollLeft : 0);
                else
                    pos += obj.offsetLeft;
            } else {
                if (includeScroll)
                    pos += obj.firstChild.offsetLeft - obj.firstChild.scrollLeft;
                else
                    pos += obj.firstChild.offsetLeft;
            }
          
            if(isFF == true || isOpera == true) {
                arrUsedElements.push(obj);
            }
              
            obj = obj.offsetParent;          
        }      
    }
    else if (obj.x)
    {
        pos += obj.x;
    }
  
    if((isFF == true || isOpera == true) && arrUsedElements.length > 0) {
        obj = oInitialObj;
        while(obj.parentNode) {          
            if(obj.nodeName == "DIV" && obj.style.position != "absolute" && obj.style.position != "relative" && obj.style.position != "fixed") {
                var bAlreadyUsed = false;
                for(var j=0; j<arrUsedElements.length; j++) {
                    if(arrUsedElements[j] == obj) {
                        bAlreadyUsed = true;
                        break;
                    }
                }
              
                if(bAlreadyUsed == false) {
                    if (includeScroll)
                        pos -= obj.scrollLeft;
                }
            }
      
            obj = obj.parentNode;
        }
    }
  
    return pos;
}

function ob_em_getTop(obj, includeScroll)
{
    var pos = 0;
    var count=0;
 
    if(isFF == true || isOpera==true) {
        var arrUsedElements = new Array();
        var oInitialObj = obj;
    }
  
    if (obj)
    {     
    
        if(isIE)
        {
            if(!isNaN(parseInt(obj.currentStyle.borderTopWidth)))
                pos += parseInt(obj.currentStyle.borderTopWidth);
        } 
       
        while (obj)
        {  
            count++;
            var parentmenu = undefined; if (obj.id != "") try{parentmenu = eval("ob_em_" + obj.id);} catch(ex){}
            if(obj.nodeName != "TR" || isSafari == false) {
                if (includeScroll && typeof(parentmenu) == "object" && parentmenu.showEvent != "always")
                    pos += obj.offsetTop - ((obj.nodeName != "TR" && isOpera==false) ? obj.scrollTop : 0);
                else 
                    pos += obj.offsetTop;
            } else {
                if (includeScroll && typeof(parentmenu) == "object" && parentmenu.showEvent != "always")
                    pos += obj.firstChild.offsetTop - obj.firstChild.scrollTop;
                else
                    pos += obj.firstChild.offsetTop;
            }
                      
            if(isFF == true||isOpera==true ) {
                arrUsedElements.push(obj);
            }
            obj = obj.offsetParent;          
        }
    }
    else if (obj.y)
    {
        pos += obj.y;
    }
      
    if((isFF == true ||isOpera==true) && arrUsedElements.length > 0) {
        obj = oInitialObj;
        while(obj.parentNode) {          
            if(obj.nodeName == "DIV" && obj.style.position != "absolute" && obj.style.position != "relative" && obj.style.position != "fixed") {
                var bAlreadyUsed = false;
                for(var j=0; j<arrUsedElements.length; j++) {
                    if(arrUsedElements[j] == obj) {
                        bAlreadyUsed = true;
                        break;
                    }
                }
              
                if(bAlreadyUsed == false) {
                    if (includeScroll)
                        pos -= obj.scrollTop;
                }
            }
      
            obj = obj.parentNode;
        }
    }
    return pos;
}

function ob_em_getStyle(oElm, strCssRule)
{
    var strValue = "";
    if(document.defaultView && document.defaultView.getComputedStyle)
        strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
    else if(oElm.currentStyle)
    {
		try
		{
			strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){return p1.toUpperCase();});
			strValue = oElm.currentStyle[strCssRule];
        }
        catch(ex){}
    }
    return strValue;
}

function ob_em_searchArrayForElement (array, element)
{
	if (element == null || array == null || typeof array != 'object') return -1;
	
	for (var i = 0; i < array.length; i++)
	{
		if (typeof(element) == 'string') {if (array[i].toLowerCase() == element.toLowerCase()) return i;}
		else if (array[i] == element) return i;
	}
		
	return -1;
}

function ob_em_arrangeAlignProperty (align)
{
	var result = new Array();
	if (align == '')
	{
	    result[0] = '';
	    result[1] = '';
	}
	else if (align.substr(0, 3) == 'top')
	{
		result[0] = align.substr(0, 3);
		result[1] = align.substr(3, align.length);
	}
	else
	{
		result[0] = align.substr(0, 6);
		result[1] = align.substr(6, align.length);
	}
	return result;
}

function ob_em_removeEvent (elem, ev, collection, fct)
{
	fct = fct.toString();
		
	// check if the collection has elements
	if (collection.length == 0)
	{
		if (eval("elem." + ev).toString().toLowerCase().replace(/'/g, "\"").indexOf(fct.toLowerCase().replace(/'/g, "\"")) != -1)
			eval("elem." + ev + " = null");
	}
	else
	{
		for (var i=0; i < collection.length; i++)
		{
			if (collection[i].toString().toLowerCase().replace(/'/g, "\"").indexOf(fct.toLowerCase().replace(/'/g, "\"")) != -1)
				collection.splice(i, 1);
		}
		if (collection.length == 0)
			eval("elem." + ev + " = null");
	}
}

function ob_em_getDefaultClasses (menu)
{
	for (var itemType in menu.classes)
	{
		if (menu.classes[itemType] == 'default')
		{
			// (mi - MenuItem, ms - MenuSeparator, i - IconCell, c - ContentCell, _o - MouseOver)
			switch (itemType.toLowerCase())
			{
				case "menuseparator": 
				    menu.classes[itemType] = {  "c":"easyMenuSeparator",
				                                "c_o":"easyMenuSeparatorOver",
				                                "c_c":"easyMenuSeparatorContentCell",
				                                "c_c_o":"easyMenuSeparatorContentCellOver",
				                                "c_lrc":"easyMenuSeparatorLeftRoundCornerCell",
				                                "c_lrc_o":"easyMenuSeparatorLeftRoundCornerCellOver",
				                                "c_rrc":"easyMenuSeparatorRightRoundCornerCell",
				                                "c_rrc_o":"easyMenuSeparatorRightRoundCornerCellOver",
				                                "c_i":"easyMenuSeparatorIconCell",
				                                "c_i_o":"easyMenuSeparatorIconCellOver",
				                                "c_m":"easyMenuSeparatorSubMenuCell",
				                                "c_m_o":"easyMenuSeparatorSubMenuCellOver"}; 
                    break;
				default: 
				    menu.classes[itemType] = {  "c":"easyMenuItem",
				                                "c_o":"easyMenuItemOver",
				                                "c_c":"easyMenuItemContentCell",
				                                "c_c_o":"easyMenuItemContentCellOver",
				                                "c_lrc":"easyMenuItemLeftRoundCornerCell",
				                                "c_lrc_o":"easyMenuItemLeftRoundCornerCellOver",
				                                "c_rrc":"easyMenuItemRightRoundCornerCell",
				                                "c_rrc_o":"easyMenuItemRightRoundCornerCellOver",
				                                "c_i":"easyMenuItemIconCell",
				                                "c_i_o":"easyMenuItemIconCellOver",
				                                "c_m":"easyMenuItemSubMenuCell",
				                                "c_m_o":"easyMenuItemSubMenuCellOver"}; 
                    break;
			}
		}
	}
}

function ob_em_CreateMenuUnderlay(menuObjectId)
{
	var menu = document.getElementById(menuObjectId);
	var div = document.getElementById(menuObjectId + "__underlay");

	div.type = "ob_em_underlay";
	div.style.display = "";
	div.style.backgroundColor = "transparent";	
	div.style.visibility = "hidden";
	div.menu = menu;
	
	var span = document.createElement("span");
	div.appendChild(span);
	span.style.width = "100%";
	span.style.height = "100%";
	span.style.backgroundColor = "transparent";
}

function ob_em_GetEventElements(e)
{
	if (!e) e = window.event;
	if (!e) return [null, null];

	// get relative target
	var relTarg;
	if (typeof e.relatedTarget != 'undefined') relTarg = e.relatedTarget;
	else if (typeof e.fromElement != 'undefined' || typeof e.toElement != 'undefined') relTarg = e.type.toLowerCase() == "mouseover" ? e.fromElement : e.toElement;

	// get current target
	var curTarg;
	if (typeof e.target != 'undefined') curTarg = e.target;
	else if (typeof e.srcElement != 'undefined') curTarg = e.srcElement;
	
	return [relTarg, curTarg];
}

function ob_em_GetParentMenuFromElement(element)
{
    while (element != null && ((element.nodeType == 3 || typeof element.tagName == "undefined" || element.tagName.toLowerCase() != "div") || 
    (typeof element.object != 'object' || (typeof element.object.type == 'undefined' || element.object.type.toLowerCase() != "ob_em_menu"))))
    {
        element = element.parentNode;
    }
    
    return element;
}

function ob_em_GetUnderlayFromElement(element)
{
    while (element != null && ((element.nodeType == 3 || typeof element.tagName == "undefined" || element.tagName.toLowerCase() != "div") || 
    (typeof element.menu != 'object' || (typeof element.menu.object == 'undefined' || (typeof element.menu.object.type == 'undefined' || 
    element.menu.object.type.toLowerCase() != "ob_em_menu")))))
    {
        element = element.parentNode;
    }
    return element;
}
function ob_em_GetParentItemFromElement(element, eventType, showEvent)
{
    try
    {
        // if on element is a menu attached
        if (((showEvent == "contextmenu" && eventType == "mouseclick") || (showEvent == "mouseclick" && eventType == "contextmenu")) 
        && (element != null && typeof element.object == 'object' && element.object.type.toLowerCase() == "ob_em_attachelement"))
            return null;
            
        while (element != null && ((element.nodeType == 3) || (typeof element.object != 'object' || (typeof element.object.type == 'undefined' || 
        (element.object.type.toLowerCase() != "ob_em_menuitem" && element.object.type.toLowerCase() != "ob_em_attachelement")))))
        {
            element = element.parentNode;
        }
    } catch(ex){/* unspecified error when used with applet */};
    
    return element;
}
function ob_em_MenuIsSubmenuOfElement(menu, element)
{
    if (menu == null || typeof menu != 'object' || element == null || typeof element != 'object')
    {
        return false;
    }
    menu = typeof menu.object == 'object' && menu.object != null ? menu.object : menu;
    element = typeof element.object == 'object' && element.object != null ? element.object : element;
    return (typeof element.ob_em_submenu == 'object' && element.ob_em_submenu == menu);
}
function ob_em_MenuIsVisibleForElement(menu, element)
{
    if (menu == null || typeof menu != 'object' || element == null || typeof element != 'object')
    {
        return false;
    }
    menu = typeof menu.object == 'object' && menu.object != null ? menu.object : menu;
    element = typeof element.object == 'object' && element.object != null ? element.object : element;
    return (typeof menu.visibleFor == 'object' && menu.visibleFor == element);
}

function heo_ProcessEvent(e, onMouseOver, onMouseOut, elementId) {
    
	if (!e) e = window.event;
	if (!e) return false;
	
	var over = e.type.toLowerCase() == "mouseover";
	var element = document.getElementById(elementId);

	// get relative target
	var relTarg;
	if (typeof e.relatedTarget != 'undefined') relTarg = e.relatedTarget;
	else if (typeof e.fromElement != 'undefined' || typeof e.toElement != 'undefined') relTarg = over ? e.fromElement : e.toElement;
	// try to get to 'element' - if this is a child
	// if not found this will be null
	while (relTarg != null && relTarg != element)
		relTarg = relTarg.parentNode;

	// get current target
	var curTarg;
	if (typeof e.target != 'undefined') curTarg = e.target;
	else if (typeof e.srcElement != 'undefined') curTarg = e.srcElement;
	// try to get to 'element' - if this is a child
	// if not found this will be null
	while (curTarg != null && curTarg != element)
		curTarg = curTarg.parentNode;

	// if event took place between two children of 'element'
	// or between 'element' and a child
	// then discard the event
	if (relTarg == curTarg && curTarg != null)
	{
		ob_em_cancelEvent(e);
		return false;
	}
	// else execute user functions for the event
	else
	{
		if (over)
			// if user passed a function for onmouseover event, execute it
			return (typeof onMouseOver == "function") ? onMouseOver(e, element) : true;
		else
			// if user passed a function for onmouseout event, execute it
			return (typeof onMouseOut == "function") ? onMouseOut (e, element) : true;
	}
}

var ob_em_visibleMenus = new Array();
function ob_em_HideAll(onlymouseover) {ob_em_HideAllFromIndex(0, onlymouseover)}
function ob_em_VisibleArrayElementHasPrecedence(element1, element2){for (var i=0; i < ob_em_visibleMenus.length; i++){if (element1 == ob_em_visibleMenus[i]){for (var j=i; j<ob_em_visibleMenus.length; j++)if (element2 == ob_em_visibleMenus[j]) return true;break;}}return false;}
function ob_em_VisibleArrayIndexOf (element){for (var i=ob_em_visibleMenus.length - 1; i >= 0 ; i--){if (ob_em_visibleMenus[i] == element) return i;}return -1;}
function ob_em_HideAllFromIndex(index, onlymouseover)
{
	if (onlymouseover)
	{
		var i = ob_em_visibleMenus.length-1;
		while (i >= index)
		{
			if (ob_em_visibleMenus[i] != null && typeof ob_em_visibleMenus[i].object != 'undefined' && 
				ob_em_visibleMenus[i].object != null && typeof ob_em_visibleMenus[i].object.hideMenu == "function")
			{
				if (ob_em_visibleMenus[i].object.showEvent != "mouseover")
				{
					index = i + 2;
					break;
				}
			}
			i--;
		}
	}
	
	for (var i=index; i < ob_em_visibleMenus.length; i++)
	{
		if (ob_em_visibleMenus[i] != null && (typeof ob_em_visibleMenus[i].object != 'undefined' && 
			ob_em_visibleMenus[i].object != null && typeof ob_em_visibleMenus[i].object.hideMenu == "function"))
		{
			index = i;
			if (ob_em_visibleMenus[i].object.hideMenu(null, false, true, false))
				break;
			else if ((i+1) == (ob_em_visibleMenus.length-1))
				return;
		}
	}

	if (index >= 1 && typeof ob_em_visibleMenus[index-1] != 'undefined' && typeof ob_em_visibleMenus[index-1].object != 'undefined' &&
		typeof ob_em_visibleMenus[index-1].object != 'undefined' && ob_em_visibleMenus[index-1].object != null && typeof ob_em_visibleMenus[index-1].object.type != 'undefined' && 
		(ob_em_visibleMenus[index-1].object.type == 'ob_em_attachelement' || ob_em_visibleMenus[index-1].object.type == 'ob_em_menuitem'))
			index--;

	ob_em_VisibleArrayRemoveFromIndex(index);
}
function ob_em_VisibleArrayRemoveFromIndex(index){var tmpInclusions = new Array();for (var i=0; i < index; i++) {if (typeof ob_em_visibleMenus[i] != 'undefined') tmpInclusions[i] = ob_em_visibleMenus[i];}ob_em_visibleMenus = tmpInclusions;}
function ob_em_VisibleArrayPush (value){ob_em_visibleMenus.push(value);}

var agt=navigator.userAgent.toLowerCase();
var isNav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var isGecko = (agt.indexOf('gecko') != -1);
var isSafari = (agt.indexOf('safari') != -1);
var isIE = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var isAol = (agt.indexOf("aol") != -1);
var isOpera = (agt.indexOf("opera") != -1);
var isFF = ( ( navigator.userAgent.indexOf ( "Firefox" ) != -1 ) && ( parseInt ( navigator.userAgent.charAt ( navigator.userAgent.indexOf ( "Firefox" ) + 8 ) ) >= 1 ) ) ? true : false;
var isWebtv = (agt.indexOf("webtv") != -1); 
var isTVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
var isAOLTV = isTVNavigator;
var ishotjava = (agt.indexOf("hotjava") != -1);
//if (document.captureEvents) document.captureEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.CONTEXTMENU | Event.MOUSEOVER | Event.MOUSEOUT);
// array containing the functions to run upon window.onload
var ob_em_gSafeOnLoad = new Array();
// clean up function
function ob_em_cleanUp()
{
    if (window.event == null || (window.event != null && window.event.type == "")) return;
	if (typeof ob_em_Menus != 'object' || typeof ob_em_Menus.length == 'undefined')
		return;
		
	var i=0,j=0;
	for (i=0; i < ob_em_Menus.length; i++)
	{
		try
		{
			var menuObject = eval(ob_em_Menus[i]);
			
			if (typeof menuObject == 'undefined' || menuObject == null)
				continue;
				
			// remove reference from DOM node to JS Object
			if (menuObject.menu != null) 
				menuObject.menu.object = null;
			// remove events
			ob_em_removeEvents(menuObject.menu);
			
			// remove references to menus or parent items
			menuObject.parentMenu = null;
			menuObject.parentItem = null;
			
			if (menuObject.underlay != null)
			{
				// remove events
				ob_em_removeEvents(menuObject.underlay);
				// remove reference from DOM node to JS Object
				menuObject.underlay.menu = null;
				menuObject.underlay = null;
			}
			
			// remove reference to iframe
			menuObject.cover_iframe = null;
			if (typeof menuObject.items != 'undefined' && menuObject.items != null && typeof menuObject.items.length != 'undefined')
			{
				for (j=0; j < menuObject.items.length; j++)
				{
					var item = menuObject.items[j];

					if (item != null)
					{
						if (menuObject.showEvent == "always")
						{
							// remove just the submenu cell
							if (item.object.subMenuCell != null)
								item.object.subMenuCell.parentNode.removeChild(item.object.subMenuCell);
						}
						else
							// remove the entire item from DOM tree
							item.parentNode.removeChild(item);

						if (item.object != null)
						{
							item.object.item = null;
							item.object.ob_em_submenu = null;
							item.object.menu = null;
							
							// remove cells reference
							item.object.iconCell = null;
							item.object.contentCell = null;
							item.object.subMenuCell = null;
						}
						
						// remove reference from DOM node to JS Object
						item.object = null;
						// remove events
						ob_em_removeEvents(item);
					}
				}
			}
			for (j=0; j < menuObject.oat_ids.length; j++)
			{
				var item = document.getElementById(menuObject.oat_ids[j]);

				if (item != null)
				{
					if (item.object != null)
					{
						item.object.item = null;
						item.object.ob_em_submenu = null;
						item.object.menu = null;
					}
					// remove reference from DOM node to JS Object
					item.object = null;
					// remove events
					ob_em_removeEvents (item);
				}
			}

			// clear items array
			menuObject.items = null;

			// remove reference from JS Object to DOM node
			menuObject.menu = null;
			menuObject = null;
		}
		catch (ex)
		{
		}
	}

	ob_em_Menus = null;
	window.onload = null;
	window.onunload = null;
}
function ob_em_removeEvents (object) {if (typeof object == 'undefined' || object == null) return; object.onmouseover = null;object.onmouseout = null;object.oncontextmenu = null;object.onclick = null;}
function ob_em_cancelEvent (ev){if(!ev) ev = window.event;ev.returnValue = false;ev.cancelBubble = true;if (ev.stopPropagation)ev.stopPropagation();return false;}
function ob_em_eventSet (menuObject, eventName){return ob_em_searchArrayForElement(menuObject.Events, eventName) != -1;}
// specifies that the window has finished loading
var ob_em_wdl = false;
ob_em_safeAddOnEvent("onload", "window", "ob_em_gSafeOnLoad", "new Function(\"ob_em_wdl=true;\")()", null);