function keyboard_init(){
	document.onkeydown=kdown;
}

function init_nav(){
	document.onkeypress=kpress;
}

function kbd_webdebug() {
	var kp_recommendedwidth = 845;
	var kp_recommendedheight = 521;

	if(document.all){
	      availW = document.body.clientWidth;
	      availH = document.body.clientHeight;
	   }else{
	      availW = innerWidth;
	      availH = innerHeight;
	   }
	DimensionString = 'PI Debugging Information\n';
	DimensionString = DimensionString + '-------------------------------\n';

	if (navigator.onLine == false) {
		DimensionString = DimensionString + 'WARNING!!!\nYour web browser is in "offline" mode so you are not viewing\ncurrent web pages.  To fix this, use the following steps:\n';
		DimensionString = DimensionString + ' * If you are using a laptop or remote computer, make sure you have\n  established a dial-up connection.\n';
		DimensionString = DimensionString + ' * Go to File drop-down menu.\n';
		DimensionString = DimensionString + '  (You should notice that there is a check next to "Work Offline".)\n';
		DimensionString = DimensionString + '* Select "Work Offline" to remove the check.\n';
		DimensionString = DimensionString + '* Close and re-open your web browser.\n\n';
	}

	DimensionString = DimensionString + 'WIDTH ANALYSIS';
	if (availW < kp_recommendedwidth) {
		DimensionString = DimensionString + ' - TOO NARROW\n';
		DimensionString = DimensionString + 'Your web browser width is too narrow at ' + availW + ' pixels.\n';
		DimensionString = DimensionString + 'Its recommended that you widen your browser window\nto ' + kp_recommendedwidth + ' pixels for best viewing.\n';
	}
	else {
		DimensionString = DimensionString + ' - Okay (Min. ' + kp_recommendedwidth + ' pixels)\nYour web browser width should work well at ' + availW + ' pixels.\n';
	}

	DimensionString = DimensionString + '\nHEIGHT ANALYSIS';
	if (availH < kp_recommendedheight) {
		DimensionString = DimensionString + ' - TOO SHORT\n';
		DimensionString = DimensionString + 'The height of your browser window is too short at ' + availH + ' pixels.\nTo prevent unnecessary up and down scrolling, you should\nconsider making the window at least ' + kp_recommendedheight + ' pixels high.\n';
	}
	else {
		DimensionString = DimensionString + ' - Okay (Min. ' + kp_recommendedheight + ' pixels)\nYour web browser height should work well at ' + availH + ' pixels.\n';
	}

	alert (DimensionString);
}


function kpress(e){
	switch(key){
		//case 65:  	// 'a' key - ASP Debug
		//		location.href='/Content/WebmasterComments/WebDebugInfo.asp'; break; 
		//case 72:  	// 'h' key
		//case 191: 	// '?' key
		//		location.href='/Content/Help.asp'; break; 

		case 68: 	// 'd' key for debug
				kbd_webdebug();
				break;
	} 
	// Uncomment below to find new key mappings.
	//alert('PI Development Test:\n\nKey Pressed is: ' + key);

	// Disable kpress event
	document.onkeypress='';
}


function kdown(e){
key=window.event.keyCode
	if(key==113){
		init_nav();
	}	
}