// TODO
// - Wenn Maus rechts oben dann style falsch und popup geht nicht weg

// toolbars
var __menu_count = 1;
var __menu_aAllComponents = new Array();
var __aAllMenu = new Array();
var __delay_html = "";
var __delay_iframe;
var __curMenuBarItem = null;
var __curMenu = null;
var __curHeight = 0;

//---------------------------------------------------------------------------------------------
// MENU BAR
//---------------------------------------------------------------------------------------------
function MenuBar(containerid)
{
  this.id     = "";
  this.container  = document;
  if(containerid)
    this.containerid = containerid;
  else
    this.containerid = "";

  this.border       = true;
  this.action       = "";
  this.design       = "5";
  this.fullsize     = false;
  this.backcolor    = "";
  this.active       = false;
  this.eventOnPopup = "";

  this.aComponents = new Array();
  this.add       = __menubar_add;
  this.show      = __menubar_show;
  this.getActiveBarItem = __menubar_getActiveBarItem;
  this.setVisible = __menubar_setvisible;

  // LIBERA - MDEARMAN - 2005-08-26 - Added to support retrieve menu items easily
  this.getItem = __menubar_getitem;
  
};

function __menubar_getActiveBarItem()
{
  return __curMenuBarItem;
};

function __menubar_setvisible(value)
{
  if(value)
    this.container.getElementById("__menu_bar").style.visibility = "visible";
  else
    this.container.getElementById("__menu_bar").style.visibility = "hidden";
};

//---------------------------------------------------------------------------
// Function Name:  __menubar_getitem
//        Author:  Mike Dearman (created on Aug-26-2005)
//         Input:  
//        Output:  
//   Description:  Gets a MenuBarItem given its text
//--------------------------------------------------------------------------
function __menubar_getitem(sMenuItemText) {
	var item = null;
	for (var i = 0; i < this.aComponents.length; i++) {
		item = this.aComponents[i];
		
		if (item.text == sMenuItemText) {
			return item;
		}
	}
	
	// not found
	return null;
};



function __menubar_show(x,y,width,height)
{
  var html = "";
  var temp = "";
  var div  = null;

  // if menu is recreated
  __curMenuBarItem = null;
  __curMenu = null;

  temp+= "<table height='100%' width='100%' cellspacing=1 cellpadding=1 border=0><tr>";

  for (var j=0;j<this.aComponents.length;j++) {
    var component = this.aComponents[j];
    var html = component.create();
    temp+=html;
  }

  temp+= "<td width='100%'></td></tr>";
  temp+= "</table>";

  html = temp;
  // create dynamic div
  if(!this.container.getElementById("__menu_bar")) {
    div = this.container.createElement("DIV");
    this.container.body.appendChild(div);
    div.id = "__menu_bar";
    if(this.containerid == "") {
      div.style.position = "absolute";
      div.style.left  = x;
      div.style.top   = y;
    }
    div.style.width = "100%";
    div.style.height= height;
    //div.style.backgroundColor = this.backcolor;
  } else {
    div = this.container.getElementById("__menu_bar");
  }

  //div.className = "MenuBar" + this.design;
  // set background color autom.
	if(this.backcolor == "") {
		if(this.design == "1" || this.design == "2")
			this.backcolor = "ButtonFace";
		if(this.design == "3")
			this.backcolor = "#9EBEF5";
		if(this.design == "4")
			this.backcolor = "#E8E8F0";
	}
  div.style.backgroundColor = this.backcolor;
  div.innerHTML = html;
  div.style.visibility = "visible";
};

function __menubar_add(component, oMenuBarItemToInsertAfter)
{
	// LIBERA - MDEARMAN - 2005-08-29 - Modified location of menubaritem insertion
	if (oMenuBarItemToInsertAfter == null) {
		// insert at end
		var id = this.aComponents.length;
		this.aComponents[id] = component;
	}	else {
		// go find place to insert new item and insert it
  
		var iInsertPosition = 0;
		for (iInsertPosition = 0; iInsertPosition < this.aComponents.length; iInsertPosition++) {
			if (this.aComponents[iInsertPosition] == oMenuBarItemToInsertAfter) {
				// found item to insert after

				// move to next position to give index to actually put new item
				iInsertPosition++;
				break;
			}
		}

		// shift all items to the right to make room for new item
		for (var iItem = this.aComponents.length; iItem > iInsertPosition; iItem--) {
			this.aComponents[iItem] = this.aComponents[iItem - 1];
		}
		// now, new item can be inserted at iInsertPosition (potentially at end of array if oMenuBarItemToInsertAfter wasnt found)
		this.aComponents[iInsertPosition] = component;
	}
  
  //component.id = __menu_count;
  component.bar = this;
  component.design = this.design;
  if(component.menu) {
    component.menu.design = this.design;
    component.menu.bar = this;
  }

  // we need this for access within events
  var id = __menu_aAllComponents.length;
  __menu_aAllComponents[id] = component;
};

function MenuBarItem(text)
{
  this.id      = __menu_count;
  __menu_count++;
  this.bar     = null;
  this.menu    = null;
  //this.tag     = tag;
  this.text    = text;
  //this.action  = action;
  //this.image   = image;
  this.pressed = false;
  this.enabled = true;
  this.visible = true;
  this.design  = "";

  this.setVisible   = __menubaritem_visible;
  this.setEnabled   = __menubaritem_enable;
  this.setStatus    = __menubaritem_status;

  this.onmouseup    = __menubaritem_mouseup;
  this.onmousedown  = __menubaritem_mousedown;
  this.onmouseover  = __menubaritem_mouseover;
  this.onmouseout   = __menubaritem_mouseout;

  this.create       = __menubaritem_create;
  this.setMenu      = __menubaritem_menu;
  this.reset        = __menubaritem_reset;

  // Added for keyboard accessibility
  this.getNextSibling   = __menubaritem_nextSibling;
  this.getPrevSibling   = __menubaritem_prevSibling;
  this.showMenu = __menubaritem_showMenu;
  this.hideMenu = __menubaritem_hideMenu;
  // used for Alt key shortcuts
  this.accessKey = null;
};

function __menubaritem_menu(menu)
{
  this.menu = menu;
  this.menu.id = "__menu" + this.id;
  this.menu.parent = this;
};

