 SYS.reg('SYS.GUI.POS',{ obj: function(p_iid,p_obj){ if(p_obj) this.G[p_iid] = p_obj; return this.G[p_iid]; }, sts: function(p_btn,p_sts){ var h = p_btn.className; if(p_sts){ h += ' hover'; } else { h = h.replace(/\s*hover/g,''); } p_btn.className = h; }, G:{} }); function CPOS(H){ this.IB = false; this.I = 'POS' + (new Date()).getTime() + Math.floor(1000 * Math.random()); this.KD = H.hdl; this.tH = parseInt(H.off || 0,10); this.M = parseInt(H.num || 0,10); this.BL = parseInt(H.max || 5,10); this.uH = parseInt(H.rpp || 10,10); this.LC = H.cls || 'pos'; this._L = H.btn || {}; return SYS.GUI.POS.obj(this.I,this); }; CPOS.prototype.draw = function(UB){ SYS.out(this.make(),UB); }; CPOS.prototype.make = function(){ var D = null; if(this.M > this.uH){ var S = Math.ceil(this.M/this.uH); if(S > 1){ var DB = this._L; var $L = []; var nC = Math.floor(this.tH/this.uH); var DL = nC < this.BL ? 0 : nC - this.BL; var iH = nC + this.BL < S ? nC + this.BL : S; if(nC > 0){ $L.push({ span: [{ CLASS: 'button', onmouseover: 'SYS.GUI.POS.sts(this,true)', onmouseout: 'SYS.GUI.POS.sts(this,false)', onclick: 'SYS.GUI.POS.obj(\'' + this.I + '\').wH(0)' },DB.home || '|<'] }); $L.push({ span: [{ CLASS: 'button', onmouseover: 'SYS.GUI.POS.sts(this,true)', onmouseout: 'SYS.GUI.POS.sts(this,false)', onclick: 'SYS.GUI.POS.obj(\'' + this.I + '\').wH(' + ((nC - 1) * this.uH) + ')' },DB.prev || '<'] }); } for(; DL < iH; DL++){ if(DL != nC){ $L.push({ span: [{ CLASS: 'button', onmouseover: 'SYS.GUI.POS.sts(this,true)', onmouseout: 'SYS.GUI.POS.sts(this,false)', onclick: 'SYS.GUI.POS.obj(\'' + this.I + '\').wH(' + (DL * this.uH) + ')' },DL + 1] }); } else { $L.push({ span: [{CLASS: 'button current'}, DL + 1] }); } } if(nC < S - 1){ $L.push({ span: [{ CLASS: 'button', onmouseover: 'SYS.GUI.POS.sts(this,true)', onmouseout: 'SYS.GUI.POS.sts(this,false)', onclick: 'SYS.GUI.POS.obj(\'' + this.I + '\').wH(' + ((nC + 1) * this.uH) + ')' },DB.next || '>'] }); $L.push({ span: [{ CLASS: 'button', onmouseover: 'SYS.GUI.POS.sts(this,true)', onmouseout: 'SYS.GUI.POS.sts(this,false)', onclick: 'SYS.GUI.POS.obj(\'' + this.I + '\').wH(' + ((S - 1) * this.uH) + ')' },DB.last || '>|'] }); } D = SYS.CNV.dat2xml({ div: [{CLASS: this.LC},$L] }); } } return D; }; CPOS.prototype.wH = function(xH){ if(typeof(this.KD) == 'function'){ this.KD(xH); } }; 