var myChart,mygrid;
var loadingFlash = 0;
function  doOnLoad() {
	try{
	mygrid = new dhtmlXGridObject('gridbox');
	mygrid.setImagePath("codebase2/imgs/");
	mygrid.setHeader("Time,Cisco,Intel,MS");
	mygrid.setInitWidths("200,100,100,100")
	mygrid.setColAlign("left,right,right,right")
	mygrid.setColTypes("ed,ed,ed,ed");
	mygrid.setColSorting("str,int,int,int")
	mygrid.enableMultiselect(true)
	mygrid.init();
	mygrid.loadXML("codebase2/grid.xml");
	window.setTimeout(function(){drawChart()}, 1000)
	}
	catch (err) { window.setTimeout(function(){doOnLoad()}, 1000);};
}

function drawChart() {
	try{
	loadingFlash++;
	var	flyChart = new dhtmlXGridToChartObject('chartbox');
  	flyChart.setLibPath("codebase2/chartlibs/");	
	flyChart.setLib("fly");
	flyChart.setChartType("line");
  	flyChart.setSourceGrid(mygrid);
  	flyChart.setDataColumnIndex("1,2,3");
	flyChart.setChartOption("autoYAxis", ["0", null, "50", "50"]);
	flyChart.setChartOption("xStepWidth", 100);
 	flyChart.setChartOption("showLegend",true);
	flyChart.setChartOption("labelsColInd", "0");
	flyChart.setChartOption("rotation", "on");
	
	flyChart.draw();
	}
	catch (err) {if (loadingFlash < 30) window.setTimeout(function(){drawChart(column)}, 1000);};
}
	
			
function dataReload() {
	var flash =  navigator.appName.indexOf("Microsoft") != -1?window["graph"]:document["graph"];
    	if (flash.length) flash[1].refresh('xmlData.xml');
		else flash.refresh('xmlData.xml');

}