//var YesNo = new keybEdit('yn','Valid values are \'Y\' or \'N\'.');
var keyNumber = new keybEdit('0123456789');
var keyNumberComma = new keybEdit('0123456789,');
var keyNumberLine = new keybEdit('0123456789-');
var keyNumberPhone = new keybEdit('0123456789-()+');
var keyMoney = new keybEdit('0123456789.');

function keybEdit(strValid, strMsg) {
	//	Variables
	var reWork = new RegExp('[a-z]','gi');		//	Regular expression\
	//	Properties
	if(reWork.test(strValid))
		this.valid = strValid.toLowerCase() + strValid.toUpperCase();
	else
		this.valid = strValid;

	if((strMsg == null) || (typeof(strMsg) == 'undefined'))
		this.message = '';
	else
		this.message = strMsg;

	//	Methods
	this.getValid = keybEditGetValid;
	this.getMessage = keybEditGetMessage;
	
	function keybEditGetValid() {
		return this.valid.toString();
	}
	
	function keybEditGetMessage() {
		return this.message;
	}
}

void function editKeyBoard(objForm, objKeyb) {
	strWork = objKeyb.getValid();
	strMsg = '';							// Error message
	blnValidChar = false;					// Valid character flag

	// Part 1: Validate input
	if(!blnValidChar)
		for(i=0;i < strWork.length;i++)
			if(window.event.keyCode == strWork.charCodeAt(i)) {
				blnValidChar = true;

				break;
			}

	// Part 2: Build error message
	if(!blnValidChar) {
		if(objKeyb.getMessage().toString().length != 0)
			alert('Error: ' + objKeyb.getMessage());

		window.event.returnValue = false;		// Clear invalid character
		objForm.focus();						// Set focus
	}
}

/*
void function setEvents() {
	document.all.txtYN.onkeypress = new Function('editKeyBoard(this,YesNo)');
	document.all.txtNumeric.onkeypress = new Function('editKeyBoard(this,Numerico)');
	document.all.txtAlpha.onkeypress = new Function('editKeyBoard(this,Alpha)');
	document.all.txtAlphaNumerico.onkeypress = new Function('editKeyBoard(this,AlphaNumerico)');
	document.all.txtDecimal.onkeypress = new Function('editKeyBoard(this,kDecimal)');
	document.all.txtDate.onkeypress = new Function('editKeyBoard(this,kDate)');
	document.all.txtDate.onkeypress = new Function('editKeyBoard(this,NumericoNM)');
	
}




*/
