var flag_no_javascript = false;
function test_value(val) {

	if (val == undefined) {
		val = '';
	} else {
		val = trim(val);
	}
	return val;
}


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) {

	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) {
	form = test_value(form);
	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) {
		if((page=='billing') && (todo=='display_do')) {
			return true;
		} else {
			submit_action_form(page, todo);
		}
	}
	return false;
}
function update_div(request, json, update_div) {

	if (json == undefined ) {
		html =request.responseText;
		html = typeof html == 'undefined' ? '' : html.toString();
		if (update_div == undefined) {
			update_div = 'content';
		}
		if (html != undefined && update_div != undefined) {
			obj = document.getElementById(update_div);
			obj.innerHTML = html.stripScripts();
			window.eval_frame_scripts(html);
			return;
		}
	}

}
function eval_frame_scripts(html) {
	setTimeout(function() {html.evalScripts()}, 10);
}