function __menubaritem_direct(id,action)
{
  for (var j=0;j<__menu_aAllComponents.length;j++) {
    if(__menu_aAllComponents[j].id == id){
      var component = __menu_aAllComponents[j];

      if(action == "OVER") {
        if(__curMenuBarItem) {
          document.getElementById(__curMenuBarItem.id).className='MenuBarItemStandard' + __curMenuBarItem.design;
        }
        __curMenuBarItem = component;
        component.onmouseover();
        if(component.bar.active) {
          if(component.menu) {
            //-- LIBERA - MDEARMAN - 2006-07-18 - Added check to see if menu already being shown (if yes, skip show to avoid unnecessary reloading/flicker)
            if (component.menu != __curMenu) {
              var x = globalGetPositonX(document.getElementById(id));
              var y = globalGetPositonY(document.getElementById(id)) + document.getElementById(id).offsetHeight - 1;
              component.menu.show(x,y,component.menu.width,null,document.getElementById(id).offsetWidth-2);
            } else {
				      // menu is already current menu, so don't show
            }
          } else {
            __onMenuHide(component.menu.id);
          }
        }
      } else if(action == "OUT") {
        component.onmouseout();
      } else if(action == "DOWN") {
        component.onmousedown();
        component.bar.active = !component.bar.active;
        if(!component.bar.active) {
          __onMenuHide(component.menu.id);
        } else {
          if(component.menu && component.menu.visible == false) {
            var x = globalGetPositonX(document.getElementById(id));
            var y = globalGetPositonY(document.getElementById(id)) + document.getElementById(id).offsetHeight - 1;
            component.menu.show(x,y,component.menu.width,null,document.getElementById(id).offsetWidth-2);
          } else {
            __onMenuHide(component.menu.id);
          }
        }
      } else if(action == "UP") {
        component.onmouseup();
        if(component.bar.action != "") {
          if(component.tag != "" && component.tag != null)
            eval( component.bar.action + "('" + component.tag + "')");
        }
      }  else if(action == "FOCUS") {
		    if (!__curMenuBarItem || __curMenuBarItem != this) {		
			    if(__curMenuBarItem) {
				    // remove style from previous item
				    document.getElementById(__curMenuBarItem.id).className='MenuBarItemStandard' + __curMenuBarItem.design;
			    }
			    __curMenuBarItem = component;

       		    component.bar.active = true;
			    component.onmousedown();
    			
			    if(component.menu) {
				    // Show & give focus to the menu
				    component.showMenu();
			    } else {
				    __onMenuHide(component.menu.id);
			    }
		    }
	    }
      return;
    }
  }
};

// Added for keyboard accessibility
// shows & sets focus to the menu
function __menubaritem_showMenu() 
{
  var x = globalGetPositonX(document.getElementById(this.id));
  var y = globalGetPositonY(document.getElementById(this.id)) + document.getElementById(this.id).offsetHeight - 1;

  __curMenuBarItem = this;
  this.bar.active = true;
	this.onmousedown();
	
	if (this.menu) {
	  this.menu.show(x,y,this.menu.width,null,document.getElementById(this.id).offsetWidth-2);
    this.menu.focus()
	}
};

// Added for keyboard accessibility
function __menubaritem_hideMenu() 
{
	// hides & blurs the menu
	this.menu.hide();
	this.onmouseout();
};


function __menubaritem_create()
{
  var temp = "";

  var UIShortcut = getUIShortcut(this.text);

  temp+= "<td";
  temp+= " nowrap id='" + this.id + "' ";
  temp+= "class='MenuBarItemStandard" + this.design + "' ";
  temp+= "onmouseover='__menubaritem_direct(" + this.id + ",\"OVER\")'";
  temp+= "onmouseout='__menubaritem_direct(" + this.id + ",\"OUT\")'";
  temp+= "onmousedown='__menubaritem_direct(" + this.id + ",\"DOWN\")'";
  temp+= "onmouseup='__menubaritem_direct(" + this.id + ",\"UP\")'";
  temp+= "onfocus='__menubaritem_direct(" + this.id + ",\"FOCUS\")' ";
  temp+= "tabindex='1' ";
  
	// Libera: MDEARMAN - 2005-08-11 - Added to fix bug where the menubaritem gets focus if the user clicks and drags over the item
	temp+= "unselectable='on' onselectstart='return false;' ondragstart='return false;' ";      
  
  if(UIShortcut.accessKey != null) {
		temp+= "accesskey='" + UIShortcut.accessKey + "' ";
  }
  temp+= ">";
  
  if(this.text)
    temp+= "<p unselectable='ON' class='MenuBarItemText" + this.design + "'>" + UIShortcut.html + "</p>";
  temp+= "</td>";
  temp+= "<iframe id='__menu" + this.id + "' unselectable='on' style='visibility: hidden;position:absolute;top:0px;left:0px;height:2px;width:2px;' class='MenuFrame" + this.design + "' src='" + this.menu.path + "pinMenu.html' frameborder='0' ></iframe>";
  return temp;
};

function __menubaritem_visible(value)
{
  this.visible = value;

  // 2005-09-29 LIBERA - MDEARMAN - Added support to show/hide menubaritem already displayed
  var button = document.getElementById(this.id);
  if (button) {
	  // button already displayed, so set its visibility
	  if(value) {
		  button.style.display = "inline";
	  } else {
		  button.style.display = "none";
	  }
  }
};

function __menubaritem_enable(value)
{
  this.enabled = value;
  var button = document.getElementById(this.id);
  if(value) {
    button.className = 'MenuBarItemDisabled';
    button.innerHTML = "<span class='MenuBarItemDisabledContainer'><span class='MenuBarItemDisabledContainer'>" + button.innerHTML + "</span></span>";
  } else {
    button.className = 'MenuBarItemStandard';
    button.innerHTML = button.firstChild.firstChild.innerHTML;
  }
};

function __menubaritem_status(value)
{
  this.pressed = value;
  if(value) {
    document.getElementById(this.id).className='MenuBarItemActive' + this.design;
  } else {
    document.getElementById(this.id).className='MenuBarItemStandard' + this.design;
  }
};

function __menubaritem_mouseup()
{
  if(!this.enabled)
    return;

  if(this.bar.active)
    document.getElementById(this.id).className='MenuBarItemActive' + this.design;
  else
    document.getElementById(this.id).className='MenuBarItemStandard' + this.design;

  if(this.action != "") {
    eval(this.action);
  }
};

function __menubaritem_mousedown()
{
  if(!this.enabled)
    return;

  if(this.bar.active)
    document.getElementById(this.id).className='MenuBarItemActive' + this.design;
  else
    document.getElementById(this.id).className='MenuBarItemHover' + this.design;
};

