

// ------------------------------------------------------
//   Profactys Default Skin JavaScript 1.0
//   © 2011 Bataviasoft
// ------------------------------------------------------


// --- SolpartMenuNavigationProvider --------------------

var trRootTab = null;
var tmrRootTab = null;

var tblCurrentMenu = null;
var clsIcon = "";
var clsItem = "";
var clsArrow = "";
var tmrMenuItem = null;


SolpartMenu.prototype.GenerateMenuHTML = function(oXML)
{
  __db(this._m_oMenu.id + ' - GenerateMenuHTML');

  var sHTML = '';
  this._m_sOuterTables = '';

  if (oXML == null)
  {
    if (this._m_oDOM == null)
    {
      oXML = spm_createDOMDoc();
      this._m_oDOM = oXML;

      if (this.xml.length)
      {
        oXML.loadXML(this.xml);
      }

      if (this.xmlFileName.length)
      {
        oXML.onload = eval('onxmlload' + this._m_sNSpace); 
        oXML.load(this.xmlFileName);

        return;
      }
    }
  }
  else
  {
    this._m_oDOM = oXML;
  }

  if (this.display == "vertical")
  {
    sHTML += '<table id="tbl' + this._m_sNSpace + 'MenuBar" cellpadding=\'0\' cellspacing=\'0\' class="' + spm_fixCSSForMac(this.getIntCSSName('spmbctr') + this.cssMenuContainer) + '" height="100%" style="vertical-align: middle;">';
    sHTML += this.GetMenuItems(this._m_oDOM.documentElement);
    sHTML += '</table>';
  }
  else
  {
    sHTML += '<table id="tbl' + this._m_sNSpace + 'MenuBar" cellpadding=\'0\' cellspacing=\'0\' class="' + spm_fixCSSForMac(this.getIntCSSName('spmbctr') + this.cssMenuContainer) + '" style="vertical-align: middle;">';
    sHTML += '  <tr>';
    sHTML += this.GetMenuItems(this._m_oDOM.documentElement);
    sHTML += '   </tr>';
    sHTML += '</table>';
  }

  this._m_oMenu.innerHTML = sHTML;
  this.GenerateSubMenus();
  this._m_oMenuMove = spm_getById('td' + this._m_sNSpace + 'MenuMove');

  spm_getTags("BODY")[0].onclick = spm_appendFunction(spm_getTags("BODY")[0].onclick, 'm_oSolpartMenu["' + this._m_sNSpace + '"].bodyclick();');
  this._m_oTblMenuBar = spm_getById('tbl' + this._m_sNSpace + 'MenuBar'); 
  this.fireEvent('onMenuComplete');

  __db(this._m_oMenu.id + ' - GenerateMenuHTML end');
}

