
FusionCharts.register('module',['private','extensions.jQueryPlugin',function(){var global=this,win=global.window,lib=global.hcLib,doc=win.document,jQ=win.jQuery,renderFusionCharts,captureAllFusionChartsEvents,getChartObjectsFromSelection,configureLinkedCharts,math=win.Math,mathMin=math.min,isArray=lib.isArray,realtimeCommandMap={feed:'feedData',setdata:'setData',setdataforid:'setDataForId',getdata:'getData',getdataforid:'getDataForId',clear:'clearChart',stop:'stopUpdate',start:'restartUpdate'},optionsParser={feedData:function(options){if(typeof options==='string'){return[options];}
else if(typeof options==='object'&&options.stream){return[options.stream];}
else{return false;}},getData:function(options){if(!isNaN(options)){return[options];}
else if(typeof options==='object'&&options.index){return[options.index];}
else{return[];}},getDataForId:function(options){if(typeof options==='string'){return[options];}
else if(typeof options==='object'&&options.id){return[options.id];}
else{return[];}},setData:function(options,value,label){var arr=[];if(typeof options!=='object'){arr=[options,value,label];}
else{options.value&&arr.push(options.value);options.label&&arr.push(options.label);}
return arr;},setDataForId:function(options,value,label){var arr=[];if(typeof options==='string'||typeof value==='string'||typeof label==='string'){arr=[options,value,label];}
else if(typeof options==='object'){options.value&&arr.push(options.value);options.label&&arr.push(options.label);}
return arr;},clearChart:function(options){return[options];},stopUpdate:function(options){return[options];},restartUpdate:function(options){return[options];}};jQ.FusionCharts=global.core;renderFusionCharts=function(elemList,chartOptions){var i,l,cO,chartObj,scriptElement;if(isArray(chartOptions)||chartOptions instanceof jQ){l=mathMin(elemList.length,chartOptions.length);}
else{l=elemList.length;}
for(i=0;i<l;i+=1){if(isArray(chartOptions)||chartOptions instanceof jQ){cO=chartOptions[i];}else{cO=chartOptions;}
if(elemList[i].parentNode){global.core.render(jQ.extend({},cO,{renderAt:elemList[i]}));}else{chartObj=new FusionCharts(jQ.extend({},cO,{renderAt:elemList[i]}));if(!jQ.FusionCharts.delayedRender){jQ.FusionCharts.delayedRender={};}
jQ.FusionCharts.delayedRender[chartObj.id]=elemList[i];scriptElement=doc.createElement('script');scriptElement.setAttribute('type','text/javascript');if(/msie/i.test(win.navigator.userAgent)&&!win.opera){scriptElement.text='FusionCharts.items[\''+chartObj.id+'\'].render();';}else{scriptElement.appendChild(doc.createTextNode('FusionCharts.items[\''+chartObj.id+'\'].render()'));}
elemList[i].appendChild(scriptElement);}}
return elemList;};captureAllFusionChartsEvents=function(event,args){var containerElement;jQ.extend(event,jQ.Event('fusioncharts'+event.eventType));if(event.sender&&event.sender.options){containerElement=event.sender.options.containerElement||event.sender.options.containerElementId;if(typeof containerElement==='object'){jQ(containerElement).trigger(event,args);}
else if(jQ('#'+containerElement).length){jQ('#'+containerElement).trigger(event,args);}
else{jQ(doc).trigger(event,args);}}else{jQ(doc).trigger(event,args);}};global.addEventListener('*',captureAllFusionChartsEvents);getChartObjectsFromSelection=function(obj){return obj.filter(':FusionCharts').add(obj.find(':FusionCharts'));};configureLinkedCharts=function(chartObjects,linkConfigObj,level){if(typeof linkConfigObj==='object'){chartObjects.each(function(){this.configureLink(linkConfigObj,level);});}};jQ.fn.insertFusionCharts=function(options){return renderFusionCharts(this,options);};jQ.fn.appendFusionCharts=function(options){options.insertMode='append';return renderFusionCharts(this,options);};jQ.fn.prependFusionCharts=function(options){options.insertMode='prepend';return renderFusionCharts(this,options);};jQ.fn.attrFusionCharts=function(attr,attrVal){var transfer=[],chartObjects=getChartObjectsFromSelection(this);if(attrVal!==undefined){chartObjects.each(function(){this.FusionCharts.setChartAttribute(attr,attrVal);});return this;}
if(typeof attr==='object'){chartObjects.each(function(){this.FusionCharts.setChartAttribute(attr);});return this;}
chartObjects.each(function(){transfer.push(this.FusionCharts.getChartAttribute(attr));});return transfer;};jQ.fn.updateFusionCharts=function(options){var filterOpts={},chartObjects=getChartObjectsFromSelection(this),updateOptions=[['swfUrl',false],['type',false],['height',false],['width',false],['containerBackgroundColor',true],['containerBackgroundAlpha',true],['dataFormat',false],['dataSource',false]],i,l,fcChart,renderFlag,optStr,newChart;for(i=0,l=updateOptions.length;i<l;i+=1){optStr=updateOptions[i][0];filterOpts.type=filterOpts.type||filterOpts.swfUrl;if(options[optStr]){if(updateOptions[i][1]){renderFlag=true;}
filterOpts[optStr]=options[optStr];}}
chartObjects.each(function(){fcChart=this.FusionCharts;if(renderFlag){newChart=fcChart.clone(filterOpts);newChart.render();return;}
if(filterOpts.dataSource!==undefined||filterOpts.dataFormat!==undefined){if(filterOpts.dataSource===undefined){fcChart.setChartData(fcChart.args.dataSource,filterOpts.dataFormat);}else if(filterOpts.dataFormat===undefined){fcChart.setChartData(filterOpts.dataSource,fcChart.args.dataFormat);}else{fcChart.setChartData(filterOpts.dataSource,filterOpts.dataFormat);}}
if(filterOpts.width!==undefined||filterOpts.height!==undefined){fcChart.resizeTo(filterOpts.width,filterOpts.height);}
if(filterOpts.type){fcChart.chartType(filterOpts.type);}});return this;};jQ.fn.cloneFusionCharts=function(callback,options){var transfer,temp,chartObjects;if(typeof callback!=='function'&&typeof options==='function'){temp=callback;callback=options;options=temp;}
transfer=[];chartObjects=getChartObjectsFromSelection(this);chartObjects.each(function(){transfer.push(this.FusionCharts.clone(options,{},true));});callback.call(jQ(transfer),transfer);return this;};jQ.fn.disposeFusionCharts=function(){var chartObjects=getChartObjectsFromSelection(this);chartObjects.each(function(){this.FusionCharts.dispose();delete this.FusionCharts;if(this._fcDrillDownLevel===0){delete this._fcDrillDownLevel;}});return this;};jQ.fn.convertToFusionCharts=function(chartOpts,convertOpts){var transferObj=[];if(typeof chartOpts.dataConfiguration==='undefined'){chartOpts.dataConfiguration={};}
jQ.extend(true,chartOpts.dataConfiguration,convertOpts);if(!chartOpts.dataSource){chartOpts.dataSource=this.get(0);}
if(!chartOpts.renderAt){this.each(function(){transferObj.push(jQ('<div></div>').insertBefore(this).insertFusionCharts(chartOpts).get(0));});}
else{if(typeof chartOpts.renderAt==='string'){transferObj.push(jQ('#'+chartOpts.renderAt).insertFusionCharts(chartOpts).get(0));}
else if(typeof chartOpts.renderAt==='object'){transferObj.push(jQ(chartOpts.renderAt).insertFusionCharts(chartOpts).get(0));}}
return jQ(transferObj);};jQ.fn.drillDownFusionChartsTo=function(){var chartObjects=getChartObjectsFromSelection(this),j,len,i,l,configureOpts;if(typeof this._fcDrillDownLevel==='undefined'){this._fcDrillDownLevel=0;}
for(j=0,len=arguments.length;j<len;j+=1){configureOpts=arguments[j];if(isArray(configureOpts)){for(i=0,l=configureOpts.length;i<l;i+=1){configureLinkedCharts(chartObjects,configureOpts[i],this._fcDrillDownLevel);this._fcDrillDownLevel+=1;}}else{configureLinkedCharts(chartObjects,configureOpts,this._fcDrillDownLevel);this._fcDrillDownLevel+=1;}}
return this;};jQ.fn.streamFusionChartsData=function(command,options,value,label){var chartObjects=getChartObjectsFromSelection(this),transfer=[],fcChart,method,params;method=realtimeCommandMap[command&&command.toLowerCase()];if(method===undefined){if(arguments.length===1){params=[command];method=realtimeCommandMap.feed;}
else{return this;}}
else if(arguments.length===1){params=[];}
else{params=optionsParser[method](options,value,label);}
if(method==='getData'||method==='getDataForId'){chartObjects.each(function(){fcChart=this.FusionCharts;if(typeof fcChart[method]==='function'){transfer.push(fcChart[method].apply(fcChart,params));}});return transfer;}
else{chartObjects.each(function(){fcChart=this.FusionCharts;if(typeof fcChart[method]==='function'){fcChart[method].apply(fcChart,params);}});return this;}};jQ.extend(jQ.expr[':'],{FusionCharts:function(obj){return(obj.FusionCharts instanceof global.core);}});}]);