ajaxApply = new sack();

function whenLoading(form){
	var e = document.getElementById(form); 
	e.innerHTML = "<img src=\"/images/ajax_load.gif\" />";
}

function whenLoaded(form){
	// nothing
}

function whenInteractive(form){
	// nothing
}

function whenCompleted(form, msg){
	var e = document.getElementById(form); 
	if (ajaxApply.responseStatus){
		var string = ajaxApply.response;
	} else {
		var string = "Error!";
	}
	e.innerHTML = string;	
}

function sendMail(form, responseform)
{

	ajaxApply.requestFile = '/kontakt/';
	if (ajaxApply.failed) return true;
	ajaxApply.element = 'response';
	ajaxApply.method = 'POST';
	ajaxApply.onLoading = function() { whenLoading(responseform) };
	ajaxApply.onLoaded = function() { whenLoaded(responseform) };
	ajaxApply.onInteractive = function() { whenInteractive(responseform) };
	ajaxApply.onCompletion = function() { whenCompleted(responseform) };

	filterForm = Form.getElements(form);
	for(var n = 0; n < filterForm.length; n++)
	{
		//filterForm[n].disabled = true;
		ajaxApply.setVar(filterForm[n].name, Form.Element.getValue(filterForm[n]));;
	}

	ajaxApply.runAJAX(Form.serialize(form));
	
	return true;	
}