function adjustDimensions() {
  var viewportWidth = $(window).width()-140;
  $("#main").css({'width' : viewportWidth});
	$('#main').jScrollHorizontalPane({scrollbarHeight:10, scrollbarMargin:0});
}

/*
function displayTooltips() {
  $('#homeNavigationContainerLeft a, #smallNavigation a').tooltip({track: true, showURL: false});
}
*/

function displaySectionTitles() {
  $(".homeNavigation").mouseenter(function(event) {
    var navigationText = $(this).children().text();
    $("#homeNavigationLabel").fadeIn(function() {
      $(this).html(navigationText);
    });
  });
  $(".homeNavigation").mouseleave(function(event) {
    $("#homeNavigationLabel").fadeOut(function() {
      $(this).html('');
    });
  });
  
  $(".smallNavigation").mouseenter(function(event) {
    var navigationText = $(this).children().text();
    if ($("#footerNavigation").length != 0) {
      $("#footerNavigation").fadeOut(function() {
        $("#footerLabel").fadeIn(function() {
          $(this).html(navigationText);
        });
      });
    } else {
      $("#footerLabel").fadeOut(function() {
        $(this).html(navigationText);
        $("#footerLabel").fadeIn();
      });
    }
  });
  $("#sidebar").mouseleave(function(event) {
    if ($("#footerNavigation").length != 0) {
      $("#footerLabel").fadeOut(function() {
        $("#footerNavigation").fadeIn();
      });
    }
  });
}

$(document).ready(function() {
  adjustDimensions();
  displaySectionTitles();
});

$(window).resize(function() { 
  adjustDimensions();
});
