/**
* nlsmenu2.js v.1.1.6
* Copyright 2005-2006, addObject.com. All Rights Reserved
* Author Jack Hermanto, www.addobject.com
*/
var nlsmenu2 = new Object();
var nlsmenu2Mgr = new Object();
var nlsWinelm2t2 = [];

var nls_isIE = (window.navigator.userAgent.indexOf("MSIE") >=0);
var nls_isIE5 = (window.navigator.userAgent.indexOf("MSIE 5.0") >=0);
var nls_isSafari = (window.navigator.userAgent.indexOf("Safari") >=0);

function Nlsmenu2Manager(mgr) {
  this.mgrId = mgr;
  this.menu2s = new Object();
  this.menu2bar = null;
  this.timeout = 100;
  this.flowOverFormElement = false;
  this.assocmenu2Mgr = [];
  this.defaultEffect=null;
  
  this.tmId = null;
  this.setTimeout=function(a, t) { this.tmId = window.setTimeout(a, t); };
  this.clearTimeout=function() { if (this.tmId!=null) { window.clearTimeout(this.tmId); this.tmId=null;}};
  
  nlsmenu2Mgr[mgr] = this;
  return this;
};

Nlsmenu2Manager.prototype.createmenu2 = function(mId) {
  var m = new Nlsmenu2(mId);  
  m.mgrId = this.mgrId;
  if (this.defaultEffect!=null && this.defaultEffect!="") m.useEffect(this.defaultEffect);
  this.menu2s[mId] = m;
  return m;
};

Nlsmenu2Manager.prototype.createmenu2bar = function (mbarId) {
  if (this.menu2bar) alert("menu2bar already exists!");
  var m = new Nlsmenu2bar(mbarId);  
  m.mgrId = this.mgrId;
  this.menu2bar = m;
  return m;  
};

Nlsmenu2Manager.prototype.rendermenu2s = function () {
  for (it in this.menu2s) {
    document.write(this.menu2s[it].rendermenu2());
  }
};

Nlsmenu2Manager.prototype.rendermenu2bar = function () {
  if (this.menu2bar) document.write(this.menu2bar.rendermenu2bar());
};

Nlsmenu2Manager.prototype.hidemenu2s = function () {
  for (it in this.menu2s) {if (this.menu2s[it].active) this.menu2s[it].hidemenu2();}
  if (this.menu2bar) this.menu2bar.hidemenu2();
};

Nlsmenu2Manager.prototype.addAssocmenu2Mgr = function(frm, mgrId) {
  this.assocmenu2Mgr[this.assocmenu2Mgr.length] = [frm, mgrId];
};

Nlsmenu2Manager.prototype.getmenu2= function(mId) {
  return this.menu2s[mId];
};

function listAll2Winelm2t2() {
  nlsWinelm2t2 = [];
  var arrWinEl2 = document.getElementsByTagName("SELECT");
  var elm2; var tmp; var x; var y;
  for(var i=0; i<arrWinEl2.length; i++) {
    elm2 = arrWinEl2[i]; tmp=elm2; x=0; y=0;
    while (tmp!=null) { 
      x += tmp.offsetLeft; y+=tmp.offsetTop;
      tmp = tmp.offsetParent;
    }
    nlsWinelm2t2[nlsWinelm2t2.length] = {e:elm2, eX1:x, eY1:y, eX2:x+elm2.offsetWidth, eY2:y+elm2.offsetHeight};
  }
};

function Nlsmenu2Item(id, capt, url, ico, enb, xtra, subId, crossFrame, subFrame, subPos, subPosAdj, subDir) {
  this.id = id;
  this.intKey = "";
  this.capt = capt;
  this.url = (url==null? "" : url);
  this.ico = (ico==null && ico=="" && ico.length==0) ? null: ico;
  this.enable=(enb==null?true:enb);
  this.xtra = xtra;
  this.stlprf="";
  
  this.submenu2Id = (subId?subId:"");
  this.crsFrame = (crossFrame?crossFrame:false);
  this.subFrame = (subFrame?subFrame:null);
  this.subPos = (subPos?subPos:[null,null]);
  this.subPosAdj = (subPosAdj?subPosAdj:[0,0]);
  this.subDir = (subDir?subDir:["right","down"]);
  this.toString=function() {return "Nlsmenu2Item";};
  return this;
};

