var schools = new Array(10);
schools[0] = new Object();
schools[0].page = "";
schools[0].name = "District";
schools[0].order = 110;
schools[0].index = 1;
schools[1] = new Object();
schools[1].page = "highschool";
schools[1].name = "Avon Lake High School";
schools[1].order = 20;
schools[1].index = 2;
schools[2] = new Object();
schools[2].page = "learwood";
schools[2].name = "Learwood Middle School";
schools[2].order = 30;
schools[2].index = 3;
schools[3] = new Object();
schools[3].page = "troy";
schools[3].name = "Troy Intermediate School";
schools[3].order = 40;
schools[3].index = 4;
schools[4] = new Object();
schools[4].page = "westview";
schools[4].name = "Westview Elementary School";
schools[4].order = 80;
schools[4].index = 5;
schools[5] = new Object();
schools[5].page = "redwood";
schools[5].name = "Redwood Elementary School";
schools[5].order = 70;
schools[5].index = 6;
schools[6] = new Object();
schools[6].page = "erieview";
schools[6].name = "Erieview Elementary School";
schools[6].order = 60;
schools[6].index = 7;
schools[7] = new Object();
schools[7].page = "eastview";
schools[7].name = "Eastview Elementary School";
schools[7].order = 50;
schools[7].index = 8;
schools[8] = new Object();
schools[8].page = "stjoes";
schools[8].name = "St. Joseph School";
schools[8].order = 90;
schools[8].index = 9;
schools[9] = new Object();
schools[9].page = "leaps";
schools[9].name = "LEAPS";
schools[9].order = 100;
schools[9].index = 10;

function forwardpage(v) { if (v == "none") return false; window.location = "/" + v; }

function showSchools(s) {
    var i;
    document.write('<select name="list" id="list" onChange="forwardpage(this.value);">');
    document.write('<option value="none">Select a School</option> ');
    // sort by order
    schools.sort(function(a,b){return a.order - b.order});
    for (var i = 0; i < schools.length; i++) {
        var selected = (schools[i].index == s && !isHome()) ? ' selected' : '';
        document.write('<option value="' + schools[i].page + '"' + selected + '>' + schools[i].name + '</option>');
    }
    document.write('</select>');
}

function isHome() {
    var home = new RegExp("^(https?)://" + window.location.host + "/(.*)$", "i");
    var REQUEST_URI = window.location.href.match(home)[2];
    return (REQUEST_URI == "");
}