/// <reference path="MetafuseBase.js" />

/*******************************
XML HTTP OBJECT
********************************/
function GetXmlHttp()
{
	//alert('in get xml http');
	//alert(BrowserTools.GetMajorVersion());
	var xmlhttp = false;
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
	{
		//alert("in native");
		xmlhttp = new XMLHttpRequest();
	}
	else if (BrowserTools.IsInternetExplorer() && BrowserTools.GetMajorVersion() < 7)
	{
		//may have to move to external file
		var xmlhttp = false;
		/*@cc_on@*/
		/*@if (@_jscript_version >= 5)
		// JScript gives us Conditional compilation, we can cope with old IE versions.
		// and security blocked creation of the objects.
		try
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (E)
			{
				xmlhttp = false;
			}
		}
		@end@*/
	}

	return xmlhttp;
}

//defined here, but is redefined in the MetafuseAjaxPostBackIE6.js file (used to prevent IE 7 from attempting to run Active X)
function GetXmlHttpIE6ActiveXScript()
{
	//alert("in get ie null method");
	return null;
}
//wrapper object does an ajax post back sending viewstate and current form elements
function MetafuseAjaxPostBackObject()
{
	this.EnableDebug = false;
	this.CallBackQueue = new Array();
};



/*********************************************************************************
Call back object methods
**********************************************************************************/
MetafuseAjaxPostBackObject.prototype.DoAjaxPostSimple = MetafuseAjaxPostBackObject_DoAjaxPostSimple; //performs a simple post sending event target but no other data
function MetafuseAjaxPostBackObject_DoAjaxPostSimple(eventTarget, eventArgument, causesValidation, elementToShowProcessingNear, processingNearHTML, includeVeil, blockOtherCallBacks, metafuseAjaxPostBackObjectServerResponse)
{
	this.DoAjaxPostComplex(eventTarget, eventArgument, causesValidation, elementToShowProcessingNear, processingNearHTML, includeVeil, blockOtherCallBacks, metafuseAjaxPostBackObjectServerResponse, null, true, true, null);
};

MetafuseAjaxPostBackObject.prototype.DoAjaxPostBack = MetafuseAjaxPostBackObject_DoAjaxPostBack; //performs a call back posting the form data
function MetafuseAjaxPostBackObject_DoAjaxPostBack(eventTarget, eventArgument, causesValidation, elementToShowProcessingNear, processingNearHTML, includeVeil, blockOtherCallBacks, metafuseAjaxPostBackObjectServerResponse)
{
	this.DoAjaxPostComplex(eventTarget, eventArgument, causesValidation, elementToShowProcessingNear, processingNearHTML, includeVeil, blockOtherCallBacks, metafuseAjaxPostBackObjectServerResponse, null, false, false, null);
};

