/* Create a new XML class for connecting to XML docs */
function xmlConn() {
	var myConn;
	var myXML;
	
	this.getXML = getXML;
	this.postXML = postXML;
	this.getConn = getConn;					
	
	/* Get XML doc using GET */
	function getXML( connURL, connHandler ) {
		openXML( 'GET', connURL, null, connHandler );
	}
	
	/* Get XML doc using POST */
	function postXML( connURL, connPostParams, connHandler ) {
		openXML( 'POST', connURL, connPostParams, connHandler );
	}
	
	/* Open the XML using XMLHttpRequest or ActiveXObject */
	function openXML( connMode, connURL, connPostParams, connHandler ) {
		if( window.XMLHttpRequest ) { // Gecko
			myConn = new XMLHttpRequest();
		} 
		else if( window.ActiveXObject ) { // IE
			myConn = new ActiveXObject( "Microsoft.XMLHTTP" );
		}
		
		// Set change handler and open the connection
		if( myConn ) {
			myConn.onreadystatechange = connHandler;
			myConn.open( connMode, connURL, true );
			myConn.send( connPostParams );
		}
	}
	
	/* Return refrence to the connection.  Useful for accessing XML data later */
	function getConn() {
		return myConn;
	}
}