SolpartMenu.prototype.GetMenuItems = function(oParent)
{
  var oNode;
  var sHTML = '';
  var sID;
  var sParentID;
  var sClickAction;

  if (oParent)
  {
    for (var i = 0; i < oParent.childNodes.length; i++)
    {
      oNode = oParent.childNodes[i];

      if ((oNode.nodeType != 3) && (oNode.nodeType != 8))
      {
        if (oNode.parentNode.nodeName != "menuitem")
        {
          sParentID = "-1";
        }
        else
        {
          sParentID = oNode.parentNode.getAttribute("id");
        }

        if (oNode.nodeName == "menuitem")
        {
          sID = oNode.getAttribute("id");
        }
        else
        {
          sID = "";
        }

        __db(sID + ' getmenuitems');
        sClickAction = spm_getMenuClickAction(oNode, this);

        if (sParentID == "-1")
        {
          if (this.display == "vertical")
          {
            sHTML += "<tr>";
          }

          if (oNode.nodeName == 'menubreak')
          {
            if (this.display == "vertical")
            {
              sHTML += "<tr>";
            }

            var sBreakHTML = spm_getAttr(oNode, 'lefthtml', '') + spm_getAttr(oNode, 'righthtml', '');
            if (sBreakHTML.length > 0)
            {
              sHTML += '  <td class="' + spm_fixCSSForMac(this.getIntCSSName('spmbrk') + this.cssMenuBreak) + '">' + sBreakHTML + '</td>';
            }
            else
            {
              sHTML += '  <td class="' + spm_fixCSSForMac(this.getIntCSSName('spmbrk') + this.cssMenuBreak) + '">' + spm_getMenuImage('spacer.gif', this, true, ' ') + '</td>';
            }

            if (this.display == "vertical")
            {
              sHTML += "</tr>";
            }
          }
          else
          {
            sHTML += '<td>';
            sHTML += '<table cellpadding="0" cellspacing="0">';

            var sAlign = this.display == 'vertical' ? 'align="' + this.menuAlignment + '"' : '';
            sHTML += '<tr id="td' + this._m_sNSpace + sID + '" ' + spm_getMenuBarEvents(this._m_sNSpace) + '  class="' + spm_fixCSSForMac(this.getIntCSSName('spmbar spmitm') + this.cssMenuBar + ' ' + this.cssMenuItem + ' ' + spm_getMenuItemCSS(oNode)) + '" savecss="' + spm_getMenuItemCSS(oNode) + '" saveselcss="' + spm_getMenuItemSelCSS(oNode) + '" menuclick="' + sClickAction + '" style="' + spm_getMenuItemStyle('item', oNode) + '">';

            if (Number(this.rootArrow) && spm_nodeHasChildren(oNode))
            {
              sHTML += '<td unselectable="on" nowrap="nowrap" ' + sAlign + ' title="' + spm_getAttr(oNode, 'tooltip', '') + '">' + spm_getImage(oNode, this) + spm_getItemHTML(oNode, 'left', '') + spm_getAttr(oNode, 'title', '') + spm_getItemHTML(oNode, 'right') + '</td>';
            }
            else
            {
              if (this.getIntCSSName('spmbar spmitm').indexOf("actions") == -1)
              {
                sHTML += '<td unselectable="on" nowrap="nowrap" ' + sAlign + ' title="' + spm_getAttr(oNode, 'tooltip', '') + '">' + spm_getImage(oNode, this) + spm_getItemHTML(oNode, 'left', '') + spm_getAttr(oNode, 'title', '') + spm_getItemHTML(oNode, 'right') + "</td>";
              }
              else
              {
                sHTML += '<td unselectable="on" nowrap="nowrap" ' + sAlign + ' title="' + spm_getAttr(oNode, 'tooltip', '') + '">' + spm_getImage(oNode, this) + spm_getItemHTML(oNode, 'left', '') + spm_getAttr(oNode, 'title', '') + spm_getItemHTML(oNode, 'right') + "</td>";
              }
            }

            sHTML += '</tr>';
            sHTML += '</table>';
            sHTML += '</td>';
          }

          if (this.display == "vertical")
          {
            sHTML += "</tr>";
          }
        }
        else
        {
          switch(oNode.nodeName)
          {
            case ("menuitem"):
            {
              sHTML += '   <tr id="tr' + this._m_sNSpace + sID + '" ' + spm_getMenuItemEvents(this._m_sNSpace) + ' parentID="' + sParentID + '" class="' + spm_fixCSSForMac(this.getIntCSSName('spmitm') + this.cssMenuItem + ' ' + spm_getMenuItemCSS(oNode)) + '" savecss="' + spm_getMenuItemCSS(oNode) + '" saveselcss="' + spm_getMenuItemSelCSS(oNode) + '" menuclick="' + sClickAction + '" style="' + spm_getMenuItemStyle('item', oNode) + '">';
              sHTML += '     <td unselectable="on" id="icon' + this._m_sNSpace + sID + '" class="' + spm_fixCSSForMac(this.getIntCSSName('spmicn') + this.cssMenuIcon) + '" style="' + spm_getMenuItemStyle('image', oNode) + '; ' + spm_getMenuItemStyle('item', oNode) + '">' + spm_getImage(oNode, this) + '</td>';
              sHTML += '     <td unselectable="on" id="td' + this._m_sNSpace + sID + '" class="' + spm_fixCSSForMac(this.getIntCSSName('spmitm') + this.cssMenuItem + ' ' + spm_getMenuItemCSS(oNode)) + '" savecss="' + spm_getMenuItemCSS(oNode) + '" nowrap="nowrap" title="' + spm_getAttr(oNode, 'tooltip', '') + '" style="' + spm_getMenuItemStyle('item', oNode) + '">' + spm_getItemHTML(oNode, 'left', '') + spm_getAttr(oNode, 'title', '') + spm_getItemHTML(oNode, 'right', '') + '</td>';
              sHTML += '     <td unselectable="on" id="arrow' + this._m_sNSpace + sID + '" width="15px" class="' + spm_fixCSSForMac(this.getIntCSSName('spmarw') + this.cssMenuArrow) + '" style="' + spm_getMenuItemStyle('item', oNode) + '">' + MyIIf(spm_nodeHasChildren(oNode), spm_getArrow(this.arrowImage, this), spm_getSpacer(this)) + '</td>';
              sHTML += '   </tr>';

              break;
            }
            case ("menubreak"):
            {
              var sBreakHTML = spm_getAttr(oNode, 'lefthtml', '') + spm_getAttr(oNode, 'righthtml', '');
              if (sBreakHTML.length > 0)
              {
                sHTML += '<tr><td colspan="3" class="' + spm_fixCSSForMac(this.getIntCSSName('spmbrk') + this.cssMenuBreak) + '">' + sBreakHTML + '</td></tr>';
              }
              else
              {
                sHTML += '<tr><td style="height: 1px" class="' + spm_fixCSSForMac(this.getIntCSSName('spmicn') + this.cssMenuIcon) + '">' + spm_getMenuImage('spacer.gif', this, true, '') + '</td><td colspan="2" class="' + spm_fixCSSForMac(this.getIntCSSName('spmbrk') + this.cssMenuBreak) + '">' + spm_getMenuImage('spacer.gif', this, true, '') + '</td></tr>';
              }

              break;
            }
          }
        }

        if (oNode.childNodes.length > 0)
        {
          var sTag = 'div';
          var sStyle = '';

          if (spm_isMac('ie'))
          {
            sTag = 'p';
            sStyle = 'margin-top:0px; margin-left:0px;'
          }

          this._m_sOuterTables = '<' + sTag + ' id="tbl' + this._m_sNSpace + sID + '" class="' + spm_fixCSSForMac(this.getIntCSSName('spmsub') + this.cssSubMenu) + '" style="display:none; position: absolute;' + sStyle + this.menuTransitionStyle + '"><table cellpadding="0" cellspacing="0">' + this.GetMenuItems(oNode) + '</table></' + sTag + '>' + this._m_sOuterTables;
        }
      }
    }
  }

  return (sHTML);
}

