jQuery(document).ready(function() {
    //misc hovers around the site
    $('.hoverTarget').hover(
      function () {
        $('span', this).show();
      }, 
      function () {
        $('span', this).hide();
      }
    );
    
    //image stream 
    $('#imageStreamImagesContainer').fadeIn(1000);
    $('#imageStreamTypeContainerOne').fadeIn(2000);
    $('#imageStreamTypeContainerTwo').fadeIn(3000);
    
    //music page album display
    //$('.musicHoverTarget').hover(
    //    function () {
    //        alreadyOn = false;
    //        //if hidden then show
    //        if($(this).find('.musicTitleDate').is(':hidden')) {
    //            $(this).find('.musicTitleDate').fadeTo('fast', 1);
    //            $(this).find('.musicImage').fadeTo('fast', 1);
    //        } else {
    //            alreadyOn = true;
    //        };
    //    }, 
    //    function () {
    //        if(alreadyOn == true) {
    //            //nothing
    //        } else {
    //            $(this).find('.musicTitleDate').hide();
    //            $(this).find('.musicImage').fadeTo('fast', 0.4);
    //    };
    //});
    
    function musicInit(){
        // Display latest album (first in code) details
        $('#albumDetailsContainer').find('.albumTracks').slice(0,1).show();
        $('#albumTitleContainer').find('.musicImage').slice(0,1).fadeTo('fast', 1);
    }
    
    function albumClick(sourceID){
        albumTarget = '';
        if(sourceID == 'albumTitleSara'){
            albumTarget = '#albumSaraDetails';
    	} else if (sourceID == 'albumTitleWGB'){
            albumTarget = '#albumWGBDetails';
        } else if (sourceID == 'albumTitleSN'){
            albumTarget = '#albumSTDetails';
        };
        
        if($(albumTarget).is(':hidden')){
            $('.albumTracks').fadeOut(200); 
            $(albumTarget).delay(200).fadeIn(200);
            $('#'+sourceID).closest('#albumTitleContainer').find('.musicImage').fadeTo(50, 0.4);
            $('#'+sourceID).closest('.musicImage').delay(100).fadeTo(100, 1);
        };
        
    };
    
    
    $('#albumTitleSara,#albumTitleWGB,#albumTitleSN').click(function(event){
        albumClick(event.target.id);
        return false;
    });
    musicInit();
   

});

