	document.onkeydown = mykeyhandler;

	function mykeyhandler() {
		try{
			with(window){
				if(event && event.keyCode == 8 && document.activeElement.isContentEditable == false){
					// try to cancel the backspace
					event.cancelBubble = true;
					event.returnValue = false;
					return false;
				}
			}
		}
		catch (varException){
			errHandler(varException,false)
		}			
	}


	function errHandler(oError,bClose)
	{
	    var msg = "There was an error on this page.\n\n";
	    msg += "An internal programming error may keep\n";
	    msg += "this page from displaying properly.\n";
	    msg += "Click OK to continue viewing this page,\n";
	    if(bClose){
			msg += "or click cancel to close it.\n\n";
		}
		else {
			msg += "or click cancel to return to the home page.\n\n";
		}
	    msg += "Error number: " + (oError.number & 0xffff) + "\n";
	    msg += "Description: " + oError.description + "\n";
	    msg += "Page: " + window.location.pathname + "\n\n";

		if(!confirm(msg))
		{
			if(bClose){
				window.close();
			}
			else{
				//if committed within a frame,etc., then the top most will
				//recieve the direction.
				parent.parent.parent.parent.document.location.href = "/default.asp";
			}
		}

	}

//*******************************************************************************
//** Search mechanism for drop-down combos and list boxes.
//**	Function searchList() is added to the onkeydown event of the
//**	desired combo/list box. If this combo/list box doesn't already have 
//**	a onkeypress event, then this event will be canceled. This is to avoid the
//**	build-in search capabilities of IE.
//*******************************************************************************
	var srch = '';
	var iTimeout;
					
	function searchList(thisEl)
	{
		try{
			var key = event.keyCode;
			//window.status = key;
			if(key >= 48 && key <= 90){
				if(!thisEl.onkeypress){
					thisEl.onkeypress = function (){return false;}
				}
											
				if(srch != ''){clearTimeout(iTimeout);}

				// 5 second delay between next keystroke.
				iTimeout = setTimeout("srch='';",5000);	
								
				srch += String.fromCharCode(key)
				//window.status =  'search = ' + srch;

				autoComplete(srch,thisEl);

				//make sure onchange event is triggered if one exists.
				if(thisEl.onchange){
					thisEl.onchange();
				}
			}
			else{
				//if(!thisEl.onkeypress){
					thisEl.onkeypress = null;
					//alert(thisEl.onkeypress);
				//}
			}				
		}
		catch (varException){
			errHandler(varException,false)
		}			
					
	}
				
	function autoComplete (field, select) 
	{
		try{
			for(var i=0;i<select.options.length;i++){
				if(select.options[i].text.toUpperCase().indexOf(field.toUpperCase()) == 0){
					select.selectedIndex = i;
					break;
				}
			}
		}
		catch (varException){
			errHandler(varException,false)
		}			

	}
			
//*******************************************************************************
//*******************************************************************************

//*******************************************************************************
//** Capitalizes first letter of each word in string
//*******************************************************************************
function unArbitration(str) {
    var words = str.toLowerCase().split(" ")
    var ans = ""
    for (i=0; i<words.length; ++i) {
        var w = words[i]
        ans += w.charAt(0).toUpperCase() + w.substring(1,(w.length)) + " "
    } 
    return ans
}

//*******************************************************************************

