/* ************************************************************
** URLJUMP.JS - JS Select-Box URL Jump Library
** ===========================================
** This library contains code to perform select-box URL jumps. 
** Enjoy ... and please maintain this header!
**
** To load this library in an HTML doc, put the following
** line in the doc's HEAD (before any other SCRIPT tags):
**
** <SCRIPT SRC="urljump.js" LANGUAGE="JavaScript"></SCRIPT>
**
** Author      Ver  Date    Comments
** ======      ===  ====    ========
** Rick Scott  1.0  2/1/00  First release
**
** Copyright 2000, Rick Scott, all rights reserved.
************************************************************ */


/* ************************************************************
** openURL(url)
** ============
** open specified URL in current window
**   url - absolute or relative URL
************************************************************ */

function openURL(url)
  {
  if (url == "")
    return;
  top.location.href = url;
  }


/* ************************************************************
** fillDependentSelectBox(selectBox, selectedVal)
** ===============================================
** Fill a dependent select box with desired options. E.g., in a 
** two-level select-box construct (see navigate.html), the master
** select box would use onChange to call fillDependentSelectBox(),
** and the dependent select box would use onChange to call openURL().
**   selectBox - dependent select-box object to fill
**   selectedVal - currently selected select-box value
**
** Note: This fillDependentSelectBox() code is tailored specifically 
** to the select-box constructs on the navigate.html demo page. You'll
** have to modify the code to fit your select-box construct needs. The
** logic will be the same, but the details will be different.
************************************************************ */

function fillDependentSelectBox(selectBox, selectedVal)
  {  
  if (selectedVal == "AltaVista") 
    {
    // the first arg to Option() is the text that appears in the select box
    // for a given select option, the second arg is the value of this option
    // (which, in this case, is a URL)
    var opt1 = new Option("Travel", "http://jump.altavista.com/travel");
    var opt2 = new Option("People", "http://jump.altavista.com/people");
    var opt3 = new Option("Miscellany", "http://jump.altavista.com/ch_en");
    }
  else if (selectedVal == "devHead") 
    {
    var opt1 = new Option("HTML", "http://www.zdnet.com/devhead/filters/html/");
    var opt2 = new Option("CSS/Fonts", "http://www.zdnet.com/devhead/filters/css/");
    var opt3 = new Option("JavaScript", "http://www.zdnet.com/devhead/filters/javascript/");
    }
  else if (selectedVal == "Yahoo!") 
    {
    var opt1 = new Option("Auctions", "http://www.yahoo.com/homet/?http://auctions.yahoo.com");
    var opt2 = new Option("World Wide Web", "http://www.yahoo.com/r/ww");
    var opt3 = new Option("Movies", "http://www.yahoo.com/homer/?http://movies.yahoo.com");
    }
  else if (selectedVal == "Travel") 
    {
    var opt1 = new Option("Book a Flight", 
      "http://www.thetrip.com/reservations/itn/inter/0,1425,1-4-ITN,00.html");
    var opt2 = new Option("Book a Car", 
      "http://www.thetrip.com/reservations/itn/inter/0,1425,1-4-car,00.html");
    var opt3 = new Option("Book a Hotel", 
      "http://www.thetrip.com/reservations/itn/inter/0,1425,1-4-hotel,00.html");
    }
  else if (selectedVal == "People") 
    {
    var opt1 = new Option("Switchboard", 
      "http://www.switchboard.com");
    var opt2 = new Option("Help", 
      "http://altavista.switchboard.com/Cobrands/help_peoplenew.HTM#FindPers");
    var opt3 = new Option("Free Listing", 
      "http://login.switchboard.com/bin/cgireg.dll?FUNC=REGDISPLAYNEWUSER&MEM=212");
    }
  else if (selectedVal == "Miscellany") 
    {
    var opt1 = new Option("Entertainment", 
      "http://jump.altavista.com/ch_en");
    var opt2 = new Option("Sports", 
      "http://jump.altavista.com/ch_sp");
    var opt3 = new Option("Money", 
      "http://jump.altavista.com/ch_mo");
    }
  else if (selectedVal == "HTML") 
    {
    var opt1 = new Option("HTML 101", 
      "http://www.zdnet.com/devhead/stories/articles/0,4413,1600332,00.html");
    var opt2 = new Option("Web Page 101", 
      "http://www.zdnet.com/devhead/stories/articles/0,4413,1600344,00.html");
    var opt3 = new Option("Web Page 201", 
      "http://www.zdnet.com/devhead/stories/articles/0,4413,1600349,00.html");
    }
  else if (selectedVal == "CSS/Fonts") 
    {
    var opt1 = new Option("CSS Primer", 
      "http://www.zdnet.com/devhead/stories/articles/0,4413,1600436,00.html");
    var opt2 = new Option("Funky Text", 
      "http://www.zdnet.com/devhead/stories/articles/0,4413,1600443,00.html");
    var opt3 = new Option("CSS Reality", 
      "http://www.zdnet.com/devhead/stories/articles/0,4413,1600441,00.html");
    }
  else if (selectedVal == "JavaScript") 
    {
    var opt1 = new Option("JavaScript 101", 
      "http://www.zdnet.com/devhead/stories/articles/0,4413,2139848,00.html");
    var opt2 = new Option("ScriptHead", 
      "http://www.zdnet.com/devhead/stories/articles/0,4413,2170375,00.html");
    var opt3 = new Option("Rollover Gods", 
      "http://www.zdnet.com/devhead/stories/articles/0,4413,2136923,00.html");
    }
  else if (selectedVal == "Auctions") 
    {
    var opt1 = new Option("Help", 
      "http://help.yahoo.com/help/us/auct/agen/");
    var opt2 = new Option("Bidder Guide", 
      "http://help.yahoo.com/help/auctions/abid/abid-01.html");
    var opt3 = new Option("Seller Guide", 
      "http://help.yahoo.com/help/auctions/asell/asell-01.html");
    }
  else if (selectedVal == "World Wide Web") 
    {
    var opt1 = new Option("History", 
      "http://dir.yahoo.com/Computers_and_Internet/Internet/World_Wide_Web/History/");
    var opt2 = new Option("JavaScript", 
      "http://dir.yahoo.com/Computers_and_Internet/Programming_Languages/JavaScript/");
    var opt3 = new Option("Best of Web", 
      "http://dir.yahoo.com/Computers_and_Internet/Internet/World_Wide_Web/Best_of_the_Web/");
    }
  else if (selectedVal == "Movies") 
    {
    var opt1 = new Option("Upcoming Releases", 
      "http://movies.yahoo.com/movies/upcoming_releases.html");
    var opt2 = new Option("Actor Index", 
      "http://dir.yahoo.com/Entertainment/Actors_and_Actresses/WhitePages/wp_1.html");
    var opt3 = new Option("Movie Ranking", 
      "http://movies.yahoo.com/movies/boxoffice/rank.html");
    }
  else  // if selectedVal doesn't match anything, create blank options
    {
    var opt1 = new Option("", "");
    var opt2 = new Option("", "");
    var opt3 = new Option("", "");
    }

  for (var i=1; i<4; i++)  // fill selectBox with specified option values
    selectBox.options[i] = eval("opt" + i);

  selectBox.options[0].selected = true;  // select top (blank) select-box option
  }



