
function cST(propertyId) {
  return changeSortType(propertyId);
}

function changeSortType(propertyId) {
  gEI('gradeHeader').focus();
//  gEI('specsHeader').focus();
//alert('' + propertyId);
  // Hide all selects and submit.
  if (propertyId < 0) {
    selectedSortPropertyId = -1;
    selectedSortPropertyType = '';
    selectedSortDirection = '';
    return;
  }
  selectedSortPropertyId = propertyId;
  for (pos = 0; pos < sortPropertyIds.length; pos++) {
    if (sortPropertyIds[pos] == propertyId) {
      break;
    }
  }
  selectedSortPropertyType = sortPropertyTypes[pos];
  selectedSortDirection = sortPropertyDirections[pos];
  doSorting();
}

// Send submit check/preparation function!
function doSorting() {
  // Check that either a value has been entered into limit text field or property type equals boolean.
  if (selectedSortPropertyId < 0) {
    alert(lang("sort", "selectProperty") + selectedSortPropertyId);
    return;
  }
  gEI('startNo').value = "1";
  var sortString = "" + selectedSortPropertyType + "," + selectedSortPropertyId + "," + selectedSortDirection;
  document.getElementById("sortString").value = sortString;
  overviewFaderTimer = setTimeout("overviewFader(700)", 0);
  aRO(categoryId, 1);
}

