var musicShow = false;

$(function() { //page onload functions
    headerImage();
    stretchContent();
    $("#clickNotes").click(
        function () {
            if (musicShow) {
                $("#mp3Player").animate({
                    marginLeft: "-190px"
                });
                musicShow = false;
            } else {
                $("#mp3Player").animate({
                    marginLeft: "0px"
                });
                musicShow = true;
            }
        }
    );
    $(window).scroll(
        function() {
//             moveAudioPlayer();
        }
    );
    $(".navItem").click (
        function(e) {
            $("#leftContent").load($(e.target).attr("name"));
//             stretchContent();
        }
    );
});

function headerImage() {
    var imgArray = new Array();
    imgArray[0] = "header01.jpg";
//     imgArray[1] = "header02.jpg";
    var randomNum = Math.floor(Math.random()*imgArray.length);
    $("#header").css("background", "url(images/"+imgArray[randomNum]+") no-repeat");
}

function stretchContent() {
    var totalHeight = $("#rightBar").height();
    $("#leftContent").css("min-height", (totalHeight + 20)+"px");
//     $("#rightBar").css("min-height", ($("#content").height()+361)+"px");
}

function moveAudioPlayer() {
    var moveToHere = $(window).scrollTop();
    var newTop = $("#mp3Player").css("top", (moveToHere-30)+"px");
    $("#mp3Player").animate({
        top: moveToHere+"px"
    });
}