function __menubaritem_mouseover()
{
  if(!this.enabled)
    return;

  if(this.bar.active)
    document.getElementById(this.id).className='MenuBarItemActive' + this.design;
  else
    document.getElementById(this.id).className='MenuBarItemHover' + this.design;
};

function __menubaritem_mouseout()
{
  if(!this.enabled)
    return;

  // Added visibility check to prevent improper styling bug when mousing away
  // from the menubaritem but not onto the menu.
  if(!this.menu.visible) {
  	document.getElementById(this.id).className='MenuBarItemStandard' + this.design;
  }
};

function __menubaritem_reset()
{
  this.bar.active = false;
  document.getElementById(this.id).className='MenuBarItemStandard' + this.design;
  if(this.menu)
    this.menu.hide();
};

// Libera: DKUBISA (06-27-2005) - Added for keyboard accessibility
function __menubaritem_nextSibling()
{
	var siblingIndex = 0;
	for(i=0; i < this.bar.aComponents.length; i++) {
		if(this.bar.aComponents[i].id == this.id) {
			siblingIndex = i + 1;
			break;
		}
	}
	
	// make sure there is next sibling, otherwise start at first item
	if (siblingIndex >= this.bar.aComponents.length) {
		siblingIndex = 0;
	}
	
	// LIBERA - MDEARMAN - 2005-10-31 - Added check to find next visible menubaritem too
	if (!this.bar.aComponents[siblingIndex].visible) {
		// skip over invisible items

		for (var i = siblingIndex + 1; i < this.bar.aComponents.length; i++) {
			siblingIndex = i;

			if (this.bar.aComponents[i].visible) {
				// found visible menubaritem
				break;
			}
			
			if (siblingIndex + 1 == this.bar.aComponents.length) {
				// if at last item, and it didn't match, just jump to first item
				siblingIndex = 0;
			}
		}
	}
	
	if(siblingIndex < this.bar.aComponents.length) {
		return this.bar.aComponents[siblingIndex];
	}	else {
		// no next sibling, go to first menubaritem
		return this.bar.aComponents[0];
	}
	
};

// Libera: DKUBISA (06-27-2005) - Added for keyboard accessibility
function __menubaritem_prevSibling()
{
	var siblingIndex = 0;
	for(i=0; i < this.bar.aComponents.length; i++) {
		if(this.bar.aComponents[i].id == this.id) {
			siblingIndex = i - 1;
			break;
		}
	}
	
	// make sure there is previous sibling, otherwise start at last item
	if (siblingIndex < 0) {
		siblingIndex = this.bar.aComponents.length - 1;
	}
	
	
	// LIBERA - MDEARMAN - 2005-10-31 - Added check to find previous visible menubaritem too
	if (!this.bar.aComponents[siblingIndex].visible) {
		// skip over invisible items

		for (var i = siblingIndex - 1; i >= 0; i--) {
			siblingIndex = i;

			if (this.bar.aComponents[i].visible) {
				// found visible non-separator
				break;
			}
		}
	}	
	
	if(siblingIndex >= 0) {
		return this.bar.aComponents[siblingIndex];
	}	else {
		// no previous sibling, go to last menubaritem
		return this.bar.aComponents[this.bar.aComponents.length - 1];
	}
	
};

//---------------------------------------------------------------------------------------------
// MENU
//---------------------------------------------------------------------------------------------
function Menu(callBack, containerid, sTag)
{
  this.id         = "__menu" + __menu_count;
  __menu_count++;
  this.aMenuItems = new Array();
  this.container  = document;
  this.bar     = null;
  // use an existing container
  if(containerid)
    this.id = containerid;
  this.callBack   = callBack;
  // the callback from pinMenu.html
  this.callbackInternal = "__onItemClick";
  this.isPopupMode = false;
  this.design     = "";
  this.width      = 150;
  this.height     = 0;
  this.path       = "menu/";
  this.imageColumn = true;
  this.isCreated  = false;
  this.dynamicWidth = true;

  //-- LIBERA - MDEARMAN - 2006-07-18 - Added 'tag' so we can tell Menus apart
  this.tag = sTag;

  this.clear  = __menu_clear;
  this.count  = __menu_itemcount;
  this.add    = __menu_add;
  this.create = __menu_create;
  this.createInObject = __menu_create_object;
  this.show   = __menu_show;
  this.hide   = __menu_hide;
  this.getItemById = __menu_getitem;

  // LIBERA - MDEARMAN - 2005-08-26 - Added to better support retrieving menu items by a known name
  this.getItemByText = __menu_getitembytext;
  this.getItemByTag = __menu_getitembytag;
  
  //-- LIBERA - MDEARMAN - 2006-07-17 - Added method to get the index of an item in the MenuItems array
  this.getItemIndex = __menu_getitemindex;
  this.getItemByIndex = __menu_getitembyindex;
  
  //-- LIBERA - MDEARMAN - 2006-07-18 - Added method to remove an item from the menu
  this.remove = __menu_remove;
  
  this.createMenuItem = __menu_create_menuitem;
  this.createMenuSeparator = __menu_create_menuseparator;

  //-- LIBERA - MDEARMAN - 2006-07-18 - Added callback event to call just before showing a menu (so we can adjust menu items as needed)
  //		This should be a string of the function to call when the menu is about to be shown
  this.OnBeforeShowCallback = null;
  
  this.getDocument = __menu_getdoc;
  // Added for keyboard accessibility
  this.focus		= __menu_focus;
  this.blur			= __menu_blur;
  this.parent		= null;
  this.visible		= false;
   // Item in menu currently selected
  this.__curMenuItem = null;

  //document.onmouseup = __onMenuHidePopup;
};

function __menu_create_menuitem(text,image,title,value,tag1,tag2,callback)
{
  return new MenuItem(text,image,title,value,tag1,tag2,callback);
};

function __menu_create_menuseparator()
{
  return new MenuSeparator();
}

function __menu_itemcount()
{
  return this.aMenuItems.length;
};

function __menu_getitem(id)
{
  for(var i=0;i<this.aMenuItems.length;i++) {
    var item = this.aMenuItems[i];
    if(item.id == id)
      return item;
  }
};


//---------------------------------------------------------------------------
// Function Name:  __menu_getitembytext
//        Author:  Mike Dearman (created on Aug-29-2005)
//         Input:  
//        Output:  
//   Description:  Gets a menu item by its text
//--------------------------------------------------------------------------
function __menu_getitembytext(sMenuItemText)
{
  for(var i=0;i<this.aMenuItems.length;i++) {
    var item = this.aMenuItems[i];
    if(item.text == sMenuItemText)
      return item;
  }
};


