	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  FixInvalidIndex
	//
	/////////////////////////////////////////////////////////
	
		// for a select menu, if the invalid index is selected, the menu is reset to the top element
	
 		function FixInvalidIndex (menu, invalidIndex) {
 		
 			if (menu.selectedIndex == invalidIndex) {
 			
 				menu.selectedIndex = 0;
 			}
 		}
 		
 
	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  ShowHelp
	//
	/////////////////////////////////////////////////////////
	
 		function ShowHelp () {
 		
 			HideDiv ('showHelp');
 			
 			ShowDiv ('help');
 		}
 		
 		
	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  HideHelp
	//
	/////////////////////////////////////////////////////////
	
 		function HideHelp () {
 		
 			HideDiv ('help');
 			
 			ShowDiv ('showHelp');
 		}
 		
 		
	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  HideDiv
	//
	/////////////////////////////////////////////////////////
	
		function HideDiv (id) {
		
			if (document.getElementById) { // DOM3 = IE5, NS6
		
				document.getElementById(id).style.display = 'none';
			}
		
			else {
		
				if (document.layers) { // Netscape 4
				
					document.id.display = 'none';
				}
				
				else { // IE 4
				
					document.all.id.style.display = 'none';
				}
			}
		}


	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  ShowDiv
	//
	/////////////////////////////////////////////////////////
	
		function ShowDiv (id) {

			if (document.getElementById) { // DOM3 = IE5, NS6
		
				document.getElementById(id).style.display = 'block';
			}
		
			else {
		
				if (document.layers) { // Netscape 4
		
					document.id.display = 'block';
				}
		
				else { // IE 4
		
					document.all.id.style.display = 'block';
				}
			}
		}


	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  CloseMessageDiv
	//
	/////////////////////////////////////////////////////////
	
 
		function CloseMessageDiv () {
		
			HideDiv ('messageContainer');
		}


	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  InArray
	//
	/////////////////////////////////////////////////////////
	
 		function InArray (element, array) {
 		
			var i;
			
			for (i = 0; i < array.length; i++) {

				if (array[i] == element) {

					return true;
				}
			}
			
			return false;
 		}


	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  ResetRadioButtons
	//
	/////////////////////////////////////////////////////////
	
		function ResetRadioButtons (element) {
 
			for (var i = 0; i < element.length; i++) {
			
				element[i].checked = false;
			} 		
		}
		
		
	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  GetRadioButtonValue
	//
	/////////////////////////////////////////////////////////
	
  		function GetRadioButtonValue (element) {
  		
			for (j = 0; j < element.length; j ++) {
			
				if (element[j].checked) {
				
					return (element[j].value);
				}
			}
			
			return false;
  		}
 		 			
	/////////////////////////////////////////////////////////
	//
	//  FUNCTION:  IgnoreKeys
	//
	/////////////////////////////////////////////////////////
	
		function IgnoreKeys (event, restrictions) {
		
			var charCode = event.charCode ? 
			               event.charCode :
			              (event.which    ? 
			               event.which    : 
			               event.keyCode) ;
								 
			// allow arrow keys
			
			if (charCode >= 37 && charCode <= 40) {
				
				return true;
			}
			
			// allow tab keys
			
			if (charCode == 9) {
				
				return true;
			}
			
			// allow backspace
			
			if (charCode == 8) {
				
				return true;
			}
			
			// return false if return/enter key
			
			if (charCode == 13 || charCode == 3 || charCode == 0) {
				
				return false;
			}
			
			// handle digits restriction
			
			if (restrictions == 'digits') {

				if (charCode < 48 || charCode > 57) {
				
					alert ("Please enter digits only in this field");
				
					return false;
				}
			}
			
			// handle decimal restriction
			
			if (restrictions == 'decimal') {
			
				// decimal point
				
				if (charCode == 46) {
				
					return true;
				}
				
				// check for digits

				if (charCode < 48 || charCode > 57) {
				
					alert ("Please enter only digits or a decimal point in this field");
				
					return false;
				}
			}
			
			// handle decimal restriction
			
			if (restrictions == 'decimalPlusMinus') {
			
				// decimal point
				
				if (charCode == 46) {
				
					return true;
				}
				
				// hyphen
				
				if (charCode == 45 || charCode == 109 || charCode == 189 || charCode == 150) {
				
					return true;
				}
				
				// check for digits

				if (charCode < 48 || charCode > 57) {
				
					alert ("Please enter only digits, a decimal point, or a hyphen (negative sign) in this field");
				
					return false;
				}
			}
			
			// handle currency restriction
			
			if (restrictions == 'currency') {
			
				// decimal point
				
				if (charCode == 46) {
				
					return true;
				}
				
				// comma
				
				if (charCode == 44) {
				
					return true;
				}
				
				// check for digits

				if (charCode < 48 || charCode > 57) {
				
					alert ("Please enter only digits, a decimal point, or a comma in this field");
				
					return false;
				}
			}
			
			// handle phone number restriction
			
			if (restrictions == 'phoneNumber') {

				if ((charCode != 45) && (charCode < 48 || charCode > 57)) {
				
					alert ("Please enter digits or a hyphen (-) only in this field");
				
					return false;
				}
			}

			// handle no input restriction
			
			if (restrictions == 'noInput') {

				alert ("Direct input is not allowed in this field");
				
				return false;
			}

			return true;
		}



