
	window.addEvent('domready', function() {								
		if(document.getElementById('leftImage')){
			loadXML_2();
		}
		if(document.getElementById('midImage') && document.getElementById('program')){
			loadXML_3();
		}
	});

/*************************************************************************/
/*   This loads the XML  for the content on the lower part of homepage   */
/*************************************************************************/
function loadXML_2()
{
var timestamp_2 = new Date();
var uri_2 = "/fileadmin/_lcu/XML/general/leftColImage.xml";

var uniqueURI_2 = uri_2 + (uri_2.indexOf("?") > 0 ? "&" : "?")+ "timestamp="+ timestamp_2.getTime();
	try
	{
		if (window.ActiveXObject)
		{
			var errorHappendHere_2 = "Check Browser and security settings";
			xmlDoc2_2 = new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc2_2.async=false;
			xmlDoc2_2.onreadystatechange=verify_2;
			xmlDoc2_2.load(uniqueURI_2);
			imageRotator_2();
		}
		else if(window.XMLHttpRequest)
		{
			var errorHappendHere_2 = "Error handling XMLHttpRequest request";
			var d_2 = new XMLHttpRequest();
			d_2.open("GET", uniqueURI_2, false);
			d_2.send(null);
			xmlDoc2_2=d_2.responseXML;
			imageRotator_2();
		} else {
			var errorHappendHere_2 = "Error.";
			xmlDoc2_2 = document.implementation.createDocument("","",null);
			xmlDoc2_2.onreadystatechange=verify_2;
			xmlDoc2_2.async=false;
			xmlDoc2_2.load(uniqueURI_2);
			xmlDoc2_2.onload=imageRotator_2();
		}
	}	
	catch(e)
	{
		//alert(errorHappendHere_2); 
	}
}

function verify_2()
{
  // 0 Object is not initialized
  // 1 Loading object is loading data
  // 2 Loaded object has loaded data
  // 3 Data from object can be worked with
  // 4 Object completely initialized
  if (xmlDoc2_2.readyState != 4)
  {
    return false;
  }
  return true;
}

/*********************************************************************/
/*    This function randomly grabs a photo from the file             */
/*    homepage.xml. It takes the info associated with it             */
/*    and creates innerHTML. All of this is sent to the 			 */
/*    centerColContainer div. This all happnes on page refresh       */
/*********************************************************************/

var imageRotator_2 = function imageRotator_2()
{
	// create an object with all of the image nodes
	var xmlTopNodes2_2=xmlDoc2_2.getElementsByTagName("node")[0].getElementsByTagName("image"); 
	// find out how many top nodes there are
	var numTopNodes2_2=xmlTopNodes2_2.length; 
	//randomly choose a photo and the other info that goes with it to display on the homepage from the XML 
	var randomNumber_2 = (Math.floor(Math.random()*numTopNodes2_2)); //This is a random number between 0 - (numTopNodes2 - 1)
	// get the value of the image source
	var newImage2_2 = xmlDoc2_2.getElementsByTagName("node")[0].getElementsByTagName("image")[randomNumber_2].getElementsByTagName("source")[0].childNodes[0].nodeValue;
	// get the value of the image altTag
	var newAlt2_2 = xmlDoc2_2.getElementsByTagName("node")[0].getElementsByTagName("image")[randomNumber_2].getElementsByTagName("altTag")[0].childNodes[0].nodeValue;
	// add the background image
	document.getElementById('leftImage').src=newImage2_2;
	document.getElementById('leftImage').alt=newAlt2_2;
}

function loadXML_3()
{
var timestamp_3 = new Date();
	var uri_3 = "/fileadmin/_lcu/XML/general/general.xml";

var uniqueURI_3 = uri_3 + (uri_3.indexOf("?") > 0 ? "&" : "?")+ "timestamp="+ timestamp_3.getTime();
	try
	{
		if (window.ActiveXObject)
		{
			var errorHappendHere_3 = "Check Browser and security settings";
			xmlDoc2_3 = new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc2_3.async=false;
			xmlDoc2_3.onreadystatechange=verify_3;
			xmlDoc2_3.load(uniqueURI_3);
			imageRotator_3();
		}
		else if(window.XMLHttpRequest)
		{
			var errorHappendHere_3 = "Error handling XMLHttpRequest request";
			var d_3 = new XMLHttpRequest();
			d_3.open("GET", uniqueURI_3, false);
			d_3.send(null);
			xmlDoc2_3=d_3.responseXML;
			imageRotator_3();
		} else {
			var errorHappendHere_3 = "Error.";
			xmlDoc2_3 = document.implementation.createDocument("","",null);
			xmlDoc2_3.onreadystatechange=verify_3;
			xmlDoc2_3.async=false;
			xmlDoc2_3.load(uniqueURI_3);
			xmlDoc2_3.onload=imageRotator_3();
		}
	}	
	catch(e)
	{
		//alert(errorHappendHere_3); 
	}
}

function verify_3()
{
  // 0 Object is not initialized
  // 1 Loading object is loading data
  // 2 Loaded object has loaded data
  // 3 Data from object can be worked with
  // 4 Object completely initialized
  if (xmlDoc2_3.readyState != 4)
  {
    return false;
  }
  return true;
}

/*********************************************************************/
/*    This function randomly grabs a photo from the file             */
/*    homepage.xml. It takes the info associated with it             */
/*    and creates innerHTML. All of this is sent to the 			 */
/*    centerColContainer div. This all happnes on page refresh       */
/*********************************************************************/

var imageRotator_3 = function imageRotator_3()
{
	// create an object with all of the image nodes
	var xmlTopNodes2_3=xmlDoc2_3.getElementsByTagName("node")[0].getElementsByTagName("image"); 
	// find out how many top nodes there are
	var numTopNodes2_3=xmlTopNodes2_3.length; 
	//randomly choose a photo and the other info that goes with it to display on the homepage from the XML 
	var randomNumber_3 = (Math.floor(Math.random()*numTopNodes2_3)); //This is a random number between 0 - (numTopNodes2 - 1)
	// get the value of the image source
	var newImage2_3 = xmlDoc2_3.getElementsByTagName("node")[0].getElementsByTagName("image")[randomNumber_3].getElementsByTagName("source")[0].childNodes[0].nodeValue;
	// get the value of the image altTag
	var newAlt2_3 = xmlDoc2_3.getElementsByTagName("node")[0].getElementsByTagName("image")[randomNumber_3].getElementsByTagName("altTag")[0].childNodes[0].nodeValue;
	// add the background image
	document.getElementById('midImage').src=newImage2_3;
	document.getElementById('midImage').alt=newAlt2_3;
}