function gotoResultPage(pageNumber) {
  document.getElementById('frmSearchResults').start.value = pageNumber;
  document.getElementById('frmSearchResults').submit();
}

function sortDesc(sFieldName) {
  setSortField(sFieldName);
  setSortDirection("DESC");
  document.getElementById('frmSearchResults').submit();
}


function sortAsc(sFieldName) {
  setSortField(sFieldName);
  setSortDirection("ASC");
  document.getElementById('frmSearchResults').submit();
}

function setSortField(sFieldName) {
  if (!document.getElementById('sort')) {
    var oSortField = document.createElement("input");
    oSortField.setAttribute("name", "sort");
    oSortField.setAttribute("type", "hidden");
    oSortField.setAttribute("id", "sort");
    oSortField.setAttribute("value", sFieldName);
    document.getElementById('frmSearchResults').appendChild(oSortField);
  } else {
    document.getElementById('sort').value = sFieldName;
  }
}

function setSortDirection(sSortDirection) {
  if (!document.getElementById('order')) {
    var oDirectionField = document.createElement("input");
    oDirectionField.setAttribute("name", "order");
    oDirectionField.setAttribute("type", "hidden");
    oDirectionField.setAttribute("id", "order");
    oDirectionField.setAttribute("value", sSortDirection);
    document.getElementById('frmSearchResults').appendChild(oDirectionField);
  } else {
    document.getElementById('order').value = sSortDirection;
  }
}