wfront = { tckbackstring: function(_strers) { var tbool = false; var tstrers = _strers; if (tstrers.substr(0, 11) == '') tbool = true; return tbool; }, tckrbackstring: function(_strers) { var tstrers = _strers; if (tstrers.substr(0, 11) == '') tstrers = tstrers.substr(11); return tstrers; }, tckinnerhtmldisplay: function(_strid1, _strid2) { var tstrid1 = _strid1; var tstrid2 = _strid2; var tobj1 = $i(tstrid1); var tobj2 = $i(tstrid2); if (tobj1 && tobj2) { if (tobj1.innerhtml != '') tobj2.style.display = ''; }; }, tloadajaxsubmit: function(_form, _obj) { var tobj = _obj; var tform = _form; var tformobj = $i(tform); if (tformobj) { var tformbeobj = $i(tform + 'beforeaction'); if (tformbeobj) eval(tformbeobj.value); if (wfront.validator.tcheck(tformobj)) { tobj.disabled = true; var taction = tformobj.action; var tstrform = cls.form.tgetvalues(tformobj); cls.tiposts(taction, tstrform, wfront.tloadajaxsubmits, tobj); }; }; }, tloadajaxsubmits: function(_strers, _obj) { var tobj = _obj; var tstrers = _strers; if (tobj) tobj.disabled = false; if (wfront.tckbackstring(tstrers)) alert(wfront.tckrbackstring(tstrers)); }, tloadbarpercent: function(_name, _value, _id) { var tid = _id; var tname = _name; var tvalue = _value; var ttotalnumber = 0; var tobjs = document.getelementsbyname(tname); if (tobjs) { for (ti = 0; ti < tobjs.length; ti ++) ttotalnumber = ttotalnumber + cls.tgetnum(tobjs[ti].value, 0); }; if (ttotalnumber != 0) { tvalue = cls.tgetnum(tvalue, 0); var tcurrentobj = $i(tname + '_' + tid); if (tcurrentobj) tcurrentobj.style.width = (tvalue / ttotalnumber * 100) + '%'; }; }, tloadimgsrcs: function(_obj, _width, _height) { var tobj = _obj; var twidth = _width; var theight = _height; var timage = new image(); timage.src = tobj.getattribute('srcs'); if (timage.width > 0) wfront.tloadimgsrcst(tobj, twidth, theight, timage.width, timage.height); else timage.onload = function() {wfront.tloadimgsrcst(tobj, twidth, theight, timage.width, timage.height);}; }, tloadimgsrcst: function(_obj, _width, _height, _nwidth, _nheight) { var tobj = _obj; var twidth = _width; var theight = _height; var tnwidth = _nwidth; var tnheight = _nheight; var tnewwidth = 0; var tnewheight = 0; if (tnwidth > twidth && tnheight > theight) { if ((tnwidth / twidth) > (tnheight / theight)) tnewwidth = twidth; else tnewheight = theight; } else { if (tnwidth > twidth && tnheight <= theight) tnewwidth = twidth; if (tnwidth <= twidth && tnheight > theight) tnewheight = theight; }; tobj.onload = function() {}; tobj.src = tobj.getattribute('srcs'); if (tnewwidth != 0) tobj.width = tnewwidth; if (tnewheight != 0) tobj.height = tnewheight; } }; wfront.img = { tinsertselects: function(_name, _value) { var tname = _name; var tvalue = _value; var tobj = $i(tname); if (tobj) { if (tobj.getattribute('inserted') != 'yes') { var tary = tvalue.split('|'); for (ti = 0; ti < tary.length; ti ++) { if (tary[ti]) cls.selects.tadd(tname, tary[ti], tary[ti]); }; tobj.setattribute('inserted', 'yes'); }; }; } }; wfront.loading = { tloader: function(_strers) { var tstrers = _strers; if (tstrers) { var thtml = '
' + tstrers + '
'; cls.mask.tshow(thtml); cls.mask.tsetstyle(); }; }, tclose: function() { cls.mask.tclose(); } }; wfront.validator = { trequire: /.+/, temail: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/, tnumber: /^\d+$/, tenglish: /^[a-za-z]+$/, tchinese: /^[\u0391-\uffe5]+$/, tcheck: function(_obj) { var tobj = _obj; var tbool = true; var tfocusobj = null; var trmessagestring = ''; if (tobj) { var tvobj, tvalue; var trtypestr, trequirestr, trmessage; var tinputobj = tobj.getelementsbytagname('input'); for(ti = 0; ti < tinputobj.length; ti++) { tvobj = tinputobj[ti]; tvalue = tvobj.value; trtypestr = tvobj.getattribute('rtype'); trequirestr = tvobj.getattribute('require'); trmessage = tvobj.getattribute('rmessage'); if (trtypestr) { if (trequirestr != '0' || (trequirestr == '0' && tvalue)) { if (!this['t' + trtypestr].test(tvalue)) { if (!tfocusobj) tfocusobj = tvobj; trmessagestring += trmessage + '\n'; tbool = false; }; }; }; }; }; if (tfocusobj) tfocusobj.focus(); if (trmessagestring) alert(trmessagestring); return tbool; } };