
function addOption (OptionBoxName, SelectionBoxName) {
  var OptionBox = returnObjById(OptionBoxName);
  var SelectionBox = returnObjById(SelectionBoxName);
  var SelectedIndex = OptionBox.options.selectedIndex;
  if (SelectedIndex == -1) {
    alert("Please make a selection.");
  } else {
    for (i=0; i<OptionBox.options.length; i++) {
      if(OptionBox.options[i].selected) {
        var name = OptionBox.options[i].text;
        var ID = OptionBox.options[i].value;
        var nodupe = true;
        for (j=0; j<SelectionBox.options.length; j++) {
          if ((SelectionBox.options[j].text == name) && (SelectionBox.options[j].value == ID)) {
            nodupe = false;
          }
        }
        if (nodupe) SelectionBox.options[SelectionBox.options.length]=new Option (name,ID);
      }
    }
  }
}

function removeOption (OptionBoxName, SelectionBoxName) {
  var OptionBox = returnObjById(OptionBoxName);
  var SelectionBox = returnObjById(SelectionBoxName);
  var SelectedIndex = SelectionBox.options.selectedIndex;
  if (SelectedIndex == -1) {
    alert("Please make a selection.");
  } else {
    for (i=0; i<SelectionBox.options.length; i++) {
      if(SelectionBox.options[i].selected) {
        SelectionBox.options[i]= null;
        i = i-1;
      }
    }
  }
}


function selectOptions(SelectionBoxName) {
	//alert('got here product list');
  var SelectionBox = returnObjById(SelectionBoxName);
  for (i=0; i<SelectionBox.options.length; i++) {
    SelectionBox.options[i].selected=true;
  }
}

function initializeSelection(SelectionBoxName) {
    if(returnObjById(SelectionBoxName)){
      var SelectionBox = returnObjById(SelectionBoxName);
      for (i=0; i<SelectionBox.options.length; i++) {
        if (!SelectionBox.options[i].selected) {
                    SelectionBox.options[i]=null;
                    i = i-1;
            };
      }
    }
}


function selectApplicationOptions(SelectionBoxName) {
	//alert('got here application list');
  var SelectionBox = returnObjById(SelectionBoxName);
  for (i=0; i<SelectionBox.options.length; i++) {
    SelectionBox.options[i].selected=true;
  }
}

function initializeApplicationSelection(SelectionBoxName) {
    if(returnObjById(SelectionBoxName)){
      var SelectionBox = returnObjById(SelectionBoxName);
      for (i=0; i<SelectionBox.options.length; i++) {
        if (!SelectionBox.options[i].selected) {
                    SelectionBox.options[i]=null;
                    i = i-1;
            };
      }
    }
}


function selectApplicationStandardOptions(SelectionBoxName) {
	//alert('got here application standard list');
  var SelectionBox = returnObjById(SelectionBoxName);
  for (i=0; i<SelectionBox.options.length; i++) {
    SelectionBox.options[i].selected=true;
  }
}

function initializeApplicationStandardSelection(SelectionBoxName) {
 //alert('got here application standard list');
  var SelectionBox = returnObjById(SelectionBoxName);
  for (i=0; i<SelectionBox.options.length; i++) {
    if (!SelectionBox.options[i].selected) {
		SelectionBox.options[i]=null;
		i = i-1;
	};
  }
}


function selectManufacturedProductOptions(SelectionBoxName) {
	//alert('got here manufactured product list');
  var SelectionBox = returnObjById(SelectionBoxName);
  for (i=0; i<SelectionBox.options.length; i++) {
    SelectionBox.options[i].selected=true;
  }
}

function initializeManufacturedProductelection(SelectionBoxName) {
  var SelectionBox = returnObjById(SelectionBoxName);
  for (i=0; i<SelectionBox.options.length; i++) {
    if (!SelectionBox.options[i].selected) {
		SelectionBox.options[i]=null;
		i = i-1;
	};
  }
}

function returnObjById( id ) {
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}
