cls = { tagt: function() { return navigator.useragent.tolowercase(); }, tisie: function() { return (cls.tagt().indexof('msie')!= -1 && document.all); }, txmlhttp: function() { var txmlobj = null; if(window.xmlhttprequest) { txmlobj = new xmlhttprequest(); } else { if(window.activexobject) { txmlobj = new activexobject('microsoft.xmlhttp'); }; }; return txmlobj; }, tigets: function (_strers, _callback, _arg1) { var tstrers = _strers; var tcallback = _callback; var targ1 = _arg1; var txmlhttp = new cls.txmlhttp(); txmlhttp.onreadystatechange = function() { if (txmlhttp.readystate == 4) { var tresponsetext = '$error$'; if (txmlhttp.status == 200 || txmlhttp.status == 304) { tresponsetext = txmlhttp.responsetext; }; if (!targ1) tcallback(tresponsetext); else tcallback(tresponsetext, targ1); }; }; txmlhttp.open('get', tstrers, true); txmlhttp.send(null); }, tiposts: function (_strers, _strform, _callback, _arg1) { var tstrers = _strers; var tstrform = _strform; var tcallback = _callback; var targ1 = _arg1; var txmlhttp = new cls.txmlhttp(); txmlhttp.onreadystatechange = function() { if (txmlhttp.readystate == 4) { var tresponsetext = '$error$'; if (txmlhttp.status == 200 || txmlhttp.status == 304) { tresponsetext = txmlhttp.responsetext; }; if (!targ1) tcallback(tresponsetext); else tcallback(tresponsetext, targ1); }; }; txmlhttp.open('post', tstrers, true); txmlhttp.setrequestheader('content-length', tstrers.length); txmlhttp.setrequestheader('content-type', 'application/x-www-form-urlencoded'); txmlhttp.send(tstrform); }, treparameter: function(_para, _strers, _value) { var tpara = _para; var tstrers = _strers; var tvalue = _value; var tmpstr = ''; if (!tpara) tmpstr = '?' + tstrers + '=' + tvalue; else { var tmypara = '&' + tpara.substr(1); if (tmypara.indexof('&' + tstrers + '=') == -1) tmpstr = tpara + '&' + tstrers + '=' + tvalue; else { var tary1 = tmypara.split('&' + tstrers + '='); var tmpvalue = tary1[1]; if (tmpvalue.indexof('&') != -1) { var tary2 = tmpvalue.split('&'); tmpvalue = tary2[0]; }; tmpstr = tmypara.replace('&' + tstrers + '=' + tmpvalue, '&' + tstrers + '=' + tvalue); tmpstr = '?' + tmpstr.substr(1); }; }; return tmpstr; }, tgetmbcstring: function(_strers, _length) { var tstrers = _strers; var tlength = _length; var tstring = ''; var tstrings = '0123456789abcdefghijklmnopqrstuvwxyz~!@#$%^&*()'; var tmpstring = ''; var tmblength = 0; if (tstrers) { for (ti = 0; ti < tstrers.length; ti ++) { tmblength += 1; tstring = tstrers.substr(ti, 1).tolowercase(); if (tstrings.indexof(tstring) == -1) tmblength += 1; if (tmblength <= tlength) tmpstring += tstring; }; }; if (tmblength > tlength) tmpstring += '..'; return tmpstring; }, tgetnum: function(_strers, _default) { var tstrers = _strers; var tdefault = _default; var tnum = tdefault; try { var tnum1 = 0; if (tstrers.indexof('.') == -1) tnum1 = parseint(tstrers); else tnum1 = parsefloat(tstrers); if (!isnan(tnum1)) tnum = tnum1; } catch(e){}; return tnum; }, tgetparameter: function(_strers, _strkey) { var tmpvalue = ''; var tstrers = _strers; var tstrkey = _strkey; if (tstrers && tstrkey) { var tiname, tivalue, ticount; var tinum = tstrers.indexof('?'); tstrers = tstrers.substr(tinum + 1); var tarrtmp = tstrers.split('&'); for(ticount = 0; ticount < tarrtmp.length; ticount ++) { tinum = tarrtmp[ticount].indexof('='); if(tinum > 0) { tiname = tarrtmp[ticount].substring(0, tinum); tivalue = tarrtmp[ticount].substr(tinum + 1); if (tiname == tstrkey) tmpvalue = tivalue; }; }; }; return tmpvalue; }, tgetcheckboxsvalue: function(_strname) { var tname = _strname; var tmpvalue = ''; var tobjs = document.getelementsbyname(tname); if (tobjs) { for (ti = 0; ti < tobjs.length; ti ++) { if (tobjs[ti].checked) tmpvalue += ',' + tobjs[ti].value; }; }; if (tmpvalue != '') tmpvalue = tmpvalue.substr(1); return tmpvalue; }, thtmlencode: function(_strers) { var tstrers = _strers; tstrers = tstrers.replace(/(\&)/g, '&'); tstrers = tstrers.replace(/(\>)/g, '>'); tstrers = tstrers.replace(/(\<)/g, '<'); tstrers = tstrers.replace(/(\")/g, '"'); return tstrers; }, thtmldecode: function(_strers) { var tstrers = _strers; tstrers = tstrers.replace(/(\&)/g, '&'); tstrers = tstrers.replace(/(\>)/g, '>'); tstrers = tstrers.replace(/(\<)/g, '<'); tstrers = tstrers.replace(/(\")/g, '"'); return tstrers; }, tquotencode: function(_strers) { var tstrers = _strers; tstrers = tstrers.replace(/(\")/g, '"'); return tstrers; }, tseloptions: function(_obj, _strvalue) { var tobj = _obj; var tvalue = _strvalue; for(ti = 0; ti < tobj.options.length; ti ++) { if(tobj.options[ti].value == tvalue) { tobj.options.selectedindex = ti; break; }; }; }, tselcheckboxs: function(_obj, _strname) { var tobj = _obj; var tname = _strname; var tobjs = document.getelementsbyname(tname); if (tobj && tobjs) { for (ti = 0; ti < tobjs.length; ti ++) tobjs[ti].checked = tobj.checked; }; }, tswitchdisplay: function(_obj) { var tobj = _obj; if (tobj) tobj.style.display = tobj.style.display == 'none'? '': 'none'; }, tauthor: 'jetiben', temail: 'jetiben@hotmail.com', tsysinfo: 'jtbc', twebsite: 'http://www.jetiben.com/', tversion: '2.0' }; cls.base64 = { tbase64encodechars: 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/', tbase64decodechars: new array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1), tencode: function(_strers) { var tstrers = _strers; var tc1, tc2, tc3; var tmpstr = ''; var ti = 0; var tlen = tstrers.length; while (ti < tlen) { tc1 = tstrers.charcodeat(ti ++) & 0xff; if (ti == tlen) { tmpstr += cls.base64.tbase64encodechars.charat(tc1 >> 2); tmpstr += cls.base64.tbase64encodechars.charat((tc1 & 0x3) << 4); tmpstr += '=='; break; }; tc2 = tstrers.charcodeat(ti ++); if(ti == tlen) { tmpstr += cls.base64.tbase64encodechars.charat(tc1 >> 2); tmpstr += cls.base64.tbase64encodechars.charat(((tc1 & 0x3)<< 4) | ((tc2 & 0xf0) >> 4)); tmpstr += cls.base64.tbase64encodechars.charat((tc2 & 0xf) << 2); tmpstr += '='; break; }; tc3 = tstrers.charcodeat(ti ++); tmpstr += cls.base64.tbase64encodechars.charat(tc1 >> 2); tmpstr += cls.base64.tbase64encodechars.charat(((tc1 & 0x3)<< 4) | ((tc2 & 0xf0) >> 4)); tmpstr += cls.base64.tbase64encodechars.charat(((tc2 & 0xf) << 2) | ((tc3 & 0xc0) >>6)); tmpstr += cls.base64.tbase64encodechars.charat(tc3 & 0x3f); }; return tmpstr; }, tdecode: function(_strers) { var tstrers = _strers; var tc1, tc2, tc3, tc4; var tmpstr = ''; var ti = 0; var tlen = tstrers.length; while (ti < tlen) { do { tc1 = cls.base64.tbase64decodechars[tstrers.charcodeat(ti ++) & 0xff]; } while (ti < tlen && tc1 == -1); if (tc1 == -1) break; do { tc2 = cls.base64.tbase64decodechars[tstrers.charcodeat(ti ++) & 0xff]; } while (ti < tlen && tc2 == -1); if (tc2 == -1) break; tmpstr += string.fromcharcode((tc1 << 2) | ((tc2 & 0x30) >> 4)); do { tc3 = tstrers.charcodeat(ti ++) & 0xff; if(tc3 == 61) return tmpstr; tc3 = cls.base64.tbase64decodechars[tc3]; } while(ti < tlen && tc3 == -1); if(tc3 == -1) break; tmpstr += string.fromcharcode(((tc2 & 0xf) << 4) | ((tc3 & 0x3c) >> 2)); do { tc4 = tstrers.charcodeat(ti ++) & 0xff; if(tc4 == 61) return tmpstr; tc4 = cls.base64.tbase64decodechars[tc4]; } while(ti < tlen && tc4 == -1); tmpstr += string.fromcharcode(((tc3 & 0x03) << 6) | tc4); }; return tmpstr; } }; cls.doc = { tscrolltop: function() { return document.documentelement.scrolltop; }, tscrollleft: function() { return document.documentelement.scrollleft; }, tscrollwidth: function() { return document.documentelement.scrollwidth; }, tscrollheight: function() { return document.documentelement.scrollheight; }, tclientwidth: function() { return document.documentelement.clientwidth; }, tclientheight: function() { return document.documentelement.clientheight; } }; cls.drag = { tmx: 0, tmy: 0, tdobj: null, tdrag: function(_obj, _event) { var tobj = _obj; var tevent = _event; if (cls.drag.tdobj == tobj) { var tx = cls.mouse.tx(tevent); var ty = cls.mouse.ty(tevent); if (cls.drag.tmx == 0) cls.drag.tmx = tx; if (cls.drag.tmy == 0) cls.drag.tmy = ty; var tpobj = tobj.parentnode; tpobj.style.left = tpobj.offsetleft + (tx - cls.drag.tmx) + 'px'; tpobj.style.top = tpobj.offsettop + (ty - cls.drag.tmy) + 'px'; cls.drag.tmx = tx; cls.drag.tmy = ty; }; }, tstart: function(_obj) { var tobj = _obj; cls.drag.tdobj = tobj; }, tstop: function(_obj) { var tobj = _obj; if (cls.drag.tdobj == tobj) { cls.drag.tmx = 0; cls.drag.tmy = 0; cls.drag.tdobj = null; document.onmousemove = null; }; }, tmouseout: function(_obj) { var tobj = _obj; if (cls.drag.tdobj == tobj) { document.onmousemove = function(_event) { tevent = _event; cls.drag.tdrag(tobj, tevent); }; }; } }; cls.form = { tgetvalues: function(_obj) { var tobj = _obj; var tmpvalues = ''; if (tobj) { var tinputobj = tobj.getelementsbytagname('input'); for(ti = 0; ti < tinputobj.length; ti ++) { if (tinputobj[ti].type == 'text' || tinputobj[ti].type == 'password' || tinputobj[ti].type == 'hidden') tmpvalues += tinputobj[ti].name + '=' + iescape(tinputobj[ti].value) + '&'; if (tinputobj[ti].type == 'checkbox' || tinputobj[ti].type == 'radio') { if (tinputobj[ti].checked) tmpvalues += tinputobj[ti].name + '=' + iescape(tinputobj[ti].value) + '&'; }; }; var tselectobj = tobj.getelementsbytagname('select'); for(ti = 0; ti < tselectobj.length; ti ++) { if (tselectobj[ti].getattribute('vtype') != 'all') tmpvalues += tselectobj[ti].name + '=' + iescape(tselectobj[ti].value) + '&'; else { var tselvalue = ''; for (tis = 0; tis < tselectobj[ti].options.length; tis ++) { if (tselvalue == '') tselvalue = tselectobj[ti].options[tis].value; else tselvalue += '|' + tselectobj[ti].options[tis].value; }; tmpvalues += tselectobj[ti].name + '=' + iescape(tselvalue) + '&'; }; }; var ttextareaobj = tobj.getelementsbytagname('textarea'); for(ti = 0; ti < ttextareaobj.length; ti ++) { tmpvalues += ttextareaobj[ti].name + '=' + iescape(ttextareaobj[ti].value) + '&'; }; }; if (tmpvalues) tmpvalues = tmpvalues.substr(0, tmpvalues.length - 1); return tmpvalues; } }; cls.img = { tresize: function(_obj, _width, _height) { var tobj = _obj; var twidth = _width; var theight = _height; var timage = new image(); timage.src = tobj.src; if (timage.width > twidth && timage.height > theight) { if ((timage.width / twidth) > (timage.height / theight)) tobj.width = twidth; else tobj.height = theight; } else { if (timage.width > twidth && timage.height <= theight) tobj.width = twidth; if (timage.width <= twidth && timage.height > theight) tobj.height = theight; }; } }; cls.mouse = { tx: function(_e) { var te = _e; var txnum = 0; if (window.event) txnum = cls.doc.tscrollleft() + event.clientx; else txnum = te.pagex; return txnum; }, ty: function(_e) { var te = _e; var tynum = 0; if (window.event) tynum = cls.doc.tscrolltop() + event.clienty; else tynum = te.pagey; return tynum; } }; cls.mask = { twidth: 0, theight: 0, tclientwidth: null, tclientheight: null, tsetdivstyle: function() { var tobj1 = $i('jmask'); var tobj2 = $i('jmaskdiv'); if (tobj1 && tobj2) { tobj2.style.margintop = (cls.doc.tscrolltop() - math.floor(cls.mask.theight / 2)) + 'px'; if (cls.mask.tclientwidth != cls.doc.tclientwidth()) { cls.mask.tclientwidth = cls.doc.tclientwidth(); tobj1.style.width = cls.doc.tclientwidth() + 'px'; if (cls.doc.tscrollwidth() > cls.doc.tclientwidth()) tobj1.style.width = cls.doc.tscrollwidth() + 'px'; }; if (cls.mask.tclientheight != cls.doc.tclientheight()) { cls.mask.tclientheight = cls.doc.tclientheight(); tobj1.style.height = cls.doc.tclientheight() + 'px'; if (cls.doc.tscrollheight() > cls.doc.tclientheight()) tobj1.style.height = cls.doc.tscrollheight() + 'px'; }; settimeout('cls.mask.tsetdivstyle()', 60); }; }, tcreatediv: function() { var tdiv = document.createelement('div'); tdiv.setattribute('id', 'jmask'); tdiv.style.position = 'absolute'; tdiv.style.top = '0'; tdiv.style.left = '0'; tdiv.style.background = '#000000'; tdiv.style.filter = 'alpha(opacity=30)'; tdiv.style.opacity = '0.3'; tdiv.style.width = cls.doc.tscrollwidth() + 'px'; tdiv.style.height = cls.doc.tscrollheight() + 'px'; tdiv.style.zindex = '999999998'; document.body.appendchild(tdiv); tdiv = document.createelement('div'); tdiv.setattribute('id', 'jmaskdiv'); tdiv.style.position = 'absolute'; tdiv.style.top = '50%'; tdiv.style.left = '50%'; tdiv.style.zindex = '999999999'; document.body.appendchild(tdiv); cls.mask.tclientwidth = cls.doc.tclientwidth(); cls.mask.tclientheight = cls.doc.tclientheight(); settimeout('cls.mask.tsetdivstyle()', 60); }, tshow: function(_strhtml) { var tstrhtml = _strhtml; if (tstrhtml) { var tobj = $i('jmaskdiv'); if (!tobj) { cls.mask.tcreatediv(); tobj = $i('jmaskdiv'); }; if (tobj) { tobj.style.display = 'none'; setinnerhtml(tobj, tstrhtml); }; }; }, tsetstyle: function() { var tobj = $i('jmaskdiv'); if (tobj) { tobj.style.display = 'block'; cls.mask.twidth = tobj.offsetwidth; cls.mask.theight = tobj.offsetheight; tobj.style.marginleft = (0 - math.floor(cls.mask.twidth / 2)) + 'px'; tobj.style.margintop = (cls.doc.tscrolltop() - math.floor(cls.mask.theight / 2)) + 'px'; }; }, tclose: function() { var tobj1 = $i('jmask'); var tobj2 = $i('jmaskdiv'); if (tobj1 && tobj2) { document.body.removechild(tobj1); document.body.removechild(tobj2); }; } }; cls.pagi = { tpnum: 10, tpagi: function(_num1, _num2, _baselink, _tid) { var tnum1 = _num1; var tnum2 = _num2; var tbaselink = _baselink; var tid = _tid; var tmpstr = ''; var tvlnum = 0; if (tid == 'ct-cutepage') tvlnum = 1; if (tnum2 > tvlnum) { if (tnum1 < 1) tnum1 = 1; if (tnum1 > tnum2) tnum1 = tnum2; tmpstr += '' + tnum1 + '/' + tnum2 + ''; tmpstr += '«'; tnum1c = tnum1 - math.floor(cls.pagi.tpnum / 2); if (tnum1c < 1) tnum1c = 1; var tnum1s = tnum1c + cls.pagi.tpnum - 1; if (tnum1s > tnum2) tnum1s = tnum2; if (tnum1c <= tnum1s) { if ((tnum1s - tnum1c) < (cls.pagi.tpnum - 1)) { tnum1c = tnum1c - ((cls.pagi.tpnum - 1) - (tnum1s - tnum1c)); if (tnum1c < 1) tnum1c = 1; }; for (ti = tnum1c; ti <= tnum1s; ti ++) { if (ti != tnum1) tmpstr += '' + ti + ''; else tmpstr += '' + ti + ''; }; }; tmpstr += '»'; tmpstr += 'go'; }; var tobj = $i(tid); if (tobj) tobj.innerhtml = tmpstr; }, tredirect: function(_baselink, _page) { var tpage = _page; var tbaselink = _baselink; tbaselink = cls.thtmldecode(tbaselink); tbaselink = tbaselink.replace(/(\[\~page\])/g, tpage); location.href = tbaselink; } }; cls.style = { tover: function(_obj) { var tobj = _obj; if (tobj) { if (tobj.classname == 'selected') tobj.classname = tobj.getattribute('oclass'); tobj.setattribute('oclass', tobj.classname); tobj.classname = 'selected'; }; }, tout: function(_obj) { var tobj = _obj; if (tobj) tobj.classname = tobj.getattribute('oclass'); } }; cls.selects = { tadd: function(_strid, _strero, _strers) { var tstrid = _strid; var tstrero = _strero; var tstrers = _strers; var tobj = $i(tstrid); if (tobj) { var ti, tstr, tisext; for (ti = 0; ti < tobj.options.length; ti ++) { if (tobj.options[ti].text == tstrero && tobj.options[ti].value == tstrers) tisext = true; }; if (!tisext) tobj.options.add(new option(tstrero, tstrers)); }; }, tremove: function(_strid) { var tstrid = _strid; var tobj = $i(tstrid); if (tobj) { var tidx = tobj.selectedindex; if (tidx != -1) tobj.options[tidx] = null; }; }, tdisplace: function(_obj, _strindex, _strkey) { var tobj = _obj; var tstrindex = _strindex; var tstrkey = _strkey; if (tstrindex >= 0) { if (tobj) { var tstrvalue, tstrtext; tstrtext = tobj.options[tstrindex].text; tstrvalue = tobj.options[tstrindex].value; if (tstrkey == 38) { if (!(tstrindex == 0)) { tobj.options[tstrindex].text = tobj.options[tstrindex - 1].text; tobj.options[tstrindex].value = tobj.options[tstrindex - 1].value; tobj.options[tstrindex - 1].text = tstrtext; tobj.options[tstrindex - 1].value = tstrvalue; }; }; if (tstrkey == 40) { if (!(tstrindex == (tobj.options.length - 1))) { tobj.options[tstrindex].text = tobj.options[tstrindex + 1].text; tobj.options[tstrindex].value = tobj.options[tstrindex + 1].value; tobj.options[tstrindex + 1].text = tstrtext; tobj.options[tstrindex + 1].value = tstrvalue; }; }; }; }; } };