/*
 * A boolean variable used to flag when the page has been initialized.
 */
var pageInitialied = false;

/*
 * Is called when the body of the page is loaded to finish initializing
 * the rest of the page.
 */
function initializePage() {
  // Clear the progress status text, if any
  displayProgressStatusText(null);

  // Set focus to the first link on the page or to the limit element
  var firstLink = document.getElementById("firstLink");

  if (firstLink != null) {
    setFocusToFirstLink();
  }

	// Page initialization is complete
  pageInitialied = true;
}

/*
 * Cleanup the page with unregistering hot keys.
 */
function cleanupPage() {
}

/*
 * Receives the tab forward event supplied from the previous window supplied.
 */
function receiveTabForwardEvent(theFromWindow, theEvent) {
  window.setTimeout("setFocusToFirstLink()", 10);
}

/*
 * Receives the tab backward event supplied from the previous window supplied.
 */
function receiveTabBackwardEvent(theFromWindow, theEvent) {
  var lastLink = document.getElementById("lastLink");

  if (lastLink != null) {
  	window.setTimeout("setFocusToLastLink()", 10);
  }
}

/*
 * Sets focus to the first link element.
 */
function setFocusToFirstLink() {
  window.focus();
  var limitEle = document.getElementById("firstLink");

  if (limitEle != null) {
    limitEle.focus();
  }
}

/*
 * Sets focus to the first link.
 */
function setFocusToFirstLink() {
  window.focus();
  var firstLink = document.getElementById("firstLink");

  if (firstLink != null) {
    firstLink.focus();
  }
}

/*
 * Sets focus to the last link.
 */
function setFocusToLastLink() {
  window.focus();
  var lastLink = document.getElementById("lastLink");

  if (lastLink != null) {
    lastLink.focus();
  }
}

