Index: schedule/js/chart.js
===================================================================
--- schedule/js/chart.js	(revision 16615)
+++ schedule/js/chart.js	(revision 16621)
@@ -1,52 +1,112 @@
-$(document).ready(function(){
-		var chart = new Highcharts.Chart({
-        chart: {
-            renderTo: 'container' /* display to div Graph*/
-       },
-        
-        xAxis: {
-		labels: {
-                    rotation: -45,
-                    align: 'right',
-					},
-            categories:["","","","","","","","19:00","20:00","21:00","22:00","23:00","24:00","1:00","2:00","3:00","4:00","5:00","6:00","7:00"]},
-		series:[], /* array of Data  */
-		
-		remove:function()
+function GetData() 
+{
+	//calls the xml request in a loop based on the current sources                
+	var source = ['Mrk 421','Mrk 501'];
+	for (i = 0; i<source.length; i++) 
+	{
+	   // alert (source[i]);
+		GetXMLData(i, source);
+		//$('#data').append('1st'+source);
+	}
+}
+
+function GetXMLData(index, source) 
+{
+   // alert("test XML Data");
+	var XML;
+	//$('#data').append('   xmlData pass'+source+" "+index);
+	XML = new XMLHttpRequest();
+	//NOTE: previous errors on the request was caused by appending "http://www.fact-project.org"
+	XML.open("GET","/smartfact/index.php?source="+escape(source[index])+"&time="+year+"-"+month+"-"+day,true);
+	dataSource = new Array();
+	XML.onload=function() 
+	{
+		if (testXML.status==200)
 		{
-			return false;
-		},
-		
-		 exporting: {							/*--------------------*/
-          buttons: {							/*					  */
-            exportButton: {					/*		Export		  */
-                    menuItems: null,			/*		  to		  */
-                   onclick: function() {		/*			PNG.file  */
-                        this.exportChart();		/*--------------------*/
-                    }
-                }
-            }
-        },
-		
-		plotOptions:
+			alert("request ok");
+			line=testXML.responseText.split('\n');
+			dataSource.push(line);
+			if (dataSource.length == source.length)
+				{
+				   // alert("new datasource");
+				displayXMLData(dataSource, source); //this will be called when the last data from the list is read
+				//$('#data').append('successfully load'+source +""+dataSource);
+				}
+		}
+		else
+			alert("status is " + testXML.status);
+	
+	};
+	XML.send();
+}
+
+function displayXMLData(dataSource, source)
+{
+	var options = 
+	{
+			chart: {
+				renderTo: 'container' /* display to div Graph*/
+				
+			},
+			
+			xAxis: {
+				categories:["12PM","1PM","2PM","3PM","4PM","5PM","6PM","7PM","8PM","9PM","10PM","11PM","12AM","1AM","2AM","3AM","4AM","5AM","6AM","7AM","8AM","9AM","10AM","12PM"]
+			},
+			series:[], /* array of Data  */
+			
+			remove:function()
+			{
+				return false;
+			},
+			
+			 exporting: {							/*--------------------*/
+				buttons: {							/*					  */
+					exportButton: {					/*		Export		  */
+						menuItems: null,			/*		  to		  */
+						onclick: function() {		/*			PNG.file  */
+							this.exportChart();		/*--------------------*/
+						}
+					}
+				}
+			},
+			plotOptions : {
+			
+			series : {
+					lineWidth: 3,
+			
+				marker : {
+					enabled:false
+				}
+			}
+		}
+	};
+	//This function splits the lines of data per data source
+	var dataGraph = new Array(source.length);
+	var Time = new Array(source.length);
+	for (i=0; i<source.length; i++) 
+	{
+		dataGraph[i] = new Array(); //dataGraph contains the individual points for each source i
+		Time[i] = new Array(); // Time contains the individual time for each sources.
+		for(row=0;row<dataSource[i].length;row++)
 		{
-		series: {
-				marker: {
-                    enabled: false,
-					
-                },
+			rows=line[row].split(',');
+			dataGraph[i].push(parseFloat(rows[4])||parseFloat('0'));
+			Temp[i].push(rows[0]);
+			for(TempTime=0;TempTime<Temp.length;TempTime++)
+			{
+				rowTime=Temp[TempTime].split(':');
+				colonTime[i].push(rowTime[0]); // Contains the data of Time
+				colonMin[i].push(parseInt(rowTime[1]/60*100)||parseFloat('0')); // Contains the data of minutes
+				for(TempHour=0;TempHour<colonTime.length;TempHour++)
+				{
+					rowHour=colonTime[TempHour].split('T');
+					Hour[i].push(parseFloat(rowHour[1])||parseFloat('0'));
+					Time[i].push(Hour[i]+'.'+colonMin[i]);
+				}
 				
-            events: {
-                legendItemClick: function(event) {
-                    
-					
-                }
-            }
-				 
-        }
-		},
-	
-		
-		
-    });
-});
+				
+			}
+		}
+		$('#data').append(i + ": " + source[i] + ' GRAPH DATA ' + dataGraph[i] + ' Time '+ Time[i]);
+	}
+}
