


	function addOpening( sel1, sel2, counter, updateFlag ) {

		var add = 1;

		// Create a new option
		if( sel1.type == 'select-one' ) {
			

			var option0 = new Option( sel1.options[sel1.selectedIndex].text, sel1.options[sel1.selectedIndex].value );
		} else {

			// Get rid of any pipes, quotes or back slashes
			sel1.value = sel1.value.replace( /[\|"\\']/gi, '' );

			if( sel1.value != '') {
				var option0 = new Option( sel1.value, sel1.value );
				sel1.value = '';
			} else {
				add = 0;
			}

		}



		if( add ) {
			sel2.options[sel2.length] = option0;

			// Note that we've made changes
			if( updateFlag ) {
				updateFlag.value = 1; 
			}

			if( counter ) {
				setCounter( counter, Number( counter.value ) + 1 );
			}
		} else {
			alert( 'Please enter a valid animal!' );
		}

		sel1.focus();

		return 1;
	}

	function killOpening( sel, counter, updateFlag ) {

		if( sel.selectedIndex != - 1 ) {
			if( sel.length ) {
				selIndex = sel.selectedIndex;

				sel.options[sel.selectedIndex] = null;

				// Note that we've made changes
				if( updateFlag ) {
					updateFlag.value = 1; 
				}

				// If there is still an etry select the next one on the list
				if( sel.length ) {

					if( selIndex - 1 > 0 ) {
						sel.selectedIndex = selIndex - 1;
					} else {
						sel.selectedIndex = 0;
					}
				}

				setCounter( counter, Number( counter.value ) - 1 );
			}
		} else {
			//alert( 'Please make a selection first.' );
		}

		return 1;
	}


	function setCounter( counter, newCount ) {
		counter.value = newCount;

		return 1;
	}

	function selToStr( sel, dataDest ) {

		if( dataDest.value != "" ) {

			dataDest.value = "";

			// Turn "sel" (a select) into a str and store it in dataDest (a hidden input)
			for( i = 0; i < sel.length; i++ ) {
				dataDest.value += String( sel.options[i].value + "|" );
			}

			if( dataDest.value.length == 0 ) {
				dataDest.value = '|';
			}

			//dataDest.value = dataDest.value.substr( 0, dataDest.value.length - 1 );

		}

		return 1;

	}