var Prototype={Version:"1.6.0.3",Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf("Opera")===-1),Opera:navigator.userAgent.indexOf("Opera")>-1,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")===-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div")["__proto__"]&&document.createElement("div")["__proto__"]!==document.createElement("form")["__proto__"]},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Class={create:function(){var f=null,e=$A(arguments);if(Object.isFunction(e[0])){f=e.shift()}function a(){this.initialize.apply(this,arguments)}Object.extend(a,Class.Methods);a.superclass=f;a.subclasses=[];if(f){var b=function(){};b.prototype=f.prototype;a.prototype=new b;f.subclasses.push(a)}for(var d=0;d<e.length;d++){a.addMethods(e[d])}if(!a.prototype.initialize){a.prototype.initialize=Prototype.emptyFunction}a.prototype.constructor=a;return a}};Class.Methods={addMethods:function(h){var d=this.superclass&&this.superclass.prototype;var b=Object.keys(h);if(!Object.keys({toString:true}).length){b.push("toString","valueOf")}for(var a=0,e=b.length;a<e;a++){var g=b[a],f=h[g];if(d&&Object.isFunction(f)&&f.argumentNames().first()=="$super"){var k=f;f=(function(l){return function(){return d[l].apply(this,arguments)}})(g).wrap(k);f.valueOf=k.valueOf.bind(k);f.toString=k.toString.bind(k)}this.prototype[g]=f}return this}};var Abstract={};Object.extend=function(a,d){for(var b in d){a[b]=d[b]}return a};Object.extend(Object,{inspect:function(a){try{if(Object.isUndefined(a)){return"undefined"}if(a===null){return"null"}return a.inspect?a.inspect():String(a)}catch(b){if(b instanceof RangeError){return"..."}throw b}},toJSON:function(a){var d=typeof a;switch(d){case"undefined":case"function":case"unknown":return;case"boolean":return a.toString()}if(a===null){return"null"}if(a.toJSON){return a.toJSON()}if(Object.isElement(a)){return}var b=[];for(var f in a){var e=Object.toJSON(a[f]);if(!Object.isUndefined(e)){b.push(f.toJSON()+": "+e)}}return"{"+b.join(", ")+"}"},toQueryString:function(a){return $H(a).toQueryString()},toHTML:function(a){return a&&a.toHTML?a.toHTML():String.interpret(a)},keys:function(a){var b=[];for(var d in a){b.push(d)}return b},values:function(b){var a=[];for(var d in b){a.push(b[d])}return a},clone:function(a){return Object.extend({},a)},isElement:function(a){return !!(a&&a.nodeType==1)},isArray:function(a){return a!=null&&typeof a=="object"&&"splice" in a&&"join" in a},isHash:function(a){return a instanceof Hash},isFunction:function(a){return typeof a=="function"},isString:function(a){return typeof a=="string"},isNumber:function(a){return typeof a=="number"},isUndefined:function(a){return typeof a=="undefined"}});Object.extend(Function.prototype,{argumentNames:function(){var a=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,"").split(",");return a.length==1&&!a[0]?[]:a},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var a=this,d=$A(arguments),b=d.shift();return function(){return a.apply(b,d.concat($A(arguments)))}},bindAsEventListener:function(){var a=this,d=$A(arguments),b=d.shift();return function(e){return a.apply(b,[e||window.event].concat(d))}},curry:function(){if(!arguments.length){return this}var a=this,b=$A(arguments);return function(){return a.apply(this,b.concat($A(arguments)))}},delay:function(){var a=this,b=$A(arguments),d=b.shift()*1000;return window.setTimeout(function(){return a.apply(a,b)},d)},defer:function(){var a=[0.01].concat($A(arguments));return this.delay.apply(this,a)},wrap:function(b){var a=this;return function(){return b.apply(this,[a.bind(this)].concat($A(arguments)))}},methodize:function(){if(this._methodized){return this._methodized}var a=this;return this._methodized=function(){return a.apply(null,[this].concat($A(arguments)))}}});Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};var Try={these:function(){var d;for(var b=0,f=arguments.length;b<f;b++){var a=arguments[b];try{d=a();break}catch(g){}}return d}};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute()}finally{this.currentlyExecuting=false}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,{gsub:function(f,d){var a="",e=this,b;d=arguments.callee.prepareReplacement(d);while(e.length>0){if(b=e.match(f)){a+=e.slice(0,b.index);a+=String.interpret(d(b));e=e.slice(b.index+b[0].length)}else{a+=e,e=""}}return a},sub:function(d,a,b){a=this.gsub.prepareReplacement(a);b=Object.isUndefined(b)?1:b;return this.gsub(d,function(e){if(--b<0){return e[0]}return a(e)})},scan:function(b,a){this.gsub(b,a);return String(this)},truncate:function(b,a){b=b||30;a=Object.isUndefined(a)?"...":a;return this.length>b?this.slice(0,b-a.length)+a:String(this)},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var b=new RegExp(Prototype.ScriptFragment,"img");var a=new RegExp(Prototype.ScriptFragment,"im");return(this.match(b)||[]).map(function(d){return(d.match(a)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var a=arguments.callee;a.text.data=this;return a.div.innerHTML},unescapeHTML:function(){var a=new Element("div");a.innerHTML=this.stripTags();return a.childNodes[0]?(a.childNodes.length>1?$A(a.childNodes).inject("",function(b,d){return b+d.nodeValue}):a.childNodes[0].nodeValue):""},toQueryParams:function(b){var a=this.strip().match(/([^?#]*)(#.*)?$/);if(!a){return{}}return a[1].split(b||"&").inject({},function(f,g){if((g=g.split("="))[0]){var d=decodeURIComponent(g.shift());var e=g.length>1?g.join("="):g[0];if(e!=undefined){e=decodeURIComponent(e)}if(d in f){if(!Object.isArray(f[d])){f[d]=[f[d]]}f[d].push(e)}else{f[d]=e}}return f})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(a){return a<1?"":new Array(a+1).join(this)},camelize:function(){var e=this.split("-"),a=e.length;if(a==1){return e[0]}var d=this.charAt(0)=="-"?e[0].charAt(0).toUpperCase()+e[0].substring(1):e[0];for(var b=1;b<a;b++){d+=e[b].charAt(0).toUpperCase()+e[b].substring(1)}return d},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()},dasherize:function(){return this.gsub(/_/,"-")},inspect:function(b){var a=this.gsub(/[\x00-\x1f\\]/,function(d){var e=String.specialChar[d[0]];return e?e:"\\u00"+d[0].charCodeAt().toPaddedString(2,16)});if(b){return'"'+a.replace(/"/g,'\\"')+'"'}return"'"+a.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(a){return this.sub(a||Prototype.JSONFilter,"#{1}")},isJSON:function(){var a=this;if(a.blank()){return false}a=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(a)},evalJSON:function(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())},include:function(a){return this.indexOf(a)>-1},startsWith:function(a){return this.indexOf(a)===0},endsWith:function(a){var b=this.length-a.length;return b>=0&&this.lastIndexOf(a)===b},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)},interpolate:function(a,b){return new Template(this,b).evaluate(a)}});if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},unescapeHTML:function(){return this.stripTags().replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}})}String.prototype.gsub.prepareReplacement=function(b){if(Object.isFunction(b)){return b}var a=new Template(b);return function(d){return a.evaluate(d)}};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(e){if(a==null){return""}var g=e[1]||"";if(g=="\\"){return e[2]}var b=a,h=e[3];var f=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;e=f.exec(h);if(e==null){return g}while(e!=null){var d=e[1].startsWith("[")?e[2].gsub("\\\\]","]"):e[1];b=b[d];if(null==b||""==e[3]){break}h=h.substring("["==e[3]?e[1].length:e[0].length);e=f.exec(h)}return g+String.interpret(b)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(d,b){var a=0;try{this._each(function(e){d.call(b,e,a++)})}catch(f){if(f!=$break){throw f}}return this},eachSlice:function(e,d,b){var a=-e,f=[],g=this.toArray();if(e<1){return g}while((a+=e)<g.length){f.push(g.slice(a,a+e))}return f.collect(d,b)},all:function(d,b){d=d||Prototype.K;var a=true;this.each(function(f,e){a=a&&!!d.call(b,f,e);if(!a){throw $break}});return a},any:function(d,b){d=d||Prototype.K;var a=false;this.each(function(f,e){if(a=!!d.call(b,f,e)){throw $break}});return a},collect:function(d,b){d=d||Prototype.K;var a=[];this.each(function(f,e){a.push(d.call(b,f,e))});return a},detect:function(d,b){var a;this.each(function(f,e){if(d.call(b,f,e)){a=f;throw $break}});return a},findAll:function(d,b){var a=[];this.each(function(f,e){if(d.call(b,f,e)){a.push(f)}});return a},grep:function(e,d,b){d=d||Prototype.K;var a=[];if(Object.isString(e)){e=new RegExp(e)}this.each(function(g,f){if(e.match(g)){a.push(d.call(b,g,f))}});return a},include:function(a){if(Object.isFunction(this.indexOf)){if(this.indexOf(a)!=-1){return true}}var b=false;this.each(function(d){if(d==a){b=true;throw $break}});return b},inGroupsOf:function(b,a){a=Object.isUndefined(a)?null:a;return this.eachSlice(b,function(d){while(d.length<b){d.push(a)}return d})},inject:function(a,d,b){this.each(function(f,e){a=d.call(b,a,f,e)});return a},invoke:function(b){var a=$A(arguments).slice(1);return this.map(function(d){return d[b].apply(d,a)})},max:function(d,b){d=d||Prototype.K;var a;this.each(function(f,e){f=d.call(b,f,e);if(a==null||f>=a){a=f}});return a},min:function(d,b){d=d||Prototype.K;var a;this.each(function(f,e){f=d.call(b,f,e);if(a==null||f<a){a=f}});return a},partition:function(e,b){e=e||Prototype.K;var d=[],a=[];this.each(function(g,f){(e.call(b,g,f)?d:a).push(g)});return[d,a]},pluck:function(b){var a=[];this.each(function(d){a.push(d[b])});return a},reject:function(d,b){var a=[];this.each(function(f,e){if(!d.call(b,f,e)){a.push(f)}});return a},sortBy:function(b,a){return this.map(function(e,d){return{value:e,criteria:b.call(a,e,d)}}).sort(function(g,f){var e=g.criteria,d=f.criteria;return e<d?-1:e>d?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var b=Prototype.K,a=$A(arguments);if(Object.isFunction(a.last())){b=a.pop()}var d=[this].concat(a).map($A);return this.map(function(f,e){return b(d.pluck(e))})},size:function(){return this.toArray().length},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">"}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(d){if(!d){return[]}if(d.toArray){return d.toArray()}var b=d.length||0,a=new Array(b);while(b--){a[b]=d[b]}return a}if(Prototype.Browser.WebKit){$A=function(d){if(!d){return[]}if(!(typeof d==="function"&&typeof d.length==="number"&&typeof d.item==="function")&&d.toArray){return d.toArray()}var b=d.length||0,a=new Array(b);while(b--){a[b]=d[b]}return a}}Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(b){for(var a=0,d=this.length;a<d;a++){b(this[a])}},clear:function(){this.length=0;return this},first:function(){return this[0]},last:function(){return this[this.length-1]},compact:function(){return this.select(function(a){return a!=null})},flatten:function(){return this.inject([],function(b,a){return b.concat(Object.isArray(a)?a.flatten():[a])})},without:function(){var a=$A(arguments);return this.select(function(b){return !a.include(b)})},reverse:function(a){return(a!==false?this:this.toArray())._reverse()},reduce:function(){return this.length>1?this:this[0]},uniq:function(a){return this.inject([],function(e,d,b){if(0==b||(a?e.last()!=d:!e.include(d))){e.push(d)}return e})},intersect:function(a){return this.uniq().findAll(function(b){return a.detect(function(d){return b===d})})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var a=[];this.each(function(b){var d=Object.toJSON(b);if(!Object.isUndefined(d)){a.push(d)}});return"["+a.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(d,a){a||(a=0);var b=this.length;if(a<0){a=b+a}for(;a<b;a++){if(this[a]===d){return a}}return -1}}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(b,a){a=isNaN(a)?this.length:(a<0?this.length+a:a)+1;var d=this.slice(0,a).reverse().indexOf(b);return(d<0)?d:a-d-1}}Array.prototype.toArray=Array.prototype.clone;function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var f=[];for(var b=0,d=this.length;b<d;b++){f.push(this[b])}for(var b=0,d=arguments.length;b<d;b++){if(Object.isArray(arguments[b])){for(var a=0,e=arguments[b].length;a<e;a++){f.push(arguments[b][a])}}else{f.push(arguments[b])}}return f}}Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(b,a){$R(0,this,true).each(b,a);return this},toPaddedString:function(d,b){var a=this.toString(b||10);return"0".times(d-a.length)+a},toJSON:function(){return isFinite(this)?this.toString():"null"}});$w("abs round ceil floor").each(function(a){Number.prototype[a]=Math[a].methodize()});function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function a(b,d){if(Object.isUndefined(d)){return b}return b+"="+encodeURIComponent(String.interpret(d))}return{initialize:function(b){this._object=Object.isHash(b)?b.toObject():Object.clone(b)},_each:function(d){for(var b in this._object){var e=this._object[b],f=[b,e];f.key=b;f.value=e;d(f)}},set:function(b,d){return this._object[b]=d},get:function(b){if(this._object[b]!==Object.prototype[b]){return this._object[b]}},unset:function(b){var d=this._object[b];delete this._object[b];return d},toObject:function(){return Object.clone(this._object)},keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(d){var b=this.detect(function(e){return e.value===d});return b&&b.key},merge:function(b){return this.clone().update(b)},update:function(b){return new Hash(b).inject(this,function(d,e){d.set(e.key,e.value);return d})},toQueryString:function(){return this.inject([],function(e,f){var d=encodeURIComponent(f.key),b=f.value;if(b&&typeof b=="object"){if(Object.isArray(b)){return e.concat(b.map(a.curry(d)))}}else{e.push(a(d,b))}return e}).join("&")},inspect:function(){return"#<Hash:{"+this.map(function(b){return b.map(Object.inspect).join(": ")}).join(", ")+"}>"},toJSON:function(){return Object.toJSON(this.toObject())},clone:function(){return new Hash(this)}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(d,a,b){this.start=d;this.end=a;this.exclusive=b},_each:function(a){var b=this.start;while(this.include(b)){a(b);b=b.succ()}},include:function(a){if(a<this.start){return false}if(this.exclusive){return a<this.end}return a<=this.end}});var $R=function(d,a,b){return new ObjectRange(d,a,b)};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(e,b,d,a){this.each(function(f){if(Object.isFunction(f[e])){try{f[e].apply(f,[b,d,a])}catch(g){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,a){$super(a);this.transport=Ajax.getTransport();this.request(b)},request:function(b){this.url=b;this.method=this.options.method;var f=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){f._method=this.method;this.method="post"}this.parameters=f;if(f=Object.toQueryString(f)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+f}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){f+="&_="}}}try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||f):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(d){this.dispatchException(d)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var f={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){f["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){f.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var d=this.options.requestHeaders;if(Object.isFunction(d.push)){for(var b=0,e=d.length;b<e;b+=2){f[d[b]]=d[b+1]}}else{$H(d).each(function(g){f[g.key]=g.value})}}for(var a in f){this.transport.setRequestHeader(a,f[a])}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var d=Ajax.Request.Events[a],b=new Ajax.Response(this);if(d=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(f){this.dispatchException(f)}var g=b.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&g&&g.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+d]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+d,this,b,b.headerJSON)}catch(f){this.dispatchException(f)}if(d=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return !a||(a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(d){this.request=d;var e=this.transport=d.transport,a=this.readyState=e.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(e.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var b=e.responseXML;this.responseXML=Object.isUndefined(b)?null:b;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a){return null}a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,a,d,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};b=Object.clone(b);var e=b.onComplete;b.onComplete=(function(f,g){this.updateContent(f.responseText);if(Object.isFunction(e)){e(f,g)}}).bind(this);$super(d,b)},updateContent:function(e){var d=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){e=e.stripScripts()}if(d=$(d)){if(a.insertion){if(Object.isString(a.insertion)){var b={};b[a.insertion]=e;d.insert(b)}else{a.insertion(d,e)}}else{d.update(e)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,a,d,b){$super(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=d;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(b){if(arguments.length>1){for(var a=0,e=[],d=arguments.length;a<d;a++){e.push($(arguments[a]))}return e}if(Object.isString(b)){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(g,a){var d=[];var f=document.evaluate(g,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,e=f.snapshotLength;b<e;b++){d.push(Element.extend(f.snapshotItem(b)))}return d}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(){var a=this.Element;this.Element=function(e,d){d=d||{};e=e.toLowerCase();var b=Element.cache;if(Prototype.Browser.IE&&d.name){e="<"+e+' name="'+d.name+'">';delete d.name;return Element.writeAttribute(document.createElement(e),d)}if(!b[e]){b[e]=Element.extend(document.createElement(e))}return Element.writeAttribute(b[e].cloneNode(false),d)};Object.extend(this.Element,a||{});if(a){this.Element.prototype=a.prototype}}).call(window);Element.cache={};Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){a=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:function(a,b){a=$(a);if(b&&b.toElement){b=b.toElement()}if(Object.isElement(b)){return a.update().insert(b)}b=Object.toHTML(b);a.innerHTML=b.stripScripts();b.evalScripts.bind(b).defer();return a},replace:function(b,d){b=$(b);if(d&&d.toElement){d=d.toElement()}else{if(!Object.isElement(d)){d=Object.toHTML(d);var a=b.ownerDocument.createRange();a.selectNode(b);d.evalScripts.bind(d).defer();d=a.createContextualFragment(d.stripScripts())}}b.parentNode.replaceChild(d,b);return b},insert:function(d,f){d=$(d);if(Object.isString(f)||Object.isNumber(f)||Object.isElement(f)||(f&&(f.toElement||f.toHTML))){f={bottom:f}}var e,g,b,h;for(var a in f){e=f[a];a=a.toLowerCase();g=Element._insertionTranslations[a];if(e&&e.toElement){e=e.toElement()}if(Object.isElement(e)){g(d,e);continue}e=Object.toHTML(e);b=((a=="before"||a=="after")?d.parentNode:d).tagName.toUpperCase();h=Element._getContentFromAnonymousElement(b,e.stripScripts());if(a=="top"||a=="after"){h.reverse()}h.each(g.curry(d));e.evalScripts.bind(e).defer()}return d},wrap:function(b,d,a){b=$(b);if(Object.isElement(d)){$(d).writeAttribute(a||{})}else{if(Object.isString(d)){d=new Element(d,a)}else{d=new Element("div",d)}}if(b.parentNode){b.parentNode.replaceChild(d,b)}d.appendChild(b);return d},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(g){var f=g.first(),d=g.last();var e=(b[f]||"").toString();if(e){a+=" "+d+"="+e.inspect(true)}});return a+">"},recursivelyCollect:function(a,d){a=$(a);var b=[];while(a=a[d]){if(a.nodeType==1){b.push(Element.extend(a))}}return b},ancestors:function(a){return $(a).recursivelyCollect("parentNode")},descendants:function(a){return $(a).select("*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild)){return[]}while(a&&a.nodeType!=1){a=a.nextSibling}if(a){return[a].concat($(a).nextSiblings())}return[]},previousSiblings:function(a){return $(a).recursivelyCollect("previousSibling")},nextSiblings:function(a){return $(a).recursivelyCollect("nextSibling")},siblings:function(a){a=$(a);return a.previousSiblings().reverse().concat(a.nextSiblings())},match:function(b,a){if(Object.isString(a)){a=new Selector(a)}return a.match($(b))},up:function(b,e,a){b=$(b);if(arguments.length==1){return $(b.parentNode)}var d=b.ancestors();return Object.isNumber(e)?d[e]:Selector.findElement(d,e,a)},down:function(b,d,a){b=$(b);if(arguments.length==1){return b.firstDescendant()}return Object.isNumber(d)?b.descendants()[d]:Element.select(b,d)[a||0]},previous:function(b,e,a){b=$(b);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(b))}var d=b.previousSiblings();return Object.isNumber(e)?d[e]:Selector.findElement(d,e,a)},next:function(d,e,b){d=$(d);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(d))}var a=d.nextSiblings();return Object.isNumber(e)?a[e]:Selector.findElement(a,e,b)},select:function(){var a=$A(arguments),b=$(a.shift());return Selector.findChildElements(b,a)},adjacent:function(){var a=$A(arguments),b=$(a.shift());return Selector.findChildElements(b.parentNode,a).without(b)},identify:function(b){b=$(b);var d=b.readAttribute("id"),a=arguments.callee;if(d){return d}do{d="anonymous_element_"+a.counter++}while($(d));b.writeAttribute("id",d);return d},readAttribute:function(d,a){d=$(d);if(Prototype.Browser.IE){var b=Element._attributeTranslations.read;if(b.values[a]){return b.values[a](d,a)}if(b.names[a]){a=b.names[a]}if(a.include(":")){return(!d.attributes||!d.attributes[a])?null:d.attributes[a].value}}return d.getAttribute(a)},writeAttribute:function(f,d,g){f=$(f);var b={},e=Element._attributeTranslations.write;if(typeof d=="object"){b=d}else{b[d]=Object.isUndefined(g)?true:g}for(var a in b){d=e.names[a]||a;g=b[a];if(e.values[a]){d=e.values[a](f,g)}if(g===false||g===null){f.removeAttribute(d)}else{if(g===true){f.setAttribute(d,d)}else{f.setAttribute(d,g)}}}return f},getHeight:function(a){return $(a).getDimensions().height},getWidth:function(a){return $(a).getDimensions().width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(!(a=$(a))){return}var d=a.className;return(d.length>0&&(d==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(d)))},addClassName:function(a,b){if(!(a=$(a))){return}if(!a.hasClassName(b)){a.className+=(a.className?" ":"")+b}return a},removeClassName:function(a,b){if(!(a=$(a))){return}a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a},toggleClassName:function(a,b){if(!(a=$(a))){return}return a[a.hasClassName(b)?"removeClassName":"addClassName"](b)},cleanWhitespace:function(b){b=$(b);var d=b.firstChild;while(d){var a=d.nextSibling;if(d.nodeType==3&&!/\S/.test(d.nodeValue)){b.removeChild(d)}d=a}return b},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(b,a){b=$(b),a=$(a);if(b.compareDocumentPosition){return(b.compareDocumentPosition(a)&8)===8}if(a.contains){return a.contains(b)&&a!==b}while(b=b.parentNode){if(b==a){return true}}return false},scrollTo:function(a){a=$(a);var b=a.cumulativeOffset();window.scrollTo(b[0],b[1]);return a},getStyle:function(b,d){b=$(b);d=d=="float"?"cssFloat":d.camelize();var e=b.style[d];if(!e||e=="auto"){var a=document.defaultView.getComputedStyle(b,null);e=a?a[d]:null}if(d=="opacity"){return e?parseFloat(e):1}return e=="auto"?null:e},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(b,d){b=$(b);var f=b.style,a;if(Object.isString(d)){b.style.cssText+=";"+d;return d.include("opacity")?b.setOpacity(d.match(/opacity:\s*(\d?\.?\d*)/)[1]):b}for(var e in d){if(e=="opacity"){b.setOpacity(d[e])}else{f[(e=="float"||e=="cssFloat")?(Object.isUndefined(f.styleFloat)?"cssFloat":"styleFloat"):e]=d[e]}}return b},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;return a},getDimensions:function(d){d=$(d);var h=d.getStyle("display");if(h!="none"&&h!=null){return{width:d.offsetWidth,height:d.offsetHeight}}var b=d.style;var g=b.visibility;var e=b.position;var a=b.display;b.visibility="hidden";b.position="absolute";b.display="block";var k=d.clientWidth;var f=d.clientHeight;b.display=a;b.position=e;b.visibility=g;return{width:k,height:f}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.Opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},cumulativeOffset:function(b){var a=0,d=0;do{a+=b.offsetTop||0;d+=b.offsetLeft||0;b=b.offsetParent}while(b);return Element._returnOffset(d,a)},positionedOffset:function(b){var a=0,e=0;do{a+=b.offsetTop||0;e+=b.offsetLeft||0;b=b.offsetParent;if(b){if(b.tagName.toUpperCase()=="BODY"){break}var d=Element.getStyle(b,"position");if(d!=="static"){break}}}while(b);return Element._returnOffset(e,a)},absolutize:function(b){b=$(b);if(b.getStyle("position")=="absolute"){return b}var e=b.positionedOffset();var g=e[1];var f=e[0];var d=b.clientWidth;var a=b.clientHeight;b._originalLeft=f-parseFloat(b.style.left||0);b._originalTop=g-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=g+"px";b.style.left=f+"px";b.style.width=d+"px";b.style.height=a+"px";return b},relativize:function(a){a=$(a);if(a.getStyle("position")=="relative"){return a}a.style.position="relative";var d=parseFloat(a.style.top||0)-(a._originalTop||0);var b=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=d+"px";a.style.left=b+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a},cumulativeScrollOffset:function(b){var a=0,d=0;do{a+=b.scrollTop||0;d+=b.scrollLeft||0;b=b.parentNode}while(b);return Element._returnOffset(d,a)},getOffsetParent:function(a){if(a.offsetParent){return $(a.offsetParent)}if(a==document.body){return $(a)}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return $(a)}}return $(document.body)},viewportOffset:function(e){var a=0,d=0;var b=e;do{a+=b.offsetTop||0;d+=b.offsetLeft||0;if(b.offsetParent==document.body&&Element.getStyle(b,"position")=="absolute"){break}}while(b=b.offsetParent);b=e;do{if(!Prototype.Browser.Opera||(b.tagName&&(b.tagName.toUpperCase()=="BODY"))){a-=b.scrollTop||0;d-=b.scrollLeft||0}}while(b=b.parentNode);return Element._returnOffset(d,a)},clonePosition:function(b,e){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});e=$(e);var f=e.viewportOffset();b=$(b);var g=[0,0];var d=null;if(Element.getStyle(b,"position")=="absolute"){d=b.getOffsetParent();g=d.viewportOffset()}if(d==document.body){g[0]-=document.body.offsetLeft;g[1]-=document.body.offsetTop}if(a.setLeft){b.style.left=(f[0]-g[0]+a.offsetLeft)+"px"}if(a.setTop){b.style.top=(f[1]-g[1]+a.offsetTop)+"px"}if(a.setWidth){b.style.width=e.offsetWidth+"px"}if(a.setHeight){b.style.height=e.offsetHeight+"px"}return b}};Element.Methods.identify.counter=1;Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(e,b,d){switch(d){case"left":case"top":case"right":case"bottom":if(e(b,"position")==="static"){return null}case"height":case"width":if(!Element.visible(b)){return null}var f=parseInt(e(b,d),10);if(f!==b["offset"+d.capitalize()]){return f+"px"}var a;if(d==="height"){a=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{a=["border-left-width","padding-left","padding-right","border-right-width"]}return a.inject(f,function(g,h){var k=e(b,h);return k===null?g:g-parseInt(k,10)})+"px";default:return e(b,d)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(d,a,b){if(b==="title"){return a.title}return d(a,b)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(d,b){b=$(b);try{b.offsetParent}catch(g){return $(document.body)}var a=b.getStyle("position");if(a!=="static"){return d(b)}b.setStyle({position:"relative"});var f=d(b);b.setStyle({position:a});return f});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=Element.Methods[a].wrap(function(g,d){d=$(d);try{d.offsetParent}catch(k){return Element._returnOffset(0,0)}var b=d.getStyle("position");if(b!=="static"){return g(d)}var f=d.getOffsetParent();if(f&&f.getStyle("position")==="fixed"){f.setStyle({zoom:1})}d.setStyle({position:"relative"});var h=g(d);d.setStyle({position:b});return h})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(b,a){try{a.offsetParent}catch(d){return Element._returnOffset(0,0)}return b(a)});Element.Methods.getStyle=function(a,b){a=$(a);b=(b=="float"||b=="cssFloat")?"styleFloat":b.camelize();var d=a.style[b];if(!d&&a.currentStyle){d=a.currentStyle[b]}if(b=="opacity"){if(d=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(d[1]){return parseFloat(d[1])/100}}return 1}if(d=="auto"){if((b=="width"||b=="height")&&(a.getStyle("display")!="none")){return a["offset"+b.capitalize()]+"px"}return null}return d};Element.Methods.setOpacity=function(b,f){function g(h){return h.replace(/alpha\([^\)]*\)/gi,"")}b=$(b);var a=b.currentStyle;if((a&&!a.hasLayout)||(!a&&b.style.zoom=="normal")){b.style.zoom=1}var e=b.getStyle("filter"),d=b.style;if(f==1||f===""){(e=g(e))?d.filter=e:d.removeAttribute("filter");return b}else{if(f<0.00001){f=0}}d.filter=g(e)+"alpha(opacity="+(f*100)+")";return b};Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(a,b){return a.getAttribute(b,2)},_getAttrNode:function(a,d){var b=a.getAttributeNode(d);return b?b.value:""},_getEv:function(a,b){b=a.getAttribute(b);return b?b.toString().slice(23,-2):null},_flag:function(a,b){return $(a).hasAttribute(b)?b:null},style:function(a){return a.style.cssText.toLowerCase()},title:function(a){return a.title}}}};Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr,src:a._getAttr,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values)}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1)?0.999999:(b==="")?"":(b<0.00001)?0:b;return a}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;if(b==1){if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else{try{var f=document.createTextNode(" ");a.appendChild(f);a.removeChild(f)}catch(d){}}}return a};Element.Methods.cumulativeOffset=function(b){var a=0,d=0;do{a+=b.offsetTop||0;d+=b.offsetLeft||0;if(b.offsetParent==document.body){if(Element.getStyle(b,"position")=="absolute"){break}}b=b.offsetParent}while(b);return Element._returnOffset(d,a)}}}}}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(b,d){b=$(b);if(d&&d.toElement){d=d.toElement()}if(Object.isElement(d)){return b.update().insert(d)}d=Object.toHTML(d);var a=b.tagName.toUpperCase();if(a in Element._insertionTranslations.tags){$A(b.childNodes).each(function(e){b.removeChild(e)});Element._getContentFromAnonymousElement(a,d.stripScripts()).each(function(e){b.appendChild(e)})}else{b.innerHTML=d.stripScripts()}d.evalScripts.bind(d).defer();return b}}if("outerHTML" in document.createElement("div")){Element.Methods.replace=function(d,f){d=$(d);if(f&&f.toElement){f=f.toElement()}if(Object.isElement(f)){d.parentNode.replaceChild(f,d);return d}f=Object.toHTML(f);var e=d.parentNode,b=e.tagName.toUpperCase();if(Element._insertionTranslations.tags[b]){var g=d.next();var a=Element._getContentFromAnonymousElement(b,f.stripScripts());e.removeChild(d);if(g){a.each(function(h){e.insertBefore(h,g)})}else{a.each(function(h){e.appendChild(h)})}}else{d.outerHTML=f.stripScripts()}f.evalScripts.bind(f).defer();return d}}Element._returnOffset=function(b,d){var a=[b,d];a.left=b;a.top=d;return a};Element._getContentFromAnonymousElement=function(d,b){var e=new Element("div"),a=Element._insertionTranslations.tags[d];if(a){e.innerHTML=a[0]+b+a[1];a[2].times(function(){e=e.firstChild})}else{e.innerHTML=b}return $A(e.childNodes)};Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})}).call(Element._insertionTranslations);Element.Methods.Simulated={hasAttribute:function(a,d){d=Element._attributeTranslations.has[d]||d;var b=$(a).getAttributeNode(d);return !!(b&&b.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div")["__proto__"]){window.HTMLElement={};window.HTMLElement.prototype=document.createElement("div")["__proto__"];Prototype.BrowserFeatures.ElementExtensions=true}Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions){return Prototype.K}var a={},b=Element.Methods.ByTag;var d=Object.extend(function(g){if(!g||g._extendedByPrototype||g.nodeType!=1||g==window){return g}var e=Object.clone(a),f=g.tagName.toUpperCase(),k,h;if(b[f]){Object.extend(e,b[f])}for(k in e){h=e[k];if(Object.isFunction(h)&&!(k in g)){g[k]=h.methodize()}}g._extendedByPrototype=Prototype.emptyFunction;return g},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});d.refresh();return d})();Element.hasAttribute=function(a,b){if(a.hasAttribute){return a.hasAttribute(b)}return Element.Methods.Simulated.hasAttribute(a,b)};Element.addMethods=function(d){var k=Prototype.BrowserFeatures,e=Element.Methods.ByTag;if(!d){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var b=d;d=arguments[1]}if(!b){Object.extend(Element.Methods,d||{})}else{if(Object.isArray(b)){b.each(h)}else{h(b)}}function h(m){m=m.toUpperCase();if(!Element.Methods.ByTag[m]){Element.Methods.ByTag[m]={}}Object.extend(Element.Methods.ByTag[m],d)}function a(o,n,m){m=m||false;for(var q in o){var p=o[q];if(!Object.isFunction(p)){continue}if(!m||!(q in n)){n[q]=p.methodize()}}}function f(o){var m;var n={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(n[o]){m="HTML"+n[o]+"Element"}if(window[m]){return window[m]}m="HTML"+o+"Element";if(window[m]){return window[m]}m="HTML"+o.capitalize()+"Element";if(window[m]){return window[m]}window[m]={};window[m].prototype=document.createElement(o)["__proto__"];return window[m]}if(k.ElementExtensions){a(Element.Methods,HTMLElement.prototype);a(Element.Methods.Simulated,HTMLElement.prototype,true)}if(k.SpecificElementExtensions){for(var l in Element.Methods.ByTag){var g=f(l);if(Object.isUndefined(g)){continue}a(e[l],g.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){var a={},b=Prototype.Browser;$w("width height").each(function(f){var e=f.capitalize();if(b.WebKit&&!document.evaluate){a[f]=self["inner"+e]}else{if(b.Opera&&parseFloat(window.opera.version())<9.5){a[f]=document.body["client"+e]}else{a[f]=document.documentElement["client"+e]}}});return a},getWidth:function(){return this.getDimensions().width},getHeight:function(){return this.getDimensions().height},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};var Selector=Class.create({initialize:function(a){this.expression=a.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else{if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}}},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath){return false}var a=this.expression;if(Prototype.Browser.WebKit&&(a.include("-of-type")||a.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(a)){return false}return true},shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false}if(!Selector._div){Selector._div=new Element("div")}try{Selector._div.querySelector(this.expression)}catch(a){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var g=this.expression,h=Selector.patterns,b=Selector.xpath,f,a;if(Selector._cache[g]){this.xpath=Selector._cache[g];return}this.matcher=[".//*"];while(g&&f!=g&&(/\S/).test(g)){f=g;for(var d in h){if(a=g.match(h[d])){this.matcher.push(Object.isFunction(b[d])?b[d](a):new Template(b[d]).evaluate(a));g=g.replace(a[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;var d=this.expression,b;switch(this.mode){case"selectorsAPI":if(a!==document){var f=a.id,g=$(a).identify();d="#"+g+" "+d}b=$A(a.querySelectorAll(d)).map(Element.extend);a.id=f;return b;case"xpath":return document._getElementsByXPath(this.xpath,a);default:return this.matcher(a)}},match:function(l){this.tokens=[];var r=this.expression,a=Selector.patterns,g=Selector.assertions;var b,f,h;while(r&&b!==r&&(/\S/).test(r)){b=r;for(var n in a){f=a[n];if(h=r.match(f)){if(g[n]){this.tokens.push([n,Object.clone(h)]);r=r.replace(h[0],"")}else{return this.findElements(document).include(l)}}}}var q=true,d,o;for(var n=0,k;k=this.tokens[n];n++){d=k[0],o=k[1];if(!Selector.assertions[d](l,o)){q=false;break}}return q},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*"){return""}return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(a){a[1]=a[1].toLowerCase();return new Template("[@#{1}]").evaluate(a)},attr:function(a){a[1]=a[1].toLowerCase();a[3]=a[5]||a[6];return new Template(Selector.xpath.operators[a[2]]).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];if(!b){return""}if(Object.isFunction(b)){return b(a)}return new Template(Selector.xpath.pseudos[a[1]]).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(b){var l=b[6],k=Selector.patterns,a=Selector.xpath,g,d;var h=[];while(l&&g!=l&&(/\S/).test(l)){g=l;for(var f in k){if(b=l.match(k[f])){d=Object.isFunction(a[f])?a[f](b):new Template(a[f]).evaluate(b);h.push("("+d.substring(1,d.length-1)+")");l=l.replace(b[0],"");break}}}return"[not("+h.join(" and ")+")]"},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)},"first-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-of-type"](a)},"last-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](a)},"only-of-type":function(a){var b=Selector.xpath.pseudos;return b["first-of-type"](a)+b["last-of-type"](a)},nth:function(h,f){var k,l=f[6],e;if(l=="even"){l="2n+0"}if(l=="odd"){l="2n+1"}if(k=l.match(/^(\d+)$/)){return"["+h+"= "+k[1]+"]"}if(k=l.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(k[1]=="-"){k[1]=-1}var g=k[1]?Number(k[1]):1;var d=k[2]?Number(k[2]):0;e="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(e).evaluate({fragment:h,a:g,b:d})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(a){a[3]=(a[5]||a[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(a)},pseudo:function(a){if(a[6]){a[6]=a[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(a)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[((?:[\w]+:)?[\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(a,b){return b[1].toUpperCase()==a.tagName.toUpperCase()},className:function(a,b){return Element.hasClassName(a,b[1])},id:function(a,b){return a.id===b[1]},attrPresence:function(a,b){return Element.hasAttribute(a,b[1])},attr:function(b,d){var a=Element.readAttribute(b,d[1]);return a&&Selector.operators[d[2]](a,d[5]||d[6])}},handlers:{concat:function(e,d){for(var f=0,g;g=d[f];f++){e.push(g)}return e},mark:function(a){var e=Prototype.emptyFunction;for(var b=0,d;d=a[b];b++){d._countedByPrototype=e}return a},unmark:function(a){for(var b=0,d;d=a[b];b++){d._countedByPrototype=undefined}return a},index:function(a,e,h){a._countedByPrototype=Prototype.emptyFunction;if(e){for(var b=a.childNodes,f=b.length-1,d=1;f>=0;f--){var g=b[f];if(g.nodeType==1&&(!h||g._countedByPrototype)){g.nodeIndex=d++}}}else{for(var f=0,d=1,b=a.childNodes;g=b[f];f++){if(g.nodeType==1&&(!h||g._countedByPrototype)){g.nodeIndex=d++}}}},unique:function(b){if(b.length==0){return b}var e=[],f;for(var d=0,a=b.length;d<a;d++){if(!(f=b[d])._countedByPrototype){f._countedByPrototype=Prototype.emptyFunction;e.push(Element.extend(f))}}return Selector.handlers.unmark(e)},descendant:function(a){var e=Selector.handlers;for(var d=0,b=[],f;f=a[d];d++){e.concat(b,f.getElementsByTagName("*"))}return b},child:function(a){var f=Selector.handlers;for(var e=0,d=[],g;g=a[e];e++){for(var b=0,k;k=g.childNodes[b];b++){if(k.nodeType==1&&k.tagName!="!"){d.push(k)}}}return d},adjacent:function(a){for(var d=0,b=[],f;f=a[d];d++){var e=this.nextElementSibling(f);if(e){b.push(e)}}return b},laterSibling:function(a){var e=Selector.handlers;for(var d=0,b=[],f;f=a[d];d++){e.concat(b,Element.nextSiblings(f))}return b},nextElementSibling:function(a){while(a=a.nextSibling){if(a.nodeType==1){return a}}return null},previousElementSibling:function(a){while(a=a.previousSibling){if(a.nodeType==1){return a}}return null},tagName:function(a,l,d,b){var m=d.toUpperCase();var f=[],k=Selector.handlers;if(a){if(b){if(b=="descendant"){for(var g=0,e;e=a[g];g++){k.concat(f,e.getElementsByTagName(d))}return f}else{a=this[b](a)}if(d=="*"){return a}}for(var g=0,e;e=a[g];g++){if(e.tagName.toUpperCase()===m){f.push(e)}}return f}else{return l.getElementsByTagName(d)}},id:function(b,a,l,g){var k=$(l),e=Selector.handlers;if(!k){return[]}if(!b&&a==document){return[k]}if(b){if(g){if(g=="child"){for(var d=0,f;f=b[d];d++){if(k.parentNode==f){return[k]}}}else{if(g=="descendant"){for(var d=0,f;f=b[d];d++){if(Element.descendantOf(k,f)){return[k]}}}else{if(g=="adjacent"){for(var d=0,f;f=b[d];d++){if(Selector.handlers.previousElementSibling(k)==f){return[k]}}}else{b=e[g](b)}}}}for(var d=0,f;f=b[d];d++){if(f==k){return[k]}}return[]}return(k&&Element.descendantOf(k,a))?[k]:[]},className:function(b,a,d,e){if(b&&e){b=this[e](b)}return Selector.handlers.byClassName(b,a,d)},byClassName:function(d,b,g){if(!d){d=Selector.handlers.descendant([b])}var k=" "+g+" ";for(var f=0,e=[],h,a;h=d[f];f++){a=h.className;if(a.length==0){continue}if(a==g||(" "+a+" ").include(k)){e.push(h)}}return e},attrPresence:function(d,b,a,h){if(!d){d=b.getElementsByTagName("*")}if(d&&h){d=this[h](d)}var f=[];for(var e=0,g;g=d[e];e++){if(Element.hasAttribute(g,a)){f.push(g)}}return f},attr:function(a,l,k,m,d,b){if(!a){a=l.getElementsByTagName("*")}if(a&&b){a=this[b](a)}var n=Selector.operators[d],g=[];for(var f=0,e;e=a[f];f++){var h=Element.readAttribute(e,k);if(h===null){continue}if(n(h,m)){g.push(e)}}return g},pseudo:function(b,d,f,a,e){if(b&&e){b=this[e](b)}if(!b){b=a.getElementsByTagName("*")}return Selector.pseudos[d](b,f,a)}},pseudos:{"first-child":function(b,g,a){for(var e=0,d=[],f;f=b[e];e++){if(Selector.handlers.previousElementSibling(f)){continue}d.push(f)}return d},"last-child":function(b,g,a){for(var e=0,d=[],f;f=b[e];e++){if(Selector.handlers.nextElementSibling(f)){continue}d.push(f)}return d},"only-child":function(b,k,a){var f=Selector.handlers;for(var e=0,d=[],g;g=b[e];e++){if(!f.previousElementSibling(g)&&!f.nextElementSibling(g)){d.push(g)}}return d},"nth-child":function(b,d,a){return Selector.pseudos.nth(b,d,a)},"nth-last-child":function(b,d,a){return Selector.pseudos.nth(b,d,a,true)},"nth-of-type":function(b,d,a){return Selector.pseudos.nth(b,d,a,false,true)},"nth-last-of-type":function(b,d,a){return Selector.pseudos.nth(b,d,a,true,true)},"first-of-type":function(b,d,a){return Selector.pseudos.nth(b,"1",a,false,true)},"last-of-type":function(b,d,a){return Selector.pseudos.nth(b,"1",a,true,true)},"only-of-type":function(b,e,a){var d=Selector.pseudos;return d["last-of-type"](d["first-of-type"](b,e,a),e,a)},getIndices:function(e,d,f){if(e==0){return d>0?[d]:[]}return $R(1,f).inject([],function(a,b){if(0==(b-d)%e&&(b-d)/e>=0){a.push(b)}return a})},nth:function(d,u,w,t,f){if(d.length==0){return[]}if(u=="even"){u="2n+0"}if(u=="odd"){u="2n+1"}var r=Selector.handlers,q=[],e=[],k;r.mark(d);for(var p=0,g;g=d[p];p++){if(!g.parentNode._countedByPrototype){r.index(g.parentNode,t,f);e.push(g.parentNode)}}if(u.match(/^\d+$/)){u=Number(u);for(var p=0,g;g=d[p];p++){if(g.nodeIndex==u){q.push(g)}}}else{if(k=u.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(k[1]=="-"){k[1]=-1}var x=k[1]?Number(k[1]):1;var v=k[2]?Number(k[2]):0;var y=Selector.pseudos.getIndices(x,v,d.length);for(var p=0,g,n=y.length;g=d[p];p++){for(var o=0;o<n;o++){if(g.nodeIndex==y[o]){q.push(g)}}}}}r.unmark(d);r.unmark(e);return q},empty:function(b,g,a){for(var e=0,d=[],f;f=b[e];e++){if(f.tagName=="!"||f.firstChild){continue}d.push(f)}return d},not:function(a,e,n){var k=Selector.handlers,o,d;var l=new Selector(e).findElements(n);k.mark(l);for(var g=0,f=[],b;b=a[g];g++){if(!b._countedByPrototype){f.push(b)}}k.unmark(l);return f},enabled:function(b,g,a){for(var e=0,d=[],f;f=b[e];e++){if(!f.disabled&&(!f.type||f.type!=="hidden")){d.push(f)}}return d},disabled:function(b,g,a){for(var e=0,d=[],f;f=b[e];e++){if(f.disabled){d.push(f)}}return d},checked:function(b,g,a){for(var e=0,d=[],f;f=b[e];e++){if(f.checked){d.push(f)}}return d}},operators:{"=":function(b,a){return b==a},"!=":function(b,a){return b!=a},"^=":function(b,a){return b==a||b&&b.startsWith(a)},"$=":function(b,a){return b==a||b&&b.endsWith(a)},"*=":function(b,a){return b==a||b&&b.include(a)},"$=":function(b,a){return b.endsWith(a)},"*=":function(b,a){return b.include(a)},"~=":function(b,a){return(" "+b+" ").include(" "+a+" ")},"|=":function(b,a){return("-"+(b||"").toUpperCase()+"-").include("-"+(a||"").toUpperCase()+"-")}},split:function(b){var a=[];b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(d){a.push(d[1].strip())});return a},matchElements:function(g,k){var f=$$(k),e=Selector.handlers;e.mark(f);for(var d=0,b=[],a;a=g[d];d++){if(a._countedByPrototype){b.push(a)}}e.unmark(f);return b},findElement:function(b,d,a){if(Object.isNumber(d)){a=d;d=false}return Selector.matchElements(b,d||"*")[a||0]},findChildElements:function(f,k){k=Selector.split(k.join(","));var e=[],g=Selector.handlers;for(var d=0,b=k.length,a;d<b;d++){a=new Selector(k[d].strip());g.concat(e,a.findElements(f))}return(b>1)?g.unique(e):e}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(e,d){for(var f=0,g;g=d[f];f++){if(g.tagName!=="!"){e.push(g)}}return e},unmark:function(a){for(var b=0,d;d=a[b];b++){d.removeAttribute("_countedByPrototype")}return a}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){$(a).reset();return a},serializeElements:function(h,b){if(typeof b!="object"){b={hash:!!b}}else{if(Object.isUndefined(b.hash)){b.hash=true}}var d,g,a=false,f=b.submit;var e=h.inject({},function(k,l){if(!l.disabled&&l.name){d=l.name;g=$(l).getValue();if(g!=null&&l.type!="file"&&(l.type!="submit"||(!a&&f!==false&&(!f||d==f)&&(a=true)))){if(d in k){if(!Object.isArray(k[d])){k[d]=[k[d]]}k[d].push(g)}else{k[d]=g}}}return k});return b.hash?e:Object.toQueryString(e)}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(b,d){if(Form.Element.Serializers[d.tagName.toLowerCase()]){b.push(Element.extend(d))}return b})},getInputs:function(h,d,e){h=$(h);var a=h.getElementsByTagName("input");if(!d&&!e){return $A(a).map(Element.extend)}for(var f=0,k=[],g=a.length;f<g;f++){var b=a[f];if((d&&b.type!=d)||(e&&b.name!=e)){continue}k.push(Element.extend(b))}return k},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(b){var d=$(b).getElements().findAll(function(e){return"hidden"!=e.type&&!e.disabled});var a=d.findAll(function(e){return e.hasAttribute("tabIndex")&&e.tabIndex>=0}).sortBy(function(e){return e.tabIndex}).first();return a?a:d.find(function(e){return["input","select","textarea"].include(e.tagName.toLowerCase())})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(b,a){b=$(b),a=Object.clone(a||{});var e=a.parameters,d=b.readAttribute("action")||"";if(d.blank()){d=window.location.href}a.parameters=b.serialize(true);if(e){if(Object.isString(e)){e=e.toQueryParams()}Object.extend(a.parameters,e)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(d,a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var d={};d[a.name]=b;return Object.toQueryString(d)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var d=a.tagName.toLowerCase();Form.Element.Serializers[d](a,b);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(a.type))){a.select()}}catch(b){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(a,b){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a,b);default:return Form.Element.Serializers.textarea(a,b)}},inputSelector:function(a,b){if(Object.isUndefined(b)){return a.checked?a.value:null}else{a.checked=!!b}},textarea:function(a,b){if(Object.isUndefined(b)){return a.value}else{a.value=b}},select:function(d,g){if(Object.isUndefined(g)){return this[d.type=="select-one"?"selectOne":"selectMany"](d)}else{var b,e,h=!Object.isArray(g);for(var a=0,f=d.length;a<f;a++){b=d.options[a];e=this.optionValue(b);if(h){if(e==g){b.selected=true;return}}else{b.selected=g.include(e)}}}},selectOne:function(b){var a=b.selectedIndex;return a>=0?this.optionValue(b.options[a]):null},selectMany:function(e){var a,f=e.length;if(!f){return null}for(var d=0,a=[];d<f;d++){var b=e.options[d];if(b.selected){a.push(this.optionValue(b))}}return a},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,a,b,d){$super(d,b);this.element=$(a);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});if(!window.Event){var Event={}}Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{},relatedTarget:function(b){var a;switch(b.type){case"mouseover":a=b.fromElement;break;case"mouseout":a=b.toElement;break;default:return null}return Element.extend(a)}});Event.Methods=(function(){var a;if(Prototype.Browser.IE){var b={0:1,1:4,2:2};a=function(e,d){return e.button==b[d]}}else{if(Prototype.Browser.WebKit){a=function(e,d){switch(d){case 0:return e.which==1&&!e.metaKey;case 1:return e.which==1&&e.metaKey;default:return false}}}else{a=function(e,d){return e.which?(e.which===d+1):(e.button===d)}}}return{isLeftClick:function(d){return a(d,0)},isMiddleClick:function(d){return a(d,1)},isRightClick:function(d){return a(d,2)},element:function(f){f=Event.extend(f);var e=f.target,d=f.type,g=f.currentTarget;if(g&&g.tagName){if(d==="load"||d==="error"||(d==="click"&&g.tagName.toLowerCase()==="input"&&g.type==="radio")){e=g}}if(e.nodeType==Node.TEXT_NODE){e=e.parentNode}return Element.extend(e)},findElement:function(e,g){var d=Event.element(e);if(!g){return d}var f=[d].concat(d.ancestors());return Selector.findElement(f,g,0)},pointer:function(f){var e=document.documentElement,d=document.body||{scrollLeft:0,scrollTop:0};return{x:f.pageX||(f.clientX+(e.scrollLeft||d.scrollLeft)-(e.clientLeft||0)),y:f.pageY||(f.clientY+(e.scrollTop||d.scrollTop)-(e.clientTop||0))}},pointerX:function(d){return Event.pointer(d).x},pointerY:function(d){return Event.pointer(d).y},stop:function(d){Event.extend(d);d.preventDefault();d.stopPropagation();d.stopped=true}}})();Event.extend=(function(){var a=Object.keys(Event.Methods).inject({},function(b,d){b[d]=Event.Methods[d].methodize();return b});if(Prototype.Browser.IE){Object.extend(a,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});return function(b){if(!b){return false}if(b._extendedByPrototype){return b}b._extendedByPrototype=Prototype.emptyFunction;var d=Event.pointer(b);Object.extend(b,{target:b.srcElement,relatedTarget:Event.relatedTarget(b),pageX:d.x,pageY:d.y});return Object.extend(b,a)}}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents")["__proto__"];Object.extend(Event.prototype,a);return Prototype.K}})();Object.extend(Event,(function(){var b=Event.cache;function d(m){if(m._prototypeEventID){return m._prototypeEventID[0]}arguments.callee.id=arguments.callee.id||1;return m._prototypeEventID=[++arguments.callee.id]}function h(m){if(m&&m.include(":")){return"dataavailable"}return m}function a(m){return b[m]=b[m]||{}}function g(o,m){var n=a(o);return n[m]=n[m]||[]}function k(n,m,o){var r=d(n);var q=g(r,m);if(q.pluck("handler").include(o)){return false}var p=function(t){if(!Event||!Event.extend||(t.eventName&&t.eventName!=m)){return false}Event.extend(t);o.call(n,t)};p.handler=o;q.push(p);return p}function l(p,m,n){var o=g(p,m);return o.find(function(q){return q.handler==n})}function e(p,m,n){var o=a(p);if(!o[m]){return false}o[m]=o[m].without(l(p,m,n))}function f(){for(var n in b){for(var m in b[n]){b[n][m]=null}}}if(window.attachEvent){window.attachEvent("onunload",f)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}return{observe:function(o,m,p){o=$(o);var n=h(m);var q=k(o,m,p);if(!q){return o}if(o.addEventListener){o.addEventListener(n,q,false)}else{o.attachEvent("on"+n,q)}return o},stopObserving:function(o,m,p){o=$(o);var r=d(o),n=h(m);if(!p&&m){g(r,m).each(function(t){o.stopObserving(m,t.handler)});return o}else{if(!m){Object.keys(a(r)).each(function(t){o.stopObserving(t)});return o}}var q=l(r,m,p);if(!q){return o}if(o.removeEventListener){o.removeEventListener(n,q,false)}else{o.detachEvent("on"+n,q)}e(r,m,p);return o},fire:function(o,n,m){o=$(o);if(o==document&&document.createEvent&&!o.dispatchEvent){o=document.documentElement}var p;if(document.createEvent){p=document.createEvent("HTMLEvents");p.initEvent("dataavailable",true,true)}else{p=document.createEventObject();p.eventType="ondataavailable"}p.eventName=n;p.memo=m||{};if(document.createEvent){o.dispatchEvent(p)}else{o.fireEvent(p.eventType,p)}return Event.extend(p)}}})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize(),loaded:false});(function(){var b;function a(){if(document.loaded){return}if(b){window.clearInterval(b)}document.fire("dom:loaded");document.loaded=true}if(document.addEventListener){if(Prototype.Browser.WebKit){b=window.setInterval(function(){if(/loaded|complete/.test(document.readyState)){a()}},0);Event.observe(window,"load",a)}else{document.addEventListener("DOMContentLoaded",a,false)}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;a()}}}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(b,a,d){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,d)}this.xcomp=a;this.ycomp=d;this.offset=Element.cumulativeOffset(b);return(d>=this.offset[1]&&d<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,e){var d=Element.cumulativeScrollOffset(b);this.xcomp=a+d[0]-this.deltaX;this.ycomp=e+d[1]-this.deltaY;this.offset=Element.cumulativeOffset(b);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,d,a){a=a||{};return Element.clonePosition(d,b,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(d){return d.blank()?null:"[contains(concat(' ', @class, ' '), ' "+d+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(d,f){f=f.toString().strip();var e=/\s/.test(f)?$w(f).map(a).join(""):a(f);return e?document._getElementsByXPath(".//*"+e,d):[]}:function(f,g){g=g.toString().strip();var h=[],k=(/\s/.test(g)?$w(g):null);if(!k&&!g){return h}var d=$(f).getElementsByTagName("*");g=" "+g+" ";for(var e=0,m,l;m=d[e];e++){if(m.className&&(l=" "+m.className+" ")&&(l.include(g)||(k&&k.all(function(n){return !n.toString().blank()&&l.include(" "+n+" ")})))){h.push(Element.extend(m))}}return h};return function(e,d){return $(d||document.body).getElementsByClassName(e)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();var Flotr={version:"0.2.0-test",author:"Bas Wenneker",website:"http://www.solutoire.com",_registeredTypes:{lines:"drawSeriesLines",points:"drawSeriesPoints",bars:"drawSeriesBars",candles:"drawSeriesCandles",pie:"drawSeriesPie"},register:function(e,d){Flotr._registeredTypes[e]=d+""},draw:function(e,g,f,h){h=h||Flotr.Graph;return new h(e,g,f)},getSeries:function(b){return b.collect(function(d){var a;d=(d.data)?Object.clone(d):{data:d};for(a=d.data.length-1;a>-1;--a){d.data[a][1]=(d.data[a][1]===null?null:parseFloat(d.data[a][1]))}return d})},merge:function(g,e){var f=e||{};for(var h in g){f[h]=(g[h]!=null&&typeof(g[h])=="object"&&!(g[h].constructor==Array||g[h].constructor==RegExp)&&!Object.isElement(g[h]))?Flotr.merge(g[h],e[h]):f[h]=g[h]}return f},getTickSize:function(p,q,l,k){var m=(l-q)/p;var n=Flotr.getMagnitude(m);var r=m/n;var o=10;if(r<1.5){o=1}else{if(r<2.25){o=2}else{if(r<3){o=((k==0)?2:2.5)}else{if(r<7.5){o=5}}}}return o*n},defaultTickFormatter:function(b){return b+""},defaultTrackFormatter:function(b){return"("+b.x+", "+b.y+")"},defaultPieLabelFormatter:function(b){return(b.fraction*100).toFixed(2)+"%"},convertToBytes:function(h,g,k){var l=["Y","Z","E","P","T","G","M","k",""],f=l.length;k=k||1024;g=g||2;while(f--&&h>1024){h/=k}return(Math.round(h*g)/g)+l[f]},getMagnitude:function(b){return Math.pow(10,Math.floor(Math.log(b)/Math.LN10))},toPixel:function(b){return Math.floor(b)+0.5},toRad:function(b){return -b*(Math.PI/180)},parseColor:function(g){if(g instanceof Flotr.Color){return g}var f,h=Flotr.Color;if((f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g))){return new h(parseInt(f[1]),parseInt(f[2]),parseInt(f[3]))}if((f=/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(g))){return new h(parseInt(f[1]),parseInt(f[2]),parseInt(f[3]),parseFloat(f[4]))}if((f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g))){return new h(parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55)}if((f=/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(g))){return new h(parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55,parseFloat(f[4]))}if((f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g))){return new h(parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16))}if((f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g))){return new h(parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16))}var e=g.strip().toLowerCase();if(e=="transparent"){return new h(255,255,255,0)}return((f=h.lookupColors[e]))?new h(f[0],f[1],f[2]):false},extractColor:function(d){var e;do{e=d.getStyle("background-color").toLowerCase();if(!(e==""||e=="transparent")){break}d=d.up(0)}while(!d.nodeName.match(/^body$/i));return(e=="rgba(0, 0, 0, 0)")?"transparent":e}};Flotr.Graph=Class.create({initialize:function(d,f,e){this.el=$(d);if(!this.el){throw"The target container doesn't exist"}this.data=f;this.series=Flotr.getSeries(f);this.setOptions(e);this.lastMousePos={pageX:null,pageY:null};this.selection={first:{x:-1,y:-1},second:{x:-1,y:-1}};this.plotOffset={left:0,right:0,top:0,bottom:0};this.prevSelection=null;this.selectionInterval=null;this.ignoreClick=false;this.prevHit=null;this.constructCanvas();this.initEvents();this.findDataRanges();this.calculateTicks(this.axes.x);this.calculateTicks(this.axes.x2);this.calculateTicks(this.axes.y);this.calculateTicks(this.axes.y2);this.calculateSpacing();this.draw();this.insertLegend();if(this.options.spreadsheet.show){this.constructTabs()}},setOptions:function(H){var J={colors:["#00A8F0","#C0D800","#CB4B4B","#4DA74D","#9440ED"],title:null,subtitle:null,legend:{show:true,noColumns:1,labelFormatter:Prototype.K,labelBoxBorderColor:"#CCCCCC",labelBoxWidth:14,labelBoxHeight:10,labelBoxMargin:5,container:null,position:"nw",margin:5,backgroundColor:null,backgroundOpacity:0.85},xaxis:{ticks:null,showLabels:true,labelsAngle:0,title:null,titleAngle:0,noTicks:5,tickFormatter:Flotr.defaultTickFormatter,tickDecimals:null,min:null,max:null,autoscaleMargin:0,color:null},x2axis:{},yaxis:{ticks:null,showLabels:true,labelsAngle:0,title:null,titleAngle:90,noTicks:5,tickFormatter:Flotr.defaultTickFormatter,tickDecimals:null,min:null,max:null,autoscaleMargin:0,color:null},y2axis:{titleAngle:270},points:{show:false,radius:3,lineWidth:2,fill:true,fillColor:"#FFFFFF",fillOpacity:0.4},lines:{show:false,lineWidth:2,fill:false,fillColor:null,fillOpacity:0.4},bars:{show:false,lineWidth:2,barWidth:1,fill:true,fillColor:null,fillOpacity:0.4,horizontal:false,stacked:false,centered:true},candles:{show:false,lineWidth:1,wickLineWidth:1,candleWidth:0.6,fill:true,upFillColor:"#00A8F0",downFillColor:"#CB4B4B",fillOpacity:0.5,barcharts:false},pie:{show:false,lineWidth:1,fill:true,fillColor:null,fillOpacity:0.6,explode:6,sizeRatio:0.6,startAngle:Math.PI/4,labelFormatter:Flotr.defaultPieLabelFormatter,pie3D:false,pie3DviewAngle:(Math.PI/2*0.8),pie3DspliceThickness:20},grid:{color:"#545454",backgroundColor:null,tickColor:"#DDDDDD",labelMargin:3,verticalLines:true,horizontalLines:true,outlineWidth:2},selection:{mode:null,color:"#B6D9FF",fps:20},crosshair:{mode:null,color:"#FF0000",hideCursor:true},mouse:{track:false,position:"se",relative:false,trackFormatter:Flotr.defaultTrackFormatter,margin:5,lineColor:"#FF3F19",trackDecimals:1,sensibility:2,radius:3},shadowSize:4,defaultType:"lines",HtmlText:true,fontSize:7.5,spreadsheet:{show:false,tabGraphLabel:"Graph",tabDataLabel:"Data",toolbarDownload:"Download CSV",toolbarSelectAll:"Select all"}};J.x2axis=Object.extend(Object.clone(J.xaxis),J.x2axis);J.y2axis=Object.extend(Object.clone(J.yaxis),J.y2axis);this.options=Flotr.merge((H||{}),J);this.axes={x:{options:this.options.xaxis,n:1},x2:{options:this.options.x2axis,n:2},y:{options:this.options.yaxis,n:1},y2:{options:this.options.y2axis,n:2}};var B=[],G=[],y=this.series.length,v=this.series.length,F=this.options.colors,I=[],C=0,w,z,A,u,E;for(z=v-1;z>-1;--z){w=this.series[z].color;if(w!=null){--v;if(Object.isNumber(w)){B.push(w)}else{I.push(Flotr.parseColor(w))}}}for(z=B.length-1;z>-1;--z){v=Math.max(v,B[z]+1)}for(z=0;G.length<v;){w=(F.length==z)?new Flotr.Color(100,100,100):Flotr.parseColor(F[z]);var D=C%2==1?-1:1;var x=1+D*Math.ceil(C/2)*0.2;w.scale(x,x,x);G.push(w);if(++z>=F.length){z=0;++C}}for(z=0,A=0;z<y;++z){u=this.series[z];if(u.color==null){u.color=G[A++].toString()}else{if(Object.isNumber(u.color)){u.color=G[u.color].toString()}}if(!u.xaxis){u.xaxis=this.axes.x}if(u.xaxis==1){u.xaxis=this.axes.x}else{if(u.xaxis==2){u.xaxis=this.axes.x2}}if(!u.yaxis){u.yaxis=this.axes.y}if(u.yaxis==1){u.yaxis=this.axes.y}else{if(u.yaxis==2){u.yaxis=this.axes.y2}}u.lines=Object.extend(Object.clone(this.options.lines),u.lines);u.points=Object.extend(Object.clone(this.options.points),u.points);u.bars=Object.extend(Object.clone(this.options.bars),u.bars);u.candles=Object.extend(Object.clone(this.options.candles),u.candles);u.pie=Object.extend(Object.clone(this.options.pie),u.pie);u.mouse=Object.extend(Object.clone(this.options.mouse),u.mouse);if(u.shadowSize==null){u.shadowSize=this.options.shadowSize}}},constructCanvas:function(){var k=this.el,f,h,g;this.canvas=k.select(".flotr-canvas")[0];this.overlay=k.select(".flotr-overlay")[0];k.childElements().invoke("remove");k.setStyle({position:"relative",cursor:"default"});this.canvasWidth=k.getWidth();this.canvasHeight=k.getHeight();f={width:this.canvasWidth,height:this.canvasHeight};if(this.canvasWidth<=0||this.canvasHeight<=0){throw"Invalid dimensions for plot, width = "+this.canvasWidth+", height = "+this.canvasHeight}if(!this.canvas){h=this.canvas=$(document.createElement("canvas"));h.className="flotr-canvas";h=h.writeAttribute("style","position:absolute;left:0px;top:0px;")}h=this.canvas.writeAttribute(f).show();k.insert(h);if(!this.overlay){g=this.overlay=$(document.createElement("canvas"));g.className="flotr-overlay";g=g.writeAttribute("style","position:absolute;left:0px;top:0px;")}g=this.overlay.writeAttribute(f).show();k.insert(g);if(Prototype.Browser.IE){h=window.G_vmlCanvasManager.initElement(h);g=window.G_vmlCanvasManager.initElement(g)}this.ctx=h.getContext("2d");this.octx=g.getContext("2d");this.textEnabled=!!this.ctx.drawText},getTextDimensions:function(k,n,g,m){if(!k){return{width:0,height:0}}if(!this.options.HtmlText&&this.textEnabled){var l=this.ctx.getTextBounds(k,n);return{width:l.width+2,height:l.height+6}}else{var h=this.el.insert('<div style="position:absolute;top:-10000px;'+g+'" class="'+m+' flotr-dummy-div">'+k+"</div>").select(".flotr-dummy-div")[0];dim=h.getDimensions();h.remove();return dim}},loadDataGrid:function(){if(this.seriesData){return this.seriesData}var e=this.series,d=[];for(i=0;i<e.length;++i){e[i].data.each(function(k){var l=k[0],a=k[1],b=d.find(function(f){return f[0]==l});if(b){b[i+1]=a}else{var h=[];h[0]=l;h[i+1]=a;d.push(h)}})}d=d.sortBy(function(a){return a[0]});return this.seriesData=d},showTab:function(d){var e="canvas, .flotr-labels, .flotr-legend, .flotr-legend-bg, .flotr-title, .flotr-subtitle";switch(d){case"graph":this.datagrid.up().hide();this.el.select(e).invoke("show");this.tabs.data.removeClassName("selected");this.tabs.graph.addClassName("selected");break;case"data":this.constructDataGrid();this.datagrid.up().show();this.el.select(e).invoke("hide");this.tabs.data.addClassName("selected");this.tabs.graph.removeClassName("selected");break}},constructTabs:function(){var b=new Element("div",{className:"flotr-tabs-group",style:"position:absolute;left:0px;top:"+this.canvasHeight+"px;width:"+this.canvasWidth+"px;"});this.el.insert({bottom:b});this.tabs={graph:new Element("div",{className:"flotr-tab selected",style:"float:left;"}).update(this.options.spreadsheet.tabGraphLabel),data:new Element("div",{className:"flotr-tab",style:"float:left;"}).update(this.options.spreadsheet.tabDataLabel)};b.insert(this.tabs.graph).insert(this.tabs.data);this.el.setStyle({height:this.canvasHeight+this.tabs.data.getHeight()+2+"px"});this.tabs.graph.observe("click",(function(){this.showTab("graph")}).bind(this));this.tabs.data.observe("click",(function(){this.showTab("data")}).bind(this))},constructDataGrid:function(){if(this.datagrid){return this.datagrid}var z,B,q=this.series,t=this.loadDataGrid(),r=this.datagrid=new Element("table",{className:"flotr-datagrid",style:"height:100px;"}),A=["<colgroup><col />"];var x=['<tr class="first-row">'];x.push("<th>&nbsp;</th>");for(z=0;z<q.length;++z){x.push('<th scope="col">'+(q[z].label||String.fromCharCode(65+z))+"</th>");A.push("<col />")}x.push("</tr>");for(B=0;B<t.length;++B){x.push("<tr>");for(z=0;z<q.length+1;++z){var p="td";var w=(t[B][z]!=null?Math.round(t[B][z]*100000)/100000:"");if(z==0){p="th";var u;if(this.options.xaxis.ticks){var y=this.options.xaxis.ticks.find(function(a){return a[0]==t[B][z]});if(y){u=y[1]}}else{u=this.options.xaxis.tickFormatter(w)}if(u){w=u}}x.push("<"+p+(p=="th"?' scope="row"':"")+">"+w+"</"+p+">")}x.push("</tr>")}A.push("</colgroup>");r.update(A.join("")+x.join(""));if(!Prototype.Browser.IE){r.select("td").each(function(a){a.observe("mouseover",function(d){a=d.element();var b=a.previousSiblings();r.select("th[scope=col]")[b.length-1].addClassName("hover");r.select("colgroup col")[b.length].addClassName("hover")});a.observe("mouseout",function(){r.select("colgroup col.hover, th.hover").each(function(b){b.removeClassName("hover")})})})}var v=new Element("div",{className:"flotr-datagrid-toolbar"}).insert(new Element("button",{type:"button",className:"flotr-datagrid-toolbar-button"}).update(this.options.spreadsheet.toolbarDownload).observe("click",this.downloadCSV.bind(this))).insert(new Element("button",{type:"button",className:"flotr-datagrid-toolbar-button"}).update(this.options.spreadsheet.toolbarSelectAll).observe("click",this.selectAllData.bind(this)));var C=new Element("div",{className:"flotr-datagrid-container",style:"left:0px;top:0px;width:"+this.canvasWidth+"px;height:"+this.canvasHeight+"px;overflow:auto;"});C.insert(v);r.wrap(C.hide());this.el.insert(C);return r},selectAllData:function(){if(this.tabs){var f,g,h,k,l=this.constructDataGrid();this.showTab("data");(function(){if((h=l.ownerDocument)&&(k=h.defaultView)&&k.getSelection&&h.createRange&&(f=window.getSelection())&&f.removeAllRanges){g=h.createRange();g.selectNode(l);f.removeAllRanges();f.addRange(g)}else{if(document.body&&document.body.createTextRange&&(g=document.body.createTextRange())){g.moveToElementText(l);g.select()}}}).defer();return true}else{return false}},downloadCSV:function(){var k,g='"x"',l=this.series,h=this.loadDataGrid();for(k=0;k<l.length;++k){g+='%09"'+(l[k].label||String.fromCharCode(65+k))+'"'}g+="%0D%0A";for(k=0;k<h.length;++k){if(this.options.xaxis.ticks){var f=this.options.xaxis.ticks.find(function(a){return a[0]==h[k][0]});if(f){h[k][0]=f[1]}}else{h[k][0]=this.options.xaxis.tickFormatter(h[k][0])}g+=h[k].join("%09")+"%0D%0A"}if(Prototype.Browser.IE){g=g.gsub("%09","\t").gsub("%0A","\n").gsub("%0D","\r");window.open().document.write(g)}else{window.open("data:text/csv,"+g)}},initEvents:function(){this.overlay.stopObserving();this.overlay.observe("mousedown",this.mouseDownHandler.bind(this));this.overlay.observe("mousemove",this.mouseMoveHandler.bind(this));this.overlay.observe("click",this.clickHandler.bind(this))},findDataRanges:function(){var a=this.series,p=this.axes;p.x.datamin=p.x.datamax=p.x2.datamin=p.x2.datamax=p.y.datamin=p.y.datamax=p.y2.datamin=p.y2.datamax=0;if(a.length>0){var u,w,t,o,q,v,h,r;for(u=0;u<a.length;++u){v=a[u].data,h=a[u].xaxis,r=a[u].yaxis;if(v.length>0&&!a[u].hide){if(!h.used){h.datamin=h.datamax=v[0][0]}if(!r.used){r.datamin=r.datamax=v[0][1]}h.used=true;r.used=true;for(t=v.length-1;t>-1;--t){o=v[t][0];if(o<h.datamin){h.datamin=o}else{if(o>h.datamax){h.datamax=o}}for(w=1;w<v[t].length;w++){q=v[t][w];if(q<r.datamin){r.datamin=q}else{if(q>r.datamax){r.datamax=q}}}}}}}this.findXAxesValues();this.calculateRange(p.x);this.extendXRangeIfNeededByBar(p.x);if(p.x2.used){this.calculateRange(p.x2);this.extendXRangeIfNeededByBar(p.x2)}this.calculateRange(p.y);this.extendYRangeIfNeededByBar(p.y);if(p.y2.used){this.calculateRange(p.y2);this.extendYRangeIfNeededByBar(p.y2)}},calculateRange:function(m){var k=m.options,n=k.min!=null?k.min:m.datamin,h=k.max!=null?k.max:m.datamax,l;if(h-n==0){var g=(h==0)?1:0.01;n-=g;h+=g}m.tickSize=Flotr.getTickSize(k.noTicks,n,h,k.tickDecimals);if(k.min==null){l=k.autoscaleMargin;if(l!=0){n-=m.tickSize*l;if(n<0&&m.datamin>=0){n=0}n=m.tickSize*Math.floor(n/m.tickSize)}}if(k.max==null){l=k.autoscaleMargin;if(l!=0){h+=m.tickSize*l;if(h>0&&m.datamax<=0){h=0}h=m.tickSize*Math.ceil(h/m.tickSize)}}m.min=n;m.max=h},extendXRangeIfNeededByBar:function(x){if(x.options.max==null){var w=x.min,t=x.max,v,b,q,r,o=[],u=null;for(v=0;v<this.series.length;++v){b=this.series[v];q=b.bars;r=b.candles;if(b.xaxis==x){if(r.show||(q.centered&&q.show)){t=Math.max(x.datamax+0.5,t);w=Math.min(x.datamin-0.5,w)}if(q.show){if(!q.horizontal&&(q.barWidth+x.datamax>t)){t=x.max+(q.centered?q.barWidth/2:q.barWidth)}if(q.stacked&&q.horizontal){for(j=0;j<b.data.length;j++){if(q.show&&q.stacked){var p=b.data[j][0];o[p]=(o[p]||0)+b.data[j][1];u=b}}for(j=0;j<o.length;j++){t=Math.max(o[j],t)}}}}}x.lastSerie=u;x.max=t;x.min=w}},extendYRangeIfNeededByBar:function(v){if(v.options.max==null){var r=v.max,u,b,p,q,n=[],t=null;for(u=0;u<this.series.length;++u){b=this.series[u];p=b.bars;q=b.candles;if(b.yaxis==v&&p.show&&!b.hide){if(p.horizontal&&(p.barWidth+v.datamax>r)||(q.candleWidth+v.datamax>r)){r=v.max+p.barWidth}if(p.stacked&&!p.horizontal){for(j=0;j<b.data.length;j++){if(b.bars.show&&b.bars.stacked){var o=b.data[j][0];n[o]=(n[o]||0)+b.data[j][1];t=b}}for(j=0;j<n.length;j++){r=Math.max(n[j],r)}}}}v.lastSerie=t;v.max=r}},findXAxesValues:function(){for(i=this.series.length-1;i>-1;--i){s=this.series[i];s.xaxis.values=s.xaxis.values||[];for(j=s.data.length-1;j>-1;--j){s.xaxis.values[s.data[j][0]]={}}}},calculateTicks:function(q){var t=q.options,p,m;q.ticks=[];if(t.ticks){var n=t.ticks,l,o;if(Object.isFunction(n)){n=n({min:q.min,max:q.max})}for(p=0;p<n.length;++p){l=n[p];if(typeof(l)=="object"){m=l[0];o=(l.length>1)?l[1]:t.tickFormatter(m)}else{m=l;o=t.tickFormatter(m)}q.ticks[p]={v:m,label:o}}}else{var u=q.tickSize*Math.ceil(q.min/q.tickSize),r;for(p=0;u+p*q.tickSize<=q.max;++p){m=u+p*q.tickSize;r=t.tickDecimals;if(r==null){r=1-Math.floor(Math.log(q.tickSize)/Math.LN10)}if(r<0){r=0}m=m.toFixed(r);q.ticks.push({v:m,label:t.tickFormatter(m)})}}},calculateSpacing:function(){var l=this.axes,E=this.options,w=this.series,A=E.grid.labelMargin,a=l.x,D=l.x2,u=l.y,p=l.y2,y=2,x,z,B,v;[a,D,u,p].each(function(d){var b="";if(d.options.showLabels){for(x=0;x<d.ticks.length;++x){B=d.ticks[x].label.length;if(B>b.length){b=d.ticks[x].label}}}d.maxLabel=this.getTextDimensions(b,{size:E.fontSize,angle:Flotr.toRad(d.options.labelsAngle)},"font-size:smaller;","flotr-grid-label");d.titleSize=this.getTextDimensions(d.options.title,{size:E.fontSize*1.2,angle:Flotr.toRad(d.options.titleAngle)},"font-weight:bold;","flotr-axis-title")},this);v=this.getTextDimensions(E.title,{size:E.fontSize*1.5},"font-size:1em;font-weight:bold;","flotr-title");this.titleHeight=v.height;v=this.getTextDimensions(E.subtitle,{size:E.fontSize},"font-size:smaller;","flotr-subtitle");this.subtitleHeight=v.height;if(E.show){y=Math.max(y,E.points.radius+E.points.lineWidth/2)}for(z=0;z<E.length;++z){if(w[z].points.show){y=Math.max(y,w[z].points.radius+w[z].points.lineWidth/2)}}var C=this.plotOffset;C.bottom+=(a.options.showLabels?(a.maxLabel.height+A):0)+(a.options.title?(a.titleSize.height+A):0)+y;C.top+=(D.options.showLabels?(D.maxLabel.height+A):0)+(D.options.title?(D.titleSize.height+A):0)+this.subtitleHeight+this.titleHeight+y;C.left+=(u.options.showLabels?(u.maxLabel.width+A):0)+(u.options.title?(u.titleSize.width+A):0)+y;C.right+=(p.options.showLabels?(p.maxLabel.width+A):0)+(p.options.title?(p.titleSize.width+A):0)+y;C.top=Math.floor(C.top);this.plotWidth=this.canvasWidth-C.left-C.right;this.plotHeight=this.canvasHeight-C.bottom-C.top;a.scale=this.plotWidth/(a.max-a.min);D.scale=this.plotWidth/(D.max-D.min);u.scale=this.plotHeight/(u.max-u.min);p.scale=this.plotHeight/(p.max-p.min)},draw:function(){this.drawGrid();this.drawLabels();this.drawTitles();if(this.series.length){this.el.fire("flotr:beforedraw",[this.series,this]);for(var b=0;b<this.series.length;b++){if(!this.series[b].hide){this.drawSeries(this.series[b])}}}this.el.fire("flotr:afterdraw",[this.series,this])},tHoz:function(e,d){d=d||this.axes.x;return(e-d.min)*d.scale},tVert:function(d,e){e=e||this.axes.y;return this.plotHeight-(d-e.min)*e.scale},drawGrid:function(){var f,h=this.options,g=this.ctx;if(h.grid.verticalLines||h.grid.horizontalLines){this.el.fire("flotr:beforegrid",[this.axes.x,this.axes.y,h,this])}g.save();g.translate(this.plotOffset.left,this.plotOffset.top);if(h.grid.backgroundColor!=null){g.fillStyle=h.grid.backgroundColor;g.fillRect(0,0,this.plotWidth,this.plotHeight)}g.lineWidth=1;g.strokeStyle=h.grid.tickColor;g.beginPath();if(h.grid.verticalLines){for(var k=0;k<this.axes.x.ticks.length;++k){f=this.axes.x.ticks[k].v;if((f==this.axes.x.min||f==this.axes.x.max)&&h.grid.outlineWidth!=0){continue}g.moveTo(Math.floor(this.tHoz(f))+g.lineWidth/2,0);g.lineTo(Math.floor(this.tHoz(f))+g.lineWidth/2,this.plotHeight)}}if(h.grid.horizontalLines){for(var l=0;l<this.axes.y.ticks.length;++l){f=this.axes.y.ticks[l].v;if((f==this.axes.y.min||f==this.axes.y.max)&&h.grid.outlineWidth!=0){continue}g.moveTo(0,Math.floor(this.tVert(f))+g.lineWidth/2);g.lineTo(this.plotWidth,Math.floor(this.tVert(f))+g.lineWidth/2)}}g.stroke();if(h.grid.outlineWidth!=0){g.lineWidth=h.grid.outlineWidth;g.strokeStyle=h.grid.color;g.lineJoin="round";g.strokeRect(0,0,this.plotWidth,this.plotHeight)}g.restore();if(h.grid.verticalLines||h.grid.horizontalLines){this.el.fire("flotr:aftergrid",[this.axes.x,this.axes.y,h,this])}},drawLabels:function(){var u=0,t,v,r,q,p,a=this.options,n=this.ctx,o=this.axes;for(r=0;r<o.x.ticks.length;++r){if(o.x.ticks[r].label){++u}}v=this.plotWidth/u;if(!a.HtmlText&&this.textEnabled){var w={size:a.fontSize,adjustAlign:true};t=o.x;w.color=t.options.color||a.grid.color;for(r=0;r<t.ticks.length&&t.options.showLabels&&t.used;++r){p=t.ticks[r];if(!p.label||p.label.length==0){continue}w.angle=Flotr.toRad(t.options.labelsAngle);w.halign="c";w.valign="t";n.drawText(p.label,this.plotOffset.left+this.tHoz(p.v,t),this.plotOffset.top+this.plotHeight+a.grid.labelMargin,w)}t=o.x2;w.color=t.options.color||a.grid.color;for(r=0;r<t.ticks.length&&t.options.showLabels&&t.used;++r){p=t.ticks[r];if(!p.label||p.label.length==0){continue}w.angle=Flotr.toRad(t.options.labelsAngle);w.halign="c";w.valign="b";n.drawText(p.label,this.plotOffset.left+this.tHoz(p.v,t),this.plotOffset.top+a.grid.labelMargin,w)}t=o.y;w.color=t.options.color||a.grid.color;for(r=0;r<t.ticks.length&&t.options.showLabels&&t.used;++r){p=t.ticks[r];if(!p.label||p.label.length==0){continue}w.angle=Flotr.toRad(t.options.labelsAngle);w.halign="r";w.valign="m";n.drawText(p.label,this.plotOffset.left-a.grid.labelMargin,this.plotOffset.top+this.tVert(p.v,t),w)}t=o.y2;w.color=t.options.color||a.grid.color;for(r=0;r<t.ticks.length&&t.options.showLabels&&t.used;++r){p=t.ticks[r];if(!p.label||p.label.length==0){continue}w.angle=Flotr.toRad(t.options.labelsAngle);w.halign="l";w.valign="m";n.drawText(p.label,this.plotOffset.left+this.plotWidth+a.grid.labelMargin,this.plotOffset.top+this.tVert(p.v,t),w);n.save();n.strokeStyle=w.color;n.beginPath();n.moveTo(this.plotOffset.left+this.plotWidth-8,this.plotOffset.top+this.tVert(p.v,t));n.lineTo(this.plotOffset.left+this.plotWidth,this.plotOffset.top+this.tVert(p.v,t));n.stroke();n.restore()}}else{if(o.x.options.showLabels||o.x2.options.showLabels||o.y.options.showLabels||o.y2.options.showLabels){q=['<div style="font-size:smaller;color:'+a.grid.color+';" class="flotr-labels">'];t=o.x;if(t.options.showLabels){for(r=0;r<t.ticks.length;++r){p=t.ticks[r];if(!p.label||p.label.length==0||(this.plotOffset.left+this.tHoz(p.v,t)<0)||(this.plotOffset.left+this.tHoz(p.v,t)>this.canvasWidth)){continue}q.push('<div style="position:absolute;top:'+(this.plotOffset.top+this.plotHeight+a.grid.labelMargin)+"px;left:"+(this.plotOffset.left+this.tHoz(p.v,t)-v/2)+"px;width:"+v+"px;text-align:center;"+(t.options.color?("color:"+t.options.color+";"):"")+'" class="flotr-grid-label">'+p.label+"</div>")}}t=o.x2;if(t.options.showLabels&&t.used){for(r=0;r<t.ticks.length;++r){p=t.ticks[r];if(!p.label||p.label.length==0||(this.plotOffset.left+this.tHoz(p.v,t)<0)||(this.plotOffset.left+this.tHoz(p.v,t)>this.canvasWidth)){continue}q.push('<div style="position:absolute;top:'+(this.plotOffset.top-a.grid.labelMargin-t.maxLabel.height)+"px;left:"+(this.plotOffset.left+this.tHoz(p.v,t)-v/2)+"px;width:"+v+"px;text-align:center;"+(t.options.color?("color:"+t.options.color+";"):"")+'" class="flotr-grid-label">'+p.label+"</div>")}}t=o.y;if(t.options.showLabels){for(r=0;r<t.ticks.length;++r){p=t.ticks[r];if(!p.label||p.label.length==0||(this.plotOffset.top+this.tVert(p.v,t)<0)||(this.plotOffset.top+this.tVert(p.v,t)>this.canvasHeight)){continue}q.push('<div style="position:absolute;top:'+(this.plotOffset.top+this.tVert(p.v,t)-t.maxLabel.height/2)+"px;left:0;width:"+(this.plotOffset.left-a.grid.labelMargin)+"px;text-align:right;"+(t.options.color?("color:"+t.options.color+";"):"")+'" class="flotr-grid-label">'+p.label+"</div>")}}t=o.y2;if(t.options.showLabels&&t.used){n.save();n.strokeStyle=t.options.color||a.grid.color;n.beginPath();for(r=0;r<t.ticks.length;++r){p=t.ticks[r];if(!p.label||p.label.length==0||(this.plotOffset.top+this.tVert(p.v,t)<0)||(this.plotOffset.top+this.tVert(p.v,t)>this.canvasHeight)){continue}q.push('<div style="position:absolute;top:'+(this.plotOffset.top+this.tVert(p.v,t)-t.maxLabel.height/2)+"px;right:0;width:"+(this.plotOffset.right-a.grid.labelMargin)+"px;text-align:left;"+(t.options.color?("color:"+t.options.color+";"):"")+'" class="flotr-grid-label">'+p.label+"</div>");n.moveTo(this.plotOffset.left+this.plotWidth-8,this.plotOffset.top+this.tVert(p.v,t));n.lineTo(this.plotOffset.left+this.plotWidth,this.plotOffset.top+this.tVert(p.v,t))}n.stroke();n.restore()}q.push("</div>");this.el.insert(q.join(""))}}},drawTitles:function(){var l,m=this.options,h=m.grid.labelMargin,n=this.ctx,a=this.axes;if(!m.HtmlText&&this.textEnabled){var k={size:m.fontSize,color:m.grid.color,halign:"c"};if(m.subtitle){n.drawText(m.subtitle,this.plotOffset.left+this.plotWidth/2,this.titleHeight+this.subtitleHeight-2,k)}k.weight=1.5;k.size*=1.5;if(m.title){n.drawText(m.title,this.plotOffset.left+this.plotWidth/2,this.titleHeight-2,k)}k.weight=1.8;k.size*=0.8;k.adjustAlign=true;if(a.x.options.title&&a.x.used){k.halign="c";k.valign="t";k.angle=Flotr.toRad(a.x.options.titleAngle);n.drawText(a.x.options.title,this.plotOffset.left+this.plotWidth/2,this.plotOffset.top+a.x.maxLabel.height+this.plotHeight+2*h,k)}if(a.x2.options.title&&a.x2.used){k.halign="c";k.valign="b";k.angle=Flotr.toRad(a.x2.options.titleAngle);n.drawText(a.x2.options.title,this.plotOffset.left+this.plotWidth/2,this.plotOffset.top-a.x2.maxLabel.height-2*h,k)}if(a.y.options.title&&a.y.used){k.halign="r";k.valign="m";k.angle=Flotr.toRad(a.y.options.titleAngle);n.drawText(a.y.options.title,this.plotOffset.left-a.y.maxLabel.width-2*h,this.plotOffset.top+this.plotHeight/2,k)}if(a.y2.options.title&&a.y2.used){k.halign="l";k.valign="m";k.angle=Flotr.toRad(a.y2.options.titleAngle);n.drawText(a.y2.options.title,this.plotOffset.left+this.plotWidth+a.y2.maxLabel.width+2*h,this.plotOffset.top+this.plotHeight/2,k)}}else{l=['<div style="color:'+m.grid.color+';" class="flotr-titles">'];if(m.title){l.push('<div style="position:absolute;top:0;left:'+this.plotOffset.left+"px;font-size:1em;font-weight:bold;text-align:center;width:"+this.plotWidth+'px;" class="flotr-title">'+m.title+"</div>")}if(m.subtitle){l.push('<div style="position:absolute;top:'+this.titleHeight+"px;left:"+this.plotOffset.left+"px;font-size:smaller;text-align:center;width:"+this.plotWidth+'px;" class="flotr-subtitle">'+m.subtitle+"</div>")}l.push("</div>");l.push('<div class="flotr-axis-title" style="font-weight:bold;">');if(a.x.options.title&&a.x.used){l.push('<div style="position:absolute;top:'+(this.plotOffset.top+this.plotHeight+m.grid.labelMargin+a.x.titleSize.height)+"px;left:"+this.plotOffset.left+"px;width:"+this.plotWidth+'px;text-align:center;" class="flotr-axis-title">'+a.x.options.title+"</div>")}if(a.x2.options.title&&a.x2.used){l.push('<div style="position:absolute;top:0;left:'+this.plotOffset.left+"px;width:"+this.plotWidth+'px;text-align:center;" class="flotr-axis-title">'+a.x2.options.title+"</div>")}if(a.y.options.title&&a.y.used){l.push('<div style="position:absolute;top:'+(this.plotOffset.top+this.plotHeight/2-a.y.titleSize.height/2)+'px;left:0;text-align:right;" class="flotr-axis-title">'+a.y.options.title+"</div>")}if(a.y2.options.title&&a.y2.used){l.push('<div style="position:absolute;top:'+(this.plotOffset.top+this.plotHeight/2-a.y.titleSize.height/2)+'px;right:0;text-align:right;" class="flotr-axis-title">'+a.y2.options.title+"</div>")}l.push("</div>");this.el.insert(l.join(""))}},drawSeries:function(e){e=e||this.series;var f=false;for(var d in Flotr._registeredTypes){if(e[d]&&e[d].show){this[Flotr._registeredTypes[d]](e);f=true}}if(!f){this[Flotr._registeredTypes[this.options.defaultType]](e)}},plotLine:function(y,B){var r=this.ctx,G=y.xaxis,w=y.yaxis,x=this.tHoz.bind(this),u=this.tVert.bind(this),z=y.data;if(z.length<2){return}var C=x(z[0][0],G),D=u(z[0][1],w)+B;r.beginPath();r.moveTo(C,D);for(var A=0;A<z.length-1;++A){var E=z[A][0],t=z[A][1],F=z[A+1][0],v=z[A+1][1];if(t===null||v===null){continue}if(t<=v&&t<w.min){if(v<w.min){continue}E=(w.min-t)/(v-t)*(F-E)+E;t=w.min}else{if(v<=t&&v<w.min){if(t<w.min){continue}F=(w.min-t)/(v-t)*(F-E)+E;v=w.min}}if(t>=v&&t>w.max){if(v>w.max){continue}E=(w.max-t)/(v-t)*(F-E)+E;t=w.max}else{if(v>=t&&v>w.max){if(t>w.max){continue}F=(w.max-t)/(v-t)*(F-E)+E;v=w.max}}if(E<=F&&E<G.min){if(F<G.min){continue}t=(G.min-E)/(F-E)*(v-t)+t;E=G.min}else{if(F<=E&&F<G.min){if(E<G.min){continue}v=(G.min-E)/(F-E)*(v-t)+t;F=G.min}}if(E>=F&&E>G.max){if(F>G.max){continue}t=(G.max-E)/(F-E)*(v-t)+t;E=G.max}else{if(F>=E&&F>G.max){if(E>G.max){continue}v=(G.max-E)/(F-E)*(v-t)+t;F=G.max}}if(C!=x(E,G)||D!=u(t,w)+B){r.moveTo(x(E,G),u(t,w)+B)}C=x(F,G);D=u(v,w)+B;r.lineTo(C,D)}r.stroke()},plotLineArea:function(F,L){var w=F.data;if(w.length<2){return}var D,I=0,B=this.ctx,y=F.xaxis,N=F.yaxis,K=this.tHoz.bind(this),C=this.tVert.bind(this),H=Math.min(Math.max(0,N.min),N.max),J=true;B.beginPath();for(var A=0;A<w.length-1;++A){var x=w[A][0],M=w[A][1],z=w[A+1][0],O=w[A+1][1];if(x<=z&&x<y.min){if(z<y.min){continue}M=(y.min-x)/(z-x)*(O-M)+M;x=y.min}else{if(z<=x&&z<y.min){if(x<y.min){continue}O=(y.min-x)/(z-x)*(O-M)+M;z=y.min}}if(x>=z&&x>y.max){if(z>y.max){continue}M=(y.max-x)/(z-x)*(O-M)+M;x=y.max}else{if(z>=x&&z>y.max){if(x>y.max){continue}O=(y.max-x)/(z-x)*(O-M)+M;z=y.max}}if(J){B.moveTo(K(x,y),C(H,N)+L);J=false}if(M>=N.max&&O>=N.max){B.lineTo(K(x,y),C(N.max,N)+L);B.lineTo(K(z,y),C(N.max,N)+L);continue}else{if(M<=N.min&&O<=N.min){B.lineTo(K(x,y),C(N.min,N)+L);B.lineTo(K(z,y),C(N.min,N)+L);continue}}var G=x,E=z;if(M<=O&&M<N.min&&O>=N.min){x=(N.min-M)/(O-M)*(z-x)+x;M=N.min}else{if(O<=M&&O<N.min&&M>=N.min){z=(N.min-M)/(O-M)*(z-x)+x;O=N.min}}if(M>=O&&M>N.max&&O<=N.max){x=(N.max-M)/(O-M)*(z-x)+x;M=N.max}else{if(O>=M&&O>N.max&&M<=N.max){z=(N.max-M)/(O-M)*(z-x)+x;O=N.max}}if(x!=G){D=(M<=N.min)?D=N.min:N.max;B.lineTo(K(G,y),C(D,N)+L);B.lineTo(K(x,y),C(D,N)+L)}B.lineTo(K(x,y),C(M,N)+L);B.lineTo(K(z,y),C(O,N)+L);if(z!=E){D=(O<=N.min)?N.min:N.max;B.lineTo(K(E,y),C(D,N)+L);B.lineTo(K(z,y),C(D,N)+L)}I=Math.max(z,E)}B.lineTo(K(I,y),C(H,N)+L);B.closePath();B.fill()},drawSeriesLines:function(l){l=l||this.series;var f=this.ctx;f.save();f.translate(this.plotOffset.left,this.plotOffset.top);f.lineJoin="round";var k=l.lines.lineWidth;var g=l.shadowSize;if(g>0){f.lineWidth=g/2;var h=k/2+f.lineWidth/2;f.strokeStyle="rgba(0,0,0,0.1)";this.plotLine(l,h+g/2);f.strokeStyle="rgba(0,0,0,0.2)";this.plotLine(l,h);if(l.lines.fill){f.fillStyle="rgba(0,0,0,0.05)";this.plotLineArea(l,h+g/2)}}f.lineWidth=k;f.strokeStyle=l.color;if(l.lines.fill){f.fillStyle=l.lines.fillColor!=null?l.lines.fillColor:Flotr.parseColor(l.color).scale(null,null,null,l.lines.fillOpacity).toString();this.plotLineArea(l,0)}this.plotLine(l,0);f.restore()},drawSeriesPoints:function(h){var e=this.ctx;e.save();e.translate(this.plotOffset.left,this.plotOffset.top);var g=h.lines.lineWidth;var f=h.shadowSize;if(f>0){e.lineWidth=f/2;e.strokeStyle="rgba(0,0,0,0.1)";this.plotPointShadows(h,f/2+e.lineWidth/2,h.points.radius);e.strokeStyle="rgba(0,0,0,0.2)";this.plotPointShadows(h,e.lineWidth/2,h.points.radius)}e.lineWidth=h.points.lineWidth;e.strokeStyle=h.color;e.fillStyle=h.points.fillColor!=null?h.points.fillColor:h.color;this.plotPoints(h,h.points.radius,h.points.fill);e.restore()},plotPoints:function(u,r,n){var w=u.xaxis,q=u.yaxis,m=this.ctx,t,v=u.data;for(t=v.length-1;t>-1;--t){var o=v[t][0],p=v[t][1];if(p===null||o<w.min||o>w.max||p<q.min||p>q.max){continue}m.beginPath();m.arc(this.tHoz(o,w),this.tVert(p,q),r,0,2*Math.PI,true);if(n){m.fill()}m.stroke()}},plotPointShadows:function(t,v,q){var w=t.xaxis,p=t.yaxis,m=this.ctx,r,u=t.data;for(r=u.length-1;r>-1;--r){var n=u[r][0],o=u[r][1];if(o===null||n<w.min||n>w.max||o<p.min||o>p.max){continue}m.beginPath();m.arc(this.tHoz(n,w),this.tVert(o,p)+v,q,0,Math.PI,false);m.stroke()}},drawSeriesBars:function(e){var f=this.ctx,g=e.bars.barWidth,h=Math.min(e.bars.lineWidth,g);f.save();f.translate(this.plotOffset.left,this.plotOffset.top);f.lineJoin="miter";f.lineWidth=h;f.strokeStyle=e.color;this.plotBarsShadows(e,g,0,e.bars.fill);if(e.bars.fill){f.fillStyle=e.bars.fillColor!=null?e.bars.fillColor:Flotr.parseColor(e.color).scale(null,null,null,e.bars.fillOpacity).toString()}this.plotBars(e,g,0,e.bars.fill);f.restore()},plotBars:function(I,F,P,C){var x=I.data;if(x.length<1){return}var A=I.xaxis,R=I.yaxis,D=this.ctx,N=this.tHoz.bind(this),E=this.tVert.bind(this);for(var B=0;B<x.length;B++){var J=x[B][0],K=x[B][1],O=true,H=true,S=true;if(K===null){continue}var L=0;if(I.bars.stacked){A.values.each(function(b,a){if(a==J){L=b.stack||0;b.stack=L+K}})}if(I.bars.horizontal){var Q=L,y=J+L,M=K,G=K+F}else{var Q=J-(I.bars.centered?F/2:0),y=J+F-(I.bars.centered?F/2:0),M=L,G=K+L}if(y<A.min||Q>A.max||G<R.min||M>R.max){continue}if(Q<A.min){Q=A.min;O=false}if(y>A.max){y=A.max;if(A.lastSerie!=I&&I.bars.horizontal){H=false}}if(M<R.min){M=R.min}if(G>R.max){G=R.max;if(R.lastSerie!=I&&!I.bars.horizontal){H=false}}if(C){D.beginPath();D.moveTo(N(Q,A),E(M,R)+P);D.lineTo(N(Q,A),E(G,R)+P);D.lineTo(N(y,A),E(G,R)+P);D.lineTo(N(y,A),E(M,R)+P);D.fill()}if(I.bars.lineWidth!=0&&(O||S||H)){D.beginPath();D.moveTo(N(Q,A),E(M,R)+P);D[O?"lineTo":"moveTo"](N(Q,A),E(G,R)+P);D[H?"lineTo":"moveTo"](N(y,A),E(G,R)+P);D[S?"lineTo":"moveTo"](N(y,A),E(M,R)+P);D.stroke()}}},plotBarsShadows:function(I,G,O){var x=I.data;if(x.length<1){return}var z=I.xaxis,Q=I.yaxis,B=this.ctx,N=this.tHoz.bind(this),E=this.tVert.bind(this),D=this.options.shadowSize;for(var A=0;A<x.length;A++){var J=x[A][0],K=x[A][1];if(K===null){continue}var M=0;if(I.bars.stacked){z.values.each(function(b,a){if(a==J){M=b.stackShadow||0;b.stackShadow=M+K}})}if(I.bars.horizontal){var P=M,y=J+M,L=K,H=K+G}else{var P=J-(I.bars.centered?G/2:0),y=J+G-(I.bars.centered?G/2:0),L=M,H=K+M}if(y<z.min||P>z.max||H<Q.min||L>Q.max){continue}if(P<z.min){P=z.min}if(y>z.max){y=z.max}if(L<Q.min){L=Q.min}if(H>Q.max){H=Q.max}var C=N(y,z)-N(P,z)-((N(y,z)+D<=this.plotWidth)?0:D);var F=Math.max(0,E(L,Q)-E(H,Q)-((E(L,Q)+D<=this.plotHeight)?0:D));B.fillStyle="rgba(0,0,0,0.05)";B.fillRect(Math.min(N(P,z)+D,this.plotWidth),Math.min(E(H,Q)+D,this.plotWidth),C,F)}},drawSeriesCandles:function(d){var e=this.ctx,f=d.candles.candleWidth;e.save();e.translate(this.plotOffset.left,this.plotOffset.top);e.lineJoin="miter";e.lineWidth=d.candles.lineWidth;this.plotCandlesShadows(d,f/2);this.plotCandles(d,f/2);e.restore()},plotCandles:function(O,V){var H=O.data;if(H.length<1){return}var d=O.xaxis,X=O.yaxis,F=this.ctx,U=this.tHoz.bind(this),I=this.tVert.bind(this);for(var x=0;x<H.length;x++){var M=H[x],P=M[0],N=M[1],Q=M[2],G=M[3],K=M[4];var W=P-O.candles.candleWidth/2,J=P+O.candles.candleWidth/2,S=Math.max(X.min,G),L=Math.min(X.max,Q),Y=Math.max(X.min,Math.min(N,K)),y=Math.min(X.max,Math.max(N,K));if(J<d.min||W>d.max||L<X.min||S>X.max){continue}var E=O.candles[N>K?"downFillColor":"upFillColor"];if(O.candles.fill&&!O.candles.barcharts){F.fillStyle=Flotr.parseColor(E).scale(null,null,null,O.candles.fillOpacity).toString();F.fillRect(U(W,d),I(y,X)+V,U(J,d)-U(W,d),I(Y,X)-I(y,X))}if(O.candles.lineWidth||O.candles.wickLineWidth){var P,R,T=(O.candles.wickLineWidth%2)/2;P=Math.floor(U((W+J)/2),d)+T;F.save();F.strokeStyle=E;F.lineWidth=O.candles.wickLineWidth;F.lineCap="butt";if(O.candles.barcharts){F.beginPath();F.moveTo(P,Math.floor(I(L,X)+V));F.lineTo(P,Math.floor(I(S,X)+V));R=Math.floor(I(N,X)+V)+0.5;F.moveTo(Math.floor(U(W,d))+T,R);F.lineTo(P,R);R=Math.floor(I(K,X)+V)+0.5;F.moveTo(Math.floor(U(J,d))+T,R);F.lineTo(P,R)}else{F.strokeRect(U(W,d),I(y,X)+V,U(J,d)-U(W,d),I(Y,X)-I(y,X));F.beginPath();F.moveTo(P,Math.floor(I(y,X)+V));F.lineTo(P,Math.floor(I(L,X)+V));F.moveTo(P,Math.floor(I(Y,X)+V));F.lineTo(P,Math.floor(I(S,X)+V))}F.stroke();F.restore()}}},plotCandlesShadows:function(L,Q){var x=L.data;if(x.length<1||L.candles.barcharts){return}var C=L.xaxis,S=L.yaxis,P=this.tHoz.bind(this),G=this.tVert.bind(this),F=this.options.shadowSize;for(var D=0;D<x.length;D++){var B=x[D],M=B[0],K=B[1],N=B[2],d=B[3],I=B[4];var R=M-L.candles.candleWidth/2,A=M+L.candles.candleWidth/2,O=Math.max(S.min,Math.min(K,I)),J=Math.min(S.max,Math.max(K,I));if(A<C.min||R>C.max||J<S.min||O>S.max){continue}var E=P(A,C)-P(R,C)-((P(A,C)+F<=this.plotWidth)?0:F);var H=Math.max(0,G(O,S)-G(J,S)-((G(O,S)+F<=this.plotHeight)?0:F));this.ctx.fillStyle="rgba(0,0,0,0.05)";this.ctx.fillRect(Math.min(P(R,C)+F,this.plotWidth),Math.min(G(J,S)+F,this.plotWidth),E,H)}},drawSeriesPie:function(I){if(this.options.pie.drawn){return}var D=this.ctx,M=this.options,K=I.pie.lineWidth,F=I.shadowSize,w=I.data,H=this.plotOffset,L=(Math.min(this.canvasWidth,this.canvasHeight)*I.pie.sizeRatio)/2,G=[],C=1,y=Math.sin(I.pie.viewAngle)*I.pie.spliceThickness/C,B={size:M.fontSize*1.2,color:M.grid.color,weight:1.5},x={x:H.left+(this.plotWidth)/2,y:H.top+(this.plotHeight)/2},z=this.series.collect(function(a,b){if(a.pie.show&&a.data[0][1]!==null){return{name:(a.label||a.data[0][1]),value:[b,a.data[0][1]],options:a.pie,series:a}}}),N=z.pluck("value").pluck(1).inject(0,function(b,a){return b+a}),J=0,A=I.pie.startAngle,E=0;var O=z.collect(function(a){A+=J;E=parseFloat(a.value[1]);J=E/N;return{name:a.name,fraction:J,x:a.value[0],y:E,options:a.options,series:a.series,startAngle:2*A*Math.PI,endAngle:2*(A+J)*Math.PI}});D.save();if(F>0){O.each(function(d){if(d.startAngle==d.endAngle){return}var b=(d.startAngle+d.endAngle)/2,a=x.x+Math.cos(b)*d.options.explode+F,e=x.y+Math.sin(b)*d.options.explode+F;this.plotSlice(a,e,L,d.startAngle,d.endAngle,false,C);if(I.pie.fill){D.fillStyle="rgba(0,0,0,0.1)";D.fill()}},this)}if(M.HtmlText||!this.textEnabled){G=['<div style="color:'+this.options.grid.color+'" class="flotr-labels">']}O.each(function(l,b){if(l.startAngle==l.endAngle){return}var d=(l.startAngle+l.endAngle)/2,e=l.series.color,h=l.options.fillColor||e,a=x.x+Math.cos(d)*l.options.explode,f=x.y+Math.sin(d)*l.options.explode;this.plotSlice(a,f,L,l.startAngle,l.endAngle,false,C);if(I.pie.fill){D.fillStyle=Flotr.parseColor(h).scale(null,null,null,I.pie.fillOpacity).toString();D.fill()}D.lineWidth=K;D.strokeStyle=e;D.stroke();var m=M.pie.labelFormatter(l),k=(Math.cos(d)<0),n=a+Math.cos(d)*(I.pie.explode+L),o=f+Math.sin(d)*(I.pie.explode+L);if(l.fraction&&m){if(M.HtmlText||!this.textEnabled){var g="position:absolute;top:"+(o-5)+"px;";if(k){g+="right:"+(this.canvasWidth-n)+"px;text-align:right;"}else{g+="left:"+n+"px;text-align:left;"}G.push('<div style="'+g+'" class="flotr-grid-label">'+m+"</div>")}else{B.halign=k?"r":"l";D.drawText(m,n,o+B.size/2,B)}}},this);if(M.HtmlText||!this.textEnabled){G.push("</div>");this.el.insert(G.join(""))}D.restore();M.pie.drawn=true},plotSlice:function(k,m,l,p,q,o,n){var r=this.ctx;n=n||1;r.scale(1,n);r.beginPath();r.moveTo(k,m);r.arc(k,m,l,p,q,o);r.lineTo(k,m);r.closePath()},insertLegend:function(){if(!this.options.legend.show){return}var aa=this.series,Z=this.plotOffset,ag=this.options,p=[],ah=false,O=this.ctx,m;var K=aa.findAll(function(a){return(a.label&&!a.hide)}).size();if(K){if(!ag.HtmlText&&this.textEnabled){var U={size:ag.fontSize*1.1,color:ag.grid.color};var T=ag.legend.position,Q=ag.legend.margin,V=ag.legend.labelBoxWidth,y=ag.legend.labelBoxHeight,W=ag.legend.labelBoxMargin,P=Z.left+Q,S=Z.top+Q;var x=0;for(m=aa.length-1;m>-1;--m){if(!aa[m].label||aa[m].hide){continue}var ad=ag.legend.labelFormatter(aa[m].label);x=Math.max(x,O.measureText(ad,U))}var X=Math.round(V+W*3+x),af=Math.round(K*(W+y)+W);if(T.charAt(0)=="s"){S=Z.top+this.plotHeight-(Q+af)}if(T.charAt(1)=="e"){P=Z.left+this.plotWidth-(Q+X)}var M=Flotr.parseColor(ag.legend.backgroundColor||"rgb(240,240,240)").scale(null,null,null,ag.legend.backgroundOpacity||0.1).toString();O.fillStyle=M;O.fillRect(P,S,X,af);O.strokeStyle=ag.legend.labelBoxBorderColor;O.strokeRect(Flotr.toPixel(P),Flotr.toPixel(S),X,af);var ab=P+W;var ac=S+W;for(m=0;m<aa.length;m++){if(!aa[m].label||aa[m].hide){continue}var ad=ag.legend.labelFormatter(aa[m].label);O.fillStyle=aa[m].color;O.fillRect(ab,ac,V-1,y-1);O.strokeStyle=ag.legend.labelBoxBorderColor;O.lineWidth=1;O.strokeRect(Math.ceil(ab)-1.5,Math.ceil(ac)-1.5,V+2,y+2);O.drawText(ad,ab+V+W,ac+(y+U.size-O.fontDescent(U))/2,U);ac+=y+W}}else{for(m=0;m<aa.length;++m){if(!aa[m].label||aa[m].hide){continue}if(m%ag.legend.noColumns==0){p.push(ah?"</tr><tr>":"<tr>");ah=true}var ad=ag.legend.labelFormatter(aa[m].label);p.push('<td class="flotr-legend-color-box"><div style="border:1px solid '+ag.legend.labelBoxBorderColor+';padding:1px"><div style="width:'+ag.legend.labelBoxWidth+"px;height:"+ag.legend.labelBoxHeight+"px;background-color:"+aa[m].color+'"></div></div></td><td class="flotr-legend-label">'+ad+"</td>")}if(ah){p.push("</tr>")}if(p.length>0){var R='<table style="font-size:smaller;color:'+ag.grid.color+'">'+p.join("")+"</table>";if(ag.legend.container!=null){$(ag.legend.container).update(R)}else{var ae="",T=ag.legend.position,Q=ag.legend.margin;if(T.charAt(0)=="n"){ae+="top:"+(Q+Z.top)+"px;"}else{if(T.charAt(0)=="s"){ae+="bottom:"+(Q+Z.bottom)+"px;"}}if(T.charAt(1)=="e"){ae+="right:"+(Q+Z.right)+"px;"}else{if(T.charAt(1)=="w"){ae+="left:"+(Q+Z.left)+"px;"}}var Y=this.el.insert('<div class="flotr-legend" style="position:absolute;z-index:2;'+ae+'">'+R+"</div>").select("div.flotr-legend").first();if(ag.legend.backgroundOpacity!=0){var L=ag.legend.backgroundColor;if(L==null){var N=(ag.grid.backgroundColor!=null)?ag.grid.backgroundColor:Flotr.extractColor(Y);L=Flotr.parseColor(N).adjust(null,null,null,1).toString()}this.el.insert('<div class="flotr-legend-bg" style="position:absolute;width:'+Y.getWidth()+"px;height:"+Y.getHeight()+"px;"+ae+"background-color:"+L+';"> </div>').select("div.flotr-legend-bg").first().setStyle({opacity:ag.legend.backgroundOpacity})}}}}}},getEventPosition:function(q){var m=this.overlay.cumulativeOffset(),n=(q.pageX-m.left-this.plotOffset.left),o=(q.pageY-m.top-this.plotOffset.top),p=0,r=0;if(q.pageX==null&&q.clientX!=null){var l=document.documentElement,b=document.body;p=q.clientX+(l&&l.scrollLeft||b.scrollLeft||0);r=q.clientY+(l&&l.scrollTop||b.scrollTop||0)}else{p=q.pageX;r=q.pageY}return{x:this.axes.x.min+n/this.axes.x.scale,x2:this.axes.x2.min+n/this.axes.x2.scale,y:this.axes.y.max-o/this.axes.y.scale,y2:this.axes.y2.max-o/this.axes.y2.scale,relX:n,relY:o,absX:p,absY:r}},clickHandler:function(b){if(this.ignoreClick){this.ignoreClick=false;return}this.el.fire("flotr:click",[this.getEventPosition(b),this])},mouseMoveHandler:function(e){var d=this.getEventPosition(e);this.lastMousePos.pageX=d.absX;this.lastMousePos.pageY=d.absY;if(this.options.crosshair.mode){this.clearCrosshair()}if(this.selectionInterval==null&&(this.options.mouse.track||this.series.any(function(a){return a.mouse&&a.mouse.track}))){this.hit(d)}if(this.options.crosshair.mode){this.drawCrosshair(d)}this.el.fire("flotr:mousemove",[e,d,this])},mouseDownHandler:function(f){if(f.isRightClick()){f.stop();var d=this.overlay;d.hide();function e(){d.show();$(document).stopObserving("mousemove",e)}$(document).observe("mousemove",e);return}if(!this.options.selection.mode||!f.isLeftClick()){return}this.setSelectionPos(this.selection.first,f);if(this.selectionInterval!=null){clearInterval(this.selectionInterval)}this.lastMousePos.pageX=null;this.selectionInterval=setInterval(this.updateSelection.bind(this),1000/this.options.selection.fps);this.mouseUpHandler=this.mouseUpHandler.bind(this);$(document).observe("mouseup",this.mouseUpHandler)},fireSelectEvent:function(){var a=this.axes,h=this.selection,m=(h.first.x<=h.second.x)?h.first.x:h.second.x,n=(h.first.x<=h.second.x)?h.second.x:h.first.x,k=(h.first.y>=h.second.y)?h.first.y:h.second.y,l=(h.first.y>=h.second.y)?h.second.y:h.first.y;m=a.x.min+m/a.x.scale;n=a.x.min+n/a.x.scale;k=a.y.max-k/a.y.scale;l=a.y.max-l/a.y.scale;this.el.fire("flotr:select",[{x1:m,y1:k,x2:n,y2:l},this])},mouseUpHandler:function(b){$(document).stopObserving("mouseup",this.mouseUpHandler);b.stop();if(this.selectionInterval!=null){clearInterval(this.selectionInterval);this.selectionInterval=null}this.setSelectionPos(this.selection.second,b);this.clearSelection();if(this.selectionIsSane()){this.drawSelection();this.fireSelectEvent();this.ignoreClick=true}},setSelectionPos:function(g,e){var f=this.options,h=$(this.overlay).cumulativeOffset();if(f.selection.mode.indexOf("x")==-1){g.x=(g==this.selection.first)?0:this.plotWidth}else{g.x=e.pageX-h.left-this.plotOffset.left;g.x=Math.min(Math.max(0,g.x),this.plotWidth)}if(f.selection.mode.indexOf("y")==-1){g.y=(g==this.selection.first)?0:this.plotHeight}else{g.y=e.pageY-h.top-this.plotOffset.top;g.y=Math.min(Math.max(0,g.y),this.plotHeight)}},updateSelection:function(){if(this.lastMousePos.pageX==null){return}this.setSelectionPos(this.selection.second,this.lastMousePos);this.clearSelection();if(this.selectionIsSane()){this.drawSelection()}},clearSelection:function(){if(this.prevSelection==null){return}var l=this.prevSelection,n=this.octx.lineWidth,p=this.plotOffset,k=Math.min(l.first.x,l.second.x),m=Math.min(l.first.y,l.second.y),h=Math.abs(l.second.x-l.first.x),o=Math.abs(l.second.y-l.first.y);this.octx.clearRect(k+p.left-n/2+0.5,m+p.top-n/2+0.5,h+n,o+n);this.prevSelection=null},setSelection:function(n){var k=this.options,m=this.axes.x,l=this.axes.y,o=l.scale,q=m.scale,p=k.selection.mode.indexOf("x")!=-1,r=k.selection.mode.indexOf("y")!=-1;this.clearSelection();this.selection.first.y=p?0:(l.max-n.y1)*o;this.selection.second.y=p?this.plotHeight:(l.max-n.y2)*o;this.selection.first.x=r?0:(n.x1-m.min)*q;this.selection.second.x=r?this.plotWidth:(n.x2-m.min)*q;this.drawSelection();this.fireSelectEvent()},drawSelection:function(){var r=this.prevSelection,o=this.selection,m=this.octx,h=this.options,u=this.plotOffset;if(r!=null&&o.first.x==r.first.x&&o.first.y==r.first.y&&o.second.x==r.second.x&&o.second.y==r.second.y){return}m.save();m.strokeStyle=Flotr.parseColor(h.selection.color).scale(null,null,null,0.8).toString();m.lineWidth=1;m.lineJoin="miter";m.fillStyle=Flotr.parseColor(h.selection.color).scale(null,null,null,0.4).toString();this.prevSelection={first:{x:o.first.x,y:o.first.y},second:{x:o.second.x,y:o.second.y}};var p=Math.min(o.first.x,o.second.x),q=Math.min(o.first.y,o.second.y),n=Math.abs(o.second.x-o.first.x),t=Math.abs(o.second.y-o.first.y);m.fillRect(p+u.left+0.5,q+u.top+0.5,n,t);m.strokeRect(p+u.left+0.5,q+u.top+0.5,n,t);m.restore()},drawCrosshair:function(m){var o=this.octx,p=this.options,q=this.plotOffset,k=q.left+m.relX+0.5,n=q.top+m.relY+0.5,r=p.crosshair.mode.indexOf("x")!=-1,l=p.crosshair.mode.indexOf("y")!=-1;if(m.relX<0||m.relY<0||m.relX>this.plotWidth||m.relY>this.plotHeight){this.el.style.cursor=null;this.el.removeClassName("flotr-crosshair");return}this.lastMousePos.relX=null;this.lastMousePos.relY=null;if(p.crosshair.hideCursor){this.el.style.cursor="url(blank.cur), crosshair";this.el.addClassName("flotr-crosshair")}o.save();o.strokeStyle=p.crosshair.color;o.lineWidth=1;o.beginPath();if(r){o.moveTo(k,q.top);o.lineTo(k,q.top+this.plotHeight);this.lastMousePos.relX=k}if(l){o.moveTo(q.left,n);o.lineTo(q.left+this.plotWidth,n);this.lastMousePos.relY=n}o.stroke();o.restore()},clearCrosshair:function(){if(this.lastMousePos.relX!=null){this.octx.clearRect(this.lastMousePos.relX-0.5,this.plotOffset.top,1,this.plotHeight+1)}if(this.lastMousePos.relY!=null){this.octx.clearRect(this.plotOffset.left,this.lastMousePos.relY-0.5,this.plotWidth+1,1)}},selectionIsSane:function(){return Math.abs(this.selection.second.x-this.selection.first.x)>=5&&Math.abs(this.selection.second.y-this.selection.first.y)>=5},clearHit:function(){if(this.prevHit){var d=this.options,e=this.plotOffset,f=this.prevHit;this.octx.clearRect(this.tHoz(f.x,f.xaxis)+e.left-d.points.radius*2,this.tVert(f.y,f.yaxis)+e.top-d.points.radius*2,d.points.radius*3+d.points.lineWidth*3,d.points.radius*3+d.points.lineWidth*3);this.prevHit=null}},drawHit:function(f){var d=this.octx,e=this.options;if(f.mouse.lineColor!=null){d.save();d.translate(this.plotOffset.left,this.plotOffset.top);d.lineWidth=e.points.lineWidth;d.strokeStyle=f.mouse.lineColor;d.fillStyle="#ffffff";d.beginPath();d.arc(this.tHoz(f.x,f.xaxis),this.tVert(f.y,f.yaxis),e.mouse.radius,0,2*Math.PI,true);d.fill();d.stroke();d.restore()}this.prevHit=f},hit:function(S){var V=this.series,Z=this.options,O=this.prevHit,U=this.plotOffset,X=this.octx,L,ae,n,M,ac,N,Q,P,p={dist:Number.MAX_VALUE,x:null,y:null,relX:S.relX,relY:S.relY,absX:S.absX,absY:S.absY,mouse:null,xaxis:null,yaxis:null};for(P=0;P<V.length;P++){s=V[P];if(!s.mouse.track){continue}L=s.data;M=s.xaxis;ac=s.yaxis;ae=(2*Z.points.lineWidth)/M.scale;n=(2*Z.points.lineWidth)/ac.scale;N=S.relX/M.scale+M.min;Q=-S.relY/ac.scale+ac.max;for(var R=0,ad,Y;R<L.length;R++){if(L[R][1]===null||M.min>L[R][0]||M.max<L[R][0]||ac.min>L[R][1]||ac.max<L[R][1]){continue}var K=Math.abs(L[R][0]-N),aa=Math.abs(L[R][1]-Q);if(K<ae&&aa<n){var ab=Math.sqrt(K*K+aa*aa);if(ab<p.dist){p.dist=ab;p.x=L[R][0];p.y=L[R][1];p.xaxis=M;p.yaxis=ac;p.mouse=s.mouse}}}}if(p.mouse&&p.mouse.track&&!O||(O)){var H=this.mouseTrack||this.el.select(".flotr-mouse-value")[0],W="",J=Z.mouse.position,m=Z.mouse.margin,T="opacity:0.7;background-color:#000;color:#fff;display:none;position:absolute;padding:2px 8px;-moz-border-radius:4px;border-radius:4px;white-space:nowrap;";if(!Z.mouse.relative){if(J.charAt(0)=="n"){W+="top:"+(m+U.top)+"px;"}else{if(J.charAt(0)=="s"){W+="bottom:"+(m+U.bottom)+"px;"}}if(J.charAt(1)=="e"){W+="right:"+(m+U.right)+"px;"}else{if(J.charAt(1)=="w"){W+="left:"+(m+U.left)+"px;"}}}else{if(J.charAt(0)=="n"){W+="bottom:"+(m-U.top-this.tVert(p.y)+this.canvasHeight)+"px;"}else{if(J.charAt(0)=="s"){W+="top:"+(m+U.top+this.tVert(p.y))+"px;"}}if(J.charAt(1)=="e"){W+="left:"+(m+U.left+this.tHoz(p.x))+"px;"}else{if(J.charAt(1)=="w"){W+="right:"+(m-U.left-this.tHoz(p.x)+this.canvasWidth)+"px;"}}}T+=W;if(!H){this.el.insert('<div class="flotr-mouse-value" style="'+T+'"></div>');H=this.mouseTrack=this.el.select(".flotr-mouse-value").first()}else{this.mouseTrack=H.setStyle(T)}if(p.x!==null&&p.y!==null){H.show();this.clearHit();this.drawHit(p);var I=p.mouse.trackDecimals;if(I==null||I<0){I=0}H.innerHTML=p.mouse.trackFormatter({x:p.x.toFixed(I),y:p.y.toFixed(I)});H.fire("flotr:hit",[p,this])}else{if(O){H.hide();this.clearHit()}}}},saveImage:function(k,l,g,f){var h=null;switch(k){case"jpeg":case"jpg":h=Canvas2Image.saveAsJPEG(this.canvas,f,l,g);break;default:case"png":h=Canvas2Image.saveAsPNG(this.canvas,f,l,g);break;case"bmp":h=Canvas2Image.saveAsBMP(this.canvas,f,l,g);break}if(Object.isElement(h)&&f){this.restoreCanvas();this.canvas.hide();this.overlay.hide();this.el.insert(h.setStyle({position:"absolute"}))}},restoreCanvas:function(){this.canvas.show();this.overlay.show();this.el.select("img").invoke("remove")}});Flotr.Color=Class.create({initialize:function(a,b,k,g){this.rgba=["r","g","b","a"];var l=4;while(-1<--l){this[this.rgba[l]]=arguments[l]||((l==3)?1:0)}this.normalize()},adjust:function(k,l,h,f){var g=4;while(-1<--g){if(arguments[g]!=null){this[this.rgba[g]]+=arguments[g]}}return this.normalize()},clone:function(){return new Flotr.Color(this.r,this.b,this.g,this.a)},limit:function(d,e,f){return Math.max(Math.min(d,f),e)},normalize:function(){var b=this.limit;this.r=b(parseInt(this.r),0,255);this.g=b(parseInt(this.g),0,255);this.b=b(parseInt(this.b),0,255);this.a=b(this.a,0,1);return this},scale:function(k,l,h,f){var g=4;while(-1<--g){if(arguments[g]!=null){this[this.rgba[g]]*=arguments[g]}}return this.normalize()},distance:function(d){if(!d){return}d=new Flotr.parseColor(d);var f=0,e=3;while(-1<--e){f+=Math.abs(this[this.rgba[e]]-d[this.rgba[e]])}return f},toString:function(){return(this.a>=1)?"rgb("+[this.r,this.g,this.b].join(",")+")":"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"}});Flotr.Color.lookupColors={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]};Flotr.Date={format:function(n,o){if(!n){return}var l=function(a){a=a.toString();return a.length==1?"0"+a:a};var p=[],m,q=false;for(var d=0;d<o.length;++d){m=o.charAt(d);if(q){switch(m){case"h":m=n.getUTCHours().toString();break;case"H":m=l(n.getUTCHours());break;case"M":m=l(n.getUTCMinutes());break;case"S":m=l(n.getUTCSeconds());break;case"d":m=n.getUTCDate().toString();break;case"m":m=(n.getUTCMonth()+1).toString();break;case"y":m=n.getUTCFullYear().toString();break;case"b":m=Flotr.Date.monthNames[n.getUTCMonth()];break}p.push(m);q=false}else{if(m=="%"){q=true}else{p.push(m)}}}return p.join("")},formatter:function(g,k){var h=new Date(g);if(k.options.timeformat!=null){return Flotr.Date.format(h,k.options.timeformat)}var d=k.tickSize[0]*Flotr.Date.timeUnits[k.tickSize[1]],l=k.max-k.min;if(d<Flotr.Date.timeUnits.minute){fmt="%h:%M:%S"}else{if(d<Flotr.Date.timeUnits.day){fmt=(l<2*Flotr.Date.timeUnits.day)?"%h:%M":"%b %d %h:%M"}else{if(d<Flotr.Date.timeUnits.month){fmt="%b %d"}else{if(d<Flotr.Date.timeUnits.year){fmt=(l<Flotr.Date.timeUnits.year)?"%b":"%b %y"}else{fmt="%y"}}}}return Flotr.Date.format(h,fmt)},generator:function(w){var q=[],t=w.tickSize[0],p=w.tickSize[1],r=new Date(w.min),x=t*timeUnitSize[p];switch(p){case"second":r.setUTCSeconds(floorInBase(r.getUTCSeconds(),t));break;case"minute":r.setUTCMinutes(floorInBase(r.getUTCMinutes(),t));break;case"hour":r.setUTCHours(floorInBase(r.getUTCHours(),t));break;case"month":r.setUTCMonth(floorInBase(r.getUTCMonth(),t));break;case"year":r.setUTCFullYear(floorInBase(r.getUTCFullYear(),t));break}r.setUTCMilliseconds(0);if(x>=timeUnitSize.minute){r.setUTCSeconds(0)}if(x>=timeUnitSize.hour){r.setUTCMinutes(0)}if(x>=timeUnitSize.day){r.setUTCHours(0)}if(x>=timeUnitSize.day*4){r.setUTCDate(1)}if(x>=timeUnitSize.year){r.setUTCMonth(0)}var d=0,o=Number.NaN,v;do{v=o;o=r.getTime();q.push({v:o,label:w.tickFormatter(o,w)});if(p=="month"){if(t<1){r.setUTCDate(1);var y=r.getTime();r.setUTCMonth(r.getUTCMonth()+1);var u=r.getTime();r.setTime(o+d*timeUnitSize.hour+(u-y)*t);d=r.getUTCHours();r.setUTCHours(0)}else{r.setUTCMonth(r.getUTCMonth()+t)}}else{if(p=="year"){r.setUTCFullYear(r.getUTCFullYear()+t)}else{r.setTime(o+x)}}}while(o<w.max&&o!=v);return q},timeUnits:{second:1000,minute:1000*60,hour:1000*60*60,day:1000*60*60*24,month:1000*60*60*24*30,year:1000*60*60*24*30*365.2425},spec:[[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"]],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]};var CanvasText={letters:{"\n":{width:-1,points:[]}," ":{width:10,points:[]},"!":{width:10,points:[[5,21],[5,7],null,[5,2],[4,1],[5,0],[6,1],[5,2]]},'"':{width:16,points:[[4,21],[4,14],null,[12,21],[12,14]]},"#":{width:21,points:[[11,25],[4,-7],null,[17,25],[10,-7],null,[4,12],[18,12],null,[3,6],[17,6]]},"$":{width:20,points:[[8,25],[8,-4],null,[12,25],[12,-4],null,[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},"%":{width:24,points:[[21,21],[3,0],null,[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],null,[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]]},"&":{width:26,points:[[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]]},"'":{width:10,points:[[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]]},"(":{width:14,points:[[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]]},")":{width:14,points:[[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]]},"*":{width:16,points:[[8,21],[8,9],null,[3,18],[13,12],null,[13,18],[3,12]]},"+":{width:26,points:[[13,18],[13,0],null,[4,9],[22,9]]},",":{width:10,points:[[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]]},"-":{width:26,points:[[4,9],[22,9]]},".":{width:10,points:[[5,2],[4,1],[5,0],[6,1],[5,2]]},"/":{width:22,points:[[20,25],[2,-7]]},"0":{width:20,points:[[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]]},"1":{width:20,points:[[6,17],[8,18],[11,21],[11,0]]},"2":{width:20,points:[[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]]},"3":{width:20,points:[[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]]},"4":{width:20,points:[[13,21],[3,7],[18,7],null,[13,21],[13,0]]},"5":{width:20,points:[[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]]},"6":{width:20,points:[[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]]},"7":{width:20,points:[[17,21],[7,0],null,[3,21],[17,21]]},"8":{width:20,points:[[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]]},"9":{width:20,points:[[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]]},":":{width:10,points:[[5,14],[4,13],[5,12],[6,13],[5,14],null,[5,2],[4,1],[5,0],[6,1],[5,2]]},";":{width:10,points:[[5,14],[4,13],[5,12],[6,13],[5,14],null,[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]]},"<":{width:24,points:[[20,18],[4,9],[20,0]]},"=":{width:26,points:[[4,12],[22,12],null,[4,6],[22,6]]},">":{width:24,points:[[4,18],[20,9],[4,0]]},"?":{width:18,points:[[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],null,[9,2],[8,1],[9,0],[10,1],[9,2]]},"@":{width:27,points:[[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],null,[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],null,[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],null,[19,16],[18,8],[18,6],[19,5]]},A:{width:18,points:[[9,21],[1,0],null,[9,21],[17,0],null,[4,7],[14,7]]},B:{width:21,points:[[4,21],[4,0],null,[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],null,[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]]},C:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]]},D:{width:21,points:[[4,21],[4,0],null,[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]]},E:{width:19,points:[[4,21],[4,0],null,[4,21],[17,21],null,[4,11],[12,11],null,[4,0],[17,0]]},F:{width:18,points:[[4,21],[4,0],null,[4,21],[17,21],null,[4,11],[12,11]]},G:{width:21,points:[[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],null,[13,8],[18,8]]},H:{width:22,points:[[4,21],[4,0],null,[18,21],[18,0],null,[4,11],[18,11]]},I:{width:8,points:[[4,21],[4,0]]},J:{width:16,points:[[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]]},K:{width:21,points:[[4,21],[4,0],null,[18,21],[4,7],null,[9,12],[18,0]]},L:{width:17,points:[[4,21],[4,0],null,[4,0],[16,0]]},M:{width:24,points:[[4,21],[4,0],null,[4,21],[12,0],null,[20,21],[12,0],null,[20,21],[20,0]]},N:{width:22,points:[[4,21],[4,0],null,[4,21],[18,0],null,[18,21],[18,0]]},O:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]]},P:{width:21,points:[[4,21],[4,0],null,[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]]},Q:{width:22,points:[[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],null,[12,4],[18,-2]]},R:{width:21,points:[[4,21],[4,0],null,[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],null,[11,11],[18,0]]},S:{width:20,points:[[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},T:{width:16,points:[[8,21],[8,0],null,[1,21],[15,21]]},U:{width:22,points:[[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]]},V:{width:18,points:[[1,21],[9,0],null,[17,21],[9,0]]},W:{width:24,points:[[2,21],[7,0],null,[12,21],[7,0],null,[12,21],[17,0],null,[22,21],[17,0]]},X:{width:20,points:[[3,21],[17,0],null,[17,21],[3,0]]},Y:{width:18,points:[[1,21],[9,11],[9,0],null,[17,21],[9,11]]},Z:{width:20,points:[[17,21],[3,0],null,[3,21],[17,21],null,[3,0],[17,0]]},"[":{width:14,points:[[4,25],[4,-7],null,[5,25],[5,-7],null,[4,25],[11,25],null,[4,-7],[11,-7]]},"\\":{width:14,points:[[0,21],[14,-3]]},"]":{width:14,points:[[9,25],[9,-7],null,[10,25],[10,-7],null,[3,25],[10,25],null,[3,-7],[10,-7]]},"^":{width:14,points:[[3,10],[8,18],[13,10]]},_:{width:16,points:[[0,-2],[16,-2]]},"`":{width:10,points:[[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]]},a:{width:19,points:[[15,14],[15,0],null,[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},b:{width:19,points:[[4,21],[4,0],null,[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},c:{width:18,points:[[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},d:{width:19,points:[[15,21],[15,0],null,[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},e:{width:18,points:[[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},f:{width:12,points:[[10,21],[8,21],[6,20],[5,17],[5,0],null,[2,14],[9,14]]},g:{width:19,points:[[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],null,[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},h:{width:19,points:[[4,21],[4,0],null,[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},i:{width:8,points:[[3,21],[4,20],[5,21],[4,22],[3,21],null,[4,14],[4,0]]},j:{width:10,points:[[5,21],[6,20],[7,21],[6,22],[5,21],null,[6,14],[6,-3],[5,-6],[3,-7],[1,-7]]},k:{width:17,points:[[4,21],[4,0],null,[14,14],[4,4],null,[8,8],[15,0]]},l:{width:8,points:[[4,21],[4,0]]},m:{width:30,points:[[4,14],[4,0],null,[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],null,[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]]},n:{width:19,points:[[4,14],[4,0],null,[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]]},o:{width:19,points:[[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]]},p:{width:19,points:[[4,14],[4,-7],null,[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]]},q:{width:19,points:[[15,14],[15,-7],null,[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]]},r:{width:13,points:[[4,14],[4,0],null,[4,8],[5,11],[7,13],[9,14],[12,14]]},s:{width:17,points:[[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]]},t:{width:12,points:[[5,21],[5,4],[6,1],[8,0],[10,0],null,[2,14],[9,14]]},u:{width:19,points:[[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],null,[15,14],[15,0]]},v:{width:16,points:[[2,14],[8,0],null,[14,14],[8,0]]},w:{width:22,points:[[3,14],[7,0],null,[11,14],[7,0],null,[11,14],[15,0],null,[19,14],[15,0]]},x:{width:17,points:[[3,14],[14,0],null,[14,14],[3,0]]},y:{width:16,points:[[2,14],[8,0],null,[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]]},z:{width:17,points:[[14,14],[3,0],null,[3,14],[14,14],null,[3,0],[14,0]]},"{":{width:14,points:[[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],null,[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],null,[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]]},"|":{width:8,points:[[4,25],[4,-7]]},"}":{width:14,points:[[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],null,[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],null,[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]]},"~":{width:24,points:[[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],null,[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]]},"�":{diacritic:"�",letter:"e"},"�":{diacritic:"`",letter:"e"},"�":{diacritic:"^",letter:"e"},"�":{diacritic:"�",letter:"e"},"�":{diacritic:"`",letter:"a"},"�":{diacritic:"^",letter:"a"},"�":{diacritic:"�",letter:"c"},"�":{diacritic:"~",letter:"n"},"�":{diacritic:"^",letter:"o"},"�":{diacritic:"�",letter:"E"},"�":{diacritic:"`",letter:"E"},"�":{diacritic:"^",letter:"E"},"�":{diacritic:"�",letter:"E"},"�":{diacritic:"`",letter:"A"},"�":{diacritic:"�",letter:"C"},"�":{diacritic:"~",letter:"N"},"�":{diacritic:"^",letter:"O"}},specialchars:{pi:{width:19,points:[[6,14],[6,0],null,[14,14],[14,0],null,[2,13],[6,16],[13,13],[17,16]]}},diacritics:{"�":{entity:"cedil",points:[[6,-4],[4,-6],[2,-7],[1,-7]]},"�":{entity:"acute",points:[[8,19],[13,22]]},"`":{entity:"grave",points:[[7,22],[12,19]]},"^":{entity:"circ",points:[[5.5,19],[9.5,23],[12.5,19]]},"�":{entity:"trema",points:[[5,21],[6,20],[7,21],[6,22],[5,21],null,[12,21],[13,20],[14,21],[13,22],[12,21]]},"~":{entity:"tilde",points:[[4,18],[7,22],[10,18],[13,22]]}},style:{size:8,font:null,color:"#000000",weight:1,halign:"l",valign:"b",adjustAlign:false,angle:0,tracking:1,boundingBoxColor:"#ff0000",originPointColor:"#000000"},debug:false,_bufferLexemes:{},letter:function(a){return CanvasText.letters[a]},parseLexemes:function(g){if(CanvasText._bufferLexemes[g]){return CanvasText._bufferLexemes[g]}var d,h,f=g.match(/&[A-Za-z]{2,5};|\s|./g);var a=[],e=[];for(d=0;d<f.length;d++){h=f[d];if(h.length==1){e.push(h)}else{var b=h.substring(1,h.length-1);if(CanvasText.specialchars[b]){e.push(b)}else{e=e.concat(h.toArray())}}}for(d=0;d<e.length;d++){h=e[d];if(h=CanvasText.letters[h]||CanvasText.specialchars[h]){a.push(h)}}return CanvasText._bufferLexemes[g]=a.compact()},ascent:function(a){a=a||{};return(a.size||CanvasText.style.size)},descent:function(a){a=a||{};return 7*(a.size||CanvasText.style.size)/25},measure:function(f,d){if(!f){return}d=d||{};var a,b,g=CanvasText.parseLexemes(f),e=0;for(a=g.length-1;a>-1;--a){c=g[a];b=(c.diacritic)?CanvasText.letter(c.letter).width:c.width;e+=b*(d.tracking||CanvasText.style.tracking)*(d.size||CanvasText.style.size)/25}return e},getDimensions:function(f,d){var b=CanvasText.measure(f,d),a=d.size||CanvasText.style.size,e=d.angle||CanvasText.style.angle;if(d.angle==0){return{width:b,height:a}}return{width:Math.abs(Math.cos(e)*b)+Math.abs(Math.sin(e)*a),height:Math.abs(Math.sin(e)*b)+Math.abs(Math.cos(e)*a)}},getBestAlign:function(e,d){e+=CanvasText.getAngleFromAlign(d.halign,d.valign);var b={h:"c",v:"m"};if(Math.round(Math.cos(e)*1000)/1000!=0){b.h=(Math.cos(e)>0?"r":"l")}if(Math.round(Math.sin(e)*1000)/1000!=0){b.v=(Math.sin(e)>0?"t":"b")}return b},getAngleFromAlign:function(d,a){var e=Math.PI,b={rm:0,rt:e/4,ct:e/2,lt:3*(e/4),lm:e,lb:-3*(e/4),cb:-e/2,rb:-e/4,cm:0};return b[d+a]},drawPoints:function(n,m,l,h,g,e){var f,k,d=true,b=0;e=e||{x:0,y:0};n.beginPath();for(f=0;f<m.length;f++){k=m[f];if(!k){d=true;continue}if(d){n.moveTo(l+k[0]*g+e.x,h-k[1]*g+e.y);d=false}else{n.lineTo(l+k[0]*g+e.x,h-k[1]*g+e.y)}}n.stroke()},draw:function(n,h,b,r){if(!n){return}r=r||CanvasText.style;r.halign=r.halign||CanvasText.style.halign;r.valign=r.valign||CanvasText.style.valign;r.angle=r.angle||CanvasText.style.angle;r.size=r.size||CanvasText.style.size;r.adjustAlign=r.adjustAlign||CanvasText.style.adjustAlign;var q,t,v=0,d=r.size/25,l=0,k=0,e=CanvasText.parseLexemes(n),g={x:0,y:0},f=CanvasText.measure(n,r),o;if(r.adjustAlign){o=CanvasText.getBestAlign(r.angle,r);r.halign=o.h;r.valign=o.v}switch(r.halign){case"l":break;case"c":g.x=-f/2;break;case"r":g.x=-f;break}switch(r.valign){case"b":break;case"m":g.y=r.size/2;break;case"t":g.y=r.size;break}this.save();this.translate(h,b);this.rotate(r.angle);this.lineCap="round";this.lineWidth=2*d*(r.weight||CanvasText.style.weight);this.strokeStyle=r.color||CanvasText.style.color;for(q=0;q<e.length;q++){t=e[q];if(t.width==-1){l=0;k=r.size*1.4;continue}var p=t.points,m=t.width;if(t.diacritic){var u=CanvasText.diacritics[t.diacritic],a=CanvasText.letter(t.letter);CanvasText.drawPoints(this,u.points,l,k-(t.letter.toUpperCase()==t.letter?3:0),d,g);p=a.points;m=a.width}CanvasText.drawPoints(this,p,l,k,d,g);if(CanvasText.debug){this.save();this.lineJoin="miter";this.lineWidth=0.5;this.strokeStyle=(r.boundingBoxColor||CanvasText.style.boundingBoxColor);this.strokeRect(l+g.x,k+g.y,m*d,-r.size);this.fillStyle=(r.originPointColor||CanvasText.style.originPointColor);this.beginPath();this.arc(0,0,1.5,0,Math.PI*2,true);this.fill();this.restore()}l+=m*d*(r.tracking||CanvasText.style.tracking)}this.restore();return v}};if(window.CanvasRenderingContext2D){CanvasRenderingContext2D.prototype.drawText=CanvasText.draw;CanvasRenderingContext2D.prototype.measureText=CanvasText.measure;CanvasRenderingContext2D.prototype.getTextBounds=CanvasText.getDimensions;CanvasRenderingContext2D.prototype.fontAscent=CanvasText.ascent;CanvasRenderingContext2D.prototype.fontDescent=CanvasText.descent}if(!document.createElement("canvas").getContext){(function(){var B=Math;var C=B.round;var y=B.sin;var L=B.cos;var q=B.abs;var K=B.sqrt;var b=10;var r=b/2;function l(){return this.context_||(this.context_=new v(this))}var A=Array.prototype.slice;function M(p,N,O){var m=A.call(arguments,2);return function(){return p.apply(N,m.concat(A.call(arguments)))}}var n={init:function(m){if(/MSIE/.test(navigator.userAgent)&&!window.opera){var p=m||document;p.createElement("canvas");p.attachEvent("onreadystatechange",M(this.init_,this,p))}},init_:function(O){if(!O.namespaces.g_vml_){O.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML")}if(!O.namespaces.g_o_){O.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML")}if(!O.styleSheets.ex_canvas_){var N=O.createStyleSheet();N.owningElement.id="ex_canvas_";N.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}g_o_\\:*{behavior:url(#default#VML)}"}var p=O.getElementsByTagName("canvas");for(var m=0;m<p.length;m++){this.initElement(p[m])}},initElement:function(p){if(!p.getContext){p.getContext=l;p.innerHTML="";p.attachEvent("onpropertychange",I);p.attachEvent("onresize",d);var m=p.attributes;if(m.width&&m.width.specified){p.style.width=m.width.nodeValue+"px"}else{p.width=p.clientWidth}if(m.height&&m.height.specified){p.style.height=m.height.nodeValue+"px"}else{p.height=p.clientHeight}}return p}};function I(p){var m=p.srcElement;switch(p.propertyName){case"width":m.style.width=m.attributes.width.nodeValue+"px";m.getContext().clearRect();break;case"height":m.style.height=m.attributes.height.nodeValue+"px";m.getContext().clearRect();break}}function d(p){var m=p.srcElement;if(m.firstChild){m.firstChild.style.width=m.clientWidth+"px";m.firstChild.style.height=m.clientHeight+"px"}}n.init();var g=[];for(var F=0;F<16;F++){for(var E=0;E<16;E++){g[F*16+E]=F.toString(16)+E.toString(16)}}function w(){return[[1,0,0],[0,1,0],[0,0,1]]}function f(O,N){var p=w();for(var m=0;m<3;m++){for(var R=0;R<3;R++){var P=0;for(var Q=0;Q<3;Q++){P+=O[m][Q]*N[Q][R]}p[m][R]=P}}return p}function D(p,m){m.fillStyle=p.fillStyle;m.lineCap=p.lineCap;m.lineJoin=p.lineJoin;m.lineWidth=p.lineWidth;m.miterLimit=p.miterLimit;m.shadowBlur=p.shadowBlur;m.shadowColor=p.shadowColor;m.shadowOffsetX=p.shadowOffsetX;m.shadowOffsetY=p.shadowOffsetY;m.strokeStyle=p.strokeStyle;m.globalAlpha=p.globalAlpha;m.arcScaleX_=p.arcScaleX_;m.arcScaleY_=p.arcScaleY_;m.lineScale_=p.lineScale_}function e(p){var P,O=1;p=String(p);if(p.substring(0,3)=="rgb"){var R=p.indexOf("(",3);var m=p.indexOf(")",R+1);var Q=p.substring(R+1,m).split(",");P="#";for(var N=0;N<3;N++){P+=g[Number(Q[N])]}if(Q.length==4&&p.substr(3,1)=="a"){O=Q[3]}}else{P=p}return{color:P,alpha:O}}function z(m){switch(m){case"butt":return"flat";case"round":return"round";case"square":default:return"square"}}function v(p){this.m_=w();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=b*1;this.globalAlpha=1;this.canvas=p;var m=p.ownerDocument.createElement("div");m.style.width=p.clientWidth+"px";m.style.height=p.clientHeight+"px";m.style.overflow="hidden";m.style.position="absolute";p.appendChild(m);this.element_=m;this.arcScaleX_=1;this.arcScaleY_=1;this.lineScale_=1}var o=v.prototype;o.clearRect=function(){this.element_.innerHTML=""};o.beginPath=function(){this.currentPath_=[]};o.moveTo=function(N,m){var O=this.getCoords_(N,m);this.currentPath_.push({type:"moveTo",x:O.x,y:O.y});this.currentX_=O.x;this.currentY_=O.y};o.lineTo=function(N,m){var O=this.getCoords_(N,m);this.currentPath_.push({type:"lineTo",x:O.x,y:O.y});this.currentX_=O.x;this.currentY_=O.y};o.bezierCurveTo=function(O,N,U,T,S,Q){var m=this.getCoords_(S,Q);var R=this.getCoords_(O,N);var P=this.getCoords_(U,T);u(this,R,P,m)};function u(m,P,O,N){m.currentPath_.push({type:"bezierCurveTo",cp1x:P.x,cp1y:P.y,cp2x:O.x,cp2y:O.y,x:N.x,y:N.y});m.currentX_=N.x;m.currentY_=N.y}o.quadraticCurveTo=function(S,O,N,m){var R=this.getCoords_(S,O);var Q=this.getCoords_(N,m);var T={x:this.currentX_+2/3*(R.x-this.currentX_),y:this.currentY_+2/3*(R.y-this.currentY_)};var P={x:T.x+(Q.x-this.currentX_)/3,y:T.y+(Q.y-this.currentY_)/3};u(this,T,P,Q)};o.arc=function(V,T,U,Q,N,O){U*=b;var Z=O?"at":"wa";var W=V+L(Q)*U-r;var Y=T+y(Q)*U-r;var m=V+L(N)*U-r;var X=T+y(N)*U-r;if(W==m&&!O){W+=0.125}var P=this.getCoords_(V,T);var S=this.getCoords_(W,Y);var R=this.getCoords_(m,X);this.currentPath_.push({type:Z,x:P.x,y:P.y,radius:U,xStart:S.x,yStart:S.y,xEnd:R.x,yEnd:R.y})};o.rect=function(N,p,m,O){this.moveTo(N,p);this.lineTo(N+m,p);this.lineTo(N+m,p+O);this.lineTo(N,p+O);this.closePath()};o.strokeRect=function(N,p,m,O){var P=this.currentPath_;this.beginPath();this.moveTo(N,p);this.lineTo(N+m,p);this.lineTo(N+m,p+O);this.lineTo(N,p+O);this.closePath();this.stroke();this.currentPath_=P};o.fillRect=function(N,p,m,O){var P=this.currentPath_;this.beginPath();this.moveTo(N,p);this.lineTo(N+m,p);this.lineTo(N+m,p+O);this.lineTo(N,p+O);this.closePath();this.fill();this.currentPath_=P};o.createLinearGradient=function(p,O,m,N){var P=new G("gradient");P.x0_=p;P.y0_=O;P.x1_=m;P.y1_=N;return P};o.createRadialGradient=function(O,Q,N,p,P,m){var R=new G("gradientradial");R.x0_=O;R.y0_=Q;R.r0_=N;R.x1_=p;R.y1_=P;R.r1_=m;return R};o.drawImage=function(ab,N){var T,R,V,ai,Z,X,ad,ak;var U=ab.runtimeStyle.width;var aa=ab.runtimeStyle.height;ab.runtimeStyle.width="auto";ab.runtimeStyle.height="auto";var S=ab.width;var ag=ab.height;ab.runtimeStyle.width=U;ab.runtimeStyle.height=aa;if(arguments.length==3){T=arguments[1];R=arguments[2];Z=X=0;ad=V=S;ak=ai=ag}else{if(arguments.length==5){T=arguments[1];R=arguments[2];V=arguments[3];ai=arguments[4];Z=X=0;ad=S;ak=ag}else{if(arguments.length==9){Z=arguments[1];X=arguments[2];ad=arguments[3];ak=arguments[4];T=arguments[5];R=arguments[6];V=arguments[7];ai=arguments[8]}else{throw Error("Invalid number of arguments")}}}var aj=this.getCoords_(T,R);var O=ad/2;var p=ak/2;var ah=[];var m=10;var Q=10;ah.push(" <g_vml_:group",' coordsize="',b*m,",",b*Q,'"',' coordorigin="0,0"',' style="width:',m,"px;height:",Q,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]){var P=[];P.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",C(aj.x/b),",","Dy=",C(aj.y/b),"");var af=aj;var ae=this.getCoords_(T+V,R);var ac=this.getCoords_(T,R+ai);var Y=this.getCoords_(T+V,R+ai);af.x=B.max(af.x,ae.x,ac.x,Y.x);af.y=B.max(af.y,ae.y,ac.y,Y.y);ah.push("padding:0 ",C(af.x/b),"px ",C(af.y/b),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",P.join(""),", sizingmethod='clip');")}else{ah.push("top:",C(aj.y/b),"px;left:",C(aj.x/b),"px;")}ah.push(' ">','<g_vml_:image src="',ab.src,'"',' style="width:',b*V,"px;"," height:",b*ai,'px;"',' cropleft="',Z/S,'"',' croptop="',X/ag,'"',' cropright="',(S-Z-ad)/S,'"',' cropbottom="',(ag-X-ak)/ag,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",ah.join(""))};o.stroke=function(ao){var T=[];var U=false;var aD=e(ao?this.fillStyle:this.strokeStyle);var ak=aD.color;var ax=aD.alpha*this.globalAlpha;var P=10;var X=10;T.push("<g_vml_:shape",' filled="',!!ao,'"',' style="position:absolute;width:',P,"px;height:",X,'px;"',' coordorigin="0 0" coordsize="',b*P," ",b*X,'"',' stroked="',!ao,'"',' path="');var V=false;var aC={x:null,y:null};var ag={x:null,y:null};for(var aw=0;aw<this.currentPath_.length;aw++){var au=this.currentPath_[aw];var aB;switch(au.type){case"moveTo":aB=au;T.push(" m ",C(au.x),",",C(au.y));break;case"lineTo":T.push(" l ",C(au.x),",",C(au.y));break;case"close":T.push(" x ");au=null;break;case"bezierCurveTo":T.push(" c ",C(au.cp1x),",",C(au.cp1y),",",C(au.cp2x),",",C(au.cp2y),",",C(au.x),",",C(au.y));break;case"at":case"wa":T.push(" ",au.type," ",C(au.x-this.arcScaleX_*au.radius),",",C(au.y-this.arcScaleY_*au.radius)," ",C(au.x+this.arcScaleX_*au.radius),",",C(au.y+this.arcScaleY_*au.radius)," ",C(au.xStart),",",C(au.yStart)," ",C(au.xEnd),",",C(au.yEnd));break}if(au){if(aC.x==null||au.x<aC.x){aC.x=au.x}if(ag.x==null||au.x>ag.x){ag.x=au.x}if(aC.y==null||au.y<aC.y){aC.y=au.y}if(ag.y==null||au.y>ag.y){ag.y=au.y}}}T.push(' ">');if(!ao){var af=this.lineScale_*this.lineWidth;if(af<1){ax*=af}T.push("<g_vml_:stroke",' opacity="',ax,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',z(this.lineCap),'"',' weight="',af,'px"',' color="',ak,'" />')}else{if(this.fillStyle instanceof G){var Y=this.fillStyle;var ad=0;var at={x:0,y:0};var al=0;var ab=1;if(Y.type_=="gradient"){var aa=Y.x0_/this.arcScaleX_;var N=Y.y0_/this.arcScaleY_;var Z=Y.x1_/this.arcScaleX_;var aE=Y.y1_/this.arcScaleY_;var az=this.getCoords_(aa,N);var ay=this.getCoords_(Z,aE);var R=ay.x-az.x;var Q=ay.y-az.y;ad=Math.atan2(R,Q)*180/Math.PI;if(ad<0){ad+=360}if(ad<0.000001){ad=0}}else{var az=this.getCoords_(Y.x0_,Y.y0_);var m=ag.x-aC.x;var O=ag.y-aC.y;at={x:(az.x-aC.x)/m,y:(az.y-aC.y)/O};m/=this.arcScaleX_*b;O/=this.arcScaleY_*b;var ar=B.max(m,O);al=2*Y.r0_/ar;ab=2*Y.r1_/ar-al}var aj=Y.colors_;aj.sort(function(W,p){return W.offset-p.offset});var ae=aj.length;var ai=aj[0].color;var ah=aj[ae-1].color;var an=aj[0].alpha*this.globalAlpha;var am=aj[ae-1].alpha*this.globalAlpha;var aq=[];for(var aw=0;aw<ae;aw++){var ac=aj[aw];aq.push(ac.offset*ab+al+" "+ac.color)}T.push('<g_vml_:fill type="',Y.type_,'"',' method="none" focus="100%"',' color="',ai,'"',' color2="',ah,'"',' colors="',aq.join(","),'"',' opacity="',am,'"',' g_o_:opacity2="',an,'"',' angle="',ad,'"',' focusposition="',at.x,",",at.y,'" />')}else{if(this.fillStyle instanceof h){var aA=ag.x-aC.x;var av=ag.y-aC.y;if(aA&&av){var S=-aC.x;var ap=-aC.y;T.push("<g_vml_:fill",' position="',S/aA*this.arcScaleX_*this.arcScaleX_,",",ap/av*this.arcScaleY_*this.arcScaleY_,'"',' type="tile"',' src="',this.fillStyle.src_,'" />')}}else{T.push('<g_vml_:fill color="',ak,'" opacity="',ax,'" />')}}}T.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",T.join(""))};o.fill=function(){this.stroke(true)};o.closePath=function(){this.currentPath_.push({type:"close"})};o.getCoords_=function(O,N){var p=this.m_;return{x:b*(O*p[0][0]+N*p[1][0]+p[2][0])-r,y:b*(O*p[0][1]+N*p[1][1]+p[2][1])-r}};o.save=function(){var m={};D(this,m);this.aStack_.push(m);this.mStack_.push(this.m_);this.m_=f(w(),this.m_)};o.restore=function(){D(this.aStack_.pop(),this);this.m_=this.mStack_.pop()};function k(p){for(var O=0;O<3;O++){for(var N=0;N<2;N++){if(!isFinite(p[O][N])||isNaN(p[O][N])){return false}}}return true}function H(N,p,O){if(!k(p)){return}N.m_=p;if(O){var P=p[0][0]*p[1][1]-p[0][1]*p[1][0];N.lineScale_=K(q(P))}}o.translate=function(N,p){var m=[[1,0,0],[0,1,0],[N,p,1]];H(this,f(m,this.m_),false)};o.rotate=function(p){var O=L(p);var N=y(p);var m=[[O,N,0],[-N,O,0],[0,0,1]];H(this,f(m,this.m_),false)};o.scale=function(N,p){this.arcScaleX_*=N;this.arcScaleY_*=p;var m=[[N,0,0],[0,p,0],[0,0,1]];H(this,f(m,this.m_),true)};o.transform=function(P,O,R,Q,p,m){var N=[[P,O,0],[R,Q,0],[p,m,1]];H(this,f(N,this.m_),true)};o.setTransform=function(Q,P,S,R,O,N){var p=[[Q,P,0],[S,R,0],[O,N,1]];H(this,p,true)};o.clip=function(){};o.arcTo=function(){};o.createPattern=function(p,m){return new h(p,m)};function G(m){this.type_=m;this.x0_=0;this.y0_=0;this.r0_=0;this.x1_=0;this.y1_=0;this.r1_=0;this.colors_=[]}G.prototype.addColorStop=function(p,m){m=e(m);this.colors_.push({offset:p,color:m.color,alpha:m.alpha})};function h(p,m){a(p);switch(m){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=m;break;default:x("SYNTAX_ERR")}this.src_=p.src;this.width_=p.width;this.height_=p.height}function x(m){throw new J(m)}function a(m){if(!m||m.nodeType!=1||m.tagName!="IMG"){x("TYPE_MISMATCH_ERR")}if(m.readyState!="complete"){x("INVALID_STATE_ERR")}}function J(m){this.code=this[m];this.message=m+": DOM Exception "+this.code}var t=J.prototype=new Error;t.INDEX_SIZE_ERR=1;t.DOMSTRING_SIZE_ERR=2;t.HIERARCHY_REQUEST_ERR=3;t.WRONG_DOCUMENT_ERR=4;t.INVALID_CHARACTER_ERR=5;t.NO_DATA_ALLOWED_ERR=6;t.NO_MODIFICATION_ALLOWED_ERR=7;t.NOT_FOUND_ERR=8;t.NOT_SUPPORTED_ERR=9;t.INUSE_ATTRIBUTE_ERR=10;t.INVALID_STATE_ERR=11;t.SYNTAX_ERR=12;t.INVALID_MODIFICATION_ERR=13;t.NAMESPACE_ERR=14;t.INVALID_ACCESS_ERR=15;t.VALIDATION_ERR=16;t.TYPE_MISMATCH_ERR=17;G_vmlCanvasManager=n;CanvasRenderingContext2D=v;CanvasGradient=G;CanvasPattern=h;DOMException=J})()}(function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var e=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1];function b(n){var h,l,f;var m,k,g;f=n.length;l=0;h="";while(l<f){m=n.charCodeAt(l++)&255;if(l==f){h+=a.charAt(m>>2);h+=a.charAt((m&3)<<4);h+="==";break}k=n.charCodeAt(l++);if(l==f){h+=a.charAt(m>>2);h+=a.charAt(((m&3)<<4)|((k&240)>>4));h+=a.charAt((k&15)<<2);h+="=";break}g=n.charCodeAt(l++);h+=a.charAt(m>>2);h+=a.charAt(((m&3)<<4)|((k&240)>>4));h+=a.charAt(((k&15)<<2)|((g&192)>>6));h+=a.charAt(g&63)}return h}function d(o){var n,m,k,g;var l,f,h;f=o.length;l=0;h="";while(l<f){do{n=e[o.charCodeAt(l++)&255]}while(l<f&&n==-1);if(n==-1){break}do{m=e[o.charCodeAt(l++)&255]}while(l<f&&m==-1);if(m==-1){break}h+=String.fromCharCode((n<<2)|((m&48)>>4));do{k=o.charCodeAt(l++)&255;if(k==61){return h}k=e[k]}while(l<f&&k==-1);if(k==-1){break}h+=String.fromCharCode(((m&15)<<4)|((k&60)>>2));do{g=o.charCodeAt(l++)&255;if(g==61){return h}g=e[g]}while(l<f&&g==-1);if(g==-1){break}h+=String.fromCharCode(((k&3)<<6)|g)}return h}if(!window.btoa){window.btoa=b}if(!window.atob){window.atob=d}})();var Canvas2Image=(function(){var k=document.createElement("canvas"),n=String.fromCharCode;if(!k.getContext){return{saveAsBMP:function(){},saveAsPNG:function(){},saveAsJPEG:function(){}}}var d=!!(k.getContext("2d").getImageData),e=!!(k.toDataURL),a=!!(window.btoa),f="image/octet-stream";var p=function(q){var r=parseInt(q.width),t=parseInt(q.height);return q.getContext("2d").getImageData(0,0,r,t)};var g=function(t){var r,q,u="";if(typeof t=="string"){u=t}else{q=t;for(r=0;r<q.length;r++){u+=n(q[r])}}return btoa(u)};var m=function(t){var A="",u=t.width,q=t.height;A+="BM";var E=u*q*4+54;A+=n(E%256);E=Math.floor(E/256);A+=n(E%256);E=Math.floor(E/256);A+=n(E%256);E=Math.floor(E/256);A+=n(E%256);A+=n(0,0,0,0,54,0,0,0);A+=n(40,0,0,0);var r=u;A+=n(r%256);r=Math.floor(r/256);A+=n(r%256);r=Math.floor(r/256);A+=n(r%256);r=Math.floor(r/256);A+=n(r%256);var I=q;A+=n(I%256);I=Math.floor(I/256);A+=n(I%256);I=Math.floor(I/256);A+=n(I%256);I=Math.floor(I/256);A+=n(I%256);A+=n(1,0,32,0);A+=n(0,0,0,0);var z=u*q*4;A+=n(z%256);z=Math.floor(z/256);A+=n(z%256);z=Math.floor(z/256);A+=n(z%256);z=Math.floor(z/256);A+=n(z%256);A+=n(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var C=t.data,D="",F,H,G=q,w,v,B;do{v=u*(G-1)*4;B="";for(H=0;H<u;H++){w=4*H;B+=n(C[v+w+2],C[v+w+1],C[v+w],C[v+w+3])}D+=B}while(--G);return g(A+D)};var b=function(q){if(!window.open(q)){document.location.href=q}};var l=function(r,q){return"data:"+q+";base64,"+r};var o=function(q){var r=document.createElement("img");r.src=q;return r};var h=function(r,t,v){if(t&&v){var u=document.createElement("canvas");u.width=t;u.height=v;u.style.width=t+"px";u.style.height=v+"px";var q=u.getContext("2d");q.drawImage(r,0,0,r.width,r.height,0,0,t,t);return u}return r};return{saveAsPNG:function(r,q,t,w){if(!e){return false}var u=h(r,t,w),v=u.toDataURL("image/png");if(q){return o(v)}else{b(v.replace("image/png",f))}return true},saveAsJPEG:function(r,q,t,x){if(!e){return false}var u=h(r,t,x),w="image/jpeg",v=u.toDataURL(w);if(v.indexOf(w)!=5){return false}if(q){return o(v)}else{b(v.replace(w,f))}return true},saveAsBMP:function(t,r,u,w){if(!(d&&a)){return false}var v=h(t,u,w),x=p(v),q=m(x);if(r){return o(l(q,"image/bmp"))}else{b(l(q,f))}return true}}})();
