function add_select_option(select_id,text,value) {
var select_eid = document.getElementById(select_id);
if (!select_eid || !text || !value) { return false; }
var option = document.createElement('option');
option.setAttribute('value',key);
var text = document.createTextNode(value);
option.appendChild(text);
select_eid.appendChild(option);
return true;
}
function remove_select_option(select_id,index) {
var select_eid = document.getElementById(select_id);
if (!select_eid || typeof(index) != 'number') { return false; }
if (!select_eid.options[index]) { return false; }
var remove_eid = select_eid.options[index];
select_eid.removeChild(remove_eid);
return true;
}
function clear_select_options(select_id) {
var select_eid = document.getElementById(select_id);
if (!select_eid) { return false; }
var kids = select_eid.options.length;
for (var i = 0;i <= kids;i++) {
// Remove the zeroth element as many times as there are items
remove_select_option(select_id,0);
}
return true;
}