MetafuseAjaxPostBackObject.prototype.DoAjaxPostComplex = MetafuseAjaxPostBackObject_DoAjaxPostComplex; //performs a complex post back with all options
function MetafuseAjaxPostBackObject_DoAjaxPostComplex(eventTarget, eventArgument, causesValidation, elementToShowProcessingNear, processingNearHTML, includeVeil, blockOtherCallBacks, metafuseAjaxPostBackObjectServerResponse, additionalNameValueParametersEncoded, excludeViewState, excludeAllFormElements, elementNamesToSendArray)
{

	if (UITools.EnableDebugOutput == true)
	{
		this.EnableDebug = true;
	}


	if (causesValidation && IsBrowserInternetExplorer())
	{
		if (typeof (Page_ClientValidate) == 'function')
		{
			Page_ClientValidate();
		}
		//make sure the page is valid
		if (!Page_IsValid)
		{
			return;
		}
	}

	var multipleCheckboxHash = new Object();
	var theData = '';
	var payload = new Array();
	var theform = document.forms[0];
	var thePage = window.location.pathname + window.location.search;
	//make sure we have a page file name and not a trailing slash here
	var sobj = new String(thePage);
	if (sobj.lastIndexOf("/") == (sobj.length - 1))
	{
		thePage = thePage + "default.aspx";
	};



	var eName = '';

	if (!eventTarget)
	{
		eventTarget = '';
	}
	if (!eventArgument)
	{
		eventArgument = '';
	}


	//get a stamp for the ajax call
	var timestamp = new Date().valueOf();

	var viewstate = "";


	//theData += '__AJAXPOSTBACKTS=' + timestamp + '&';//send the ajax post back timestamp
	//theData += '__EVENTTARGET=' + escape(eventTarget.split("$").join(":")) + '&';//event target
	//theData += '__EVENTARGUMENT=' + eventArgument + '&';//event argument

	payload[0] = '__AJAXPOSTBACKTS=' + timestamp;
	//payload[1] = '__EVENTTARGET=' + escape(eventTarget.split("$").join(":"));
	payload[1] = '__EVENTTARGET=' + escape(eventTarget);
	payload[2] = '__EVENTARGUMENT=' + encodeURIComponent(eventArgument);

	//if this is true
	if (!excludeViewState)
	{
		viewstate += '__VIEWSTATE=' + escape(theform.__VIEWSTATE.value).replace(new RegExp('\\+', 'g'), '%2b') + '&';

	}

	//if we are getting all the form elements the append them
	if (!excludeAllFormElements)
	{
		var radioElements = new Object();

		for (var i = 0; i < theform.elements.length; i++)
		{
			var element = theform.elements[i];

			eName = element.name;



			if (eName && eName != '')
			{

				if (eName == '__EVENTTARGET' || eName == '__EVENTARGUMENT' || eName == '__VIEWSTATE')
				{
					// Do Nothing Handled Above
				}
				else
				{
					//make sure we get the value for a radio button list only once
					var process = true;
					if (element.type == "radio")
					{
						if (radioElements[eName] != null)
						{
							process = false;
						}
						else
						{
							radioElements[eName] = true;
						}
					}

					if (process)
					{
						var getFormElementValue = true;
						var elementValue = "";

						//2007-04-14 STW determine if the checkbox is being repeated on the form and loop through checked ones if so
						if (element.type == "checkbox")
						{
							var checkboxElement = theform[eName];
							if (checkboxElement.length && checkboxElement.length > 1)
							{
								if (element.checked)
								{
									var checkboxValueArray = multipleCheckboxHash[eName];
									if (checkboxValueArray == null)
									{
										checkboxValueArray = new Array();
										multipleCheckboxHash[eName] = checkboxValueArray;
									}
									checkboxValueArray[checkboxValueArray.length] = element.value;
								}
							}
							else
							{
								//get the form element value needed for a post back
								elementValue = FormTools.GetFormElementValue(element);
							}
						}
						else
						{
							//get the form element value needed for a post back
							elementValue = FormTools.GetFormElementValue(element);
						}



						//STW 2006-04-03 Added this for radio button list exception may not be a good idea to skip
						//always, if this is a problem then we may need to branch by type
						//STW 2006-08-02 Discovered that if a control that uses RaisePostBack has a variable in a hidden
						//tag with the same name as the control and is included in the data sent, that the RaisePostBack event will not get fired

						//STW 2006-08-15 Discovered that the time text box and other controls need to have
						//the value sent back even if it is "" so that the viewstate is not accidentally
						//used by these controls.  Commented out the branch (elementValue != "") 
						//Let's keep an eye on things to see if they still function OK.

						if (elementValue != "" && element.type == "select-multiple")
						{
							var multipleSelectValues = elementValue.split(",");

							for (var z = 0; z < multipleSelectValues.length; z++)
							{
								//switched to encodeURIComponent so that characters in French etc would work

								//payload[payload.length] = encodeURIComponent(eName.split("$").join(":")) + '=' + encodeURIComponent(multipleSelectValues[z]);
								payload[payload.length] = encodeURIComponent(eName) + '=' + encodeURIComponent(multipleSelectValues[z]);

							}

						}
						else if (elementValue != "" || element.type != "checkbox")
						{
							/*
							//switched to encodeURIComponent so that characters in French etc would work
							theData = theData + encodeURIComponent(eName.split("$").join(":")) + '=' + encodeURIComponent(elementValue);
							
							if(i != theform.elements.length - 1)
							{
							theData = theData + '&';
							}
							*/

							//add to array
							//payload[payload.length] = encodeURIComponent(eName.split("$").join(":")) + '=' + encodeURIComponent(elementValue);
							payload[payload.length] = encodeURIComponent(eName) + '=' + encodeURIComponent(elementValue);

						}
					}
				}
			}
		}
	}

	//add the viewstate at the end for speed
	//var tp111 = new Date().valueOf();
	//alert(tp111 - timestamp);
	//tp111 = new Date().valueOf();

	if (multipleCheckboxHash != null)
	{
		for (var key in multipleCheckboxHash)
		{
			var cbArray = multipleCheckboxHash[key];
			//payload[payload.length] = encodeURIComponent(key.split("$").join(":")) + '=' + encodeURIComponent(cbArray.join(','));
			payload[payload.length] = encodeURIComponent(key) + '=' + encodeURIComponent(cbArray.join(','));
		}
	}

	//var tp112 = new Date().valueOf();
	///alert(tp112 - tp111);

	if (additionalNameValueParametersEncoded)
	{
		theData += "&" + additionalNameValueParametersEncoded;
	}

	//theData += "&" + viewstate;
	payload[payload.length] = viewstate;
	theData = payload.join('&');



	var serverResponse;
	if (metafuseAjaxPostBackObjectServerResponse == null)
	{
		serverResponse = new MetafuseAjaxPostBackObjectServerResponse()
	}
	else
	{
		serverResponse = metafuseAjaxPostBackObjectServerResponse;
	}


	if (elementToShowProcessingNear)
	{
		serverResponse.ElementToShowProcessingNear = elementToShowProcessingNear;
	}
	if (processingNearHTML != null && processingNearHTML != "")
	{
		serverResponse.ProcessingNearHTML = processingNearHTML;
	}
	serverResponse.IncludeVeil = includeVeil;

	//if we have an http object
	if (serverResponse.XmlHttp)
	{



		//if another call has blocked mine then wait my turn

		if (blockOtherCallBacks || this.CallBackQueue.length > 0)
		{



			this.CallBackQueue[this.CallBackQueue.length] = serverResponse.CallBackID;



			var waiting = true;

			//wait until it's my turn
			while (waiting == true)
			{
				var nextStamp = this.CallBackQueue[0];


				if (nextStamp == serverResponse.CallBackID)
				{
					waiting = false;
				}
				else
				{
					//alert("Another call is currently being processed.  Please wait.  Current Stamp: " + serverResponse.CallBackID + " Next Stamp: " + nextStamp);

					alert("Another call is currently being processed.  Please wait.");
					//  Current Stamp: " + serverResponse.CallBackID + " Next Stamp: " + nextStamp);

				}
			}

			//if we aren't blocking other call backs
			if (!blockOtherCallBacks)
			{
				this.CallBackQueue = this.CallBackQueue.splice(0, 1); //remove this call from the queue
			}
		}



		serverResponse.ShowProcessingMessage();
		var oThis = this;
		serverResponse.XmlHttp.open('POST', thePage, true);
		serverResponse.XmlHttp.onreadystatechange = function() { oThis.ReadyStateChange(serverResponse); };
		serverResponse.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		serverResponse.XmlHttp.setRequestHeader("Content-length", theData.length);
		serverResponse.XmlHttp.send(theData);

	}
	else
	{
		alert("Unable to create an XmlHttp object.  Please be sure you are using a modern browser (IE 5.5+, FireFox 1.1+, or Safari 1.1+) and that your ActiveX security setting, \"Script ActiveX controls marked safe for scripting,\" is enabled.");
	}
};


