<!-- Original: Dion (biab@iinet.net.au) -->
<!-- Web Site: http://www.iinet.net.au/~biab/ -->

<!-- Based on the original adapted and modified by DSH 20-May-2001 - http://www.dsh.tst.de/ -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com/ -->

function search(frm)
 {
  head0="<HTML><HEAD><TITLE>Suchergebnis in www.aarstrasse.de</TITLE><LINK REL='stylesheet' HREF='aarstyle.css' TYPE='text/css'><BASE TARGET='Inhalt'></HEAD>";
  page1="<BODY CLASS=home><DIV ALIGN=Center><TABLE BORDER>";
  win = window.open("","","width=480,height=200,scrollbars");
  win.document.write(head0);
  win.document.write(page1);
  txt = frm.srchval.value.toLowerCase().split(" ");
  win.document.write("<CAPTION CLASS=home>Suchbegriff: "+txt+"</CAPTION>");
  fnd = new Array(); total=0;
  key = new Array();
  for (i = 0; i < item.length; i++)
   {
    fnd[i] = 0; order = new Array(0, 4, 2, 3);
    for (j = 0; j < order.length; j++)
     {
      for (k = 0; k < txt.length; k++)
      if (item[i][order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != "")
      fnd[i] += (j+1);
     }
   }
  for (i = 0; i < fnd.length; i++)
   {
    n = 0; w = -1;
    for (j = 0; j < fnd.length; j++)
    if (fnd[j] > n) { n = fnd[j]; w = j; };
    if (w > -1) total += show(w,win,n,txt,key[w]);
    fnd[w] = 0;
   }

  page2="</TABLE></DIV><P>Insgesamt gefundene Einträge: "+total;
  foot3="<P><IMG SRC='aarstr0.gif' WIDTH=256 HEIGHT=48><P CLASS=foot>&copy; <A HREF='http://www.dsh.tst.de/'>DSH</A> Elektronische Medien und Internet-Dienste</BODY></HTML>";
  win.document.write(page2);
  win.document.write(foot3);
  win.document.close();
 }

function show(which,wind,num,txt,found)
 {
  found = "";
  for (j = 1; j < order.length; j++)
   {
    kwd = "";
    for (k = 0; k < txt.length; k++)
     {
      string = ""; 
      alet = "";
      plet = "";
      ind = item[which][order[j]].toLowerCase().indexOf(txt[k]);
      if (ind < 0) continue;
      for (l = 0; l < ind; l++)
       {
        alet = item[which][order[j]].substr(ind-l-1,1);
        if (alet != "," && alet != " " && alet != "")
         string = alet + string;
        else
         break;
       }
      mm = item[which][order[j]].indexOf(",",ind) - ind;
      mn = item[which][order[j]].indexOf(" ",ind) - ind;
      if (mm > mn) m = mn; else m = mm;
      if (mm < 0) m = mn;
      if (mn < 0) m = mm;
      if (mm == mn) m =99;
      plet = item[which][order[j]].substr(ind,m);
      if (plet != "")
       string = string + plet;
      else
       string = string + txt[k];
      if (kwd !== "" && string !== "") kwd = kwd + ", ";
      kwd = kwd + string;
     }
    if (found !== "" && kwd !== "") found = found + ", ";
    found = found + kwd
   }

  link = item[which][1] + item[which][0]; 
  line = "<TR><TD><A HREF='"+link+"'>"+item[which][2]+"</A></TD><TD>"+num+"</TD><TD>"+found+"</TD></TR>";
  wind.document.write(line);
  return 1;
 }

