(function(){jQuery.color={};jQuery.color.make=function(c,h,f,e){var d={};d.r=c||0;d.g=h||0;d.b=f||0;d.a=e!=null?e:1;d.add=function(j,k){for(var g=0;g<j.length;++g){d[j.charAt(g)]+=k}return d.normalize()};d.scale=function(g,k){for(var j=0;j<g.length;++j){d[g.charAt(j)]*=k}return d.normalize()};d.toString=function(){if(d.a>=1){return"rgb("+[d.r,d.g,d.b].join(",")+")"}else{return"rgba("+[d.r,d.g,d.b,d.a].join(",")+")"}};d.normalize=function(){function g(j,i,k){return i<j?j:(i>k?k:i)}d.r=g(0,parseInt(d.r),255);d.g=g(0,parseInt(d.g),255);d.b=g(0,parseInt(d.b),255);d.a=g(0,d.a,1);return d};d.clone=function(){return jQuery.color.make(d.r,d.b,d.g,d.a)};return d.normalize()};jQuery.color.getLinearColor=function(l,k,h,e,g){var f=function(o,n,q,p,r){var s=parseInt(p+(o-n)/(q-n)*(r-p));if(s>255){s=255}else{if(s<0){s=0}}return s};var i=null;var d=null;if(typeof e=="string"){i=jQuery.color.parse(e)}else{i=e}if(typeof g=="string"){d=jQuery.color.parse(g)}else{d=g}var c=f(l,k,h,i.r,d.r);var j=f(l,k,h,i.g,d.g);var m=f(l,k,h,i.b,d.b);return jQuery.color.make(c,j,m)};jQuery.color.getMidColor=function(d,c){return jQuery.color.getLinearColor(128,0,256,d,c)};jQuery.color.extract=function(e,d){var f;do{f=e.css(d).toLowerCase();if(f!=""&&f!="transparent"){break}e=e.parent()}while(!jQuery.nodeName(e.get(0),"body"));if(f=="rgba(0, 0, 0, 0)"){f="transparent"}return jQuery.color.parse(f)};jQuery.color.parse=function(e){var g,c=jQuery.color.make;if(g=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e)){return c(parseInt(g[1],10),parseInt(g[2],10),parseInt(g[3],10))}if(g=/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(e)){return c(parseInt(g[1],10),parseInt(g[2],10),parseInt(g[3],10),parseFloat(g[4]))}if(g=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e)){return c(parseFloat(g[1])*2.55,parseFloat(g[2])*2.55,parseFloat(g[3])*2.55)}if(g=/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(e)){return c(parseFloat(g[1])*2.55,parseFloat(g[2])*2.55,parseFloat(g[3])*2.55,parseFloat(g[4]))}if(g=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e)){return c(parseInt(g[2],16),parseInt(g[3],16),parseInt(g[4],16),parseInt(g[1],16)/255)}if(g=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e)){return c(parseInt(g[1],16),parseInt(g[2],16),parseInt(g[3],16))}if(g=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e)){return c(parseInt(g[1]+g[1],16),parseInt(g[2]+g[2],16),parseInt(g[3]+g[3],16))}var d=jQuery.trim(e).toLowerCase();if(d==""||d==null||d=="undefined"){return null}if(d=="transparent"){return c(255,255,255,0)}if(parseInt(d)){var d=parseInt(d);var f=d>20?(d%20):d;if(f==0){f=20}e=b[f];if(g=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e)){return c(parseInt(g[1],16),parseInt(g[2],16),parseInt(g[3],16))}}else{g=a[d];return c(g[0],g[1],g[2])}};var b={1:"#0A1E60",2:"#A6BC09",3:"#FEA620",4:"#FF1300",5:"#738FB6",6:"#006065",7:"#47A888",8:"#FFD100",9:"#D13973",10:"#73A87F",11:"#4A4A7B",12:"#3E841C",13:"#F0F065",14:"#770000",15:"#81ABBA",16:"#949FB7",17:"#CFD47F",18:"#F4B287",19:"#CD7F99",20:"#7FAFB2"};var a={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]}})();(function($){$.toJSON=function(o){if(typeof(JSON)=="object"&&JSON.stringify){return JSON.stringify(o)}var type=typeof(o);if(o===null){return"null"}if(type=="undefined"){return undefined}if(type=="number"||type=="boolean"){return o+""}if(type=="string"){return $.quoteString(o)}if(type=="object"){if(typeof o.toJSON=="function"){return $.toJSON(o.toJSON())}if(o.constructor===Date){var month=o.getUTCMonth()+1;if(month<10){month="0"+month}var day=o.getUTCDate();if(day<10){day="0"+day}var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10){hours="0"+hours}var minutes=o.getUTCMinutes();if(minutes<10){minutes="0"+minutes}var seconds=o.getUTCSeconds();if(seconds<10){seconds="0"+seconds}var milli=o.getUTCMilliseconds();if(milli<100){milli="0"+milli}if(milli<10){milli="0"+milli}return'"'+year+"-"+month+"-"+day+"T"+hours+":"+minutes+":"+seconds+"."+milli+'Z"'}if(o.constructor===Array){var ret=[];for(var i=0;i<o.length;i++){ret.push($.toJSON(o[i])||"null")}return"["+ret.join(",")+"]"}var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number"){name='"'+k+'"'}else{if(type=="string"){name=$.quoteString(k)}else{continue}}if(typeof o[k]=="function"){continue}var val=$.toJSON(o[k]);pairs.push(name+":"+val)}return"{"+pairs.join(", ")+"}"}};$.evalJSON=function(src){if(typeof(JSON)=="object"&&JSON.parse){return JSON.parse(src)}return eval("("+src+")")};$.secureEvalJSON=function(src){if(typeof(JSON)=="object"&&JSON.parse){return JSON.parse(src)}var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,"@");filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(filtered)){return eval("("+src+")")}else{throw new SyntaxError("Error parsing JSON, source is not valid.")}};$.quoteString=function(string){if(string.match(_escapeable)){return'"'+string.replace(_escapeable,function(a){var c=_meta[a];if(typeof c==="string"){return c}c=a.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"'}return'"'+string+'"'};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}})(jQuery);function Dictionary(){var d=this;this.compareMode=1;this.count=0;this.arrKeys=new Array();this.arrValues=new Array();this.throwException=true;this.item=function(e){var f=a(d.arrKeys,e);if(f!=-1){return d.arrValues[f]}else{if(d.throwException){throw"Exception when tring to match key, special key may not exist"}}};this.keys=function(){return d.arrKeys};this.values=function(){return d.arrValues};this.updateItem=function(f,e){var g=a(d.arrKeys,f);if(g!=-1){return d.arrValues.splice(g,1,e)}else{this.add(f,e)}};this.add=function(f,e){if(c(f)){d.arrKeys[d.count]=f;d.arrValues[d.count]=e;d.count++}else{if(d.throwException){throw"Exception when tring to add key, special key exist"}}};this.batchAdd=function(e,g){var f=false;if(e!=null&&e!=undefined&&g!=null&&g!=undefined){if(e.length==g.length&&e.length>0){var h=d.arrKeys.concat(e);if(!b(h)){d.arrKeys=h;d.arrValues=d.arrValues.concat(g);d.count=d.arrKeys.length;f=true}}}return f};this.clear=function(){if(d.count!=0){d.arrKeys.splice(0,d.count);d.arrValues.splice(0,d.count);d.count=0}};this.containsKey=function(e){return a(d.arrKeys,e)!=-1};this.containsValue=function(e){return a(d.arrValues,e)!=-1};this.remove=function(e){var f=a(d.arrKeys,e);if(f!=-1){d.arrKeys.splice(f,1);d.arrValues.splice(f,1);d.count--;return true}else{return false}};this.removeValue=function(e){var f=a(d.arrValues,e);if(f!=-1){d.arrKeys.splice(f,1);d.arrValues.splice(f,1);d.count--;return true}else{return false}};this.tryGetValue=function(f,e){var g=a(d.arrKeys,f);if(g!=-1){return d.arrValues[g]}else{return e}};this.toString=function(){if(d.count==0){return""}else{return d.arrKeys.toString()+";"+d.arrValues.toString()}};function c(e){if(e==null||e==undefined||e==""||e==NaN){return false}return !d.containsKey(e)}function a(f,k){var l=-1;var j;if(!(f==null||f==undefined||typeof(f)!="object")){try{for(j=0;j<f.length;j++){var g;if(d.compareMode==0){g=(f[j]===k)}else{g=(f[j]==k)}if(g){l=j;break}}}catch(h){}}return l}function b(f){var e=false;if(f!=null&&f!=undefined&&typeof(f)=="object"){var h;for(h=0;h<f.length-1;h++){var g;if(d.compareMode==0){g=(f[h]===f[h+1])}else{g=(f[h]==f[h+1])}if(g){e=true;break}}}return e}};var gFloatingWindows=["oPanelDebug","oPanelUpdates","oPanelIssues"];var CHARTID={Growth:"growth",HBSM:"hbsm"};function showPanel(b){var a=gFloatingWindows.length;var d;for(var e=0;e<a;e++){d=gFloatingWindows[e]==b;var c=document.getElementById(gFloatingWindows[e]);if(c){if(!d){c.style.display="none"}else{if(c.style.display=="block"){c.style.display="none"}else{c.style.display="block"}}}}}function initPanel(a){switch(a.objId){case CHARTID.Growth:_showGrowthChartInfo();break;case CHARTID.HBSM:_showHBSMChartInfo();break;default:break}}function _showGrowthChartInfo(){var b=document.getElementById("oUpdates");if(!b){return}b.value="01/22/2010\n - [new feature] enable legend component (basic function). \n - [update] change the draging behavior of date slider, components won't update until mouse buttom up.\n01/18/2010\n - [new feature] enable the subject investment indicator in main graph. \n - [bug fixed] update the method of getting relative position when page has scroll bar.\n - [bug fixed] the right border line of dateslider will disappear sometimes.\n - [folder improve] change the folder structure.\n01/15/2010\n - [new feature] enable main graph component.\n - [new feature] enable date slider component.\n - [new feature] enable basic interactive behavior in date slider.\n - [test] work in google chrome, firefox 3.5, IE6.\n - [test] google chrome has the best performance, IE6 is worst.\n01/11/2010\n - [new feature] Page created.\n";var a=document.getElementById("oIssues");if(!a){return}a.value=" - [open] No data source, data in this demo is generated by random function.\n - [open] Font size in google chrome (chs version) can't be smaller than 12px.\n\n - [fixed] date slider have problem in getting relative position when having scroll bar. (01/18/2010)\n"}function _showHBSMChartInfo(){};Date.prototype.dateAdd=function(c,e){var a=[this.getFullYear(),this.getMonth(),this.getDate()];var b=new Date(a[0],a[1],a[2]);switch(c){case"d":b.setDate(a[2]+e);break;case"w":b.setDate(a[2]+e*7);break;case"m":b.setMonth(a[1]+e);break;case"q":b.setMonth(a[1]+e*3);break;case"s":b.setMonth(a[1]+e*6);break;case"a":b.setFullYear(a[0]+e);break}return b};Date.prototype.dateDiff=function(b,e){var c=this,a=c.getTime(),f=e.getTime();switch(b){case"d":return Math.floor(f/86400000)-Math.floor(a/86400000);case"w":return Math.floor((f+345600000)/(604800000))-Math.floor((a+345600000)/(604800000));case"m":return(e.getFullYear()-c.getFullYear())*12+e.getMonth()-c.getMonth();case"q":return(e.getFullYear()-c.getFullYear())*4+Math.floor(e.getMonth()/4)-Math.floor(c.getMonth()/4);case"s":return(e.getFullYear()-c.getFullYear())*2+Math.floor(e.getMonth()/2)-Math.floor(c.getMonth()/2);case"a":return e.getFullYear()-c.getFullYear()}return 0};Date.prototype.clone=function(){return new Date(this.getFullYear(),this.getMonth(),this.getDate())};String.format=function(){var a=arguments[0];for(var c=0;c<arguments.length-1;c++){var b=new RegExp("\\{"+c+"\\}","gm");a=a.replace(b,arguments[c+1])}return a};String.prototype.endWith=function(a){return(this.substr(this.length-a.length)===a)};String.prototype.startWith=function(a){return(this.substr(0,a.length)===a)};Number.prototype.floatToFixed=function(b){var a=""+this;if(-1==a.indexOf(".")){return this}else{return this.toFixed(b)}};Number.prototype.toHex=function(){var a=this.toString(16);if(a.length%2==1){return"0"+this.toString(16)}else{return this.toString(16)}};Number.prototype.equalWith=function(a){return Math.abs(this-a)<1e-05};Number.prototype.mul=function(b){var a=0,c=b.toString(),e=this.toString();var f=c.split(".");var d=e.split(".");if(f.length>1){a+=f[1].length}if(d.length>1){a+=d[1].length}return Number(c.replace(".",""))*Number(e.replace(".",""))/Math.pow(10,a)};Number.prototype.div=function(a){var d=0,h=0,b,f;var c=this.toString(),g=a.toString();var e=c.split(".");var i=g.split(".");if(e.length>1){d=e[1].length}if(i.length>1){h=i[1].length}b=Number(c.replace(".",""));f=Number(g.replace(".",""));return(b/f)*Math.pow(10,h-d)};Number.prototype.add=function(b){var f=0,d=0,a;var e=b.toString().split(".");var c=this.toString().split(".");if(e.length>1){f=e[1].length}if(c.length>1){d=c[1].length}a=Math.pow(10,Math.max(f,d));return(b*a+this*a)/a};if(!Array.prototype.indexOf){[].indexOf||(Array.prototype.indexOf=function(b){var a=this.length;var c=Number(arguments[1])||0;c=(c<0)?Math.ceil(c):Math.floor(c);if(c<0){c+=a}for(;c<a;c++){if(c in this&&this[c]===b){return c}}return -1})}Math.log10=function(a){return Math.log(a)/Math.log(10)};jQuery.extend({getPosition:function(a,c){var b={left:0,top:0};try{if(a){b=$(a).offset()}}catch(c){}return{x:c.pageX-b.left,y:c.pageY-b.top}},getMargins:function(f,c){var d=$(f);var g=d.css("margin-top")||"";var a=d.css("margin-right")||"";var e=d.css("margin-bottom")||"";var h=d.css("margin-left")||"";if(c){return{t:parseInt(g)||0,r:parseInt(a)||0,b:parseInt(e)||0,l:parseInt(h)}}else{return{t:g,r:a,b:e,l:h}}},getPadding:function(f,c){var d=$(f);var g=d.css("padding-top")||"";var a=d.css("padding-right")||"";var e=d.css("padding-bottom")||"";var h=d.css("padding-left")||"";if(c){return{t:parseInt(g)||0,r:parseInt(a)||0,b:parseInt(e)||0,l:parseInt(h)}}else{return{t:g,r:a,b:e,l:h}}},getBorder:function(f,c){var d=$(f);var g=d.css("border-top-width")||"";var a=d.css("border-right-width")||"";var e=d.css("border-bottom-width")||"";var h=d.css("border-left-width")||"";if(c){return{t:parseInt(g)||0,r:parseInt(a)||0,b:parseInt(e)||0,l:parseInt(h)||0}}else{return{t:g,r:a,b:e,l:h}}}});$.fn.extend({removeCSS:function(a){return this.each(function(){var b=$(this);jQuery.grep(a.split(","),function(c){b.css(c,"")});return b})}});jQuery.extend({BooleanTrueString:"true",parseToBool:function(b){var a=false;b=b.toLowerCase();if(b=="1"){a=true}if($.BooleanTrueString.indexOf(b)==0){a=true}return a},isNull:function(a){return a==null||typeof(a)=="undefined"}});$.extend({Canvas:{create:function(b,h,c,f,g,e,a){function d(j,i){var k=document.createElement("canvas");k.width=j;k.height=i;if(!k.getContext){k=window.G_vmlCanvasManager.initElement(k)}return k}return $(d(g,e)).css({position:h,left:c,top:f,width:g,height:e,"background-color":a?a:"transparent"}).appendTo(b).get(0)},createDiv:function(d,a,b,g,e,c){function f(i,h){var j=document.createElement("DIV");j.width=i;j.height=h;return j}return $(f(e,c)).css({position:a,left:b,top:g,width:e,height:c}).appendTo(d).get(0)},resize:function(b,c,a){b.css({width:c,height:a});b.each(function(){this.width=c;this.height=a})}},TextStudio:{create:function(f,a,k,b,h,j,g,i){var e='<div class="'+i+'">'+f+"</div>";var d=$(e).css({position:k,left:b,top:h}).appendTo(a);if(j){d.css({width:j})}if(g){d.css({height:g})}return d.get(0)},createTextString:function(d,a,i,b,f,h,e,g){var c="";c+='<div style="position: '+i+"; left: "+b+"px; top:  "+f+"px; ";if(h){c+="width: "+h+"px;"}if(e){c+="height: "+e+'px;" '}c+=' class="'+g+'">'+d+"</div>";return c},createVertical:function(f,a,k,b,h,j,g,i){var e='<div class="'+i+'">'+f+"</div>";var d=$(e).css({position:k}).appendTo(a);if(j){d.css({width:j})}if(g){d.css({height:g})}if(!$.browser.msie){var l=(d.width()-d.height())/2;b-=l;h+=l}d.css({left:b,top:h,"writing-mode":"tb-rl","-o-transform":"rotate(-90deg)","-moz-transform":"rotate(-90deg)","-webkit-transform":"rotate(-90deg)"});return d.get(0)},getTextMeasure:function(f,d,e){if(!d){d=$(document.body)}var a=""+e+" textnowrap";var b=$(d).children("#tbGetWidth");if(!b||b.length<1){b=$($.TextStudio.create(f,d,"absolute",0,0,null,null,a)).attr({id:"tbGetWidth"})}else{b.attr({"class":a});b.text(f)}b.get(0).style.display="block";var c={width:b.width(),height:b.height()};b.get(0).style.display="none";return c}},ShapeGallery:{begin:function(a){a.save();a.beginPath()},end:function(a){a.restore()},drawLine:function(e,c,g,f,d,b){if(typeof(b)=="undefined"){b=true}if(b){var a=d%2==1?0.5:0;c.x=parseInt(c.x)+a;c.y=parseInt(c.y)+a;g.x=parseInt(g.x)+a;g.y=parseInt(g.y)+a}e.lineWidth=d;e.strokeStyle=f;e.moveTo(c.x,c.y);e.lineTo(g.x,g.y);e.stroke()},drawLines:function(f,c,e,b,h){if(typeof(h)=="undefined"){h=true}var g=c.length;if(g>0){if(h){var d=b%2==1?0.5:0;for(var a=0;a<g;a++){f.moveTo(parseInt(c[a][0])+d,parseInt(c[a][1])+d);f.lineTo(parseInt(c[a][2])+d,parseInt(c[a][3])+d)}}else{for(var a=0;a<g;a++){f.moveTo(c[a][0],c[a][1]);f.lineTo(c[a][2],c[a][3])}}f.lineWidth=b;f.strokeStyle=e;f.stroke()}},drawVDotLine:function(i,c,k,d,b,j,h,f){i.lineWidth=f;i.strokeStyle=h;var e=d,g=d-b,a=b+j;while(e>k){i.moveTo(c,g);i.lineTo(c,e);e-=a;g-=a;g=g<k?k:g}i.stroke()},drawCircle:function(e,b,a,g,d,c){var f=0;if(c){e.arc(b.x,b.y,a,0,Math.PI*2,false);e.fillStyle=c;e.fill();f++}if(d>0){if(f>0){e.beginPath()}e.arc(b.x,b.y,a,0,Math.PI*2,false);e.lineWidth=d;e.strokeStyle=g;e.stroke()}},drawDotCircle:function(h,e,c,b,d,j){var a=[],g=Math.floor(Math.PI*2/(b/c));for(var f=0;f<=g;f++){a[f]=[e.x+c*Math.cos(f*b/c),e.y+c*Math.sin(f*b/c)]}h.lineWidth=j;h.strokeStyle=d;for(f=0;f<g;f++){if(f%2==0){h.moveTo(a[f][0],a[f][1]);h.lineTo(a[f+1][0],a[f+1][1])}}h.stroke()},drawArc:function(g,f,d,b,a,e,h,c){g.moveTo(f.x,f.y);if(a<b){var i=b;b=a;a=i}if(a-b>=Math.PI*2){g.arc(f.x,f.y,d,b,(b+a)/2,false);g.arc(f.x,f.y,d,(b+a)/2-0.0001,a,false)}else{g.arc(f.x,f.y,d,b,a,false)}if(c){g.fillStyle=c;g.fill()}else{g.lineWidth=h;g.strokeStyle=e;g.stroke()}},drawEclipse:function(j,a,d,l,h,e,c){var i=[];var f=[];if(l==0){return}for(var b=l;b>=0;b-=0.5){f.push(b);var g=d*d-d*d*b*b/(l*l);if(g<0){g=0}i.push(Math.sqrt(g))}var m=[a.x,a.y];j.moveTo(m[0]+i[0],m[1]-f[0]);for(var b=0;b<i.length;b++){j.lineTo(m[0]+i[b],m[1]-f[b])}for(var b=i.length-1;b>=0;b--){j.lineTo(m[0]+i[b],m[1]+f[b])}for(var b=0;b<i.length;b++){j.lineTo(m[0]-i[b],m[1]+f[b])}for(var b=i.length-1;b>=0;b--){j.lineTo(m[0]-i[b],m[1]-f[b])}if(c){j.fillStyle=c;j.fill()}else{j.lineWidth=e;j.strokeStyle=h;j.stroke()}},drawRectangle:function(g,c,a,e,d,h,b,i){if(typeof(i)=="undefined"){i=true}if(b){g.fillStyle=b;if(i){g.fillRect(parseInt(c.x),parseInt(c.y),parseInt(a),parseInt(e))}else{g.fillRect(c.x,c.y,a,e)}}if(h>0){g.lineWidth=h;g.strokeStyle=d;if(i){var f=h/2;g.strokeRect(parseInt(c.x)+f,parseInt(c.y)+f,parseInt(a)-h,parseInt(e)-h)}else{g.strokeRect(c.x,c.y,a,e)}}},drawPolyline:function(c,d,b,a){c.lineWidth=b;c.lineJoin="round";c.strokeStyle=a;this._drawPath(c,d,false);c.stroke()},drawPolygon:function(e,f,d,b,c){var a=0;if(c){this._drawPath(e,f,true);e.fillStyle=c;e.fill();a++}if(d>0){if(a>0){e.beginPath()}this._drawPath(e,f,true);e.lineWidth=d;e.lineJoin="round";e.strokeStyle=b;e.stroke()}},_drawPath:function(e,f,b){var a=f.length;var c=function(j){var k=null;for(var h=j;h<a;h++){if(typeof(f[h].y)=="number"){k=h;break}}return k};if(a){e.moveTo(f[0].x,f[0].y);for(var g=1;g<a;g++){if(typeof(f[g].y)=="number"){e.lineTo(f[g].x,f[g].y)}else{if(f[g].y==null){var d=c(g);if(d!=null){e.moveTo(f[d].x,f[d].y)}}}}}if(b){e.closePath()}}},Graphics:function(a){this.GraphicFillType={NONE_FILL:0,NORMAL_FILL:1,GRADIENT_FILL:2};this._ctx=a;this._autoPos=true;this._lineWidth=1;this._lineAlpha=1;this._lineColor="rgba(0,0,0,1)";this._fillType=this.GraphicFillType.NORMAL_FILL;this._fillColor="rgba(255,255,255,1)";this._fillAlpha=1;this._gradientFill=null;this.setContainer=function(b){this._ctx=b};this.setLineStyle=function(d,c,b){if(!$.isNull(d)){this._lineWidth=d}if(!$.isNull(c)){this._lineColor=c}if(!$.isNull(b)){this._lineAlpha=b}};this.setNoneFill=function(){this._fillType=this.GraphicFillType.NONE_FILL};this.setNormalFill=function(b,c){this._fillColor=b;if(!$.isNull(c)){this._fillAlpha=c}this._fillType=this.GraphicFillType.NORMAL_FILL};this.setGradientFill=function(b){this._gradientFill=b;this._fillType=this.GraphicFillType.GRADIENT_FILL};this.getFillBrush=function(){switch(this._fillType){case this.GraphicFillType.NONE_FILL:return null;case this.GraphicFillType.NORMAL_FILL:return this._fillColor;case this.GraphicFillType.GRADIENT_FILL:return this._gradientFill}return null};this.begin=function(){$.ShapeGallery.begin(this._ctx)};this.end=function(){$.ShapeGallery.end(this._ctx)};this.drawLine=function(b,c,d,e){$.ShapeGallery.drawLine(this._ctx,{x:b,y:c},{x:d,y:e},this._lineColor,this._lineWidth,this._autoPos)};this.drawLines=function(b){$.ShapeGallery.drawLines(this._ctx,b,this._lineColor,this._lineWidth,this._autoPos)};this.drawVDotLine=function(b,d,f,c,e){$.ShapeGallery.drawVDotLine(this._ctx,b,d,f,c,e,this._lineColor,this._lineWidth)};this.drawRectangle=function(b,c,d,e){if(e<0){c=c+e;e=-e}if(d<0){b=b+d;d=-d}$.ShapeGallery.drawRectangle(this._ctx,{x:b,y:c},d,e,this._lineColor,this._lineWidth,this.getFillBrush())};this.drawPolyline=function(b){$.ShapeGallery.drawPolyline(this._ctx,b,this._lineWidth,this._lineColor)};this.drawPolygon=function(b){$.ShapeGallery.drawPolygon(this._ctx,b,this._lineWidth,this._lineColor,this.getFillBrush())};this.drawCircle=function(c,b){$.ShapeGallery.drawCircle(this._ctx,c,b,this._lineColor,this._lineWidth,this.getFillBrush())};this.drawDotCircle=function(c,b,d){$.ShapeGallery.drawDotCircle(this._ctx,c,b,d,this._lineColor,this._lineWidth)};this.drawArc=function(d,b,c,e){if(c.equalWith(e)){return}$.ShapeGallery.drawArc(this._ctx,d,b,c,e,this._lineColor,this._lineWidth,this._fillColor)};this.drawEclipse=function(c,b,d){$.ShapeGallery.drawEclipse(this._ctx,c,b,d,this._lineColor,this._lineWidth,this.getFillBrush())}}});if(!Chart){var Chart={version:0.001001,build:20100802}}Chart.load=function(a,c,d){var b=String.format("{0}/script/pack/{1}.pack.js",a,c);$.getScript(b,d)};Chart.Common=function(){};Chart.Component=function(){};Chart.Interface=function(){};Chart.Common.Graphic=function(){};Chart.Common.Graphic.ShapeType={Rect:0,Area:1,Square:2,Circle:3,Triangle:4,Cross:5,LineSmall:6,LineMedium:7,LineThick:8,CharDividend:9,CharCapitalGain:10,CharSplits:11,TipBox:12,Ellipse:13,DotSmall:14,DotMedium:15,DotLarge:16,Diamond:19,Pentagon:20,TriangleDown:21,TriangleLeft:22,TriangleRight:23,CircleFrame:24,SquareFrame:25,TriangleFrame:26,TriangleDownFrame:27,TriangleLeftFrame:28,TriangleRightFrame:29,DiamondFrame:30,PentagonFrame:31,None:99};Chart.Common.Graphic.GraphElement=function(){var b=0;var a=0;this.canvas=null;this.applySetting=function(c){};this.getSetting=function(c){};this.getHeight=function(){if(this.canvas){return this.canvas.height}return 0};this.getWidth=function(){if(this.canvas){return this.canvas.width}return 0};this.getGlobaPosition=function(f,d){var e=$(this.canvas).offset();var c=d.offset();f.x+=e.left-c.left;f.y+=e.top-c.top;return f};this.refresh=function(){};this.resize=function(d,c){this.resizeComponents(d,c);if(this.canvas){this.canvas.width=d;this.canvas.height=c;$(this.canvas).css({width:d,height:c});b=d;a=c}};this.resizeComponents=function(d,c){};this.setPosition=function(c,d){if(this.canvas){$(this.canvas).css({left:c,top:d})}}};Chart.Common.Graphic.GraphicUtil=function(){};Chart.Common.Graphic.GraphicUtil.inPolygon=function(d,c,g){var h=function(m,i,l){return((m.x-l.x)*(i.y-l.y)-(i.x-l.x)*(m.y-l.y))};var e=function(l,i){return((Math.abs(h(i.pt1,i.pt2,l))<1e-05)&&((l.x-i.pt1.x)*(l.x-i.pt2.x)<=0)&&((l.y-i.pt1.y)*(l.y-i.pt2.y)<=0))};var f=function(l,i){return((Math.max(l.pt1.x,l.pt2.x)>=Math.min(i.pt1.x,i.pt2.x))&&(Math.max(i.pt1.x,i.pt2.x)>=Math.min(l.pt1.x,l.pt2.x))&&(Math.max(l.pt1.y,l.pt2.y)>=Math.min(i.pt1.y,i.pt2.y))&&(Math.max(i.pt1.y,i.pt2.y)>=Math.min(l.pt1.y,l.pt2.y))&&(h(i.pt1,l.pt2,l.pt1)*h(l.pt2,i.pt2,l.pt1)>=0)&&(h(l.pt1,i.pt2,i.pt1)*h(i.pt2,l.pt2,i.pt1)>=0))};if(c==1){return((Math.abs(d[0].x-g.x)<1e-05)&&(fabs(d[0].y-g.y)<1e-05))}else{if(c==2){var k={pt1:d[0],pt2:d[1]};return e(g,k)}}var j=0;var b={pt1:g,pt2:{x:-10000000000,y:g.y}};for(var a=0;a<c;a++){var k={pt1:d[a],pt2:d[(a+1)%c]};if(e(g,k)){return true}if(Math.abs(k.pt1.y-k.pt2.y)<1e-05){continue}if(e(k.pt1,b)){if(k.pt1.y>k.pt2.y){j++}}else{if(e(k.pt2,b)){if(k.pt2.y>k.pt1.y){j++}}else{if(f(b,k)){j++}}}}return(j%2==1)};Chart.Common.Util=function(){};Chart.Common.Util.PeriodType={Day:"d",Month:"m",Year:"y",Custom:"custom",MTD:"mtd",QTD:"qtd",YTD:"ytd",MAX:"max"};Chart.Common.Util.TimePeriod=function(){this.periodCount=0;this.periodType=Chart.Common.Util.PeriodType.MAX};Chart.Common.Util.TimePeriod.prototype={create:function(c){if(!c){return false}var b=c.split(";");if(!b||b.length<2){return false}var a=parseInt(b[0]);if(isNaN(a)){return false}this.periodCount=a;switch(b[1].toLowerCase()){case Chart.Common.Util.PeriodType.Day:case Chart.Common.Util.PeriodType.Month:case Chart.Common.Util.PeriodType.Year:case Chart.Common.Util.PeriodType.Custom:case Chart.Common.Util.PeriodType.MTD:case Chart.Common.Util.PeriodType.QTD:case Chart.Common.Util.PeriodType.YTD:case Chart.Common.Util.PeriodType.MAX:this.periodType=b[1].toLowerCase();break;default:break}return true},getStartDate:function(a){switch(this.periodType){case Chart.Common.Util.PeriodType.Day:return a.dateAdd(Chart.Common.Util.DataFrequency.Daily,0-this.periodCount+1);case Chart.Common.Util.PeriodType.Month:return a.dateAdd(Chart.Common.Util.DataFrequency.Daily,1).dateAdd(Chart.Common.Util.DataFrequency.Monthly,0-this.periodCount);case Chart.Common.Util.PeriodType.Year:return a.dateAdd(Chart.Common.Util.DataFrequency.Daily,1).dateAdd(Chart.Common.Util.DataFrequency.Annually,0-this.periodCount);case Chart.Common.Util.PeriodType.MTD:return new Date(a.getFullYear(),a.getMonth(),1);case Chart.Common.Util.PeriodType.QTD:var b=a.getMonth()+1;b=b-(b-1)%3-1;return new Date(a.getFullYear(),b,1);case Chart.Common.Util.PeriodType.YTD:return new Date(a.getFullYear(),0,1);case Chart.Common.Util.PeriodType.MAX:default:return Chart.Common.Util.DateUtil.BASE_DATE()}},isSpecific:function(){switch(this.periodType){case Chart.Common.Util.PeriodType.Custom:case Chart.Common.Util.PeriodType.MAX:return false;default:return true}},toString:function(){return this.periodCount.toString()+";"+this.periodType}};Chart.Common.Util.DataFrequency={None:"",Daily:"d",Weekly:"w",Monthly:"m",Quarterly:"q",Semiannually:"s",Annually:"a",Irregular:"i",AnnuallyIncludingYearToDate:"ytd"};Chart.Common.Util.DataFrequencyEx=function(a,b){this.frequency=a;this.count=b};Chart.Common.Util.DataFrequencyEx.prototype.toString=function(){return String.format("({0};{1})",this.count,this.frequency)};Chart.Common.Util.DateUtil=function(){};Chart.Common.Util.DateUtil.BASE_DATE=function(){return new Date(1900,0,1)};Chart.Common.Util.DateUtil.arrayOfDayInMonths=[31,28,31,30,31,30,31,31,30,31,30,31];Chart.Common.Util.DateUtil.arrayOfDayInMonths2=[31,29,31,30,31,30,31,31,30,31,30,31];Chart.Common.Util.DateUtil.getDateIndex=function(a){return Chart.Common.Util.DateUtil.BASE_DATE().dateDiff("d",a)};Chart.Common.Util.DateUtil.getDateFromIndex=function(a){return new Date(1900,0,1+a)};Chart.Common.Util.DateUtil.adjustOLEDateIndex=function(a){return a-2};Chart.Common.Util.DateUtil.dayInMonth=function(c,b){var a=(((c%4===0)&&(c%100!==0))||(c%400===0));var d=a?Chart.Common.Util.DateUtil.arrayOfDayInMonths2:Chart.Common.Util.DateUtil.arrayOfDayInMonths;return d[b]};Chart.Common.Util.DateUtil.getWeekEndDate=function(a){return a.dateAdd(Chart.Common.Util.DataFrequency.Daily,a.getDay()==6?6:(5-a.getDay()))};Chart.Common.Util.DateUtil.getMonthEndDate=function(a){return new Date(a.getFullYear(),a.getMonth(),Chart.Common.Util.DateUtil.dayInMonth(a.getFullYear(),a.getMonth()))};Chart.Common.Util.DateUtil.getMonthFirstDate=function(a){return new Date(a.getFullYear(),a.getMonth(),1)};Chart.Common.Util.DateUtil.getHalfYearEndDate=function(c){var b=c.getMonth()+1;var a=Math.ceil(b/6)*6-b;return Chart.Common.Util.DateUtil.getMonthEndDate(c.dateAdd("m",a))};Chart.Common.Util.DateUtil.getYearEndDate=function(a){return new Date(a.getFullYear(),11,31)};Chart.Common.Util.DateUtil.getQuarterEndDate=function(c){var b=c.getMonth()+1;var a=Math.ceil(b/3)*3-b;return Chart.Common.Util.DateUtil.getMonthEndDate(c.dateAdd("m",a))};Chart.Common.Util.DateUtil.getLastWeekEndDate=function(a){if(a.getDay()!=6){a=a.dateAdd(Chart.Common.Util.DataFrequency.Daily,-7)}return a.dateAdd(Chart.Common.Util.DataFrequency.Daily,6-a.getDay())};Chart.Common.Util.DateUtil.getLastMonthEndDate=function(a){if(a.getDate()<Chart.Common.Util.DateUtil.dayInMonth(a.getFullYear(),a.getMonth())){a=a.dateAdd(Chart.Common.Util.DataFrequency.Monthly,-1)}return Chart.Common.Util.DateUtil.getMonthEndDate(a)};Chart.Common.Util.DateUtil.getLastQuarterEndDate=function(c,b){if(!b){b=12}var a=(c.getMonth()+1+12-b)%3;var d=Chart.Common.Util.DateUtil.dayInMonth(c.getFullYear(),c.getMonth());if(c.getDay()<d&&a===0){c=c.dateAdd(Chart.Common.Util.DataFrequency.Monthly,-3)}else{if(c.getDay()<d&&a>0){c=c.dateAdd(Chart.Common.Util.DataFrequency.Monthly,-a)}}return Chart.Common.Util.DateUtil.getMonthEndDate(c)};Chart.Common.Util.DateUtil.getLastYearEndDate=function(a){if(a.getDay()<31||a.getMonth()<11){a=new Date(a.getFullYear()-1,11,31)}return a};Chart.Common.Util.DateUtil.getPeriodEnd=function(b,a){switch(a){case Chart.Common.Util.DataFrequency.Weekly:return Chart.Common.Util.DateUtil.getWeekEndDate(b);case Chart.Common.Util.DataFrequency.Monthly:return Chart.Common.Util.DateUtil.getMonthEndDate(b);case Chart.Common.Util.DataFrequency.Quarterly:return Chart.Common.Util.DateUtil.getQuarterEndDate(b);case Chart.Common.Util.DataFrequency.Semiannually:return Chart.Common.Util.DateUtil.getHalfYearEndDate(b);case Chart.Common.Util.DataFrequency.Annually:case Chart.Common.Util.DataFrequency.AnnuallyIncludingYearToDate:return Chart.Common.Util.DateUtil.getYearEndDate(b);default:return b}};Chart.Common.Util.DateUtil.getLastPeriodEnd=function(b,a){switch(a){case Chart.Common.Util.DataFrequency.Weekly:return Chart.Common.Util.DateUtil.getLastWeekEndDate(b);case Chart.Common.Util.DataFrequency.Monthly:return Chart.Common.Util.DateUtil.getLastMonthEndDate(b);case Chart.Common.Util.DataFrequency.Quarterly:return Chart.Common.Util.DateUtil.getLastQuarterEndDate(b);case Chart.Common.Util.DataFrequency.Semiannually:return Chart.Common.Util.DateUtil.getHalfYearEndDate(b).dateAdd(Chart.Common.Util.DataFrequency.Monthly,-6);case Chart.Common.Util.DataFrequency.Annually:case Chart.Common.Util.DataFrequency.AnnuallyIncludingYearToDate:return Chart.Common.Util.DateUtil.getLastYearEndDate(b);default:return b}};Chart.Common.Util.NumberUtil=function(){};Chart.Common.Util.NumberUtil.parseRawDouble=function(b,a){var c=parseFloat(b);if(isNaN(c)){c=a}return c};Chart.Common.Util.ChildManagerTool=function(a){this.childType=a;this.childList=[];this.index=0;return this};Chart.Common.Util.ChildManagerTool.prototype={getChild:function(){this._appendNewChildWhenNeeded.apply(this,arguments);return this.childList[this.index++]},clearChildren:function(){this.childList=[]},restart:function(){this.index=0},backspace:function(){if(this.index>0){this.index--}},_addChild:function(a){this.childList.push(a)},_appendNewChildWhenNeeded:function(){if(this.index>=this.childList.length){var a=this._createChild.apply(this,arguments);this._addChild(a)}},_createChild:function(){var str="new "+this.childType+"(";var len=arguments.length;if(len>0){len--;for(var i=0;i<len;i++){str+="arguments["+i+"],"}str+="arguments["+len+"]"}str+=")";return eval(str)}};Chart.Common.Coordinate=function(){};Chart.Common.Coordinate.CartesianMappingType={Log:0,Linear:1};Chart.Common.Coordinate.ScatterValueMapping=function(){this._coordinateRange={first:0,second:0};this._borderList=[];this._scatterValueCount=0;this._unitWidth=0};Chart.Common.Coordinate.ScatterValueMapping.prototype={getCoordinateRange:function(){return this._coordinateRange},getScatterValueCount:function(){return this._scatterValueCount},getCoordinate:function(a){if(this._scatterValueCount>0&&this._borderList.length>this._scatterValueCount){if(a>-1&&a<this._scatterValueCount){return this._borderList[a]}return 0}else{return 0}},getValueIndex:function(a){if(this._scatterValueCount>0&&this._borderList.length>this._scatterValueCount){var b=-1;while(a>this._borderList[b+1]&&b<this._borderList.length-1){b++}return b}else{return -1}},getUnitWidth:function(){return this._unitWidth},setCoordinateRange:function(a){if(a){this._coordinateRange=a;this._parseBorder()}},setScatterValueCount:function(a){if(!isNaN(a)){this._scatterValueCount=a;this._parseBorder()}},_parseBorder:function(){this._borderList=[];this._borderList.push(this._coordinateRange.first);this._unitWidth=this._coordinateRange.second-this._coordinateRange.first;if(this._scatterValueCount>1){var a=this._coordinateRange.first;this._unitWidth=this._unitWidth/this._scatterValueCount;for(var b=1;b<this._scatterValueCount;b++){a+=this._unitWidth;this._borderList.push(a)}}this._borderList.push(this._coordinateRange.second)}};Chart.Common.Coordinate.Date2DoubleLinearMapping=function(){this._coordinateRange={first:0,second:0};this._valueRange={first:Chart.Common.Util.DateUtil.BASE_DATE(),second:Chart.Common.Util.DateUtil.BASE_DATE()};this._unitSpaceEveryDay=0;this._unitTimeEveryPt=0;var a=this;this.preCalculate=function(){var b=a._valueRange.first.dateDiff(Chart.Common.Util.DataFrequency.Daily,a._valueRange.second);var c=a._coordinateRange.second-a._coordinateRange.first;if(b==0||c==0){a._unitSpaceEveryDay=0;a._unitTimeEveryPt=0}else{a._unitSpaceEveryDay=c/b;a._unitTimeEveryPt=b/c}}};Chart.Common.Coordinate.Date2DoubleLinearMapping.prototype.getCoordinateRange=function(){return this._coordinateRange};Chart.Common.Coordinate.Date2DoubleLinearMapping.prototype.getValueRange=function(){return this._valueRange};Chart.Common.Coordinate.Date2DoubleLinearMapping.prototype.setCoordinateRange=function(a){if(a){this._coordinateRange.first=a.first;this._coordinateRange.second=a.second;this.preCalculate();return true}return false};Chart.Common.Coordinate.Date2DoubleLinearMapping.prototype.setValueRange=function(a){if(a){this._valueRange.first=new Date(a.first.getFullYear(),a.first.getMonth(),a.first.getDate());this._valueRange.second=new Date(a.second.getFullYear(),a.second.getMonth(),a.second.getDate());this.preCalculate();return true}return false};Chart.Common.Coordinate.Date2DoubleLinearMapping.prototype.getCoordinate=function(a){if(this._valueRange.first.dateDiff("d",this._valueRange.second)!=0){return this._coordinateRange.first+this._valueRange.first.dateDiff("d",a)*this._unitSpaceEveryDay}else{return 0}};Chart.Common.Coordinate.Date2DoubleLinearMapping.prototype.getDate=function(a){if(this._coordinateRange.second-this._coordinateRange.first!=0){return this._valueRange.first.dateAdd("d",Math.floor((a-this._coordinateRange.first)*this._unitTimeEveryPt+0.5))}else{return Chart.Common.Util.DateUtil.BASE_DATE()}};Chart.Common.Coordinate.Double2DoubleMapping=function(){var a={first:0,second:0};var b={first:0,second:0};this._coordinateRange=a;this._valueRange=b};Chart.Common.Coordinate.Double2DoubleMapping.prototype.getCoordinateRange=function(){return this._coordinateRange};Chart.Common.Coordinate.Double2DoubleMapping.prototype.getValueRange=function(){return this._valueRange};Chart.Common.Coordinate.Double2DoubleMapping.prototype.setCoordinateRange=function(a){if(a){this._coordinateRange=a;this.preCalculate();return true}return false};Chart.Common.Coordinate.Double2DoubleMapping.prototype.setValueRange=function(a){if(a){this._valueRange=a;this.preCalculate();return true}return false};Chart.Common.Coordinate.Double2DoubleMapping.prototype.getCoordinate=function(a){return 0};Chart.Common.Coordinate.Double2DoubleMapping.prototype.getValue=function(a){return 0};Chart.Common.Coordinate.Double2DoubleLinearMapping=function(){this._unitSpaceEveryDay=0;this._unitValueEveryPt=0;var a=this;this.preCalculate=function(){var c=a._valueRange.second-a._valueRange.first;var b=a._coordinateRange.second-a._coordinateRange.first;if(c==0||b==0){a._unitSpaceEveryDay=0;a._unitValueEveryPt=0}else{a._unitSpaceEveryDay=b/c;a._unitValueEveryPt=c/b}}};Chart.Common.Coordinate.Double2DoubleLinearMapping.prototype=$.extend(new Chart.Common.Coordinate.Double2DoubleMapping(),{getCoordinate:function(a){if((this._valueRange.second-this._valueRange.first)!=0){return this._coordinateRange.first+(a-this._valueRange.first)*this._unitSpaceEveryDay}else{return 0}},getValue:function(a){if((this._coordinateRange.second-this._coordinateRange.first)!=0){return this._valueRange.first+(a-this._coordinateRange.first)*this._unitValueEveryPt}return 0}});Chart.Common.Coordinate.Double2DoubleLogMapping=function(){this._adjustOffset=0;var a=this;this.preCalculate=function(){if(a._valueRange.first<1){a._adjustOffset=1-a._valueRange.first}}};Chart.Common.Coordinate.Double2DoubleLogMapping.prototype=$.extend(new Chart.Common.Coordinate.Double2DoubleMapping(),{getCoordinate:function(a){if((this._valueRange.second-this._valueRange.first)!=0){return this._coordinateRange.first+(Math.log(a+this._adjustOffset)-Math.log(this._valueRange.first+this._adjustOffset))/(Math.log(this._valueRange.second+this._adjustOffset)-Math.log(this._valueRange.first+this._adjustOffset))*(this._coordinateRange.second-this._coordinateRange.first)}else{return 0}},getValue:function(a){if((this._coordinateRange.second-this._coordinateRange.first)!=0){return Math.pow(Math.E,Math.log(this._valueRange.first)+(a-this._coordinateRange.first)*(Math.log(this._valueRange.second)-Math.log(this._valueRange.first))/(this._coordinateRange.second-this._coordinateRange.first))}else{return 0}}});Chart.Common.Command=function(){};Chart.Common.Command.Commands={COMMAND_START:-1,UPDATE_SELECTION:0,RESIZE:1,INITIALIZE:2,COMPONENT_STATUS_UPDATE:3,REFRESH_PRESENTATION:4,UPDATE_TIME_RANGE:5,ADD_INVESTMENT:6,DELETE_ITEM:7,DELETE_INVESTMENT:8,ITEM_STATUS_UPDATE:9,APPLY_CHART_SETTING:10,GET_CHART_SETTING:11,SET_CULTURE:12,UPDATE_PERIOD:13,COMMAND_END:999};Chart.Common.Command.ComponentStatus={BeginRequest:1,EndRequest:2,ClearAll:3,ClearData:4};Chart.Common.Command.CommandDirection={ToRoot:1,ToLeaf:2};Chart.Common.Command.CommandArgs=function(a,c,d,b){this.sender=a;this.command=c;this.data=d;this.direction=Chart.Common.Command.CommandDirection.ToLeaf;if(b){this.direction=b}this.handled=false};Chart.Common.Command.CommandHandler=function(){this.parentContainer=null;this.interactiveChildren=[];this.addChild=function(a){a.parentContainer=this;this.interactiveChildren.push(a)}};Chart.Common.Command.CommandHandler.prototype.executeCommand=function(a){if(a==null||a.handled){return}var c=a.direction;if(a.sender!=this){if(this.getHandler!=null&&typeof(this.getHandler)=="function"){var b=this.getHandler(a);if(b){b.apply(this,new Array(a));a.direction=Chart.Common.Command.CommandDirection.ToLeaf;$(this.interactiveChildren).each(function(){if(this.executeCommand){this.executeCommand(a)}})}}}a.direction=c;if(a.direction==Chart.Common.Command.CommandDirection.ToRoot&&this.parentContainer){a.sender=this;this.parentContainer.executeCommand(a)}};Chart.Common.Command.CommandHandler.prototype.collectionChildren=function(){this.interactiveChildren=[]};Chart.Common.Command.Args=function(){};Chart.Common.Command.Args.AddInvestmentArgs=function(a){this.investmentId=a;this.index=-1};Chart.Common.Command.Args.ChartSettingArgs=function(a){this.setting=a};Chart.Common.Command.Args.UpdateSelectionArgs=function(b,a){this.startIndex=b;this.endIndex=a};Chart.Common.Command.Args.ItemStatusUpdateArgs=function(c,a,b){this.investmentId=startIndex;this.itemKey=a;this.status=b};Chart.Common.Data=function(){};Chart.Common.Data.IChartBusinessManager=function(){};Chart.Common.Data.IChartBusinessManager.prototype={getInvestmentName:function(a){},getInvestmentSetting:function(a){}};Chart.Common.Data.ListWrapper=function(a){this.data=[];if(a){this.data=a}};Chart.Common.Data.TimeSeriesDatum=function(b,a){this.dateIndex=b;this.value=Number.NaN;if(a){this.value=a}};Chart.Common.Data.TimeSeriesDatum.prototype.dateValue=function(){return Chart.Common.Util.DateUtil.getDateFromIndex(this.dateIndex)};Chart.Common.Data.Item=function(){};Chart.Common.Data.ItemStatus={Initialized:0,Requesting:1,DataResponseOK:2,DataResponseEmpty:3,DataResponseFailed:4,DataCalculatedOK:5,DataCalculatedEmpty:6,DataCalculatedFailed:7,DataDeferred:99};Chart.Common.Data.ItemKey=function(){this.investmentId="";this.dataId="";this.secId="";this.cfId="";this.ticker="";this.mpId=""};Chart.Common.Data.ItemKey.prototype.toString=function(){return $.toJSON(this)};Chart.Common.Data.GroupDataRecord=function(a){this.dataKey=a;this.groupData=null;this.minValue=0;this.maxValue=0};Chart.Common.Data.GroupDataRecord.prototype={parseBorderValue:function(){if(this.groupData==null||this.groupData.count<1){this.maxValue=0;this.minValue=0;return}this.maxValue=-Number.MAX_VALUE;this.minValue=Number.MAX_VALUE;var c=this.groupData.values();for(var b=0,a=this.groupData.count;b<a;b++){if(isNaN(c[b])){return}if(c[b]>this.maxValue){this.maxValue=c[b]}if(c[b]<this.minValue){this.minValue=c[b]}}}};Chart.Common.Data.TimeSeries=function(){};Chart.Common.Data.TimeSeries.TimeSeriesDataRecord=function(a){this.dataKey=a;this.tsData=null;this.minValue=0;this.maxValue=0;this.earliestDateIndex=0;this.lastestDateIndex=0};Chart.Common.Data.TimeSeries.TimeSeriesDataRecord.prototype={parseBorderValue:function(){if(this.tsData==null||this.tsData.data.length<1){this.maxValue=0;this.minValue=0;this.earliestDateIndex=0;this.lastestDateIndex=0;return}this.maxValue=-Number.MAX_VALUE;this.minValue=Number.MAX_VALUE;var c=null;for(var b=0,a=this.tsData.data.length;b<a;b++){c=this.tsData.data[b];if(isNaN(c.value)){return}if(c.value>this.maxValue){this.maxValue=c.value}if(c.value<this.minValue){this.minValue=c.value}}this.earliestDateIndex=this.tsData.data[0].dateIndex;this.lastestDateIndex=this.tsData.data[this.tsData.data.length-1].dateIndex}};Chart.Common.Data.TimeSeries.TSDataSlicer=function(){};Chart.Common.Data.TimeSeries.TSDataSlicer.isPeriodEnd=function(a){switch(a.frequency){case Chart.Common.Util.DataFrequency.Weekly:return function(c,b,d){return(b.dateDiff("d",c)>7)};case Chart.Common.Util.DataFrequency.Monthly:return function(c,b,d){return((d.getFullYear()!=c.getFullYear())||(d.getMonth()!=c.getMonth()))&&(c.getMonth()+1)%a.count==0};case Chart.Common.Util.DataFrequency.Quarterly:return function(c,b,d){return((d.getFullYear()!=c.getFullYear())||(d.getMonth()>c.getMonth()))&&(c.getMonth()+1)%(a.count*3)==0};case Chart.Common.Util.DataFrequency.Semiannually:return function(c,b,d){return((d.getFullYear()!=c.getFullYear())||(d.getMonth()>c.getMonth()))&&(c.getMonth()+1)%(a.count*6)==0};case Chart.Common.Util.DataFrequency.Annually:return function(c,b,d){return d.getFullYear()>c.getFullYear()&&c.getFullYear()%a.count==0};case Chart.Common.Util.DataFrequency.Daily:return function(){return true}}};Chart.Common.Data.TimeSeries.TSDataSlicer.isPeriodStart=function(c,b,a){switch(a.frequency){case Chart.Common.Util.DataFrequency.Daily:return true;case Chart.Common.Util.DataFrequency.Weekly:return(b.dateDiff("d",c)>7);case Chart.Common.Util.DataFrequency.Monthly:return((b.getFullYear()!=c.getFullYear())||(c.getMonth()>b.getMonth()))&&(c.getMonth()+1)%a.count==0;case Chart.Common.Util.DataFrequency.Quarterly:return((b.getFullYear()!=c.getFullYear())||(c.getMonth()>b.getMonth()))&&(c.getMonth()+1)%(a.count*3)==0;case Chart.Common.Util.DataFrequency.Semiannually:return((b.getFullYear()!=c.getFullYear())||(c.getMonth()>b.getMonth()))&&(c.getMonth()+1)%(a.count*6)==0;case Chart.Common.Util.DataFrequency.Annually:return c.getFullYear()>b.getFullYear()&&c.getFullYear()%a.count==0;default:return true}};Chart.Common.Data.TimeSeries.TSDataSlicer.getFrequencyRatio=function(a){switch(a.frequency){case Chart.Common.Util.DataFrequency.Daily:return a.count;case Chart.Common.Util.DataFrequency.Weekly:return a.count*7;case Chart.Common.Util.DataFrequency.Monthly:return a.count*30;case Chart.Common.Util.DataFrequency.Quarterly:return a.count*90;case Chart.Common.Util.DataFrequency.Semiannually:return a.count*180;case Chart.Common.Util.DataFrequency.Annually:return a.count*365}return 0};Chart.Common.Data.TimeSeries.TSDataSlicer.getSliceFrequency=function(a,d,c){if(!c){c=0}var b=d/a;b=Math.max(c,b);if(b<=1){return new Chart.Common.Util.DataFrequencyEx(Chart.Common.Util.DataFrequency.Daily,1)}else{if(b<=7){return new Chart.Common.Util.DataFrequencyEx(Chart.Common.Util.DataFrequency.Weekly,1)}else{if(b<30){return new Chart.Common.Util.DataFrequencyEx(Chart.Common.Util.DataFrequency.Monthly,1)}else{if(b<90){return new Chart.Common.Util.DataFrequencyEx(Chart.Common.Util.DataFrequency.Quarterly,1)}else{if(b<180){return new Chart.Common.Util.DataFrequencyEx(Chart.Common.Util.DataFrequency.Semiannually,1)}else{if(b<365){return new Chart.Common.Util.DataFrequencyEx(Chart.Common.Util.DataFrequency.Annually,1)}else{if(b<730){return new Chart.Common.Util.DataFrequencyEx(Chart.Common.Util.DataFrequency.Annually,2)}else{if(b<1825){return new Chart.Common.Util.DataFrequencyEx(Chart.Common.Util.DataFrequency.Annually,5)}else{return new Chart.Common.Util.DataFrequencyEx(Chart.Common.Util.DataFrequency.Annually,10)}}}}}}}}};Chart.Common.Data.TimeSeries.TSDataSlicer.sliceDataByFreqency=function(n,r,f,v,o){function q(){if(n.data[0].dateIndex>=f){return 0}if(n.data[l-1].dateIndex<=f){return -1}var d=0;var i=l-1;while(i-d>=2){var x=d+Math.floor((i-d)/2);if(n.data[x].dateIndex<f){d=x}else{i=x}}if(n.data[d].dateIndex==f){return d}else{return i}}function c(){if(n.data[l-1].dateIndex<=v){return l-1}if(n.data[0].dateIndex>=v){return -1}var d=0;var i=l-1;var x=0;var y=0;while(i-d>=2){y=d+Math.floor((i-d)/2);x=n.data[y].dateIndex;if(x==v){return y}if(x<v){d=y}else{i=y}}if(n.data[i].dateIndex==v){return i}else{return d}}function e(d,i){var x=i.dateAdd(r.frequency,r.count);return d+i.dateDiff("d",x)}var p=+new Date();var w=new Chart.Common.Data.ListWrapper([]);var l=n.data.length;var h=q();var k=c();if(h<0||k<=h){return w}if(o){w.data.push(n.data[h]);var m=n.data[h].dateValue();var u=Chart.Common.Util.DateUtil.getPeriodEnd(m,r.frequency);var a=m.dateDiff("d",u)+h;var b=null;if(u==m){a=e(a,u)}while(a<=k){b=n.data[a];u=Chart.Common.Util.DateUtil.getDateFromIndex(b.dateIndex+1);a=e(a,u);w.data.push(b)}w.data.push(n.data[k])}else{var g=new Date(1900,0,1);var t=n.data[h];if(t.dateIndex>=f&&t.dateIndex<=v){w.data.push(t);g=t.dateValue()}for(var j=h+1;j<=k;j++){var s=n.data[j];var a=s.dateIndex;var u=s.dateValue();if(a<f){continue}if(a>v){break}if(Chart.Common.Data.TimeSeries.TSDataSlicer.isPeriodStart(u,g,r)){w.data.push(s);g=u}}}ChartLogger.instance.write(String.format("[time-consuming] time consuming of slice data from {0} to {1}: {2}, freq: {3}",f,v,(+new Date()-p),r));return w};Chart.Common.Data.TimeSeries.TSDataSlicer.sliceDataByFreqencyDaily=function(e,i,d,a){var j=function(k,l){var m=l.dateAdd("d",1).dateAdd(i.frequency,i.count);return k+l.dateDiff("d",m)-1};var b=[];var f=e.data[d].dateValue();var g=Chart.Common.Util.DateUtil.getPeriodEnd(f,i.frequency);var h=f.dateDiff("d",g)+d;var c=null;while(h<=a){c=e.data[h];g=c.dateValue();h=j(h,g);b.push(c)}return b};Chart.Common.Data.TimeSeries.TSDataSlicer.getSingleCurrentData=function(h,i,f,c,b,g){if(!g){g=new Chart.Common.Util.DataFrequencyEx(Chart.Common.Util.DataFrequency.Daily,1)}if(h.tsData==null){return null}var d=Chart.Common.Data.TimeSeries.TSDataSlicer.getSliceFrequency(i,c-f,Chart.Common.Data.TimeSeries.TSDataSlicer.getFrequencyRatio(g)-1);var e=Chart.Common.Data.TimeSeries.TSDataSlicer.sliceDataByFreqency(h.tsData,d,f,c,b);var a=new Chart.Common.Data.TimeSeries.TimeSeriesDataRecord(h.dataKey);a.tsData=e;a.parseBorderValue();return a};Chart.Common.Data.TimeSeries.TSDataSlicer.getAllCurrentData=function(c,b,e,f,d,a){if(!a){a=new Chart.Common.Util.DataFrequencyEx(Chart.Common.Util.DataFrequency.Daily,1)}if(c==null||c.length<1){return null}var g=new Array();$(c).each(function(){var h=Chart.Common.Data.TimeSeries.TSDataSlicer.getSingleCurrentData(this,b,e,f,d,a);if(h!=null){g.push(h)}});return g};Chart.Common.Data.TimeSeries.TSUtil=function(){};Chart.Common.Data.TimeSeries.TSUtil.increaseMonth=function(a,b){return new Date(a.getFullYear(),a.getMonth(),1).dateAdd("m",b)};Chart.Common.Data.TimeSeries.TSUtil.increaseYear=function(b,a){return new Date(b.getFullYear(),0,1).dateAdd("a",a)};Chart.Common.Data.TimeSeries.TSUtil.getNextPeriodEnd=function(b,a){switch(a.frequency){case Chart.Common.Util.DataFrequency.Daily:return b.dateAdd("d",-a.count+1).dateAdd("d",-1);case Chart.Common.Util.DataFrequency.Weekly:return b.dateAdd("d",-a.count*7+1).dateAdd("d",-1);case Chart.Common.Util.DataFrequency.Monthly:return Chart.Common.Data.TimeSeries.TSUtil.increaseMonth(b,-a.count+1).dateAdd("d",-1);case Chart.Common.Util.DataFrequency.Quarterly:return Chart.Common.Data.TimeSeries.TSUtil.increaseMonth(b,-a.count*3+1).dateAdd("d",-1);case Chart.Common.Util.DataFrequency.Semiannually:return Chart.Common.Data.TimeSeries.TSUtil.increaseMonth(b,-a.count*6+1).dateAdd("d",-1);case Chart.Common.Util.DataFrequency.Annually:return Chart.Common.Data.TimeSeries.TSUtil.increaseYear(b,-a.count+1).dateAdd("d",-1);default:throw new Exception()}};Chart.Common.Data.TimeSeries.TSUtil.createDateTimeMarks=function(c,e,a){var b=new Array();var d=e;while(d>c){b.push(d);d=Chart.Common.Data.TimeSeries.TSUtil.getNextPeriodEnd(d,a)}if(b.length>0){b.push(c);b.reverse()}return b};Chart.Common.Controls=function(){};Chart.Common.Controls.Panel=function(b){var a='<div class="chart-panel"><div class="container"><div class="ctn"></div></div><div class="shadow"></div></div>';this.jqDOM=$(a);this.ctn=null;this.shadow=null;this._init(b);return this};Chart.Common.Controls.Panel.prototype={_init:function(b){var a=this;this.ctn=this.jqDOM.find(".ctn");this.shadow=this.jqDOM.find(".shadow");this.jqDOM.appendTo(b?b:jQuery("body",document))},setContent:function(a){this.ctn.append(a)},setTitle:function(a){this.title.html(a)},setBackGround:function(a){this.shadow.addClass(a)},setPosition:function(a){this.jqDOM.css({left:a.x,top:a.y})},getSize:function(){var a=$.getMargins(this.jqDOM.get(0),true);return{width:this.jqDOM.width()+a.l+a.r,height:this.jqDOM.height()+a.t+a.b}},show:function(){this.jqDOM.find(".shadow").css({height:this.jqDOM.height()});this.jqDOM.show()},hide:function(){this.jqDOM.removeCSS("width,height");this.jqDOM.hide()},del:function(){this.jqDOM.remove()}};Chart.Common.Controls.TipStatus={Hide:0,Show:1,Fixed:2};Chart.Common.Controls.TipDirection={TopLeft:0,TopRight:1,BottomLeft:2,BottomRight:3};Chart.Common.Controls.ITooltip=function(){this.container=null;this.activeRegion={x:0,y:0,width:0,height:0};this.dialogSize={width:0,height:0};this.status=Chart.Common.Controls.TipStatus.Hide;this.direction=Chart.Common.Controls.TipDirection.TopLeft;this.panel=null;this.offset=1;return this};Chart.Common.Controls.ITooltip.prototype={popupAt:function(a){},hide:function(){},setContent:function(a){},setActiveRegion:function(a){this.activeRegion=a;this.panel.jqDOM.dragOption({rect:this.activeRegion})},_initialize:function(){this.panel=new Chart.Common.Controls.Panel(this.container);this.panel.hide();this._initializeEx()},_initializeEx:function(){},_moveTo:function(a){this.panel.setPosition(a)},_resize:function(){this.panel.jqDOM.removeCSS("width,height");this.panel.show();var a=this.panel.getSize();a.width=a.width>this.minWidth?a.width:this.minWidth;this.panel.hide();this.panel.jqDOM.css({width:a.width,height:a.height});this.dialogSize.width=a.width;this.dialogSize.height=a.height},_setTipDirection:function(a){if(this.activeRegion.width>a.x+this.dialogSize.width*0.5){if(a.y>this.dialogSize.height){this.direction=Chart.Common.Controls.TipDirection.TopRight}else{this.direction=Chart.Common.Controls.TipDirection.BottomRight}}else{if(a.y>this.dialogSize.height){this.direction=Chart.Common.Controls.TipDirection.TopLeft}else{this.direction=Chart.Common.Controls.TipDirection.BottomLeft}}},_setTipDirection2:function(c){var b=this.activeRegion.x+this.activeRegion.width/2;var a=this.activeRegion.y+this.activeRegion.height/2;if(c.y<a){if(c.x<b){this.direction=Chart.Common.Controls.TipDirection.BottomRight}else{this.direction=Chart.Common.Controls.TipDirection.BottomLeft}}else{if(c.x<b){this.direction=Chart.Common.Controls.TipDirection.TopRight}else{this.direction=Chart.Common.Controls.TipDirection.TopLeft}}},_adjustTipPlace:function(a){this._setTipDirection(a);switch(this.direction){case Chart.Common.Controls.TipDirection.TopLeft:this._moveTo({x:a.x-this.dialogSize.width-this.offset,y:a.y-this.dialogSize.height-this.offset});break;case Chart.Common.Controls.TipDirection.TopRight:this._moveTo({x:Math.min(a.x+this.offset,this.activeRegion.width-this.dialogSize.width),y:a.y-this.dialogSize.height-this.offset});break;case Chart.Common.Controls.TipDirection.BottomLeft:this._moveTo({x:a.x-this.dialogSize.width-this.offset,y:a.y+this.offset});break;default:this._moveTo({x:Math.min(a.x+this.offset,this.activeRegion.width-this.dialogSize.width),y:a.y+this.offset});break}}};Chart.Common.Controls.BasicTip=function(a){this.minWidth=50;this.container=a;this._initialize();return this};Chart.Common.Controls.BasicTip.prototype=$.extend(new Chart.Common.Controls.ITooltip(),{popupAt:function(a){this._adjustTipPlace(a);this._setStatus(Chart.Common.Controls.TipStatus.Show)},hide:function(){this._setStatus(Chart.Common.Controls.TipStatus.Hide)},setContent:function(b){var a="";$(b).each(function(){a+="<h5>"+this+"</h5>"});this.panel.msg.html(a);this._resize()},_setStatus:function(a){switch(a){case Chart.Common.Controls.TipStatus.Fixed:case Chart.Common.Controls.TipStatus.Show:this.panel.show();this.status=Chart.Common.Controls.TipStatus.Show;break;case Chart.Common.Controls.TipStatus.Hide:default:this.panel.hide();this.status=Chart.Common.Controls.TipStatus.Hide;break}},_initializeEx:function(){this.panel.setContent($("<div>Message</div>").addClass("msg"));this.panel.msg=this.panel.ctn.find(".msg");this.panel.jqDOM.addClass("basic-tip").css({cursor:"default"}).drag({isInDragArea:function(a){return false}})}});Chart.Common.Controls.GraphRectTip=function(a){this.minWidth=50;this.container=a;this._initialize();return this};Chart.Common.Controls.GraphRectTip.prototype=$.extend(new Chart.Common.Controls.ITooltip(),{popupAt:function(a){this._adjustTipPlace(a);this._setStatus(Chart.Common.Controls.TipStatus.Show)},hide:function(){this._setStatus(Chart.Common.Controls.TipStatus.Hide)},setContent:function(b){var a="";$(b).each(function(){a+="<h5>"+this+"</h5>"});this.panel.msg.html(a);this._resize()},setTitle:function(a){this.panel.titleMsg.html(a);this._resize()},_setStatus:function(a){switch(a){case Chart.Common.Controls.TipStatus.Fixed:this.panel.show();this.status=Chart.Common.Controls.TipStatus.Fixed;break;case Chart.Common.Controls.TipStatus.Show:this.panel.show();this.status=Chart.Common.Controls.TipStatus.Show;break;case Chart.Common.Controls.TipStatus.Hide:default:this.panel.hide();this.status=Chart.Common.Controls.TipStatus.Hide;break}},_initializeEx:function(){this.panel.setContent($("<div><h5>Title</h5></div>").addClass("title"));this.panel.setContent($("<div>Message</div>").addClass("msg"));this.panel.titleMsg=this.panel.ctn.find(".title h5");this.panel.msg=this.panel.ctn.find(".msg");this.panel.jqDOM.addClass("rect-tip").css({cursor:"default"}).drag({rect:this.activeRegion})}});Chart.Common.Controls.BasicTipFactory=function(){var a="";if(arguments.length>0){a=arguments[0]}this.container=$("#phTip"+a);this.activeRegion={x:0,y:0,width:800,height:600};this.clearChildren();return this};Chart.Common.Controls.BasicTipFactory.prototype=$.extend(new Chart.Common.Util.ChildManagerTool("Chart.Common.Controls.BasicTip"),{create:function(){var a=this.getChild(this.container);a.activeRegion=this.activeRegion;return a},setActiveRegion:function(a){this.activeRegion.x=a.x;this.activeRegion.y=a.y;this.activeRegion.width=a.width;this.activeRegion.height=a.height}});Chart.Common.Controls.GraphRectTipFactory=function(){var a="";if(arguments.length>0){a=arguments[0]}this.container=$("#phTip"+a);this.activeRegion={x:0,y:0,width:800,height:600};this.clearChildren();return this};Chart.Common.Controls.GraphRectTipFactory.prototype=$.extend(new Chart.Common.Util.ChildManagerTool("Chart.Common.Controls.GraphRectTip"),{create:function(){var a=this.getChild(this.container);a.setActiveRegion(this.activeRegion);return a},setActiveRegion:function(a){this.activeRegion.x=a.x;this.activeRegion.y=a.y;this.activeRegion.width=a.width;this.activeRegion.height=a.height}});var Globalization=function(){};Globalization.DateFormatType={Normal:0,Shorter:1};Globalization.ShortFormatType={NONE:-1,SHORT_FORMAT_KILO:0,SHORT_FORMAT_MEGA:1,SHORT_FORMAT_BIL:2};var LocalizationManager=function(){var w="root";var y="label.xml";var t=null;var m=null;var k="en_us";var o="../../xml/";var n=y;var s=[];var v="MM-dd-yyyy";var x="MM-yyyy";var h="yyyy";var p="MM-dd-yy";var a="MM-yy";var g="yy";var f="";var d=3;var i=",";var l=".";var c=this;this.initialize=function(A,z){o=A;n=z};this.setCurrentCulture=function(B,A){var z=/<[^>]+>/g;s.push(A);if(z.test(B)){b(q($(B)))}else{k=B;r()}};this.getCurrentCulture=function(){return k};this.getLabel=function(z,A){z=z.toLowerCase();if(t!=null&&t.containsKey(z)){var B=t.item(z);if(B){return B}}return A};this.getDateFormat=function(z,A){var B=h;switch(z){case Chart.Common.Util.DataFrequency.Annually:case Chart.Common.Util.DataFrequency.Irregular:case Chart.Common.Util.DataFrequency.None:B=A==Globalization.DateFormatType.Normal?h:g;break;case Chart.Common.Util.DataFrequency.Semiannually:case Chart.Common.Util.DataFrequency.Quarterly:case Chart.Common.Util.DataFrequency.Monthly:B=A==Globalization.DateFormatType.Normal?x:a;break;case Chart.Common.Util.DataFrequency.Weekly:case Chart.Common.Util.DataFrequency.Daily:B=A==Globalization.DateFormatType.Normal?v:p;break;default:break}return B};this.getDailyDateString=function(z){return this.formatDate(z,this.getDateFormat(Chart.Common.Util.DataFrequency.Daily,Globalization.DateFormatType.Normal))};this.formatDate=function(C,A){var B=A.toLowerCase();var z=C.getFullYear().toString();B=B.replace(/yyyy/g,z);B=B.replace(/yy/g,z.substr(z.length-2));B=B.replace(/mmmm/g,this.getLabel("month"+C.getMonth().toString(),C.getMonth().toString()));B=B.replace(/mmm/g,this.getLabel("abmonth"+C.getMonth().toString(),C.getMonth().toString()));B=B.replace(/mm/g,e(C.getMonth()+1));B=B.replace(/m/g,(C.getMonth()+1).toString());B=B.replace(/dd/g,e(C.getDate()));B=B.replace(/d/g,C.getDate().toString());return B};this.formatDecimal=function(z,A){if($.isNull(A)||A<0){A=-1}return u(z,A)};this.removeTrailingZero=function(z){while(z.indexOf(l)>=0&&(z.lastIndexOf("0")==z.length-1||z.lastIndexOf(l)==z.length-1)){z=z.substr(0,z.length-1)}return z};this.downloadFile=function(z,C){if(!C||typeof(C)!="function"){return}if(z==null||z==""||z.length<=1){C(false,null)}if(k==""){j(z,C);return}var B=z.lastIndexOf(".");if(B<0){j(z,C);return}var A=z.substr(0,B)+"_"+k+z.substr(B);$.ajax({type:"GET",url:A,success:function(D){C(true,D);ChartLogger.instance.write("[download-resource] success to download resource: "+A)},error:function(D){ChartLogger.instance.write("[download-resource] failed to download resource: "+A);j(z,C);return}})};function e(A,E,z){if(z==null){z=2}if(E==null||E){var B=A.toString();if(B.length<z){var D=z-B.length;for(var C=0;C<D;C++){B="0"+B}}return B}if(!E){return A}}function u(D,E){var A="";if(E!=-1){var z=Math.pow(10,E);D=Math.round(D*z)/z}if(D<0){A="-"}var H=Math.abs(D).toString();var B=H.indexOf(".");if(B==-1){H+=l;B=H.length-1}var G=H.substr(0,B);if(d>0){var F=G.length;while(F>d){G=G.substr(0,F-d)+i+G.substr(F-d,G.length-F+d);F-=d}}var C=H.substr(B+1);if(E!=-1){while(C.length<E){C+="0"}C=C.substr(0,E)}if(C!=""){return A+G+l+C}return A+G}function r(){var z=o+n+"?date="+(+new Date()).toString();c.downloadFile(z,function(A,B){try{if(!A||!B){b(false);ChartLogger.instance.write("[localization] failed to parse localization cfg file");return}b(q($(B)));ChartLogger.instance.write("[localization] success to parse localization cfg file")}catch(C){b(false);ChartLogger.instance.write("[localization] failed to parse localization cfg file")}});ChartLogger.instance.write("[download-resource] loading "+z)}function j(z,A){$.ajax({type:"GET",url:z,success:function(B){A(true,B);ChartLogger.instance.write("[download-resource] success to download resource: "+z)},error:function(B){A(false,null);ChartLogger.instance.write("[download-resource] failed to download resource: "+z)}})}function q(A){var B=null;B=A.find(w+" cy");if(B&&B.length>0){f=B.text()}B=A.find(w+" dateformatdaily");if(B&&B.length>0){v=B.text()}B=A.find(w+" dateformatmonthly");if(B&&B.length>0){x=B.text()}B=A.find(w+" dateformatannually");if(B&&B.length>0){h=B.text()}B=A.find(w+" sdateformatdaily");if(B&&B.length>0){p=B.text()}B=A.find(w+" sdateformatmonthly");if(B&&B.length>0){a=B.text()}B=A.find(w+" sdateformatannually");if(B&&B.length>0){g=B.text()}B=A.find(w+" decimal");if(B&&B.length>0){var z=parseInt(B.attr("cluster"));if(z!=NaN&&z>=0){d=z}}B=A.find(w+" groupsep");if(B&&B.length>0){i=B.text()}B=A.find(w+" decsep");if(B&&B.length>0){l=B.text()}B=A.find(w+" errmsg");if(!B||B.length<=0){return false}t=new Dictionary();B.children().each(function(){t.add(this.nodeName.toLowerCase(),$(this).text())});return true}function b(z){$(s).each(function(){this(z)});s=[]}};LocalizationManager.instance=new LocalizationManager();var StrFormatter=function(){};StrFormatter.formatDecimal=function(a,b){return LocalizationManager.instance.formatDecimal(a,b)};StrFormatter.formatNumber=function(a,c){var b=Globalization.ShortFormatType.NONE;if(a>999999999){b=ShortFormatType.SHORT_FORMAT_BIL}else{if(a>999999){b=ShortFormatType.SHORT_FORMAT_MEGA}else{if(a>999){b=ShortFormatType.SHORT_FORMAT_KILO}}}return StrFormatter.shortenNumber(a,b,c)};StrFormatter.shortenNumber=function(c,b,d){var a="";switch(b){case Globalization.ShortFormatType.SHORT_FORMAT_BIL:a=LocalizationManager.instance.removeTrailingZero(StrFormatter.formatDecimal(c/1000000000,d))+"B";break;case Globalization.ShortFormatType.SHORT_FORMAT_MEGA:a=LocalizationManager.instance.removeTrailingZero(StrFormatter.formatDecimal(c/1000000,d))+"M";break;case Globalization.ShortFormatType.SHORT_FORMAT_KILO:a=LocalizationManager.instance.removeTrailingZero(StrFormatter.formatDecimal(c/1000,d))+"K";break;default:a=LocalizationManager.instance.removeTrailingZero(StrFormatter.formatDecimal(c,d));break}return a};StrFormatter.getFormattedNumString=function(c,a,d,b){if(b){if(c>=0){return StrFormatter.getFormattedNumStringImpl(c,a,d)}else{return"-"+StrFormatter.getFormattedNumStringImpl(Math.abs(c),a,d)}}else{return LocalizationManager.instance.formatDecimal(c,d)}};StrFormatter.getFormattedNumStringImpl=function(b,a,c){if(!c){c=2}if(b<1000){return StrFormatter.shortenNumber(b,Globalization.ShortFormatType.NONE,c)}else{if(b>=1000&&b<1000000){return StrFormatter.shortenNumber(b,Globalization.ShortFormatType.SHORT_FORMAT_KILO,c)}else{if(b>=1000000&&b<1000000000){return StrFormatter.shortenNumber(b,Globalization.ShortFormatType.SHORT_FORMAT_MEGA,c)}else{return StrFormatter.shortenNumber(b,Globalization.ShortFormatType.SHORT_FORMAT_BIL,c)}}}};StrFormatter.getFormattedLabel=function(a,b){return LocalizationManager.instance.getLabel(a,b)};var ChartLogger=function(){var a=true;this.debugoutput=null;this.write=function(e){if(!a||!this.debugoutput){return}var f=new Date();var d=new Array();d.push(f.getFullYear());d.push(f.getMonth()+1);d.push(f.getDate());var c=new Array();c.push(f.getHours());c.push(f.getMinutes());c.push(f.getSeconds());c.push(f.getMilliseconds());var b=new Array();b.push(d.join("-")+" "+c.join(":"));b.push("HTML");b.push(e);b.push("\r\n");this.debugoutput(b.join("|"))};this.isEnable=function(){return a};this.enableLog=function(){a=true};this.disableLog=function(){a=false}};ChartLogger.instance=new ChartLogger();Chart.Common.Controls.IDragControl=function(){this.getContainer=function(){};this.isInDragArea=function(h){};this.dragTo=function(h){};var g=this;var a=false;var d={x:0,y:0};var c=function(h){var i=$.getPosition(g.getContainer,h);if(g.isInDragArea(i)){d.x=i.x;d.y=i.y;a=true;$("body").bind("selectstart",function(){return false})}};var b=function(h){a=false};var f=function(h){if(a){var i=$.getPosition(g.getContainer,h);i.x-=d.x;i.y-=d.y;g.dragTo(targetPoint)}};var e=function(){var h=$(g.getContainer());if(h&&h.length>0){h.mousemove();h.mouseup();h.mousedown()}};intializeEx()};$.extend({dragger:{cover:null,helper:null,draggerIndex:1,draggerOptions:new Dictionary()}});$.fn.extend({undrag:function(a){},dragOption:function(a){var b=parseInt(this.attr("draggerIndex"),10)||0;if(b&&$.dragger.draggerOptions.containsKey(b)){$.extend($.dragger.draggerOptions.item(b),a)}},drag:function(k){var c={rect:{x:0,y:0,width:0,height:0},isInDragArea:function(n){return true},onBeginDrag:function(n){},onEndDrag:function(n){},onDraging:function(n){},moveCopy:false};var d={x:0,y:0};var a=false;var b=null;var i=this;var f=$.dragger.draggerIndex;$.extend(c,k);$.dragger.draggerIndex++;$.dragger.draggerOptions.updateItem(f,c);var h=function(p){var q=$.getPosition(this,p);if(c.isInDragArea(q)==false){return}g();var o=$.getPosition(null,p);var n=$(document);b={object:this,ref:$(this),width:$(this).width(),height:$(this).height(),parentOffset:$(this).parent().offset()};a=true;d.x=q.x;d.y=q.y;$.dragger.helper.empty();if(c.moveCopy==false){$.dragger.helper.css({display:"block",width:b.width+2,height:b.height+2,left:o.x-q.x,top:o.y-q.y})}b.ref.clone(true).appendTo($.dragger.helper).css({left:0,top:0});n.bind("mousemove",l).bind("mouseup",e);document.onselectstart=function(){return false};if(c.onBeginDrag){c.onBeginDrag.apply(i,[p])}};var e=function(n){a=false;$.dragger.helper.empty();$.dragger.helper.css({display:"none"});var o=$.getPosition(b.ref.parent().get(0),n);o.x-=d.x;o.y-=d.y;o.x=c.rect.width>0&&(o.x+b.width)>c.rect.width?c.rect.width-b.width:o.x;o.y=c.rect.height>0&&(o.y+b.height)>c.rect.height?c.rect.height-b.height:o.y;o.x=o.x>c.rect.x?o.x:c.rect.x;o.y=o.y>c.rect.y?o.y:c.rect.y;b.ref.css({left:o.x,top:o.y});b=null;$(document).unbind("mousemove",l).unbind("mouseup",e);document.onselectstart=null;if(c.onEndDrag){c.onEndDrag.apply(i,[n])}};var l=function(n){if(a){var o=$.getPosition(null,n);if(c.moveCopy==true){var o=$.getPosition(b.ref.parent().get(0),n);o.x-=d.x;o.y-=d.y;o.x=c.rect.width>0&&(o.x+b.width)>c.rect.width?c.rect.width-b.width:o.x;o.y=c.rect.height>0&&(o.y+b.height)>c.rect.height?c.rect.height-b.height:o.y;o.x=o.x>c.rect.x?o.x:c.rect.x;o.y=o.y>c.rect.y?o.y:c.rect.y;b.ref.css({left:o.x,top:o.y})}else{o.x-=d.x;o.y-=d.y;o.x=c.rect.width>0&&(o.x+b.width-b.parentOffset.left)>c.rect.width?c.rect.width-b.width+b.parentOffset.left:o.x;o.y=c.rect.height>0&&(o.y+b.height-b.parentOffset.top)>c.rect.height?c.rect.height-b.height+b.parentOffset.top:o.y;o.x=o.x>c.rect.x+b.parentOffset.left?o.x:c.rect.x+b.parentOffset.left;o.y=o.y>c.rect.y+b.parentOffset.top?o.y:c.rect.y+b.parentOffset.top;$.dragger.helper.css({left:o.x,top:o.y})}if(c.onDraging){c.onDraging.apply(i,[n])}}};var m=function(){return false};var j=function(){if(!$.dragger.cover){$.dragger.cover=$('<div id="dragCover"></div>').appendTo(jQuery("body",document));$.dragger.cover.css({position:"absolute",display:"none",overflow:"hidden","margin-left":0,"margin-top":0,"margin-bottom":0,"margin-rigth":0})}};var g=function(){if(!$.dragger.helper){$.dragger.helper=$('<div id="dragHelper"></div>').appendTo(jQuery("body",document));$.dragger.helper.addClass("drag-panel");$.dragger.helper.css({position:"absolute",display:"none",cursor:"move",listStyle:"none",overflow:"hidden","margin-left":0,"margin-top":0,"margin-bottom":0,"margin-rigth":0});$.dragger.helper.onselectstart=function(){return false};$.dragger.helper.ondragstart=function(){return false};if(window.ActiveXObject){$.dragger.helper.each(function(){this.unselectable="on"})}else{$.dragger.helper.css({"-moz-user-select":"none","user-select":"none","-khtml-user-select":"none"})}}};this.each(function(){if(window.ActiveXObject){this.onselectstart=function(){return false};this.ondragstart=function(){return false}}var n=this;var o=c.handle?$(this).find(c.handle):$(this);if($.browser.msie){o.each(function(){this.unselectable="on"})}else{o.css({"-moz-user-select":"none","user-select":"none","-khtml-user-select":"none"})}o.bind("mousedown",h);o.attr("draggerIndex",f)});return f}});Chart.Setting=function(){};Chart.Setting.SettingItem={Chart:"chart",ToolTip:"tooltip"};Chart.Setting.Presentation=function(){};Chart.Setting.Presentation.BG=function(){};Chart.Setting.Presentation.BG.deSerialize=function(f,b){if(!f||!f.presentation||!f.presentation.background||f.presentation.background.length<=0){return false}var a=f.presentation.background.length,e=null;for(var d=0;d<a;d++){e=f.presentation.background[d];if(e.type&&e.type==b){var c={};c.color=$.color.parse(e.color).toString();return c}}return null};Chart.Setting.Presentation.BG.tryDeSerialize=function(f,b,c){if(!f||!f.presentation||!f.presentation.background||f.presentation.background.length<=0){return false}var a=f.presentation.background.length,e=null;for(var d=0;d<a;d++){e=f.presentation.background[d];if(e.type&&e.type==b){c.color=$.color.parse(e.color).toString();return true}}return false};Chart.Setting.Presentation.BG.serialize=function(f,b,d){if(f){if(!f.presentation){f.presentation={}}if(!f.presentation.background){f.presentation.background=[]}var a=f.presentation.background.length,c=null,g=null;for(var e=0;e<a;e++){c=f.presentation.background[e];if(c.type&&c.type==b){g=c;break}}if(!g){g={};f.presentation.background.push(g)}g.type=b;g.color=$.color.parse(d.color).toString()}};Chart.Setting.Presentation.Coordinate=function(){};Chart.Setting.Presentation.Coordinate.deSerializeXAxisSuffix=function(a){if(!a||!a.presentation||!a.presentation.coordinate||typeof(a.presentation.coordinate.xsuffix)=="undefined"){return null}return a.presentation.coordinate.xsuffix};Chart.Setting.Presentation.Coordinate.deSerializeYAxisSuffix=function(a){if(!a||!a.presentation||!a.presentation.coordinate||typeof(a.presentation.coordinate.ysuffix)=="undefined"){return null}return a.presentation.coordinate.ysuffix};Chart.Setting.Presentation.Coordinate.tryDeSerializeShowXLine=function(b,a){if(!b||!b.presentation||!b.presentation.coordinate||typeof(b.presentation.coordinate.showxline)=="undefined"){return false}};Chart.Setting.Presentation.Coordinate.tryDeSerializeShowYLine=function(a,b){if(!a||!a.presentation||!a.presentation.coordinate||typeof(a.presentation.coordinate.showyline)=="undefined"){return false}};Chart.Setting.Presentation.Coordinate.serializeShowXLine=function(b,a){if(b){if(!b.presentation){b.presentation={}}if(!b.presentation.coordinate){b.presentation.coordinate={}}b.presentation.coordinate.showxline=a}};Chart.Setting.Presentation.Coordinate.serializeShowYLine=function(a,b){if(a){if(!a.presentation){a.presentation={}}if(!a.presentation.coordinate){a.presentation.coordinate={}}a.presentation.coordinate.showyline=b}};Chart.Setting.Presentation.Coordinate.serializeXAxisSuffix=function(b,a){if(b){if(!b.presentation){b.presentation={}}if(!b.presentation.coordinate){b.presentation.coordinate={}}b.presentation.coordinate.xsuffix=a}};Chart.Setting.Presentation.Coordinate.serializeYAxisSuffix=function(b,a){if(b){if(!b.presentation){b.presentation={}}if(!b.presentation.coordinate){b.presentation.coordinate={}}b.presentation.coordinate.ysuffix=a}};Chart.Setting.Presentation.NumSetting=function(){this.unit="";this.decimalCount=2;this.shortened=false};Chart.Setting.Presentation.NumSetting.tryDeSerialize=function(e,b,f){if(!e||!e.presentation||!e.presentation.format||!e.presentation.format.number||e.presentation.format.number.length<=0){return false}var a=e.presentation.format.number.length,d=null;for(var c=0;c<a;c++){d=e.presentation.format.number[c];if(d.type&&d.type==b){f.unit=!$.isNull(d.unit)?d.unit:"";f.decimalCount=!$.isNull(d.decimalcount)?d.decimalcount:0;f.shortened=!$.isNull(d.shortened)?d.shortened:false;return true}}return false};Chart.Setting.Presentation.NumSetting.serialize=function(f,b,g){if(f){if(!f.presentation){f.presentation={}}if(!f.presentation.format){f.presentation.format={}}if(!f.presentation.format.number){f.presentation.format.number=[]}var a=f.presentation.format.number.length,c=null,d=null;for(var e=0;e<a;e++){c=f.presentation.format.number[e];if(c.type&&c.type==b){d=c;break}}if(!d){d={};f.presentation.format.number.push(d)}d.type=b;d.unit=!$.isNull(g.unit)?g.unit:"";d.decimalcount=!$.isNull(g.decimalCount)&&g.decimalCount>=0?g.decimalCount:0;d.shortened=!$.isNull(g.shortened)?g.shortened:false}};