function Nlsmenu2Separator(cstSeparator) {
  this.stlprf = "";
  this.intKey = "";
  this.seprt = cstSeparator!=null?cstSeparator:"";
  this.render = function () {
    if (this.seprt!="") return this.seprt;
    return ("<table border=0 cellpadding=0 cellspacing=0 width='100%' height='0%'><tr>" + 
            "<td class=\""+this.stlprf+"nlsseparator\"></td>" + 
            "</tr></table>");
  };
                 
  this.toString=function() {return "Nlsmenu2Separator";};
};

function NlsCustommenu2Item(cst) {
  this.intKey = "";
  this.cstmenu2 = (cst?cst:"&nbsp;");
  this.toString=function() {return "NlsCustommenu2Item";};
};
 
function Nlsmenu2(mId) {
  //private
  this.lsItm=null;
  this.mgrId = "";
  this.winelm2t=null;
  this.container2=null;
  this.customBorder=null;
  this.shadow=new Nlsmenu2Shadow("bottomright", "5px", mId);
  this.count=0;
  this.active = false;
  this.ismenu2bar=false;
  this.effect=null;
  this.srItems=[];
  
  //public
  this.mId = mId;
  this.items = new Object();
  this.stlprf="";
  this.submenu2Ic=[];
  this.target=null;
  
  this.showIcon=false;
  this.showSubIcon=false;
 
  this.absWidth=0;
  this.orient="V";

  this.maxItemCol=100;
  this.zIndex = 100;
  
  this.wnd = window;
  nlsmenu2[mId] = this;
  return this;
};

Nlsmenu2.prototype.addItem = function(key, capt, url, ico, enb, xtra, subId) {
  var intKey = this.mId+"_"+key;
  var it = new Nlsmenu2Item(key, capt, url, ico, enb, xtra, subId);
  it.intKey = intKey;
  this.items[intKey]=it;
  this.srItems[this.srItems.length]=it;
  this.count++;
  return it;
};

Nlsmenu2.prototype.addSeparator = function(separator) { 
  var intKey = "sep_"+this.count;
  var it = (separator ? separator : new Nlsmenu2Separator());
  it.stlprf = this.stlprf;
  it.intKey = intKey;
  this.items[intKey] = it;
  this.srItems[this.srItems.length]=it;
  this.count++;
  return it;
};

Nlsmenu2.prototype.addSubmenu2 = function(key, subId, crsFrame, subFrame, subPos, subPosAdj, subDir) {
  var intKey = this.mId+"_"+key;
  var mnItem = this.items[intKey];
  mnItem.submenu2Id=subId;
  mnItem.subFrame=(subFrame?subFrame:null);
  mnItem.crsFrame=(crsFrame?crsFrame:false);
  mnItem.subPos = (subPos?subPos:[null,null]);
  mnItem.subPosAdj = (subPosAdj?subPosAdj:[0,0]);
  mnItem.subDir = (subDir?subDir:["right","down"]);
};

Nlsmenu2.prototype.addCustommenu2 = function (custom) {
  var intKey = "cst_"+this.count;
  var it = new NlsCustommenu2Item(custom);
  it.intKey = intKey;
  this.items[intKey] = it;
  this.srItems[this.srItems.length]=it;
  this.count++;
  return it;
};

Nlsmenu2.prototype.setItemStyle = function (key, stlprf) {
  var intKey = this.mId+"_"+key;
  var mnItem = this.items[intKey];
  mnItem.stlprf=stlprf;
};

Nlsmenu2.prototype.enableItem = function (key, b) {
 var intKey = this.mId+"_"+key;
 this.items[intKey].enable=b;
 setMnStyle2(NlsGetElementById2(intKey), (b?"N":"D"), (this.items[intKey].stlprf==""?this.stlprf:this.items[intKey].stlprf));
};

Nlsmenu2.prototype.dropShadow = function (pos, offset) {
  if (this.shadow) { this.shadow.pos=pos; this.shadow.offset=(offset?offset:"5px"); } else
  { this.shadow=new Nlsmenu2Shadow(pos, offset, this.mId); }
};

Nlsmenu2.prototype.applyBorder = function (bTop, bBottom, bLeft, bRight) {
  if (!bTop && !bBottom && !bLeft && !bRight) {
    this.customBorder=null;
  } else {
    this.customBorder=new Nlsmenu2Border(bTop, bBottom, bLeft, bRight);
  }
};

Nlsmenu2.prototype.useEffect = function (effName) {
  this.effect=new Nlsmenu2Effect(this.mId, effName);
};

