/*
ŠPay Plus Benefits, Inc.
Author:	Chad W. Zink
Date:		01/24/2005
Project:	eTools v1.0
*/

/***************************************************************************************/
/*	START EVENT HANDLING SCRIPT							  */
/***************************************************************************************/

//SETUP EVENT HANDLERS FOR CONTROL KEYS

/* KEY DOWN EVENT */
if( document.captureEvents ) {
	if( Event.KEYDOWN ) {
		//NS 4, NS 6+, Mozilla 0.9+
		document.captureEvents( Event.KEYDOWN );
	}
}
document.onkeydown = HandlerKeyDown;

/* KEY UP EVENT */
if( document.captureEvents ) {
	if( Event.KEYUP ) {
		//NS 4, NS 6+, Mozilla 0.9+
		document.captureEvents( Event.KEYUP );
	}
}
document.onkeyup = HandlerKeyUp;

function TranslateEvent( e ){

	if( !e ){
		if( window.event ) e = window.event;
		else return null;
	}

	if( typeof( e.which ) == 'number' ) e = e.which;
	else if( typeof( e.keyCode ) == 'number'  ) e = e.keyCode;
	else if( typeof( e.charCode ) == 'number'  ) e = e.charCode;
	else return null;

	return e;
}
function HandlerKeyUp( evt ){

	evt = TranslateEvent( evt );
}
function HandlerKeyDown( evt ){

	evt = TranslateEvent( evt );
	//handle return key
	if( evt == 13 ){

		if( document.forms[0].UserID.value.length == 0  ){
			alert("You must provide a valid Email Address to enter this secure site.");
			return false;
		} else {
			document.forms[0].submit();
			return false;
		}
	};
}

/***************************************************************************************/
/*	END EVENT HANDLING SCRIPT								  */
/***************************************************************************************/
