function addNavigation() {
    document.getElementById("head").innerHTML = '<h1><a class="title" href="index.xhtml">Getting Down with JavaScript</a></h1><table id="navigation" class="c2" width ="100%" style="margin:auto" cellpadding="0" cellspacing="0"><tr><td class="c2" id="s1"><a href="lesson1.xhtml"><span>Lesson 1</span></a></td><td class="c2" id="s2"><a href="lesson2.xhtml"><span>Lesson 2</span></a></td><td class="c2" id="s3"><a href="lesson3.xhtml"><span>Lesson 3</span></a></td><td class="c2" id="s4"><a href="lesson4.xhtml"><span>Lesson 4</span></a></td><td class="c2" id="s5"><a href="lesson5.xhtml"><span>Lesson 5</span></a></td><td class="c2" id="s6"><a href="lesson6.xhtml"><span>Lesson 6</span></a></td><td class="c2" id="s7"><a href="lesson7.xhtml"><span>Lesson 7</span></a></td></tr><tr><td colspan="7"><div class="c3">by Daniel Folsom, Julia Fairweather and Jeff Elkner</div></td></tr></table>';
    }

function alphy() {
    anything =  prompt("letter?");
    dictlet = new Array();
    var alphabet = "abcdefghijklmnopqrstuvwxyz";
    for (y = 0; y <= 12; y++) {
        dictlet[alphabet.charAt(y)] = "1st half";
    }
    for (y = 13; y <= 25; y++) {
        dictlet[alphabet.charAt(y)] = "2nd half";
    }
    alert(dictlet[anything]);
}

function opt4() {
    blah =  new Array();
    blah[1] = document.optionform.na.value;
    blah[2] = document.optionform.age.value;
    document.optionform.final1.value = blah[1]+" is "+blah[2]+" years old";
    blah[3] = eval(blah[2]*365);
    document.optionform.final2.value = blah[1] +
                                       " is older than " +
                                       blah[3] + " days and younger than " +
                                       eval(blah[3] + 365) +
                                       " days old";
    blah[4] = eval(blah[2] * 12);
    document.optionform.final3.value = blah[1] + " is about " + blah[4] +
                                       " months old";
}

function opt1() {
    all = "";
    if (document.getElementById('optionform').chk1.checked == 1) {
        all += "toolbar = 1,";
    }
    if (document.getElementById('optionform').chk2.checked == 1) {
        all += "status = 1,";
    }
    if (document.getElementById('optionform').chk3.checked == 1) {
        all += "menubars = 1,";
    }
    if (document.getElementById('optionform').chk4.checked ==  1) {
        all += "scrollbars = 1,";
    }
    if (document.getElementById('optionform').chk5.checked ==  1) {
        all += "resizable = 1,";
    }
    if (document.getElementById('optionform').chk6.checked == 1) {
        all += "location = 1,";
    }
    if (document.getElementById('optionform').chk7.checked == 1) {
        all += "directories = 1,";
    }
    if (document.getElementById('optionform').chk8.value !== "") {
        all += "height = "+document.getElementById('optionform').chk8.value+",";
    }
    if (document.getElementById('optionform').chk9.value !== "") {
        all += "width = "+document.getElementById('optionform').chk9.value+",";
    }
    document.getElementById('optionform').options1.value = all;
}

function opt(stuff) {
    awindow = window.open("", "aw", stuff);
    awindow.document.write("<html><body onBlur = 'window.close()'><p>Remember to close this window<\/p><\/body><\/html>");
    awindow.document.close();
}

function MsgBox(textstring) {
    alert (textstring);
}

