/*
 * Set the value of the DOM element with the specified id.
 */
function set_value(id, value) {
	document.getElementById(id).value = value;
}

/*
 * Get the value of the DOM element with the specified id.
 */
function get_value(id) {
	return document.getElementById(id).value;
}

/*
 * Hide the DOM element with the specified id.
 */
function hide_element(id) {
	var el = document.getElementById(id);
	if (el && typeof el != "undefined") {
		el.style.display="none";
	}
}

/*
 * Show the DOM element with the specified id.
 */
function show_block_element(id) {
	var el = document.getElementById(id);
	if (el && typeof el != "undefined") {
		el.style.display="block";
	}
}

/*
 * Show the DOM element with the specified id.
 */
function show_inline_element(id) {
	var el = document.getElementById(id);
	if (el && typeof el != "undefined") {
		el.style.display="inline";
	}
}

/*
 * Get a list of elements whose name property match the specified name.
 */
function get_list_by_name(name) {
	return document.getElementsByName(name);
}

/*
 * Show the elements in the list using style.display = inline
 */
function show_inline_list(list) {
	for (var i = 0; i < list.length; i++) {
		list[i].style.display="inline";
	}
}

/*
 * Show the elements in the list using style.display = block
 */
function show_block_list(list) {
	for (var i = 0; i < list.length; i++) {
		list[i].style.display="block";
	}
}

/*
 * Show the elements in the list using style.display = ""
 */
function show_default_style_list(list) {
	for (var i = 0; i < list.length; i++) {
		list[i].style.display="";
	}
}

function remove_options_from_select(select_el_id) {
	var select_el = document.getElementById(select_el_id);
	var option_list = select_el.options;
        for (var i = option_list.length; i > 0; i--) {
                option_list.remove(i);
        }
}

