function EnterTrapper() { }
EnterTrapper.TrapKey = function(ControlID, ButtonID, KeyCode)
{
	function AttachEvent(Control)
	{
	    Control.onkeypress = function(e)
	    {
		    var key;
			if(window.event)
	    		key = window.event.keyCode;     //IE
			else key = e.which;     			//firefox

	        if (key == KeyCode)
	        {
	            //Get the button the user wants to have clicked
	            var btn = document.getElementById(ButtonID);
	            if (btn != null)
	            {
	                btn.click();
	                return false;
	            }
	        }
	    }
	}

	if(KeyCode == null)
	    KeyCode = 13;

	var Control = document.getElementById(ControlID);
	if(Control.tagName == "INPUT")
	    AttachEvent(Control);
	else
	{
	    var Elements = Control.getElementsByTagName("input");
		for(var ct = 0; ct < Elements.length; ct++)
		{
		    AttachEvent(Elements[ct]);
		}
	}

}