//---------------------------------------------------------------------------
// Function Name:  __menu_getitembytag
//        Author:  Mike Dearman (created on Aug-29-2005)
//         Input:  
//        Output:  
//   Description:  Gets a menu item by its tag (tag1)
//--------------------------------------------------------------------------
function __menu_getitembytag(sMenuItemTag)
{
  for(var i=0;i<this.aMenuItems.length;i++) {
    var item = this.aMenuItems[i];
    if(item.tag1 == sMenuItemTag)
      return item;
  }
};


//---------------------------------------------------------------------------
// Function Name:  __menu_getitemindex
//        Author:  Mike Dearman (created on Jul-17-2006)
//         Input:  
//        Output:  Index in MenuItem array where item found or -1 if not found
//   Description:  Gets the index into the MenuItems array for the given menu item
//--------------------------------------------------------------------------
function __menu_getitemindex(oMenuItem)
{
	var item = null;
	for(var i=0; i < this.aMenuItems.length; i++) {
		item = this.aMenuItems[i];
		if (item == oMenuItem) {
			// found item
			return i;
		}
	}
		
	// not found
	return -1;
};


//---------------------------------------------------------------------------
// Function Name:  __menu_getitembyindex
//        Author:  Mike Dearman (created on Jul-17-2006)
//         Input:  iIndex - index of menuitem to return
//        Output:  MenuItem found at index
//   Description:  Gets the index into the MenuItems array for the given menu item
//--------------------------------------------------------------------------
function __menu_getitembyindex(iIndex)
{
	return this.aMenuItems[iIndex];
};


function __onMenuHidePopup(evt)
{

  if(!browser.ns) {
    var x = parseInt(event.clientX);
    var y = parseInt(event.clientY);
  } else {
    var x = parseInt(evt.clientX);
    var y = parseInt(evt.clientY);
  }

  if(!__curMenu)
    return;

  var id = __curMenu.id;

  if(!document.getElementById(id))
    return;

  var menuX = parseInt(document.getElementById(id).style.left);
  var menuY = parseInt(document.getElementById(id).style.top);
  var menuWidth  = parseInt(document.getElementById(id).style.width);
  var menuHeight = parseInt(document.getElementById(id).style.height);

  if(x < menuX || x > (menuX + menuWidth)) {
    __onMenuHide(id);
    return;
  }


  if(y > (menuY + menuHeight))
    __onMenuHide(id);

};

function __onMenuHide(id)
{
  if(document.getElementById(id))
    document.getElementById(id).style.visibility = "hidden";

  if(__curMenuBarItem)
    __curMenuBarItem.reset();
};

function __menu_clear()
{
  this.aMenuItems = new Array();
};

function __menu_add(menuitem, oComponentToInsertBefore)
{
  var id = this.aMenuItems.length;
  
	//-- LIBERA - MDEARMAN - 2006-07-17 - Added support to insert component before another component
	if (oComponentToInsertBefore) {
		// need to insert into array at correct position

		var iComponentIndex = this.getItemIndex(oComponentToInsertBefore);
		if (iComponentIndex >= 0) {

			// insert item before other component
			if (iComponentIndex == 0) {
				// insert before all items
				this.aMenuItems.unshift(menuitem);
			}	else {
				// insert into middle/end of array
				this.aMenuItems.splice(iComponentIndex /* insert before */,
											0 /* dont delete any items */, 
											menuitem);
			}
		}	else {
			// cant find other component, so just append to list
			this.aMenuItems.push(menuitem);
			oComponentToInsertBefore = null;
		}
	}	else {
		// append to list
		this.aMenuItems[id] = menuitem;
	}
  
  
  menuitem.id = __menu_count;
  menuitem.menu = this;
  menuitem.callback = this.callbackInternal;
  __menu_count++;

  //-- LIBERA - MDEARMAN - 2006-07-18 - Mark menu as not created since we just added one (so next time we'll regenerate)
  this.isCreated = false;

  // we ned this for access within events
  var id = __aAllMenu.length;
  __aAllMenu[id] = menuitem;
};


//---------------------------------------------------------------------------
// Function Name:  __menu_remove
//        Author:  Mike Dearman (created on Jul-18-2006)
//         Input:  menuitem - menu item to remove
//        Output:  
//   Description:  Removes the given menuitem from the menu
//--------------------------------------------------------------------------
function __menu_remove(menuitem) 
{
	var iComponentIndex = this.getItemIndex(menuitem);
	if (iComponentIndex >= 0) {
		
		this.aMenuItems.splice(iComponentIndex, 1 /* delete just this item */);
		__menu_count--;

		//-- LIBERA - MDEARMAN - 2006-07-18 - Mark menu as not created since we just removed one (so next time we'll regenerate)
		this.isCreated = false;
		
		
		//-- LIBERA - MDEARMAN - 2006-09-08 - Changed search to use for loop, old use of 'menuitem.__globalId' didnt work with multiple removes
		//-- LIBERA - MDEARMAN - 2006-07-24 - Remove menuitem from global menuitem array so we don't accidently find it during events
		for (var i = 0; i < __aAllMenu.length; i++) {
			if (menuitem == __aAllMenu[i]) {
				// found item in global array too, so remove it
				__aAllMenu.splice(i, 1 /* delete just this item */);
				break;
			}
		}
	}
};


