
window.focus();

var win = window;    // window to search.
var n   = 0;

function findInPage(str) {

  var txt, i, found;

  if (str == "")
    return false;

  // Find next occurance of the given string on the page, wrap around to the
  // start of the page if necessary.

  if (isNN) {

    // Look for match starting at the current point. If not found, rewind
    // back to the first match.

    if (!win.find(str))
      while(win.find(str, false, true))
        n++;
    else
      n++;

    // If not found in either direction, give message.

    if (n == 0)
      alert(str + " not found.");
  }

  if (isIE4 || isFF) {
    txt = win.document.body.createTextRange();

    start_at = txt.text.indexOf("Australian Business Number (ABN) 99 724 136 560");

    if (start_at == -1) {
      start_at = txt.text.indexOf("Start of Alphabetic Index");

      if (start_at == -1) {
      start_at = 0;
      }

    }

    txt.moveStart("character", start_at);




    // Find the nth match from the top of the page.

    for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
      txt.moveStart("character", 1);
      txt.moveEnd("textedit");
    }

    // If found, mark it and scroll it into view.

    if (found) {
      txt.moveStart("character", -1);
      txt.findText(str);
      txt.select();
      txt.scrollIntoView();
      n++;
    }

    // Otherwise, start over at the top of the page and find first match.

    else {
      if (n > 0) {
        n = 0;
        findInPage(str);
      }

      // Not found anywhere, give message.

      else
        alert(str + " not found.");
    }
  }

  return false;
}

document.onkeydown = function(){

if(window.event && window.event.keyCode == 114) 
        { // Capture and remap F3
     window.event.keyCode = 505;
       }

if(window.event && window.event.keyCode == 505) 
        { // New action for F3
     findInPage(document.forms["search"].string.value);
     return false; 
        // Must return false or the browser will refresh anyway
     }

}

function editThis(item, page) {

top.frames['select'].document.location.href = "edit/editlist.asp?p=" + page + "&i=" + item;

top.document.body.rows = "40,*,400";
top.document.getElementById('codeset').cols = "*,-1,-1,-1,-1";
top.document.getElementById('mainset').cols = "-1,*";

}
