<!--		
function WhichStringComesFirst(valueString1, valueString2) {
	var numMaxLen = new Number;
	var strString1 = valueString1.toLowerCase();
	var strString2 = valueString2.toLowerCase();
	var strString1Ascii = new Number;
	var strString2Ascii = new Number;
	
	if (strString1.length >= strString2.length) {
		numMaxLen = strString1.length;
	} else {
		numMaxLen = strString2.length;
	};
	
	for (var numIndex = 0; numIndex < numMaxLen; numIndex++) {
		if (strString1.length <= numIndex) {
			return 1;
		} else if (strString2.length <= numIndex) {
			return 2;
		} else {
			strString1Ascii = ChrToAscii(strString1.charAt(numIndex));
			strString2Ascii = ChrToAscii(strString2.charAt(numIndex));
			
			if(strString1Ascii < strString2Ascii) {
				return 1;
			} else if(strString1Ascii > strString2Ascii) {
				return 2;
			};
		};
	};
	
	return 0;
};

function ChrToAscii(valueChr) {
	// restrict input to a single character
	valueChr = valueChr.charAt(0);
	var numIndex = new Number;
	
	
	// loop through all possible ASCII values
	for (numIndex = 0; numIndex < 256; numIndex++) {
		// convert i into a 2-digit hex string
		var strHexIndex = numIndex.toString(16);
		
		if (strHexIndex.length == 1) {
			strHexIndex = "0" + strHexIndex;
		};
		
		// insert a % character into the string
		strHexIndex = "%" + strHexIndex;
		
		// determine the character represented by the escape code
		strHexIndex = unescape(strHexIndex);
		
		// if the characters match, we've found the ASCII value
		if (strHexIndex == valueChr) {
			break;
		};
	};
	
	return numIndex;
};

function GetOptionByIndex(valueSelectBox, valueIndex) {
	for (var numIndex = 0; numIndex < valueSelectBox.length; numIndex++) {
		if ((valueSelectBox.options[numIndex].index == valueIndex)) {
			return valueSelectBox.options[numIndex];
		};
	};
};

function GetOptionByValue(valueSelectBox, valueValue) {
	for (var numIndex = 0; numIndex < valueSelectBox.length; numIndex++) {
		if ((valueSelectBox.options[numIndex].value == valueValue)) {
			return valueSelectBox.options[numIndex];
		};
	};
};

function GetOptionByText(valueSelectBox, valueText) {
	for (var numIndex = 0; numIndex < valueSelectBox.length; numIndex++) {
		if ((valueSelectBox.options[numIndex].text == valueText)) {
			return valueSelectBox.options[numIndex];
		};
	};
	
};

function AddOptionToEnd(valueSelectBox, valueValue, valueText) {
	if (valueSelectBox) {
		valueSelectBox.options[valueSelectBox.options.length] = new Option(valueText, valueValue);
		
		valueSelectBox.selectedIndex = valueSelectBox.length - 1;
	};
};

function AddOptionInOrderOfText(valueSelectBox, valueValue, valueText) {
	if (valueSelectBox) {
		var arrReplacement = new Array();
		var flgOptionAdded = false;
		var numSelectedIndex = new Number;
		
		for (var numIndex = 0; numIndex < valueSelectBox.length; numIndex++) {
			if (flgOptionAdded) {
				arrReplacement[arrReplacement.length] = new Array(valueSelectBox.options[numIndex].value, valueSelectBox.options[numIndex].text);
			} else if (WhichStringComesFirst(valueSelectBox.options[numIndex].text, valueText) == 2) {
				arrReplacement[arrReplacement.length] = new Array(valueValue, valueText);
				numSelectedIndex = arrReplacement.length - 1;
				arrReplacement[arrReplacement.length] = new Array(valueSelectBox.options[numIndex].value, valueSelectBox.options[numIndex].text);
				flgOptionAdded = true;
			} else {
				arrReplacement[arrReplacement.length] = new Array(valueSelectBox.options[numIndex].value, valueSelectBox.options[numIndex].text);
			};
		};
		
		if (!flgOptionAdded) {
			arrReplacement[arrReplacement.length] = new Array(valueValue, valueText);
			numSelectedIndex = arrReplacement.length - 1;
		};
		
		valueSelectBox.options.length = 0;
		
		for (var numIndex = 0; numIndex < arrReplacement.length; numIndex++) {
			valueSelectBox.options[numIndex] = new Option(arrReplacement[numIndex][1], arrReplacement[numIndex][0]);
		};
		
		valueSelectBox.selectedIndex = numSelectedIndex;
	};
};