function __menu_create(barwidth)
{
  var lineWidth = "0";

  if(barwidth)
    lineWidth = barwidth;

  __curHeight = 0;
  var temp = "";

  if(this.isPopupMode) {
    temp+= "<TABLE id='main' style='border:0' unselectable='ON' class='MenuBorder" + this.design + "' width='100%' height='100%' cellSpacing=0 cellPadding=0 border=0><TR><TD>";
  } else {
    if(!browser.ns)
      temp+= "<HR class='MenuLine" + this.design + "' style='width:" + lineWidth + " px;LEFT: 1px; POSITION: absolute; TOP: 0px' SIZE=1>";
    temp+= "<TABLE  id='main' unselectable='ON' style='TABLE-LAYOUT: fixed;' class='MenuBorder" + this.design + "' width='100%' height='100%' cellSpacing=0 cellPadding=0 border=0><TR><TD>";
  }

  // when we have no images the background image must disappear
  if(this.imageColumn)
    temp+= "<TABLE unselectable='ON'  style='TABLE-LAYOUT: fixed;' class='Menu" + this.design + "' cellSpacing=0 cellPadding=0 border=0><TR unselectable='ON'><TD unselectable='ON'>";
  else
    temp+= "<TABLE unselectable='ON' style='TABLE-LAYOUT: fixed;background-image: url();' class='Menu" + this.design + "' cellSpacing=0 cellPadding=0 border=0><TR unselectable='ON'><TD unselectable='ON'>";

  // LIBERA - MDEARMAN - 2005-11-10 - Added tracking for last visible item created for separator removal checks
  var oLastVisibleMenuItem = null;

  // get code for all toolbars
  for (var i=0;i<this.aMenuItems.length;i++) {
    var menuitem = this.aMenuItems[i];
	  // LIBERA - MDEARMAN - 2005-11-10 - Added checks to remove separators as first item and double-separators (ie: if items have been hidden, etc)
	  if (menuitem instanceof MenuSeparator) {
		  if (i == 0) {
			  // skip item, dont want separator as first visible item
			  continue;
		  } else if ((i > 0) && (oLastVisibleMenuItem == null || oLastVisibleMenuItem instanceof MenuSeparator)) {
			  // last visible item was a separator, so skip item to avoid double-separators
			  continue;
		  }
	  }
    
    temp+= menuitem.create();
    // LIBERA - MDEARMAN - 2005-11-10 - if separator or visible menu item, mark as last visible item created
    if (menuitem instanceof MenuSeparator || menuitem.visible) {
		  oLastVisibleMenuItem = menuitem;
	  }
    
  }

  temp+="</TD></TR></table></TD></TR></table>";

  this.height = __curHeight + 4;

  return temp;
};

function __menu_create_object(destObject)
{
  var lineWidth = "0";

  __curHeight = 0;
  var temp = "";

  try {
    if(this.isPopupMode) {
      // ###  temp+= "<TABLE style='border:0' class='MenuBorder" + this.design + "' width='100%' height='100%' cellSpacing=0 cellPadding=0 border=0><TR><TD>";
      // create table
      var doc = destObject.ownerDocument;
      var table = doc.createElement("table");
      table.style.border = "0";
      table.className = "MenuBorder" + this.design;
      if(!this.dynamicWidth)
        table.width = "100%";
      //table.height = "100%";
      table.cellSpacing = 0;
      table.cellPadding = 0;
      table.border = 0;
      table.id = "main";
      var tr = table.insertRow(-1);
      var td = tr.insertCell(-1);
      destObject.appendChild(table);
    } else {
      if(browser.ie)
        temp+= "<HR class='MenuLine" + this.design + "' style='width:" + lineWidth + " px;LEFT: 1px; POSITION: absolute; TOP: 0px' SIZE=1>";
      temp+= "<TABLE style='TABLE-LAYOUT: fixed;' class='MenuBorder" + this.design + "' width='100%' height='100%' cellSpacing=0 cellPadding=0 border=0><TR><TD>";
    }

    var subtd = null;
    // when we have no images the background image must disappear
    if(this.imageColumn) {
      // ### temp+= "<TABLE style='TABLE-LAYOUT: fixed;' class='Menu" + this.design + "' cellSpacing=0 cellPadding=0 border=0><TR><TD>";
      var subTable = doc.createElement("table");
      //subTable.style.tableLayout = "fixed";
      subTable.className = "Menu" + this.design;
      subTable.cellSpacing = 0;
      subTable.cellPadding = 0;
      td.appendChild(subTable);
      subTable.border = 0;
      var subtr = subTable.insertRow(-1);
      subtd = subtr.insertCell(-1);
    } else {
      // ### temp+= "<TABLE style='TABLE-LAYOUT: fixed;background-image: url();' class='Menu" + this.design + "' cellSpacing=0 cellPadding=0 border=0><TR><TD>";
      var subTable = doc.createElement("table");
      //subTable.style.tableLayout = "fixed";
      subTable.style.backgroundImage = "url()";
      subTable.className = "Menu" + this.design;
      subTable.cellSpacing = 0;
      subTable.cellPadding = 0;
      td.appendChild(subTable);
      subTable.border = 0;
      var subtr = subTable.insertRow(-1);
      subtd = subtr.insertCell(-1);
    }

    // get code for all items
    for (var i=0;i<this.aMenuItems.length;i++) {
      var menuitem = this.aMenuItems[i];
      // ### temp+= menuitem.create();
      menuitem.createInObject(subtd);
    }
    this.height = __curHeight + 3;

  } catch(Error) {
  }
};


function __menu_show(x,y,width,height,barwidth)
{

  var iframe;
  var html = "";

  if(__curMenu)
    __curMenu.hide();

  __curMenu = this;

  //-- LIBERA - MDEARMAN - 2006-07-18 - Added support to call OnBeforeShowCallback before showing menu to let it adjust menu items as needed
  if (this.OnBeforeShowCallback != null) {
    eval(this.OnBeforeShowCallback + "(this)");
	}

  // if we have a container
  if(this.id != "") {
    iframe = this.container.getElementById(this.id);
    if(!this.isCreated){
      html = this.create(barwidth);
      //this.htmlCreated = html;
      iframe.style.position = "absolute";
      var doc = iframe.contentWindow.document;
      doc.body.innerHTML = html;
      doc.onmousemove = __menu_move;
      // Added menu reference for keyboard accessibility (right/left arrows)
      iframe.contentWindow.__curMenu = this;
      this.isCreated = true;
    } else {
     // Added menu reference in else clause for keyboard 
     // accessibility (right/left arrows)
     // update current menu
	   iframe.contentWindow.__curMenu = this;
    }

    iframe.style.left = x;
    iframe.style.top = y;

    if(height == null)
      iframe.style.height = this.height;
    else
      iframe.style.height = height;

    if(width == null)
      iframe.style.width = this.width;
    else
      iframe.style.width = width;

    iframe.style.visibility = "visible";

	  //-- LIBERA - MDEARMAN - 2006-07-07 - Added fix to auto-size height of menu IFRAME based on content (in case content wrapped, etc)
	  //-- LIBERA - MDEARMAN - 2006-07-07 - Called handleLoad ftn to resize frame appropriately
  	//iframe.contentWindow.handleLoad();
  	if(browser.ie)
      iframe.contentWindow.document.focus();

	  if(this.bar.eventOnPopup != "")
	    eval(this.bar.eventOnPopup + "()");
  } else {
    // no id --> use popup
    //<iframe id='__menu" + this.id + "' unselectable='on' style='visibility: hidden;position:absolute;top:0px;left:0px;height:2px;width:2px;' class='MenuFrame" + this.design + "' src='" + this.menu.path + "pinMenu.html' frameborder='0' ></iframe>";

  }
  this.visible = true;
};

