function copy(from, to, naam) {
  fromList = document.getElementById(from);
  toList = document.getElementById(to);
  if (toList.options.length > 0 && toList.options[0].value == 'temp') {
    toList.options.length = 0;
  }
  var sel = false;
  for (i=0;i<fromList.options.length;i++) {
    var current = fromList.options[i];
    if (current.selected) {
      sel = true;
      txt = current.text;
      val = current.value;
      toList.options[toList.length] = new Option(txt,val);
      
    }
  }
  update_items(naam);
}

function move(from, to, naam) {
  fromList = document.getElementById(from);
  
  toList = document.getElementById(to);
  
  if (toList.options.length > 0 && toList.options[0].value == 'temp')
  {
    toList.options.length = 0;
  }
  var sel = false;
  for (i = 0; i < fromList.options.length; i++)
  {
    var current = fromList.options[i];
    if (current.selected)
    {
      sel = true;
      txt = current.text;
      val = current.value;
      toList.options[toList.length] = new Option(txt,val);
      fromList.options[i] = null;
      i--;
    }
  }
  update_items(naam);
}

function delete_option(from, naam) {
  fromList = document.getElementById(from);
  var sel = false;
  for (i = 0; i < fromList.options.length; i++) {
    var current = fromList.options[i];
    if (current.selected) {
      sel = true;
	  fromList.options[i] = null;
	  i--;
    }
  }
  update_items(naam);
}

function update_items(naam) {
    List = document.getElementById(naam + '_naar');
    naam_var = document.getElementById(naam);
    naam = '';
    //if (List.length && List.options[0].value == '') {
    //alert(List.length);
  	
	
	for (i=0;i<List.length;i++)	{
		naam += List.options[i].value+'|';
	}
	naam = naam.substr(0, naam.length - 1);
	naam_var.value = naam;
	if (List.length == 0) {
		 return;
	}
}
