// ----------------------------------- Asynchronous Navigation -----------------------------------
// This script provides a cross-browser API for dealing with asynchronous requests.  This is
// *not* necessarily "Ajax," as the response is not assumed to be XML.
//
// $Id: async_1_0.js,v 1.1 2006/09/12 23:55:46 ryandear Exp $ 

var dlese_xmlHttp = null;	// asynchronous request object

// Start an asynchronous request of the given URL.  This function should not be invoked 
// a second time until the callback function has been called!
// 		url - address of the request for info. (not an entire page!)
// 		callback - function that is invoked by the asynchronous loading, where DOM updating
//          with the new content can occur using dlese_xmlHttp.responseText--be sure to 
//          check whether the response is ready for processing with dlese_asyncRequestIsReady()
function dlese_asyncRequest( url, callback ) {  
	dlese_xmlHttp = dlese_getXMLHTTP();    
	dlese_xmlHttp.open( "GET", url, true );     
	dlese_xmlHttp.onreadystatechange = callback;    
	dlese_xmlHttp.send( null ); 
} 

// Check whether the response has completed:
function dlese_asyncRequestIsReady() {
	if ( dlese_xmlHttp && dlese_xmlHttp.readyState && ( dlese_xmlHttp.readyState == 4 ) 
		 && dlese_xmlHttp.responseText )
		return true;
	return false;
}

// Cross-browser asynchronous HTTP request:
function dlese_getXMLHTTP() {    
	var A = null;    
	try { 
		A = new ActiveXObject( "Msxml2.XMLHTTP" ); 
	}    
	catch ( e ) {
		try { 
			A = new ActiveXObject( "Microsoft.XMLHTTP" );
		} catch( oc ) { 
			A = null; 
		}    
	}    
	if ( !A && ( typeof XMLHttpRequest != "undefined" ) ) { 
		A = new XMLHttpRequest();    
	}    
	return A; 
} 