Nlsmenu2.prototype.rendermenu2 = function() {
  if (!this.submenu2Ic||this.submenu2Ic=="") {
    var allScs = (document.getElementsByTagName ? document.getElementsByTagName("SCRIPT"): document.scripts);
    for (var i=0;i<allScs.length;i++) {
      if (allScs[i].src.toLowerCase().indexOf("nlsmenu2.js")>=0) {this.submenu2Ic=[allScs[i].src.replace(/nlsmenu2.js/gi, "img/submenu2.gif"), allScs[i].src.replace(/nlsmenu2.js/gi, "img/submenu2ovr.gif")];break;}
    }
  }
  var sAbs=(this.absWidth==0?"":"width='"+this.absWidth+"px'");
  var smenu2="<table cellpadding=0 cellspacing=0 width='100%'>";
  var tmpCnt=0;var prf=this.stlprf; var it=null;
  for (var i=0; i<this.srItems.length; i++) {
    it=this.srItems[i];
    if (it.toString()=="Nlsmenu2Separator") {
      smenu2+=(this.orient=="V"?"<tr>":"");
      smenu2+=("<td class='"+this.stlprf+"nlsseparatorcontainer2'>"+it.render()+"</td>");
      smenu2+=(this.orient=="V"?"</tr>":"");
    } else 
    if (it.toString()=="NlsCustommenu2Item") {
      smenu2+=(this.orient=="V"?"<tr>":"");
      smenu2+=("<td>"+it.cstmenu2+"</td>");
      smenu2+=(this.orient=="V"?"</tr>":"");
    } else {
      if (it.stlprf) prf=it.stlprf; else prf=this.stlprf;
      if (this.orient=="V") { smenu2+="<tr>"; }
      if (this.orient=="H") { if (tmpCnt==0) smenu2+="<tr>"; tmpCnt++; }
      smenu2+="<td id=\""+it.intKey+"\" class=\""+prf+"nlsitemcontainer2\" "+(this.orient=="H"?sAbs:"")+" onmouseover=\"nlsmenu2ItemOver(event, '"+it.intKey+"')\" onclick=\"return nlsmenu2."+this.mId+".menu2ItemClick(event, '"+it.intKey+"');\">";
      smenu2+="<table cellpadding=0 cellspacing=0 width='100%' height='100%'><tr style=\"cursor:pointer;\">";
      if (this.showIcon) { smenu2+="<td id=\""+it.intKey+"x1\" class=\""+prf+"nlsiconcell\" align=\"center\" nowrap>"+(it.ico && it.ico.length>0?"<img id=\"ic_"+it.intKey+"\" src=\""+it.ico[0]+"\">" + (it.ico.length>1?"<img id=\"icovr_"+it.intKey+"\" style='display:none' src=\""+it.ico[1]+"\">":"") :"")+"</td>"; }
      smenu2+="<td id=\""+it.intKey+"x2\" class=\""+prf+(it.enable?"nlsitem\"":"nlsitemdisable\"")+" nowrap>"+it.capt+"</td>";
      if (this.showSubIcon && it.submenu2Id!="")  { smenu2+="<td id=\""+it.intKey+"x3\" class=\""+prf+"nlssubmenu2cell\" align=\"right\" nowrap>"+ (it.submenu2Id!=""? "<img id='subic_"+it.intKey+"' src=\""+this.submenu2Ic[0]+"\">" + (this.submenu2Ic.length>1?"<img id='subicovr_"+it.intKey+"' style='display:none' src=\""+this.submenu2Ic[1]+"\">":"") :"") +"</td>"; }
      smenu2+="</tr></table>";
      smenu2+="</td>";
      if (this.orient=="V") { smenu2+="</tr>"; }
      if (this.orient=="H" && tmpCnt==this.maxItemCol) { smenu2+="</tr>"; tmpCnt=0; }
    }
  }
  
  smenu2+=(this.orient=="H" && tmpCnt!=0 ?"</tr>":"");
  smenu2 += "</table>";
  smenu2 = "<table cellpadding=0 cellspacing=0 class='"+this.stlprf+"nlsmenu2'><tr><td "+(this.orient=="V"?sAbs:"")+">"+smenu2+"</td></tr></table>";
  
  if (this.customBorder!=null) smenu2 = this.customBorder.applyBorder(smenu2, this.stlprf);
  smenu2 = this.shadow.dropShadow(smenu2);

  smenu2 = "<div " + (nls_isIE && !this.ismenu2bar?"style='position:absolute;z-index:"+(this.zIndex-1)+";'":"") + ">" + smenu2 + "</div>";
  if (!this.ismenu2bar &&  nls_isIE && !nls_isIE5 && nlsmenu2Mgr[this.mgrId].flowOverFormElement) { 
    smenu2 += "<iframe id='"+this.mId+"ifrm' scrolling='no' frameborder=0 width='1' height='1' style='position:absolute;top:0px;left:0px;' ></iframe>"; 
  }
    
  smenu2 = "<div id='"+this.mId+"' style="+(this.ismenu2bar?"''":"'position:absolute;z-index:"+this.zIndex+";display:none;'")+" onmouseover=\"_nlsmenu2ItemOver('"+this.mgrId+"')\" onmouseout=\"nlsmenu2ItemOut('"+this.mgrId+"')\">" + smenu2 + "</div>";

  return smenu2;
}

