summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/examples/assets/js/dependencies.js728
-rw-r--r--docs/examples/assets/js/jsrrdgraph.js4937
-rw-r--r--docs/examples/index.html2
3 files changed, 398 insertions, 5269 deletions
diff --git a/docs/examples/assets/js/dependencies.js b/docs/examples/assets/js/dependencies.js
index 893ef2e..b7c7d64 100644
--- a/docs/examples/assets/js/dependencies.js
+++ b/docs/examples/assets/js/dependencies.js
@@ -1,9 +1,6 @@
-// Compiled with closure-compiler on 2011-08-07 18:29:31.168108
+// Compiled with closure-compiler on 2011-08-14 20:50:27.421965
// @code_url http://code.jquery.com/jquery-1.6.2.js
-// @code_url http://flot.googlecode.com/svn/trunk/excanvas.js
-// @code_url http://flot.googlecode.com/svn/trunk/jquery.flot.js
-// @code_url http://flot.googlecode.com/svn/trunk/jquery.flot.stack.js
-// @code_url http://flot.googlecode.com/svn/trunk/jquery.flot.selection.js
+// @code_url https://raw.github.com/wallrj/jsrrdgraph/master/rrd.js
// @code_url http://javascriptrrd.cvs.sourceforge.net/viewvc/javascriptrrd/v0/src/lib/rrdFile.js
// @code_url https://raw.github.com/jquerytools/jquerytools/dev/src/dateinput/dateinput.js
// @code_url https://raw.github.com/jquerytools/jquerytools/dev/src/tabs/tabs.js
@@ -12,315 +9,386 @@
// @output_format text
// @output_info compiled_code
// Input 0
-(function(d,h){function F(a,c,g){if(g===h&&a.nodeType===1)if(g="data-"+c.replace(oa,"$1-$2").toLowerCase(),g=a.getAttribute(g),typeof g==="string"){try{g=g==="true"?!0:g==="false"?!1:g==="null"?null:!b.isNaN(g)?parseFloat(g):D.test(g)?b.parseJSON(g):g}catch(k){}b.data(a,c,g)}else g=h;return g}function p(a){for(var c in a)if(c!=="toJSON")return!1;return!0}function C(a,c,g){var k=c+"defer",s=c+"queue",H=c+"mark",f=b.data(a,k,h,!0);f&&(g==="queue"||!b.data(a,s,h,!0))&&(g==="mark"||!b.data(a,H,h,!0))&&
-setTimeout(function(){!b.data(a,s,h,!0)&&!b.data(a,H,h,!0)&&(b.removeData(a,k,!0),f.resolve())},0)}function B(){return!1}function q(){return!0}function z(a,c,g){var k=b.extend({},g[0]);k.type=a;k.originalEvent={};k.liveFired=h;b.event.handle.call(c,k);k.isDefaultPrevented()&&g[0].preventDefault()}function N(a){var c,g,k,s,H,f,e,j,l,d,v,t=[];s=[];H=b._data(this,"events");if(!(a.liveFired===this||!H||!H.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(v=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+
-"(\\.|$)"));a.liveFired=this;var n=H.live.slice(0);for(e=0;e<n.length;e++)H=n[e],H.origType.replace(Ba,"")===a.type?s.push(H.selector):n.splice(e--,1);s=b(a.target).closest(s,a.currentTarget);j=0;for(l=s.length;j<l;j++){d=s[j];for(e=0;e<n.length;e++)if(H=n[e],d.selector===H.selector&&(!v||v.test(H.namespace))&&!d.elem.disabled){f=d.elem;k=null;if(H.preType==="mouseenter"||H.preType==="mouseleave")a.type=H.preType,(k=b(a.relatedTarget).closest(H.selector)[0])&&b.contains(f,k)&&(k=f);(!k||k!==f)&&t.push({elem:f,
-handleObj:H,level:d.level})}}j=0;for(l=t.length;j<l;j++){s=t[j];if(g&&s.level>g)break;a.currentTarget=s.elem;a.data=s.handleObj.data;a.handleObj=s.handleObj;v=s.handleObj.origHandler.apply(s.elem,arguments);if(v===!1||a.isPropagationStopped())if(g=s.level,v===!1&&(c=!1),a.isImmediatePropagationStopped())break}return c}}function K(a,c){return(a&&a!=="*"?a+".":"")+c.replace(pa,"`").replace(u,"&")}function I(a,c,g){c=c||0;if(b.isFunction(c))return b.grep(a,function(a,b){return!!c.call(a,b,a)===g});else if(c.nodeType)return b.grep(a,
-function(a){return a===c===g});else if(typeof c==="string"){var k=b.grep(a,function(a){return a.nodeType===1});if(Ea.test(c))return b.filter(c,k,!g);else c=b.filter(c,k)}return b.grep(a,function(a){return b.inArray(a,c)>=0===g})}function G(a,c){if(c.nodeType===1&&b.hasData(a)){var g=b.expando,k=b.data(a),s=b.data(c,k);if(k=k[g]){var H=k.events,s=s[g]=b.extend({},k);if(H){delete s.handle;s.events={};for(var f in H){g=0;for(k=H[f].length;g<k;g++)b.event.add(c,f+(H[f][g].namespace?".":"")+H[f][g].namespace,
-H[f][g],H[f][g].data)}}}}}function r(a,c){var g;if(c.nodeType===1){c.clearAttributes&&c.clearAttributes();c.mergeAttributes&&c.mergeAttributes(a);g=c.nodeName.toLowerCase();if(g==="object")c.outerHTML=a.outerHTML;else if(g==="input"&&(a.type==="checkbox"||a.type==="radio")){if(a.checked)c.defaultChecked=c.checked=a.checked;if(c.value!==a.value)c.value=a.value}else if(g==="option")c.selected=a.defaultSelected;else if(g==="input"||g==="textarea")c.defaultValue=a.defaultValue;c.removeAttribute(b.expando)}}
-function o(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function A(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function V(a){b.nodeName(a,"input")?A(a):"getElementsByTagName"in a&&b.grep(a.getElementsByTagName("input"),A)}function Q(a,c){c.src?b.ajax({url:c.src,async:!1,dataType:"script"}):b.globalEval((c.text||c.textContent||c.innerHTML||"").replace(hb,"/*$0*/"));c.parentNode&&c.parentNode.removeChild(c)}
-function R(a,c,g){var k=c==="width"?a.offsetWidth:a.offsetHeight,s=c==="width"?ib:jb;if(k>0)return g!=="border"&&b.each(s,function(){g||(k-=parseFloat(b.css(a,"padding"+this))||0);g==="margin"?k+=parseFloat(b.css(a,g+this))||0:k-=parseFloat(b.css(a,"border"+this+"Width"))||0}),k+"px";k=Ja(a,c,c);if(k<0||k==null)k=a.style[c]||0;k=parseFloat(k)||0;g&&b.each(s,function(){k+=parseFloat(b.css(a,"padding"+this))||0;g!=="padding"&&(k+=parseFloat(b.css(a,"border"+this+"Width"))||0);g==="margin"&&(k+=parseFloat(b.css(a,
-g+this))||0)});return k+"px"}function S(a){return function(c,g){var Z;typeof c!=="string"&&(g=c,c="*");if(b.isFunction(g))for(var k=c.toLowerCase().split(Ya),s=0,H=k.length,f,e;s<H;s++)f=k[s],(e=/^\+/.test(f))&&(f=f.substr(1)||"*"),Z=a[f]=a[f]||[],f=Z,f[e?"unshift":"push"](g)}}function x(a,c,b,k,s,H){s=s||c.dataTypes[0];H=H||{};H[s]=!0;for(var s=a[s],f=0,e=s?s.length:0,j=a===Ua,l;f<e&&(j||!l);f++)l=s[f](c,b,k),typeof l==="string"&&(!j||H[l]?l=h:(c.dataTypes.unshift(l),l=x(a,c,b,k,l,H)));if((j||!l)&&
-!H["*"])l=x(a,c,b,k,"*",H);return l}function X(a,c,g,k){if(b.isArray(c))b.each(c,function(c,s){g||kb.test(a)?k(a,s):X(a+"["+(typeof s==="object"||b.isArray(s)?c:"")+"]",s,g,k)});else if(!g&&c!=null&&typeof c==="object")for(var s in c)X(a+"["+s+"]",c[s],g,k);else k(a,c)}function L(){try{return new d.XMLHttpRequest}catch(a){}}function fa(){setTimeout(O,0);return Ra=b.now()}function O(){Ra=h}function ga(a,c){var g={};b.each(Za.concat.apply([],Za.slice(0,c)),function(){g[this]=a});return g}function qa(a){if(!Va[a]){var c=
-y.body,g=b("<"+a+">").appendTo(c),k=g.css("display");g.remove();if(k==="none"||k===""){if(!Ca)Ca=y.createElement("iframe"),Ca.frameBorder=Ca.width=Ca.height=0;c.appendChild(Ca);if(!Ka||!Ca.createElement)Ka=(Ca.contentWindow||Ca.contentDocument).document,Ka.write((y.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),Ka.close();g=Ka.createElement(a);Ka.body.appendChild(g);k=b.css(g,"display");c.removeChild(Ca)}Va[a]=k}return Va[a]}function va(a){return b.isWindow(a)?a:a.nodeType===9?a.defaultView||
-a.parentWindow:!1}var y=d.document,T=d.navigator,Y=d.location,b=function(){function a(){if(!c.isReady){try{y.documentElement.doScroll("left")}catch(b){setTimeout(a,1);return}c.ready()}}var c=function(a,b){return new c.fn.init(a,b,s)},b=d.jQuery,k=d.$,s,f=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,e=/\S/,j=/^\s+/,l=/\s+$/,v=/\d/,t=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,M=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,P=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,W=/(?:^|:|,)(?:\s*\[)+/g,
-w=/(webkit)[ \/]([\w.]+)/,ma=/(opera)(?:.*version)?[ \/]([\w.]+)/,J=/(msie) ([\w.]+)/,ha=/(mozilla)(?:.*? rv:([\w.]+))?/,Z=/-([a-z])/ig,lb=function(a,c){return c.toUpperCase()},Qa=T.userAgent,Sa,La,mb=Object.prototype.toString,Aa=Object.prototype.hasOwnProperty,u=Array.prototype.push,o=Array.prototype.slice,za=String.prototype.trim,r=Array.prototype.indexOf,q={};c.fn=c.prototype={constructor:c,init:function(a,b,g){var k;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;
-if(a==="body"&&!b&&y.body)return this.context=y,this[0]=y.body,this.selector=a,this.length=1,this;if(typeof a==="string")if((k=a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?[null,a,null]:f.exec(a))&&(k[1]||!b))if(k[1])return g=(b=b instanceof c?b[0]:b)?b.ownerDocument||b:y,(a=t.exec(a))?c.isPlainObject(b)?(a=[y.createElement(a[1])],c.fn.attr.call(a,b,!0)):a=[g.createElement(a[1])]:(a=c.buildFragment([k[1]],[g]),a=(a.cacheable?c.clone(a.fragment):a.fragment).childNodes),c.merge(this,a);
-else{if((b=y.getElementById(k[2]))&&b.parentNode){if(b.id!==k[2])return g.find(a);this.length=1;this[0]=b}this.context=y;this.selector=a;return this}else return!b||b.jquery?(b||g).find(a):this.constructor(b).find(a);else if(c.isFunction(a))return g.ready(a);if(a.selector!==h)this.selector=a.selector,this.context=a.context;return c.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return o.call(this,0)},get:function(a){return a==null?this.toArray():
-a<0?this[this.length+a]:this[a]},pushStack:function(a,b,g){var k=this.constructor();c.isArray(a)?u.apply(k,a):c.merge(k,a);k.prevObject=this;k.context=this.context;if(b==="find")k.selector=this.selector+(this.selector?" ":"")+g;else if(b)k.selector=this.selector+"."+b+"("+g+")";return k},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();Sa.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},
-slice:function(){return this.pushStack(o.apply(this,arguments),"slice",o.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(c,b){return a.call(c,b,c)}))},end:function(){return this.prevObject||this.constructor(null)},push:u,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a,b,g,k,s,f=arguments[0]||{},H=1,Z=arguments.length,e=!1;typeof f==="boolean"&&(e=f,f=arguments[1]||{},H=2);typeof f!=="object"&&!c.isFunction(f)&&(f=
-{});Z===H&&(f=this,--H);for(;H<Z;H++)if((a=arguments[H])!=null)for(b in a)g=f[b],k=a[b],f!==k&&(e&&k&&(c.isPlainObject(k)||(s=c.isArray(k)))?(s?(s=!1,g=g&&c.isArray(g)?g:[]):g=g&&c.isPlainObject(g)?g:{},f[b]=c.extend(e,g,k)):k!==h&&(f[b]=k));return f};c.extend({noConflict:function(a){if(d.$===c)d.$=k;if(a&&d.jQuery===c)d.jQuery=b;return c},isReady:!1,readyWait:1,holdReady:function(a){a?c.readyWait++:c.ready(!0)},ready:function(a){if(a===!0&&!--c.readyWait||a!==!0&&!c.isReady){if(!y.body)return setTimeout(c.ready,
-1);c.isReady=!0;a!==!0&&--c.readyWait>0||(Sa.resolveWith(y,[c]),c.fn.trigger&&c(y).trigger("ready").unbind("ready"))}},bindReady:function(){if(!Sa){Sa=c._Deferred();if(y.readyState==="complete")return setTimeout(c.ready,1);if(y.addEventListener)y.addEventListener("DOMContentLoaded",La,!1),d.addEventListener("load",c.ready,!1);else if(y.attachEvent){y.attachEvent("onreadystatechange",La);d.attachEvent("onload",c.ready);var b=!1;try{b=d.frameElement==null}catch(g){}y.documentElement.doScroll&&b&&a()}}},
-isFunction:function(a){return c.type(a)==="function"},isArray:Array.isArray||function(a){return c.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!v.test(a)||isNaN(a)},type:function(a){return a==null?String(a):q[mb.call(a)]||"object"},isPlainObject:function(a){if(!a||c.type(a)!=="object"||a.nodeType||c.isWindow(a))return!1;if(a.constructor&&!Aa.call(a,"constructor")&&!Aa.call(a.constructor.prototype,"isPrototypeOf"))return!1;
-for(var b in a);return b===h||Aa.call(a,b)},isEmptyObject:function(a){for(var c in a)return!1;return!0},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(d.JSON&&d.JSON.parse)return d.JSON.parse(a);if(n.test(a.replace(M,"@").replace(P,"]").replace(W,"")))return(new Function("return "+a))();c.error("Invalid JSON: "+a)},parseXML:function(a,b,g){d.DOMParser?(g=new DOMParser,b=g.parseFromString(a,"text/xml")):(b=new ActiveXObject("Microsoft.XMLDOM"),
-b.async="false",b.loadXML(a));g=b.documentElement;(!g||!g.nodeName||g.nodeName==="parsererror")&&c.error("Invalid XML: "+a);return b},noop:function(){},globalEval:function(a){a&&e.test(a)&&(d.execScript||function(a){d.eval.call(d,a)})(a)},camelCase:function(a){return a.replace(Z,lb)},nodeName:function(a,c){return a.nodeName&&a.nodeName.toUpperCase()===c.toUpperCase()},each:function(a,b,g){var k,s=0,f=a.length,H=f===h||c.isFunction(a);if(g)if(H)for(k in a){if(b.apply(a[k],g)===!1)break}else for(;s<
-f;){if(b.apply(a[s++],g)===!1)break}else if(H)for(k in a){if(b.call(a[k],k,a[k])===!1)break}else for(;s<f;)if(b.call(a[s],s,a[s++])===!1)break;return a},trim:za?function(a){return a==null?"":za.call(a)}:function(a){return a==null?"":a.toString().replace(j,"").replace(l,"")},makeArray:function(a,b){var g=b||[];if(a!=null){var k=c.type(a);a.length==null||k==="string"||k==="function"||k==="regexp"||c.isWindow(a)?u.call(g,a):c.merge(g,a)}return g},inArray:function(a,c){if(r)return r.call(c,a);for(var b=
-0,g=c.length;b<g;b++)if(c[b]===a)return b;return-1},merge:function(a,c){var b=a.length,g=0;if(typeof c.length==="number")for(var k=c.length;g<k;g++)a[b++]=c[g];else for(;c[g]!==h;)a[b++]=c[g++];a.length=b;return a},grep:function(a,c,b){for(var g=[],k,b=!!b,s=0,f=a.length;s<f;s++)k=!!c(a[s],s),b!==k&&g.push(a[s]);return g},map:function(a,b,g){var k,s,f=[],H=0,Z=a.length;if(a instanceof c||Z!==h&&typeof Z==="number"&&(Z>0&&a[0]&&a[Z-1]||Z===0||c.isArray(a)))for(;H<Z;H++)k=b(a[H],H,g),k!=null&&(f[f.length]=
-k);else for(s in a)k=b(a[s],s,g),k!=null&&(f[f.length]=k);return f.concat.apply([],f)},guid:1,proxy:function(a,b){if(typeof b==="string")var g=a[b],b=a,a=g;if(!c.isFunction(a))return h;var k=o.call(arguments,2),g=function(){return a.apply(b,k.concat(o.call(arguments)))};g.guid=a.guid=a.guid||g.guid||c.guid++;return g},access:function(a,b,g,k,s,f){var H=a.length;if(typeof b==="object"){for(var Z in b)c.access(a,Z,b[Z],k,s,g);return a}if(g!==h){k=!f&&k&&c.isFunction(g);for(Z=0;Z<H;Z++)s(a[Z],b,k?g.call(a[Z],
-Z,s(a[Z],b)):g,f);return a}return H?s(a[0],b):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();a=w.exec(a)||ma.exec(a)||J.exec(a)||a.indexOf("compatible")<0&&ha.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},sub:function(){function a(c,b){return new a.fn.init(c,b)}c.extend(!0,a,this);a.superclass=this;a.fn=a.prototype=this();a.fn.constructor=a;a.sub=this.sub;a.fn.init=function(g,k){k&&k instanceof c&&!(k instanceof a)&&(k=a(k));return c.fn.init.call(this,
-g,k,b)};a.fn.init.prototype=a.fn;var b=a(y);return a},browser:{}});c.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,c){q["[object "+c+"]"]=c.toLowerCase()});Qa=c.uaMatch(Qa);if(Qa.browser)c.browser[Qa.browser]=!0,c.browser.version=Qa.version;if(c.browser.webkit)c.browser.safari=!0;e.test("\u00a0")&&(j=/^[\s\xA0]+/,l=/[\s\xA0]+$/);s=c(y);y.addEventListener?La=function(){y.removeEventListener("DOMContentLoaded",La,!1);c.ready()}:y.attachEvent&&(La=function(){y.readyState===
-"complete"&&(y.detachEvent("onreadystatechange",La),c.ready())});return c}(),$="done fail isResolved isRejected promise then always pipe".split(" "),aa=[].slice;b.extend({_Deferred:function(){var a=[],c,g,k,s={done:function(){if(!k){var g=arguments,f,e,j,l,d;c&&(d=c,c=0);f=0;for(e=g.length;f<e;f++)j=g[f],l=b.type(j),l==="array"?s.done.apply(s,j):l==="function"&&a.push(j);d&&s.resolveWith(d[0],d[1])}return this},resolveWith:function(b,s){if(!k&&!c&&!g){s=s||[];g=1;try{for(;a[0];)a.shift().apply(b,
-s)}finally{c=[b,s],g=0}}return this},resolve:function(){s.resolveWith(this,arguments);return this},isResolved:function(){return!(!g&&!c)},cancel:function(){k=1;a=[];return this}};return s},Deferred:function(a){var c=b._Deferred(),g=b._Deferred(),k;b.extend(c,{then:function(a,b){c.done(a).fail(b);return this},always:function(){return c.done.apply(c,arguments).fail.apply(this,arguments)},fail:g.done,rejectWith:g.resolveWith,reject:g.resolve,isRejected:g.isResolved,pipe:function(a,g){return b.Deferred(function(k){b.each({done:[a,
-"resolve"],fail:[g,"reject"]},function(a,g){var s=g[0],f=g[1],H;if(b.isFunction(s))c[a](function(){if((H=s.apply(this,arguments))&&b.isFunction(H.promise))H.promise().then(k.resolve,k.reject);else k[f](H)});else c[a](k[f])})}).promise()},promise:function(a){if(a==null){if(k)return k;k=a={}}for(var b=$.length;b--;)a[$[b]]=c[$[b]];return a}});c.done(g.cancel).fail(c.cancel);delete c.cancel;a&&a.call(c,c);return c},when:function(a){function c(a){return function(c){g[a]=arguments.length>1?aa.call(arguments,
-0):c;--f||e.resolveWith(e,aa.call(g,0))}}var g=arguments,k=0,s=g.length,f=s,e=s<=1&&a&&b.isFunction(a.promise)?a:b.Deferred();if(s>1){for(;k<s;k++)g[k]&&b.isFunction(g[k].promise)?g[k].promise().then(c(k),e.reject):--f;f||e.resolveWith(e,g)}else e!==a&&e.resolveWith(e,s?[a]:[]);return e.promise()}});b.support=function(){var a=y.createElement("div"),c=y.documentElement,g,k,s,f,e,j;a.setAttribute("className","t");a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
-g=a.getElementsByTagName("*");k=a.getElementsByTagName("a")[0];if(!g||!g.length||!k)return{};s=y.createElement("select");f=s.appendChild(y.createElement("option"));g=a.getElementsByTagName("input")[0];e={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(k.getAttribute("style")),hrefNormalized:k.getAttribute("href")==="/a",opacity:/^0.55$/.test(k.style.opacity),cssFloat:!!k.style.cssFloat,
-checkOn:g.value==="on",optSelected:f.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0};g.checked=!0;e.noCloneChecked=g.cloneNode(!0).checked;s.disabled=!0;e.optDisabled=!f.disabled;try{delete a.test}catch(l){e.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){e.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick"));
-g=y.createElement("input");g.value="t";g.setAttribute("type","radio");e.radioValue=g.value==="t";g.setAttribute("checked","checked");a.appendChild(g);k=y.createDocumentFragment();k.appendChild(a.firstChild);e.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked;a.innerHTML="";a.style.width=a.style.paddingLeft="1px";s=y.getElementsByTagName("body")[0];k=y.createElement(s?"div":"body");f={visibility:"hidden",width:0,height:0,border:0,margin:0};s&&b.extend(f,{position:"absolute",left:-1E3,top:-1E3});
-for(j in f)k.style[j]=f[j];k.appendChild(a);c=s||c;c.insertBefore(k,c.firstChild);e.appendChecked=g.checked;e.boxModel=a.offsetWidth===2;if("zoom"in a.style)a.style.display="inline",a.style.zoom=1,e.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",e.shrinkWrapBlocks=a.offsetWidth!==2;a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";s=a.getElementsByTagName("td");g=s[0].offsetHeight===0;s[0].style.display=
-"";s[1].style.display="none";e.reliableHiddenOffsets=g&&s[0].offsetHeight===0;a.innerHTML="";if(y.defaultView&&y.defaultView.getComputedStyle)g=y.createElement("div"),g.style.width="0",g.style.marginRight="0",a.appendChild(g),e.reliableMarginRight=(parseInt((y.defaultView.getComputedStyle(g,null)||{marginRight:0}).marginRight,10)||0)===0;k.innerHTML="";c.removeChild(k);if(a.attachEvent)for(j in{submit:1,change:1,focusin:1})c="on"+j,g=c in a,g||(a.setAttribute(c,"return;"),g=typeof a[c]==="function"),
-e[j+"Bubbles"]=g;k=k=s=f=s=g=a=g=null;return e}();b.boxModel=b.support.boxModel;var D=/^(?:\{.*\}|\[.*\])$/,oa=/([a-z])([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?b.cache[a[b.expando]]:a[b.expando];return!!a&&!p(a)},data:function(a,c,g,k){if(b.acceptData(a)){var s=b.expando,f=typeof c==="string",e=a.nodeType,j=e?b.cache:a,l=e?a[b.expando]:
-a[b.expando]&&b.expando;if(l&&(!k||!l||j[l][s])||!(f&&g===h)){if(!l)e?a[b.expando]=l=++b.uuid:l=b.expando;if(!j[l]&&(j[l]={},!e))j[l].toJSON=b.noop;if(typeof c==="object"||typeof c==="function")k?j[l][s]=b.extend(j[l][s],c):j[l]=b.extend(j[l],c);a=j[l];k&&(a[s]||(a[s]={}),a=a[s]);g!==h&&(a[b.camelCase(c)]=g);if(c==="events"&&!a[c])return a[s]&&a[s].events;return f?a[b.camelCase(c)]||a[c]:a}}},removeData:function(a,c,g){if(b.acceptData(a)){var k=b.expando,s=a.nodeType,f=s?b.cache:a,e=s?a[b.expando]:
-b.expando;if(f[e]){if(c){var j=g?f[e][k]:f[e];if(j&&(delete j[c],!p(j)))return}if(g&&(delete f[e][k],!p(f[e])))return;c=f[e][k];b.support.deleteExpando||f!=d?delete f[e]:f[e]=null;if(c){f[e]={};if(!s)f[e].toJSON=b.noop;f[e][k]=c}else s&&(b.support.deleteExpando?delete a[b.expando]:a.removeAttribute?a.removeAttribute(b.expando):a[b.expando]=null)}}},_data:function(a,c,g){return b.data(a,c,g,!0)},acceptData:function(a){if(a.nodeName){var c=b.noData[a.nodeName.toLowerCase()];if(c)return!(c===!0||a.getAttribute("classid")!==
-c)}return!0}});b.fn.extend({data:function(a,c){var g=null;if(typeof a==="undefined"){if(this.length&&(g=b.data(this[0]),this[0].nodeType===1))for(var k=this[0].attributes,s,f=0,e=k.length;f<e;f++)s=k[f].name,s.indexOf("data-")===0&&(s=b.camelCase(s.substring(5)),F(this[0],s,g[s]));return g}else if(typeof a==="object")return this.each(function(){b.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";return c===h?(g=this.triggerHandler("getData"+j[1]+"!",[j[0]]),g===h&&this.length&&(g=b.data(this[0],
-a),g=F(this[0],a,g)),g===h&&j[1]?this.data(j[0]):g):this.each(function(){var g=b(this),k=[j[0],c];g.triggerHandler("setData"+j[1]+"!",k);b.data(this,a,c);g.triggerHandler("changeData"+j[1]+"!",k)})},removeData:function(a){return this.each(function(){b.removeData(this,a)})}});b.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",b.data(a,c,(b.data(a,c,h,!0)||0)+1,!0))},_unmark:function(a,c,g){a!==!0&&(g=c,c=a,a=!1);if(c){var g=g||"fx",k=g+"mark";(a=a?0:(b.data(c,k,h,!0)||1)-1)?b.data(c,k,a,!0):(b.removeData(c,
-k,!0),C(c,g,"mark"))}},queue:function(a,c,g){if(a){var c=(c||"fx")+"queue",k=b.data(a,c,h,!0);g&&(!k||b.isArray(g)?k=b.data(a,c,b.makeArray(g),!0):k.push(g));return k||[]}},dequeue:function(a,c){var c=c||"fx",g=b.queue(a,c),k=g.shift();k==="inprogress"&&(k=g.shift());k&&(c==="fx"&&g.unshift("inprogress"),k.call(a,function(){b.dequeue(a,c)}));g.length||(b.removeData(a,c+"queue",!0),C(a,c,"queue"))}});b.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===h)return b.queue(this[0],
-a);return this.each(function(){var g=b.queue(this,a,c);a==="fx"&&g[0]!=="inprogress"&&b.dequeue(this,a)})},dequeue:function(a){return this.each(function(){b.dequeue(this,a)})},delay:function(a,c){a=b.fx?b.fx.speeds[a]||a:a;c=c||"fx";return this.queue(c,function(){var g=this;setTimeout(function(){b.dequeue(g,c)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a){function c(){--f||g.resolveWith(k,[k])}typeof a!=="string"&&(a=h);var a=a||"fx",g=b.Deferred(),k=this,s=k.length,
-f=1,e=a+"defer",j=a+"queue";a+="mark";for(var l;s--;)if(l=b.data(k[s],e,h,!0)||(b.data(k[s],j,h,!0)||b.data(k[s],a,h,!0))&&b.data(k[s],e,b._Deferred(),!0))f++,l.done(c);c();return g.promise()}});var ja=/[\n\t\r]/g,ba=/\s+/,ra=/\r/g,wa=/^(?:button|input)$/i,Ma=/^(?:button|input|object|select|textarea)$/i,e=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,w=/\:|^on/,J,n;b.fn.extend({attr:function(a,c){return b.access(this,
-a,c,!0,b.attr)},removeAttr:function(a){return this.each(function(){b.removeAttr(this,a)})},prop:function(a,c){return b.access(this,a,c,!0,b.prop)},removeProp:function(a){a=b.propFix[a]||a;return this.each(function(){try{this[a]=h,delete this[a]}catch(c){}})},addClass:function(a){var c,g,k,s,f,e,j;if(b.isFunction(a))return this.each(function(c){b(this).addClass(a.call(this,c,this.className))});if(a&&typeof a==="string"){c=a.split(ba);g=0;for(k=this.length;g<k;g++)if(s=this[g],s.nodeType===1)if(!s.className&&
-c.length===1)s.className=a;else{f=" "+s.className+" ";e=0;for(j=c.length;e<j;e++)~f.indexOf(" "+c[e]+" ")||(f+=c[e]+" ");s.className=b.trim(f)}}return this},removeClass:function(a){var c,g,k,s,f,e,j;if(b.isFunction(a))return this.each(function(c){b(this).removeClass(a.call(this,c,this.className))});if(a&&typeof a==="string"||a===h){c=(a||"").split(ba);g=0;for(k=this.length;g<k;g++)if(s=this[g],s.nodeType===1&&s.className)if(a){f=(" "+s.className+" ").replace(ja," ");e=0;for(j=c.length;e<j;e++)f=f.replace(" "+
-c[e]+" "," ");s.className=b.trim(f)}else s.className=""}return this},toggleClass:function(a,c){var g=typeof a,k=typeof c==="boolean";if(b.isFunction(a))return this.each(function(g){b(this).toggleClass(a.call(this,g,this.className,c),c)});return this.each(function(){if(g==="string")for(var s,f=0,e=b(this),j=c,l=a.split(ba);s=l[f++];)j=k?j:!e.hasClass(s),e[j?"addClass":"removeClass"](s);else if(g==="undefined"||g==="boolean")this.className&&b._data(this,"__className__",this.className),this.className=
-this.className||a===!1?"":b._data(this,"__className__")||""})},hasClass:function(a){for(var a=" "+a+" ",c=0,b=this.length;c<b;c++)if((" "+this[c].className+" ").replace(ja," ").indexOf(a)>-1)return!0;return!1},val:function(a){var c,g,k=this[0];if(!arguments.length){if(k){if((c=b.valHooks[k.nodeName.toLowerCase()]||b.valHooks[k.type])&&"get"in c&&(g=c.get(k,"value"))!==h)return g;g=k.value;return typeof g==="string"?g.replace(ra,""):g==null?"":g}return h}var s=b.isFunction(a);return this.each(function(g){var k=
-b(this);if(this.nodeType===1&&(g=s?a.call(this,g,k.val()):a,g==null?g="":typeof g==="number"?g+="":b.isArray(g)&&(g=b.map(g,function(a){return a==null?"":a+""})),c=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type],!c||!("set"in c)||c.set(this,g,"value")===h))this.value=g})}});b.extend({valHooks:{option:{get:function(a){var c=a.attributes.value;return!c||c.specified?a.value:a.text}},select:{get:function(a){var c,g=a.selectedIndex,k=[],s=a.options,a=a.type==="select-one";if(g<0)return null;
-for(var f=a?g:0,e=a?g+1:s.length;f<e;f++)if(c=s[f],c.selected&&(b.support.optDisabled?!c.disabled:c.getAttribute("disabled")===null)&&(!c.parentNode.disabled||!b.nodeName(c.parentNode,"optgroup"))){c=b(c).val();if(a)return c;k.push(c)}if(a&&!k.length&&s.length)return b(s[g]).val();return k},set:function(a,c){var g=b.makeArray(c);b(a).find("option").each(function(){this.selected=b.inArray(b(this).val(),g)>=0});if(!g.length)a.selectedIndex=-1;return g}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,
-width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,g,k){var s=a.nodeType;if(!a||s===3||s===8||s===2)return h;if(k&&c in b.attrFn)return b(a)[c](g);if(!("getAttribute"in a))return b.prop(a,c,g);var f,e;if(k=s!==1||!b.isXMLDoc(a))if(c=b.attrFix[c]||c,e=b.attrHooks[c],!e)if(t.test(c))e=n;else if(J&&c!=="className"&&(b.nodeName(a,"form")||w.test(c)))e=J;return g!==h?g===null?(b.removeAttr(a,c),h):e&&"set"in e&&k&&(f=e.set(a,g,c))!==h?f:(a.setAttribute(c,""+g),g):e&&"get"in e&&
-k&&(f=e.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?h:f)},removeAttr:function(a,c){var g;if(a.nodeType===1&&(c=b.attrFix[c]||c,b.support.getSetAttribute?a.removeAttribute(c):(b.attr(a,c,""),a.removeAttributeNode(a.getAttributeNode(c))),t.test(c)&&(g=b.propFix[c]||c)in a))a[g]=!1},attrHooks:{type:{set:function(a,c){if(wa.test(a.nodeName)&&a.parentNode)b.error("type property can't be changed");else if(!b.support.radioValue&&c==="radio"&&b.nodeName(a,"input")){var g=a.value;a.setAttribute("type",
-c);if(g)a.value=g;return c}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):Ma.test(a.nodeName)||e.test(a.nodeName)&&a.href?0:h}},value:{get:function(a,c){if(J&&b.nodeName(a,"button"))return J.get(a,c);return c in a?a.value:null},set:function(a,c,g){if(J&&b.nodeName(a,"button"))return J.set(a,c,g);a.value=c}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",
-cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,g){var k=a.nodeType;if(!a||k===3||k===8||k===2)return h;var f,e;if(k!==1||!b.isXMLDoc(a))c=b.propFix[c]||c,e=b.propHooks[c];return g!==h?e&&"set"in e&&(f=e.set(a,g,c))!==h?f:a[c]=g:e&&"get"in e&&(f=e.get(a,c))!==h?f:a[c]},propHooks:{}});n={get:function(a,c){return b.prop(a,c)?c.toLowerCase():h},set:function(a,c,g){c===!1?b.removeAttr(a,g):(c=
-b.propFix[g]||g,c in a&&(a[c]=!0),a.setAttribute(g,g.toLowerCase()));return g}};if(!b.support.getSetAttribute)b.attrFix=b.propFix,J=b.attrHooks.name=b.attrHooks.title=b.valHooks.button={get:function(a,c){var b;return(b=a.getAttributeNode(c))&&b.nodeValue!==""?b.nodeValue:h},set:function(a,c,b){if(a=a.getAttributeNode(b))return a.nodeValue=c}},b.each(["width","height"],function(a,c){b.attrHooks[c]=b.extend(b.attrHooks[c],{set:function(a,b){if(b==="")return a.setAttribute(c,"auto"),b}})});b.support.hrefNormalized||
-b.each(["href","src","width","height"],function(a,c){b.attrHooks[c]=b.extend(b.attrHooks[c],{get:function(a){a=a.getAttribute(c,2);return a===null?h:a}})});if(!b.support.style)b.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||h},set:function(a,c){return a.style.cssText=""+c}};if(!b.support.optSelected)b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(){}});b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(a){return a.getAttribute("value")===
-null?"on":a.value}}});b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(a,c){if(b.isArray(c))return a.checked=b.inArray(b(a).val(),c)>=0}})});var Ba=/\.(.*)$/,ca=/^(?:textarea|input|select)$/i,pa=/\./g,u=/ /g,da=/[^\w\s.|`]/g,ia=function(a){return a.replace(da,"\\$&")};b.event={add:function(a,c,g,k){if(!(a.nodeType===3||a.nodeType===8)){if(g===!1)g=B;else if(!g)return;var f,e;if(g.handler)f=g,g=f.handler;if(!g.guid)g.guid=b.guid++;if(e=b._data(a)){var j=
-e.events,l=e.handle;if(!j)e.events=j={};if(!l)e.handle=l=function(a){return typeof b!=="undefined"&&(!a||b.event.triggered!==a.type)?b.event.handle.apply(l.elem,arguments):h};l.elem=a;for(var c=c.split(" "),d,v=0,t;d=c[v++];){e=f?b.extend({},f):{handler:g,data:k};d.indexOf(".")>-1?(t=d.split("."),d=t.shift(),e.namespace=t.slice(0).sort().join(".")):(t=[],e.namespace="");e.type=d;if(!e.guid)e.guid=g.guid;var n=j[d],M=b.event.special[d]||{};if(!n&&(n=j[d]=[],!M.setup||M.setup.call(a,k,t,l)===!1))a.addEventListener?
-a.addEventListener(d,l,!1):a.attachEvent&&a.attachEvent("on"+d,l);if(M.add&&(M.add.call(a,e),!e.handler.guid))e.handler.guid=g.guid;n.push(e);b.event.global[d]=!0}a=null}}},global:{},remove:function(a,c,g,k){if(!(a.nodeType===3||a.nodeType===8)){g===!1&&(g=B);var f,e,j=0,l,d,t,v,n,M,P=b.hasData(a)&&b._data(a),W=P&&P.events;if(P&&W){if(c&&c.type)g=c.handler,c=c.type;if(!c||typeof c==="string"&&c.charAt(0)===".")for(f in c=c||"",W)b.event.remove(a,f+c);else{for(c=c.split(" ");f=c[j++];)if(v=f,l=f.indexOf(".")<
-0,d=[],l||(d=f.split("."),f=d.shift(),t=RegExp("(^|\\.)"+b.map(d.slice(0).sort(),ia).join("\\.(?:.*\\.)?")+"(\\.|$)")),n=W[f])if(g){v=b.event.special[f]||{};for(e=k||0;e<n.length;e++)if(M=n[e],g.guid===M.guid){if(l||t.test(M.namespace))k==null&&n.splice(e--,1),v.remove&&v.remove.call(a,M);if(k!=null)break}if(n.length===0||k!=null&&n.length===1)(!v.teardown||v.teardown.call(a,d)===!1)&&b.removeEvent(a,f,P.handle),delete W[f]}else for(e=0;e<n.length;e++)if(M=n[e],l||t.test(M.namespace))b.event.remove(a,
-v,M.handler,e),n.splice(e--,1);if(b.isEmptyObject(W)){if(c=P.handle)c.elem=null;delete P.events;delete P.handle;b.isEmptyObject(P)&&b.removeData(a,h,!0)}}}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(a,c,g,k){var f=a.type||a,e=[],j;f.indexOf("!")>=0&&(f=f.slice(0,-1),j=!0);f.indexOf(".")>=0&&(e=f.split("."),f=e.shift(),e.sort());if(g&&!b.event.customEvent[f]||b.event.global[f]){a=typeof a==="object"?a[b.expando]?a:new b.Event(f,a):new b.Event(f);a.type=f;a.exclusive=j;a.namespace=
-e.join(".");a.namespace_re=RegExp("(^|\\.)"+e.join("\\.(?:.*\\.)?")+"(\\.|$)");if(k||!g)a.preventDefault(),a.stopPropagation();if(g){if(!(g.nodeType===3||g.nodeType===8)){a.result=h;a.target=g;c=c!=null?b.makeArray(c):[];c.unshift(a);e=g;k=f.indexOf(":")<0?"on"+f:"";do{j=b._data(e,"handle");a.currentTarget=e;j&&j.apply(e,c);if(k&&b.acceptData(e)&&e[k]&&e[k].apply(e,c)===!1)a.result=!1,a.preventDefault();e=e.parentNode||e.ownerDocument||e===a.target.ownerDocument&&d}while(e&&!a.isPropagationStopped());
-if(!a.isDefaultPrevented()){var l,e=b.event.special[f]||{};if((!e._default||e._default.call(g.ownerDocument,a)===!1)&&!(f==="click"&&b.nodeName(g,"a"))&&b.acceptData(g)){try{if(k&&g[f])(l=g[k])&&(g[k]=null),b.event.triggered=f,g[f]()}catch(v){}l&&(g[k]=l);b.event.triggered=h}}return a.result}}else b.each(b.cache,function(){var g=this[b.expando];g&&g.events&&g.events[f]&&b.event.trigger(a,c,g.handle.elem)})}},handle:function(a){var a=b.event.fix(a||d.event),c=((b._data(this,"events")||{})[a.type]||
-[]).slice(0),g=!a.exclusive&&!a.namespace,k=Array.prototype.slice.call(arguments,0);k[0]=a;a.currentTarget=this;for(var f=0,e=c.length;f<e;f++){var j=c[f];if(g||a.namespace_re.test(j.namespace)){a.handler=j.handler;a.data=j.data;a.handleObj=j;j=j.handler.apply(this,k);if(j!==h)a.result=j,j===!1&&(a.preventDefault(),a.stopPropagation());if(a.isImmediatePropagationStopped())break}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
-fix:function(a){if(a[b.expando])return a;for(var c=a,a=b.Event(c),g=this.props.length,k;g;)k=this.props[--g],a[k]=c[k];if(!a.target)a.target=a.srcElement||y;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null)g=a.target.ownerDocument||y,c=g.documentElement,g=g.body,a.pageX=a.clientX+(c&&c.scrollLeft||g&&g.scrollLeft||0)-(c&&c.clientLeft||g&&g.clientLeft||0),a.pageY=
-a.clientY+(c&&c.scrollTop||g&&g.scrollTop||0)-(c&&c.clientTop||g&&g.clientTop||0);if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==h)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:b.proxy,special:{ready:{setup:b.bindReady,teardown:b.noop},live:{add:function(a){b.event.add(this,K(a.origType,a.selector),b.extend({},a,{handler:N,guid:a.handler.guid}))},remove:function(a){b.event.remove(this,
-K(a.origType,a.selector),a)}},beforeunload:{setup:function(a,c,g){if(b.isWindow(this))this.onbeforeunload=g},teardown:function(a,c){if(this.onbeforeunload===c)this.onbeforeunload=null}}}};b.removeEvent=y.removeEventListener?function(a,c,b){a.removeEventListener&&a.removeEventListener(c,b,!1)}:function(a,c,b){a.detachEvent&&a.detachEvent("on"+c,b)};b.Event=function(a,c){if(!this.preventDefault)return new b.Event(a,c);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||
-a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?q:B):this.type=a;c&&b.extend(this,c);this.timeStamp=b.now();this[b.expando]=!0};b.Event.prototype={preventDefault:function(){this.isDefaultPrevented=q;var a=this.originalEvent;if(a)a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=q;var a=this.originalEvent;if(a)a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=
-q;this.stopPropagation()},isDefaultPrevented:B,isPropagationStopped:B,isImmediatePropagationStopped:B};var ka=function(a){var c=a.relatedTarget,g=!1,k=a.type;a.type=a.data;if(c!==this&&(c&&(g=b.contains(this,c)),!g))b.event.handle.apply(this,arguments),a.type=k},E=function(a){a.type=a.data;b.event.handle.apply(this,arguments)};b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,c){b.event.special[a]={setup:function(g){b.event.add(this,c,g&&g.selector?E:ka,a)},teardown:function(a){b.event.remove(this,
-c,a&&a.selector?E:ka)}}});if(!b.support.submitBubbles)b.event.special.submit={setup:function(){if(b.nodeName(this,"form"))return!1;else b.event.add(this,"click.specialSubmit",function(a){var c=a.target,g=c.type;(g==="submit"||g==="image")&&b(c).closest("form").length&&z("submit",this,arguments)}),b.event.add(this,"keypress.specialSubmit",function(a){var c=a.target,g=c.type;(g==="text"||g==="password")&&b(c).closest("form").length&&a.keyCode===13&&z("submit",this,arguments)})},teardown:function(){b.event.remove(this,
-".specialSubmit")}};if(!b.support.changeBubbles){var ea,la=function(a){var c=a.type,g=a.value;if(c==="radio"||c==="checkbox")g=a.checked;else if(c==="select-multiple")g=a.selectedIndex>-1?b.map(a.options,function(a){return a.selected}).join("-"):"";else if(b.nodeName(a,"select"))g=a.selectedIndex;return g},xa=function(a,c){var g=a.target,k,f;if(ca.test(g.nodeName)&&!g.readOnly&&(k=b._data(g,"_change_data"),f=la(g),(a.type!=="focusout"||g.type!=="radio")&&b._data(g,"_change_data",f),!(k===h||f===k)))if(k!=
-null||f)a.type="change",a.liveFired=h,b.event.trigger(a,c,g)};b.event.special.change={filters:{focusout:xa,beforedeactivate:xa,click:function(a){var c=a.target,g=b.nodeName(c,"input")?c.type:"";(g==="radio"||g==="checkbox"||b.nodeName(c,"select"))&&xa.call(this,a)},keydown:function(a){var c=a.target,g=b.nodeName(c,"input")?c.type:"";(a.keyCode===13&&!b.nodeName(c,"textarea")||a.keyCode===32&&(g==="checkbox"||g==="radio")||g==="select-multiple")&&xa.call(this,a)},beforeactivate:function(a){a=a.target;
-b._data(a,"_change_data",la(a))}},setup:function(){if(this.type==="file")return!1;for(var a in ea)b.event.add(this,a+".specialChange",ea[a]);return ca.test(this.nodeName)},teardown:function(){b.event.remove(this,".specialChange");return ca.test(this.nodeName)}};ea=b.event.special.change.filters;ea.focus=ea.beforeactivate}b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(a,c){function g(a){var g=b.event.fix(a);g.type=c;g.originalEvent={};b.event.trigger(g,null,g.target);g.isDefaultPrevented()&&
-a.preventDefault()}var k=0;b.event.special[c]={setup:function(){k++===0&&y.addEventListener(a,g,!0)},teardown:function(){--k===0&&y.removeEventListener(a,g,!0)}}});b.each(["bind","one"],function(a,c){b.fn[c]=function(a,k,f){var e;if(typeof a==="object"){for(var j in a)this[c](j,k,a[j],f);return this}if(arguments.length===2||k===!1)f=k,k=h;c==="one"?(e=function(a){b(this).unbind(a,e);return f.apply(this,arguments)},e.guid=f.guid||b.guid++):e=f;if(a==="unload"&&c!=="one")this.one(a,k,f);else{j=0;for(var l=
-this.length;j<l;j++)b.event.add(this[j],a,e,k)}return this}});b.fn.extend({unbind:function(a,c){if(typeof a==="object"&&!a.preventDefault)for(var g in a)this.unbind(g,a[g]);else{g=0;for(var k=this.length;g<k;g++)b.event.remove(this[g],a,c)}return this},delegate:function(a,c,b,k){return this.live(c,b,k,a)},undelegate:function(a,c,b){return arguments.length===0?this.unbind("live"):this.die(c,null,b,a)},trigger:function(a,c){return this.each(function(){b.event.trigger(a,c,this)})},triggerHandler:function(a,
-c){if(this[0])return b.event.trigger(a,c,this[0],!0)},toggle:function(a){var c=arguments,g=a.guid||b.guid++,k=0,f=function(g){var f=(b.data(this,"lastToggle"+a.guid)||0)%k;b.data(this,"lastToggle"+a.guid,f+1);g.preventDefault();return c[f].apply(this,arguments)||!1};for(f.guid=g;k<c.length;)c[k++].guid=g;return this.click(f)},hover:function(a,c){return this.mouseenter(a).mouseleave(c||a)}});var sa={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};b.each(["live","die"],
-function(a,c){b.fn[c]=function(a,k,f,e){var j=0,l,d,v=e||this.selector,t=e?this:b(this.context);if(typeof a==="object"&&!a.preventDefault){for(l in a)t[c](l,k,a[l],v);return this}if(c==="die"&&!a&&e&&e.charAt(0)===".")return t.unbind(e),this;if(k===!1||b.isFunction(k))f=k||B,k=h;for(a=(a||"").split(" ");(e=a[j++])!=null;)if(l=Ba.exec(e),d="",l&&(d=l[0],e=e.replace(Ba,"")),e==="hover")a.push("mouseenter"+d,"mouseleave"+d);else if(l=e,sa[e]?(a.push(sa[e]+d),e+=d):e=(sa[e]||e)+d,c==="live"){d=0;for(var n=
-t.length;d<n;d++)b.event.add(t[d],"live."+K(e,v),{data:k,selector:v,handler:f,origType:e,origHandler:f,preType:l})}else t.unbind("live."+K(e,v),f);return this}});b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,c){b.fn[c]=function(a,b){b==null&&(b=a,a=null);return arguments.length>0?this.bind(c,a,b):this.trigger(c)};b.attrFn&&(b.attrFn[c]=
-!0)});(function(){function a(a,c,b,g,k,f){for(var k=0,e=g.length;k<e;k++){var s=g[k];if(s){for(var j=!1,s=s[a];s;){if(s.sizcache===b){j=g[s.sizset];break}if(s.nodeType===1&&!f)s.sizcache=b,s.sizset=k;if(s.nodeName.toLowerCase()===c){j=s;break}s=s[a]}g[k]=j}}}function c(a,c,b,g,k,f){for(var k=0,e=g.length;k<e;k++){var s=g[k];if(s){for(var j=!1,s=s[a];s;){if(s.sizcache===b){j=g[s.sizset];break}if(s.nodeType===1){if(!f)s.sizcache=b,s.sizset=k;if(typeof c!=="string"){if(s===c){j=!0;break}}else if(v.filter(c,
-[s]).length>0){j=s;break}}s=s[a]}g[k]=j}}}var g=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,k=0,f=Object.prototype.toString,e=!1,j=!0,l=/\\/g,d=/\W/;[0,0].sort(function(){j=!1;return 0});var v=function(a,c,b,k){var b=b||[],e=c=c||y;if(c.nodeType!==1&&c.nodeType!==9)return[];if(!a||typeof a!=="string")return b;var j,l,d,M,H,P=!0,h=v.isXML(c),w=[],ma=a;do if(g.exec(""),j=g.exec(ma))if(ma=j[3],w.push(j[1]),j[2]){M=
-j[3];break}while(j);if(w.length>1&&n.exec(a))if(w.length===2&&t.relative[w[0]])l=ha(w[0]+w[1],c);else for(l=t.relative[w[0]]?[c]:v(w.shift(),c);w.length;)a=w.shift(),t.relative[a]&&(a+=w.shift()),l=ha(a,l);else if(!k&&w.length>1&&c.nodeType===9&&!h&&t.match.ID.test(w[0])&&!t.match.ID.test(w[w.length-1])&&(j=v.find(w.shift(),c,h),c=j.expr?v.filter(j.expr,j.set)[0]:j.set[0]),c){j=k?{expr:w.pop(),set:W(k)}:v.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&c.parentNode?c.parentNode:c,h);l=j.expr?
-v.filter(j.expr,j.set):j.set;for(w.length>0?d=W(l):P=!1;w.length;)j=H=w.pop(),t.relative[H]?j=w.pop():H="",j==null&&(j=c),t.relative[H](d,j,h)}else d=[];d||(d=l);d||v.error(H||a);if(f.call(d)==="[object Array]")if(P)if(c&&c.nodeType===1)for(a=0;d[a]!=null;a++)d[a]&&(d[a]===!0||d[a].nodeType===1&&v.contains(c,d[a]))&&b.push(l[a]);else for(a=0;d[a]!=null;a++)d[a]&&d[a].nodeType===1&&b.push(l[a]);else b.push.apply(b,d);else W(d,b);M&&(v(M,e,b,k),v.uniqueSort(b));return b};v.uniqueSort=function(a){if(ma&&
-(e=j,a.sort(ma),e))for(var c=1;c<a.length;c++)a[c]===a[c-1]&&a.splice(c--,1);return a};v.matches=function(a,c){return v(a,null,null,c)};v.matchesSelector=function(a,c){return v(c,null,null,[a]).length>0};v.find=function(a,c,b){var g;if(!a)return[];for(var k=0,f=t.order.length;k<f;k++){var e,s=t.order[k];if(e=t.leftMatch[s].exec(a)){var j=e[1];e.splice(1,1);if(j.substr(j.length-1)!=="\\"&&(e[1]=(e[1]||"").replace(l,""),g=t.find[s](e,c,b),g!=null)){a=a.replace(t.match[s],"");break}}}g||(g=typeof c.getElementsByTagName!==
-"undefined"?c.getElementsByTagName("*"):[]);return{set:g,expr:a}};v.filter=function(a,c,b,g){for(var k,f,e=a,s=[],j=c,l=c&&c[0]&&v.isXML(c[0]);a&&c.length;){for(var d in t.filter)if((k=t.leftMatch[d].exec(a))!=null&&k[2]){var n,M,H=t.filter[d];M=k[1];f=!1;k.splice(1,1);if(M.substr(M.length-1)!=="\\"){j===s&&(s=[]);if(t.preFilter[d])if(k=t.preFilter[d](k,j,b,s,g,l)){if(k===!0)continue}else f=n=!0;if(k)for(var P=0;(M=j[P])!=null;P++)if(M){n=H(M,k,P,j);var w=g^!!n;b&&n!=null?w?f=!0:j[P]=!1:w&&(s.push(M),
-f=!0)}if(n!==h){b||(j=s);a=a.replace(t.match[d],"");if(!f)return[];break}}}if(a===e)if(f==null)v.error(a);else break;e=a}return j};v.error=function(a){throw"Syntax error, unrecognized expression: "+a;};var t=v.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
-TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,c){var b=
-typeof c==="string",g=b&&!d.test(c),b=b&&!g;g&&(c=c.toLowerCase());for(var g=0,k=a.length,f;g<k;g++)if(f=a[g]){for(;(f=f.previousSibling)&&f.nodeType!==1;);a[g]=b||f&&f.nodeName.toLowerCase()===c?f||!1:f===c}b&&v.filter(c,a,!0)},">":function(a,c){var b,g=typeof c==="string",k=0,f=a.length;if(g&&!d.test(c))for(c=c.toLowerCase();k<f;k++){if(b=a[k])b=b.parentNode,a[k]=b.nodeName.toLowerCase()===c?b:!1}else{for(;k<f;k++)(b=a[k])&&(a[k]=g?b.parentNode:b.parentNode===c);g&&v.filter(c,a,!0)}},"":function(b,
-g,f){var e,s=k++,j=c;typeof g==="string"&&!d.test(g)&&(e=g=g.toLowerCase(),j=a);j("parentNode",g,s,b,e,f)},"~":function(b,g,f){var e,s=k++,j=c;typeof g==="string"&&!d.test(g)&&(e=g=g.toLowerCase(),j=a);j("previousSibling",g,s,b,e,f)}},find:{ID:function(a,c,b){if(typeof c.getElementById!=="undefined"&&!b)return(a=c.getElementById(a[1]))&&a.parentNode?[a]:[]},NAME:function(a,c){if(typeof c.getElementsByName!=="undefined"){for(var b=[],g=c.getElementsByName(a[1]),k=0,f=g.length;k<f;k++)g[k].getAttribute("name")===
-a[1]&&b.push(g[k]);return b.length===0?null:b}},TAG:function(a,c){if(typeof c.getElementsByTagName!=="undefined")return c.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,c,b,g,k,f){a=" "+a[1].replace(l,"")+" ";if(f)return a;for(var f=0,e;(e=c[f])!=null;f++)e&&(k^(e.className&&(" "+e.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?b||g.push(e):b&&(c[f]=!1));return!1},ID:function(a){return a[1].replace(l,"")},TAG:function(a){return a[1].replace(l,"").toLowerCase()},CHILD:function(a){if(a[1]===
-"nth"){a[2]||v.error(a[0]);a[2]=a[2].replace(/^\+|\s*/g,"");var c=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=c[1]+(c[2]||1)-0;a[3]=c[3]-0}else a[2]&&v.error(a[0]);a[0]=k++;return a},ATTR:function(a,c,b,g,k,f){c=a[1]=a[1].replace(l,"");!f&&t.attrMap[c]&&(a[1]=t.attrMap[c]);a[4]=(a[4]||a[5]||"").replace(l,"");a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(a,c,b,k,f){if(a[1]==="not")if((g.exec(a[3])||"").length>1||
-/^\w/.test(a[3]))a[3]=v(a[3],null,null,c);else return a=v.filter(a[3],c,b,1^f),b||k.push.apply(k,a),!1;else if(t.match.POS.test(a[0])||t.match.CHILD.test(a[0]))return!0;return a},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},
-has:function(a,c,b){return!!v(b[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var c=a.getAttribute("type"),b=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===b&&(c===b||c===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()===
-"input"&&"password"===a.type},submit:function(a){var c=a.nodeName.toLowerCase();return(c==="input"||c==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var c=a.nodeName.toLowerCase();return(c==="input"||c==="button")&&"reset"===a.type},button:function(a){var c=a.nodeName.toLowerCase();return c==="input"&&"button"===a.type||c==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===
-a.ownerDocument.activeElement}},setFilters:{first:function(a,c){return c===0},last:function(a,c,b,g){return c===g.length-1},even:function(a,c){return c%2===0},odd:function(a,c){return c%2===1},lt:function(a,c,b){return c<b[3]-0},gt:function(a,c,b){return c>b[3]-0},nth:function(a,c,b){return b[3]-0===c},eq:function(a,c,b){return b[3]-0===c}},filter:{PSEUDO:function(a,c,b,g){var k=c[1],f=t.filters[k];if(f)return f(a,b,c,g);else if(k==="contains")return(a.textContent||a.innerText||v.getText([a])||"").indexOf(c[3])>=
-0;else if(k==="not"){c=c[3];b=0;for(g=c.length;b<g;b++)if(c[b]===a)return!1;return!0}else v.error(k)},CHILD:function(a,c){var b=c[1],g=a;switch(b){case "only":case "first":for(;g=g.previousSibling;)if(g.nodeType===1)return!1;if(b==="first")return!0;g=a;case "last":for(;g=g.nextSibling;)if(g.nodeType===1)return!1;return!0;case "nth":var b=c[2],k=c[3];if(b===1&&k===0)return!0;var f=c[0],e=a.parentNode;if(e&&(e.sizcache!==f||!a.nodeIndex)){for(var s=0,g=e.firstChild;g;g=g.nextSibling)if(g.nodeType===
-1)g.nodeIndex=++s;e.sizcache=f}g=a.nodeIndex-k;return b===0?g===0:g%b===0&&g/b>=0}},ID:function(a,c){return a.nodeType===1&&a.getAttribute("id")===c},TAG:function(a,c){return c==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===c},CLASS:function(a,c){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(c)>-1},ATTR:function(a,c){var b=c[1],b=t.attrHandle[b]?t.attrHandle[b](a):a[b]!=null?a[b]:a.getAttribute(b),g=b+"",k=c[2],f=c[4];return b==null?k==="!=":k==="="?g===f:k==="*="?g.indexOf(f)>=
-0:k==="~="?(" "+g+" ").indexOf(f)>=0:!f?g&&b!==!1:k==="!="?g!==f:k==="^="?g.indexOf(f)===0:k==="$="?g.substr(g.length-f.length)===f:k==="|="?g===f||g.substr(0,f.length+1)===f+"-":!1},POS:function(a,c,b,g){var k=t.setFilters[c[2]];if(k)return k(a,b,c,g)}}},n=t.match.POS,M=function(a,c){return"\\"+(c-0+1)},P;for(P in t.match)t.match[P]=RegExp(t.match[P].source+/(?![^\[]*\])(?![^\(]*\))/.source),t.leftMatch[P]=RegExp(/(^(?:.|\r|\n)*?)/.source+t.match[P].source.replace(/\\(\d+)/g,M));var W=function(a,
-c){a=Array.prototype.slice.call(a,0);if(c)return c.push.apply(c,a),c;return a};try{Array.prototype.slice.call(y.documentElement.childNodes,0)}catch(w){W=function(a,c){var b=0,g=c||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(g,a);else if(typeof a.length==="number")for(var k=a.length;b<k;b++)g.push(a[b]);else for(;a[b];b++)g.push(a[b]);return g}}var ma,J;y.documentElement.compareDocumentPosition?ma=function(a,c){if(a===c)return e=!0,0;if(!a.compareDocumentPosition||!c.compareDocumentPosition)return a.compareDocumentPosition?
--1:1;return a.compareDocumentPosition(c)&4?-1:1}:(ma=function(a,c){if(a===c)return e=!0,0;else if(a.sourceIndex&&c.sourceIndex)return a.sourceIndex-c.sourceIndex;var b,g,k=[],f=[];b=a.parentNode;g=c.parentNode;var s=b;if(b===g)return J(a,c);else if(b){if(!g)return 1}else return-1;for(;s;)k.unshift(s),s=s.parentNode;for(s=g;s;)f.unshift(s),s=s.parentNode;b=k.length;g=f.length;for(s=0;s<b&&s<g;s++)if(k[s]!==f[s])return J(k[s],f[s]);return s===b?J(a,f[s],-1):J(k[s],c,1)},J=function(a,c,b){if(a===c)return b;
-for(a=a.nextSibling;a;){if(a===c)return-1;a=a.nextSibling}return 1});v.getText=function(a){for(var c="",b,g=0;a[g];g++)b=a[g],b.nodeType===3||b.nodeType===4?c+=b.nodeValue:b.nodeType!==8&&(c+=v.getText(b.childNodes));return c};(function(){var a=y.createElement("div"),c="script"+(new Date).getTime(),b=y.documentElement;a.innerHTML="<a name='"+c+"'/>";b.insertBefore(a,b.firstChild);if(y.getElementById(c))t.find.ID=function(a,c,b){if(typeof c.getElementById!=="undefined"&&!b)return(c=c.getElementById(a[1]))?
-c.id===a[1]||typeof c.getAttributeNode!=="undefined"&&c.getAttributeNode("id").nodeValue===a[1]?[c]:h:[]},t.filter.ID=function(a,c){var b=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&b&&b.nodeValue===c};b.removeChild(a);b=a=null})();(function(){var a=y.createElement("div");a.appendChild(y.createComment(""));if(a.getElementsByTagName("*").length>0)t.find.TAG=function(a,c){var b=c.getElementsByTagName(a[1]);if(a[1]==="*"){for(var g=[],k=0;b[k];k++)b[k].nodeType===
-1&&g.push(b[k]);b=g}return b};a.innerHTML="<a href='#'></a>";if(a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#")t.attrHandle.href=function(a){return a.getAttribute("href",2)};a=null})();y.querySelectorAll&&function(){var a=v,c=y.createElement("div");c.innerHTML="<p class='TEST'></p>";if(!(c.querySelectorAll&&c.querySelectorAll(".TEST").length===0)){v=function(c,b,g,k){b=b||y;if(!k&&!v.isXML(b)){var f=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(c);
-if(f&&(b.nodeType===1||b.nodeType===9))if(f[1])return W(b.getElementsByTagName(c),g);else if(f[2]&&t.find.CLASS&&b.getElementsByClassName)return W(b.getElementsByClassName(f[2]),g);if(b.nodeType===9){if(c==="body"&&b.body)return W([b.body],g);else if(f&&f[3]){var e=b.getElementById(f[3]);if(e&&e.parentNode){if(e.id===f[3])return W([e],g)}else return W([],g)}try{return W(b.querySelectorAll(c),g)}catch(s){}}else if(b.nodeType===1&&b.nodeName.toLowerCase()!=="object"){var f=b,j=(e=b.getAttribute("id"))||
-"__sizzle__",l=b.parentNode,d=/^\s*[+~]/.test(c);e?j=j.replace(/'/g,"\\$&"):b.setAttribute("id",j);if(d&&l)b=b.parentNode;try{if(!d||l)return W(b.querySelectorAll("[id='"+j+"'] "+c),g)}catch(n){}finally{e||f.removeAttribute("id")}}}return a(c,b,g,k)};for(var b in a)v[b]=a[b];c=null}}();(function(){var a=y.documentElement,c=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(c){var b=!c.call(y.createElement("div"),"div"),g=!1;try{c.call(y.documentElement,"[test!='']:sizzle")}catch(k){g=
-!0}v.matchesSelector=function(a,k){k=k.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!v.isXML(a))try{if(g||!t.match.PSEUDO.test(k)&&!/!=/.test(k)){var f=c.call(a,k);if(f||!b||a.document&&a.document.nodeType!==11)return f}}catch(e){}return v(k,null,null,[a]).length>0}}})();(function(){var a=y.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0&&(a.lastChild.className="e",a.getElementsByClassName("e").length!==
-1))t.order.splice(1,0,"CLASS"),t.find.CLASS=function(a,c,b){if(typeof c.getElementsByClassName!=="undefined"&&!b)return c.getElementsByClassName(a[1])},a=null})();v.contains=y.documentElement.contains?function(a,c){return a!==c&&(a.contains?a.contains(c):!0)}:y.documentElement.compareDocumentPosition?function(a,c){return!!(a.compareDocumentPosition(c)&16)}:function(){return!1};v.isXML=function(a){return(a=(a?a.ownerDocument||a:0).documentElement)?a.nodeName!=="HTML":!1};var ha=function(a,c){for(var b,
-g=[],k="",f=c.nodeType?[c]:c;b=t.match.PSEUDO.exec(a);)k+=b[0],a=a.replace(t.match.PSEUDO,"");a=t.relative[a]?a+"*":a;b=0;for(var e=f.length;b<e;b++)v(a,f[b],g);return v.filter(k,g)};b.find=v;b.expr=v.selectors;b.expr[":"]=b.expr.filters;b.unique=v.uniqueSort;b.text=v.getText;b.isXMLDoc=v.isXML;b.contains=v.contains})();var ta=/Until$/,U=/^(?:parents|prevUntil|prevAll)/,ya=/,/,Ea=/^.[^:#\[\.,]*$/,f=Array.prototype.slice,v=b.expr.match.POS,j={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(a){var c=
-this,g,k;if(typeof a!=="string")return b(a).filter(function(){g=0;for(k=c.length;g<k;g++)if(b.contains(c[g],this))return!0});var f=this.pushStack("","find",a),e,j,l;g=0;for(k=this.length;g<k;g++)if(e=f.length,b.find(a,this[g],f),g>0)for(j=e;j<f.length;j++)for(l=0;l<e;l++)if(f[l]===f[j]){f.splice(j--,1);break}return f},has:function(a){var c=b(a);return this.filter(function(){for(var a=0,k=c.length;a<k;a++)if(b.contains(this,c[a]))return!0})},not:function(a){return this.pushStack(I(this,a,!1),"not",
-a)},filter:function(a){return this.pushStack(I(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a==="string"?b.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,c){var g=[],k,f,e=this[0];if(b.isArray(a)){var j,l={},d=1;if(e&&a.length){k=0;for(f=a.length;k<f;k++)j=a[k],l[j]||(l[j]=v.test(j)?b(j,c||this.context):j);for(;e&&e.ownerDocument&&e!==c;){for(j in l)k=l[j],(k.jquery?k.index(e)>-1:b(e).is(k))&&g.push({selector:j,elem:e,level:d});e=e.parentNode;d++}}return g}j=v.test(a)||
-typeof a!=="string"?b(a,c||this.context):0;k=0;for(f=this.length;k<f;k++)for(e=this[k];e;)if(j?j.index(e)>-1:b.find.matchesSelector(e,a)){g.push(e);break}else if(e=e.parentNode,!e||!e.ownerDocument||e===c||e.nodeType===11)break;g=g.length>1?b.unique(g):g;return this.pushStack(g,"closest",a)},index:function(a){if(!a||typeof a==="string")return b.inArray(this[0],a?b(a):this.parent().children());return b.inArray(a.jquery?a[0]:a,this)},add:function(a,c){var g=typeof a==="string"?b(a,c):b.makeArray(a&&
-a.nodeType?[a]:a),k=b.merge(this.get(),g);return this.pushStack(!g[0]||!g[0].parentNode||g[0].parentNode.nodeType===11||!k[0]||!k[0].parentNode||k[0].parentNode.nodeType===11?k:b.unique(k))},andSelf:function(){return this.add(this.prevObject)}});b.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return b.dir(a,"parentNode")},parentsUntil:function(a,c,g){return b.dir(a,"parentNode",g)},next:function(a){return b.nth(a,2,"nextSibling")},prev:function(a){return b.nth(a,
-2,"previousSibling")},nextAll:function(a){return b.dir(a,"nextSibling")},prevAll:function(a){return b.dir(a,"previousSibling")},nextUntil:function(a,c,g){return b.dir(a,"nextSibling",g)},prevUntil:function(a,c,g){return b.dir(a,"previousSibling",g)},siblings:function(a){return b.sibling(a.parentNode.firstChild,a)},children:function(a){return b.sibling(a.firstChild)},contents:function(a){return b.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:b.makeArray(a.childNodes)}},function(a,
-c){b.fn[a]=function(g,k){var e=b.map(this,c,g),l=f.call(arguments);ta.test(a)||(k=g);k&&typeof k==="string"&&(e=b.filter(k,e));e=this.length>1&&!j[a]?b.unique(e):e;if((this.length>1||ya.test(k))&&U.test(a))e=e.reverse();return this.pushStack(e,a,l.join(","))}});b.extend({filter:function(a,c,g){g&&(a=":not("+a+")");return c.length===1?b.find.matchesSelector(c[0],a)?[c[0]]:[]:b.find.matches(a,c)},dir:function(a,c,g){for(var k=[],a=a[c];a&&a.nodeType!==9&&(g===h||a.nodeType!==1||!b(a).is(g));)a.nodeType===
-1&&k.push(a),a=a[c];return k},nth:function(a,c,b){for(var c=c||1,k=0;a;a=a[b])if(a.nodeType===1&&++k===c)break;return a},sibling:function(a,c){for(var b=[];a;a=a.nextSibling)a.nodeType===1&&a!==c&&b.push(a);return b}});var M=/ jQuery\d+="(?:\d+|null)"/g,l=/^\s+/,P=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,W=/<([\w:]+)/,Aa=/<tbody/i,ma=/<|&#?\w+;/,za=/<(?:script|object|embed|option|style)/i,ha=/checked\s*(?:[^=]|=\s*.checked.)/i,Na=/\/(java|ecma)script/i,hb=/^\s*<!(?:\[CDATA\[|\-\-)/,
-na={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};na.optgroup=na.option;na.tbody=na.tfoot=na.colgroup=na.caption=na.thead;na.th=na.td;if(!b.support.htmlSerialize)na._default=[1,"div<div>","</div>"];b.fn.extend({text:function(a){if(b.isFunction(a))return this.each(function(c){var g=
-b(this);g.text(a.call(this,c,g.text()))});if(typeof a!=="object"&&a!==h)return this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a));return b.text(this)},wrapAll:function(a){if(b.isFunction(a))return this.each(function(c){b(this).wrapAll(a.call(this,c))});if(this[0]){var c=b(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&c.insertBefore(this[0]);c.map(function(){for(var a=this;a.firstChild&&a.firstChild.nodeType===1;)a=a.firstChild;return a}).append(this)}return this},
-wrapInner:function(a){if(b.isFunction(a))return this.each(function(c){b(this).wrapInner(a.call(this,c))});return this.each(function(){var c=b(this),g=c.contents();g.length?g.wrapAll(a):c.append(a)})},wrap:function(a){return this.each(function(){b(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,
-!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});else if(arguments.length){var a=b(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});else if(arguments.length){var a=
-this.pushStack(this,"after",arguments);a.push.apply(a,b(arguments[0]).toArray());return a}},remove:function(a,c){for(var g=0,k;(k=this[g])!=null;g++)if(!a||b.filter(a,[k]).length)!c&&k.nodeType===1&&(b.cleanData(k.getElementsByTagName("*")),b.cleanData([k])),k.parentNode&&k.parentNode.removeChild(k);return this},empty:function(){for(var a=0,c;(c=this[a])!=null;a++)for(c.nodeType===1&&b.cleanData(c.getElementsByTagName("*"));c.firstChild;)c.removeChild(c.firstChild);return this},clone:function(a,c){a=
-a==null?!1:a;c=c==null?a:c;return this.map(function(){return b.clone(this,a,c)})},html:function(a){if(a===h)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(M,""):null;else if(typeof a==="string"&&!za.test(a)&&(b.support.leadingWhitespace||!l.test(a))&&!na[(W.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(P,"<$1></$2>");try{for(var c=0,g=this.length;c<g;c++)if(this[c].nodeType===1)b.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a}catch(k){this.empty().append(a)}}else b.isFunction(a)?
-this.each(function(c){var g=b(this);g.html(a.call(this,c,g.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(b.isFunction(a))return this.each(function(c){var g=b(this),k=g.html();g.replaceWith(a.call(this,c,k))});typeof a!=="string"&&(a=b(a).detach());return this.each(function(){var c=this.nextSibling,g=this.parentNode;b(this).remove();c?b(c).before(a):b(g).append(a)})}else return this.length?this.pushStack(b(b.isFunction(a)?a():a),"replaceWith",
-a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,g){var k,f,e,j=a[0],l=[];if(!b.support.checkClone&&arguments.length===3&&typeof j==="string"&&ha.test(j))return this.each(function(){b(this).domManip(a,c,g,!0)});if(b.isFunction(j))return this.each(function(k){var f=b(this);a[0]=j.call(this,k,c?f.html():h);f.domManip(a,c,g)});if(this[0]){k=j&&j.parentNode;k=b.support.parentNode&&k&&k.nodeType===11&&k.childNodes.length===this.length?{fragment:k}:b.buildFragment(a,this,l);e=
-k.fragment;if(f=e.childNodes.length===1?e=e.firstChild:e.firstChild){c=c&&b.nodeName(f,"tr");f=0;for(var d=this.length,v=d-1;f<d;f++)g.call(c?b.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):this[f]:this[f],k.cacheable||d>1&&f<v?b.clone(e,!0,!0):e)}l.length&&b.each(l,Q)}return this}});b.buildFragment=function(a,c,g){var k,f,e,j;c&&c[0]&&(j=c[0].ownerDocument||c[0]);j.createDocumentFragment||(j=y);if(a.length===
-1&&typeof a[0]==="string"&&a[0].length<512&&j===y&&a[0].charAt(0)==="<"&&!za.test(a[0])&&(b.support.checkClone||!ha.test(a[0])))f=!0,(e=b.fragments[a[0]])&&e!==1&&(k=e);k||(k=j.createDocumentFragment(),b.clean(a,j,k,g));f&&(b.fragments[a[0]]=e?k:1);return{fragment:k,cacheable:f}};b.fragments={};b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,c){b.fn[a]=function(g){var k=[],g=b(g),f=this.length===1&&this[0].parentNode;if(f&&
-f.nodeType===11&&f.childNodes.length===1&&g.length===1)return g[c](this[0]),this;else{for(var f=0,e=g.length;f<e;f++){var j=(f>0?this.clone(!0):this).get();b(g[f])[c](j);k=k.concat(j)}return this.pushStack(k,a,g.selector)}}});b.extend({clone:function(a,c,g){var k=a.cloneNode(!0),f,e,j;if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!b.isXMLDoc(a)){r(a,k);f=o(a);e=o(k);for(j=0;f[j];++j)r(f[j],e[j])}if(c&&(G(a,k),g)){f=o(a);e=o(k);for(j=0;f[j];++j)G(f[j],
-e[j])}return k},clean:function(a,c,g,k){c=c||y;typeof c.createElement==="undefined"&&(c=c.ownerDocument||c[0]&&c[0].ownerDocument||y);for(var f=[],e,j=0,d;(d=a[j])!=null;j++)if(typeof d==="number"&&(d+=""),d){if(typeof d==="string")if(ma.test(d)){d=d.replace(P,"<$1></$2>");e=(W.exec(d)||["",""])[1].toLowerCase();var v=na[e]||na._default,t=v[0],n=c.createElement("div");for(n.innerHTML=v[1]+d+v[2];t--;)n=n.lastChild;if(!b.support.tbody){t=Aa.test(d);v=e==="table"&&!t?n.firstChild&&n.firstChild.childNodes:
-v[1]==="<table>"&&!t?n.childNodes:[];for(e=v.length-1;e>=0;--e)b.nodeName(v[e],"tbody")&&!v[e].childNodes.length&&v[e].parentNode.removeChild(v[e])}!b.support.leadingWhitespace&&l.test(d)&&n.insertBefore(c.createTextNode(l.exec(d)[0]),n.firstChild);d=n.childNodes}else d=c.createTextNode(d);var M;if(!b.support.appendChecked)if(d[0]&&typeof(M=d.length)==="number")for(e=0;e<M;e++)V(d[e]);else V(d);d.nodeType?f.push(d):f=b.merge(f,d)}if(g){a=function(a){return!a.type||Na.test(a.type)};for(j=0;f[j];j++)k&&
-b.nodeName(f[j],"script")&&(!f[j].type||f[j].type.toLowerCase()==="text/javascript")?k.push(f[j].parentNode?f[j].parentNode.removeChild(f[j]):f[j]):(f[j].nodeType===1&&(c=b.grep(f[j].getElementsByTagName("script"),a),f.splice.apply(f,[j+1,0].concat(c))),g.appendChild(f[j]))}return f},cleanData:function(a){for(var c,g,k=b.cache,f=b.expando,e=b.event.special,j=b.support.deleteExpando,l=0,d;(d=a[l])!=null;l++)if(!d.nodeName||!b.noData[d.nodeName.toLowerCase()])if(g=d[b.expando]){if((c=k[g]&&k[g][f])&&
-c.events){for(var v in c.events)e[v]?b.event.remove(d,v):b.removeEvent(d,v,c.handle);if(c.handle)c.handle.elem=null}j?delete d[b.expando]:d.removeAttribute&&d.removeAttribute(b.expando);delete k[g]}}});var Da=/alpha\([^)]*\)/i,Fa=/opacity=([^)]*)/,ua=/([A-Z]|^ms)/g,Ga=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob=/^[+\-]=/,pb=/[^+\-\.\de]+/g,qb={position:"absolute",visibility:"hidden",display:"block"},ib=["Left","Right"],jb=["Top","Bottom"],Ja,$a,ab;b.fn.css=function(a,c){if(arguments.length===2&&c===h)return this;
-return b.access(this,a,c,!0,function(a,c,f){return f!==h?b.style(a,c,f):b.css(a,c)})};b.extend({cssHooks:{opacity:{get:function(a,c){if(c){var b=Ja(a,"opacity","opacity");return b===""?"1":b}else return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,g,f){if(a&&!(a.nodeType===3||a.nodeType===8||!a.style)){var e,j=b.camelCase(c),l=a.style,d=b.cssHooks[j],
-c=b.cssProps[j]||j;if(g!==h){if(f=typeof g,!(f==="number"&&isNaN(g)||g==null))if(f==="string"&&ob.test(g)&&(g=+g.replace(pb,"")+parseFloat(b.css(a,c)),f="number"),f==="number"&&!b.cssNumber[j]&&(g+="px"),!d||!("set"in d)||(g=d.set(a,g))!==h)try{l[c]=g}catch(v){}}else{if(d&&"get"in d&&(e=d.get(a,!1,f))!==h)return e;return l[c]}}},css:function(a,c,g){var f,e,c=b.camelCase(c);e=b.cssHooks[c];c=b.cssProps[c]||c;c==="cssFloat"&&(c="float");if(e&&"get"in e&&(f=e.get(a,!0,g))!==h)return f;else if(Ja)return Ja(a,
-c)},swap:function(a,c,b){var f={},e;for(e in c)f[e]=a.style[e],a.style[e]=c[e];b.call(a);for(e in c)a.style[e]=f[e]}});b.curCSS=b.css;b.each(["height","width"],function(a,c){b.cssHooks[c]={get:function(a,f,e){var j;if(f){if(a.offsetWidth!==0)return R(a,c,e);else b.swap(a,qb,function(){j=R(a,c,e)});return j}},set:function(a,c){if(Ga.test(c)){if(c=parseFloat(c),c>=0)return c+"px"}else return c}}});if(!b.support.opacity)b.cssHooks.opacity={get:function(a,c){return Fa.test((c&&a.currentStyle?a.currentStyle.filter:
-a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":c?"1":""},set:function(a,c){var g=a.style,f=a.currentStyle;g.zoom=1;var e=b.isNaN(c)?"":"alpha(opacity="+c*100+")",f=f&&f.filter||g.filter||"";g.filter=Da.test(f)?f.replace(Da,e):f+" "+e}};b(function(){if(!b.support.reliableMarginRight)b.cssHooks.marginRight={get:function(a,c){var g;b.swap(a,{display:"inline-block"},function(){g=c?Ja(a,"margin-right","marginRight"):a.style.marginRight});return g}}});y.defaultView&&y.defaultView.getComputedStyle&&($a=
-function(a,c){var g,f,c=c.replace(ua,"-$1").toLowerCase();if(!(f=a.ownerDocument.defaultView))return h;if(f=f.getComputedStyle(a,null))g=f.getPropertyValue(c),g===""&&!b.contains(a.ownerDocument.documentElement,a)&&(g=b.style(a,c));return g});y.documentElement.currentStyle&&(ab=function(a,c){var b,f=a.currentStyle&&a.currentStyle[c],e=a.runtimeStyle&&a.runtimeStyle[c],j=a.style;if(!Ga.test(f)&&nb.test(f)){b=j.left;if(e)a.runtimeStyle.left=a.currentStyle.left;j.left=c==="fontSize"?"1em":f||0;f=j.pixelLeft+
-"px";j.left=b;if(e)a.runtimeStyle.left=e}return f===""?"auto":f});Ja=$a||ab;if(b.expr&&b.expr.filters)b.expr.filters.hidden=function(a){var c=a.offsetHeight;return a.offsetWidth===0&&c===0||!b.support.reliableHiddenOffsets&&(a.style.display||b.css(a,"display"))==="none"},b.expr.filters.visible=function(a){return!b.expr.filters.hidden(a)};var rb=/%20/g,kb=/\[\]$/,bb=/\r?\n/g,sb=/#.*$/,tb=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,ub=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
-vb=/^(?:GET|HEAD)$/,wb=/^\/\//,cb=/\?/,xb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,yb=/^(?:select|textarea)/i,Ya=/\s+/,zb=/([?&])_=[^&]*/,db=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,eb=b.fn.load,Ua={},fb={},Ha,Ia;try{Ha=Y.href}catch(Fb){Ha=y.createElement("a"),Ha.href="",Ha=Ha.href}Ia=db.exec(Ha.toLowerCase())||[];b.fn.extend({load:function(a,c,g){if(typeof a!=="string"&&eb)return eb.apply(this,arguments);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0)var e=a.slice(f,
-a.length),a=a.slice(0,f);f="GET";c&&(b.isFunction(c)?(g=c,c=h):typeof c==="object"&&(c=b.param(c,b.ajaxSettings.traditional),f="POST"));var j=this;b.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,c,f){f=a.responseText;a.isResolved()&&(a.done(function(a){f=a}),j.html(e?b("<div>").append(f.replace(xb,"")).find(e):f));g&&j.each(g,[f,c,a])}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?
-b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||yb.test(this.nodeName)||ub.test(this.type))}).map(function(a,c){var g=b(this).val();return g==null?null:b.isArray(g)?b.map(g,function(a){return{name:c.name,value:a.replace(bb,"\r\n")}}):{name:c.name,value:g.replace(bb,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,c){b.fn[c]=function(a){return this.bind(c,a)}});b.each(["get","post"],
-function(a,c){b[c]=function(a,f,e,j){b.isFunction(f)&&(j=j||e,e=f,f=h);return b.ajax({type:c,url:a,data:f,success:e,dataType:j})}});b.extend({getScript:function(a,c){return b.get(a,h,c,"script")},getJSON:function(a,c,g){return b.get(a,c,g,"json")},ajaxSetup:function(a,c){c?b.extend(!0,a,b.ajaxSettings,c):(c=a,a=b.extend(!0,b.ajaxSettings,c));for(var g in{context:1,url:1})g in c?a[g]=c[g]:g in b.ajaxSettings&&(a[g]=b.ajaxSettings[g]);return a},ajaxSettings:{url:Ha,isLocal:/^(?:about|app|app\-storage|.+\-extension|file|widget):$/.test(Ia[1]),
-global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":d.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML}},ajaxPrefilter:S(Ua),ajaxTransport:S(fb),ajax:function(a,c){function g(a,c,g,n){if(ha!==
-2){ha=2;ma&&clearTimeout(ma);W=h;P=n||"";u.readyState=a?4:0;var M,w,J;if(g){var n=f,o=u,za=n.contents,r=n.dataTypes,q=n.responseFields,x,p,ca,ua;for(p in q)p in g&&(o[q[p]]=g[p]);for(;r[0]==="*";)r.shift(),x===h&&(x=n.mimeType||o.getResponseHeader("content-type"));if(x)for(p in za)if(za[p]&&za[p].test(x)){r.unshift(p);break}if(r[0]in g)ca=r[0];else{for(p in g){if(!r[0]||n.converters[p+" "+r[0]]){ca=p;break}ua||(ua=p)}ca=ca||ua}ca?(ca!==r[0]&&r.unshift(ca),g=g[ca]):g=void 0}else g=h;if(a>=200&&a<300||
-a===304){if(f.ifModified){if(x=u.getResponseHeader("Last-Modified"))b.lastModified[t]=x;if(x=u.getResponseHeader("Etag"))b.etag[t]=x}if(a===304)c="notmodified",M=!0;else try{x=f;x.dataFilter&&(g=x.dataFilter(g,x.dataType));var A=x.dataTypes;p={};var Fa,Na,y=A.length,Ga,E=A[0],Da,F,z,Q,C;for(Fa=1;Fa<y;Fa++){if(Fa===1)for(Na in x.converters)typeof Na==="string"&&(p[Na.toLowerCase()]=x.converters[Na]);Da=E;E=A[Fa];if(E==="*")E=Da;else if(Da!=="*"&&Da!==E){F=Da+" "+E;z=p[F]||p["* "+E];if(!z)for(Q in C=
-h,p)if(Ga=Q.split(" "),Ga[0]===Da||Ga[0]==="*")if(C=p[Ga[1]+" "+E]){Q=p[Q];Q===!0?z=C:C===!0&&(z=Q);break}!z&&!C&&b.error("No conversion from "+F.replace(" "," to "));z!==!0&&(g=z?z(g):C(Q(g)))}}w=g;c="success";M=!0}catch(na){c="parsererror",J=na}}else if(J=c,!c||a)c="error",a<0&&(a=0);u.status=a;u.statusText=c;M?d.resolveWith(e,[w,c,u]):d.rejectWith(e,[u,c,J]);u.statusCode(v);v=h;Aa&&j.trigger("ajax"+(M?"Success":"Error"),[u,f,M?w:J]);l.resolveWith(e,[u,c]);Aa&&(j.trigger("ajaxComplete",[u,f]),--b.active||
-b.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=h);var c=c||{},f=b.ajaxSetup({},c),e=f.context||f,j=e!==f&&(e.nodeType||e instanceof b)?b(e):b.event,d=b.Deferred(),l=b._Deferred(),v=f.statusCode||{},t,n={},M={},P,w,W,ma,J,ha=0,Aa,o,u={readyState:0,setRequestHeader:function(a,c){if(!ha){var b=a.toLowerCase(),a=M[b]=M[b]||a;n[a]=c}return this},getAllResponseHeaders:function(){return ha===2?P:null},getResponseHeader:function(a){var c;if(ha===2){if(!w)for(w={};c=tb.exec(P);)w[c[1].toLowerCase()]=
-c[2];c=w[a.toLowerCase()]}return c===h?null:c},overrideMimeType:function(a){if(!ha)f.mimeType=a;return this},abort:function(a){a=a||"abort";W&&W.abort(a);g(0,a);return this}};d.promise(u);u.success=u.done;u.error=u.fail;u.complete=l.done;u.statusCode=function(a){if(a){var c;if(ha<2)for(c in a)v[c]=[v[c],a[c]];else c=a[u.status],u.then(c,c)}return this};f.url=((a||f.url)+"").replace(sb,"").replace(wb,Ia[1]+"//");f.dataTypes=b.trim(f.dataType||"*").toLowerCase().split(Ya);if(f.crossDomain==null)J=db.exec(f.url.toLowerCase()),
-f.crossDomain=!(!J||!(J[1]!=Ia[1]||J[2]!=Ia[2]||(J[3]||(J[1]==="http:"?80:443))!=(Ia[3]||(Ia[1]==="http:"?80:443))));if(f.data&&f.processData&&typeof f.data!=="string")f.data=b.param(f.data,f.traditional);x(Ua,f,c,u);if(ha===2)return!1;Aa=f.global;f.type=f.type.toUpperCase();f.hasContent=!vb.test(f.type);Aa&&b.active++===0&&b.event.trigger("ajaxStart");if(!f.hasContent&&(f.data&&(f.url+=(cb.test(f.url)?"&":"?")+f.data),t=f.url,f.cache===!1)){J=b.now();var za=f.url.replace(zb,"$1_="+J);f.url=za+(za===
-f.url?(cb.test(f.url)?"&":"?")+"_="+J:"")}(f.data&&f.hasContent&&f.contentType!==!1||c.contentType)&&u.setRequestHeader("Content-Type",f.contentType);f.ifModified&&(t=t||f.url,b.lastModified[t]&&u.setRequestHeader("If-Modified-Since",b.lastModified[t]),b.etag[t]&&u.setRequestHeader("If-None-Match",b.etag[t]));u.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+(f.dataTypes[0]!=="*"?", */*; q=0.01":""):f.accepts["*"]);for(o in f.headers)u.setRequestHeader(o,
-f.headers[o]);if(f.beforeSend&&(f.beforeSend.call(e,u,f)===!1||ha===2))return u.abort(),!1;for(o in{success:1,error:1,complete:1})u[o](f[o]);if(W=x(fb,f,c,u)){u.readyState=1;Aa&&j.trigger("ajaxSend",[u,f]);f.async&&f.timeout>0&&(ma=setTimeout(function(){u.abort("timeout")},f.timeout));try{ha=1,W.send(n,g)}catch(r){status<2?g(-1,r):b.error(r)}}else g(-1,"No Transport");return u},param:function(a,c){var f=[],e=function(a,c){c=b.isFunction(c)?c():c;f[f.length]=encodeURIComponent(a)+"="+encodeURIComponent(c)};
-if(c===h)c=b.ajaxSettings.traditional;if(b.isArray(a)||a.jquery&&!b.isPlainObject(a))b.each(a,function(){e(this.name,this.value)});else for(var j in a)X(j,a[j],c,e);return f.join("&").replace(rb,"+")}});b.extend({active:0,lastModified:{},etag:{}});var Ab=b.now(),Ta=/(\=)\?(&|$)|\?\?/i;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return b.expando+"_"+Ab++}});b.ajaxPrefilter("json jsonp",function(a,c,f){c=a.contentType==="application/x-www-form-urlencoded"&&typeof a.data==="string";if(a.dataTypes[0]===
-"jsonp"||a.jsonp!==!1&&(Ta.test(a.url)||c&&Ta.test(a.data))){var e,j=a.jsonpCallback=b.isFunction(a.jsonpCallback)?a.jsonpCallback():a.jsonpCallback,l=d[j],v=a.url,t=a.data,n="$1"+j+"$2";a.jsonp!==!1&&(v=v.replace(Ta,n),a.url===v&&(c&&(t=t.replace(Ta,n)),a.data===t&&(v+=(/\?/.test(v)?"&":"?")+a.jsonp+"="+j)));a.url=v;a.data=t;d[j]=function(a){e=[a]};f.always(function(){d[j]=l;if(e&&b.isFunction(l))d[j](e[0])});a.converters["script json"]=function(){e||b.error(j+" was not called");return e[0]};a.dataTypes[0]=
-"json";return"script"}});b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){b.globalEval(a);return a}}});b.ajaxPrefilter("script",function(a){if(a.cache===h)a.cache=!1;if(a.crossDomain)a.type="GET",a.global=!1});b.ajaxTransport("script",function(a){if(a.crossDomain){var c,b=y.head||y.getElementsByTagName("head")[0]||y.documentElement;return{send:function(f,
-e){c=y.createElement("script");c.async="async";if(a.scriptCharset)c.charset=a.scriptCharset;c.src=a.url;c.onload=c.onreadystatechange=function(a,f){if(f||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,b&&c.parentNode&&b.removeChild(c),c=h,f||e(200,"success")};b.insertBefore(c,b.firstChild)},abort:function(){if(c)c.onload(0,1)}}}});var Wa=d.ActiveXObject?function(){for(var a in Oa)Oa[a](0,1)}:!1,Bb=0,Oa;b.ajaxSettings.xhr=d.ActiveXObject?function(){var a;if(!(a=
-!this.isLocal&&L()))a:{try{a=new d.ActiveXObject("Microsoft.XMLHTTP");break a}catch(c){}a=void 0}return a}:L;(function(a){b.extend(b.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})})(b.ajaxSettings.xhr());b.support.ajax&&b.ajaxTransport(function(a){if(!a.crossDomain||b.support.cors){var c;return{send:function(f,e){var j=a.xhr(),l,v;a.username?j.open(a.type,a.url,a.async,a.username,a.password):j.open(a.type,a.url,a.async);if(a.xhrFields)for(v in a.xhrFields)j[v]=a.xhrFields[v];a.mimeType&&j.overrideMimeType&&
-j.overrideMimeType(a.mimeType);!a.crossDomain&&!f["X-Requested-With"]&&(f["X-Requested-With"]="XMLHttpRequest");try{for(v in f)j.setRequestHeader(v,f[v])}catch(t){}j.send(a.hasContent&&a.data||null);c=function(f,g){var d,v,t,n,M;try{if(c&&(g||j.readyState===4)){c=h;if(l)j.onreadystatechange=b.noop,Wa&&delete Oa[l];if(g)j.readyState!==4&&j.abort();else{d=j.status;t=j.getAllResponseHeaders();n={};if((M=j.responseXML)&&M.documentElement)n.xml=M;n.text=j.responseText;try{v=j.statusText}catch(P){v=""}!d&&
-a.isLocal&&!a.crossDomain?d=n.text?200:404:d===1223&&(d=204)}}}catch(w){g||e(-1,w)}n&&e(d,v,n,t)};!a.async||j.readyState===4?c():(l=++Bb,Wa&&(Oa||(Oa={},b(d).unload(Wa)),Oa[l]=c),j.onreadystatechange=c)},abort:function(){c&&c(0,1)}}}});var Va={},Ca,Ka,Cb=/^(?:toggle|show|hide)$/,Db=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,Pa,Za=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],Ra,Xa=d.webkitRequestAnimationFrame||
-d.mozRequestAnimationFrame||d.oRequestAnimationFrame;b.fn.extend({show:function(a,c,f){if(a||a===0)return this.animate(ga("show",3),a,c,f);else{for(var f=0,e=this.length;f<e;f++)if(a=this[f],a.style){c=a.style.display;if(!b._data(a,"olddisplay")&&c==="none")c=a.style.display="";c===""&&b.css(a,"display")==="none"&&b._data(a,"olddisplay",qa(a.nodeName))}for(f=0;f<e;f++)if(a=this[f],a.style&&(c=a.style.display,c===""||c==="none"))a.style.display=b._data(a,"olddisplay")||"";return this}},hide:function(a,
-c,f){if(a||a===0)return this.animate(ga("hide",3),a,c,f);else{a=0;for(c=this.length;a<c;a++)this[a].style&&(f=b.css(this[a],"display"),f!=="none"&&!b._data(this[a],"olddisplay")&&b._data(this[a],"olddisplay",f));for(a=0;a<c;a++)if(this[a].style)this[a].style.display="none";return this}},_toggle:b.fn.toggle,toggle:function(a,c,f){var e=typeof a==="boolean";b.isFunction(a)&&b.isFunction(c)?this._toggle.apply(this,arguments):a==null||e?this.each(function(){var c=e?a:b(this).is(":hidden");b(this)[c?"show":
-"hide"]()}):this.animate(ga("toggle",3),a,c,f);return this},fadeTo:function(a,c,b,f){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:c},a,b,f)},animate:function(a,c,f,e){var j=b.speed(c,f,e);if(b.isEmptyObject(a))return this.each(j.complete,[!1]);a=b.extend({},a);return this[j.queue===!1?"each":"queue"](function(){var s;j.queue===!1&&b._mark(this);var c=b.extend({},j),f=this.nodeType===1,g=f&&b(this).is(":hidden"),e,k,d,l,v;c.animatedProperties={};for(d in a){e=b.camelCase(d);
-d!==e&&(a[e]=a[d],delete a[d]);k=a[e];b.isArray(k)?(c.animatedProperties[e]=k[1],s=a[e]=k[0],k=s):c.animatedProperties[e]=c.specialEasing&&c.specialEasing[e]||c.easing||"swing";if(k==="hide"&&g||k==="show"&&!g)return c.complete.call(this);if(f&&(e==="height"||e==="width"))if(c.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],b.css(this,"display")==="inline"&&b.css(this,"float")==="none")b.support.inlineBlockNeedsLayout?(k=qa(this.nodeName),k==="inline"?this.style.display="inline-block":
-(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"}if(c.overflow!=null)this.style.overflow="hidden";for(d in a)if(f=new b.fx(this,c,d),k=a[d],Cb.test(k))f[k==="toggle"?g?"show":"hide":k]();else e=Db.exec(k),l=f.cur(),e?(k=parseFloat(e[2]),v=e[3]||(b.cssNumber[d]?"":"px"),v!=="px"&&(b.style(this,d,(k||1)+v),l*=(k||1)/f.cur(),b.style(this,d,l+v)),e[1]&&(k=(e[1]==="-="?-1:1)*k+l),f.custom(l,k,v)):f.custom(l,k,"");return!0})},stop:function(a,c){a&&this.queue([]);this.each(function(){var a=
-b.timers,f=a.length;for(c||b._unmark(!0,this);f--;)if(a[f].elem===this){if(c)a[f](!0);a.splice(f,1)}});c||this.dequeue();return this}});b.each({slideDown:ga("show",1),slideUp:ga("hide",1),slideToggle:ga("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,c){b.fn[a]=function(a,b,f){return this.animate(c,a,b,f)}});b.extend({speed:function(a,c,f){var e=a&&typeof a==="object"?b.extend({},a):{complete:f||!f&&c||b.isFunction(a)&&a,duration:a,easing:f&&
-c||c&&!b.isFunction(c)&&c};e.duration=b.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in b.fx.speeds?b.fx.speeds[e.duration]:b.fx.speeds._default;e.old=e.complete;e.complete=function(a){b.isFunction(e.old)&&e.old.call(this);e.queue!==!1?b.dequeue(this):a!==!1&&b._unmark(this)};return e},easing:{linear:function(a,c,b,f){return b+f*a},swing:function(a,c,b,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+b}},timers:[],fx:function(a,c,b){this.options=c;this.elem=a;this.prop=b;c.orig=c.orig||{}}});
-b.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(b.fx.step[this.prop]||b.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,c=b.css(this.elem,this.prop);return isNaN(a=parseFloat(c))?!c||c==="auto"?0:c:a},custom:function(a,c,f){function e(a){return j.step(a)}var j=this,d=b.fx,l;this.startTime=Ra||fa();this.start=a;this.end=c;this.unit=f||this.unit||
-(b.cssNumber[this.prop]?"":"px");this.now=this.start;this.pos=this.state=0;e.elem=this.elem;e()&&b.timers.push(e)&&!Pa&&(Xa?(Pa=!0,l=function(){Pa&&(Xa(l),d.tick())},Xa(l)):Pa=setInterval(d.tick,d.interval))},show:function(){this.options.orig[this.prop]=b.style(this.elem,this.prop);this.options.show=!0;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());b(this.elem).show()},hide:function(){this.options.orig[this.prop]=b.style(this.elem,this.prop);this.options.hide=!0;this.custom(this.cur(),
-0)},step:function(a){var c=Ra||fa(),f=!0,e=this.elem,j=this.options,d;if(a||c>=j.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();j.animatedProperties[this.prop]=!0;for(d in j.animatedProperties)j.animatedProperties[d]!==!0&&(f=!1);if(f){j.overflow!=null&&!b.support.shrinkWrapBlocks&&b.each(["","X","Y"],function(a,c){e.style["overflow"+c]=j.overflow[a]});j.hide&&b(e).hide();if(j.hide||j.show)for(var l in j.animatedProperties)b.style(e,l,j.orig[l]);j.complete.call(e)}return!1}else j.duration==
-Infinity?this.now=c:(a=c-this.startTime,this.state=a/j.duration,this.pos=b.easing[j.animatedProperties[this.prop]](this.state,a,0,1,j.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}};b.extend(b.fx,{tick:function(){for(var a=b.timers,c=0;c<a.length;++c)a[c]()||a.splice(c--,1);a.length||b.fx.stop()},interval:13,stop:function(){clearInterval(Pa);Pa=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){b.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&
-a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}});if(b.expr&&b.expr.filters)b.expr.filters.animated=function(a){return b.grep(b.timers,function(c){return a===c.elem}).length};var Eb=/^t(?:able|d|h)$/i,gb=/^(?:body|html)$/i;b.fn.offset="getBoundingClientRect"in y.documentElement?function(a){var c=this[0],f;if(a)return this.each(function(c){b.offset.setOffset(this,a,c)});if(!c||!c.ownerDocument)return null;if(c===
-c.ownerDocument.body)return b.offset.bodyOffset(c);try{f=c.getBoundingClientRect()}catch(e){}var j=c.ownerDocument,d=j.documentElement;if(!f||!b.contains(d,c))return f?{top:f.top,left:f.left}:{top:0,left:0};c=j.body;j=va(j);return{top:f.top+(j.pageYOffset||b.support.boxModel&&d.scrollTop||c.scrollTop)-(d.clientTop||c.clientTop||0),left:f.left+(j.pageXOffset||b.support.boxModel&&d.scrollLeft||c.scrollLeft)-(d.clientLeft||c.clientLeft||0)}}:function(a){var c=this[0];if(a)return this.each(function(c){b.offset.setOffset(this,
-a,c)});if(!c||!c.ownerDocument)return null;if(c===c.ownerDocument.body)return b.offset.bodyOffset(c);b.offset.initialize();var f,e=c.offsetParent,j=c.ownerDocument,d=j.documentElement,l=j.body;f=(j=j.defaultView)?j.getComputedStyle(c,null):c.currentStyle;for(var v=c.offsetTop,t=c.offsetLeft;(c=c.parentNode)&&c!==l&&c!==d;){if(b.offset.supportsFixedPosition&&f.position==="fixed")break;f=j?j.getComputedStyle(c,null):c.currentStyle;v-=c.scrollTop;t-=c.scrollLeft;if(c===e){v+=c.offsetTop;t+=c.offsetLeft;
-if(b.offset.doesNotAddBorder&&(!b.offset.doesAddBorderForTableAndCells||!Eb.test(c.nodeName)))v+=parseFloat(f.borderTopWidth)||0,t+=parseFloat(f.borderLeftWidth)||0;e=c.offsetParent}b.offset.subtractsBorderForOverflowNotVisible&&f.overflow!=="visible"&&(v+=parseFloat(f.borderTopWidth)||0,t+=parseFloat(f.borderLeftWidth)||0)}if(f.position==="relative"||f.position==="static")v+=l.offsetTop,t+=l.offsetLeft;b.offset.supportsFixedPosition&&f.position==="fixed"&&(v+=Math.max(d.scrollTop,l.scrollTop),t+=
-Math.max(d.scrollLeft,l.scrollLeft));return{top:v,left:t}};b.offset={initialize:function(){var a=y.body,c=y.createElement("div"),f,e,j,d=parseFloat(b.css(a,"marginTop"))||0;b.extend(c.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});c.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
-a.insertBefore(c,a.firstChild);f=c.firstChild;e=f.firstChild;j=f.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=j.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";f.style.overflow="hidden";f.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==d;a.removeChild(c);
-b.offset.initialize=b.noop},bodyOffset:function(a){var c=a.offsetTop,f=a.offsetLeft;b.offset.initialize();b.offset.doesNotIncludeMarginInBodyOffset&&(c+=parseFloat(b.css(a,"marginTop"))||0,f+=parseFloat(b.css(a,"marginLeft"))||0);return{top:c,left:f}},setOffset:function(a,c,f){var e=b.css(a,"position");if(e==="static")a.style.position="relative";var j=b(a),d=j.offset(),l=b.css(a,"top"),v=b.css(a,"left"),t={},n={};(e==="absolute"||e==="fixed")&&b.inArray("auto",[l,v])>-1?(n=j.position(),e=n.top,v=
-n.left):(e=parseFloat(l)||0,v=parseFloat(v)||0);b.isFunction(c)&&(c=c.call(a,f,d));if(c.top!=null)t.top=c.top-d.top+e;if(c.left!=null)t.left=c.left-d.left+v;"using"in c?c.using.call(a,t):j.css(t)}};b.fn.extend({position:function(){if(!this[0])return null;var a=this[0],c=this.offsetParent(),f=this.offset(),e=gb.test(c[0].nodeName)?{top:0,left:0}:c.offset();f.top-=parseFloat(b.css(a,"marginTop"))||0;f.left-=parseFloat(b.css(a,"marginLeft"))||0;e.top+=parseFloat(b.css(c[0],"borderTopWidth"))||0;e.left+=
-parseFloat(b.css(c[0],"borderLeftWidth"))||0;return{top:f.top-e.top,left:f.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||y.body;a&&!gb.test(a.nodeName)&&b.css(a,"position")==="static";)a=a.offsetParent;return a})}});b.each(["Left","Top"],function(a,c){var f="scroll"+c;b.fn[f]=function(c){var e,j;if(c===h){e=this[0];if(!e)return null;return(j=va(e))?"pageXOffset"in j?j[a?"pageYOffset":"pageXOffset"]:b.support.boxModel&&j.document.documentElement[f]||
-j.document.body[f]:e[f]}return this.each(function(){(j=va(this))?j.scrollTo(!a?c:b(j).scrollLeft(),a?c:b(j).scrollTop()):this[f]=c})}});b.each(["Height","Width"],function(a,c){var f=c.toLowerCase();b.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(b.css(a,f,"padding")):null};b.fn["outer"+c]=function(a){var c=this[0];return c&&c.style?parseFloat(b.css(c,f,a?"margin":"border")):null};b.fn[f]=function(a){var e=this[0];if(!e)return a==null?null:this;if(b.isFunction(a))return this.each(function(c){var e=
-b(this);e[f](a.call(this,c,e[f]()))});if(b.isWindow(e)){var j=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&j||e.document.body["client"+c]||j}else return e.nodeType===9?Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]):a===h?(e=b.css(e,f),j=parseFloat(e),b.isNaN(j)?e:j):this.css(f,typeof a==="string"?a:a+"px")}});d.jQuery=d.$=b})(window);
+(function(a,c){function d(k,a,b){if(b===c&&k.nodeType===1)if(b="data-"+a.replace(Z,"$1-$2").toLowerCase(),b=k.getAttribute(b),typeof b==="string"){try{b=b==="true"?!0:b==="false"?!1:b==="null"?null:!e.isNaN(b)?parseFloat(b):$.test(b)?e.parseJSON(b):b}catch(d){}e.data(k,a,b)}else b=c;return b}function b(k){for(var a in k)if(a!=="toJSON")return!1;return!0}function f(k,a,b){var d=a+"defer",v=a+"queue",u=a+"mark",f=e.data(k,d,c,!0);f&&(b==="queue"||!e.data(k,v,c,!0))&&(b==="mark"||!e.data(k,u,c,!0))&&
+setTimeout(function(){!e.data(k,v,c,!0)&&!e.data(k,u,c,!0)&&(e.removeData(k,d,!0),f.resolve())},0)}function g(){return!1}function h(){return!0}function j(k,a,b){var d=e.extend({},b[0]);d.type=k;d.originalEvent={};d.liveFired=c;e.event.handle.call(a,d);d.isDefaultPrevented()&&b[0].preventDefault()}function m(k){var a,b,c,d,u,f,g,h,j,l,m,o=[];d=[];u=e._data(this,"events");if(!(k.liveFired===this||!u||!u.live||k.target.disabled||k.button&&k.type==="click")){k.namespace&&(m=RegExp("(^|\\.)"+k.namespace.split(".").join("\\.(?:.*\\.)?")+
+"(\\.|$)"));k.liveFired=this;var n=u.live.slice(0);for(g=0;g<n.length;g++)u=n[g],u.origType.replace(sa,"")===k.type?d.push(u.selector):n.splice(g--,1);d=e(k.target).closest(d,k.currentTarget);for(h=0,j=d.length;h<j;h++){l=d[h];for(g=0;g<n.length;g++)if(u=n[g],l.selector===u.selector&&(!m||m.test(u.namespace))&&!l.elem.disabled){f=l.elem;c=null;if(u.preType==="mouseenter"||u.preType==="mouseleave")k.type=u.preType,(c=e(k.relatedTarget).closest(u.selector)[0])&&e.contains(f,c)&&(c=f);(!c||c!==f)&&o.push({elem:f,
+handleObj:u,level:l.level})}}for(h=0,j=o.length;h<j;h++){d=o[h];if(b&&d.level>b)break;k.currentTarget=d.elem;k.data=d.handleObj.data;k.handleObj=d.handleObj;m=d.handleObj.origHandler.apply(d.elem,arguments);if(m===!1||k.isPropagationStopped())if(b=d.level,m===!1&&(a=!1),k.isImmediatePropagationStopped())break}return a}}function n(k,a){return(k&&k!=="*"?k+".":"")+a.replace(ja,"`").replace(Xa,"&")}function q(k,a,b){a=a||0;if(e.isFunction(a))return e.grep(k,function(k,c){return!!a.call(k,c,k)===b});
+else if(a.nodeType)return e.grep(k,function(k){return k===a===b});else if(typeof a==="string"){var c=e.grep(k,function(k){return k.nodeType===1});if(Ya.test(a))return e.filter(a,c,!b);else a=e.filter(a,c)}return e.grep(k,function(k){return e.inArray(k,a)>=0===b})}function p(k,a){if(a.nodeType===1&&e.hasData(k)){var b=e.expando,c=e.data(k),d=e.data(a,c);if(c=c[b]){var u=c.events,d=d[b]=e.extend({},c);if(u){delete d.handle;d.events={};for(var f in u){b=0;for(c=u[f].length;b<c;b++)e.event.add(a,f+(u[f][b].namespace?
+".":"")+u[f][b].namespace,u[f][b],u[f][b].data)}}}}}function l(k,a){var b;if(a.nodeType===1){a.clearAttributes&&a.clearAttributes();a.mergeAttributes&&a.mergeAttributes(k);b=a.nodeName.toLowerCase();if(b==="object")a.outerHTML=k.outerHTML;else if(b==="input"&&(k.type==="checkbox"||k.type==="radio")){if(k.checked)a.defaultChecked=a.checked=k.checked;if(a.value!==k.value)a.value=k.value}else if(b==="option")a.selected=k.defaultSelected;else if(b==="input"||b==="textarea")a.defaultValue=k.defaultValue;
+a.removeAttribute(e.expando)}}function o(k){return"getElementsByTagName"in k?k.getElementsByTagName("*"):"querySelectorAll"in k?k.querySelectorAll("*"):[]}function E(k){if(k.type==="checkbox"||k.type==="radio")k.defaultChecked=k.checked}function w(k){e.nodeName(k,"input")?E(k):"getElementsByTagName"in k&&e.grep(k.getElementsByTagName("input"),E)}function A(k,a){a.src?e.ajax({url:a.src,async:!1,dataType:"script"}):e.globalEval((a.text||a.textContent||a.innerHTML||"").replace(Za,"/*$0*/"));a.parentNode&&
+a.parentNode.removeChild(a)}function z(k,a,b){var c=a==="width"?k.offsetWidth:k.offsetHeight,d=a==="width"?$a:ab;if(c>0)return b!=="border"&&e.each(d,function(){b||(c-=parseFloat(e.css(k,"padding"+this))||0);b==="margin"?c+=parseFloat(e.css(k,b+this))||0:c-=parseFloat(e.css(k,"border"+this+"Width"))||0}),c+"px";c=aa(k,a,a);if(c<0||c==null)c=k.style[a]||0;c=parseFloat(c)||0;b&&e.each(d,function(){c+=parseFloat(e.css(k,"padding"+this))||0;b!=="padding"&&(c+=parseFloat(e.css(k,"border"+this+"Width"))||
+0);b==="margin"&&(c+=parseFloat(e.css(k,b+this))||0)});return c+"px"}function D(k){return function(a,b){var t;typeof a!=="string"&&(b=a,a="*");if(e.isFunction(b))for(var c=a.toLowerCase().split(Ca),d=0,f=c.length,g,h;d<f;d++)g=c[d],(h=/^\+/.test(g))&&(g=g.substr(1)||"*"),t=k[g]=k[g]||[],g=t,g[h?"unshift":"push"](b)}}function s(k,a,b,e,d,f){d=d||a.dataTypes[0];f=f||{};f[d]=!0;for(var d=k[d],g=0,h=d?d.length:0,j=k===ta,l;g<h&&(j||!l);g++)l=d[g](a,b,e),typeof l==="string"&&(!j||f[l]?l=c:(a.dataTypes.unshift(l),
+l=s(k,a,b,e,l,f)));if((j||!l)&&!f["*"])l=s(k,a,b,e,"*",f);return l}function T(k,a,b,c){if(e.isArray(a))e.each(a,function(a,x){b||bb.test(k)?c(k,x):T(k+"["+(typeof x==="object"||e.isArray(x)?a:"")+"]",x,b,c)});else if(!b&&a!=null&&typeof a==="object")for(var d in a)T(k+"["+d+"]",a[d],b,c);else c(k,a)}function B(){try{return new a.XMLHttpRequest}catch(k){}}function ba(){setTimeout(ca,0);return na=e.now()}function ca(){na=c}function I(a,b){var c={};e.each(Da.concat.apply([],Da.slice(0,b)),function(){c[this]=
+a});return c}function U(a){if(!ua[a]){var b=r.body,c=e("<"+a+">").appendTo(b),d=c.css("display");c.remove();if(d==="none"||d===""){if(!Q)Q=r.createElement("iframe"),Q.frameBorder=Q.width=Q.height=0;b.appendChild(Q);if(!da||!Q.createElement)da=(Q.contentWindow||Q.contentDocument).document,da.write((r.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),da.close();c=da.createElement(a);da.body.appendChild(c);d=e.css(c,"display");b.removeChild(Q)}ua[a]=d}return ua[a]}function S(a){return e.isWindow(a)?
+a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var r=a.document,ea=a.navigator,G=a.location,e=function(){function k(){if(!b.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(k,1);return}b.ready()}}var b=function(a,k){return new b.fn.init(a,k,v)},e=a.jQuery,d=a.$,v,f=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,g=/\S/,h=/^\s+/,j=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,n=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+p=/(?:^|:|,)(?:\s*\[)+/g,H=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,w=/(msie) ([\w.]+)/,J=/(mozilla)(?:.*? rv:([\w.]+))?/,cb=/-([a-z])/ig,C=function(a,k){return k.toUpperCase()},ka=ea.userAgent,oa,fa,db=Object.prototype.toString,va=Object.prototype.hasOwnProperty,wa=Array.prototype.push,A=Array.prototype.slice,O=String.prototype.trim,E=Array.prototype.indexOf,z={};b.fn=b.prototype={constructor:b,init:function(a,k,e){var d;if(!a)return this;if(a.nodeType)return this.context=this[0]=
+a,this.length=1,this;if(a==="body"&&!k&&r.body)return this.context=r,this[0]=r.body,this.selector=a,this.length=1,this;if(typeof a==="string")if((d=a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?[null,a,null]:f.exec(a))&&(d[1]||!k))if(d[1])return e=(k=k instanceof b?k[0]:k)?k.ownerDocument||k:r,(a=m.exec(a))?b.isPlainObject(k)?(a=[r.createElement(a[1])],b.fn.attr.call(a,k,!0)):a=[e.createElement(a[1])]:(a=b.buildFragment([d[1]],[e]),a=(a.cacheable?b.clone(a.fragment):a.fragment).childNodes),
+b.merge(this,a);else{if((k=r.getElementById(d[2]))&&k.parentNode){if(k.id!==d[2])return e.find(a);this.length=1;this[0]=k}this.context=r;this.selector=a;return this}else return!k||k.jquery?(k||e).find(a):this.constructor(k).find(a);else if(b.isFunction(a))return e.ready(a);if(a.selector!==c)this.selector=a.selector,this.context=a.context;return b.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return A.call(this,0)},get:function(a){return a==
+null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,k,c){var e=this.constructor();b.isArray(a)?wa.apply(e,a):b.merge(e,a);e.prevObject=this;e.context=this.context;if(k==="find")e.selector=this.selector+(this.selector?" ":"")+c;else if(k)e.selector=this.selector+"."+k+"("+c+")";return e},each:function(a,k){return b.each(this,a,k)},ready:function(a){b.bindReady();oa.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},
+last:function(){return this.eq(-1)},slice:function(){return this.pushStack(A.apply(this,arguments),"slice",A.call(arguments).join(","))},map:function(a){return this.pushStack(b.map(this,function(k,b){return a.call(k,b,k)}))},end:function(){return this.prevObject||this.constructor(null)},push:wa,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var a,k,e,d,y,t=arguments[0]||{},v=1,f=arguments.length,u=!1;typeof t==="boolean"&&(u=t,t=arguments[1]||{},v=2);typeof t!==
+"object"&&!b.isFunction(t)&&(t={});f===v&&(t=this,--v);for(;v<f;v++)if((a=arguments[v])!=null)for(k in a)e=t[k],d=a[k],t!==d&&(u&&d&&(b.isPlainObject(d)||(y=b.isArray(d)))?(y?(y=!1,e=e&&b.isArray(e)?e:[]):e=e&&b.isPlainObject(e)?e:{},t[k]=b.extend(u,e,d)):d!==c&&(t[k]=d));return t};b.extend({noConflict:function(k){if(a.$===b)a.$=d;if(k&&a.jQuery===b)a.jQuery=e;return b},isReady:!1,readyWait:1,holdReady:function(a){a?b.readyWait++:b.ready(!0)},ready:function(a){if(a===!0&&!--b.readyWait||a!==!0&&!b.isReady){if(!r.body)return setTimeout(b.ready,
+1);b.isReady=!0;a!==!0&&--b.readyWait>0||(oa.resolveWith(r,[b]),b.fn.trigger&&b(r).trigger("ready").unbind("ready"))}},bindReady:function(){if(!oa){oa=b._Deferred();if(r.readyState==="complete")return setTimeout(b.ready,1);if(r.addEventListener)r.addEventListener("DOMContentLoaded",fa,!1),a.addEventListener("load",b.ready,!1);else if(r.attachEvent){r.attachEvent("onreadystatechange",fa);a.attachEvent("onload",b.ready);var c=!1;try{c=a.frameElement==null}catch(e){}r.documentElement.doScroll&&c&&k()}}},
+isFunction:function(a){return b.type(a)==="function"},isArray:Array.isArray||function(a){return b.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):z[db.call(a)]||"object"},isPlainObject:function(a){if(!a||b.type(a)!=="object"||a.nodeType||b.isWindow(a))return!1;if(a.constructor&&!va.call(a,"constructor")&&!va.call(a.constructor.prototype,"isPrototypeOf"))return!1;
+for(var k in a);return k===c||va.call(a,k)},isEmptyObject:function(a){for(var k in a)return!1;return!0},error:function(a){throw a;},parseJSON:function(k){if(typeof k!=="string"||!k)return null;k=b.trim(k);if(a.JSON&&a.JSON.parse)return a.JSON.parse(k);if(o.test(k.replace(n,"@").replace(q,"]").replace(p,"")))return(new Function("return "+k))();b.error("Invalid JSON: "+k)},parseXML:function(k,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(k,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),
+c.async="false",c.loadXML(k));e=c.documentElement;(!e||!e.nodeName||e.nodeName==="parsererror")&&b.error("Invalid XML: "+k);return c},noop:function(){},globalEval:function(k){k&&g.test(k)&&(a.execScript||function(k){a.eval.call(a,k)})(k)},camelCase:function(a){return a.replace(cb,C)},nodeName:function(a,k){return a.nodeName&&a.nodeName.toUpperCase()===k.toUpperCase()},each:function(a,k,e){var d,y=0,t=a.length,v=t===c||b.isFunction(a);if(e)if(v)for(d in a){if(k.apply(a[d],e)===!1)break}else for(;y<
+t;){if(k.apply(a[y++],e)===!1)break}else if(v)for(d in a){if(k.call(a[d],d,a[d])===!1)break}else for(;y<t;)if(k.call(a[y],y,a[y++])===!1)break;return a},trim:O?function(a){return a==null?"":O.call(a)}:function(a){return a==null?"":a.toString().replace(h,"").replace(j,"")},makeArray:function(a,k){var c=k||[];if(a!=null){var e=b.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||b.isWindow(a)?wa.call(c,a):b.merge(c,a)}return c},inArray:function(a,k){if(E)return E.call(k,a);for(var b=
+0,c=k.length;b<c;b++)if(k[b]===a)return b;return-1},merge:function(a,k){var b=a.length,e=0;if(typeof k.length==="number")for(var x=k.length;e<x;e++)a[b++]=k[e];else for(;k[e]!==c;)a[b++]=k[e++];a.length=b;return a},grep:function(a,k,b){for(var c=[],e,b=!!b,x=0,d=a.length;x<d;x++)e=!!k(a[x],x),b!==e&&c.push(a[x]);return c},map:function(a,k,e){var d,y,t=[],v=0,f=a.length;if(a instanceof b||f!==c&&typeof f==="number"&&(f>0&&a[0]&&a[f-1]||f===0||b.isArray(a)))for(;v<f;v++)d=k(a[v],v,e),d!=null&&(t[t.length]=
+d);else for(y in a)d=k(a[y],y,e),d!=null&&(t[t.length]=d);return t.concat.apply([],t)},guid:1,proxy:function(a,k){if(typeof k==="string")var e=a[k],k=a,a=e;if(!b.isFunction(a))return c;var d=A.call(arguments,2),e=function(){return a.apply(k,d.concat(A.call(arguments)))};e.guid=a.guid=a.guid||e.guid||b.guid++;return e},access:function(a,k,e,d,y,t){var v=a.length;if(typeof k==="object"){for(var f in k)b.access(a,f,k[f],d,y,e);return a}if(e!==c){d=!t&&d&&b.isFunction(e);for(f=0;f<v;f++)y(a[f],k,d?e.call(a[f],
+f,y(a[f],k)):e,t);return a}return v?y(a[0],k):c},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();a=H.exec(a)||s.exec(a)||w.exec(a)||a.indexOf("compatible")<0&&J.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},sub:function(){function a(k,b){return new a.fn.init(k,b)}b.extend(!0,a,this);a.superclass=this;a.fn=a.prototype=this();a.fn.constructor=a;a.sub=this.sub;a.fn.init=function(c,e){e&&e instanceof b&&!(e instanceof a)&&(e=a(e));return b.fn.init.call(this,
+c,e,k)};a.fn.init.prototype=a.fn;var k=a(r);return a},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,k){z["[object "+k+"]"]=k.toLowerCase()});ka=b.uaMatch(ka);if(ka.browser)b.browser[ka.browser]=!0,b.browser.version=ka.version;if(b.browser.webkit)b.browser.safari=!0;g.test("\u00a0")&&(h=/^[\s\xA0]+/,j=/[\s\xA0]+$/);v=b(r);r.addEventListener?fa=function(){r.removeEventListener("DOMContentLoaded",fa,!1);b.ready()}:r.attachEvent&&(fa=function(){r.readyState===
+"complete"&&(r.detachEvent("onreadystatechange",fa),b.ready())});return b}(),N="done fail isResolved isRejected promise then always pipe".split(" "),L=[].slice;e.extend({_Deferred:function(){var a=[],b,c,d,v={done:function(){if(!d){var c=arguments,y,f,g,h,j;b&&(j=b,b=0);for(y=0,f=c.length;y<f;y++)g=c[y],h=e.type(g),h==="array"?v.done.apply(v,g):h==="function"&&a.push(g);j&&v.resolveWith(j[0],j[1])}return this},resolveWith:function(e,v){if(!d&&!b&&!c){v=v||[];c=1;try{for(;a[0];)a.shift().apply(e,v)}finally{b=
+[e,v],c=0}}return this},resolve:function(){v.resolveWith(this,arguments);return this},isResolved:function(){return!(!c&&!b)},cancel:function(){d=1;a=[];return this}};return v},Deferred:function(a){var b=e._Deferred(),c=e._Deferred(),d;e.extend(b,{then:function(a,k){b.done(a).fail(k);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,k){return e.Deferred(function(c){e.each({done:[a,
+"resolve"],fail:[k,"reject"]},function(a,k){var d=k[0],y=k[1],t;if(e.isFunction(d))b[a](function(){if((t=d.apply(this,arguments))&&e.isFunction(t.promise))t.promise().then(c.resolve,c.reject);else c[y](t)});else b[a](c[y])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}for(var k=N.length;k--;)a[N[k]]=b[N[k]];return a}});b.done(c.cancel).fail(b.cancel);delete b.cancel;a&&a.call(b,b);return b},when:function(a){function b(a){return function(k){c[a]=arguments.length>1?L.call(arguments,
+0):k;--f||g.resolveWith(g,L.call(c,0))}}var c=arguments,d=0,v=c.length,f=v,g=v<=1&&a&&e.isFunction(a.promise)?a:e.Deferred();if(v>1){for(;d<v;d++)c[d]&&e.isFunction(c[d].promise)?c[d].promise().then(b(d),g.reject):--f;f||g.resolveWith(g,c)}else g!==a&&g.resolveWith(g,v?[a]:[]);return g.promise()}});e.support=function(){var a=r.createElement("div"),b=r.documentElement,c,d,f,g,h,j;a.setAttribute("className","t");a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+c=a.getElementsByTagName("*");d=a.getElementsByTagName("a")[0];if(!c||!c.length||!d)return{};f=r.createElement("select");g=f.appendChild(r.createElement("option"));c=a.getElementsByTagName("input")[0];h={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.55$/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,
+checkOn:c.value==="on",optSelected:g.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0};c.checked=!0;h.noCloneChecked=c.cloneNode(!0).checked;f.disabled=!0;h.optDisabled=!g.disabled;try{delete a.test}catch(l){h.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){h.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick"));
+c=r.createElement("input");c.value="t";c.setAttribute("type","radio");h.radioValue=c.value==="t";c.setAttribute("checked","checked");a.appendChild(c);d=r.createDocumentFragment();d.appendChild(a.firstChild);h.checkClone=d.cloneNode(!0).cloneNode(!0).lastChild.checked;a.innerHTML="";a.style.width=a.style.paddingLeft="1px";f=r.getElementsByTagName("body")[0];d=r.createElement(f?"div":"body");g={visibility:"hidden",width:0,height:0,border:0,margin:0};f&&e.extend(g,{position:"absolute",left:-1E3,top:-1E3});
+for(j in g)d.style[j]=g[j];d.appendChild(a);b=f||b;b.insertBefore(d,b.firstChild);h.appendChecked=c.checked;h.boxModel=a.offsetWidth===2;if("zoom"in a.style)a.style.display="inline",a.style.zoom=1,h.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",h.shrinkWrapBlocks=a.offsetWidth!==2;a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";f=a.getElementsByTagName("td");c=f[0].offsetHeight===0;f[0].style.display=
+"";f[1].style.display="none";h.reliableHiddenOffsets=c&&f[0].offsetHeight===0;a.innerHTML="";if(r.defaultView&&r.defaultView.getComputedStyle)c=r.createElement("div"),c.style.width="0",c.style.marginRight="0",a.appendChild(c),h.reliableMarginRight=(parseInt((r.defaultView.getComputedStyle(c,null)||{marginRight:0}).marginRight,10)||0)===0;d.innerHTML="";b.removeChild(d);if(a.attachEvent)for(j in{submit:1,change:1,focusin:1})b="on"+j,c=b in a,c||(a.setAttribute(b,"return;"),c=typeof a[b]==="function"),
+h[j+"Bubbles"]=c;d=d=f=g=f=c=a=c=null;return h}();e.boxModel=e.support.boxModel;var $=/^(?:\{.*\}|\[.*\])$/,Z=/([a-z])([A-Z])/g;e.extend({cache:{},uuid:0,expando:"jQuery"+(e.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?e.cache[a[e.expando]]:a[e.expando];return!!a&&!b(a)},data:function(a,b,d,t){if(e.acceptData(a)){var f=e.expando,g=typeof b==="string",h=a.nodeType,j=h?e.cache:a,l=h?a[e.expando]:
+a[e.expando]&&e.expando;if(l&&(!t||!l||j[l][f])||!(g&&d===c)){if(!l)h?a[e.expando]=l=++e.uuid:l=e.expando;if(!j[l]&&(j[l]={},!h))j[l].toJSON=e.noop;if(typeof b==="object"||typeof b==="function")t?j[l][f]=e.extend(j[l][f],b):j[l]=e.extend(j[l],b);a=j[l];t&&(a[f]||(a[f]={}),a=a[f]);d!==c&&(a[e.camelCase(b)]=d);return b==="events"&&!a[b]?a[f]&&a[f].events:g?a[e.camelCase(b)]||a[b]:a}}},removeData:function(k,c,d){if(e.acceptData(k)){var t=e.expando,f=k.nodeType,g=f?e.cache:k,h=f?k[e.expando]:e.expando;
+if(g[h]){if(c){var j=d?g[h][t]:g[h];if(j&&(delete j[c],!b(j)))return}if(d&&(delete g[h][t],!b(g[h])))return;c=g[h][t];e.support.deleteExpando||g!=a?delete g[h]:g[h]=null;if(c){g[h]={};if(!f)g[h].toJSON=e.noop;g[h][t]=c}else f&&(e.support.deleteExpando?delete k[e.expando]:k.removeAttribute?k.removeAttribute(e.expando):k[e.expando]=null)}}},_data:function(a,b,c){return e.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=e.noData[a.nodeName.toLowerCase()];if(b)return!(b===!0||a.getAttribute("classid")!==
+b)}return!0}});e.fn.extend({data:function(a,b){var y=null;if(typeof a==="undefined"){if(this.length&&(y=e.data(this[0]),this[0].nodeType===1))for(var t=this[0].attributes,f,g=0,h=t.length;g<h;g++)f=t[g].name,f.indexOf("data-")===0&&(f=e.camelCase(f.substring(5)),d(this[0],f,y[f]));return y}else if(typeof a==="object")return this.each(function(){e.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";return b===c?(y=this.triggerHandler("getData"+j[1]+"!",[j[0]]),y===c&&this.length&&(y=e.data(this[0],
+a),y=d(this[0],a,y)),y===c&&j[1]?this.data(j[0]):y):this.each(function(){var c=e(this),d=[j[0],b];c.triggerHandler("setData"+j[1]+"!",d);e.data(this,a,b);c.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){e.removeData(this,a)})}});e.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",e.data(a,b,(e.data(a,b,c,!0)||0)+1,!0))},_unmark:function(a,b,d){a!==!0&&(d=b,b=a,a=!1);if(b){var d=d||"fx",t=d+"mark";(a=a?0:(e.data(b,t,c,!0)||1)-1)?e.data(b,t,a,!0):(e.removeData(b,
+t,!0),f(b,d,"mark"))}},queue:function(a,b,d){if(a){var b=(b||"fx")+"queue",t=e.data(a,b,c,!0);d&&(!t||e.isArray(d)?t=e.data(a,b,e.makeArray(d),!0):t.push(d));return t||[]}},dequeue:function(a,b){var b=b||"fx",c=e.queue(a,b),d=c.shift();d==="inprogress"&&(d=c.shift());d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){e.dequeue(a,b)}));c.length||(e.removeData(a,b+"queue",!0),f(a,b,"queue"))}});e.fn.extend({queue:function(a,b){typeof a!=="string"&&(b=a,a="fx");return b===c?e.queue(this[0],a):
+this.each(function(){var c=e.queue(this,a,b);a==="fx"&&c[0]!=="inprogress"&&e.dequeue(this,a)})},dequeue:function(a){return this.each(function(){e.dequeue(this,a)})},delay:function(a,b){a=e.fx?e.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){e.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a){function b(){--g||d.resolveWith(t,[t])}typeof a!=="string"&&(a=c);var a=a||"fx",d=e.Deferred(),t=this,f=t.length,g=1,h=
+a+"defer",j=a+"queue";a+="mark";for(var l;f--;)if(l=e.data(t[f],h,c,!0)||(e.data(t[f],j,c,!0)||e.data(t[f],a,c,!0))&&e.data(t[f],h,e._Deferred(),!0))g++,l.done(b);b();return d.promise()}});var R=/[\n\t\r]/g,M=/\s+/,la=/\r/g,ga=/^(?:button|input)$/i,H=/^(?:button|input|object|select|textarea)$/i,J=/^a(?:rea)?$/i,O=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,F=/\:|^on/,P,V;e.fn.extend({attr:function(a,b){return e.access(this,
+a,b,!0,e.attr)},removeAttr:function(a){return this.each(function(){e.removeAttr(this,a)})},prop:function(a,b){return e.access(this,a,b,!0,e.prop)},removeProp:function(a){a=e.propFix[a]||a;return this.each(function(){try{this[a]=c,delete this[a]}catch(b){}})},addClass:function(a){var b,c,d,f,g,h,j;if(e.isFunction(a))return this.each(function(b){e(this).addClass(a.call(this,b,this.className))});if(a&&typeof a==="string"){b=a.split(M);for(c=0,d=this.length;c<d;c++)if(f=this[c],f.nodeType===1)if(!f.className&&
+b.length===1)f.className=a;else{g=" "+f.className+" ";for(h=0,j=b.length;h<j;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");f.className=e.trim(g)}}return this},removeClass:function(a){var b,d,f,g,u,h,j;if(e.isFunction(a))return this.each(function(b){e(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a==="string"||a===c){b=(a||"").split(M);for(d=0,f=this.length;d<f;d++)if(g=this[d],g.nodeType===1&&g.className)if(a){u=(" "+g.className+" ").replace(R," ");for(h=0,j=b.length;h<j;h++)u=u.replace(" "+
+b[h]+" "," ");g.className=e.trim(u)}else g.className=""}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b==="boolean";return e.isFunction(a)?this.each(function(c){e(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string")for(var f,g=0,h=e(this),j=b,l=a.split(M);f=l[g++];)j=d?j:!h.hasClass(f),h[j?"addClass":"removeClass"](f);else if(c==="undefined"||c==="boolean")this.className&&e._data(this,"__className__",this.className),this.className=this.className||
+a===!1?"":e._data(this,"__className__")||""})},hasClass:function(a){for(var a=" "+a+" ",b=0,c=this.length;b<c;b++)if((" "+this[b].className+" ").replace(R," ").indexOf(a)>-1)return!0;return!1},val:function(a){var b,d,f=this[0];if(!arguments.length){if(f){if((b=e.valHooks[f.nodeName.toLowerCase()]||e.valHooks[f.type])&&"get"in b&&(d=b.get(f,"value"))!==c)return d;d=f.value;return typeof d==="string"?d.replace(la,""):d==null?"":d}return c}var g=e.isFunction(a);return this.each(function(d){var y=e(this);
+if(this.nodeType===1&&(d=g?a.call(this,d,y.val()):a,d==null?d="":typeof d==="number"?d+="":e.isArray(d)&&(d=e.map(d,function(a){return a==null?"":a+""})),b=e.valHooks[this.nodeName.toLowerCase()]||e.valHooks[this.type],!b||!("set"in b)||b.set(this,d,"value")===c))this.value=d})}});e.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],f=a.options,a=a.type==="select-one";if(c<0)return null;for(var g=
+a?c:0,h=a?c+1:f.length;g<h;g++)if(b=f[g],b.selected&&(e.support.optDisabled?!b.disabled:b.getAttribute("disabled")===null)&&(!b.parentNode.disabled||!e.nodeName(b.parentNode,"optgroup"))){b=e(b).val();if(a)return b;d.push(b)}return a&&!d.length&&f.length?e(f[c]).val():d},set:function(a,b){var c=e.makeArray(b);e(a).find("option").each(function(){this.selected=e.inArray(e(this).val(),c)>=0});if(!c.length)a.selectedIndex=-1;return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,
+offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,b,d,f){var g=a.nodeType;if(!a||g===3||g===8||g===2)return c;if(f&&b in e.attrFn)return e(a)[b](d);if(!("getAttribute"in a))return e.prop(a,b,d);var h,j;if(f=g!==1||!e.isXMLDoc(a))if(b=e.attrFix[b]||b,j=e.attrHooks[b],!j)if(O.test(b))j=V;else if(P&&b!=="className"&&(e.nodeName(a,"form")||F.test(b)))j=P;return d!==c?d===null?(e.removeAttr(a,b),c):j&&"set"in j&&f&&(h=j.set(a,d,b))!==c?h:(a.setAttribute(b,""+d),d):j&&"get"in j&&f&&(h=j.get(a,b))!==
+null?h:(h=a.getAttribute(b),h===null?c:h)},removeAttr:function(a,b){var c;if(a.nodeType===1&&(b=e.attrFix[b]||b,e.support.getSetAttribute?a.removeAttribute(b):(e.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),O.test(b)&&(c=e.propFix[b]||b)in a))a[c]=!1},attrHooks:{type:{set:function(a,b){if(ga.test(a.nodeName)&&a.parentNode)e.error("type property can't be changed");else if(!e.support.radioValue&&b==="radio"&&e.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b);if(c)a.value=c;
+return b}}},tabIndex:{get:function(a){var b=a.getAttributeNode("tabIndex");return b&&b.specified?parseInt(b.value,10):H.test(a.nodeName)||J.test(a.nodeName)&&a.href?0:c}},value:{get:function(a,b){return P&&e.nodeName(a,"button")?P.get(a,b):b in a?a.value:null},set:function(a,b,c){if(P&&e.nodeName(a,"button"))return P.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",
+rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,b,d){var f=a.nodeType;if(!a||f===3||f===8||f===2)return c;var g,h;if(f!==1||!e.isXMLDoc(a))b=e.propFix[b]||b,h=e.propHooks[b];return d!==c?h&&"set"in h&&(g=h.set(a,d,b))!==c?g:a[b]=d:h&&"get"in h&&(g=h.get(a,b))!==c?g:a[b]},propHooks:{}});V={get:function(a,b){return e.prop(a,b)?b.toLowerCase():c},set:function(a,b,c){b===!1?e.removeAttr(a,c):(b=e.propFix[c]||c,b in a&&(a[b]=
+!0),a.setAttribute(c,c.toLowerCase()));return c}};if(!e.support.getSetAttribute)e.attrFix=e.propFix,P=e.attrHooks.name=e.attrHooks.title=e.valHooks.button={get:function(a,b){var e;return(e=a.getAttributeNode(b))&&e.nodeValue!==""?e.nodeValue:c},set:function(a,b,c){if(a=a.getAttributeNode(c))return a.nodeValue=b}},e.each(["width","height"],function(a,b){e.attrHooks[b]=e.extend(e.attrHooks[b],{set:function(a,k){if(k==="")return a.setAttribute(b,"auto"),k}})});e.support.hrefNormalized||e.each(["href",
+"src","width","height"],function(a,b){e.attrHooks[b]=e.extend(e.attrHooks[b],{get:function(a){a=a.getAttribute(b,2);return a===null?c:a}})});if(!e.support.style)e.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||c},set:function(a,b){return a.style.cssText=""+b}};if(!e.support.optSelected)e.propHooks.selected=e.extend(e.propHooks.selected,{get:function(){}});e.support.checkOn||e.each(["radio","checkbox"],function(){e.valHooks[this]={get:function(a){return a.getAttribute("value")===
+null?"on":a.value}}});e.each(["radio","checkbox"],function(){e.valHooks[this]=e.extend(e.valHooks[this],{set:function(a,b){if(e.isArray(b))return a.checked=e.inArray(e(a).val(),b)>=0}})});var sa=/\.(.*)$/,W=/^(?:textarea|input|select)$/i,ja=/\./g,Xa=/ /g,eb=/[^\w\s.|`]/g,fb=function(a){return a.replace(eb,"\\$&")};e.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(d===!1)d=g;else if(!d)return;var v,h;if(d.handler)v=d,d=v.handler;if(!d.guid)d.guid=e.guid++;if(h=e._data(a)){var j=
+h.events,l=h.handle;if(!j)h.events=j={};if(!l)h.handle=l=function(a){return typeof e!=="undefined"&&(!a||e.event.triggered!==a.type)?e.event.handle.apply(l.elem,arguments):c};l.elem=a;for(var b=b.split(" "),m,o=0,n;m=b[o++];){h=v?e.extend({},v):{handler:d,data:f};m.indexOf(".")>-1?(n=m.split("."),m=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace="");h.type=m;if(!h.guid)h.guid=d.guid;var q=j[m],p=e.event.special[m]||{};if(!q&&(q=j[m]=[],!p.setup||p.setup.call(a,f,n,l)===!1))a.addEventListener?
+a.addEventListener(m,l,!1):a.attachEvent&&a.attachEvent("on"+m,l);if(p.add&&(p.add.call(a,h),!h.handler.guid))h.handler.guid=d.guid;q.push(h);e.event.global[m]=!0}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){d===!1&&(d=g);var v,h,j=0,l,m,o,n,q,p,r=e.hasData(a)&&e._data(a),H=r&&r.events;if(r&&H){if(b&&b.type)d=b.handler,b=b.type;if(!b||typeof b==="string"&&b.charAt(0)===".")for(v in b=b||"",H)e.event.remove(a,v+b);else{for(b=b.split(" ");v=b[j++];)if(n=v,l=v.indexOf(".")<
+0,m=[],l||(m=v.split("."),v=m.shift(),o=RegExp("(^|\\.)"+e.map(m.slice(0).sort(),fb).join("\\.(?:.*\\.)?")+"(\\.|$)")),q=H[v])if(d){n=e.event.special[v]||{};for(h=f||0;h<q.length;h++)if(p=q[h],d.guid===p.guid){if(l||o.test(p.namespace))f==null&&q.splice(h--,1),n.remove&&n.remove.call(a,p);if(f!=null)break}if(q.length===0||f!=null&&q.length===1)(!n.teardown||n.teardown.call(a,m)===!1)&&e.removeEvent(a,v,r.handle),delete H[v]}else for(h=0;h<q.length;h++)if(p=q[h],l||o.test(p.namespace))e.event.remove(a,
+n,p.handler,h),q.splice(h--,1);if(e.isEmptyObject(H)){if(b=r.handle)b.elem=null;delete r.events;delete r.handle;e.isEmptyObject(r)&&e.removeData(a,c,!0)}}}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(b,d,f,g){var h=b.type||b,j=[],l;h.indexOf("!")>=0&&(h=h.slice(0,-1),l=!0);h.indexOf(".")>=0&&(j=h.split("."),h=j.shift(),j.sort());if(f&&!e.event.customEvent[h]||e.event.global[h]){b=typeof b==="object"?b[e.expando]?b:new e.Event(h,b):new e.Event(h);b.type=h;b.exclusive=l;b.namespace=
+j.join(".");b.namespace_re=RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!f)b.preventDefault(),b.stopPropagation();if(f){if(!(f.nodeType===3||f.nodeType===8)){b.result=c;b.target=f;d=d!=null?e.makeArray(d):[];d.unshift(b);j=f;g=h.indexOf(":")<0?"on"+h:"";do{l=e._data(j,"handle");b.currentTarget=j;l&&l.apply(j,d);if(g&&e.acceptData(j)&&j[g]&&j[g].apply(j,d)===!1)b.result=!1,b.preventDefault();j=j.parentNode||j.ownerDocument||j===b.target.ownerDocument&&a}while(j&&!b.isPropagationStopped());
+if(!b.isDefaultPrevented()){var m,j=e.event.special[h]||{};if((!j._default||j._default.call(f.ownerDocument,b)===!1)&&!(h==="click"&&e.nodeName(f,"a"))&&e.acceptData(f)){try{if(g&&f[h])(m=f[g])&&(f[g]=null),e.event.triggered=h,f[h]()}catch(o){}m&&(f[g]=m);e.event.triggered=c}}return b.result}}else e.each(e.cache,function(){var a=this[e.expando];a&&a.events&&a.events[h]&&e.event.trigger(b,d,a.handle.elem)})}},handle:function(b){var b=e.event.fix(b||a.event),d=((e._data(this,"events")||{})[b.type]||
+[]).slice(0),f=!b.exclusive&&!b.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=b;b.currentTarget=this;for(var h=0,j=d.length;h<j;h++){var l=d[h];if(f||b.namespace_re.test(l.namespace)){b.handler=l.handler;b.data=l.data;b.handleObj=l;l=l.handler.apply(this,g);if(l!==c)b.result=l,l===!1&&(b.preventDefault(),b.stopPropagation());if(b.isImmediatePropagationStopped())break}}return b.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+fix:function(a){if(a[e.expando])return a;for(var b=a,a=e.Event(b),d=this.props.length,f;d;)f=this.props[--d],a[f]=b[f];if(!a.target)a.target=a.srcElement||r;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null)d=a.target.ownerDocument||r,b=d.documentElement,d=d.body,a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0),a.pageY=
+a.clientY+(b&&b.scrollTop||d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0);if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==c)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:e.proxy,special:{ready:{setup:e.bindReady,teardown:e.noop},live:{add:function(a){e.event.add(this,n(a.origType,a.selector),e.extend({},a,{handler:m,guid:a.handler.guid}))},remove:function(a){e.event.remove(this,
+n(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){if(e.isWindow(this))this.onbeforeunload=c},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};e.removeEvent=r.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)};e.Event=function(a,b){if(!this.preventDefault)return new e.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||
+a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?h:g):this.type=a;b&&e.extend(this,b);this.timeStamp=e.now();this[e.expando]=!0};e.Event.prototype={preventDefault:function(){this.isDefaultPrevented=h;var a=this.originalEvent;if(a)a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=h;var a=this.originalEvent;if(a)a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=
+h;this.stopPropagation()},isDefaultPrevented:g,isPropagationStopped:g,isImmediatePropagationStopped:g};var Ea=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data;if(b!==this&&(b&&(c=e.contains(this,b)),!c))e.event.handle.apply(this,arguments),a.type=d},Fa=function(a){a.type=a.data;e.event.handle.apply(this,arguments)};e.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){e.event.special[a]={setup:function(c){e.event.add(this,b,c&&c.selector?Fa:Ea,a)},teardown:function(a){e.event.remove(this,
+b,a&&a.selector?Fa:Ea)}}});if(!e.support.submitBubbles)e.event.special.submit={setup:function(){if(e.nodeName(this,"form"))return!1;else e.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&e(b).closest("form").length&&j("submit",this,arguments)}),e.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&e(b).closest("form").length&&a.keyCode===13&&j("submit",this,arguments)})},teardown:function(){e.event.remove(this,
+".specialSubmit")}};if(!e.support.changeBubbles){var ma,Ga=function(a){var b=a.type,c=a.value;if(b==="radio"||b==="checkbox")c=a.checked;else if(b==="select-multiple")c=a.selectedIndex>-1?e.map(a.options,function(a){return a.selected}).join("-"):"";else if(e.nodeName(a,"select"))c=a.selectedIndex;return c},pa=function(a,b){var d=a.target,f,g;if(W.test(d.nodeName)&&!d.readOnly&&(f=e._data(d,"_change_data"),g=Ga(d),(a.type!=="focusout"||d.type!=="radio")&&e._data(d,"_change_data",g),!(f===c||g===f)))if(f!=
+null||g)a.type="change",a.liveFired=c,e.event.trigger(a,b,d)};e.event.special.change={filters:{focusout:pa,beforedeactivate:pa,click:function(a){var b=a.target,c=e.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||e.nodeName(b,"select"))&&pa.call(this,a)},keydown:function(a){var b=a.target,c=e.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!e.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&pa.call(this,a)},beforeactivate:function(a){a=a.target;
+e._data(a,"_change_data",Ga(a))}},setup:function(){if(this.type==="file")return!1;for(var a in ma)e.event.add(this,a+".specialChange",ma[a]);return W.test(this.nodeName)},teardown:function(){e.event.remove(this,".specialChange");return W.test(this.nodeName)}};ma=e.event.special.change.filters;ma.focus=ma.beforeactivate}e.support.focusinBubbles||e.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){var d=e.event.fix(a);d.type=b;d.originalEvent={};e.event.trigger(d,null,d.target);d.isDefaultPrevented()&&
+a.preventDefault()}var d=0;e.event.special[b]={setup:function(){d++===0&&r.addEventListener(a,c,!0)},teardown:function(){--d===0&&r.removeEventListener(a,c,!0)}}});e.each(["bind","one"],function(a,b){e.fn[b]=function(a,d,k){var f;if(typeof a==="object"){for(var g in a)this[b](g,d,a[g],k);return this}if(arguments.length===2||d===!1)k=d,d=c;b==="one"?(f=function(a){e(this).unbind(a,f);return k.apply(this,arguments)},f.guid=k.guid||e.guid++):f=k;if(a==="unload"&&b!=="one")this.one(a,d,k);else{g=0;for(var h=
+this.length;g<h;g++)e.event.add(this[g],a,f,d)}return this}});e.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else{c=0;for(var d=this.length;c<d;c++)e.event.remove(this[c],a,b)}return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){e.event.trigger(a,b,this)})},triggerHandler:function(a,
+b){if(this[0])return e.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||e.guid++,d=0,f=function(c){var f=(e.data(this,"lastToggle"+a.guid)||0)%d;e.data(this,"lastToggle"+a.guid,f+1);c.preventDefault();return b[f].apply(this,arguments)||!1};for(f.guid=c;d<b.length;)b[d++].guid=c;return this.click(f)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var xa={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};e.each(["live","die"],
+function(a,b){e.fn[b]=function(a,d,k,f){var h=0,j,l,m=f||this.selector,o=f?this:e(this.context);if(typeof a==="object"&&!a.preventDefault){for(j in a)o[b](j,d,a[j],m);return this}if(b==="die"&&!a&&f&&f.charAt(0)===".")return o.unbind(f),this;if(d===!1||e.isFunction(d))k=d||g,d=c;for(a=(a||"").split(" ");(f=a[h++])!=null;)if(j=sa.exec(f),l="",j&&(l=j[0],f=f.replace(sa,"")),f==="hover")a.push("mouseenter"+l,"mouseleave"+l);else if(j=f,xa[f]?(a.push(xa[f]+l),f+=l):f=(xa[f]||f)+l,b==="live"){l=0;for(var q=
+o.length;l<q;l++)e.event.add(o[l],"live."+n(f,m),{data:d,selector:m,handler:k,origType:f,origHandler:k,preType:j})}else o.unbind("live."+n(f,m),k);return this}});e.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){e.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)};e.attrFn&&(e.attrFn[b]=
+!0)});(function(){function a(b,c,d,e,k,f){for(var k=0,g=e.length;k<g;k++){var h=e[k];if(h){for(var x=!1,h=h[b];h;){if(h.sizcache===d){x=e[h.sizset];break}if(h.nodeType===1&&!f)h.sizcache=d,h.sizset=k;if(h.nodeName.toLowerCase()===c){x=h;break}h=h[b]}e[k]=x}}}function b(a,c,d,e,k,f){for(var k=0,g=e.length;k<g;k++){var h=e[k];if(h){for(var x=!1,h=h[a];h;){if(h.sizcache===d){x=e[h.sizset];break}if(h.nodeType===1){if(!f)h.sizcache=d,h.sizset=k;if(typeof c!=="string"){if(h===c){x=!0;break}}else if(o.filter(c,
+[h]).length>0){x=h;break}}h=h[a]}e[k]=x}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,f=0,g=Object.prototype.toString,h=!1,j=!0,l=/\\/g,m=/\W/;[0,0].sort(function(){j=!1;return 0});var o=function(a,b,c,e){var c=c||[],k=b=b||r;if(b.nodeType!==1&&b.nodeType!==9)return[];if(!a||typeof a!=="string")return c;var f,h,x,t,j,l=!0,m=o.isXML(b),u=[],Ba=a;do if(d.exec(""),f=d.exec(Ba))if(Ba=f[3],u.push(f[1]),f[2]){t=
+f[3];break}while(f);if(u.length>1&&q.exec(a))if(u.length===2&&n.relative[u[0]])h=O(u[0]+u[1],b);else for(h=n.relative[u[0]]?[b]:o(u.shift(),b);u.length;)a=u.shift(),n.relative[a]&&(a+=u.shift()),h=O(a,h);else if(!e&&u.length>1&&b.nodeType===9&&!m&&n.match.ID.test(u[0])&&!n.match.ID.test(u[u.length-1])&&(f=o.find(u.shift(),b,m),b=f.expr?o.filter(f.expr,f.set)[0]:f.set[0]),b){f=e?{expr:u.pop(),set:s(e)}:o.find(u.pop(),u.length===1&&(u[0]==="~"||u[0]==="+")&&b.parentNode?b.parentNode:b,m);h=f.expr?o.filter(f.expr,
+f.set):f.set;for(u.length>0?x=s(h):l=!1;u.length;)f=j=u.pop(),n.relative[j]?f=u.pop():j="",f==null&&(f=b),n.relative[j](x,f,m)}else x=[];x||(x=h);x||o.error(j||a);if(g.call(x)==="[object Array]")if(l)if(b&&b.nodeType===1)for(a=0;x[a]!=null;a++)x[a]&&(x[a]===!0||x[a].nodeType===1&&o.contains(b,x[a]))&&c.push(h[a]);else for(a=0;x[a]!=null;a++)x[a]&&x[a].nodeType===1&&c.push(h[a]);else c.push.apply(c,x);else s(x,c);t&&(o(t,k,c,e),o.uniqueSort(c));return c};o.uniqueSort=function(a){if(A&&(h=j,a.sort(A),
+h))for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1);return a};o.matches=function(a,b){return o(a,null,null,b)};o.matchesSelector=function(a,b){return o(b,null,null,[a]).length>0};o.find=function(a,b,c){var d;if(!a)return[];for(var e=0,k=n.order.length;e<k;e++){var f,g=n.order[e];if(f=n.leftMatch[g].exec(a)){var h=f[1];f.splice(1,1);if(h.substr(h.length-1)!=="\\"&&(f[1]=(f[1]||"").replace(l,""),d=n.find[g](f,b,c),d!=null)){a=a.replace(n.match[g],"");break}}}d||(d=typeof b.getElementsByTagName!==
+"undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}};o.filter=function(a,b,d,e){for(var k,f,g=a,h=[],x=b,t=b&&b[0]&&o.isXML(b[0]);a&&b.length;){for(var j in n.filter)if((k=n.leftMatch[j].exec(a))!=null&&k[2]){var y,v,l=n.filter[j];v=k[1];f=!1;k.splice(1,1);if(v.substr(v.length-1)!=="\\"){x===h&&(h=[]);if(n.preFilter[j])if(k=n.preFilter[j](k,x,d,h,e,t)){if(k===!0)continue}else f=y=!0;if(k)for(var u=0;(v=x[u])!=null;u++)if(v){y=l(v,k,u,x);var m=e^!!y;d&&y!=null?m?f=!0:x[u]=!1:m&&(h.push(v),
+f=!0)}if(y!==c){d||(x=h);a=a.replace(n.match[j],"");if(!f)return[];break}}}if(a===g)if(f==null)o.error(a);else break;g=a}return x};o.error=function(a){throw"Syntax error, unrecognized expression: "+a;};var n=o.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
+TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=
+typeof b==="string",d=c&&!m.test(b),c=c&&!d;d&&(b=b.toLowerCase());for(var d=0,e=a.length,k;d<e;d++)if(k=a[d]){for(;(k=k.previousSibling)&&k.nodeType!==1;);a[d]=c||k&&k.nodeName.toLowerCase()===b?k||!1:k===b}c&&o.filter(b,a,!0)},">":function(a,b){var c,d=typeof b==="string",e=0,k=a.length;if(d&&!m.test(b))for(b=b.toLowerCase();e<k;e++){if(c=a[e])c=c.parentNode,a[e]=c.nodeName.toLowerCase()===b?c:!1}else{for(;e<k;e++)(c=a[e])&&(a[e]=d?c.parentNode:c.parentNode===b);d&&o.filter(b,a,!0)}},"":function(c,
+d,e){var g,h=f++,j=b;typeof d==="string"&&!m.test(d)&&(g=d=d.toLowerCase(),j=a);j("parentNode",d,h,c,g,e)},"~":function(c,d,e){var g,h=f++,j=b;typeof d==="string"&&!m.test(d)&&(g=d=d.toLowerCase(),j=a);j("previousSibling",d,h,c,g,e)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c)return(a=b.getElementById(a[1]))&&a.parentNode?[a]:[]},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){for(var c=[],d=b.getElementsByName(a[1]),e=0,k=d.length;e<k;e++)d[e].getAttribute("name")===
+a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,k){a=" "+a[1].replace(l,"")+" ";if(k)return a;for(var k=0,f;(f=b[k])!=null;k++)f&&(e^(f.className&&(" "+f.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(f):c&&(b[k]=!1));return!1},ID:function(a){return a[1].replace(l,"")},TAG:function(a){return a[1].replace(l,"").toLowerCase()},CHILD:function(a){if(a[1]===
+"nth"){a[2]||o.error(a[0]);a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0;a[3]=b[3]-0}else a[2]&&o.error(a[0]);a[0]=f++;return a},ATTR:function(a,b,c,d,e,k){b=a[1]=a[1].replace(l,"");!k&&n.attrMap[b]&&(a[1]=n.attrMap[b]);a[4]=(a[4]||a[5]||"").replace(l,"");a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(a,b,c,e,k){if(a[1]==="not")if((d.exec(a[3])||"").length>1||
+/^\w/.test(a[3]))a[3]=o(a[3],null,null,b);else return a=o.filter(a[3],b,c,1^k),c||e.push.apply(e,a),!1;else if(n.match.POS.test(a[0])||n.match.CHILD.test(a[0]))return!0;return a},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},
+has:function(a,b,c){return!!o(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()===
+"input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===
+a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],k=n.filters[e];if(k)return k(a,c,b,d);else if(e==="contains")return(a.textContent||a.innerText||o.getText([a])||"").indexOf(b[3])>=
+0;else if(e==="not"){b=b[3];c=0;for(d=b.length;c<d;c++)if(b[c]===a)return!1;return!0}else o.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case "only":case "first":for(;d=d.previousSibling;)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case "last":for(;d=d.nextSibling;)if(d.nodeType===1)return!1;return!0;case "nth":var c=b[2],e=b[3];if(c===1&&e===0)return!0;var k=b[0],f=a.parentNode;if(f&&(f.sizcache!==k||!a.nodeIndex)){for(var g=0,d=f.firstChild;d;d=d.nextSibling)if(d.nodeType===
+1)d.nodeIndex=++g;f.sizcache=k}d=a.nodeIndex-e;return c===0?d===0:d%c===0&&d/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],c=n.attrHandle[c]?n.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),d=c+"",e=b[2],k=b[4];return c==null?e==="!=":e==="="?d===k:e==="*="?d.indexOf(k)>=
+0:e==="~="?(" "+d+" ").indexOf(k)>=0:!k?d&&c!==!1:e==="!="?d!==k:e==="^="?d.indexOf(k)===0:e==="$="?d.substr(d.length-k.length)===k:e==="|="?d===k||d.substr(0,k.length+1)===k+"-":!1},POS:function(a,b,c,d){var e=n.setFilters[b[2]];if(e)return e(a,c,b,d)}}},q=n.match.POS,p=function(a,b){return"\\"+(b-0+1)},H;for(H in n.match)n.match[H]=RegExp(n.match[H].source+/(?![^\[]*\])(?![^\(]*\))/.source),n.leftMatch[H]=RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[H].source.replace(/\\(\d+)/g,p));var s=function(a,
+b){a=Array.prototype.slice.call(a,0);return b?(b.push.apply(b,a),b):a};try{Array.prototype.slice.call(r.documentElement.childNodes,0)}catch(w){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var A,J;r.documentElement.compareDocumentPosition?A=function(a,b){return a===b?(h=!0,0):!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition?
+-1:1:a.compareDocumentPosition(b)&4?-1:1}:(A=function(a,b){if(a===b)return h=!0,0;else if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],k=[];c=a.parentNode;d=b.parentNode;var f=c;if(c===d)return J(a,b);else if(c){if(!d)return 1}else return-1;for(;f;)e.unshift(f),f=f.parentNode;for(f=d;f;)k.unshift(f),f=f.parentNode;c=e.length;d=k.length;for(f=0;f<c&&f<d;f++)if(e[f]!==k[f])return J(e[f],k[f]);return f===c?J(a,k[f],-1):J(e[f],b,1)},J=function(a,b,c){if(a===b)return c;
+for(a=a.nextSibling;a;){if(a===b)return-1;a=a.nextSibling}return 1});o.getText=function(a){for(var b="",c,d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=o.getText(c.childNodes));return b};(function(){var a=r.createElement("div"),b="script"+(new Date).getTime(),d=r.documentElement;a.innerHTML="<a name='"+b+"'/>";d.insertBefore(a,d.firstChild);if(r.getElementById(b))n.find.ID=function(a,b,d){if(typeof b.getElementById!=="undefined"&&!d)return(b=b.getElementById(a[1]))?
+b.id===a[1]||typeof b.getAttributeNode!=="undefined"&&b.getAttributeNode("id").nodeValue===a[1]?[b]:c:[]},n.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b};d.removeChild(a);d=a=null})();(function(){var a=r.createElement("div");a.appendChild(r.createComment(""));if(a.getElementsByTagName("*").length>0)n.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){for(var d=[],e=0;c[e];e++)c[e].nodeType===
+1&&d.push(c[e]);c=d}return c};a.innerHTML="<a href='#'></a>";if(a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(a){return a.getAttribute("href",2)};a=null})();r.querySelectorAll&&function(){var a=o,b=r.createElement("div");b.innerHTML="<p class='TEST'></p>";if(!(b.querySelectorAll&&b.querySelectorAll(".TEST").length===0)){o=function(b,c,d,e){c=c||r;if(!e&&!o.isXML(c)){var k=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);
+if(k&&(c.nodeType===1||c.nodeType===9))if(k[1])return s(c.getElementsByTagName(b),d);else if(k[2]&&n.find.CLASS&&c.getElementsByClassName)return s(c.getElementsByClassName(k[2]),d);if(c.nodeType===9){if(b==="body"&&c.body)return s([c.body],d);else if(k&&k[3]){var f=c.getElementById(k[3]);if(f&&f.parentNode){if(f.id===k[3])return s([f],d)}else return s([],d)}try{return s(c.querySelectorAll(b),d)}catch(g){}}else if(c.nodeType===1&&c.nodeName.toLowerCase()!=="object"){var k=c,h=(f=c.getAttribute("id"))||
+"__sizzle__",x=c.parentNode,t=/^\s*[+~]/.test(b);f?h=h.replace(/'/g,"\\$&"):c.setAttribute("id",h);if(t&&x)c=c.parentNode;try{if(!t||x)return s(c.querySelectorAll("[id='"+h+"'] "+b),d)}catch(j){}finally{f||k.removeAttribute("id")}}}return a(b,c,d,e)};for(var c in a)o[c]=a[c];b=null}}();(function(){var a=r.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var c=!b.call(r.createElement("div"),"div"),d=!1;try{b.call(r.documentElement,"[test!='']:sizzle")}catch(e){d=
+!0}o.matchesSelector=function(a,e){e=e.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!o.isXML(a))try{if(d||!n.match.PSEUDO.test(e)&&!/!=/.test(e)){var k=b.call(a,e);if(k||!c||a.document&&a.document.nodeType!==11)return k}}catch(f){}return o(e,null,null,[a]).length>0}}})();(function(){var a=r.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0&&(a.lastChild.className="e",a.getElementsByClassName("e").length!==
+1))n.order.splice(1,0,"CLASS"),n.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null})();o.contains=r.documentElement.contains?function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:r.documentElement.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16)}:function(){return!1};o.isXML=function(a){return(a=(a?a.ownerDocument||a:0).documentElement)?a.nodeName!=="HTML":!1};var O=function(a,b){for(var c,
+d=[],e="",k=b.nodeType?[b]:b;c=n.match.PSEUDO.exec(a);)e+=c[0],a=a.replace(n.match.PSEUDO,"");a=n.relative[a]?a+"*":a;c=0;for(var f=k.length;c<f;c++)o(a,k[c],d);return o.filter(e,d)};e.find=o;e.expr=o.selectors;e.expr[":"]=e.expr.filters;e.unique=o.uniqueSort;e.text=o.getText;e.isXMLDoc=o.isXML;e.contains=o.contains})();var gb=/Until$/,hb=/^(?:parents|prevUntil|prevAll)/,ib=/,/,Ya=/^.[^:#\[\.,]*$/,jb=Array.prototype.slice,Ha=e.expr.match.POS,kb={children:!0,contents:!0,next:!0,prev:!0};e.fn.extend({find:function(a){var b=
+this,c,d;if(typeof a!=="string")return e(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(e.contains(b[c],this))return!0});var f=this.pushStack("","find",a),g,h,j;for(c=0,d=this.length;c<d;c++)if(g=f.length,e.find(a,this[c],f),c>0)for(h=g;h<f.length;h++)for(j=0;j<g;j++)if(f[j]===f[h]){f.splice(h--,1);break}return f},has:function(a){var b=e(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(e.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(q(this,a,!1),"not",
+a)},filter:function(a){return this.pushStack(q(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a==="string"?e.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,f,g=this[0];if(e.isArray(a)){var h,j={},l=1;if(g&&a.length){for(d=0,f=a.length;d<f;d++)h=a[d],j[h]||(j[h]=Ha.test(h)?e(h,b||this.context):h);for(;g&&g.ownerDocument&&g!==b;){for(h in j)d=j[h],(d.jquery?d.index(g)>-1:e(g).is(d))&&c.push({selector:h,elem:g,level:l});g=g.parentNode;l++}}return c}h=Ha.test(a)||
+typeof a!=="string"?e(a,b||this.context):0;for(d=0,f=this.length;d<f;d++)for(g=this[d];g;)if(h?h.index(g)>-1:e.find.matchesSelector(g,a)){c.push(g);break}else if(g=g.parentNode,!g||!g.ownerDocument||g===b||g.nodeType===11)break;c=c.length>1?e.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){return!a||typeof a==="string"?e.inArray(this[0],a?e(a):this.parent().children()):e.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?e(a,b):e.makeArray(a&&a.nodeType?
+[a]:a),d=e.merge(this.get(),c);return this.pushStack(!c[0]||!c[0].parentNode||c[0].parentNode.nodeType===11||!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11?d:e.unique(d))},andSelf:function(){return this.add(this.prevObject)}});e.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return e.dir(a,"parentNode")},parentsUntil:function(a,b,c){return e.dir(a,"parentNode",c)},next:function(a){return e.nth(a,2,"nextSibling")},prev:function(a){return e.nth(a,
+2,"previousSibling")},nextAll:function(a){return e.dir(a,"nextSibling")},prevAll:function(a){return e.dir(a,"previousSibling")},nextUntil:function(a,b,c){return e.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return e.dir(a,"previousSibling",c)},siblings:function(a){return e.sibling(a.parentNode.firstChild,a)},children:function(a){return e.sibling(a.firstChild)},contents:function(a){return e.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:e.makeArray(a.childNodes)}},function(a,
+b){e.fn[a]=function(c,d){var f=e.map(this,b,c),g=jb.call(arguments);gb.test(a)||(d=c);d&&typeof d==="string"&&(f=e.filter(d,f));f=this.length>1&&!kb[a]?e.unique(f):f;if((this.length>1||ib.test(d))&&hb.test(a))f=f.reverse();return this.pushStack(f,a,g.join(","))}});e.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?e.find.matchesSelector(b[0],a)?[b[0]]:[]:e.find.matches(a,b)},dir:function(a,b,d){for(var f=[],a=a[b];a&&a.nodeType!==9&&(d===c||a.nodeType!==1||!e(a).is(d));)a.nodeType===
+1&&f.push(a),a=a[b];return f},nth:function(a,b,c){for(var b=b||1,d=0;a;a=a[c])if(a.nodeType===1&&++d===b)break;return a},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var lb=/ jQuery\d+="(?:\d+|null)"/g,ya=/^\s+/,Ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ja=/<([\w:]+)/,mb=/<tbody/i,nb=/<|&#?\w+;/,Ka=/<(?:script|object|embed|option|style)/i,La=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/\/(java|ecma)script/i,Za=/^\s*<!(?:\[CDATA\[|\-\-)/,
+K={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};K.optgroup=K.option;K.tbody=K.tfoot=K.colgroup=K.caption=K.thead;K.th=K.td;if(!e.support.htmlSerialize)K._default=[1,"div<div>","</div>"];e.fn.extend({text:function(a){return e.isFunction(a)?
+this.each(function(b){var c=e(this);c.text(a.call(this,b,c.text()))}):typeof a!=="object"&&a!==c?this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(a)):e.text(this)},wrapAll:function(a){if(e.isFunction(a))return this.each(function(b){e(this).wrapAll(a.call(this,b))});if(this[0]){var b=e(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var a=this;a.firstChild&&a.firstChild.nodeType===1;)a=a.firstChild;return a}).append(this)}return this},
+wrapInner:function(a){return e.isFunction(a)?this.each(function(b){e(this).wrapInner(a.call(this,b))}):this.each(function(){var b=e(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){e(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){e.nodeName(this,"body")||e(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,
+!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});else if(arguments.length){var a=e(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});else if(arguments.length){var a=
+this.pushStack(this,"after",arguments);a.push.apply(a,e(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||e.filter(a,[d]).length)!b&&d.nodeType===1&&(e.cleanData(d.getElementsByTagName("*")),e.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&e.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a,b){a=
+a==null?!1:a;b=b==null?a:b;return this.map(function(){return e.clone(this,a,b)})},html:function(a){if(a===c)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(lb,""):null;else if(typeof a==="string"&&!Ka.test(a)&&(e.support.leadingWhitespace||!ya.test(a))&&!K[(Ja.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ia,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1)e.cleanData(this[b].getElementsByTagName("*")),this[b].innerHTML=a}catch(f){this.empty().append(a)}}else e.isFunction(a)?
+this.each(function(b){var c=e(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(e.isFunction(a))return this.each(function(b){var c=e(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!=="string"&&(a=e(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;e(this).remove();b?e(b).before(a):e(c).append(a)})}else return this.length?this.pushStack(e(e.isFunction(a)?a():a),"replaceWith",
+a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,b,d){var f,g,h,j=a[0],l=[];if(!e.support.checkClone&&arguments.length===3&&typeof j==="string"&&La.test(j))return this.each(function(){e(this).domManip(a,b,d,!0)});if(e.isFunction(j))return this.each(function(f){var g=e(this);a[0]=j.call(this,f,b?g.html():c);g.domManip(a,b,d)});if(this[0]){f=j&&j.parentNode;f=e.support.parentNode&&f&&f.nodeType===11&&f.childNodes.length===this.length?{fragment:f}:e.buildFragment(a,this,l);h=
+f.fragment;if(g=h.childNodes.length===1?h=h.firstChild:h.firstChild){b=b&&e.nodeName(g,"tr");g=0;for(var m=this.length,o=m-1;g<m;g++)d.call(b?e.nodeName(this[g],"table")?this[g].getElementsByTagName("tbody")[0]||this[g].appendChild(this[g].ownerDocument.createElement("tbody")):this[g]:this[g],f.cacheable||m>1&&g<o?e.clone(h,!0,!0):h)}l.length&&e.each(l,A)}return this}});e.buildFragment=function(a,b,c){var d,f,g,h;b&&b[0]&&(h=b[0].ownerDocument||b[0]);h.createDocumentFragment||(h=r);if(a.length===
+1&&typeof a[0]==="string"&&a[0].length<512&&h===r&&a[0].charAt(0)==="<"&&!Ka.test(a[0])&&(e.support.checkClone||!La.test(a[0])))f=!0,(g=e.fragments[a[0]])&&g!==1&&(d=g);d||(d=h.createDocumentFragment(),e.clean(a,h,d,c));f&&(e.fragments[a[0]]=g?d:1);return{fragment:d,cacheable:f}};e.fragments={};e.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){e.fn[a]=function(c){var d=[],c=e(c),f=this.length===1&&this[0].parentNode;if(f&&
+f.nodeType===11&&f.childNodes.length===1&&c.length===1)return c[b](this[0]),this;else{for(var f=0,g=c.length;f<g;f++){var h=(f>0?this.clone(!0):this).get();e(c[f])[b](h);d=d.concat(h)}return this.pushStack(d,a,c.selector)}}});e.extend({clone:function(a,b,c){var d=a.cloneNode(!0),f,g,h;if((!e.support.noCloneEvent||!e.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!e.isXMLDoc(a)){l(a,d);f=o(a);g=o(d);for(h=0;f[h];++h)l(f[h],g[h])}if(b&&(p(a,d),c)){f=o(a);g=o(d);for(h=0;f[h];++h)p(f[h],
+g[h])}return d},clean:function(a,b,c,d){b=b||r;typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||r);for(var f=[],g,h=0,j;(j=a[h])!=null;h++)if(typeof j==="number"&&(j+=""),j){if(typeof j==="string")if(nb.test(j)){j=j.replace(Ia,"<$1></$2>");g=(Ja.exec(j)||["",""])[1].toLowerCase();var l=K[g]||K._default,m=l[0],o=b.createElement("div");for(o.innerHTML=l[1]+j+l[2];m--;)o=o.lastChild;if(!e.support.tbody){m=mb.test(j);l=g==="table"&&!m?o.firstChild&&o.firstChild.childNodes:
+l[1]==="<table>"&&!m?o.childNodes:[];for(g=l.length-1;g>=0;--g)e.nodeName(l[g],"tbody")&&!l[g].childNodes.length&&l[g].parentNode.removeChild(l[g])}!e.support.leadingWhitespace&&ya.test(j)&&o.insertBefore(b.createTextNode(ya.exec(j)[0]),o.firstChild);j=o.childNodes}else j=b.createTextNode(j);var n;if(!e.support.appendChecked)if(j[0]&&typeof(n=j.length)==="number")for(g=0;g<n;g++)w(j[g]);else w(j);j.nodeType?f.push(j):f=e.merge(f,j)}if(c){a=function(a){return!a.type||ob.test(a.type)};for(h=0;f[h];h++)d&&
+e.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript")?d.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]):(f[h].nodeType===1&&(b=e.grep(f[h].getElementsByTagName("script"),a),f.splice.apply(f,[h+1,0].concat(b))),c.appendChild(f[h]))}return f},cleanData:function(a){for(var b,c,d=e.cache,f=e.expando,g=e.event.special,h=e.support.deleteExpando,j=0,l;(l=a[j])!=null;j++)if(!l.nodeName||!e.noData[l.nodeName.toLowerCase()])if(c=l[e.expando]){if((b=d[c]&&d[c][f])&&
+b.events){for(var o in b.events)g[o]?e.event.remove(l,o):e.removeEvent(l,o,b.handle);if(b.handle)b.handle.elem=null}h?delete l[e.expando]:l.removeAttribute&&l.removeAttribute(e.expando);delete d[c]}}});var Ma=/alpha\([^)]*\)/i,pb=/opacity=([^)]*)/,qb=/([A-Z]|^ms)/g,Na=/^-?\d+(?:px)?$/i,rb=/^-?\d/,sb=/^[+\-]=/,tb=/[^+\-\.\de]+/g,ub={position:"absolute",visibility:"hidden",display:"block"},$a=["Left","Right"],ab=["Top","Bottom"],aa,Oa,Pa;e.fn.css=function(a,b){return arguments.length===2&&b===c?this:
+e.access(this,a,b,!0,function(a,b,d){return d!==c?e.style(a,b,d):e.css(a,b)})};e.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=aa(a,"opacity","opacity");return c===""?"1":c}else return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":e.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,f){if(a&&!(a.nodeType===3||a.nodeType===8||!a.style)){var g,h=e.camelCase(b),j=a.style,l=e.cssHooks[h],
+b=e.cssProps[h]||h;if(d!==c){if(f=typeof d,!(f==="number"&&isNaN(d)||d==null))if(f==="string"&&sb.test(d)&&(d=+d.replace(tb,"")+parseFloat(e.css(a,b)),f="number"),f==="number"&&!e.cssNumber[h]&&(d+="px"),!l||!("set"in l)||(d=l.set(a,d))!==c)try{j[b]=d}catch(o){}}else return l&&"get"in l&&(g=l.get(a,!1,f))!==c?g:j[b]}},css:function(a,b,d){var f,g,b=e.camelCase(b);g=e.cssHooks[b];b=e.cssProps[b]||b;b==="cssFloat"&&(b="float");if(g&&"get"in g&&(f=g.get(a,!0,d))!==c)return f;else if(aa)return aa(a,b)},
+swap:function(a,b,c){var d={},e;for(e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}});e.curCSS=e.css;e.each(["height","width"],function(a,b){e.cssHooks[b]={get:function(a,c,d){var f;if(c){if(a.offsetWidth!==0)return z(a,b,d);else e.swap(a,ub,function(){f=z(a,b,d)});return f}},set:function(a,b){if(Na.test(b)){if(b=parseFloat(b),b>=0)return b+"px"}else return b}}});if(!e.support.opacity)e.cssHooks.opacity={get:function(a,b){return pb.test((b&&a.currentStyle?a.currentStyle.filter:
+a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var f=e.isNaN(b)?"":"alpha(opacity="+b*100+")",d=d&&d.filter||c.filter||"";c.filter=Ma.test(d)?d.replace(Ma,f):d+" "+f}};e(function(){if(!e.support.reliableMarginRight)e.cssHooks.marginRight={get:function(a,b){var c;e.swap(a,{display:"inline-block"},function(){c=b?aa(a,"margin-right","marginRight"):a.style.marginRight});return c}}});r.defaultView&&r.defaultView.getComputedStyle&&(Oa=
+function(a,b){var d,f,b=b.replace(qb,"-$1").toLowerCase();if(!(f=a.ownerDocument.defaultView))return c;if(f=f.getComputedStyle(a,null))d=f.getPropertyValue(b),d===""&&!e.contains(a.ownerDocument.documentElement,a)&&(d=e.style(a,b));return d});r.documentElement.currentStyle&&(Pa=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;if(!Na.test(d)&&rb.test(d)){c=f.left;if(e)a.runtimeStyle.left=a.currentStyle.left;f.left=b==="fontSize"?"1em":d||0;d=f.pixelLeft+
+"px";f.left=c;if(e)a.runtimeStyle.left=e}return d===""?"auto":d});aa=Oa||Pa;if(e.expr&&e.expr.filters)e.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!e.support.reliableHiddenOffsets&&(a.style.display||e.css(a,"display"))==="none"},e.expr.filters.visible=function(a){return!e.expr.filters.hidden(a)};var vb=/%20/g,bb=/\[\]$/,Qa=/\r?\n/g,wb=/#.*$/,xb=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,yb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
+zb=/^(?:GET|HEAD)$/,Ab=/^\/\//,Ra=/\?/,Bb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Cb=/^(?:select|textarea)/i,Ca=/\s+/,Db=/([?&])_=[^&]*/,Sa=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,Ta=e.fn.load,ta={},Ua={},X,Y;try{X=G.href}catch(Jb){X=r.createElement("a"),X.href="",X=X.href}Y=Sa.exec(X.toLowerCase())||[];e.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ta)return Ta.apply(this,arguments);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0)var g=a.slice(f,a.length),
+a=a.slice(0,f);f="GET";b&&(e.isFunction(b)?(d=b,b=c):typeof b==="object"&&(b=e.param(b,e.ajaxSettings.traditional),f="POST"));var h=this;e.ajax({url:a,type:f,dataType:"html",data:b,complete:function(a,b,c){c=a.responseText;a.isResolved()&&(a.done(function(a){c=a}),h.html(g?e("<div>").append(c.replace(Bb,"")).find(g):c));d&&h.each(d,[c,b,a])}});return this},serialize:function(){return e.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?e.makeArray(this.elements):
+this}).filter(function(){return this.name&&!this.disabled&&(this.checked||Cb.test(this.nodeName)||yb.test(this.type))}).map(function(a,b){var c=e(this).val();return c==null?null:e.isArray(c)?e.map(c,function(a){return{name:b.name,value:a.replace(Qa,"\r\n")}}):{name:b.name,value:c.replace(Qa,"\r\n")}}).get()}});e.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){e.fn[b]=function(a){return this.bind(b,a)}});e.each(["get","post"],function(a,b){e[b]=function(a,
+d,f,k){e.isFunction(d)&&(k=k||f,f=d,d=c);return e.ajax({type:b,url:a,data:d,success:f,dataType:k})}});e.extend({getScript:function(a,b){return e.get(a,c,b,"script")},getJSON:function(a,b,c){return e.get(a,b,c,"json")},ajaxSetup:function(a,b){b?e.extend(!0,a,e.ajaxSettings,b):(b=a,a=e.extend(!0,e.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in e.ajaxSettings&&(a[c]=e.ajaxSettings[c]);return a},ajaxSettings:{url:X,isLocal:/^(?:about|app|app\-storage|.+\-extension|file|widget):$/.test(Y[1]),
+global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":e.parseJSON,"text xml":e.parseXML}},ajaxPrefilter:D(ta),ajaxTransport:D(Ua),ajax:function(a,b){function d(a,b,k,x){if(J!==2){J=
+2;w&&clearTimeout(w);H=c;p=x||"";C.readyState=a?4:0;var n,y,q;if(k){var x=f,r=C,s=x.contents,A=x.dataTypes,E=x.responseFields,z,F,B,ra;for(F in E)F in k&&(r[E[F]]=k[F]);for(;A[0]==="*";)A.shift(),z===c&&(z=x.mimeType||r.getResponseHeader("content-type"));if(z)for(F in s)if(s[F]&&s[F].test(z)){A.unshift(F);break}if(A[0]in k)B=A[0];else{for(F in k){if(!A[0]||x.converters[F+" "+A[0]]){B=F;break}ra||(ra=F)}B=B||ra}B?(B!==A[0]&&A.unshift(B),k=k[B]):k=void 0}else k=c;if(a>=200&&a<300||a===304){if(f.ifModified){if(z=
+C.getResponseHeader("Last-Modified"))e.lastModified[m]=z;if(z=C.getResponseHeader("Etag"))e.etag[m]=z}if(a===304)b="notmodified",n=!0;else try{z=f;z.dataFilter&&(k=z.dataFilter(k,z.dataType));var W=z.dataTypes;F={};var P,D,N=W.length,V,G=W[0],K,ja,I,L,M;for(P=1;P<N;P++){if(P===1)for(D in z.converters)typeof D==="string"&&(F[D.toLowerCase()]=z.converters[D]);K=G;G=W[P];if(G==="*")G=K;else if(K!=="*"&&K!==G){ja=K+" "+G;I=F[ja]||F["* "+G];if(!I)for(L in M=c,F)if(V=L.split(" "),V[0]===K||V[0]==="*")if(M=
+F[V[1]+" "+G]){L=F[L];L===!0?I=M:M===!0&&(I=L);break}!I&&!M&&e.error("No conversion from "+ja.replace(" "," to "));I!==!0&&(k=I?I(k):M(L(k)))}}y=k;b="success";n=!0}catch(Wa){b="parsererror",q=Wa}}else if(q=b,!b||a)b="error",a<0&&(a=0);C.status=a;C.statusText=b;n?j.resolveWith(g,[y,b,C]):j.rejectWith(g,[C,b,q]);C.statusCode(o);o=c;O&&h.trigger("ajax"+(n?"Success":"Error"),[C,f,n?y:q]);l.resolveWith(g,[C,b]);O&&(h.trigger("ajaxComplete",[C,f]),--e.active||e.event.trigger("ajaxStop"))}}typeof a==="object"&&
+(b=a,a=c);var b=b||{},f=e.ajaxSetup({},b),g=f.context||f,h=g!==f&&(g.nodeType||g instanceof e)?e(g):e.event,j=e.Deferred(),l=e._Deferred(),o=f.statusCode||{},m,n={},q={},p,r,H,w,A,J=0,O,E,C={readyState:0,setRequestHeader:function(a,b){if(!J){var c=a.toLowerCase(),a=q[c]=q[c]||a;n[a]=b}return this},getAllResponseHeaders:function(){return J===2?p:null},getResponseHeader:function(a){var b;if(J===2){if(!r)for(r={};b=xb.exec(p);)r[b[1].toLowerCase()]=b[2];b=r[a.toLowerCase()]}return b===c?null:b},overrideMimeType:function(a){if(!J)f.mimeType=
+a;return this},abort:function(a){a=a||"abort";H&&H.abort(a);d(0,a);return this}};j.promise(C);C.success=C.done;C.error=C.fail;C.complete=l.done;C.statusCode=function(a){if(a){var b;if(J<2)for(b in a)o[b]=[o[b],a[b]];else b=a[C.status],C.then(b,b)}return this};f.url=((a||f.url)+"").replace(wb,"").replace(Ab,Y[1]+"//");f.dataTypes=e.trim(f.dataType||"*").toLowerCase().split(Ca);if(f.crossDomain==null)A=Sa.exec(f.url.toLowerCase()),f.crossDomain=!(!A||!(A[1]!=Y[1]||A[2]!=Y[2]||(A[3]||(A[1]==="http:"?
+80:443))!=(Y[3]||(Y[1]==="http:"?80:443))));if(f.data&&f.processData&&typeof f.data!=="string")f.data=e.param(f.data,f.traditional);s(ta,f,b,C);if(J===2)return!1;O=f.global;f.type=f.type.toUpperCase();f.hasContent=!zb.test(f.type);O&&e.active++===0&&e.event.trigger("ajaxStart");if(!f.hasContent&&(f.data&&(f.url+=(Ra.test(f.url)?"&":"?")+f.data),m=f.url,f.cache===!1)){A=e.now();var z=f.url.replace(Db,"$1_="+A);f.url=z+(z===f.url?(Ra.test(f.url)?"&":"?")+"_="+A:"")}(f.data&&f.hasContent&&f.contentType!==
+!1||b.contentType)&&C.setRequestHeader("Content-Type",f.contentType);f.ifModified&&(m=m||f.url,e.lastModified[m]&&C.setRequestHeader("If-Modified-Since",e.lastModified[m]),e.etag[m]&&C.setRequestHeader("If-None-Match",e.etag[m]));C.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+(f.dataTypes[0]!=="*"?", */*; q=0.01":""):f.accepts["*"]);for(E in f.headers)C.setRequestHeader(E,f.headers[E]);if(f.beforeSend&&(f.beforeSend.call(g,C,f)===!1||J===2))return C.abort(),
+!1;for(E in{success:1,error:1,complete:1})C[E](f[E]);if(H=s(Ua,f,b,C)){C.readyState=1;O&&h.trigger("ajaxSend",[C,f]);f.async&&f.timeout>0&&(w=setTimeout(function(){C.abort("timeout")},f.timeout));try{J=1,H.send(n,d)}catch(F){status<2?d(-1,F):e.error(F)}}else d(-1,"No Transport");return C},param:function(a,b){var d=[],f=function(a,b){b=e.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(b===c)b=e.ajaxSettings.traditional;if(e.isArray(a)||a.jquery&&!e.isPlainObject(a))e.each(a,
+function(){f(this.name,this.value)});else for(var g in a)T(g,a[g],b,f);return d.join("&").replace(vb,"+")}});e.extend({active:0,lastModified:{},etag:{}});var Eb=e.now(),qa=/(\=)\?(&|$)|\?\?/i;e.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return e.expando+"_"+Eb++}});e.ajaxPrefilter("json jsonp",function(b,c,d){c=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(qa.test(b.url)||c&&qa.test(b.data))){var f,g=b.jsonpCallback=
+e.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h=a[g],j=b.url,l=b.data,o="$1"+g+"$2";b.jsonp!==!1&&(j=j.replace(qa,o),b.url===j&&(c&&(l=l.replace(qa,o)),b.data===l&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+g)));b.url=j;b.data=l;a[g]=function(a){f=[a]};d.always(function(){a[g]=h;if(f&&e.isFunction(h))a[g](f[0])});b.converters["script json"]=function(){f||e.error(g+" was not called");return f[0]};b.dataTypes[0]="json";return"script"}});e.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},
+contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){e.globalEval(a);return a}}});e.ajaxPrefilter("script",function(a){if(a.cache===c)a.cache=!1;if(a.crossDomain)a.type="GET",a.global=!1});e.ajaxTransport("script",function(a){if(a.crossDomain){var b,d=r.head||r.getElementsByTagName("head")[0]||r.documentElement;return{send:function(e,f){b=r.createElement("script");b.async="async";if(a.scriptCharset)b.charset=a.scriptCharset;b.src=a.url;b.onload=b.onreadystatechange=function(a,
+e){if(e||!b.readyState||/loaded|complete/.test(b.readyState))b.onload=b.onreadystatechange=null,d&&b.parentNode&&d.removeChild(b),b=c,e||f(200,"success")};d.insertBefore(b,d.firstChild)},abort:function(){if(b)b.onload(0,1)}}}});var za=a.ActiveXObject?function(){for(var a in ha)ha[a](0,1)}:!1,Fb=0,ha;e.ajaxSettings.xhr=a.ActiveXObject?function(){var b;if(!(b=!this.isLocal&&B()))a:{try{b=new a.ActiveXObject("Microsoft.XMLHTTP");break a}catch(c){}b=void 0}return b}:B;(function(a){e.extend(e.support,
+{ajax:!!a,cors:!!a&&"withCredentials"in a})})(e.ajaxSettings.xhr());e.support.ajax&&e.ajaxTransport(function(b){if(!b.crossDomain||e.support.cors){var d;return{send:function(f,g){var h=b.xhr(),j,l;b.username?h.open(b.type,b.url,b.async,b.username,b.password):h.open(b.type,b.url,b.async);if(b.xhrFields)for(l in b.xhrFields)h[l]=b.xhrFields[l];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType);!b.crossDomain&&!f["X-Requested-With"]&&(f["X-Requested-With"]="XMLHttpRequest");try{for(l in f)h.setRequestHeader(l,
+f[l])}catch(o){}h.send(b.hasContent&&b.data||null);d=function(a,f){var l,o,m,n,y;try{if(d&&(f||h.readyState===4)){d=c;if(j)h.onreadystatechange=e.noop,za&&delete ha[j];if(f)h.readyState!==4&&h.abort();else{l=h.status;m=h.getAllResponseHeaders();n={};if((y=h.responseXML)&&y.documentElement)n.xml=y;n.text=h.responseText;try{o=h.statusText}catch(q){o=""}!l&&b.isLocal&&!b.crossDomain?l=n.text?200:404:l===1223&&(l=204)}}}catch(p){f||g(-1,p)}n&&g(l,o,n,m)};!b.async||h.readyState===4?d():(j=++Fb,za&&(ha||
+(ha={},e(a).unload(za)),ha[j]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ua={},Q,da,Gb=/^(?:toggle|show|hide)$/,Hb=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ia,Da=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],na,Aa=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;e.fn.extend({show:function(a,b,c){if(a||a===0)return this.animate(I("show",3),a,b,c);else{for(var c=
+0,d=this.length;c<d;c++)if(a=this[c],a.style){b=a.style.display;if(!e._data(a,"olddisplay")&&b==="none")b=a.style.display="";b===""&&e.css(a,"display")==="none"&&e._data(a,"olddisplay",U(a.nodeName))}for(c=0;c<d;c++)if(a=this[c],a.style&&(b=a.style.display,b===""||b==="none"))a.style.display=e._data(a,"olddisplay")||"";return this}},hide:function(a,b,c){if(a||a===0)return this.animate(I("hide",3),a,b,c);else{a=0;for(b=this.length;a<b;a++)this[a].style&&(c=e.css(this[a],"display"),c!=="none"&&!e._data(this[a],
+"olddisplay")&&e._data(this[a],"olddisplay",c));for(a=0;a<b;a++)if(this[a].style)this[a].style.display="none";return this}},_toggle:e.fn.toggle,toggle:function(a,b,c){var d=typeof a==="boolean";e.isFunction(a)&&e.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:e(this).is(":hidden");e(this)[b?"show":"hide"]()}):this.animate(I("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},
+a,c,d)},animate:function(a,b,c,d){var f=e.speed(b,c,d);if(e.isEmptyObject(a))return this.each(f.complete,[!1]);a=e.extend({},a);return this[f.queue===!1?"each":"queue"](function(){var k;f.queue===!1&&e._mark(this);var b=e.extend({},f),c=this.nodeType===1,d=c&&e(this).is(":hidden"),g,h,j,l,o;b.animatedProperties={};for(j in a){g=e.camelCase(j);j!==g&&(a[g]=a[j],delete a[j]);h=a[g];e.isArray(h)?(b.animatedProperties[g]=h[1],k=a[g]=h[0],h=k):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||
+b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);if(c&&(g==="height"||g==="width"))if(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],e.css(this,"display")==="inline"&&e.css(this,"float")==="none")e.support.inlineBlockNeedsLayout?(h=U(this.nodeName),h==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"}if(b.overflow!=null)this.style.overflow="hidden";for(j in a)if(c=
+new e.fx(this,b,j),h=a[j],Gb.test(h))c[h==="toggle"?d?"show":"hide":h]();else g=Hb.exec(h),l=c.cur(),g?(h=parseFloat(g[2]),o=g[3]||(e.cssNumber[j]?"":"px"),o!=="px"&&(e.style(this,j,(h||1)+o),l*=(h||1)/c.cur(),e.style(this,j,l+o)),g[1]&&(h=(g[1]==="-="?-1:1)*h+l),c.custom(l,h,o)):c.custom(l,h,"");return!0})},stop:function(a,b){a&&this.queue([]);this.each(function(){var a=e.timers,c=a.length;for(b||e._unmark(!0,this);c--;)if(a[c].elem===this){if(b)a[c](!0);a.splice(c,1)}});b||this.dequeue();return this}});
+e.each({slideDown:I("show",1),slideUp:I("hide",1),slideToggle:I("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){e.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}});e.extend({speed:function(a,b,c){var d=a&&typeof a==="object"?e.extend({},a):{complete:c||!c&&b||e.isFunction(a)&&a,duration:a,easing:c&&b||b&&!e.isFunction(b)&&b};d.duration=e.fx.off?0:typeof d.duration==="number"?d.duration:d.duration in e.fx.speeds?e.fx.speeds[d.duration]:
+e.fx.speeds._default;d.old=d.complete;d.complete=function(a){e.isFunction(d.old)&&d.old.call(this);d.queue!==!1?e.dequeue(this):a!==!1&&e._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+0.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b;this.elem=a;this.prop=c;b.orig=b.orig||{}}});e.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(e.fx.step[this.prop]||e.fx.step._default)(this)},
+cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=e.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function d(a){return f.step(a)}var f=this,g=e.fx,h;this.startTime=na||ba();this.start=a;this.end=b;this.unit=c||this.unit||(e.cssNumber[this.prop]?"":"px");this.now=this.start;this.pos=this.state=0;d.elem=this.elem;d()&&e.timers.push(d)&&!ia&&(Aa?(ia=!0,h=function(){ia&&
+(Aa(h),g.tick())},Aa(h)):ia=setInterval(g.tick,g.interval))},show:function(){this.options.orig[this.prop]=e.style(this.elem,this.prop);this.options.show=!0;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());e(this.elem).show()},hide:function(){this.options.orig[this.prop]=e.style(this.elem,this.prop);this.options.hide=!0;this.custom(this.cur(),0)},step:function(a){var b=na||ba(),c=!0,d=this.elem,f=this.options,g;if(a||b>=f.duration+this.startTime){this.now=this.end;this.pos=this.state=
+1;this.update();f.animatedProperties[this.prop]=!0;for(g in f.animatedProperties)f.animatedProperties[g]!==!0&&(c=!1);if(c){f.overflow!=null&&!e.support.shrinkWrapBlocks&&e.each(["","X","Y"],function(a,b){d.style["overflow"+b]=f.overflow[a]});f.hide&&e(d).hide();if(f.hide||f.show)for(var h in f.animatedProperties)e.style(d,h,f.orig[h]);f.complete.call(d)}return!1}else f.duration==Infinity?this.now=b:(a=b-this.startTime,this.state=a/f.duration,this.pos=e.easing[f.animatedProperties[this.prop]](this.state,
+a,0,1,f.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}};e.extend(e.fx,{tick:function(){for(var a=e.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||e.fx.stop()},interval:13,stop:function(){clearInterval(ia);ia=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){e.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):
+a.now)+a.unit:a.elem[a.prop]=a.now}}});if(e.expr&&e.expr.filters)e.expr.filters.animated=function(a){return e.grep(e.timers,function(b){return a===b.elem}).length};var Ib=/^t(?:able|d|h)$/i,Va=/^(?:body|html)$/i;e.fn.offset="getBoundingClientRect"in r.documentElement?function(a){var b=this[0],c;if(a)return this.each(function(b){e.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return e.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var f=
+b.ownerDocument,g=f.documentElement;if(!c||!e.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};b=f.body;f=S(f);return{top:c.top+(f.pageYOffset||e.support.boxModel&&g.scrollTop||b.scrollTop)-(g.clientTop||b.clientTop||0),left:c.left+(f.pageXOffset||e.support.boxModel&&g.scrollLeft||b.scrollLeft)-(g.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(b){e.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return e.offset.bodyOffset(b);
+e.offset.initialize();var c,d=b.offsetParent,f=b.ownerDocument,g=f.documentElement,h=f.body;c=(f=f.defaultView)?f.getComputedStyle(b,null):b.currentStyle;for(var j=b.offsetTop,l=b.offsetLeft;(b=b.parentNode)&&b!==h&&b!==g;){if(e.offset.supportsFixedPosition&&c.position==="fixed")break;c=f?f.getComputedStyle(b,null):b.currentStyle;j-=b.scrollTop;l-=b.scrollLeft;if(b===d){j+=b.offsetTop;l+=b.offsetLeft;if(e.offset.doesNotAddBorder&&(!e.offset.doesAddBorderForTableAndCells||!Ib.test(b.nodeName)))j+=
+parseFloat(c.borderTopWidth)||0,l+=parseFloat(c.borderLeftWidth)||0;d=b.offsetParent}e.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(j+=parseFloat(c.borderTopWidth)||0,l+=parseFloat(c.borderLeftWidth)||0)}if(c.position==="relative"||c.position==="static")j+=h.offsetTop,l+=h.offsetLeft;e.offset.supportsFixedPosition&&c.position==="fixed"&&(j+=Math.max(g.scrollTop,h.scrollTop),l+=Math.max(g.scrollLeft,h.scrollLeft));return{top:j,left:l}};e.offset={initialize:function(){var a=
+r.body,b=r.createElement("div"),c,d,f,g=parseFloat(e.css(a,"marginTop"))||0;e.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,
+a.firstChild);c=b.firstChild;d=c.firstChild;f=c.nextSibling.firstChild.firstChild;this.doesNotAddBorder=d.offsetTop!==5;this.doesAddBorderForTableAndCells=f.offsetTop===5;d.style.position="fixed";d.style.top="20px";this.supportsFixedPosition=d.offsetTop===20||d.offsetTop===15;d.style.position=d.style.top="";c.style.overflow="hidden";c.style.position="relative";this.subtractsBorderForOverflowNotVisible=d.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==g;a.removeChild(b);e.offset.initialize=
+e.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;e.offset.initialize();e.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(e.css(a,"marginTop"))||0,c+=parseFloat(e.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=e.css(a,"position");if(d==="static")a.style.position="relative";var f=e(a),g=f.offset(),h=e.css(a,"top"),j=e.css(a,"left"),l={},o={};(d==="absolute"||d==="fixed")&&e.inArray("auto",[h,j])>-1?(o=f.position(),d=o.top,j=o.left):(d=parseFloat(h)||
+0,j=parseFloat(j)||0);e.isFunction(b)&&(b=b.call(a,c,g));if(b.top!=null)l.top=b.top-g.top+d;if(b.left!=null)l.left=b.left-g.left+j;"using"in b?b.using.call(a,l):f.css(l)}};e.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=Va.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(e.css(a,"marginTop"))||0;c.left-=parseFloat(e.css(a,"marginLeft"))||0;d.top+=parseFloat(e.css(b[0],"borderTopWidth"))||0;d.left+=parseFloat(e.css(b[0],
+"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||r.body;a&&!Va.test(a.nodeName)&&e.css(a,"position")==="static";)a=a.offsetParent;return a})}});e.each(["Left","Top"],function(a,b){var d="scroll"+b;e.fn[d]=function(b){var f,g;if(b===c){f=this[0];return!f?null:(g=S(f))?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:e.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:f[d]}return this.each(function(){(g=
+S(this))?g.scrollTo(!a?b:e(g).scrollLeft(),a?b:e(g).scrollTop()):this[d]=b})}});e.each(["Height","Width"],function(a,b){var d=b.toLowerCase();e.fn["inner"+b]=function(){var a=this[0];return a&&a.style?parseFloat(e.css(a,d,"padding")):null};e.fn["outer"+b]=function(a){var b=this[0];return b&&b.style?parseFloat(e.css(b,d,a?"margin":"border")):null};e.fn[d]=function(a){var f=this[0];if(!f)return a==null?null:this;if(e.isFunction(a))return this.each(function(b){var c=e(this);c[d](a.call(this,b,c[d]()))});
+if(e.isWindow(f)){var g=f.document.documentElement["client"+b];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+b]||g}else return f.nodeType===9?Math.max(f.documentElement["client"+b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]):a===c?(f=e.css(f,d),g=parseFloat(f),e.isNaN(g)?f:g):this.css(d,typeof a==="string"?a:a+"px")}});a.jQuery=a.$=e})(window);
// Input 1
-document.createElement("canvas").getContext||function(){function d(){return this.context_||(this.context_=new o(this))}function h(e,d){var w=b.call(arguments,2);return function(){return e.apply(d,w.concat(b.call(arguments)))}}function F(b){return String(b).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function p(b){b.namespaces.g_vml_||b.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");b.namespaces.g_o_||b.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");
-if(!b.styleSheets.ex_canvas_)b=b.createStyleSheet(),b.owningElement.id="ex_canvas_",b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}function C(b){var d=b.srcElement;switch(b.propertyName){case "width":d.getContext().clearRect();d.style.width=d.attributes.width.nodeValue+"px";d.firstChild.style.width=d.clientWidth+"px";break;case "height":d.getContext().clearRect(),d.style.height=d.attributes.height.nodeValue+"px",d.firstChild.style.height=d.clientHeight+
-"px"}}function B(b){b=b.srcElement;if(b.firstChild)b.firstChild.style.width=b.clientWidth+"px",b.firstChild.style.height=b.clientHeight+"px"}function q(){return[[1,0,0],[0,1,0],[0,0,1]]}function z(b,d){for(var w=q(),h=0;h<3;h++)for(var n=0;n<3;n++){for(var o=0,r=0;r<3;r++)o+=b[h][r]*d[r][n];w[h][n]=o}return w}function N(b,d){d.fillStyle=b.fillStyle;d.lineCap=b.lineCap;d.lineJoin=b.lineJoin;d.lineWidth=b.lineWidth;d.miterLimit=b.miterLimit;d.shadowBlur=b.shadowBlur;d.shadowColor=b.shadowColor;d.shadowOffsetX=
-b.shadowOffsetX;d.shadowOffsetY=b.shadowOffsetY;d.strokeStyle=b.strokeStyle;d.globalAlpha=b.globalAlpha;d.font=b.font;d.textAlign=b.textAlign;d.textBaseline=b.textBaseline;d.arcScaleX_=b.arcScaleX_;d.arcScaleY_=b.arcScaleY_;d.lineScale_=b.lineScale_}function K(b){var d=b.indexOf("(",3),w=b.indexOf(")",d+1),d=b.substring(d+1,w).split(",");if(d.length!=4||b.charAt(3)!="a")d[3]=1;return d}function I(b,d,w){return Math.min(w,Math.max(d,b))}function G(b,d,w){w<0&&w++;w>1&&w--;return 6*w<1?b+(d-b)*6*w:
-2*w<1?d:3*w<2?b+(d-b)*(2/3-w)*6:b}function r(b){if(b in ba)return ba[b];var d,w=1,b=String(b);if(b.charAt(0)=="#")d=b;else if(/^rgb/.test(b)){w=K(b);d="#";for(var h,n=0;n<3;n++)h=w[n].indexOf("%")!=-1?Math.floor(parseFloat(w[n])/100*255):+w[n],d+=aa[I(h,0,255)];w=+w[3]}else if(/^hsl/.test(b)){n=w=K(b);d=parseFloat(n[0])/360%360;d<0&&d++;h=I(parseFloat(n[1])/100,0,1);n=I(parseFloat(n[2])/100,0,1);if(h==0)h=n=d=n;else{var o=n<0.5?n*(1+h):n+h-n*h,r=2*n-o;h=G(r,o,d+1/3);n=G(r,o,d);d=G(r,o,d-1/3)}d="#"+
-aa[Math.floor(h*255)]+aa[Math.floor(n*255)]+aa[Math.floor(d*255)];w=w[3]}else d=ja[b]||b;return ba[b]={color:d,alpha:w}}function o(b){this.m_=q();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=T*1;this.globalAlpha=1;this.font="10px sans-serif";this.textAlign="left";this.textBaseline="alphabetic";this.canvas=b;var d="width:"+b.clientWidth+"px;height:"+b.clientHeight+"px;overflow:hidden;position:absolute",
-w=b.ownerDocument.createElement("div");w.style.cssText=d;b.appendChild(w);d=w.cloneNode(!1);d.style.backgroundColor="red";d.style.filter="alpha(opacity=0)";b.appendChild(d);this.element_=w;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}function A(b,d,w,h){b.currentPath_.push({type:"bezierCurveTo",cp1x:d.x,cp1y:d.y,cp2x:w.x,cp2y:w.y,x:h.x,y:h.y});b.currentX_=h.x;b.currentY_=h.y}function V(b,d){var w=r(b.strokeStyle),h=w.color,w=w.alpha*b.globalAlpha,n=b.lineScale_*b.lineWidth;n<1&&(w*=n);d.push("<g_vml_:stroke",
-' opacity="',w,'"',' joinstyle="',b.lineJoin,'"',' miterlimit="',b.miterLimit,'"',' endcap="',Ma[b.lineCap]||"square",'"',' weight="',n,'px"',' color="',h,'" />')}function Q(b,d,w,h){var n=b.fillStyle,o=b.arcScaleX_,p=b.arcScaleY_,q=h.x-w.x,u=h.y-w.y;if(n instanceof x){var A=0,h={x:0,y:0},y=0,z=1;if(n.type_=="gradient"){var A=n.x1_/o,w=n.y1_/p,E=R(b,n.x0_/o,n.y0_/p),A=R(b,A,w),A=Math.atan2(A.x-E.x,A.y-E.y)*180/Math.PI;A<0&&(A+=360);A<1.0E-6&&(A=0)}else E=R(b,n.x0_,n.y0_),h={x:(E.x-w.x)/q,y:(E.y-w.y)/
-u},q/=o*T,u/=p*T,z=fa.max(q,u),y=2*n.r0_/z,z=2*n.r1_/z-y;o=n.colors_;o.sort(function(b,e){return b.offset-e.offset});for(var p=o.length,E=o[0].color,w=o[p-1].color,q=o[0].alpha*b.globalAlpha,b=o[p-1].alpha*b.globalAlpha,u=[],Q=0;Q<p;Q++){var F=o[Q];u.push(F.offset*z+y+" "+F.color)}d.push('<g_vml_:fill type="',n.type_,'"',' method="none" focus="100%"',' color="',E,'"',' color2="',w,'"',' colors="',u.join(","),'"',' opacity="',b,'"',' g_o_:opacity2="',q,'"',' angle="',A,'"',' focusposition="',h.x,",",
-h.y,'" />')}else n instanceof X?q&&u&&d.push("<g_vml_:fill",' position="',-w.x/q*o*o,",",-w.y/u*p*p,'"',' type="tile"',' src="',n.src_,'" />'):(n=r(b.fillStyle),d.push('<g_vml_:fill color="',n.color,'" opacity="',n.alpha*b.globalAlpha,'" />'))}function R(b,d,w){b=b.m_;return{x:T*(d*b[0][0]+w*b[1][0]+b[2][0])-Y,y:T*(d*b[0][1]+w*b[1][1]+b[2][1])-Y}}function S(b,d,w){if(isFinite(d[0][0])&&isFinite(d[0][1])&&isFinite(d[1][0])&&isFinite(d[1][1])&&isFinite(d[2][0])&&isFinite(d[2][1])&&(b.m_=d,w))b.lineScale_=
-y(va(d[0][0]*d[1][1]-d[0][1]*d[1][0]))}function x(b){this.type_=b;this.r1_=this.y1_=this.x1_=this.r0_=this.y0_=this.x0_=0;this.colors_=[]}function X(b,d){if(!b||b.nodeType!=1||b.tagName!="IMG")throw new L("TYPE_MISMATCH_ERR");if(b.readyState!="complete")throw new L("INVALID_STATE_ERR");switch(d){case "repeat":case null:case "":this.repetition_="repeat";break;case "repeat-x":case "repeat-y":case "no-repeat":this.repetition_=d;break;default:throw new L("SYNTAX_ERR");}this.src_=b.src;this.width_=b.width;
-this.height_=b.height}function L(b){this.code=this[b];this.message=b+": DOM Exception "+this.code}var fa=Math,O=fa.round,ga=fa.sin,qa=fa.cos,va=fa.abs,y=fa.sqrt,T=10,Y=T/2;navigator.userAgent.match(/MSIE ([\d.]+)?/);var b=Array.prototype.slice;p(document);var $={init:function(b){b=b||document;b.createElement("canvas");b.attachEvent("onreadystatechange",h(this.init_,this,b))},init_:function(b){for(var b=b.getElementsByTagName("canvas"),d=0;d<b.length;d++)this.initElement(b[d])},initElement:function(b){if(!b.getContext){b.getContext=
-d;p(b.ownerDocument);b.innerHTML="";b.attachEvent("onpropertychange",C);b.attachEvent("onresize",B);var t=b.attributes;t.width&&t.width.specified?b.style.width=t.width.nodeValue+"px":b.width=b.clientWidth;t.height&&t.height.specified?b.style.height=t.height.nodeValue+"px":b.height=b.clientHeight}return b}};$.init();for(var aa=[],D=0;D<16;D++)for(var oa=0;oa<16;oa++)aa[D*16+oa]=D.toString(16)+oa.toString(16);var ja={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",
-bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",
-darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",
-ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",
-mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",
-peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",whitesmoke:"#F5F5F5",yellowgreen:"#9ACD32"},
-ba={},ra={style:"normal",variant:"normal",weight:"normal",size:10,family:"sans-serif"},wa={},Ma={butt:"flat",round:"round"},D=o.prototype;D.clearRect=function(){if(this.textMeasureEl_)this.textMeasureEl_.removeNode(!0),this.textMeasureEl_=null;this.element_.innerHTML=""};D.beginPath=function(){this.currentPath_=[]};D.moveTo=function(b,d){var w=R(this,b,d);this.currentPath_.push({type:"moveTo",x:w.x,y:w.y});this.currentX_=w.x;this.currentY_=w.y};D.lineTo=function(b,d){var w=R(this,b,d);this.currentPath_.push({type:"lineTo",
-x:w.x,y:w.y});this.currentX_=w.x;this.currentY_=w.y};D.bezierCurveTo=function(b,d,w,h,n,o){n=R(this,n,o);b=R(this,b,d);w=R(this,w,h);A(this,b,w,n)};D.quadraticCurveTo=function(b,d,h,o){b=R(this,b,d);h=R(this,h,o);o={x:this.currentX_+2/3*(b.x-this.currentX_),y:this.currentY_+2/3*(b.y-this.currentY_)};A(this,o,{x:o.x+(h.x-this.currentX_)/3,y:o.y+(h.y-this.currentY_)/3},h)};D.arc=function(b,d,h,o,n,r){h*=T;var p=r?"at":"wa",x=b+qa(o)*h-Y,u=d+ga(o)*h-Y,o=b+qa(n)*h-Y,n=d+ga(n)*h-Y;x==o&&!r&&(x+=0.125);
-b=R(this,b,d);x=R(this,x,u);o=R(this,o,n);this.currentPath_.push({type:p,x:b.x,y:b.y,radius:h,xStart:x.x,yStart:x.y,xEnd:o.x,yEnd:o.y})};D.rect=function(b,d,h,o){this.moveTo(b,d);this.lineTo(b+h,d);this.lineTo(b+h,d+o);this.lineTo(b,d+o);this.closePath()};D.strokeRect=function(b,d,h,o){var n=this.currentPath_;this.beginPath();this.moveTo(b,d);this.lineTo(b+h,d);this.lineTo(b+h,d+o);this.lineTo(b,d+o);this.closePath();this.stroke();this.currentPath_=n};D.fillRect=function(b,d,h,o){var n=this.currentPath_;
-this.beginPath();this.moveTo(b,d);this.lineTo(b+h,d);this.lineTo(b+h,d+o);this.lineTo(b,d+o);this.closePath();this.fill();this.currentPath_=n};D.createLinearGradient=function(b,d,h,o){var n=new x("gradient");n.x0_=b;n.y0_=d;n.x1_=h;n.y1_=o;return n};D.createRadialGradient=function(b,d,h,o,n,r){var p=new x("gradientradial");p.x0_=b;p.y0_=d;p.r0_=h;p.x1_=o;p.y1_=n;p.r1_=r;return p};D.drawImage=function(b){var d,h,o,n,r,p,x,u;o=b.runtimeStyle.width;n=b.runtimeStyle.height;b.runtimeStyle.width="auto";
-b.runtimeStyle.height="auto";var q=b.width,A=b.height;b.runtimeStyle.width=o;b.runtimeStyle.height=n;if(arguments.length==3)d=arguments[1],h=arguments[2],r=p=0,x=o=q,u=n=A;else if(arguments.length==5)d=arguments[1],h=arguments[2],o=arguments[3],n=arguments[4],r=p=0,x=q,u=A;else if(arguments.length==9)r=arguments[1],p=arguments[2],x=arguments[3],u=arguments[4],d=arguments[5],h=arguments[6],o=arguments[7],n=arguments[8];else throw Error("Invalid number of arguments");var z=R(this,d,h),y=[];y.push(" <g_vml_:group",
-' coordsize="',T*10,",",T*10,'"',' coordorigin="0,0"',' style="width:',10,"px;height:",10,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]||this.m_[1][1]!=1||this.m_[1][0]){var Q=[];Q.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",O(z.x/T),",","Dy=",O(z.y/T),"");var F=R(this,d+o,h),C=R(this,d,h+n);d=R(this,d+o,h+n);z.x=fa.max(z.x,F.x,C.x,d.x);z.y=fa.max(z.y,F.y,C.y,d.y);y.push("padding:0 ",O(z.x/T),"px ",O(z.y/T),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",
-Q.join(""),", sizingmethod='clip');")}else y.push("top:",O(z.y/T),"px;left:",O(z.x/T),"px;");y.push(' ">','<g_vml_:image src="',b.src,'"',' style="width:',T*o,"px;"," height:",T*n,'px"',' cropleft="',r/q,'"',' croptop="',p/A,'"',' cropright="',(q-r-x)/q,'"',' cropbottom="',(A-p-u)/A,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",y.join(""))};D.stroke=function(b){for(var d={x:null,y:null},h={x:null,y:null},o=0;o<this.currentPath_.length;o+=5E3){var n=[];n.push("<g_vml_:shape",
-' filled="',!!b,'"',' style="position:absolute;width:',10,"px;height:",10,'px;"',' coordorigin="0,0"',' coordsize="',T*10,",",T*10,'"',' stroked="',!b,'"',' path="');for(var r=o;r<Math.min(o+5E3,this.currentPath_.length);r++){r%5E3==0&&r>0&&n.push(" m ",O(this.currentPath_[r-1].x),",",O(this.currentPath_[r-1].y));var p=this.currentPath_[r];switch(p.type){case "moveTo":n.push(" m ",O(p.x),",",O(p.y));break;case "lineTo":n.push(" l ",O(p.x),",",O(p.y));break;case "close":n.push(" x ");p=null;break;
-case "bezierCurveTo":n.push(" c ",O(p.cp1x),",",O(p.cp1y),",",O(p.cp2x),",",O(p.cp2y),",",O(p.x),",",O(p.y));break;case "at":case "wa":n.push(" ",p.type," ",O(p.x-this.arcScaleX_*p.radius),",",O(p.y-this.arcScaleY_*p.radius)," ",O(p.x+this.arcScaleX_*p.radius),",",O(p.y+this.arcScaleY_*p.radius)," ",O(p.xStart),",",O(p.yStart)," ",O(p.xEnd),",",O(p.yEnd))}if(p){if(d.x==null||p.x<d.x)d.x=p.x;if(h.x==null||p.x>h.x)h.x=p.x;if(d.y==null||p.y<d.y)d.y=p.y;if(h.y==null||p.y>h.y)h.y=p.y}}n.push(' ">');b?
-Q(this,n,d,h):V(this,n);n.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",n.join(""))}};D.fill=function(){this.stroke(!0)};D.closePath=function(){this.currentPath_.push({type:"close"})};D.save=function(){var b={};N(this,b);this.aStack_.push(b);this.mStack_.push(this.m_);this.m_=z(q(),this.m_)};D.restore=function(){if(this.aStack_.length)N(this.aStack_.pop(),this),this.m_=this.mStack_.pop()};D.translate=function(b,d){S(this,z([[1,0,0],[0,1,0],[b,d,1]],this.m_),!1)};D.rotate=function(b){var d=
-qa(b),b=ga(b);S(this,z([[d,b,0],[-b,d,0],[0,0,1]],this.m_),!1)};D.scale=function(b,d){this.arcScaleX_*=b;this.arcScaleY_*=d;S(this,z([[b,0,0],[0,d,0],[0,0,1]],this.m_),!0)};D.transform=function(b,d,h,o,n,p){S(this,z([[b,d,0],[h,o,0],[n,p,1]],this.m_),!0)};D.setTransform=function(b,d,h,o,n,p){S(this,[[b,d,0],[h,o,0],[n,p,1]],!0)};D.drawText_=function(b,d,h,o,n){var p=this.m_,o=0,r=1E3,x={x:0,y:0},u=[],q;q=this.font;if(wa[q])q=wa[q];else{var A=document.createElement("div").style;try{A.font=q}catch(z){}q=
-wa[q]={style:A.fontStyle||ra.style,variant:A.fontVariant||ra.variant,weight:A.fontWeight||ra.weight,size:A.fontSize||ra.size,family:A.fontFamily||ra.family}}var A=q,y=this.element_;q={};for(var C in A)q[C]=A[C];C=parseFloat(y.currentStyle.fontSize);y=parseFloat(A.size);q.size=typeof A.size=="number"?A.size:A.size.indexOf("px")!=-1?y:A.size.indexOf("em")!=-1?C*y:A.size.indexOf("%")!=-1?C/100*y:A.size.indexOf("pt")!=-1?y/0.75:C;q.size*=0.981;C=q.style+" "+q.variant+" "+q.weight+" "+q.size+"px "+q.family;
-y=this.element_.currentStyle;A=this.textAlign.toLowerCase();switch(A){case "left":case "center":case "right":break;case "end":A=y.direction=="ltr"?"right":"left";break;case "start":A=y.direction=="rtl"?"right":"left";break;default:A="left"}switch(this.textBaseline){case "hanging":case "top":x.y=q.size/1.75;break;case "middle":break;default:case null:case "alphabetic":case "ideographic":case "bottom":x.y=-q.size/2.25}switch(A){case "right":o=1E3;r=0.05;break;case "center":o=r=500}d=R(this,d+x.x,h+
-x.y);u.push('<g_vml_:line from="',-o,' 0" to="',r,' 0.05" ',' coordsize="100 100" coordorigin="0 0"',' filled="',!n,'" stroked="',!!n,'" style="position:absolute;width:1px;height:1px;">');n?V(this,u):Q(this,u,{x:-o,y:0},{x:r,y:q.size});n=p[0][0].toFixed(3)+","+p[1][0].toFixed(3)+","+p[0][1].toFixed(3)+","+p[1][1].toFixed(3)+",0,0";d=O(d.x/T)+","+O(d.y/T);u.push('<g_vml_:skew on="t" matrix="',n,'" ',' offset="',d,'" origin="',o,' 0" />','<g_vml_:path textpathok="true" />','<g_vml_:textpath on="true" string="',
-F(b),'" style="v-text-align:',A,";font:",F(C),'" /></g_vml_:line>');this.element_.insertAdjacentHTML("beforeEnd",u.join(""))};D.fillText=function(b,d,h,o){this.drawText_(b,d,h,o,!1)};D.strokeText=function(b,d,h,o){this.drawText_(b,d,h,o,!0)};D.measureText=function(b){if(!this.textMeasureEl_)this.element_.insertAdjacentHTML("beforeEnd",'<span style="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;"></span>'),this.textMeasureEl_=this.element_.lastChild;var d=this.element_.ownerDocument;
-this.textMeasureEl_.innerHTML="";this.textMeasureEl_.style.font=this.font;this.textMeasureEl_.appendChild(d.createTextNode(b));return{width:this.textMeasureEl_.offsetWidth}};D.clip=function(){};D.arcTo=function(){};D.createPattern=function(b,d){return new X(b,d)};x.prototype.addColorStop=function(b,d){d=r(d);this.colors_.push({offset:b,color:d.color,alpha:d.alpha})};D=L.prototype=Error();D.INDEX_SIZE_ERR=1;D.DOMSTRING_SIZE_ERR=2;D.HIERARCHY_REQUEST_ERR=3;D.WRONG_DOCUMENT_ERR=4;D.INVALID_CHARACTER_ERR=
-5;D.NO_DATA_ALLOWED_ERR=6;D.NO_MODIFICATION_ALLOWED_ERR=7;D.NOT_FOUND_ERR=8;D.NOT_SUPPORTED_ERR=9;D.INUSE_ATTRIBUTE_ERR=10;D.INVALID_STATE_ERR=11;D.SYNTAX_ERR=12;D.INVALID_MODIFICATION_ERR=13;D.NAMESPACE_ERR=14;D.INVALID_ACCESS_ERR=15;D.VALIDATION_ERR=16;D.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=$;CanvasRenderingContext2D=o;CanvasGradient=x;CanvasPattern=X;DOMException=L}();
+var RRDTime=function(a){this.parser(a)};RRDTime.EOF=-1;RRDTime.MIDNIGHT=0;RRDTime.NOON=1;RRDTime.TEATIME=2;RRDTime.PM=3;RRDTime.AM=4;RRDTime.YESTERDAY=5;RRDTime.TODAY=6;RRDTime.TOMORROW=7;RRDTime.NOW=8;RRDTime.START=9;RRDTime.END=10;RRDTime.EPOCH=11;RRDTime.SECONDS=12;RRDTime.MINUTES=13;RRDTime.HOURS=14;RRDTime.DAYS=15;RRDTime.WEEKS=16;RRDTime.MONTHS=17;RRDTime.YEARS=18;RRDTime.MONTHS_MINUTES=19;RRDTime.NUMBER=20;RRDTime.PLUS=21;RRDTime.MINUS=22;RRDTime.DOT=23;RRDTime.COLON=24;RRDTime.SLASH=25;
+RRDTime.ID=26;RRDTime.JUNK=27;RRDTime.JAN=28;RRDTime.FEB=29;RRDTime.MAR=30;RRDTime.APR=31;RRDTime.MAY=32;RRDTime.JUN=33;RRDTime.JUL=34;RRDTime.AUG=35;RRDTime.SEP=36;RRDTime.OCT=37;RRDTime.NOV=38;RRDTime.DEC=39;RRDTime.SUN=40;RRDTime.MON=41;RRDTime.TUE=42;RRDTime.WED=43;RRDTime.THU=44;RRDTime.FRI=45;RRDTime.SAT=46;
+RRDTime.variousWords=[{name:"midnight",value:RRDTime.MIDNIGHT},{name:"noon",value:RRDTime.NOON},{name:"teatime",value:RRDTime.TEATIME},{name:"am",value:RRDTime.AM},{name:"pm",value:RRDTime.PM},{name:"tomorrow",value:RRDTime.TOMORROW},{name:"yesterday",value:RRDTime.YESTERDAY},{name:"today",value:RRDTime.TODAY},{name:"now",value:RRDTime.NOW},{name:"n",value:RRDTime.NOW},{name:"start",value:RRDTime.START},{name:"s",value:RRDTime.START},{name:"end",value:RRDTime.END},{name:"e",value:RRDTime.END},{name:"epoch",
+value:RRDTime.EPOCH},{name:"jan",value:RRDTime.JAN},{name:"feb",value:RRDTime.FEB},{name:"mar",value:RRDTime.MAR},{name:"apr",value:RRDTime.APR},{name:"may",value:RRDTime.MAY},{name:"jun",value:RRDTime.JUN},{name:"jul",value:RRDTime.JUL},{name:"aug",value:RRDTime.AUG},{name:"sep",value:RRDTime.SEP},{name:"oct",value:RRDTime.OCT},{name:"nov",value:RRDTime.NOV},{name:"dec",value:RRDTime.DEC},{name:"january",value:RRDTime.JAN},{name:"february",value:RRDTime.FEB},{name:"march",value:RRDTime.MAR},{name:"april",
+value:RRDTime.APR},{name:"may",value:RRDTime.MAY},{name:"june",value:RRDTime.JUN},{name:"july",value:RRDTime.JUL},{name:"august",value:RRDTime.AUG},{name:"september",value:RRDTime.SEP},{name:"october",value:RRDTime.OCT},{name:"november",value:RRDTime.NOV},{name:"december",value:RRDTime.DEC},{name:"sunday",value:RRDTime.SUN},{name:"sun",value:RRDTime.SUN},{name:"monday",value:RRDTime.MON},{name:"mon",value:RRDTime.MON},{name:"tuesday",value:RRDTime.TUE},{name:"tue",value:RRDTime.TUE},{name:"wednesday",
+value:RRDTime.WED},{name:"wed",value:RRDTime.WED},{name:"thursday",value:RRDTime.THU},{name:"thu",value:RRDTime.THU},{name:"friday",value:RRDTime.FRI},{name:"fri",value:RRDTime.FRI},{name:"saturday",value:RRDTime.SAT},{name:"sat",value:RRDTime.SAT}];
+RRDTime.timeMultipliers=[{name:"second",value:RRDTime.SECONDS},{name:"seconds",value:RRDTime.SECONDS},{name:"sec",value:RRDTime.SECONDS},{name:"s",value:RRDTime.SECONDS},{name:"minute",value:RRDTime.MINUTES},{name:"minutes",value:RRDTime.MINUTES},{name:"min",value:RRDTime.MINUTES},{name:"m",value:RRDTime.MONTHS_MINUTES},{name:"hour",value:RRDTime.HOURS},{name:"hours",value:RRDTime.HOURS},{name:"hr",value:RRDTime.HOURS},{name:"h",value:RRDTime.HOURS},{name:"day",value:RRDTime.DAYS},{name:"days",value:RRDTime.DAYS},
+{name:"d",value:RRDTime.DAYS},{name:"week",value:RRDTime.WEEKS},{name:"weeks",value:RRDTime.WEEKS},{name:"wk",value:RRDTime.WEEKS},{name:"w",value:RRDTime.WEEKS},{name:"month",value:RRDTime.MONTHS},{name:"months",value:RRDTime.MONTHS},{name:"mon",value:RRDTime.MONTHS},{name:"year",value:RRDTime.YEARS},{name:"years",value:RRDTime.YEARS},{name:"yr",value:RRDTime.YEARS},{name:"y",value:RRDTime.YEARS}];RRDTime.ABSOLUTE_TIME=0;RRDTime.RELATIVE_TO_START_TIME=1;RRDTime.RELATIVE_TO_END_TIME=2;
+RRDTime.RELATIVE_TO_EPOCH=3;
+RRDTime.prototype={tokens:null,toklen:0,tokidx:0,token:null,tokid:0,type:0,offset:0,tm_sec:0,tm_min:0,tm_hour:0,tm_mday:0,tm_mon:0,tm_year:0,tm_wday:0,specials:null,gettok:function(){if(this.tokidx>=this.toklen)this.tokid=RRDTime.EOF;else if(this.token=this.tokens[this.tokidx],this.tokidx++,isNaN(this.token))if(this.token===":")this.tokid=RRDTime.COLON;else if(this.token===".")this.tokid=RRDTime.DOT;else if(this.token==="+")this.tokid=RRDTime.PLUS;else if(this.token==="/")this.tokid=RRDTime.SLASH;
+else if(this.token==="-")this.tokid=RRDTime.MINUS;else{this.tokid=RRDTime.ID;for(var a=0,c=this.specials.length;a<c;a++)if(this.specials[a].name===this.token){this.tokid=this.specials[a].value;break}}else this.tokid=RRDTime.NUMBER,this.token=parseInt(this.token,10);return this.tokid},plus_minus:function(a){var c=RRDTime.PLUS,d=-1;if(a>=0){c=a;if(this.gettok()!=RRDTime.NUMBER)throw"There should be number after '"+(c==RRDTime.PLUS?"+":"-")+"'";d=-1}a=this.token;if(this.gettok()==RRDTime.MONTHS_MINUTES)switch(d){case RRDTime.DAYS:case RRDTime.WEEKS:case RRDTime.MONTHS:case RRDTime.YEARS:this.tokid=
+RRDTime.MONTHS;break;case RRDTime.SECONDS:case RRDTime.MINUTES:case RRDTime.HOURS:this.tokid=RRDTime.MINUTES;break;default:this.tokid=a<6?RRDTime.MONTHS:RRDTime.MINUTES}switch(this.tokid){case RRDTime.YEARS:this.tm_year+=c==RRDTime.PLUS?a:-a;return;case RRDTime.MONTHS:this.tm_mon+=c==RRDTime.PLUS?a:-a;return;case RRDTime.WEEKS:a*=7;case RRDTime.DAYS:this.tm_mday+=c==RRDTime.PLUS?a:-a;return;case RRDTime.HOURS:this.offset+=c==RRDTime.PLUS?a*3600:-a*3600;return;case RRDTime.MINUTES:this.offset+=c==
+RRDTime.PLUS?a*60:-a*60;return;case RRDTime.SECONDS:this.offset+=c==RRDTime.PLUS?a:-a;return;default:this.offset+=c==RRDTime.PLUS?a:-a;return}throw"well-known time unit expected after "+a;},tod:function(){var a,c=0,d=this.tokid;if(!((this.token+"").length>2))if(a=this.token,this.gettok(),this.tokid==RRDTime.SLASH||this.tokid==RRDTime.DOT)this.tokid=d,this.token=a;else{if(this.tokid==RRDTime.COLON){if(this.gettok()!=RRDTime.NUMBER)throw"Parsing HH:MM syntax, expecting MM as number, got none";c=this.token;
+if(c>59)throw"parsing HH:MM syntax, got MM = "+c+" (>59!)";this.gettok()}if(this.tokid==RRDTime.AM||this.tokid==RRDTime.PM){if(a>12)throw"there cannot be more than 12 AM or PM hours";this.tokid==RRDTime.PM?a!=12&&(a+=12):a==12&&(a=0);this.gettok()}else if(a>23){this.tokid=d;this.token=a;return}this.tm_hour=a;this.tm_min=c;this.tm_sec=0;if(this.tm_hour==24)this.tm_hour=0,this.tm_mday++}},assign_date:function(a,c,d){if(d>138)if(d>1970)d-=1900;else throw"invalid year "+d+" (should be either 00-99 or >1900)";
+else d>=0&&d<38&&(d+=100);if(d<70)throw"won't handle dates before epoch (01/01/1970), sorry";this.tm_mday=a;this.tm_mon=c;this.tm_year=d},day:function(){var a=0,c,d=this.tm_year;switch(this.tokid){case RRDTime.YESTERDAY:this.tm_mday--;case RRDTime.TODAY:this.gettok();break;case RRDTime.TOMORROW:this.tm_mday++;this.gettok();break;case RRDTime.JAN:case RRDTime.FEB:case RRDTime.MAR:case RRDTime.APR:case RRDTime.MAY:case RRDTime.JUN:case RRDTime.JUL:case RRDTime.AUG:case RRDTime.SEP:case RRDTime.OCT:case RRDTime.NOV:case RRDTime.DEC:c=
+this.tokid-RRDTime.JAN;if(this.gettok()!=RRDTime.NUMBER)throw"the day of the month should follow month name";a=this.token;this.gettok()==RRDTime.NUMBER?(d=this.token,this.gettok()):d=this.tm_year;this.assign_date(a,c,d);break;case RRDTime.SUN:case RRDTime.MON:case RRDTime.TUE:case RRDTime.WED:case RRDTime.THU:case RRDTime.FRI:case RRDTime.SAT:c=this.tokid-RRDTime.SUN;this.tm_mday+=c-this.tm_wday;this.gettok();break;case RRDTime.NUMBER:c=this.token;if(c>31536E4){this.localtime(c);this.gettok();break}if(c>
+19700101&&c<24000101)a=this.token+"",d=parseInt(a.substr(0,4),10),c=parseInt(a.substr(4,2),10),a=parseInt(a.substr(6,2),10),this.gettok();else if(this.gettok(),c<=31&&(this.tokid==RRDTime.SLASH||this.tokid==RRDTime.DOT)){var b=this.tokid;if(this.gettok()!=RRDTime.NUMBER)throw"there should be "+(RRDTime.DOT?"month":"day")+" number after '"+(RRDTime.DOT?".":"/")+"'";a=this.token;if(this.gettok()==b){if(this.gettok()!=RRDTime.NUMBER)throw"there should be year number after '"+(b==RRDTime.DOT?".":"/")+
+"'";d=this.token;this.gettok()}b==RRDTime.DOT&&(b=a,a=c,c=b)}c--;if(c<0||c>11)throw"did you really mean month "+(c+1)+"?";if(a<1||a>31)throw"I'm afraid that "+a+" is not a valid day of the month";this.assign_date(a,c,d)}},parser:function(a){var c=new Date,d=0;this.specials=RRDTime.variousWords;this.tokens=(a+"").match(/[0-9]+|[A-Za-z]+|[:.+-\/]/g);this.toklen=this.tokens.length;this.type=RRDTime.ABSOLUTE_TIME;this.offset=0;this.tm_sec=c.getSeconds();this.tm_min=c.getMinutes();this.tm_hour=c.getHours();
+this.tm_mday=c.getDate();this.tm_mon=c.getMonth();this.tm_year=c.getFullYear()-1900;this.tm_wday=c.getDay();this.gettok();switch(this.tokid){case RRDTime.PLUS:case RRDTime.MINUS:break;case RRDTime.EPOCH:this.type=RRDTime.RELATIVE_TO_EPOCH;case RRDTime.START:case RRDTime.END:this.type=this.tokid===RRDTime.EPOCH?RRDTime.RELATIVE_TO_START_TIME:RRDTime.RELATIVE_TO_END_TIME,this.tm_year=this.tm_mon=this.tm_mday=this.tm_hour=this.tm_min=this.tm_sec=0;case RRDTime.NOW:a=this.tokid;this.gettok();if(this.tokid==
+RRDTime.PLUS||this.tokid==RRDTime.MINUS)break;if(a!=RRDTime.NOW)throw"'start' or 'end' MUST be followed by +|- offset";else if(this.tokid!=RRDTime.EOF)throw"if 'now' is followed by a token it must be +|- offset";break;case RRDTime.NUMBER:a=this.tm_hour;c=this.tm_year;this.tm_hour=30;this.tm_year=3E4;this.tod();this.day();this.tm_hour==30&&this.tm_year!=3E4&&this.tod();if(this.tm_hour==30)this.tm_hour=a;if(this.tm_year==3E4)this.tm_year=c;break;case RRDTime.JAN:case RRDTime.FEB:case RRDTime.MAR:case RRDTime.APR:case RRDTime.MAY:case RRDTime.JUN:case RRDTime.JUL:case RRDTime.AUG:case RRDTime.SEP:case RRDTime.OCT:case RRDTime.NOV:case RRDTime.DEC:this.day();
+if(this.tokid!=RRDTime.NUMBER)break;this.tod();break;case RRDTime.TEATIME:d+=4;case RRDTime.NOON:d+=12;case RRDTime.MIDNIGHT:this.tm_hour=d;this.tm_sec=this.tm_min=0;this.gettok();this.day();break;default:throw"unparsable time: "+this.token;}if(this.tokid==RRDTime.PLUS||this.tokid==RRDTime.MINUS)for(this.specials=RRDTime.timeMultipliers;this.tokid==RRDTime.PLUS||this.tokid==RRDTime.MINUS||this.tokid==RRDTime.NUMBER;)this.tokid==RRDTime.NUMBER?this.plus_minus(-1):this.plus_minus(this.tokid),this.gettok();
+if(this.tokid!=RRDTime.EOF)throw"unparsable trailing text: '..."+this.token+"'";},localtime:function(a){a=new Date(a*1E3);this.tm_sec=a.getSeconds();this.tm_min=a.getMinutes();this.tm_hour=a.getHours();this.tm_mday=a.getDate();this.tm_mon=a.getMonth();this.tm_year=a.getFullYear()-1900;this.tm_wday=a.getDay()},mktime:function(){return Math.round((new Date(this.tm_year+1900,this.tm_mon,this.tm_mday,this.tm_hour,this.tm_min,this.tm_sec)).getTime()/1E3)}};
+RRDTime.proc_start_end=function(a,c){var d,b;if(a.type==RRDTime.RELATIVE_TO_END_TIME&&c.type==RRDTime.RELATIVE_TO_START_TIME)throw"the start and end times cannot be specified relative to each other";if(a.type==RRDTime.RELATIVE_TO_START_TIME)throw"the start time cannot be specified relative to itself";if(c.type==RRDTime.RELATIVE_TO_END_TIME)throw"the end time cannot be specified relative to itself";a.type==RRDTime.RELATIVE_TO_END_TIME?(b=c.mktime()+c.offset,b=new Date(b*1E3),b.setDate(b.getDate()+
+a.tm_mday),b.setMonth(b.getMonth()+a.tm_mon),b.setFullYear(b.getFullYear()+a.tm_year),d=Math.round(b.getTime()/1E3)+a.offset):d=a.mktime()+a.offset;c.type==RRDTime.RELATIVE_TO_START_TIME?(d=a.mktime()+a.offset,b=new Date(d*1E3),b.setDate(b.getDate()+c.tm_mday),b.setMonth(b.getMonth()+c.tm_mon),b.setFullYear(b.getFullYear()+c.tm_year),b=Math.round(b.getTime()/1E3)+c.offset):b=c.mktime()+c.offset;return[d,b]};var RRDRpn=function(a,c){this.parser(a,c)};
+RRDRpn.OP={NUMBER:0,VARIABLE:1,INF:2,PREV:3,NEGINF:4,UNKN:5,NOW:6,TIME:7,ADD:8,MOD:9,SUB:10,MUL:11,DIV:12,SIN:13,DUP:14,EXC:15,POP:16,COS:17,LOG:18,EXP:19,LT:20,LE:21,GT:22,GE:23,EQ:24,IF:25,MIN:26,MAX:27,LIMIT:28,FLOOR:29,CEIL:30,UN:31,END:32,LTIME:33,NE:34,ISINF:35,PREV_OTHER:36,COUNT:37,ATAN:38,SQRT:39,SORT:40,REV:41,TREND:42,TRENDNAN:43,ATAN2:44,RAD2DEG:45,DEG2RAD:46,PREDICT:47,PREDICTSIGMA:48,AVG:49,ABS:50,ADDNAN:51};RRDRpn.STACK_UNDERFLOW="RPN stack underflow";
+RRDRpn.prototype={rpnstack:null,rpnp:null,find_var:function(a,c){for(var d=0,b=a.length;d<b;d++)if((a[d].gf==RRDGraphDesc.GF.DEF||a[d].gf==RRDGraphDesc.GF.VDEF||a[d].gf==RRDGraphDesc.GF.CDEF)&&a[d].vname==c)return d;return-1},parser:function(a,c){var d=-1,b,f=a.split(",");this.rpnp=[];for(var g=0,h=f.length;g<h;g++)if(b=f[g].toUpperCase(),d++,this.rpnp[d]={},isNaN(b))if(b==="+")this.rpnp[d].op=RRDRpn.OP.ADD;else if(b==="-")this.rpnp[d].op=RRDRpn.OP.SUB;else if(b==="*")this.rpnp[d].op=RRDRpn.OP.MUL;
+else if(b==="/")this.rpnp[d].op=RRDRpn.OP.DIV;else if(b==="%")this.rpnp[d].op=RRDRpn.OP.MOD;else if(b==="SIN")this.rpnp[d].op=RRDRpn.OP.SIN;else if(b==="COS")this.rpnp[d].op=RRDRpn.OP.COS;else if(b==="LOG")this.rpnp[d].op=RRDRpn.OP.LOG;else if(b==="FLOOR")this.rpnp[d].op=RRDRpn.OP.FLOOR;else if(b==="CEIL")this.rpnp[d].op=RRDRpn.OP.CEIL;else if(b==="EXP")this.rpnp[d].op=RRDRpn.OP.EXP;else if(b==="DUP")this.rpnp[d].op=RRDRpn.OP.DUP;else if(b==="EXC")this.rpnp[d].op=RRDRpn.OP.EXC;else if(b==="POP")this.rpnp[d].op=
+RRDRpn.OP.POP;else if(b==="LTIME")this.rpnp[d].op=RRDRpn.OP.LTIME;else if(b==="LT")this.rpnp[d].op=RRDRpn.OP.LT;else if(b==="LE")this.rpnp[d].op=RRDRpn.OP.LE;else if(b==="GT")this.rpnp[d].op=RRDRpn.OP.GT;else if(b==="GE")this.rpnp[d].op=RRDRpn.OP.GE;else if(b==="EQ")this.rpnp[d].op=RRDRpn.OP.EQ;else if(b==="IF")this.rpnp[d].op=RRDRpn.OP.IF;else if(b==="MIN")this.rpnp[d].op=RRDRpn.OP.MIN;else if(b==="MAX")this.rpnp[d].op=RRDRpn.OP.MAX;else if(b==="LIMIT")this.rpnp[d].op=RRDRpn.OP.LIMIT;else if(b===
+"UNKN")this.rpnp[d].op=RRDRpn.OP.UNKN;else if(b==="UN")this.rpnp[d].op=RRDRpn.OP.UN;else if(b==="NEGINF")this.rpnp[d].op=RRDRpn.OP.NEGINF;else if(b==="NE")this.rpnp[d].op=RRDRpn.OP.NE;else if(b==="COUNT")this.rpnp[d].op=RRDRpn.OP.COUNT;else if(/PREV\([-_A-Za-z0-9]+\)/.test(b)){if(b=f[g].match(/PREV\(([-_A-Za-z0-9]+)\)/i),b.length==2)this.rpnp[d].op=RRDRpn.OP.PREV_OTHER,this.rpnp[d].ptr=this.find_var(c,b[1])}else if(b==="PREV")this.rpnp[d].op=RRDRpn.OP.PREV;else if(b==="INF")this.rpnp[d].op=RRDRpn.OP.INF;
+else if(b==="ISINF")this.rpnp[d].op=RRDRpn.OP.ISINF;else if(b==="NOW")this.rpnp[d].op=RRDRpn.OP.NOW;else if(b==="TIME")this.rpnp[d].op=RRDRpn.OP.TIME;else if(b==="ATAN2")this.rpnp[d].op=RRDRpn.OP.ATAN2;else if(b==="ATAN")this.rpnp[d].op=RRDRpn.OP.ATAN;else if(b==="SQRT")this.rpnp[d].op=RRDRpn.OP.SQRT;else if(b==="SORT")this.rpnp[d].op=RRDRpn.OP.SORT;else if(b==="REV")this.rpnp[d].op=RRDRpn.OP.REV;else if(b==="TREND")this.rpnp[d].op=RRDRpn.OP.TREND;else if(b==="TRENDNAN")this.rpnp[d].op=RRDRpn.OP.TRENDNAN;
+else if(b==="PREDICT")this.rpnp[d].op=RRDRpn.OP.PREDICT;else if(b==="PREDICTSIGMA")this.rpnp[d].op=RRDRpn.OP.PREDICTSIGMA;else if(b==="RAD2DEG")this.rpnp[d].op=RRDRpn.OP.RAD2DEG;else if(b==="DEG2RAD")this.rpnp[d].op=RRDRpn.OP.DEG2RAD;else if(b==="AVG")this.rpnp[d].op=RRDRpn.OP.AVG;else if(b==="ABS")this.rpnp[d].op=RRDRpn.OP.ABS;else if(b==="ADDNAN")this.rpnp[d].op=RRDRpn.OP.ADDNAN;else if(/[-_A-Za-z0-9]+/.test(b))this.rpnp[d].ptr=this.find_var(c,f[g]),this.rpnp[d].op=RRDRpn.OP.VARIABLE;else return;
+else this.rpnp[d].op=RRDRpn.OP.NUMBER,this.rpnp[d].val=parseFloat(b);this.rpnp[d+1]={};this.rpnp[d+1].op=RRDRpn.OP.END},compare_double:function(a,c){var d=a-c;return d<0?-1:d>0?1:0},fmod:function(a,c){var d,b=0,f=d=0,g=0;d=a.toExponential().match(/^.\.?(.*)e(.+)$/);b=parseInt(d[2],10)-(d[1]+"").length;d=c.toExponential().match(/^.\.?(.*)e(.+)$/);d=parseInt(d[2],10)-(d[1]+"").length;d>b&&(b=d);d=a%c;return b<-100||b>20?(f=Math.round(Math.log(d)/Math.log(10)),g=Math.pow(10,f),(d/g).toFixed(f-b)*g):
+parseFloat(d.toFixed(-b))},calc:function(a,c,d){var b=-1;this.rpnstack=[];for(var f=0;this.rpnp[f].op!=RRDRpn.OP.END;f++)switch(this.rpnp[f].op){case RRDRpn.OP.NUMBER:this.rpnstack[++b]=this.rpnp[f].val;break;case RRDRpn.OP.VARIABLE:case RRDRpn.OP.PREV_OTHER:if(this.rpnp[f].ds_cnt==0)throw"VDEF made it into rpn_calc... aborting";else this.rpnp[f].op==RRDRpn.OP.VARIABLE?this.rpnstack[++b]=this.rpnp[f].data[this.rpnp[f].pdata]:d<=0?this.rpnstack[++b]=Number.NaN:this.rpnstack[++b]=this.rpnp[f].data[this.rpnp[f].pdata-
+this.rpnp[f].ds_cnt],a%this.rpnp[f].step==0&&(this.rpnp[f].pdata+=this.rpnp[f].ds_cnt);break;case RRDRpn.OP.COUNT:this.rpnstack[++b]=d+1;break;case RRDRpn.OP.PREV:d<=0?this.rpnstack[++b]=Number.NaN:this.rpnstack[++b]=c[d-1];break;case RRDRpn.OP.UNKN:this.rpnstack[++b]=Number.NaN;break;case RRDRpn.OP.INF:this.rpnstack[++b]=Infinity;break;case RRDRpn.OP.NEGINF:this.rpnstack[++b]=-Infinity;break;case RRDRpn.OP.NOW:this.rpnstack[++b]=Math.round((new Date).getTime()/1E3);break;case RRDRpn.OP.TIME:this.rpnstack[++b]=
+a;break;case RRDRpn.OP.LTIME:var g=new Date(a*1E3);this.rpnstack[++b]=g.getTimezoneOffset()*60+a;break;case RRDRpn.OP.ADD:if(b<1)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b-1]+=this.rpnstack[b];b--;break;case RRDRpn.OP.ADDNAN:if(b<1)throw RRDRpn.STACK_UNDERFLOW;isNaN(this.rpnstack[b-1])?this.rpnstack[b-1]=this.rpnstack[b]:isNaN(this.rpnstack[b])||(this.rpnstack[b-1]+=this.rpnstack[b]);b--;break;case RRDRpn.OP.SUB:if(b<1)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b-1]-=this.rpnstack[b];b--;break;
+case RRDRpn.OP.MUL:if(b<1)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b-1]*=this.rpnstack[b];b--;break;case RRDRpn.OP.DIV:if(b<1)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b-1]/=this.rpnstack[b];b--;break;case RRDRpn.OP.MOD:if(b<1)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b-1]=this.fmod(this.rpnstack[b-1],this.rpnstack[b]);b--;break;case RRDRpn.OP.SIN:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]=Math.sin(this.rpnstack[b]);break;case RRDRpn.OP.ATAN:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]=
+Math.atan(this.rpnstack[b]);break;case RRDRpn.OP.RAD2DEG:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]*=57.29577951;break;case RRDRpn.OP.DEG2RAD:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]*=0.0174532952;break;case RRDRpn.OP.ATAN2:if(b<1)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b-1]=Math.atan2(this.rpnstack[b-1],this.rpnstack[b]);b--;break;case RRDRpn.OP.COS:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]=Math.cos(this.rpnstack[b]);break;case RRDRpn.OP.CEIL:if(b<0)throw RRDRpn.STACK_UNDERFLOW;
+this.rpnstack[b]=Math.ceil(this.rpnstack[b]);break;case RRDRpn.OP.FLOOR:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]=Math.floor(this.rpnstack[b]);break;case RRDRpn.OP.LOG:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]=Math.log(this.rpnstack[b]);break;case RRDRpn.OP.DUP:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b+1]=this.rpnstack[b];b++;break;case RRDRpn.OP.POP:if(b<0)throw RRDRpn.STACK_UNDERFLOW;b--;break;case RRDRpn.OP.EXC:if(b<1)throw RRDRpn.STACK_UNDERFLOW;g=this.rpnstack[b];
+this.rpnstack[b]=this.rpnstack[b-1];this.rpnstack[b-1]=g;break;case RRDRpn.OP.EXP:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]=Math.exp(this.rpnstack[b]);break;case RRDRpn.OP.LT:if(b<1)throw RRDRpn.STACK_UNDERFLOW;isNaN(this.rpnstack[b-1])||(this.rpnstack[b-1]=isNaN(this.rpnstack[b])?this.rpnstack[b]:this.rpnstack[b-1]<this.rpnstack[b]?1:0);b--;break;case RRDRpn.OP.LE:if(b<1)throw RRDRpn.STACK_UNDERFLOW;isNaN(this.rpnstack[b-1])||(this.rpnstack[b-1]=isNaN(this.rpnstack[b])?this.rpnstack[b]:
+this.rpnstack[b-1]<=this.rpnstack[b]?1:0);b--;break;case RRDRpn.OP.GT:if(b<1)throw RRDRpn.STACK_UNDERFLOW;isNaN(this.rpnstack[b-1])||(this.rpnstack[b-1]=isNaN(this.rpnstack[b])?this.rpnstack[b]:this.rpnstack[b-1]>this.rpnstack[b]?1:0);b--;break;case RRDRpn.OP.GE:if(b<1)throw RRDRpn.STACK_UNDERFLOW;isNaN(this.rpnstack[b-1])||(this.rpnstack[b-1]=isNaN(this.rpnstack[b])?this.rpnstack[b]:this.rpnstack[b-1]>=this.rpnstack[b]?1:0);b--;break;case RRDRpn.OP.NE:if(b<1)throw RRDRpn.STACK_UNDERFLOW;isNaN(this.rpnstack[b-
+1])||(this.rpnstack[b-1]=isNaN(this.rpnstack[b])?this.rpnstack[b]:this.rpnstack[b-1]==this.rpnstack[b]?0:1);b--;break;case RRDRpn.OP.EQ:if(b<1)throw RRDRpn.STACK_UNDERFLOW;isNaN(this.rpnstack[b-1])||(this.rpnstack[b-1]=isNaN(this.rpnstack[b])?this.rpnstack[b]:this.rpnstack[b-1]==this.rpnstack[b]?1:0);b--;break;case RRDRpn.OP.IF:if(b<2)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b-2]=isNaN(this.rpnstack[b-2])||this.rpnstack[b-2]==0?this.rpnstack[b]:this.rpnstack[b-1];b--;b--;break;case RRDRpn.OP.MIN:if(b<
+1)throw RRDRpn.STACK_UNDERFLOW;isNaN(this.rpnstack[b-1])||(isNaN(this.rpnstack[b])?this.rpnstack[b-1]=this.rpnstack[b]:this.rpnstack[b-1]>this.rpnstack[b]&&(this.rpnstack[b-1]=this.rpnstack[b]));b--;break;case RRDRpn.OP.MAX:if(b<1)throw RRDRpn.STACK_UNDERFLOW;isNaN(this.rpnstack[b-1])||(isNaN(this.rpnstack[b])?this.rpnstack[b-1]=this.rpnstack[b]:this.rpnstack[b-1]<this.rpnstack[b]&&(this.rpnstack[b-1]=this.rpnstack[b]));b--;break;case RRDRpn.OP.LIMIT:if(b<2)throw RRDRpn.STACK_UNDERFLOW;if(!isNaN(this.rpnstack[b-
+2]))if(isNaN(this.rpnstack[b-1]))this.rpnstack[b-2]=this.rpnstack[b-1];else if(isNaN(this.rpnstack[b]))this.rpnstack[b-2]=this.rpnstack[b];else if(this.rpnstack[b-2]<this.rpnstack[b-1])this.rpnstack[b-2]=Number.NaN;else if(this.rpnstack[b-2]>this.rpnstack[b])this.rpnstack[b-2]=Number.NaN;b-=2;break;case RRDRpn.OP.UN:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]=isNaN(this.rpnstack[b])?1:0;break;case RRDRpn.OP.ISINF:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]=isInfinite(this.rpnstack[b])?
+1:0;break;case RRDRpn.OP.SQRT:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]=Math.sqrt(this.rpnstack[b]);break;case RRDRpn.OP.SORT:if(b<0)throw RRDRpn.STACK_UNDERFLOW;g=this.rpnstack[b--];if(b<g-1)throw RRDRpn.STACK_UNDERFLOW;var h=this.rpnstack.slice(b-g+1,b+1);h.sort(this.compare_double);for(var g=b-g+1,j=0;g<b+1;g++,j++)this.rpnstack[g]=h[j];break;case RRDRpn.OP.REV:if(b<0)throw RRDRpn.STACK_UNDERFLOW;g=this.rpnstack[b--];if(b<g-1)throw RRDRpn.STACK_UNDERFLOW;h=this.rpnstack.slice(b-g+1,
+b+1);h.reverse();g=b-g+1;for(j=0;g<b+1;g++,j++)this.rpnstack[g]=h[j];break;case RRDRpn.OP.PREDICT:case RRDRpn.OP.PREDICTSIGMA:if(b<2)throw RRDRpn.STACK_UNDERFLOW;var g=this.rpnstack[--b],m=this.rpnstack[--b];if(b<m)throw RRDRpn.STACK_UNDERFLOW;m<0?b--:b-=m;var h=Number.NaN,n=this.rpnp[f-1].step,q=this.rpnp[f-1].ds_cnt,p=Math.ceil(g/n),l=0,o=0,j=0,E=m;m<0&&(E=-m);for(var w=0;w<E;w++){var A=1,A=m<0?w*this.rpnstack[b]:this.rpnstack[b+w];if(A<0)throw"negative shift step not allowed: "+A;A=Math.ceil(A/
+n);for(g=0;g<=p;g++)h=A+g,h>=0&&h<d&&(h=this.rpnp[f-1].data[-q*h],isNaN(h)||(l+=h,o+=h*h,j++))}h=Number.NaN;this.rpnp[f].op==RRDRpn.OP.PREDICT?j>0&&(h=l/j):j>1&&(h=j*o-l*l,h=h<0?Number.NaN:Math.sqrt(h/(j*(j-1))));this.rpnstack[b]=h;break;case RRDRpn.OP.TREND:case RRDRpn.OP.TRENDNAN:if(b<1)throw RRDRpn.STACK_UNDERFLOW;if(f<2||this.rpnp[f-2].op!=RRDRpn.OP.VARIABLE)throw"malformed trend arguments";else if(m=this.rpnstack[b],n=this.rpnp[f-2].step,d>Math.ceil(m/n)){q=this.rpnp[f].op==RRDRpn.OP.TREND;j=
+g=p=0;do{h=this.rpnp[f-2].data[this.rpnp[f-2].ds_cnt*g--];if(q||!isNaN(h))p+=h,++j;m-=n}while(m>0);this.rpnstack[--b]=j==0?Number.NaN:p/j}else this.rpnstack[--b]=Number.NaN;break;case RRDRpn.OP.AVG:if(b<0)throw RRDRpn.STACK_UNDERFLOW;g=this.rpnstack[b--];j=l=0;if(b<g-1)throw RRDRpn.STACK_UNDERFLOW;for(;g>0;)h=this.rpnstack[b--],g--,isNaN(h)||(j++,l+=h);j>0?this.rpnstack[++b]=l/j:this.rpnstack[++b]=Number.NaN;break;case RRDRpn.OP.ABS:if(b<0)throw RRDRpn.STACK_UNDERFLOW;this.rpnstack[b]=fabs(this.rpnstack[b])}if(b!=
+0)throw"RPN final stack size != 1";c[d]=this.rpnstack[0];return 0}};var RRDGraphDesc=function(a){this.init(a)};RRDGraphDesc.GF={PRINT:0,GPRINT:1,COMMENT:2,HRULE:3,VRULE:4,LINE:5,AREA:6,STACK:7,TICK:8,TEXTALIGN:9,DEF:10,CDEF:11,VDEF:12,SHIFT:13,XPORT:14};RRDGraphDesc.VDEF={MAXIMUM:0,MINIMUM:1,AVERAGE:2,STDEV:3,PERCENT:4,TOTAL:5,FIRST:6,LAST:7,LSLSLOPE:8,LSLINT:9,LSLCORREL:10,PERCENTNAN:11};
+RRDGraphDesc.CF={AVERAGE:0,MINIMUM:1,MAXIMUM:2,LAST:3,HWPREDICT:4,SEASONAL:5,DEVPREDICT:6,DEVSEASONAL:7,FAILURES:8,MHWPREDICT:9};RRDGraphDesc.TXA={LEFT:0,RIGHT:1,CENTER:2,JUSTIFIED:3};
+RRDGraphDesc.prototype={gf:null,stack:!1,debug:!1,vname:null,vidx:Number.NaN,rrd:null,ds_nam:null,ds:-1,cf:null,cf_reduce:null,col:null,format:null,legend:null,strftm:!1,leg_x:0,leg_y:0,yrule:Number.NaN,xrule:0,vf:null,rpnp:null,shidx:0,shval:0,shift:0,start:0,end:0,start_orig:0,end_orig:0,step:0,step_orig:0,ds_cnt:0,data_first:0,ds_namv:null,data:null,p_data:null,linewidth:0,dash:!1,p_dashes:null,ndash:!1,offset:0,txtalign:0,init:function(a){this.step_orig=this.step=a.step;this.start_orig=this.start=
+a.start;this.end_orig=this.end=a.end;this.cf_reduce=this.cf=RRDGraphDesc.CF.AVERAGE;this.data=[];this.pdata=[];this.ds_namv=[]}};Date.prototype.getWeek=function(){var a=new Date(this.getFullYear(),0,1);return Math.ceil(((this-a)/864E5+a.getDay()+1)/7)};var RRDGraph=function(){this.init.apply(this,arguments)};RRDGraph.pad2=function(a){return(a<10?"0":"")+a};RRDGraph.pad3=function(a){return(a<10?"00":a<100?"0":"")+a};RRDGraph.lpad=function(a,c,d){for(;a.length<d;)a=c+a;return a};RRDGraph.days="Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",");
+RRDGraph.fdays="Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(",");RRDGraph.months="Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(",");RRDGraph.fmonths="January,February,March,April,May,June,July,August,September,October,November,December".split(",");RRDGraph.TMT={SECOND:0,MINUTE:1,HOUR:2,DAY:3,WEEK:4,MONTH:5,YEAR:6};
+RRDGraph.prototype={xlab:[{minsec:0,length:0,gridtm:RRDGraph.TMT.SECOND,gridst:30,mgridtm:RRDGraph.TMT.MINUTE,mgridst:5,labtm:RRDGraph.TMT.MINUTE,labst:5,precis:0,stst:function(a){return RRDGraph.pad2(a.getHours())+":"+RRDGraph.pad2(a.getMinutes())}},{minsec:2,length:0,gridtm:RRDGraph.TMT.MINUTE,gridst:1,mgridtm:RRDGraph.TMT.MINUTE,mgridst:5,labtm:RRDGraph.TMT.MINUTE,labst:5,precis:0,stst:function(a){return RRDGraph.pad2(a.getHours())+":"+RRDGraph.pad2(a.getMinutes())}},{minsec:5,length:0,gridtm:RRDGraph.TMT.MINUTE,
+gridst:2,mgridtm:RRDGraph.TMT.MINUTE,mgridst:10,labtm:RRDGraph.TMT.MINUTE,labst:10,precis:0,stst:function(a){return RRDGraph.pad2(a.getHours())+":"+RRDGraph.pad2(a.getMinutes())}},{minsec:10,length:0,gridtm:RRDGraph.TMT.MINUTE,gridst:5,mgridtm:RRDGraph.TMT.MINUTE,mgridst:20,labtm:RRDGraph.TMT.MINUTE,labst:20,precis:0,stst:function(a){return RRDGraph.pad2(a.getHours())+":"+RRDGraph.pad2(a.getMinutes())}},{minsec:30,length:0,gridtm:RRDGraph.TMT.MINUTE,gridst:10,mgridtm:RRDGraph.TMT.HOUR,mgridst:1,labtm:RRDGraph.TMT.HOUR,
+labst:1,precis:0,stst:function(a){return RRDGraph.pad2(a.getHours())+":"+RRDGraph.pad2(a.getMinutes())}},{minsec:60,length:0,gridtm:RRDGraph.TMT.MINUTE,gridst:30,mgridtm:RRDGraph.TMT.HOUR,mgridst:2,labtm:RRDGraph.TMT.HOUR,labst:2,precis:0,stst:function(a){return RRDGraph.pad2(a.getHours())+":"+RRDGraph.pad2(a.getMinutes())}},{minsec:60,length:86400,gridtm:RRDGraph.TMT.MINUTE,gridst:30,mgridtm:RRDGraph.TMT.HOUR,mgridst:2,labtm:RRDGraph.TMT.HOUR,labst:6,precis:0,stst:function(a){return RRDGraph.days[a.getDay()]+
+" "+RRDGraph.pad2(a.getHours())+":"+RRDGraph.pad2(a.getMinutes())}},{minsec:180,length:0,gridtm:RRDGraph.TMT.HOUR,gridst:1,mgridtm:RRDGraph.TMT.HOUR,mgridst:6,labtm:RRDGraph.TMT.HOUR,labst:6,precis:0,stst:function(a){return RRDGraph.pad2(a.getHours())+":"+RRDGraph.pad2(a.getMinutes())}},{minsec:180,length:86400,gridtm:RRDGraph.TMT.HOUR,gridst:1,mgridtm:RRDGraph.TMT.HOUR,mgridst:6,labtm:RRDGraph.TMT.HOUR,labst:12,precis:0,stst:function(a){return RRDGraph.days[a.getDay()]+" "+RRDGraph.pad2(a.getHours())+
+":"+RRDGraph.pad2(a.getMinutes())}},{minsec:600,length:0,gridtm:RRDGraph.TMT.HOUR,gridst:6,mgridtm:RRDGraph.TMT.DAY,mgridst:1,labtm:RRDGraph.TMT.DAY,labst:1,precis:86400,stst:function(a){return RRDGraph.days[a.getDay()]}},{minsec:1200,length:0,gridtm:RRDGraph.TMT.HOUR,gridst:6,mgridtm:RRDGraph.TMT.DAY,mgridst:1,labtm:RRDGraph.TMT.DAY,labst:1,precis:86400,stst:function(a){return RRDGraph.pad2(a.getDate())}},{minsec:1800,length:0,gridtm:RRDGraph.TMT.HOUR,gridst:12,mgridtm:RRDGraph.TMT.DAY,mgridst:1,
+labtm:RRDGraph.TMT.DAY,labst:2,precis:86400,stst:function(a){return RRDGraph.days[a.getDay()]+" "+RRDGraph.pad2(a.getDate())}},{minsec:2400,length:0,gridtm:RRDGraph.TMT.HOUR,gridst:12,mgridtm:RRDGraph.TMT.DAY,mgridst:1,labtm:RRDGraph.TMT.DAY,labst:2,precis:86400,stst:function(a){return RRDGraph.days[a.getDay()]}},{minsec:3600,length:0,gridtm:RRDGraph.TMT.DAY,gridst:1,mgridtm:RRDGraph.TMT.WEEK,mgridst:1,labtm:RRDGraph.TMT.WEEK,labst:1,precis:604800,stst:function(a){return"Week "+RRDGraph.pad2(a.getWeek())}},
+{minsec:10800,length:0,gridtm:RRDGraph.TMT.WEEK,gridst:1,mgridtm:RRDGraph.TMT.MONTH,mgridst:1,labtm:RRDGraph.TMT.WEEK,labst:2,precis:604800,stst:function(a){return"Week "+RRDGraph.pad2(a.getWeek())}},{minsec:21600,length:0,gridtm:RRDGraph.TMT.MONTH,gridst:1,mgridtm:RRDGraph.TMT.MONTH,mgridst:1,labtm:RRDGraph.TMT.MONTH,labst:1,precis:2592E3,stst:function(a){return RRDGraph.months[a.getMonth()]}},{minsec:172800,length:0,gridtm:RRDGraph.TMT.MONTH,gridst:1,mgridtm:RRDGraph.TMT.MONTH,mgridst:3,labtm:RRDGraph.TMT.MONTH,
+labst:3,precis:2592E3,stst:function(a){return RRDGraph.months[a.getMonth()]}},{minsec:315360,length:0,gridtm:RRDGraph.TMT.MONTH,gridst:3,mgridtm:RRDGraph.TMT.YEAR,mgridst:1,labtm:RRDGraph.TMT.YEAR,labst:1,precis:31536E3,stst:function(a){return""+a.getFullYear()}},{minsec:864E3,length:0,gridtm:RRDGraph.TMT.YEAR,gridst:1,mgridtm:RRDGraph.TMT.YEAR,mgridst:1,labtm:RRDGraph.TMT.YEAR,labst:1,precis:31536E3,stst:function(a){return(""+a.getFullYear()).substr(2,4)}},{minsec:-1,length:0,gridtm:RRDGraph.TMT.MONTH,
+gridst:0,mgridtm:RRDGraph.TMT.MONTH,mgridst:0,labtm:RRDGraph.TMT.MONTH,labst:0,precis:0,stst:null}],ylab:[{grid:0.1,lfac:[1,2,5,10]},{grid:0.2,lfac:[1,5,10,20]},{grid:0.5,lfac:[1,2,4,10]},{grid:1,lfac:[1,2,5,10]},{grid:2,lfac:[1,5,10,20]},{grid:5,lfac:[1,2,4,10]},{grid:10,lfac:[1,2,5,10]},{grid:20,lfac:[1,5,10,20]},{grid:50,lfac:[1,2,4,10]},{grid:100,lfac:[1,2,5,10]},{grid:200,lfac:[1,5,10,20]},{grid:500,lfac:[1,2,4,10]},{grid:0,lfac:[0,0,0,0]}],si_symbol:"a,f,p,n,u,m, ,k,M,G,T,P,E".split(","),si_symbcenter:6,
+GRC:null,GFX_H:{LEFT:1,RIGHT:2,CENTER:3},GFX_V:{TOP:1,BOTTOM:2,CENTER:3},DEFAULT_FONT:"DejaVu Sans Mono",TEXT:null,MGRIDWIDTH:0.6,GRIDWIDTH:0.4,YLEGEND_ANGLE:90,LEGEND_POS:{NORTH:0,WEST:1,SOUTH:2,EAST:3},LEGEND_DIR:{TOP_DOWN:0,BOTTOM_UP:1},canvas:null,ctx:null,xsize:400,ysize:100,ylegend:null,title:"",watermark:null,draw_x_grid:!0,draw_y_grid:!0,draw_3d_border:2,dynamic_labels:!1,grid_dash_on:1,grid_dash_off:1,xlab_form:null,second_axis_scale:0,second_axis_shift:0,second_axis_legend:null,second_axis_format:null,
+ygridstep:Number.NaN,ylabfact:0,tabwidth:40,start:0,start_t:null,end:0,end_t:null,step:0,setminval:Number.NaN,setmaxval:Number.NaN,minval:Number.NaN,maxval:Number.NaN,rigid:!1,gridfit:!0,lazy:0,slopemode:!1,legendposition:0,legenddirection:0,logarithmic:!1,force_scale_min:0,force_scale_max:0,xorigin:0,yorigin:0,xOriginTitle:0,yOriginTitle:0,xOriginLegendY:0,yOriginLegendY:0,xOriginLegendY2:0,yOriginLegendY2:0,xOriginLegend:0,yOriginLegend:0,ximg:0,yimg:0,legendwidth:0,legendheight:0,zoom:1,magfact:0,
+base:1E3,symbol:null,viewfactor:1,unitsexponent:9999,unitslength:6,forceleftspace:!1,alt_ygrid:!1,alt_autoscale:!1,alt_autoscale_min:!1,alt_autoscale_max:!1,no_legend:!1,no_minor:!1,only_graph:!1,force_rules_legend:!1,force_units:!1,force_unit_si:!1,full_size_mode:!1,no_rrdtool_tag:!1,xlab_user:null,ygrid_scale:null,gdes:null,ytr_pixie:0,xtr_pixie:0,rrdfiles:null,init:function(a){this.canvas=document.getElementById(a);this.ctx=this.canvas.getContext("2d");this.AlmostEqualBuffer=new ArrayBuffer(Float32Array.BYTES_PER_ELEMENT*
+2);this.AlmostEqualInt=new Int32Array(this.AlmostEqualBuffer);this.AlmostEqualFloat=new Float32Array(this.AlmostEqualBuffer);this.legenddirection=this.LEGEND_DIR.TOP_DOWN;this.legendposition=this.LEGEND_POS.SOUTH;this.gdes=[];this.rrdfiles={};this.TEXT={DEFAULT:{size:11,font:this.DEFAULT_FONT},TITLE:{size:12,font:this.DEFAULT_FONT},AXIS:{size:10,font:this.DEFAULT_FONT},UNIT:{size:11,font:this.DEFAULT_FONT},LEGEND:{size:11,font:this.DEFAULT_FONT},WATERMARK:{size:8,font:this.DEFAULT_FONT}};this.GRC=
+{CANVAS:"rgba(255, 255, 255, 1.0)",BACK:"rgba(242,242, 242, 1.0)",SHADEA:"rgba(207, 207, 207, 1.0)",SHADEB:"rgba(158, 158, 158, 1.0)",GRID:"rgba(143, 143, 143, 0.75)",MGRID:"rgba(222, 79, 79, 0.60)",FONT:"rgba(0, 0, 0, 1.0)",ARROW:"rgba(127, 31, 31, 1.0)",AXIS:"rgba(31, 31, 31, 1.0)",FRAME:"rgba(0, 0, 0, 1.0)"};this.start_t=new RRDTime("end-24h");this.end_t=new RRDTime("now")},set_default_font:function(a){for(var c in this.TEXT)this.TEXT[c].font=a},set_option:function(a,c){switch(a){case "alt-autoscale":case "A":this.alt_autoscale=
+!0;break;case "base":case "b":this.base=parseInt(c,10);if(this.base!==1E3&&this.base!==1024)throw"the only sensible value for base apart from 1000 is 1024";break;case "color":case "c":var d=c.indexOf("#");if(d===-1)throw"invalid color def format";var b=c.substr(0,d);if(!this.GRC[b])throw"invalid color name '"+b+"'";this.GRC[b]=c.substr(d);break;case "full-size-mode":case "D":this.full_size_mode=!0;break;case "slope-mode":case "E":this.slopemode=!0;break;case "end":case "e":this.end_t=new RRDTime(c);
+break;case "force-rules-legend":case "F":this.force_rules_legend=!0;break;case "imginfo":case "f":break;case "graph-render-mode":case "G":break;case "no-legend":case "g":this.no_legend=!0;break;case "height":case "h":this.ysize=parseInt(c,10);break;case "no-minor":case "I":this.no_minor=!1;break;case "interlaced":case "i":break;case "alt-autoscale-min":case "J":this.alt_autoscale_min=!0;break;case "only-graph":case "j":this.only_graph=!0;break;case "units-length":case "L":this.unitslength=parseInt(c,
+10);this.forceleftspace=!0;break;case "lower-limit":case "l":this.setminval=parseFloat(c);break;case "alt-autoscale-max":case "M":this.alt_autoscale_max=!0;break;case "zoom":case "m":this.zoom=parseFloat(c);if(this.zoom<=0)throw"zoom factor must be > 0";break;case "no-gridfit":case "N":this.gridfit=!0;break;case "font":case "n":d=c.split(":");if(d.length!==3)throw"invalid text property format";if(!this.TEXT[d[0]])throw"invalid fonttag '"+d[0]+"'";if(d[1]>0)this.TEXT[d[0]].size=d[1];if(d[2])this.TEXT[d[0]].font=
+d[2];break;case "logarithmic":case "o":this.logarithmic=!0;break;case "pango-markup":case "P":break;case "font-render-mode":case "R":break;case "rigid":case "r":this.rigid=!0;break;case "step":this.step=parseInt(c,10);break;case "start":case "s":this.start_t=new RRDTime(c);break;case "tabwidth":case "T":this.tabwidth=parseFloat(c);break;case "title":case "t":this.title=c;break;case "upper-limit":case "u":this.setmaxval=parseFloat(c);break;case "vertical-label":case "v":this.ylegend=c;break;case "watermark":case "W":this.watermark=
+c;break;case "width":case "w":this.xsize=parseInt(c,10);if(this.xsize<10)throw"width below 10 pixels";break;case "units-exponent":case "X":this.unitsexponent=parseInt(c,10);break;case "x-grid":case "x":if(c==="none")this.draw_x_grid=!1;else{d=c.split(":");if(d.length!==8)throw"invalid x-grid format";this.xlab_user.gridtm=this.tmt_conv(d[0]);if(this.xlab_user.gridtm<0)throw"unknown keyword "+d[0];this.xlab_user.gridst=parseInt(d[1],10);this.xlab_user.mgridtm=this.tmt_conv(d[2]);if(this.xlab_user.mgridtm<
+2)throw"unknown keyword "+d[2];this.xlab_user.mgridst=parseInt(d[3],10);this.xlab_user.labtm=this.tmt_conv(d[4]);if(this.xlab_user.labtm<0)throw"unknown keyword "+d[4];this.xlab_user.labst=parseInt(d[5],10);this.xlab_user.precis=parseInt(d[6],10);this.xlab_user.minsec=1;this.xlab_form=d[7];this.xlab_user.stst=this.xlab_form}break;case "alt-y-grid":case "Y":this.alt_y_grid=!0;break;case "y-grid":case "y":if(c==="none")this.draw_y_grid=!1;else{d=c.indexOf(":");if(d===-1)throw"invalid y-grid format";
+this.ygridstep=parseFloat(c.substr(0,d));if(this.ygridstep<=0)throw"grid step must be > 0";this.ylabfact=parseInt(c.substr(d+1),10);if(this.ylabfact<1)throw"label factor must be > 0";}break;case "lazy":case "z":this.lazy=1;break;case "units":if(this.force_units)throw"--units can only be used once!";if(c==="si")this.force_units_si=!0;else throw"invalid argument for --units: "+c;break;case "alt-y-mrtg":break;case "disable-rrdtool-tag":this.no_rrdtool_tag=!0;break;case "right-axis":d=c.indexOf(":");
+if(d===-1)throw"invalid right-axis format expected scale:shift";this.second_axis_scale=parseFloat(c.substr(0,d));if(this.second_axis_scale===0)throw"the second_axis_scale must not be 0";this.second_axis_shift=parseFloat(c.substr(d+1));break;case "right-axis-label":this.second_axis_legend=c;break;case "right-axis-format":this.second_axis_format=c;break;case "legend-position":if(c==="north")this.legendposition=this.LEGEND_POS.NORTH;else if(c==="west")this.legendposition=this.LEGEND_POS.WEST;else if(c===
+"south")this.legendposition=this.LEGEND_POS.SOUTH;else if(c==="east")this.legendposition=this.LEGEND_POS.EAST;else throw"unknown legend-position '"+c+"'";break;case "legend-direction":if(c==="topdown")this.legenddirection=this.LEGEND_DIR.TOP_DOWN;else if(c==="bottomup")this.legenddirection=this.LEGEND_DIR.BOTTOM_UP;else throw"unknown legend-position '"+c+"'";break;case "border":this.draw_3d_border=parseInt(c,10);break;case "grid-dash":d=c.indexOf(":");if(d===-1)throw"expected grid-dash format float:float";
+this.grid_dash_on=parseFloat(c.substr(0,d));this.grid_dash_off=parseFloat(c.substr(d+1));break;case "dynamic-labels":this.dynamic_labels=!0;break;default:throw'Unknow option "'+a+'"';}},parse_color:function(a){var c;if(c=/^#?([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(a))return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16),1];else if(c=/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(a))return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16),1];else if(c=
+/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(a))return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16),parseInt(c[4],16)/255];else if(c=/^rgb\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\)$/.exec(a))return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10),1];else if(c=/^rgba\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([0-9.]+)\)$/.exec(a))return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10),parseFloat(c[4])];else throw"Unknow color format '"+a+
+"'";},color2rgba:function(a){return"rgba("+a[0]+","+a[1]+","+a[2]+","+a[3]+")"},cmdline:function(a){for(var c=0,a=a.replace(/\n/g," "),a=a.match(/[^" ]+|"[^"]+"/g),d=a.length;c<d;){var b=a[c];b.charAt(0)==='"'&&b.charAt(b.length-1)==='"'&&(b=b.substr(1,b.length-2));if(/^LINE[0-9.]+:/.test(b))this.parse_line(b);else if(/^AREA:/.test(b))this.parse_area(b);else if(/^DEF:/.test(b))this.parse_def(b);else if(/^CDEF:/.test(b))this.parse_cdef(b);else if(/^VDEF:/.test(b))this.parse_vdef(b);else if(/^GPRINT:/.test(b))this.parse_gprint(b);
+else if(/^COMMENT:/.test(b))this.parse_comment(b);else if(/^VRULE:/.test(b))this.parse_vrule(b);else if(/^HRULE:/.test(b))this.parse_hrule(b);else if(/^TICK:/.test(b))this.parse_tick(b);else if(/^TEXTALIGN:/.test(b))this.parse_textaling(b);else if(/^SHIFT:/.test(b))this.parse_shift(b);else if(b.charAt(0)==="-"){var f=1;b.length>1&&b.charAt(1)==="-"&&(f=2);b=b.substr(f);f=void 0;if(b.indexOf("=")!==-1)var g=b.indexOf("="),f=b.substr(g+1),b=b.substr(0,g);else c+1<d&&a[c+1].charAt(0)!=="-"&&!/^"?LINE[0-9.]+:/.test(a[c+
+1])&&!/^"?AREA:/.test(a[c+1])&&!/^"?DEF:/.test(a[c+1])&&!/^"?CDEF:/.test(a[c+1])&&!/^"?VDEF:/.test(a[c+1])&&!/^"?GPRINT:/.test(a[c+1])&&!/^"?COMMENT:/.test(a[c+1])&&!/^"?HRULE:/.test(a[c+1])&&!/^"?VRULE:/.test(a[c+1])&&!/^"?TICK:/.test(a[c+1])&&!/^"?TEXTALING:/.test(a[c+1])&&!/^"?SHIFT:/.test(a[c+1])&&(c++,f=a[c].charAt(0)==='"'&&a[c].charAt(a[c].length-1)==='"'?a[c].substr(1,a[c].length-2):a[c]);this.set_option(b,f)}else throw"Unknow argument: "+b;c++}c=RRDTime.proc_start_end(this.start_t,this.end_t);
+this.start=c[0];this.end=c[1]},sprintf:function(){var a=0,c=arguments;return c[a++].replace(/%(\d+)?(\.(\d+))?(l?)([%scdfeg])/g,function(d,b,f,g,h,j){if(d==="%%")return"%";f=c[a++];b=b===void 0?0:+b;g=g===void 0?j=="d"?0:6:+g;switch(j){case "s":case "c":return f;case "d":return parseInt(f,10);case "e":return RRDGraph.lpad((f<0?"-":"")+Math.abs(f).toExponential(g)," ",b);case "f":return RRDGraph.lpad((f<0?"-":"")+Math.abs(f).toFixed(g)," ",b);case "g":return RRDGraph.lpad((f<0?"-":"")+Math.abs(f).toPrecision(g),
+" ",b);default:return d}})},strftime:function(a,c){var d=new Date(c*1E3);return fmt.replace(/%([aAbBcdHIjmMpsSUVwWxXyYZ%])/g,function(a,c){if(a==="%%")return"%";switch(c){case "a":return RRDGraph.days[d.getDay()];case "A":return RRDGraph.fdays[d.getDay()];case "b":return RRDGraph.months[d.getMonth()];case "B":return RRDGraph.fmonths[d.getMonth()];case "c":return d.toLocaleString();case "d":return RRDGraph.pad2(d.getDate());case "H":return RRDGraph.pad2(d.getHours());case "I":var g=d.getHours()%12;
+return RRDGraph.pad2(g===0?12:g);case "j":return g=new Date(date.getFullYear(),0,1),RRDGraph.pad3(Math.ceil((g.getTime()-d.getTime())/864E5));case "m":return RRDGraph.pad2(d.getMonth());case "M":return RRDGraph.pad2(d.getMinutes());case "p":return d.getHours()>=12?"PM":"AM";case "s":return RRDGraph.pad2(d.getSeconds());case "S":return d.getTime()/1E3;case "U":return g=new Date(this.getFullYear(),0,1),RRDGraph.pad2(Math.ceil(((d.getTime()-g.getTime())/864E5+g.getDay()+1)/7));case "V":this.getFullYear();
+break;case "w":return d.getDay();case "W":break;case "x":return RRDGraph.pad2(d.getDate())+"/"+RRDGraph.pad2(d.getMonth())+"/"+d.getFullYear();case "X":return RRDGraph.pad2(d.getHours())+":"+RRDGraph.pad2(d.getMinutes())+":"+RRDGraph.pad2(d.getSeconds());case "y":return RRDGraph.pad2(d.getFullYear()%100);case "Y":return d.getFullYear();case "Z":return d.toString().replace(/^.*\(([^)]+)\)$/,"$1");default:return a}})},gfx_line:function(a,c,d,b,f,g){a=Math.round(a);c=Math.round(c);d=Math.round(d);b=
+Math.round(b);c===b?(c+=0.5,b+=0.5):a===d&&(a+=0.5,d+=0.5);this.ctx.save();this.ctx.lineWidth=f;this.ctx.strokeStyle=g;this.ctx.beginPath();this.ctx.moveTo(a,c);this.ctx.lineTo(d,b);this.ctx.stroke();this.ctx.restore()},gfx_dashed_line:function(a,c,d,b,f,g,h,j){a=Math.round(a);c=Math.round(c);d=Math.round(d);b=Math.round(b);this.ctx.save();this.ctx.lineWidth=f;this.ctx.strokeStyle=g;this.ctx.beginPath();if(c===b){c+=0.5;a>d&&(f=a,a=d,d=f);this.ctx.moveTo(a,c);for(f=0;a<=d;)f%2===1?(a+=h,this.ctx.lineTo(a,
+c)):(a+=j,this.ctx.moveTo(a,c)),f++}else if(a===d){a+=0.5;c>b&&(f=c,c=b,b=f);this.ctx.moveTo(a,c);for(f=0;c<=b;)f%2===1?(c+=h,this.ctx.lineTo(a,c)):(c+=j,this.ctx.moveTo(a,c)),f++}else this.ctx.moveTo(a,c),this.ctx.lineTo(d,b);this.ctx.stroke();this.ctx.restore()},gfx_new_area:function(a,c,d,b,f,g,h){a=Math.round(a)+0.5;c=Math.round(c)+0.5;d=Math.round(d)+0.5;b=Math.round(b)+0.5;f=Math.round(f)+0.5;g=Math.round(g)+0.5;this.ctx.fillStyle=h;this.ctx.beginPath();this.ctx.moveTo(a,c);this.ctx.lineTo(d,
+b);this.ctx.lineTo(f,g)},gfx_add_point:function(a,c){this.ctx.lineTo(a,c)},gfx_close_path:function(){this.ctx.closePath();this.ctx.fill()},gfx_text:function(a,c,d,b,f,g,h,j,m){a=Math.round(a);c=Math.round(c);this.ctx.save();this.ctx.font=b.size+"px '"+b.font+"'";switch(h){case this.GFX_H.LEFT:this.ctx.textAlign="left";break;case this.GFX_H.RIGHT:this.ctx.textAlign="right";break;case this.GFX_H.CENTER:this.ctx.textAlign="center"}switch(j){case this.GFX_V.TOP:this.ctx.textBaseline="top";break;case this.GFX_V.BOTTOM:this.ctx.textBaseline=
+"bottom";break;case this.GFX_V.CENTER:this.ctx.textBaseline="middle"}this.ctx.fillStyle=d;this.ctx.translate(a,c);this.ctx.rotate(-g*Math.PI/180);this.ctx.fillText(m,0,0);this.ctx.restore()},gfx_get_text_width:function(a,c,d,b){this.ctx.save();this.ctx.font=c.size+"px "+c.font;a=this.ctx.measureText(b);this.ctx.restore();return a.width},xtr:function(a){return a===0?(this.xtr_pixie=this.xsize/(this.end-this.start),this.xorigin):this.xorigin+this.xtr_pixie*(a-this.start)},ytr:function(a){isNaN(a)?(this.ytr_pixie=
+this.logarithmic?this.ysize/(Math.log(this.maxval)/Math.LN10-Math.log(this.minval)/Math.LN10):this.ysize/(this.maxval-this.minval),a=this.yorigin):a=this.logarithmic?a<this.minval?this.yorigin:this.yorigin-this.ytr_pixie*(Math.log(a)/Math.LN10-Math.log(this.minval)/Math.LN10):this.yorigin-this.ytr_pixie*(a-this.minval);return a},floatToIntBits:function(a){var c=Math.pow(2,23)-1;if(a!=a)return 2143289344;var d=a<0||a==0&&1/a<0?-2147483648:0,b=Math.abs(a);if(b==Number.POSITIVE_INFINITY)return d|2139095040;
+for(var f=0,a=b;a>=2&&f<=127;)f++,a/=2;for(;a<1&&f>=-126;)f--,a*=2;if(a*Math.pow(2,f)!=b)throw"floatToIntBits: error fabs.";b=f+127;if(!(0<=b&&b<=254))throw"floatToIntBits: error biasedExp "+b;if(b==255)return signBit|2139095040;if(b==0){if(!(0<=a&&a<2))throw"floatToIntBits: x in [0.0, 1.0) "+a;a=a*Math.pow(2,23)/2}else{if(!(1<=a&&a<2))throw"floatToIntBits: x in [0.5; 1.0) "+a;a=a*Math.pow(2,23)-Math.pow(2,23)}f=a&8388607;if(!(0<=f&&f<=c))throw"floatToIntBits: mantissa in [0.0, 2^23) "+a+" MANT_MAX "+
+c+" "+(a&8388607);return d|b<<23&2139095040|f},AlmostEqual2sComplement:function(a,c,d){this.AlmostEqualFloat[0]=a;this.AlmostEqualFloat[1]=c;a=this.AlmostEqualInt[0];a<0&&(a=2147483648-a);c=this.AlmostEqualInt[1];c<0&&(c=2147483648-c);return Math.abs(a-c)<=d?!0:!1},tmt2str:function(a){switch(a){case RRDGraph.TMT.SECOND:return"sec";case RRDGraph.TMT.MINUTE:return"min";case RRDGraph.TMT.HOUR:return"hour";case RRDGraph.TMT.DAY:return"day";case RRDGraph.TMT.WEEK:return"week";case RRDGraph.TMT.MONTH:return"mon";
+case RRDGraph.TMT.YEAR:return"year"}return a},find_first_time:function(a,c,d){a=new Date(a*1E3);switch(c){case RRDGraph.TMT.SECOND:c=a.getSeconds();c-=c%d;a.setSeconds(c);break;case RRDGraph.TMT.MINUTE:a.setSeconds(0);c=a.getMinutes();c-=c%d;a.setMinutes(c);break;case RRDGraph.TMT.HOUR:a.setSeconds(0);a.setMinutes(0);c=a.getHours();c-=c%d;a.setHours(c);break;case RRDGraph.TMT.DAY:a.setSeconds(0);a.setMinutes(0);a.setHours(0);break;case RRDGraph.TMT.WEEK:a.setSeconds(0);a.setMinutes(0);a.setHours(0);
+d=a.getDate();c=a.getDay();d-=c-1;c===0&&(d-=7);a.setDate(d);break;case RRDGraph.TMT.MONTH:a.setSeconds(0);a.setMinutes(0);a.setHours(0);a.setDate(1);c=a.getMonth();c-=c%d;a.setMonth(c);break;case RRDGraph.TMT.YEAR:a.setSeconds(0),a.setMinutes(0),a.setHours(0),a.setDate(1),a.setMonth(0),c=a.getFullYear()-1900,c-=(c+1900)%d,a.setFullYear(c+1900)}return Math.round(a.getTime()/1E3)},find_next_time:function(a,c,d){var a=new Date(a*1E3),b=2,f;switch(c){case RRDGraph.TMT.SECOND:b=7200;break;case RRDGraph.TMT.MINUTE:b=
+120;break;case RRDGraph.TMT.HOUR:b=2;break;default:b=2;break}do{switch(c){case RRDGraph.TMT.SECOND:a.setSeconds(a.getSeconds()+d);break;case RRDGraph.TMT.MINUTE:a.setMinutes(a.getMinutes()+d);break;case RRDGraph.TMT.HOUR:a.setHours(a.getHours()+d);break;case RRDGraph.TMT.DAY:a.setDate(a.getDate()+d);break;case RRDGraph.TMT.WEEK:a.setDate(a.getDate()+7*d);break;case RRDGraph.TMT.MONTH:a.setMonth(a.getMonth()+d);break;case RRDGraph.TMT.YEAR:a.setFullYear(a.getFullYear()+d)}f=Math.round(a.getTime()/
+1E3)}while(f===-1&&b-- >=0);return f},print_calc:function(){var a,c,d;c=0;var b,f=-1,g="",h;Math.round((new Date).getTime()/1E3);for(var j=0,m=this.gdes.length;j<m;j++){var n=this.gdes[j].vidx;switch(this.gdes[j].gf){case RRDGraphDesc.GF.PRINT:case RRDGraphDesc.GF.GPRINT:if(this.gdes[n].gf===RRDGraphDesc.GF.VDEF)c=this.gdes[n].vf.val,d=this.gdes[n].vf.when;else{b=(this.gdes[n].end-this.gdes[n].start)/this.gdes[n].step*this.gdes[n].ds_cnt;c=Number.NaN;a=0;for(var q=this.gdes[n].ds;q<b;q+=this.gdes[n].ds_cnt)if(isFinite(this.gdes[n].data[q]))if(isNaN(c))c=
+this.gdes[n].data[q],a++;else switch(this.gdes[j].cf){case RRDGraphDesc.CF.HWPREDICT:case RRDGraphDesc.CF.MHWPREDICT:case RRDGraphDesc.CF.DEVPREDICT:case RRDGraphDesc.CF.DEVSEASONAL:case RRDGraphDesc.CF.SEASONAL:case RRDGraphDesc.CF.AVERAGE:a++;c+=this.gdes[n].data[q];break;case RRDGraphDesc.CF.MINIMUM:c=Math.min(c,this.gdes[n].data[q]);break;case RRDGraphDesc.CF.FAILURES:case RRDGraphDesc.CF.MAXIMUM:c=Math.max(c,this.gdes[n].data[q]);break;case RRDGraphDesc.CF.LAST:c=this.gdes[n].data[q]}if(this.gdes[j].cf===
+RRDGraphDesc.CF.AVERAGE||this.gdes[j].cf>RRDGraphDesc.CF.LAST)a>1&&(c/=a)}!this.gdes[j].strftm&&(h=this.gdes[j].format.indexOf("%S"))!=-1?(f<0?(f=this.auto_scale(c,g,f),c=f[0],g=f[1],f=f[2],c===0&&(f=-1)):c/=f,this.gdes[j].format=this.gdes[j].format.substr(0,h+1)+"s"+this.gdes[j].format.substr(h+2)):!this.gdes[j].strftm&&this.gdes[j].format.indexOf("%s")!=-1&&(f=this.auto_scale(c,g,f),c=f[0],g=f[1],f=f[2]);this.gdes[j].legend=this.gdes[j].strftm?this.strftime(this.gdes[j].format,d):this.sprintf(this.gdes[j].format,
+c,g);c=1;break;case RRDGraphDesc.GF.LINE:case RRDGraphDesc.GF.AREA:case RRDGraphDesc.GF.TICK:c=1;break;case RRDGraphDesc.GF.HRULE:if(isNaN(this.gdes[j].yrule))this.gdes[j].yrule=this.gdes[n].vf.val;c=1;break;case RRDGraphDesc.GF.VRULE:if(this.gdes[j].xrule===0)this.gdes[j].xrule=this.gdes[n].vf.when;c=1;break;case RRDGraphDesc.GF.STACK:throw"STACK should already be turned into LINE or AREA here";}}return c},reduce_data:function(a,c){var d=Math.ceil(a.step/c),b,f,g,h;f=0;var j,m;a.step=c*d;j=m=0;g=
+(a.end-a.start)/c;h=a.end%a.step;if(b=a.start%a.step){a.start-=b;f=d-b/c;j+=f*a.ds_cnt;for(b=0;b<a.ds_cnt;b++)a.data[m++]=Number.NaN;g-=f}if(h)a.end=a.end-h+a.step,g-=h/c;if(g%d)throw"BUG in reduce_data(), SANITY CHECK: "+g+" rows cannot be reduced by "+d;for(f=0;g>=d;f++){for(b=0;b<a.ds_cnt;b++){var n=Number.NaN,q=0;for(i=0;i<d;i++)if(!isNaN(a.data[j+i*a.ds_cnt+b]))if(q++,isNaN(n))n=a.data[j+i*a.ds_cnt+b];else switch(a.cf_reduce){case RRDGraphDesc.CF.HWPREDICT:case RRDGraphDesc.CF.MHWPREDICT:case RRDGraphDesc.CF.DEVSEASONAL:case RRDGraphDesc.CF.DEVPREDICT:case RRDGraphDesc.CF.SEASONAL:case RRDGraphDesc.CF.AVERAGE:n+=
+a.data[j+i*a.ds_cnt+b];break;case RRDGraphDesc.CF.MINIMUM:n=Math.min(n,a.data[j+i*a.ds_cnt+b]);break;case RRDGraphDesc.CF.FAILURES:case RRDGraphDesc.CF.MAXIMUM:n=Math.max(n,a.data[j+i*a.ds_cnt+b]);break;case RRDGraphDesc.CF.LAST:n=a.data[j+i*a.ds_cnt+b]}if(q===0)n=Number.NaN;else switch(a.cf_reduce){case RRDGraphDesc.CF.HWPREDICT:case RRDGraphDesc.CF.MHWPREDICT:case RRDGraphDesc.CF.DEVSEASONAL:case RRDGraphDesc.CF.DEVPREDICT:case RRDGraphDesc.CF.SEASONAL:case RRDGraphDesc.CF.AVERAGE:n/=q}a.data[m++]=
+n}j+=a.ds_cnt*d;g-=d}if(h)for(b=0;b<a.ds_cnt;b++)a.data[m++]=Number.NaN},data_fetch:function(){for(var a,c=0,d=this.gdes.length;c<d;c++)if(this.gdes[c].gf==RRDGraphDesc.GF.DEF){a=!1;for(var b=0;b<c;b++)if(this.gdes[b].gf==RRDGraphDesc.GF.DEF){if(this.gdes[c].rrd===this.gdes[b].rrd&&this.gdes[c].cf===this.gdes[b].cf&&this.gdes[c].cf_reduce===this.gdes[b].cf_reduce&&this.gdes[c].start_orig===this.gdes[b].start_orig&&this.gdes[c].end_orig===this.gdes[b].end_orig&&this.gdes[c].step_orig===this.gdes[b].step_orig)this.gdes[c].start=
+this.gdes[b].start,this.gdes[c].end=this.gdes[b].end,this.gdes[c].step=this.gdes[b].step,this.gdes[c].ds_cnt=this.gdes[b].ds_cnt,this.gdes[c].ds_namv=this.gdes[b].ds_namv,this.gdes[c].data=this.gdes[b].data,this.gdes[c].data_first=0,a=!0;if(a)break}if(!a){a=this.gdes[c].step;a=this.rrd_fetch(this.gdes[c],a);if(a<0)return-1;this.gdes[c].data_first=1;a<this.gdes[c].step?this.reduce_data(this.gdes[c],a):this.gdes[c].step=a}for(b=0;b<this.gdes[c].ds_cnt;b++)if(this.gdes[c].ds_namv[b]===this.gdes[c].ds_nam){this.gdes[c].ds=
+b;break}if(this.gdes[c].ds===-1)throw"No DS called '"+this.gdes[c].ds_nam+"' in '"+this.gdes[c].rrd+"'";}return 0},lcd:function(a){for(var c,d=0;a[d+1]!=0;d++){do c=a[d]%a[d+1],a[d]=a[d+1],a[d+1]=c;while(c!=0);a[d+1]=a[d]}return a[d]},data_calc:function(){for(var a,c,d=0,b=this.gdes.length;d<b;d++)switch(this.gdes[d].gf){case RRDGraphDesc.GF.SHIFT:a=this.gdes[this.gdes[d].vidx];a.start-=a.shift;a.end-=a.shift;a.shift=this.gdes[d].shidx>=0?this.gdes[this.gdes[d].shidx].vf.val:this.gdes[d].shval;a.shift=
+a.shift/a.step*a.step;a.start+=a.shift;a.end+=a.shift;break;case RRDGraphDesc.GF.VDEF:this.gdes[d].ds_cnt=0;if(this.vdef_calc(d))throw"Error processing VDEF '"+this.gdes[d].vname+"%s'";break;case RRDGraphDesc.GF.CDEF:this.gdes[d].ds_cnt=1;this.gdes[d].ds=0;this.gdes[d].data_first=1;this.gdes[d].start=0;this.gdes[d].end=0;c=[];var f=0;a=-1;for(var g=this.gdes[d].rpnp.rpnp,h=0;g[h].op!=RRDRpn.OP.END;h++)if(g[h].op===RRDRpn.OP.VARIABLE||g[h].op===RRDRpn.OP.PREV_OTHER){var j=g[h].ptr;if(this.gdes[j].ds_cnt===
+0)g[h].val=this.gdes[j].vf.val,g[h].op=RRDRpn.OP.NUMBER;else{++f;c[f-1]=this.gdes[j].step;if(this.gdes[d].start<this.gdes[j].start)this.gdes[d].start=this.gdes[j].start;if(this.gdes[d].end===0||this.gdes[d].end>this.gdes[j].end)this.gdes[d].end=this.gdes[j].end;g[h].data=this.gdes[j].data;g[h].pdata=this.gdes[j].ds;g[h].step=this.gdes[j].step;g[h].ds_cnt=this.gdes[j].ds_cnt}}for(h=0;g[h].op!=RRDRpn.OP.END;h++)if(g[h].op===RRDRpn.OP.VARIABLE||g[h].op===RRDRpn.OP.PREV_OTHER){var j=g[h].ptr,m=this.gdes[d].start-
+this.gdes[j].start;m>0&&(g[h].pdata+=m/this.gdes[j].step*this.gdes[j].ds_cnt)}if(c===null)throw"rpn expressions without DEF or CDEF variables are not supported";c[f]=0;this.gdes[d].step=this.lcd(c);this.gdes[d].data=[];for(c=this.gdes[d].start+this.gdes[d].step;c<=this.gdes[d].end;c+=this.gdes[d].step)if(this.gdes[d].rpnp.calc(c,this.gdes[d].data,++a)===-1)return-1}return 0},data_proc:function(){for(var a=(this.end-this.start)/this.xsize,c,d=Number.NaN,b=Number.NaN,f,g=0,h=this.gdes.length;g<h;g++)if(this.gdes[g].gf===
+RRDGraphDesc.GF.LINE||this.gdes[g].gf===RRDGraphDesc.GF.AREA||this.gdes[g].gf===RRDGraphDesc.GF.TICK)this.gdes[g].p_data=[];for(g=0;g<this.xsize;g++){var j;f=this.start+a*g;for(var m=c=0,h=this.gdes.length;m<h;m++)switch(this.gdes[m].gf){case RRDGraphDesc.GF.LINE:case RRDGraphDesc.GF.AREA:case RRDGraphDesc.GF.TICK:this.gdes[m].stack||(c=0);j=this.gdes[m].yrule;if(isNaN(j)||this.gdes[m].gf===RRDGraphDesc.GF.TICK)j=this.gdes[m].vidx,j=this.gdes[j].gf===RRDGraphDesc.GF.VDEF?this.gdes[j].vf.val:f>=this.gdes[j].start&&
+f<this.gdes[j].end?this.gdes[j].data[Math.floor((f-this.gdes[j].start)/this.gdes[j].step)*this.gdes[j].ds_cnt+this.gdes[j].ds]:Number.NaN;if(isNaN(j))this.gdes[m].p_data[g]=Number.NaN;else if(c+=j,this.gdes[m].p_data[g]=c,isFinite(c)&&this.gdes[m].gf!=RRDGraphDesc.GF.TICK){if((isNaN(d)||c<d)&&!(this.logarithmic&&c<=0))d=c;if(isNaN(b)||c>b)b=c}break;case RRDGraphDesc.GF.STACK:throw"STACK should already be turned into LINE or AREA here";}}if(this.logarithmic){if(isNaN(d)||isNaN(b)||b<=0)d=0,b=5.1;d<=
+0&&(d=b/1E9)}else if(isNaN(d)||isNaN(b))d=0,b=1;if(isNaN(this.minval)||!this.rigid&&this.minval>d)this.minval=this.logarithmic?d/2:d;if(isNaN(this.maxval)||!this.rigid&&this.maxval<b)this.maxval=this.logarithmic?b*2:b;if(this.minval>this.maxval)this.minval=this.minval>0?0.99*this.maxval:1.01*this.maxval;if(this.AlmostEqual2sComplement(this.minval,this.maxval,4)&&(this.maxval*=this.maxval>0?1.01:0.99,this.AlmostEqual2sComplement(this.maxval,0,4)))this.maxval=1;return 0},leg_place:function(a){var c=
+this.TEXT.LEGEND.size*1.5,d=this.TEXT.LEGEND.size*1.5,b=0,f,g,h=0;f=d;var j=0,m;m=0;var n;n=0;var q=RRDGraphDesc.TXA.JUSTIFIED,p,l;g=a?0:this.legendwidth-2*d;if(!this.no_legend&&!this.only_graph){p=[];for(var o=0,E=this.gdes.length;o<E;o++){var w;if(a)l=this.gdes[o].legend;f=b;if(this.gdes[o].gf===RRDGraphDesc.GF.TEXTALIGN)q=this.gdes[o].txtalign;if(!this.force_rules_legend){if(this.gdes[o].gf===RRDGraphDesc.GF.HRULE&&(this.gdes[o].yrule<this.minval||this.gdes[o].yrule>this.maxval))this.gdes[o].legend=
+null;if(this.gdes[o].gf===RRDGraphDesc.GF.VRULE&&(this.gdes[o].xrule<this.start||this.gdes[o].xrule>this.end))this.gdes[o].legend=null}this.gdes[o].legend=this.gdes[o].legend.replace(/\\t/gi,"\t");m=this.gdes[o].legend.length;m>=2&&this.gdes[o].legend.charAt(m-2)==="\\"?(w=this.gdes[o].legend.charAt(m-1),m-=2,this.gdes[o].legend=this.gdes[o].legend.substr(0,m)):w=null;if(w!="l"&&w!="n"&&w!="r"&&w!="j"&&w!="c"&&w!="u"&&w!="s"&&w!=null&&w!="g")throw"Unknown control code at the end of "+this.gdes[o].legend+
+": "+w;for(w==="n"&&(w="l");w==="g"&&m>0&&this.gdes[o].legend.charAt(m-1)===" ";)m--,this.gdes[o].legend=this.gdes[o].legend.substr(0,m);m!=0?(p[o]=w==="g"?0:c,b>0&&(b+=p[o]),b+=this.gfx_get_text_width(b+d,this.TEXT.LEGEND,this.tabwidth,this.gdes[o].legend),h++):p[o]=0;w==="g"&&(w=null);if(w===null){a&&b>g&&(g=b);if(o===E-1||b>g)switch(q){case RRDGraphDesc.TXA.RIGHT:w="r";break;case RRDGraphDesc.TXA.CENTER:w="c";break;case RRDGraphDesc.TXA.JUSTIFIED:w="j";break;default:w="l"}b>g&&h>1&&(o--,b=f,h--);
+h===1&&w==="j"&&(w="l")}if(w!=null){f=d;m=h>=2&&w==="j"?(g-b)/(h-1):0;w==="c"&&(f=(g-b)/2);for(w==="r"&&(f=g-b+d);n<=o;n++)if(this.gdes[n].legend!=="")this.gdes[n].leg_x=f,this.gdes[n].leg_y=j+d,f+=this.gfx_get_text_width(f,this.TEXT.LEGEND,this.tabwidth,this.gdes[n].legend)+p[n]+m;if(f>d||w==="s")j+=this.TEXT.LEGEND.size*1.4;w==="s"&&(j-=this.TEXT.LEGEND.size);w==="u"&&(j-=this.TEXT.LEGEND.size*1.4);a&&b>g&&(g=b);h=b=0}if(a)this.gdes[o].legend=l}a?this.legendwidth=g+2*d:this.legendheight=j+d*0.6}return 0},
+axis_paint:function(){this.gfx_line(this.xorigin-4,this.yorigin,this.xorigin+this.xsize+4,this.yorigin,this.MGRIDWIDTH,this.GRC.AXIS);this.gfx_line(this.xorigin,this.yorigin+4,this.xorigin,this.yorigin-this.ysize-4,this.MGRIDWIDTH,this.GRC.AXIS);this.gfx_new_area(this.xorigin+this.xsize+2,this.yorigin-3,this.xorigin+this.xsize+2,this.yorigin+3,this.xorigin+this.xsize+7,this.yorigin,this.GRC.ARROW);this.gfx_close_path();this.gfx_new_area(this.xorigin-3,this.yorigin-this.ysize-2,this.xorigin+3,this.yorigin-
+this.ysize-2,this.xorigin,this.yorigin-this.ysize-7,this.GRC.ARROW);this.gfx_close_path();this.second_axis_scale!=0&&(this.gfx_line(this.xorigin+this.xsize,this.yorigin+4,this.xorigin+this.xsize,this.yorigin-this.ysize-4,MGRIDWIDTH,this.GRC.AXIS),this.gfx_new_area(this.xorigin+this.xsize-2,this.yorigin-this.ysize-2,this.xorigin+this.xsize+3,this.yorigin-this.ysize-2,this.xorigin+this.xsize,this.yorigin-this.ysize-7,this.GRC.ARROW),this.gfx_close_path())},frexp10:function(a){var c,d;d=Math.floor(Math.log(Math.abs(a))/
+Math.LN10);c=a/Math.pow(10,d);c>=10&&(d++,c=a/Math.pow(10,d));return[c,d]},horizontal_log_grid:function(){var a=[[1,10,0,0,0,0,0,0,0,0],[1,5,10,0,0,0,0,0,0,0],[1,2,5,7,10,0,0,0,0,0],[1,2,4,6,8,10,0,0,0,0],[1,2,3,4,5,6,7,8,9,10],[0,0,0,0,0,0,0,0,0,0]],c,d,b,f,g,h=1,j=-1,m,n,q,p,l;for(g=this.ysize/(Math.log(this.maxval/this.minval)/Math.LN10);g*h<2.3*this.TEXT.LEGEND.size;)h===1?h=2.3:h+=2.3;do{j++;for(c=0;a[j][c+1]<10;c++);b=g*Math.log(10/a[j][c])/Math.LN10}while(b>1.56*this.TEXT.LEGEND.size&&a[j][0]>
+0);j&&j--;g=-1;do g++,m=this.frexp10(this.minval),b=m[0],n=m[1];while(a[j][g]<10&&b>a[j][g]);a[j][g]===10&&(n+=1,g=0);b=n;b%h&&(b+=Math.abs(-b%h));q=this.xorigin;p=this.xorigin+this.xsize;for(n=Number.NaN;;){m=a[j][g]*Math.pow(10,b);if(this.AlmostEqual2sComplement(m,n,4))break;n=m;l=this.ytr(m);if(Math.floor(l+0.5)<=this.yorigin-this.ysize)break;this.gfx_line(q-2,l,q,l,this.MGRIDWIDTH,this.GRC.MGRID);this.gfx_line(p,l,p+2,l,this.MGRIDWIDTH,this.GRC.MGRID);this.gfx_dashed_line(q-2,l,p+2,l,this.MGRIDWIDTH,
+this.GRC.MGRID,this.grid_dash_on,this.grid_dash_off);this.force_units_si?(c=Math.floor(b/3),d=m>=1?Math.pow(10,b%3):Math.pow(10,(b+1)%3+2),d*=a[j][g],c=this.sprintf("%3.0f %s",d,c+this.si_symbcenter<this.si_symbol.length&&c+this.si_symbcenter>=0?this.si_symbol[c+this.si_symbcenter]:"?")):c=this.sprintf("%3.0e",m);this.second_axis_scale!=0&&(d=m*this.second_axis_scale+this.second_axis_shift,this.second_axis_format[0]?m=this.sprintf(this.second_axis_format,d,""):this.force_units_si?(m="",m=this.auto_scale(d,
+m,1),d=m[0],m=m[1],m=this.sprintf("%4.0f %s",d,m)):m=this.sprintf("%3.0e",d),this.gfx_text(p+7,l,this.GRC.FONT,this.TEXT.AXIS,this.tabwidth,0,this.GFX_H.LEFT,this.GFX_V.CENTER,m));this.gfx_text(q-this.TEXT.AXIS.size,l,this.GRC.FONT,this.TEXT.AXIS,this.tabwidth,0,this.GFX_H.RIGHT,this.GFX_V.CENTER,c);if(j<4&&h===1){if(g===0){f=b-1;for(c=1;a[j][c]<10;c++);c=a[j][c-1]+1;d=10}else f=b,c=a[j][g-1]+1,d=a[j][g];for(;c<d;c++)if(m=c*Math.pow(10,f),!(m<this.minval)){l=this.ytr(m);if(Math.floor(l+0.5)<=this.yorigin-
+this.ysize)break;this.gfx_line(q-2,l,q,l,this.GRIDWIDTH,this.GRC.GRID);this.gfx_line(p,l,p+2,l,this.GRIDWIDTH,this.GRC.GRID);this.gfx_dashed_line(q-1,l,p+1,l,this.GRIDWIDTH,this.GRC.GRID,this.grid_dash_on,this.grid_dash_off)}}else if(h>1)for(c=b-h/3*2;c<b;c+=h/3)if(m=Math.pow(10,c),!(m<this.minval)){l=this.ytr(m);if(Math.floor(l+0.5)<=this.yorigin-this.ysize)break;this.gfx_line(q-2,l,q,l,this.GRIDWIDTH,this.GRC.GRID);this.gfx_line(p,l,p+2,l,this.GRIDWIDTH,this.GRC.GRID);this.gfx_dashed_line(q-1,l,
+p+1,l,this.GRIDWIDTH,this.GRC.GRID,this.grid_dash_on,this.grid_dash_off)}a[j][++g]===10&&(g=0,b+=h)}if(j<4&&h===1){if(g===0){f=b-1;for(c=1;a[j][c]<10;c++);c=a[j][c-1]+1;d=10}else f=b,c=a[j][g-1]+1,d=a[j][g];for(;c<d;c++)if(m=c*Math.pow(10,f),!(m<this.minval)){l=this.ytr(m);if(Math.floor(l+0.5)<=this.yorigin-this.ysize)break;this.gfx_line(q-2,l,q,l,this.GRIDWIDTH,this.GRC.GRID);this.gfx_line(p,l,p+2,l,this.GRIDWIDTH,this.GRC.GRID);this.gfx_dashed_line(q-1,l,p+1,l,this.GRIDWIDTH,this.GRC.GRID,this.grid_dash_on,
+this.grid_dash_off)}}else if(h>1)for(c=b-h/3*2;c<b;c+=h/3)if(m=Math.pow(10,c),!(m<this.minval)){l=this.ytr(m);if(Math.floor(l+0.5)<=this.yorigin-this.ysize)break;this.gfx_line(q-2,l,q,l,this.GRIDWIDTH,this.GRC.GRID);this.gfx_line(p,l,p+2,l,this.GRIDWIDTH,this.GRC.GRID);this.gfx_dashed_line(q-1,l,p+1,l,this.GRIDWIDTH,this.GRC.GRID,this.grid_dash_on,this.grid_dash_off)}return 1},vertical_grid:function(){var a,c,d,b,f;if(this.xlab_user.minsec===-1){d=(this.end-this.start)/this.xsize;for(a=0;this.xlab[a+
+1].minsec!=-1&&this.xlab[a+1].minsec<=d;)a++;for(a===0&&(a=1);this.xlab[a-1].minsec===this.xlab[a].minsec&&this.xlab[a].length>this.end-this.start;)a--;this.xlab_user=this.xlab[a]}d=this.yorigin;f=this.yorigin-this.ysize;if(!this.no_minor)for(a=this.find_first_time(this.start,this.xlab_user.gridtm,this.xlab_user.gridst),c=this.find_first_time(this.start,this.xlab_user.mgridtm,this.xlab_user.mgridst);a<this.end&&a!=-1;a=this.find_next_time(a,this.xlab_user.gridtm,this.xlab_user.gridst))if(!(a<this.start||
+a>this.end)){for(;c<a&&c!=-1;)c=this.find_next_time(c,this.xlab_user.mgridtm,this.xlab_user.mgridst);if(c===-1)break;a!==c&&(b=this.xtr(a),this.gfx_line(b,f-2,b,f,this.GRIDWIDTH,this.GRC.GRID),this.gfx_line(b,d,b,d+2,this.GRIDWIDTH,this.GRC.GRID),this.gfx_dashed_line(b,d+1,b,f-1,this.GRIDWIDTH,this.GRC.GRID,this.grid_dash_on,this.grid_dash_off))}for(a=this.find_first_time(this.start,this.xlab_user.mgridtm,this.xlab_user.mgridst);a<this.end&&a!=-1;a=this.find_next_time(a,this.xlab_user.mgridtm,this.xlab_user.mgridst))a<
+this.start||a>this.end||(b=this.xtr(a),this.gfx_line(b,f-2,b,f,this.MGRIDWIDTH,this.GRC.MGRID),this.gfx_line(b,d,b,d+3,this.MGRIDWIDTH,this.GRC.MGRID),this.gfx_dashed_line(b,d+3,b,f-2,this.MGRIDWIDTH,this.GRC.MGRID,this.grid_dash_on,this.grid_dash_off));for(a=this.find_first_time(this.start-this.xlab_user.precis/2,this.xlab_user.labtm,this.xlab_user.labst);a<=this.end-this.xlab_user.precis/2&&a!=-1;a=this.find_next_time(a,this.xlab_user.labtm,this.xlab_user.labst))c=a+this.xlab_user.precis/2,c<this.start||
+c>this.end||(b=this.xlab_user.stst(new Date(c*1E3)),this.gfx_text(this.xtr(c),d+3,this.GRC.FONT,this.TEXT.AXIS,this.tabwidth,0,this.GFX_H.CENTER,this.GFX_V.TOP,b))},auto_scale:function(a,c,d){var c="a,f,p,n,u,m, ,k,M,G,T,P,E".split(","),b;a===0||isNaN(a)?(b=0,d=1):(b=Math.floor(Math.log(Math.abs(a))/Math.LN10/(Math.log(this.base)/Math.LN10)),d=Math.pow(this.base,b),a/=d);c=b<=6&&b>=-6?c[b+6]:"?";return[a,c,d]},si_unit:function(){var a,c=0;a=Math.floor(Math.log(Math.max(Math.abs(this.minval),Math.abs(this.maxval)))/
+Math.log(this.base));c=this.unitsexponent!=9999?Math.floor(this.unitsexponent/3):a;this.magfact=Math.pow(this.base,a);this.viewfactor=this.magfact/Math.pow(this.base,c);this.symbol=c+this.si_symbcenter<this.si_symbol.length&&c+this.si_symbcenter>=0?this.si_symbol[c+this.si_symbcenter]:"?"},expand_range:function(){var a=[1E3,900,800,750,700,600,500,400,300,250,200,125,100,90,80,75,70,60,50,40,30,25,20,10,9,8,7,6,5,4,3.5,3,2.5,2,1.8,1.5,1.2,1,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0,-1],c,d,b;if(isNaN(this.ygridstep))if(this.alt_autoscale)c=
+this.maxval-this.minval,a=c*0.1,d=2*Math.pow(10,Math.floor(Math.log(Math.max(Math.abs(this.minval),Math.abs(this.maxval))/this.magfact)/Math.LN10)-2),c<d&&(a=(d-c)*0.55),this.minval-=a,this.maxval+=a;else if(this.alt_autoscale_min)a=(this.maxval-this.minval)*0.1,this.minval-=a;else if(this.alt_autoscale_max)a=(this.maxval-this.minval)*0.1,this.maxval+=a;else{c=this.minval/this.magfact;d=this.maxval/this.magfact;for(b=1;a[b]>0;b++){if(a[b-1]>=c&&a[b]<=c)this.minval=a[b]*this.magfact;if(-a[b-1]<=c&&
+-a[b]>=c)this.minval=-a[b-1]*this.magfact;if(a[b-1]>=d&&a[b]<=d)this.maxval=a[b-1]*this.magfact;if(-a[b-1]<=d&&-a[b]>=d)this.maxval=-a[b]*this.magfact}}else this.minval=this.ylabfact*this.ygridstep*Math.floor(this.minval/(this.ylabfact*this.ygridstep)),this.maxval=this.ylabfact*this.ygridstep*Math.ceil(this.maxval/(this.ylabfact*this.ygridstep))},calc_horizontal_grid:function(){var a,c,d,b=0;this.ygrid_scale.labfact=2;a=this.maxval-this.minval;c=a/this.magfact;if(isNaN(c)||!isFinite(c))return!1;d=
+1;if(isNaN(this.ygridstep))if(this.alt_ygrid){c=Math.ceil(Math.log(Math.max(Math.abs(this.maxval),Math.abs(this.minval))*this.viewfactor/this.magfact)/Math.LN10);c<=0&&(c=1);this.ygrid_scale.gridstep=Math.pow(10,Math.floor(Math.log(a*this.viewfactor/this.magfact)/Math.LN10))/this.viewfactor*this.magfact;if(this.ygrid_scale.gridstep===0)this.ygrid_scale.gridstep=0.1;a/this.ygrid_scale.gridstep<5&&this.ygrid_scale.gridstep>=30&&(this.ygrid_scale.gridstep/=10);a/this.ygrid_scale.gridstep>15&&(this.ygrid_scale.gridstep*=
+10);if(a/this.ygrid_scale.gridstep>5){if(this.ygrid_scale.labfact=1,a/this.ygrid_scale.gridstep>8||this.ygrid_scale.gridstep<1.8*this.TEXT.AXIS.size)this.ygrid_scale.labfact=2}else this.ygrid_scale.gridstep/=5,this.ygrid_scale.labfact=5;a=Math.floor(Math.log(this.ygrid_scale.gridstep*this.ygrid_scale.labfact*this.viewfactor/this.magfact)/Math.LN10);if(a<0){c=c-a+1;if(this.unitslength<c+2)this.unitslength=c+2;this.ygrid_scale.labfmt=this.sprintf("%%%d.%df%s",c,-a,this.symbol!=" "?" %s":"")}else{c+=
+1;if(this.unitslength<c+2)this.unitslength=c+2;this.ygrid_scale.labfmt=this.sprintf("%%%d.0f%s",c,this.symbol!=" "?" %s":"")}}else{for(a=0;this.ylab[a].grid>0;a++)if(d=this.ysize/(c/this.ylab[a].grid),b=a,d>=5)break;for(a=0;a<4;a++)if(d*this.ylab[b].lfac[a]>=1.8*this.TEXT.AXIS.size){this.ygrid_scale.labfact=this.ylab[b].lfac[a];break}this.ygrid_scale.gridstep=this.ylab[b].grid*this.magfact}else this.ygrid_scale.gridstep=this.ygridstep,this.ygrid_scale.labfact=this.ylabfact;return!0},draw_horizontal_grid:function(){var a,
+c,d,b=0,f=this.xorigin,g=this.xorigin+this.xsize,h=Math.round(this.minval/this.ygrid_scale.gridstep-1),j=Math.round(this.maxval/this.ygrid_scale.gridstep+1),m,n=0,q="",p;c=this.ygrid_scale.gridstep/this.magfact*this.viewfactor;m=c*j;for(a=h;a<=j;a++)if(p=this.ytr(this.ygrid_scale.gridstep*a),d=this.ytr(this.ygrid_scale.gridstep*(a+1)),Math.floor(p+0.5)>=this.yorigin-this.ysize&&Math.floor(p+0.5)<=this.yorigin)if(a%this.ygrid_scale.labfact===0||b===1&&(d<this.yorigin-this.ysize||d>this.yorigin)){this.symbol===
+" "?d=this.alt_ygridf?this.sprintf(this.ygrid_scale.labfmt,c*a):m<10?this.sprintf("%4.1f",c*a):this.sprintf("%4.0f",c*a):(d=a===0?" ":this.symbol,d=this.alt_ygrid?this.sprintf(this.ygrid_scale.labfmt,c*a,d):m<10?this.sprintf("%4.1f %s",c*a,d):this.sprintf("%4.0f %s",c*a,d));b++;if(this.second_axis_scale!=0){var l;sval=this.ygrid_scale.gridstep*a*this.second_axis_scale+this.second_axis_shift;this.second_axis_format?l=this.sprintf(this.second_axis_format,sval):(n||(n=this.auto_scale(this.ygrid_scale.gridstep*
+(h+j)/2*this.second_axis_scale+this.second_axis_shift,q,n),q=n[1],n=n[2]),sval/=n,l=m<10?this.sprintf("%5.1f %s",sval,q):this.sprintf("%5.0f %s",sval,q));this.gfx_text(g+7,p,this.GRC.FONT,this.TEXT.AXIS,this.tabwidth,0,this.GFX_H.LEFT,this.GFX_V.CENTER,l)}this.gfx_text(f-this.TEXT.AXIS.size,p,this.GRC.FONT,this.TEXT.AXIS,this.tabwidth,0,this.GFX_H.RIGHT,this.GFX_V.CENTER,d);this.gfx_line(f-2,p,f,p,this.MGRIDWIDTH,this.GRC.MGRID);this.gfx_line(g,p,g+2,p,this.MGRIDWIDTH,this.GRC.MGRID);this.gfx_dashed_line(f-
+2,p,g+2,p,this.MGRIDWIDTH,this.GRC.MGRID,this.grid_dash_on,this.grid_dash_off)}else this.no_minor||(this.gfx_line(f-2,p,f,p,this.GRIDWIDTH,this.GRC.GRID),this.gfx_line(g,p,g+2,p,this.GRIDWIDTH,this.GRC.GRID),this.gfx_dashed_line(f-1,p,g+1,p,this.GRIDWIDTH,this.GRC.GRID,this.grid_dash_on,this.grid_dash_off));return 1},grid_paint:function(){var a;a=0;var c,d;if(this.draw_3d_border>0)a=this.draw_3d_border,this.gfx_new_area(0,this.yimg,a,this.yimg-a,a,a,this.GRC.SHADEA),this.gfx_add_point(this.ximg-a,
+a),this.gfx_add_point(this.ximg,0),this.gfx_add_point(0,0),this.gfx_close_path(),this.gfx_new_area(a,this.yimg-a,this.ximg-a,this.yimg-a,this.ximg-a,a,this.GRC.SHADEB),this.gfx_add_point(this.ximg,0),this.gfx_add_point(this.ximg,this.yimg),this.gfx_add_point(0,this.yimg),this.gfx_close_path();this.draw_x_grid&&this.vertical_grid();this.draw_y_grid&&((a=this.logarithmic?this.horizontal_log_grid():this.draw_horizontal_grid())||this.gfx_text(this.ximg/2,(2*this.yorigin-this.ysize)/2,this.GRC.FONT,this.TEXT.AXIS,
+this.tabwidth,0,this.GFX_H.CENTER,this.GFX_V.CENTER,"No Data found"));this.ylegend&&this.gfx_text(this.xOriginLegendY+10,this.yOriginLegendY,this.GRC.FONT,this.TEXT.UNIT,this.tabwidth,this.YLEGEND_ANGLE,this.GFX_H.CENTER,this.GFX_V.CENTER,this.ylegend);this.second_axis_legend&&this.gfx_text(this.xOriginLegendY2+10,this.yOriginLegendY2,this.GRC.FONT,this.TEXT.UNIT,this.tabwidth,this.YLEGEND_ANGLE,this.GFX_H.CENTER,this.GFX_V.CENTER,this.second_axis_legend);this.gfx_text(this.xOriginTitle,this.yOriginTitle+
+6,this.GRC.FONT,this.TEXT.TITLE,this.tabwidth,0,this.GFX_H.CENTER,this.GFX_V.TOP,this.title);this.no_rrdtool_tag||(a=this.parse_color(this.GRC.FONT),a[3]=0.3,a=this.color2rgba(a),this.gfx_text(this.legendposition===this.LEGEND_POS.EAST?this.xOriginLegendY:this.ximg-4,5,a,this.TEXT.WATERMARK,this.tabwidth,-90,this.GFX_H.LEFT,this.GFX_V.TOP,"RRDTOOL / TOBI OETIKER"));this.watermark&&(a=this.parse_color(this.GRC.FONT),a[3]=0.3,a=this.color2rgba(a),this.gfx_text(this.ximg/2,this.yimg-6,a,this.TEXT.FONT,
+this.tabwidth,0,this.GFX_H.CENTER,this.GFX_V.BOTTOM,this.watermark));var b;if(!this.no_legend&&!this.only_graph)for(a=0,b=this.gdes.length;a<b;a++)if(this.gdes[a].legend&&(c=this.xOriginLegend+this.gdes[a].leg_x,d=this.legenddirection===this.LEGEND_DIR.TOP_DOWN?this.yOriginLegend+this.gdes[a].leg_y:this.yOriginLegend+this.legendheight-this.gdes[a].leg_y,this.gfx_text(c,d,this.GRC.FONT,this.TEXT.LEGEND,this.tabwidth,0,this.GFX_H.LEFT,this.GFX_V.BOTTOM,this.gdes[a].legend),this.gdes[a].gf!=RRDGraphDesc.GF.PRINT&&
+this.gdes[a].gf!=RRDGraphDesc.GF.GPRINT&&this.gdes[a].gf!=RRDGraphDesc.GF.COMMENT)){var f,g;g=f=this.gfx_get_text_width(0,this.TEXT.LEGEND,this.tabwidth,"o")*1.2;d-=g*0.4;this.dynamic_labels&&this.gdes[a].gf===RRDGraphDesc.GF.HRULE?this.gfx_line(c,d-g/2,c+f,d-g/2,1,this.gdes[a].col):this.dynamic_labels&&this.gdes[a].gf===RRDGraphDesc.GF.VRULE?this.gfx_line(c+f/2,d,c+f/2,d-g,1,this.gdes[a].col):this.dynamic_labels&&this.gdes[a].gf===RRDGraphDesc.GF.LINE?this.gfx_line(c,d,c+f,d-g,this.gdes[a].linewidth,
+this.gdes[a].col):(this.gfx_new_area(c,d-g,c,d,c+f,d,this.GRC.BACK),this.gfx_add_point(Math.round(c+f)+0.5,Math.round(d-g)+0.5),this.gfx_close_path(),this.gfx_new_area(c,d-g,c,d,c+f,d,this.gdes[a].col),this.gfx_add_point(Math.round(c+f)+0.5,Math.round(d-g)+0.5),this.gfx_close_path(),this.ctx.save(),this.ctx.beginPath(),this.ctx.lineWidth=1,f=c+f,g=d-g,c=Math.round(c)+0.5,f=Math.round(f)+0.5,d=Math.round(d)+0.5,g=Math.round(g)+0.5,this.ctx.moveTo(c,d),this.ctx.lineTo(f,d),this.ctx.lineTo(f,g),this.ctx.lineTo(c,
+g),this.ctx.closePath(),this.ctx.strokeStyle=this.GRC.FRAME,this.ctx.stroke(),this.ctx.restore())}},graph_size_location:function(a){var c=0,d=0,b=0,f=0,g=0,h=0,j=0,m=4;if(this.only_graph)return this.xorigin=0,this.ximg=this.xsize,this.yorigin=this.yimg=this.ysize,this.ytr(Number.NaN),0;this.watermark&&(m=this.TEXT.WATERMARK.size*1.5);this.ylegend&&(c=this.TEXT.UNIT.size*1.5);this.second_axis_legend&&(d=this.TEXT.UNIT.size*1.5);b=this.title?this.TEXT.TITLE.size*1.95+10:22.5;if(a&&(this.draw_x_grid&&
+(j=this.TEXT.AXIS.size*1.35),this.draw_y_grid||this.forceleftspace))f=this.gfx_get_text_width(0,this.TEXT.AXIS,this.tabwidth,"0")*this.unitslength;f+=15;this.legendwidth=this.legendheight=0;if(!this.no_legend&&(this.legendposition===this.LEGEND_POS.WEST||this.legendposition===this.LEGEND_POS.EAST)&&this.leg_place(1)===-1)return-1;if(this.full_size_mode){this.ximg=this.xsize;this.yimg=this.ysize;g=this.ximg;h=this.yimg;g-=f;if((this.legendposition===this.LEGEND_POS.WEST||this.legendposition===this.LEGEND_POS.EAST)&&
+!this.no_legend)g-=this.legendwidth;this.second_axis_scale!=0&&(g-=f);this.no_rrdtool_tag||(g-=15);g-=c+d;g<1&&(g=1);this.xsize=g;if(!this.no_legend&&(this.legendposition===this.LEGEND_POS.NORTH||this.legendposition===this.LEGEND_POS.SOUTH))if(this.legendwidth=this.ximg,this.leg_place(0)===-1)return-1;h-=(this.legendposition===this.LEGEND_POS.NORTH||this.legendposition===this.LEGEND_POS.SOUTH)&&!this.no_legend?j+this.legendheight:j;h-=b;this.nolegened&&(h-=15);this.watermark&&(h-=m);h<1&&(h=1);this.ysize=
+h}else{if(a)g=this.xsize+15,h=this.ysize;this.ximg=g+f;this.no_rrdtool_tag||(this.ximg+=15);if((this.legendposition===this.LEGEND_POS.WEST||this.legendposition===this.LEGEND_POS.EAST)&&!this.no_legend)this.ximg+=this.legendwidth;this.second_axis_scale!=0&&(this.ximg+=f);this.ximg+=c+d;if(!this.no_legend&&(this.legendposition===this.LEGEND_POS.NORTH||this.legendposition===this.LEGEND_POS.SOUTH))if(this.legendwidth=this.ximg,this.leg_place(0)===-1)return-1;this.yimg=h+j;if((this.legendposition===this.LEGEND_POS.NORTH||
+this.legendposition===this.LEGEND_POS.SOUTH)&&!this.no_legend)this.yimg+=this.legendheight;this.yimg+=b?b:22.5;this.no_legend&&(this.yimg+=15);this.watermark&&(this.yimg+=m)}if(!this.no_legend&&(this.legendposition===this.LEGEND_POS.WEST||this.legendposition===this.LEGEND_POS.EAST)&&this.leg_place(0)===-1)return-1;switch(this.legendposition){case this.LEGEND_POS.NORTH:this.xOriginTitle=Math.round(c+f+this.xsize/2);this.xOriginLegend=this.yOriginTitle=0;this.yOriginLegend=Math.round(b);this.xOriginLegendY=
+0;this.yOriginLegendY=Math.round(b+this.legendheight+h/2+j);this.xorigin=Math.round(c+f);this.yorigin=Math.round(b+this.legendheight+h);this.xOriginLegendY2=Math.round(c+f+g);this.second_axis_scale!=0&&(this.xOriginLegendY2+=f);this.yOriginLegendY2=Math.round(b+this.legendheight+h/2+j);break;case this.LEGEND_POS.WEST:this.xOriginTitle=Math.round(this.legendwidth+c+f+this.xsize/2);this.xOriginLegend=this.yOriginTitle=0;this.yOriginLegend=Math.round(b);this.xOriginLegendY=Math.round(this.legendwidth);
+this.yOriginLegendY=Math.round(b+h/2);this.xorigin=Math.round(this.legendwidth+c+f);this.yorigin=Math.round(b+h);this.xOriginLegendY2=Math.round(this.legendwidth+c+f+g);this.second_axis_scale!=0&&(this.xOriginLegendY2+=f);this.yOriginLegendY2=Math.round(b+h/2);break;case this.LEGEND_POS.SOUTH:this.xOriginTitle=Math.round(c+f+this.xsize/2);this.xOriginLegend=this.yOriginTitle=0;this.yOriginLegend=Math.round(b+h+j);this.xOriginLegendY=0;this.yOriginLegendY=Math.round(b+h/2);this.xorigin=Math.round(c+
+f);this.yorigin=Math.round(b+h);this.xOriginLegendY2=Math.round(c+f+g);this.second_axis_scale!=0&&(this.xOriginLegendY2+=f);this.yOriginLegendY2=Math.round(b+h/2);break;case this.LEGEND_POS.EAST:this.xOriginTitle=Math.round(c+f+this.xsize/2),this.yOriginTitle=0,this.xOriginLegend=Math.round(c+f+g+d),this.second_axis_scale!=0&&(this.xOriginLegend+=f),this.yOriginLegend=Math.round(b),this.xOriginLegendY=0,this.yOriginLegendY=Math.round(b+h/2),this.xorigin=Math.round(c+f),this.yorigin=Math.round(b+h),
+this.xOriginLegendY2=Math.round(c+f+g),this.second_axis_scale!=0&&(this.xOriginLegendY2+=f),this.yOriginLegendY2=Math.round(b+h/2),this.no_rrdtool_tag||(this.xOriginTitle+=15,this.xOriginLegend+=15,this.xOriginLegendY+=15,this.xorigin+=15,this.xOriginLegendY2+=15)}this.xtr(0);this.ytr(Number.NaN);return 0},graph_paint:function(){if(this.logarithmic&&this.minval<=0)throw"for a logarithmic yaxis you must specify a lower-limit > 0";if(this.start<31536E4)throw"the first entry to fetch should be after 1980 ("+
+this.start+"%ld)";if(this.end<this.start)throw"start ("+this.start+") should be less than end ("+this.end+")";this.xlab_user={minsec:-1,length:0,gridtm:0,gridst:0,mgridtm:0,mgridst:0,labtm:0,labst:0,precis:0,stst:null};this.ygrid_scale={gridstep:0,labfact:0,labfmt:null};this.minval=this.setminval;this.maxval=this.setmaxval;this.step=Math.max(this.step,(this.end-this.start)/this.xsize);for(var a=0,c=this.gdes.length;a<c;a++)this.gdes[a].step=0,this.gdes[a].step_orig=this.step,this.gdes[a].start=this.start,
+this.gdes[a].end=this.end;var d=0,b=null;if(this.data_fetch()===-1)return-1;if(this.data_calc()===-1)return-1;a=this.print_calc();if(a<0)return-1;if(this.graph_size_location(a)===-1)return-1;if(this.data_proc()===-1)return-1;this.logarithmic||this.si_unit();!this.rigid&&!this.logarithmic&&this.expand_range();if(this.magfact===0)this.magfact=1;if(!this.calc_horizontal_grid())return-1;this.ytr(Number.NaN);this.canvas.height=this.yimg;this.canvas.width=this.ximg;this.gfx_new_area(0,0,0,this.yimg,this.ximg,
+this.yimg,this.GRC.BACK);this.gfx_add_point(this.ximg,0);this.gfx_close_path();this.gfx_new_area(this.xorigin,this.yorigin,this.xorigin+this.xsize,this.yorigin,this.xorigin+this.xsize,this.yorigin-this.ysize,this.GRC.CANVAS);this.gfx_add_point(this.xorigin,this.yorigin-this.ysize);this.gfx_close_path();if(this.minval>0)d=this.minval;if(this.maxval<0)d=this.maxval;for(a=0,c=this.gdes.length;a<c;a++)switch(this.gdes[a].gf){case RRDGraphDesc.GF.TICK:for(var f=0;f<this.xsize;f++)!isNaN(this.gdes[a].p_data[f])&&
+this.gdes[a].p_data[f]!=0&&(this.gdes[a].yrule>0?this.gfx_line(this.xorigin+f,this.yorigin+1,this.xorigin+f,this.yorigin-this.gdes[a].yrule*this.ysize,1,this.gdes[a].col):this.gdes[a].yrule<0&&this.gfx_line(this.xorigin+f,this.yorigin-this.ysize-1,this.xorigin+f,this.yorigin-this.ysize-this.gdes[a].yrule*this.ysize,1,this.gdes[a].col));break;case RRDGraphDesc.GF.LINE:case RRDGraphDesc.GF.AREA:for(var f=this.maxval-this.minval,g=this.maxval+9*f,h=this.minval-9*f,f=0;f<this.xsize;f++)isNaN(this.gdes[a].p_data[f])||
+(isFinite(this.gdes[a].p_data[f])||(this.gdes[a].p_data[f]=this.gdes[a].p_data[f]>0?this.maxval:this.minval),this.gdes[a].p_data[f]>g&&(this.gdes[a].p_data[f]=g),this.gdes[a].p_data[f]<h&&(this.gdes[a].p_data[f]=h));if(this.parse_color(this.gdes[a].col)[3]!=0)if(this.gdes[a].gf===RRDGraphDesc.GF.LINE){g=0;h=!1;this.ctx.save();this.ctx.beginPath();this.ctx.lineWidth=this.gdes[a].linewidth;for(f=1;f<this.xsize;f++)if(isNaN(this.gdes[a].p_data[f])||this.slopemode&&isNaN(this.gdes[a].p_data[f-1]))h=!1;
+else if(h){var j=f+this.xorigin,m=this.ytr(this.gdes[a].p_data[f]);!this.slopemode&&!this.AlmostEqual2sComplement(m,g,4)&&(n=f-1+this.xorigin,q=m,n=Math.round(n)+0.5,q=Math.round(q)+0.5,this.ctx.lineTo(n,q));g=m;j=Math.round(j)+0.5;m=Math.round(m)+0.5;this.ctx.lineTo(j,m)}else{g=this.ytr(this.gdes[a].p_data[f]);if(this.slopemode)n=f-1+this.xorigin,q=this.ytr(this.gdes[a].p_data[f-1]);else var n=f-1+this.xorigin,q=g;n=Math.round(n)+0.5;q=Math.round(q)+0.5;this.ctx.moveTo(n,q);n=f+this.xorigin;q=g;
+n=Math.round(n)+0.5;q=Math.round(q)+0.5;this.ctx.lineTo(n,q);h=!0}this.ctx.strokeStyle=this.gdes[a].col;this.ctx.lineCap="round";this.ctx.round="round";this.ctx.stroke();this.ctx.restore()}else{g=-1;h=[];j=[];m=[];n=[];q=!1;for(f=0;f<=this.xsize;f++){var p,l;if(g>0&&(q||f===this.xsize)){q=1;for(p=0;q<g&&this.AlmostEqual2sComplement(h[p],h[q],4)&&this.AlmostEqual2sComplement(h[p],h[q+1],4);)q++;for(this.gfx_new_area(n[0],m[0],j[0],h[0],j[q],h[q],this.gdes[a].col);q<g;){p=q;for(q++;q<g&&this.AlmostEqual2sComplement(h[p],
+h[q],4)&&this.AlmostEqual2sComplement(h[p],h[q+1],4);)q++;this.gfx_add_point(j[q],h[q])}for(this.gfx_add_point(n[g],m[g]);g>1;){p=g;for(g--;g>1&&this.AlmostEqual2sComplement(m[p],m[g],4)&&this.AlmostEqual2sComplement(m[p],m[g-1],4);)g--;this.gfx_add_point(n[g],m[g])}g=-1;q=!1;this.gfx_close_path()}q&&(q=!1,g=-1);if(f===this.xsize)break;if(this.slopemode||f!==0)if(isNaN(this.gdes[a].p_data[f]))q=!0;else if(l=this.ytr(this.gdes[a].p_data[f]),p=b&&this.gdes[a].stack?this.ytr(b.p_data[f]):this.ytr(d),
+p===l)q=!0;else{if(p>l){var o=l;l=p;p=o}this.slopemode||(m[++g]=p-0.2,n[g]=f+this.xorigin-1,h[g]=l+0.2,j[g]=f+this.xorigin-1);m[++g]=p-0.2;n[g]=f+this.xorigin;h[g]=l+0.2;j[g]=f+this.xorigin}}}for(f=0;f<this.xsize;f++)isNaN(this.gdes[a].p_data[f])&&(this.gdes[a].p_data[f]=b&&this.gdes[a].stack?b.p_data[f]:d);b=this.gdes[a];break;case RRDGraphDesc.GF.STACK:throw"STACK should already be turned into LINE or AREA here";}this.only_graph||this.grid_paint();this.only_graph||this.axis_paint();for(a=0,c=this.gdes.length;a<
+c;a++)switch(this.gdes[a].gf){case RRDGraphDesc.GF.HRULE:this.gdes[a].yrule>=this.minval&&this.gdes[a].yrule<=this.maxval&&this.gfx_line(this.xorigin,this.ytr(this.gdes[a].yrule),this.xorigin+this.xsize,this.ytr(this.gdes[a].yrule),1,this.gdes[a].col);break;case RRDGraphDesc.GF.VRULE:this.gdes[a].xrule>=this.start&&this.gdes[a].xrule<=this.end&&this.gfx_line(this.xtr(this.gdes[a].xrule),this.yorigin,this.xtr(this.gdes[a].xrule),this.yorigin-this.ysize,1,this.gdes[a].col)}return 0},find_var:function(a){for(var c=
+0,d=this.gdes.length;c<d;c++)if((this.gdes[c].gf===RRDGraphDesc.GF.DEF||this.gdes[c].gf===RRDGraphDesc.GF.VDEF||this.gdes[c].gf===RRDGraphDesc.GF.CDEF)&&this.gdes[c].vname===a)return c;return-1},parse_def:function(a){var a=a.split(/:/),c=1,d=a[c++].split("="),b=d[0],d=d[1],f=a[c++],g=a[c++],h=void 0,j=void 0,m=void 0,n=void 0;if(a.length>c)for(var q=a.length;c<q;c++){var p=a[c].split("=");p[0]==="step"&&(h=p[1]);p[0]==="reduce"&&(j=p[1]);p[0]==="start"&&(m=p[1]);p[0]==="end"&&(n=p[1])}this.create_def(b,
+d,f,g,h,m,n,j)},create_def:function(a,c,d,b,f,g,h,j){var m=new RRDGraphDesc(this),n=new RRDTime(this.start),q=new RRDTime(this.end);m.gf=RRDGraphDesc.GF.DEF;m.vname=a;m.vidx=this.find_var(a);m.rrd=c;m.ds_nam=d;m.cf=this.cf_conv(b);if(f!=void 0&&f!=null)m.step=f;g!=void 0&&g!=null&&(n=new RRDTime(g));h!=void 0&&h!=null&&(q=new RRDTime(h));m.cf_reduce=j===void 0||j===null?m.cf:this.cf_conv(j);m.legend="";a=RRDTime.proc_start_end(n,q);m.start=a[0];m.end=a[1];m.start_orig=a[0];m.end_orig=a[1];this.gdes.push(m)},
+parse_cdef:function(a){a=a.split(/:|=/);this.create_cdef(a[1],a[2])},create_cdef:function(a,c){var d=new RRDGraphDesc(this);d.gf=RRDGraphDesc.GF.CDEF;d.vname=a;d.vidx=this.find_var(a);d.rpnp=new RRDRpn(c,this.gdes);d.legend="";this.gdes.push(d)},parse_vdef:function(a){a=a.split(/:|=/);this.create_vdef(a[1],a[2])},create_vdef:function(a,c){var d=new RRDGraphDesc(this);d.gf=RRDGraphDesc.GF.VDEF;d.vname=a;var b=c.indexOf(","),f=c.substring(0,b);d.vidx=this.find_var(f);if(this.gdes[d.vidx].gf!=RRDGraphDesc.GF.DEF&&
+this.gdes[d.vidx].gf!=RRDGraphDesc.GF.CDEF)throw'variable "'+f+'" not DEF nor CDEF in VDEF.';this.vdef_parse(d,c.substring(b+1));d.legend="";this.gdes.push(d)},parse_shift:function(a){a=a.split(":");this.create_shift(a[1],a[2])},create_shift:function(a,c){var d=new RRDGraphDesc(this);d.gf=RRDGraphDesc.GF.SHIFT;d.vname=a;d.vidx=this.find_var(a);if(this.gdes[d.vidx].gf===RRDGraphDesc.GF.VDEF)throw"Cannot shift a VDEF: '%s' in line '"+this.gdes[d.vidx].vname+"'";if(this.gdes[d.vidx].gf!==RRDGraphDesc.GF.DEF&&
+this.gdes[d.vidx].gf!==RRDGraphDesc.GF.CDEF)throw"Encountered unknown type variable '"+this.gdes[d.vidx].vname+"'";d.shidx=this.find_var(c);if(d.shidx>=0){if(this.gdes[d.shidx].gf===RRDGraphDesc.GF.DEF||this.gdes[d.shidx].gf===RRDGraphDesc.GF.CDEF)throw"Offset cannot be a (C)DEF: '"+this.gdes[d.shidx].gf+"'";if(this.gdes[d.shidx].gf!==RRDGraphDesc.GF.VDEF)throw"Encountered unknown type variable '"+this.gdes[d.shidx].vname+"'";}else d.shval=parseInt(c,10),d.shidx=-1;d.legend="";this.gdes.push(d)},
+parse_line:function(a){var a=a.split(/#|:/),c=parseFloat(a[0].substr(4)),d=a[4]==="STACK"?!0:void 0,b=this.parse_color(a[2]);this.create_line(c,a[1],this.color2rgba(b),a[3],d)},create_line:function(a,c,d,b,f){var g=new RRDGraphDesc(this);g.gf=RRDGraphDesc.GF.LINE;g.vname=c;g.vidx=this.find_var(c);g.linewidth=a;g.col=d;g.legend=b===void 0?"":" "+b;g.stack=f===void 0?!1:f;g.format=g.legend;this.gdes.push(g)},parse_area:function(a){var a=a.split(/#|:/),c=a[3]==="STACK"?!0:void 0,d=this.parse_color(a[2]);
+this.create_area(a[1],this.color2rgba(d),c)},create_area:function(a,c,d,b){var f=new RRDGraphDesc(this);f.gf=RRDGraphDesc.GF.AREA;f.vname=a;f.vidx=this.find_var(a);f.col=c;f.legend=d===void 0?"":" "+d;f.stack=b===void 0?!1:b;f.format=f.legend;this.gdes.push(f)},parse_tick:function(a){var a=a.split(/:|#/),c=this.parse_color(a[2]);this.create_tick(a[1],this.color2rgba(c),a[3],a[4])},create_tick:function(a,c,d,b){var f=new RRDGraphDesc(this);f.gf=RRDGraphDesc.GF.TICK;f.vname=a;f.vidx=this.find_var(a);
+f.col=c;if(b!==void 0)f.yrule=d;f.legend=b===void 0?"":" "+b;f.format=f.legend;this.gdes.push(f)},parse_gprint:function(a){var a=a.split(":"),c=!1,d=a[1],b=a[2],f="";if(a.length>3)for(var g=0,h=3,j=a.length;h<j;h++)a[h]==="strftime"?c=!0:(f=g>0?f+":"+a[h]:a[h],g++);this.create_gprint(d,b,f,c)},create_gprint:function(a,c,d,b){var f=new RRDGraphDesc(this);f.gf=RRDGraphDesc.GF.GPRINT;f.vname=a;f.vidx=this.find_var(a);f.legend="";if(d===void 0)switch(f.format=c,this.gdes[f.vidx].gf){case RRDGraphDesc.GF.DEF:case RRDGraphDesc.GF.CDEF:f.cf=
+this.gdes[f.vidx].cf;break;case RRDGraphDesc.GF.VDEF:break;default:throw"Encountered unknown type variable "+this.gdes[f.vidx].vname;}else f.cf=this.cf_conv(c),f.format=d;if(this.gdes[f.vidx].gf===RRDGraphDesc.GF.VDEF&&b===!0)f.strftm=!0;this.gdes.push(f)},parse_comment:function(a){var c=a.indexOf(":");this.create_comment(a.substr(c+1))},create_comment:function(a){var c=new RRDGraphDesc(this);c.gf=RRDGraphDesc.GF.COMMENT;c.vidx=-1;c.legend=a;this.gdes.push(c)},parse_textaling:function(a){var c=a.indexOf(":");
+this.create_textalign(a.substr(c+1))},create_textalign:function(a){var c=new RRDGraphDesc(this);c.gf=RRDGraphDesc.GF.TEXTALIGN;c.vidx=-1;if(a==="left")c.txtalign=RRDGraphDesc.TXA.LEFT;else if(a==="right")c.txtalign=RRDGraphDesc.TXA.RIGHT;else if(a==="justified")c.txtalign=RRDGraphDesc.TXA.JUSTIFIED;else if(a==="center")c.txtalign=RRDGraphDesc.TXA.CENTER;else throw"Unknown alignement type '"+a+"'";this.gdes.push(c)},parse_vrule:function(a){a=a.split(/:|#/);this.create_vrule(a[1],"#"+a[2],a[3])},create_vrule:function(a,
+c,d){var b=new RRDGraphDesc(this);b.gf=RRDGraphDesc.GF.VRULE;b.xrule=a;b.col=c;b.legend=d===void 0?"":" "+d;this.gdes.push(b)},parse_hrule:function(a){a=a.split(/:|#/);this.create_hrule(a[1],"#"+a[2],a[3])},create_hrule:function(a,c,d){var b=new RRDGraphDesc(this);b.gf=RRDGraphDesc.GF.HRULE;b.yrule=a;b.col=c;b.legend=d===void 0?"":" "+d;this.gdes.push(b)},cf_conv:function(a){switch(a){case "AVERAGE":return RRDGraphDesc.CF.AVERAGE;case "MIN":return RRDGraphDesc.CF.MINIMUM;case "MAX":return RRDGraphDesc.CF.MAXIMUM;
+case "LAST":return RRDGraphDesc.CF.LAST;case "HWPREDICT":return RRDGraphDesc.CF.HWPREDICT;case "MHWPREDICT":return RRDGraphDesc.CF.MHWPREDICT;case "DEVPREDICT":return RRDGraphDesc.CF.DEVPREDICT;case "SEASONAL":return RRDGraphDesc.CF.SEASONAL;case "DEVSEASONAL":return RRDGraphDesc.CF.DEVSEASONAL;case "FAILURES":return RRDGraphDesc.CF.FAILURES}return-1},tmt_conv:function(a){switch(a){case "SECOND":return RRDGraph.TMT.SECOND;case "MINUTE":return RRDGraph.TMT.MINUTE;case "HOUR":return RRDGraph.TMT.HOUR;
+case "DAY":return RRDGraph.TMT.DAY;case "WEEK":return RRDGraph.TMT.WEEK;case "MONTH":return RRDGraph.TMT.MONTH;case "YEAR":return RRDGraph.TMT.YEAR}return-1},vdef_parse:function(a,c){var d,b;b=c.indexOf(",");b!=-1?(d=parseFloat(c.substr(0,b)),b=c.substr(b+1)):(d=Number.NaN,b=c);a.vf={op:null,param:null,val:null,when:null};if(b==="PERCENT")a.vf.op=RRDGraphDesc.VDEF.PERCENT;else if(b==="PERCENTNAN")a.vf.op=RRDGraphDesc.VDEF.PERCENTNAN;else if(b==="MAXIMUM")a.vf.op=RRDGraphDesc.VDEF.MAXIMUM;else if(b===
+"AVERAGE")a.vf.op=RRDGraphDesc.VDEF.AVERAGE;else if(b==="STDEV")a.vf.op=RRDGraphDesc.VDEF.STDEV;else if(b==="MINIMUM")a.vf.op=RRDGraphDesc.VDEF.MINIMUM;else if(b==="TOTAL")a.vf.op=RRDGraphDesc.VDEF.TOTAL;else if(b==="FIRST")a.vf.op=RRDGraphDesc.VDEF.FIRST;else if(b==="LAST")a.vf.op=RRDGraphDesc.VDEF.LAST;else if(b==="LSLSLOPE")a.vf.op=RRDGraphDesc.VDEF.LSLSLOPE;else if(b==="LSLINT")a.vf.op=RRDGraphDesc.VDEF.LSLINT;else if(b==="LSLCORREL")a.vf.op=RRDGraphDesc.VDEF.LSLCORREL;else throw'Unknown function "'+
+b+'" in VDEF "'+a.vname+'"';switch(a.vf.op){case RRDGraphDesc.VDEF.PERCENT:case RRDGraphDesc.VDEF.PERCENTNAN:if(isNaN(d))throw"Function '"+b+"' needs parameter in VDEF '"+a.vname+"'";if(d>=0&&d<=100)a.vf.param=d,a.vf.val=Number.NaN,a.vf.when=0;else throw"Parameter '"+d+"' out of range in VDEF '"+a.vname+"'";break;case RRDGraphDesc.VDEF.MAXIMUM:case RRDGraphDesc.VDEF.AVERAGE:case RRDGraphDesc.VDEF.STDEV:case RRDGraphDesc.VDEF.MINIMUM:case RRDGraphDesc.VDEF.TOTAL:case RRDGraphDesc.VDEF.FIRST:case RRDGraphDesc.VDEF.LAST:case RRDGraphDesc.VDEF.LSLSLOPE:case RRDGraphDesc.VDEF.LSLINT:case RRDGraphDesc.VDEF.LSLCORREL:if(isNaN(d))a.vf.param=
+Number.NaN,a.vf.val=Number.NaN,a.vf.when=0;else throw"Function '"+b+"' needs no parameter in VDEF '"+a.vname+"'";}return 0},vdef_calc:function(a){var c,d,b,f,a=this.gdes[a];c=this.gdes[a.vidx];d=c.data;f=(c.end-c.start)/c.step;switch(a.vf.op){case RRDGraphDesc.VDEF.PERCENT:var g=[],h;for(b=0;b<f;b++)g[b]=d[b*c.ds_cnt];g.sort(this.vdef_percent_compar);h=Math.round(a.vf.param*(f-1)/100);a.vf.val=g[h];a.vf.when=0;break;case RRDGraphDesc.VDEF.PERCENTNAN:g=[];for(b=h=0;b<f;b++)isNaN(d[b*c.ds_cnt])||(g[h]=
+d[b*c.ds_cnt]);g.sort(vdef_percent_compar);h=Math.round(a.vf.param*(h-1)/100);a.vf.val=g[h];a.vf.when=0;break;case RRDGraphDesc.VDEF.MAXIMUM:for(b=0;b!=f&&isNaN(d[b*c.ds_cnt]);)b++;b===f?(a.vf.val=Number.NaN,a.vf.when=0):(a.vf.val=d[b*c.ds_cnt],a.vf.when=c.start+(b+1)*c.step);for(;b!=f;){if(isFinite(d[b*c.ds_cnt])&&d[b*c.ds_cnt]>a.vf.val)a.vf.val=d[b*c.ds_cnt],a.vf.when=c.start+(b+1)*c.step;b++}break;case RRDGraphDesc.VDEF.TOTAL:case RRDGraphDesc.VDEF.STDEV:case RRDGraphDesc.VDEF.AVERAGE:var j=h=
+g=0;for(b=0;b<f;b++)isFinite(d[b*c.ds_cnt])&&(h+=d[b*c.ds_cnt],g++);if(g)if(a.vf.op===RRDGraphDesc.VDEF.TOTAL)a.vf.val=h*c.step;else if(a.vf.op===RRDGraphDesc.VDEF.AVERAGE)a.vf.val=h/g;else{j=h/g;for(b=h=0;b<f;b++)isFinite(d[b*c.ds_cnt])&&(h+=Math.pow(d[b*c.ds_cnt]-j,2));a.vf.val=Math.pow(h/g,0.5)}else a.vf.val=Number.NaN;a.vf.when=0;break;case RRDGraphDesc.VDEF.MINIMUM:for(b=0;b!=f&&isNaN(d[b*c.ds_cnt]);)b++;b===f?(a.vf.val=Number.NaN,a.vf.when=0):(a.vf.val=d[b*c.ds_cnt],a.vf.when=c.start+(b+1)*
+c.step);for(;b!=f;){if(isFinite(d[b*c.ds_cnt])&&d[b*c.ds_cnt]<a.vf.val)a.vf.val=d[b*c.ds_cnt],a.vf.when=c.start+(b+1)*c.step;b++}break;case RRDGraphDesc.VDEF.FIRST:for(b=0;b!=f&&isNaN(d[b*c.ds_cnt]);)b++;b===f?(a.vf.val=Number.NaN,a.vf.when=0):(a.vf.val=d[b*c.ds_cnt],a.vf.when=c.start+b*c.step);break;case RRDGraphDesc.VDEF.LAST:for(b=f-1;b>=0&&isNaN(d[b*c.ds_cnt]);)b--;b<0?(a.vf.val=Number.NaN,a.vf.when=0):(a.vf.val=d[b*c.ds_cnt],a.vf.when=c.start+(b+1)*c.step);break;case RRDGraphDesc.VDEF.LSLSLOPE:case RRDGraphDesc.VDEF.LSLINT:case RRDGraphDesc.VDEF.LSLCORREL:var g=
+0,m,n,q;for(b=q=n=m=j=h=0;b<f;b++)isFinite(d[b*c.ds_cnt])&&(g++,h+=b,n+=b*b,m+=b*d[b*c.ds_cnt],j+=d[b*c.ds_cnt],q+=d[b*c.ds_cnt]*d[b*c.ds_cnt]);c=(h*j-g*m)/(h*h-g*n);d=(j-c*h)/g;b=(m-h*j/g)/Math.sqrt((n-h*h/g)*(q-j*j/g));if(g)if(a.vf.op===RRDGraphDesc.VDEF.LSLSLOPE)a.vf.val=c,a.vf.when=0;else if(a.vf.op===RRDGraphDesc.VDEF.LSLINT)a.vf.val=d,a.vf.when=0;else{if(a.vf.op===RRDGraphDesc.VDEF.LSLCORREL)a.vf.val=b,a.vf.when=0}else a.vf.val=DNAN,a.vf.when=0}return 0},vdef_percent_compar:function(a,c){return isNaN(a)?
+-1:isNaN(c)?1:!isFinite(a)?a===-Infinity?-1:1:!isFinite(c)?c===-Infinity?-1:1:a<c?-1:1},rrd_fetch:function(a,c){var d,b=0,f=0,g=0,h=0,j=0,m=g=0,n=0,q=1,p=1,l;try{if(this.rrdfiles[a.rrd])l=this.rrdfiles[a.rrd];else{var o=FetchBinaryURL(a.rrd);l=new RRDFile(o);this.rrdfiles[a.rrd]=l}}catch(E){throw console.log(E.message),console.log(E.stack),"File "+a.rrd+" is not a valid RRD archive!";}for(var w=a.cf,o=l.getNrDSs(),A=l.getNrRRAs(),z=0;z<o;z++)a.ds_namv[z]=l.rrd_header.getDSbyIdx(z).getName();for(z=
+0;z<A;z++)if(g=l.getRRAInfo(z),this.cf_conv(g.getCFName())===w)if(d=l.getLastUpdate()-l.getLastUpdate()%(g.getPdpPerRow()*g.pdp_step),d-=g.getPdpPerRow()*g.row_cnt*g.pdp_step,m=a.end-a.start,g=Math.abs(c-l.getMinStep()*g.pdp_cnt),d<=a.start){if(q||g<h)q=0,h=g,b=z}else if(d>a.start&&(m-=d-a.start),p||n<m||n===m&&g<j)p=0,n=m,j=g,f=z;if(q===0)g=b;else if(p===0)g=f;else throw"the RRD does not contain an RRA matching the chosen CF";z=l.getRRAInfo(g);g=l.getRRA(g);c=l.rrd_header.pdp_step*z.getPdpPerRow();
+a.start-=a.start%c;a.end+=c-a.end%c;a.ds_cnt=o;b=0;l=l.getLastUpdate()-l.getLastUpdate()%c;z=(a.start+c-(l-c*(z.row_cnt-1)))/c;l=(l-a.end)/c;for(a.data=[];z<g.row_cnt-l;z++)if(z<0)for(f=0;f<o;f++)a.data[b++]=Number.NaN;else if(z>=g.row_cnt)for(f=0;f<o;f++)a.data[b++]=Number.NaN;else for(f=0;f<o;f++)a.data[b++]=g.getEl(z,f);return c}};
// Input 2
-(function(d){d.color={};d.color.make=function(h,p,C,B){var q={};q.r=h||0;q.g=p||0;q.b=C||0;q.a=B!=null?B:1;q.add=function(d,h){for(var p=0;p<d.length;++p)q[d.charAt(p)]+=h;return q.normalize()};q.scale=function(d,h){for(var p=0;p<d.length;++p)q[d.charAt(p)]*=h;return q.normalize()};q.toString=function(){return q.a>=1?"rgb("+[q.r,q.g,q.b].join(",")+")":"rgba("+[q.r,q.g,q.b,q.a].join(",")+")"};q.normalize=function(){function d(h,p,q){return p<h?h:p>q?q:p}q.r=d(0,parseInt(q.r),255);q.g=d(0,parseInt(q.g),
-255);q.b=d(0,parseInt(q.b),255);q.a=d(0,q.a,1);return q};q.clone=function(){return d.color.make(q.r,q.b,q.g,q.a)};return q.normalize()};d.color.extract=function(h,p){var C;do{C=h.css(p).toLowerCase();if(C!=""&&C!="transparent")break;h=h.parent()}while(!d.nodeName(h.get(0),"body"));C=="rgba(0, 0, 0, 0)"&&(C="transparent");return d.color.parse(C)};d.color.parse=function(F){var p,C=d.color.make;if(p=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F))return C(parseInt(p[1],10),
-parseInt(p[2],10),parseInt(p[3],10));if(p=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F))return C(parseInt(p[1],10),parseInt(p[2],10),parseInt(p[3],10),parseFloat(p[4]));if(p=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F))return C(parseFloat(p[1])*2.55,parseFloat(p[2])*2.55,parseFloat(p[3])*2.55);if(p=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(F))return C(parseFloat(p[1])*
-2.55,parseFloat(p[2])*2.55,parseFloat(p[3])*2.55,parseFloat(p[4]));if(p=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F))return C(parseInt(p[1],16),parseInt(p[2],16),parseInt(p[3],16));if(p=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F))return C(parseInt(p[1]+p[1],16),parseInt(p[2]+p[2],16),parseInt(p[3]+p[3],16));F=d.trim(F).toLowerCase();return F=="transparent"?C(255,255,255,0):(p=h[F]||[0,0,0],C(p[0],p[1],p[2]))};var h={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,
-0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,
-211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);
-(function(d){function h(h,C,B,q){function z(b,d){for(var d=[U].concat(d),j=0;j<b.length;++j)b[j].apply(this,d)}function N(b){for(var e=[],j=0;j<b.length;++j){var h=d.extend(!0,{},n.series);b[j].data!=null?(h.data=b[j].data,delete b[j].data,d.extend(!0,h,b[j]),b[j].data=h.data):h.data=b[j];e.push(h)}J=e;e=J.length;j=[];h=[];for(b=0;b<J.length;++b){var l=J[b].color;l!=null&&(--e,typeof l=="number"?h.push(l):j.push(d.color.parse(J[b].color)))}for(b=0;b<h.length;++b)e=Math.max(e,h[b]+1);j=[];for(b=h=
-0;j.length<e;)l=n.colors.length==b?d.color.make(100,100,100):d.color.parse(n.colors[b]),l.scale("rgb",1+(h%2==1?-1:1)*Math.ceil(h/2)*0.2),j.push(l),++b,b>=n.colors.length&&(b=0,++h);for(b=e=0;b<J.length;++b){h=J[b];if(h.color==null)h.color=j[e].toString(),++e;else if(typeof h.color=="number")h.color=j[h.color].toString();if(h.lines.show==null){var P,l=!0;for(P in h)if(h[P]&&h[P].show){l=!1;break}if(l)h.lines.show=!0}h.xaxis=r(ia,K(h,"x"));h.yaxis=r(ka,K(h,"y"))}o()}function K(b,d){var j=b[d+"axis"];
-if(typeof j=="object")j=j.n;typeof j!="number"&&(j=1);return j}function I(){return d.grep(ia.concat(ka),function(b){return b})}function G(b){var d={},j,e;for(j=0;j<ia.length;++j)(e=ia[j])&&e.used&&(d["x"+e.n]=e.c2p(b.left));for(j=0;j<ka.length;++j)(e=ka[j])&&e.used&&(d["y"+e.n]=e.c2p(b.top));if(d.x1!==void 0)d.x=d.x1;if(d.y1!==void 0)d.y=d.y1;return d}function r(b,e){b[e-1]||(b[e-1]={n:e,direction:b==ia?"x":"y",options:d.extend(!0,{},b==ia?n.xaxis:n.yaxis)});return b[e-1]}function o(){function b(f,
-d,j){if(d<f.datamin&&d!=-h)f.datamin=d;if(j>f.datamax&&j!=h)f.datamax=j}var e=Number.POSITIVE_INFINITY,j=Number.NEGATIVE_INFINITY,h=Number.MAX_VALUE,l,n,o,p,r,u,t,q,w,A;d.each(I(),function(b,f){f.datamin=e;f.datamax=j;f.used=!1});for(l=0;l<J.length;++l)r=J[l],r.datapoints={points:[]},z(ta.processRawData,[r,r.data,r.datapoints]);for(l=0;l<J.length;++l){r=J[l];var x=r.data,y=r.datapoints.format;if(!y){y=[];y.push({x:!0,number:!0,required:!0});y.push({y:!0,number:!0,required:!0});if(r.bars.show||r.lines.show&&
-r.lines.fill)if(y.push({y:!0,number:!0,required:!1,defaultValue:0}),r.bars.horizontal)delete y[y.length-1].y,y[y.length-1].x=!0;r.datapoints.format=y}if(r.datapoints.pointsize==null){r.datapoints.pointsize=y.length;t=r.datapoints.pointsize;u=r.datapoints.points;insertSteps=r.lines.show&&r.lines.steps;r.xaxis.used=r.yaxis.used=!0;for(n=o=0;n<x.length;++n,o+=t){A=x[n];var ua=A==null;if(!ua)for(p=0;p<t;++p){q=A[p];if(w=y[p])if(w.number&&q!=null&&(q=+q,isNaN(q)?q=null:q==Infinity?q=h:q==-Infinity&&(q=
--h)),q==null&&(w.required&&(ua=!0),w.defaultValue!=null))q=w.defaultValue;u[o+p]=q}if(ua)for(p=0;p<t;++p)q=u[o+p],q!=null&&(w=y[p],w.x&&b(r.xaxis,q,q),w.y&&b(r.yaxis,q,q)),u[o+p]=null;else if(insertSteps&&o>0&&u[o-t]!=null&&u[o-t]!=u[o]&&u[o-t+1]!=u[o+1]){for(p=0;p<t;++p)u[o+t+p]=u[o+p];u[o+1]=u[o-t+1];o+=t}}}}for(l=0;l<J.length;++l)r=J[l],z(ta.processDatapoints,[r,r.datapoints]);for(l=0;l<J.length;++l){r=J[l];u=r.datapoints.points;t=r.datapoints.pointsize;y=r.datapoints.format;A=o=e;ua=x=j;for(n=
-0;n<u.length;n+=t)if(u[n]!=null)for(p=0;p<t;++p)if(q=u[n+p],(w=y[p])&&!(q==h||q==-h))w.x&&(q<o&&(o=q),q>x&&(x=q)),w.y&&(q<A&&(A=q),q>ua&&(ua=q));r.bars.show&&(n=r.bars.align=="left"?0:-r.bars.barWidth/2,r.bars.horizontal?(A+=n,ua+=n+r.bars.barWidth):(o+=n,x+=n+r.bars.barWidth));b(r.xaxis,o,x);b(r.yaxis,A,ua)}d.each(I(),function(b,f){if(f.datamin==e)f.datamin=null;if(f.datamax==j)f.datamax=null})}function A(b,e){var j=document.createElement("canvas");j.className=e;j.width=ea;j.height=la;b||d(j).css({position:"absolute",
-left:0,top:0});d(j).appendTo(h);j.getContext||(j=window.G_vmlCanvasManager.initElement(j));j.getContext("2d").save();return j}function V(){ea=h.width();la=h.height();if(ea<=0||la<=0)throw"Invalid dimensions for plot, width = "+ea+", height = "+la;}function Q(b){if(b.width!=ea)b.width=ea;if(b.height!=la)b.height=la;b=b.getContext("2d");b.restore();b.save()}function R(b){function d(b){return b}var j,e,l=b.options.transform||d,h=b.options.inverseTransform;b.direction=="x"?(j=b.scale=xa/Math.abs(l(b.max)-
-l(b.min)),e=Math.min(l(b.max),l(b.min))):(j=b.scale=sa/Math.abs(l(b.max)-l(b.min)),j=-j,e=Math.max(l(b.max),l(b.min)));b.p2c=l==d?function(b){return(b-e)*j}:function(b){return(l(b)-e)*j};b.c2p=h?function(b){return h(e+b/j)}:function(b){return e+b/j}}function S(b){var e=b.labelWidth,j=b.labelHeight,h=b.options.position,l=b.options.tickLength,o=n.grid.axisMargin,r=n.grid.labelMargin,p=b.direction=="x"?ia:ka,u=d.grep(p,function(b){return b&&b.options.position==h&&b.reserveSpace});d.inArray(b,u)==u.length-
-1&&(o=0);if(l==null)var l=d.grep(p,function(b){return b&&b.reserveSpace}),q=d.inArray(b,l)==0,l=q?"full":5;isNaN(+l)||(r+=+l);b.direction=="x"?(j+=r,h=="bottom"?(E.bottom+=j+o,b.box={top:la-E.bottom,height:j}):(b.box={top:E.top+o,height:j},E.top+=j+o)):(e+=r,h=="left"?(b.box={left:E.left+o,width:e},E.left+=e+o):(E.right+=e+o,b.box={left:ea-E.right,width:e}));b.position=h;b.tickLength=l;b.box.padding=r;b.innermost=q}function x(){var b=n.grid.minBorderMargin,e={x:0,y:0},j;if(b==null)for(j=b=0;j<J.length;++j)b=
-Math.max(b,2*(J[j].points.radius+J[j].points.lineWidth/2));e.x=e.y=Math.ceil(b);d.each(I(),function(b,f){var d=f.direction;f.reserveSpace&&(e[d]=Math.ceil(Math.max(e[d],(d=="x"?f.labelWidth:f.labelHeight)/2)))});E.left=Math.max(e.x,E.left);E.right=Math.max(e.x,E.right);E.top=Math.max(e.y,E.top);E.bottom=Math.max(e.y,E.bottom)}function X(){var b,e=I();b=n.grid.show;for(var j in E)E[j]=b?n.grid.borderWidth:0;d.each(e,function(b,f){f.show=f.options.show;if(f.show==null)f.show=f.used;f.reserveSpace=f.show||
-f.options.reserveSpace;var d=f.options,j=+(d.min!=null?d.min:f.datamin),e=+(d.max!=null?d.max:f.datamax),h=e-j;if(h==0){if(h=e==0?1:0.01,d.min==null&&(j-=h),d.max==null||d.min!=null)e+=h}else{var v=d.autoscaleMargin;v!=null&&(d.min==null&&(j-=h*v,j<0&&f.datamin!=null&&f.datamin>=0&&(j=0)),d.max==null&&(e+=h*v,e>0&&f.datamax!=null&&f.datamax<=0&&(e=0)))}f.min=j;f.max=e});if(b){var o={style:h.css("font-style"),size:Math.round(0.8*(+h.css("font-size").replace("px","")||13)),variant:h.css("font-variant"),
-weight:h.css("font-weight"),family:h.css("font-family")};j=d.grep(e,function(b){return b.reserveSpace});d.each(j,function(b,f){L(f);var j=f.options.ticks,e=[];j==null||typeof j=="number"&&j>0?e=f.tickGenerator(f):j&&(e=d.isFunction(j)?j(f):j);var h;f.ticks=[];for(j=0;j<e.length;++j){var v=null,n=e[j];typeof n=="object"?(h=+n[0],n.length>1&&(v=n[1])):h=+n;v==null&&(v=f.tickFormatter(h,f));isNaN(h)||f.ticks.push({v:h,label:v})}e=f.ticks;if(f.options.autoscaleMargin&&e.length>0){if(f.options.min==null)f.min=
-Math.min(f.min,e[0].v);if(f.options.max==null&&e.length>1)f.max=Math.max(f.max,e[e.length-1].v)}f.font=d.extend({},o,f.options.font);e=f.options;j=f.ticks||[];h=e.labelWidth||0;v=e.labelHeight||0;n=f.font;u.save();u.font=n.style+" "+n.variant+" "+n.weight+" "+n.size+"px '"+n.family+"'";for(var r=0;r<j.length;++r){var p=j[r];p.lines=[];p.width=p.height=0;if(p.label){for(var q=p.label.replace(/<br ?\/?>|\r\n|\r/g,"\n").split("\n"),t=0;t<q.length;++t){var w={text:q[t]},A=u.measureText(w.text);w.width=
-A.width;w.height=A.height!=null?A.height:n.size;w.height+=Math.round(n.size*0.15);p.width=Math.max(w.width,p.width);p.height+=w.height;p.lines.push(w)}e.labelWidth==null&&(h=Math.max(h,p.width));e.labelHeight==null&&(v=Math.max(v,p.height))}}u.restore();f.labelWidth=Math.ceil(h);f.labelHeight=Math.ceil(v)});for(b=j.length-1;b>=0;--b)S(j[b]);x();d.each(j,function(b,f){f.direction=="x"?(f.box.left=E.left-f.labelWidth/2,f.box.width=ea-E.left-E.right+f.labelWidth):(f.box.top=E.top-f.labelHeight/2,f.box.height=
-la-E.bottom-E.top+f.labelHeight)})}xa=ea-E.left-E.right;sa=la-E.bottom-E.top;d.each(e,function(b,f){R(f)});$()}function L(b){var e=b.options,j=(b.max-b.min)/(typeof e.ticks=="number"&&e.ticks>0?e.ticks:0.3*Math.sqrt(b.direction=="x"?ea:la)),h,l,n,o;if(e.mode=="time"){var p={second:1E3,minute:6E4,hour:36E5,day:864E5,month:2592E6,year:525949.2*6E4};o=[[1,"second"],[2,"second"],[5,"second"],[10,"second"],[30,"second"],[1,"minute"],[2,"minute"],[5,"minute"],[10,"minute"],[30,"minute"],[1,"hour"],[2,"hour"],
-[4,"hour"],[8,"hour"],[12,"hour"],[1,"day"],[2,"day"],[3,"day"],[0.25,"month"],[0.5,"month"],[1,"month"],[2,"month"],[3,"month"],[6,"month"],[1,"year"]];h=0;e.minTickSize!=null&&(h=typeof e.tickSize=="number"?e.tickSize:e.minTickSize[0]*p[e.minTickSize[1]]);for(l=0;l<o.length-1;++l)if(j<(o[l][0]*p[o[l][1]]+o[l+1][0]*p[o[l+1][1]])/2&&o[l][0]*p[o[l][1]]>=h)break;h=o[l][0];n=o[l][1];n=="year"&&(l=Math.pow(10,Math.floor(Math.log(j/p.year)/Math.LN10)),o=j/p.year/l,h=o<1.5?1:o<3?2:o<7.5?5:10,h*=l);b.tickSize=
-e.tickSize||[h,n];l=function(b){var f=[],d=b.tickSize[0],e=b.tickSize[1],j=new Date(b.min),l=d*p[e];e=="second"&&j.setUTCSeconds(F(j.getUTCSeconds(),d));e=="minute"&&j.setUTCMinutes(F(j.getUTCMinutes(),d));e=="hour"&&j.setUTCHours(F(j.getUTCHours(),d));e=="month"&&j.setUTCMonth(F(j.getUTCMonth(),d));e=="year"&&j.setUTCFullYear(F(j.getUTCFullYear(),d));j.setUTCMilliseconds(0);l>=p.minute&&j.setUTCSeconds(0);l>=p.hour&&j.setUTCMinutes(0);l>=p.day&&j.setUTCHours(0);l>=p.day*4&&j.setUTCDate(1);l>=p.year&&
-j.setUTCMonth(0);var h=0,n=Number.NaN,v;do if(v=n,n=j.getTime(),f.push(n),e=="month")if(d<1){j.setUTCDate(1);var o=j.getTime();j.setUTCMonth(j.getUTCMonth()+1);var r=j.getTime();j.setTime(n+h*p.hour+(r-o)*d);h=j.getUTCHours();j.setUTCHours(0)}else j.setUTCMonth(j.getUTCMonth()+d);else e=="year"?j.setUTCFullYear(j.getUTCFullYear()+d):j.setTime(n+l);while(n<b.max&&n!=v);return f};h=function(b,f){var j=new Date(b);if(e.timeformat!=null)return d.plot.formatDate(j,e.timeformat,e.monthNames);var l=f.tickSize[0]*
-p[f.tickSize[1]],h=f.max-f.min,n=e.twelveHourClock?" %p":"";fmt=l<p.minute?"%h:%M:%S"+n:l<p.day?h<2*p.day?"%h:%M"+n:"%b %d %h:%M"+n:l<p.month?"%b %d":l<p.year?h<p.year?"%b":"%b %y":"%y";return d.plot.formatDate(j,fmt,e.monthNames)}}else{n=e.tickDecimals;var r=-Math.floor(Math.log(j)/Math.LN10);n!=null&&r>n&&(r=n);l=Math.pow(10,-r);o=j/l;if(o<1.5)h=1;else if(o<3){if(h=2,o>2.25&&(n==null||r+1<=n))h=2.5,++r}else h=o<7.5?5:10;h*=l;if(e.minTickSize!=null&&h<e.minTickSize)h=e.minTickSize;b.tickDecimals=
-Math.max(0,n!=null?n:r);b.tickSize=e.tickSize||h;l=function(b){var f=[],d=F(b.min,b.tickSize),j=0,e=Number.NaN,l;do l=e,e=d+j*b.tickSize,f.push(e),++j;while(e<b.max&&e!=l);return f};h=function(b,f){return b.toFixed(f.tickDecimals)}}if(e.alignTicksWithAxis!=null){var u=(b.direction=="x"?ia:ka)[e.alignTicksWithAxis-1];if(u&&u.used&&u!=b){l=l(b);if(l.length>0){if(e.min==null)b.min=Math.min(b.min,l[0]);if(e.max==null&&l.length>1)b.max=Math.max(b.max,l[l.length-1])}l=function(b){var f=[],d,j;for(j=0;j<
-u.ticks.length;++j)d=(u.ticks[j].v-u.min)/(u.max-u.min),d=b.min+d*(b.max-b.min),f.push(d);return f};if(!b.mode&&e.tickDecimals==null&&(j=Math.max(0,-Math.floor(Math.log(j)/Math.LN10)+1),o=l(b),!(o.length>1&&/\..*0$/.test((o[1]-o[0]).toFixed(j)))))b.tickDecimals=j}}b.tickGenerator=l;b.tickFormatter=d.isFunction(e.tickFormatter)?function(b,f){return""+e.tickFormatter(b,f)}:h}function fa(){u.clearRect(0,0,ea,la);var b=n.grid;if(b.show&&b.backgroundColor)u.save(),u.translate(E.left,E.top),u.fillStyle=
-w(n.grid.backgroundColor,sa,0,"rgba(255, 255, 255, 0)"),u.fillRect(0,0,xa,sa),u.restore();b.show&&!b.aboveData&&(ga(),qa());for(var d=0;d<J.length;++d){z(ta.drawSeries,[u,J[d]]);var j=J[d];j.lines.show&&va(j);j.bars.show&&Y(j);j.points.show&&y(j)}z(ta.draw,[u]);b.show&&b.aboveData&&(ga(),qa())}function O(b,d){var j,e,l,h,n=I();for(i=0;i<n.length;++i)if(j=n[i],j.direction==d&&(h=d+j.n+"axis",!b[h]&&j.n==1&&(h=d+"axis"),b[h])){e=b[h].from;l=b[h].to;break}b[h]||(j=d=="x"?ia[0]:ka[0],e=b[d+"1"],l=b[d+
-"2"]);e!=null&&l!=null&&e>l&&(h=e,e=l,l=h);return{from:e,to:l,axis:j}}function ga(){var b;u.save();u.translate(E.left,E.top);var e=n.grid.markings;if(e){if(d.isFunction(e)){var j=U.getAxes();j.xmin=j.xaxis.min;j.xmax=j.xaxis.max;j.ymin=j.yaxis.min;j.ymax=j.yaxis.max;e=e(j)}for(b=0;b<e.length;++b){var j=e[b],h=O(j,"x"),l=O(j,"y");if(h.from==null)h.from=h.axis.min;if(h.to==null)h.to=h.axis.max;if(l.from==null)l.from=l.axis.min;if(l.to==null)l.to=l.axis.max;if(!(h.to<h.axis.min||h.from>h.axis.max||l.to<
-l.axis.min||l.from>l.axis.max))if(h.from=Math.max(h.from,h.axis.min),h.to=Math.min(h.to,h.axis.max),l.from=Math.max(l.from,l.axis.min),l.to=Math.min(l.to,l.axis.max),!(h.from==h.to&&l.from==l.to))h.from=h.axis.p2c(h.from),h.to=h.axis.p2c(h.to),l.from=l.axis.p2c(l.from),l.to=l.axis.p2c(l.to),h.from==h.to||l.from==l.to?(u.beginPath(),u.strokeStyle=j.color||n.grid.markingsColor,u.lineWidth=j.lineWidth||n.grid.markingsLineWidth,u.moveTo(h.from,l.from),u.lineTo(h.to,l.to),u.stroke()):(u.fillStyle=j.color||
-n.grid.markingsColor,u.fillRect(h.from,l.to,h.to-h.from,l.from-l.to))}}j=I();e=n.grid.borderWidth;for(h=0;h<j.length;++h){l=j[h];b=l.box;var o=l.tickLength,p,r,q,t;if(l.show&&l.ticks.length!=0){u.strokeStyle=l.options.tickColor||d.color.parse(l.options.color).scale("a",0.22).toString();u.lineWidth=1;l.direction=="x"?(p=0,r=o=="full"?l.position=="top"?0:sa:b.top-E.top+(l.position=="top"?b.height:0)):(r=0,p=o=="full"?l.position=="left"?0:xa:b.left-E.left+(l.position=="left"?b.width:0));l.innermost||
-(u.beginPath(),q=t=0,l.direction=="x"?q=xa:t=sa,u.lineWidth==1&&(p=Math.floor(p)+0.5,r=Math.floor(r)+0.5),u.moveTo(p,r),u.lineTo(p+q,r+t),u.stroke());u.beginPath();for(b=0;b<l.ticks.length;++b){var w=l.ticks[b].v;q=t=0;w<l.min||w>l.max||o=="full"&&e>0&&(w==l.min||w==l.max)||(l.direction=="x"?(p=l.p2c(w),t=o=="full"?-sa:o,l.position=="top"&&(t=-t)):(r=l.p2c(w),q=o=="full"?-xa:o,l.position=="left"&&(q=-q)),u.lineWidth==1&&(l.direction=="x"?p=Math.floor(p)+0.5:r=Math.floor(r)+0.5),u.moveTo(p,r),u.lineTo(p+
-q,r+t))}u.stroke()}}if(e)u.lineWidth=e,u.strokeStyle=n.grid.borderColor,u.strokeRect(-e/2,-e/2,xa+e,sa+e);u.restore()}function qa(){u.save();d.each(I(),function(b,e){if(e.show&&e.ticks.length!=0){var j=e.box,h=e.font;u.fillStyle=e.options.color;u.font=h.style+" "+h.variant+" "+h.weight+" "+h.size+"px "+h.family;u.textAlign="start";u.textBaseline="middle";for(h=0;h<e.ticks.length;++h){var l=e.ticks[h];if(l.label&&!(l.v<e.min||l.v>e.max))for(var n,o,p=0,r,q=0;q<l.lines.length;++q)r=l.lines[q],e.direction==
-"x"?(n=E.left+e.p2c(l.v)-r.width/2,o=e.position=="bottom"?j.top+j.padding:j.top+j.height-j.padding-l.height):(o=E.top+e.p2c(l.v)-l.height/2,n=e.position=="left"?j.left+j.width-j.padding-r.width:j.left+j.padding),o+=r.height/2+p,p+=r.height,d.browser.opera&&(n=Math.floor(n),o=Math.ceil(o-2)),u.fillText(r.text,n,o)}}});u.restore()}function va(f){function e(b,f,d,j,h){var l=b.points,b=b.pointsize,n=null,o=null;u.beginPath();for(var p=b;p<l.length;p+=b){var v=l[p-b],r=l[p-b+1],q=l[p],t=l[p+1];if(!(v==
-null||q==null)){if(r<=t&&r<h.min){if(t<h.min)continue;v=(h.min-r)/(t-r)*(q-v)+v;r=h.min}else if(t<=r&&t<h.min){if(r<h.min)continue;q=(h.min-r)/(t-r)*(q-v)+v;t=h.min}if(r>=t&&r>h.max){if(t>h.max)continue;v=(h.max-r)/(t-r)*(q-v)+v;r=h.max}else if(t>=r&&t>h.max){if(r>h.max)continue;q=(h.max-r)/(t-r)*(q-v)+v;t=h.max}if(v<=q&&v<j.min){if(q<j.min)continue;r=(j.min-v)/(q-v)*(t-r)+r;v=j.min}else if(q<=v&&q<j.min){if(v<j.min)continue;t=(j.min-v)/(q-v)*(t-r)+r;q=j.min}if(v>=q&&v>j.max){if(q>j.max)continue;
-r=(j.max-v)/(q-v)*(t-r)+r;v=j.max}else if(q>=v&&q>j.max){if(v>j.max)continue;t=(j.max-v)/(q-v)*(t-r)+r;q=j.max}(v!=n||r!=o)&&u.moveTo(j.p2c(v)+f,h.p2c(r)+d);n=q;o=t;u.lineTo(j.p2c(q)+f,h.p2c(t)+d)}}u.stroke()}function d(b,f,e){for(var j=b.points,b=b.pointsize,h=Math.min(Math.max(0,e.min),e.max),l=0,n=!1,o=1,v=0,r=0;;){if(b>0&&l>j.length+b)break;l+=b;var p=j[l-b],q=j[l-b+o],t=j[l],w=j[l+o];if(n){if(b>0&&p!=null&&t==null){r=l;b=-b;o=2;continue}if(b<0&&l==v+b){u.fill();n=!1;b=-b;o=1;l=v=r+b;continue}}if(!(p==
-null||t==null)){if(p<=t&&p<f.min){if(t<f.min)continue;q=(f.min-p)/(t-p)*(w-q)+q;p=f.min}else if(t<=p&&t<f.min){if(p<f.min)continue;w=(f.min-p)/(t-p)*(w-q)+q;t=f.min}if(p>=t&&p>f.max){if(t>f.max)continue;q=(f.max-p)/(t-p)*(w-q)+q;p=f.max}else if(t>=p&&t>f.max){if(p>f.max)continue;w=(f.max-p)/(t-p)*(w-q)+q;t=f.max}n||(u.beginPath(),u.moveTo(f.p2c(p),e.p2c(h)),n=!0);if(q>=e.max&&w>=e.max)u.lineTo(f.p2c(p),e.p2c(e.max)),u.lineTo(f.p2c(t),e.p2c(e.max));else if(q<=e.min&&w<=e.min)u.lineTo(f.p2c(p),e.p2c(e.min)),
-u.lineTo(f.p2c(t),e.p2c(e.min));else{var A=p,x=t;if(q<=w&&q<e.min&&w>=e.min)p=(e.min-q)/(w-q)*(t-p)+p,q=e.min;else if(w<=q&&w<e.min&&q>=e.min)t=(e.min-q)/(w-q)*(t-p)+p,w=e.min;if(q>=w&&q>e.max&&w<=e.max)p=(e.max-q)/(w-q)*(t-p)+p,q=e.max;else if(w>=q&&w>e.max&&q<=e.max)t=(e.max-q)/(w-q)*(t-p)+p,w=e.max;p!=A&&u.lineTo(f.p2c(A),e.p2c(q));u.lineTo(f.p2c(p),e.p2c(q));u.lineTo(f.p2c(t),e.p2c(w));t!=x&&(u.lineTo(f.p2c(t),e.p2c(w)),u.lineTo(f.p2c(x),e.p2c(w)))}}}}u.save();u.translate(E.left,E.top);u.lineJoin=
-"round";var h=f.lines.lineWidth,l=f.shadowSize;if(h>0&&l>0){u.lineWidth=l;u.strokeStyle="rgba(0,0,0,0.1)";var n=Math.PI/18;e(f.datapoints,Math.sin(n)*(h/2+l/2),Math.cos(n)*(h/2+l/2),f.xaxis,f.yaxis);u.lineWidth=l/2;e(f.datapoints,Math.sin(n)*(h/2+l/4),Math.cos(n)*(h/2+l/4),f.xaxis,f.yaxis)}u.lineWidth=h;u.strokeStyle=f.color;if(l=b(f.lines,f.color,0,sa))u.fillStyle=l,d(f.datapoints,f.xaxis,f.yaxis);h>0&&e(f.datapoints,0,0,f.xaxis,f.yaxis);u.restore()}function y(f){function e(b,f,d,j,h,l,n,o){for(var p=
-b.points,b=b.pointsize,v=0;v<p.length;v+=b){var r=p[v],q=p[v+1];if(!(r==null||r<l.min||r>l.max||q<n.min||q>n.max)){u.beginPath();r=l.p2c(r);q=n.p2c(q)+j;o=="circle"?u.arc(r,q,f,0,h?Math.PI:Math.PI*2,!1):o(u,r,q,f,h);u.closePath();if(d)u.fillStyle=d,u.fill();u.stroke()}}}u.save();u.translate(E.left,E.top);var j=f.points.lineWidth,d=f.shadowSize,h=f.points.radius,n=f.points.symbol;if(j>0&&d>0)d/=2,u.lineWidth=d,u.strokeStyle="rgba(0,0,0,0.1)",e(f.datapoints,h,null,d+d/2,!0,f.xaxis,f.yaxis,n),u.strokeStyle=
-"rgba(0,0,0,0.2)",e(f.datapoints,h,null,d/2,!0,f.xaxis,f.yaxis,n);u.lineWidth=j;u.strokeStyle=f.color;e(f.datapoints,h,b(f.points,f.color),0,!1,f.xaxis,f.yaxis,n);u.restore()}function T(b,e,d,h,l,n,o,p,r,q,t,w){var u,A,x,y;t?(y=A=x=!0,u=!1,t=d,d=e+h,l=e+l,b<t&&(e=b,b=t,t=e,u=!0,A=!1)):(u=A=x=!0,y=!1,t=b+h,b+=l,l=d,d=e,d<l&&(e=d,d=l,l=e,y=!0,x=!1));if(!(b<p.min||t>p.max||d<r.min||l>r.max)){if(t<p.min)t=p.min,u=!1;if(b>p.max)b=p.max,A=!1;if(l<r.min)l=r.min,y=!1;if(d>r.max)d=r.max,x=!1;t=p.p2c(t);l=
-r.p2c(l);b=p.p2c(b);d=r.p2c(d);if(o)q.beginPath(),q.moveTo(t,l),q.lineTo(t,d),q.lineTo(b,d),q.lineTo(b,l),q.fillStyle=o(l,d),q.fill();if(w>0&&(u||A||x||y))q.beginPath(),q.moveTo(t,l+n),u?q.lineTo(t,d+n):q.moveTo(t,d+n),x?q.lineTo(b,d+n):q.moveTo(b,d+n),A?q.lineTo(b,l+n):q.moveTo(b,l+n),y?q.lineTo(t,l+n):q.moveTo(t,l+n),q.stroke()}}function Y(f){u.save();u.translate(E.left,E.top);u.lineWidth=f.bars.lineWidth;u.strokeStyle=f.color;var e=f.bars.align=="left"?0:-f.bars.barWidth/2;(function(b,e,d,h,n,
-p,o){for(var r=b.points,b=b.pointsize,q=0;q<r.length;q+=b)r[q]!=null&&T(r[q],r[q+1],r[q+2],e,d,h,n,p,o,u,f.bars.horizontal,f.bars.lineWidth)})(f.datapoints,e,e+f.bars.barWidth,0,f.bars.fill?function(e,d){return b(f.bars,f.color,e,d)}:null,f.xaxis,f.yaxis);u.restore()}function b(b,e,j,h){var l=b.fill;if(!l)return null;if(b.fillColor)return w(b.fillColor,j,h,e);b=d.color.parse(e);b.a=typeof l=="number"?l:0.4;b.normalize();return b.toString()}function $(){h.find(".legend").remove();if(n.legend.show){for(var b=
-[],e=!1,j=n.legend.labelFormatter,o,l,r=0;r<J.length;++r)if(o=J[r],l=o.label)r%n.legend.noColumns==0&&(e&&b.push("</tr>"),b.push("<tr>"),e=!0),j&&(l=j(l,o)),b.push('<td class="legendColorBox"><div style="border:1px solid '+n.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+o.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+l+"</td>");e&&b.push("</tr>");if(b.length!=0)if(e='<table style="font-size:smaller;color:'+n.grid.color+'">'+b.join("")+
-"</table>",n.legend.container!=null)d(n.legend.container).html(e);else if(b="",j=n.legend.position,o=n.legend.margin,o[0]==null&&(o=[o,o]),j.charAt(0)=="n"?b+="top:"+(o[1]+E.top)+"px;":j.charAt(0)=="s"&&(b+="bottom:"+(o[1]+E.bottom)+"px;"),j.charAt(1)=="e"?b+="right:"+(o[0]+E.right)+"px;":j.charAt(1)=="w"&&(b+="left:"+(o[0]+E.left)+"px;"),e=d('<div class="legend">'+e.replace('style="','style="position:absolute;'+b+";")+"</div>").appendTo(h),n.legend.backgroundOpacity!=0){j=n.legend.backgroundColor;
-if(j==null)j=(j=n.grid.backgroundColor)&&typeof j=="string"?d.color.parse(j):d.color.extract(e,"background-color"),j.a=1,j=j.toString();o=e.children();d('<div style="position:absolute;width:'+o.width()+"px;height:"+o.height()+"px;"+b+"background-color:"+j+';"> </div>').prependTo(e).css("opacity",n.legend.backgroundOpacity)}}}function aa(b){n.grid.hoverable&&ja("plothover",b,function(b){return b.hoverable!=!1})}function D(b){n.grid.hoverable&&ja("plothover",b,function(){return!1})}function oa(b){ja("plotclick",
-b,function(b){return b.clickable!=!1})}function ja(b,e,d){var o=pa.offset(),l=e.pageX-o.left-E.left,r=e.pageY-o.top-E.top,q=G({left:l,top:r});q.pageX=e.pageX;q.pageY=e.pageY;var e=n.grid.mouseActiveRadius,t=e*e+1,u=null,w,A;for(w=J.length-1;w>=0;--w)if(d(J[w])){var x=J[w],y=x.xaxis,C=x.yaxis,z=x.datapoints.points,Q=x.datapoints.pointsize,F=y.c2p(l),B=C.c2p(r),R=e/y.scale,D=e/C.scale;if(y.options.inverseTransform)R=Number.MAX_VALUE;if(C.options.inverseTransform)D=Number.MAX_VALUE;if(x.lines.show||
-x.points.show)for(A=0;A<z.length;A+=Q){var V=z[A],S=z[A+1];if(V!=null&&!(V-F>R||V-F<-R||S-B>D||S-B<-D))V=Math.abs(y.p2c(V)-l),S=Math.abs(C.p2c(S)-r),S=V*V+S*S,S<t&&(t=S,u=[w,A/Q])}if(x.bars.show&&!u){y=x.bars.align=="left"?0:-x.bars.barWidth/2;x=y+x.bars.barWidth;for(A=0;A<z.length;A+=Q)if(V=z[A],S=z[A+1],C=z[A+2],V!=null&&(J[w].bars.horizontal?F<=Math.max(C,V)&&F>=Math.min(C,V)&&B>=S+y&&B<=S+x:F>=V+y&&F<=V+x&&B>=Math.min(C,S)&&B<=Math.max(C,S)))u=[w,A/Q]}}u?(w=u[0],A=u[1],Q=J[w].datapoints.pointsize,
-d={datapoint:J[w].datapoints.points.slice(A*Q,(A+1)*Q),dataIndex:A,series:J[w],seriesIndex:w}):d=null;if(d)d.pageX=parseInt(d.series.xaxis.p2c(d.datapoint[0])+o.left+E.left),d.pageY=parseInt(d.series.yaxis.p2c(d.datapoint[1])+o.top+E.top);if(n.grid.autoHighlight){for(o=0;o<ya.length;++o)l=ya[o],l.auto==b&&(!d||!(l.series==d.series&&l.point[0]==d.datapoint[0]&&l.point[1]==d.datapoint[1]))&&Ma(l.series,l.point);d&&wa(d.series,d.datapoint,b)}h.trigger(b,[q,d])}function ba(){var b=n.interaction.redrawOverlayInterval;
-b==-1?ra():Ea||(Ea=setTimeout(ra,b))}function ra(){Ea=null;da.save();da.clearRect(0,0,ea,la);da.translate(E.left,E.top);var b,e;for(b=0;b<ya.length;++b)if(e=ya[b],e.series.bars.show)t(e.series,e.point);else{var j=e.series,h=e.point;e=h[0];var h=h[1],l=j.xaxis,n=j.yaxis;if(!(e<l.min||e>l.max||h<n.min||h>n.max)){var o=j.points.radius+j.points.lineWidth/2;da.lineWidth=o;da.strokeStyle=d.color.parse(j.color).scale("a",0.5).toString();o*=1.5;e=l.p2c(e);h=n.p2c(h);da.beginPath();j.points.symbol=="circle"?
-da.arc(e,h,o,0,2*Math.PI,!1):j.points.symbol(da,e,h,o,!1);da.closePath();da.stroke()}}da.restore();z(ta.drawOverlay,[da])}function wa(b,d,j){typeof b=="number"&&(b=J[b]);if(typeof d=="number")var h=b.datapoints.pointsize,d=b.datapoints.points.slice(h*d,h*(d+1));h=e(b,d);if(h==-1)ya.push({series:b,point:d,auto:j}),ba();else if(!j)ya[h].auto=!1}function Ma(b,d){b==null&&d==null&&(ya=[],ba());typeof b=="number"&&(b=J[b]);typeof d=="number"&&(d=b.data[d]);var j=e(b,d);j!=-1&&(ya.splice(j,1),ba())}function e(b,
-e){for(var d=0;d<ya.length;++d){var h=ya[d];if(h.series==b&&h.point[0]==e[0]&&h.point[1]==e[1])return d}return-1}function t(b,e){da.lineWidth=b.bars.lineWidth;da.strokeStyle=d.color.parse(b.color).scale("a",0.5).toString();var j=d.color.parse(b.color).scale("a",0.5).toString(),h=b.bars.align=="left"?0:-b.bars.barWidth/2;T(e[0],e[1],e[2]||0,h,h+b.bars.barWidth,0,function(){return j},b.xaxis,b.yaxis,da,b.bars.horizontal,b.bars.lineWidth)}function w(b,e,j,h){if(typeof b=="string")return b;else{for(var e=
-u.createLinearGradient(0,j,0,e),j=0,l=b.colors.length;j<l;++j){var n=b.colors[j];if(typeof n!="string"){var o=d.color.parse(h);n.brightness!=null&&(o=o.scale("rgb",n.brightness));n.opacity!=null&&(o.a*=n.opacity);n=o.toString()}e.addColorStop(j/(l-1),n)}return e}}var J=[],n={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:!0,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:0.85},xaxis:{show:null,
-position:"bottom",mode:null,font:null,color:null,tickColor:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null,labelHeight:null,reserveSpace:null,tickLength:null,alignTicksWithAxis:null,tickDecimals:null,tickSize:null,minTickSize:null,monthNames:null,timeformat:null,twelveHourClock:!1},yaxis:{autoscaleMargin:0.02,position:"left"},xaxes:[],yaxes:[],series:{points:{show:!1,radius:3,lineWidth:2,fill:!0,fillColor:"#ffffff",symbol:"circle"},
-lines:{lineWidth:2,fill:!1,fillColor:null,steps:!1},bars:{show:!1,lineWidth:2,barWidth:1,fill:!0,fillColor:null,align:"left",horizontal:!1},shadowSize:3},grid:{show:!0,aboveData:!1,color:"#545454",backgroundColor:null,borderColor:null,tickColor:null,labelMargin:5,axisMargin:8,borderWidth:2,minBorderMargin:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:!1,hoverable:!1,autoHighlight:!0,mouseActiveRadius:10},interaction:{redrawOverlayInterval:1E3/60},hooks:{}},Ba=null,ca=null,
-pa=null,u=null,da=null,ia=[],ka=[],E={left:0,right:0,top:0,bottom:0},ea=0,la=0,xa=0,sa=0,ta={processOptions:[],processRawData:[],processDatapoints:[],drawSeries:[],draw:[],bindEvents:[],drawOverlay:[],shutdown:[]},U=this;U.setData=N;U.setupGrid=X;U.draw=fa;U.getPlaceholder=function(){return h};U.getCanvas=function(){return Ba};U.getPlotOffset=function(){return E};U.width=function(){return xa};U.height=function(){return sa};U.offset=function(){var b=pa.offset();b.left+=E.left;b.top+=E.top;return b};
-U.getData=function(){return J};U.getAxes=function(){var b={};d.each(ia.concat(ka),function(e,d){d&&(b[d.direction+(d.n!=1?d.n:"")+"axis"]=d)});return b};U.getXAxes=function(){return ia};U.getYAxes=function(){return ka};U.c2p=G;U.p2c=function(b){var e={},d,h,l;for(d=0;d<ia.length;++d)if((h=ia[d])&&h.used)if(l="x"+h.n,b[l]==null&&h.n==1&&(l="x"),b[l]!=null){e.left=h.p2c(b[l]);break}for(d=0;d<ka.length;++d)if((h=ka[d])&&h.used)if(l="y"+h.n,b[l]==null&&h.n==1&&(l="y"),b[l]!=null){e.top=h.p2c(b[l]);break}return e};
-U.getOptions=function(){return n};U.highlight=wa;U.unhighlight=Ma;U.triggerRedrawOverlay=ba;U.pointOffset=function(b){return{left:parseInt(ia[K(b,"x")-1].p2c(+b.x)+E.left),top:parseInt(ka[K(b,"y")-1].p2c(+b.y)+E.top)}};U.shutdown=function(){Ea&&clearTimeout(Ea);pa.unbind("mousemove",aa);pa.unbind("mouseleave",D);pa.unbind("click",oa);z(ta.shutdown,[pa])};U.resize=function(){V();Q(Ba);Q(ca)};U.hooks=ta;(function(){for(var b=0;b<q.length;++b){var e=q[b];e.init(U);e.options&&d.extend(!0,n,e.options)}})(U);
-(function(b){d.extend(!0,n,b);if(n.xaxis.color==null)n.xaxis.color=n.grid.color;if(n.yaxis.color==null)n.yaxis.color=n.grid.color;if(n.xaxis.tickColor==null)n.xaxis.tickColor=n.grid.tickColor;if(n.yaxis.tickColor==null)n.yaxis.tickColor=n.grid.tickColor;if(n.grid.borderColor==null)n.grid.borderColor=n.grid.color;if(n.grid.tickColor==null)n.grid.tickColor=d.color.parse(n.grid.color).scale("a",0.22).toString();for(b=0;b<Math.max(1,n.xaxes.length);++b)n.xaxes[b]=d.extend(!0,{},n.xaxis,n.xaxes[b]);for(b=
-0;b<Math.max(1,n.yaxes.length);++b)n.yaxes[b]=d.extend(!0,{},n.yaxis,n.yaxes[b]);if(n.xaxis.noTicks&&n.xaxis.ticks==null)n.xaxis.ticks=n.xaxis.noTicks;if(n.yaxis.noTicks&&n.yaxis.ticks==null)n.yaxis.ticks=n.yaxis.noTicks;if(n.x2axis)n.xaxes[1]=d.extend(!0,{},n.xaxis,n.x2axis),n.xaxes[1].position="top";if(n.y2axis)n.yaxes[1]=d.extend(!0,{},n.yaxis,n.y2axis),n.yaxes[1].position="right";if(n.grid.coloredAreas)n.grid.markings=n.grid.coloredAreas;if(n.grid.coloredAreasColor)n.grid.markingsColor=n.grid.coloredAreasColor;
-n.lines&&d.extend(!0,n.series.lines,n.lines);n.points&&d.extend(!0,n.series.points,n.points);n.bars&&d.extend(!0,n.series.bars,n.bars);if(n.shadowSize!=null)n.series.shadowSize=n.shadowSize;for(b=0;b<n.xaxes.length;++b)r(ia,b+1).options=n.xaxes[b];for(b=0;b<n.yaxes.length;++b)r(ka,b+1).options=n.yaxes[b];for(var e in ta)n.hooks[e]&&n.hooks[e].length&&(ta[e]=ta[e].concat(n.hooks[e]));z(ta.processOptions,[n])})(B);(function(){var b;b=h.children("canvas.flot-base");var e=h.children("canvas.flot-overlay");
-b.length==0||e==0?(h.html(""),h.css({padding:0}),h.css("position")=="static"&&h.css("position","relative"),V(),Ba=A(!0,"flot-base"),ca=A(!1,"flot-overlay"),b=!1):(Ba=b.get(0),ca=e.get(0),b=!0);u=Ba.getContext("2d");da=ca.getContext("2d");pa=d(ca);b&&(h.data("plot").shutdown(),U.resize(),da.clearRect(0,0,ea,la),pa.unbind(),h.children().not([Ba,ca]).remove());h.data("plot",U)})();N(C);X();fa();n.grid.hoverable&&(pa.mousemove(aa),pa.mouseleave(D));n.grid.clickable&&pa.click(oa);z(ta.bindEvents,[pa]);
-var ya=[],Ea=null}function F(d,h){return h*Math.floor(d/h)}d.plot=function(p,C,F){return new h(d(p),C,F,d.plot.plugins)};d.plot.version="0.7";d.plot.plugins=[];d.plot.formatDate=function(d,h,F){var q=function(d){d=""+d;return d.length==1?"0"+d:d},z=[],N=!1,K=!1,I=d.getUTCHours(),G=I<12;F==null&&(F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]);h.search(/%p|%P/)!=-1&&(I>12?I-=12:I==0&&(I=12));for(var r=0;r<h.length;++r){var o=h.charAt(r);if(N){switch(o){case "h":o=""+I;
-break;case "H":o=q(I);break;case "M":o=q(d.getUTCMinutes());break;case "S":o=q(d.getUTCSeconds());break;case "d":o=""+d.getUTCDate();break;case "m":o=""+(d.getUTCMonth()+1);break;case "y":o=""+d.getUTCFullYear();break;case "b":o=""+F[d.getUTCMonth()];break;case "p":o=G?"am":"pm";break;case "P":o=G?"AM":"PM";break;case "0":o="",K=!0}o&&K&&(o=q(o),K=!1);z.push(o);K||(N=!1)}else o=="%"?N=!0:z.push(o)}return z.join("")}})(jQuery);
-// Input 3
-(function(d){d.plot.plugins.push({init:function(d){d.hooks.processDatapoints.push(function(d,h,C){if(h.stack!=null){for(var B,d=d.getData(),q=null,z=0;z<d.length;++z){if(h==d[z])break;d[z].stack==h.stack&&(q=d[z])}if(B=q){d=C.pointsize;q=C.points;z=B.datapoints.pointsize;B=B.datapoints.points;var N=[],K,I,G,r,o,A,V=h.lines.show;r=h.bars.horizontal;var Q=d>2&&(r?C.format[2].x:C.format[2].y),h=V&&h.lines.steps;G=!0;for(var R=r?1:0,S=r?0:1,x=0,X=0,L;;){if(x>=q.length)break;L=N.length;if(q[x]==null){for(m=
-0;m<d;++m)N.push(q[x+m]);x+=d}else if(X>=B.length){if(!V)for(m=0;m<d;++m)N.push(q[x+m]);x+=d}else if(B[X]==null){for(m=0;m<d;++m)N.push(null);G=!0;X+=z}else{K=q[x+R];I=q[x+S];r=B[X+R];o=B[X+S];A=0;if(K==r){for(m=0;m<d;++m)N.push(q[x+m]);N[L+S]+=o;A=o;x+=d;X+=z}else if(K>r){if(V&&x>0&&q[x-d]!=null){G=I+(q[x-d+S]-I)*(r-K)/(q[x-d+R]-K);N.push(r);N.push(G+o);for(m=2;m<d;++m)N.push(q[x+m]);A=o}X+=z}else{if(G&&V){x+=d;continue}for(m=0;m<d;++m)N.push(q[x+m]);V&&X>0&&B[X-z]!=null&&(A=o+(B[X-z+S]-o)*(K-r)/
-(B[X-z+R]-r));N[L+S]+=A;x+=d}G=!1;L!=N.length&&Q&&(N[L+2]+=A)}if(h&&L!=N.length&&L>0&&N[L]!=null&&N[L]!=N[L-d]&&N[L+1]!=N[L-d+1]){for(m=0;m<d;++m)N[L+d+m]=N[L+m];N[L+1]=N[L-d+1]}}C.points=N}}})},options:{series:{stack:null}},name:"stack",version:"1.2"})})(jQuery);
-// Input 4
-(function(d){d.plot.plugins.push({init:function(h){function F(d){G.active&&(z(d),h.getPlaceholder().trigger("plotselecting",[C()]))}function p(p){if(p.which==1){document.body.focus();if(document.onselectstart!==void 0&&r.onselectstart==null)r.onselectstart=document.onselectstart,document.onselectstart=function(){return!1};if(document.ondrag!==void 0&&r.ondrag==null)r.ondrag=document.ondrag,document.ondrag=function(){return!1};q(G.first,p);G.active=!0;o=function(d){o=null;if(document.onselectstart!==
-void 0)document.onselectstart=r.onselectstart;if(document.ondrag!==void 0)document.ondrag=r.ondrag;G.active=!1;z(d);I()?B():(h.getPlaceholder().trigger("plotunselected",[]),h.getPlaceholder().trigger("plotselecting",[null]))};d(document).one("mouseup",o)}}function C(){if(!I())return null;var o={},r=G.first,p=G.second;d.each(h.getAxes(),function(d,h){if(h.used){var q=h.c2p(r[h.direction]),z=h.c2p(p[h.direction]);o[d]={from:Math.min(q,z),to:Math.max(q,z)}}});return o}function B(){var d=C();h.getPlaceholder().trigger("plotselected",
-[d]);d.xaxis&&d.yaxis&&h.getPlaceholder().trigger("selected",[{x1:d.xaxis.from,y1:d.yaxis.from,x2:d.xaxis.to,y2:d.yaxis.to}])}function q(d,o){var r=h.getOptions(),p=h.getPlaceholder().offset(),q=h.getPlotOffset(),x=o.pageX-p.left-q.left,z=h.width();d.x=x<0?0:x>z?z:x;p=o.pageY-p.top-q.top;q=h.height();d.y=p<0?0:p>q?q:p;if(r.selection.mode=="y")d.x=d==G.first?0:h.width();if(r.selection.mode=="x")d.y=d==G.first?0:h.height()}function z(d){if(d.pageX!=null)q(G.second,d),I()?(G.show=!0,h.triggerRedrawOverlay()):
-N(!0)}function N(d){if(G.show)G.show=!1,h.triggerRedrawOverlay(),d||h.getPlaceholder().trigger("plotunselected",[])}function K(d,o){var r,p,q,x,z=h.getAxes(),C;for(C in z)if(r=z[C],r.direction==o&&(x=o+r.n+"axis",!d[x]&&r.n==1&&(x=o+"axis"),d[x])){p=d[x].from;q=d[x].to;break}d[x]||(r=o=="x"?h.getXAxes()[0]:h.getYAxes()[0],p=d[o+"1"],q=d[o+"2"]);p!=null&&q!=null&&p>q&&(x=p,p=q,q=x);return{from:p,to:q,axis:r}}function I(){return Math.abs(G.second.x-G.first.x)>=5&&Math.abs(G.second.y-G.first.y)>=5}var G=
-{first:{x:-1,y:-1},second:{x:-1,y:-1},show:!1,active:!1},r={},o=null;h.clearSelection=N;h.setSelection=function(d,o){var r,p=h.getOptions();p.selection.mode=="y"?(G.first.x=0,G.second.x=h.width()):(r=K(d,"x"),G.first.x=r.axis.p2c(r.from),G.second.x=r.axis.p2c(r.to));p.selection.mode=="x"?(G.first.y=0,G.second.y=h.height()):(r=K(d,"y"),G.first.y=r.axis.p2c(r.from),G.second.y=r.axis.p2c(r.to));G.show=!0;h.triggerRedrawOverlay();!o&&I()&&B()};h.getSelection=C;h.hooks.bindEvents.push(function(d,h){d.getOptions().selection.mode!=
-null&&(h.mousemove(F),h.mousedown(p))});h.hooks.drawOverlay.push(function(h,o){if(G.show&&I()){var r=h.getPlotOffset(),p=h.getOptions();o.save();o.translate(r.left,r.top);r=d.color.parse(p.selection.color);o.strokeStyle=r.scale("a",0.8).toString();o.lineWidth=1;o.lineJoin="round";o.fillStyle=r.scale("a",0.4).toString();var r=Math.min(G.first.x,G.second.x),p=Math.min(G.first.y,G.second.y),q=Math.abs(G.second.x-G.first.x),x=Math.abs(G.second.y-G.first.y);o.fillRect(r,p,q,x);o.strokeRect(r,p,q,x);o.restore()}});
-h.hooks.shutdown.push(function(h,r){r.unbind("mousemove",F);r.unbind("mousedown",p);o&&d(document).unbind("mouseup",o)})},options:{selection:{mode:null,color:"#e8cfac"}},name:"selection",version:"1.1"})})(jQuery);
-// Input 5
-function InvalidRRD(d){this.message=d;this.name="Invalid RRD"}InvalidRRD.prototype.toString=function(){return this.name+': "'+this.message+'"'};function RRDDS(d,h,F){this.rrd_data=d;this.rrd_data_idx=h;this.my_idx=F}RRDDS.prototype.getIdx=function(){return this.my_idx};RRDDS.prototype.getName=function(){return this.rrd_data.getCStringAt(this.rrd_data_idx,20)};RRDDS.prototype.getType=function(){return this.rrd_data.getCStringAt(this.rrd_data_idx+20,20)};
-RRDDS.prototype.getMin=function(){return this.rrd_data.getDoubleAt(this.rrd_data_idx+48)};RRDDS.prototype.getMax=function(){return this.rrd_data.getDoubleAt(this.rrd_data_idx+56)};function RRDRRAInfo(d,h,F,p,C,B){this.rrd_data=d;this.rra_def_idx=h;this.rrd_align=F;this.row_cnt=p;this.pdp_step=C;this.my_idx=B}RRDRRAInfo.prototype.getIdx=function(){return this.my_idx};RRDRRAInfo.prototype.getNrRows=function(){return this.row_cnt};
+function InvalidRRD(a){this.message=a;this.name="Invalid RRD"}InvalidRRD.prototype.toString=function(){return this.name+': "'+this.message+'"'};function RRDDS(a,c,d){this.rrd_data=a;this.rrd_data_idx=c;this.my_idx=d}RRDDS.prototype.getIdx=function(){return this.my_idx};RRDDS.prototype.getName=function(){return this.rrd_data.getCStringAt(this.rrd_data_idx,20)};RRDDS.prototype.getType=function(){return this.rrd_data.getCStringAt(this.rrd_data_idx+20,20)};
+RRDDS.prototype.getMin=function(){return this.rrd_data.getDoubleAt(this.rrd_data_idx+48)};RRDDS.prototype.getMax=function(){return this.rrd_data.getDoubleAt(this.rrd_data_idx+56)};function RRDRRAInfo(a,c,d,b,f,g){this.rrd_data=a;this.rra_def_idx=c;this.rrd_align=d;this.row_cnt=b;this.pdp_step=f;this.my_idx=g}RRDRRAInfo.prototype.getIdx=function(){return this.my_idx};RRDRRAInfo.prototype.getNrRows=function(){return this.row_cnt};
RRDRRAInfo.prototype.getPdpPerRow=function(){return this.rrd_align==32?this.rrd_data.getLongAt(this.rra_def_idx+24,20):this.rrd_data.getLongAt(this.rra_def_idx+32,20)};RRDRRAInfo.prototype.getStep=function(){return this.pdp_step*this.getPdpPerRow()};RRDRRAInfo.prototype.getCFName=function(){return this.rrd_data.getCStringAt(this.rra_def_idx,20)};
-function RRDRRA(d,h,F,p,C,B){this.rrd_data=d;this.rra_info=F;this.row_cnt=F.row_cnt;this.ds_cnt=B;var q=B*8;this.base_rrd_db_idx=p+C*q;this.cur_row=d.getLongAt(h);this.calc_idx=function(d,h){if(d>=0&&d<this.row_cnt)if(h>=0&&h<B){var p=d+this.cur_row+1;p>=this.row_cnt&&(p-=this.row_cnt);return q*p+h*8}else throw RangeError("DS idx ("+d+") out of range [0-"+B+").");else throw RangeError("Row idx ("+d+") out of range [0-"+this.row_cnt+").");}}RRDRRA.prototype.getIdx=function(){return this.rra_info.getIdx()};
-RRDRRA.prototype.getNrRows=function(){return this.row_cnt};RRDRRA.prototype.getNrDSs=function(){return this.ds_cnt};RRDRRA.prototype.getStep=function(){return this.rra_info.getStep()};RRDRRA.prototype.getCFName=function(){return this.rra_info.getCFName()};RRDRRA.prototype.getEl=function(d,h){return this.rrd_data.getDoubleAt(this.base_rrd_db_idx+this.calc_idx(d,h))};RRDRRA.prototype.getElFast=function(d,h){return this.rrd_data.getFastDoubleAt(this.base_rrd_db_idx+this.calc_idx(d,h))};
-function RRDHeader(d){this.rrd_data=d;this.validate_rrd();this.load_header();this.calc_idxs()}
+function RRDRRA(a,c,d,b,f,g){this.rrd_data=a;this.rra_info=d;this.row_cnt=d.row_cnt;this.ds_cnt=g;var h=g*8;this.base_rrd_db_idx=b+f*h;this.cur_row=a.getLongAt(c);this.calc_idx=function(a,b){if(a>=0&&a<this.row_cnt)if(b>=0&&b<g){var c=a+this.cur_row+1;c>=this.row_cnt&&(c-=this.row_cnt);return h*c+b*8}else throw RangeError("DS idx ("+a+") out of range [0-"+g+").");else throw RangeError("Row idx ("+a+") out of range [0-"+this.row_cnt+").");}}RRDRRA.prototype.getIdx=function(){return this.rra_info.getIdx()};
+RRDRRA.prototype.getNrRows=function(){return this.row_cnt};RRDRRA.prototype.getNrDSs=function(){return this.ds_cnt};RRDRRA.prototype.getStep=function(){return this.rra_info.getStep()};RRDRRA.prototype.getCFName=function(){return this.rra_info.getCFName()};RRDRRA.prototype.getEl=function(a,c){return this.rrd_data.getDoubleAt(this.base_rrd_db_idx+this.calc_idx(a,c))};RRDRRA.prototype.getElFast=function(a,c){return this.rrd_data.getFastDoubleAt(this.base_rrd_db_idx+this.calc_idx(a,c))};
+function RRDHeader(a){this.rrd_data=a;this.validate_rrd();this.load_header();this.calc_idxs()}
RRDHeader.prototype.validate_rrd=function(){if(this.rrd_data.getCStringAt(0,4)!=="RRD")throw new InvalidRRD("Wrong magic id.");this.rrd_version=this.rrd_data.getCStringAt(4,5);if(this.rrd_version!=="0003"&&this.rrd_version!=="0004")throw new InvalidRRD("Unsupported RRD version "+this.rrd_version+".");if(this.rrd_data.getDoubleAt(12)==8.642135E130)this.rrd_align=32;else if(this.rrd_data.getDoubleAt(16)==8.642135E130)this.rrd_align=64;else throw new InvalidRRD("Unsupported platform.");};
RRDHeader.prototype.load_header=function(){this.rrd_align==32?(this.ds_cnt=this.rrd_data.getLongAt(20,!1),this.rra_cnt=this.rrd_data.getLongAt(24,!1),this.pdp_step=this.rrd_data.getLongAt(28,!1),this.top_header_size=112):(this.ds_cnt=this.rrd_data.getLongAt(24,!1),this.rra_cnt=this.rrd_data.getLongAt(32,!1),this.pdp_step=this.rrd_data.getLongAt(40,!1),this.top_header_size=128)};
RRDHeader.prototype.calc_idxs=function(){this.ds_def_idx=this.top_header_size;this.ds_el_size=120;this.rra_def_idx=this.ds_def_idx+this.ds_el_size*this.ds_cnt;this.rrd_align==32?(this.rra_def_el_size=108,this.row_cnt_idx=20):(this.rra_def_el_size=120,this.row_cnt_idx=24);this.live_head_idx=this.rra_def_idx+this.rra_def_el_size*this.rra_cnt;this.live_head_size=this.rrd_align==32?8:16;this.pdp_prep_idx=this.live_head_idx+this.live_head_size;this.pdp_prep_el_size=112;this.cdp_prep_idx=this.pdp_prep_idx+
this.pdp_prep_el_size*this.ds_cnt;this.cdp_prep_el_size=80;this.rra_ptr_idx=this.cdp_prep_idx+this.cdp_prep_el_size*this.ds_cnt*this.rra_cnt;this.rra_ptr_el_size=this.rrd_align==32?4:8;this.header_size=this.rra_ptr_idx+this.rra_ptr_el_size*this.rra_cnt};
-RRDHeader.prototype.load_row_cnts=function(){this.rra_def_row_cnts=[];this.rra_def_row_cnt_sums=[];for(var d=0;d<this.rra_cnt;d++)this.rra_def_row_cnts[d]=this.rrd_data.getLongAt(this.rra_def_idx+d*this.rra_def_el_size+this.row_cnt_idx,!1),this.rra_def_row_cnt_sums[d]=d==0?0:this.rra_def_row_cnt_sums[d-1]+this.rra_def_row_cnts[d-1]};RRDHeader.prototype.getMinStep=function(){return this.pdp_step};RRDHeader.prototype.getLastUpdate=function(){return this.rrd_data.getLongAt(this.live_head_idx,!1)};
-RRDHeader.prototype.getNrDSs=function(){return this.ds_cnt};RRDHeader.prototype.getDSNames=function(){for(var d=[],h=0;h<this.ds_cnt;h++){var F=this.getDSbyIdx(h).getName();d.push(F)}return d};RRDHeader.prototype.getDSbyIdx=function(d){if(d>=0&&d<this.ds_cnt)return new RRDDS(this.rrd_data,this.ds_def_idx+this.ds_el_size*d,d);else throw RangeError("DS idx ("+d+") out of range [0-"+this.ds_cnt+").");};
-RRDHeader.prototype.getDSbyName=function(d){for(var h=0;h<this.ds_cnt;h++){var F=this.getDSbyIdx(h);if(F.getName()==d)return F}throw RangeError("DS name "+d+" unknown.");};RRDHeader.prototype.getNrRRAs=function(){return this.rra_cnt};
-RRDHeader.prototype.getRRAInfo=function(d){if(d>=0&&d<this.rra_cnt)return new RRDRRAInfo(this.rrd_data,this.rra_def_idx+d*this.rra_def_el_size,this.rrd_align,this.rra_def_row_cnts[d],this.pdp_step,d);else throw RangeError("RRA idx ("+d+") out of range [0-"+this.rra_cnt+").");};
-function RRDFile(d){this.rrd_header=new RRDHeader(d);this.rrd_header.load_row_cnts();this.getMinStep=function(){return this.rrd_header.getMinStep()};this.getLastUpdate=function(){return this.rrd_header.getLastUpdate()};this.getNrDSs=function(){return this.rrd_header.getNrDSs()};this.getDSNames=function(){return this.rrd_header.getDSNames()};this.getDS=function(d){return typeof d=="number"?this.rrd_header.getDSbyIdx(d):this.rrd_header.getDSbyName(d)};this.getNrRRAs=function(){return this.rrd_header.getNrRRAs()};
-this.getRRAInfo=function(d){return this.rrd_header.getRRAInfo(d)};this.getRRA=function(h){rra_info=this.rrd_header.getRRAInfo(h);return new RRDRRA(d,this.rrd_header.rra_ptr_idx+h*this.rrd_header.rra_ptr_el_size,rra_info,this.rrd_header.header_size,this.rrd_header.rra_def_row_cnt_sums[h],this.rrd_header.ds_cnt)}};
-// Input 6
+RRDHeader.prototype.load_row_cnts=function(){this.rra_def_row_cnts=[];this.rra_def_row_cnt_sums=[];for(var a=0;a<this.rra_cnt;a++)this.rra_def_row_cnts[a]=this.rrd_data.getLongAt(this.rra_def_idx+a*this.rra_def_el_size+this.row_cnt_idx,!1),this.rra_def_row_cnt_sums[a]=a==0?0:this.rra_def_row_cnt_sums[a-1]+this.rra_def_row_cnts[a-1]};RRDHeader.prototype.getMinStep=function(){return this.pdp_step};RRDHeader.prototype.getLastUpdate=function(){return this.rrd_data.getLongAt(this.live_head_idx,!1)};
+RRDHeader.prototype.getNrDSs=function(){return this.ds_cnt};RRDHeader.prototype.getDSNames=function(){for(var a=[],c=0;c<this.ds_cnt;c++){var d=this.getDSbyIdx(c).getName();a.push(d)}return a};RRDHeader.prototype.getDSbyIdx=function(a){if(a>=0&&a<this.ds_cnt)return new RRDDS(this.rrd_data,this.ds_def_idx+this.ds_el_size*a,a);else throw RangeError("DS idx ("+a+") out of range [0-"+this.ds_cnt+").");};
+RRDHeader.prototype.getDSbyName=function(a){for(var c=0;c<this.ds_cnt;c++){var d=this.getDSbyIdx(c);if(d.getName()==a)return d}throw RangeError("DS name "+a+" unknown.");};RRDHeader.prototype.getNrRRAs=function(){return this.rra_cnt};
+RRDHeader.prototype.getRRAInfo=function(a){if(a>=0&&a<this.rra_cnt)return new RRDRRAInfo(this.rrd_data,this.rra_def_idx+a*this.rra_def_el_size,this.rrd_align,this.rra_def_row_cnts[a],this.pdp_step,a);else throw RangeError("RRA idx ("+a+") out of range [0-"+this.rra_cnt+").");};
+function RRDFile(a){this.rrd_header=new RRDHeader(a);this.rrd_header.load_row_cnts();this.getMinStep=function(){return this.rrd_header.getMinStep()};this.getLastUpdate=function(){return this.rrd_header.getLastUpdate()};this.getNrDSs=function(){return this.rrd_header.getNrDSs()};this.getDSNames=function(){return this.rrd_header.getDSNames()};this.getDS=function(a){return typeof a=="number"?this.rrd_header.getDSbyIdx(a):this.rrd_header.getDSbyName(a)};this.getNrRRAs=function(){return this.rrd_header.getNrRRAs()};
+this.getRRAInfo=function(a){return this.rrd_header.getRRAInfo(a)};this.getRRA=function(c){rra_info=this.rrd_header.getRRAInfo(c);return new RRDRRA(a,this.rrd_header.rra_ptr_idx+c*this.rrd_header.rra_ptr_el_size,rra_info,this.rrd_header.header_size,this.rrd_header.rra_def_row_cnt_sums[c],this.rrd_header.ds_cnt)}};
+// Input 3
/*
jQuery Tools @VERSION Dateinput - <input type="date" /> for humans
@@ -332,23 +400,23 @@ this.getRRAInfo=function(d){return this.rrd_header.getRRAInfo(d)};this.getRRA=fu
Since: Mar 2010
Date: @DATE
*/
-(function(d){function h(d,h){d=""+d;for(h=h||2;d.length<h;)d="0"+d;return d}function F(d,o,p){var q=d.getDate(),z=d.getDay(),C=d.getMonth(),d=d.getFullYear(),B={d:q,dd:h(q),ddd:K[p].shortDays[z],dddd:K[p].days[z],m:C+1,mm:h(C+1),mmm:K[p].shortMonths[C],mmmm:K[p].months[C],yy:String(d).slice(2),yyyy:d},o=o.replace(I,function(d){return d in B?B[d]:d.slice(1,d.length-1)});return G.html(o).html()}function p(d,h){return d.getFullYear()===h.getFullYear()&&d.getMonth()==h.getMonth()&&d.getDate()==h.getDate()}
-function C(d){if(d!==void 0){if(d.constructor==Date)return d;if(typeof d=="string"){var h=d.split("-");if(h.length==3)return new Date(parseInt(h[0],10),parseInt(h[1],10)-1,parseInt(h[2],10));if(!/^-?\d+$/.test(d))return;d=parseInt(d,10)}h=new Date;h.setDate(h.getDate()+d);return h}}function B(h,o){function A(b,e,o){Y=b;va=b.getFullYear();y=b.getMonth();T=b.getDate();o=o||d.Event("api");o.type="change";oa.trigger(o,[b]);o.isDefaultPrevented()||(h.val(F(b,e.format,e.lang)),h.data("date",b),B.hide(o))}
-function z(b){b.type="onShow";oa.trigger(b);d(document).bind("keydown.d",function(b){if(b.ctrlKey)return!0;var o=b.keyCode;if(o==8)return h.val(""),B.hide(b);if(o==27||o==9)return B.hide(b);if(d(N).index(o)>=0){if(!aa)return B.show(b),b.preventDefault();var p=d("#"+x.weeks+" a"),q=d("."+x.focus),n=p.index(q);q.removeClass(x.focus);if(o==74||o==40)n+=7;else if(o==75||o==38)n-=7;else if(o==76||o==39)n+=1;else if(o==72||o==37)n-=1;n>41?(B.addMonth(),q=d("#"+x.weeks+" a:eq("+(n-42)+")")):n<0?(B.addMonth(-1),
-q=d("#"+x.weeks+" a:eq("+(n+42)+")")):q=p.eq(n);q.addClass(x.focus);return b.preventDefault()}if(o==34)return B.addMonth();if(o==33)return B.addMonth(-1);if(o==36)return B.today();o==13&&(d(b.target).is("select")||d("."+x.focus).click());return d([16,17,18,9]).index(o)>=0});d(document).bind("click.d",function(b){var o=b.target;!d(o).parents("#"+x.root).length&&o!=h[0]&&(!O||o!=O[0])&&B.hide(b)})}var B=this,G=new Date,I=G.getFullYear(),x=o.css,X=K[o.lang],L=d("#"+x.root),fa=L.find("#"+x.title),O,ga,
-qa,va,y,T,Y=h.attr("data-value")||o.value||h.val(),b=h.attr("min")||o.min,$=h.attr("max")||o.max,aa,D;b===0&&(b="0");Y=C(Y)||G;b=C(b||new Date(I+o.yearRange[0],1,1));$=C($||new Date(I+o.yearRange[1]+1,1,-1));if(!X)throw"Dateinput: invalid language: "+o.lang;h.attr("type")=="date"&&(D=h.clone(),I=D.wrap("<div/>").parent().html(),I=d(I.replace(/type/i,"type=text data-orig-type")),I.val(o.value),h.replaceWith(I),h=I);h.addClass(x.input);var oa=h.add(B);if(!L.length){L=d("<div><div><a/><div/><a/></div><div><div/><div/></div></div>").hide().css({position:"absolute"}).attr("id",
-x.root);L.children().eq(0).attr("id",x.head).end().eq(1).attr("id",x.body).children().eq(0).attr("id",x.days).end().eq(1).attr("id",x.weeks).end().end().end().find("a").eq(0).attr("id",x.prev).end().eq(1).attr("id",x.next);fa=L.find("#"+x.head).find("div").attr("id",x.title);if(o.selectors){var ja=d("<select/>").attr("id",x.month),ba=d("<select/>").attr("id",x.year);fa.html(ja.add(ba))}for(var I=L.find("#"+x.days),ra=0;ra<7;ra++)I.append(d("<span/>").text(X.shortDays[(ra+o.firstDay)%7]));d("body").append(L)}o.trigger&&
-(O=d("<a/>").attr("href","#").addClass(x.trigger).click(function(b){B.show();return b.preventDefault()}).insertAfter(h));var wa=L.find("#"+x.weeks),ba=L.find("#"+x.year),ja=L.find("#"+x.month);d.extend(B,{show:function(b){if(!h.attr("readonly")&&!h.attr("disabled")&&!aa&&(b=b||d.Event(),b.type="onBeforeShow",oa.trigger(b),!b.isDefaultPrevented())){d.each(q,function(){this.hide()});aa=!0;ja.unbind("change").change(function(){B.setValue(ba.val(),d(this).val())});ba.unbind("change").change(function(){B.setValue(d(this).val(),
-ja.val())});ga=L.find("#"+x.prev).unbind("click").click(function(){ga.hasClass(x.disabled)||B.addMonth(-1);return!1});qa=L.find("#"+x.next).unbind("click").click(function(){qa.hasClass(x.disabled)||B.addMonth();return!1});B.setValue(Y);var e=h.offset();/iPad/i.test(navigator.userAgent)&&(e.top-=d(window).scrollTop());L.css({top:e.top+h.outerHeight({margins:!0})+o.offset[0],left:e.left+o.offset[1]});o.speed?L.show(o.speed,function(){z(b)}):(L.show(),z(b));return B}},setValue:function(h,e,q){var r=
-parseInt(e,10)>=-1?new Date(parseInt(h,10),parseInt(e,10),parseInt(q||1,10)):h||Y;r<b?r=b:r>$&&(r=$);typeof h=="string"&&(r=C(h));h=r.getFullYear();e=r.getMonth();q=r.getDate();e==-1?(e=11,h--):e==12&&(e=0,h++);if(!aa)return A(r,o),B;y=e;va=h;var q=(new Date(h,e,1-o.firstDay)).getDay(),z=32-(new Date(h,e,32)).getDate(),n=32-(new Date(h,e-1,32)).getDate(),F;if(o.selectors){ja.empty();d.each(X.months,function(e,n){b<new Date(h,e+1,-1)&&$>new Date(h,e,0)&&ja.append(d("<option/>").html(n).attr("value",
-e))});ba.empty();for(var r=G.getFullYear(),D=r+o.yearRange[0];D<r+o.yearRange[1];D++)b<=new Date(D+1,-1,1)&&$>new Date(D,0,0)&&ba.append(d("<option/>").text(D));ja.val(e);ba.val(h)}else fa.html(X.months[e]+" "+h);wa.empty();ga.add(qa).removeClass(x.disabled);for(var D=!q?-7:0,I,u;D<(!q?35:42);D++)I=d("<a/>"),D%7===0&&(F=d("<div/>").addClass(x.week),wa.append(F)),D<q?(I.addClass(x.off),u=n-q+D+1,r=new Date(h,e-1,u)):D>=q+z?(I.addClass(x.off),u=D-z-q+1,r=new Date(h,e+1,u)):(u=D-q+1,r=new Date(h,e,u),
-p(Y,r)?I.attr("id",x.current).addClass(x.focus):p(G,r)&&I.attr("id",x.today)),b&&r<b&&I.add(ga).addClass(x.disabled),$&&r>$&&I.add(qa).addClass(x.disabled),I.attr("href","#"+u).text(u).data("date",r),F.append(I);wa.find("a").click(function(b){var e=d(this);e.hasClass(x.disabled)||(d("#"+x.current).removeAttr("id"),e.attr("id",x.current),A(e.data("date"),o,b));return!1});x.sunday&&wa.find(x.week).each(function(){var b=o.firstDay?7-o.firstDay:0;d(this).children().slice(b,b+1).addClass(x.sunday)});return B},
-setMin:function(d,e){b=C(d);e&&Y<b&&B.setValue(b);return B},setMax:function(b,d){$=C(b);d&&Y>$&&B.setValue($);return B},today:function(){return B.setValue(G)},addDay:function(b){return this.setValue(va,y,T+(b||1))},addMonth:function(b){return this.setValue(va,y+(b||1),T)},addYear:function(b){return this.setValue(va+(b||1),y,T)},destroy:function(){h.add(document).unbind("click.d").unbind("keydown.d");L.add(O).remove();h.removeData("dateinput").removeClass(x.input);D&&h.replaceWith(D)},hide:function(b){if(aa){b=
-d.Event();b.type="onHide";oa.trigger(b);d(document).unbind("click.d").unbind("keydown.d");if(b.isDefaultPrevented())return;L.hide();aa=!1}return B},getConf:function(){return o},getInput:function(){return h},getCalendar:function(){return L},getValue:function(b){return b?F(Y,b,o.lang):Y},isOpen:function(){return aa}});d.each(["onBeforeShow","onShow","change","onHide"],function(b,e){d.isFunction(o[e])&&d(B).bind(e,o[e]);B[e]=function(b){b&&d(B).bind(e,b);return B}});o.editable||h.bind("focus.d click.d",
-B.show).keydown(function(b){var e=b.keyCode;if(!aa&&d(N).index(e)>=0)return B.show(b),b.preventDefault();return b.shiftKey||b.ctrlKey||b.altKey||e==9?!0:b.preventDefault()});C(h.val())&&A(Y,o)}d.tools=d.tools||{version:"@VERSION"};var q=[],z,N=[75,76,38,39,74,72,40,37],K={};z=d.tools.dateinput={conf:{format:"mm/dd/yy",selectors:!1,yearRange:[-5,5],lang:"en",offset:[0,0],speed:0,firstDay:0,min:void 0,max:void 0,trigger:0,editable:0,css:{prefix:"cal",input:"date",root:0,head:0,title:0,prev:0,next:0,
-month:0,year:0,days:0,body:0,weeks:0,today:0,current:0,week:0,off:0,sunday:0,focus:0,disabled:0,trigger:0}},localize:function(h,o){d.each(o,function(d,h){o[d]=h.split(",")});K[h]=o}};z.localize("en",{months:"January,February,March,April,May,June,July,August,September,October,November,December",shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",days:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",shortDays:"Sun,Mon,Tue,Wed,Thu,Fri,Sat"});var I=/d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*'/g,
-G=d("<a/>");d.expr[":"].date=function(h){var o=h.getAttribute("type");return o&&o=="date"||!!d(h).data("dateinput")};d.fn.dateinput=function(h){if(this.data("dateinput"))return this;h=d.extend(!0,{},z.conf,h);d.each(h.css,function(d,o){!o&&d!="prefix"&&(h.css[d]=(h.css.prefix||"")+(o||d))});var o;this.each(function(){var p=new B(d(this),h);q.push(p);p=p.getInput().data("dateinput",p);o=o?o.add(p):p});return o?o:this}})(jQuery);
-// Input 7
+(function(a){function c(a,b){a=""+a;for(b=b||2;a.length<b;)a="0"+a;return a}function d(a,b,d){var f=a.getDate(),g=a.getDay(),h=a.getMonth(),a=a.getFullYear(),j={d:f,dd:c(f),ddd:n[d].shortDays[g],dddd:n[d].days[g],m:h+1,mm:c(h+1),mmm:n[d].shortMonths[h],mmmm:n[d].months[h],yy:String(a).slice(2),yyyy:a},b=b.replace(q,function(a){return a in j?j[a]:a.slice(1,a.length-1)});return p.html(b).html()}function b(a,b){return a.getFullYear()===b.getFullYear()&&a.getMonth()==b.getMonth()&&a.getDate()==b.getDate()}
+function f(a){if(a!==void 0){if(a.constructor==Date)return a;if(typeof a=="string"){var b=a.split("-");if(b.length==3)return new Date(parseInt(b[0],10),parseInt(b[1],10)-1,parseInt(b[2],10));if(!/^-?\d+$/.test(a))return;a=parseInt(a,10)}b=new Date;b.setDate(b.getDate()+a);return b}}function g(c,g){function j(b,f,e){G=b;S=b.getFullYear();r=b.getMonth();ea=b.getDate();e=e||a.Event("api");e.type="change";Z.trigger(e,[b]);e.isDefaultPrevented()||(c.val(d(b,f.format,f.lang)),c.data("date",b),p.hide(e))}
+function q(b){b.type="onShow";Z.trigger(b);a(document).bind("keydown.d",function(b){if(b.ctrlKey)return!0;var d=b.keyCode;if(d==8)return c.val(""),p.hide(b);if(d==27||d==9)return p.hide(b);if(a(m).index(d)>=0){if(!L)return p.show(b),b.preventDefault();var f=a("#"+s.weeks+" a"),e=a("."+s.focus),g=f.index(e);e.removeClass(s.focus);if(d==74||d==40)g+=7;else if(d==75||d==38)g-=7;else if(d==76||d==39)g+=1;else if(d==72||d==37)g-=1;g>41?(p.addMonth(),e=a("#"+s.weeks+" a:eq("+(g-42)+")")):g<0?(p.addMonth(-1),
+e=a("#"+s.weeks+" a:eq("+(g+42)+")")):e=f.eq(g);e.addClass(s.focus);return b.preventDefault()}if(d==34)return p.addMonth();if(d==33)return p.addMonth(-1);if(d==36)return p.today();d==13&&(a(b.target).is("select")||a("."+s.focus).click());return a([16,17,18,9]).index(d)>=0});a(document).bind("click.d",function(b){var d=b.target;!a(d).parents("#"+s.root).length&&d!=c[0]&&(!ca||d!=ca[0])&&p.hide(b)})}var p=this,z=new Date,D=z.getFullYear(),s=g.css,T=n[g.lang],B=a("#"+s.root),ba=B.find("#"+s.title),ca,
+I,U,S,r,ea,G=c.attr("data-value")||g.value||c.val(),e=c.attr("min")||g.min,N=c.attr("max")||g.max,L,$;e===0&&(e="0");G=f(G)||z;e=f(e||new Date(D+g.yearRange[0],1,1));N=f(N||new Date(D+g.yearRange[1]+1,1,-1));if(!T)throw"Dateinput: invalid language: "+g.lang;c.attr("type")=="date"&&($=c.clone(),D=$.wrap("<div/>").parent().html(),D=a(D.replace(/type/i,"type=text data-orig-type")),D.val(g.value),c.replaceWith(D),c=D);c.addClass(s.input);var Z=c.add(p);if(!B.length){B=a("<div><div><a/><div/><a/></div><div><div/><div/></div></div>").hide().css({position:"absolute"}).attr("id",
+s.root);B.children().eq(0).attr("id",s.head).end().eq(1).attr("id",s.body).children().eq(0).attr("id",s.days).end().eq(1).attr("id",s.weeks).end().end().end().find("a").eq(0).attr("id",s.prev).end().eq(1).attr("id",s.next);ba=B.find("#"+s.head).find("div").attr("id",s.title);if(g.selectors){var R=a("<select/>").attr("id",s.month),M=a("<select/>").attr("id",s.year);ba.html(R.add(M))}for(var D=B.find("#"+s.days),la=0;la<7;la++)D.append(a("<span/>").text(T.shortDays[(la+g.firstDay)%7]));a("body").append(B)}g.trigger&&
+(ca=a("<a/>").attr("href","#").addClass(s.trigger).click(function(a){p.show();return a.preventDefault()}).insertAfter(c));var ga=B.find("#"+s.weeks),M=B.find("#"+s.year),R=B.find("#"+s.month);a.extend(p,{show:function(b){if(!c.attr("readonly")&&!c.attr("disabled")&&!L&&(b=b||a.Event(),b.type="onBeforeShow",Z.trigger(b),!b.isDefaultPrevented())){a.each(h,function(){this.hide()});L=!0;R.unbind("change").change(function(){p.setValue(M.val(),a(this).val())});M.unbind("change").change(function(){p.setValue(a(this).val(),
+R.val())});I=B.find("#"+s.prev).unbind("click").click(function(){I.hasClass(s.disabled)||p.addMonth(-1);return!1});U=B.find("#"+s.next).unbind("click").click(function(){U.hasClass(s.disabled)||p.addMonth();return!1});p.setValue(G);var d=c.offset();/iPad/i.test(navigator.userAgent)&&(d.top-=a(window).scrollTop());B.css({top:d.top+c.outerHeight({margins:!0})+g.offset[0],left:d.left+g.offset[1]});g.speed?B.show(g.speed,function(){q(b)}):(B.show(),q(b));return p}},setValue:function(c,d,h){var l=parseInt(d,
+10)>=-1?new Date(parseInt(c,10),parseInt(d,10),parseInt(h||1,10)):c||G;l<e?l=e:l>N&&(l=N);typeof c=="string"&&(l=f(c));c=l.getFullYear();d=l.getMonth();h=l.getDate();d==-1?(d=11,c--):d==12&&(d=0,c++);if(!L)return j(l,g),p;r=d;S=c;var h=(new Date(c,d,1-g.firstDay)).getDay(),m=32-(new Date(c,d,32)).getDate(),n=32-(new Date(c,d-1,32)).getDate(),q;if(g.selectors){R.empty();a.each(T.months,function(b,d){e<new Date(c,b+1,-1)&&N>new Date(c,b,0)&&R.append(a("<option/>").html(d).attr("value",b))});M.empty();
+for(var l=z.getFullYear(),w=l+g.yearRange[0];w<l+g.yearRange[1];w++)e<=new Date(w+1,-1,1)&&N>new Date(w,0,0)&&M.append(a("<option/>").text(w));R.val(d);M.val(c)}else ba.html(T.months[d]+" "+c);ga.empty();I.add(U).removeClass(s.disabled);for(var w=!h?-7:0,B,D;w<(!h?35:42);w++)B=a("<a/>"),w%7===0&&(q=a("<div/>").addClass(s.week),ga.append(q)),w<h?(B.addClass(s.off),D=n-h+w+1,l=new Date(c,d-1,D)):w>=h+m?(B.addClass(s.off),D=w-m-h+1,l=new Date(c,d+1,D)):(D=w-h+1,l=new Date(c,d,D),b(G,l)?B.attr("id",s.current).addClass(s.focus):
+b(z,l)&&B.attr("id",s.today)),e&&l<e&&B.add(I).addClass(s.disabled),N&&l>N&&B.add(U).addClass(s.disabled),B.attr("href","#"+D).text(D).data("date",l),q.append(B);ga.find("a").click(function(b){var c=a(this);c.hasClass(s.disabled)||(a("#"+s.current).removeAttr("id"),c.attr("id",s.current),j(c.data("date"),g,b));return!1});s.sunday&&ga.find(s.week).each(function(){var b=g.firstDay?7-g.firstDay:0;a(this).children().slice(b,b+1).addClass(s.sunday)});return p},setMin:function(a,b){e=f(a);b&&G<e&&p.setValue(e);
+return p},setMax:function(a,b){N=f(a);b&&G>N&&p.setValue(N);return p},today:function(){return p.setValue(z)},addDay:function(a){return this.setValue(S,r,ea+(a||1))},addMonth:function(a){return this.setValue(S,r+(a||1),ea)},addYear:function(a){return this.setValue(S+(a||1),r,ea)},destroy:function(){c.add(document).unbind("click.d").unbind("keydown.d");B.add(ca).remove();c.removeData("dateinput").removeClass(s.input);$&&c.replaceWith($)},hide:function(b){if(L){b=a.Event();b.type="onHide";Z.trigger(b);
+a(document).unbind("click.d").unbind("keydown.d");if(b.isDefaultPrevented())return;B.hide();L=!1}return p},getConf:function(){return g},getInput:function(){return c},getCalendar:function(){return B},getValue:function(a){return a?d(G,a,g.lang):G},isOpen:function(){return L}});a.each(["onBeforeShow","onShow","change","onHide"],function(b,c){a.isFunction(g[c])&&a(p).bind(c,g[c]);p[c]=function(b){b&&a(p).bind(c,b);return p}});g.editable||c.bind("focus.d click.d",p.show).keydown(function(b){var c=b.keyCode;
+return!L&&a(m).index(c)>=0?(p.show(b),b.preventDefault()):b.shiftKey||b.ctrlKey||b.altKey||c==9?!0:b.preventDefault()});f(c.val())&&j(G,g)}a.tools=a.tools||{version:"@VERSION"};var h=[],j,m=[75,76,38,39,74,72,40,37],n={};j=a.tools.dateinput={conf:{format:"mm/dd/yy",selectors:!1,yearRange:[-5,5],lang:"en",offset:[0,0],speed:0,firstDay:0,min:void 0,max:void 0,trigger:0,editable:0,css:{prefix:"cal",input:"date",root:0,head:0,title:0,prev:0,next:0,month:0,year:0,days:0,body:0,weeks:0,today:0,current:0,
+week:0,off:0,sunday:0,focus:0,disabled:0,trigger:0}},localize:function(b,c){a.each(c,function(a,b){c[a]=b.split(",")});n[b]=c}};j.localize("en",{months:"January,February,March,April,May,June,July,August,September,October,November,December",shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",days:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",shortDays:"Sun,Mon,Tue,Wed,Thu,Fri,Sat"});var q=/d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*'/g,p=a("<a/>");a.expr[":"].date=function(b){var c=
+b.getAttribute("type");return c&&c=="date"||!!a(b).data("dateinput")};a.fn.dateinput=function(b){if(this.data("dateinput"))return this;b=a.extend(!0,{},j.conf,b);a.each(b.css,function(a,c){!c&&a!="prefix"&&(b.css[a]=(b.css.prefix||"")+(c||a))});var c;this.each(function(){var d=new g(a(this),b);h.push(d);d=d.getInput().data("dateinput",d);c=c?c.add(d):d});return c?c:this}})(jQuery);
+// Input 4
/*
jQuery Tools @VERSION Tabs- The basics of UI design.
@@ -360,9 +428,9 @@ G=d("<a/>");d.expr[":"].date=function(h){var o=h.getAttribute("type");return o&&
Since: November 2008
Date: @DATE
*/
-(function(d){function h(h,p,q){var z=this,N=h.add(this),K=h.find(q.tabs),I=p.jquery?p:h.children(p),G;K.length||(K=h.children());I.length||(I=h.parent().find(p));I.length||(I=d(p));d.extend(this,{click:function(h,o){var p=K.eq(h);typeof h=="string"&&h.replace("#","")&&(p=K.filter("[href*="+h.replace("#","")+"]"),h=Math.max(K.index(p),0));if(q.rotate){var B=K.length-1;if(h<0)return z.click(B,o);if(h>B)return z.click(0,o)}if(!p.length){if(G>=0)return z;h=q.initialIndex;p=K.eq(h)}if(h===G)return z;o=
-o||d.Event();o.type="onBeforeClick";N.trigger(o,[h]);if(!o.isDefaultPrevented())return G=h,F[q.effect].call(z,h,function(){o.type="onClick";N.trigger(o,[h])}),K.removeClass(q.current),p.addClass(q.current),z},getConf:function(){return q},getTabs:function(){return K},getPanes:function(){return I},getCurrentPane:function(){return I.eq(G)},getCurrentTab:function(){return K.eq(G)},getIndex:function(){return G},next:function(){return z.click(G+1)},prev:function(){return z.click(G-1)},destroy:function(){K.unbind(q.event).removeClass(q.current);
-I.find("a[href^=#]").unbind("click.T");return z}});d.each("onBeforeClick,onClick".split(","),function(h,o){d.isFunction(q[o])&&d(z).bind(o,q[o]);z[o]=function(h){h&&d(z).bind(o,h);return z}});if(q.history&&d.fn.history)d.tools.history.init(K),q.event="history";K.each(function(h){d(this).bind(q.event,function(d){z.click(h,d);return d.preventDefault()})});I.find("a[href^=#]").bind("click.T",function(h){z.click(d(this).attr("href"),h)});location.hash&&q.tabs=="a"&&h.find("[href="+location.hash+"]").length?
-z.click(location.hash):(q.initialIndex===0||q.initialIndex>0)&&z.click(q.initialIndex)}d.tools=d.tools||{version:"@VERSION"};d.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:!1,history:!1},addEffect:function(d,h){F[d]=h}};var F={"default":function(d,h){this.getPanes().hide().eq(d).show();h.call()},fade:function(d,h){var p=this.getConf(),z=p.fadeOutSpeed,F=this.getPanes();z?F.fadeOut(z):F.hide();F.eq(d).fadeIn(p.fadeInSpeed,
-h)},slide:function(d,h){this.getPanes().slideUp(200);this.getPanes().eq(d).slideDown(400,h)},ajax:function(d,h){this.getPanes().eq(0).load(this.getTabs().eq(d).attr("href"),h)}},p;d.tools.tabs.addEffect("horizontal",function(h,B){p||(p=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){d(this).hide()});this.getPanes().eq(h).animate({width:p},function(){d(this).show();B.call()})});d.fn.tabs=function(p,B){var q=this.data("tabs");q&&(q.destroy(),this.removeData("tabs"));
-d.isFunction(B)&&(B={onBeforeClick:B});B=d.extend({},d.tools.tabs.conf,B);this.each(function(){q=new h(d(this),p,B);d(this).data("tabs",q)});return B.api?q:this}})(jQuery);
+(function(a){function c(b,c,h){var j=this,m=b.add(this),n=b.find(h.tabs),q=c.jquery?c:b.children(c),p;n.length||(n=b.children());q.length||(q=b.parent().find(c));q.length||(q=a(c));a.extend(this,{click:function(b,c){var f=n.eq(b);typeof b=="string"&&b.replace("#","")&&(f=n.filter("[href*="+b.replace("#","")+"]"),b=Math.max(n.index(f),0));if(h.rotate){var g=n.length-1;if(b<0)return j.click(g,c);if(b>g)return j.click(0,c)}if(!f.length){if(p>=0)return j;b=h.initialIndex;f=n.eq(b)}if(b===p)return j;c=
+c||a.Event();c.type="onBeforeClick";m.trigger(c,[b]);if(!c.isDefaultPrevented())return p=b,d[h.effect].call(j,b,function(){c.type="onClick";m.trigger(c,[b])}),n.removeClass(h.current),f.addClass(h.current),j},getConf:function(){return h},getTabs:function(){return n},getPanes:function(){return q},getCurrentPane:function(){return q.eq(p)},getCurrentTab:function(){return n.eq(p)},getIndex:function(){return p},next:function(){return j.click(p+1)},prev:function(){return j.click(p-1)},destroy:function(){n.unbind(h.event).removeClass(h.current);
+q.find("a[href^=#]").unbind("click.T");return j}});a.each("onBeforeClick,onClick".split(","),function(b,c){a.isFunction(h[c])&&a(j).bind(c,h[c]);j[c]=function(b){b&&a(j).bind(c,b);return j}});if(h.history&&a.fn.history)a.tools.history.init(n),h.event="history";n.each(function(b){a(this).bind(h.event,function(a){j.click(b,a);return a.preventDefault()})});q.find("a[href^=#]").bind("click.T",function(b){j.click(a(this).attr("href"),b)});location.hash&&h.tabs=="a"&&b.find("[href="+location.hash+"]").length?
+j.click(location.hash):(h.initialIndex===0||h.initialIndex>0)&&j.click(h.initialIndex)}a.tools=a.tools||{version:"@VERSION"};a.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:!1,history:!1},addEffect:function(a,b){d[a]=b}};var d={"default":function(a,b){this.getPanes().hide().eq(a).show();b.call()},fade:function(a,b){var c=this.getConf(),d=c.fadeOutSpeed,m=this.getPanes();d?m.fadeOut(d):m.hide();m.eq(a).fadeIn(c.fadeInSpeed,
+b)},slide:function(a,b){this.getPanes().slideUp(200);this.getPanes().eq(a).slideDown(400,b)},ajax:function(a,b){this.getPanes().eq(0).load(this.getTabs().eq(a).attr("href"),b)}},b;a.tools.tabs.addEffect("horizontal",function(c,d){b||(b=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){a(this).hide()});this.getPanes().eq(c).animate({width:b},function(){a(this).show();d.call()})});a.fn.tabs=function(b,d){var h=this.data("tabs");h&&(h.destroy(),this.removeData("tabs"));
+a.isFunction(d)&&(d={onBeforeClick:d});d=a.extend({},a.tools.tabs.conf,d);this.each(function(){h=new c(a(this),b,d);a(this).data("tabs",h)});return d.api?h:this}})(jQuery);
diff --git a/docs/examples/assets/js/jsrrdgraph.js b/docs/examples/assets/js/jsrrdgraph.js
deleted file mode 100644
index d296ec6..0000000
--- a/docs/examples/assets/js/jsrrdgraph.js
+++ /dev/null
@@ -1,4937 +0,0 @@
-/**
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
-
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
-
- * RRDtool 1.4.5 Copyright by Tobi Oetiker, 1997-2010
- *
- * Convert to javascript: Manuel Sanmartin <manuel.luis at gmail.com>
- **/
-
-"use strict";
-
-var RRDTime = function() {
- this.parser.apply(this, arguments);
-};
-
-RRDTime.EOF = -1;
-RRDTime.MIDNIGHT = 0;
-RRDTime.NOON = 1;
-RRDTime.TEATIME = 2;
-RRDTime.PM = 3;
-RRDTime.AM = 4;
-RRDTime.YESTERDAY = 5;
-RRDTime.TODAY = 6;
-RRDTime.TOMORROW = 7;
-RRDTime.NOW = 8;
-RRDTime.START = 9;
-RRDTime.END = 10;
-RRDTime.EPOCH = 11;
-RRDTime.SECONDS = 12;
-RRDTime.MINUTES = 13;
-RRDTime.HOURS = 14;
-RRDTime.DAYS = 15;
-RRDTime.WEEKS = 16;
-RRDTime.MONTHS = 17;
-RRDTime.YEARS = 18;
-RRDTime.MONTHS_MINUTES = 19;
-RRDTime.NUMBER = 20;
-RRDTime.PLUS = 21;
-RRDTime.MINUS = 22;
-RRDTime.DOT = 23;
-RRDTime.COLON = 24;
-RRDTime.SLASH = 25;
-RRDTime.ID = 26;
-RRDTime.JUNK = 27;
-RRDTime.JAN = 28;
-RRDTime.FEB = 29;
-RRDTime.MAR = 30;
-RRDTime.APR = 31;
-RRDTime.MAY = 32;
-RRDTime.JUN = 33;
-RRDTime.JUL = 34;
-RRDTime.AUG = 35;
-RRDTime.SEP = 36;
-RRDTime.OCT = 37;
-RRDTime.NOV = 38;
-RRDTime.DEC = 39;
-RRDTime.SUN = 40;
-RRDTime.MON = 41;
-RRDTime.TUE = 42;
-RRDTime.WED = 43;
-RRDTime.THU = 44;
-RRDTime.FRI = 45;
-RRDTime.SAT = 46;
-
-RRDTime.variousWords = [
- {name: "midnight", value: RRDTime.MIDNIGHT}, /* 00:00:00 of today or tomorrow */
- {name: "noon", value: RRDTime.NOON}, /* 12:00:00 of today or tomorrow */
- {name: "teatime", value: RRDTime.TEATIME}, /* 16:00:00 of today or tomorrow */
- {name: "am", value: RRDTime.AM}, /* morning times for 0-12 clock */
- {name: "pm", value: RRDTime.PM}, /* evening times for 0-12 clock */
- {name: "tomorrow", value: RRDTime.TOMORROW},
- {name: "yesterday", value: RRDTime.YESTERDAY},
- {name: "today", value: RRDTime.TODAY},
- {name: "now", value: RRDTime.NOW},
- {name: "n", value: RRDTime.NOW},
- {name: "start", value: RRDTime.START},
- {name: "s", value: RRDTime.START},
- {name: "end", value: RRDTime.END},
- {name: "e", value: RRDTime.END},
- {name: "epoch", value: RRDTime.EPOCH},
- {name: "jan", value: RRDTime.JAN},
- {name: "feb", value: RRDTime.FEB},
- {name: "mar", value: RRDTime.MAR},
- {name: "apr", value: RRDTime.APR},
- {name: "may", value: RRDTime.MAY},
- {name: "jun", value: RRDTime.JUN},
- {name: "jul", value: RRDTime.JUL},
- {name: "aug", value: RRDTime.AUG},
- {name: "sep", value: RRDTime.SEP},
- {name: "oct", value: RRDTime.OCT},
- {name: "nov", value: RRDTime.NOV},
- {name: "dec", value: RRDTime.DEC},
- {name: "january", value: RRDTime.JAN},
- {name: "february", value: RRDTime.FEB},
- {name: "march", value: RRDTime.MAR},
- {name: "april", value: RRDTime.APR},
- {name: "may", value: RRDTime.MAY},
- {name: "june", value: RRDTime.JUN},
- {name: "july", value: RRDTime.JUL},
- {name: "august", value: RRDTime.AUG},
- {name: "september", value: RRDTime.SEP},
- {name: "october", value: RRDTime.OCT},
- {name: "november", value: RRDTime.NOV},
- {name: "december", value: RRDTime.DEC},
- {name: "sunday", value: RRDTime.SUN},
- {name: "sun", value: RRDTime.SUN},
- {name: "monday", value: RRDTime.MON},
- {name: "mon", value: RRDTime.MON},
- {name: "tuesday", value: RRDTime.TUE},
- {name: "tue", value: RRDTime.TUE},
- {name: "wednesday", value: RRDTime.WED},
- {name: "wed", value: RRDTime.WED},
- {name: "thursday", value: RRDTime.THU},
- {name: "thu", value: RRDTime.THU},
- {name: "friday", value: RRDTime.FRI},
- {name: "fri", value: RRDTime.FRI},
- {name: "saturday", value: RRDTime.SAT},
- {name: "sat", value: RRDTime.SAT}
-];
-
-RRDTime.timeMultipliers = [
- {name: "second", value: RRDTime.SECONDS}, /* seconds multiplier */
- {name: "seconds", value: RRDTime.SECONDS}, /* (pluralized) */
- {name: "sec", value: RRDTime.SECONDS}, /* (generic) */
- {name: "s", value: RRDTime.SECONDS}, /* (short generic) */
- {name: "minute", value: RRDTime.MINUTES}, /* minutes multiplier */
- {name: "minutes", value: RRDTime.MINUTES}, /* (pluralized) */
- {name: "min", value: RRDTime.MINUTES}, /* (generic) */
- {name: "m", value: RRDTime.MONTHS_MINUTES}, /* (short generic) */
- {name: "hour", value: RRDTime.HOURS}, /* hours ... */
- {name: "hours", value: RRDTime.HOURS}, /* (pluralized) */
- {name: "hr", value: RRDTime.HOURS}, /* (generic) */
- {name: "h", value: RRDTime.HOURS}, /* (short generic) */
- {name: "day", value: RRDTime.DAYS}, /* days ... */
- {name: "days", value: RRDTime.DAYS}, /* (pluralized) */
- {name: "d", value: RRDTime.DAYS}, /* (short generic) */
- {name: "week", value: RRDTime.WEEKS}, /* week ... */
- {name: "weeks", value: RRDTime.WEEKS}, /* (pluralized) */
- {name: "wk", value: RRDTime.WEEKS}, /* (generic) */
- {name: "w", value: RRDTime.WEEKS}, /* (short generic) */
- {name: "month", value: RRDTime.MONTHS}, /* week ... */
- {name: "months", value: RRDTime.MONTHS}, /* (pluralized) */
- {name: "mon", value: RRDTime.MONTHS}, /* (generic) */
- {name: "year", value: RRDTime.YEARS}, /* year ... */
- {name: "years", value: RRDTime.YEARS}, /* (pluralized) */
- {name: "yr", value: RRDTime.YEARS}, /* (generic) */
- {name: "y", value: RRDTime.YEARS} /* (short generic) */
-];
-
-RRDTime.ABSOLUTE_TIME = 0;
-RRDTime.RELATIVE_TO_START_TIME = 1;
-RRDTime.RELATIVE_TO_END_TIME = 2;
-RRDTime.RELATIVE_TO_EPOCH = 3;
-
-RRDTime.prototype = {
- tokens: null,
- toklen: 0,
- tokidx: 0,
-
- token: null,
- tokid: 0,
-
- type: 0,
- offset: 0,
- tm_sec: 0,
- tm_min: 0,
- tm_hour: 0,
- tm_mday: 0,
- tm_mon: 0,
- tm_year: 0,
- tm_wday: 0,
-
- specials: null,
-
- gettok: function ()
- {
- if (this.tokidx >= this.toklen) {
- this.tokid = RRDTime.EOF;
- } else {
- this.token = this.tokens[this.tokidx];
- this.tokidx++;
- if (!isNaN(this.token)) {
- this.tokid = RRDTime.NUMBER;
- this.token = parseInt(this.token, 10);
- } else if (this.token === ':') {
- this.tokid = RRDTime.COLON;
- } else if (this.token === '.') {
- this.tokid = RRDTime.DOT;
- } else if (this.token === '+') {
- this.tokid = RRDTime.PLUS;
- } else if (this.token === '/') {
- this.tokid = RRDTime.SLASH;
- } else if (this.token === '-') {
- this.tokid = RRDTime.MINUS;
- } else {
- this.tokid = RRDTime.ID;
- for (var i = 0, len = this.specials.length; i < len; i++) {
- if (this.specials[i].name === this.token) {
- this.tokid = this.specials[i].value;
- break;
- }
- }
- }
- }
- return this.tokid;
- },
- plus_minus: function (doop)
- {
- var op = RRDTime.PLUS;
- var prev_multiplier = -1;
- var delta;
-
- if (doop >= 0) {
- op = doop;
- if (this.gettok() != RRDTime.NUMBER)
- throw "There should be number after '"+(op == RRDTime.PLUS ? '+' : '-')+"'";
- prev_multiplier = -1; /* reset months-minutes guessing mechanics */
- }
- /* if doop is < 0 then we repeat the previous op with the prefetched number */
- delta = this.token;
- if (this.gettok() == RRDTime.MONTHS_MINUTES) {
- /* hard job to guess what does that -5m means: -5mon or -5min? */
- switch (prev_multiplier) {
- case RRDTime.DAYS:
- case RRDTime.WEEKS:
- case RRDTime.MONTHS:
- case RRDTime.YEARS:
- this.tokid = RRDTime.MONTHS;
- break;
- case RRDTime.SECONDS:
- case RRDTime.MINUTES:
- case RRDTime.HOURS:
- this.tokid = RRDTime.MINUTES;
- break;
- default:
- if (delta < 6) /* it may be some other value but in the context of RRD who needs less than 6 min deltas? */
- this.tokid = RRDTime.MONTHS;
- else
- this.tokid = RRDTime.MINUTES;
- }
- }
- prev_multiplier = this.tokid;
- switch (this.tokid) {
- case RRDTime.YEARS:
- this.tm_year += ( op == RRDTime.PLUS) ? delta : -delta;
- return;
- case RRDTime.MONTHS:
- this.tm_mon += ( op == RRDTime.PLUS) ? delta : -delta;
- return;
- case RRDTime.WEEKS:
- delta *= 7;
- case RRDTime.DAYS:
- this.tm_mday += ( op == RRDTime.PLUS) ? delta : -delta;
- return;
- case RRDTime.HOURS:
- this.offset += (op == RRDTime.PLUS) ? delta * 60 * 60 : -delta * 60 * 60;
- return;
- case RRDTime.MINUTES:
- this.offset += (op == RRDTime.PLUS) ? delta * 60 : -delta * 60;
- return;
- case RRDTime.SECONDS:
- this.offset += (op == RRDTime.PLUS) ? delta : -delta;
- return;
- default: /*default unit is seconds */
- this.offset += (op == RRDTime.PLUS) ? delta : -delta;
- return;
- }
- throw "well-known time unit expected after "+delta;
- },
- tod: function() /* tod() computes the time of day (TIME-OF-DAY-SPEC) */
- {
- var hour, minute = 0;
- var tlen;
- /* save token status in case we must abort */
- var tokid_sv = this.tokid;
-
- tlen = (this.token+"").length;
- /* first pick out the time of day - we assume a HH (COLON|DOT) MM time */
- if (tlen > 2)
- return;
- hour = this.token;
- this.gettok();
- if (this.tokid == RRDTime.SLASH || this.tokid == RRDTime.DOT) {
- /* guess we are looking at a date */
- this.tokid = tokid_sv;
- this.token = hour;
- return;
- }
- if (this.tokid == RRDTime.COLON) {
- if (this.gettok() != RRDTime.NUMBER)
- throw "Parsing HH:MM syntax, expecting MM as number, got none";
- minute = this.token;
- if (minute > 59)
- throw "parsing HH:MM syntax, got MM = "+minute+" (>59!)";
- this.gettok();
- }
- /* check if an AM or PM specifier was given */
- if (this.tokid == RRDTime.AM || this.tokid == RRDTime.PM) {
- if (hour > 12) {
- throw "there cannot be more than 12 AM or PM hours";
- }
- if (this.tokid == RRDTime.PM) {
- if (hour != 12) /* 12:xx PM is 12:xx, not 24:xx */
- hour += 12;
- } else {
- if (hour == 12) /* 12:xx AM is 00:xx, not 12:xx */
- hour = 0;
- }
- this.gettok();
- } else if (hour > 23) {
- /* guess it was not a time then ... */
- this.tokid = tokid_sv;
- this.token = hour;
- return;
- }
- this.tm_hour = hour;
- this.tm_min = minute;
- this.tm_sec = 0;
- if (this.tm_hour == 24) {
- this.tm_hour = 0;
- this.tm_mday++;
- }
- },
- assign_date: function(mday, mon, year)
- {
- if (year > 138) {
- if (year > 1970) {
- year -= 1900;
- } else {
- throw "invalid year "+year+" (should be either 00-99 or >1900)";
- }
- } else if (year >= 0 && year < 38) {
- year += 100; /* Allow year 2000-2037 to be specified as */
- }
- /* 00-37 until the problem of 2038 year will */
- /* arise for unices with 32-bit time_t :) */
- if (year < 70)
- throw "won't handle dates before epoch (01/01/1970), sorry";
-
- this.tm_mday = mday;
- this.tm_mon = mon;
- this.tm_year = year;
- },
- day: function ()
- {
- var mday = 0, wday, mon, year = this.tm_year;
- var tlen;
-
- switch (this.tokid) {
- case RRDTime.YESTERDAY:
- this.tm_mday--;
- case RRDTime.TODAY:
- this.gettok();
- break;
- case RRDTime.TOMORROW:
- this.tm_mday++;
- this.gettok();
- break;
- case RRDTime.JAN:
- case RRDTime.FEB:
- case RRDTime.MAR:
- case RRDTime.APR:
- case RRDTime.MAY:
- case RRDTime.JUN:
- case RRDTime.JUL:
- case RRDTime.AUG:
- case RRDTime.SEP:
- case RRDTime.OCT:
- case RRDTime.NOV:
- case RRDTime.DEC:
- mon = (this.tokid - RRDTime.JAN);
- if (this.gettok() != RRDTime.NUMBER)
- throw "the day of the month should follow month name";
- mday = this.token;
- if (this.gettok() == RRDTime.NUMBER) {
- year = this.token;
- this.gettok();
- } else {
- year = this.tm_year;
- }
- this.assign_date(mday, mon, year);
- break;
- case RRDTime.SUN:
- case RRDTime.MON:
- case RRDTime.TUE:
- case RRDTime.WED:
- case RRDTime.THU:
- case RRDTime.FRI:
- case RRDTime.SAT:
- wday = (this.tokid - RRDTime.SUN);
- this.tm_mday += (wday - this.tm_wday);
- this.gettok();
- break;
- case RRDTime.NUMBER:
- mon = this.token;
- if (mon > 10 * 365 * 24 * 60 * 60) {
- this.localtime(mon);
- this.gettok();
- break;
- }
- if (mon > 19700101 && mon < 24000101) { /*works between 1900 and 2400 */
- var str = this.token + '';
- year = parseInt(str.substr(0,4), 10);
- mon = parseInt(str.substr(4,2), 10);
- mday = parseInt(str.substr(6,2), 10);
- this.gettok();
- } else {
- this.gettok();
- if (mon <= 31 && (this.tokid == RRDTime.SLASH || this.tokid == RRDTime.DOT)) {
- var sep = this.tokid;
- if (this.gettok() != RRDTime.NUMBER)
- throw "there should be "+(RRDTime.DOT ? "month" : "day")+" number after '"+(RRDTime.DOT ? '.' : '/')+"'";
- mday = this.token;
- if (this.gettok() == sep) {
- if (this.gettok() != RRDTime.NUMBER)
- throw "there should be year number after '"+(sep == RRDTime.DOT ? '.' : '/')+"'";
- year = this.token;
- this.gettok();
- }
- if (sep == RRDTime.DOT) {
- var x = mday;
- mday = mon;
- mon = x;
- }
- }
- }
- mon--;
- if (mon < 0 || mon > 11)
- throw "did you really mean month "+(mon+1)+"?";
- if (mday < 1 || mday > 31)
- throw "I'm afraid that "+mday+" is not a valid day of the month",
- this.assign_date(mday, mon, year);
- break;
- }
- },
- parser: function(tspec)
- {
- var date = new Date();
- var hr = 0;
-
- this.specials = RRDTime.variousWords;
- this.tokens = (tspec+'').match(/[0-9]+|[A-Za-z]+|[:.+-\/]/g);
- this.toklen = this.tokens.length;
-
- /* establish the default time reference */
- this.type = RRDTime.ABSOLUTE_TIME;
- this.offset = 0;
- this.tm_sec = date.getSeconds();
- this.tm_min = date.getMinutes();
- this.tm_hour = date.getHours();
- this.tm_mday = date.getDate();
- this.tm_mon = date.getMonth();
- this.tm_year = date.getFullYear()-1900;
- this.tm_wday = date.getDay();
- //thisptv->tm = *localtime(&now);
-
- this.gettok();
- switch (this.tokid) {
- case RRDTime.PLUS:
- case RRDTime.MINUS:
- break; /* jump to OFFSET-SPEC part */
- case RRDTime.EPOCH:
- this.type = RRDTime.RELATIVE_TO_EPOCH;
- case RRDTime.START:
- case RRDTime.END:
- if (this.tokid === RRDTime.EPOCH)
- this.type = RRDTime.RELATIVE_TO_START_TIME;
- else
- this.type = RRDTime.RELATIVE_TO_END_TIME;
- this.tm_sec = 0;
- this.tm_min = 0;
- this.tm_hour = 0;
- this.tm_mday = 0;
- this.tm_mon = 0;
- this.tm_year = 0;
- case RRDTime.NOW:
- var time_reference = this.tokid;
- this.gettok();
- if (this.tokid == RRDTime.PLUS || this.tokid == RRDTime.MINUS)
- break;
- if (time_reference != RRDTime.NOW) {
- throw "'start' or 'end' MUST be followed by +|- offset";
- } else if (this.tokid != RRDTime.EOF) {
- throw "if 'now' is followed by a token it must be +|- offset";
- }
- break;
- case RRDTime.NUMBER: /* Only absolute time specifications below */
- var hour_sv = this.tm_hour;
- var year_sv = this.tm_year;
- this.tm_hour = 30;
- this.tm_year = 30000;
- this.tod();
- this.day();
- if (this.tm_hour == 30 && this.tm_year != 30000)
- this.tod();
- if (this.tm_hour == 30)
- this.tm_hour = hour_sv;
- if (this.tm_year == 30000)
- this.tm_year = year_sv;
- break;
- case RRDTime.JAN:
- case RRDTime.FEB:
- case RRDTime.MAR:
- case RRDTime.APR:
- case RRDTime.MAY:
- case RRDTime.JUN:
- case RRDTime.JUL:
- case RRDTime.AUG:
- case RRDTime.SEP:
- case RRDTime.OCT:
- case RRDTime.NOV:
- case RRDTime.DEC:
- this.day();
- if (this.tokid != RRDTime.NUMBER)
- break;
- this.tod();
- break;
- case RRDTime.TEATIME:
- hr += 4;
- case RRDTime.NOON:
- hr += 12;
- case RRDTime.MIDNIGHT:
- this.tm_hour = hr;
- this.tm_min = 0;
- this.tm_sec = 0;
- this.gettok();
- this.day();
- break;
- default:
- throw "unparsable time: "+this.token+" "+this.sct;
- break;
- } /* ugly case statement */
-
- /*
- * the OFFSET-SPEC part
- *
- * (NOTE, the sc_tokid was prefetched for us by the previous code)
- */
- if (this.tokid == RRDTime.PLUS || this.tokid == RRDTime.MINUS) {
- this.specials = RRDTime.timeMultipliers; /* switch special words context */
- while (this.tokid == RRDTime.PLUS || this.tokid == RRDTime.MINUS || this.tokid == RRDTime.NUMBER) {
- if (this.tokid == RRDTime.NUMBER) {
- this.plus_minus(-1);
- } else {
- this.plus_minus(this.tokid);
- }
- this.gettok(); /* We will get EOF eventually but that's OK, since token() will return us as many EOFs as needed */
- }
- }
-
- /* now we should be at EOF */
- if (this.tokid != RRDTime.EOF)
- throw "unparsable trailing text: '..."+this.token+"'";
-// if (this.type == RRDTime.ABSOLUTE_TIME)
-// if (mktime(&ptv->tm) == -1) // FIXME ??
-// panic(e("the specified time is incorrect (out of range?)"));
- },
- localtime: function (tm)
- {
- var date = new Date(tm*1000);
- this.tm_sec = date.getSeconds();
- this.tm_min = date.getMinutes();
- this.tm_hour = date.getHours();
- this.tm_mday = date.getDate();
- this.tm_mon = date.getMonth();
- this.tm_year = date.getFullYear()-1900;
- this.tm_wday = date.getDay();
- },
- mktime: function()
- {
- var date = new Date(this.tm_year+1900, this.tm_mon, this.tm_mday, this.tm_hour, this.tm_min, this.tm_sec);
- return Math.round(date.getTime()/1000.0);
- }
-};
-
-RRDTime.proc_start_end = function(start_t, end_t) {
- var start, end;
-
- if (start_t.type == RRDTime.RELATIVE_TO_END_TIME && end_t.type == RRDTime.RELATIVE_TO_START_TIME)
- throw "the start and end times cannot be specified relative to each other";
- if (start_t.type == RRDTime.RELATIVE_TO_START_TIME)
- throw "the start time cannot be specified relative to itself";
- if (end_t.type == RRDTime.RELATIVE_TO_END_TIME)
- throw "the end time cannot be specified relative to itself";
-
- if (start_t.type == RRDTime.RELATIVE_TO_END_TIME) {
- end = end_t.mktime() + end_t.offset;
- var tmtmp = new Date(end*1000);
- tmtmp.setDate(tmtmp.getDate()+start_t.tm_mday);
- tmtmp.setMonth(tmtmp.getMonth()+start_t.tm_mon);
- tmtmp.setFullYear(tmtmp.getFullYear()+start_t.tm_year);
- start = Math.round(tmtmp.getTime()/1000.0) + start_t.offset;
- } else {
- start = start_t.mktime() + start_t.offset;
- }
- if (end_t.type == RRDTime.RELATIVE_TO_START_TIME) {
- start = start_t.mktime() + start_t.offset;
- var tmtmp = new Date(start*1000);
- tmtmp.setDate(tmtmp.getDate()+end_t.tm_mday);
- tmtmp.setMonth(tmtmp.getMonth()+end_t.tm_mon);
- tmtmp.setFullYear(tmtmp.getFullYear()+end_t.tm_year);
- end = Math.round(tmtmp.getTime()/1000.0) + end_t.offset;
- } else {
- end = end_t.mktime() + end_t.offset;
- }
- return [start, end];
-};
-
-var RRDRpn = function() {
- this.parser.apply(this, arguments);
-};
-
-RRDRpn.OP = { NUMBER: 0, VARIABLE: 1, INF: 2, PREV: 3, NEGINF: 4,
- UNKN: 5, NOW: 6, TIME: 7, ADD: 8, MOD: 9, SUB: 10, MUL: 11,
- DIV: 12, SIN: 13, DUP: 14, EXC: 15, POP: 16,
- COS: 17, LOG: 18, EXP: 19, LT: 20, LE: 21, GT: 22, GE: 23, EQ: 24, IF: 25,
- MIN: 26, MAX: 27, LIMIT: 28, FLOOR: 29, CEIL: 30,
- UN: 31, END: 32, LTIME: 33, NE: 34, ISINF: 35, PREV_OTHER: 36, COUNT: 37,
- ATAN: 38, SQRT: 39, SORT: 40, REV: 41, TREND: 42, TREDNAN: 43,
- ATAN2: 44, RAD2DEG: 45, DEG2RAD: 46,
- PREDICT: 47, PREDICTSIGMA: 48, AVG: 49, ABS: 50, ADDNAN: 51 };
-
-RRDRpn.STACK_UNDERFLOW = 'RPN stack underflow';
-
-RRDRpn.prototype = {
-
- rpnstack: null,
- rpnp: null,
-
- find_var: function(gdes, key)
- {
- for (var ii = 0, gdes_c = gdes.length; ii < gdes_c; ii++) {
- if ((gdes[ii].gf == RRDGraphDesc.GF.DEF ||
- gdes[ii].gf == RRDGraphDesc.GF.VDEF ||
- gdes[ii].gf == RRDGraphDesc.GF.CDEF)
- && gdes[ii].vname == key) {
- return ii;
- }
- }
- return -1;
- },
- parser: function (str_expr, gdes)
- {
- var steps = -1;
- var expr;
- var exprs = str_expr.split(',');
-
- this.rpnp = [];
-
- for(var i=0, len=exprs.length; i < len; i++) {
- expr=exprs[i].toUpperCase();
-
- steps++;
- this.rpnp[steps] = {};
-
- if (!isNaN(expr)) {
- this.rpnp[steps].op = RRDRpn.OP.NUMBER;
- this.rpnp[steps].val = parseFloat(expr);
- }
- else if (expr === '+') this.rpnp[steps].op = RRDRpn.OP.ADD;
- else if (expr === '-') this.rpnp[steps].op = RRDRpn.OP.SUB;
- else if (expr === '*') this.rpnp[steps].op = RRDRpn.OP.MUL;
- else if (expr === '/') this.rpnp[steps].op = RRDRpn.OP.DIV;
- else if (expr === '%') this.rpnp[steps].op = RRDRpn.OP.MOD;
- else if (expr === 'SIN') this.rpnp[steps].op = RRDRpn.OP.SIN;
- else if (expr === 'COS') this.rpnp[steps].op = RRDRpn.OP.COS;
- else if (expr === 'LOG') this.rpnp[steps].op = RRDRpn.OP.LOG;
- else if (expr === 'FLOOR') this.rpnp[steps].op = RRDRpn.OP.FLOOR;
- else if (expr === 'CEIL') this.rpnp[steps].op = RRDRpn.OP.CEIL;
- else if (expr === 'EXP') this.rpnp[steps].op = RRDRpn.OP.EXP;
- else if (expr === 'DUP') this.rpnp[steps].op = RRDRpn.OP.DUP;
- else if (expr === 'EXC') this.rpnp[steps].op = RRDRpn.OP.EXC;
- else if (expr === 'POP') this.rpnp[steps].op = RRDRpn.OP.POP;
- else if (expr === 'LTIME') this.rpnp[steps].op = RRDRpn.OP.LTIME;
- else if (expr === 'LT') this.rpnp[steps].op = RRDRpn.OP.LT;
- else if (expr === 'LE') this.rpnp[steps].op = RRDRpn.OP.LE;
- else if (expr === 'GT') this.rpnp[steps].op = RRDRpn.OP.GT;
- else if (expr === 'GE') this.rpnp[steps].op = RRDRpn.OP.GE;
- else if (expr === 'EQ') this.rpnp[steps].op = RRDRpn.OP.EQ;
- else if (expr === 'IF') this.rpnp[steps].op = RRDRpn.OP.IF;
- else if (expr === 'MIN') this.rpnp[steps].op = RRDRpn.OP.MIN;
- else if (expr === 'MAX') this.rpnp[steps].op = RRDRpn.OP.MAX;
- else if (expr === 'LIMIT') this.rpnp[steps].op = RRDRpn.OP.LIMIT;
- else if (expr === 'UNKN') this.rpnp[steps].op = RRDRpn.OP.UNKN;
- else if (expr === 'UN') this.rpnp[steps].op = RRDRpn.OP.UN;
- else if (expr === 'NEGINF') this.rpnp[steps].op = RRDRpn.OP.NEGINF;
- else if (expr === 'NE') this.rpnp[steps].op = RRDRpn.OP.NE;
- else if (expr === 'COUNT') this.rpnp[steps].op = RRDRpn.OP.COUNT;
- else if (/PREV\([-_A-Za-z0-9]+\)/.test(expr)) {
- var match = exprs[i].match(/PREV\(([-_A-Za-z0-9]+)\)/i);
- if (match.length == 2) {
- this.rpnp[steps].op = RRDRpn.OP.PREV_OTHER;
- this.rpnp[steps].ptr = this.find_var(gdes, match[1]); // FIXME if -1
- }
- }
- else if (expr === 'PREV') this.rpnp[steps].op = RRDRpn.OP.PREV;
- else if (expr === 'INF') this.rpnp[steps].op = RRDRpn.OP.INF;
- else if (expr === 'ISINF') this.rpnp[steps].op = RRDRpn.OP.ISINF;
- else if (expr === 'NOW') this.rpnp[steps].op = RRDRpn.OP.NOW;
- else if (expr === 'TIME') this.rpnp[steps].op = RRDRpn.OP.TIME;
- else if (expr === 'ATAN2') this.rpnp[steps].op = RRDRpn.OP.ATAN2;
- else if (expr === 'ATAN') this.rpnp[steps].op = RRDRpn.OP.ATAN;
- else if (expr === 'SQRT') this.rpnp[steps].op = RRDRpn.OP.SQRT;
- else if (expr === 'SORT') this.rpnp[steps].op = RRDRpn.OP.SORT;
- else if (expr === 'REV') this.rpnp[steps].op = RRDRpn.OP.REV;
- else if (expr === 'TREND') this.rpnp[steps].op = RRDRpn.OP.TREND;
- else if (expr === 'TRENDNAN') this.rpnp[steps].op = RRDRpn.OP.TRENDNAN;
- else if (expr === 'PREDICT') this.rpnp[steps].op = RRDRpn.OP.PREDICT;
- else if (expr === 'PREDICTSIGMA') this.rpnp[steps].op = RRDRpn.OP.PREDICTSIGMA;
- else if (expr === 'RAD2DEG') this.rpnp[steps].op = RRDRpn.OP.RAD2DEG;
- else if (expr === 'DEG2RAD') this.rpnp[steps].op = RRDRpn.OP.DEG2RAD;
- else if (expr === 'AVG') this.rpnp[steps].op = RRDRpn.OP.AVG;
- else if (expr === 'ABS') this.rpnp[steps].op = RRDRpn.OP.ABS;
- else if (expr === 'ADDNAN') this.rpnp[steps].op = RRDRpn.OP.ADDNAN;
- else if (/[-_A-Za-z0-9]+/.test(expr)) {
- this.rpnp[steps].ptr = this.find_var(gdes, exprs[i]);
- this.rpnp[steps].op = RRDRpn.OP.VARIABLE;
- } else {
- return;
- }
- }
- this.rpnp[steps + 1] = {};
- this.rpnp[steps + 1].op = RRDRpn.OP.END;
-
- },
- compare_double: function(x, y)
- {
- var diff = x - y;
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
- },
- fmod: function (x, y) {
- var tmp, tmp2, p = 0,
- pY = 0,
- l = 0.0,
- l2 = 0.0;
-
- tmp = x.toExponential().match(/^.\.?(.*)e(.+)$/);
- p = parseInt(tmp[2], 10) - (tmp[1] + '').length;
- tmp = y.toExponential().match(/^.\.?(.*)e(.+)$/);
- pY = parseInt(tmp[2], 10) - (tmp[1] + '').length;
-
- if (pY > p) p = pY;
-
- tmp2 = (x % y);
-
- if (p < -100 || p > 20) {
- l = Math.round(Math.log(tmp2) / Math.log(10));
- l2 = Math.pow(10, l);
- return (tmp2 / l2).toFixed(l - p) * l2;
- } else {
- return parseFloat(tmp2.toFixed(-p));
- }
- },
- calc: function (data_idx, output, output_idx)
- {
- var stptr = -1;
-
- this.rpnstack = [];
-
- for (var rpi = 0; this.rpnp[rpi].op != RRDRpn.OP.END; rpi++) {
- switch (this.rpnp[rpi].op) {
- case RRDRpn.OP.NUMBER:
- this.rpnstack[++stptr] = this.rpnp[rpi].val;
- break;
- case RRDRpn.OP.VARIABLE:
- case RRDRpn.OP.PREV_OTHER:
- if (this.rpnp[rpi].ds_cnt == 0) {
- throw "VDEF made it into rpn_calc... aborting";
- } else {
- if (this.rpnp[rpi].op == RRDRpn.OP.VARIABLE) {
- this.rpnstack[++stptr] = this.rpnp[rpi].data[this.rpnp[rpi].pdata];
- } else {
- if ((output_idx) <= 0) this.rpnstack[++stptr] = Number.NaN;
- else this.rpnstack[++stptr] = this.rpnp[rpi].data[this.rpnp[rpi].pdata - this.rpnp[rpi].ds_cnt];
- }
- if (data_idx % this.rpnp[rpi].step == 0) {
- this.rpnp[rpi].pdata += this.rpnp[rpi].ds_cnt;
- }
- }
- break;
- case RRDRpn.OP.COUNT:
- this.rpnstack[++stptr] = (output_idx + 1); /* Note: Counter starts at 1 */
- break;
- case RRDRpn.OP.PREV:
- if ((output_idx) <= 0) this.rpnstack[++stptr] = Number.NaN;
- else this.rpnstack[++stptr] = output[output_idx - 1];
- break;
- case RRDRpn.OP.UNKN:
- this.rpnstack[++stptr] = Number.NaN;
- break;
- case RRDRpn.OP.INF:
- this.rpnstack[++stptr] = Infinity;
- break;
- case RRDRpn.OP.NEGINF:
- this.rpnstack[++stptr] = -Infinity;
- break;
- case RRDRpn.OP.NOW:
- this.rpnstack[++stptr] = Math.round((new Date()).getTime() / 1000);
- break;
- case RRDRpn.OP.TIME:
- this.rpnstack[++stptr] = data_idx;
- break;
- case RRDRpn.OP.LTIME:
- var date = new Date(data_idx*1000); // FIXME XXX
- this.rpnstack[++stptr] = date.getTimezoneOffset() * 60 + data_idx;
- break;
- case RRDRpn.OP.ADD:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr - 1] = this.rpnstack[stptr - 1] + this.rpnstack[stptr];
- stptr--;
- break;
- case RRDRpn.OP.ADDNAN:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- if (isNaN(this.rpnstack[stptr - 1])) {
- this.rpnstack[stptr - 1] = this.rpnstack[stptr];
- } else if (isNaN(this.rpnstack[stptr])) {
- /* NOOP */
- /* this.rpnstack[stptr - 1] = this.rpnstack[stptr - 1]; */
- } else {
- this.rpnstack[stptr - 1] = this.rpnstack[stptr - 1] + this.rpnstack[stptr];
- }
- stptr--;
- break;
- case RRDRpn.OP.SUB:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr - 1] = this.rpnstack[stptr - 1] - this.rpnstack[stptr];
- stptr--;
- break;
- case RRDRpn.OP.MUL:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr - 1] = (this.rpnstack[stptr - 1]) * (this.rpnstack[stptr]);
- stptr--;
- break;
- case RRDRpn.OP.DIV:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr - 1] = this.rpnstack[stptr - 1] / this.rpnstack[stptr];
- stptr--;
- break;
- case RRDRpn.OP.MOD:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr - 1] = this.fmod(this.rpnstack[stptr - 1] , this.rpnstack[stptr]);
- stptr--;
- break;
- case RRDRpn.OP.SIN:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = Math.sin(this.rpnstack[stptr]);
- break;
- case RRDRpn.OP.ATAN:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = Math.atan(this.rpnstack[stptr]);
- break;
- case RRDRpn.OP.RAD2DEG:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = 57.29577951 * this.rpnstack[stptr];
- break;
- case RRDRpn.OP.DEG2RAD:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = 0.0174532952 * this.rpnstack[stptr];
- break;
- case RRDRpn.OP.ATAN2:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr - 1] = Math.atan2(this.rpnstack[stptr - 1], this.rpnstack[stptr]);
- stptr--;
- break;
- case RRDRpn.OP.COS:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = Math.cos(this.rpnstack[stptr]);
- break;
- case RRDRpn.OP.CEIL:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = Math.ceil(this.rpnstack[stptr]);
- break;
- case RRDRpn.OP.FLOOR:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = Math.floor(this.rpnstack[stptr]);
- break;
- case RRDRpn.OP.LOG:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = Math.log(this.rpnstack[stptr]);
- break;
- case RRDRpn.OP.DUP:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr + 1] = this.rpnstack[stptr];
- stptr++;
- break;
- case RRDRpn.OP.POP:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- stptr--;
- break;
- case RRDRpn.OP.EXC:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW; {
- var dummy = this.rpnstack[stptr];
- this.rpnstack[stptr] = this.rpnstack[stptr - 1];
- this.rpnstack[stptr - 1] = dummy;
- }
- break;
- case RRDRpn.OP.EXP:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = Math.exp(this.rpnstack[stptr]);
- break;
- case RRDRpn.OP.LT:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- if (isNaN(this.rpnstack[stptr - 1]));
- else if (isNaN(this.rpnstack[stptr]))
- this.rpnstack[stptr - 1] = this.rpnstack[stptr];
- else
- this.rpnstack[stptr - 1] = this.rpnstack[stptr - 1] < this.rpnstack[stptr] ? 1.0 : 0.0;
- stptr--;
- break;
- case RRDRpn.OP.LE:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- if (isNaN(this.rpnstack[stptr - 1]));
- else if (isNaN(this.rpnstack[stptr]))
- this.rpnstack[stptr - 1] = this.rpnstack[stptr];
- else
- this.rpnstack[stptr - 1] = this.rpnstack[stptr - 1] <= this.rpnstack[stptr] ? 1.0 : 0.0;
- stptr--;
- break;
- case RRDRpn.OP.GT:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- if (isNaN(this.rpnstack[stptr - 1]));
- else if (isNaN(this.rpnstack[stptr]))
- this.rpnstack[stptr - 1] = this.rpnstack[stptr];
- else
- this.rpnstack[stptr - 1] = this.rpnstack[stptr - 1] > this.rpnstack[stptr] ? 1.0 : 0.0;
- stptr--;
- break;
- case RRDRpn.OP.GE:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- if (isNaN(this.rpnstack[stptr - 1]));
- else if (isNaN(this.rpnstack[stptr]))
- this.rpnstack[stptr - 1] = this.rpnstack[stptr];
- else
- this.rpnstack[stptr - 1] = this.rpnstack[stptr - 1] >= this.rpnstack[stptr] ? 1.0 : 0.0;
- stptr--;
- break;
- case RRDRpn.OP.NE:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- if (isNaN(this.rpnstack[stptr - 1]));
- else if (isNaN(this.rpnstack[stptr]))
- this.rpnstack[stptr - 1] = this.rpnstack[stptr];
- else
- this.rpnstack[stptr - 1] = this.rpnstack[stptr - 1] == this.rpnstack[stptr] ? 0.0 : 1.0;
- stptr--;
- break;
- case RRDRpn.OP.EQ:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- if (isNaN(this.rpnstack[stptr - 1]));
- else if (isNaN(this.rpnstack[stptr]))
- this.rpnstack[stptr - 1] = this.rpnstack[stptr];
- else
- this.rpnstack[stptr - 1] = this.rpnstack[stptr - 1] == this.rpnstack[stptr] ? 1.0 : 0.0;
- stptr--;
- break;
- case RRDRpn.OP.IF:
- if(stptr < 2) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr - 2] = (isNaN(this.rpnstack[stptr - 2]) || this.rpnstack[stptr - 2] == 0.0) ? this.rpnstack[stptr] : this.rpnstack[stptr - 1];
- stptr--;
- stptr--;
- break;
- case RRDRpn.OP.MIN:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- if (isNaN(this.rpnstack[stptr - 1]));
- else if (isNaN(this.rpnstack[stptr]))
- this.rpnstack[stptr - 1] = this.rpnstack[stptr];
- else if (this.rpnstack[stptr - 1] > this.rpnstack[stptr])
- this.rpnstack[stptr - 1] = this.rpnstack[stptr];
- stptr--;
- break;
- case RRDRpn.OP.MAX:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- if (isNaN(this.rpnstack[stptr - 1]));
- else if (isNaN(this.rpnstack[stptr]))
- this.rpnstack[stptr - 1] = this.rpnstack[stptr];
- else if (this.rpnstack[stptr - 1] < this.rpnstack[stptr])
- this.rpnstack[stptr - 1] = this.rpnstack[stptr];
- stptr--;
- break;
- case RRDRpn.OP.LIMIT:
- if(stptr < 2) {
- throw RRDRpn.STACK_UNDERFLOW;
- };
- if (isNaN(this.rpnstack[stptr - 2])) {
- } else if (isNaN(this.rpnstack[stptr - 1])) {
- this.rpnstack[stptr - 2] = this.rpnstack[stptr - 1];
- } else if (isNaN(this.rpnstack[stptr])) {
- this.rpnstack[stptr - 2] = this.rpnstack[stptr];
- } else if (
- this.rpnstack[stptr - 2] < this.rpnstack[stptr - 1]) {
- this.rpnstack[stptr - 2] = Number.NaN;
- } else if (this.rpnstack[stptr - 2] > this.rpnstack[stptr]) {
- this.rpnstack[stptr - 2] = Number.NaN;
- }
- stptr -= 2;
- break;
- case RRDRpn.OP.UN:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = isNaN(this.rpnstack[stptr]) ? 1.0 : 0.0;
- break;
- case RRDRpn.OP.ISINF:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = isInfinite(this.rpnstack[stptr]) ? 1.0 : 0.0;
- break;
- case RRDRpn.OP.SQRT:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = Math.sqrt(this.rpnstack[stptr]);
- break;
- case RRDRpn.OP.SORT:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- var spn = this.rpnstack[stptr--];
- if(stptr < spn - 1) throw RRDRpn.STACK_UNDERFLOW;
- var array = this.rpnstack (stptr - spn + 1, stptr +1);
- array.sort(this.rpn_compare_double);
- for (var i=stptr - spn + 1, ii=0; i < (stptr +1) ; i++, ii++)
- this.rpnstack[i] = array[ii];
- // qsort(this.rpnstack + stptr - spn + 1, spn, sizeof(double), rpn_compare_double);
- break;
- case RRDRpn.OP.REV:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- var spn = this.rpnstack[stptr--];
- if(stptr < spn - 1) throw RRDRpn.STACK_UNDERFLOW;
- var array = this.rpnstack (stptr - spn + 1, stptr +1);
- array.reverse();
- for (var i=stptr - spn + 1, ii=0; i < (stptr +1) ; i++, ii++)
- this.rpnstack[i] = array[ii];
- // var p, q;
- // p = this.rpnstack + stptr - spn + 1;
- // q = this.rpnstack + stptr;
- // while (p < q) {
- // var x = q;
- // q-- = p;
- // p++ = x;
- // }
- break;
- case RRDRpn.OP.PREDICT:
- case RRDRpn.OP.PREDICTSIGMA:
- if(stptr < 2) throw RRDRpn.STACK_UNDERFLOW;
- var locstepsize = this.rpnstack[--stptr];
- var shifts = this.rpnstack[--stptr];
- if(stptr < shifts) throw RRDRpn.STACK_UNDERFLOW;
- if (shifts<0) stptr--;
- else stptr-=shifts;
- var val=Number.NaN;
- var dsstep = this.rpnp[rpi - 1].step;
- var dscount = this.rpnp[rpi - 1].ds_cnt;
- var locstep = Math.ceil(locstepsize/dsstep);
- var sum = 0;
- var sum2 = 0;
- var count = 0;
- /* now loop for each position */
- var doshifts=shifts;
- if (shifts<0) doshifts=-shifts;
- for(var loop=0;loop<doshifts;loop++) {
- var shiftstep=1;
- if (shifts<0) shiftstep = loop*this.rpnstack[stptr];
- else shiftstep = this.rpnstack[stptr+loop];
- if(shiftstep <0) {
- throw "negative shift step not allowed: "+shiftstep;
- }
- shiftstep=Math.ceil(shiftstep/dsstep);
- for(var i=0; i<=locstep; i++) {
- var offset=shiftstep+i;
- if ((offset>=0)&&(offset<output_idx)) {
- val =this.rpnp[rpi - 1].data[-dscount * offset];
- if (! isNaN(val)) {
- sum+=val;
- sum2+=val*val;
- count++;
- }
- }
- }
- }
- val=Number.NaN;
- if (this.rpnp[rpi].op == RRDRpn.OP.PREDICT) {
- if (count>0) val = sum/count;
- } else {
- if (count>1) {
- val=count*sum2-sum*sum;
- if (val<0) {
- val=Number.NaN;
- } else {
- val=Math.sqrt(val/(count*(count-1.0)));
- }
- }
- }
- this.rpnstack[stptr] = val;
- break;
- case RRDRpn.OP.TREND:
- case RRDRpn.OP.TRENDNAN:
- if(stptr < 1) throw RRDRpn.STACK_UNDERFLOW;
- if ((rpi < 2) || (this.rpnp[rpi - 2].op != RRDRpn.OP.VARIABLE)) {
- throw "malformed trend arguments";
- } else {
- var dur = this.rpnstack[stptr];
- var step = this.rpnp[rpi - 2].step;
-
- if (output_idx > Math.ceil(dur / step)) {
- var ignorenan = (this.rpnp[rpi].op == RRDRpn.OP.TREND);
- var accum = 0.0;
- var i = 0;
- var count = 0;
-
- do {
- var val = this.rpnp[rpi - 2].data[this.rpnp[rpi - 2].ds_cnt * i--];
- if (ignorenan || !isNaN(val)) {
- accum += val;
- ++count;
- }
- dur -= step;
- } while (dur > 0);
-
- this.rpnstack[--stptr] = (count == 0) ? Number.NaN : (accum / count);
- } else this.rpnstack[--stptr] = Number.NaN;
- }
- break;
- case RRDRpn.OP.AVG:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- var i = this.rpnstack[stptr--];
- var sum = 0;
- var count = 0;
-
- if(stptr < i - 1) throw RRDRpn.STACK_UNDERFLOW;
- while (i > 0) {
- var val = this.rpnstack[stptr--];
- i--;
- if (isNaN(val)) continue;
- count++;
- sum += val;
- }
- if (count > 0) this.rpnstack[++stptr] = sum / count;
- else this.rpnstack[++stptr] = Number.NaN;
- break;
- case RRDRpn.OP.ABS:
- if(stptr < 0) throw RRDRpn.STACK_UNDERFLOW;
- this.rpnstack[stptr] = fabs(this.rpnstack[stptr]);
- break;
- case RRDRpn.OP.END:
- break;
- }
- }
- if (stptr != 0) throw "RPN final stack size != 1";
- output[output_idx] = this.rpnstack[0];
- return 0;
- }
-};
-
-var RRDGraphDesc = function() {
- this.init.apply(this, arguments);
-};
-
-RRDGraphDesc.GF = {PRINT: 0, GPRINT: 1, COMMENT: 2, HRULE: 3, VRULE: 4, LINE: 5, AREA:6, STACK:7, TICK:8, TEXTALIGN:9, DEF:10, CDEF:11, VDEF:12, SHIFT: 13, XPORT: 14 };
-
-RRDGraphDesc.VDEF = {MAXIMUM: 0, MINIMUM: 1, AVERAGE: 2, STDEV: 3, PERCENT: 4, TOTAL: 5, FIRST: 6, LAST: 7, LSLSLOPE: 8, LSLINT: 9, LSLCORREL: 10, PERCENTNAN: 11 };
-
-RRDGraphDesc.CF = {AVERAGE: 0, MINIMUM: 1, MAXIMUM: 2, LAST: 3, HWPREDICT: 4, SEASONAL: 5, DEVPREDICT: 6, DEVSEASONAL: 7, FAILURES: 8, MHWPREDICT:9 };
-RRDGraphDesc.TXA = {LEFT: 0, RIGHT: 1, CENTER: 2, JUSTIFIED: 3};
-
-RRDGraphDesc.prototype = {
-
- gf: null, /* graphing function */
- stack: false, /* boolean */
- debug: false, /* boolean */
- vname: null, /* name of the variable */
- vidx: Number.NaN, /* gdes reference */
- rrd: null, /* name of the rrd_file containing data */
- ds_nam: null, /* data source name */
- ds: -1, /* data source number */
- cf: null, /* consolidation function */
- cf_reduce: null, /* consolidation function for reduce_data() */
- col: null, /* graph color */
- format: null, /* format for PRINT AND GPRINT */
- legend: null, /* legend */
- strftm: false, /* should the VDEF legend be formated with strftime */
- leg_x: 0, /* location of legend */
- leg_y: 0,
- yrule: Number.NaN, /* value for y rule line and for VDEF */
- xrule: 0, /* time for x rule line and for VDEF */
- vf: null, /* instruction for VDEF function */
- rpnp: null, /* instructions for CDEF function */
-
- /* SHIFT implementation */
- shidx: 0, /* gdes reference for offset (-1 --> constant) */
- shval: 0, /* offset if shidx is -1 */
- shift: 0, /* current shift applied */
-
- /* description of data fetched for the graph element */
- start: 0, /* timestaps for first and last data element */
- end: 0,
- start_orig: 0, /* timestaps for first and last data element */
- end_orig: 0,
- step: 0, /* time between samples */
- step_orig: 0, /* time between samples */
- ds_cnt: 0, /* how many data sources are there in the fetch */
- data_first: 0, /* first pointer to this data */
- ds_namv: null, /* name of datasources in the fetch. */
- data: null, /* the raw data drawn from the rrd */
- p_data: null, /* processed data, xsize elments */
- linewidth: 0, /* linewideth */
-
- /* dashed line stuff */
- dash: false, /* boolean, draw dashed line? */
- p_dashes: null, /* pointer do dash array which keeps the lengths of dashes */
- ndash: false, /* number of dash segments */
- offset: 0, /* dash offset along the line */
-
- txtalign: 0, /* change default alignment strategy for text */
-
- init: function (graph)
- {
- this.step = graph.step;
- this.step_orig = graph.step;
- this.start = graph.start;
- this.start_orig = graph.start;
- this.end = graph.end;
- this.end_orig = graph.end;
- this.cf = RRDGraphDesc.CF.AVERAGE;
- this.cf_reduce = RRDGraphDesc.CF.AVERAGE;
- this.data = [];
- this.pdata = [];
- this.ds_namv = [];
- }
-};
-
-Date.prototype.getWeek = function() {
- var onejan = new Date(this.getFullYear(),0,1);
- return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
-};
-
-
-var RRDGraph = function() {
- this.init.apply(this, arguments);
-};
-
-RRDGraph.pad2 = function(number) {
- return (number < 10 ? '0' : '') + number;
-};
-RRDGraph.pad3 = function(number) {
- return (number < 10 ? '00' : number < 100 ? '0' : '') + number;
-};
-RRDGraph.lpad = function(str, padString, length) {
- while (str.length < length) {
- str = padString + str;
- }
- return str;
-};
-RRDGraph.days = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];
-RRDGraph.fdays = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
-RRDGraph.months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
-RRDGraph.fmonths = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
-RRDGraph.TMT = { SECOND: 0, MINUTE: 1, HOUR: 2, DAY: 3, WEEK: 4, MONTH: 5 , YEAR: 6 };
-
-RRDGraph.prototype = {
-
- xlab: [ {minsec: 0, length: 0, gridtm: RRDGraph.TMT.SECOND, gridst: 30, mgridtm: RRDGraph.TMT.MINUTE, mgridst: 5, labtm: RRDGraph.TMT.MINUTE, labst: 5, precis: 0, stst: function (date) { return RRDGraph.pad2(date.getHours())+':'+RRDGraph.pad2(date.getMinutes()); }} ,
- {minsec: 2, length: 0, gridtm: RRDGraph.TMT.MINUTE, gridst: 1, mgridtm: RRDGraph.TMT.MINUTE, mgridst: 5, labtm: RRDGraph.TMT.MINUTE, labst: 5, precis: 0, stst: function (date) { return RRDGraph.pad2(date.getHours())+':'+RRDGraph.pad2(date.getMinutes()); }} ,
- {minsec: 5, length: 0, gridtm: RRDGraph.TMT.MINUTE, gridst: 2, mgridtm: RRDGraph.TMT.MINUTE, mgridst: 10, labtm: RRDGraph.TMT.MINUTE, labst: 10, precis: 0, stst: function (date) { return RRDGraph.pad2(date.getHours())+':'+RRDGraph.pad2(date.getMinutes()); }} ,
- {minsec: 10, length: 0, gridtm: RRDGraph.TMT.MINUTE, gridst: 5,mgridtm: RRDGraph.TMT.MINUTE, mgridst: 20, labtm: RRDGraph.TMT.MINUTE, labst: 20, precis: 0, stst: function (date) { return RRDGraph.pad2(date.getHours())+':'+RRDGraph.pad2(date.getMinutes()); }} ,
- {minsec: 30, length: 0, gridtm: RRDGraph.TMT.MINUTE, gridst: 10, mgridtm: RRDGraph.TMT.HOUR, mgridst: 1, labtm: RRDGraph.TMT.HOUR, labst: 1, precis: 0, stst: function (date) { return RRDGraph.pad2(date.getHours())+':'+RRDGraph.pad2(date.getMinutes()); }} ,
- {minsec: 60, length: 0, gridtm: RRDGraph.TMT.MINUTE, gridst: 30, mgridtm: RRDGraph.TMT.HOUR, mgridst: 2, labtm: RRDGraph.TMT.HOUR, labst: 2, precis: 0, stst: function (date) { return RRDGraph.pad2(date.getHours())+':'+RRDGraph.pad2(date.getMinutes()); }} ,
- {minsec: 60, length: 24 * 3600, gridtm: RRDGraph.TMT.MINUTE, gridst: 30, mgridtm: RRDGraph.TMT.HOUR, mgridst: 2, labtm: RRDGraph.TMT.HOUR, labst: 6, precis: 0, stst: function (date) { return RRDGraph.days[date.getDay()]+' '+RRDGraph.pad2(date.getHours())+':'+RRDGraph.pad2(date.getMinutes()); }},
- {minsec: 180, length: 0, gridtm: RRDGraph.TMT.HOUR, gridst: 1, mgridtm: RRDGraph.TMT.HOUR, mgridst: 6, labtm: RRDGraph.TMT.HOUR, labst: 6, precis: 0, stst: function (date) { return RRDGraph.pad2(date.getHours())+':'+RRDGraph.pad2(date.getMinutes());}} ,
- {minsec: 180, length: 24 * 3600, gridtm: RRDGraph.TMT.HOUR, gridst: 1, mgridtm: RRDGraph.TMT.HOUR, mgridst: 6, labtm: RRDGraph.TMT.HOUR, labst: 12, precis: 0, stst: function (date) { return RRDGraph.days[date.getDay()]+' '+RRDGraph.pad2(date.getHours())+':'+RRDGraph.pad2(date.getMinutes());}} ,
- {minsec: 600, length: 0, gridtm: RRDGraph.TMT.HOUR, gridst: 6, mgridtm: RRDGraph.TMT.DAY, mgridst: 1, labtm: RRDGraph.TMT.DAY, labst: 1, precis: 24 * 3600, stst: function (date) { return RRDGraph.days[date.getDay()];}},
- {minsec: 1200, length: 0, gridtm: RRDGraph.TMT.HOUR, gridst: 6, mgridtm: RRDGraph.TMT.DAY, mgridst: 1, labtm: RRDGraph.TMT.DAY, labst: 1, precis: 24 * 3600, stst: function (date) { return RRDGraph.pad2(date.getDate());}},
- {minsec: 1800, length: 0, gridtm: RRDGraph.TMT.HOUR, gridst: 12, mgridtm: RRDGraph.TMT.DAY, mgridst: 1, labtm: RRDGraph.TMT.DAY, labst: 2, precis: 24 * 3600, stst: function (date) { return RRDGraph.days[date.getDay()]+' '+RRDGraph.pad2(date.getDate());}} ,
- {minsec: 2400, length: 0, gridtm: RRDGraph.TMT.HOUR, gridst: 12, mgridtm: RRDGraph.TMT.DAY, mgridst: 1, labtm: RRDGraph.TMT.DAY, labst: 2, precis: 24 * 3600,stst: function (date) { return RRDGraph.days[date.getDay()];}} ,
- {minsec: 3600, length: 0, gridtm: RRDGraph.TMT.DAY, gridst: 1, mgridtm: RRDGraph.TMT.WEEK, mgridst: 1, labtm: RRDGraph.TMT.WEEK, labst: 1, precis: 7 * 24 * 3600, stst: function (date) { return 'Week '+RRDGraph.pad2(date.getWeek());}} ,
- {minsec: 3 * 3600, length: 0, gridtm: RRDGraph.TMT.WEEK, gridst: 1, mgridtm: RRDGraph.TMT.MONTH, mgridst: 1, labtm: RRDGraph.TMT.WEEK, labst: 2, precis: 7 * 24 * 3600, stst: function (date) { return 'Week '+RRDGraph.pad2(date.getWeek());}} ,
- {minsec: 6 * 3600, length: 0, gridtm: RRDGraph.TMT.MONTH, gridst: 1, mgridtm: RRDGraph.TMT.MONTH, mgridst: 1, labtm: RRDGraph.TMT.MONTH, labst: 1, precis: 30 * 24 * 3600, stst: function (date) { return RRDGraph.months[date.getMonth()];}} ,
- {minsec: 48 * 3600,length: 0, gridtm: RRDGraph.TMT.MONTH, gridst: 1, mgridtm: RRDGraph.TMT.MONTH, mgridst: 3, labtm: RRDGraph.TMT.MONTH, labst: 3, precis: 30 * 24 * 3600, stst: function (date) { return RRDGraph.months[date.getMonth()];}} ,
- {minsec: 315360, length: 0, gridtm: RRDGraph.TMT.MONTH, gridst: 3, mgridtm: RRDGraph.TMT.YEAR, mgridst: 1, labtm: RRDGraph.TMT.YEAR, labst: 1, precis: 365 * 24 * 3600, stst: function (date) { return ''+date.getFullYear();}} ,
- {minsec: 10 * 24 * 3600 , length: 0, gridtm: RRDGraph.TMT.YEAR, gridst: 1, mgridtm: RRDGraph.TMT.YEAR, mgridst: 1, labtm: RRDGraph.TMT.YEAR, labst: 1, precis: 365 * 24 * 3600, stst: function (date) { return ('' + date.getFullYear()).substr(2, 4);}} ,
- {minsec: -1, length: 0, gridtm: RRDGraph.TMT.MONTH, gridst: 0, mgridtm: RRDGraph.TMT.MONTH, mgridst: 0, labtm: RRDGraph.TMT.MONTH, labst: 0, precis: 0, stst: null }
- ],
-
- ylab: [ {grid: 0.1, lfac: [1, 2, 5, 10] } ,
- {grid: 0.2, lfac: [1, 5, 10, 20] } ,
- {grid: 0.5, lfac: [1, 2, 4, 10] } ,
- {grid: 1.0, lfac: [1, 2, 5, 10] } ,
- {grid: 2.0, lfac: [1, 5, 10, 20] } ,
- {grid: 5.0, lfac: [1, 2, 4, 10] } ,
- {grid: 10.0, lfac: [1, 2, 5, 10] } ,
- {grid: 20.0, lfac: [1, 5, 10, 20] } ,
- {grid: 50.0, lfac: [1, 2, 4, 10] } ,
- {grid: 100.0, lfac: [1, 2, 5, 10] } ,
- {grid: 200.0, lfac: [1, 5, 10, 20] } ,
- {grid: 500.0, lfac: [1, 2, 4, 10] },
- {grid: 0.0, lfac: [0, 0, 0, 0] }
- ],
- si_symbol: [
- 'a', /* 10e-18 Atto */
- 'f', /* 10e-15 Femto */
- 'p', /* 10e-12 Pico */
- 'n', /* 10e-9 Nano */
- 'u', /* 10e-6 Micro */
- 'm', /* 10e-3 Milli */
- ' ', /* Base */
- 'k', /* 10e3 Kilo */
- 'M', /* 10e6 Mega */
- 'G', /* 10e9 Giga */
- 'T', /* 10e12 Tera */
- 'P', /* 10e15 Peta */
- 'E' /* 10e18 Exa */
- ],
- si_symbcenter: 6,
-
- GRC: null,
-
- GFX_H: { LEFT: 1, RIGHT: 2, CENTER: 3 },
- GFX_V: { TOP: 1, BOTTOM: 2, CENTER: 3 },
-
- DEFAULT_FONT: 'DejaVu Sans Mono', //DejaVu Sans Mono ,Bitstream Vera Sans Mono,monospace,Courier',
-// DEFAULT_FONT: 'DejaVuSansMono', //DejaVu Sans Mono ,Bitstream Vera Sans Mono,monospace,Courier',
-// pt -> pt=px*72/96
- TEXT: null,
- MGRIDWIDTH: 0.6,
- GRIDWIDTH: 0.4,
-
- YLEGEND_ANGLE: 90.0,
-
- LEGEND_POS: { NORTH: 0, WEST: 1, SOUTH: 2, EAST: 3 },
- LEGEND_DIR: { TOP_DOWN: 0, BOTTOM_UP: 1 },
-
- canvas: null,
- ctx: null,
- xsize: 400, /* graph area size in pixels */
- ysize: 100,
- ylegend: null, /* legend along the yaxis */
- title: '', /* title for graph */
- watermark: null, /* watermark for graph */
- draw_x_grid: true, /* no x-grid at all */
- draw_y_grid: true, /* no y-grid at all */
- draw_3d_border: 2, /* size of border in pixels, 0 for off */
- dynamic_labels: false,/* pick the label shape according to the line drawn */
- grid_dash_on: 1,
- grid_dash_off: 1,
- xlab_form: null, /* format for the label on the xaxis */
- second_axis_scale: 0, /* relative to the first axis (0 to disable) */
- second_axis_shift: 0, /* how much is it shifted vs the first axis */
- second_axis_legend: null, /* label to put on the seond axis */
- second_axis_format: null, /* format for the numbers on the scond axis */
- ygridstep: Number.NaN, /* user defined step for y grid */
- ylabfact: 0, /* every how many y grid shall a label be written ? */
- tabwidth: 40, /* tabwdith */
- start: 0, /* what time does the graph cover */
- start_t: null,
- end: 0,
- end_t: null,
- step: 0, /* any preference for the default step ? */
- setminval: Number.NaN, /* extreme values in the data */
- setmaxval: Number.NaN,
- minval: Number.NaN, /* extreme values in the data */
- maxval: Number.NaN,
- rigid: false, /* do not expand range even with values outside */
- gridfit: true, /* adjust y-axis range etc so all grindlines falls in integer pixel values */
- lazy: 0, /* only update the image if there is reasonable probablility that the existing one is out of date */
- slopemode: false, /* connect the dots of the curve directly, not using a stair */
- legendposition: 0, /* the position of the legend: north, west, south or east */
- legenddirection: 0, /* The direction of the legend topdown or bottomup */
- logarithmic: false, /* scale the yaxis logarithmic */
- force_scale_min: 0, /* Force a scale--min */
- force_scale_max: 0, /* Force a scale--max */
- /* status information */
- //with_markup: 0,
- xorigin: 0, /* where is (0,0) of the graph */
- yorigin: 0,
- xOriginTitle: 0, /* where is the origin of the title */
- yOriginTitle: 0,
- xOriginLegendY: 0, /* where is the origin of the y legend */
- yOriginLegendY: 0,
- xOriginLegendY2: 0, /* where is the origin of the second y legend */
- yOriginLegendY2: 0,
- xOriginLegend: 0, /* where is the origin of the legend */
- yOriginLegend: 0,
- ximg: 0, /* total size of the image */
- yimg: 0,
- legendwidth: 0, /* the calculated height and width of the legend */
- legendheight: 0,
- zoom: 1,
- magfact: 0, /* numerical magnitude */
- base: 1000, /* 1000 or 1024 depending on what we graph */
- symbol: null, /* magnitude symbol for y-axis */
- viewfactor: 1.0, /* how should the numbers on the y-axis be scaled for viewing ? */
- unitsexponent: 9999, /* 10*exponent for units on y-asis */
- unitslength: 6, /* width of the yaxis labels */
- forceleftspace: false, /* do not kill the space to the left of the y-axis if there is no grid */
-
- alt_ygrid: false, /* use alternative y grid algorithm */
- alt_autoscale: false, /* use alternative algorithm to find lower and upper bounds */
- alt_autoscale_min: false, /* use alternative algorithm to find lower bounds */
- alt_autoscale_max: false, /* use alternative algorithm to find upper bounds */
- no_legend: false, /* use no legend */
- no_minor: false, /* Turn off minor gridlines */
- only_graph: false, /* use only graph */
- force_rules_legend: false, /* force printing of HRULE and VRULE legend */
- force_units: false, /* mask for all FORCE_UNITS_* flags */
- force_unit_si: false, /* force use of SI units in Y axis (no effect in linear graph, SI instead of E in log graph) */
- full_size_mode: false, /* -width and -height indicate the total size of the image */
- no_rrdtool_tag: false, /* disable the rrdtool tag */
-
- xlab_user: null,
- ygrid_scale: null,
-
- gdes: null,
-
- ytr_pixie: 0,
- xtr_pixie: 0,
-
- rrdfiles: null,
-
- init: function (canvasId)
- {
- this.canvas = document.getElementById(canvasId);
- this.ctx = this.canvas.getContext('2d');
-
- this.AlmostEqualBuffer = new ArrayBuffer(Float32Array.BYTES_PER_ELEMENT*2);
- this.AlmostEqualInt = new Int32Array(this.AlmostEqualBuffer);
- this.AlmostEqualFloat = new Float32Array(this.AlmostEqualBuffer);
-
- this.legenddirection = this.LEGEND_DIR.TOP_DOWN;
- this.legendposition = this.LEGEND_POS.SOUTH;
- this.gdes = [];
- this.rrdfiles = {};
- this.TEXT = { DEFAULT: { size: 11, font: this.DEFAULT_FONT },
- TITLE: { size: 12, font: this.DEFAULT_FONT },
- AXIS: { size: 10, font: this.DEFAULT_FONT },
- UNIT: { size: 11, font: this.DEFAULT_FONT },
- LEGEND: { size: 11, font: this.DEFAULT_FONT },
- WATERMARK: { size: 8, font: this.DEFAULT_FONT } };
- this.GRC = { CANVAS: 'rgba(255, 255, 255, 1.0)',
- BACK: 'rgba(242,242, 242, 1.0)',
- SHADEA: 'rgba(207, 207, 207, 1.0)',
- SHADEB: 'rgba(158, 158, 158, 1.0)',
- GRID: 'rgba(143, 143, 143, 0.75)',
- MGRID: 'rgba(222, 79, 79, 0.60)',
- FONT: 'rgba(0, 0, 0, 1.0)',
- ARROW: 'rgba(127, 31, 31, 1.0)',
- AXIS: 'rgba(31, 31, 31, 1.0)',
- FRAME: 'rgba(0, 0, 0, 1.0)' };
-
-
- this.start_t = new RRDTime("end-24h");
- this.end_t = new RRDTime("now");
- },
- set_default_font: function (name)
- {
- for (var font in this.TEXT)
- this.TEXT[font].font = name;
- },
- set_option: function(option, value)
- {
- switch(option) {
- case 'alt-autoscale':
- case 'A':
- this.alt_autoscale = true;
- break;
- case 'base':
- case 'b':
- this.base = parseInt(value, 10);
- if (this.base !== 1000 && this.base !== 1024)
- throw 'the only sensible value for base apart from 1000 is 1024';
- break;
- case 'color':
- case 'c':
- var index = value.indexOf('#');
- if (index === -1)
- throw "invalid color def format";
- var name = value.substr(0,index);
- if (!this.GRC[name])
- throw "invalid color name '"+name+"'";
- this.GRC[name] = value.substr(index); // FIXME check color
- break;
- case 'full-size-mode':
- case 'D':
- this.full_size_mode = true;
- break;
- case 'slope-mode':
- case 'E':
- this.slopemode = true;
- break;
- case 'end':
- case 'e':
- this.end_t = new RRDTime(value);
-// this.end = parseInt(value);
- break;
- case 'force-rules-legend':
- case 'F':
- this.force_rules_legend = true;
- break;
- case 'imginfo':
- case 'f':
- // im->imginfo = optarg;
- break;
- case 'graph-render-mode':
- case 'G':
- // im->graph_antialias
- break;
- case 'no-legend':
- case 'g':
- this.no_legend = true;
- break;
- case 'height':
- case 'h':
- this.ysize = parseInt(value, 10);
- break;
- case 'no-minor':
- case 'I':
- this.no_minor = false;
- break;
- case 'interlaced':
- case 'i':
- break;
- case 'alt-autoscale-min':
- case 'J':
- this.alt_autoscale_min = true;
- break;
- case 'only-graph':
- case 'j':
- this.only_graph = true;
- break;
- case 'units-length':
- case 'L':
- this.unitslength = parseInt(value, 10);
- this.forceleftspace = true;
- break;
- case 'lower-limit':
- case 'l':
- this.setminval = parseFloat(value);
- break;
- case 'alt-autoscale-max':
- case 'M':
- this.alt_autoscale_max = true;
- break;
- case 'zoom':
- case 'm':
- this.zoom = parseFloat(value);
- if (this.zoom <= 0.0)
- throw "zoom factor must be > 0";
- break;
- case 'no-gridfit':
- case 'N':
- this.gridfit = true;
- break;
- case 'font':
- case 'n':
- var args = value.split(':');
- if (args.length !== 3)
- throw "invalid text property format";
- if (!this.TEXT[args[0]])
- throw "invalid fonttag '"+args[0]+"'";
- if (args[1] > 0)
- this.TEXT[args[0]].size = args[1];
- if (args[2])
- this.TEXT[args[0]].font = args[2];
- break;
- case 'logarithmic':
- case 'o':
- this.logarithmic = true;
- break;
- case 'pango-markup':
- case 'P':
- // im->with_markup = 1;
- break;
- case 'font-render-mode':
- case 'R':
- // im->font_options: normal light mono
- break;
- case 'rigid':
- case 'r':
- this.rigid = true;
- break;
- case 'step':
- this.step = parseInt(value, 10);
- break;
- case 'start':
- case 's':
- this.start_t = new RRDTime(value);
- //this.start = parseInt(value);
- break;
- case 'tabwidth':
- case 'T':
- this.tabwidth = parseFloat(value);
- break;
- case 'title':
- case 't':
- this.title = value;
- break;
- case 'upper-limit':
- case 'u':
- this.setmaxval = parseFloat(value);
- break;
- case 'vertical-label':
- case 'v':
- this.ylegend = value;
- break;
- case 'watermark':
- case 'W':
- this.watermark = value;
- break;
- case 'width':
- case 'w':
- this.xsize = parseInt(value, 10);
- if (this.xsize < 10)
- throw "width below 10 pixels";
- break;
- case 'units-exponent':
- case 'X':
- this.unitsexponent = parseInt(value, 10);
- break;
- case 'x-grid':
- case 'x':
- if (value === 'none') {
- this.draw_x_grid = false;
- } else {
- var args = value.split(':');
- if (args.length !== 8)
- throw "invalid x-grid format";
- this.xlab_user.gridtm = this.tmt_conv(args[0]);
- if (this.xlab_user.gridtm < 0)
- throw "unknown keyword "+args[0];
- this.xlab_user.gridst = parseInt(args[1], 10);
- this.xlab_user.mgridtm = this.tmt_conv(args[2]);
- if (this.xlab_user.mgridtm < 2)
- throw "unknown keyword "+args[2];
- this.xlab_user.mgridst = parseInt(args[3], 10);
- this.xlab_user.labtm = this.tmt_conv(args[4]);
- if (this.xlab_user.labtm < 0)
- throw "unknown keyword "+args[4];
- this.xlab_user.labst = parseInt(args[5], 10);
- this.xlab_user.precis = parseInt(args[6], 10);
- this.xlab_user.minsec = 1;
- this.xlab_form = args[7]; // FIXME : ? join(:)
- this.xlab_user.stst = this.xlab_form;
- }
- break;
- case 'alt-y-grid':
- case 'Y':
- this.alt_y_grid = true;
- break;
- case 'y-grid':
- case 'y':
- if (value === 'none') {
- this.draw_y_grid = false;
- } else {
- var index = value.indexOf(':');
- if (index === -1)
- throw "invalid y-grid format";
- this.ygridstep = parseFloat(value.substr(0,index));
- if (this.ygridstep <= 0)
- throw "grid step must be > 0";
- this.ylabfact = parseInt(value.substr(index+1), 10);
- if (this.ylabfact < 1)
- throw "label factor must be > 0";
- }
- break;
- case 'lazy':
- case 'z':
- this.lazy = 1;
- break;
- case 'units':
- if (this.force_units)
- throw "--units can only be used once!";
- if (value === 'si')
- this.force_units_si = true;
- else
- throw "invalid argument for --units: "+value;
- break;
- case 'alt-y-mrtg':
- break;
- case 'disable-rrdtool-tag':
- this.no_rrdtool_tag = true;
- break;
- case 'right-axis':
- var index = value.indexOf(':');
- if (index === -1)
- throw "invalid right-axis format expected scale:shift";
- this.second_axis_scale = parseFloat(value.substr(0,index));
- if(this.second_axis_scale === 0)
- throw "the second_axis_scale must not be 0";
- this.second_axis_shift = parseFloat(value.substr(index+1));
- break;
- case 'right-axis-label':
- this.second_axis_legend = value;
- break;
- case 'right-axis-format':
- this.second_axis_format = value;
- break;
- case 'legend-position':
- if (value === "north") {
- this.legendposition = this.LEGEND_POS.NORTH;
- } else if (value === "west") {
- this.legendposition = this.LEGEND_POS.WEST;
- } else if (value === "south") {
- this.legendposition = this.LEGEND_POS.SOUTH;
- } else if (value === "east") {
- this.legendposition = this.LEGEND_POS.EAST;
- } else {
- throw "unknown legend-position '"+value+"'";
- }
- break;
- case 'legend-direction':
- if (value === "topdown") {
- this.legenddirection = this.LEGEND_DIR.TOP_DOWN;
- } else if (value === "bottomup") {
- this.legenddirection = this.LEGEND_DIR.BOTTOM_UP;
- } else {
- throw "unknown legend-position '"+value+"'";
- }
- break;
- case 'border':
- this.draw_3d_border = parseInt(value, 10);
- break;
- case 'grid-dash':
- var index = value.indexOf(':');
- if (index === -1)
- throw "expected grid-dash format float:float";
- this.grid_dash_on = parseFloat(value.substr(0,index));
- this.grid_dash_off = parseFloat(value.substr(index+1));
- break;
- case 'dynamic-labels':
- this.dynamic_labels = true;
- break;
- default:
- throw 'Unknow option "'+option+'"';
- }
-
- },
- parse_color: function(str)
- {
- var bits;
- if ((bits = /^#?([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/.exec(str))) {
- return [
- parseInt(bits[1] + bits[1], 16),
- parseInt(bits[2] + bits[2], 16),
- parseInt(bits[3] + bits[3], 16),
- 1.0];
- } else if ((bits = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(str))) {
- return [
- parseInt(bits[1], 16),
- parseInt(bits[2], 16),
- parseInt(bits[3], 16),
- 1.0];
- } else if ((bits = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/.exec(str))) {
- return [
- parseInt(bits[1], 16),
- parseInt(bits[2], 16),
- parseInt(bits[3], 16),
- parseInt(bits[4], 16)/255];
- } else if ((bits = /^rgb\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\)$/.exec(str))) {
- return [
- parseInt(bits[1], 10),
- parseInt(bits[2], 10),
- parseInt(bits[3], 10),
- 1.0];
- } else if ((bits = /^rgba\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([0-9.]+)\)$/.exec(str))) {
- return [
- parseInt(bits[1], 10),
- parseInt(bits[2], 10),
- parseInt(bits[3], 10),
- parseFloat(bits[4]), 10];
- } else {
- throw "Unknown color format '" + str + "'";
- }
- },
- color2rgba: function (color)
- {
- return 'rgba('+color[0]+','+color[1]+','+color[2]+','+color[3]+')';
- },
- cmdline: function(line) // FIXME
- {
- var i = 0;
- line = line.replace(/\n/g," ");
- var lines = line.match(/[^" ]+|"[^"]+"/g);
- var len = lines.length;
-
- while (i < len) {
- var arg = lines[i];
- if (arg.charAt(0) === '"' && arg.charAt(arg.length-1) === '"')
- arg = arg.substr(1,arg.length-2);
- if (/^LINE[0-9.]+:/.test(arg)) {
- this.parse_line(arg);
- } else if (/^AREA:/.test(arg)) {
- this.parse_area(arg);
- } else if (/^DEF:/.test(arg)) {
- this.parse_def(arg);
- } else if (/^CDEF:/.test(arg)) {
- this.parse_cdef(arg);
- } else if (/^VDEF:/.test(arg)) {
- this.parse_vdef(arg);
- } else if (/^GPRINT:/.test(arg)) {
- this.parse_gprint(arg);
- } else if (/^COMMENT:/.test(arg)) {
- this.parse_comment(arg);
- } else if (/^VRULE:/.test(arg)) {
- this.parse_vrule(arg);
- } else if (/^HRULE:/.test(arg)) {
- this.parse_hrule(arg);
- } else if (/^TICK:/.test(arg)) {
- this.parse_tick(arg);
- } else if (/^TEXTALIGN:/.test(arg)) {
- this.parse_textaling(arg);
- } else if (/^SHIFT:/.test(arg)) {
- this.parse_shift(arg);
- } else if (arg.charAt(0) === '-') {
- var strip = 1;
- if (arg.length > 1 && arg.charAt(1) === '-') {
- strip = 2;
- }
- var option = arg.substr(strip);
- var value = undefined;
-
- if (option.indexOf('=') !== -1) {
- var index = option.indexOf('=');
- value = option.substr(index+1);
- option = option.substr(0,index);
- } else if (i+1 < len) {
- if (lines[i+1].charAt(0) !== '-' &&
- !/^"?LINE[0-9.]+:/.test(lines[i+1]) &&
- !/^"?AREA:/.test(lines[i+1]) &&
- !/^"?DEF:/.test(lines[i+1]) &&
- !/^"?CDEF:/.test(lines[i+1]) &&
- !/^"?VDEF:/.test(lines[i+1]) &&
- !/^"?GPRINT:/.test(lines[i+1]) &&
- !/^"?COMMENT:/.test(lines[i+1]) &&
- !/^"?HRULE:/.test(lines[i+1]) &&
- !/^"?VRULE:/.test(lines[i+1]) &&
- !/^"?TICK:/.test(lines[i+1]) &&
- !/^"?TEXTALING:/.test(lines[i+1]) &&
- !/^"?SHIFT:/.test(lines[i+1])
- ) {
- i++;
- if (lines[i].charAt(0) === '"' && lines[i].charAt(lines[i].length-1) === '"')
- value = lines[i].substr(1,lines[i].length-2);
- else
- value = lines[i];
- }
- }
- this.set_option(option, value);
- } else {
- throw "Unknow argument: "+arg;
- }
- i++;
- }
- var start_end = RRDTime.proc_start_end(this.start_t, this.end_t); // FIXME here?
- this.start = start_end[0];
- this.end = start_end[1];
- },
- sprintf: function()
- {
- var argc = 0;
- var args = arguments;
- var fmt = args[argc++];
-
- function format (match, width, dot, precision, length, conversion)
- {
- if (match === '%%') return '%';
-
- var value = args[argc++];
- var prefix;
-
- if (width === undefined)
- width = 0;
- else
- width = +width;
-
- if (precision === undefined)
- precision = conversion == 'd' ? 0 : 6;
- else
- precision = +precision;
-
- switch (conversion) {
- case 's':
- case 'c':
- return value;
- break;
- case 'd':
- return parseInt(value, 10);
- break;
- case 'e':
- prefix = value < 0 ? '-' : '';
- return RRDGraph.lpad(prefix+Math.abs(value).toExponential(precision),' ',width);
- break;
- case 'f':
- prefix = value < 0 ? '-' : '';
- return RRDGraph.lpad(prefix+Math.abs(value).toFixed(precision),' ',width);
- break;
- case 'g':
- prefix = value < 0 ? '-' : '';
- return RRDGraph.lpad(prefix+Math.abs(value).toPrecision(precision),' ',width);
- break;
- default:
- return match;
- }
-
- };
- return fmt.replace(/%(\d+)?(\.(\d+))?(l?)([%scdfeg])/g,format);
- },
- strftime: function (ftm, time)
- {
- var d = new Date(time*1000);
-
- function format(match, opt)
- {
- if (match === '%%') return '%';
-
- switch (opt) {
- case 'a':
- return RRDGraph.days[d.getDay()];
- break;
- case 'A':
- return RRDGraph.fdays[d.getDay()];
- break;
- case 'b':
- return RRDGraph.months[d.getMonth()];
- break;
- case 'B':
- return RRDGraph.fmonths[d.getMonth()];
- break;
- case 'c':
- return d.toLocaleString();
- break;
- case 'd':
- return RRDGraph.pad2(d.getDate());
- break;
- case 'H':
- return RRDGraph.pad2(d.getHours());
- break;
- case 'I':
- var hours = d.getHours()%12;
- return RRDGraph.pad2(hours === 0 ? 12 : hours);
- break;
- case 'j':
- var d01 = new Date (date.getFullYear(), 0, 1);
- return RRDGraph.pad3(Math.ceil((d01.getTime()-d.getTime())/86400000));
- break;
- case 'm':
- return RRDGraph.pad2(d.getMonth());
- break;
- case 'M':
- return RRDGraph.pad2(d.getMinutes());
- break;
- case 'p':
- return d.getHours() >= 12 ? 'PM' : 'AM';
- break;
- case 's':
- return RRDGraph.pad2(d.getSeconds());
- break;
- case 'S':
- return d.getTime()/1000;
- break;
-//%U The week number of the current year as a decimal number, range 00 to 53, starting with the first Sunday as the first day of week 01. See also %V and %W.
- case 'U':
- var d01 = new Date(this.getFullYear(),0,1);
- return RRDGraph.pad2(Math.ceil((((d.getTime() - d01.getTime()) / 86400000) + d01.getDay()+1)/7)); // FIXME weeks
- break;
-//%V The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. See also %U and %W.
- case 'V':
- var d01 = new Date(this.getFullYear(),0,1); // FIXME weeks
- break;
-//%W The week number of the current year as a decimal number, range 00 to 53, starting with the first Monday as the first day of week 01.
- case 'w':
- return d.getDay();
- break;
- case 'W': // FIXME weeks
- break;
- case 'x':
- return RRDGraph.pad2(d.getDate())+'/'+RRDGraph.pad2(d.getMonth())+'/'+d.getFullYear();
- break;
- case 'X':
- return RRDGraph.pad2(d.getHours())+':'+RRDGraph.pad2(d.getMinutes())+':'+RRDGraph.pad2(d.getSeconds());
- break;
- case 'y':
- return RRDGraph.pad2(d.getFullYear()%100);
- break;
- case 'Y':
- return d.getFullYear();
- break;
- case 'Z':
- return d.toString().replace(/^.*\(([^)]+)\)$/, '$1');
- break;
- default:
- return match;
- }
- };
- return fmt.replace(/%([aAbBcdHIjmMpsSUVwWxXyYZ%])/g, format);
- },
- gfx_line: function (X0, Y0, X1, Y1, width, color)
- {
- X0 = Math.round(X0);
- Y0 = Math.round(Y0);
- X1 = Math.round(X1);
- Y1 = Math.round(Y1);
-
- if (Y0 === Y1) {
- Y0 += 0.5;
- Y1 += 0.5;
- } else if (X0 === X1) {
- X0 += 0.5;
- X1 += 0.5;
- }
-
- this.ctx.save();
- this.ctx.lineWidth = width;
- this.ctx.strokeStyle = color;
- this.ctx.beginPath();
- this.ctx.moveTo(X0, Y0);
- this.ctx.lineTo(X1, Y1);
- this.ctx.stroke();
- this.ctx.restore();
- },
- gfx_dashed_line: function (X0, Y0, X1, Y1, width, color, dash_on, dash_off)
- {
- X0 = Math.round(X0);
- Y0 = Math.round(Y0);
- X1 = Math.round(X1);
- Y1 = Math.round(Y1);
-
- this.ctx.save();
- this.ctx.lineWidth = width;
- this.ctx.strokeStyle = color;
-
- this.ctx.beginPath();
- if (Y0 === Y1) {
- Y0 += 0.5;
- Y1 += 0.5;
- if (X0 > X1) {
- var swap = X0;
- X0 = X1;
- X1 = swap;
- }
- this.ctx.moveTo(X0, Y0);
- var n=0;
- while(X0<=X1) {
- if (n%2 === 1) {
- X0 += dash_on;
- this.ctx.lineTo(X0, Y0);
- } else {
- X0 += dash_off;
- this.ctx.moveTo(X0, Y0);
- }
- n++;
- }
- } else if (X0 === X1) {
- X0 += 0.5;
- X1 += 0.5;
- if (Y0 > Y1) {
- var swap = Y0;
- Y0 = Y1;
- Y1 = swap;
- }
- this.ctx.moveTo(X0, Y0);
- var n=0;
- while(Y0<=Y1) {
- if (n%2 === 1) {
- Y0 += dash_on;
- this.ctx.lineTo(X0, Y0);
- } else {
- Y0 += dash_off;
- this.ctx.moveTo(X0, Y0);
- }
- n++;
- }
-
- } else {
- this.ctx.moveTo(X0, Y0);
- this.ctx.lineTo(X1, Y1);
- }
- this.ctx.stroke();
- this.ctx.restore();
- },
- gfx_new_area: function (X0, Y0, X1, Y1, X2, Y2, color)
- {
- X0 = Math.round(X0)+0.5;
- Y0 = Math.round(Y0)+0.5;
- X1 = Math.round(X1)+0.5;
- Y1 = Math.round(Y1)+0.5;
- X2 = Math.round(X2)+0.5;
- Y2 = Math.round(Y2)+0.5;
- this.ctx.fillStyle = color;
- this.ctx.beginPath();
- this.ctx.moveTo(X0, Y0);
- this.ctx.lineTo(X1, Y1);
- this.ctx.lineTo(X2, Y2);
- },
- gfx_add_point: function (x, y)
- {
- this.ctx.lineTo(x, y);
- },
- gfx_close_path: function ()
- {
- this.ctx.closePath();
- this.ctx.fill();
- },
- gfx_text: function (x, y, color, font, tabwidth, angle, h_align, v_align, text)
- {
- x = Math.round(x);
- y = Math.round(y);
-
- this.ctx.save();
- this.ctx.font = font.size+'px '+"'"+font.font+"'";
-
- switch (h_align) {
- case this.GFX_H.LEFT:
- this.ctx.textAlign = 'left';
- break;
- case this.GFX_H.RIGHT:
- this.ctx.textAlign = 'right';
- break;
- case this.GFX_H.CENTER:
- this.ctx.textAlign = 'center';
- break;
- }
-
- switch (v_align) {
- case this.GFX_V.TOP:
- this.ctx.textBaseline = 'top';
- break;
- case this.GFX_V.BOTTOM:
- this.ctx.textBaseline = 'bottom';
- break;
- case this.GFX_V.CENTER:
- this.ctx.textBaseline = 'middle';
- break;
- }
-
- this.ctx.fillStyle = color;
- this.ctx.translate(x,y);
- this.ctx.rotate(-angle*Math.PI/180.0);
- this.ctx.fillText(text, 0, 0);
- this.ctx.restore();
- },
- gfx_get_text_width: function( start, font, tabwidth, text)
- {
- this.ctx.save();
- this.ctx.font = font.size+"px "+font.font;
- var width = this.ctx.measureText(text);
- this.ctx.restore();
- return width.width;
- },
- xtr: function (mytime)
- {
- if (mytime === 0) {
- this.xtr_pixie = this.xsize / (this.end - this.start);
- return this.xorigin;
- }
- return this.xorigin + this.xtr_pixie * (mytime - this.start);
- },
- ytr: function (value)
- {
- var yval;
-
- if (isNaN(value)) {
- if (!this.logarithmic)
- this.ytr_pixie = this.ysize / (this.maxval - this.minval);
- else
- this.ytr_pixie = this.ysize / ((Math.log(this.maxval)/Math.LN10) - (Math.log(this.minval)/Math.LN10));
- yval = this.yorigin;
- } else if (!this.logarithmic) {
- yval = this.yorigin - this.ytr_pixie * (value - this.minval);
- } else {
- if (value < this.minval) {
- yval = this.yorigin;
- } else {
- yval = this.yorigin - this.ytr_pixie * ((Math.log(value)/Math.LN10) - (Math.log(this.minval)/Math.LN10));
- }
- }
- return yval;
- },
- // http://stackoverflow.com/questions/3077718/converting-a-decimal-value-to-a-32bit-floating-point-hexadecimal
- floatToIntBits: function (f)
- {
- var NAN_BITS = 0|0x7FC00000;
- var INF_BITS = 0|0x7F800000;
- var ZERO_BITS = 0|0x00000000;
- var SIGN_MASK = 0|0x80000000;
- var EXP_MASK = 0|0x7F800000;
- var MANT_MASK = 0|0x007FFFFF;
- var MANT_MAX = Math.pow(2.0, 23) - 1.0;
-
- if (f != f)
- return NAN_BITS;
- var hasSign = f < 0.0 || (f == 0.0 && 1.0 / f < 0);
- var signBits = hasSign ? SIGN_MASK : 0;
- var fabs = Math.abs(f);
-
- if (fabs == Number.POSITIVE_INFINITY)
- return signBits | INF_BITS;
-
- var exp = 0, x = fabs;
- while (x >= 2.0 && exp <= 127) {
- exp++;
- x /= 2.0;
- }
- while (x < 1.0 && exp >= -126) {
- exp--;
- x *= 2.0;
- }
- if (!(x * Math.pow(2.0, exp) == fabs)) throw "floatToIntBits: error fabs.";
- var biasedExp = exp + 127;
- if (!(0 <= biasedExp && biasedExp <= 254)) throw "floatToIntBits: error biasedExp "+biasedExp;
-
- if (biasedExp == 255)
- return signBit | INF_BITS;
- if (biasedExp == 0) {
- if (!(0.0 <= x && x < 2.0)) throw "floatToIntBits: x in [0.0, 1.0) "+x;
- var mantissa = x * Math.pow(2.0, 23) / 2.0;
- } else {
- if (!(1.0 <= x && x < 2.0)) throw "floatToIntBits: x in [0.5; 1.0) "+x;
- var mantissa = x * Math.pow(2.0, 23) - Math.pow(2.0, 23);
- }
- var mantissaBits = mantissa & MANT_MASK;
- if (!(0.0 <= mantissaBits && mantissaBits <= MANT_MAX)) throw "floatToIntBits: mantissa in [0.0, 2^23) "+mantissa+" MANT_MAX "+MANT_MAX+" "+(mantissa & MANT_MASK);
-
- //console.log("number", f, "x", x, "biasedExp", biasedExp, "mantissa", mantissa.toString(16));
- var expBits = (biasedExp << 23) & EXP_MASK;
-
- //console.log("number", f, "sign", signBits.toString(16), "expBits", expBits.toString(16), "mantissaBits", mantissaBits.toString(16));
- return signBits | expBits | mantissaBits;
- },
-/*
- AlmostEqual2sComplement: function(A, B, maxUlps)
- {
- var aInt = this.floatToIntBits(A);
- if (aInt < 0) aInt = 0x80000000 - aInt;
-
- var bInt = this.floatToIntBits(B);
- if (bInt < 0) bInt = 0x80000000 - bInt;
-
- var intDiff = Math.abs(aInt - bInt);
-
- if (intDiff <= maxUlps)
- return true;
-
- return false;
- },
-*/
- AlmostEqual2sComplement: function(A, B, maxUlps)
- {
-
- this.AlmostEqualFloat[0] = A;
- this.AlmostEqualFloat[1] = B;
-
- var aInt = this.AlmostEqualInt[0];
- if (aInt < 0) aInt = 0x80000000 - aInt;
-
- var bInt = this.AlmostEqualInt[1];
- if (bInt < 0) bInt = 0x80000000 - bInt;
-
- var intDiff = Math.abs(aInt - bInt);
-
- if (intDiff <= maxUlps)
- return true;
-
- return false;
- },
-/*
-//AlmostEqualRelative
-//AlmostEqualRelativeOrAbsolute
- AlmostEqual2sComplement: function(A, B, error) // FIXME may not work, maxUpls???
- {
- error = 0.00001
-
- if (A == B)
- return true;
-
- var relerror;
- if (Math.abs(B) > Math.abs(A))
- relerror = Math.abs((A - B) / B);
- else
- relerror = Math.abs((A - B) / A);
-
- if (relerror <= error)
- return true;
-//console.log("AlmostEqual2sComplement("+A+","+B+"): Math.abs(A - B):"+(Math.abs(A - B))+" < "+maxUlps+" relativeError: "+error);
- return false;
- },
-*/
- tmt2str: function (val)
- {
- switch (val) {
- case RRDGraph.TMT.SECOND: return 'sec';
- case RRDGraph.TMT.MINUTE: return 'min';
- case RRDGraph.TMT.HOUR: return 'hour';
- case RRDGraph.TMT.DAY: return 'day';
- case RRDGraph.TMT.WEEK: return 'week';
- case RRDGraph.TMT.MONTH: return 'mon';
- case RRDGraph.TMT.YEAR: return 'year';
- }
- return val;
- },
- find_first_time: function(start, baseint, basestep)
- {
- var date = new Date(start*1000);
-
- switch (baseint) {
- case RRDGraph.TMT.SECOND:
- var sec = date.getSeconds();
- sec -= sec % basestep;
- date.setSeconds(sec);
- break;
- case RRDGraph.TMT.MINUTE:
- date.setSeconds(0);
- var min = date.getMinutes();
- min -= min % basestep;
- date.setMinutes(min);
- break;
- case RRDGraph.TMT.HOUR:
- date.setSeconds(0);
- date.setMinutes(0);
- var hour = date.getHours();
- hour -= hour % basestep;
- date.setHours(hour);
- break;
- case RRDGraph.TMT.DAY:
- date.setSeconds(0);
- date.setMinutes(0);
- date.setHours(0);
- break;
- case RRDGraph.TMT.WEEK:
- date.setSeconds(0);
- date.setMinutes(0);
- date.setHours(0);
- var mday = date.getDate();
- var wday = date.getDay();
- mday -= wday - 1; // FIXME find_first_weekday
- if (wday === 0) mday -= 7;// FIXME find_first_weekday
- date.setDate(mday);
- break;
- case RRDGraph.TMT.MONTH:
- date.setSeconds(0);
- date.setMinutes(0);
- date.setHours(0);
- date.setDate(1);
- var mon = date.getMonth();
- mon -= mon % basestep;
- date.setMonth(mon);
- break;
- case RRDGraph.TMT.YEAR:
- date.setSeconds(0);
- date.setMinutes(0);
- date.setHours(0);
- date.setDate(1);
- date.setMonth(0);
- var year = date.getFullYear()-1900;
- year -= (year + 1900) %basestep;
- date.setFullYear(year+1900);
- }
- return Math.round(date.getTime()/1000.0);
- },
- find_next_time: function(current, baseint, basestep)
- {
- var date = new Date(current*1000);
- var limit = 2;
- var madetime;
-
- switch (baseint) {
- case RRDGraph.TMT.SECOND: limit = 7200; break;
- case RRDGraph.TMT.MINUTE: limit = 120; break;
- case RRDGraph.TMT.HOUR: limit = 2; break;
- default: limit = 2; break;
- }
-
- do {
- switch (baseint) {
- case RRDGraph.TMT.SECOND:
- date.setSeconds(date.getSeconds()+basestep);
- break;
- case RRDGraph.TMT.MINUTE:
- date.setMinutes(date.getMinutes()+basestep);
- break;
- case RRDGraph.TMT.HOUR:
- date.setHours(date.getHours()+basestep);
- break;
- case RRDGraph.TMT.DAY:
- date.setDate(date.getDate()+basestep);
- break;
- case RRDGraph.TMT.WEEK:
- date.setDate(date.getDate()+7*basestep);
- break;
- case RRDGraph.TMT.MONTH:
- date.setMonth(date.getMonth()+basestep);
- break;
- case RRDGraph.TMT.YEAR:
- date.setFullYear(date.getFullYear()+basestep);
- break;
- }
- madetime = Math.round(date.getTime()/1000.0);
- } while (madetime === -1 && limit-- >= 0); /* this is necessary to skip impossible times like the daylight saving time skips */ // FIXME ??
- return madetime;
- },
- print_calc: function()
- {
- var validsteps;
- var printval;
- var tmvdef;
- var graphelement = 0;
- var max_ii;
- var magfact = -1;
- var si_symb = "";
- var percent_s;
- var prline_cnt = 0;
-
- var now = Math.round((new Date()).getTime() / 1000);
-
- for (var i = 0, gdes_c = this.gdes.length; i < gdes_c; i++) {
- var vidx = this.gdes[i].vidx;
- switch (this.gdes[i].gf) {
- case RRDGraphDesc.GF.PRINT:
- case RRDGraphDesc.GF.GPRINT:
- if (this.gdes[vidx].gf === RRDGraphDesc.CF.VDEF) { /* simply use vals */
- printval = this.gdes[vidx].vf.val;
- tmvdef = this.gdes[vidx].vf.when;
- // localtime_r(&this.gdes[vidx].vf.when, &tmvdef); // FIXME ?
- } else { /* need to calculate max,min,avg etcetera */
- max_ii = ((this.gdes[vidx].end - this.gdes[vidx].start) / this.gdes[vidx].step * this.gdes[vidx].ds_cnt);
- printval = Number.NaN;
- validsteps = 0;
-
- for (var ii = this.gdes[vidx].ds; ii < max_ii; ii += this.gdes[vidx].ds_cnt) {
- if (!isFinite(this.gdes[vidx].data[ii])) continue;
- if (isNaN(printval)) {
- printval = this.gdes[vidx].data[ii];
- validsteps++;
- continue;
- }
- switch (this.gdes[i].cf) {
- case RRDGraphDesc.CF.HWPREDICT:
- case RRDGraphDesc.CF.MHWPREDICT:
- case RRDGraphDesc.CF.DEVPREDICT:
- case RRDGraphDesc.CF.DEVSEASONAL:
- case RRDGraphDesc.CF.SEASONAL:
- case RRDGraphDesc.CF.AVERAGE:
- validsteps++;
- printval += this.gdes[vidx].data[ii];
- break;
- case RRDGraphDesc.CF.MINIMUM:
- printval = Math.min(printval, this.gdes[vidx].data[ii]);
- break;
- case RRDGraphDesc.CF.FAILURES:
- case RRDGraphDesc.CF.MAXIMUM:
- printval = Math.max(printval, this.gdes[vidx].data[ii]);
- break;
- case RRDGraphDesc.CF.LAST:
- printval = this.gdes[vidx].data[ii];
- }
- }
- if (this.gdes[i].cf === RRDGraphDesc.CF.AVERAGE || this.gdes[i].cf > RRDGraphDesc.CF.LAST) {
- if (validsteps > 1) printval = (printval / validsteps);
- }
- } /* prepare printval */
-
- if (!this.gdes[i].strftm && (percent_s = this.gdes[i].format.indexOf('%S')) != -1) {
- if (magfact < 0.0) {
- //[printval, si_symb, magfact] = this.auto_scale(printval, si_symb, magfact);
- var dummy = this.auto_scale(
- printval, si_symb, magfact);
- printval = dummy[0];
- si_symb = dummy[1];
- magfact = dummy[2];
- if (printval === 0.0) magfact = -1.0;
- } else {
- printval /= magfact;
- }
- this.gdes[i].format = this.gdes[i].format.substr(0, percent_s+1)+'s'+this.gdes[i].format.substr(percent_s+2);
- } else if (!this.gdes[i].strftm && this.gdes[i].format.indexOf('%s') != -1) {
- //[printval, si_symb, magfact] = this.auto_scale(printval, si_symb, magfact);
- var dummy = this.auto_scale(
- printval, si_symb, magfact);
- printval = dummy[0];
- si_symb = dummy[1];
- magfact = dummy[2];
-
- }
-
-// if (this.gdes[i].gf === RRDGraphDesc.GF.PRINT) {
-// var prline;
-//
-// if (this.gdes[i].strftm) {
-// var date = new Date(tmvdef*1000);
-// prline.u_str = date.strftime(this.gdes[i].format);
-// } else {
-// prline.u_str = sprintf(this.gdes[i].format, printval, si_symb);
-// }
-// grinfo_push(im, sprintf_alloc ("print[%ld]", prline_cnt++), RD_I_STR, prline); // FIXME
-// } else {
- if (this.gdes[i].strftm) {
- this.gdes[i].legend = this.strftime(this.gdes[i].format, tmvdef);
- } else {
- this.gdes[i].legend = this.sprintf(this.gdes[i].format, printval, si_symb);
- }
- graphelement = 1;
-// }
- break;
- case RRDGraphDesc.GF.LINE:
- case RRDGraphDesc.GF.AREA:
- case RRDGraphDesc.GF.TICK:
- graphelement = 1;
- break;
- case RRDGraphDesc.GF.HRULE:
- if (isNaN(this.gdes[i].yrule)) { /* we must set this here or the legend printer can not decide to print the legend */
- this.gdes[i].yrule = this.gdes[vidx].vf.val;
- };
- graphelement = 1;
- break;
- case RRDGraphDesc.GF.VRULE:
- if (this.gdes[i].xrule === 0) { /* again ... the legend printer needs it */
- this.gdes[i].xrule = this.gdes[vidx].vf.when;
- };
- graphelement = 1;
- break;
- case RRDGraphDesc.GF.COMMENT:
- case RRDGraphDesc.GF.TEXTALIGN:
- case RRDGraphDesc.GF.DEF:
- case RRDGraphDesc.GF.CDEF:
- case RRDGraphDesc.GF.VDEF:
- case RRDGraphDesc.GF.SHIFT:
- case RRDGraphDesc.GF.XPORT:
- break;
- case RRDGraphDesc.GF.STACK:
- throw "STACK should already be turned into LINE or AREA here";
- break;
- }
- }
- return graphelement;
- },
- reduce_data: function(gdes, cur_step)
- {
- var reduce_factor = Math.ceil(gdes.step / cur_step);
- var col, dst_row, row_cnt, start_offset, end_offset, skiprows = 0;
- var srcptr, dstptr;
-
- gdes.step = cur_step * gdes.reduce_factor; /* set new step size for reduced data */
- dstptr = 0;
- srcptr = 0;
- row_cnt = (gdes.end - gdes.start) / cur_step;
-
- end_offset = gdes.end % gdes.step;
- start_offset = gdes.start % gdes.step;
-
- if (start_offset) {
- gdes.start = gdes.start - start_offset;
- skiprows = reduce_factor - start_offset / cur_step;
- srcptr += skiprows * gdes.ds_cnt;
- for (col = 0; col < gdes.ds_cnt; col++)
- gdes.data[dstptr++] = Number.NaN;
- row_cnt -= skiprows;
- }
-
- if (end_offset) {
- gdes.end = gdes.end - end_offset + gdes.step;
- skiprows = end_offset / cur_step;
- row_cnt -= skiprows;
- }
-
- if (row_cnt % reduce_factor) {
- throw "BUG in reduce_data(), SANITY CHECK: "+row_cnt+" rows cannot be reduced by "+reduce_factor;
- }
-
- for (dst_row = 0; row_cnt >= reduce_factor; dst_row++) {
- for (col = 0; col < gdes.ds_cnt; col++) {
- var newval = Number.NaN;
- var validval = 0;
-
- for (i = 0; i < reduce_factor; i++) {
- if (isNaN(gdes.data[srcptr + i*gdes.ds_cnt + col])) continue;
- validval++;
- if (isNaN(newval))
- newval = gdes.data[srcptr + i * gdes.ds_cnt + col];
- else {
- switch (gdes.cf_reduce) {
- case RRDGraphDesc.CF.HWPREDICT:
- case RRDGraphDesc.CF.MHWPREDICT:
- case RRDGraphDesc.CF.DEVSEASONAL:
- case RRDGraphDesc.CF.DEVPREDICT:
- case RRDGraphDesc.CF.SEASONAL:
- case RRDGraphDesc.CF.AVERAGE:
- newval += gdes.data[srcptr + i*gdes.ds_cnt + col];
- break;
- case RRDGraphDesc.CF.MINIMUM:
- newval = Math.min(newval, gdes.data[srcptr + i*gdes.ds_cnt + col]);
- break;
- case RRDGraphDesc.CF.FAILURES:
- /* an interval contains a failure if any subintervals contained a failure */
- case RRDGraphDesc.CF.MAXIMUM:
- newval = Math.max(newval, gdes.data[srcptr + i*gdes.ds_cnt + col]);
- break;
- case RRDGraphDesc.CF.LAST:
- newval = gdes.data[srcptr + i*gdes.ds_cnt + col];
- break;
- }
- }
- }
- if (validval === 0) {
- newval = Number.NaN;
- } else {
- switch (gdes.cf_reduce) {
- case RRDGraphDesc.CF.HWPREDICT:
- case RRDGraphDesc.CF.MHWPREDICT:
- case RRDGraphDesc.CF.DEVSEASONAL:
- case RRDGraphDesc.CF.DEVPREDICT:
- case RRDGraphDesc.CF.SEASONAL:
- case RRDGraphDesc.CF.AVERAGE:
- newval /= validval;
- break;
- case RRDGraphDesc.CF.MINIMUM:
- case RRDGraphDesc.CF.FAILURES:
- case RRDGraphDesc.CF.MAXIMUM:
- case RRDGraphDesc.CF.LAST:
- break;
- }
- }
- gdes.data[dstptr++] = newval;
- }
- srcptr += gdes.ds_cnt * reduce_factor;
- row_cnt -= reduce_factor;
- }
- if (end_offset)
- for (col = 0; col < gdes.ds_cnt; col++)
- gdes.data[dstptr++] = Number.NaN;
- },
- data_fetch: function()
- {
- var skip;
-
- for (var i = 0, gdes_c = this.gdes.length; i < gdes_c; i++) {
- if (this.gdes[i].gf != RRDGraphDesc.GF.DEF) continue;
-
- skip = false;
- for (var ii = 0; ii < i; ii++) {
- if (this.gdes[ii].gf != RRDGraphDesc.GF.DEF) continue;
- if ((this.gdes[i].rrd === this.gdes[ii].rrd)
- && (this.gdes[i].cf === this.gdes[ii].cf)
- && (this.gdes[i].cf_reduce === this.gdes[ii].cf_reduce)
- && (this.gdes[i].start_orig === this.gdes[ii].start_orig)
- && (this.gdes[i].end_orig === this.gdes[ii].end_orig)
- && (this.gdes[i].step_orig === this.gdes[ii].step_orig)) {
- this.gdes[i].start = this.gdes[ii].start;
- this.gdes[i].end = this.gdes[ii].end;
- this.gdes[i].step = this.gdes[ii].step;
- this.gdes[i].ds_cnt = this.gdes[ii].ds_cnt;
- this.gdes[i].ds_namv = this.gdes[ii].ds_namv;
- this.gdes[i].data = this.gdes[ii].data;
- this.gdes[i].data_first = 0;
- skip = true;
- }
- if (skip) break;
- }
-
- if (!skip) {
- var ft_step = this.gdes[i].step; /* ft_step will record what we got from fetch */
- ft_step = this.rrd_fetch(this.gdes[i], ft_step);
- if (ft_step < 0)
- return -1;
- this.gdes[i].data_first = 1;
- if (ft_step < this.gdes[i].step) {
- this.reduce_data(this.gdes[i], ft_step);
- } else {
- this.gdes[i].step = ft_step;
- }
- }
- /* lets see if the required data source is really there */
- for (var ii = 0; ii < this.gdes[i].ds_cnt; ii++) {
- if (this.gdes[i].ds_namv[ii] === this.gdes[i].ds_nam) {
- this.gdes[i].ds = ii;
- break;
- }
- }
-
- if (this.gdes[i].ds === -1)
- throw "No DS called '"+this.gdes[i].ds_nam+"' in '"+this.gdes[i].rrd+"'";
- }
-
- return 0;
- },
- lcd: function (num)
- {
- var rest;
- for (var i = 0; num[i + 1] != 0; i++) {
- do {
- rest = num[i] % num[i + 1];
- num[i] = num[i + 1];
- num[i + 1] = rest;
- } while (rest != 0); // FIXME infinite loop ?
- num[i + 1] = num[i];
- }
- return num[i];
- },
- data_calc: function()
- {
- var dataidx;
- var now;
-
- var rpnstack;
-
- for (var gdi = 0, gdes_c = this.gdes.length; gdi < gdes_c; gdi++) {
- switch (this.gdes[gdi].gf) {
- case RRDGraphDesc.GF.XPORT:
- break;
- case RRDGraphDesc.GF.SHIFT:
- var vdp = this.gdes[this.gdes[gdi].vidx];
- /* remove current shift */
- vdp.start -= vdp.shift;
- vdp.end -= vdp.shift;
-
- if (this.gdes[gdi].shidx >= 0) vdp.shift = this.gdes[this.gdes[gdi].shidx].vf.val;
- else vdp.shift = this.gdes[gdi].shval;
-
- vdp.shift = (vdp.shift / vdp.step) * vdp.step;
-
- vdp.start += vdp.shift;
- vdp.end += vdp.shift;
- break;
- case RRDGraphDesc.GF.VDEF:
- this.gdes[gdi].ds_cnt = 0;
- if (this.vdef_calc(gdi))
- throw "Error processing VDEF '"+this.gdes[gdi].vname+"%s'";
- break;
- case RRDGraphDesc.GF.CDEF:
- this.gdes[gdi].ds_cnt = 1;
- this.gdes[gdi].ds = 0;
- this.gdes[gdi].data_first = 1;
- this.gdes[gdi].start = 0;
- this.gdes[gdi].end = 0;
- var steparray = [];
- var stepcnt = 0;
- dataidx = -1;
-
- var rpnp = this.gdes[gdi].rpnp.rpnp;
- for (var rpi = 0; rpnp[rpi].op != RRDRpn.OP.END; rpi++) {
- if (rpnp[rpi].op === RRDRpn.OP.VARIABLE || rpnp[rpi].op === RRDRpn.OP.PREV_OTHER) {
- var ptr = rpnp[rpi].ptr;
- if (this.gdes[ptr].ds_cnt === 0) { /* this is a VDEF data source */
- rpnp[rpi].val = this.gdes[ptr].vf.val;
- rpnp[rpi].op = RRDRpn.OP.NUMBER;
- } else { /* normal variables and PREF(variables) */
- ++stepcnt;
- steparray[stepcnt - 1] = this.gdes[ptr].step;
-
- if (this.gdes[gdi].start < this.gdes[ptr].start)
- this.gdes[gdi].start = this.gdes[ptr].start;
- if (this.gdes[gdi].end === 0 || this.gdes[gdi].end > this.gdes[ptr].end)
- this.gdes[gdi].end = this.gdes[ptr].end;
-
- rpnp[rpi].data = this.gdes[ptr].data;
- rpnp[rpi].pdata = this.gdes[ptr].ds;
- rpnp[rpi].step = this.gdes[ptr].step;
- rpnp[rpi].ds_cnt = this.gdes[ptr].ds_cnt;
- }
- }
- }
- /* move the data pointers to the correct period */
- for (var rpi = 0; rpnp[rpi].op != RRDRpn.OP.END; rpi++) {
- if (rpnp[rpi].op === RRDRpn.OP.VARIABLE || rpnp[rpi].op === RRDRpn.OP.PREV_OTHER) {
- var ptr = rpnp[rpi].ptr;
- var diff = this.gdes[gdi].start - this.gdes[ptr].start;
-
- if (diff > 0) rpnp[rpi].pdata += (diff / this.gdes[ptr].step) * this.gdes[ptr].ds_cnt;
- }
- }
-
- if (steparray === null) {
- throw "rpn expressions without DEF or CDEF variables are not supported";
- }
- steparray[stepcnt] = 0;
- this.gdes[gdi].step = this.lcd(steparray);
- this.gdes[gdi].data = [];
-
- for (now = this.gdes[gdi].start + this.gdes[gdi].step; now <= this.gdes[gdi].end; now += this.gdes[gdi].step) {
- if (this.gdes[gdi].rpnp.calc(now, this.gdes[gdi].data, ++dataidx) === -1)
- return -1;
- }
- break;
- default:
- continue;
- }
- }
- return 0;
- },
- data_proc: function()
- {
- var pixstep = (this.end - this.start) / this.xsize;
- var paintval;
- var minval = Number.NaN, maxval = Number.NaN;
- var gr_time;
-
- /* memory for the processed data */
-
- for (var i = 0, gdes_c = this.gdes.length; i < gdes_c; i++) {
- if ((this.gdes[i].gf === RRDGraphDesc.GF.LINE) || (this.gdes[i].gf === RRDGraphDesc.GF.AREA) || (this.gdes[i].gf === RRDGraphDesc.GF.TICK)) {
- this.gdes[i].p_data = [];
- }
- }
-
- for (var i = 0; i < this.xsize; i++) { /* for each pixel */
- var vidx;
- gr_time = this.start + pixstep * i; /* time of the current step */
- paintval = 0.0;
-
- for (var ii = 0 , gdes_c = this.gdes.length; ii < gdes_c; ii++) {
- var value;
- switch (this.gdes[ii].gf) {
- case RRDGraphDesc.GF.LINE:
- case RRDGraphDesc.GF.AREA:
- case RRDGraphDesc.GF.TICK:
- if (!this.gdes[ii].stack) paintval = 0.0;
- value = this.gdes[ii].yrule;
- if (isNaN(value) || (this.gdes[ii].gf === RRDGraphDesc.GF.TICK)) {
- vidx = this.gdes[ii].vidx;
- if (this.gdes[vidx].gf === RRDGraphDesc.GF.VDEF) {
- value = this.gdes[vidx].vf.val;
- } else if (gr_time >= this.gdes[vidx].start && gr_time < this.gdes[vidx].end) {
- value = this.gdes[vidx].data[Math.floor((gr_time - this.gdes[vidx].start) / this.gdes[vidx].step) * this.gdes[vidx].ds_cnt + this.gdes[vidx].ds];
- } else {
- value = Number.NaN;
- }
- }
- if (!isNaN(value)) {
- paintval += value;
- this.gdes[ii].p_data[i] = paintval;
- if (isFinite(paintval) && this.gdes[ii].gf != RRDGraphDesc.GF.TICK) {
- if ((isNaN(minval) || paintval < minval) && !(this.logarithmic && paintval <= 0.0))
- minval = paintval;
- if (isNaN(maxval) || paintval > maxval)
- maxval = paintval;
- }
- } else {
- this.gdes[ii].p_data[i] = Number.NaN;
- }
- break;
- case RRDGraphDesc.GF.STACK:
- throw "STACK should already be turned into LINE or AREA here";
- break;
- default:
- break;
- }
- }
- }
-
- if (this.logarithmic) {
- if (isNaN(minval) || isNaN(maxval) || maxval <= 0) {
- minval = 0.0;
- maxval = 5.1;
- }
- if (minval <= 0) minval = maxval / 10e8;
- } else {
- if (isNaN(minval) || isNaN(maxval)) {
- minval = 0.0;
- maxval = 1.0;
- }
- }
-
- if (isNaN(this.minval) || ((!this.rigid) && this.minval > minval)) {
- if (this.logarithmic) this.minval = minval / 2.0;
- else this.minval = minval;
- }
- if (isNaN(this.maxval) || (!this.rigid && this.maxval < maxval)) {
- if (this.logarithmic) this.maxval = maxval * 2.0;
- else this.maxval = maxval;
- }
-
- if (this.minval > this.maxval) {
- if (this.minval > 0) this.minval = 0.99 * this.maxval;
- else this.minval = 1.01 * this.maxval;
- }
-
- if (this.AlmostEqual2sComplement(this.minval, this.maxval, 4)) {
- if (this.maxval > 0) this.maxval *= 1.01;
- else this.maxval *= 0.99;
-
- if (this.AlmostEqual2sComplement(this.maxval, 0, 4)) this.maxval = 1.0;
- }
- return 0;
- },
- leg_place: function (calc_width)
- {
- var interleg = this.TEXT.LEGEND.size * 1.5;
- var border = this.TEXT.LEGEND.size * 1.5;
- var fill = 0, fill_last;
- var legendwidth; // = this.ximg - 2 * border;
- var leg_c = 0;
- var leg_x = border;
- var leg_y = 0; //this.yimg;
- var leg_y_prev = 0; // this.yimg;
- var leg_cc;
- var glue = 0;
- var ii, mark = 0;
- var default_txtalign = RRDGraphDesc.TXA.JUSTIFIED; /*default line orientation */
- var legspace;
- var tab;
- var saved_legend;
-
- if(calc_width) legendwidth = 0;
- else legendwidth = this.legendwidth - 2 * border;
-
- if (!this.no_legend && !this.only_graph) {
- legspace = [];
- for (var i = 0 , gdes_c = this.gdes.length; i < gdes_c; i++) {
- var prt_fctn; /*special printfunctions */
- if(calc_width) saved_legend = this.gdes[i].legend;
- fill_last = fill;
- if (this.gdes[i].gf === RRDGraphDesc.GF.TEXTALIGN)
- default_txtalign = this.gdes[i].txtalign;
-
- if (!this.force_rules_legend) {
- if (this.gdes[i].gf === RRDGraphDesc.GF.HRULE && (this.gdes[i].yrule < this.minval || this.gdes[i].yrule > this.maxval))
- this.gdes[i].legend = null;
- if (this.gdes[i].gf === RRDGraphDesc.GF.VRULE && (this.gdes[i].xrule < this.start || this.gdes[i].xrule > this.end))
- this.gdes[i].legend = null;
- }
- this.gdes[i].legend = this.gdes[i].legend.replace(/\\t/gi, "\t"); /* turn \\t into tab */
-
- leg_cc = this.gdes[i].legend.length;
- /* is there a controle code at the end of the legend string ? */
- if (leg_cc >= 2 && this.gdes[i].legend.charAt(leg_cc - 2) === '\\') {
- prt_fctn = this.gdes[i].legend.charAt(leg_cc - 1);
- leg_cc -= 2;
- this.gdes[i].legend = this.gdes[i].legend.substr(0,leg_cc);
- } else {
- prt_fctn = null;
- }
- /* only valid control codes */
- if (prt_fctn != 'l' && prt_fctn != 'n' && prt_fctn != 'r' && prt_fctn != 'j' && prt_fctn != 'c' &&
- prt_fctn != 'u' && prt_fctn != 's' && prt_fctn != null && prt_fctn != 'g') {
- throw "Unknown control code at the end of "+this.gdes[i].legend+": "+prt_fctn;
- }
- /* \n -> \l */
- if (prt_fctn === 'n') prt_fctn = 'l';
-
- /* remove exess space from the end of the legend for \g */
- while (prt_fctn === 'g' && leg_cc > 0 && this.gdes[i].legend.charAt(leg_cc - 1) === ' ') {
- leg_cc--;
- this.gdes[i].legend = this.gdes[i].legend.substr(0,leg_cc);
- }
-
- if (leg_cc != 0) {
- legspace[i] = (prt_fctn === 'g' ? 0 : interleg);
- if (fill > 0) fill += legspace[i];
- fill += this.gfx_get_text_width(fill + border, this.TEXT.LEGEND, this.tabwidth, this.gdes[i].legend);
- leg_c++;
- } else {
- legspace[i] = 0;
- }
- /* who said there was a special tag ... ? */
- if (prt_fctn === 'g') prt_fctn = null;
-
- if (prt_fctn === null) {
- if(calc_width && (fill > legendwidth)) legendwidth = fill;
-
- if (i === gdes_c - 1 || fill > legendwidth) {
- switch (default_txtalign) {
- case RRDGraphDesc.TXA.RIGHT:
- prt_fctn = 'r';
- break;
- case RRDGraphDesc.TXA.CENTER:
- prt_fctn = 'c';
- break;
- case RRDGraphDesc.TXA.JUSTIFIED:
- prt_fctn = 'j';
- break;
- default:
- prt_fctn = 'l';
- break;
- }
- }
- /* is it time to place the legends ? */
- if (fill > legendwidth) {
- if (leg_c > 1) {
- /* go back one */
- i--;
- fill = fill_last;
- leg_c--;
- }
- }
- if (leg_c === 1 && prt_fctn === 'j') {
- prt_fctn = 'l';
- }
- }
-
- if (prt_fctn != null) {
- leg_x = border;
- if (leg_c >= 2 && prt_fctn === 'j') {
- glue = (legendwidth - fill) / (leg_c - 1);
- } else {
- glue = 0;
- }
- if (prt_fctn === 'c')
- leg_x = (legendwidth - fill) / 2.0;
- if (prt_fctn === 'r')
- leg_x = legendwidth - fill + border;
- for (ii = mark; ii <= i; ii++) {
- if (this.gdes[ii].legend === '') continue;
- this.gdes[ii].leg_x = leg_x;
- this.gdes[ii].leg_y = leg_y + border;
- leg_x += this.gfx_get_text_width(leg_x, this.TEXT.LEGEND, this.tabwidth, this.gdes[ii].legend) + legspace[ii] + glue;
- }
- leg_y_prev = leg_y;
- if (leg_x > border || prt_fctn === 's') leg_y += this.TEXT.LEGEND.size * 1.4;
- if (prt_fctn === 's') leg_y -= this.TEXT.LEGEND.size;
- if (prt_fctn === 'u') leg_y -= this.TEXT.LEGEND.size * 1.4;
-
- if(calc_width && (fill > legendwidth)) legendwidth = fill;
- fill = 0;
- leg_c = 0;
- mark = ii;
- }
-
- if(calc_width) this.gdes[i].legend = saved_legend;
- }
- if(calc_width) this.legendwidth = legendwidth + 2 * border;
- else this.legendheight = leg_y + border * 0.6; // FIXME 0.6 ??
- }
- return 0;
- },
- axis_paint: function()
- {
- this.gfx_line(this.xorigin - 4, this.yorigin,
- this.xorigin + this.xsize + 4, this.yorigin,
- this.MGRIDWIDTH, this.GRC.AXIS);
-
- this.gfx_line(this.xorigin, this.yorigin + 4,
- this.xorigin, this.yorigin - this.ysize - 4,
- this.MGRIDWIDTH, this.GRC.AXIS);
-
- this.gfx_new_area(this.xorigin + this.xsize + 2, this.yorigin - 3,
- this.xorigin + this.xsize + 2,
- this.yorigin + 3, this.xorigin + this.xsize + 7, this.yorigin,
- this.GRC.ARROW);
- this.gfx_close_path();
-
- this.gfx_new_area(this.xorigin - 3, this.yorigin - this.ysize - 2,
- this.xorigin + 3, this.yorigin - this.ysize - 2,
- this.xorigin, this.yorigin - this.ysize - 7,
- this.GRC.ARROW);
- this.gfx_close_path();
-
- if (this.second_axis_scale != 0){
- this.gfx_line (this.xorigin+this.xsize,this.yorigin+4,
- this.xorigin+this.xsize,this.yorigin-this.ysize-4,
- MGRIDWIDTH, this.graph_col[GRC_AXIS]);
- this.gfx_new_area (this.xorigin+this.xsize-2, this.yorigin-this.ysize-2,
- this.xorigin+this.xsize+3, this.yorigin-this.ysize-2,
- this.xorigin+this.xsize, this.yorigin-this.ysize-7, /* LINEOFFSET */
- this.GRC.ARROW);
- this.gfx_close_path();
- }
- },
- frexp10: function (x)
- {
- var mnt;
- var iexp;
-
- iexp = Math.floor(Math.log(Math.abs(x)) / Math.LN10);
- mnt = x / Math.pow(10.0, iexp);
- if (mnt >= 10.0) {
- iexp++;
- mnt = x / Math.pow(10.0, iexp);
- }
- return [mnt, iexp];
- },
- horizontal_log_grid: function ()
- {
- var yloglab = [
- [ 1.0, 10., 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ],
- [ 1.0, 5.0, 10., 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ],
- [ 1.0, 2.0, 5.0, 7.0, 10., 0.0, 0.0, 0.0, 0.0, 0.0 ],
- [ 1.0, 2.0, 4.0, 6.0, 8.0, 10., 0.0, 0.0, 0.0, 0.0 ],
- [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10. ],
- [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] /* last line */
- ];
- var i, j, val_exp, min_exp;
- var nex; /* number of decades in data */
- var logscale; /* scale in logarithmic space */
- var exfrac = 1; /* decade spacing */
- var mid = -1; /* row in yloglab for major grid */
- var mspac; /* smallest major grid spacing (pixels) */
- var flab; /* first value in yloglab to use */
- var value, tmp, pre_value;
- var X0, X1, Y0;
- var graph_label;
-
- nex = Math.log(this.maxval / this.minval)/Math.LN10;
- logscale = this.ysize / nex;
- /* major spacing for data with high dynamic range */
- while (logscale * exfrac < 2.3 * this.TEXT.LEGEND.size) { // FIXME 3 -> 2.34 ??
- if (exfrac === 1) exfrac = 2.3; // ??? 3 -> 2.34
- else exfrac += 2.3 ; // 3-> 2.34
- }
- /* major spacing for less dynamic data */
- do {
- mid++;
- for (i = 0; yloglab[mid][i + 1] < 10.0; i++);
- mspac = logscale * Math.log(10.0 / yloglab[mid][i])/Math.LN10;
- } while (mspac > 1.56 * this.TEXT.LEGEND.size && yloglab[mid][0] > 0); // FIXME 2->1.56 ??
- if (mid) mid--;
- /* find first value in yloglab */
- //for (flab = 0; yloglab[mid][flab] < 10 && this.frexp10(this.minval,tmp) > yloglab[mid][flab]; flab++);
- flab = -1;
- do {
- var ret;
- flab++;
- // [ret, tmp] = this.frexp10(this.minval);
- var dummy = this.frexp10(this.minval); ret = dummy[0]; tmp = dummy[1];
- } while (yloglab[mid][flab] < 10 && ret > yloglab[mid][flab]);
-
- if (yloglab[mid][flab] === 10.0) {
- tmp += 1.0;
- flab = 0;
- }
- val_exp = tmp;
- if (val_exp % exfrac) val_exp += Math.abs(-val_exp % exfrac);
- X0 = this.xorigin;
- X1 = this.xorigin + this.xsize;
- /* draw grid */
- pre_value = Number.NaN;
-
- while (1) {
- value = yloglab[mid][flab] * Math.pow(10.0, val_exp);
- if (this.AlmostEqual2sComplement(value, pre_value, 4)) // FIXME
- break; /* it seems we are not converging */
- pre_value = value;
- Y0 = this.ytr(value);
- if (Math.floor(Y0 + 0.5) <= this.yorigin - this.ysize)
- break;
- /* major grid line */
- this.gfx_line(X0 - 2, Y0, X0, Y0, this.MGRIDWIDTH, this.GRC.MGRID);
- this.gfx_line(X1, Y0, X1 + 2, Y0, this.MGRIDWIDTH, this.GRC.MGRID);
- this.gfx_dashed_line(X0 - 2, Y0, X1 + 2, Y0, this.MGRIDWIDTH, this.GRC.MGRID, this.grid_dash_on, this.grid_dash_off);
- /* label */
- if (this.force_units_si) {
- var scale;
- var pvalue;
- var symbol;
-
- scale = Math.floor(val_exp / 3.0);
- if (value >= 1.0) pvalue = Math.pow(10.0, val_exp % 3);
- else pvalue = Math.pow(10.0, ((val_exp + 1) % 3) + 2);
- pvalue *= yloglab[mid][flab];
-
- if (((scale + this.si_symbcenter) < this.si_symbol.length) && ((scale + this.si_symbcenter) >= 0))
- symbol = this.si_symbol[scale + this.si_symbcenter];
- else
- symbol = '?';
- graph_label = this.sprintf("%3.0f %s", pvalue, symbol);
- } else {
- graph_label = this.sprintf("%3.0e", value);
- }
- if (this.second_axis_scale != 0){
- var graph_label_right;
- var sval = value*this.second_axis_scale+this.second_axis_shift;
- if (!this.second_axis_format[0]){
- if (this.force_units_si) {
- var mfac = 1;
- var symb = '';
- //[sval, symb, mfac ] = this.auto_scale(sval, symb, mfac);
- var dummy = this.auto_scale(sval, symb, mfac);
- sval = dummy[0];
- symb = dummy[1];
- mfac = dummy[2];
- graph_label_right = this.sprintf("%4.0f %s", sval,symb);
- } else {
- graph_label_right = this.sprintf("%3.0e", sval);
- }
- } else {
- graph_label_right = this.sprintf(this.second_axis_format,sval,"");
- }
- this.gfx_text( X1+7, Y0, this.GRC.FONT, this.TEXT.AXIS, this.tabwidth,0.0, this.GFX_H.LEFT, this.GFX_V.CENTER, graph_label_right );
- }
-
- this.gfx_text(X0 - this.TEXT.AXIS.size, Y0, this.GRC.FONT, this.TEXT.AXIS, this.tabwidth, 0.0, this.GFX_H.RIGHT, this.GFX_V.CENTER, graph_label);
- if (mid < 4 && exfrac === 1) { /* minor grid */
- if (flab === 0) { /* find first and last minor line behind current major line * i is the first line and j tha last */
- min_exp = val_exp - 1;
- for (i = 1; yloglab[mid][i] < 10.0; i++) {};
- i = yloglab[mid][i - 1] + 1;
- j = 10;
- } else {
- min_exp = val_exp;
- i = yloglab[mid][flab - 1] + 1;
- j = yloglab[mid][flab];
- }
- for (; i < j; i++) { /* draw minor lines below current major line */
- value = i * Math.pow(10.0, min_exp);
- if (value < this.minval) continue;
- Y0 = this.ytr(value);
- if (Math.floor(Y0 + 0.5) <= this.yorigin - this.ysize) break;
- this.gfx_line(X0 - 2, Y0, X0, Y0, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_line(X1, Y0, X1 + 2, Y0, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_dashed_line(X0 - 1, Y0, X1 + 1, Y0, this.GRIDWIDTH, this.GRC.GRID, this.grid_dash_on, this.grid_dash_off);
- }
- } else if (exfrac > 1) {
- for (i = val_exp - exfrac / 3 * 2; i < val_exp; i += exfrac / 3) {
- value = Math.pow(10.0, i);
- if (value < this.minval) continue;
- Y0 = this.ytr(value);
- if (Math.floor(Y0 + 0.5) <= this.yorigin - this.ysize) break;
- this.gfx_line(X0 - 2, Y0, X0, Y0, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_line(X1, Y0, X1 + 2, Y0, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_dashed_line(X0 - 1, Y0, X1 + 1, Y0, this.GRIDWIDTH, this.GRC.GRID, this.grid_dash_on, this.grid_dash_off);
- }
- }
- if (yloglab[mid][++flab] === 10.0) { /* next decade */
- flab = 0;
- val_exp += exfrac;
- }
- }
- if (mid < 4 && exfrac === 1) { /* draw minor lines after highest major line */
- if (flab === 0) { /* find first and last minor line below current major line * i is the first line and j tha last */
- min_exp = val_exp - 1;
- for (i = 1; yloglab[mid][i] < 10.0; i++) {};
- i = yloglab[mid][i - 1] + 1;
- j = 10;
- } else {
- min_exp = val_exp;
- i = yloglab[mid][flab - 1] + 1;
- j = yloglab[mid][flab];
- }
- for (; i < j; i++) { /* draw minor lines below current major line */
- value = i * Math.pow(10.0, min_exp);
- if (value < this.minval) continue;
- Y0 = this.ytr(value);
- if (Math.floor(Y0 + 0.5) <= this.yorigin - this.ysize) break;
- this.gfx_line(X0 - 2, Y0, X0, Y0, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_line(X1, Y0, X1 + 2, Y0, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_dashed_line(X0 - 1, Y0, X1 + 1, Y0, this.GRIDWIDTH, this.GRC.GRID, this.grid_dash_on, this.grid_dash_off);
- }
- } else if (exfrac > 1) { /* fancy minor gridlines */
- for (i = val_exp - exfrac / 3 * 2; i < val_exp; i += exfrac / 3) {
- value = Math.pow(10.0, i);
- if (value < this.minval) continue;
- Y0 = this.ytr(value);
- if (Math.floor(Y0 + 0.5) <= this.yorigin - this.ysize) break;
- this.gfx_line(X0 - 2, Y0, X0, Y0, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_line(X1, Y0, X1 + 2, Y0, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_dashed_line(X0 - 1, Y0, X1 + 1, Y0, this.GRIDWIDTH, this.GRC.GRID, this.grid_dash_on, this.grid_dash_off);
- }
- }
- return 1;
- },
- vertical_grid: function()
- {
- var xlab_sel; /* which sort of label and grid ? */
- var ti, tilab, timajor;
- var factor;
- var graph_label;
- var X0, Y0, Y1; /* points for filled graph and more */
-
- /* the type of time grid is determined by finding the number of seconds per pixel in the graph */
- if (this.xlab_user.minsec === -1) {
- factor = (this.end - this.start) / this.xsize;
- xlab_sel = 0;
-
- while (this.xlab[xlab_sel + 1].minsec != -1 && this.xlab[xlab_sel + 1].minsec <= factor) xlab_sel++;
- if (xlab_sel === 0) xlab_sel=1; // FIXME XXX XXX xlab_sel == 0 ???
- while (this.xlab[xlab_sel - 1].minsec === this.xlab[xlab_sel].minsec && this.xlab[xlab_sel].length > (this.end - this.start)) xlab_sel--;
- this.xlab_user = this.xlab[xlab_sel];
-
- }
- Y0 = this.yorigin;
- Y1 = this.yorigin - this.ysize;
-
- if (!(this.no_minor)) {
- for ( ti = this.find_first_time(this.start, this.xlab_user.gridtm, this.xlab_user.gridst),
- timajor = this.find_first_time(this.start, this.xlab_user.mgridtm, this.xlab_user.mgridst);
- ti < this.end && ti != -1;
- ti = this.find_next_time(ti, this.xlab_user.gridtm, this.xlab_user.gridst)) {
- if (ti < this.start || ti > this.end) continue;
- while (timajor < ti && timajor != -1) timajor = this.find_next_time(timajor, this.xlab_user.mgridtm, this.xlab_user.mgridst);
- if (timajor === -1) break;
- if (ti === timajor) continue;
- X0 = this.xtr(ti);
- this.gfx_line(X0, Y1 - 2, X0, Y1, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_line(X0, Y0, X0, Y0 + 2, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_dashed_line(X0, Y0 + 1, X0, Y1 - 1, this.GRIDWIDTH, this.GRC.GRID, this.grid_dash_on, this.grid_dash_off);
- }
- }
-
- for ( ti = this.find_first_time(this.start, this.xlab_user.mgridtm, this.xlab_user.mgridst);
- ti < this.end && ti != -1;
- ti = this.find_next_time(ti, this.xlab_user.mgridtm, this.xlab_user.mgridst)
- ) {
- if (ti < this.start || ti > this.end) continue;
- X0 = this.xtr(ti);
- this.gfx_line(X0, Y1 - 2, X0, Y1, this.MGRIDWIDTH, this.GRC.MGRID);
- this.gfx_line(X0, Y0, X0, Y0 + 3, this.MGRIDWIDTH, this.GRC.MGRID);
- this.gfx_dashed_line(X0, Y0 + 3, X0, Y1 - 2, this.MGRIDWIDTH,
- this.GRC.MGRID, this.grid_dash_on, this.grid_dash_off);
- }
-
- for ( ti = this.find_first_time(this.start - this.xlab_user.precis / 2, this.xlab_user.labtm, this.xlab_user.labst);
- (ti <= this.end - this.xlab_user.precis / 2) && ti != -1;
- ti = this.find_next_time(ti, this.xlab_user.labtm, this.xlab_user.labst)
- ) {
- tilab = ti + this.xlab_user.precis / 2;
- if (tilab < this.start || tilab > this.end)
- continue;
- //localtime_r(&tilab, &tm); FIXME
- //strftime(graph_label, 99, this.xlab_user.stst, &tm); FIXME
- graph_label = this.xlab_user.stst(new Date(tilab*1000));
- this.gfx_text(this.xtr(tilab), Y0 + 3, this.GRC.FONT,
- this.TEXT.AXIS, this.tabwidth, 0.0,
- this.GFX_H.CENTER, this.GFX_V.TOP, graph_label);
- }
- },
- auto_scale: function (value, symb_ptr, magfact)
- {
- var symbol = [
- 'a', /* 10e-18 Atto */
- 'f', /* 10e-15 Femto */
- 'p', /* 10e-12 Pico */
- 'n', /* 10e-9 Nano */
- 'u', /* 10e-6 Micro */
- 'm', /* 10e-3 Milli */
- ' ', /* Base */
- 'k', /* 10e3 Kilo */
- 'M', /* 10e6 Mega */
- 'G', /* 10e9 Giga */
- 'T', /* 10e12 Tera */
- 'P', /* 10e15 Peta */
- 'E' /* 10e18 Exa */
- ];
-
- var symbcenter = 6;
- var sindex;
-
- if (value === 0.0 || isNaN(value)) {
- sindex = 0;
- magfact = 1.0;
- } else {
- sindex = Math.floor((Math.log(Math.abs(value))/Math.LN10) / (Math.log(this.base)/Math.LN10));
- magfact = Math.pow(this.base, sindex);
- value /= magfact;
- }
- if (sindex <= symbcenter && sindex >= -symbcenter) {
- symb_ptr = symbol[sindex + symbcenter];
- } else {
- symb_ptr = '?';
- }
- return [value, symb_ptr, magfact];
- },
- si_unit: function()
- {
- var digits;
- var viewdigits = 0;
-
- digits = Math.floor(Math.log(Math.max(Math.abs(this.minval), Math.abs(this.maxval))) / Math.log(this.base));
-
- if (this.unitsexponent != 9999) {
- /* unitsexponent = 9, 6, 3, 0, -3, -6, -9, etc */
- viewdigits = Math.floor(this.unitsexponent / 3);
- } else {
- viewdigits = digits;
- }
-
- this.magfact = Math.pow(this.base, digits);
-
- this.viewfactor = this.magfact / Math.pow(this.base, viewdigits);
-
- if (((viewdigits + this.si_symbcenter) < this.si_symbol.length) && ((viewdigits + this.si_symbcenter) >= 0))
- this.symbol = this.si_symbol[viewdigits + this.si_symbcenter];
- else
- this.symbol = '?';
- },
- expand_range: function ()
- {
- var sensiblevalues = [ 1000.0, 900.0, 800.0, 750.0, 700.0, 600.0, 500.0, 400.0, 300.0, 250.0, 200.0, 125.0, 100.0, 90.0, 80.0, 75.0, 70.0, 60.0, 50.0, 40.0, 30.0, 25.0, 20.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.5, 3.0, 2.5, 2.0, 1.8, 1.5, 1.2, 1.0, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0.0, -1 ];
- var scaled_min, scaled_max;
- var adj;
- var i;
-
- if (isNaN(this.ygridstep)) {
- if (this.alt_autoscale) {
- var delt, fact;
-
- delt = this.maxval - this.minval;
- adj = delt * 0.1;
- fact = 2.0 * Math.pow(10.0, Math.floor(Math.log(Math.max(Math.abs(this.minval), Math.abs(this.maxval)) / this.magfact)/Math.LN10) - 2);
- if (delt < fact) adj = (fact - delt) * 0.55;
- this.minval -= adj;
- this.maxval += adj;
- } else if (this.alt_autoscale_min) {
- adj = (this.maxval - this.minval) * 0.1;
- this.minval -= adj;
- } else if (this.alt_autoscale_max) {
- adj = (this.maxval - this.minval) * 0.1;
- this.maxval += adj;
- } else {
- scaled_min = this.minval / this.magfact;
- scaled_max = this.maxval / this.magfact;
-
- for (i = 1; sensiblevalues[i] > 0; i++) {
- if (sensiblevalues[i - 1] >= scaled_min && sensiblevalues[i] <= scaled_min)
- this.minval = sensiblevalues[i] * this.magfact;
- if (-sensiblevalues[i - 1] <= scaled_min && -sensiblevalues[i] >= scaled_min)
- this.minval = -sensiblevalues[i - 1] * this.magfact;
- if (sensiblevalues[i - 1] >= scaled_max && sensiblevalues[i] <= scaled_max)
- this.maxval = sensiblevalues[i - 1] * this.magfact;
- if (-sensiblevalues[i - 1] <= scaled_max && -sensiblevalues[i] >= scaled_max)
- this.maxval = -sensiblevalues[i] * this.magfact;
- }
- }
- } else {
- this.minval = this.ylabfact * this.ygridstep * Math.floor(this.minval / (this.ylabfact * this.ygridstep));
- this.maxval = this.ylabfact * this.ygridstep * Math.ceil(this.maxval / (this.ylabfact * this.ygridstep));
- }
- },
- calc_horizontal_grid: function()
- {
- var range;
- var scaledrange;
- var pixel, i;
- var gridind = 0;
- var decimals, fractionals;
-
- this.ygrid_scale.labfact = 2;
- range = this.maxval - this.minval;
- scaledrange = range / this.magfact;
- if (isNaN(scaledrange) || !isFinite(scaledrange)) {
- return false;
- }
-
- pixel = 1;
- if (isNaN(this.ygridstep)) {
- if (this.alt_ygrid) {
- decimals = Math.ceil(Math.log(Math.max(Math.abs(this.maxval), Math.abs(this.minval)) * this.viewfactor / this.magfact)/Math.LN10);
- if (decimals <= 0) decimals = 1;
- this.ygrid_scale.gridstep = Math.pow(10, Math.floor(Math.log(range * this.viewfactor / this.magfact)/Math.LN10)) / this.viewfactor * this.magfact;
- if (this.ygrid_scale.gridstep === 0) this.ygrid_scale.gridstep = 0.1;
- if (range / this.ygrid_scale.gridstep < 5 && this.ygrid_scale.gridstep >= 30)
- this.ygrid_scale.gridstep /= 10;
- if (range / this.ygrid_scale.gridstep > 15)
- this.ygrid_scale.gridstep *= 10;
- if (range / this.ygrid_scale.gridstep > 5) {
- this.ygrid_scale.labfact = 1;
- if (range / this.ygrid_scale.gridstep > 8 || this.ygrid_scale.gridstep < 1.8 * this.TEXT.AXIS.size) // 1.8
- this.ygrid_scale.labfact = 2;
- } else {
- this.ygrid_scale.gridstep /= 5;
- this.ygrid_scale.labfact = 5;
- }
-
- fractionals = Math.floor(Math.log(this.ygrid_scale.gridstep * this.ygrid_scale.labfact * this.viewfactor / this.magfact)/Math.LN10);
- if (fractionals < 0) { /* small amplitude. */
- var len = decimals - fractionals + 1;
- if (this.unitslength < len + 2) this.unitslength = len + 2;
- this.ygrid_scale.labfmt = this.sprintf("%%%d.%df%s", len, -fractionals, (this.symbol != ' ' ? " %s" : ""));
- } else {
- var len = decimals + 1;
- if (this.unitslength < len + 2) this.unitslength = len + 2;
- this.ygrid_scale.labfmt = this.sprintf("%%%d.0f%s", len, (this.symbol != ' ' ? " %s" : ""));
- }
- } else { /* classic rrd grid */
- for (i = 0; this.ylab[i].grid > 0; i++) {
- pixel = this.ysize / (scaledrange / this.ylab[i].grid);
- gridind = i;
- if (pixel >= 5) break;
- }
- for (i = 0; i < 4; i++) {
- if (pixel * this.ylab[gridind].lfac[i] >= 1.8 * this.TEXT.AXIS.size) { // 1.8
- this.ygrid_scale.labfact = this.ylab[gridind].lfac[i];
- break;
- }
- }
- this.ygrid_scale.gridstep = this.ylab[gridind].grid * this.magfact;
- }
- } else {
- this.ygrid_scale.gridstep = this.ygridstep;
- this.ygrid_scale.labfact = this.ylabfact;
- }
- return true;
- },
- draw_horizontal_grid: function()
- {
- var i;
- var scaledstep;
- var graph_label;
- var nlabels = 0;
- var X0 = this.xorigin;
- var X1 = this.xorigin + this.xsize;
- var sgrid = Math.round(this.minval / this.ygrid_scale.gridstep - 1);
- var egrid = Math.round(this.maxval / this.ygrid_scale.gridstep + 1);
- var MaxY;
- var second_axis_magfact = 0;
- var second_axis_symb = '';
- var Y0, YN;
- var sisym;
-
- scaledstep = this.ygrid_scale.gridstep / this.magfact * this.viewfactor;
- MaxY = scaledstep * egrid;
- for (i = sgrid; i <= egrid; i++) {
- Y0 = this.ytr(this.ygrid_scale.gridstep * i);
- YN = this.ytr(this.ygrid_scale.gridstep * (i + 1));
- if (Math.floor(Y0 + 0.5) >= this.yorigin - this.ysize && Math.floor(Y0 + 0.5) <= this.yorigin) {
- if (i % this.ygrid_scale.labfact === 0 || (nlabels === 1 && (YN < this.yorigin - this.ysize || YN > this.yorigin))) {
- if (this.symbol === ' ') {
- if (this.alt_ygridf) {
- graph_label = this.sprintf(this.ygrid_scale.labfmt, scaledstep * i); // FIXME
- } else {
- if (MaxY < 10) {
- graph_label = this.sprintf("%4.1f", scaledstep * i);
- //var dummy = scaledstep * i; // FIXME
- //graph_label = lpad(dummy.toFixed(1),' ',4);
- } else {
- graph_label = this.sprintf("%4.0f", scaledstep * i);
- //var dummy = scaledstep * i; // FIXME
- //graph_label = lpad(dummy.toFixed(),' ',4);
- }
- }
- } else {
- sisym = (i === 0 ? ' ' : this.symbol);
- if (this.alt_ygrid) {
- graph_label = this.sprintf(this.ygrid_scale.labfmt, scaledstep * i, sisym);
- } else {
- if (MaxY < 10) {
- graph_label = this.sprintf("%4.1f %s", scaledstep * i, sisym);
- //var dummy = scaledstep * i; // FIXME
- //graph_label = lpad(dummy.toFixed(1),' ',4)+' '+sisym;
- } else {
- graph_label = this.sprintf("%4.0f %s", scaledstep * i, sisym);
- //var dummy = scaledstep * i; // FIXME
- //graph_label = lpad(dummy.toFixed(),' ',4)+' '+sisym;
- }
- }
- }
- nlabels++;
- if (this.second_axis_scale != 0){
- var graph_label_right;
- sval = (this.ygrid_scale.gridstep *
- i *
- this.second_axis_scale +
- this.second_axis_shift);
-
- if (!this.second_axis_format) {
- if (!second_axis_magfact) {
- var dummy = (this.ygrid_scale.gridstep *
- (sgrid+egrid)/2.0 *
- this.second_axis_scale +
- this.second_axis_shift);
- var scaled = this.auto_scale(
- dummy, second_axis_symb,
- second_axis_magfact);
- dummy = scaled[0];
- second_axis_symb = scaled[1];
- second_axis_magfact = scaled[2];
- }
- sval /= second_axis_magfact;
- if(MaxY < 10) {
- graph_label_right = this.sprintf("%5.1f %s", sval, second_axis_symb);
- } else {
- graph_label_right = this.sprintf("%5.0f %s", sval, second_axis_symb);
- }
- } else {
- graph_label_right = this.sprintf(this.second_axis_format, sval);
- }
- this.gfx_text (X1+7, Y0, this.GRC.FONT, this.TEXT.AXIS, this.tabwidth, 0.0, this.GFX_H.LEFT, this.GFX_V.CENTER, graph_label_right );
- }
- this.gfx_text(X0 - this.TEXT.AXIS.size , Y0, this.GRC.FONT, this.TEXT.AXIS , this.tabwidth, 0.0, this.GFX_H.RIGHT, this.GFX_V.CENTER, graph_label);
- this.gfx_line(X0 - 2, Y0, X0, Y0, this.MGRIDWIDTH, this.GRC.MGRID);
- this.gfx_line(X1, Y0, X1 + 2, Y0, this.MGRIDWIDTH, this.GRC.MGRID);
- this.gfx_dashed_line(X0 - 2, Y0, X1 + 2, Y0, this.MGRIDWIDTH, this.GRC.MGRID, this.grid_dash_on, this.grid_dash_off);
- } else if (!this.no_minor) {
- this.gfx_line( X0 - 2, Y0, X0, Y0, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_line(X1, Y0, X1 + 2, Y0, this.GRIDWIDTH, this.GRC.GRID);
- this.gfx_dashed_line(X0 - 1, Y0, X1 + 1, Y0, this.GRIDWIDTH, this.GRC.GRID, this.grid_dash_on, this.grid_dash_off);
- }
- }
- }
- return 1;
- },
- grid_paint: function()
- {
- var i;
- var res = 0;
- var X0, Y0;
-
- if (this.draw_3d_border > 0) {
- i = this.draw_3d_border;
- this.gfx_new_area(0, this.yimg, i, this.yimg - i, i, i, this.GRC.SHADEA);
- this.gfx_add_point(this.ximg - i, i);
- this.gfx_add_point(this.ximg, 0);
- this.gfx_add_point(0, 0);
- this.gfx_close_path();
- this.gfx_new_area(i, this.yimg - i, this.ximg - i, this.yimg - i, this.ximg - i, i, this.GRC.SHADEB);
- this.gfx_add_point(this.ximg, 0);
- this.gfx_add_point(this.ximg, this.yimg);
- this.gfx_add_point(0, this.yimg);
- this.gfx_close_path();
- }
- if (this.draw_x_grid)
- this.vertical_grid();
- if (this.draw_y_grid) {
- if (this.logarithmic)
- res = this.horizontal_log_grid();
- else
- res = this.draw_horizontal_grid();
- /* dont draw horizontal grid if there is no min and max val */
- if (!res) {
- this.gfx_text(this.ximg / 2, (2 * this.yorigin - this.ysize) / 2,
- this.GRC.FONT, this.TEXT.AXIS,
- this.tabwidth, 0.0,
- this.GFX_H.CENTER, this.GFX_V.CENTER, 'No Data found');
- }
- }
-
- /* yaxis unit description */
- if (this.ylegend){
- this.gfx_text(this.xOriginLegendY+10, this.yOriginLegendY,
- this.GRC.FONT, this.TEXT.UNIT, this.tabwidth, this.YLEGEND_ANGLE,
- this.GFX_H.CENTER, this.GFX_V.CENTER, this.ylegend);
-
- }
- if (this.second_axis_legend){
- this.gfx_text(this.xOriginLegendY2+10, this.yOriginLegendY2,
- this.GRC.FONT, this.TEXT.UNIT, this.tabwidth, this.YLEGEND_ANGLE,
- this.GFX_H.CENTER, this.GFX_V.CENTER, this.second_axis_legend);
- }
-
- /* graph title */
- this.gfx_text(this.xOriginTitle, this.yOriginTitle+6,
- this.GRC.FONT, this.TEXT.TITLE, this.tabwidth, 0.0, this.GFX_H.CENTER, this.GFX_V.TOP, this.title);
- /* rrdtool 'logo' */
- if (!this.no_rrdtool_tag){
- var color = this.parse_color(this.GRC.FONT);
- color[3] = 0.3;
- var water_color = this.color2rgba(color);
- var xpos = this.legendposition === this.LEGEND_POS.EAST ? this.xOriginLegendY : this.ximg - 4;
- this.gfx_text(xpos, 5, water_color, this.TEXT.WATERMARK, this.tabwidth,
- -90, this.GFX_H.LEFT, this.GFX_V.TOP, "RRDTOOL / TOBI OETIKER");
- }
- /* graph watermark */
- if (this.watermark) {
- var color = this.parse_color(this.GRC.FONT);
- color[3] = 0.3;
- var water_color = this.color2rgba(color);
- this.gfx_text(this.ximg / 2, this.yimg - 6, water_color, this.TEXT.FONT , this.tabwidth, 0,
- this.GFX_H.CENTER, this.GFX_V.BOTTOM, this.watermark);
- }
- /* graph labels */
- if (!(this.no_legend) && !(this.only_graph)) {
- for (var i = 0 , gdes_c = this.gdes.length; i < gdes_c; i++) {
- if (!this.gdes[i].legend) continue;
- X0 = this.xOriginLegend + this.gdes[i].leg_x;
- Y0 = this.legenddirection === this.LEGEND_DIR.TOP_DOWN ? this.yOriginLegend + this.gdes[i].leg_y : this.yOriginLegend + this.legendheight - this.gdes[i].leg_y;
- this.gfx_text(X0, Y0, this.GRC.FONT, this.TEXT.LEGEND, this.tabwidth, 0.0, this.GFX_H.LEFT, this.GFX_V.BOTTOM, this.gdes[i].legend);
- if (this.gdes[i].gf != RRDGraphDesc.GF.PRINT && this.gdes[i].gf != RRDGraphDesc.GF.GPRINT && this.gdes[i].gf != RRDGraphDesc.GF.COMMENT) {
- var boxH, boxV;
- var X1, Y1;
-
- boxH = this.gfx_get_text_width(0,this.TEXT.LEGEND, this.tabwidth, 'o') * 1.2;
- boxV = boxH;
-
- Y0 -= boxV * 0.4;
-
- if (this.dynamic_labels && this.gdes[i].gf === RRDGraphDesc.GF.HRULE) {
- this.gfx_line(X0, Y0 - boxV / 2, X0 + boxH, Y0 - boxV / 2, 1.0, this.gdes[i].col);
- } else if (this.dynamic_labels && this.gdes[i].gf === RRDGraphDesc.GF.VRULE) {
- this.gfx_line(X0 + boxH / 2, Y0, X0 + boxH / 2, Y0 - boxV, 1.0, this.gdes[i].col);
- } else if (this.dynamic_labels && this.gdes[i].gf === RRDGraphDesc.GF.LINE) {
- this.gfx_line(X0, Y0, X0 + boxH, Y0 - boxV, this.gdes[i].linewidth, this.gdes[i].col);
- } else {
- this.gfx_new_area(X0, Y0 - boxV, X0, Y0, X0 + boxH, Y0, this.GRC.BACK);
- this.gfx_add_point(Math.round(X0 + boxH)+0.5, Math.round(Y0 - boxV)+0.5);
- this.gfx_close_path();
- this.gfx_new_area(X0, Y0 - boxV, X0, Y0, X0 + boxH, Y0, this.gdes[i].col);
- this.gfx_add_point(Math.round(X0 + boxH)+0.5, Math.round(Y0 - boxV)+0.5);
- this.gfx_close_path();
- this.ctx.save();
-
- this.ctx.beginPath();
- this.ctx.lineWidth = 1.0;
- X1 = X0 + boxH;
- Y1 = Y0 - boxV;
- X0 = Math.round(X0)+0.5;
- X1 = Math.round(X1)+0.5;
- Y0 = Math.round(Y0)+0.5;
- Y1 = Math.round(Y1)+0.5;
- this.ctx.moveTo(X0, Y0);
- this.ctx.lineTo(X1, Y0);
- this.ctx.lineTo(X1, Y1);
- this.ctx.lineTo(X0, Y1);
- this.ctx.closePath();
- this.ctx.strokeStyle = this.GRC.FRAME;
- this.ctx.stroke();
- this.ctx.restore();
- }
-// if (this.gdes[i].dash) { FIXME
-// double dashes[] = { 3.0 };
-// cairo_set_dash(this.cr, dashes, 1, 0.0);
-// }
- }
- }
- }
- },
- graph_size_location: function (elements)
- {
- var Xvertical = 0;
- var Xvertical2 = 0;
- var Ytitle = 0;
- var Xylabel = 0;
- var Xmain = 0;
- var Ymain = 0;
- var Yxlabel = 0;
- var Xspacing = 15;
- var Yspacing = 15;
- var Ywatermark = 4;
-
- if (this.only_graph) {
- this.xorigin = 0;
- this.ximg = this.xsize;
- this.yimg = this.ysize;
- this.yorigin = this.ysize;
- this.ytr(Number.NaN);
- return 0;
- }
-
- if(this.watermark)
- Ywatermark = this.TEXT.WATERMARK.size * 1.5; // 2
- if(this.ylegend)
- Xvertical = this.TEXT.UNIT.size * 1.5; // 2
- if(this.second_axis_legend)
- Xvertical2 = this.TEXT.UNIT.size * 1.5; // 2
-
- if(this.title)
- Ytitle = this.TEXT.TITLE.size * 1.95 + 10; // 2.6
- else
- Ytitle = 1.5 * Yspacing;
-
- if (elements) {
- if (this.draw_x_grid)
- Yxlabel = this.TEXT.AXIS.size * 1.35; // 2.5 1.87
- if (this.draw_y_grid || this.forceleftspace) // FIXME
- Xylabel = this.gfx_get_text_width(0, this.TEXT.AXIS, this.tabwidth, '0') * this.unitslength;
- }
- Xylabel += Xspacing;
- this.legendheight = 0;
- this.legendwidth = 0;
- if(!this.no_legend) {
- if(this.legendposition === this.LEGEND_POS.WEST || this.legendposition === this.LEGEND_POS.EAST){
- if (this.leg_place(1) === -1) return -1; // FIXME
- }
- }
-
- if(this.full_size_mode) {
- this.ximg = this.xsize;
- this.yimg = this.ysize;
- Xmain = this.ximg;
- Ymain = this.yimg;
-
- Xmain -= Xylabel;// + Xspacing;
- if((this.legendposition === this.LEGEND_POS.WEST || this.legendposition === this.LEGEND_POS.EAST) && !(this.no_legend) )
- Xmain -= this.legendwidth;// + Xspacing;
- if (this.second_axis_scale != 0) Xmain -= Xylabel;
- if (!(this.no_rrdtool_tag)) Xmain -= Xspacing;
-
- Xmain -= Xvertical + Xvertical2;
-
- if(Xmain < 1) Xmain = 1;
- this.xsize = Xmain;
-
- if (!(this.no_legend)) {
- if(this.legendposition === this.LEGEND_POS.NORTH || this.legendposition === this.LEGEND_POS.SOUTH){
- this.legendwidth = this.ximg;
- if (this.leg_place(0) === -1) return -1;
- }
- }
-
- if( (this.legendposition === this.LEGEND_POS.NORTH || this.legendposition === this.LEGEND_POS.SOUTH) && !(this.no_legend) )
- Ymain -= Yxlabel + this.legendheight;
- else Ymain -= Yxlabel;
-
- Ymain -= Ytitle;
-
- if (this.nolegened) Ymain -= Yspacing;
- if (this.watermark) Ymain -= Ywatermark;
- if(Ymain < 1) Ymain = 1;
- this.ysize = Ymain;
- } else {
- if (elements) {
-// Xmain = this.xsize; // + Xspacing;
- Xmain = this.xsize + Xspacing; //FIXME ???
- Ymain = this.ysize;
- }
- this.ximg = Xmain + Xylabel;
- if (!this.no_rrdtool_tag) this.ximg += Xspacing;
-
- if( (this.legendposition === this.LEGEND_POS.WEST || this.legendposition === this.LEGEND_POS.EAST) && !this.no_legend )
- this.ximg += this.legendwidth;// + Xspacing;
- if (this.second_axis_scale != 0) this.ximg += Xylabel;
-
- this.ximg += Xvertical + Xvertical2;
-
- if (!(this.no_legend)) {
- if(this.legendposition === this.LEGEND_POS.NORTH || this.legendposition === this.LEGEND_POS.SOUTH){
- this.legendwidth = this.ximg;
- if (this.leg_place(0) === -1) return -1;
- }
- }
-
- this.yimg = Ymain + Yxlabel;
- if( (this.legendposition === this.LEGEND_POS.NORTH || this.legendposition === this.LEGEND_POS.SOUTH) && !(this.no_legend) )
- this.yimg += this.legendheight;
-
- if (Ytitle) this.yimg += Ytitle;
- else this.yimg += 1.5 * Yspacing;
-
- if (this.no_legend) this.yimg += Yspacing;
- if (this.watermark) this.yimg += Ywatermark;
- }
-
-
- if (!this.no_legend) {
- if(this.legendposition === this.LEGEND_POS.WEST || this.legendposition === this.LEGEND_POS.EAST){
- if (this.leg_place(0) === -1) return -1;
- }
- }
-
- switch(this.legendposition){
- case this.LEGEND_POS.NORTH:
- this.xOriginTitle = Math.round(Xvertical + Xylabel + (this.xsize / 2));
- this.yOriginTitle = 0;
- this.xOriginLegend = 0;
- this.yOriginLegend = Math.round(Ytitle);
- this.xOriginLegendY = 0;
- this.yOriginLegendY = Math.round(Ytitle + this.legendheight + (Ymain / 2) + Yxlabel);
- this.xorigin = Math.round(Xvertical + Xylabel);
- this.yorigin = Math.round(Ytitle + this.legendheight + Ymain);
- this.xOriginLegendY2 = Math.round(Xvertical + Xylabel + Xmain);
- if (this.second_axis_scale != 0) this.xOriginLegendY2 += Xylabel;
- this.yOriginLegendY2 = Math.round(Ytitle + this.legendheight + (Ymain / 2) + Yxlabel);
- break;
- case this.LEGEND_POS.WEST:
- this.xOriginTitle = Math.round(this.legendwidth + Xvertical + Xylabel + this.xsize / 2);
- this.yOriginTitle = 0;
- this.xOriginLegend = 0;
- this.yOriginLegend = Math.round(Ytitle);
- this.xOriginLegendY = Math.round(this.legendwidth);
- this.yOriginLegendY = Math.round(Ytitle + (Ymain / 2));
- this.xorigin = Math.round(this.legendwidth + Xvertical + Xylabel);
- this.yorigin = Math.round(Ytitle + Ymain);
- this.xOriginLegendY2 = Math.round(this.legendwidth + Xvertical + Xylabel + Xmain);
- if (this.second_axis_scale != 0) this.xOriginLegendY2 += Xylabel;
- this.yOriginLegendY2 = Math.round(Ytitle + (Ymain / 2));
- break;
- case this.LEGEND_POS.SOUTH:
- this.xOriginTitle = Math.round(Xvertical + Xylabel + this.xsize / 2);
- this.yOriginTitle = 0;
- this.xOriginLegend = 0;
- this.yOriginLegend = Math.round(Ytitle + Ymain + Yxlabel);
- this.xOriginLegendY = 0;
- this.yOriginLegendY = Math.round(Ytitle + (Ymain / 2));
- this.xorigin = Math.round(Xvertical + Xylabel);
- this.yorigin = Math.round(Ytitle + Ymain);
- this.xOriginLegendY2 = Math.round(Xvertical + Xylabel + Xmain);
- if (this.second_axis_scale != 0) this.xOriginLegendY2 += Xylabel;
- this.yOriginLegendY2 = Math.round(Ytitle + (Ymain / 2));
- break;
- case this.LEGEND_POS.EAST:
- this.xOriginTitle = Math.round(Xvertical + Xylabel + this.xsize / 2);
- this.yOriginTitle = 0;
- this.xOriginLegend = Math.round(Xvertical + Xylabel + Xmain + Xvertical2);
- if (this.second_axis_scale != 0) this.xOriginLegend += Xylabel;
- this.yOriginLegend = Math.round(Ytitle);
- this.xOriginLegendY = 0;
- this.yOriginLegendY = Math.round(Ytitle + (Ymain / 2));
- this.xorigin = Math.round(Xvertical + Xylabel);
- this.yorigin = Math.round(Ytitle + Ymain);
- this.xOriginLegendY2 = Math.round(Xvertical + Xylabel + Xmain);
- if (this.second_axis_scale != 0) this.xOriginLegendY2 += Xylabel;
- this.yOriginLegendY2 = Math.round(Ytitle + (Ymain / 2));
-
- if (!this.no_rrdtool_tag){
- this.xOriginTitle += Xspacing;
- this.xOriginLegend += Xspacing;
- this.xOriginLegendY += Xspacing;
- this.xorigin += Xspacing;
- this.xOriginLegendY2 += Xspacing;
- }
- break;
- }
- this.xtr(0);
- this.ytr(Number.NaN);
- return 0;
- },
- graph_paint: function()
- {
- if (this.logarithmic && this.minval <= 0)
- throw "for a logarithmic yaxis you must specify a lower-limit > 0";
-
-// var start_end = RRDTime.proc_start_end(this.start_t, this.end_t);
-// this.start = start_end[0];
-// this.end = start_end[1];
-
- if (this.start < 3600 * 24 * 365 * 10)
- throw "the first entry to fetch should be after 1980 ("+this.start+"%ld)";
-
- if (this.end < this.start)
- throw "start ("+this.start+") should be less than end ("+this.end+")";
-
-// this.xlab_form = null
- this.xlab_user = { minsec: -1, length: 0, gridtm: 0, gridst: 0, mgridtm: 0, mgridst: 0, labtm: 0, labst: 0, precis: 0, stst: null };
- this.ygrid_scale = { gridstep: 0.0, labfact:0 , labfmt: null };
- this.minval = this.setminval;
- this.maxval = this.setmaxval;
-
- this.step = Math.max(this.step, (this.end - this.start) / this.xsize);
-
- for (var i = 0, gdes_c = this.gdes.length; i < gdes_c; i++) {
- this.gdes[i].step = 0; // FIXME 0?
- this.gdes[i].step_orig = this.step;
- this.gdes[i].start = this.start; // FIXME SHIFT
-// this.gdes[i].start_orig = this.start;
- this.gdes[i].end = this.end; // FIXME SHIFT
-// this.gdes[i].end_orig = this.end;
- }
-
- var areazero = 0.0;
- var lastgdes = null;
-
- if (this.data_fetch() === -1)
- return -1;
- if (this.data_calc() === -1)
- return -1;
- var i = this.print_calc();
- if (i < 0)
- return -1;
- if (this.graph_size_location(i) === -1)
- return -1;
-
- if (this.data_proc() === -1)
- return -1;
- if (!this.logarithmic)
- this.si_unit();
- if (!this.rigid && !this.logarithmic)
- this.expand_range();
-
- if (this.magfact === 0) this.magfact =1; // FIXME XXX XXX logarithmic Â?
-
- if (!this.calc_horizontal_grid())
- return -1;
-
- this.ytr(Number.NaN);
-
- this.canvas.height = this.yimg;
- this.canvas.width = this.ximg;
-
- this.gfx_new_area(0, 0, 0, this.yimg, this.ximg, this.yimg, this.GRC.BACK);
- this.gfx_add_point(this.ximg, 0);
- this.gfx_close_path();
-
- this.gfx_new_area(this.xorigin, this.yorigin, this.xorigin + this.xsize,
- this.yorigin, this.xorigin + this.xsize, this.yorigin - this.ysize, this.GRC.CANVAS);
- this.gfx_add_point(this.xorigin, this.yorigin - this.ysize);
- this.gfx_close_path();
-
-// this.ctx.rect(this.xorigin, this.yorigin - this.ysize - 1.0, this.xsize, this.ysize + 2.0);
-// this.ctx.clip();
-
- if (this.minval > 0.0) areazero = this.minval;
- if (this.maxval < 0.0) areazero = this.maxval;
-
- for (var i = 0, gdes_c = this.gdes.length; i < gdes_c; i++) {
- switch (this.gdes[i].gf) {
- case RRDGraphDesc.GF.CDEF:
- case RRDGraphDesc.GF.VDEF:
- case RRDGraphDesc.GF.DEF:
- case RRDGraphDesc.GF.PRINT:
- case RRDGraphDesc.GF.GPRINT:
- case RRDGraphDesc.GF.COMMENT:
- case RRDGraphDesc.GF.TEXTALIGN:
- case RRDGraphDesc.GF.HRULE:
- case RRDGraphDesc.GF.VRULE:
- case RRDGraphDesc.GF.XPORT:
- case RRDGraphDesc.GF.SHIFT:
- break;
- case RRDGraphDesc.GF.TICK:
- for (var ii = 0; ii < this.xsize; ii++) {
- if (!isNaN(this.gdes[i].p_data[ii]) && this.gdes[i].p_data[ii] != 0.0) {
- if (this.gdes[i].yrule > 0) {
- this.gfx_line(this.xorigin + ii, this.yorigin + 1.0, this.xorigin + ii, this.yorigin - this.gdes[i].yrule * this.ysize, 1.0, this.gdes[i].col);
- } else if (this.gdes[i].yrule < 0) {
- this.gfx_line(this.xorigin + ii, this.yorigin - this.ysize - 1.0, this.xorigin + ii, this.yorigin - this.ysize - this.gdes[i].yrule * this.ysize, 1.0, this.gdes[i].col);
- }
- }
- }
- break;
- case RRDGraphDesc.GF.LINE:
- case RRDGraphDesc.GF.AREA:
- var diffval = this.maxval - this.minval;
- var maxlimit = this.maxval + 9 * diffval;
- var minlimit = this.minval - 9 * diffval;
- for (var ii = 0; ii < this.xsize; ii++) {
- if (!isNaN(this.gdes[i].p_data[ii])) { // FIXME NaN < ???
- if (!isFinite(this.gdes[i].p_data[ii])) {
- if (this.gdes[i].p_data[ii] > 0) this.gdes[i].p_data[ii] = this.maxval;
- else this.gdes[i].p_data[ii] = this.minval;
- }
- if (this.gdes[i].p_data[ii] > maxlimit) this.gdes[i].p_data[ii] = maxlimit;
- if (this.gdes[i].p_data[ii] < minlimit) this.gdes[i].p_data[ii] = minlimit;
- }
- }
- var color = this.parse_color(this.gdes[i].col); // if (this.gdes[i].col.alpha != 0.0) {
- if (color[3] != 0.0) {
- if (this.gdes[i].gf === RRDGraphDesc.GF.LINE) {
- var last_y = 0.0;
- var draw_on = false;
-
- this.ctx.save();
- this.ctx.beginPath();
- this.ctx.lineWidth = this.gdes[i].linewidth;
- //if (this.gdes[i].dash) cairo_set_dash(this.cr, this.gdes[i].p_dashes, this.gdes[i].ndash, this.gdes[i].offset); FIXME
- for (var ii = 1; ii < this.xsize; ii++) {
- if (isNaN(this.gdes[i].p_data[ii]) || (this.slopemode && isNaN(this.gdes[i].p_data[ii - 1]))) {
- draw_on = false;
- continue;
- }
- if (!draw_on) {
- last_y = this.ytr(this.gdes[i].p_data[ii]);
- if (!this.slopemode) {
- var x = ii - 1 + this.xorigin;
- var y = last_y;
- x = Math.round(x)+0.5;
- y = Math.round(y)+0.5;
- this.ctx.moveTo(x, y);
- x = ii + this.xorigin;
- y = last_y;
- x = Math.round(x)+0.5;
- y = Math.round(y)+0.5;
- this.ctx.lineTo(x, y);
- } else {
- var x = ii - 1 + this.xorigin;
- var y = this.ytr(this.gdes[i].p_data[ii - 1]);
- x = Math.round(x)+0.5;
- y = Math.round(y)+0.5;
- this.ctx.moveTo(x, y);
- x = ii + this.xorigin;
- y = last_y;
- x = Math.round(x)+0.5;
- y = Math.round(y)+0.5;
- this.ctx.lineTo(x, y);
- }
- draw_on = true;
- } else {
- var x1 = ii + this.xorigin;
- var y1 = this.ytr(this.gdes[i].p_data[ii]);
-
- if (!this.slopemode && !this.AlmostEqual2sComplement(y1, last_y, 4)) {
- var x = ii - 1 + this.xorigin;
- var y = y1;
-
- x = Math.round(x)+0.5;
- y = Math.round(y)+0.5;
- this.ctx.lineTo(x, y);
- }
- last_y = y1;
- x1 = Math.round(x1)+0.5;
- y1 = Math.round(y1)+0.5;
- this.ctx.lineTo(x1, y1);
- }
- }
- //cairo_set_source_rgba(this.cr, this.gdes[i]. col.red, this.gdes[i]. col.green, this.gdes[i]. col.blue, this.gdes[i].col.alpha);
- this.ctx.strokeStyle = this.gdes[i].col;
- this.ctx.lineCap = 'round'; //cairo_set_line_cap(this.cr, CAIRO_LINE_CAP_ROUND);
- this.ctx.round = 'round'; //cairo_set_line_join(this.cr, CAIRO_LINE_JOIN_ROUND);
- this.ctx.stroke();
- this.ctx.restore();
- } else {
- var idxI = -1;
- var foreY = [];
- var foreX = [];
- var backY = [];
- var backX = [];
- var drawem = false;
-
- for (ii = 0; ii <= this.xsize; ii++) {
- var ybase, ytop;
-
- if (idxI > 0 && (drawem || ii === this.xsize)) {
- var cntI = 1;
- var lastI = 0;
-
- while (cntI < idxI && this.AlmostEqual2sComplement(foreY [lastI], foreY[cntI], 4) && this.AlmostEqual2sComplement(foreY [lastI], foreY [cntI + 1], 4))
- cntI++;
- this.gfx_new_area(backX[0], backY[0], foreX[0], foreY[0], foreX[cntI], foreY[cntI], this.gdes[i].col);
- while (cntI < idxI) {
- lastI = cntI;
- cntI++;
- while (cntI < idxI && this.AlmostEqual2sComplement(foreY [lastI], foreY[cntI], 4) && this.AlmostEqual2sComplement(foreY [lastI], foreY [cntI + 1], 4))
- cntI++;
- this.gfx_add_point(foreX[cntI], foreY[cntI]);
- }
- this.gfx_add_point(backX[idxI], backY[idxI]);
- while (idxI > 1) {
- lastI = idxI;
- idxI--;
- while (idxI > 1 && this.AlmostEqual2sComplement(backY [lastI], backY[idxI], 4) && this.AlmostEqual2sComplement(backY [lastI], backY [idxI - 1], 4))
- idxI--;
- this.gfx_add_point(backX[idxI], backY[idxI]);
- }
- idxI = -1;
- drawem = false;
- this.gfx_close_path();
- }
- if (drawem) {
- drawem = false;
- idxI = -1;
- }
- if (ii === this.xsize)
- break;
- if (!this.slopemode && ii === 0)
- continue;
- if (isNaN(this.gdes[i].p_data[ii])) {
- drawem = true;
- continue;
- }
- ytop = this.ytr(this.gdes[i].p_data[ii]);
- if (lastgdes && this.gdes[i].stack) ybase = this.ytr(lastgdes.p_data[ii]);
- else ybase = this.ytr(areazero);
- if (ybase === ytop) {
- drawem = true;
- continue;
- }
-
- if (ybase > ytop) {
- var extra = ytop;
- ytop = ybase;
- ybase = extra;
- }
- if (!this.slopemode) {
- backY[++idxI] = ybase - 0.2;
- backX[idxI] = ii + this.xorigin - 1;
- foreY[idxI] = ytop + 0.2;
- foreX[idxI] = ii + this.xorigin - 1;
- }
- backY[++idxI] = ybase - 0.2;
- backX[idxI] = ii + this.xorigin;
- foreY[idxI] = ytop + 0.2;
- foreX[idxI] = ii + this.xorigin;
- }
- }
- }
- /* if color != 0x0 */
- /* make sure we do not run into trouble when stacking on NaN */
- for (ii = 0; ii < this.xsize; ii++) {
- if (isNaN(this.gdes[i].p_data[ii])) {
- if (lastgdes && (this.gdes[i].stack)) this.gdes[i].p_data[ii] = lastgdes.p_data[ii];
- else this.gdes[i].p_data[ii] = areazero;
- }
- }
- lastgdes = this.gdes[i]; //lastgdes = &(this.gdes[i]);
- break;
- case RRDGraphDesc.GF.STACK:
- throw "STACK should already be turned into LINE or AREA here";
- break;
- }
- }
-// cairo_reset_clip(this.cr);
- if (!this.only_graph)
- this.grid_paint();
- if (!this.only_graph)
- this.axis_paint();
- /* the RULES are the last thing to paint ... */
- for (var i = 0, gdes_c = this.gdes.length; i < gdes_c; i++) {
- switch (this.gdes[i].gf) {
- case RRDGraphDesc.GF.HRULE:
- if (this.gdes[i].yrule >= this.minval && this.gdes[i].yrule <= this.maxval) {
- //if (this.gdes[i].dash) cairo_set_dash(this.cr, this.gdes[i].p_dashes, this.gdes[i].ndash, this.gdes[i].offset);
- this.gfx_line(this.xorigin, this.ytr(this.gdes[i].yrule), this.xorigin + this.xsize, this.ytr(this.gdes[i].yrule), 1.0, this.gdes[i].col);
- }
- break;
- case RRDGraphDesc.GF.VRULE:
- if (this.gdes[i].xrule >= this.start && this.gdes[i].xrule <= this.end) {
- //if (this.gdes[i].dash) cairo_set_dash(this.cr, this.gdes[i].p_dashes, this.gdes[i].ndash, this.gdes[i].offset);
- this.gfx_line(this.xtr(this.gdes[i].xrule), this.yorigin, this.xtr(this.gdes[i].xrule), this.yorigin - this.ysize, 1.0, this.gdes[i].col);
- }
- break;
- default:
- break;
- }
- }
- return 0;
- },
- find_var: function(key)
- {
- for (var ii = 0, gdes_c = this.gdes.length; ii < gdes_c; ii++) {
- if ((this.gdes[ii].gf === RRDGraphDesc.GF.DEF
- || this.gdes[ii].gf === RRDGraphDesc.GF.VDEF
- || this.gdes[ii].gf === RRDGraphDesc.GF.CDEF)
- && this.gdes[ii].vname === key) {
- return ii;
- }
- }
- throw new Error('Key not found ' + key);
- },
- // DEF:<vname>=<rrdfile>:<ds-name>:<CF>[:step=<step>][:start=<time>][:end=<time>][:reduce=<CF>]
- parse_def: function (line)
- {
- var args = line.split(/:/);
- var n=1;
- var vnames = args[n++].split('=');
- var vname = vnames[0];
- var rrdfile = vnames[1];
- var name = args[n++];
- var cf = args[n++];
- var step = undefined;
- var reduce = undefined;
- var start = undefined;
- var end = undefined;
- if (args.length > n) {
- for (var j = n, xlen = args.length ; j < xlen ; j++) {
- var opts = args[j].split("=");
- if (opts[0] === "step") step = opts[1];
- if (opts[0] === "reduce") reduce = opts[1];
- if (opts[0] === "start") start = opts[1];
- if (opts[0] === "end") end = opts[1];
- }
- }
- this.create_def(vname, rrdfile, name, cf, step, start, end, reduce);
- },
- create_def: function (vname, rrdfile, name, cf, step, start, end, reduce)
- {
- var gdp = new RRDGraphDesc(this);
- var start_t = new RRDTime(this.start);
- var end_t = new RRDTime(this.end);
-
- gdp.gf = RRDGraphDesc.GF.DEF;
- gdp.vname = vname;
-// gdp.vidx = this.find_var(vname);
- gdp.rrd = rrdfile;
- gdp.ds_nam = name;
- gdp.cf = this.cf_conv(cf);
-
- if (step != undefined && step != null)
- gdp.step = step;
- if (start != undefined && start != null)
- start_t = new RRDTime(start);
- if (end != undefined && end != null)
- end_t = new RRDTime(end);
- if (reduce === undefined || reduce === null)
- gdp.cf_reduce = gdp.cf; // ¿?
- else
- gdp.cf_reduce = this.cf_conv(reduce);
- gdp.legend = '';
-
- var start_end = RRDTime.proc_start_end(start_t, end_t); // FIXME here?
- gdp.start = start_end[0];
- gdp.end = start_end[1];
- gdp.start_orig = start_end[0];
- gdp.end_orig = start_end[1];
-
- this.gdes.push(gdp);
- },
- // CDEF:vname=RPN expression
- parse_cdef: function (line)
- {
- var args = line.split(/:|=/);
- this.create_cdef(args[1], args[2]);
- },
- create_cdef:function (vname, rpn)
- {
- var gdp = new RRDGraphDesc(this);
- gdp.gf = RRDGraphDesc.GF.CDEF;
- gdp.vname = vname;
- gdp.vidx = this.find_var(vname);
-
- gdp.rpnp = new RRDRpn(rpn,this.gdes);
-
- gdp.legend = '';
- this.gdes.push(gdp);
- },
- // VDEF:vname=RPN expression
- parse_vdef: function (line)
- {
- var args = line.split(/:|=/);
- this.create_vdef(args[1], args[2]);
- },
- create_vdef:function (vname, rpn)
- {
- var gdp = new RRDGraphDesc(this);
- gdp.gf = RRDGraphDesc.GF.VDEF;
- gdp.vname = vname;
-
- var index = rpn.indexOf(',');
- var name = rpn.substring(0,index);
- var vidx = this.find_var(name);
- if (vidx === -1) {
- throw 'variable "'+name+'" does not exist in VDEF.';
- } else {
- gdp.vidx = vidx;
- }
- if (this.gdes[gdp.vidx].gf != RRDGraphDesc.GF.DEF
- && this.gdes[gdp.vidx].gf != RRDGraphDesc.GF.CDEF) {
- throw 'variable "'+name+'" not DEF nor CDEF in VDEF.';
- }
-
- this.vdef_parse(gdp, rpn.substring(index+1));
-
- gdp.legend = '';
- this.gdes.push(gdp);
- },
- // SHIFT:vname:offset
- parse_shift: function (line)
- {
- var args = line.split(':');
- this.create_shift(args[1], args[2]);
- },
- create_shift: function (vname, offset)
- {
- var gdp = new RRDGraphDesc(this);
- gdp.gf = RRDGraphDesc.GF.SHIFT;
- gdp.vname = vname; // Â?
- gdp.vidx = this.find_var(vname); // FIXME checks
-
- if (this.gdes[gdp.vidx].gf === RRDGraphDesc.GF.VDEF)
- throw "Cannot shift a VDEF: '%s' in line '"+this.gdes[gdp.vidx].vname+"'";
- if (this.gdes[gdp.vidx].gf !== RRDGraphDesc.GF.DEF && this.gdes[gdp.vidx].gf !== RRDGraphDesc.GF.CDEF)
- throw "Encountered unknown type variable '"+this.gdes[gdp.vidx].vname+"'";
-
- gdp.shidx = this.find_var(offset);
- if (gdp.shidx >= 0) {
- if (this.gdes[gdp.shidx].gf === RRDGraphDesc.GF.DEF || this.gdes[gdp.shidx].gf === RRDGraphDesc.GF.CDEF)
- throw "Offset cannot be a (C)DEF: '"+this.gdes[gdp.shidx].gf+"'";
- if (this.gdes[gdp.shidx].gf !== RRDGraphDesc.GF.VDEF)
- throw "Encountered unknown type variable '"+this.gdes[gdp.shidx].vname+"'";
- } else {
- gdp.shval = parseInt(offset, 10); // FIXME check
- gdp.shidx = -1;
- }
- gdp.legend = '';
- this.gdes.push(gdp);
- },
- // LINE[width]:value[#color][:[legend][:STACK]][:dashes[=on_s[,off_s[,on_s,off_s]...]][:dash-offset=offset]]
- parse_line: function (line)
- {
- var args = line.split(/#|:/);
- var width = parseFloat(args[0].substr(4));
- var stack = args[4] === 'STACK' ? true : undefined;
- var color = this.parse_color(args[2]);
- this.create_line(width, args[1], this.color2rgba(color), args[3], stack);
- },
- create_line: function (width, value, color, legend, stack)
- {
- var gdp = new RRDGraphDesc(this);
-
- gdp.gf = RRDGraphDesc.GF.LINE;
- gdp.vname = value;
- gdp.vidx = this.find_var(value);
- gdp.linewidth = width;
- gdp.col = color;
- if (legend === undefined) gdp.legend = '';
- else gdp.legend = ' '+legend;
- if (stack === undefined) gdp.stack = false;
- else gdp.stack = stack;
- gdp.format = gdp.legend;
- this.gdes.push(gdp);
- },
- // AREA:value[#color][:[legend][:STACK]]
- parse_area: function (line)
- {
- var args = line.split(/#|:/);
- var stack = args[3] === 'STACK' ? true : undefined;
- var color = this.parse_color(args[2]);
- this.create_area(args[1], this.color2rgba(color), stack);
- },
- create_area: function (value, color, legend, stack)
- {
- var gdp = new RRDGraphDesc(this);
-
- gdp.gf = RRDGraphDesc.GF.AREA;
- gdp.vname = value;
- gdp.vidx = this.find_var(value);
- gdp.col = color;
- if (legend === undefined) gdp.legend = '';
- else gdp.legend = ' '+legend;
- if (stack === undefined) gdp.stack = false;
- else gdp.stack = stack;
- gdp.format = gdp.legend;
- this.gdes.push(gdp);
- },
- // TICK:vname#rrggbb[aa][:fraction[:legend]]
- parse_tick: function (line)
- {
- var args = line.split(/:|#/);
- var color = this.parse_color(args[2]);
- this.create_tick(args[1], this.color2rgba(color), args[3], args[4]);
- },
- create_tick: function (vname, color, fraction, legend)
- {
- var gdp = new RRDGraphDesc(this);
- gdp.gf = RRDGraphDesc.GF.TICK;
- gdp.vname = vname;
- gdp.vidx = this.find_var(vname);
- gdp.col = color;
- if (legend !== undefined)
- gdp.yrule = fraction;
- if (legend === undefined) gdp.legend = '';
- else gdp.legend = ' '+legend;
- gdp.format = gdp.legend;
- this.gdes.push(gdp);
- },
- // GPRINT:vname:format
- parse_gprint: function(line)
- {
- var args = line.split(':');
- var strftime = false;
- var vname = args[1];
- var cf = args[2];
- var format = "";
- if (args.length > 3) {
- var m=0;
- for (var j = 3, xlen = args.length ; j < xlen ; j++) {
- if (args[j] === 'strftime') {
- strftime = true;
- } else {
- if (m>0) {
- format = format + ':'+ args[j];
- } else {
- format = args[j];
- }
- m++;
- }
- }
- }
- this.create_gprint(vname, cf, format, strftime);
- },
- create_gprint: function (vname, cf, format, strftime)
- {
- var gdp = new RRDGraphDesc(this);
- gdp.gf = RRDGraphDesc.GF.GPRINT;
- gdp.vname = vname;
- gdp.vidx = this.find_var(vname);
- gdp.legend = '';
- if (format === undefined) {
- gdp.format = cf;
- switch (this.gdes[gdp.vidx].gf) {
- case RRDGraphDesc.GF.DEF:
- case RRDGraphDesc.GF.CDEF:
- gdp.cf = this.gdes[gdp.vidx].cf;
- break;
- case RRDGraphDesc.GF.VDEF:
- break;
- default:
- throw "Encountered unknown type variable "+this.gdes[gdp.vidx].vname;
- }
- } else {
- gdp.cf = this.cf_conv(cf);
- gdp.format = format;
- }
- // if (this.gdes[gdp.vidx].gf === RRDGraphDesc.GF.VDEF && gdp.strftm === true) // FIXME
- if (this.gdes[gdp.vidx].gf === RRDGraphDesc.GF.VDEF && strftime === true) // FIXME
- gdp.strftm = true;
- this.gdes.push(gdp);
- },
- //COMMENT:text
- parse_comment: function (line)
- {
- var index = line.indexOf(':');
- this.create_comment(line.substr(index+1));
- },
- create_comment: function (text)
- {
- var gdp = new RRDGraphDesc(this);
- gdp.gf = RRDGraphDesc.GF.COMMENT;
- gdp.vidx = -1;
- gdp.legend = text;
- this.gdes.push(gdp);
- },
- // TEXTALIGN:{left|right|justified|center}
- parse_textaling: function (line)
- {
- var index = line.indexOf(':');
- this.create_textaling(line.substr(index+1));
- },
- create_textalign: function (align)
- {
- var gdp = new RRDGraphDesc(this);
- gdp.gf = RRDGraphDesc.GF.TEXTALIGN;
- gdp.vidx = -1;
- if (align === "left") {
- gdp.txtalign = RRDGraphDesc.TXA.LEFT;
- } else if (align === "right") {
- gdp.txtalign = RRDGraphDesc.TXA.RIGHT;
- } else if (align === "justified") {
- gdp.txtalign = RRDGraphDesc.TXA.JUSTIFIED;
- } else if (align === "center") {
- gdp.txtalign = RRDGraphDesc.TXA.CENTER;
- } else {
- throw "Unknown alignement type '"+align+"'";
- }
- this.gdes.push(gdp);
- },
- // VRULE:time#color[:legend][:dashes[=on_s[,off_s[,on_s,off_s]...]][:dash-offset=offset]]
- parse_vrule: function (line)
- {
- var args = line.split(/:|#/);
- this.create_vrule(args[1], '#'+args[2], args[3]);
- },
- create_vrule: function (time, color, legend)
- {
- var gdp = new RRDGraphDesc(this);
-
- gdp.gf = RRDGraphDesc.GF.VRULE;
- gdp.xrule = time;
- gdp.col = color;
- if (legend === undefined) gdp.legend = '';
- else gdp.legend = ' '+legend;
- this.gdes.push(gdp);
- },
- // HRULE:value#color[:legend][:dashes[=on_s[,off_s[,on_s,off_s]...]][:dash-offset=offset]]
- parse_hrule: function (line)
- {
- var args = line.split(/:|#/);
- this.create_hrule(args[1], '#'+args[2], args[3]);
- },
- create_hrule: function (value, color, legend)
- {
- var gdp = new RRDGraphDesc(this);
-
- gdp.gf = RRDGraphDesc.GF.HRULE;
- gdp.yrule = value;
- gdp.col = color;
- if (legend === undefined) gdp.legend = '';
- else gdp.legend = ' '+legend;
-
- this.gdes.push(gdp);
- },
- cf_conv: function (str)
- {
- switch (str){
- case 'AVERAGE': return RRDGraphDesc.CF.AVERAGE;
- case 'MIN': return RRDGraphDesc.CF.MINIMUM;
- case 'MAX': return RRDGraphDesc.CF.MAXIMUM;
- case 'LAST': return RRDGraphDesc.CF.LAST;
- case 'HWPREDICT': return RRDGraphDesc.CF.HWPREDICT;
- case 'MHWPREDICT': return RRDGraphDesc.CF.MHWPREDICT;
- case 'DEVPREDICT': return RRDGraphDesc.CF.DEVPREDICT;
- case 'SEASONAL': return RRDGraphDesc.CF.SEASONAL;
- case 'DEVSEASONAL': return RRDGraphDesc.CF.DEVSEASONAL;
- case 'FAILURES': return RRDGraphDesc.CF.FAILURES;
- }
- return -1;
- },
- tmt_conv: function (str)
- {
- switch (str) {
- case 'SECOND': return RRDGraph.TMT.SECOND;
- case 'MINUTE': return RRDGraph.TMT.MINUTE;
- case 'HOUR': return RRDGraph.TMT.HOUR;
- case 'DAY': return RRDGraph.TMT.DAY;
- case 'WEEK': return RRDGraph.TMT.WEEK;
- case 'MONTH': return RRDGraph.TMT.MONTH;
- case 'YEAR': return RRDGraph.TMT.YEAR;
- }
- return -1;
- },
- // struct graph_desc_t *gdes, const char *const str)
- vdef_parse: function(gdes, str)
- { /* A VDEF currently is either "func" or "param,func" so the parsing is rather simple. Change if needed. */
- var param;
- var func;
- var n;
-
- n = 0;
- var index = str.indexOf(',');
- if (index != -1) {
- param = parseFloat(str.substr(0,index));
- func = str.substr(index+1);
- } else {
- param = Number.NaN;
- func = str;
- }
-
- gdes.vf = { op: null, param: null, val: null, when: null };
-
- if (func === 'PERCENT') gdes.vf.op = RRDGraphDesc.VDEF.PERCENT;
- else if (func === 'PERCENTNAN') gdes.vf.op = RRDGraphDesc.VDEF.PERCENTNAN;
- else if (func === 'MAXIMUM') gdes.vf.op = RRDGraphDesc.VDEF.MAXIMUM;
- else if (func === 'AVERAGE') gdes.vf.op = RRDGraphDesc.VDEF.AVERAGE;
- else if (func === 'STDEV') gdes.vf.op = RRDGraphDesc.VDEF.STDEV;
- else if (func === 'MINIMUM') gdes.vf.op = RRDGraphDesc.VDEF.MINIMUM;
- else if (func === 'TOTAL') gdes.vf.op = RRDGraphDesc.VDEF.TOTAL;
- else if (func === 'FIRST') gdes.vf.op = RRDGraphDesc.VDEF.FIRST;
- else if (func === 'LAST') gdes.vf.op = RRDGraphDesc.VDEF.LAST;
- else if (func === 'LSLSLOPE') gdes.vf.op = RRDGraphDesc.VDEF.LSLSLOPE;
- else if (func === 'LSLINT') gdes.vf.op = RRDGraphDesc.VDEF.LSLINT;
- else if (func === 'LSLCORREL') gdes.vf.op = RRDGraphDesc.VDEF.LSLCORREL;
- else {
- throw 'Unknown function "'+func+'" in VDEF "'+gdes.vame+'"';
- }
-
- switch (gdes.vf.op) {
- case RRDGraphDesc.VDEF.PERCENT:
- case RRDGraphDesc.VDEF.PERCENTNAN:
- if (isNaN(param)) { /* no parameter given */
- throw "Function '"+func+"' needs parameter in VDEF '"+gdes.vname+"'";
- }
- if (param >= 0.0 && param <= 100.0) {
- gdes.vf.param = param;
- gdes.vf.val = Number.NaN; /* undefined */
- gdes.vf.when = 0; /* undefined */
- } else {
- throw "Parameter '"+param+"' out of range in VDEF '"+gdes.vname+"'";
- }
- break;
- case RRDGraphDesc.VDEF.MAXIMUM:
- case RRDGraphDesc.VDEF.AVERAGE:
- case RRDGraphDesc.VDEF.STDEV:
- case RRDGraphDesc.VDEF.MINIMUM:
- case RRDGraphDesc.VDEF.TOTAL:
- case RRDGraphDesc.VDEF.FIRST:
- case RRDGraphDesc.VDEF.LAST:
- case RRDGraphDesc.VDEF.LSLSLOPE:
- case RRDGraphDesc.VDEF.LSLINT:
- case RRDGraphDesc.VDEF.LSLCORREL:
- if (isNaN(param)) {
- gdes.vf.param = Number.NaN;
- gdes.vf.val = Number.NaN;
- gdes.vf.when = 0;
- } else {
- throw "Function '"+func+"' needs no parameter in VDEF '"+gdes.vname+"'";
- }
- break;
- }
- return 0;
- },
- vdef_calc: function(gdi)
- {
- var src, dst;
- var data;
- var step, steps;
-
- dst = this.gdes[gdi];
- src = this.gdes[dst.vidx];
- //data = src.data + src.ds; // FIXME ¿?
- data = src.data;
-
- steps = (src.end - src.start) / src.step;
-
- switch (dst.vf.op) {
- case RRDGraphDesc.VDEF.PERCENT:
- var array = [];
- var field;
-
- for (step = 0; step < steps; step++) {
- array[step] = data[step * src.ds_cnt];
- }
- array.sort(this.vdef_percent_compar);
- field = Math.round((dst.vf.param * (steps - 1)) / 100.0);
- dst.vf.val = array[field];
- dst.vf.when = 0; /* no time component */
- break;
- case RRDGraphDesc.VDEF.PERCENTNAN:
- var array = [];
- var field;
- //var nancount=0;
-
- field=0;
- for (step = 0; step < steps; step++) {
- if (!isNaN(data[step * src.ds_cnt])) {
- array[field] = data[step * src.ds_cnt];
- }
- }
- array.sort(vdef_percent_compar);
- field = Math.round(dst.vf.param * (field - 1) / 100.0);
- dst.vf.val = array[field];
- dst.vf.when = 0; /* no time component */
- break;
- case RRDGraphDesc.VDEF.MAXIMUM:
- step = 0;
- while (step != steps && isNaN(data[step * src.ds_cnt])) step++;
- if (step === steps) {
- dst.vf.val = Number.NaN;
- dst.vf.when = 0;
- } else {
- dst.vf.val = data[step * src.ds_cnt];
- dst.vf.when = src.start + (step + 1) * src.step;
- }
- while (step != steps) {
- if (isFinite(data[step * src.ds_cnt])) {
- if (data[step * src.ds_cnt] > dst.vf.val) {
- dst.vf.val = data[step * src.ds_cnt];
- dst.vf.when = src.start + (step + 1) * src.step;
- }
- }
- step++;
- }
- break;
- case RRDGraphDesc.VDEF.TOTAL:
- case RRDGraphDesc.VDEF.STDEV:
- case RRDGraphDesc.VDEF.AVERAGE:
- var cnt = 0;
- var sum = 0.0;
- var average = 0.0;
-
- for (step = 0; step < steps; step++) {
- if (isFinite(data[step * src.ds_cnt])) {
- sum += data[step * src.ds_cnt];
- cnt++;
- }
- }
-
- if (cnt) {
- if (dst.vf.op === RRDGraphDesc.VDEF.TOTAL) {
- dst.vf.val = sum * src.step;
- dst.vf.when = 0; /* no time component */
- } else if (dst.vf.op === RRDGraphDesc.VDEF.AVERAGE) {
- dst.vf.val = sum / cnt;
- dst.vf.when = 0; /* no time component */
- } else {
- average = sum / cnt;
- sum = 0.0;
- for (step = 0; step < steps; step++) {
- if (isFinite(data[step * src.ds_cnt])) {
- sum += Math.pow((data[step * src.ds_cnt] - average), 2.0);
- }
- }
- dst.vf.val = Math.pow(sum / cnt, 0.5);
- dst.vf.when = 0; /* no time component */
- }
- } else {
- dst.vf.val = Number.NaN;
- dst.vf.when = 0;
- }
- break;
- case RRDGraphDesc.VDEF.MINIMUM:
- step = 0;
- while (step != steps && isNaN(data[step * src.ds_cnt])) step++;
- if (step === steps) {
- dst.vf.val = Number.NaN;
- dst.vf.when = 0;
- } else {
- dst.vf.val = data[step * src.ds_cnt];
- dst.vf.when = src.start + (step + 1) * src.step;
- }
- while (step != steps) {
- if (isFinite(data[step * src.ds_cnt])) {
- if (data[step * src.ds_cnt] < dst.vf.val) {
- dst.vf.val = data[step * src.ds_cnt];
- dst.vf.when = src.start + (step + 1) * src.step;
- }
- }
- step++;
- }
- break;
- case RRDGraphDesc.VDEF.FIRST:
- step = 0;
- while (step != steps && isNaN(data[step * src.ds_cnt])) step++;
- if (step === steps) { /* all entries were NaN */
- dst.vf.val = Number.NaN;
- dst.vf.when = 0;
- } else {
- dst.vf.val = data[step * src.ds_cnt];
- dst.vf.when = src.start + step * src.step;
- }
- break;
- case RRDGraphDesc.VDEF.LAST:
- step = steps - 1;
- while (step >= 0 && isNaN(data[step * src.ds_cnt])) step--;
- if (step < 0) { /* all entries were NaN */
- dst.vf.val = Number.NaN;
- dst.vf.when = 0;
- } else {
- dst.vf.val = data[step * src.ds_cnt];
- dst.vf.when = src.start + (step + 1) * src.step;
- }
- break;
- case RRDGraphDesc.VDEF.LSLSLOPE:
- case RRDGraphDesc.VDEF.LSLINT:
- case RRDGraphDesc.VDEF.LSLCORREL:
- var cnt = 0;
- var SUMx, SUMy, SUMxy, SUMxx, SUMyy, slope, y_intercept, correl;
-
- SUMx = 0;
- SUMy = 0;
- SUMxy = 0;
- SUMxx = 0;
- SUMyy = 0;
-
- for (step = 0; step < steps; step++) {
- if (isFinite(data[step * src.ds_cnt])) {
- cnt++;
- SUMx += step;
- SUMxx += step * step;
- SUMxy += step * data[step * src.ds_cnt];
- SUMy += data[step * src.ds_cnt];
- SUMyy += data[step * src.ds_cnt] * data[step * src.ds_cnt];
- }
- }
-
- slope = (SUMx * SUMy - cnt * SUMxy) / (SUMx * SUMx - cnt * SUMxx);
- y_intercept = (SUMy - slope * SUMx) / cnt;
- correl = (SUMxy - (SUMx * SUMy) / cnt) / Math.sqrt((SUMxx - (SUMx * SUMx) / cnt) * (SUMyy - (SUMy * SUMy) / cnt));
-
- if (cnt) {
- if (dst.vf.op === RRDGraphDesc.VDEF.LSLSLOPE) {
- dst.vf.val = slope;
- dst.vf.when = 0;
- } else if (dst.vf.op === RRDGraphDesc.VDEF.LSLINT) {
- dst.vf.val = y_intercept;
- dst.vf.when = 0;
- } else if (dst.vf.op === RRDGraphDesc.VDEF.LSLCORREL) {
- dst.vf.val = correl;
- dst.vf.when = 0;
- }
- } else {
- dst.vf.val = DNAN;
- dst.vf.when = 0;
- }
- break;
- }
- return 0;
- },
- vdef_percent_compar: function (a, b)
- { /* Equality is not returned; this doesn't hurt except (maybe) for a little performance. */
- /* NaN < -INF < finite_values < INF */
- if (isNaN(a)) return -1;
- if (isNaN(b)) return 1;
- /* NaN doesn't reach this part so INF and -INF are extremes. The sign from isinf() is compatible with the sign we return */
- if (!isFinite(a)) {
- if (a === -Infinity) return -1;
- else return 1;
- }
- if (!isFinite(b)) {
- if (b === -Infinity) return -1;
- else return 1;
- }
- /* If we reach this, both values must be finite */
- if (a < b) return -1;
- else return 1;
- },
- rrd_fetch: function(gdp, ft_step)
- {
- var cal_start, cal_end;
- var best_full_rra = 0, best_part_rra = 0, chosen_rra = 0;
- var best_full_step_diff = 0, best_part_step_diff = 0, tmp_step_diff = 0, tmp_match = 0, best_match = 0;
- var full_match, rra_base;
- var first_full = 1;
- var first_part = 1;
- var rrd;
- var data_ptr;
- var rows;
-
- try {
- if (this.rrdfiles[gdp.rrd]) {
- rrd = this.rrdfiles[gdp.rrd];
- } else {
- var bf = FetchBinaryURL(gdp.rrd);
- rrd = new RRDFile(bf);
- this.rrdfiles[gdp.rrd] = rrd;
- }
- } catch(err) {
- console.log(err.message);
- console.log(err.stack);
- throw "File "+gdp.rrd+" is not a valid RRD archive!";
- }
-
- var cf_idx = gdp.cf;
- var ds_cnt = rrd.getNrDSs();
- var rra_cnt = rrd.getNrRRAs();
-
- for (var i = 0; i < ds_cnt; i++)
- gdp.ds_namv[i] = rrd.rrd_header.getDSbyIdx(i).getName();
-
- for (var i = 0; i < rra_cnt; i++) {
- var rra = rrd.getRRAInfo(i);
- if (this.cf_conv(rra.getCFName()) === cf_idx) {
- cal_end = (rrd.getLastUpdate() - (rrd.getLastUpdate() % (rra.getPdpPerRow() * rra.pdp_step)));
- cal_start = (cal_end - (rra.getPdpPerRow() * rra.row_cnt * rra.pdp_step));
- full_match = gdp.end - gdp.start;
-
- tmp_step_diff = Math.abs(ft_step - (rrd.getMinStep() * rra.pdp_cnt));
- if (cal_start <= gdp.start) {
- if (first_full || (tmp_step_diff < best_full_step_diff)) {
- first_full = 0;
- best_full_step_diff = tmp_step_diff;
- best_full_rra = i;
- }
- } else {
- tmp_match = full_match;
- if (cal_start > gdp.start) tmp_match -= (cal_start - gdp.start);
- if (first_part || (best_match < tmp_match) || (best_match === tmp_match && tmp_step_diff < best_part_step_diff)) {
- first_part = 0;
- best_match = tmp_match;
- best_part_step_diff = tmp_step_diff;
- best_part_rra = i;
- }
- }
- }
- }
-
- if (first_full === 0) chosen_rra = best_full_rra;
- else if (first_part === 0) chosen_rra = best_part_rra;
- else throw "the RRD does not contain an RRA matching the chosen CF";
-
- var rra_info = rrd.getRRAInfo(chosen_rra);
- var rra = rrd.getRRA(chosen_rra);
-
- ft_step = rrd.rrd_header.pdp_step * rra_info.getPdpPerRow();
- gdp.start -= (gdp.start % ft_step);
- gdp.end += (ft_step - gdp.end % ft_step);
- rows = (gdp.end - gdp.start) / ft_step + 1;
-
- gdp.ds_cnt = ds_cnt;
- data_ptr = 0;
-
- var rra_end_time = (rrd.getLastUpdate() - (rrd.getLastUpdate() % ft_step));
- var rra_start_time = (rra_end_time - (ft_step * (rra_info.row_cnt - 1)));
- /* here's an error by one if we don't be careful */
- var start_offset = (gdp.start + ft_step - rra_start_time) / ft_step;
- var end_offset = (rra_end_time - gdp.end) / ft_step;
-
- gdp.data = [];
-
- for (i = start_offset; i < rra.row_cnt - end_offset; i++) {
- if (i < 0) {
- for (var ii = 0; ii < ds_cnt; ii++) gdp.data[data_ptr++] = Number.NaN;
- } else if (i >= rra.row_cnt) {
- for (var ii = 0; ii < ds_cnt; ii++) gdp.data[data_ptr++] = Number.NaN;
- } else {
- for (var ii = 0; ii < ds_cnt; ii++) {
- gdp.data[data_ptr++] = rra.getEl(i, ii);
- }
- }
- }
- return ft_step;
- }
-};
diff --git a/docs/examples/index.html b/docs/examples/index.html
index ddd2a50..cd75c48 100644
--- a/docs/examples/index.html
+++ b/docs/examples/index.html
@@ -12,9 +12,7 @@
href="assets/css/tabs-no-images.css" />
<link rel="stylesheet" type="text/css"
href="assets/css/jquerytools.dateinput.skin1.css" />
-
<script type="text/javascript" src="assets/js/dependencies.js"></script>
- <script type="text/javascript" src="assets/js/jsrrdgraph.js"></script>
<script type="text/javascript" src="../../jarmon/jarmon.js"></script>
<script type="text/javascript" src="jarmon_example_recipes.js"></script>
<script type="text/javascript">