function spm_getImage(oAttr, me)
{
  var sImage = spm_getAttr(oAttr, 'image', '');

  if (sImage.length)
  {
    return (spm_getHTMLImage(sImage, spm_getAttr(oAttr, 'imagepath', me.iconImagesPath), null, spm_getAttr(oAttr, 'title', '')));
  }
  else
  {
    return (spm_getMenuImage('spacer.gif', me, null, ''));
  }
}

function spm_getMenuImage(sImage, me, bForce, sAlt)
{
  return (spm_getHTMLImage(sImage, me.systemImagesPath, bForce, sAlt));
}

function spm_getHTMLImage(sImage, sPath, bForce, sAlt)
{
  return ("<img src=\"" + sPath + sImage + "\" " + spm_getAlt(sAlt) + ">");
}

function spm_getElementHeight(o)
{
  if ((o.offsetHeight == null) || (o.offsetHeight == 0))
  {
    if (o.offsetParent)
    {
      if ((o.offsetParent.offsetHeight == null) || (o.offsetParent.offsetHeight == 0))
      {
        if (o.offsetParent.offsetParent != null)
        {
          return (o.offsetParent.offsetParent.offsetHeight);
        }
        else
        {
          return (0);
        }
      }
      else
      {
        return (o.offsetParent.offsetHeight);
      }
    }
  }
  else
  {
    return (o.offsetHeight);
  }
}

function spm_getElementWidth(o)
{
  if ((o.offsetWidth == null) || (o.offsetWidth == 0))
  {
    if (o.offsetParent)
    {
      if ((o.offsetParent.offsetWidth == null) || (o.offsetParent.offsetWidth == 0))
      {
        if (o.offsetParent.offsetParent != null)
        {
          return (o.offsetParent.offsetParent.offsetWidth);
        }
        else
        {
          return (0);
        }
      }
      else
      {
        return (o.offsetParent.offsetWidth);
      }
    }
  }
  else
  {
    return (o.offsetWidth);
  }
}

