/*************************************************************************************
						Corcoran AJAX Class
						This class is used for creating and loading XMLHttp objects.
				
						Written Tuesday, April 14, 2008
						Questions? Contact Cornelius(cmoore@corcoran.com)
***********************************************************************************************/

/* Superclass and main constructor */
function CorcoranAJAX(){}

/***********************************************************************************************
					All subclasses of CorcoranAJAX  are defined here
************************************************************************************************/
function eObjects(){
	this.superclass();
	this.isActv = false;
	this.isAsync = true;
	
	eObjects.prototype.createXmlHttpObject = function(){
	/*******************************************************************************	
	Usage: eObjects.createXmlHttpObject() - Creates a unique XMLHTTP object
	********************************************************************************/
		var o;

	    if(window.XMLHttpRequest){
          try{
            o = new XMLHttpRequest(); 
          }catch(e){
            o = false;
          }          
		}
		// branch for IE/Windows ActiveX version
	    else if(window.ActiveXObject){
			try{
				o = new ActiveXObject("Msxml2.xmlhttp");
			}catch(e){
				try{
					o = new ActiveXObject("Microsoft.xmlhttp");
				}catch(e){ o = false;}
			}
		}
		return o;
	};
	
	eObjects.prototype.SendXmlHttpRequest = function(obj,qstr,fnc){
	/****************************************************************************************************	
	Usage: eObjects.SendXmlHttpRequest([the XMLHTTP object name],[the query string],[the handler function]) 
		  - Connects to the server, binds the server response to the object you specified,
		  and calls your function passing it the data from the object
	*****************************************************************************************************/
		if (!this.isActv && obj) {
			obj.open("POST", qstr, this.isAsync);	
			obj.onreadystatechange = function(){
				if (obj.readyState == 4){		
					if (obj.responseText.indexOf('invalid') == -1) {
						r = obj.responseText;
						var p=fnc(obj.responseText);
					}
				}	
			}	
			obj.send('');
		}
	};
	
	eObjects.prototype.DestroyXmlHttpObject = function(obj){
	/*******************************************************************************	
	Usage: eObjects.DestroyXmlHttpObject([object name]) - Creates a unique XMLHTTP object
	********************************************************************************/
		delete obj;		
	};
}

/***********************************************************************************************
					SubClass initialization - Each Subclass inherits CorcoranAJAX
					but uses its own contructor.
************************************************************************************************/
eObjects.prototype = new CorcoranAJAX();
eObjects.prototype.contructor = eObjects;
eObjects.prototype.superclass = CorcoranAJAX;
eObjects = new eObjects();

CorcoranAJAX=new CorcoranAJAX();
