var load_select;

function on_loaded(oj) {

  var res  = decodeURIComponent(oj.responseText);

  var cols = res.split(",");

  if (cols.length >= 1) {

    for (i=0; i<cols.length; i++) {

      var option = cols[i].split("=");

      if (option.length >= 2) {

	load_select.options[load_select.length] = new Option(option[1], option[0]);
      }
    }
  }
}

function clearOptions(select) {

  if (select == null) {

    return;
  }

  var len = select.length;

  for (i=1; i<len; i++) {

    select.options[select.length-1] = null;
  }

  select.seletedIndex = 0;
}

function loadOptions(select, server_url) {

  load_select = select;

  sendRequest(on_loaded, '', 'GET', server_url, false, true);
}

