var checkKeys = true;
function keysOff() {	checkKeys = false; }
function keysOn() {	checkKeys = true; }

function ShowKeys() {
	var w = 480, h = 340;

	if (document.all || document.layers) {
	   w = screen.availWidth;
	   h = screen.availHeight;
	}

	var popW = 325, popH = 450;

	var leftPos = (w-popW)/2, topPos = (h-popH)/2;

	window.open('/LACEA-LAMES/2009/System/listkeys.asp', 'winShowKeys', 'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos);
	return false;
}

function gotoPage(txtURL) {
	location.href = txtURL;
}

function launchHelp() {
	var w = 480, h = 340;

	if (document.all || document.layers) {
	   w = screen.availWidth;
	   h = screen.availHeight;
	}

	var popW = 450, popH = 320;

	var leftPos = (w-popW)/2, topPos = (h-popH)/2;

	window.open('/LACEA-LAMES/2009/admin/admins/cshelp/pop.asp?fromURL='+location.href,'winCSHelp','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos);
}

function getKey(e) {
	if (!checkKeys) return true;
	if (e == null) {
		//ie
		kcode = event.keyCode;
	} else {
	  if (e.altKey || e.ctrlKey) {
		return true;
	  }
	  kcode = e.which;
	}
	key = String.fromCharCode(kcode).toLowerCase();
	switch(key) {

	  case "a": gotoPage('/LACEA-LAMES/2009/admin/'); return false;

	  case "r": gotoPage('/LACEA-LAMES/2009/admin/participants/'); return false;
	  case "p": gotoPage('/LACEA-LAMES/2009/admin/papers/'); return false;
	  case "s": gotoPage('/LACEA-LAMES/2009/admin/sessions/'); return false;
	  case "t": gotoPage('/LACEA-LAMES/2009/admin/timeslots/'); return false;
	  case "e": gotoPage('/LACEA-LAMES/2009/admin/email/'); return false;
	  case "c": gotoPage('/LACEA-LAMES/2009/admin/functionality/'); return false;
	  case "i": gotoPage('/LACEA-LAMES/2009/admin/statistics/'); return false;
	  case "x": gotoPage('/LACEA-LAMES/2009/admin/export/'); return false;
	  case "h": gotoPage('/LACEA-LAMES/2009/admin/help/'); return false;
	  case "k": return ShowKeys();

	  case "/": // / = ?
	  case "?": launchHelp(); return false;

	  case "b": history.go(-1); return false;
	  case "f": history.go(1); return false;
	}
	return true;
}

document.onkeypress = getKey;