MetafuseAjaxPostBackObject.prototype.ReadyStateChange = function(serverResponse)
{

	//if the AJAX master is enabled for debug set it on this instance 
	if (this.EnableDebug == true)
	{
		serverResponse.EnableDebug = this.EnableDebug;
	}


	if (serverResponse.XmlHttp.readyState == 1)
	{
		serverResponse.StartDateTime = new Date();
		//InsertHTML("<div>" + serverResponse.StartDateTime.toString() + "</div>");
		window.status = "AJAX call connecting...";
		serverResponse.OnLoading(serverResponse);
	}
	else if (serverResponse.XmlHttp.readyState == 2)
	{
		if (!serverResponse.StartDateTime)
		{
			serverResponse.StartDateTime = new Date();
		}
		window.status = "AJAX call loaded...";

		serverResponse.OnLoaded(serverResponse);
	}
	else if (serverResponse.XmlHttp.readyState == 3)
	{
		window.status = "AJAX call processing...";

		serverResponse.OnInteractive(serverResponse);
	}
	else if (serverResponse.XmlHttp.readyState == 4)
	{
		window.status = "AJAX call received...";


		if (serverResponse.XmlHttp.status == 0)
		{
			serverResponse.OnAbort(serverResponse);

			//hide the processing message
			serverResponse.HideProcessingMessage();

			//dequeue the call back
			this.DeQueueCallBackQueue(serverResponse);

		}
		else if ((serverResponse.XmlHttp.status == 200 && serverResponse.XmlHttp.statusText == "OK" && serverResponse.XmlHttp.responseText.substring(0, 16) != "<!--ERRORPAGE-->") || (BrowserTools.IsSafari() && serverResponse.XmlHttp.responseText == null))
		{

			var responseText = serverResponse.XmlHttp.responseText;

			//we should get a response string always, but in case we don't just skip over it
			if (responseText != null && responseText.length > 0)
			{
				var isValidString = responseText.substring(0, 1);

				serverResponse.ResponseText = responseText.substring(1, responseText.length - 1);

				//if not valid
				if (isValidString == "0")
				{
					serverResponse.IsValid = false;
				}
			}


			serverResponse.OnBeforeExecuteSuccessfulResponse(serverResponse);
			serverResponse.OnExecuteSuccessfulResponse(serverResponse);

			var endTime = new Date;

			serverResponse.EndDateTime = endTime;

			var deltaTime = "";
			if (serverResponse.StartDateTime)
			{
				try
				{
					deltaTime = ((endTime.getTime() - serverResponse.StartDateTime.getTime()) / 1000);
				}
				catch (ex)
				{
					//do nothing
				}
			}

			if (deltaTime != "")
			{
				window.status = "AJAX call complete - " + deltaTime.toString() + " secs";
			}
			else
			{
				window.status = "AJAX call complete";
			}

			//hide the processing message
			serverResponse.HideProcessingMessage();

			//dequeue the call back
			this.DeQueueCallBackQueue(serverResponse);

			//after executing the sucessful call back execute the event
			serverResponse.OnAfterExecuteSuccessfulResponse(serverResponse);





		}
		else
		{


			serverResponse.OnBeforeProcessErrorMessage(serverResponse);
			serverResponse.OnProcessErrorMessage(serverResponse);
			window.status = "AJAX call error";

			//hide the processing message
			serverResponse.HideProcessingMessage();

			//dequeue the call back
			this.DeQueueCallBackQueue(serverResponse);

			//execute after processing message
			serverResponse.OnAfterProcessErrorMessage(serverResponse);



		}


	}
};
MetafuseAjaxPostBackObject.prototype.DeQueueCallBackQueue = function(serverResponse)
{
	//remove the item from the queue if it is equal to the stamp
	//if we aren't blocking other call backs
	if (this.CallBackQueue.length > 0)
	{
		if (serverResponse.CallBackID == this.CallBackQueue[0])
		{
			this.CallBackQueue.splice(0, 1); //remove this call from the queue
		}
	}
};

