	
	// @current revision 2/17/2009 11:55:27 AM +mlp
	// @previous revision 7.28.2008 +mlp
	
	if (!window.XMLHttpRequest) {
		window.IE6 = true;
		window.XMLHttpRequest = function() {
			var oMSAXO;
			if(typeof(window.ActiveXObject)=='function') {
				oMSAXO = new ActiveXObject('Msxml2.XMLHTTP');
				if(oMSAXO.readyState!=0) {
					oMSAXO = new ActiveXObject('Microsoft.XMLHTTP')
				}
				if(oMSAXO.readyState!=0) { //no ajax for you, begone!
					oMSAXO=false;
				}
		 	}
			return oMSAXO;
		};
	} else {
		window.IE6 = false;
	}
	//************************************************************


	Function.prototype.ajaxEvent = function (lsUrl, loElement, llAppend, llQueued, lsFunction, laArguments, lsMethod) {
	//function ajaxEvent(lsUrl, loElement, llAppend, llQueued, lsFunction, laArguments, lsMethod) {      	
		//NOTE: the llQueued variable is confusing since it's the inverse of the xmlhttp implementation for asynchronous mode. keep it this way for backwards compatibility...
		if(!lsUrl){return(false);} //REQUEST URL
		if (lsMethod!='POST') { //defaults to GET
			lsMethod = 'GET'
		} else {
			lsMethod= 'GET'
		}
		if (llAppend===false) { 
			llAppend=false; 
		} else { 
			llAppend=true; 
		}//replace||append into callback div.
		
		if(!loElement){
			//no callback
		} else {
			if (typeof(loElement)=='string') { //id of element, resolve to DOM reference
				loElement=document.getElementById(loElement); //resolve to object if id passed in returns false and indicates no callback if DOM Element doesn't exist
			}
			if(loElement.parentNode) { //custom for loading animation
				var loRE = new RegExp('folder');
				(loRE.test(loElement.parentNode.className))?(ClassFX.addClass(loElement.parentNode,'loading')):(null);
			}
		}
		if (!window.XMLHttpRequest) {
			window.IE6 = true;
			window.XMLHttpRequest = function() {
				var oMSAXO;
				if(typeof(window.ActiveXObject)=='function') {
					oMSAXO = new ActiveXObject('Msxml2.XMLHTTP');
					if(oMSAXO.readyState!=0) {
						oMSAXO = new ActiveXObject('Microsoft.XMLHTTP')
					}
					if(oMSAXO.readyState!=0) { //no ajax for you, begone!
						oMSAXO=false;
					}
			 	}
				return oMSAXO;
			};
		}

		var oXMLHTTP = new XMLHttpRequest(); //CALL

		if (!oXMLHTTP) {callbackEvents(false,loElement,llAppend); return;}
		if (oXMLHTTP.overrideMimeType) {oXMLHTTP.overrideMimeType('text/xml');} //override to text/xml -oops, cant use this for anything else if we do this.
		var lAsynch = true;
		if (llQueued) { //switch value here for clarity, since it was't set up right.
			lAsynch = false;
		} else {
			lAsynch = true;
		}

		//for ie6
		if(window.IE6) { //the gap between older implementations and newer ones is getting wider... FF3 = drastically incompatible with IE6
			oXMLHTTP.open('GET', lsUrl, lAsynch);//submit request (asynchronous = true)
			oXMLHTTP.onreadystatechange = function () {
				if (oXMLHTTP.readyState == 4) {
					if(oXMLHTTP.status == 200) {
						callbackEvents(oXMLHTTP.responseText,loElement,llAppend);
						if(typeof(this[lsFunction])=='function') {
							this[lsFunction];						
						}
					}
				}
			};
			oXMLHTTP.send(null); //required to send to null
		} else { //Exactly right implementation in FF3/IE7. Extend the object firing event passing in context to event recipient.
			oXMLHTTP.callBack = loElement;
			oXMLHTTP.append = llAppend;
			if (lAsynch) { //asynchronous request.
				oXMLHTTP.open('GET', lsUrl, lAsynch);//submit request (asynchronous = true)
				oXMLHTTP.onreadystatechange = function (aEvt) {
					if (oXMLHTTP.readyState == 4) {
						if(oXMLHTTP.status == 200) {
							callbackEvents(oXMLHTTP);
							if(lsFunction) {
								if(typeof(window[lsFunction])=='function') {
									try {
										window[lsFunction](laArguments);							
									} catch(e) { trace('/*no dice*/'); }
								} else if(typeof(this[lsFunction])=='function') {
									try {
										this[lsFunction](laArguments);						
									} catch(e) { trace('/*no dice*/'); }
								} else if(typeof(lsFunction)=='string') {
									try {
										eval(lsFunction+'('+laArguments+')');
									} catch(e) { trace('/*no dice*/'); }
								} else { /*fuzzy dice*/ }
							}
						}
					}
				};
				oXMLHTTP.send(null); //required to send to null
			} else { //synchronous request, i have to call this differently or firefox won't perform the callback function
				oXMLHTTP.open('GET', lsUrl, lAsynch); //submit request (asynchronous = true)
				oXMLHTTP.send(null); //required to send to null
				if(oXMLHTTP.status == 200) {
					callbackEvents(oXMLHTTP);
					if(lsFunction) {
						if(typeof(window[lsFunction])=='function') {
							try {
								window[lsFunction](laArguments);							
							} catch(e) { trace('/*no dice*/'); }
						} else if(typeof(this[lsFunction])=='function') {
							try {
								this[lsFunction](laArguments);						
							} catch(e) { trace('/*no dice*/'); }
						} else if(typeof(lsFunction)=='string') {
							try {
								eval(lsFunction+'('+laArguments+')');
							} catch(e) { trace('/*no dice*/'); }
						} else { /*fuzzy dice*/ }
					}
				}
			}
		}

	}
	//************************************************************


	//overwrite placeholder calls...
	var ajaxEvent = function (lsUrl, loElement, llAppend, llQueued, lsFunction, laArguments, lsMethod) {
		Function.ajaxEvent(lsUrl, loElement, llAppend, llQueued, lsFunction, laArguments, lsMethod); 	
	};
	//*****************************************


	function preCallBack(loElement,luValue) {
		return true;
	}
	//************************************************************


	function callbackEvents(oXMLHTTP,loElement,llAppend){ //specific task for call back
		if (typeof(oXMLHTTP)!='object') {
			sResponseData = oXMLHTTP;
		} else {
			var sResponseData = '';
			if(oXMLHTTP==false) {
				sResponseData = 'Request failed, unsupported XMLHTTP implementation';
			} else {
				sResponseData = oXMLHTTP.responseText;
			}
		}
		if (oXMLHTTP.callBack==null) { //ie6 won't extend activeXObject
			loElement=(loElement==false)?(null):(loElement);
		} else {
			loElement=oXMLHTTP.callBack;
		}
		lAppend=(llAppend===true)?(true):( (llAppend===false)?(false):(oXMLHTTP.append) );
		if(!loElement) {
			return;
		} else {
			preCallBack(loElement,sResponseData);
			var loRE = /input/ig;
			if(loRE.test(loElement.tagName)) {
				loElement.value = (lAppend)?(loElement.value + sResponseData):(sResponseData);
			} else { //textarea||div etc.
				loElement.innerHTML = (lAppend)?(loElement.innerHTML + sResponseData):(sResponseData);
			}
			postCallBack(loElement,sResponseData);
		}
		
		return;
	}
	//************************************************************

	function postCallBack(loElement,luValue) {
		if(loElement.parentNode) {
			var loRE = new RegExp('loading');
			(loRE.test(loElement.parentNode.className))?(ClassFX.removeClass(loElement.parentNode,'loading')):(null);
			(ClassFX.hasClass(loElement.parentNode,'loading'))?(ClassFX.removeClass(loElement.parentNode,'loading')):(null);
		}
		return true;
	}
	//************************************************************
	
	
