// JavaScript Document

/*
 * Creating a cross-browser XMLHttpRequest
 * @author: Philip McCarthy - philmccarthy@gmail.com 
 */
function createXmlHttpRequest(){
	var xmlreq = null;
	// Create XMLHttpRequest object in non-Microsoft browsers
	if (window.XMLHttpRequest) {
		xmlreq = new XMLHttpRequest();
	} // Create XMLHttpRequest via MS ActiveX
	else if (window.ActiveXObject) {
		try {			
      		// Try to create XMLHttpRequest in later versions of Internet Explorer
			xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
			} 
			catch (e1) {
				// Failed to create required ActiveXObject
				try {
					// Try version supported by older versions of Internet Explorer
					xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
					} 
					catch (e2) {
						// Unable to create an XMLHttpRequest with ActiveX
					}				
			}
	}
  return xmlreq;
}

/********************************************************
 Make this IE7 Compatible ;)
 http://ajaxian.com/archives/ajax-on-ie-7-check-native-first
*********************************************************/
function createXmlHttpRequestIE7() {
	var xmlhttp;
		/*@cc_on
	@if (@_jscript_version>= 5)
			try {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
					try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
					catch (E) {xmlhttp = false;}
			}
	@else
		xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != "undefined") {
			try {xmlhttp = new XMLHttpRequest();} catch (e) {xmlhttp = false;}
	}
	return xmlhttp;
}