// JavaScript Document
function capsDetect( e ) {
	if( !e ) { e = window.event; } if( !e ) { MWJ_say_Caps( false ); return; }
	//what (case sensitive in good browsers) key was pressed
	var theKey = e.which ? e.which : ( e.keyCode ? e.keyCode : ( e.charCode ? e.charCode : 0 ) );
	//was the shift key was pressed
	var theShift = e.shiftKey || ( e.modifiers && ( e.modifiers & 4 ) ); //bitWise AND
	//if upper case, check if shift is not pressed. if lower case, check if shift is pressed
	MWJ_say_Caps( ( theKey > 64 && theKey < 91 && !theShift ) || ( theKey > 96 && theKey < 123 && theShift ) );
}
function MWJ_say_Caps( oC ) {
	if( typeof( capsError ) == 'string' ) { 
		if( oC ) { 
			alert( capsError ); 
			event.returnValue = false;
			} 
		} 
	else { 
		capsError( oC ); 
		}
}

//you must either define capsError as a function or a message to be alerted

	//this will make the script alert a message if Caps Lock is engaged
	var capsError = 'WARNING:\n\nCaps Lock está ligado\n\nPor favor desabilite a caixa alta (maiúsculas)';

	//this will make the script run a function and pass it a parameter saying if Caps Lock is engaged
	//function format NOT compatible with v1 - it will now be run even if Caps Lock is not enabled
	function capsError( capsEngaged ) {
		if( capsEngaged ) {
			//do something to warn the user that caps lock is engaged
			//alert(capsError);
		} else {
			//remove any warnings that caps lock is engaged
		}
	}
