
	function AJAXRequest()
	{
		this.objXML 		= null;
		this.intInterval 	= null;
		this.strURL 		= '';
		this.strMethod		= 'GET';
		this.running	 	= false;
		this.objEvents 		= {};
		this.intLastStatus  = STATE_NONE;
		this.timer;
		this.Picture 		= '';
		this.clipboard		= {};
		this.blnComplete	= false;

		this.constructor = function(url, method)
		{
			if(url != undefined && url != '') this.strURL = url;
			if(method != undefined && method != '') this.strMethod = method;
		}


		this.setURL = function(strURL)
		{
			if(strURL != undefined && strURL != '')
			{
				this.strURL = strURL;
			}
		}


		this.load = function()
		{
			if(this.strURL == '') return null;

			this.intInterval = setInterval(this.exec.bind(this), 10);

			if(window.ActiveXObject)
			{
				try
				{
					this.objXML = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e)
				{
					try
					{
						this.objXML = new ActiveXObject("Microsoft.XMLHTTP");
					} catch(e) {}
				}
			}
			else if(window.XMLHttpRequest)
			{
				this.objXML = new XMLHttpRequest();						
			}

			if(this.objXML.overrideMimeType)
			{
				this.objXML.overrideMimeType('text/xml; charset=ISO-8859-1');
			}

			try
			{
				this.objXML.open(this.strMethod, this.strURL, true);
				this.objXML.setRequestHeader("Pragma", "no-cache");
				this.objXML.setRequestHeader("Cache-Control", "must-revalidate");
				this.objXML.setRequestHeader("If-Modified-Since", 0);
				this.objXML.send(null);
				
				this.dispatchEvent(EVENT_START);

				this.running = true;
				this.timer	 = new Date();
			}
			catch(exception)
			{
				this.stop();
				this.dispatchEvent(EVENT_ERROR, exception);
			}
		};


		this.exec = function()
		{
			try
			{
				if(this.intLastStatus != this.objXML.readyState)
				{
					this.intLastStatus = this.objXML.readyState;

					this.dispatchEvent(EVENT_CHANGE);
				}
				this.dispatchEvent(EVENT_UPDATE);
				this.dispatchEvent(this.objXML.readyState);

				if(this.objXML.readyState == STATE_READY)
				{
					this.timer = (new Date()).getTime() - this.timer.getTime();
					this.stop();

					this.blnComplete = true;

					this.dispatchEvent(EVENT_COMPLETE);
				}
			}
			catch(exception)
			{
				this.stop();
				this.dispatchEvent(EVENT_ERROR, exception);
			}
		};


		this.stop = function()
		{
			window.clearInterval(this.intInterval);
			this.objXML.abort();
			this.running = false;
		};


		this.addEvent = function(event, objOptions)
		{
			if(event != undefined && objOptions != undefined)
			{
				if(TypeOf(event) == 'Array' && event.length > 0)
				{
					var key;
					for(key in event)
					{
						if(this.objEvents[event[key]] == null)
						{
							this.objEvents[event[key]] = objOptions;
							this.objEvents[event[key]].params = objOptions.params || [];
							this.objEvents[event[key]].scope  = objOptions.scope || this;
						}
					}
				}
				else if(event != '' && this.objEvents[event] == null)
				{
					this.objEvents[event] = objOptions;
					this.objEvents[event].params = objOptions.params || [];
					this.objEvents[event].scope  = objOptions.scope || this;
				}
			}
		}


		this.dispatchEvent = function(strEvent, strValue)
		{
			if(strEvent != undefined && strEvent != '' && this.objEvents[strEvent] != null)
			{
				if(this.objEvents[strEvent].func != null)
				{
					if(strValue != '')
					{
						this.objEvents[strEvent].params.unshift({value:strValue});
					}
					this.objEvents[strEvent].func.apply(this.objEvents[strEvent].scope, this.objEvents[strEvent].params);
				}
			}
		}


		this.isComplete = function()
		{
			return this.blnComplete;	
		}


		this.isRequestStatus = function(intStatus)
		{
			return (intStatus >= STATE_NONE && intStatus <= STATE_READY);
		}


		this.getXMLFilePath = function(strFileName)
		{
			return String(objControl.Config.strXMLPath + strFileName + objControl.Config.strXMLFileExtension);
		}
		this.constructor.apply(this, arguments);
	};