/* program..: paraSite.js       */
/* author...: the oxherder      */
/* email....: jnardo@onramp.net */
/* generator: paraSite.exe      */
/* license..: public domain     */

var URL          = new urlBase('index', 'category', 'url');
var choiceString = getCookie('myChoices');
if (choiceString == null || choiceString.length != 8){choiceString = '00000000'}
var altavista    = 0;
var excite       = 1;
var hotbot       = 2;
var infoseek     = 3;
var looksmart    = 4;
var lycos        = 5;
var magellan     = 6;
var metacrawler  = 7;
var snap         = 8;
var webcrawler   = 9;
var yahoo        = 10;

var webPrefix    = 0;
var roadMaps     = 1;
var yellowPages  = 2;
var whitePages   = 3;
var emailSearch  = 4;
var news         = 5;
var sports       = 6;
var stocks       = 7;
var webSuffix    = 8;

URL.addRecord(altavista, roadMaps, 'http://maps.altavista.com/cgi-bin/mapcgi');
URL.addRecord(altavista, yellowPages, 'http://altavista.switchboard.com/bin/cgidir.dll?MG=&MEM=212');
URL.addRecord(altavista, whitePages, 'http://altavista.switchboard.com/bin/cgiqa.dll?MG=&MEM=212');
URL.addRecord(altavista, emailSearch, 'http://www.switchboard.com/bin/cgiemail.dll?MG=&MEM=212');
URL.addRecord(altavista, news, 'http://abcnews.go.com/altavista/sections/world/index.html');
URL.addRecord(altavista, sports, 'http://abcnews.go.com/altavista/sections/sports/');
URL.addRecord(altavista, webPrefix, 'http://www.altavista.com/cgi-bin/query?pg=q&what=web&fmt=.&q=');
URL.addRecord(altavista, stocks, 'http://altavista.wallst.com');
URL.addRecord(altavista, webSuffix, '');

URL.addRecord(excite, roadMaps, 'http://city.net/maps/address/');
URL.addRecord(excite, yellowPages, 'http://yellowpages.zip2.com/');
URL.addRecord(excite, whitePages, 'http://www.excite.com/reference/people_finder/');
URL.addRecord(excite, emailSearch, 'http://www.excite.com/reference/email_lookup');
URL.addRecord(excite, news, 'http://nt.excite.com/news');
URL.addRecord(excite, sports, 'http://sports.excite.com/');
URL.addRecord(excite, webPrefix, 'http://search.excite.com/search.gw?look=default&trace=b&collection=web&search=');
URL.addRecord(excite, stocks, 'http://quicken.excite.com/');
URL.addRecord(excite, webSuffix, '');

URL.addRecord(hotbot, roadMaps, 'http://www.hotbot.com/partners/maps.asp');
URL.addRecord(hotbot, yellowPages, 'http://www.hotbot.com/partners/business.asp');
URL.addRecord(hotbot, whitePages, 'http://www.hotbot.com/partners/people.asp');
URL.addRecord(hotbot, emailSearch, 'http://www.hotbot.com/partners/email.asp');
URL.addRecord(hotbot, news, 'http://headlines.hotbot.com/news/');
URL.addRecord(hotbot, sports, 'http://www.hotbot.com/sports/');
URL.addRecord(hotbot, webPrefix, 'http://www.hotbot.com/?MT=');
URL.addRecord(hotbot, stocks, 'http://stocks.hotbot.com/');
URL.addRecord(hotbot, webSuffix, '&SM=MC&DV=0&LG=any&DC=10&DE=2&submit=SEARCH&_v=2&OPs=MDRTP');