var Ajax = new MetafuseAjaxPostBackObject();



/*********************************************************************************
Ajax Post Back Object Server Response 
**********************************************************************************/
function MetafuseAjaxPostBackObjectServerResponse()
{

	//set the call back time stamp
	this.CallBackTS = new Date().valueOf();
	this.CallBackID = NewGuid() + this.CallBackTS;

	this.StartDateTime;
	this.EndDateTime;

	//get xml http object
	//alert('get xml http');
	this.XmlHttp = GetXmlHttp();

	this.ElementToShowProcessingNear = null;
	this.ProcessingDiv = null;
	this.ProcessingIFrame = null;
	this.ProcessingNearHTML = "Processing...";
	this.IncludeVeil = false;


	this.ResponseText = null; //must be null

	this.IsValid = true;

	this.EnableDebug = false;
};


/************************************************************************************************
Ajax Call Processing Functions
*************************************************************************************************/
//manual function to abort the current post back
MetafuseAjaxPostBackObjectServerResponse.prototype.AbortPostBack = function(metafuseAjaxPostBackObjectServerResponse)
{
	if (metafuseAjaxPostBackObjectServerResponse.XmlHttp)
	{
		metafuseAjaxPostBackObjectServerResponse.XmlHttp.abort();
	}
	metafuseAjaxPostBackObjectServerResponse.OnAbort(metafuseAjaxPostBackObjectServerResponse);
};
MetafuseAjaxPostBackObjectServerResponse.prototype.OnLoading = function(metafuseAjaxPostBackObjectServerResponse) { };
MetafuseAjaxPostBackObjectServerResponse.prototype.OnLoaded = function(metafuseAjaxPostBackObjectServerResponse) { };
MetafuseAjaxPostBackObjectServerResponse.prototype.OnInteractive = function(metafuseAjaxPostBackObjectServerResponse) { };
MetafuseAjaxPostBackObjectServerResponse.prototype.OnAbort = function(metafuseAjaxPostBackObjectServerResponse) { };
MetafuseAjaxPostBackObjectServerResponse.prototype.OnBeforeExecuteSuccessfulResponse = function(metafuseAjaxPostBackObjectServerResponse) { };
MetafuseAjaxPostBackObjectServerResponse.prototype.OnExecuteSuccessfulResponse = function(metafuseAjaxPostBackObjectServerResponse)
{
	if (this.EnableDebug == true)
	{
		if (metafuseAjaxPostBackObjectServerResponse.ResponseText != null)
		{
			var textBoxId = "textBoxOutputProcessId_" + NewGuid();
			InsertHTML("<div><p/>Response Received: " + new Date().toString() + " : Below :</p></div><textarea id=\"" + textBoxId + "\" style=\"width:100%\" rows=\"10\">" + metafuseAjaxPostBackObjectServerResponse.ResponseText + "</textarea><br/><a href=\"javascript:\" onclick=\"eval(FormTools.GetFormElementValue('" + textBoxId + "'));\">Re-Execute Contents</a>");
		}
		else
		{
			InsertHTML("<div><p/>Response Received: " + new Date().toString() + " : No Response</p></div> ");
		}
	}
	try
	{

		var s = metafuseAjaxPostBackObjectServerResponse.ResponseText;
		eval(s);

	}
	catch (e)
	{
		alert("The request was successful, however, a javascript error occurred while updating the form/document.\n\n  The error will be shown and the text response output.\n\n  Please take screen shots of each alert, then send it to support.\n\n Reload the form by navigating away and back to the form to try again.");
		__Dump(e);
		alert(metafuseAjaxPostBackObjectServerResponse.ResponseText);
	}
};
MetafuseAjaxPostBackObjectServerResponse.prototype.OnAfterExecuteSuccessfulResponse = function(metafuseAjaxPostBackObjectServerResponse) { };
MetafuseAjaxPostBackObjectServerResponse.prototype.OnBeforeProcessErrorMessage = function(metafuseAjaxPostBackObjectServerResponse) { };
MetafuseAjaxPostBackObjectServerResponse.prototype.OnProcessErrorMessage = function(metafuseAjaxPostBackObjectServerResponse)
{
	//alert('An error occurred on the server while processing your request.  Please use the "Help" link above to report the steps required to reproduce this error.');
	if (this.EnableDebug
		&& metafuseAjaxPostBackObjectServerResponse.XmlHttp.responseText.substring(0, 16) != "<!--ERRORPAGE-->"
		&& metafuseAjaxPostBackObjectServerResponse.XmlHttp.responseText.substring(0, 22) != "<!--VALIDATEREQUEST-->")
	{
		InsertHTML("<div>Error:<br/>" + metafuseAjaxPostBackObjectServerResponse.XmlHttp.responseText + "</div>");
	}
	else
	{
		if (metafuseAjaxPostBackObjectServerResponse.XmlHttp.responseText.substring(0, 22) == "<!--VALIDATEREQUEST-->")
		{
			document.location.href = Root + "/Site/Errors/ValidateRequest.aspx";
		}
		else
		{
			document.location.href = Root + "/Site/Errors/500.aspx";
		}
	}
};
MetafuseAjaxPostBackObjectServerResponse.prototype.OnAfterProcessErrorMessage = function(metafuseAjaxPostBackObjectServerResponse) { };

