// Usage: onkeydown="return setSubmitButton(event, buttonid)"
// Can be applied to div, table tags, etc. Anything within the
// container will use the specified button.

function setSubmitButton(e, btn) {
	if (e.keyCode == 13) {
		var button=document.getElementById(btn);
		button.click();
		return false;
	} else {
		return true;
	}
}

// The same, only with __doPostBack specified for a particular control.
// A bit hackish and not too robust, but needed to make simulating
// a linkbutton click possible in Firefox (Firefox doesn't support click() method on 
// hyperlinks)

function setSubmitButtonPostBack(e, control) {
	if (e.keyCode == 13) {
		__doPostBack(control,'')
		return false;
	} else {
		return true;
	}
}
