
/**
* Class to give user interface feedback to the user when typing in the
* customer number in the given text field element and output error messages
* to the given label element.
*
* @author	Jimmy Chin
* @date		30 August 2006
*/

function PasswordTextFieldChecking(
	pTextFieldElement,
	pEnterFunction)
{
	this.textFieldElement	= pTextFieldElement;
	this.enterFunction		= pEnterFunction;
}

PasswordTextFieldChecking.prototype =
{
	textFieldElement : null
	,
	errorMessageLabelElement : null
	,
	enterFunction : null
	,
	// static
	setup : function(
		pTextFieldElement,
		pEnterFunction)
	{
		dojo.event.connect(
			pTextFieldElement,
			"onkeypress",
			function(){
				var errorChecking = new PasswordTextFieldChecking(
					pTextFieldElement,
					pEnterFunction);
				errorChecking.passwordTextFieldOnKeyPress();
			}
		);
	}
	,
	passwordTextFieldOnKeyPress : function()
	{
		var keyCode = dojo.event.browser.currentEvent.keyCode;
		var len = this.textFieldElement.value.length;
		
		if (keyCode === 13 && this.enterFunction !== null)
		{
			this.enterFunction();
			dojo.event.browser.stopEvent(
				dojo.event.browser.currentEvent);
		}
	}

}
