		function funcGetDepartments(iDepartmentId, iSelectedDepartmentId){
			document.frmSearch.iDepartmentId.disabled = true;
			// get departments
			document.frames("frameGetDropDown").location = "func_GetDepartments.asp?iDepartmentId=" + iDepartmentId + "&amp;iSelectedDepartmentId=" +iSelectedDepartmentId;
		}

		function funcPopulateDepartments(myArr, iLength, iSelectedDepartmentId, iFuntionId){

			// remove previous elements of selectbox
			frmSearch.iDepartmentId.length = 0;

			var strTmp, iTmp, iIndex;
			var newItem;

			iIndex = 0;

			for(iTmp = 0; iTmp < iLength; iTmp++){
				var newItem = document.createElement("OPTION");
				strTmp = myArr[iTmp]
				newItem.value = strTmp.substr(0, strTmp.search(","));
				if (iSelectedDepartmentId == newItem.value){
					iIndex = iTmp;
				}
				newItem.text = strTmp.substr(strTmp.search(",") + 1);
				frmSearch.iDepartmentId.add (newItem);
			}

			// select the correct element
			frmSearch.iDepartmentId.selectedIndex = iIndex;

			document.frmSearch.iDepartmentId.disabled = false;
		}

		// refresh siden med ny sort
		function goSort(iSortField, iSortDirection){
			//alert("iSortField: " + iSortField + " iSortDirection: " + iSortDirection);
			document.getElementById("iSortField").value = iSortField;
			document.getElementById("iSortDirection").value = iSortDirection;
			document.frmSearch.submit();
		}