function Nlsmenu2Shadow(pos, offset, mId) {
  this.pos=pos;
  this.offset=offset;
  this.mId=mId;

  this.dropShadow = function (smenu2) {
    var mn = nlsmenu2[this.mId];
    var shadow = "<table id='effwin_"+this.mId+"' cellpadding=0 cellspacing=0 height='0px'>";
    var hshadow = "<table cellpadding=0 cellspacing=0 width='100%' height='5px' class='"+mn.stlprf+"horzshadow'><tr><td></td></tr></table>";
    var vshadow = "<table cellpadding=0 cellspacing=0 width='5px' height='100%' class='"+mn.stlprf+"vertshadow'><tr><td></td></tr></table>";
    var menu2td = "<td id='actmn_"+this.mId+"'>"+smenu2+"</td>";
    var cornertd = "<td class='"+mn.stlprf+"cornshadow' width='5px' height='5px'></td>";
    switch (this.pos) {
      case "none":
        shadow += "<tr>"+menu2td+"</tr>";
        break;
      case "bottomright" :
        shadow += "<tr>"+menu2td+"<td style='height:100%;padding-top:OFFSET;'>"+vshadow+"</td></tr>" + 
          "<tr><td style='padding-left:OFFSET;'>"+hshadow+"</td>"+cornertd+"</tr>";
        break;
      case "bottomleft" :
        shadow += "<tr><td style='height:100%;padding-top:OFFSET;'>"+vshadow+"</td>"+menu2td+"</tr>" + 
          "<tr>"+cornertd+"<td style='padding-right:OFFSET;'>"+hshadow+"</td></tr>";
        break;
      case "topleft" :
        shadow += "<tr>"+cornertd+"<td style='padding-right:OFFSET;'>"+hshadow+"</td></tr>" + 
          "<tr><td style='height:100%;padding-bottom:OFFSET;'>"+vshadow+"</td>"+menu2td+"</tr>";
        break;
      case "topright" :
        shadow += "<tr><td style='padding-left:OFFSET;'>"+hshadow+"</td>"+cornertd+"</tr>" + 
          "<tr>"+menu2td+"<td style='height:100%;padding-bottom:OFFSET;'>"+vshadow+"</td></tr>";
        break;
    }
    return shadow.replace(/OFFSET/gi, this.offset) + "</table>";  
  }
}