function __menu_getdoc()
{
  // if we have a container
  if(this.id != "") {
    var iframe = this.container.getElementById(this.id);
    if (this.isCreated) {
		  // found document
      return iframe.contentWindow.document;
    }
  }
  
  return null;
};

function __menu_move()
{
  if(__curMenuBarItem && document.getElementById(__curMenuBarItem.id).className != "MenuBarItemActive" + __curMenuBarItem.design)
    document.getElementById(__curMenuBarItem.id).className = "MenuBarItemActive" + __curMenuBarItem.design;
  return false;
};


// we have to wait, until pinEdit is loaded
function __menu_delay_load()
{
  var doc;
  try {
    doc = __delay_iframe.contentWindow.document;
  } catch(Error) {
    window.setTimeout('__menu_delay_load()',10);
    return;
  }
  doc.body.innerHTML = __delay_html;
  doc.onmousemove = __menu_move;
};


function __menu_hide()
{
  this.container.getElementById(this.id).style.visibility = "hidden";
  this.blur();
  this.visible = false;
};

// Give focus to the first menu item
function __menu_focus()
{
	// LIBERA - MDEARMAN - 2005-11-10 - Go find first visible & enabled item
	var item = this.aMenuItems[0];
	if (!item.enabled || !item.visible) {
		item = item.getNextSibling();
	}
	
	if (item) {
		item.focus();
	}
};

// Blur all menu items (needed to allow for simultaneous access from the
// keyboard and mouse)
function __menu_blur()
{
	for(i=0; i<this.aMenuItems.length; i++) {
		if( this.aMenuItems[i] instanceof MenuItem) {
			this.aMenuItems[i].blur();
		}
	}
};

//---------------------------------------------------------------------------------------------
// MENUITEM
//---------------------------------------------------------------------------------------------
function MenuItem(text,image,title,value,tag1,tag2,callback)
{
  this.id      = "";
  this.callback = "";
  this.text    = text;
  this.title   = title;
  this.image   = image;
  this.enabled = true;
  this.value   = value;
  this.menu    = null;
  this.height  = 22;
  this.tag1    = tag1;
  this.tag2    = tag2;
  this.directCallback = callback;

  // Added focus and blur for keyboard Accessibility
  this.focus		= __menuitem_focus;
  this.blur			= __menuitem_blur;
  
  this.setEnabled   = __menuitem_enable;
  this.create       = __menuitem_create;
  this.createInObject  = __menuitem_create_object;
  
  // Added for keyboard shortcut functionality
  // Get the next and previous menu items (next = below, previous = above)
  this.getNextSibling   = __menuitem_nextSibling;
  this.getPrevSibling   = __menuitem_prevSibling;

  // LIBERA - MDEARMAN - 2005-08-26 - Added to support changing menus dynamically  
  this.setVisible   = __menuitem_setvisible;
  this.visible = true;
  
};

//---------------------------------------------------------------------------
// Function Name:  __menuitem_setvisible
//        Author:  Mike Dearman (created on Aug-29-2005) - LIBERA
//         Input:  
//        Output:  
//   Description:  Sets the visibility of this menu item.  The visibility will only be affected after the menu_show is called.
//                 
//--------------------------------------------------------------------------
function __menuitem_setvisible(value)
{
	// if value different, then change property and mark that menu needs to be re-created
	if (this.visible != value) {
		this.visible = value;
		
		// mark that menu needs to be re-created
		this.menu.isCreated = false;
	}
};


// Libera: DKUBISA (06-27-2005) - Return the next menuitem in the table, or the first if at the bottom
function __menuitem_nextSibling()
{
	var siblingIndex = 0;
	
	// find ourselves and then get sibling after me
	for(var i=0; i < this.menu.aMenuItems.length; i++) {
		if (this.menu.aMenuItems[i].id == this.id) {
			siblingIndex = i + 1;
			break;
		}
	}
	
	
	// LIBERA - MDEARMAN - 2005-11-10 - Fixed logic to handle skipping over invisible items and separators for all weird scenarios
	//			such as when the first item is hidden and needs to wrap to the last item, but if the last item is invisible too, etc.
	
	// keep track of the index we started at so we can detect infinite loops
	var iStartingIndex = siblingIndex;
	
	var oMenuItems = this.menu.aMenuItems;
	do {
		// if we're at the last item, wrap to first item
		if (siblingIndex >= oMenuItems.length) {
			siblingIndex = 0;
		}	
	
		// if we found a non-separator that is visible
		if (!(oMenuItems[siblingIndex] instanceof MenuSeparator) && oMenuItems[siblingIndex].visible) {
			break;
		}
	
		// move to next item
		siblingIndex = siblingIndex + 1;
	} while (iStartingIndex != siblingIndex);
	

	// get actual prev sibling
	if (siblingIndex >= 0 && siblingIndex < oMenuItems.length) {
		return oMenuItems[siblingIndex];
	}	else {
		// no next sibling that is visible (all menu items are hidden)
		return null;
	}	
};


// Libera: DKUBISA (06-27-2005) - Return the previous menuitem in the table, or the last if at the top
function __menuitem_prevSibling()
{
	var siblingIndex = 0;
	for(var i=0; i < this.menu.aMenuItems.length; i++) {
		if(this.menu.aMenuItems[i].id == this.id) {
			siblingIndex = i - 1;
			break;
		}
	}
	
	// LIBERA - MDEARMAN - 2005-11-10 - Fixed logic to handle skipping over invisible items and separators for all weird scenarios
	//			such as when the first item is hidden and needs to wrap to the last item, but if the last item is invisible too, etc.
	
	// keep track of the index we started at so we can detect infinite loops
	var iStartingIndex = siblingIndex;
	
	var oMenuItems = this.menu.aMenuItems;
	do {
		// if we're before the first item, wrap to last item
		if (siblingIndex < 0) {
			siblingIndex = oMenuItems.length - 1;
		}	
	
		// if we found a non-separator that is visible
		if (!(oMenuItems[siblingIndex] instanceof MenuSeparator) && oMenuItems[siblingIndex].visible) {
			break;
		}
	
		// move to previous item
		siblingIndex = siblingIndex - 1;
	} while (iStartingIndex != siblingIndex);
	

	// get actual prev sibling
	if (siblingIndex >= 0 && siblingIndex < oMenuItems.length) {
		return oMenuItems[siblingIndex];
	}	else {
		// no previous sibling that is visible (all menu items are hidden)
		return null;
	}
};


