$(document).ready(function () {
    $("#myHomePage").click(function () {
        location = "index.htm";
    });
    $("#myPhotosPage").click(function () {
        location = "photos.htm";
    });
    $("#mySchedulePage").click(function () {
        location = "schedule.htm";
    });
    $("#mySponsorsPage").click(function () {
        location = "sponsors.htm";
    });
    $("#myLinksPage").click(function () {
        location = "links.htm";
    });
    $("#aboutUsPage").click(function () {
        location = "aboutus.htm";
    });
    $("#myMembershipPage").click(function () {
        location = "membership.htm";
    });
    getCopyRightYear();
});
function getCopyRightYear() {
    var beginningYear = 2010;
    var year = new Date().getFullYear();
    if (beginningYear < year)
        $("#copyrightYear").text(beginningYear.toString() + " - " + year.toString());
    else
        $("#copyrightYear").text(year.toString());
}

function loadYearlyThemes()
{
    if (window.XMLHttpRequest)
    {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {
        // code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    try {
        xmlhttp.open("GET","includes/yearThemes.xml",false);
        xmlhttp.send();
        xmlDoc=xmlhttp.responseXML;

        var tbl = document.getElementById("yearlyThemes");

        for (var i=0; i < xmlDoc.getElementsByTagName("year").length; i++)
        {
            var row = tbl.insertRow(tbl.rows.length);

            var cellOne = row.insertCell(0);
            var textNode = document.createTextNode(xmlDoc.getElementsByTagName("year")[i].childNodes[0].nodeValue);
            cellOne.appendChild(textNode);

            var cellTwo = row.insertCell(1);
            textNode = document.createTextNode(xmlDoc.getElementsByTagName("theme")[i].childNodes[0].nodeValue);
            cellTwo.appendChild(textNode);

            var cellThree = row.insertCell(2);
            textNode = document.createTextNode(xmlDoc.getElementsByTagName("announcer")[i].childNodes[0].nodeValue);
            cellThree.appendChild(textNode);
        }
    }
    catch (e) {
        var tbl = document.getElementById("yearlyThemes");
        var row = tbl.insertRow(tbl.rows.length);
        $(row).addClass("themeErrorMessage");
        var cellOne = row.insertCell(0);
        $(cellOne).attr("colspan", "3");
        var textNode = document.createTextNode("Unable to load themes.");
        cellOne.appendChild(textNode);
    }
}