Nlsmenu2.prototype.showmenu2 = function(x1, y1, x2, y2, mnOrient, subDir, subAdj) {

  if (this.lsItm!=null) {setMnStyle2(this.lsItm, "N", (this.lsItm.stlprf==""?this.stlprf:this.lsItm.stlprf)); this.lsItm=null;}

  var flag= this.menu2OnShow(this.mId); //onshow event
  if (flag==false) return;
  
  var ctx = NlsGetElementById2(this.mId);
  if (!ctx) return;
  var dmfrm = NlsGetElementById2(this.mId+"ifrm");
  ctx.style.visibility="hidden";
  ctx.style.display="";
  
  //reposition
  var scrOffX = window.scrollX?window.scrollX:document.body.scrollLeft; //scrollLeft:IE, scrollX:MOZ
  var scrOffY = window.scrollY?window.scrollY:document.body.scrollTop; //scrollLeft:IE, scrollX:MOZ
  var cW=(window.innerWidth?window.innerWidth:document.body.clientWidth);//clientWidth:IE, innerWidth:MOZ, clientWidth in MOZ include non visible area
  var cH=(window.innerHeight?window.innerHeight:document.body.clientHeight);
  var mW=(ctx.children?ctx.children[0]:ctx.childNodes[0]).offsetWidth
  var mH=(ctx.children?ctx.children[0]:ctx.childNodes[0]).offsetHeight; //using clientWidth is OK on IE and FF, but not in NS/MOZ
  var sDir=(subDir?subDir:["right", "down"]);
  var adjX=(subAdj?subAdj[0]:0); var adjY=(subAdj?subAdj[1]:0);
  
  if (dmfrm) { 
    //dmfrm.width=mW; dmfrm.height=mH; 
    var actMn = NlsGetElementById2("actmn_"+this.mId);
    dmfrm.width = actMn.children[0].offsetWidth;
    dmfrm.height = actMn.children[0].offsetHeight;
  }
  var mX=0; var mY=0;
  if (mnOrient=="V") {
    if (sDir[0]=="right") {
      if (x2+mW>cW) { if (x1>=mW) { mX=x1-mW+adjX+scrOffX; } else { mX=cW-mW-1+scrOffX; }  } else { mX=x2+scrOffX-adjX; }
    } else {
      if (x1-mW<0) { if (x2+mW<cW) { mX=x2-adjX+scrOffX; } else { mX=scrOffX; } } else {  mX=x1-mW+adjX+scrOffX; }
    }
    if (sDir[1]=="down") {
      if (y1+mH>cH) { if (y2>=mH) { mY=y2-mH+scrOffY-adjY; } else { mY=cH-mH-1+scrOffY; } } else { mY=y1+scrOffY+adjY; }
    } else {
      if (y1-mH<0) { if (y1+mH<cH) { mY=y1+scrOffY-adjY; } else { mY=scrOffY; } } else { mY=y2-mH+scrOffY-adjY; }
    }
  } else { //if menu2 horiz
    if (sDir[0] == "right") {
      if (x1+mW>cW) { if (x2>=mW) { mX=x2-mW+scrOffX-adjX; } else { mX=cW-mW-1+scrOffX; } } else { mX=x1+scrOffX+adjX; }
    } else {
      if (x2-mW<0) { if (x1+mW<cW) { mX=x1+scrOffX+adjX; } else { mX=scrOffX;} } else { mX=x2-mW+scrOffX-adjX; }
    }
    if (sDir[1] == "down") {
      if (y2+mH>cH) { if (y1>=mH) { mY=y1-mH+scrOffY+adjY; } else { mY=cH-mH-1+scrOffY; } } else { mY=y2+scrOffY-adjY; }
    } else {
      if (y1-mH<0) { if (y2+mH<cH) { mY=y2+scrOffY-adjY; } else { mY=scrOffY; } } else { mY=y1-mH+scrOffY+adjY; }
    }
  }
  
  if (nls_isIE5 || !nlsmenu2Mgr[this.mgrId].flowOverFormElement) {
    if (this.winelm2t==null) hideWin2elm2t(this, mX, mY, mX+mW, mY+mH);
    if (this.winelm2t==null) this.winelm2t=[];
    for(var i=0;i<this.winelm2t.length;i++) {
      this.winelm2t[i].style.visibility="hidden";
    }
  }
  with (ctx.style) { 
    left=mX+"px"; top=mY+"px"; 
    zIndex = this.zIndex; 
    if (this.effect) { this.effect.init(); visibility="visible"; this.effect.start();
    } else { visibility="visible"; }
  }
  this.active=true;
}

function hideWin2elm2t(mn, mX1, mY1, mX2, mY2) {
  var oe;
  for (var i=0; i<nlsWinelm2t2.length; i++) {
    oe = nlsWinelm2t2[i];
    if ((oe.eX1>=mX1 && oe.eX1<=mX2 && oe.eY1>=mY1 && oe.eY1<=mY2) ||
        (oe.eX1>=mX1 && oe.eX1<=mX2 && oe.eY2>=mY1 && oe.eY2<=mY2) ||
        (oe.eX2>=mX1 && oe.eX2<=mX2 && oe.eY1>=mY1 && oe.eY1<=mY2) ||
        (oe.eX2>=mX1 && oe.eX2<=mX2 && oe.eY2>=mY1 && oe.eY2<=mY2) ||
        (mX1>=oe.eX1 && mX1<=oe.eX2 && mY1>=oe.eY1 && mY1<=oe.eY2) ||
        (mX1>=oe.eX1 && mX1<=oe.eX2 && mY2>=oe.eY1 && mY2<=oe.eY2) ||
        (mX2>=oe.eX1 && mX2<=oe.eX2 && mY1>=oe.eY1 && mY1<=oe.eY2) ||
        (mX2>=oe.eX1 && mX2<=oe.eX2 && mY2>=oe.eY1 && mY2<=oe.eY2) ||
        (oe.eX1<mX1 && oe.eX2>mX2 && oe.eY1>=mY1 && oe.eY1<=mY2) ||
        (oe.eX1<mX1 && oe.eX2>mX2 && oe.eY2>=mY1 && oe.eY2<=mY2)
       ) {
      if (oe.e.style.visibility!="hidden") {
        oe.e.style.visibility="hidden";
        if (mn.winelm2t==null) mn.winelm2t=[];
        mn.winelm2t[mn.winelm2t.length]=oe.e;
      }
    }
  }
};

