// Initiate an Ajax call
// c: from Bullettproof Ajax

function getHTTPObject(){
	var xhr = false;
	if(window.XMLHttpRequest){
		xhr  = new XMLHttpRequest();	
	}
	else if(window.ActiveXObject){
		try{
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				xhr = false;	
			}
		}
	}
	return xhr;
}

function displayLoading(element) {
  while (element.hasChildNodes()) {
    element.removeChild(element.lastChild);
  }
  var image = document.createElement("img");
  image.setAttribute("src","/img/ajax-loader.gif");
  image.setAttribute("alt","Loading...");
  image.setAttribute("title","Loading...");
  element.appendChild(image);
}