SolpartMenu.prototype.onMBMO = function(e, bBypassDelay)
{
  this.GenerateSubMenus();
  var oCell = e;

  if (oCell.id.length == 0)
  {
    return;
  }

  var sID = oCell.id.substr(2);
  var oMenu = spm_getById("tbl" + sID);

  if (this._m_aOpenMenuID.length || this.moExpand != '0')
  {
    if ((this.minDelay != 0) && (bBypassDelay != true))
    {
      if (this.minDelayTimer != null)
      {
        window.clearTimeout(this.minDelayTimer);
      }

      this.minDelayType = 'root';
      this.minDelayObj = e;
      this.minDelayTimer = setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].mouseInDelayHandler()', this.minDelay);
    }
    else
    {
      this.hideAllMenus();

      if (oMenu != null)
      {
        spm_positionMenu(this, oMenu, oCell);
        this.doTransition(oMenu);
        oMenu.style.display = "";
        this._m_aOpenMenuID[0] = sID;

        if (sID.indexOf("actions") == -1)
        {
          tblCurrentMenu = oMenu;

          clsIcon = spm_fixCSSForMac(this.getIntCSSName('spmicn') + this.cssMenuIcon);
          clsItem = spm_fixCSSForMac(this.getIntCSSName('spmitm') + ' ' + this.cssMenuItem);
          clsArrow = spm_fixCSSForMac(this.getIntCSSName('spmarw') + this.cssMenuArrow);

          ResetMenuItem();
        }

        if (this.useIFrames)
        {
          spm_iFrameIndex(oMenu, true, this.systemImagesPath);
        }
        else
        {
          spm_hideElement("SELECT|OBJECT", oMenu);
        }
      }
    }

    this.applyBorder(oCell, 1, this.shColor, this.hlColor);
  }
  else
  {
    this.applyBorder(oCell, 1, this.hlColor, this.shColor);
  }

  if (oCell.className.indexOf("actions") == -1)
  {
    trRootTab = oCell;
    ResetRootTab();
    CancelResetRootTab();

    oCell.className = spm_fixCSSForMac(spm_getAttr(oCell, 'saveselcss', ''));
  }

  this._m_dHideTimer = null;
}

SolpartMenu.prototype.onMBMOUT = function(e)
{
  var oCell = e;
  var sID = oCell.id.substr(2);
  this.applyBorder(oCell, 1, spm_getCellBackColor(oCell), spm_getCellBackColor(oCell), "none");
  this._m_dHideTimer = new Date();

  if (this.moutDelay != 0)
  {
    setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].hideMenuTime()', this.moutDelay);
  }

  this.stopTransition();
  this.minDelayType = null;

  if (oCell.className.indexOf("actions") == -1)
  {
    tmrRootTab = window.setTimeout("ResetRootTab()", 500);
  }
}

SolpartMenu.prototype.onMBIC = function (e, evt)
{
  var oRow = spm_getSourceTR(e, this._m_sNSpace);
  var sID = oRow.id.substr(2);

  if (spm_itemHasChildren(sID, this._m_sNSpace) == false)
  {
    this.hideAllMenus();
  }

  this.fireEvent("onMenuItemClick", oRow);

  if (spm_getAttr(oRow, "menuclick", "").length)
  {
    eval(spm_getAttr(oRow, "menuclick", ""));
  }

  spm_stopEventBubbling(evt);
  this.handlembi_mo(oRow, true);
}

function ResetRootTab()
{
  var nTable = trRootTab.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("table");

  for (var i = 0; i < nTable.length; i++)
  {
    var nTr = nTable[i].getElementsByTagName("tr")[0];
    nTr.className = spm_fixCSSForMac(spm_getAttr(nTr, 'savecss', ''));
  }
}

function CancelResetRootTab()
{
  if (tmrRootTab)
  {
    window.clearTimeout(tmrRootTab);
  }
}

