﻿// Scripts for running Fusion Charts
function ShowReport(DataFeed,ChartType,ChartSWF,ChartName,chart,sDataURL)
        {
            //before doing anything detect if we have flash 8 or above
            //this is required for Fusion Charts v3
            
            var f = new FlashSwapper(8);
	        var sNoFlash='You need to install Flash Player 8 or above to view this chart';
	        
	        if(f.DetectFlash()==true)
	        {
	            if(f.version==0)
	            {
	                document.getElementById(ChartName + "Div").innerHTML=sNoFlash;
	                return;
	            }
	            if(f.version < 8)
	            {
	                document.getElementById(ChartName + "Div").innerHTML='You need Flash Player 8 to view this chart you only have ' + f.version;
	                return;
	            }
	        }
	        else
	        {
	            document.getElementById(ChartName + "Div").innerHTML=sNoFlash;
	            return;
	        } 
	        
	
	        //size the charts!
	        //one size for Pies, no size for graphs
	        
	        var iWidth;
            var iHeight;
            
            if(ChartType=="Legend")
            {
                //change width and height if legend!
                iWidth=205;
                iHeight=228;
            }
	        else if(ChartType=="PieWithLegend")
	        {
	            iWidth=245;
                iHeight=228;
	        }
	        else
	        {
	            iWidth=450;
                iHeight=300;
	        }
                        
            var chart = new FusionCharts("FusionCharts/" + ChartSWF, ChartName, iWidth, iHeight, "0", "1");
            chart.setDataURL(escape(sDataURL));
            
            chart.render(ChartName + "Div");
        }
        

