	
	/* +----------------------------------------------------------------------------+ */
	/* | Ajax Caller                                                                | */
	/* |                                                                            | */
	/* | To use this you must pass an object with the method parseAjax which will   | */
	/* | be called by the readystate.  If you want to extend the exisitng class     | */
	/* | then thats fine but make sure you pass itself as the object                | */
	/* |                                                                            | */
	/* +----------------------------------------------------------------------------+ */
	
	function Ajax() {
		
		this.__iCaller;
		this.__uri;
		this.__post;
		this.ajaxHandle;
		
		this.setCallingReference = function( __object ) {
			this.__iCaller = __object;
		} 
		
		this.setUrl = function( __uri,__post ) {
			this.__uri = __uri;
			this.__post = __post;
		}
		
		this.process = function() {
			if ( window.XMLHttpRequest ) { this.ajaxHandle = new XMLHttpRequest(); } 
			else if ( window.ActiveXObject ) { this.ajaxHandle = new ActiveXObject("Microsoft.XMLHTTP"); } 
			else { alert("Your browser is not supported"); }
			
			if ( this.ajaxHandle ) 
			{			
				var __self = this;
				this.ajaxHandle.onreadystatechange = function() { 
__self.__iCaller.parseAjax(__self.ajaxHandle); }			
				if ( this.__post != '' && this.__post !=null && this.__post != "undefined" ) { 
					this.ajaxHandle.open("POST", this.__uri, true); 
					this.ajaxHandle.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
					this.ajaxHandle.setRequestHeader("Content-length", this.__post.length); 
					this.ajaxHandle.setRequestHeader("Connection", "close"); 
					this.ajaxHandle.send(post);
				} else { 
					this.ajaxHandle.open("GET", this.__uri, true); 
					this.ajaxHandle.send(null); 
				}
			}
				
		}

	} // AJax
	
	
	/**
	
		Example of use:
		
			function SomeProcessOfCustomAjax(){
				this.parseAjax = function( __ajaxObject ) {
					try{
						if (__ajaxObject.readyState == 4 && __ajaxObject.status == 200){		
							if (__ajaxObject.responseXML){
								this.response = __ajaxObject.responseXML.documentElement;
								if ( this.response ){
									var items = 
this.response.getElementsByTagName("magda");
									alert("I got a repsonse");	
								}						
							}			
						}
					}
					catch ( exception ){
						alert("Exception: " + exception.message);
					}			
				}
			}
			
			
			
			
			// Option 1 - Pass a custom ajax handler to the ajax object
			
			var sp = new SomeProcessOfCustomAjax();
			var ajax = new Ajax();
			ajax.setCallingReference(sp);
			ajax.setUrl("/some/url/of?sss=2122");
			ajax.process();		
	
	
	**/
