	/**
	*
	* @copyright Fluid Edge Limited
	* @version 1.00
	*
	*/	

	var xmlHttp = createXmlHttpRequestObject();		// Create instance of HTTPRequest Object
	var el;											// div element to replace
	var url;										// URL to load into div
	
	/**
	* Create XMLHTTPRequest object
	*/
	function createXmlHttpRequestObject()
	{
		var xmlHttp;		// reference to request object
		
		// should work for all browsers except IE6 and older
		try
		{
			xmlHttp = new XMLHttpRequest();
		}
		catch (e)
		{
			// assume IE6 or older
			var xmlHttpVersions = new Array(	'MSXML2.XMLHTTP.6.0',
												'MSXML2.XMLHTTP.5.0',
												'MSXML2.XMLHTTP.4.0',
												'MSXML2.XMLHTTP.3.0',
												'MSXML2.XMLHTTP',
												'Microsoft.XMLHTTP');
												
			// try every prog id until one works :P
			for (var i=0; i<xmlHttpVersions.length && !xmlHttp; i++)
			{
				try
				{
					xmlHttp = new ActiveXObject(xmlHttpVersions[i]);
				}
				catch (e)
				{
					// ignore potential errors
				}
			}
		}
		// return the created object or display error
		if (!xmlHttp)
		{
			alert("Error creating the XMLHttpRequest Object: " + e.tostring());
		}
		else
		{
			return xmlHttp;
		}
	}

	
	/**
	* Sends request for file to server via HTMLRequest Object
	*
	* @example ajaxLoad(name_of_div_to_load_content_into,url_to_load)
	*/
	function ajaxLoad(theDiv,url)
	{	
		// get div element to load response, exit if not found!
		el = document.getElementById(theDiv);
		if (!el)
		{
			alert("Error, specified DIV element was not found: " + theDiv);
			return;
		}	

		if (xmlHttp)
		{
			try 
			{
				xmlHttp.open("GET", url, true);
				xmlHttp.onreadystatechange = handleRequestStateChange;
				xmlHttp.send(null);
			}
			catch (e)
			{
				alert("Can't connect to server\n:" + e);
			}
			
			// get div element to replace 
		}
	}
	
	/**
	* Executed when the state of the request changes
	*/
	function handleRequestStateChange()
	{
		// continue only if process is completed
		if (xmlHttp.readyState == 4)
		{
			// continue only if http status is "ok"
			if (xmlHttp.status == 200)
			{
				try
				{
					response = xmlHttp.responseText;
					el.innerHTML = response;
					// to do
				}
				catch (e)
				{
					alert("Error reading the response: " + e.tostring());
				}
			}
			else
			{
				alert("There was a problem retreiving the data:\n" + xmlHttp.statusText);
			}
		}
	}
