// hide this script from non-JavaScript browsers

// All code in this script is Copyright(C) 1996, Justin Boyan, jab+j@cs.cmu.edu
// For documentation and more info, see:  http://www.cs.cmu.edu/~jab/snark/
// This is SNARK Version 1.0, 18 May 1996

var MAX_ENGINES = 30;
var SNARK_STRING = "hunting+the+snark";

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

var engs = new MakeArray(MAX_ENGINES);

function find_substring(needle, haystack) {
   var i, needlen = needle.length, haylen = haystack.length;
   for (i=0; i<=haylen-needlen; i++) {
      if (needle == haystack.substring(i,i+needlen))
        return i;
   }
   return false;
}

function Engine(name, opts, home, search) {
  var snark = find_substring(SNARK_STRING, search);
  this.name = name;
  this.opts = opts;
  this.home = home;
  this.pre_snark = search.substring(0,snark);
  this.post_snark= search.substring(snark+SNARK_STRING.length, search.length);
}

function Add(name, opts, home, search) {
  engs.len++;
  if (engs.len <= engs.maxlen) {
    engs[engs.len] = new Engine(name, opts, home, search)
  }
  else {
    alert("Better increase MAX_ENGINES: " + engs.len + ">" + engs.maxlen)
  }
}

// ADD YOUR OWN SEARCH ENGINES BELOW.  (See http://www.cs.cmu.edu/~jab/snark/ )


Add("Kvasir", "",
   "http://www.kvasir.no/",
   "http://kvasir.sol.no/query?q=hunting+the+snark&what=no" );
   
   Add("MP3.com", "",
   "http://www.mp3.com/",
   "http://search.mp3.com/bin/search?query=hunting+the+snark" );
   
   Add("Midi søk", "",
   "http://www.musicrobot.com/",
   "http://www.musicrobot.com/cgi-bin/search.pl?terms=hunting+the+snark&class=name&mode=diffnames" );
   
    Add("Midi 2", "",
   "http://www.midisite.co.uk/",
   "http://www.midisite.co.uk/cgi-bin/search/search.pl?Terms=hunting+the+snark&maxhits=100&Match=1&nocpp=1" );
     
   Add("Look.com", "",
   "http://www.look.com/index.asp",
   "http://www.look.com/searchroute/enterprise.asp?q=hunting+the+snark" );
   
   Add("Elyrics4u", "",
   "http://www.elyrics4u.com/",
   "http://www.elyrics4u.com/search/?query=hunting+the+snark&submit.x=15&submit.y=10" );
   
   Add("Lyrics.astraweb", "",
   "http:lyrics.astraweb.com/",
   "http://search.lyrics.astraweb.com/?word=hunting+the+snark" );

Add("Lycos", "",
   "http://www.no.lycos.de/",
   "http://www.no.lycos.de/cgi-bin/pursuit?matchmode=and&mtemp=main&etemp=error&loc=searchbox&adv=1&query=hunting+the+snark&cat=lycos&x=40&y=12" );

Add("Google", "",
   "http://www.google.com/",
   "http://www.google.com/search?q=hunting+the+snark&btnG=Google-s%F8k&hl=no&lr=" );

Add("Excite", "",
   "http://www.excite.com/",
   "http://msxml.excite.com/_1_4N2CTF705ZWST2__info.xcite/dog/webresults.htm?&qkw=hunting+the+snark&qcat=web&start=&userip=193.217.138.174&ver=08312" );

Add("AltaVista", "",
   "http://no.altavista.com/",
   "http://search.no.altavista.com/cgi-bin/query?aveenc=1&pg=q&sc=on&q=hunting+the+snark&kl=XX&what=web&search.x=42&search.y=12" );

Add("No.yahoo", "",
   "http://no.yahoo.com/",
   "http://no.search.yahoo.com/search/noint?p=hunting+the+snark&hc=0&hs=0" );

Add("Msn.no", "",
   "http://www.msn.no/",
   "http://search.msn.no/results.asp?FORM=MSNH&v=1&RS=CHECKED&CY=no&q=hunting+the+snark" );

Add("Webcrawler", "",
   "http://www.webcrawler.com/",
   "http://dpxml.webcrawler.com/info.wbcrwl/dog/webresults.htm?&qkw=hunting+the+snark&qcat=web&qk=20&start=&userip=193.217.138.174&ver=15251" );

Add("Look Smart", "",
   "http://www.looksmart.com/",
   "http://www.looksmart.com/r_search?look=&pin=020514x7cd467851577448f0f1&key=hunting+the+snark" );

Add("All the web", "",
   "http://www.alltheweb.com/",
   "http://www.alltheweb.com/cgi-bin/search?type=all&query=hunting+the+snark&exec=FAST+Search" );

Add("Hotbot!", "",
   "http://hotbot.lycos.com/",
   "http://hotbot.lycos.com/?MT=hunting+the+snark&SM=MC&DV=0&LG=any&DC=10&DE=2&AM1=MC&x=55&y=7" );


Add("Debriefing", "",
   "http://www.debriefing.com/",
   "http://debriefing.ixquick.com/do/metasearch.pl?query=hunting+the+snark&language=english&cat=web&rl=DEBRIEFING&dyn=1");

Add("Supersnooper", "",
   "http://www.supersnooper.com/",
   "http://www.supersnooper.com/Search.dll?SearchString=hunting+the+snark" );




// ADD YOUR OWN SEARCH ENGINES ABOVE.  (See http://www.cs.cmu.edu/~jab/snark/ )

function HandleForm(form) {
  form.submit();  // This fixes a mysterious Netscape bug.  Without this line,
                  // you can't use <enter> to start the search the first time.
  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 = engs[1+form.service.selectedIndex];
  location.href = newq ? eng.pre_snark + newq + eng.post_snark : eng.home;
}

function DisplayForm() {
  document.writeln('<CENTER><FORM OnSubmit="HandleForm(this); return false">');
  document.writeln('</SELECT>Search the web for<INPUT size=26 name="query">'); 
              
 document.writeln('In one of these  <SELECT name="service">');
  for (i=1; i <= engs.len; i++) {
    document.writeln("<OPTION " + engs[i].opts + "> " + engs[i].name);
  }
   
   document.writeln('<input type=submit value="Search">');
   document.writeln('</FORM> </CENTER>');
}

DisplayForm();

// done hiding from old browsers 
// -->