// JavaScript Document
/* loadImages function
 * Receives two mandatory arguments from a page - xmlFile and contentid.
 * Updates the required section of the content with HTML in [xmlFile][id].xml
 * A series of images contained within an HTML fragment of the page to load.
 * Each successive page will contain the onclick code to load the next image.
 * Called from managedServicesmainContent.html and image2-image5.html.
 */

function loadImages(xmlFile,contentid) 
{ 
	var req = null; 
	document.getElementById(contentid).innerHTML = "Started...";
	if (window.XMLHttpRequest) // Non-IE browser
		{
			req = new XMLHttpRequest();
			if (req.overrideMimeType) 
			{
				req.overrideMimeType('text/xml');
			}
		} 
		else if (window.ActiveXObject) // IE, in some form
		{
			try {
				req = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e)
			{
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) { alert ("Your browser doesn't support AJAX!"); 

				return; } // Need to test this and add a link a for HTML only option
		}
	}

	req.onreadystatechange = function() { 
		document.getElementById(contentid).innerHTML = "Loading...";
		if(req.readyState == 4)
		{
			if(req.status == 200)
				{
					document.getElementById(contentid).innerHTML  = req.responseText;	
				}	
			else	
				{
					document.getElementById(contentid).innerHTML="Error: returned status code " + req.status + " " + req.statusText;
				}	
		} 
	}; 

	req.open("GET", xmlFile + ".html?" + Date(), true); // Append date to request URL to prevent cache issues.
	req.send(null); 
} 
