var flag_no_javascript = false;
function test_value(val) {
	
	if (val == undefined) {
		val = '';
	} else {
		val = trim(val);
	}
	return val;
}

function set_anchor(name) {
	obj = document.action_form.num_anchor;
	if (obj != undefined) {
		obj.value=name;
	}
}
function submit_action_form(page, todo, anhor, action, target) {
	// hack! ask for denis
	if(action != undefined){
		document.action_form.action = action;
	} 
	/*else {
		document.action_form.action = './index.php';
	}*/
	if (target != undefined) {
		document.action_form.target = target;
	} else {
		document.action_form.target = '_self';
	}
	anhor = test_value(anhor);
	if (anhor!='') {
		document.action_form.action += anhor;
	}
    document.action_form.elements['actioncontext[page]'].value = test_value(page);
    document.action_form.elements['actioncontext[todo]'].value = test_value(todo);
	
	document.action_form.submit();
    return false;
};


function submit_menu (page, todo,action) {
	if(action != undefined){
		
		document.menu.action = action;
	} 
	
	document.menu.elements['ap'].value = test_value(page);
    document.menu.elements['at'].value = test_value(todo);
    document.menu.submit();
    return false;
}


function submit_f( page, todo, form, form_name,anhor, action,target) {	
	
	form_name = test_value(form_name);
	todo = test_value(todo);
	page = test_value(page);
	if (form == '') {
		form = document.action_form;
	} 
	if (form_name == '') {
		form_name = 'action_form';
	}
	if (!flag_no_javascript) {
		var flag = test_f(form, form_name);
	} else {
		var flag = true;
	}		
	if (flag) {
		
		submit_action_form(page, todo,anhor, action,target);
		
	}
	return false;	
}