function alphaBetaMoveOptionHoriz(fboxname, tboxname) 
{
	var fbox = document.forms[0].elements[fboxname]; 
	var tbox = document.forms[0].elements[tboxname];
	
	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	for (i = 0; i < tbox.options.length; i++) {
		//arrLookup[tbox.options[i].text] = tbox.options[i].value;
		arrLookup[tbox.options[i].text] = tbox.options[i].value;
		arrTbox[i] = tbox.options[i].text;
	}
	var fLength = 0;
	var tLength = arrTbox.length;
	for(i = 0; i < fbox.options.length; i++) {
		arrLookup[fbox.options[i].text] = fbox.options[i].value;
		if (fbox.options[i].selected && fbox.options[i].value != "") {
			arrTbox[tLength] = fbox.options[i].text;
			tLength++;
		} else {
			arrFbox[fLength] = fbox.options[i].text;
			fLength++;
	   }
	}

	var alphabetize = true;
	if ( alphabetize == true ) {
		arrFbox.sort();
		arrTbox.sort();
	}
	fbox.length = 0;
	tbox.length = 0;
	var c;
	for(c = 0; c < arrFbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrFbox[c]];
		no.text = arrFbox[c];
		fbox[c] = no;
	}

	for(c = 0; c < arrTbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrTbox[c]];
		no.text = arrTbox[c];
		tbox[c] = no;
   }
}

function selectAll(element)
{
	////alert("Selecting All");
	var myElement = document.forms[0].elements[element];
	var count = myElement.options.length;
	var i;
	
	for (i=0; i<count; i++) {
		myElement.options[i].selected = true;
	}
}

function searchOptionValues(selectElem, str)
{
	var optLen = selectElem.options.length;
	var i = 0;
	
	for ( i=0; i<optLen; i++ ) {
		if ( selectElem.options[i].value == str ) {
			return i;	
			
		}
		
	}//for
	
	return -1;
	
}//end searchOptionValues


function searchOptionText(selectElem, str)
{
	var optLen = selectElem.options.length;
	var i = 0;
	
	for ( i=0; i<optLen; i++ ) {
		if ( selectElem.options[i].text == str ) {
			return i;	
			
		}
		
	}//for
	
	return -1;	
	
	
}//end searchOptionText












// +----------------------------------------------------------------------+
// | SuperMenus v1.0								                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003-2004 Tim Jarrett                                  |
// +----------------------------------------------------------------------+
// | You are free to use and distribute the following JavaScript          |
// | functions as long as this header remain in place and significant     |
// | changes are submitted to the author at tim@tim-jarrett.com so that   |
// | the code here can be continually improved.                           |
// | 																      |
// |  The latest version of this software can be obtained at:             |
// |  http://www.supertim-online.com                                      |
// |                                                                      |
// +----------------------------------------------------------------------+
// | Author: Tim Jarrett <tim@tim-jarrett.com>                            |
// +----------------------------------------------------------------------+

function moveOptionHoriz(currForm, fromhere, tohere)
{
	var fromElement = currForm.elements[fromhere];
	var toElement = currForm.elements[tohere];
	var selectOptions = new Array();
	var i;
	
	for (i=0; i<fromElement.length; i++) {
		if (fromElement.options[i].selected == true) {
			selectOptions.push(i);
			newOption = new Option(fromElement.options[i].text, fromElement.options[i].value);
			toElement.options[toElement.options.length] = newOption;
		}
	}
	
	for(i=selectOptions.length-1; i>=0; i--) {
		fromElement.remove(selectOptions[i]);
	}
}

function moveOptionVert(currForm, element, direction)
{
	var myElement = currForm.elements[element];
	var currPos;
	var newPos;
	
	if (myElement.selectedIndex != -1) {
	
		if (direction == "down") {
			currPos = myElement.selectedIndex;
			newPos = currPos + 1;
			
			currOption = myElement.options[currPos];
			oldOption = myElement.options[newPos];
			
			if (newPos >= myElement.length) {
				myElement.selectedIndex = currPos;
				return false;
			}
								
		} else if (direction == "up") {
			currPos = myElement.selectedIndex;
			newPos = currPos - 1;
			
			currOption = myElement.options[currPos];
			oldOption = myElement.options[newPos];
			
			if (newPos < 0) {
				myElement.selectedIndex = currPos;
				return false;
			}			
		}
	}

	currSelect = new Option(currOption.text, currOption.value);
	oldSelect = new Option(oldOption.text, oldOption.value);
	
	myElement.options[currPos] = oldSelect;
	myElement.options[newPos] = currSelect;
	
	myElement.selectedIndex = newPos;
}