function DoPostBack(CommandName, Params)
{
	document.forms[0].CommandName.value = CommandName;
	document.forms[0].Params.value = Params;
	document.forms[0].submit();
}

function ConfirmAction()
{
	return confirm("Are you sure?");
}

function EmptyValidate(ControlsToEmptyValidate, ErrorMessagesControls)
{
	var Result = true;
	
	for (i = 0; i < ControlsToEmptyValidate.length; i++)
	{
		var CurrentControl = document.getElementById(ControlsToEmptyValidate[i]);
		if (CurrentControl.value == "")
		{
			var ErrorMessageControl = document.getElementById(ErrorMessagesControls[i]);
			ErrorMessageControl.style.display = "";
			Result = false;
		}
	}
	
	return Result;
}

function FormatValidate(ControlsToFormatValidate, FormatsOfControls,  FormatErrorMessagesControls)
{
	var Result = true;
	
	for (i = 0; i < ControlsToFormatValidate.length; i++)
	{
		var CurrentControl = document.getElementById(ControlsToFormatValidate[i]);
		var RegExpInst = new RegExp(FormatsOfControls[i]);
		
		if (!RegExpInst.test(CurrentControl.value))
		{
			var ErrorMessageControl = document.getElementById(FormatErrorMessagesControls[i]);
			ErrorMessageControl.style.display = "";
			Result = false;
		}
	}
		
	return Result;
}

function ClearErrorMessages(Controls)
{
	for (i = 0; i < Controls.length; i++)
	{
		for (j = 0; j < Controls[i].length; j++)
		{
			var CurrentControl = document.getElementById(Controls[i][j]);
			CurrentControl.style.display = "none";
		}
	}
}