function COptionTransfer(List1, List2) {
	this.List1 = List1;
	this.List2 = List2;
}

COptionTransfer.prototype.transferRight = function() {
	var SelectList1 = document.getElementById(this.List1);
	var SelectList2 = document.getElementById(this.List2);
  if(SelectList1.selectedIndex >= 0) {
	  if(SelectList1.options[SelectList1.selectedIndex].value >= 0) {
      if(SelectList2.options.length > 3) {
        alert("U mag maar 3 regio's kiezen.");
        return;
      }
      for(var i = 0; i < SelectList2.options.length; i++) {       
        if(SelectList1.options[SelectList1.selectedIndex].value == SelectList2.options[i].value) {   
          return;  
        }
      }
      var option = SelectList1.options[SelectList1.selectedIndex];  
      SelectList2.options.add(this.copyOption(option));
	  }
  }
}

COptionTransfer.prototype.transferLeft = function() {
	var SelectList2 = document.getElementById(this.List2);
  if(SelectList2.selectedIndex >= 0) { 
	  if(SelectList2.options[SelectList2.selectedIndex].value >= 0) {
      var option = SelectList2.options[SelectList2.selectedIndex];
		  SelectList2.removeChild(option);
	  }
  }
}

COptionTransfer.prototype.copyOption = function(option) {
	var optn = document.createElement("OPTION");
	optn.text = option.text;
	optn.value = option.value;
	return optn;
}

COptionTransfer.prototype.selectAllSecondList = function() {
  var SelectList2 = document.getElementById(this.List2); 
  for(var i = 0; i < SelectList2.options.length; i++) {
    SelectList2.options[i].selected = true;  
  }      
}
