String.prototype.trim = function() {
  return this.replace(/^\s+|\s+$/g,"");
  // return this.replace(/^\s+/g,"").replace(/\s+$/g,"");
}
    

function g(ctrl) {
  return document.getElementById(ctrl);
}

function gg(ctrl) {
  return document.getElementsByName(ctrl);
}

function pick_prim(ctrl, pickvalue) {
  for (var i=0; i<ctrl.length; ++i) {
    if (ctrl.options[i].value == pickvalue) {
      ctrl.selectedIndex = i;
      break;
    }
  }
}

function pick(ctrl, pickvalue) {
  pick_prim(g(ctrl), pickvalue);
}