function __doExecute(strPanelName, aParams, strURL, strForm)
{
	if (strForm != null && strForm != "")
	{
		//	inputs
		$('form[@id=' + strForm + '] input').each(function(i)
			{
				if ((this.type != 'radio' && this.type != 'checkbox') || this.checked)
				{
					if (this.type == 'checkbox')
					  aParams[this.name] = (aParams[this.name] != "" && aParams[this.name] != null ? aParams[this.name] + "," : "") + this.value;
					else
					  aParams[this.name] = this.value;
				}
			});

		//	textareas
		$('form[@id=' + strForm + '] textarea').each(function(i){
			  aParams[this.name] = this.value;
			});
	}

	aParams["__is_postback"] = "true";
	$('#' + strPanelName).load(strURL, aParams);
	return false;
}

function __doExecute2(strPanelName, aParams, strURL, strForm)
{
	try
	{
		var strThisForm = strForm;

		if (strForm != null && strForm != "")
		{
			if ($('form[@id=' + strThisForm + ']').attr("in_process") == "true")
			{
				alert("Data sending to server")
				return false;
			}

			//	inputs
			$('form[@id=' + strForm + '] input').each(function(i)
				{
					
					if ((this.type != 'radio' && this.type != 'checkbox') || this.checked)
					{
						if (this.type == 'checkbox')
						  aParams[this.name] = (aParams[this.name] != "" && aParams[this.name] != null ? aParams[this.name] + "," : "") + this.value;
						else
						  aParams[this.name] = this.value;
					}
				});

			//	textareas
			$('form[@id=' + strForm + '] textarea').each(function(i){
				  aParams[this.name] = this.value;
				});

			//	select
			$('form[@id=' + strForm + '] select').each(function(i)
			{
				if (this.multiple != true)
					aParams[this.name] = this.value;
				else
				{
					var strSelectName = this.name;
					aParams[strSelectName] = "";
					$('form[@id=' + strForm + '] select[@name=' + this.name + '] option').each(function(i)
					{
						if ($(this).attr("selected"))
							aParams[strSelectName] += (aParams[strSelectName] != "" ? "," : "") + $(this).val();
					});
				}
			});

			try
			{
				if (tinyMCE != null)
				{
					$('textarea').each(function(i)
					{
						try
						{
							var oTinyMceEditor = tinyMCE.get(this.id);
							//	Добавляем из HTML редактора
							if (oTinyMceEditor != null)
								aParams[this.id] = oTinyMceEditor.getContent();
						}
						catch(e) {}
					});
				}
			}
			catch(e) {}


			$('form[@id=' + strForm + ']').attr("in_process", "true");
		}

		var strThisPanelName = strPanelName.split('.')[0];
		$('#' + strThisPanelName).addClass("submited");

		aParams["__is_postback"] = "true";
		aParams["__is_postback_panel"] = strPanelName;

		$('#AjaxResult').load(strURL, aParams, function()
		{
			if (strThisForm != null)
				$('form[@id=' + strThisForm + ']').attr("in_process", "false");
			strThisForm = null;

			$('#' + strThisPanelName).removeClass("submited");

			var bIsError = false;
			var oLastElement = null;	

			$('#AjaxResult #Message').each(function(i)
			{
				alert(this.innerText)
				bIsError = true;
			});

			if (bIsError == false)
			{
				
				$('#AjaxResult').children().each(function(i)
				{
					if (this.id != this.id.replace("_postback", ""))
						$("#" + this.id.replace("_postback", "")).html(this.innerHTML);
				});
			}
	
			$("#AjaxResult").html("");
		});
	}
	catch(e) {}
	
	return false;
}

function RegisterAjaxPostBackParameter(strName, strValue)
{
}

function RefreshPanel(strPanelName, nInterval, strURL)
{
	setTimeout("__doExecute('" + strPanelName + "', {}, '" + strURL + "');", nInterval * 1000);
}

function RefreshPanel2(strPanelName, nInterval, strURL, strParams)
{
	setTimeout("__doExecute2('" + strPanelName + "', " + strParams + ", '" + strURL + "');", nInterval * 1000);
}