function __menuitem_create()
{
  var temp = "";

  // LIBERA - MDEARMAN - 2005-08-29 - Added visibility support
  if (this.visible) {
	  __curHeight =  __curHeight + this.height;

	  // Libera: MDEARMAN 2005-06-24 - Added ID to table element
	  temp = "<table id='" + this.id + "' unselectable='ON' class='MenuItem" + this.menu.design + "' title='" + this.title + "' width='100%' cellSpacing=0 cellPadding=2 border=0";

    if(this.enabled) {
	    // Use onFocus for menubar, use onOver for popup mode
	    if(!this.menu.isPopupMode) {
		    temp+= " onmouseover='onFocus(this," + this.id + ",\"" + this.menu.design + "\")'";
	    } else {
		    temp+= " onmouseover='onOver(this," + this.id + ",\"" + this.menu.design + "\")'";
	    }
      temp+= " onmouseout='onOut(this," + this.id + ",\"" + this.menu.design + "\")'";
      if(this.menu.isPopupMode) {
        if(window.frameElement)
          temp+= " onmouseup=onClick('" + window.frameElement.id + "'," + this.id + ",\"" + this.menu.design + "\",\"" + this.callback + "\")";
        else
          temp+= " onmouseup=onClick(''," + this.id + ",\"" + this.menu.design + "\",\"" + this.callback + "\")";
      } else {
        temp+= " onmouseup=onClick(''," + this.id + ",\"" + this.menu.design + "\",\"" + this.callback + "\")";
      }

	    // Attached onKeyDown event for keyboard accessibility
	    temp+= " onkeydown='onKeyDown(this," + this.id + ",\"" + this.menu.design + "\",\"" + this.callback + "\")'";
    }
    temp+= ">";
    temp+= "<tr  unselectable='ON'>";
    temp+= "<TD  unselectable='ON' id='" + this.id + ".1'>";
    if(this.image) {
      if(this.image.substring(0,1) == "/" || this.image.toLowerCase().substring(0,4) == "http" || this.image.toLowerCase().substring(0,4) == "file")
        temp+= "<div style='width:25px'><IMG unselectable='ON' src='" + this.image + "'></div>";
      else
        temp+= "<div style='width:25px'><IMG unselectable='ON' src='../" + this.image + "'></div>";
    } else {
      // when no text then height is 23 ? Not clear why
      if(browser.ie)
        __curHeight++;
      if(this.menu.imageColumn)
        temp+= "<div style='width:25px'></div>";
    }
    temp+= "</TD>";
    //temp+= "</TR>";

	  if(this.enabled)
		  //-- LIBERA - MDEARMAN - 2006-07-07 - Added nowrap attribute to stop long text from causing cell wrap (mixed with auto-width/height addition today too)
		  //-- LIBERA - MDEARMAN - 2006-01-18 - Added title to TD also since focus event focuses on cell, not table that had title
		  temp+= "<TD unselectable='ON' width='100%' id='" + this.id + ".2' class='MenuItemFont" + this.menu.design + "' title='" + this.title + "' nowrap='nowrap'>" + this.text + "</TD>";
	  else
		  //-- LIBERA - MDEARMAN - 2006-07-07 - Added nowrap attribute to stop long text from causing cell wrap (mixed with auto-width/height addition today too)
		  //-- LIBERA - MDEARMAN - 2006-01-18 - Added title to TD also since focus event focuses on cell, not table that had title 
		  temp+= "<TD unselectable='ON' width='100%' id='" + this.id + ".2' style='color: #8D8D8D;' class='MenuItemFont" + this.menu.design + "' title='" + this.title + "' nowrap='nowrap'>" + this.text + "</TD>"; 
	  temp+= "<TD id='" + this.id + ".3'></TD>";
	  temp+= "</tr></table>";
  
  } else {
    // LIBERA - MDEARMAN - 2005-08-29 - Added visibility support
  	// return nothing if menu item is invisible
  }
  return temp;
};

function __menuitem_create_object(destObject)
{

  __curHeight =  __curHeight + this.height;

	var temp = "";

	// use textarea because of ' and "	
  // ###temp+= "<table  tabindex='1' class='MenuItem" + this.menu.design + "' title='" + this.title + "' width='100%' cellSpacing=0 cellPadding=2 border=0";

  var doc = destObject.ownerDocument;
  var table = doc.createElement("table");
  //table.tabIndex = 1;
  table.className = "MenuItem" + this.menu.design;
  table.title = this.title;
  //table.width = "100%";
  table.cellSpacing = 0;
  table.cellPadding = 2;
  table.border = 0;
  table.id = this.id;

  table.setAttribute("design",this.menu.design);
  table.setAttribute("callback",this.callback);
  if(window.frameElement)
    table.setAttribute("frame",window.frameElement.id);

  destObject.appendChild(table);

  if(this.enabled) {
    if(browser.ie) {
      table.onmouseover = function() {try{this.ownerDocument.parentWindow.onOver(this,this.id,this.design)}catch(e) {}};
      table.onmouseout = function() {try{this.ownerDocument.parentWindow.onOut(this,this.id,this.design)}catch(e) {}};
      if(this.directCallback) {
        table.onmouseup = this.directCallback;
      } else {
        table.onmouseup  =  function() {try {var frame = this.getAttribute('frame'); this.ownerDocument.parentWindow.onClick(frame,this.id,this.design,this.callback)}catch(e) {}};    
      }
    } else {
      table.addEventListener("mouseover", function() {try {this.ownerDocument.defaultView.onOver(this,this.id,this.getAttribute('design'))}catch(e) {}}, false);
      table.addEventListener("mouseout", function() {try {this.ownerDocument.defaultView.onOut(this,this.id,this.getAttribute('design'))} catch(e) {}}, false);
      if(this.directCallback) {
        table.addEventListener("mouseup", this.directCallback , false);
      } else {
        table.addEventListener("mouseup", function() {try {var frame = this.getAttribute('frame'); this.ownerDocument.defaultView.onClick(frame,this.id,this.getAttribute('design'),this.getAttribute('callback'))} catch(e) {}}, false);
      }
    }
  }
  // ### temp+= ">";
  // ### temp+= "<tr>";
  var tr = table.insertRow(-1);
  // ### temp+= "<TD id='" + this.id + ".1'>";
  var td = tr.insertCell(-1);
  td.id =  this.id + ".1";

  if(this.image) {
    if(this.image.substring(0,1) == "/" || this.image.toLowerCase().substring(0,4) == "http" || this.image.toLowerCase().substring(0,4) == "file") {
      // ### temp+= "<div style='width:25px'><IMG unselectable='ON' src='" + this.image + "'></div>";
      var div = doc.createElement("div");
      div.style.width = "25px";
      td.appendChild(div);
      var image = doc.createElement("img");
      image.unselectable = "on";
      image.src = this.image;
      div.appendChild(image);
    } else {
      // ### temp+= "<div style='width:25px'><IMG unselectable='ON' src='../" + this.image + "'></div>";
      var div = doc.createElement("div");
      div.style.width = "25px";
      td.appendChild(div);
      var image = doc.createElement("img");
      image.unselectable = "on";
      image.src = "../" + this.image;
      div.appendChild(image);
    }
  } else {
    if(this.menu.imageColumn){
      var div = doc.createElement("div");
      div.style.width = "25px";
      div.style.fontSize = "6px";
      div.innerHTML = "&nbsp;";
      td.appendChild(div);
    }
  }
  //temp+= "</TD>";
  //temp+= "</TR>";

  if(this.enabled) {
    // ### temp+= "<TD nowrap unselectable='ON' width='100%' id='" + this.id + ".2' class='MenuItemFont" + this.menu.design + "'>" + this.text + "</TD>";
    var td2 = tr.insertCell(-1);
    td2.unselectable = "on";
    td2.width = "100%";
    td2.id =  this.id + ".2";
    td2.className = "MenuItemFont" + this.menu.design;
    td2.innerHTML = this.text;
  } else {
    // ### temp+= "<TD nowrap unselectable='ON' width='100%' id='" + this.id + ".2'  style='color: #8D8D8D;' class='MenuItemFont" + this.menu.design + "'>" + this.text + "</TD>";
    var td2 = tr.insertCell(-1);
    td2.unselectable = "on";
    td2.width = "100%";
    td2.id =  this.id + ".2";
    td2.style.color = "#8D8D8D";
    td2.className = "MenuItemFont" + this.menu.design;
    td2.innerHTML = this.text;
  }
  td2.noWrap = true;
  // ### temp+= "<TD id='" + this.id + ".3'></TD>";
  var td3 = tr.insertCell(-1);
  td3.id =  this.id + ".3";
};

