var g={nl2br:function(a){a&&(a=a.toString(),a=a.replace(/\n/g,"<br>"));return a},niceJson:function(a){a=JSON.stringify(a,null,3);(a=g.nl2br(a))&&(a=a.replace(/\s/g,"&nbsp;"));return a},getParameterByName:function(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");a=RegExp("[\\?&]"+a+"=([^&#]*)").exec(location.search);return null==a?"":decodeURIComponent(a[1].replace(/\+/g," "))},formatShortDateTime:function(a,b){var c=new Date(b),d="",e=c.getFullYear();e===a.getFullYear()&&(e=void 0);d=c.getMonth()+
1;d=c.getDate()+"."+d+".";e&&(d+=e);return d+="   "+c.getHours()+":"+c.getMinutes()},getReadableFileSizeString:function(a){for(var b=0;900<a&&3>b;)a/=1024,b++;0<b&&(a=1>a?a.toFixed(2):10>a?a.toFixed(1):a.toFixed());return a+["B","KB","MB","GB"][b]},urlEncode:function(a){a=a.split("/");for(var b=a.length;0<=--b;)a[b]=encodeURIComponent(a[b]);return a=a.join("/")},getScrollBarWidth:function(){var a=document.createElement("p");a.style.width="100%";a.style.height="200px";var b=document.createElement("div");
b.style.position="absolute";b.style.top="0px";b.style.left="0px";b.style.visibility="hidden";b.style.width="200px";b.style.height="150px";b.style.overflow="hidden";b.appendChild(a);document.body.appendChild(b);var c=a.offsetWidth;b.style.overflow="scroll";a=a.offsetWidth;c==a&&(a=b.clientWidth);document.body.removeChild(b);return c-a},canUseStorage:"undefined"!==typeof Storage,canUseSSE:"undefined"!==typeof EventSource,getPref:function(a){if(this.canUseStorage)try{return localStorage.getItem(a)}catch(b){}},
getBooleanPref:function(a,b){var c=this.getPref(a);return c?"true"==c:!!b},getIntPref:function(a){(a=this.getPref(a))&&(a=parseInt(a));return a},setPref:function(a,b){if(this.canUseStorage)try{localStorage.setItem(a,b)}catch(c){}},setSessionPref:function(a,b){if(this.canUseStorage)try{sessionStorage[a]=b}catch(c){}},getSessionPref:function(a){if(this.canUseStorage)try{return sessionStorage[a]}catch(b){}},getExtension:function(a){a=a.split(".");return 1>=a.length?null:a.pop()},getParentPath:function(a){var b=
a.lastIndexOf("/");return-1==b?null:a.substring(0,b)},getMimeTypeBase:function(a){if(a){var b=a.indexOf("/");-1!=b&&(a=a.substring(0,b))}return a},getMimeSubType:function(a){a&&(a=a.substring(a.indexOf("/")+1));return a},isPathInPath:function(a,b){var c=a.length;if(0===c)return!1;var d=b.length;return c>d||0!==b.indexOf(a)?!1:c===d||"/"===b.charAt(c)||"/"===a},fileIsFolder:function(a,b){if(102400<a.size)b(!0);else{var c=new FileReader;c.onload=function(a){b(!0)};c.onerror=function(){b(!1)};try{c.readAsArrayBuffer(a)}catch(d){b(!1)}}},
getStackTrace:function(){try{throw Error("!!!!");}catch(a){if(a.stack){var b=a.stack,c=b.indexOf("!!!!");0<=c&&(b=b.substring(c+5));return b}b=[];for(c=arguments.callee;c=c.caller;){var d;if(void 0!==c.name)d=c.name||"anonymous";else{d=c.toString();var e=/^function ([^\s(]+).+/;d=e.test(d)?d.split("\n")[0].replace(e,"$1")||"anonymous":"anonymous"}b.push(d)}return b.join("\n")}},htmlEncode:function(a){return $("<div/>").text(a).html()}};
function SpeedCounter(){for(var a=[],b=0;16>b;b++)a[b]=0;var c=$.now(),d=0,e=0;this.tick=function(b){for(var f=($.now()-c)/1E3&2147483647,k=!1;e!=f;){k=!0;++e;e&=2147483647;var h=e%a.length;d<h&&(d=h);a[h]=0}a[f%a.length]+=b;return k};this.getBytesPerSec=function(){for(var b=0,c=d+1;0<=--c;)c!=e&&(b+=a[c]);return Math.floor(1*b/d)};this.isStable=function(){return 2*d>=a.length}};