Nlsmenu2.prototype.showmenu2Abs = function(x, y) {
  //hideAllmenu2();
  var ctx = NlsGetElementById2(this.mId);
  ctx.style.top=y+"px"; ctx.style.left=x+"px"; 
  ctx.style.display="";
  this.active=true;
};

Nlsmenu2.prototype.hidemenu2 = function() {
  var ctx = NlsGetElementById2(this.mId);
  if (!ctx) return;
  if (!this.ismenu2bar) {
    ctx.style.display="none";
    this.active=false;
  } else {
    this.ismenu2Opened = false;
  }
  if (this.lsItm!=null) {
    setMnStyle2(this.lsItm, "N", (this.items[this.lsItm.id].stlprf==""?this.stlprf:this.items[this.lsItm.id].stlprf)); 
    setMnIcon2(this, this.items[this.lsItm.id], "N");
    this.lsItm=null;
  }
  if (this.winelm2t!=null && this.winelm2t.length>0) {
    for (i=0;i<this.winelm2t.length;i++) {
      this.winelm2t[i].style.visibility = "visible";
    }
  }
};

Nlsmenu2.prototype.menu2ItemClick = function(e, itemId) {
  if (!this.items[itemId].enable) return;

  var m=itemId.split("_");
  var prmenu2 = nlsmenu2[m[0]];
  
  if (this.ismenu2bar && this.dropOnClick && !this.ismenu2Opened) {
    //drop down the menu2
    _showmenu2(prmenu2, itemId);
    this.ismenu2Opened = true;
    return null;
  } else {
    //hide
    nlsmenu2Mgr[this.mgrId].hidemenu2s();
    var mnMgr = nlsmenu2Mgr[this.mgrId];
    var assMgr = mnMgr.assocmenu2Mgr;
    if ( assMgr && assMgr.length > 0) {
      for (var i=0; i<assMgr.length; i++) { var frm = assMgr[i];  frm[0].hideAllNlsmenu2(); }
    }  
    
    if (this.ismenu2bar && this.dropOnClick) {
      var oIt = NlsGetElementById2(itemId);
      setMnStyle2(oIt, (prmenu2.items[itemId].enable ? "O" : "D"), (prmenu2.items[itemId].stlprf==""?this.stlprf:prmenu2.items[itemId].stlprf)); //select
      setMnIcon2(prmenu2, prmenu2.items[itemId], "O");
      this.ismenu2Opened = false;
      return null;
    } else {
      var ids = itemId.split("_");
      var wnd = this.target?this.target:window;
      if (this.items[itemId].url!="") {
        wnd.location.href=this.items[itemId].url;
      } else {
        return this.menu2OnClick(ids[0], ids[1]);
      }
    }
  }
};

//menu2 item click event, PUT YOUR CODE HERE
Nlsmenu2.prototype.menu2OnClick = function (menu2Id, itemId) {return true;};
Nlsmenu2.prototype.menu2OnShow = function (menu2Id) {return true;};

function setMnIcon2(mn, mnItm, flg) {
  if (mn.showIcon && mnItm.ico && mnItm.ico.length>1) {
    NlsGetElementById2("ic_"+mnItm.intKey).style.display=(flg=="N"?"":"none");
    NlsGetElementById2("icovr_"+mnItm.intKey).style.display=(flg=="O"?"":"none");
  }
  if (mn.showSubIcon && mnItm.submenu2Id!="" && mn.submenu2Ic && mn.submenu2Ic.length>1) {
    NlsGetElementById2("subic_"+mnItm.intKey).style.display=(flg=="N"?"":"none");
    NlsGetElementById2("subicovr_"+mnItm.intKey).style.display=(flg=="O"?"":"none");
  } 
};