function define(what) {
    if (what == 'method') {
        content = "<html xmlns = 'http://www.w3.org/1999/xhtml' xml:lang = 'en'><head><style type = 'text/css'>body{background:#FFCCFF;}<\/style><\/head><body><table width = '100%' cellpadding = '5'><tr><td valign = 'middle'><div style = ' border:4px dotted #FFFFCC'><dl><dt><span style = 'font-size:15px'>Method<\/span><\/dt><dd><small>Something that an object can do. You can open a new document with &quot;document.open()&quot;. You can write &quot;hello world&quot; in a document with &quot;<tt>document.write(&quot;Hello World&quot;)<\/tt><\/small><\/dd><\/dl><\/div><\/td><\/tr><\/table><\/body><\/html>";
    }
    if (what == 'input') {
        content = "<html xmlns = 'http://www.w3.org/1999/xhtml' xml:lang = 'en'><head><style type = 'text/css'>body {background:#FFCCFF;}<\/style><\/head><body><table width = '100%' cellpadding = '5'><tr><td valign = 'middle'><div style = 'border:4px dotted #FFFFCC'><dl><dt><span style = 'font-size:15px'>Input<\/span><\/dt><dd><small>Input is the most common form element - defined by &lt;input&gt; - the different types are text field (type = 'text'), radio buttons (type = 'radio'), checkboxes (type = 'checkbox'), and it can also have a submit button (type = 'submit').<\/small><\/dd><\/dl><\/div><\/td><\/tr><\/table><\/body><\/html>";
    }
    if (what == 'object') {
        content = "<html xmlns = 'http://www.w3.org/1999/xhtml' xml:lang = 'en'><head><style type = 'text/css'>body {background:#FFCCFF;}<\/style><\/head><body><table width = '100%' cellpadding = '5'><tr><td valign = 'middle'><div style = 'border:4px dotted #FFFFCC'><dl><dt><span style = 'font-size:15px'>Object<\/span><\/dt><dd><small>Essentially anything on the webpage - including the webpage document itself, a table within the webpage, a button on a webpage or anything. Each object has certain properties such as color or background. For example, the page's background color is defined by 'document.bgcolor'; in order to change that, you would type something like <tt>document.bgcolor = 'red'<\/tt>. Each object can be accessed through a hierarchy. If you have text box named 'apple', within a form, 'banana', then its contents would be 'document.banana.apple.value', because the document is at the top of the hierarchy, then the form, then the text box, and then the text box has a property, 'value'.<\/small><\/dd><\/dl><\/div><\/td><\/tr><\/table><\/body><\/html>";
    }
    NewWindow = window.open("blah","mywindow",
                            "height = 260, width = 550, left = 0,top = 0");
    NewWindow.document.write(content);
    NewWindow.document.close();
}

function testing(head, body) {
    content = "<html xmlns = 'http://www.w3.org/1999/xhtml' xml:lang = 'en'><head>" + head + "<\/head><body>" + body + "<\/body><\/html>";
    Windownumber1 = window.open("a", "mywindow", "height = 295, width = 400");
    Windownumber1.document.write(content);
    Windownumber1.document.close();
}

function hiya() {
    document.bgcolor = red;
}

function testwithprompt() {
    a = prompt("Say something");
    document.form1.input1.value = a;
}

function imrunningoutoffunctionnames() {
    a = prompt("Pick a number 1-4");
    if (a == "1") {
        document.form2.input2.value = "You picked one!";
    }
    else if (a == "2") {
        document.form2.input2.value = "You picked two!";
    }
    else if (a == "3") {
        document.form2.input2.value = "You picked three!";
    }
    else if (a == "4") {
        document.form2.input2.value = "You picked four!";
    }
    else {
        document.form2.input2.value = "Not Valid";
    }
}

function obnoxious() {
    for (count = 1; count  <= 5; count++) {
        alert("HI");
    }
}

function paralesson6() {
    la = confirm("If you click OK, a new window will come up");
    if (la) { 
        Windownumber1 = window.open("", "mywindow",
                                    "height = 300, width = 400");
        Windownumber1.document.close();
    }
    else {
        alert("You clicked cancel");
    }
}

function lab() {
    mywindow = window.open('resources/test.xhtml', "lab",
                           "width = 620, height = 480, resizable = 1");
}