function __menuitem_enable(value)
{
	this.enabled = value;
};

function __onItemClick(row)
{
  for(var i=0;i<__aAllMenu.length;i++) {
    if(__aAllMenu[i].id == row) {
      if(__aAllMenu[i].menu.callBack != null)
        __curMenuBarItem.reset();
        __aAllMenu[i].menu.hide();
        if(__aAllMenu[i].directCallback) {
          __aAllMenu[i].directCallback();
        } else {
          eval(__aAllMenu[i].menu.callBack + "('" + __aAllMenu[i].value + "', __aAllMenu[" + i + "])");
        }
        // Added break after calling function to improve performance
        break;
    }
  }
};

// Fire the focus event on this menuitem and set the menu's current
// menu item to this
function __menuitem_focus() 
{
  try {
	  var doc = this.menu.getDocument();
	  var table = doc.getElementById(this.id);
	  doc.parentWindow.onFocus(table,this.id,this.menu.design);
	  this.menu.__curMenuItem = this;
	} catch(Error) {}
};

// Fire the blur event on this menuitem and set the menu's current
// menu item to null
function __menuitem_blur() 
{
  try {
    if(browser.ie) {
	    var doc = this.menu.getDocument();
	    var table = doc.getElementById(this.id);
	    doc.parentWindow.onOut(table,this.id,this.menu.design);
	    this.menu.__curMenuItem = null;
    }
  } catch(Error) {}
};

//---------------------------------------------------------------------------------------------
// MENU SEPARATOR
//---------------------------------------------------------------------------------------------
function MenuSeparator()
{
  this.create = __menusep_create;
  this.typeIntern = "MENUSEPARATOR";

  //-- LIBERA - MDEARMAN - 2006-03-31 - Added for keyboard shortcut functionality
  this.menu = null;
  // Get the next and previous menu items (next = below, previous = above)
  this.getNextSibling   = __menuitem_nextSibling;
  this.getPrevSibling   = __menuitem_prevSibling;
  this.createInObject   = __menusep_create_object;
};

function __menusep_create()
{
  if(browser.ie)
    __curHeight =  __curHeight + 3;
  else
    __curHeight =  __curHeight + 4;

  var temp = "<TABLE style='WIDTH: 100%;height: 1px;' cellSpacing=0 cellPadding=0 border=0>";
      temp+= "<TR>";
      temp+= "<TD style='width:28px'></TD>";
      temp+= "<TD class='MenuSeparator" + this.menu.design + "'>&nbsp;</TD>";
      temp+= "<TD class='MenuSeparator" + this.menu.design + "'>&nbsp;</TD>";
      temp+= "</TR>";
      temp+= "</TABLE>";

  return temp;
};

function __menusep_create_object(destObject)
{
  if(browser.ie)
    __curHeight =  __curHeight + 3;
  else
    __curHeight =  __curHeight + 4;

  try {
    var doc = destObject.ownerDocument;
    var table = doc.createElement("table");
    table.width = "100%";
    table.height = "1px";
    table.cellSpacing = 0;
    table.cellPadding = 0;
    table.border = 0;
    destObject.appendChild(table);

    var tr = table.insertRow(-1);
    var td = tr.insertCell(-1);
    td.style.width = "28px";
    td = tr.insertCell(-1);
    td.innerHTML = "&nbsp;";
    td.className = "MenuSeparator" + this.menu.design; 
    td = tr.insertCell(-1);
    td.innerHTML = "&nbsp;";
    td.className = "MenuSeparator" + this.menu.design; 
    
  } catch(Error) {
  }
};


//---------------------------------------------------------------------------------------------
// KEYBOARD SHORTUCT FUNCTIONS
//---------------------------------------------------------------------------------------------

// Create a new UIShortcut object
function UIShortcut(sText, sAccessKey, sHtml)
{
		
	this.text = sText;
	this.accessKey = sAccessKey;
	this.html = sHtml;
	
	return this;
	
};

// Return a UIShortcut specific to text parameter (value in en.js)
function getUIShortcut(sText)
{
	// init
	var text = sText;
	var accessKey = null;
	var html = sText;
	
	// set attributes for UI Shortcut object & return
	if(sText.match("&") != null) {
		text = text.replace("&", "");
		accessKey = sText.charAt(sText.indexOf("&") + 1);
		html = html.substring(0, html.indexOf("&")) + "<u>" + accessKey + "</u>" + html.substring(html.indexOf("&") + 2);
	}

	return UIShortcut(text, accessKey, html);
};



