function checkCaps( e ) {
	
	if( !e ) {
		e = window.event;
	}
	if( !e ) {
		return;
	}
	
	var theKey = 0;
  	if( e.which ) {
		theKey = e.which;
	} 
 	else if( e.keyCode ) { 
		theKey = e.keyCode;
	} 
 	else if( e.charCode ) { 
		theKey = e.charCode
	} 
 	
	
	var theShift = false;
	if( e.shiftKey ) { 
		theShift = e.shiftKey;
	}
 	else if( e.modifiers ) { //Netscape 4
		
		if( e.modifiers & 4 ) { 
		  theShift = true;
		}
  	}
	
	if( (theKey > 64 && theKey < 91 && !theShift) ||
  	    (theKey > 96 && theKey < 123 && theShift) ) {
		notifyCaps(true);
	} else {
		notifyCaps(false);	
	}
}

function notifyCaps(notify){
	var c = document.getElementById('capsDisp');				
	if(notify){
		c.style.display = 'block';
		c.innerHTML = '<b>Caps Lock on päällä.</b><br>Tämä saattaa aiheuttaa sen, että salasanasi tulee kenttään väärin. Ota Caps Lock pois korjataksesi tilanteen.';
		setTimeout("hideCaps(document.getElementById('capsDisp'));", 3000);
	} else {
		hideCaps(c);
	}
}

function hideCaps(e){
	e.style.display = 'none';
}
