 var BOX = { FLG: { VIS: 1, TOG: 2, TTL: 3, HDR: 12, HDR_VIS: 4, HDR_TOG: 8, BDY: 48, BDY_VIS: 16, BDY_TOG: 32, FTR: 192, FTR_VIS: 64, FTR_TOG: 128 }, ICO: { WID: 17, HEI: 17, HDR: 'ico_win_max.gif', BDY: 'ico_win_max.gif', FTR: 'ico_win_max.gif' }, obj: function(p_iid,p_obj){ if(p_obj) this.G[p_iid] = p_obj; return this.G[p_iid]; }, get: function(p_var){ return getVar(this,p_var); }, set: function(P){ setVar(this,P); }, G:{} }; function CBOX(H){ var D = null; if(H && H.iid){ D = BOX.obj(H.iid); if(!D){ this.IB = false; this.I = H.iid; this.NC = H.flg; this.OC = H.wid; this.JF = H.hei; this.LC = H.cls ? H.cls : 'box_com'; this.set('ico',H.ico); this.set('ttl',H.ttl); this.set('hdr',H.hdr); this.set('bdy',H.bdy); this.set('ftr',H.ftr); D = BOX.obj(this.I,this); } } return D; }; CBOX.prototype.draw = function(H){ if(!this.IB){ var BB = this.make(); if(BB){ SYS.out(BB,this.I); this.IB = true; } } }; CBOX.prototype.make = function(){ var D = dat_xml({ div: [{ id: this.W(), 'class': this.ID(), style: { width: this.OC } }, this.sH(), this.uK(), this.vK(), this.xK()] }); return D; }; CBOX.prototype.set = function(tK,P){ if(tK && tK.match(/^(ico|ttl|hdr|bdy|ftr)$/)){ P = P ? P : ''; if(this.IB){ var O = getElementById(this.W(tK)); if(O){ if(tK == 'ico'){ O.src = P; } else { O.innerHTML = P; } } } else { this['_' + tK] = P; } } }; CBOX.prototype.get = function(tK,Z){ var D = Z; if(tK && tK.match(/^(ico|ttl|hdr|bdy|ftr)$/)){ D = this['_' + tK]; } return D; }; CBOX.prototype.sH = function(){ var D = null; var fB = this.NC; if(fB & BOX.FLG.TTL){ var _C = []; var wF = []; var ZC = this.get('ico'); if(ZC){ _C.push({img: { id: this.W('ico'), src: fullDir(ENV.ico,ZC), border: 0,align: 'absbottom', witdh: BOX.ICO.WID, height: BOX.ICO.HEI }}); } _C.push({ span: [{ id: this.W('ttl'), 'class': this.ID('ttl') },this.get('ttl')] }); if(((fB & BOX.FLG.HDR) >> 2) & BOX.FLG.TOG){ wF.push({ span: [{ title:'Show/Hide the header', onclick: "BOX.obj('" + this.I + "').dD('hdr')" },{ img: { src:fullDir(ENV.ico,BOX.ICO.HDR),border:0,align:'absbottom', width: BOX.ICO.WID,height:BOX.ICO.HEI } }] }); } if(((fB & BOX.FLG.BDY) >> 4) & BOX.FLG.TOG){ wF.push({ span: [{ title:'Show/Hide the body', onclick: "BOX.obj('" + this.I + "').dD('bdy')" },{ img: { src:fullDir(ENV.ico,BOX.ICO.BDY),border:0,align:'absbottom', width: BOX.ICO.WID,height:BOX.ICO.HEI } }] }); } if(((fB & BOX.FLG.FTR) >> 6) & BOX.FLG.TOG){ wF.push({ span: [{ title:'Show/Hide the footer', onclick: "BOX.obj('" + this.I + "').dD('ftr')" },{ img: { src:fullDir(ENV.ico,BOX.ICO.FTR),border:0,align:'absbottom', width: BOX.ICO.WID,height:BOX.ICO.HEI } }] }); } var ZH = [{td: [{align:'left'},_C]}]; if(wF){ ZH.push({td: [{align:'right',nowrap:true},wF]}) } D = { div: [{ 'class': this.ID('bar'), style: { width: this.OC } },{ table: [{ width: '100%', border: 0, cellpadding:1, cellspacing:0 },{ tr: [null,ZH] }] }] } } return D; }; CBOX.prototype.uK = function(){ var D = null; var fB = (this.NC & BOX.FLG.HDR) >> 2; if(fB){ D = { div: [{ id: this.W('hdr'), 'class': this.ID('hdr'), style: { width: this.OC, display: fB & BOX.FLG.VIS ? 'block' : 'none' } }, this.get('hdr','')] }; } return D; }; CBOX.prototype.vK = function(){ var fB = (this.NC & BOX.FLG.BDY) >> 4; var D = { div: [{ id: this.W('bdy'), 'class': this.ID('bdy'), style: { display: fB & BOX.FLG.VIS ? 'block' : 'none', width: this.OC, height: this.JF, overflow: 'auto' } }, this.get('bdy','')] }; return D; }; CBOX.prototype.xK = function(){ var D = null; var fB = (this.NC & BOX.FLG.FTR) >> 6; if(fB){ D = { div: [{ id: this.W('ftr'), 'class': this.ID('ftr'), style: { width: this.OC, display: fB & BOX.FLG.VIS ? 'block' : 'none' } }, this.get('ftr','')] }; } return D; }; CBOX.prototype.dD = function(tK){ var O = getElementById(this.W(tK)); if(O){ O.style.display = O.style.display == 'block' ? 'none' : 'block'; } }; CBOX.prototype.W = function(){ var D = 'BOX_' + this.I; for(var X = 0; X < arguments.length; X++){ D += '_' + arguments[X]; } return D; }; CBOX.prototype.ID = function(){ var D = this.LC; for(var X = 0; X < arguments.length; X++){ D += '_' + arguments[X]; } return D; }; 