 var MNU = { FLG: { ABS: 1, BAR: 2, HID: 4, ICO: 8 }, ico: { wid: 17, hei: 16, spc: 'ico_spacer.gif' }, cls: ['mnu'], sep: '#666666 1px solid', opa: '90%', obj: function(A,mC){ if(mC) this.G[A] = mC; return this.G[A]; }, set: function(p_val){ setVar(this,p_val); }, G: {} }; function CMNU(H){ var D = null; if(H && H.iid){ D = MNU.obj(H.iid); if(!D){ this.I = H.iid; this.LC = H.cls ? H.cls : MNU.cls; this.MC = H.opa ? H.opa : MNU.opa; this.TD = H.sep ? H.sep : MNU.sep; this.NC = H.flg ? H.flg : 0; this.PC = ''; this.QC = null; D = MNU.obj(this.I,this); } } return D; }; CMNU.prototype.draw = function(H){ if(H && typeof(H) == 'object'){ var BB = this.make(H); SYS.out(BB,H.iid); if(!(this.NC & MNU.FLG.HID)){ if(SYS.sts()){ this.show(); } else { SYS.reg(new Function('MNU.obj(\'' + this.I + '\').show();')); } } } }; CMNU.prototype.make = function(H){ var D = ''; if(H && typeof(H) == 'object'){ this.SC = H.lng; D = this.XC(0,'',H.dat,this.NC,H.wid); delete this.SC; } return D; }; CMNU.prototype.move = function(TC,UC){ var VC = getElementById('m_' + this.I); if(VC){ if(TC != null){ VC.style.left = TC; } if(UC != null){ VC.style.top = UC; } } }; CMNU.prototype.show = function(A){ A = A ? A : this.I; var VC = getElementById('m_' + A); if(VC){ VC.style.display = "block"; var FB = getElementById('d_' + A); var IC = getElementById('f_' + A); var XH = getElementById('t_' + A); if(!VC.style.width){ VC.style.width = XH.offsetWidth; } if(!VC.style.height){ VC.style.height = XH.offsetHeight; } IC.style.left = FB.style.left = XH.style.left = 0; IC.style.top = FB.style.top = XH.style.top = 0; } }; CMNU.prototype.hide = function(){ var pB = this.PC.split('_'); var WC = pB[0]; for(var X=1;X < pB.length; X++){ WC += '_' + pB[X]; var F = getElementById('i_' + WC); F.className = this.ID(X - 1, 'normal'); var oC = getElementById('s_' + WC); if(oC) oC.className = this.ID(X - 1, 'spacer'); var VC = getElementById('m_' + WC); if(VC) VC.style.display = "none"; else break; } this.PC = ''; }; CMNU.prototype.XC = function(HE,A,RB,MB,u){ if(!RB) return ''; var D = ''; var FB = ''; var IE = false; A = A ? A : ''; MB = MB != null ? MB : MNU.FLG.ABS | MNU.FLG.HID; for(var X = 0; X < RB.length; X++){ var F = RB[X]; var YC = (A ? A + '_' : '') + X; if(F.flg == 0){ IE = true; } else { if(F.flg == 1){ F = this.jC(HE,F,MB); } else { FB += this.XC(HE + 1,YC,F.sub); F = this.cC(HE,YC,F,MB,IE); } D += F; IE = false; } } if(D){ if(MB & MNU.FLG.BAR){ D = dat_xml({tr:[null,D]}); } var YC = this.I + (A ? '_' + A : ''); D = dat_xml({ div: [{ id: 'm_' + YC, style: { position: (MB & MNU.FLG.ABS) ? 'absolute' : 'relative', display: 'none', width : u, 'z-index': 1000 } },{ iframe: [{ id: 'f_' + YC, style:{ position:'absolute', left:0,top:0, 'z-index': 0, width: '100%', height: '100%', filter:'alpha(opacity=0)', display:'block', frameborder:0 } },''] },{ div: [{ id: 'd_' + YC, 'class': this.ID(HE, 'panel'), onselectstart: 'return false;', style:{ position: 'absolute', left:0,top: 0, width: '100%', height: '100%', 'z-index': 1, filter: 'alpha(opacity=' + this.MC + ')', display: 'block' } },{ table: [{ id: 't_' + YC, border: 0, cellpadding: 2, cellspacing: 0, width: u ? u : '100%', style: { position: 'static', left:0,top: 0 } },D] }] }] }); } return D + FB; }; CMNU.prototype.cC = function(HE, A,JD,MB,aD){ var D = ''; var bD = this.I; var aC = null; if(JD.lnk){ var bC = JD.dst ? '\'' + str2str(JD.dst) + '\'' : 'null'; aC = 'MNU.obj(\'' + bD + '\').HD({flg:' + JD.flg + ',dat:\'' + str2str(JD.lnk) + '\',dst:' + bC + '})'; } if(MB & MNU.FLG.BAR){ D = dat_xml({ td: [{ id:'i_' + bD + '_' + A, 'class': this.ID(HE, 'normal'), onmouseover:'MNU.obj(\'' + bD + '\').lC(this,' + MB + ')', onmouseout:'MNU.obj(\'' + bD + '\').FD()', onclick: aC, valign:'top', align:JD.alg, nowrap: true, style:{'border-left':aD ? this.TD : null} },this.AF(JD.ico),this.sH(JD.ttl)] }); } else { var MD = []; var ZC = this.AF(JD.ico ? JD.ico : MNU.ico.spc); if(ZC){ MD.push({ td: [{ id:'s_' + bD + '_' + A, 'class':this.ID(HE, 'spacer'), align:'center', valign:'top' }, ZC] }); } MD.push({ td: [{ align:JD.alg, nowrap:true, valign:'top', style:{'border-top':aD ? this.TD : null} },this.sH(JD.ttl)] },{ td: [{ align:'right', valign:'top' }, JD.sub ? '>' :'&nbsp;'] }); D = dat_xml({ tr: [{ id:'i_' + bD + '_' + A, 'class': this.ID(HE, 'normal'), onmouseover:'MNU.obj(\'' + bD + '\').lC(this,' + MB + ')', onmouseout:'MNU.obj(\'' + bD + '\').FD()', onclick:aC },MD] }); } return D; }; CMNU.prototype.jC = function(HE, JD,MB){ var D = ''; var YC = this.I; if(MB & MNU.FLG.BAR){ D = dat_xml({ td: [{ 'class': this.ID(HE,'group'), onmouseover:'MNU.obj(\'' + YC + '\').GD()', onmouseout:'MNU.obj(\'' + YC + '\').FD()', align: JD.alg, nowrap: true }, this.AF(JD.ico),this.sH(JD.ttl)] }); } else { var MD = []; var ZC = this.AF(JD.ico ? JD.ico : MNU.ico.spc); if(ZC){ MD.push({ td: [{ valign:'top' }, ZC] }); } MD.push({ td: [{ align:JD.alg, valign:'top', colspan: 2, nowrap:true },this.sH(JD.ttl)] }); D = dat_xml({ tr: [{ 'class': this.ID(HE,'group'), onmouseover: 'MNU.obj(\'' + YC + '\').GD()', onmouseout: 'MNU.obj(\'' + YC + '\').FD()' },MD] }); } return D; }; CMNU.prototype.lC = function(mC,MB){ this.GD(); var YC = mC.id.substr(2); var qC = YC.split('_'); mC.className = this.ID(qC.length - 2, 'hilite'); var oC = getElementById('s_' + YC); if(oC) oC.className = ''; var nC = this.PC; if(nC){ var pC = nC.split('_'); var X = 1; var WC = qC[0]; for(;X<pC.length;X++){ if(pC[X] != qC[X]) break; WC += '_' + pC[X]; } for(;X < pC.length; X++){ WC += '_' + pC[X]; var F = getElementById('i_' + WC); F.className = this.ID(X - 1, 'normal'); var oC = getElementById('s_' + WC); if(oC) oC.className = this.ID(X - 1, 'spacer'); var VC = getElementById('m_' + WC); if(VC) VC.style.display = "none"; else break; } } this.PC = YC; var VC = getElementById('m_' + YC); if(VC && VC.style.display == 'none'){ this.show(YC); var rC = YC.lastIndexOf('_'); var VB = getElementById('m_' + YC.substr(0,rC)); var sC = VB.offsetParent; var tC,uC; var vC = sC.scrollLeft; var wC = sC.scrollTop; var xC = sC.clientWidth; var yC = sC.clientHeight; var zC = VB.offsetTop; var AD = VB.offsetLeft; var BD = VB.offsetWidth; var CD = VB.offsetHeight; var DD = VC.offsetWidth; var ED = VC.offsetHeight; if(MB & MNU.FLG.BAR){ tC = mC.offsetLeft + AD; uC = zC + CD; if(tC + DD > vC + xC){ tC = vC + xC - DD; } if(uC + ED > wC + yC){ if((yC - CD)/2 < zC - wC) uC = zC - ED; else uC = wC + yC - ED; } } else { tC = AD + BD; uC = mC.offsetTop + zC; if(tC + DD > vC + xC){ if((xC - BD)/2 < AD - vC) tC = AD - DD; else tC = vC + xC - DD; } if(uC + ED > wC + yC){ uC = wC + yC - ED; } } VC.style.left = tC < vC ? vC : tC; VC.style.top = uC < wC ? wC : uC; } }; CMNU.prototype.FD = function(){ this.GD(); if(this.PC){ this.QC = setTimeout('MNU.obj(\''+ this.I + '\').hide()',1000); } }; CMNU.prototype.GD = function(){ clearTimeout(this.QC); this.QC = null; }; CMNU.prototype.HD = function(H){ if(H){ this.hide(); SYS.run(H); } }; CMNU.prototype.AF = function(eC){ var D = null; if((this.NC & MNU.FLG.ICO) && eC){ D = dat_xml({ img: { src:fullDir(ENV.ico,eC), align:'absbottom', width:MNU.ico.wid, height:MNU.ico.hei } }); } return D; }; CMNU.prototype.sH = function(fC){ if(this.SC){ fC = this.SC[fC]; } return '&nbsp;' + fC + '&nbsp;'; }; CMNU.prototype.W = function(){ var D = 'MNU_' + this.I; for(var X = 0; X < arguments.length; X++){ D += '_' + arguments[X]; } return D; }; CMNU.prototype.ID = function(HE){ if(HE >= this.LC.length){ HE = this.LC.length - 1; } var D = this.LC[HE]; for(var X = 1; X < arguments.length; X++){ D += '_' + arguments[X]; } return D; }; 