********************
Javascript code  and Form code are bundled together (inside the html body)
********************


<table width=500 border="0">
 <tr>
 <td>
 <center>
<SCRIPT language="JavaScript">

<!-- 
var maxmotori = 30;
var famoseuncicheto = "how+to+search";

function femoselarray(n) {
   for (var i = 1; i <= n; i++) {
     this[i] = 0;
   }
   this.maxlen = n;
   this.len = 0;
   return this;
}

var motori = new femoselarray(maxmotori);

function trovalasubstringa(bingo, pajaro) {
   var i, bingon = bingo.length, pajarolength = pajaro.length;
   for (i=0; i<=pajarolength-bingon; i++) {
      if (bingo == pajaro.substring(i,i+bingon))
        return i;
   }
   return false;
}

function motoron(name, opts, home, search) {
  var krok = trovalasubstringa(famoseuncicheto, search);
  this.name = name;
  this.opts = opts;
  this.home = home;
  this.pre_krok = search.substring(0,krok);
  this.post_krok= search.substring(krok+famoseuncicheto.length, search.length);
}

function sonta(name, opts, home, search) {
  motori.len++;
  if (motori.len <= motori.maxlen) {
    motori[motori.len] = new motoron(name, opts, home, search)
  }
  else {
    alert("Better increase maxmotori: " + motori.len + ">" + motori.maxlen)
  }
}

sonta("AltaVista", "SELECTED",
   "http://altavista.digital.com/",
   "http://altavista.digital.com/cgi-bin/query?pg=q&what=web&fmt=d&q=how+to+search");

sonta("AltaVista (UseNet)", "",
   "http://altavista.digital.com/",
   "http://altavista.digital.com/cgi-bin/query?pg=q&what=news&fmt=d&q=how+to+search" );

sonta("DejaNews", "",
   "http://www.dejanews.com/",
   "http://search.dejanews.com/nph-dnquery.xp?query=how+to+search&defaultOp=AND&svcclass=dncurrent&maxhits=25");

sonta("Excite", "",
   "http://www.excite.com/",
   "http://www.excite.com/search.gw?searchType=Concept&search=how+to+search&category=default");

sonta("FTP Search", "",
        "http://ftpsearch.ntnu.no/",
        "http://ftpsearch.ntnu.no/ftpsearch?query=how+to+search&doit=Search&type=Case+insensitive+substring+search&hits=50&matches=&hitsprmatch=&limdom=&limpath=&f1=Count&f2=Mode&f3=Size&f4=Date&f5=Host&f6=Path&header=none&sort=none&trlen=20");

sonta("Galaxy","",
   "http://galaxy.einet.net/galaxy.html",
   "http://galaxy.einet.net/www/www.html?how+to+search");

sonta("HandiLinks", "",
   "http://www.hotbot.com",
   "http://www.hotbot.com/search.html?domain=www.ahandyguide.com&MT=how+to+search&DC=50&_v=1.0&SW=web&SM=MC&OP=1&DE=0&RD=DM&search.x=40");

sonta("HotBot", "",
   "http://www.hotbot.com",
   "http://www.hotbot.com/search.html?MT=how+to+search&DC=25");

sonta("Infoseek", "",
   "http://guide-p.infoseek.com",
   "http://guide-p.infoseek.com/Titles?qt=how+to+search&col=WW&sv=IS&lk=fast");

sonta("Infoseek Ultra", "",
   "http://guide-p.infoseek.com",
   "http://guide-p.infoseek.com/Titles?qt=how+to+search&col=WW&sv=IS&lk=fast");

sonta("Infoseek (Usenet)", "",
   "http://guide-p.infoseek.com",
   "http://guide-p.infoseek.com/Titles?qt=how+to+search&col=NN&sv=IS&lk=fast");

sonta("Lycos", "",
   "http://www.lycos.com/",
   "http://www.lycos.com/cgi-bin/pursuit?query=how+to+search");

sonta("Magellan","",
   "http://www.mckinley.com/",
   "http://www.mckinley.com/extsearch.cgi?query=how+to+search");

sonta("Infoart (Russia)","",
        "http://stars.infoart.ru",
        "http://stars.infoart.ru/cgi-bin/stsrch.pl?=how+to+search");


sonta("OpenText", "",
   "http://search.opentext.com",
   "http://search.opentext.com/omw/simplesearch?SearchFor=how+to+search&mode=and");

sonta("Rambler (Russia)", "",
        "http://www.rambler.ru/",
        "http://www.rambler.ru/cgi-bin/rambler_search?and=1&short=0&news=0&words=how+to+search&Search.x=46&Search.y=12");

sonta("WebCrawler", "",
   "http://query.webcrawler.com/",
   "http://query.webcrawler.com/cgi-bin/WebQuery?searchText=how+to+search&maxHits=25");

sonta("Shareware/DOS", "",
   "http://www.shareware.com/",
   "http://search.shareware.com/code/motoron/Find?frame=none&logop=and&cfrom=quick&orfile=True&hits=25&search=how+to+search&category=DOS");

sonta("Shareware/Unix", "",
   "http://www.shareware.com/",
   "http://search.shareware.com/code/motoron/Find?frame=none&logop=and&cfrom=quick&orfile=True&hits=25&search=how+to+search&category=UNIX");

sonta("Shareware/Windows", "",
   "http://www.shareware.com/",
   "http://search.shareware.com/code/motoron/Find?cfrom=quick&frame=none&orfile=True&category=MS-Windows%28all%29&hits=25&search=how+to+search&logop=and&and=");

sonta("WhoWhere (E-mail)", "",
    "http://www.whowhere.com",
    "http://query1.whowhere.com/jwz/name.wsrch?name=how+to+search&org=");

sonta("Yahoo!", "",
   "http://www.yahoo.com/",
   "http://search.yahoo.com/bin/search?p=how+to+search" );

function HandleForm(form) {
  form.submit();  
  var i, oldq=form.query.value, newq="";
  for (i=0; i<oldq.length; i++) {  // compress [ ]+ into \+
    var thischar = oldq.charAt(i);
    if (thischar != ' ')
      newq += thischar;
    else if (lastchar != ' ')
      newq += '+';
    lastchar = thischar;
  }
  var eng = motori[1+form.service.selectedIndex];
  location.href = newq ? eng.pre_krok + newq + eng.post_krok : eng.home;
}

function DisplayForm() {


  document.writeln('<FORM OnSubmit="HandleForm(this); return false">');
  document.writeln('Search <select name="service">');
  for (i=1; i <= motori.len; i++) {
    document.writeln("<OPTION " + motori[i].opts + "> " + motori[i].name);
  }
}

DisplayForm();

// done hiding from old browsers -->

</SCRIPT>
 
 </SELECT>
 </CENTER>
 </TD>
<td width=150><font color=blue>[</font><a href="glancekr.txt">Krok's code</a><font color=blue>]</font></td>
 </TR>
 <TR>
 <TD>
 </SELECT>
 and find the following:&nbsp;<input size=50 name="query">

 </TD>
 <TD>
 <input type=submit name=search value=Krok! width=100 border=0>&nbsp;
 </TD>
 </TR>
 </FORM>
 </TABLE>