/**
 *  Sets the value of t:inputHidden with id "isAjax" to 0
 */
function clearIsAjax() {
	document.getElementById("isAjax").value=0;
}

/**
 * Java script function for activating the search, login or
 * price range filtering process when enter is pressed.
 * It depends on the id and class attributes on the elements (form, input, a).
 * If they are changed, the script must be also updated/changed.
 * It also depends on the JSF generated java script oamSubmitForm.
 * If JSF implementation is changed this method might not work.
*/
function processKey(s, e) {
	if(e.keyCode == 13) {
		e.returnValue = false;
		if (s.id == "endeca-range-from" || s.id == "endeca-range-to") {
			form = s.form;
			form.submit();
		} else if (s.id == "searchTerm") {
			clearIsAjax();
			form = jQuery('.fastsearch-form-class');
			button = jQuery('a[id*=searchCommand]');
			oamSubmitForm(form[0][0].id, button[0][0].id);
		} else if (s.getAttribute("class") == "loginTop-input-class" || 
				s.getAttribute("class") == "passwordTop-input-secret-class") {
			form = jQuery('.verticallogin-form-class');
			button = jQuery('a[id*=verticalLogin]');
			oamSubmitForm(form[0][0].id, button[0][0].id);
		}
 	}
}

/**
 * Ignores the enter key
 */
function ignoreEnter(e) {
	if(e.keyCode == 13) {
		e.returnValue = false;
		if (e.preventDefault != undefined) {
			e.preventDefault();
		}
	}
}