function DeleteOptionByValue(valueSelectBox, valueValue) {
	var arrReplacement = new Array();
	
	for (var numIndex = 0; numIndex < valueSelectBox.length; numIndex++) {
		if (valueSelectBox.options[numIndex].index != valueValue) {
			arrReplacement[arrReplacement.length] = new Array(valueSelectBox.options[numIndex].value, valueSelectBox.options[numIndex].text);
		};
	};
	
	valueSelectBox.options.length = 0;
	
	for (var numIndex = 0; numIndex < arrReplacement.length; numIndex++) {
		valueSelectBox.options[numIndex] = new Option(arrReplacement[numIndex][1], arrReplacement[numIndex][0]);
	};
};

function DeleteOptionByIndex(valueSelectBox, valueIndex) {
	var arrReplacement = new Array();
	
	for (var numIndex = 0; numIndex < valueSelectBox.length; numIndex++) {
		if (numIndex != valueIndex) {
			arrReplacement[arrReplacement.length] = new Array(valueSelectBox.options[numIndex].value, valueSelectBox.options[numIndex].text);
		};
	};
	
	valueSelectBox.options.length = 0;
	
	for (var numIndex = 0; numIndex < arrReplacement.length; numIndex++) {
		valueSelectBox.options[numIndex] = new Option(arrReplacement[numIndex][1], arrReplacement[numIndex][0]);
	};
};

function DeleteSelectedOption(valueSelectBox) {
	if (valueSelectBox.selectedIndex != -1) {
		var arrReplacement = new Array();
		var numNextSelectedIndex = new Number;
		
		if (valueSelectBox.length == 1) {
			numNextSelectedIndex = -1;
		} else if (valueSelectBox.selectedIndex == valueSelectBox.length - 1) {
			numNextSelectedIndex = valueSelectBox.selectedIndex - 1;
		} else {
			numNextSelectedIndex = valueSelectBox.selectedIndex;
		};
		
		for (var numIndex = 0; numIndex < valueSelectBox.length; numIndex++) {
			if (numIndex != valueSelectBox.selectedIndex) {
				arrReplacement[arrReplacement.length] = new Array(valueSelectBox.options[numIndex].value, valueSelectBox.options[numIndex].text);
			};
		};
		
		valueSelectBox.options.length = 0;
		
		for (var numIndex = 0; numIndex < arrReplacement.length; numIndex++) {
			valueSelectBox.options[numIndex] = new Option(arrReplacement[numIndex][1], arrReplacement[numIndex][0]);
		};
		
		valueSelectBox.selectedIndex = numNextSelectedIndex;
	};
};

function DeleteSelectedOptions(valueSelectBox) {
	if (valueSelectBox.selectedIndex != -1) {
		var arrReplacement = new Array();
		
		for (var numIndex = 0; numIndex < valueSelectBox.options.length; numIndex++) {
			if (!valueSelectBox.options[numIndex].selected) {
				arrReplacement[arrReplacement.length] = new Array(valueSelectBox.options[numIndex].value, valueSelectBox.options[numIndex].text);
			};
		};
		
		valueSelectBox.options.length = 0;
		
		for (var numIndex = 0; numIndex < arrReplacement.length; numIndex++) {
			valueSelectBox.options[numIndex] = new Option(arrReplacement[numIndex][1], arrReplacement[numIndex][0]);
		};
	};
};

