/*
==========================================
SIMPLE AJAX REQUEST FUNCTIONS
==========================================
*/
var ajax_http;
function Ajax_SendRequest_IsReady(){
	try{
		if (ajax_http.readyState != 4){return false;}
		if (ajax_http.status != 200){return false;}
		return true;
	}catch(ex){
		return false;
	}	
}
function Ajax_SendRequest(Url, ResponseFunction) {
	ajax_http = null;
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
		ajax_http = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // IE
		ajax_http = new ActiveXObject("Microsoft.XMLHTTP");
	}
    ajax_http.open('GET', Url, true);
    ajax_http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    ajax_http.onreadystatechange = ResponseFunction;
    ajax_http.send(null);
}
/*
SAMPLE RETURN FUNCTION...
function UserSave_AjaxResponse(){
    if(ajax_http.readyState == 4){
	var response = ajax_http.responseText;
	alert(response);
    }
}
OR...
function UserSave_AjaxResponse(){
    if (!Ajax_SendRequest_IsReady()){return;}
	var response = ajax_http.responseText;
	alert(response);
    }
}
*/

/*
==========================================
AJAX XML DOCUMENT REQUEST FUNCTIONS 
==========================================
*/
var Ajax_XmlHttp = false;
function Ajax_GetXmlPage(Url, ResponseFunction) {
  Ajax_XmlHttp = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
	 Ajax_XmlHttp = new XMLHttpRequest();
	 if (Ajax_XmlHttp.overrideMimeType) {Ajax_XmlHttp.overrideMimeType('text/xml'); }
  } else if (window.ActiveXObject) { // IE
	 try{Ajax_XmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }catch(ex){
		try{Ajax_XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){}}
  }
  if (!Ajax_XmlHttp) {return false;}
  Ajax_XmlHttp.onreadystatechange = ResponseFunction;
  Ajax_XmlHttp.open('GET', Url, true);
  Ajax_XmlHttp.send(null);
}
function Ajax_PostXmlPage(Url, Params, ResponseFunction) {
  Ajax_XmlHttp = false;
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
	 Ajax_XmlHttp = new XMLHttpRequest();
	 if (Ajax_XmlHttp.overrideMimeType) {Ajax_XmlHttp.overrideMimeType('text/xml'); }
  } else if (window.ActiveXObject) { // IE
	 try{Ajax_XmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }catch(ex){
		try{Ajax_XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){}}
  }
  if (!Ajax_XmlHttp) {return false;}
  Ajax_XmlHttp.open("POST", Url, true);
  Ajax_XmlHttp.onreadystatechange = ResponseFunction;
  Ajax_XmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  Ajax_XmlHttp.send(Params);
}
function Ajax_XmlHttp_IsReady(){
	if (Ajax_XmlHttp.readyState != 4){return false;}
	if (Ajax_XmlHttp.status != 200){return false;}
	return true;
}
/*
SAMPLE RETURN FUNCTION...
function LibraryAtom_BuildDocList_Response(){
	if(Ajax_XmlHttp_IsReady()){
		document.getElementById("docs").innerHTML = ""; //clear current list
		var XmlDoc = Ajax_XmlHttp.responseXML;
		var nodes = XmlDoc.getElementsByTagName("object")
		for(var i = 0; i < nodes.length; i++){	}
	}
}
*/