SolpartMenu.prototype.handlembi_mo = function(oRow, bBypassDelay)
{
  var sID = oRow.id.substr(2);

  CancelResetRootTab();

  if (sID.indexOf("actions") == -1)
  {
    tblCurrentMenu = oRow.parentNode.parentNode;

    clsIcon = spm_fixCSSForMac(this.getIntCSSName('spmicn') + this.cssMenuIcon);
    clsItem = spm_fixCSSForMac(this.getIntCSSName('spmitm') + ' ' + this.cssMenuItem + ' ' + spm_getAttr(oRow, 'savecss', ''));
    clsArrow = spm_fixCSSForMac(this.getIntCSSName('spmarw') + this.cssMenuArrow);

    ResetMenuItem();
    CancelResetMenuItem();

    var nParentID = this._m_sNSpace + spm_getAttr(oRow, "parentID", "");

    if (spm_getById("tbl" + nParentID))
    {
      if (spm_getById("icon" + nParentID))
      {
        spm_getById("icon" + nParentID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel spmicn') + this.cssMenuIcon + ' ' + this.cssMenuItemSel + ' ' + spm_getAttr(oRow, 'saveselcss', ''));
        spm_getById("td" + nParentID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel') + this.cssMenuItemSel + ' ' + spm_getAttr(oRow, 'saveselcss', ''));
        spm_getById("arrow" + nParentID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel spmarw') + this.cssMenuItemSel + ' ' + this.cssMenuArrow + ' ' + spm_getAttr(oRow, 'saveselcss', ''));
      }
      else
      {
        if (trRootTab)
        {
          trRootTab.className = spm_fixCSSForMac(spm_getAttr(trRootTab, 'saveselcss', ''))
        }
      }
    }
  }

  spm_getById("icon" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel spmicn') + this.cssMenuIcon + ' ' + this.cssMenuItemSel + ' ' + spm_getAttr(oRow, 'saveselcss', ''));
  spm_getById("td" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel') + this.cssMenuItemSel + ' ' + spm_getAttr(oRow, 'saveselcss', ''));
  spm_getById("arrow" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel spmarw') + this.cssMenuItemSel + ' ' + this.cssMenuArrow + ' ' + spm_getAttr(oRow, 'saveselcss', ''));

  if (this.selBorderColor != '')
  {
    spm_applyRowBorder(oRow, 1, this.selBorderColor, true);
  }

  if ((this.minDelay != 0) && (bBypassDelay != true))
  {
    if (this.minDelayTimer != null)
    {
      window.clearTimeout(this.minDelayTimer);
    }

    this.minDelayType = 'sub';
    this.minDelayObj = oRow;
    this.minDelayTimer = setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].mouseInDelayHandler()', this.minDelay);

    return;
  }

  if (this._m_aOpenMenuID[this._m_aOpenMenuID.length - 1] != oRow.id.replace('tr', ''))
  {
    this.handleNewItemSelect(spm_getAttr(oRow, "parentID", ""));

    if (spm_getById("tbl" + sID) != null)
    {
      var iWidth;
      oMenu = spm_getById("tbl" + sID);

      var oPDims = new spm_elementDims(oRow);
      var oMDims = new spm_elementDims(oMenu);

      oMenu.style.top = spm_getCoord(oPDims.t);

      spm_resetScroll(oMenu);

      this.doTransition(oMenu);

      oMDims = new spm_elementDims(oMenu);
      oMenu.style.display = "";

      if ((oMDims.t - spm_getBodyScrollTop() + oMDims.h) > spm_getViewPortHeight())
      {
        if (oMDims.h < spm_getViewPortHeight())
        {
          oMenu.style.top = spm_getCoord(spm_getViewPortHeight() + spm_getBodyScrollTop() - oMDims.h);
        }
        else
        {
          spm_handleScrollMenu(this, oMenu);
          oMDims = new spm_elementDims(oMenu);
        }
      }

      if (this.direction == 'rtl')
      {
        oMenu.style.left = spm_getCoord(oPDims.l - oMDims.w - spm_getBodyScrollLeft());
      }
      else
      {
        oMenu.style.left = spm_getCoord(oPDims.l + oPDims.w - spm_getBodyScrollLeft());
      }

      if (this.direction == 'rtl')
      {
        if (oMDims.l - spm_getBodyScrollLeft() < 0)
        {
          oMenu.style.left = spm_getCoord(oPDims.l + oPDims.w - spm_getBodyScrollLeft());
        }
      }
      else
      {
        if (oPDims.l - spm_getBodyScrollLeft() + oPDims.w + oMDims.w > spm_getViewPortWidth())
        {
          oMenu.style.left = spm_getCoord(oPDims.l - oMDims.w - spm_getBodyScrollLeft());
        }
      }

      this._m_aOpenMenuID[this._m_aOpenMenuID.length] = sID;

      if (sID.indexOf("actions") == -1)
      {
        tblCurrentMenu = oMenu;
        ResetMenuItem();
      }

      if (this.useIFrames)
      {
        spm_iFrameIndex(oMenu, true, this.systemImagesPath);
      }
      else
      {
        spm_hideElement("SELECT|OBJECT", oMenu);
      }
    }
  }
}

SolpartMenu.prototype.handlembi_mout = function(oRow)
{
  var sID = oRow.id.substr(2);

  oRow.className = spm_fixCSSForMac(this.getIntCSSName('spmitm') + ' ' + this.cssMenuItem + ' ' + spm_getAttr(oRow, 'savecss', ''));

  if (sID.indexOf("actions") == -1)
  {
    tblCurrentMenu = oRow.parentNode.parentNode;
    tmrMenuItem = window.setTimeout("ResetMenuItem()", 500);
  }
  else
  {
    spm_getById("icon" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmicn') + this.cssMenuIcon);
    spm_getById("td" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitm') + ' ' + this.cssMenuItem + ' ' + spm_getAttr(oRow, 'savecss', ''));
    spm_getById("arrow" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmarw') + this.cssMenuArrow);
  }

  if (this.selBorderColor != '')
  {
    spm_applyRowBorder(oRow, 1, "", false);
  }

  this.stopTransition();
}

function ResetMenuItem()
{
  var nTr = tblCurrentMenu.getElementsByTagName("tr");

  for (var i = 0; i < nTr.length; i++)
  {
    var nTd = nTr[i].getElementsByTagName("td");

    if (nTd[0])
    {
      nTd[0].className = clsIcon;
    }

    if (nTd[1])
    {
      nTd[1].className = clsItem;
    }

    if (nTd[2])
    {
      nTd[2].className = clsArrow;
    }
  }
}

function CancelResetMenuItem()
{
  if (tmrMenuItem)
  {
    window.clearTimeout(tmrMenuItem);
  }
}

SolpartMenu.prototype.hideAllMenus = function()
{
  var i;
  var oMenu;

  for (i = 0; i < this._m_aOpenMenuID.length; i++)
  {
    oMenu = spm_getById("tbl" + this._m_aOpenMenuID[i]);
    oMenu.style.display = "none";

    if (this.useIFrames)
    {
      spm_iFrameIndex(oMenu, false, this.systemImagesPath);
    }
  }

  if (this.useIFrames != true)
  {
    spm_showElement("SELECT|OBJECT");
  }

  this._m_aOpenMenuID.length = 0;

  if (oMenu)
  {
    if (oMenu.className.indexOf("actions") == -1)
    {
      ResetRootTab();
    }
  }
}

function spm_getMenuBarEvents(sCtl)
{
  return ('onmouseover="m_oSolpartMenu[\'' + sCtl + '\'].onMBMO(this);" onmouseout="m_oSolpartMenu[\'' + sCtl + '\'].onMBMOUT(this);" onclick="m_oSolpartMenu[\'' + sCtl + '\'].onMBC(this, event);" onmousedown="m_oSolpartMenu[\'' + sCtl + '\'].onMBMD(this);" onmouseup="m_oSolpartMenu[\'' + sCtl + '\'].onMBMU(this);"');
}

function spm_getMenuItemEvents(sCtl)
{
  return ('onmouseover="m_oSolpartMenu[\'' + sCtl + '\'].onMBIMO(this);" onmouseout="m_oSolpartMenu[\'' + sCtl + '\'].onMBIMOUT(this);" onclick="m_oSolpartMenu[\'' + sCtl + '\'].onMBIC(this, event);"');
}

function spm_iFrameIndex(eMenu, bShow, sysImgPath)
{
  if (spm_browserType() == "op")
  {
    return;
  }

  if (document.readyState != "complete")
  {
    return;
  }

  if (bShow)
  {
    var oIFR = spm_getById("ifr" + eMenu.id);
    if (oIFR == null)
    {
      var oIFR = document.createElement("iframe");
      oIFR.id = "ifr" + eMenu.id;
      oIFR.src = sysImgPath + "spacer.gif";
      oIFR.style.top = spm_getCoord(0);
      oIFR.style.left = spm_getCoord(0);
      oIFR.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
      oIFR.scrolling = "no";
      oIFR.frameBorder = "no";
      oIFR.style.display = "none";
      oIFR.style.position = "absolute";
      document.body.appendChild(oIFR);
    }

    var oMDims = new spm_elementDims(eMenu);

    oIFR.style.width = oMDims.w.toString() + "px";
    oIFR.style.height = oMDims.h.toString() + "px";
    oIFR.style.top = spm_getCoord(oMDims.t);
    oIFR.style.left = spm_getCoord(oMDims.l);

    var iIndex = spm_getCurrentStyle(eMenu, "zIndex");

    if (iIndex == null || iIndex == 0 || isNaN(null) || iIndex == "auto")
    {
      iIndex = 0;
      eMenu.style.zIndex = 99;
    }

    oIFR.style.zIndex = iIndex - 1;
    oIFR.style.display = "block";
  }
  else if (spm_getById("ifr" + eMenu.id) != null)
  {
    spm_getById("ifr" + eMenu.id).style.display = "none";
  }
}

function spm_positionMenu(me, oMenu, oCell)
{
  spm_resetScroll(oMenu);

  var oPDims = new spm_elementDims(oCell, false, me);

  if (me.display == "vertical")
  {
    oMenu.style.top = spm_getCoord(oPDims.t);
    var oMDims = new spm_elementDims(oMenu);

    if ((oMDims.t - spm_getBodyScrollTop() + oMDims.h) >= spm_getViewPortHeight())
    {
      if (oMDims.h < spm_getViewPortHeight())
      {
        oMenu.style.top = spm_getCoord(spm_getViewPortHeight() - oMDims.h + spm_getBodyScrollTop());
      }
      else
      {
        spm_handleScrollMenu(me, oMenu);
      }
    }

    var oOrigMDims;

    if (spm_browserType() != "ie")
    {
      oOrigMDims = new spm_elementDims(oMenu);
    }

    if (me.direction == "rtl")
    {
      var oMDims2 = new spm_elementDims(oMenu);
      oMenu.style.left = spm_getCoord((oPDims.l) - oMDims2.w - spm_getBodyScrollLeft());
    }
    else
    {
      oMenu.style.left = spm_getCoord(oPDims.l + oPDims.w - spm_getBodyScrollLeft());
    }

    oMDims = new spm_elementDims(oMenu);
    if (oOrigMDims == null)
    {
      oOrigMDims = oMDims;
    }

    if ((oMDims.l - spm_getBodyScrollLeft(true) + oOrigMDims.w) > spm_getViewPortWidth())
    {
      if ((spm_getViewPortWidth() - oOrigMDims.w) > 0)
      {
        oMenu.style.left = spm_getCoord(oPDims.l - oOrigMDims.w - spm_getBodyScrollLeft(true));
      }
    }
  }
  else
  {
    if (me.direction == "rtl")
    {
      var oMDims2 = new spm_elementDims(oMenu);
      oMenu.style.left = spm_getCoord((oPDims.l + oPDims.w) - oMDims2.w - spm_getBodyScrollLeft());
    }
    else
    {
      oMenu.style.left = spm_getCoord(oPDims.l - spm_getBodyScrollLeft());
    }

    oMenu.style.top = spm_getCoord(oPDims.t + oPDims.h + 2);
    var oMDims = new spm_elementDims(oMenu);

    if ((oMDims.l - spm_getBodyScrollLeft(true) + oMDims.w) > spm_getViewPortWidth())
    {
      if (spm_getViewPortWidth() - oMDims.w > 0)
      {
        oMenu.style.left = spm_getCoord(spm_getViewPortWidth() - oMDims.w + spm_getBodyScrollLeft(true));
      }
    }

    if ((oMDims.t - spm_getBodyScrollTop() + oMDims.h) > spm_getViewPortHeight())
    {
      if ((oPDims.t - oMDims.h - spm_getBodyScrollTop()) > 0)
      {
        oMenu.style.top = spm_getCoord(oPDims.t - oMDims.h);
      }
      else
      {
        spm_handleScrollMenu(me, oMenu);
      }
    }
  }
}