function setMnStyle2(it, s, prefix) {
  var suff=(s=="O"?"over":"");
  it.className=prefix+"nlsitemcontainer2"+suff;
  var r = (it.children?it.children[0]:it.childNodes[0]).rows[0];
  for (var i=0; i<r.cells.length; i++) {
    switch (r.cells[i].id) {
      case it.id+"x1": 
        r.cells[i].className=prefix+"nlsiconcell"+suff; break;
      case it.id+"x2":
        r.cells[i].className=prefix+"nlsitem"+(s=="D"?"disable":suff);
        break;
      case it.id+"x3":
        r.cells[i].className=prefix+"nlssubmenu2cell"+suff; break;    
    }
  }
};

function nlsmenu2ItemOver(e, it) {
  var m=it.split("_");
  var oIt = NlsGetElementById2(it);
  var li = nlsmenu2[m[0]].lsItm;
  var prmenu2 = nlsmenu2[m[0]];
  if (!prmenu2.active) return;
  
  if (li!=null) {
    var lstItm = prmenu2.items[li.id];
    if (lstItm.intKey==it) return;
    setMnStyle2(li, (lstItm.enable ? "N" : "D"), (lstItm.stlprf==""?prmenu2.stlprf:lstItm.stlprf));
    if (lstItm.enable) setMnIcon2(prmenu2, lstItm, "N");
    
    var tmp=(lstItm.crsFrame?lstItm.subFrame.nlsGetmenu2(lstItm.submenu2Id):nlsGetmenu2(lstItm.submenu2Id));
    while(tmp!=null) { 
      var nli = null;
      if (tmp.lsItm) {
        nli = (tmp.items[tmp.lsItm.id].crsFrame ? tmp.items[tmp.lsItm.id].subFrame.nlsGetmenu2(tmp.items[tmp.lsItm.id].submenu2Id) : tmp.wnd.nlsGetmenu2(tmp.items[tmp.lsItm.id].submenu2Id));
      } 
      tmp.hidemenu2(); tmp=nli; 
    }
  }
  setMnStyle2(oIt, (prmenu2.items[it].enable ? "O" : "D"), (prmenu2.items[it].stlprf==""?prmenu2.stlprf:prmenu2.items[it].stlprf)); //select
  if (prmenu2.items[it].enable) setMnIcon2(prmenu2, prmenu2.items[it], "O");
  
  if (!prmenu2.ismenu2bar || (prmenu2.ismenu2bar && !prmenu2.dropOnClick) || (prmenu2.ismenu2bar && prmenu2.dropOnClick && prmenu2.ismenu2Opened)) { _showmenu2(prmenu2, it); }
  
  nlsmenu2[m[0]].lsItm=oIt;
};

function _showmenu2(prmenu2, it) {
  var oIt = NlsGetElementById2(it);
  if (prmenu2.items[it].submenu2Id!="" && prmenu2.items[it].enable==true) {
    var mnIt = prmenu2.items[it];

    var tmp = oIt; var x=0; var y=0; x2=0; y2=0;
    while(tmp) { x+=tmp.offsetLeft; y+=tmp.offsetTop; tmp=tmp.offsetParent } ;
    x -= (window.scrollX?window.scrollX:document.body.scrollLeft); //scrollLeft:IE, scrollX:MOZ
    y -= (window.scrollY?window.scrollY:document.body.scrollTop); //scrollLeft:IE, scrollX:MOZ
    if (mnIt.crsFrame) {
      if (mnIt.subPos[0]=="REL") { x2=x+oIt.offsetWidth; } else { x = mnIt.subPos[0]; x2=x; }
      if (mnIt.subPos[1]=="REL") { y2=y+oIt.offsetHeight; } else { y = mnIt.subPos[1]; y2=y; }

      var subMn = mnIt.subFrame.nlsGetmenu2(mnIt.submenu2Id);
      subMn.showmenu2(x, y, x2, y2, prmenu2.orient, mnIt.subDir, mnIt.subPosAdj);
    } else {
      x2=x+oIt.offsetWidth; y2=y+oIt.offsetHeight;
      var smenu2 = nlsGetmenu2(mnIt.submenu2Id);
      if (smenu2.zIndex <= prmenu2.zIndex) { smenu2.zIndex = prmenu2.zIndex+1 }
      smenu2.showmenu2(x, y, x2, y2, prmenu2.orient, mnIt.subDir, mnIt.subPosAdj);
      
    }
  }
};

