function invokePlayerBrowse(dest, rnf)
{
//  alert('Things are happening!');
  window.open('index.php?content1=sbperson&dest=' + dest + '&rnf=' + rnf, 'PersonSearch', 'width=350,height=400,scrollbars=yes,left=500,top=200');
  return;
}

function movePlayer( lbFrom, lbTo ) {
  var i;
  var iTo;
  var item;
  iTo = lbTo.options.length;
  for ( i = 0; i < lbFrom.options.length; ++i ) {
    item = lbFrom.options[i];
    if ( item.selected ) {
      lbTo.options[iTo] = new Option( item.text, item.value );
      ++iTo;
    }
  }
  for ( i = lbFrom.options.length - 1; i >= 0; --i ) {
    item = lbFrom.options[i];
    if ( item.selected ) {
      lbFrom.options[i] = null;
    }
  }
}

function moveById( idFrom, idTo ) {
  movePlayer(document.mapform.elements[idFrom + '[]'], document.mapform.elements[idTo + '[]']);
}

function swapItems(item1, item2) {
  var saveText
  var saveValue
  saveText = item1.text
  saveValue = item1.value
  item1.text = item2.text
  item1.value = item2.value
  item2.text = saveText
  item2.value = saveValue
}
function moveUp() {
  var listBox
  var i
  var n
  var item
//  listBox = document.f.best
  listBox = document.mapform.elements['best[]']
  if ( listBox.options[0].selected ) {
    alert("You cannot move the top player up.")
  }
  else {
    n = listBox.options.length - 1
    for ( i = 1; i <= n; ++i ) {
      item = listBox.options[i]
      if ( item.selected ) {
        swapItems( listBox.options[i], listBox.options[i-1] )
        listBox.options[i-1].selected = true
        listBox.options[i].selected = false
      }
    }
  }
}
function moveDown() {
  var listBox
  var i
  var n
  var item
//  listBox = document.f.best
  listBox = document.mapform.elements['best[]']
  n = listBox.options.length - 1
  if ( listBox.options[n].selected ) {
    alert("You cannot move the bottom player down.")
  }
  else {
    for ( i = n-1; i >= 0; --i ) {
      item = listBox.options[i]
      if ( item.selected ) {
        swapItems( listBox.options[i], listBox.options[i+1] )
        listBox.options[i+1].selected = true
        listBox.options[i].selected = false
      }
    }
  }
}

function save() {
  var listBox
  var n
  var s
  var i
  listBox = document.mapform.elements['best[]']
  n = listBox.options.length - 1
  s = "0"
  for ( i = 0; i <= n; ++i ) {
    s = s + "," + listBox.options[i].value
  }
  document.mapform.bestlist.value = s
  return 1;
}

function setEdit(e) {
//  alert(e);
  document.mapform.es.value = e;
//  alert('poo');
  return 1;
}

