jQuery(document).ready(function() {
    $('#home_link').click(function() {
        $('#ewd_content_a').animate({ "top": "-650px", "left": "-800px" }, 1000);
    });
    $('#high_link').click(function() {
        $('#ewd_content_a').animate({ "top": "0px", "left": "-800px" }, 1000);
    });
    $('#spring_link').click(function() {
        $('#ewd_content_a').animate({ "top": "-650px", "left": "0px" }, 1000);
    });
    $('#winter_link').click(function() {
        $('#ewd_content_a').animate({ "top": "-650px", "left": "-1600px" }, 1000);
    });
    $('#junior_link').click(function() {
        $('#ewd_content_a').animate({ "top": "-1300px", "left": "-800px" }, 1000);
    });
    $("#ewd_navbar_wrapper").mouseenter(function() {
        $('#navbar_home_hover').show('slow');
    });
    $("#ewd_navbar_wrapper").mouseleave(function() {
        $('#navbar_home_hover').hide('slow');
    });
});

function set_page() {
    h_content = document.getElementById("ewd_content_a");

    var page = getUrlVars();

    var final_top = 0;
    var final_left = 0;
    var width = 800;
    var height = 650;
    switch (page) {
        case "westlake":
			final_top = -height * 0;
            final_left = -width * 1;
        case "spring":
            final_top = -height * 1;
            final_left = -width * 0;
            break;
        case "winter":
            final_top = -height * 1;
            final_left = -width * 2;
            break;
        case "junior":
            final_top = -height * 2;
            final_left = -width * 1;
            break;
        default:
            final_top = -height * 1;
            final_left = -width * 1;
            break;
    }

    h_content.setAttribute("top", final_top);
    h_content.setAttribute("left", final_left);
}

// Read a page's GET URL variables and return them as an associative array.
function getUrlVars() {
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

    for (var i = 0; i < hashes.length; i++) {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }

    return vars;
}