function EventsList()
{
	var req = false;
	var xmlDoc;
	var url = "/xml/events.xml";
	
	this.loadEventsList = function()
	{
		 if(window.XMLHttpRequest && !(window.ActiveXObject)) 
		 {
			 try {
				req = new XMLHttpRequest();
			 } catch(e) {
				req = false;
			 }
		 // branch for IE/Windows ActiveX version
		 } 
		 else if(window.ActiveXObject) 
		 {
			 try {
				req = new ActiveXObject("Msxml2.XMLHTTP");
			 } 
			 catch(e) 
			 {
				 try {
					req = new ActiveXObject("Microsoft.XMLHTTP");
				 } 
				 catch(e) {
					req = false;
				 }
			 }
		 }
		 
		 req.onreadystatechange = function() 
		 {
			 if (req.readyState==4 && req.status==200)
			 {
				 xmlDoc = req.responseXML;
				 displayEvents();
			 }
		 };
		 req.open("GET", url, true);
		 req.send();

	}
	
	displayEvents = function()
	{
		var items = new Array();
		var html = '';
		var date;
		var title;
		var location;
		var briefing;
		var speaker;
		var description;
		var url;
		
		var x = xmlDoc.getElementsByTagName('item');
		
		for (i=0;i<x.length;i++)
		{
			date = '';
			title = '';
			location = '';
			briefing = '';
			speaker = '';
			description = '';
			
			
			for (j=0; j<x[i].childNodes.length; j++)
			{
				if (x[i].childNodes[j].firstChild)
				{
					switch (x[i].childNodes[j].tagName)
					{
						case 'date':
							date = x[i].childNodes[j].firstChild.nodeValue;
							break;
						case 'title':
							title = x[i].childNodes[j].firstChild.nodeValue;
							break;
						case 'location':
							location = x[i].childNodes[j].firstChild.nodeValue;
							break;
						case 'briefing':
							briefing = x[i].childNodes[j].firstChild.nodeValue;
							break;
						case 'speaker':
							speaker = x[i].childNodes[j].firstChild.nodeValue;
							break;
						case 'description':
							description = x[i].childNodes[j].firstChild.nodeValue;
							break;
						case 'link':
							url = x[i].childNodes[j].firstChild.nodeValue;
							break;
					}
				}
			}
			
			items[i] = '<div id="event' + (i+1) + '" class="event clearfix"><h4>' + date + '</h4><h3>'+ title + '</h3><h5>' + location + '</h5><h5>' + briefing + '</h5><h5>' + speaker + '</h5><h5>' + description + '</h5></div>';
	
		}
		
		for (i = 0; i < items.length; i++)
		{
			html += items[i];
			
		}
		
		document.getElementById('eventsWrapper').innerHTML = html;
	}
	
}
