function ajaxObject(url,posData,callbackFunction) {
	var ajObj=this;
	this.updating = false;

	// Call this function to abort the Ajax Call, if it keeps running for long time

	this.abort = function() {
		if (ajObj.updating) {
			ajObj.updating=false;
			ajObj.AJAX.abort();
			ajObj.AJAX=null;
		}
	}

	this.update = function(posData,requesttype,showLoadBar) {
		if(showLoadBar)
			showContactTimer();

		if (ajObj.updating) { return false; }

		ajObj.AJAX = null;
		if (window.XMLHttpRequest) {
			ajObj.AJAX=new XMLHttpRequest();
		} else {
			ajObj.AJAX=new ActiveXObject("Microsoft.XMLHTTP");
		}
		if (ajObj.AJAX==null) {
			return false;
		} else {
			ajObj.AJAX.onreadystatechange = function() {
				if (ajObj.AJAX.readyState==4) {
					ajObj.updating=false;
					ajObj.callback(ajObj.AJAX);
					ajObj.AJAX=null;
					if(showLoadBar)
						hideContactTimer();
	        		}
      			}
			ajObj.updating = new Date();
                        
                        if(requesttype == "POST"){
                            ajObj.AJAX.open(requesttype, url, true);
                            ajObj.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                            ajObj.AJAX.send(posData);
                        } else {
                            ajObj.AJAX.open(requesttype, url+'?'+posData, true);
                            ajObj.AJAX.send(null);
                        }
	      		return true;
    		}
  	}
  	var urlCall = url;
  	this.callback = callbackFunction || function () { };
}

/**
 Displays the Processing Bar
*/
function showContactTimer () {
	var loader = document.getElementById('loadBar');
	loader.style.display = 'block';
}

/**
 Hides the Progress Bar and  resets the form fields
*/
function hideContactTimer () {
	var loader = document.getElementById('loadBar');
	// Hide the load bar alas! Done Loading
	loader.style.display = "none";
}
