/**
 * A little helper that will post a form with arbitrary number of fields in it.
 * 
 * @param Object fields An object containing the field names and their values.
 * @param String action A string containing the url to post to (default = the current url with the query string stripped).
 * @param String method "get" or "post" (default = "post").
 */
function inlineSubmit(fields, method, action, target)
{
	if (typeof action == 'undefined' || action === null) {
		action = document.location.href.split('?')[0];
	}
	if (typeof method == 'undefined' || method === null) {
		method = 'post';
	}
	if (typeof target == 'undefined' || target === null) {
		target = null;
	}	
	var form = document.createElement('form');
	form.action = action;
	form.method = method;
	if (target !== null) form.target = target;	
	for (var i in fields) {
		var input = document.createElement('input');
		input.type = 'hidden';
		input.name = i;
		input.value = fields[i];
		form.appendChild(input);
	}
	document.body.appendChild(form);
	form.submit();
}