function _nlsmenu2ItemOver(mgrId) {
  var mnMgr = nlsmenu2Mgr[mgrId];
  mnMgr.clearTimeout();
  
  var assMgr = mnMgr.assocmenu2Mgr;
  if ( assMgr && assMgr.length > 0) {
    for (var i=0; i<assMgr.length; i++) {
      assMgr[i][0].nlsmenu2Mgr[assMgr[i][1]].clearTimeout();
    }
  } 
  
  //hide other instances
  for (var it in nlsmenu2Mgr) {
    if (it!=mgrId) {
      nlsmenu2Mgr[it].hidemenu2s();
    }
  }
  
};

function nlsmenu2ItemOut(mgrId) {
  var mnMgr = nlsmenu2Mgr[mgrId];
  mnMgr.clearTimeout();
  mnMgr.setTimeout(function() { _nlsmenu2ItemOut(mgrId) }, mnMgr.timeout);

  var assMgr = mnMgr.assocmenu2Mgr;
  if ( assMgr && assMgr.length > 0) {
    for (var i=0; i<assMgr.length; i++) {
      var frm = assMgr[i];
      frm[0].nlsmenu2Mgr[frm[1]].clearTimeout();
      frm[0].nlsmenu2Mgr[frm[1]].setTimeout(function() { frm[0]._nlsmenu2ItemOut(mgrId); }, mnMgr.timeout);
    }
  }  
};

function _nlsmenu2ItemOut(mgrId) {
  nlsmenu2Mgr[mgrId].hidemenu2s();
};

function nlsGetmenu2(mId) {
  return nlsmenu2[mId];
};

/*===================================================*/
//Nlsmenu2Shadow class
/*===================================================*/

function Nlsmenu2Border(bTop, bBottom, bLeft, bRight) {
  var border = "<table cellpadding=0 cellspacing=0>";
  var sTop="", sBottom="", sLeft="", sRight="";
  if (bTop) sTop="<td><table width='100%' cellpadding=0 cellspacing=0><tr><td class='@stlprf_mtop'></td></tr></table></td>";
  if (bBottom) sBottom="<td><table width='100%' cellpadding=0 cellspacing=0><tr><td class='@stlprf_mbottom'></td></tr></table></td>";
  if (bLeft) {
    sLeft="<td height='100%' class='@stlprf_mleft'></td>";
    if (bTop) sTop="<td class='@stlprf_mtopleft'></td>"+sTop;
    if (bBottom) sBottom="<td class='@stlprf_mbottomleft'></td>"+sBottom;
  }
  if (bRight) {
    sRight="<td height='100%' class='@stlprf_mright'></td>";
    if (bTop) sTop+="<td class='@stlprf_mtopright'></td>";
    if (bBottom) sBottom+="<td class='@stlprf_mbottomright'></td>";    
  }
  if (sTop!="") sTop="<tr>"+sTop+"</tr>";
  if (sBottom!="") sBottom="<tr>"+sBottom+"</tr>";  
  border=border+sTop+"<tr height='100%'>"+sLeft+"<td>@menu2</td>"+sRight+"</tr>"+sBottom;
  border+="</table>";
  
  this.applyBorder = function (smenu2, stlprf) {
    var b=border.replace(/@stlprf_/gi, stlprf);
    return b.replace(/@menu2/gi, smenu2);
  }
  
  return this;
};

/*===================================================*/
//Nlsmenu2Bar class
/*===================================================*/
//private
Nlsmenu2.prototype.ismenu2Opened = false;
//public
Nlsmenu2.prototype.dropOnClick = false;

Nlsmenu2.prototype.rendermenu2bar = function () {
  return this.rendermenu2();
};

function Nlsmenu2bar(mId) {
  var mnBar = new Nlsmenu2(mId);
  mnBar.ismenu2bar=true;
  mnBar.active=true;
  return mnBar;
};

/*===================================================*/
//Public general methods
/*===================================================*/

function hideAllNlsmenu2() {
  for (it in nlsmenu2) {if (nlsmenu2[it].active) nlsmenu2[it].hidemenu2();}
};

/**Cross browser related methods*/
function NlsGetElementById2(id) {
  if (document.all) {
      return document.all(id);
  } else
  if (document.getElementById) {
      return document.getElementById(id);
  }
};

