// --------------------------------------------------------------------------------
// nsvVideoMiniSearch.js
// --------------------------------------------------------------------------------

var fieldPrefix = "tmpl_nsvVideoMiniSearch_nsvVideoMiniSearch_";

// --- Attach JS to document elements and execute simple statements. ---
ow_f_AppendLoadEvent(
function()
{
	if (document.getElementById(fieldPrefix + "btnSearch") != null)
	    ow_f_AddEvent(document.getElementById(fieldPrefix + "btnSearch"), "click", SearchFormSubmitClicked, false);

}
);

// --------------------------------------------------------------------------------
// searchFormSubmitClicked()
// Fires when the submit button was clicked.
// --------------------------------------------------------------------------------
// Arguments:
//	- none
// Returns:
//	- Nothing
// --------------------------------------------------------------------------------
function SearchFormSubmitClicked(e) {
	if (!CheckNoSearchCriteria()) {
		if (!e) var e = window.event;
		if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
	} else {
		return;
	}
}

// --------------------------------------------------------------------------------
// CheckNoSearchCriteria()
// Checks that the user made a selection from the drop down.
// --------------------------------------------------------------------------------
// Arguments:
//	- none
// Returns:
//	- Nothing
// --------------------------------------------------------------------------------

function CheckNoSearchCriteria()
{

	var lstCategory = document.getElementById(fieldPrefix + "lstCategory");
	if (lstCategory != null)
		if (lstCategory.options[lstCategory.selectedIndex].value == "0") {
			alert(document.getElementById(fieldPrefix + "ow_rfvCategory").value);
			lstCategory.focus();
			return false;
		}
	return true;
}