//This is targetted AJAX....it takes a page to fetch (any data passed by $_GET *MUST* be added as a query string)
//and a target.  The results of the request get put into the target ID.

	function SendPageRequest(page,target) {
		var ping_http_request = false;
		
        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            ping_http_request = new XMLHttpRequest();
//            if (ping_http_request.overrideMimeType) {
//                ping_http_request.overrideMimeType('text/xml');
                // See note below about this line
 //           }
        } else if (window.ActiveXObject) { // IE
            try {
                ping_http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    ping_http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!ping_http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        ping_http_request.onreadystatechange = function() { readPage(ping_http_request,target); };

		try{
    	    ping_http_request.open('GET', page, true);
			document.getElementById('model_box').innerHTML='<br><center>Loading...</center>';
			ping_http_request.send(null);
		} 	catch(e){
				document.getElementById('error').style.color="#FF0000";
				document.getElementById('error').innerHTML="Error: Could not connect to server.  Please try again later.";
			}


    }

    function readPage(ping_http_request,target) {
//					var text=ping_http_request.readyState;
//					var text2=ping_http_request.status;
//					document.getElementById('ping').innerHTML=text + " " + text2;
        if (ping_http_request.readyState == 4){
          try{			
				if (ping_http_request.status == 200){
					var response = ping_http_request.responseText;
										
					document.getElementById('model_box').innerHTML=response;
				} 
				else{
					document.getElementById('error').style.color="#FF0000";
					document.getElementById('error').innerHTML="Error: The script has experienced a fatal error.";

				}
			}
			catch(e){
				document.getElementById('error').style.color="#FF0000";
				document.getElementById('error').innerHTML="Error: The script has experienced a fatal error.";
			}
        }
    }
