
/*
***************************************************************************************************
*** Original Script created by: Rich Joslin - 3/16/2004

*** Updated with overloaded function by: John McGuinness - 9/24/2004
***************************************************************************************************

Adding enter button click handling with or without the slanted apostrophe (`) client-side replacement
to keep the HTML input box from breaking.  I've overloaded the enterKeyButtonClick() function so all
that is needed is to add the javascript keyword "this" as the third parameter to the call.

The overloaded function will capture the slanted apostrophe and keep it from even being typed in!

***************************************************************************************************
*** USAGES
***************************************************************************************************

Without the replace call:
onKeyDown="return enterKeyButtonClick(event, 'btnSaveCustInfo');"

With the replace call:
onKeyDown="return enterKeyButtonClick(event, 'btnSaveCustInfo', this);"

***************************************************************************************************
*/

function enterKeyButtonClick(event, buttonName) {
	if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
		document.getElementById(buttonName).click();
		return false;
	} else {
		return true;
	}
}

function enterKeyButtonClick(event, buttonName, textboxobject) {
	if ((event.which && event.which == 192) || (event.keyCode && event.keyCode == 192)) {
		textboxobject.value=textboxobject.value.replace('`', '');
		return false;
	}

	if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {		
		document.getElementById(buttonName).click();
		return false;
	} else {
		return true;
	}
}

function cleanUpInvalidChars(event, textboxobject) {
	if ((event.which && event.which == 192) || (event.keyCode && event.keyCode == 192)) {
		textboxobject.value=textboxobject.value.replace('`', '');
	}
}