URL.addRecord(infoseek, roadMaps, 'http://infoseek.go.com/Facts?pg=maps.html&lk=noframes&svx=liu_maps');
URL.addRecord(infoseek, yellowPages, 'http://national.sidewalk.msn.com/infoseek/search');
URL.addRecord(infoseek, whitePages, 'http://infoseek.go.com/Facts?pg=email.html&lk=noframes&svx=liu_white_pages');
URL.addRecord(infoseek, emailSearch, 'http://infoseek.go.com/Facts?pg=email.html&lk=noframes&svx=liu_email_lookup');
URL.addRecord(infoseek, news, 'http://infoseek.go.com/Center/News/?lk=noframes&nh=10');
URL.addRecord(infoseek, sports, 'http://infoseek.go.com/Center/Sports/?lk=noframes&nh=10');
URL.addRecord(infoseek, webPrefix, 'http://infoseek.go.com/Titles?qt=');
URL.addRecord(infoseek, stocks, 'http://money.go.com/');
URL.addRecord(infoseek, webSuffix, '&col=WW&sv=IS&lk=noframes&nh=10&svx=home_searchbox');

URL.addRecord(looksmart, roadMaps, 'http://www.mapblast.com/mapblast/start.hm');
URL.addRecord(looksmart, yellowPages, 'http://www.looksmart.com/r?l&tunnel=businesses.html');
URL.addRecord(looksmart, whitePages, 'http://www.looksmart.com/r?l&tunnel=people.html');
URL.addRecord(looksmart, emailSearch, 'http://www.looksmart.com/r?l&tunnel=people.html');
URL.addRecord(looksmart, news, 'http://www.looksmart.com/r?l&panel=catsum{day=today{sum=TopStories');
URL.addRecord(looksmart, sports, 'http://www.sportsline.com/');
URL.addRecord(looksmart, webPrefix, 'http://www.looksmart.com/r_search?look=&key=');
URL.addRecord(looksmart, stocks, 'http://www.stockpoint.com/');
URL.addRecord(looksmart, webSuffix, '&search=0&x=9&y=4');

URL.addRecord(lycos, roadMaps, 'http://www.lycos.com/roadmap.html');
URL.addRecord(lycos, yellowPages, 'http://yp.gte.net/sform.phtml?SRC=lycos&STYPE=S');
URL.addRecord(lycos, whitePages, 'http://www.whowhere.lycos.com/Phone');
URL.addRecord(lycos, emailSearch, 'http://whowhere.lycos.com/Email');
URL.addRecord(lycos, news, 'http://news.lycos.com/headlines/TopNews/');
URL.addRecord(lycos, sports, 'http://news.lycos.com/headlines/Sports/');
URL.addRecord(lycos, webPrefix, 'http://www.lycos.com/cgi-bin/pursuit?matchmode=and&cat=lycos&query=');
URL.addRecord(lycos, stocks, 'http://investing.lycos.com/');
URL.addRecord(lycos, webSuffix, '&x=50&y=11');

URL.addRecord(magellan, roadMaps, 'http://city.net/maps/');
URL.addRecord(magellan, yellowPages, 'http://yellowpages.zip2.com/');
URL.addRecord(magellan, whitePages, 'http://www.excite.com/reference/people_finder/');
URL.addRecord(magellan, emailSearch, 'http://www.excite.com/reference/email_lookup/');
URL.addRecord(magellan, news, 'http://magellan.excite.com/news');
URL.addRecord(magellan, sports, 'http://magellan.excite.com/sportshttp://magellan.excite.com/sports');
URL.addRecord(magellan, webPrefix, 'http://www.mckinley.com/search.gw?search=');
URL.addRecord(magellan, stocks, 'http://quicken.excite.com/investments/quotes/');
URL.addRecord(magellan, webSuffix, '&c=web&look=magellan');

