// ==========================================================
// Form Controller
// Webpress - Client Script
// ==========================================================

function doPostBack(targetForm, eventSource, eventType)
{
	var activeForm = document.forms[targetForm];
	activeForm.__EVENT_SOURCE.value = eventSource;
	activeForm.__EVENT_TYPE.value = eventType;
	activeForm.submit();

	return false;
}

function doAjaxPostBack(targetForm, eventSource, eventType, responseType)
{
	var activeForm = document.forms[targetForm];
	var params = "__POSTBACK=true&__FUNCTION=" + eventSource + "_" + eventType;
	for(n = 0; n < activeForm.elements.length; n++)
	{
		params += "&" + activeForm.elements[n].name + "=" + activeForm.elements[n].value;
	}
	
	jQuery.get( document.location.href , params, eval(eventSource + "_OnAjaxResponse"), responseType);
}


function doValidatePostBack(targetForm, eventSource, eventType)
{
	var activeForm = document.forms[targetForm];
	activeForm.__EVENT_SOURCE.value = eventSource;
	activeForm.__EVENT_TYPE.value = eventType;
	
	if(customValidateScript())
	{
		activeForm.submit();
	}

	return false;
}