function switchImage(filename) {
    var imageList = document.getElementById("imageList").getElementsByTagName("IMG");
    for(x = 0; x <= imageList.length-1; ++x) {
        imageList[x].className = "";
    }
    document.getElementById(filename).className = "imageSelected";
    document.getElementById("mainImage").src = "/data/img/projects/"+filename+".jpg";
}  

$(document).ready(function() {
    // Add class 'currentURL' to the active menu link
    $.each($("#menuList > li"), function() {
        var found = false;
        var qs = document.location.href.indexOf('?');
        
        if(qs >= 1) {
            var length = qs;
        } else {
            var length = document.location.href.length;
        }
        
        url = document.location.href.substring(0, length);
        for(var i = 0; i <= $("a", this).length-1; ++i) {
            if($("a", this)[i].href == url) {
                $($("a", this)[i]).addClass("currentUrl");
            }
        }
    });
    
    // Removes the last vertical bar from the footer (|) 
    $("#footermenu li:last").addClass("removebar");
});