URL.addRecord(metacrawler, roadMaps, 'http://www.infospace.com/info.go2net/fillc?nf=mapdir.html');
URL.addRecord(metacrawler, yellowPages, 'http://www.athand.com/');
URL.addRecord(metacrawler, whitePages, 'http://www.infospace.com/info.go2net/index_ppl.html');
URL.addRecord(metacrawler, emailSearch, 'http://in-110.infospace.com/_1_4PBWTP702HMH4JB__info.go2net/email1.htm');
URL.addRecord(metacrawler, news, 'http://www.go2net.com/channels/news/');
URL.addRecord(metacrawler, sports, 'http://www.go2net.com/channels/sports/');
URL.addRecord(metacrawler, webPrefix, 'http://search.go2net.com/crawler?general=');
URL.addRecord(metacrawler, stocks, 'http://www.stocksite.com/research/');
URL.addRecord(metacrawler, webSuffix, '&method=0&target=&region=0&rpp=20&timeout=5&hpe=10');
URL.addRecord(snap, roadMaps, 'http://www.snap.com/search/map/form/0,161,home-0,00.html?st.sn.fdsc.0.mp');
URL.addRecord(snap, yellowPages, 'http://www.snap.com/search/business/results/1,60,home-0,00.html?st.sn.fdsc.0.yp');
URL.addRecord(snap, whitePages, 'http://www.snap.com/search/people/results/0,57,-0,00.html?st.sn.fdsc.0.wp');
URL.addRecord(snap, emailSearch, 'http://www.snap.com/search/email/results/0,71,home-0,00.html?st.sn.fdsc.0.em');
URL.addRecord(snap, news, 'http://www.snap.com/main/channel/0,2,-nw,00.html');
URL.addRecord(snap, sports, 'http://www.snap.com/main/channel/0,2,-sp,00.html');
URL.addRecord(snap, webPrefix, 'http://www.snap.com/search/directory/results/1,61,home-0,00.html?tag=st.sn.fdsb&keyword=');
URL.addRecord(snap, stocks, 'http://www.snap.com/main/channel/0,2,home-mn,00.html');
URL.addRecord(snap, webSuffix, '');

URL.addRecord(webcrawler, roadMaps, 'http://webcrawler.city.net/maps/');
URL.addRecord(webcrawler, yellowPages, 'http://yellowpages.zip2.com/webc');
URL.addRecord(webcrawler, whitePages, 'http://webcrawler.com/reference/people_finder');
URL.addRecord(webcrawler, emailSearch, 'http://webcrawler.com/reference/email_lookup');
URL.addRecord(webcrawler, news, 'http://www.webcrawler.com/news/242/');
URL.addRecord(webcrawler, sports, 'http://www.webcrawler.com/news/122/');
URL.addRecord(webcrawler, webPrefix, 'http://www.webcrawler.com/cgi-bin/WebQuery?searchText=');
URL.addRecord(webcrawler, stocks, 'http://quicken.webcrawler.com/investments/quotes/');
URL.addRecord(webcrawler, webSuffix, '');

URL.addRecord(yahoo, roadMaps, 'http://maps.yahoo.com/py/maps.py');
URL.addRecord(yahoo, yellowPages, 'http://yp.yahoo.com/');
URL.addRecord(yahoo, whitePages, 'http://people.yahoo.com/');
URL.addRecord(yahoo, emailSearch, 'http://people.yahoo.com/');
URL.addRecord(yahoo, news, 'http://dailynews.yahoo.com/headlines/ts/');
URL.addRecord(yahoo, sports, 'http://dailynews.yahoo.com/headlines/sports/');
URL.addRecord(yahoo, webPrefix, 'http://search.yahoo.com/bin/search?p=');
URL.addRecord(yahoo, stocks, 'http://finance.yahoo.com/');
URL.addRecord(yahoo, webSuffix, '');

function urlBase(arg1, arg2, arg3){
  var count;
  this.fields = 3;
  this.field = new Array(3);
  this.field[0] = arg1;
  this.field[1] =arg2;
  this.field[2] = arg3;
  this.records = 0;
  this.record =new Array(11);
  for (count=0; count<11; count++){
    this.record[count] = new Array(9)}
  this.addRecord = addRecord;
  this.getRecord = getRecord}

