var StaticCharts={NavBar:function(set){this.C=set;this.H=100;this.aG=0;},fG:function(set){this.C=set;this.aI='line';this.H=100;this.aG=0;this.dk=true;this.fe=set.B.showMarkers;this.fd=set.B.showInformation;this.eq=set.B.showXLabels;this.ee=set.B.showYLabels;this.dQ=set.B.showCursor;this.dk=true;this.ac=[];this.ao=[];this.setYAxisMargins=function(bottom,top){this.bP=[bottom,top];};this.setHeight=function(h){this.H=h;this.C.aJ();};this.setType=function(type){if(!(type=='candle'||type=='mountain'||type=='line'||type=='ohlc')){return;}if(type==this.aI){return;}this.aI=type;this.C.aJ();};this.showCursor=function(aq){this.dQ=aq;this.bo=null;};this.showMarkers=function(aq){this.fe=aq;};this.showInformation=function(aq){this.fd=aq;};this.showLabels=function(x,y){this.eq=x;this.ee=y;};this.showData=function(aq){if(aq===true){this._content=1;}else if(typeof aq=='number'){this._content=aq;}else{this._content=2;}};this.addBenchmark=function(instrumentId,exchangeId,quoteSource){this.ao.push({instrumentId:instrumentId,exchangeId:exchangeId,quoteSource:quoteSource});};this.removeBenchmark=function(index){if(index<0||index>=this.ao.length){return;}this.ao.splice(index,1);};this.getNumBenchmarks=function(){return this.ao.length;};this.addTool=function(cB){};this.removeTool=function(i){if(i<0||i>=this.aB.length){return;}this.aB.splice(i,1);this.V();};this.getNumTools=function(){return this.aB.length;};this.getTool=function(){if(i<0||i>=this.aB.length){return null;}return this.aB[i];};this.getNumIndicators=function(){return this.ac.length;};this.getIndicator=function(i){if(i<0||i>=this.ac.length){return null;}return this.ac[i];};this.getIndicatorColor=function(i){if(i<0){return '';}return this.C.B.indicatorColor[i<this.C.B.indicatorColor.length?i:0];};this.addIndicator=function(type,U,aZ,aV){this.ac.push({})};this.removeIndicator=function(index){if(index<0||index>=this.ac.length){return;}this.ac.splice(index,1);};this.isEndVisible=function(end){return false;};},Chart:function(id,instrumentId,exchangeId,quoteSource,allowScroll){if(ChartCache.get(id)!==null&&console&&console.dL){console.dL('[Chart] chart with id \''+id+'\' already exists!');}ChartCache.set(id,this);this.J=[];this.aE=instrumentId;this.aD=exchangeId;this.bc=quoteSource;this.H=[500,500];this.ab=[0,0];this.aa=0;this.B=new ChartStyle();this.cq=null;this.dU=null;this.bs=null;this.cc=false;this.be=id;this.hP=function(){if(ChartCache.getUseStaticCharts()){return true;}var gQ=document.cookie.split(';');var eL='',gP='',jC='';for(var i=0;i<gQ.length;i++){eL=gQ[i].split('=');gP=eL[0].replace(/^\s+|\s+$/g,'');if(gP=='chart_fallback_nag'){if(eL.length>1){return unescape(eL[1].replace(/^\s+|\s+$/g,''))=='1'?true:false;}break;}}return false;},this.ir=function(aq){var expires=new Date();expires.setTime((new Date()).getTime()+86400*3*1000*(aq?1: -1));aq=aq?'1':'0';document.cookie="chart_fallback_nag="+aq+";expires="+expires.toGMTString()+";aF=/;domain="+document.domain;};var e=document.getElementById(id);if(!e){throw "[Chart] element with id '"+id+"' does not exist!";}e.innerHTML='';e.style.position='relative';if(typeof e=='undefined'||e===null){return null;}this.H[0]=e.offsetWidth;this.H[1]=e.offsetHeight;var img=document.createElement('img');e.appendChild(img);var R=this;if(!this.hP()){var by=document.createElement('div');by.style.position='absolute';by.style.left='0px';by.style.top='0px';by.style.background='#ffffff url('+ChartSource.prototype.cz+'bg_silverlight.jpg) left bottom repeat-x';by.style.opacity='0.8';by.style.padding='10px';by.style.filter="alpha(opacity = 80)";by.style.width=(this.H[0]-20)+'px';bk=document.createElement('a');bk.href='#';bk.onclick=function(){R.iJ();return false;};bk.style.position='absolute';bk.style.right='5px';bk.style.top='5px';fX=document.createElement('img');fX.src=ChartSource.prototype.cz+'icon_x_silverlight.gif';fX.style.border='none';bk.appendChild(fX);by.appendChild(bk);var bk=document.createElement('a');bk.href='http://go2.microsoft.com/fwlink/?LinkID=114576';bk.style.textDecoration='none';var span=document.createElement('span');span.innerHTML='Installieren Sie Silverlight, um die interaktiven Realtime-Push-Charts auf dieser Seite nutzen zu können.';span.style.fontSize='14px';span.style.fontWeight='bold';span.style.color='#004c84';span.style.display='block';bk.appendChild(span);var span=document.createElement('span');span.innerHTML='4 MB Download - 20 Sek. Installationszeit - kostenlos!';span.style.fontSize='11px';span.style.fontWeight='bold';span.style.color='#FFF';span.style.display='block';bk.appendChild(span);by.appendChild(bk);e.appendChild(by);this.dU=by;}else{this.dU=null;}var f=function(e){R.bB(e);return false;};function ak(e,name,f){if(e.addEventListener){e.addEventListener(name,f,false);}else{e.attachEvent('on'+name,f);}};ak(img,'contextmenu',f);ak(img,'mousedown',f);ak(img,'mouseup',f);this.cq=img;this.aJ=function(){var type='line';var gZ='';if(this.J.length>0){type=this.J[0].aI;if(this.J[0].ao.length>0){gZ='&benchInstrumentId='+this.J[0].ao[0].instrumentId+'&benchExchangeId='+this.J[0].ao[0].exchangeId;}}this.cq.src='/content/charts/fallback.php?height='+this.H[1]+'&width='+this.H[0]+gZ+'&from='+this.ab[0]+'&to='+this.ab[1]+'&intv='+this.aa+'&type='+type+'&instrumentId='+this.aE+'&exchangeId='+this.aD;};this.iJ=function(){var e=document.getElementById(id);e.removeChild(this.dU);this.ir(true);};this.bQ=function(cursor){if(cursor==''){cursor='pointer';}this.cq.style.cursor=cursor;};this.bB=function(event){if(this.cc){var button=e.which?e.which:e.button;if(e.type=='mousedown'&&button==1&&this.bs){document.location=this.bs;}return;}e.cancelBubble=true;if(e.stopPropagation){e.stopPropagation();}if(e.preventDefault){e.preventDefault();}e.returnValue=false;return false;};this.aK=function(span){if(typeof span=='undefined'){span=this.ab[1]-this.ab[0];}var am=[ESpans.MONTH,ESpans.WEEK,ESpans.DAY,ESpans.HOUR,ESpans.THIRTY_MINUTES,ESpans.FIFTEEN_MINUTES,ESpans.FIVE_MINUTES,ESpans.MINUTE];var w=this.B.pointSpacing+1;for(var c=0;c<this.J.length;c++){if(this.J[c].aI=='candle'||this.J[c].aI=='ohlc'){w=this.B.candleSpacing+6;break;}}var n=0;for(var i=am.length;i>=0;i--){n=span/am[i];if(am[i]<span&&this.H[0]/n>=w){return am[i];}}if(span<=86400){return ESpans.MINUTE;}else{return ESpans.MONTH;}};this.setSource=function(source){this.aE=source.aE;this.aD=source.aD;this.bc=source.bc;this.aJ();};this.setInstrument=function(instrumentId,exchangeId,quoteSource){this.aE=instrumentId;this.aD=exchangeId;this.bc=quoteSource;this.aJ();};this.getSource=function(){return{};};this.setLocked=function(aq){if(this.bs){this.bQ('pointer');}this.cc=aq;};this.setLink=function(link){if(this.cc){this.bQ('pointer');}this.bs=link;};this.setSize=function(x,y){this.H=[x,y];var e=document.getElementById(id);e.style.width=x+'px';e.style.height=y+'px';if(this.dU){this.dU.style.width=(this.H[0]-20)+'px';}this.aJ();};this.setStyle=function(style){this.B=style;this.aJ();};this.zoom=function(l,r,load){};this.scroll=function(s,load){};this.setReferenceSpan=function(span){};this.setSpanSimple=function(span,L,offset){var aA=((new Date()).getTime()/1000)|0;var end=Math.ceil(aA/ESpans.DAY)*ESpans.DAY;var start=Math.ceil((aA-span)/ESpans.DAY)*ESpans.DAY+1;this.setSpan(start,end,L,offset);};this.setInterval=function(i){this.aa=i;this.aJ();};this.setSpan=function(start,end,L,offset){if(typeof L!='number'){L=this.aK(end-start);}this.aa=L;this.ab=[start,end];this.aJ();};this.V=function(){};this.addNavBar=function(h){var y=0;for(var i=0;i<this.J.length;i++){y+=this.J[i].H;}var w=this.H[0];if(typeof h!='number'){if(this.J.length==0&&this.H[1]>0){h=this.H[1];}else{h=100;}}var chart=new NavBar(this);chart.H=h;chart.aG=y;this.J.push(chart);this.aJ();return chart;};this.addVolumeChart=function(h){var chart=this.addChart(h,false);chart.showData(3);chart.showLabels(false,true);chart.showMarkers(false);chart.showInformation(false);chart.showCursor(false);return chart;};this.addIndicatorChart=function(h){var chart=this.addChart(h);chart.showData(2);chart.showLabels(false,true);chart.showCurrentValue(false);chart.showInformation(false);chart.showCursor(false);return chart;};this.addChart=function(h,showBackgroundImage){var y=0;for(var i=0;i<this.J.length;i++){y+=this.J[i].H;}var w=this.H[0];if(typeof h!='number'){if(this.J.length==0&&this.H[1]>0){h=this.H[1];}else{h=100;}}var chart=new fG(this);chart.H=h;chart.aG=y;chart.dk=typeof showBackgroundImage=='undefined'||showBackgroundImage?true:false;chart.setType(this.B.hh);this.J.push(chart);this.aJ();return chart;};this.removeChart=function(index){if(index<0||index>=this.J.length){return;}this.J.splice(index,1);this.aJ();};this.moveChart=function(index,bm){if(index<0||bm<0||index>=this.J.length||bm>=this.J.length){return;}var dK=this.J[index];this.J[index]=this.J[bm];this.J[bm]=dK;this.aJ();};this.getNumCharts=function(){return this.J.length;};this.getChart=function(i){if(i<0||i>=this.J.length){return null;}return this.J[i];};this.saveImage=function(c){if(typeof c=='function'){c(this.cq.src);}};this.aJ();},Sparkline:function(id,instrumentId,exchangeId,quoteSource){if(ChartCache.get(id)!==null&&console&&console.dL){console.dL('[Sparkline] sparkline with id \''+id+'\' already exists!');}ChartCache.set(id,this);this.H=[0,0];this.ab=[0,0];this.B=new SparklineStyle();this.aE=instrumentId;this.aD=exchangeId;this.bc=quoteSource;var e=document.getElementById(id);if(!e){throw "[Sparkline] element with id '"+id+"' does not exist!";}e.innerHTML='';e.style.position='relative';if(typeof e=='undefined'||e===null){return null;}this.H[0]=e.offsetWidth;this.H[1]=e.offsetHeight;var img=document.createElement('img');e.appendChild(img);this.cq=img;var R=this;var f=function(e){R.bB(e);return false;};function ak(e,name,f){if(e.addEventListener){e.addEventListener(name,f,false);}else{e.attachEvent('on'+name,f);}};ak(img,'contextmenu',f);ak(img,'mousedown',f);ak(img,'mouseup',f);this.setOffsetValue=function(value){this.en=value;};this.setStyle=function(style){this.B=style;};this.setType=function(type){if(type=='histogram'||type=='line'){this.B.type=type;this.aJ();}};this.V=function(){};this.getBegin=function(){};this.getEnd=function(){};this.getHigh=function(){};this.getLow=function(){};this.setSource=function(source){this.aE=source.aE;this.bc=source.bc;this.aD=source.aD;this.aJ();};this.setInstrument=function(instrumentId,exchangeId,quoteSource){this.aE=instrumentId;this.aD=exchangeId;this.bc=quoteSource;this.aJ();};this.setSize=function(w,h){this.cq.style.width=w+'px';this.cq.style.height=h+'px';this.H=[w,h];this.aa=this.aK();this.aJ();};this.setSpanSimple=function(span,L,offset){var aA=((new Date()).getTime()/1000)|0;var end=Math.ceil(aA/ESpans.DAY)*ESpans.DAY;var start=Math.ceil((aA-span)/ESpans.DAY)*ESpans.DAY+1;this.setSpan(start,end,L,offset);};this.setSpan=function(start,end,L,offset){if(typeof L!='number'){L=this.aK(end-start);}this.aa=this.aK(end-start);this.ab=[start,end];this.aJ();};this.aJ=function(){this.cq.src='/content/charts/sparkline.php?height='+this.H[1]+'&width='+this.H[0]+'&from='+this.ab[0]+'&to='+this.ab[1]+'&intv='+this.aa+'&type='+this.B.type+'&instrumentId='+this.aE+'&exchangeId='+this.aD;};this.bB=function(event){if(this.cc){var button=e.which?e.which:e.button;if(e.type=='mousedown'&&button==1&&this.bs){document.location=this.bs;}return;}e.cancelBubble=true;if(e.stopPropagation){e.stopPropagation();}if(e.preventDefault){e.preventDefault();}e.returnValue=false;return false;};this.aK=function(span){if(typeof span=='undefined'){span=this.ab[1]-this.ab[0];}var am=[ESpans.MONTH,ESpans.WEEK,ESpans.DAY,ESpans.HOUR,ESpans.THIRTY_MINUTES,ESpans.FIFTEEN_MINUTES,ESpans.FIVE_MINUTES,ESpans.MINUTE];var n=0;for(var i=am.length;i>=0;i--){n=span/am[i];if(am[i]<span&&this.H[0]/n>=1){return am[i];}}if(span<=86400){return ESpans.MINUTE;}else{return ESpans.MONTH;}}}};function Chart(id,instrumentId,exchangeId,quoteSource,allowScroll){if(!ChartCache.ib()){throw '[Chart] charts are not supported';}if(ChartCache.get(id)!==null&&typeof console!='undefined'){console.dL('[Chart] chart with id \''+id+'\' already exists!');}ChartCache.set(id,this);this.k=false;this.be=id;this.aE=instrumentId;this.aD=exchangeId;this.bc=quoteSource;this.H=[250,150];this.B=new ChartStyle();this.ct=null;this.J=[];this.cC=null;this.ed=null;this.ab=null;this.T=null;this.aU=null;this.bj=null;this.bK=null;this.eC=null;this.eU=null;this.bn=false;this.fC=true;this.cc=false;this.bs=null;this.eo=false;this.au=[];this.F=null;this.iD=function(){var e=document.getElementById(id);e.removeChild(this.aU);e.removeChild(this.eU);if(this.bK){e.removeChild(this.bK);}for(var i=0;i<this.au.length;i++){this.au[i].source.release(this.au[i].gw);}var fJ;for(var i=0;i<this.J.length;i++){fJ=document.getElementById(this.be+'_chart_bg_'+i);if(fJ){e.removeChild(fJ);}}};var e=document.getElementById(id);if(!e){throw "[Chart] element with id '"+id+"' does not exist!"}e.innerHTML='';e.style.position='relative';if(typeof e=='undefined'||e===null){return null;}var w=e.offsetWidth,h=e.offsetHeight;if(w&&h){this.H[0]=w;this.H[1]=h;}var c=document.createElement('canvas');c.width=this.H[0];c.height=this.H[1];c.id=id+'aU';c.style.position='absolute';e.appendChild(c);if(typeof G_vmlCanvasManager!=='undefined'){G_vmlCanvasManager.fa(c);}this.bj=c.getContext("2d");this.aU=c;this.bj.font="12px 'arial'";this.aU.style.cursor='pointer';var l=document.createElement('div');l.style.backgroundColor="#dddddd";l.style.backgroundImage="url('"+ChartSource.prototype.cz+"load.gif"+"')";l.style.backgroundRepeat="no-repeat";l.style.backgroundPosition="center center";l.style.opacity=0.4;l.style.filter="alpha(opacity = 40)";l.style.width="100%";l.style.height="100%";l.style.position='absolute';l.style.display='none';e.appendChild(l);this.eU=l;var s=document.createElement('div');s.id=id+'bK';s.style.height='30px';s.style.width='300px';s.style.position='absolute';s.style.top=((this.H[1]/2)-15)+'px';s.style.left=((this.H[0]/2)-150)+'px';s.style.border='1px solid black';s.style.display='none';var bJ=document.createElement('div');bJ.style.position='relative';bJ.style.left='50px';bJ.style.width='50px';bJ.style.height='30px';bJ.style.backgroundColor='black';bJ.style.opacity=0.5;s.appendChild(bJ);e.appendChild(s);this.bK=s;this.eC=bJ;if(allowScroll!==false){c.style.cursor='pointer';var R=this;var f=function(e){R.bB(e);return false;};function ak(e,name,f){if(e.addEventListener){e.addEventListener(name,f,false);}else{e.attachEvent('on'+name,f);}};if(navigator.appVersion.indexOf('iPhone')!= -1){this.k=true;ak(c,'touchmove',f);ak(c,'touchstart',f);ak(c,'touchend',f);ak(s,'touchmove',f);ak(s,'touchstart',f);ak(s,'touchend',f);ak(bJ,'touchmove',f);ak(bJ,'touchstart',f);ak(bJ,'touchend',f);ak(l,'touchmove',f);ak(l,'touchstart',f);ak(l,'touchend',f);}else{ak(c,'contextmenu',f);ak(c,'mousedown',f);ak(c,'mouseup',f);ak(c,'mousemove',f);ak(c,'mouseout',f);ak(c,'mouseover',f);ak(l,'contextmenu',f);ak(l,'mousedown',f);ak(l,'mouseup',f);ak(l,'mousemove',f);ak(l,'mouseout',f);ak(l,'mouseover',f);}if(window.addEventListener){c.addEventListener('DOMMouseScroll',f,false);l.addEventListener('DOMMouseScroll',f,false);}ak(c,'mousewheel',f);ak(l,'mousewheel',f);}this.dr=function(x,y){this.H=[x,y];this.bK.style.top=((this.H[1]/2)-15)+'px';this.bK.style.left=((this.H[0]/2)-150)+'px';this.aU.width=this.H[0];this.aU.height=this.H[1];var e=document.getElementById(id);e.style.width=this.H[0]+'px';e.style.height=this.H[1]+'px';this.setInterval(this.aK());this.V();};this.dn=function(){var y=0;var b=null;for(var i=0;i<this.J.length;i++){b=document.getElementById(this.be+'_chart_bg_'+i);if(b){b.style.height=this.J[i].H+'px';b.style.top=y+'px';}this.J[i].aG=y;y+=this.J[i].H;}if(y!=this.H[1]){this.dr(this.H[0],y);}};this.dm=function(visible,left,right){if(this.F.offset===null){if(visible){var n=((this.F.span[1].index-this.F.span[0].index)+this.F.ai+this.F.ag);var ax=(this.H[0]-this.B.offset)/n;this.F.ag=Math.ceil(this.B.offset/ax);}else{this.F.ag=0;}this.F.ai=0;this.F.offset=0;}else{if(this.F.ag!=0&&right){this.F.ag=0;}if(this.F.ai!=0&&left){this.F.ai=0;}}};this.dp=function(mode){var eZ=this.eo;this.eo=mode;if(eZ!=mode){this.V();}};this.bQ=function(cursor){if(cursor==''){cursor='pointer';}this.aU.style.cursor=cursor;};this.gx=function(du,load){if(typeof load=='undefined'){load=true;}var w=(this.F.span[1].index-this.F.span[0].index)+this.F.ai+this.F.ag;w/=2;w=w|0;var begin=bz(du,-w);var end=bz(du,w);var ai=w-(du.index-begin.index);var ag=w-(end.index-du.index);if(load&&ai>0){this.bx(true);var z=this.aa<=ESpans.DAY?ESpans.DAY:ESpans.MONTH;this.F.source.requestData(begin.timestamp-z,end.timestamp+z,this.aa,function(){R.bx(false);R.gx(du,false);});return;}this.F.span=[begin,end];this.F.ai=ai;this.F.ag=ag;this.cx();for(var i=0;i<this.J.length;i++){this.J[i].bi();}this.V();};this.gE=function(begin,end){if(!begin|| !end||end.index<=begin.index){return;}var fi=this.F.span;var ft=this.F.ag/(this.F.span[1].index-this.F.span[0].index);this.F.span=[begin,end];this.setInterval(this.aK());this.dm(!this.F.span[1].next,begin!=fi[0],end!=fi[1]);if(!end.next&&fi[1]==end){this.F.ag=ft*(this.F.span[1].index-this.F.span[0].index);}this.cx();for(var i=0;i<this.J.length;i++){this.J[i].bi();}this.V();};this.aK=function(span){if(typeof span=='undefined'){if(this.bn|| !this.F.span){return this.aa;}span=((this.F.span[1].index-this.F.span[0].index)+this.F.ai+this.F.ag)*this.aa;}var am=[ESpans.MONTH,ESpans.WEEK,ESpans.DAY,ESpans.HOUR,ESpans.THIRTY_MINUTES,ESpans.FIFTEEN_MINUTES,ESpans.FIVE_MINUTES,ESpans.MINUTE];var w=this.B.pointSpacing+1;for(var c=0;c<this.J.length;c++){if(this.J[c].aI=='candle'||this.J[c].aI=='ohlc'){w=this.B.candleSpacing+6;break;}}var n=0;for(var i=am.length;i>=0;i--){n=span/am[i];if(this.H[0]/n>=w){return am[i];}}return ESpans.MONTH;};this.dY=function(source){if(!this.F.span){return;}if(typeof source!=='undefined'){if(!source.span|| !source.G){return;}var value=source.G.findTimestamp(this.ct);if(value){source.relative=value.close;}else{source.relative=1;}return;}for(var j=0;j<this.au.length;j++){source=this.au[j];this.dY(source);}};this.cx=function(){if(!this.F.span){return;}var begin=this.F.span[0];var end=this.F.span[1];var i=this.F.G.L;var R=this;var source=null,cE=false;for(var j=0;j<this.au.length;j++){source=this.au[j];if(source==this.F){continue;}var s=source;var f=function(a,b,c,l){if(!s.G||s.G.L!=c){s.G=s.source.getBuffer(c);}if(s.G){s.span=s.G.findSpan(begin.timestamp,end.timestamp);R.dY(s);}else{s.span=null;s.relative=1;}if(l){for(var i=0;i<R.J.length;i++){R.J[i].bi();}R.V();}};cE=source.source.requestData(begin.timestamp,end.timestamp,i,f,true);}};this.iS=function(source){for(var i=0;i<this.au.length;i++){if(this.au[i]==source){this.au[i].source.release(this.au[i].gw);this.au.splice(i,1);return;}}};this.fh=function(instrumentId,exchangeId,quoteSource){if(instrumentId instanceof ChartSource){hm=instrumentId;}else{for(var i=0;i<this.au.length;i++){if(this.au[i].instrumentId==instrumentId&&this.au[i].exchangeId==exchangeId&&this.au[i].quoteSource==quoteSource){return this.au[i];}}hm=ChartSourceCache.get(instrumentId,exchangeId,quoteSource);}var R=this;var f=function(cP){R.dJ(cP);};var source={};source.source=hm;source.G=null;source.span=null;source.gw=f;source.offset=0;source.ai=0;source.ag=0;source.relative=0;source.source.acquire(f);this.au.push(source);if(this.F){this.cx();}return source;};this.gB=function(){return this.bj;};this.ec=function(){return this.bn;};this.bx=function(mode){if(mode){this.bn=true;this.eU.style.display='block';}else{this.bn=false;this.eU.style.display='none';}};this.setSource=function(source){if(this.bn||source==this.F.source){return;}this.aE=source.aE;this.aD=source.aD;this.bc=source.bc;var setSpan=false,start,end,L;if(this.F&&this.F.span){setSpan=true;start=this.F.span[0].timestamp;end=this.F.span[1].timestamp;L=this.aa;var aA=((new Date()).getTime())/1000;if(!this.F.span[0].prev|| !this.F.span[0].prev.prev){start=Math.floor(aA/ESpans.DAY)*ESpans.DAY}if(!this.F.span[1].next){end=aA;}}this.iS(this.F);this.F=null;this.F=this.fh(source);for(var i=0;i<this.J.length;i++){this.J[i].I=this.F;this.J[i].gy();}if(setSpan){this.setSpan(start,end,L);}};this.setInstrument=function(instrumentId,exchangeId,quoteSource){this.aE=instrumentId;this.aD=exchangeId;this.bc=quoteSource;this.setSource(ChartSourceCache.get(instrumentId,exchangeId,quoteSource));};this.getSource=function(){return this.F.source;};this.setLocked=function(aq){if(this.bs){this.bQ('pointer');}this.cc=aq;};this.isLocked=function(){return this.cc;};this.setLink=function(link){if(this.cc){this.bQ('pointer');}this.bs=link;};this.getLink=function(){return this.bs;};this.setSize=function(x,y){var s=y/this.H[1];var y=0;for(var i=0;i<this.J.length;i++){this.J[i].H*=s;}this.dr(x,y);this.dn();for(var i=0;i<this.J.length;i++){this.J[i]._updateStyle();}this.V();};this.setStyle=function(style){this.B=style;this.eC.style.backgroundColor=style.sliderColor;this.bK.style.border='1px solid '+style.sliderColor;for(var i=0;i<this.J.length;i++){this.J[i]._updateStyle();}this.V();};this.zoom=function(l,r,load){if(this.bn|| !this.F.span){return;}if(typeof load=='undefined'){load=true;}var begin=this.F.span[0];var end=this.F.span[1];var prev=bz(begin,l);if(load&&l<0&&(prev.index-begin.index)>l){this.bx(true);var z=this.aa<=ESpans.DAY?ESpans.DAY:ESpans.MONTH;this.F.source.requestData(begin.timestamp-z,end.timestamp+z,this.aa,function(){R.bx(false);R.zoom(l,r,false);});return;}if(l<0){if(!begin.prev&& !end.next&&this.F.G.L<ESpans.DAY){this.setSpanSimple(ESpans.MONTH);return;}}else if(l>0){if(!end.next&&end.index-begin.index<=2&&this.F.G.L>=ESpans.DAY){this.setSpanSimple(ESpans.DAY);return;}}if(this.F.ag>0&&r<0){this.F.ag+=r;if(this.F.ag<0){r=this.F.ag;this.F.ag=0;}else{r=0;}}if(this.F.ai>0&&l>0){this.F.ai-=l;if(this.F.ai<0){l= -this.F.ai;this.F.ai=0;}else{l=0;}}begin=bz(begin,l);end=bz(end,r);if(begin.index<end.index){var ft=this.F.ag/(this.F.span[1].index-this.F.span[0].index);var dF=begin.index-this.F.span[0].index;var dB=end.index-this.F.span[1].index;this.F.ai-=l-dF;this.F.ag+=r-dB;this.F.span=[begin,end];this.setInterval(this.aK());this.cx();this.dm(!this.F.span[1].next,dF!=0,dB!=0);if(r==0){this.F.ag=ft*(this.F.span[1].index-this.F.span[0].index);}for(var i=0;i<this.J.length;i++){this.J[i].bi();}this.V();}};this.scroll=function(s,load){if(this.bn|| !this.F.span){return;}if(typeof load=='undefined'){var eZ=this.F.offset;this.F.offset+=s;if(((eZ+s)|0)==(eZ|0)){this.V();return;}load=true;}s=(this.F.offset|0);if(s!=0){var l=s,r=s;if(this.F.ag>0&&s<0){this.F.ag+=s;if(this.F.ag<0){r=this.F.ag;this.F.ag=0;}else{r=0;}}if(this.F.ai>0&&s>0){this.F.ai-=s;if(this.F.ai<0){l= -this.F.ai;this.F.ai=0;}else{l=0;}}var begin=bz(this.F.span[0],l);var end=bz(this.F.span[1],r);if(load&&((s<0&& !begin.prev)||(s>0&& !end.next))){var R=this;this.bx(true);var cE=this.F.source.requestData(begin.timestamp+s*this.aa,end.timestamp+s*this.aa,this.aa,function(s,e,i,l){R.bx(false);if(l){R.scroll(s,false);}});if(cE){return;}else{this.bx(false);}}var dF=begin.index-this.F.span[0].index;var dB=end.index-this.F.span[1].index;this.F.ai-=l-dF;this.F.ag+=r-dB;if(l!=0||r!=0){this.F.offset-=s;this.F.span=[begin,end];this.cx();this.dm(!this.F.span[1].next,dF!=0,dB!=0);for(var i=0;i<this.J.length;i++){this.J[i].bi();}}}this.V();};this.setReferenceSpan=function(span){if(span<this.aa){return;}this.ct=((new Date()).getTime()/1000)-span;this.dY();for(var i=0;i<this.J.length;i++){this.J[i].bi();}this.V();};this.setSpanSimple=function(span,L,offset){var aA=((new Date()).getTime()/1000)|0;var end=Math.ceil(aA/ESpans.DAY)*ESpans.DAY;var start=Math.ceil((aA-span)/ESpans.DAY)*ESpans.DAY+1;this.setSpan(start,end,L,offset);};this.setInterval=function(i){if(this.bn||i==this.aa){return;}var G=this.F.G;var begin=this.F.span[0],end=this.F.span[1];var n=end.index-begin.index;if(i>this.aa){do{G=G.parent;begin=begin.parent;end=end.parent;}while(end&&begin&&G&&G.L!=i);}else{do{G=G.bH;begin=begin.begin;end=end.end;}while(end&&begin&&G&&G.L!=i);}if(end&&begin&&G&&begin.index<end.index){if((i<=ESpans.DAY&&this.aa>=ESpans.DAY)||(i>=ESpans.DAY&&this.aa<=ESpans.DAY)){this.F.offset=null;}else{var f=(end.index-begin.index)/n;if(this.F.offset){this.F.offset*=f;}if(this.F.ag){this.F.ag*=f;}if(this.F.ai){this.F.ai*=f;}}this.aa=i;this.F.G=G;this.F.span=[begin,end];this.cx();this.dm(!this.F.span[1].next,false,false);for(var i=0;i<this.J.length;i++){this.J[i].bi();}this.V();}};this.setSpan=function(start,end,L,offset){if(this.ec()){return;}if(end<start){throw "invalid bO specified!";}var aC=L;if(typeof L=='undefined'||L===null){aC=this.aK(end-start);}this.aa=aC;offset=typeof offset!="undefined"?offset:null;this.F.offset=offset;this.F.ai=0;this.F.ag=0;this.bx(true);this.ed=[start,end];var R=this;if(aC<ESpans.DAY){var span=this.F.source.getAvailableSpan();if(span&&start>span[1]&&span[1]-span[0]>0){start=Math.floor(span[1]/ESpans.DAY)*ESpans.DAY;}}this.F.source.requestData(start,end,aC,function(s,e,i){R.fm(s,e,i);});};this.fl=false;this.hD=function(){var c=this.bj;c.clearRect(0,0,this.H[0],this.H[1]);for(var i=0;i<this.J.length;i++){this.J[i].bl(this.eo);}this.fl=false;};this.V=function(){if(this.fl||this.ba.length>0){return;}this.fl=true;setTimeout('ChartCache.get(\''+this.be+'\').hD()',0);};this.gF=function(h,y,isNavBar){var jx=false;var e=document.getElementById(this.be);var b=document.createElement('div');b.id=this.be+'_chart_bg_'+(this.J.length-1);if(!isNavBar){if(this.B.backgroundColor){b.style.backgroundColor=this.B.backgroundColor;}if(this.J[this.J.length-1].dk&&this.B.backgroundImage){b.style.backgroundImage="url('"+this.B.backgroundImage+"')";b.style.backgroundRepeat="no-repeat";b.style.backgroundPosition="center center";}}else{if(this.B.navBarBackgroundColor){b.style.backgroundColor=this.B.navBarBackgroundColor;}}b.style.zIndex=0;b.style.width='100%';b.style.height=h+'px';b.style.position='absolute';b.style.left='0px';b.style.top=y+'px';e.insertBefore(b,e.firstChild)};this.addNavBar=function(h){var y=0;for(var i=0;i<this.J.length;i++){y+=this.J[i].H;}var w=this.H[0];if(typeof h!='number'){if(this.J.length==0&&this.H[1]>0){h=this.H[1];}else{h=100;}}var chart=new NavBar(this,this.F);chart.H=h;chart.aG=y;this.J.push(chart);this.gF(h,y,true);this.dn();this.V();return chart;};this.addVolumeChart=function(h){var chart=this.addChart(h,false);chart.showData(3);chart.showLabels(false,true);chart.showMarkers(false);chart.showInformation(false);chart.showCursor(false);return chart;};this.addIndicatorChart=function(h){var chart=this.addChart(h);chart.showData(2);chart.showLabels(false,true);chart.showCurrentValue(false);chart.showInformation(false);chart.showCursor(false);return chart;};this.addChart=function(h,showBackgroundImage){var y=0;for(var i=0;i<this.J.length;i++){y+=this.J[i].H;}var w=this.H[0];if(typeof h!='number'){if(this.J.length==0&&this.H[1]>0){h=this.H[1];}else{h=100;}}var chart=new fG(this,this.F);chart.H=h;chart.aG=y;chart.dk=typeof showBackgroundImage=='undefined'||showBackgroundImage?true:false;if(this.B.yAxisMargins[0]+this.B.yAxisMargins[1]>h*0.5){var m=this.B.yLabelFontSize/2;if(h*0.5<m*2){m=0;}chart.setYAxisMargins(m,m);}chart.setType(this.B.hh);this.J.push(chart);this.gF(h,y);this.dn();this.V();return chart;};this.removeChart=function(index){if(index<0||index>=this.J.length){return;}var b=document.getElementById(this.be+'_chart_bg_'+index);if(b){var e=document.getElementById(this.be).removeChild(b);}this.J.splice(index,1);for(var i=index;i<this.J.length;i++){b=document.getElementById(this.be+'_chart_bg_'+(i+1));if(b){b.id=this.be+'_chart_bg_'+i;}}this.dn();this.V();};this.moveChart=function(index,bm){if(index<0||bm<0||index>=this.J.length||bm>=this.J.length){return;}var b=document.getElementById(this.be+'_chart_bg_'+index);var hd=document.getElementById(this.be+'_chart_bg_'+bm);hd.id=this.be+'_chart_bg_temp';b.id=this.be+'_chart_bg_'+bm;hd.id=this.be+'_chart_bg_'+index;var dK=this.J[index];this.J[index]=this.J[bm];this.J[bm]=dK;this.dn();this.V();};this.getNumCharts=function(){return this.J.length;};this.getChart=function(i){if(i<0||i>=this.J.length){return null;}return this.J[i];};this.saveImage=function(hk){if(this.ec()){return;}this.bx(true);var aN=null;if(typeof XMLHttpRequest!='undefined'){aN=new XMLHttpRequest();}else if(window.ActiveXObject){if(navigator.userAgent.toLowerCase().indexOf("msie 5")!= -1){aN=new ActiveXObject("Microsoft.XMLHTTP");}else{aN=new ActiveXObject("Msxml2.XMLHTTP");}}var data=this.aU.jn('image/png');aN.open("POST",ChartSource.prototype.cz+'download.php',true);var R=this;aN.onreadystatechange=function(){if(aN.readyState==4){if(hk){hk(ChartSource.prototype.cz+'download.php?id='+aN.responseText);}R.bx(false);}};var color,image;var dG='{';dG+='"data": "'+data+'", "charts": [';for(var i=0;i<this.J.length;i++){if(i!=0){dG+=',';}if(this.J[i]instanceof NavBar){color=this.B.navBarBackgroundColor!==null?this.B.navBarBackgroundColor:'';image='';}else{color=this.B.backgroundColor!==null?this.B.backgroundColor:'';image=this.J[i].dk&&this.B.backgroundImage!==null?this.B.backgroundImage:'';}dG+='{"position":'+this.J[i].aG+', "size":'+this.J[i].H+', "backgroundColor":"'+color+'", "backgroundImage":"'+image+'"}';}dG+=']}';aN.send(dG);};this.dJ=function(cP){if(!this.F|| !this.F.span){if(!this.bn){var G=this.F.source.getBuffer(60);this.F.span=[G.begin,G.end];this.F.G=G;}else{return;}}if(cP&&this.F.span[1].next==this.F.G.end){this.F.span[1]=this.F.span[1].next;}this.dm(!this.F.span[1].next,false,false);for(var i=0;i<this.J.length;i++){this.J[i].bi();}this.V();};this.fm=function(start,end,L){if(start===false||end===false||L===false||end-start==0){this.bx(false);if(L!==false&&this.aa<ESpans.DAY){var span=this.F.source.getAvailableSpan();if(span[1]-span[0]>0){var start=Math.floor(span[1]/ESpans.DAY)*ESpans.DAY;this.setSpan(start,start+ESpans.DAY);}else{var b=this.F.source.getBuffer(ESpans.DAY);if(!b||b.size==1){this.setSpanSimple(ESpans.WEEK);}}}else{this.V();}return;}L=L<ESpans.DAY?60:ESpans.DAY;var G=this.F.source.getBuffer(L);var cH=G.findSpan(start,end);var aC=this.aK(((cH[1].index-cH[0].index)+1)*L);if(aC<ESpans.DAY&&L>=ESpans.DAY){var G=this.F.source.getBuffer(aC);if(G&&G.begin&&G.begin.timestamp<=cH[0].timestamp){L=aC;}}else{L=aC;}this.F.G=this.F.source.getBuffer(L);this.F.span=this.F.G.findSpan(start,end);if(this.ct===null||this.ct<=L){var dD=this.F.source.getPreviousClose();if((this.ed[1]-this.ed[0])==ESpans.DAY&&dD){this.ct=dD.timestamp;}else{this.ct=start;}this.dY();}else{this.dY(this.F);}this.aa=L;this.setInterval(this.aK());this.cx();this.dm(!this.F.span[1].next,true,true);for(var i=0;i<this.J.length;i++){this.J[i].bi();}this.bx(false);this.V();};this.gX=function(){var w=this.bK.offsetWidth;this.eC.style.width=(((this.F.span[1].index-this.F.span[0].index)/this.F.G.size)*w)+'px';this.eC.style.left=((this.F.span[0].index/this.F.G.size)*w)+'px';};this.ba=[];this.bB=function(e){if(this.cc){var button=e.which?e.which:e.button;if(e.type=='mousedown'&&button==1&&this.bs){document.location=this.bs;}if(e.type!='mousemove'&&e.type!='mouseout'&&e.type!='mouseover'){return;}}var dM=false;if(e.type.indexOf('touch')!= -1){switch(e.type){case 'touchstart':if(this.ba.length==0){this.bK.style.display='block';this.gX();}var s=null;for(var i=0;i<e.changedTouches.length;i++){s={id:e.changedTouches[i].identifier,x:e.changedTouches[i].pageX,y:e.changedTouches[i].pageY,cJ:0,ew:0};this.ba.push(s);}break;case 'touchend':if(this.ba.length>0){for(var j=0;j<e.changedTouches.length;j++){for(var i=0;i<this.ba.length;i++){if(this.ba[i].id==e.changedTouches[j].identifier){this.ba.splice(i,i+1);break;}}}if(this.ba.length==0){this.bK.style.display='none';this.V();}}break;case 'touchmove':var n=((this.F.span[1].index-this.F.span[0].index)+this.F.ai+this.F.ag);var ax=this.H[0]/n;var t=null;for(var j=0;j<e.changedTouches.length;j++){for(var i=0;i<this.ba.length;i++){t=this.ba[i];if(t.id==e.changedTouches[j].identifier){t.cJ+=e.changedTouches[j].pageX-t.x;t.ew+=e.changedTouches[j].pageY-t.y;t.x=e.changedTouches[j].pageX;t.y=e.changedTouches[j].pageY;}}}if(this.ba.length==2){var left=this.ba[0];var right=this.ba[1];if(left.x>right.x){var hz=right;right=left;left=hz;}this.zoom(-(left.cJ/ax),-(right.cJ/ax));left.cJ=0;left.ew=0;right.cJ=0;right.ew=0;}else if(this.ba.length==1){var touch=this.ba[0];this.scroll(-(touch.cJ/ax));touch.cJ=0;touch.ew=0;}this.gX();break;}}else if(!this.k){var layerX,layerY;if(e.layerX&&e.layerY){layerX=e.layerX;layerY=e.layerY;}else{layerX=e.offsetX;layerY=e.offsetY;}if(e.type=='mouseover'){return;}else if(e.type=='mouseout'){if(this.ec()){return;}if(this.cC!==null){this.J[this.cC].bB({type:'mouseout',pageX:e.pageX,pageY:e.pageY,layerX:e.layerX,layerY:e.layerY});}this.cC=null;if(e.target==this.aU){this.fC=true;this.bQ('default');}return;}if(this.fC){if(e.type=='mousemove'){this.bQ('');this.fC=false;}else{return;}}var p,s;for(var i=0;i<this.J.length;i++){p=this.J[i].aG;s=this.J[i].H;if(layerY>=p&&layerY<=p+s){dM=i;break;}}if(dM!==this.cC){if(this.cC!==null){this.J[this.cC].bB({type:'mouseout'},e.which?e.which:e.button,layerX,layerY);}this.J[dM].bB({type:'mouseover'},e.which?e.which:e.button,layerX,layerY);this.cC=dM;}if(dM!==false){this.J[dM].bB(e,e.which?e.which:e.button,layerX,layerY);}}e.cancelBubble=true;if(e.stopPropagation){e.stopPropagation();}if(e.preventDefault){e.preventDefault();}e.returnValue=false;return false;};this.F=this.fh(instrumentId,exchangeId,quoteSource);this.bQ('default');};function hI(chart,offset,begin,end,i,j){var c=chart.bj;c.fillStyle=chart.C.B.bandColor[i<chart.C.B.bandColor.length?i:0];c.beginPath();var start=begin;var A=start;while(A&&A!=end.next){if(A.indicator[i]!==null){x=pc(chart.aj(A.index-offset.index));y=pc(chart.ae(A.indicator[i]));if(A==start){c.moveTo(x,y);}else{c.lineTo(x,y);}}else{start=A.next;}A=A.next;}if(!A){A=end;}while(A&&A!=begin.prev){x=pc(chart.aj(A.index-offset.index));y=pc(chart.ae(A.indicator[j]));c.lineTo(x,y);A=A.prev;}x=pc(chart.aj(start.index-offset.index));y=pc(chart.ae(start.indicator[i]));c.lineTo(x,y);c.fill();};function dO(chart,offset,begin,end,i){var c=chart.bj;c.strokeStyle=chart.C.B.indicatorColor[i<chart.C.B.indicatorColor.length?i:0];c.beginPath();var start=begin;var A=start;while(A&&A!=end.next){if(A.indicator[i]!==null){x=pc(chart.aj(A.index-offset.index));y=pc(chart.ae(A.indicator[i]));if(A==start){c.moveTo(x,y);}else{c.lineTo(x,y);}}else{start=A.next;}A=A.next;}c.stroke();};function ih(){this.values=1;this.style='line';this.register=function(){this.U=parseInt(this.U,10);if(isNaN(this.U)||this.U<=0){this.U=20;}};this.unregister=function(){};this.bL=function(value){if(value.index<this.U-1){value.indicator[this.id[0]]=null;return;}var bD=0;var A=value;for(var i=0;i<this.U;i++){bD+=A.close;A=A.prev;}value.indicator[this.id[0]]=bD/this.U;};this.ci=function(chart,offset,begin,end){dO(chart,offset,begin,end,this.id[0]);};};function hB(){this.values=1;this.style='line';this.gq=null;this.register=function(){this.U=parseInt(this.U,10);if(isNaN(this.U)||this.U<=0){this.U=12;}this.gq=2/(this.U+1);};this.unregister=function(){};this.bL=function(value){var cE=0;if(value.index==0){cE=value.close;}else{cE=value.prev.indicator[this.id]+this.gq*(value.close-value.prev.indicator[this.id]);}value.indicator[this.id[0]]=cE;};this.ci=function(chart,offset,begin,end){dO(chart,offset,begin,end,this.id[0]);};};function ig(){this.values=1;this.style='line';this.register=function(source){this.U=parseInt(this.U,10);if(isNaN(this.U)||this.U<=0){this.U=38;}this.m=Math.floor(this.U/2);this.n=this.m+(this.U%2);};this.unregister=function(){};this.bL=function(value){if(value.index<this.m+this.n){value.indicator[this.id[0]]=null;return;}var A=value,bI;var cj,dc;cj=0;for(var i=0;i<this.n;i++){bI=A;dc=0;for(var j=0;j<this.m;j++){dc+=bI.close;bI=bI.prev;}cj+=dc/this.m;A=A.prev;}cj=cj/this.n;value.indicator[this.id[0]]=cj;};this.ci=function(chart,offset,begin,end){dO(chart,offset,begin,end,this.id[0]);};};function ic(){this.values=1;this.style='line';this.register=function(){this.U=parseInt(this.U,10);if(isNaN(this.U)||this.U<=0){this.U=10;}};this.unregister=function(){};this.bL=function(value){if(value.index<this.U-1){value.indicator[this.id[0]]=null;return;}var cj=0,dc=0;var A=value;for(var i=0;i<this.U;i++){cj+=A.close*(this.U-i);dc+=(this.U-i);A=A.prev;}value.indicator[this.id[0]]=cj/dc;};this.ci=function(chart,offset,begin,end){dO(chart,offset,begin,end,this.id[0]);};};function hC(){this.values=2;this.style='band';this.bS=null;this.register=function(source){this.U=parseInt(this.U,10);if(isNaN(this.U)||this.U<=0){this.U=10;}this.aZ=parseInt(this.aZ,10);if(isNaN(this.aZ)||this.aZ<=0){this.aZ=2;}this.aV=parseInt(this.aV,10);if(isNaN(this.aV)||this.aV<=0){this.aV=2;}this.bS=source.addIndicator('bS',10);};this.unregister=function(source){source.removeIndicator(this.bS);};this.bL=function(value){if(value.index<this.U-1){value.indicator[this.id[0]]=null;value.indicator[this.id[1]]=null;return;}var bS=value.indicator[this.bS.id];var bD=0;var A=value;for(var j=0;j<this.U;j++){bD+=Math.pow(A.close-bS,this.aZ);A=A.prev;}bD=Math.pow(bD/this.U,1/this.aZ);value.indicator[this.id[0]]=bS-this.aV*bD;value.indicator[this.id[1]]=bS+this.aV*bD;};this.ci=function(chart,offset,begin,end){dO(chart,offset,begin,end,this.bS.id[0]);hI(chart,offset,begin,end,this.id[0],this.id[1]);};};function NavBar(set,source){this.C=set;this.I=source;this.bj=set.gB();this.H=0;this.aG=0;this.ju=[0,0];this.bV=false;this.fc=false;this.fu=0;this.fr=0;this.aa=60;this.V=function(){this.C.V();};this.bl=function(){var c=this.bj;if(!this.I.G){return;}c.save();c.translate(0,this.aG);var y=((this.H-1)|0)+0.5;var x=((this.C.H[0]-1)|0)+0.5;c.strokeStyle=this.C.B.axisColor;c.beginPath();c.moveTo(0.5,y);c.lineTo(x,y);c.stroke();c.beginPath();c.moveTo(0.5,0.5);c.lineTo(x,0.5);c.stroke();c.beginPath();c.moveTo(x,0.5);c.lineTo(x,y);c.stroke();c.beginPath();c.moveTo(0.5,0.5);c.lineTo(0.5,y);c.stroke();var G=this.I.source.getBuffer(this.aa);c.fillStyle=this.C.B.navBarAreaColor;c.strokeStyle=this.C.B.navBarHandleColor;var s=this.I.span[0];var e=this.I.span[1];if(this.I.G.size==1){x=0;w=this.C.H[0];}else{x=1+(s.index/(this.I.G.size-1))*(this.C.H[0]-2);w=((e.index-s.index)/(this.I.G.size-1))*(this.C.H[0]-2);}c.fillRect(x,0,w,this.H);var l=this.bV?this.bV:this.fc;if(l==2||l==3){if(l==3){x+=w;}c.lineWidth=2;c.beginPath();c.moveTo(x,0);c.lineTo(x,this.H);c.stroke();c.lineWidth=1;}c.strokeStyle=this.C.B.navBarLineColor;s=G.begin;e=G.end;c.beginPath();var A=s;var bO=G.high.high-G.low.low;var low=G.low.low-bO*0.1;var high=G.high.high+bO*0.1;if(low<0){low=0;}var ax=(this.C.H[0]-3)/(G.size-1);y=(((1-((A.close-low)/(high-low)))*this.H)|0)+0.5;x=1;c.moveTo(0.5,y);while(A){y=(((1-((A.close-low)/(high-low)))*this.H)|0)+0.5;c.lineTo((x|0)+0.5,y);A=A.next;x+=ax;}c.stroke();c.restore();};this.gA=function(x){if(!this.I.G|| !this.I.span){return false;}var left=(this.I.span[0].index/(this.I.G.size-1))*this.C.H[0];var right=(this.I.span[1].index/(this.I.G.size-1))*this.C.H[0];var o=x-left;var aT=right-x;if(o> -5&&o<5){return 2;}else if(aT> -5&&aT<5){return 3;}else if(x>left&&x<right){return 1;}return false;};this._updateStyle=function(){};this.fR=function(x){var a=this.gA(x);if(a!=this.fc){var cursor='';if(a==1){cursor='move';}else if(a==2){cursor='w-resize';}else if(a==3){cursor='e-resize';}this.C.bQ(cursor);this.fc=a;this.V();}};this.bB=function(e,button,layerX,layerY){if(this.C.isLocked()){return;}switch(e.type){case 'mouseover':this.fR(layerX);break;case 'mouseout':this.C.bQ('');this.fc=null;this.C.dp(false);this.bV=false;break;case 'mouseup':this.bV=false;this.fR(layerX);this.C.dp(false);break;case 'mousemove':if(!this.I.G|| !this.I.span){return;}if(!this.bV){this.fR(layerX);}else{var x=layerX-this.fu;var w=this.C.H[0]/(this.I.G.size-1);this.fr+=(x/w);var m=this.fr|0;this.fu=layerX;if(m!=0){this.fr-=m;var begin=this.I.span[0],end=this.I.span[1];if(this.bV==2){begin=bz(begin,m);}else if(this.bV==3){end=bz(end,m);}else{begin=bz(begin,m);end=bz(end,m);}this.C.gE(begin,end);}}break;case 'mousedown':if(!this.I.G|| !this.I.span){return;}this.fu=layerX;if(button==1){var a=this.gA(layerX);if(!a){this.bV=1;var i=(layerX/this.C.H[0])*(this.I.G.size-1);var w=this.I.span[1].index-this.I.span[0].index;var s=(i-w/2)|0;var e=(i+w/2)|0;var A=this.I.G.begin,begin=null,end=null;while(A){if(A.index==s||(!begin&&A.index>s)){begin=A;}if(A.index==e||(!end&& !A.next)){end=A;}A=A.next;}if(begin&&end){this.C.gE(begin,end);}}this.bV=a;this.C.dp(true);}break;}};this.gy=function(){};this.bi=function(){this.aK();if(this.aa<ESpans.DAY&&this.I.G.L>=ESpans.DAY){this.aa=ESpans.DAY;}return true;};this.aK=function(){var w=5;var span=((this.I.G.end.index-this.I.G.begin.index)+this.I.ai+this.I.ag)*this.I.G.L;var am=[ESpans.MONTH,ESpans.WEEK,ESpans.DAY,ESpans.HOUR,ESpans.THIRTY_MINUTES,ESpans.FIFTEEN_MINUTES,ESpans.FIVE_MINUTES,ESpans.MINUTE];var n=0;for(var i=am.length;i>=0;i--){n=span/am[i];if(this.C.H[0]/n>=w){this.aa=am[i];return;}}if(this.I.G.L>=86400){this.aa=86400;}else{this.aa=60;}};this.setSize=function(w,h){this.H=[w,h];};this.setPosition=function(x,y){this.aG=[x,y];}};var ESpans={MINUTE:60,FIVE_MINUTES:60*5,FIFTEEN_MINUTES:60*15,THIRTY_MINUTES:60*30,HOUR:60*60,DAY:60*60*24,WEEK:60*60*24*7,MONTH:60*60*24*7*4,YEAR:60*60*24*365};function bR(t,i){if(i==ESpans.WEEK){var d=new Date(t*1000);var w=d.getDay();return((new Date(d.getFullYear(),d.getMonth(),d.getDate())).getTime()/1000)-(w==0?7:w-1)*ESpans.DAY;}else if(i==ESpans.MONTH){var d=new Date(t*1000);return(new Date(d.getFullYear(),d.getMonth(),1)).getTime()/1000;}else if(i==ESpans.YEAR){var d=new Date(t*1000);return(new Date(d.getFullYear(),1,1)).getTime()/1000;}return Math.ceil(t/i)*i;};function hV(t){if(t>=ESpans.MONTH){var n=(t/ESpans.MONTH);return n+' Monat'+(n>1?'e':'');}else if(t>=ESpans.WEEK){var n=(t/ESpans.WEEK);return n+' Woche'+(n>1?'n':'');}else if(t>=ESpans.DAY){var n=(t/ESpans.DAY);return n+' Tag'+(n>1?'e':'');}else if(t>=ESpans.HOUR){var n=(t/ESpans.HOUR);return n+' Stunde'+(n>1?'n':'');}else{var n=(t/ESpans.MINUTE);return n+' Minute'+(n>1?'n':'');}return '';};function eT(bM,ar,i){var fZ=0,aA=0;if(!ar){var d=new Date();aA=Math.ceil(d.getTime()/(1000*ESpans.DAY))*ESpans.DAY+d.getTimezoneOffset()*60;fZ=strftime(aA,'%y');}if(i<ESpans.DAY){var de=((bM/3600)|0);var dg=((ar/3600)|0);if(!ar||de!=dg){return(aA-bM>ESpans.DAY?strftime(bM,'%d.%m '):'')+strftime(bM,'%H:%M');}return null;}if(i<ESpans.WEEK){var de=strftime(bM,'%u');var dg=strftime(ar,'%u');if(!ar||de<dg){var aO=strftime(bM,'%y');var az=strftime(ar,'%y');return strftime(bM,'%d.%m'+((ar&&aO!=az)||(!ar&&fZ!=aO)?' \'%y':''));}return null;}var de=strftime(bM,'%m');var dg=strftime(ar,'%m');if(!ar||de!=dg){return strftime(bM,'%B'+((ar&&de<dg)||(!ar&&strftime(bM,'%y')!=fZ)?' \'%y':''));}return null;};function ChartValue(d){this.next=null;this.prev=null;this.parent=null;this.begin=null;this.end=null;this.index=0;this.labelIndex=0;this.indicator=[];this.label=null;this.timestamp=0;this.open=0;this.high=0;this.low=0;this.close=0;this.volume=0;};function ga(bh,i){this.L=i;this.parent=null;this.bh=bh;this.bH=null;this.begin=null;this.end=null;this.size=0;this.cX=0;this.high=null;this.low=null;this.findTimestamp=function(timestamp){begin=this.begin;while(begin&&begin.next){if(begin.timestamp>=timestamp){break;}begin=begin.next;}return begin;};this.findSpan=function(hE,gj){var begin=null,end=null;begin=this.begin;while(begin){if(begin.timestamp>=hE){break;}begin=begin.next;}end=this.end;while(end){if(end.timestamp==gj||(end.prev&&end.prev.timestamp<gj)){break;}end=end.prev;}if(!begin|| !end){if(!begin&& !end){return null;}if(!begin)begin=end;if(!end)end=begin;}return[begin,end];};this.getFirstTimestamp=function(){if(this.begin){return this.begin.timestamp;}return null;};this.getLastTimestamp=function(){if(this.end){return this.end.timestamp;}return null;};this.getParent=function(){if(!this.parent){var am=[ESpans.MONTH,ESpans.WEEK,ESpans.DAY,ESpans.HOUR,ESpans.THIRTY_MINUTES,ESpans.FIFTEEN_MINUTES,ESpans.FIVE_MINUTES,ESpans.MINUTE];for(var i=0;i<am.length;i++){if(am[i]==this.L){if(i==0){break;}this.parent=new ga(this.bh,am[i-1]);this.parent.bH=this;}}}return this.bH;};this.getChild=function(){if(!this.bH){var am=[ESpans.MONTH,ESpans.WEEK,ESpans.DAY,ESpans.HOUR,ESpans.THIRTY_MINUTES,ESpans.FIFTEEN_MINUTES,ESpans.FIVE_MINUTES,ESpans.MINUTE];for(var i=0;i<am.length;i++){if(am[i]==this.L){if(i==am.length-1){break;}this.bH=new ga(this.bh,am[i+1]);this.bH.parent=this;}}}return this.bH;};this.fy=function(first,last){var A=null,next=null,begin=null;var t=0,ar=0;if(this.begin){var start=bR(first.timestamp,this.L);if(start<this.begin.timestamp){next=this.begin;}else{begin=this.end;t=bR(begin.timestamp,this.L);A=begin;}}var index=this.size;var p=first,q=null;do{if(this.L==ESpans.DAY){ar=Math.floor(p.timestamp/ESpans.DAY)*ESpans.DAY;}else{ar=bR(p.timestamp,this.L);}if(next&&ar>=next.timestamp){break;}if(ar<t){p=p.next;continue;}if(ar!=t){this.size++;if(this.L==ESpans.DAY){var i=2;}q=new ChartValue();q.timestamp=ar;q.index=index++;q.open=p.open;q.high=p.high;q.low=p.low;q.close=p.close;q.volume=p.volume;q.begin=q.end=p;if(A==null){if(begin){begin.next=q;q.prev=begin;}else{this.begin=q;}begin=A=q;}else{A.next=q;q.prev=A;A=q;}if(A.prev){A.label=eT(q.timestamp,A.prev.timestamp,this.L);if(A.label){A.labelIndex=this.cX++;}}t=ar;}else{A.end=p;A.close=p.close;A.volume+=p.volume;if(p.high>A.high){A.high=p.high;}if(p.low<A.low){A.low=p.low;}}if(this.high===null||A.high>this.high.high){this.high=A;}if(this.low===null||A.low<this.low.low){this.low=A;}p.parent=A;p=p.next;}while(p&&p.prev!=last);if(!A){return;}if(!next){this.end=A;}else{A.next=next;next.prev=A;}var aw;if(next){aw=this.begin;var index=0;this.cX=0;while(aw){aw.index=index++;if(aw.label){aw.labelIndex=this.cX++;}aw=aw.next;}}if(this.bh.ac.length>0){if(begin==A){for(i=0;i<this.bh.ac.length;i++){this.bh.ac[i].bL(A);}}else{aw=this.begin;while(aw){for(i=0;i<this.bh.ac.length;i++){this.bh.ac[i].bL(aw);}aw=aw.next;}}}this.getParent();if(this.parent){this.parent.fy(begin,A);}};this.hi=function(s,e,i,data){if(typeof data=='undefined'|| !data||data.length==0){return;}this.getChild();if(i<this.L){if(this.bH){this.bH.hi(s,e,i,data);}return;}var A=null,next=null,begin=null;if(this.begin){var start=data[2][0];if(start<this.begin.timestamp){next=this.begin;}else{begin=this.end;}}var q=null;var index=this.size;var t=0,ar=0;for(var p=2;p<data.length;p++){ar=bR(data[p][0],this.L);if(begin&&ar<=begin.timestamp){continue;}if(next&&ar>=next.timestamp){break;}if(ar!=t){this.size++;q=new ChartValue();q.index=index++;q.timestamp=ar;q.open=data[p][2];q.high=data[p][4];q.low=data[p][3];q.close=data[p][1];q.volume=data[p][5];if(A==null){if(begin){begin.next=q;q.prev=begin;}else{this.begin=q;}begin=A=q;}else{A.next=q;q.prev=A;A=q;}if(A.prev){A.label=eT(q.timestamp,A.prev.timestamp,this.L);if(A.label){A.labelIndex=this.cX++;}}t=ar;}else{A.close=data[p][1];A.volume+=data[p][5];if(data[p][4]>A.high){A.high=data[p][4];}if(data[p][3]<A.low){A.low=data[p][3];}}if(this.high===null||A.high>this.high.high){this.high=A;}if(this.low===null||A.low<this.low.low){this.low=A;}}if(!A){return;}if(!next){this.end=A;}else{A.next=next;next.prev=A;}var aw;if(next){aw=this.begin;var index=0;this.cX=0;while(aw){aw.index=index++;if(aw.label){aw.labelIndex=this.cX++;}aw=aw.next;}}if(this.bh.ac.length>0){if(begin==A){for(i=0;i<this.bh.ac.length;i++){this.bh.ac[i].bL(A);}}else{aw=this.begin;while(aw){for(i=0;i<this.bh.ac.length;i++){this.bh.ac[i].bL(aw);}aw=aw.next;}}}this.getParent();if(this.parent){this.parent.fy(begin,A);}};};function ChartSource(instrumentId,exchangeId,quoteSource){this.ep=0;this.cn={};this.cs={};this.ac=[];this.hA=0;this.bc=quoteSource;this.aE=instrumentId;this.aD=exchangeId;this.T=null;this.di=[];this.fs=null;this.fg=null;this.cw=null;this.co=null;this.dX=null;this.getFormatString=function(i){if(i<ESpans.DAY){return '%H:%M';}else if(i==ESpans.WEEK){return 'KW %V \'%y (%d.%m)';}else if(i==ESpans.MONTH){return '%b \'%y';}return '%d.%m.%Y';};this.acquire=function(c){if(typeof c!='undefined'){this.di.push(c);}this.ep++;if(this.ep==1){this.iX();}};this.release=function(c){if(typeof c!='undefined'){for(var j=0;j<this.di.length;j++){if(this.di[j]==c){this.di.splice(j,1);break;}}}this.ep--;if(this.ep==0){this.ij();}};this.getLastValue=function(){var b=this.getBuffer(60);if(b.end){return b.end.close;}return null;};this.getPreviousClose=function(i){var value=this.fs;var G=this.getBuffer(60);if(typeof i=='undefined'||i==60){if(typeof i=='undefined'&&value===null){if(G&&G.begin){value=G.begin;}else{value=this.T.begin;}}return value;}while(value&&G&&G.L<i){G=G.parent;if(value){value=value.parent;}else{value=G.begin;}}return value;};this.getAvailableSpan=function(){return this.cs[60];};this.getBuffer=function(i){if(this.T==null){return;}if(typeof i=='undefined'){var G=this.T;while(G.parent){G=G.parent;}return G;}var G=this.T;if(G.L>i){while(G.bH&&G.L>i){G=G.bH;}}else if(G.L<i){while(G.parent&&G.L<i){G=G.parent;}}if(G.L==i){return G;}return null;};this.requestData=function(s,e,i,c,f){return this.ho(s,e,i,c,f);};this.ij=function(){if(!this.fg){return;}BG_QuotePush.unsubscribe(this.aE,this.aD,this.cw|this.co|this.dX);BG_AjaxPushHub.unsubscribe(this.fg);};this.iX=function(){if(!BG_QuotePush.isPushableExchange(this.aD)){return;}switch(this.bc){case 'bid':default:this.cw=EQuoteFields.BID_LAST;this.co=EQuoteFields.BID_TIME;this.dX=EQuoteFields.BID_CLOSE;break;case 'ask':this.cw=EQuoteFields.ASK_LAST;this.co=EQuoteFields.ASK_TIME;this.dX=EQuoteFields.ASK_CLOSE;break;case 'last':this.cw=EQuoteFields.LAST_LAST;this.co=EQuoteFields.LAST_TIME;this.dX=EQuoteFields.LAST_CLOSE;break;}var fields=this.cw|this.co|this.dX;var event=BG_QuotePush.subscribe(this.aE,this.aD,fields);var R=this;this.fg=BG_AjaxPushHub.subscribe(event,function(e,d){R.dJ(e,d);});};this.dJ=function(e,d){if(!(d.fields&this.cw)){return;}var value=parseFloat(d.values[this.cw]);var cG=null;if(d.fields&this.co){cG=parseInt(d.values[this.co]);}else{cG=BG_QuotePush.get(this.aE,this.aD,this.co);}if(cG===null){return;}var G=this.getBuffer(60);if(!G){G=this.getBuffer(ESpans.DAY);do{G=G.getChild();}while(G&&G.L!=60);if(!G){return;}}if(G.L==ESpans.DAY){cG=Math.floor(cG/ESpans.DAY)*ESpans.DAY;}var t=bR(cG,G.L);var lt=bR(G.size==0?0:G.end.timestamp,G.L);var q;if(t==lt){q=G.end;q.close=value;if(value>q.high){q.high=value;}if(value<q.low){q.low=value;}if(!G.high||value>G.high.high){G.high=q;}if(!G.low||value<G.low.low){G.low=q;}}else{q=new ChartValue();q.prev=G.end;if(!G.begin){G.begin=q;}if(G.end){G.end.next=q;}G.end=q;q.timestamp=cG;q.open=value;q.close=value;q.high=value;q.low=value;q.volume=0;q.index=G.size;if(q.prev){q.index=q.prev.index+1;}else{q.index=0;}if(!G.high||value>G.high.high){G.high=q;}if(!G.low||value<G.low.low){G.low=q;}G.size++;}if(G.parent){G.parent.fy(q,q);}while(q){for(i=0;i<this.ac.length;i++){this.ac[i].bL(q);}q=q.parent;}for(var i=0;i<this.di.length;i++){this.di[i](t!=lt);}};this.addIndicator=function(type,U,aZ,aV){if(typeof U=='undefined'){U=0;}if(typeof aZ=='undefined'){aZ=0;}if(typeof aV=='undefined'){aV=0;}var i;for(var j=0;j<this.ac.length;j++){i=this.ac[j];if(i.type==type&&i.U==U&&i.aZ==aZ&&i.aV==aV){i.gG++;return i;}}switch(type){case 'bS':i=new ih();break;case 'ema':i=new hB();break;case 'tma':i=new ig();break;case 'wma':i=new ic();break;case 'bb':i=new hC();break;default:return null;}var ids=[];for(var j=0;j<i.values;j++){ids.push(this.hA++);}i.id=ids;i.type=type;i.gG=1;i.U=U;i.aZ=aZ;i.aV=aV;i.register(this);this.ac.push(i);var b=this.getBuffer(60);if(!b){b=this.getBuffer(ESpans.DAY);}var A;while(b){A=b.begin;while(A){i.bL(A);A=A.next;}b=b.parent;}return i;};this.removeIndicator=function(indicator){for(var j=0;j<this.ac.length;j++){if(this.ac[j]==indicator){var i=this.ac[j];if(--i.gG<=0){this.ac.splice(j,1);i.unregister(this);}return;}}};this.ho=function(s,e,i,c,f){var af=0,ah=0,aQ=i<86400?60:86400;if(f!==true&&aQ==60&&typeof this.cs[60]!='undefined'){var fY=Math.floor(s/ESpans.DAY)*ESpans.DAY;var fH=Math.floor(this.cs[60][0]/ESpans.DAY)*ESpans.DAY;if(fY<fH){i=aQ=86400;}}if(aQ==60){af=((s/86400)|0)*86400;ah=(((e/86400)|0)+1)*86400;}else{af=s-ESpans.YEAR;ah=e+ESpans.YEAR;}if(typeof this.cn[aQ]=='undefined'){this.cn[aQ]=[af,ah];}else{if(this.cn[aQ][0]<=s&&this.cn[aQ][1]>=e){if(c){var b=this.getBuffer(aQ);if(b&&b.size>0){e=Math.min(b.getLastTimestamp(),e);s=Math.min(e,Math.max(s,b.getFirstTimestamp()));c(s,e,i,false);}else{c(false,false,false,false);}}return false;}else{this.cn[aQ][0]=af=Math.min(this.cn[aQ][1],af);this.cn[aQ][1]=ah=Math.max(this.cn[aQ][1],ah);}}var aA=((new Date()).getTime()/1000)|0;if(ah>aA){ah=aA;}var aN=null;if(typeof XMLHttpRequest!='undefined'){aN=new XMLHttpRequest();}else if(window.ActiveXObject){if(navigator.userAgent.toLowerCase().indexOf("msie 5")!= -1){aN=new ActiveXObject("Microsoft.XMLHTTP");}else{aN=new ActiveXObject("Msxml2.XMLHTTP");}}var R=this;aN.onreadystatechange=function(){if(aN.readyState==4){if(aN.status!=200){if(c){c(false,false,false,true);}return;}b=R.getBuffer();var data=eval(aN.responseText);b.hi(af,ah,aQ,data);if(!R.cs[60]){R.cs[60]=[0,0];}R.cs[60][0]=data[0];R.cs[60][1]=data[1];if(f!==true&&aQ==60){var fY=Math.floor(af/ESpans.DAY)*ESpans.DAY;var fH=Math.floor(R.cs[60][0]/ESpans.DAY)*ESpans.DAY;if(fY<fH){R.ho(s,e,ESpans.DAY,c);return;}}var eH=Math.floor(((new Date()).getTime()/1000)/ESpans.DAY)*ESpans.DAY;if(!R.fs&&aQ==60&&af<=eH&&ah>=eH){b=R.getBuffer(aQ);var value=b.begin;if(value){while(value.next&&value.next.timestamp<eH){value=value.next;}if(value.timestamp<eH){R.fs=value;}}}if(c){b=R.getBuffer(aQ);if(b){e=Math.min(b.getLastTimestamp(),e);s=Math.min(e,Math.max(s,b.getFirstTimestamp()));if(s==0)s=false;if(e==0)e=false;}else{s=e=i=false;}c(s,e,i,true);}}};var cFrom=Math.ceil(af/aQ);var cTo=Math.ceil(ah/aQ);var cacheTag=this.aE+"o"+this.aD+"o"+aQ+"o"+cFrom+"o"+cTo;aN.open("GET",this.cz+'history.php?ctag='+cacheTag,true);aN.setRequestHeader("Content-type","application/x-www-form-urlencoded");aN.send(null);return true;};this.T=new ga(this,86400);};ChartSource.prototype.cz='/js/core/chart/';var ChartSourceCache={fU:{},au:[],addName:function(id,name){ChartSourceCache.fU[id]=name;},preload:function(instrumentId,exchangeId,quoteSource,start,end){if(ChartCache._staticCharts){return;}var source=ChartSourceCache.get(instrumentId,exchangeId,quoteSource);var L=end-start>86400?86400:60;if(typeof end=='undefined'){var aA=((new Date()).getTime()/1000)|0;end=Math.ceil(aA/ESpans.DAY)*ESpans.DAY;start=Math.ceil((aA-start)/ESpans.DAY)*ESpans.DAY+1;}source.requestData(start,end,L);},get:function(instrumentId,exchangeId,quoteSource){var s=null;for(var i=0;i<ChartSourceCache.au.length;i++){s=ChartSourceCache.au[i];if(s.aE==instrumentId&&s.aD==exchangeId&&s.bc==quoteSource){return s;}}s=new ChartSource(instrumentId,exchangeId,quoteSource);s.acquire();if(typeof ChartSourceCache.fU[instrumentId]!='undefined'){s.cS=ChartSourceCache.fU[instrumentId];}ChartSourceCache.au.push(s);return s;},remove:function(instrumentId,exchangeId,quoteSource){var s=null;for(var i=0;i<ChartSourceCache.au.length;i++){s=ChartSourceCache.au[i];if(s.aE==instrumentId&&s.aD==exchangeId&&s.bc==quoteSource){s.release();ChartSourceCache.au.splice(i,1);return;}}}};var ChartCache={J:[],eD:null,_staticCharts:null,getUseStaticCharts:function(){if(ChartCache._staticCharts===null){ChartCache._staticCharts=BG_AjaxPush._readSetting('BG_ChartsStatic',0)==1?true:false;}return ChartCache._staticCharts;},setUseStaticCharts:function(aq){BG_AjaxPush._writeSetting('BG_ChartsStatic',aq?1:0,86400*364);ChartCache._staticCharts=aq;},ib:function(){if(ChartCache.eD===null){if(typeof window.G_vmlCanvasManager!='undefined'&& !Silverlight.isInstalled()){ChartCache.eD=false;}else{ChartCache.eD=true;}}return ChartCache.eD;},remove:function(id){var chart=ChartCache.J[id];if(chart){delete ChartCache.J[id];chart.iD();return true;}return false;},set:function(id,chart){ChartCache.J[id]=chart;},get:function(id){if(typeof ChartCache.J[id]!='undefined'){return ChartCache.J[id];}return null;}};function dj(url){if(navigator.appVersion.indexOf("MSIE")!= -1){document.write('<script type="text/javascript" src="'+url+'"></script>');}else{var script=document.createElement('script');script.src=url;document.body.appendChild(script);}};if(!window.Silverlight){var Silverlight={fL:null,isInstalled:function(d){if(typeof d=='undefined'){d='2.0';}if(Silverlight.fL!==null){return Silverlight.fL;}var c=false,a=null;try{var b=null;if(navigator.appVersion.indexOf("MSIE")!= -1){b=new ActiveXObject("AgControl.AgControl");}else{if(navigator.plugins["Silverlight Plug-In"]){a=document.createElement("div");document.body.appendChild(a);a.innerHTML='<embed type="application/x-silverlight" />';b=a.childNodes[0]}}if(b.IsVersionSupported(d)){c=true;}b=null;Silverlight.fL=true}catch(e){c=false}if(a){document.body.removeChild(a);}return c}}}function useStaticCharts(){fG=StaticCharts.fG;NavBar=StaticCharts.NavBar;Chart=StaticCharts.Chart;Sparkline=StaticCharts.Sparkline;};if(ChartCache.getUseStaticCharts()==1){useStaticCharts();}function initCharts(aF){if(ChartCache.getUseStaticCharts()==1){return;}var c=document.createElement('canvas');var ad;if(!c.getContext){if(!Silverlight.isInstalled()){useStaticCharts();dj(aF+'charts_cf.js');}else{dj(aF+'charts_ec.js');}}else{ad=c.getContext('2d');if(!ad.fillText){dj(aF+'charts_text.js');}else if(navigator.appVersion.indexOf('iPhone')!= -1){dj(aF+'charts_text.js?reimplement=true');}}ChartSource.prototype.cz=aF;};function pc(v){return(v|0)+0.5;};function SparklineStyle(){this.type='line';this.margins=[2,5,2,5];this.positiveBarColor='rgba(51,153,0,1)';this.negativeBarColor='rgba(204,0,0,1)';this.lineColor='rgba(200,200,200,1)';this.pointSize=2;this.minBarWidth=2;this.maxBarWidth=4;this.useBarAutosize=true;this.showOpen=false;this.showClose=true;this.showHigh=true;this.showLow=true;this.delimiterColor='rgba(150,150,150,1)';this.hF='rgba(205,164,0,1)';this.upFlashColor='rgba(51,153,0,1)';this.downFlashColor='rgba(204,0,0,1)';this.neutralFlashColor='rgba(200,200,200,1)';};function Sparkline(id,instrumentId,exchangeId,quoteSource){if(ChartCache.get(id)!==null&&typeof console!='undefined'){console.dL('[Sparkline] sparkline with id \''+id+'\' already exists!');}ChartCache.set(id,this);this.aa=60;this.bn=false;this.ab=[null,null];this.en=null;this.ed=[0,0];this.I=null;this.H=[0,0];this.cv=0;this.av=[0,0];this.bw=[null,null];this.aU=null;this.bj=null;this.T=null;this.bd=null;this.at=[null,0];this.bW=null;this.bC=null;this.B=new SparklineStyle();var e=document.getElementById(id);if(!e){throw "[Chart] element with id '"+id+"' does not exist!";}e.innerHTML='';e.style.position='relative';if(typeof e=='undefined'||e===null){return null;}this.H[0]=e.offsetWidth;this.H[1]=e.offsetHeight;this.cv=this.H[0];var c=document.createElement('canvas');c.width=this.H[0];c.height=this.H[1];c.id=id+'aU';e.appendChild(c);c.style.verticalAlign='middle';if(typeof G_vmlCanvasManager!=='undefined'){G_vmlCanvasManager.fa(c);}this.bj=c.getContext("2d");this.aU=c;this.setOffsetValue=function(value){this.en=value;};this.setStyle=function(style){this.B=style;this.bl();};this.setType=function(type){if(type=='histogram'||type=='line'){this.B.type=type;this.bl();}};this.V=function(){this.bl();};this.getBegin=function(){if(!this.T||this.T.size==0){return 0;}var b=this.T.begin;return new ChartValue(b.timestamp,b.open,'begin');};this.getEnd=function(){if(!this.T||this.T.size==0){return 0;}var e=this.T.end;return new ChartValue(end.timestamp,end.close,'end');};this.getHigh=function(){if(!this.T||this.T.size==0){return 0;}var p=this.bw[0];return new ChartValue(p.timestamp,p.high,'high');};this.getLow=function(){if(!this.T||this.T.size==0){return 0;}var p=this.bw[1];return new ChartValue(p.timestamp,p.low,'low');};this.setInstrument=function(instrumentId,exchangeId,quoteSource){var source=ChartSourceCache.get(instrumentId,exchangeId,quoteSource);this.setSource(source);};this.setSource=function(source){if(typeof source!='object'){throw "invalid source specified!";}if(this.I!==null){this.I.release();}this.I=source;var R=this;var f=function(cP){R.dJ(cP);};source.acquire(f);if(this.T){this.setSpan(this.ab[0].timestamp,this.ab[1].timestamp);}};this.setSize=function(w,h){this.cv=w;this.dr(w,h);if(this.B.type=='histogram'&&this.B.useBarAutosize){this.H[0]=this.cv;this.dW();}};this.dr=function(w,h){var e=document.getElementById(id);e.style.width=w+'px';e.style.height=h+'px';this.aU.width=w;this.aU.height=h;this.H=[w,h];this.bl();if(this.ab&&this.ab[0]!=null){var aC=this.aK((this.ab[1].index-this.ab[0].index)*this.aa);var G=this.I.getBuffer(aC);if(G&&G.size>0){this.iC(aC);}}this.V();};this.setSpanSimple=function(span,L){var aA=((new Date()).getTime()/1000)|0;var start=aA-span;if(span<=86400){start=Math.floor(aA/span)*span;}var end=Math.ceil(aA/ESpans.DAY)*ESpans.DAY;this.setSpan(start,end,L);};this.setSpan=function(start,end,L){if(this.bn==true){return;}if(end<start){throw "invalid bO specified!";}var aC=L;if(typeof L=='undefined'||L===null){aC=this.aK(end-start);}this.aa=aC;this.bn=true;this.ed=[start,end];var R=this;this.I.requestData(start,end,aC,function(s,e,i){R.fm(s,e,i);});};this.fm=function(start,end,L){if(start===false||end===false||L===false){this.bn=false;if(L!==false&&this.aa<ESpans.DAY){var span=this.I.getAvailableSpan();if(span[1]-span[0]>0){var start=Math.floor(span[1]/ESpans.DAY)*ESpans.DAY;this.setSpan(start,start+ESpans.DAY);}else{var b=this.I.getBuffer(ESpans.DAY);if(!b||b.size==1){this.setSpanSimple(ESpans.WEEK);}}}return;}var G=this.I.getBuffer(L);var cH=G.findSpan(start,end);var aC=this.aK(((cH[1].index-cH[0].index)+1)*L);if(aC<ESpans.DAY&&L>=ESpans.DAY){var G=this.I.getBuffer(aC);if(G&&G.begin&&G.begin.timestamp<=cH[0].timestamp){L=aC;}}else{L=aC;}this.aa=L;var R=this;this.T=this.I.getBuffer(this.aa);this.ab=this.T.findSpan(start,end);this.bd=this.T.end.close;if(this.B.type=='histogram'&&this.B.useBarAutosize){this.H[0]=this.cv;}this.es(true);this.fQ();if(this.B.type!='histogram'|| !this.B.useBarAutosize|| !this.dW(true)){this.bl();}this.bn=false;};this.dJ=function(cP){if(!this.ab[0]){return;}if(cP&&this.ab[1].next==this.T.end){this.ab[1]=this.ab[1].next;}this.es();this.dZ();this.fQ();this.dW();this.bl();};this.bi=function(iI,hv){if(bR(this.ab[1],this.aa)==bR(iI,this.aa)){this.ab[1]=bR(hv,this.aa);}this.es();this.dZ();this.fQ();this.dW();this.bl();};this.fQ=function(){if(!this.T||this.T.size==0){this.aU.title='';}else{var c=this.T.end.close;var h=this.bw[1].high;var l=this.bw[0].low;this.aU.title='Close: '+c+' | '+'Low: '+l+' | '+'High: '+h;}};this.dZ=function(){var cK=this.T.end.close;if(cK>this.bd){this.at[0]=1;}else if(cK<this.bd){this.at[0]= -1;}else{this.at[0]=0;}if(this.bW!==null){clearTimeout(this.bW);}var R=this;if(this.bC===null){this.bC=setInterval(function(){R.at[1]=(R.at[1]+1)%2;R.bl();},200);}this.bW=setTimeout(function(){R.at[0]=null;clearInterval(R.bC);R.bC=null;R.bl();},1000);};this.es=function(complete){var start=0;if(this.T==null||this.T.size==0){this.av=[null,null];this.bw=[null,null];}else{this.av=[this.T.low,this.T.high];if(complete){var low,high,A;A=low=high=this.T.begin;while(A){if(A.low<low.low){low=A;}if(A.high>high.high){high=A;}A=A.next;}this.bw=[low,high];}else{if(this.T.end.low<this.bw[0].low){this.bw[0]=this.T.end;}if(this.T.end.high>this.bw[1].high){this.bw[1]=this.T.end;}}}};this.iC=function(L){if(L==this.aa){return;}this.aa=L;if(this.T&&this.ab&&this.ab[0]){var jp=this.T;this.T=this.I.getBuffer(this.aa);if(this.T&&this.T.size>0){this.ab=this.T.findSpan(this.ab[0].timestamp,this.ab[1].timestamp);this.bd=this.T.end.close;this.es(true);}else{this.T=null;}}};this.dW=function(){if(!this.T|| !this.ab[0]){return;}var ax=this.bX();var cQ=0;var n=((this.ab[1].index-this.ab[0].index)+1);if(ax<this.B.minBarWidth){cQ=this.B.minBarWidth-ax;}else if(ax>this.B.maxBarWidth){cQ=this.B.maxBarWidth-ax;}else{cQ=(Math.round(ax)-ax);if(this.H[0]+n*cQ>this.cv){cQ=(Math.floor(ax)-ax);}}if(cQ!=0){var w=this.H[0]+n*cQ;if(w>this.cv){this.dr(this.cv,this.H[1]);}else{this.dr(w,this.H[1]);this.dW();}return true;}return false;};this.aK=function(span){var w=2;var width=this.H[0]-(this.B.margins[0]+this.B.margins[2]);var am=[ESpans.MONTH,ESpans.WEEK,ESpans.DAY,ESpans.HOUR,ESpans.THIRTY_MINUTES,ESpans.FIFTEEN_MINUTES,ESpans.FIVE_MINUTES,ESpans.MINUTE];var n=0;for(var i=am.length;i>=0;i--){n=span/am[i];if(am[i]<span&&width/n>=w){return am[i];}}if(span>86400){return ESpans.MONTH;}else{return ESpans.HOUR;}};this.aj=function(value){var n=(this.ab[1].index-this.ab[0].index)+1;var step=((this.H[0]-this.B.margins[1]-this.B.margins[3]))/n;return this.B.margins[3]+((value*step)|0);};this.ae=function(value){var height=this.H[1]-this.B.margins[0]-this.B.margins[2];return(this.B.margins[0]+(1-((value-this.av[0].low)/(this.av[1].high-this.av[0].low)))*height);};this.bX=function(i){var n=(this.ab[1].index-this.ab[0].index)+1;var step=(this.H[0]-this.B.margins[1]-this.B.margins[3])/n;if(typeof i!="number"){return step;}return((step*(i+1))|0)-((step*(i))|0);};this.bl=function(){var c=this.bj;c.clearRect(0,0,this.H[0],this.H[1]);var da=this.av[1].high-this.av[0].low;if(!this.T||da<=0){return;}var end=this.T.end;var low=this.bw[0];var high=this.bw[1];var bp=this.aj(end);var gd=this.aj(low.index);var fo=this.aj(high.index);if(this.B.type=='line'){c.strokeStyle=this.B.lineColor;var s= -1;var A=this.T.begin;var A=this.ab[0];while(A&&A.prev!=this.ab[1]){x=pc(this.aj(A.index-this.ab[0].index));y=pc(this.ae(A.close));if(A==end){bp=x;}else if(A==low){y=pc(this.ae(A.low));gd=x;}else if(A==high){y=pc(this.ae(A.high));fo=x;}if(A==this.ab[0]){c.moveTo(x,y);}else{c.lineTo(x,y);}s=x;A=A.next;}c.stroke();c.fillStyle=this.B.delimiterColor;if(this.B.showOpen){c.beginPath();c.arc(this.aj(0),this.ae(this.T.begin.open),this.B.pointSize,0,6.28,false);c.fill();}if(this.B.showClose){if(this.at[0]===null){c.beginPath();c.arc(this.aj(end.index),this.ae(this.T.end.close),this.B.pointSize,0,6.28,false);c.fill();}}}else if(this.B.type=='histogram'){var offset=null;if(this.en){offset=this.en;}else{offset=this.I.getPreviousClose().close;}var offsetY=this.ae(offset)|0;var ax=this.bX();var v=0;var x,y,az,w,s= -1;var jg=0;var space=ax>=2;var A=this.ab[0];while(A&&A.prev!=this.ab[1]){v=A.close;x=this.aj(A.index-this.ab[0].index);y=this.ae(v)|0;w=this.bX(A.index-this.ab[0].index);if(w<=0){A=A.next;continue;}if((x|0)<=s+1){A=A.next;continue;}if(A==end){bp=x+(w/2);}else if(A==low){v=A.low;y=pc(this.ae(A.low));gd=x+(w/2);}else if(A==high){v=A.high;y=pc(this.ae(A.high));fo=x+(w/2);}if(v<=offset){c.fillStyle=this.B.negativeBarColor;c.strokeStyle=this.B.negativeBarColor;h=y-offsetY+1;az=offsetY;}else{c.fillStyle=this.B.positiveBarColor;c.strokeStyle=this.B.positiveBarColor;h=offsetY-y+1;az=y;}if(w>1&&space>0){w-=1;}c.beginPath();if(h>=1&&w>=1){c.rect(x|0,az,w|0,h);c.fill();}else{if(h==1){y+=1;}x=pc(x);c.moveTo(pc(x),pc(offsetY));c.lineTo(pc(x+(w-1)),pc(y));c.stroke();}s=x;A=A.next;}}if(this.B.type=='line'){c.fillStyle=this.B.hF;if(this.B.showLow){c.beginPath();c.arc(gd,this.ae(low.low),this.B.pointSize,0,6.28,false);c.fill();}if(this.B.showHigh){c.beginPath();c.arc(fo,this.ae(high.high),this.B.pointSize,0,6.28,false);c.fill();}}if(this.at[0]!==null){switch(this.at[0]){case 0:c.fillStyle=this.B.neutralFlashColor;break;case 1:c.fillStyle=this.B.upFlashColor;break;case-1:c.fillStyle=this.B.downFlashColor;break;}c.beginPath();c.arc(bp,this.ae(end.close),this.B.pointSize+this.at[1]*2,0,6.28,false);c.fill();}};this.setSource(new ChartSource(instrumentId,exchangeId,quoteSource));this.bl();};function ChartStyle(){this.showHGrid=false;this.showVGrid=false;this.showMarkers=true;this.showCursor=true;this.showInformation=true;this.showXLabels=true;this.showYLabels=true;this.navBarAreaColor='#0000ff';this.navBarLineColor='#ff0000';this.navBarHandleColor='#ffff00';this.navBarBackgroundColor='#00ff00';this.inactiveColor='rgba(100,100,100,0.1)';this.offset=50;this.candleSpacing=4;this.pointSpacing=2;this.labelSpacing=50;this.xAxisOnTop=true;this.yAxisInside=true;this.hh='mountain';this.candleColor='rgba(101,80,7,1)';this.sliderColor='#ffffff';this.lineColor='rgba(202,165,14,1)';this.indicatorColor=['rgba(202,0,0,1)','rgba(0,202,0,1)','rgba(0,0,202,1)','rgba(202,0,202,1)'];this.benchmarkColor=['rgba(202,0,0,1)','rgba(0,202,0,1)','rgba(0,0,202,1)','rgba(202,0,202,1)'];this.bandColor=['rgba(0,0,202,0.15)'];this.mountainColor=['rgba(254,206,16,1)','rgba(254,206,16,0)'];this.lineWidth=1;this.axisColor='rgba(204,204,204,1)';this.backgroundImage=null;this.backgroundColor=null;this.spanLabelColor='rgba(200,200,200,1)';this.spanLabelFontSize=12;this.spanLabelFontFamily='arial';this.spanLabelFontStyle='';this.infoLabelColor='rgba(200,200,200,1)';this.infoLabelFontSize=32;this.infoLabelFontFamily='arial';this.infoLabelFontStyle='';this.legendLabelColor='rgba(200,200,200,1)';this.legendLabelFontSize=16;this.legendLabelFontFamily='arial';this.legendLabelFontStyle='';this.yLabelColor='rgb(0,0,0)';this.xLabelColor='rgb(0,0,0)';this.xLabelFontSize=12;this.xLabelFontFamily='arial';this.xLabelFontStyle='';this.yLabelFontSize=12;this.yLabelFontFamily='arial';this.yLabelFontStyle='';this.volumeColor='#dddddd';this.volumeUpColor='rgb(0,255,0)';this.volumeDownColor='rgb(255,0,0)';this.candleUpColor='rgb(0,255,0)';this.candleDownColor='rgb(255,0,0)';this.flashUpColor='rgba(0,255,0,0.25)';this.flashDownColor='rgba(255,0,0,0.25)';this.lineFlashUpColor='rgba(0,255,0,1)';this.lineFlashDownColor='rgba(255,0,0,1)';this.vGridColor='rgba(200,200,200,0.5)';this.hGridColor='rgb(200,200,200)';this.referenceLineColor='#aaaaaa';this.markerFontColorClose='rgb(0,0,0)';this.markerColorClose='rgb(150,150,150)';this.markerFontSizeClose=12;this.markerFontFamilyClose='arial';this.markerFontStyleClose='bolder';this.markerFontColorUp='rgb(0,0,0)';this.markerColorUp='rgb(0,255,0)';this.markerFontSizeUp=10;this.markerFontFamilyUp='arial';this.markerFontStyleUp='';this.markerFontColorDown='rgb(0,0,0)';this.markerColorDown='rgb(255,0,0)';this.markerFontSizeDown=10;this.markerFontFamilyDown='arial';this.markerFontStyleDown='';this.markerFontColor='rgb(0,0,0)';this.markerColor='rgb(255,255,0)';this.markerFontSize=12;this.markerFontFamily='arial';this.markerFontStyle='bolder';this.markerFontColorCursorY='rgb(255,255,255)';this.markerColorCursorY='rgb(255,0,0)';this.markerFontSizeCursorY=14;this.markerFontFamilyCursorY='arial';this.markerFontStyleCursorY='bolder';this.markerFontColorCursorX='rgb(255,255,255)';this.markerColorCursorX='rgb(255,0,0)';this.markerFontSizeCursorX=14;this.markerFontFamilyCursorX='arial';this.markerFontStyleCursorX='bolder';this.cursorColor='rgba(255,0,0,0.2)';this.xAxisMargins=[5,50];this.yAxisMargins=[20,20];};function dR(t,v){this.value=v;this.timestamp=t;};dR.prototype.value=0;dR.prototype.timestamp=0;dR.prototype.index=0;function fI(){};fI.prototype.aS=null;fI.prototype.ci=function(chart,offset,begin,end){};ToolLine=function(t,v){this.aS=[];var h=new dR(t,v);this.aS.push(h);h=new dR(t,v);this.aS.push(h);};ToolLine.prototype=fI.prototype;ToolLine.prototype.ci=function(chart,offset,begin,end){var c=chart.bj;c.strokeStyle='#000000';c.beginPath();c.moveTo(chart.aj(this.aS[0].index-offset.index),chart.ae(this.aS[0].value));c.lineTo(chart.aj(this.aS[1].index-offset.index),chart.ae(this.aS[1].value));c.stroke();};function pc(v){return(v|0)+0.5;};function bz(o,n){if(n>0){for(var i=0;i<n;i++){if(!o.next){break;}o=o.next;}}else{for(var i=n;i<0;i++){if(!o.prev){break;}o=o.prev;}}return o;};function dT(number,iz,gV,gp){var n=number,cA=iz;n= !isFinite(+n)?0: +n;cA= !isFinite(+cA)?0:Math.abs(cA);var iM=(typeof gp=="undefined")?',':gp;var gR=(typeof gV=="undefined")?'.':gV;var s=(cA>0)?n.toFixed(cA):Math.round(n).toFixed(cA);var abs=Math.abs(n).toFixed(cA);var _,i;if(abs>=1000){_=abs.split(/\D/);i=_[0].length%3||3;_[0]=s.slice(0,i+(n<0))+_[0].slice(i).replace(/(\d{3})/g,iM+'$1');s=_.join(gR);}else{s=s.replace('.',gR);}return s;};function fG(set,source,allowScroll){this._gradient=null;this.C=set;this.aI='candle';this._content=1;this.fe=set.B.showMarkers;this.fd=set.B.showInformation;this.eq=set.B.showXLabels;this.ee=set.B.showYLabels;this.dQ=set.B.showCursor;this.dk=true;this.cR=null;this.bj=set.gB();this.I=source;this.at=0;this.bW=null;this.bC=null;this.fp=0;this.bd=(source.G&&source.G.end)?source.G.end.close:0;this.H=200;this.bP=[set.B.yAxisMargins[0],set.B.yAxisMargins[1]];this.dV=null;this.aG=50;this.av=[0,0];this.cN=2;this.ao=[];this.ac=[];this.aB=[];this.ea=null;this.eb=null;this.eV=[null,null,null,null];this.bo=null;this.gJ=null;this.setYAxisMargins=function(bottom,top){this.bP=[bottom,top];};this.setHeight=function(h){this.H=h;this.C.dn();};this.setType=function(type){if(!(type=='candle'||type=='mountain'||type=='line'||type=='ohlc')){return;}if(type==this.aI){return;}this.aI=type;var i=this.C.aK();if(i!=this.C.aa){this.C.setInterval(i);}else{this.V();}};this.showCursor=function(aq){this.dQ=aq;this.bo=null;this.V();};this.showMarkers=function(aq){this.fe=aq;this.V();};this.showInformation=function(aq){this.fd=aq;this.V();};this.showLabels=function(x,y){this.eq=x;this.ee=y;this.V();};this.showData=function(aq){if(aq===true){this._content=1;}else if(typeof aq=='number'){this._content=aq;}else{this._content=2;}this.eB();this.V();};this.addBenchmark=function(instrumentId,exchangeId,quoteSource){if(this.eb){this.eb=null;}var source=this.C.fh(instrumentId,exchangeId,quoteSource);this.ao.push(source);this.bi();};this.removeBenchmark=function(index){if(index<0||index>=this.ao.length){return;}this.ao.splice(index,1);this.bi();};this.getNumBenchmarks=function(){return this.ao.length;};this.addTool=function(cB){if(this.ao.length>0){return;}this.eb=cB;};this.iu=function(x,y){console.log(x,y);var t=this.gg(x);var v=this.gf(y);var cB=new ToolLine(t,v);for(var i=0;i<cB.aS.length;i++){this.gS(cB.aS[i]);}this.aB.push(cB);return cB.aS[0];};this.removeTool=function(i){if(i<0||i>=this.aB.length){return;}this.aB.splice(i,1);this.V();};this.getNumTools=function(){return this.aB.length;};this.getTool=function(){if(i<0||i>=this.aB.length){return null;}return this.aB[i];};this.getNumIndicators=function(){return this.ac.length;};this.getIndicator=function(i){if(i<0||i>=this.ac.length){return null;}return this.ac[i];};this.getIndicatorColor=function(i){if(i<0){return '';}return this.C.B.indicatorColor[i<this.C.B.indicatorColor.length?i:0];};this.addIndicator=function(type,U,aZ,aV){var object=this.I.source.addIndicator(type,U,aZ,aV);if(!object){return;}for(var j=0;j<this.ac.length;j++){if(this.ac[j]==object){this.I.source.removeIndicator(object);return;}}this.ac.push(object);this.eB();this.V();};this.removeIndicator=function(index){if(index<0||index>=this.ac.length){return;}this.I.source.removeIndicator(this.ac[index]);this.ac.splice(index,1);this.V();};this.isEndVisible=function(end){if(!this.I.G|| !this.I.span){return false;}if(typeof end=='undefined'){return this.I.span[1]&& !this.I.span[1].next;}if(this.I){return bR(end,this.I.G.L)>=bR(this.I.getBuffer(this.I.G.L).getLastTimestamp(),this.I.G.L);}return false;};this._updateStyle=function(){var bp=this.C.H[0];if(this.isEndVisible()){bp=this.aj(this.I.span[1].index-this.I.span[0].index);}this.fe=this.C.B.showMarkers;this.fd=this.C.B.showInformation;this.eq=this.C.B.showXLabels;this.ee=this.C.B.showYLabels;this.dQ=this.C.B.showCursor;if(typeof this.C.B.mountainColor=='string'){this._gradient=this.C.B.mountainColor;}else{this._gradient=this.bj.createLinearGradient(0,this.C.H[0]/2,bp,this.H/2);this._gradient.addColorStop(0,this.C.B.mountainColor[0]);this._gradient.addColorStop(1,this.C.B.mountainColor[1]);}};this.dZ=function(){if(!this.I.span){return;}var cK=this.I.G.end.close;if(!this.bd||cK==this.bd){this.at=0;}else if(cK>this.bd){this.at=1;}else if(cK<this.bd){this.at= -1;}if(this.at!=0){if(this.bW!==null){clearTimeout(this.bW);}var R=this;this.bW=setTimeout(function(){R.dZ();R.V();},(this.iH=='candle'||this.iH=='ohlc')?1000:1500);this.fp=0;if(this.bC===null){this.bC=setInterval(function(){R.fp+=1;R.V();},150);}}else{clearInterval(this.bC);this.bC=null;}this.bd=cK;};this.gy=function(){this.cR=null;this.bd=null;if(this.bW!==null){clearTimeout(this.bW);}if(this.bC!==null){clearInterval(this.bC);}if(this.I.span){this.bi();}};this.bi=function(){if(this.bo){var er=this.gD(this.gJ);this.bo=er;}this.dV=this.bX();this.iv();this.eB();this.dZ();if(this.ao.length==0){var h=null;for(var i=0;i<this.aB.length;i++){for(var j=0;j<this.aB[i].aS.length;j++){this.gS(this.aB[i].aS[j]);}}}return true;};this.df=function(){return[this.C.H[0],this.H];};this.hZ=function(h,x,y){h.index=this.I.span[0].index+this.fk(x);h.timestamp=this.gg(x);h.value=this.gf(y);};this.gS=function(h){h.index=this.hG(h.timestamp);};this.gf=function(y){y-=this.bP[1];var height=this.df()[1]-this.bP[0]-this.bP[1];return(1-(y/height))*(this.av[1]-this.av[0])+this.av[0];};this.hG=function(t){var A=this.I.G.begin;while(A){if(A.timestamp>=t){return A.index;}A=A.next;}return 0;};this.fk=function(x){var n=(this.I.span[1].index-this.I.span[0].index)+1+this.I.ai+this.I.ag;var o= -this.dV*(this.I.offset-this.I.ai);var step=this.C.H[0]/(n-1);return Math.round((x-o)/step);};this.gD=function(x){if(!this.I|| !this.I.span){return null;}var i=this.fk(x)+this.I.span[0].index;var A=this.I.span[0];while(A){if(A.index==i){return A;}A=A.next;}return null;};this.gg=function(x){var i=this.fk(x)+this.I.span[0].index;var A=this.I.span[0];while(A){if(A.index==i){return A.timestamp;}A=A.next;}return 0;};this.bX=function(i){if(!this.I|| !this.I.span){return 1;}var n=(this.I.span[1].index-this.I.span[0].index)+1+this.I.ai+this.I.ag;if(n==1){return this.C.H[0];}var step=this.C.H[0]/(n-1);if(typeof i!="number"){return step;}return((step*(i+1))|0)-((step*(i))|0);};this.aj=function(value){if(!this.I|| !this.I.span){return 1;}var n=(this.I.span[1].index-this.I.span[0].index)+1+this.I.ai+this.I.ag;var o= -this.dV*this.I.offset;o+=this.dV*this.I.ai;var step=(this.C.H[0]-2)/(n-1);return 1+((value*step)|0)+(o|0)+0.5;};this.ae=function(value){var height=this.H-this.bP[0]-this.bP[1];return this.bP[1]+(((1-((value-this.av[0])/(this.av[1]-this.av[0])))*height)|0)+0.5;};this.eB=function(){if(this.I.G===null){return;}var s=this.I.span[0];var e=this.I.span[1];if(s.prev){s=s.prev;};if(e.next){e=e.next;};var A=s;var low=1E+18;var high=0;var i;if(this._content==3){low=0;}var indicators=[];for(var index in this.ac){for(var bm in this.ac[index].id){indicators.push(this.ac[index].id[bm]);}}if(this.ao.length>0){var v=0;if(this._content==1){do{v=(A.close/this.I.relative)*100;if(v<low){low=v;}if(v>high){high=v;}A=A.next;}while(A&&A!=e.next);}for(var i=0;i<this.ao.length;i++){if(!this.ao[i].span){continue;}A=this.ao[i].span[0];e=this.ao[i].span[1];do{v=(A.close/this.ao[i].relative)*100;if(v<low){low=v;}if(v>high){high=v;}A=A.next;}while(A&&A!=e.next);}}else{do{if(this._content==1){if(A.low<low){low=A.low;}if(A.high>high){high=A.high;}}else if(this._content==3){if(A.volume<low){low=A.volume;}if(A.volume>high){high=A.volume;}}for(i in indicators){if(A.indicator[i]===null){continue;}if(A.indicator[i]<low){low=A.indicator[i];}if(A.indicator[i]>high){high=A.indicator[i];}}A=A.next;}while(A&&A!=e.next);}var bO=(high-low)*0.1;if(bO==0){bO=low*0.1;}if(low-bO<0){this.av[0]=0;}else{this.av[0]=low-bO;}this.av[1]=high+bO;};this.iv=function(){if(!this.I|| !this.I.G|| !this.I.G.begin){this.cN=2;return;}var s=this.I.G.begin.close.toString();var p=s.indexOf('.');if(p== -1){p=2;}else{p=(s.length-s.indexOf('.')-1);}if(p>4){p=4;}else if(p<2){p=2;}this.cN=p;};this.V=function(){this.C.V();};this.bl=function(isMoving){var c=this.bj;c.save();c.beginPath();c.rect(0,this.aG,this.C.H[0],this.H);c.clip();c.translate(0,this.aG);var x=0,y=0;var eG=this.df();var da=(this.av[1]-this.av[0]);var s,af,e,ah;if(this.I.G===null|| !this.I.span){s=af=e=ah=null;}else{s=af=this.I.span[0];e=ah=this.I.span[1];while(af&&this.aj(af.index-s.index)<0){af=af.next;}while(ah&&this.aj(ah.index-s.index)>this.C.H[0]){ah=ah.prev;}if(af&&af.prev){af=af.prev;};if(ah&&ah.next){ah=ah.next;};}var eK=this.av[0],jv=this.av[1];var v=0,l=null;var xLabelStep=0;if(!af|| !ah){c.textAlign='center';c.textBaseline='middle';c.font=this.C.B.infoLabelFontStyle+' '+this.C.B.infoLabelFontSize+'px \''+this.C.B.infoLabelFontFamily+'\'';c.fillStyle=this.C.B.infoLabelColor;c.strokeStyle=this.C.B.infoLabelColor;c.fillText(this.C.ec()?'Daten werden geladen':'Keine Daten gefunden',this.C.H[0]/2,this.H/2+50);c.restore();return;}else{var n=0,span=(ah.index-af.index)*this.I.G.L,size=this.df()[0]-(this.I.ai+this.I.offset+this.I.ag)*ax;if(this.I.G.L<86400){n=span/ESpans.HOUR;}else if(this.I.G.L<ESpans.WEEK){n=span/ESpans.WEEK;}else{n=span/ESpans.MONTH;}n=Math.ceil(n);if(n>=1){xLabelStep=1;var io=(this.C.B.xLabelFontSize+this.C.B.labelSpacing);var fit=(this.C.H[0]-this.C.B.xAxisMargins[0]-this.C.B.xAxisMargins[1])/io;xLabelStep=Math.ceil(n/fit);if(xLabelStep<1){xLabelStep=1;}}if(this.C.B.showVGrid&&xLabelStep>0){c.strokeStyle=this.C.B.vGridColor;var A=af;while(A&&A!=ah.next){if(!A.label||(A.labelIndex%xLabelStep!=0)){A=A.next;continue;}x=this.aj(A.index-s.index);c.beginPath();c.moveTo(x,1.5);c.lineTo(x,this.H-1.5);c.stroke();A=A.next;}}var height=this.df()[1]-this.bP[0]-this.bP[1];var yLabels=Math.floor(Math.min(height/(this.C.B.yLabelFontSize+this.C.B.labelSpacing),5));if(yLabels<2&&height/this.C.B.yLabelFontSize>=2){yLabels=2;}var step=da/(yLabels-1);if(da>0&&this.C.B.showHGrid){c.strokeStyle=this.C.B.hGridColor;x=this.C.H[0]-1;v=this.av[0];for(var i=0;i<yLabels;i++){y=this.ae(v);c.beginPath();c.moveTo(0.5,y);c.lineTo(x,y);c.stroke();v+=step;}}}var ax=this.dV;if(this.I.ai>0){c.fillStyle=this.C.B.inactiveColor;c.fillRect(0,0,this.aj(0),this.H);}var fS=this.isEndVisible();if(this._content==1){if((this.aI=='candle'||this.aI=='ohlc')&&this.at!=0&&fS){x=this.aj(e.index-s.index);if(this.at<0){c.fillStyle=this.C.B.flashDownColor;}else{c.fillStyle=this.C.B.flashUpColor;}c.fillRect(x-ax/2,0,ax,this.df()[1]);}}if(this.ao.length>0){c.lineWidth=this.C.B.lineWidth;var b=null;for(var i=0;i<this.ao.length;i++){if(this.C.B.benchmarkColor.length<=i){c.strokeStyle=this.C.B.benchmarkColor[this.C.B.benchmarkColor.length-1];}else{c.strokeStyle=this.C.B.benchmarkColor[i];}b=this.ao[i];if(!b.span){continue;}c.beginPath();var begin=b.span[0],end=b.span[1];if(begin.prev){begin=begin.prev;}if(end.next){end=end.next;}var A=af,bI=begin;var first=false;while(A&&A!=ah.next){while(bI.next&&bI.next.timestamp<=A.timestamp){bI=bI.next;}if(bI.timestamp<=A.timestamp){x=this.aj(A.index-s.index);y=this.ae((bI.close/b.relative)*100);if(!first){c.moveTo(x,y);first=true;}else{c.lineTo(x,y);}}A=A.next;}c.stroke();}}if(this.ao.length==0&&this.aB.length>0){var h=null;for(var i=0;i<this.aB.length;i++){this.aB[i].ci(this,s,af,ah);c.fillStyle='#000000';for(var j=0;j<this.aB[i].aS.length;j++){h=this.aB[i].aS[j];c.beginPath();c.arc(this.aj(h.index-s.index),this.ae(h.value),4,0,6.28,false);c.fill();}}}if(af&&ah&&af.index<ah.index){if(this.ac.length>0){c.lineWidth=2;var i;for(var j=0;j<this.ac.length;j++){i=this.ac[j].id;this.ac[j].ci(this,s,af,ah);}c.lineWidth=1;}if(this._content==3&&da>0){var base=this.ae(0);var v,x,y,w,bZ,h,gz;var A=af;gz=Math.floor(this.bX()/2);while(A&&A!=ah.next){v=A.volume;x=this.aj(A.index-s.index);y=this.ae(v)|0;w=this.bX(A.index-s.index);if(w<=0){A=A.next;continue;}if(!A.prev||A.close==A.prev.close){c.strokeStyle=c.fillStyle=this.C.B.volumeColor;}else if(A.close>A.prev.close){c.strokeStyle=c.fillStyle=this.C.B.volumeUpColor;}else{c.fillStyle=c.fillStyle=this.C.B.volumeDownColor;}if((x|0)<=bZ+1){A=A.next;continue;}h=base-y;if(w>1){w-=1;}bZ=((x-gz)|0)+0.5;c.beginPath();if(h>=2&&w>=2){c.rect(bZ|0,y,w|0,h+1);c.fill();}else{if(h==1){y=base;}c.moveTo(bZ,y);c.lineTo(bZ+((w-1)|0),base);c.stroke();}A=A.next;}}else if(this._content==1){if(this.ao.length>0){c.lineWidth=this.C.B.lineWidth;c.strokeStyle=this.C.B.lineColor;c.beginPath();var gc=null;var A=af;while(A&&A!=ah.next){x=this.aj(A.index-s.index);y=this.ae((A.close/this.I.relative)*100);if((!A.prev||A.prev.timestamp<this.C.ct)&&A.timestamp>=this.C.ct){gc=A;}if(A==af){c.moveTo(x,y);}else{c.lineTo(x,y);}A=A.next;}c.stroke();if(gc){var bp=this.aj(gc.index-s.index);c.strokeStyle=this.C.B.referenceLineColor;c.beginPath();c.moveTo(bp,1.5);c.lineTo(bp,((this.H-1)|0)+0.5);c.stroke();}}else if(this.aI=='mountain'){var bp=this.C.H[0]-1;var fM=this.aj(0-(s.index-af.index));if(fS){bp=this.aj(e.index-s.index);}c.fillStyle=this._gradient;c.strokeStyle=this.C.B.lineColor;c.lineWidth=this.C.B.lineWidth;for(var i=0;i<2-isMoving;i++){c.beginPath();y=this.H+1;c.moveTo(bp,y);if(af.prev){y=this.ae(af.close);c.lineTo(fM-2,this.H+1);c.lineTo(fM-2,y);}else{c.lineTo(fM,this.H+1);}var A=af;while(A&&A!=ah.next){x=this.aj(A.index-s.index);y=this.ae(A.close);c.lineTo(x,y);A=A.next;}if(!i&& !isMoving){c.fill();}else{c.stroke();}}}else if(this.aI=='line'){c.lineWidth=this.C.B.lineWidth;c.strokeStyle=this.C.B.lineColor;c.beginPath();var A=af;while(A&&A!=ah.next){x=this.aj(A.index-s.index);y=this.ae(A.close);if(A==af){c.moveTo(x,y);}else{c.lineTo(x,y);}A=A.next;}c.stroke();}else if(this.aI=='candle'){var az=0;c.strokeStyle=this.C.B.candleColor;var A=af;while(A&&A!=ah.next){x=this.aj(A.index-s.index);y=this.ae(A.low);az=this.ae(A.high);c.beginPath();c.moveTo(x,y);c.lineTo(x,az);c.stroke();y=this.ae(A.open);az=this.ae(A.close);c.strokeRect(x-2,Math.min(y,az),5,Math.abs(az-y));if(y<az){c.fillStyle=this.C.B.candleDownColor;}else{c.fillStyle=this.C.B.candleUpColor;}c.fillRect(x-2,Math.min(y,az),5,Math.abs(az-y));A=A.next;}}else{var az=0;c.strokeStyle=this.C.B.candleColor;var A=af;while(A&&A!=ah.next){x=this.aj(A.index-s.index);y=this.ae(A.open);az=this.ae(A.close);if(y<az){c.strokeStyle=this.C.B.candleDownColor;}else{c.strokeStyle=this.C.B.candleUpColor;}c.beginPath();c.moveTo(x-5,y);c.lineTo(x,y);c.stroke();c.beginPath();c.moveTo(x,az);c.lineTo(x+5,az);c.stroke();y=this.ae(A.low);az=this.ae(A.high);c.beginPath();c.moveTo(x,y);c.lineTo(x,az);c.stroke();A=A.next;}}if((this.aI=='line'||this.aI=='mountain')&&fS){if(this.at<0){c.strokeStyle=c.fillStyle=this.C.B.lineFlashDownColor;}else if(this.at>0){c.strokeStyle=c.fillStyle=this.C.B.lineFlashUpColor;}else{c.fillStyle=this.C.B.lineColor;}c.beginPath();c.arc(x,y,4,0,6.28,false);c.fill();if(this.at!=0){y-=this.at*4;for(var i=0;i<this.fp%4;i++){c.beginPath();c.moveTo(x-5,y-this.at*(i*3));c.lineTo(x,y-this.at*(5+i*3));c.lineTo(x+5,y-this.at*(i*3));c.stroke();}}}}}y=((this.H-1)|0)+0.5;x=((this.C.H[0]-1)|0)+0.5;if(da>0&&this.ee){var dir=1;if(this.C.B.yAxisInside){dir= -1;c.textAlign='right';}else{c.textAlign='left';}c.textBaseline='middle';c.strokeStyle=this.C.B.axisColor;c.fillStyle=this.C.B.yLabelColor;c.font=this.C.B.yLabelFontStyle+' '+this.C.B.yLabelFontSize+"px '"+this.C.B.yLabelFontFamily+"'";v=this.av[0];var jj=this.C.B.yLabelFontSize/2;for(var i=0;i<yLabels;i++){y=this.ae(v);c.beginPath();c.moveTo(x,y);c.lineTo(x+4*dir,y);c.stroke();c.fillText(dT(v,this.cN,',','.'),x+5*dir,y);v+=step;}}if(this.eq&&xLabelStep>0){y=((this.H-1)|0)+0.5;var h;c.fillStyle=this.C.B.xLabelColor;c.font=this.C.B.xLabelFontStyle+' '+this.C.B.xLabelFontSize+"px '"+this.C.B.xLabelFontFamily+"'";if(this.C.B.xAxisOnTop){y=0;h=eG[1];c.textAlign='right';c.textBaseline='middle';}else{c.textAlign='center';c.textBaseline='top';y=((this.H-1)|0)+0.5;h=12;}var jy= -100;var A=af;while(A&&A!=ah.next){if(!A.label||(A.labelIndex%xLabelStep!=0)){A=A.next;continue;}x=this.aj(A.index-s.index);c.strokeStyle=this.C.B.axisColor;c.beginPath();c.moveTo(x,y);c.lineTo(x,y+4);c.stroke();if(x<this.C.B.xAxisMargins[0]+6){if(x<this.C.B.xAxisMargins[0]){A=A.next;continue;}x=this.C.B.xAxisMargins[0]+6;}else if(x>eG[0]-6-this.C.B.xAxisMargins[1]){if(x>eG[0]-this.C.B.xAxisMargins[1]){A=A.next;continue;}x=eG[0]-6-this.C.B.xAxisMargins[1];}c.save();c.translate(x,y+5);c.rotate(-90*Math.PI/180);c.fillText(A.label,0,0);c.restore();A=A.next;}}if(this.fe==1){if(this.C.B.yAxisInside){dir= -1;c.textAlign='right';}else{c.textAlign='left';}c.textBaseline='middle';var padding=2,fontSize=this.C.B.markerFontSize,aW=8,dz=0,markerOffset=[0,0];var markerValues=[this.bd,this.I.G.high.high,this.I.G.low.low];var markerColors=[this.C.B.markerColor,this.C.B.markerColorUp,this.C.B.markerColorDown];var markerFontColors=[this.C.B.markerFontColor,this.C.B.markerFontColorUp,this.C.B.markerFontColorDown];var markerFontSizes=[this.C.B.markerFontSize,this.C.B.markerFontSizeUp,this.C.B.markerFontSizeDown];var markerFontFamilies=[this.C.B.markerFontFamily,this.C.B.markerFontFamilyUp,this.C.B.markerFontFamilyDown];var markerFontStyles=[this.C.B.markerFontStyle,this.C.B.markerFontStyleUp,this.C.B.markerFontStyleDown];if(this.at<0){markerColors[0]=markerColors[2];markerFontColors[0]=markerFontColors[2];}else if(this.at>0){markerColors[0]=markerColors[1];markerFontColors[0]=markerFontColors[1];}var dD=this.I.source.getPreviousClose();if(this.I.G.L<ESpans.DAY&&dD!=null){markerValues.push(dD.close);markerColors.push(this.C.B.markerColorClose);markerFontColors.push(this.C.B.markerFontColorClose);markerFontSizes.push(this.C.B.markerFontSizeClose);markerFontFamilies.push(this.C.B.markerFontFamilyClose);markerFontStyles.push(this.C.B.markerFontStyleClose);}else{this.eV[i]=null;}for(var i=markerValues.length-1;i>=0;i--){c.font=markerFontStyles[i]+' '+markerFontSizes[i]+'px \''+markerFontFamilies[i]+'\'';if(this.ao.length>0){markerValues[i]=(markerValues[i]/this.I.relative)*100;}var text=dT(markerValues[i],this.cN,',','.');var eh=c.measureText(text).width;x=((this.C.H[0]-1)|0)+0.5;var w=eh+padding*2,h=markerFontSizes[i]+padding*2;if(markerValues[i]<this.av[0]){y=((this.H-1-(fontSize/2)-padding)|0)+0.5;dz=(h/2);x-=markerOffset[0];markerOffset[0]+=eh+aW+padding*2;}else if(markerValues[i]>this.av[1]){y=(((fontSize/2)+padding)|0)+0.5;dz= -(h/2);x-=markerOffset[1];markerOffset[1]+=eh+aW+padding*2;}else{y=this.ae(markerValues[i]);dz=0;}var bf=((x-5-eh-padding)|0)+0.5,aO=((y-(markerFontSizes[i]/2)-padding)|0)+0.5;c.fillStyle=markerColors[i];if(dir==1){c.fillRect(x+5,y-8,this.C.H[0]-x,16);}else{c.beginPath();c.moveTo(bf-aW,aO+(h/2)+dz);c.lineTo(bf,aO);c.lineTo(bf+w,aO);c.lineTo(bf+w,aO+h);c.lineTo(bf,aO+h);c.lineTo(bf-aW,aO+(h/2)+dz);c.fill();}this.eV[i]=[bf,aO,w,h];c.fillStyle=markerFontColors[i];c.fillText(text,x+5*dir,y);}}if(this.fd){c.textAlign='left';c.textBaseline='bottom';c.strokeStyle='#000';c.font=this.C.B.legendLabelFontStyle+' '+this.C.B.legendLabelFontSize+'px \''+this.C.B.legendLabelFontFamily+'\'';var y=this.H-2-this.C.B.spanLabelFontSize-4-this.C.B.infoLabelFontSize;for(var i=0;i<this.ao.length;i++){if(this.C.B.benchmarkColor.length<=i){c.fillStyle=this.C.B.benchmarkColor[this.C.B.benchmarkColor.length-1];}else{c.fillStyle=this.C.B.benchmarkColor[i];}c.fillRect(13,y-(((this.C.B.legendLabelFontSize/2)-5)|0),10,10);c.strokeRect(13.5,((y-(this.C.B.legendLabelFontSize/2)-5)|0),10,10);c.fillStyle=this.C.B.legendLabelColor;c.fillText(this.ao[i].source.cS,25,y);y-=10;}c.font=this.C.B.infoLabelFontStyle+' '+this.C.B.infoLabelFontSize+'px \''+this.C.B.infoLabelFontFamily+'\'';c.fillStyle=this.C.B.infoLabelColor;c.strokeStyle=this.C.B.infoLabelColor;if(this.fd!=2){var text;if(this.I.source.cS){if(this.cR===null){this.cR=this.I.source.cS.length+1;var w;do{this.cR--;text=this.I.source.cS.substr(0,this.cR)+(this.cR!=this.I.source.cS.length?'...':'')+': '+dT(this.bd,this.cN,',','.');w=c.measureText(text).width;}while(this.C.H[0]-10-this.C.B.offset<w);}else{text=this.I.source.cS.substr(0,this.cR)+(this.cR!=this.I.source.cS.length?'...':'')+': '+dT(this.bd,this.cN,',','.');}}else{text=this.bd.toString();}c.fillText(text,10.5,((this.H-2-this.C.B.spanLabelFontSize-2)|0)+0.5);}c.font=this.C.B.spanLabelFontStyle+' '+this.C.B.spanLabelFontSize+'px \''+this.C.B.spanLabelFontFamily+'\'';text=eT(this.I.span[0].timestamp,0,this.I.G.L)+' - '+eT(this.I.span[1].timestamp,0,this.I.G.L)+' ('+hV(this.I.G.L)+')';c.fillText(text,10.5,((this.H-2)|0)+0.5);}if(!this.C.eo&&this.dQ==1&&this.bo){c.font=this.C.B.markerFontStyleCursorX+' '+this.C.B.markerFontSizeCursorX+'px \''+this.C.B.markerFontFamilyCursorX+'\'';var label=strftime(this.bo.timestamp,this.I.source.getFormatString(this.I.G.L));var h=this.C.B.markerFontSizeCursorX+8;var w=c.measureText(label).width+4,eP=(w/2)|0;var aW=8;var value=this._content==3?this.bo.volume:this.bo.close;if(this.ao.length>0){value=(this.bo.close/this.I.relative)*100;}x=this.aj(this.bo.index-s.index);y=this.ae(value);c.textBaseline='middle';c.strokeStyle=this.C.B.cursorColor;c.beginPath();c.moveTo(x,0.5);c.lineTo(x,((this.H-1)|0)+0.5);c.stroke();c.fillStyle=this.C.B.markerColorCursorX;c.textAlign='center';c.beginPath();c.moveTo(x,0.5+3);c.lineTo(x-(aW/2),3.5+aW);c.lineTo(x-eP,3.5+aW);c.lineTo(x-eP,3.5+aW+h);c.lineTo(x+eP,3.5+aW+h);c.lineTo(x+eP,3.5+aW);c.lineTo(x+(aW/2),3.5+aW);c.lineTo(x,3.5);c.fill();c.fillStyle=this.C.B.markerFontColorCursorX;c.fillText(label,x,3+aW+(h/2));if(this.aI=='line'||this.aI=='mountain'){c.fillStyle=this.C.B.lineColor;c.beginPath();c.arc(x,y,4,0,6.28,false);c.fill();}c.font=this.C.B.markerFontStyleCursorY+' '+this.C.B.markerFontSizeCursorY+'px \''+this.C.B.markerFontFamilyCursorY+'\'';var text=dT(value,this.cN,',','.');h=this.C.B.markerFontSizeCursorY+8;w=c.measureText(text).width+4;y-=h/2;c.fillStyle=this.C.B.markerColorCursorY;c.beginPath();if(x<this.C.H[0]/2){x+=14;c.moveTo(x-aW,y+(h/2));c.lineTo(x,y);c.lineTo(x+w,y);c.lineTo(x+w,y+h);c.lineTo(x,y+h);c.closePath();}else{x-=w+14;c.moveTo(x+w+aW,y+(h/2));c.lineTo(x+w,y);c.lineTo(x,y);c.lineTo(x,y+h);c.lineTo(x+w,y+h);c.closePath();}c.fill();c.textAlign='left';c.fillStyle=this.C.B.markerFontColorCursorY;c.fillText(text,x+2,y+(h/2));}c.strokeStyle=this.C.B.axisColor;y=((this.H-1)|0)+0.5;x=((this.C.H[0]-1)|0)+0.5;c.beginPath();c.moveTo(0.5,y);c.lineTo(x,y);c.stroke();c.beginPath();c.moveTo(0.5,0.5);c.lineTo(x,0.5);c.stroke();c.beginPath();c.moveTo(x,0.5);c.lineTo(x,y);c.stroke();c.beginPath();c.moveTo(0.5,0.5);c.lineTo(0.5,y);c.stroke();c.restore();};this.cY=null;this.dq=[0,0];this.bB=function(e,button,layerX,layerY){switch(e.type){case 'mouseup':if(button==this.cY){this.cY=null;this.C.dp(false);}break;}if(!this.C.ec()){switch(e.type){default:return;case 'mouseout':this.cY=null;this.bo=null;this.V();break;case 'DOMMouseScroll':case 'mousewheel':var cf=0;if(e.wheelDelta){cf=e.wheelDelta/120;if(window.opera){cf= -cf;}}else if(e.detail){cf= -e.detail/2;}cf=cf<0? -1:1;var l=cf,r= -cf;var p=this.df();var ax=this.bX();var s=Math.ceil((p[0]/ax)*0.1);l*=s;r*=s;if(this.I.ag>=(this.C.B.offset/ax)&&this.isEndVisible()){r=0;}this.C.zoom(l,r);break;case 'mouseup':this.ea=null;this.cY=null;this.C.dp(false);break;case 'mousedown':if(button==1){if(this.eb){this.eb=null;this.ea=this.iu(layerX,layerY-this.aG);}else{var area=null;for(var i=0;i<this.eV.length;i++){area=this.eV[i];if(area==null){continue;}if(layerX>=area[0]&&layerX<=area[0]+area[2]&&layerY-this.aG>=area[1]&&layerY-this.aG<=area[1]+area[3]){var value=null;switch(i){case 0:value=this.I.G.end;break;case 1:value=this.I.G.high;break;case 2:value=this.I.G.low;break;case 3:value=this.I.source.getPreviousClose(this.I.G.L);break;}if(value){this.C.gx(value);}return;}}var cl=null,h=null,x,y;for(var i=0;i<this.aB.length;i++){for(var j=0;j<this.aB[i].aS.length;j++){h=this.aB[i].aS[j];x=this.aj(h.index-this.I.span[0].index);y=this.ae(h.value);if(Math.abs(layerX-x)<=5&&Math.abs(layerY-this.aG-y)<=5){cl=h;break;}}if(cl){break;}}if(cl){this.ea=cl;}else{this.cY=button;this.dq[0]=layerX;this.dq[1]=layerY;this.C.dp(true);}}}break;case 'mousemove':var V=false;if(this.dQ){var er=this.gD(layerX);if(er!=this.bo){this.bo=er;this.gJ=layerX;V=true;}}if(this.ea){this.hZ(this.ea,layerX,layerY-this.aG);V=true;}else if(button==this.cY){var x=layerX-this.dq[0];var y=layerY-this.dq[1];this.dq[0]=layerX;this.dq[1]=layerY;var t=this.bX();this.C.scroll(-(x/t));}if(V){this.V();}break;}}};this.eB();this._updateStyle();};