    // Javascript for the entrance page

cgi = "/marees/cgi-bin/tide-shc.tcl"
 
function buildHotSpotMap (doc, language)  {
    // Build the map for the hot spots on the map of Canada.
    // `doc' is the document on which to generate the hot spot map.
    // `language' is the language to pass to the CGI that will generate the
    // HTML page of the selected zone.

              // Link each hot spot with the proper CGI, passing it the language and the zone
              // number.
    href = cgi + "?queryType=showFrameset&language=" + language;
    doc.write ('<MAP NAME="canadamap">\n');
    doc.write ('<AREA SHAPE="RECT" COORDS="275, 174, 345, 237" HREF="../../produits/js/%27%20%2B%20href%20%2B%20%27&zone=4%27%20%2B%20%27">');
    doc.write ('<AREA SHAPE="RECT" COORDS="158, 138, 276, 231" HREF="../../produits/js/%27%20%2B%20href%20%2B%20%27&zone=3%27%20%2B%20%27">');
    doc.write ('<AREA SHAPE="RECT" COORDS="54,3,275,138" HREF="../../produits/js/%27%20%2B%20href%20%2B%20%27&zone=2%27%20%2B%20%27">');
    doc.write ('<AREA SHAPE="RECT" COORDS="2, 162, 39, 231" HREF="../../produits/js/%27%20%2B%20href%20%2B%20%27&zone=1%27%20%2B%20%27">');
    doc.write ('<AREA SHAPE="polygon" coords="274, 136, 274, 175, 345, 174, 346, 238, 273, 239, 274, 263, 374, 262, 374, 136" HREF="../../produits/js/%27%20%2B%20href%20%2B%20%27&zone=5%27%20%2B%20%27">');
    doc.write ('</MAP>\n');
    }

function zoneSelect(list, language)  {
      // Call the CGI script that will load the page for the zone selected in the drop-down list
      // passed as argument. 2nd arg gives the language to use for the generated page:
      //   english or french
     zone = list.options[list.selectedIndex].value
       // NOTE: inside javascript, ampersands (&) do NOT have to be escaped as in HTML code.
     location = cgi + 
                "?queryType=showFrameset&" + 
                "language=" + language + "&" +
                "zone=" + zone ;
    }

function zoneList (doc, language)    {
    // Build a drop down list for all zones inside
    // document 'doc'

    doc.write ('\n<select name="zone">\n');
    if (language == "french")    {
        doc.write ('<option value="2">Arctique</option>\n');
        doc.write ('<option value="5">Atlantique</option>\n');
        doc.write ('<option value="3">Baie d\'Hudson</option>\n');
        doc.write ('<option value="4" selected>St-Laurent</option>\n');
        doc.write ('<option value="1">Pacifique</option>\n');
        }
    else    {
        doc.write ('<option value="2">Arctic</option>\n');
        doc.write ('<option value="5" selected>Atlantic</option>\n');
        doc.write ('<option value="3">Hudson\'s Bay</option>\n');
        doc.write ('<option value="4">St. Lawrence</option>\n');
        doc.write ('<option value="1">Pacific</option>\n');
        }
    doc.write ('</select>\n');
    }

function zoneListButton (doc, language)    {
    // Build inside document 'doc' the list of zone names, followed
    // by a button which will let us display the page for the selected zone.
    // Language gives the language to use.


    zoneList (doc, language);
    if (language == "french")    {
        butValue = "Aller";
        }
    else    {
        butValue = "Show";
        }
        // Write HTML for the button.
        //   <input type="button" 
        //          value="foo..." 
        //          onClick="zoneSelect(this.form.elements[0],'lang');">
        // Be carefull with all those quotes and double quotes!
 
doc.write ('<input type="button" value="' + butValue +
                '" onClick="zoneSelect(this.form.elements[0],' + "'" + language + "'" + ');">');
    }