function addRecord(arg1, arg2, arg3){
  this.record[arg1][arg2] = arg3;
  this.records++}

function getRecord(arg1, arg2){
  return(this.record[arg1][arg2])}

function displaySite(oURL){
  var oWindow =  '';
      oWindow += 'toolbar=yes,';
      oWindow += 'location=yes,';
      oWindow += 'resizable=yes,scrollbars=yes,';
      oWindow += 'status=yes,width=600,height=400';
  myWindow = open(oURL, 'URL', oWindow)}

function displayURL(){
  var thisURL
  var oCategory = document.search_engine.find_what.selectedIndex;
  var oIndex = document.search_engine.myIndex.selectedIndex;
  var oString = document.search_engine.myText.value;
  var oWindow =  '';
      oWindow += 'toolbar=yes,';
      oWindow += 'location=yes,';
      oWindow += 'resizable=yes,scrollbars=yes,';
      oWindow += 'status=yes,width=600,height=400';
  var newChoiceString = '';
  if (oCategory == 0){
    thisURL =  URL.getRecord(oIndex, webPrefix);
    thisURL += formatString(oString);
    thisURL += URL.getRecord(oIndex, webSuffix);
    myWindow = open(thisURL, 'URL', oWindow)}
  else {
    myWindow = open(URL.getRecord(oIndex, oCategory), 'URL', oWindow)}
  for (count=0; count<8; count++){
    if (count == oCategory){
      newChoiceString += (oIndex == 10) ? 'A' : oIndex}
    else {newChoiceString += choiceString.charAt(count)}}
  choiceString = newChoiceString;
  setCookie('myChoices',choiceString,365)}

function formatString(theString){
  if (isNotBlank(theString)){
    theString = spaceTrim(theString);
    theString = replaceChar(theString,'"',"'");
    theString = replaceChar(theString,"'",'%22');
    theString = replaceChar(theString, '+', '%2B');
    theString = replaceChar(theString, ' ', '+');
    return(theString)}
  else {return('')}}

function replaceChar(InString, oldChar, newStr) {
   var NewString='';
   var count;
   for (count=0; count < InString.length; count++){
      if   (InString.charAt(count)==oldChar) {NewString += newStr}
      else {NewString += InString.charAt(count)}}
   return(NewString)}

function isNotBlank(InString) {
   if (InString == null) {
      return(false)}
   if (InString.length != 0) {
      return(true)}
   else {return(false)}}

function spaceTrim(InString) {
   var LoopCtrl=true;
   while (LoopCtrl) {
      if (InString.indexOf('  ') != -1) {
         Temp = InString.substring(0, InString.indexOf('  '));
         InString = Temp + InString.substring(InString.indexOf('  ')+1,InString.length)}       else
         LoopCtrl = false}
   if (InString.substring(0, 1) == ' ')
      InString = InString.substring(1, InString.length)
   if (InString.substring (InString.length-1) == ' ')
      InString = InString.substring(0, InString.length - 1)
   return (InString)}

function setCookie(name, value, days) {
   var today = new Date();
   var expires = new Date();
   expires.setTime(today.getTime() + 1000*60*60*24*days);
   document.cookie = name + '=' + escape(value) + '; expires=' + expires.toGMTString()}

function getCookie(name){
   var search = name + '=';
   if (document.cookie.length > 0){
      offset = document.cookie.indexOf(search);
      if (offset != -1){
         offset += search.length ;
         end = document.cookie.indexOf(';', offset);
         if (end == -1){
            end = document.cookie.length}
         return unescape(document.cookie.substring(offset, end))}
       else {return('')}}
   else {return('')}}

function updateIndex(){
  var oCategory = document.search_engine.find_what.selectedIndex;
  var oIndex = choiceString.charAt(oCategory);
  if (oIndex == 'A'){oIndex = 10}
  document.search_engine.myIndex.selectedIndex = oIndex}


