/*
 Highstock JS v1.0.1 (2011-10-25)
 Exporting module

 (c) 2010-2011 Torstein H?nsi

 License: www.highcharts.com/license
*/
(function(){var i=Highcharts,z=i.Chart,C=i.addEvent,s=i.createElement,A=i.discardElement,u=i.css,v=i.merge,p=i.each,q=i.extend,D=Math.max,r=document,E=window,B=r.documentElement.ontouchstart!==undefined,x=i.getOptions();q(x.lang,{downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",exportButtonTitle:"Export to raster or vector image",printButtonTitle:"Print the chart"});x.navigation={menuStyle:{border:"1px solid #A0A0A0",
background:"#FFFFFF"},menuItemStyle:{padding:"0 5px",background:"none",color:"#303030",fontSize:B?"14px":"11px"},menuItemHoverStyle:{background:"#4572A5",color:"#FFFFFF"},buttonOptions:{align:"right",backgroundColor:{linearGradient:[0,0,0,20],stops:[[0.4,"#F7F7F7"],[0.6,"#E3E3E3"]]},borderColor:"#B0B0B0",borderRadius:3,borderWidth:1,height:20,hoverBorderColor:"#909090",hoverSymbolFill:"#81A7CF",hoverSymbolStroke:"#4572A5",symbolFill:"#E0E0E0",symbolStroke:"#A0A0A0",symbolX:11.5,symbolY:10.5,verticalAlign:"top",
width:24,y:10}};x.exporting={type:"image/png",url:"http://export.highcharts.com/",width:800,buttons:{exportButton:{symbol:"exportIcon",x:-10,symbolFill:"#A8BF77",hoverSymbolFill:"#768F3E",_id:"exportButton",_titleKey:"exportButtonTitle",menuItems:[{textKey:"downloadPNG",onclick:function(){this.exportChart()}},{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},{textKey:"downloadSVG",
onclick:function(){this.exportChart({type:"image/svg+xml"})}}]},printButton:{symbol:"printIcon",x:-36,symbolFill:"#B5C9DF",hoverSymbolFill:"#779ABF",_id:"printButton",_titleKey:"printButtonTitle",onclick:function(){this.print()}}}};q(z.prototype,{getSVG:function(b){var c=this,a,f,d,g=v(c.options,b);if(!r.createElementNS)r.createElementNS=function(e,h){var j=r.createElement(h);j.getBBox=function(){return i.Renderer.prototype.Element.prototype.getBBox.apply({element:j})};return j};b=s("div",null,{position:"absolute",
top:"-9999em",width:c.chartWidth+"px",height:c.chartHeight+"px"},r.body);q(g.chart,{renderTo:b,forExport:true});g.exporting.enabled=false;g.chart.plotBackgroundImage=null;g.series=[];p(c.series,function(e){d=v(e.options,{animation:false,showCheckbox:false,visible:e.visible});if(!d.isInternal){if(d&&d.marker&&/^url\(/.test(d.marker.symbol))d.marker.symbol="circle";g.series.push(d)}});a=new Highcharts.Chart(g);p(["xAxis","yAxis"],function(e){p(c[e],function(h,j){var n=a[e][j],k=h.getExtremes(),m=k.userMin;
k=k.userMax;if(m!==void 0||k!==void 0)n.setExtremes(m,k,true,false)})});f=a.container.innerHTML;g=null;a.destroy();A(b);f=f.replace(/zIndex="[^"]+"/g,"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/isTracker="[^"]+"/g,"").replace(/url\([^#]+#/g,"url(#").replace(/&nbsp;/g,"\u00a0").replace(/&shy;/g,"\u00ad").replace(/id=([^" >]+)/g,'id="$1"').replace(/class=([^" ]+)/g,'class="$1"').replace(/ transform /g," ").replace(/:(path|rect)/g,
"$1").replace(/style="([^"]+)"/g,function(e){return e.toLowerCase()});f=f.replace(/(url\(#highcharts-[0-9]+)&quot;/g,"$1").replace(/&quot;/g,"'");if(f.match(/ xmlns="/g).length===2)f=f.replace(/xmlns="[^"]+"/,"");return f},exportChart:function(b,c){var a,f=this.getSVG(c);b=v(this.options.exporting,b);a=s("form",{method:"post",action:b.url},{display:"none"},r.body);p(["filename","type","width","svg"],function(d){s("input",{type:"hidden",name:d,value:{filename:b.filename||"chart",type:b.type,width:b.width,
svg:f}[d]},null,a)});a.submit();A(a)},print:function(){var b=this,c=b.container,a=[],f=c.parentNode,d=r.body,g=d.childNodes;if(!b.isPrinting){b.isPrinting=true;p(g,function(e,h){if(e.nodeType===1){a[h]=e.style.display;e.style.display="none"}});d.appendChild(c);E.print();setTimeout(function(){f.appendChild(c);p(g,function(e,h){if(e.nodeType===1)e.style.display=a[h]});b.isPrinting=false},1E3)}},contextMenu:function(b,c,a,f,d,g){var e=this,h=e.options.navigation,j=h.menuItemStyle,n=e.chartWidth,k=e.chartHeight,
m="cache-"+b,l=e[m],o=D(d,g),t,y;if(!l){e[m]=l=s("div",{className:"highcharts-"+b},{position:"absolute",zIndex:1E3,padding:o+"px"},e.container);t=s("div",null,q({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},h.menuStyle),l);y=function(){u(l,{display:"none"})};C(l,"mouseleave",y);p(c,function(w){if(w)s("div",{onmouseover:function(){u(this,h.menuItemHoverStyle)},onmouseout:function(){u(this,j)},innerHTML:w.text||e.options.lang[w.textKey]},q({cursor:"pointer"},
j),t)[B?"ontouchstart":"onclick"]=function(){y();w.onclick.apply(e,arguments)}});e.exportMenuWidth=l.offsetWidth;e.exportMenuHeight=l.offsetHeight}b={display:"block"};if(a+e.exportMenuWidth>n)b.right=n-a-d-o+"px";else b.left=a-o+"px";if(f+g+e.exportMenuHeight>k)b.bottom=k-f-o+"px";else b.top=f+g-o+"px";u(l,b)},addButton:function(b){function c(){k.attr(o);n.attr(l)}var a=this,f=a.renderer,d=v(a.options.navigation.buttonOptions,b),g=d.onclick,e=d.menuItems,h=d.width,j=d.height,n,k,m;b=d.borderWidth;
var l={stroke:d.borderColor},o={stroke:d.symbolStroke,fill:d.symbolFill};if(d.enabled!==false){n=f.rect(0,0,h,j,d.borderRadius,b).align(d,true).attr(q({fill:d.backgroundColor,"stroke-width":b,zIndex:19},l)).add();m=f.rect(0,0,h,j,0).align(d).attr({id:d._id,fill:"rgba(255, 255, 255, 0.001)",title:a.options.lang[d._titleKey],zIndex:21}).css({cursor:"pointer"}).on("mouseover",function(){k.attr({stroke:d.hoverSymbolStroke,fill:d.hoverSymbolFill});n.attr({stroke:d.hoverBorderColor})}).on("mouseout",c).on("click",
c).add();if(e)g=function(){c();var t=m.getBBox();a.contextMenu("export-menu",e,t.x,t.y,h,j)};m.on("click",function(){g.apply(a,arguments)});k=f.symbol(d.symbol,d.symbolX,d.symbolY,(d.symbolSize||12)/2).align(d,true).attr(q(o,{"stroke-width":d.symbolStrokeWidth||1,zIndex:20})).add()}}});i.Renderer.prototype.symbols.exportIcon=function(b,c,a){return["M",b-a,c+a,"L",b+a,c+a,b+a,c+a*0.5,b-a,c+a*0.5,"Z","M",b,c+a*0.5,"L",b-a*0.5,c-a/3,b-a/6,c-a/3,b-a/6,c-a,b+a/6,c-a,b+a/6,c-a/3,b+a*0.5,c-a/3,"Z"]};i.Renderer.prototype.symbols.printIcon=
function(b,c,a){return["M",b-a,c+a*0.5,"L",b+a,c+a*0.5,b+a,c-a/3,b-a,c-a/3,"Z","M",b-a*0.5,c-a/3,"L",b-a*0.5,c-a,b+a*0.5,c-a,b+a*0.5,c-a/3,"Z","M",b-a*0.5,c+a*0.5,"L",b-a*0.75,c+a,b+a*0.75,c+a,b+a*0.5,c+a*0.5,"Z"]};z.prototype.callbacks.push(function(b){var c,a=b.options.exporting,f=a.buttons;if(a.enabled!==false)for(c in f)b.addButton(f[c])})})();
