/***********************************************************************
Code written by Paul Ottley copyright 2006
This code is designed to pull in an html page and set it to fill a "content" div
***********************************************************************/
// Global Variable
var req;

function callPage(pg){
  loadXMLDoc(pg);
}

// Implementation of Ajax
function loadXMLDoc(url) {
	req = false;
    //document.getElementById("debugger").innerHTML += "I made it into the loadXMLDoc method <br />";
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		
		// Call the process
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send("");
			
	}
}

// This is the method that will be used to handle the request
function processReqChange() {
    //document.getElementById("debugger").innerHTML += "<br />Did I make it to the processReqChange method? Yes! readyState=" + req.readyState;
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            // ...processing statements go here...
            var respText = req.responseText;
            	document.getElementById("content").innerHTML = respText;
				} 
		else {
            alert("There was a problem retrieving the XML data:\n" +
                req.statusText);
        }
    }
}