<!--
//FIRST, TELL THE BROWSERS TO REACT TO THE EVENT
if( document.captureEvents ) {
   	//non IE
   	if( Event.KEYUP ) {
	   	//NS 4, NS 6+, Mozilla 0.9+
	   	document.captureEvents( Event.KEYUP );
   	}
}
/* this next line tells the browser to detect a keyup
   event over the whole document and when it detects it,
   it should run the event handler function 'alertkey' */
document.onkeyup = alertkey;

var hks="on";

function hotkeyswitch(position){

	if (position == "on"){
		hks = "on";
	} else if (position == "off"){
		hks = "off";
	} else if (position == "toggle"){
		hks =(hks =="on")?"off":"on";
	}

}

//NOW CREATE THE EVENT HANDLER FUNCTION TO PROCESS THE EVENT
function alertkey(e) {
	if ( hks!="on"){
		return;
	}

   	if( !e ) {
	   	//if the browser did not pass the event information to the
	   	//function, we will have to obtain it from the event register
	   	if( window.event ) {
		   	//DOM
		   	e = window.event;
	   	} else {
		   	//TOTAL FAILURE, WE HAVE NO WAY OF REFERENCING THE EVENT
		   	return;
	   	}
   	}
   	if( typeof( e.which ) == 'number' ) {
	   	//NS 4, NS 6+, Mozilla 0.9+, Opera
	   	e = e.which;
   	} else if( typeof( e.keyCode ) == 'number'  ) {
	   	//IE, NS 6+, Mozilla 0.9+
	   	e = e.keyCode;
   	} else if( typeof( e.charCode ) == 'number'  ) {
	   	//also NS 6+, Mozilla 0.9+
	   	e = e.charCode;
   	} else {
	   	//TOTAL FAILURE, WE HAVE NO WAY OF OBTAINING THE KEY CODE
	   	return;
   	}
	//Determine which action to take when user presses a key

	switch (e){

		case 40: //Down Arrow
			window.alert('Down arrow key pressed.');
			break;
		case 38: //Up Arrow
			window.alert('Up arrow key pressed.'); 
			break;
		case 72: // H is for Home 
			window.location="http://modzer0.cs.uaf.edu/";	
			break;
		case 87: // W is for Wiki
			window.location="http://modzer0.cs.uaf.edu/wiki/";	
			break;
		case 77:  // M is for Mail
			window.location="https://modzer0.cs.uaf.edu/webmail/";
			break;
		case 67:  //C is for CVS
			window.location="http://modzer0.cs.uaf.edu/cgi-bin/viewcvs.cgi";
			break;
		case 73:  //I is for IRC
			window.location="http://modzer0.cs.uaf.edu/cgiirc";
			break;
		case 80:  //P is for public downloads
			window.location="http://modzer0.cs.uaf.edu/public";
			break;
		case 83:  //S is for websvn
			window.location="http://modzer0.cs.uaf.edu/websvn";
			break;
		case 85:  //U is for User web pages
			window.location="http://modzer0.cs.uaf.edu/pages.php";
			break;
		default:
			//Do nothing
	}
//			    window.alert('The key pressed has keycode ' + e +
//					   	' and is key ' + String.fromCharCode( e ) );
}
//-->
