var pfx = "tmpl_rdb_SearchForm_rdbSearchForm_";

ow_f_AppendLoadEvent(
function() {
	if (document.getElementById(pfx + "btnSearch") != null) ow_f_AddEvent(document.getElementById(pfx + "btnSearch"), "click", rdbClick, false);
	if (document.getElementById("rdbSearchForm") != null) {
		var inp = document.getElementById("rdbSearchForm").getElementsByTagName("input");
		for (var i = 0; i < inp.length; i++) if (inp[i].type == "text") ow_f_AddEvent(inp[i], "keypress", rdbKey, false);
	}
}
);

// --------------------------------------------------------------------------------
// rdbKey()
// Fires when a textfield had focus and ENTER was pressed.
function rdbKey(e) {
	var code;
	if (!e) var e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	if (code == 13) {
		document.getElementById(pfx + "btnSearch").click();
		if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
	}
}

// --------------------------------------------------------------------------------
// rdbClick()
// Fires when the submit button was clicked.
// --------------------------------------------------------------------------------
function rdbClick(e) {
	if (!rdbValid()) {
		if (!e) var e = window.event;
		if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
	} else {
		return;
	}
}

// --------------------------------------------------------------------------------
// rdbValid()
// Validates the data entered in the Accommodations app.
// --------------------------------------------------------------------------------
// Arguments:
//	- none
// Returns:
//	- the results of the validation [boolean]
// --------------------------------------------------------------------------------
function rdbValid() { return true; }