

	function gotoPage(url) {
		window.location.href = url;
	}
	
	//For each select box you must declare hidden field with id pattern <selected_> + selectbox_id, e.g. id="selected_categories"
	function prepareSelectedFields(selectBoxesArr) {
		for(var i=0; i<selectBoxesArr.length; i++) {
			var selectedValues = getSelectBoxSelectedValues(selectBoxesArr[i]);
			var hiddenElement = document.getElementById("selected_"+selectBoxesArr[i]);
			hiddenElement.value = selectedValues;
		}
	}
	
	function getSelectBoxSelectedValues(selectBoxId, returnAll) {
		var values="";
		var selectBox = document.getElementById(selectBoxId);
		var options = selectBox.options;
		for(var j=0; j<options.length; j++)
		{
			if (options[j].selected || returnAll)
			{
				if (values != "")
					values += ",";
				values += options[j].value;
			}
		}
		return values;
	}
	
	function openPopup(uri, dialogId, width, height) {
		var wnd = window.open(uri, dialogId, "width=" + width + ",height=" + height +
							  ",status=no,toolbar=no,menubar=no,location=no,resizeable=no,scrollbars=true");
	}
	
	function openWindow(url) {
		window.open(url);
	}
	
	function preselectItem(selectValue, selectBoxId) {
		var selectBox = document.getElementById(selectBoxId);
		var options = selectBox.options;
		for(var i=0; i<options.length; i++)	{
			if (selectValue==options[i].value) {
				selectBox.selectedIndex = i;
				break;
			}
		}
	}