// JavaScript Document
var ajaxCallBackFunction
var ajaxCallInProgress = false

function createRequest(){
if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
		}
}



function ajax(url, func){
	
	if(!ajaxCallInProgress || 1 == 1){

		//Set the callback and inprogress status
		ajaxCallBackFunction = func
		ajaxCallInProgress = true
		
		createRequest();
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = StateChange;
		xmlHttp.send(null);
		
		return true;
	
	 }//end if
	else
	{
		alert("The webpage is still communicating with the server. Please wait....")
		return false
	}//end else
	
}//end function
	



function StateChange(){
if(xmlHttp.readyState == 4){
	
	var html = trim(xmlHttp.responseText)
	ajaxCallBackFunction(html)
	ajaxCallInProgress = false
	
}}