// scripts for hot key navigation var lastTarget = null; var defaultTargetBackground = '#FFFFDD'; var defaultTargetBorder = '1px solid #FFFFDD'; var sectionTag = "Section"; var targetTag = "Target"; // navigate by section on a webpage function FindNext( tag ) { var element = null; var i = 0; var focused = false; var first = -1; while( i < document.all.length && element == null ) { if( document.all[i].id.match( tag ) ) { if( first < 0 ) first = i; if( focused ) element = document.all[i]; } if( document.all[i] == document.activeElement ) focused = true; i++; } if( ! element ) element = document.all[ first ]; var num = parseInt( element.id.substring( tag.length ) ); return( num ); } function FindPrev( tag ) { var element = null; var i = document.all.length; var focused = false; var last = -1; while( i > 0 && element == null ) { i--; if( document.all[i].id.match( tag ) ) { if( last < 0 ) last = i; if( focused ) element = document.all[i]; } if( document.all[i] == document.activeElement ) focused = true; } if( ! element ) element = document.all[ last ]; var num = parseInt( element.id.substring( tag.length ) ); return( num ); } function FocusSection( num ) { if( lastTarget ) HideTableTarget( lastTarget ); section = ( num < 0 ? 0 : num ); // document.location.hash = sectionTag + section; document.getElementById( sectionTag + section ).focus(); } function NextSection() { var num = FindNext( sectionTag ); FocusSection( num ); } function PrevSection() { var num = FindPrev( sectionTag ); FocusSection( num ); } function HiliteTableTarget ( obj ) // hilite table or parent table { if( lastTarget ) HideTableTarget( lastTarget ); lastTarget = obj; var tbl = getTable( obj ); tbl.style.borderColor = '#E0E0E0 #404040 #404040 #E0E0E0'; //3d appearance tbl.style.borderStyle = 'solid'; tbl.style.borderWidth = '1px'; tbl.style.background ='#D0D0B0'; SetPointer( tbl ); } function HideTableTarget ( obj ) { var bgcolour = null; var tbl = getTable( obj ); var parent = tbl.parentNode; tbl.style.background = parent.style.background; tbl.style.borderColor = parent.style.background; ResetPointer( tbl ); } function FocusTarget( num ) { var target = ( num < 0 ? 0 : num ); // document.location.hash = targetTag + target; document.getElementById( targetTag + target ).focus(); } function NextTarget() { var num = FindNext( targetTag ); FocusTarget( num ); } function PrevTarget() { var num = FindPrev( targetTag ); FocusTarget( num ); } function ProcessKeystroke( e ) { var state = true; //alert("keystroke"); var eventMsg = ( window.event ? event : e ); var code = eventMsg.keyCode; if( eventMsg.altKey && eventMsg.ctrlKey ) { switch( code ) { case 37: // - Left arrow case 38: // - UP arrow PrevTarget(); state = false; break; case 39: // - Right arrow case 40: // - Down arrow NextTarget(); state = false; break; case 9: // - tab if( eventMsg.shiftKey ) PrevTarget(); else NextTarget(); state = false; break; case 67: // C case 88: // X sendToClipboard( " " + document.getElementById( "Target" + target) ); state = false; break; case 188: //ctrl alt , if( eventMsg.shiftKey ) PrevSection(); else NextSection(); state = false; break; case 190: // ctrl alt . if( eventMsg.shiftKey ) PrevTarget(); else NextTarget(); state = false; break; case 49: FocusSection( 1 ); state = false; break; // 1 Key case 50: FocusSection( 2 ); state = false; break; // 2 Key case 51: FocusSection( 3 ); state = false; break; // 3 Key case 52: FocusSection( 4 ); state = false; break; // 4 Key case 53: FocusSection( 5 ); state = false; break; // 5 Key case 54: FocusTarget( 0 ); state = false; break; // 6 Key case 55: FocusSection( 7 ); state = false; break; // 7 Key case 56: FocusSection( 8 ); state = false; break; // 8 Key case 57: FocusSection( 9 ); state = false; break; // 9 Key case 48: FocusSection( 10 ); state = false; break; // 0 Key //default: // if( code != 0 ) alert( "keycode = " + code); // lets see what it was for debug reasons //break; } } return state; } function getTable( element ) // return table or parent table containing the object { var pa = element.parentNode; while (pa.tagName.toLowerCase() != 'table') pa = pa.parentNode; return( pa ); } function sendToClipboard(s) { if( window.clipboardData && clipboardData.setData ) { clipboardData.setData("Text", s); } else { alert("Browser does not support Clipboard operations"); } } document.onkeyup= ProcessKeystroke; function ScrollToTop() { window.scrollTo( 0, 0 ); } function ClearFocus() { if( lastTarget != null ) HideTableTarget ( lastTarget ) lastTarget = null; }