function formPost(form)
{
	if(postRequest==''||postRequest==null)
		return true;
	var params = new Array();
	params.push(outcomeValue);
	for(var i=form.length-1;i>=0;--i)
	{
		el = form.elements[i];
		switch(el.type)
		{
			case 'hidden':
			case 'image':
			case 'submit':
				if(el.getAttribute('request')!=postRequest)
					break;
			case 'checkbox':
			case 'radio':
				if(!el.checked)
					break;
				// else, use default
			default:
				params.push(encodeURIComponent(el.name)+"="+encodeURIComponent(el.value));
		}
	}
	ajaxEngine.sendRequest(postRequest, {method:'post',parameters:params.join("&")});
	postRequest='';
	outcomeValue='';
	return false;
}

function multiSelect(sel, request)
{
	lg = sel.options.length;
	requestCommand = 'ajaxEngine.sendRequest(\''+request+'\'';
	none = true;
	for(i=0;i<lg;i++)
	{
		opt = sel.options[i];
		if(opt.selected)
		{
			requestCommand = requestCommand +',\''+sel.name+'='+opt.value+'\'';
			none = false;
		}
	}
	if(none)
		requestCommand = requestCommand +',\''+sel.name+'=\'';
	eval(requestCommand+')');
}


/**
* focus can be set inside an input via 
* setfocus from items properties in the layout editor.
* focusId is then initialized in layoutitems.xsl.The body (@see html.body.xsl) contains 
* a script which calls this method.
*/
function setFocus()
{
 	if(focusItemId != "") 
 	{
    	var list=document.getElementsByTagName("input");
		for(j=0;j<list.length;j++)
		{
			if(list[j].name==focusItemId)
			{
				list[j].focus();
		  		break;
			}
		}
    }
}


