BDG Scenario 3

PersonList.js

window.onload = window_onLoad;
document.onkeypress = document_onKeyPress;

function window_onLoad() {
   var xml = '../Scripts/viewData.asp?tableName=person&fieldList=PersonId,FirstName,LastName&sortBy=LastName,FirstName';
   var id = getParam('id');
   if (id != null)
      xml = '../Scripts/viewData.asp?procName=lw_getClassList&groupId=' + id;
   xmldso.XMLDocument.ondataavailable = doLoad;
   xmldso.XMLDocument.load(xml);
   // set cursor focus to searchTerm edit box
   document.frmSearch.searchTerm.focus();
}

function formatCell(row) {
   return '<SPAN STYLE="display:none">' + row.cells[0].innerText + '</SPAN>' +
          '<IMG border="0" width="24" height="24" src="../images/indiv.gif" align="left" hspace="4">' +
          '<SPAN>' + row.cells[1].innerText + '</SPAN>';
}

function selectCell(elem) {
   var id = elem.firstChild.innerText;
   parent.frames("RIGHTPANE").window.load(id);
}

function search() {
   var term = frmSearch.searchTerm.value;
   if (term != "") {
      resetRows();
      var xml = '../Scripts/viewData.asp?tableName=person&fieldList=PersonId,LastName,FirstName&sortBy=LastName,FirstName&search=' + term;
      xmldso.XMLDocument.ondataavailable = noOp; // won't accept null
      xmldso.XMLDocument.onreadystatechange = dataAvailable;
      xmldso.XMLDocument.load(xml);
   }
   return false;
}

function document_onKeyPress() {
   // capture ENTER key, and call search function
   if (window.event.keyCode == 13)
      return search();
}