/**
 * XMLLoad.js
 * This file defines a class for loading XML files in Javascript
 * a net benefit to this class is simple loading of multiple
 * XML files in a single web space, without a glut of code.
 *
 * @author Ross
 */

 /*
  * Class Constructor
  *
  * @param fileName 
  * location of XML file to be loaded
  * @param callBackFunction
  * callback function to be executed upon successful load of XML
  */
  function XMLLoad(fileName, callBackFunction)
  {
   	if (document.implementation && document.implementation.createDocument)
	{
		this.xmlDoc = document.implementation.createDocument("", "", null);
		if(callBackFunction)
		{
			this.xmlDoc.onload = callBackFunction;
		}
	}
	else if (window.ActiveXObject)
	{
		this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		this.xmlDoc.onreadystatechange = function () {
			if (xmlDoc.readyState == 4) 
				if (callBackFunction) callBackFunction()
		};
 	}
	else
	{
		alert('Your browser can\'t handle this script');
		return;
	}
	this.xmlDoc.load(fileName);  
  }

  /**
   * When you declare this object type you need a way to get 
   * to the XML contianed within
   */
  XMLLoad.prototype.getXML = function() {
	  return this.xmlDoc;
  };
