document.onkeypress = checkKey;

var defaultEnterControl;
var currentEnterControl;


function checkKey(oEvent){
	if (document.layers)
	Key = e.which;
	else
	Key = window.event.keyCode;
	if(Key==13){
		if (currentEnterControl != null){
			currentEnterControl.click();
		}
		return false;
	}
}

function btnStyleRestore( button )
{
	button.className = "BUTTON";
}

function setFocusBtnStyle( button )
{
	button.className = "CustomButton";
}

function FocusButtonById( AButtonId )
{
    changeFocusBtn(document.getElementById(AButtonId));
}

function changeFocusBtn( button )
{
	if ( null != currentEnterControl )
	{
		btnStyleRestore(currentEnterControl);
	}
	currentEnterControl = button;
	if ( null != currentEnterControl )
	{
		setFocusBtnStyle(currentEnterControl);
	}
}

function OnBlurGeneral(oEvent)
{
	changeFocusBtn(defaultEnterControl);
}