function MoveSelectedOption(valueSelectBox, valueDirection) {
	if (valueSelectBox) {
		if (valueSelectBox.selectedIndex != -1) {
			var flgOK = false;
			var numSelectedIndex = new Number;
			var strText = new String;
			var strValue = new String;
			var strText2 = new String;
			var strValue2 = new String;
			var flgIsIndexed = (valueSelectBox.getAttribute("IsIndexed") == "true");
			
			if (valueDirection == "UP") {
				if (valueSelectBox.selectedIndex != 0) {
					var arrReplacement = new Array();
					
					for (var numIndex = 0; numIndex < valueSelectBox.length; numIndex++) {
						if ((numIndex < valueSelectBox.selectedIndex - 1) || (numIndex > valueSelectBox.selectedIndex)) {
							arrReplacement[arrReplacement.length] = new Array(valueSelectBox.options[numIndex].value, valueSelectBox.options[numIndex].text);
						} else if (numIndex == valueSelectBox.selectedIndex - 1) {
							strText = valueSelectBox.options[valueSelectBox.selectedIndex].text;
							strValue = valueSelectBox.options[valueSelectBox.selectedIndex].value;
							
							strText2 = valueSelectBox.options[numIndex].text;
							strValue2 = valueSelectBox.options[numIndex].value;
							
							if (flgIsIndexed) {
								strText = strText.substr(strText.indexOf(". ") + 2, strText.length);
								strText = (arrReplacement.length + 1) + ". " + strText;
								
								strText2 = strText2.substr(strText2.indexOf(". ") + 2, strText2.length);
								strText2 = (arrReplacement.length + 2) + ". " + strText2;
							};
							
							arrReplacement[arrReplacement.length] = new Array(strValue, strText);
							arrReplacement[arrReplacement.length] = new Array(strValue2, strText2);
							
							numIndex += 1;
						};
					};
					
					numSelectedIndex = valueSelectBox.selectedIndex - 1;
					flgOK = true;
				};
			} else if (valueDirection == "DOWN") {
				if (valueSelectBox.selectedIndex != valueSelectBox.length - 1) {
					var arrReplacement = new Array();
					
					for (var numIndex = 0; numIndex < valueSelectBox.length; numIndex++) {
						if ((numIndex < valueSelectBox.selectedIndex) || (numIndex > valueSelectBox.selectedIndex + 1)) {
							arrReplacement[arrReplacement.length] = new Array(valueSelectBox.options[numIndex].value, valueSelectBox.options[numIndex].text);
						} else if (numIndex == valueSelectBox.selectedIndex) {
							strText = valueSelectBox.options[numIndex + 1].text
							strValue = valueSelectBox.options[numIndex + 1].value
							
							strText2 = valueSelectBox.options[valueSelectBox.selectedIndex].text
							strValue2 = valueSelectBox.options[valueSelectBox.selectedIndex].value
							
							if (flgIsIndexed) {
								strText = strText.substr(strText.indexOf(". ") + 2, strText.length)
								strText = (arrReplacement.length + 1) + ". " + strText
								
								strText2 = strText2.substr(strText2.indexOf(". ") + 2, strText2.length)
								strText2 = (arrReplacement.length + 2) + ". " + strText2
							};
							
							arrReplacement[arrReplacement.length] = new Array(strValue, strText);
							arrReplacement[arrReplacement.length] = new Array(strValue2, strText2);
							
							numIndex += 1;
						};
					};
					
					numSelectedIndex = valueSelectBox.selectedIndex + 1;
					flgOK = true;
				};
			};
			
			if (flgOK) {
				valueSelectBox.options.length = 0;
				
				for (var numIndex = 0; numIndex < arrReplacement.length; numIndex++) {
					valueSelectBox.options[numIndex] = new Option(arrReplacement[numIndex][1], arrReplacement[numIndex][0]);
				};
				
				valueSelectBox.selectedIndex = numSelectedIndex;
			};
		};
	};
};

function TransferSelectedOptions(valueSelectBoxSource, valueSelectBoxDestination) {
	if ((valueSelectBoxSource) && (valueSelectBoxDestination)) {
		if (valueSelectBoxSource.selectedIndex != -1) {
			var strValue = new String;
			var strText = new String;
			var flgSourceIsIndexed = (valueSelectBoxSource.getAttribute("IsIndexed") == "true");
			var flgDestinationIsIndexed = (valueSelectBoxDestination.getAttribute("IsIndexed") == "true");
			var flgInOrderOfText = (valueSelectBoxDestination.getAttribute("OrderedBy") == "Text");
			var numSelectedIndex = valueSelectBoxSource.selectedIndex;
			
			for (var numIndex = valueSelectBoxSource.selectedIndex; numIndex < valueSelectBoxSource.options.length; numIndex++) {
				if (valueSelectBoxSource.options[numIndex].selected) {
					strValue = valueSelectBoxSource.options[numIndex].value;
					
					if (flgSourceIsIndexed) {
						strText = valueSelectBoxSource.options[numIndex].text;
						strText = strText.substr(strText.indexOf(". ") + 2, strText.length);
					} else {
						strText = valueSelectBoxSource.options[numIndex].text;
					};
					
					if (flgDestinationIsIndexed) {
						strText = (valueSelectBoxDestination.length + 1) + ". " + strText
					};
					
					if (flgInOrderOfText) {
						AddOptionInOrderOfText(valueSelectBoxDestination, strValue, strText);
					} else {
						AddOptionToEnd(valueSelectBoxDestination, strValue, strText);
					};
				};
			};
			
			DeleteSelectedOptions(valueSelectBoxSource);
			
			if (flgSourceIsIndexed) {
				ReindexOptions(valueSelectBoxSource);
			};
			
			if (numSelectedIndex >= valueSelectBoxSource.options.length) {
				numSelectedIndex = valueSelectBoxSource.options.length - 1;
			};
			
			valueSelectBoxSource.selectedIndex = numSelectedIndex;
		};
	};
};