/************************************************************************************************
Show Hide Processing Messages
*************************************************************************************************/
//shows the processing message
MetafuseAjaxPostBackObjectServerResponse.prototype.ShowProcessingMessage = MetafuseAjaxPostBackObjectServerResponse_ShowProcessingMessage;
function MetafuseAjaxPostBackObjectServerResponse_ShowProcessingMessage()
{

	if (this.ElementToShowProcessingNear)
	{


		if (isString(this.ElementToShowProcessingNear))
		{
			this.ElementToShowProcessingNear = GetElementById(this.ElementToShowProcessingNear);
		}

		if (this.ElementToShowProcessingNear)
		{

			var x = UITools.GetPageXCoordinate(this.ElementToShowProcessingNear);
			var y = UITools.GetPageYCoordinate(this.ElementToShowProcessingNear);


			this.ProcessingDiv = this.CreateProcessingDiv(this.CallBackTS, this.ProcessingNearHTML);
			if (BrowserTools.IsInternetExplorer())
			{
				this.ProcessingIFrame = this.CreateProcessingIFrame(this.CallBackTS);
			}

			UITools.ShowDivAndIFrameAtXY(x, y, this.ProcessingDiv, this.ProcessingIFrame, 0, 0, this.IncludeVeil);

		}

	}
};

