function FSAWebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit, bDisableOnClick, sDisableMessage, bShowConfirmBox, sConfirmMessage, bDisableAllButtons, sHiddenField)
{
    this.eventTarget = eventTarget;
    this.eventArgument = eventArgument;
    this.validation = validation;
    this.validationGroup = validationGroup;
    this.actionUrl = actionUrl;
    this.trackFocus = trackFocus;
    this.clientSubmit = clientSubmit;
    this.DisableOnClick = bDisableOnClick;
    this.DisableMessage = sDisableMessage;
    this.ShowConfirmBox = bShowConfirmBox;
    this.ConfirmMessage = sConfirmMessage;
    this.DisableAllButtons = bDisableAllButtons;
    this.HiddenField = sHiddenField;
}
function FSAWebForm_DoPostBackWithOptions(options)
{  
	
	var validationResult = true;
	var forceSubmit = false;
	
	var targetControlArray = document.getElementsByName(options.eventTarget);
	if(targetControlArray.length == 0)
	{
		return false;
	}
	var targetControl = targetControlArray[0];
	var theForm = targetControl.form;
	var hiddenField = document.getElementById(options.HiddenField);
	    
	// First things first - Check if we are valid
	if (options.validation)
	{
		if (typeof(Page_ClientValidate) == 'function')
		{
			validationResult = Page_ClientValidate(options.validationGroup);
		}
	}


	if (validationResult)
	{
	    // If we are valid, check if we need to show the confirm box
	    if (options.ShowConfirmBox)
	    {
		    if (!confirm(options.ConfirmMessage))
		    {
			    // Forcefully block the submission
			    Page_BlockSubmit = true;
    			
			    // Exit
			    return false;
		    }
	    }
	    
		// Do we need to disable the control?
		if (options.DisableOnClick)
		{
			// Disable the SearchButton
			targetControl.disabled = true;
			
			// Set the disabled text of the button
			targetControl.value = options.DisableMessage;
			
			// Set the name of the hidden contol
			hiddenField.name = options.eventTarget;
			
			// Change cursor to hourglass
			document.body.style.cursor = "wait";
			
			// Do we need to disable all buttons?
			if (options.DisableAllButtons)
			{
				// Loop through all the form elements, and disable any buttons
				for(var f=0;f<document.forms.length;f++)
				{
					for (var i=0; i < document.forms[f].elements.length;i++)
					{
						if(document.forms[f].elements[i].type == "button" || document.forms[f].elements[i].type == "submit")
						{
						document.forms[f].elements[i].disabled = true;
						}
					}
				}
			}			
			// Submit the form by forcefully calling __doPostBack
			// Since the button is disabled, it won't submit automatically
			var forceSubmit = true;
			
		}				
		// Other standard actions that the framework should perform
		if ((typeof(options.actionUrl) != "undefined") && (options.actionUrl != null) && (options.actionUrl.length > 0))
		{
			theForm.action = options.actionUrl;
		}
		if (options.trackFocus)
		{
			var lastFocus = theForm.elements["__LASTFOCUS"];
			if ((typeof(lastFocus) != "undefined") && (lastFocus != null))
			{
				if (typeof(document.activeElement) == "undefined")
				{
					lastFocus.value = options.eventTarget;
				}
				else
				{
					var active = document.activeElement;
					if ((typeof(active.id) != "undefined") && (active != null))
					{
						if ((typeof(active.id) != "undefined") && (active.id != null) && (active.id.length > 0))
						{
							lastFocus.value = active.id;
						}
						else if (typeof(active.name) != "undefined")
						{
							lastFocus.value = active.name;
						}
					}
				}
			}
		}
	}    
    
	if (options.clientSubmit || forceSubmit)
	{
		if (typeof(__doPostBack) == 'function')
		{
			__doPostBack(options.eventTarget, options.eventArgument);
		}
		else
		{
			if (!theForm.onsubmit || (theForm.onsubmit() != false)) 
			{
				theForm.__EVENTTARGET.value = options.eventTarget;
				theForm.__EVENTARGUMENT.value = options.eventArgument;
				theForm.submit();
			}
		}
	}
	return true;
}