      var html = "";
      var odd = true;

      function SaveLine(line) {
        line = line.replace(/\</g,'&lt;') // convert < to &lt;
        line = line.replace(/ /g,'&nbsp;') // convert space to &nbsp;
        html += (line + "<br>");
      }

      var firstShow = true;
      function Show(list, sounds, index) {
        var next = '</td><td>';
        var base = 'http://www.ellisisland.org/search/';
        var target = sounds ? " target='_parent'" : "";
        target=""; // I can't understand why I ever thought this was needed
        var line;
        if (firstShow) {
          line = '<html><head><title>"One Step" Ellis Island Search Results</title></head>';
          SaveLine(line);
          line = '<body><center><table cellspacing=0 cellpadding=0 width="100%" border=0>';
          SaveLine(line);
          line = '<tr><td></td>';
          if (fields.indexOf('|name|') != -1) {
            line += '<td>Name&nbsp;</td>';
          }
          if (fields.indexOf('|town|') != -1) {
            line += '<td>Residence&nbsp;</td>';
          }
          if (fields.indexOf('|age|') != -1) {
            line += '<td>Age&nbsp;</td>';
          }
          if (fields.indexOf('|yob|') != -1) {
            line += '<td>Born&nbsp;</td>';
          }
          if (fields.indexOf('|yoa|') != -1) {
            line += '<td>Arrived&nbsp;</td>';
          }
          if (fields.indexOf('|passrec|') != -1) {
            line += '<td>Passenger&nbsp;<br>Record&nbsp;</td>';
          }
          if (fields.indexOf('|tmanifest|') != -1) {
            line += '<td>Text&nbsp;<br>Manifest&nbsp;</td>';
          }
          if (fields.indexOf('|smanifest|') != -1) {
            line += '<td>Scanned&nbsp;<br>Manifest&nbsp;</td>';
          }
          if (fields.indexOf('|annotations|') != -1) {
            line += '<td>Anno-&nbsp;<br>tations&nbsp;</td>';
          }
          if (fields.indexOf('|image|') != -1) {
            line += '<td>Ship&nbsp;<br>Image&nbsp;</td>';
          }
          if (fields.indexOf('|pid|') != -1) {
            line += '<td>passenger ID</td>';
          }
          line += '</tr>';
          SaveLine(line);
          firstShow = false;
        }

        for (var i in list) {
          var color = odd ? '#ffffcc' : '#cccc99';
          odd = !odd;
          var born = (list[i][3] == "") ? "" : (list[i][2]-list[i][3]);

          // put a space after the comma separating last name from first name
          var comma = list[i][0].indexOf(",");
          if (comma != -1) {
            list[i][0] = list[i][0].substr(0, comma+1) + " " + list[i][0].substr(comma+1);
          }

          line = '<tr bgColor=' + color + '><td>' + index + next;
          if (fields.indexOf('|name|') != -1) {
            line += list[i][0] + next;
          }
          if (fields.indexOf('|town|') != -1) {
            line += list[i][1] + next;
          }
          if (fields.indexOf('|age|') != -1) {
            line += list[i][3] + next;
          }
          if (fields.indexOf('|yob|') != -1) {
            line += born + next;
          }
          if (fields.indexOf('|yoa|') != -1) {
            line += list[i][2] + next;
          }
          if (fields.indexOf('|passrec|') != -1) {
            line += '&nbsp;<a href="' + base + 'passRecord.asp?pID=' + list[i][4] + target + '">view</a>' + next;
          }
          if (fields.indexOf('|tmanifest|') != -1) {
            line += '&nbsp;<a href="' + base + 'viewTextmanifest.asp?pID=' + list[i][4] + '">view</a>' + next;
          }
          if (fields.indexOf('|smanifest|') != -1) {
            line += '&nbsp;<a href="' + base + 'shipManifest.asp?pID=' + list[i][4] + '">view</a>' + next;
          }
          if (fields.indexOf('|annotations|') != -1) {
            line += '&nbsp;<a href="' + base + 'ca_viewAnnotations.asp?pID=' + list[i][4] + '">view</a>' + next;
          }
          if (fields.indexOf('|image|') != -1) {
            line += '&nbsp;<a href="' + base + 'shipImage.asp?pID=' + list[i][4] + '">view</a>' + next;
          }
          if (fields.indexOf('|pid|') != -1) {
            line += list[i][4];
          }
          line += '</td></tr>';

          var n4 = (navigator.appName == "Netscape" && navigator.appVersion.charAt(0) <= 4);
          var mac = (navigator.appName == "Macintosh" || navigator.appName == "Mac_PowerPC");
          if (n4 || mac) {
            // temporary until they fix the ellisisland.org site (replace the missing </table> at the end)
            base2 = "http://stevemorse.org/ellis/fixellis.php?xxurl=";
            line = '<tr bgColor=' + color + '><td>' + index + next +
              list[i][0] + next + list[i][1] + next + list[i][2] + next + list[i][3] + next +
              (list[i][2]-list[i][3])+ next +
              '&nbsp;<a href="' + base2 + escape(base + 'passRecord.asp?pID=' + list[i][4] + target) + '">view</a>' + next +
              '&nbsp;<a href="' + base2 + escape(base + 'viewTextmanifest.asp?pID=' + list[i][4]) + '">view</a>' + next +
              '&nbsp;<a href="' + base2 + escape(base + 'shipManifest.asp?pID=' + list[i][4]) + '">view</a>' + next +
              '&nbsp;<a href="' + base2 + escape(base + 'ca_viewAnnotations.asp?pID=' + list[i][4]) + '">view</a>' + next +
              '&nbsp;<a href="' + base2 + escape(base + 'shipImage.asp?pID=' + list[i][4]) + '">view</a>' + next +
              list[i][4] + '</td></tr>';
          }
          document.write(line + "\n");
          SaveLine(line);
          index++;
        }
      }

      var firstSource = true;
      function Source() {
        if (firstSource) {
          line = '</table>' + results + '</center></body></html>';
          SaveLine(line);
          firstSource = false;
        }
        var wind = window.open();
        wind.document.write("\n\n" + html + "\n\n");
        wind.document.write('<title>Source Code of "One Step" Ellis Island Search Results</title>');
        wind.document.close();
      }