//hides the processing message
MetafuseAjaxPostBackObjectServerResponse.prototype.HideProcessingMessage = MetafuseAjaxPostBackObjectServerResponse_HideProcessingMessage;
function MetafuseAjaxPostBackObjectServerResponse_HideProcessingMessage()
{

	if (this.ProcessingDiv != null || this.ProcessingIFrame != null)
	{
		UITools.HideDivAndIFrame(this.ProcessingDiv, this.ProcessingIFrame);

		if (this.ProcessingDiv != null)
		{
			document.forms[0].removeChild(this.ProcessingDiv);
		}
		if (this.ProcessingIFrame != null)
		{
			document.forms[0].removeChild(this.ProcessingIFrame);
		}
	}
};

//creates the processing div and i frame for use in showing and hiding 
MetafuseAjaxPostBackObjectServerResponse.prototype.CreateProcessingDiv = MetafuseAjaxPostBackObjectServerResponse_CreateProcessingDiv;
function MetafuseAjaxPostBackObjectServerResponse_CreateProcessingDiv(timestamp, processingNearHTML)
{

	if (processingNearHTML == null || processingNearHTML == "")
	{
		processingNearHTML = "Processing...";
	}

	var processingDivName = "ajaxObjectProcessingDiv_" + timestamp;
	var divHTML = "<div id=\"" + processingDivName + "\" class=\"AjaxLoadingDiv\" style=\"position: absolute; z-index: 30000;padding:3px; display:none;\">" + processingNearHTML + "</div>";
	InsertHTML(divHTML);
	return GetElementById(processingDivName);
};

MetafuseAjaxPostBackObjectServerResponse.prototype.CreateProcessingIFrame = MetafuseAjaxPostBackObjectServerResponse_CreateProcessingIFrame;
function MetafuseAjaxPostBackObjectServerResponse_CreateProcessingIFrame(timestamp)
{
	var processingIFrameName = "ajaxObjectProcessingIFrame_" + timestamp;
	var iFrameHTML = "<iframe id=\"" + processingIFrameName + "\" src=\"javascript:false;\" scrolling=\"no\" frameborder=\"0\" style=\"position:absolute; top:0px; left:0px; display:none;\"></iframe>";
	InsertHTML(iFrameHTML);
	return GetElementById(processingIFrameName);
};



function MAPBB(eventTarget, eventArgument, causesValidation, elementToShowProcessingNear, processingHTML, includeVeil, blockOtherCallBacks, onBeforeAjaxPostBackCall, metafuseTableToSave, onAfterAjaxPostBackCall)
{
	var keepGoing = true;
	if (onBeforeAjaxPostBackCall)
	{
		keepGoing = onBeforeAjaxPostBackCall();
	}
	if (keepGoing)
	{
		if (metafuseTableToSave)
		{
			metafuseTableToSave.SerializeUpdateXml();
		}

		var pbr = new MetafuseAjaxPostBackObjectServerResponse();
		if (onAfterAjaxPostBackCall)
		{
			pbr.OnAfterExecuteSuccessfulResponse = onAfterAjaxPostBackCall;
		}

		Ajax.DoAjaxPostBack(eventTarget, eventArgument, causesValidation, elementToShowProcessingNear, processingHTML, includeVeil, blockOtherCallBacks, pbr);
	}
}