// <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
function FormSender(FSDestPath, FormId, HideId, Async) {
if (!FSDestPath || !FormId) return false;
if (!Async) Async = false;

if ($(FormId + "_error")) $(FormId + "_error").hide();

new Ajax.Request(FSDestPath, 											  
	{
	 requestHeaders: ['Content-Type', 'application/x-www-form-urlencoded',
					  'Accept-Charset', 'utf-8'],
	 asynchronous: Async,
	 evalScripts: true,
	 postBody: getRequestBody($(FormId)),
	 method: 'post', 
	 onSuccess: function(transport) {
		 var response = transport.responseText; 
		 eval(response);

		 	if (has_errors != 1 && successful == 1) {
			$(HideId).style.display = "none";
			var ok_block = HideId+"_ok";
			if (HideId != FormId) $(ok_block).innerHTML = $(FormId+"_ok").innerHTML;
			$(ok_block).style.display = "block";
			}
		 }
	}
	);
}


function getRequestBody(oForm)
{
		var encode = 0;
		var aParams = new Array();
			for (var i=0; i < oForm.elements.length; i++) {
				if (oForm.elements[i].type == "checkbox" || oForm.elements[i].type == "radio") {
					if (oForm.elements[i].checked == true) encode = 1;
					else encode = 0;
				}
				else encode = 1;
				
				if (encode == 1) {
				var sParam = encodeURIComponent(oForm.elements[i].name);
				sParam += "=";
				sParam += encodeURIComponent(oForm.elements[i].value);
				aParams.push(sParam);
				}
			}
		return aParams.join("&");
}

//---------------------------------

function LocalRequest(LRDestPath, Params, Settings) {
if (!LRDestPath) return false;

var Async = true;
if (Settings) {
	if (Settings["async"] == false) Async = false;
}

var aParams = new Array();
for (n in Params)
{
	var sParam = encodeURIComponent(n);
	sParam += "=";
	sParam += encodeURIComponent(Params[n]);
	aParams.push(sParam);
}
var paramstring = aParams.join("&");						
						
						
new Ajax.Request(LRDestPath, 											  
	{
	 requestHeaders: ['Content-Type', 'application/x-www-form-urlencoded',
					  'Accept-Charset', 'utf-8'],
	 parameters: paramstring,
	 method: 'post', 
	 asynchronous: Async,
	 evalScripts: true,
	 onSuccess: function(transport) {eval(transport.responseText);}
	}
	);
}


//--------------------------

function i_panel(icon_id, content_block_id) {
var icon = 		$(icon_id);
var content = 	$(content_block_id);

	if (content.style.display == "none") {
	icon.src = "/images/on.gif";
	content.show();
	} else {
	icon.src = "/images/off.gif";
	content.hide();
	}
}