function ReindexOptions(valueSelectBox) {
	if (valueSelectBox) {
		var arrReplacement = new Array();
		var strText = new String;
		var numSelectedIndex = valueSelectBox.selectedIndex;
		
		for (var numIndex = 0; numIndex < valueSelectBox.length; numIndex++) {
			strText = valueSelectBox.options[numIndex].text
			strText = strText.substr(strText.indexOf(". ") + 2, strText.length)
			strText = (arrReplacement.length + 1) + ". " + strText
			
			arrReplacement[arrReplacement.length] = new Array(valueSelectBox.options[numIndex].value, strText);
		};
		
		valueSelectBox.options.length = 0;
		
		for (var numIndex = 0; numIndex < arrReplacement.length; numIndex++) {
			valueSelectBox.options[numIndex] = new Option(arrReplacement[numIndex][1], arrReplacement[numIndex][0]);
		};
		
		valueSelectBox.selectedIndex = numSelectedIndex;
	};
};

function GetOptionsAsCSV(valueSelectBox) {
	if (valueSelectBox) {
		var strCSV = new String;
		
		for (var numIndex = 0; numIndex < valueSelectBox.length; numIndex++) {
			if (strCSV.length > 0) {
				strCSV += ","
			};
			
			strCSV += valueSelectBox.options[numIndex].value;
		};
		
		return strCSV;
	};
};

function toggleDnDHelp() {
	var objDnDImg = window.document.getElementById("DnDHelpImg");
	
	if (objDnDImg != null) {
		if (objDnDImg.style.display == "none") {
			objDnDImg.src = objDnDImg.src;
			
			objDnDImg.style.display = "inline";
		} else {
			objDnDImg.style.display = "none";
		};
	};
};

function ChangeElementDisplay(valueElement, valueShow) {
	if (valueElement != null) {
		if (valueShow) {
			valueElement.style.display = "";
		} else {
			valueElement.style.display = "none";
		};
	};
};

var objLastOptionsDisplayed = null;

function ToggleMoreOptions(ClickedElement, MoreOptionsElementName, Direction) {
	if (ClickedElement != null && window.document.getElementById(MoreOptionsElementName) != null) {
		if (objLastOptionsDisplayed != null) {
			objLastOptionsDisplayed.style.display = "none";
		};
		
		if (objLastOptionsDisplayed == window.document.getElementById(MoreOptionsElementName)) {
			objLastOptionsDisplayed = null;
		} else {
			objLastOptionsDisplayed = window.document.getElementById(MoreOptionsElementName);
			
			objLastOptionsDisplayed.style.display = "";
			
			objLastOptionsDisplayed.style.left = (GetElementPosition(ClickedElement).x) + "px";
			
			if (Direction.toLowerCase() != "up") {
				objLastOptionsDisplayed.style.top = (GetElementPosition(ClickedElement).y + 22) + "px";
			} else {
				objLastOptionsDisplayed.style.top = (GetElementPosition(ClickedElement).y - objLastOptionsDisplayed.offsetHeight - 2) + "px";
			};
		};
	};
};

function GetElementPosition(e) {
	if (e != null) {
		var objParent = e.offsetParent;
		var numLeft = e.offsetLeft;
		var numTop = e.offsetTop;
		
		while (objParent != null) {
			numLeft += objParent.offsetLeft;
			numTop += objParent.offsetTop;
			objParent = objParent.offsetParent;
		};
		
		return {x:numLeft, y:numTop};
	} else {
		return {x:0, y:0};
	};
};
//-->