	
	/**********************************************************************************
	****
	****	AJAX OBJECT 
	****	uses AJAX to load and store request to server
	****
	****
	**********************************************************************************/
		
		var unique = 0;
			
		var js_ajaxObjectP = js_ajaxObject.prototype;
		
		function js_ajaxObject()
		{
		this.type = 'js_ajaxObject';
		//g_fac.register(this); //Gets unique id from factory = this.id		
		this.data = null;
		this.request = null;
		this.url = "";
		this.mimetype = "";
		this.encoding = "";
		this.isUploadRequest = '';
		this.formNodeId = '';
		this.alwaysUseLoadFunction = false; //to force object always to call loadfunction and not use error if response is corrupt
		this.onLoadDataError = '';
		this.externalLoadFunction = "";
		this.externalErrorFunction = "";		
		this.parameterPairs = new Array();		
		}
				
		//PARAMETER PAIR ADDER
		js_ajaxObjectP.addParameterPair = function(param, value)
		{
			var pair = new js_ajaxObjectParameterPair(param, value);
			this.parameterPairs.push(pair);
		}
		
		//EXECUTES REQUEST AND 
		js_ajaxObjectP.execute = function()
		{
			var load = this;
			
			this.request = new DojoRequest(this.url, this.mimetype, this.encoding);
			
				//LOOPING THROUGH PARAMETER PAIRS ADDING TO 'FORM'
				for(var i in this.parameterPairs)
				{
				this.request.putParameter(this.parameterPairs[i].param,this.parameterPairs[i].value);
				}
			
			this.request.setLoadFunction(function(data){load.onLoad.call(load,data);});
			this.request.execute();
		}
		
		//EXECUTES UPLOAD REQUEST
		js_ajaxObjectP.executeUpload = function()
		{
			var load = this;
			this.request = new DojoRequest(this.url, this.mimetype);
		    this.request.isUploadRequest = this.isUploadRequest;
		    this.request.formNodeId = this.formNodeId; //Form upload
		    this.request.setLoadFunction(function(data){load.onLoad.call(load,data);});
			this.request.execute();
		}

		//INTERNAL LOAD FUNCTION - always used on response
		js_ajaxObjectP.onLoad = function(data)
		{

			if((data != false) || this.alwaysUseLoadFunction == true)
			{
			this.data = data;
			this.evaluateOnLoad();			
			}
			else
			{
			eval(this.onLoadDataError);
			}			
			
		}
		
		//INTERNAL LOAD EVALUATION FUNCTION - always used on response
		js_ajaxObjectP.evaluateOnLoad = function()
		{			
			if(this.data != null || this.alwaysUseLoadFunction == true)
			{
			eval(this.externalLoadFunction);			
			}
			else
			{	
			eval(this.externalErrorFunction);
			}

		}		

		
	/**********************************************************************************
	****
	****	PARAMETER PAIR OBJECT 
	****
	****	- for form data in ajaxObject
	****
	**********************************************************************************/
		
		var js_ajaxObjectParameterPairP = js_ajaxObjectParameterPair.prototype;
		
		function js_ajaxObjectParameterPair(param, value)
		{
		this.param = param;
		this.value = value;
		}
		
	/**********************************************************************************
	****
	****	FILE ITEM OBJECT 
	****
	****	- for form data in ajaxObject
	****
	**********************************************************************************/
	
