$(document).ready(function() {

  // Preload navigation rollover graphics.

  $.preLoadImages(
    '/img/front-end/navigation/home-rollover.png',
    '/img/front-end/navigation/about-us-rollover.png',
    '/img/front-end/navigation/contact-us-rollover.png',
    '/img/front-end/navigation/policies-rollover.png',
    '/img/front-end/navigation/vacancies-rollover.png',
    '/img/front-end/navigation/news-rollover.png',
    '/img/front-end/navigation/projects-rollover.png',
    '/img/front-end/navigation/our-people-rollover.png',
    '/img/front-end/navigation/get-quote-rollover.png',
    '/img/front-end/navigation/customer-login-rollover.png'
  );

  // Handle navigation rollovers.

  $('div#navigation ul.links li a, div#navigation p.customer-login a').hover(
    function() {
      $(this).addClass('rollover');
    },
    function() {
      $(this).removeClass('rollover');
    }
  );

  // Preload menu rollover graphics.

  $.preLoadImages(
    '/img/front-end/menu-item-selected-background.png'
  );

  // Handle menu rollovers.

  $('div#menu ul li a').hover(
    function() {
      $(this).addClass('rollover');
    },
    function() {
      $(this).removeClass('rollover');
    }
  );

  // Ensure the content div stretches to the height of its container. This will
  // usually only happen if a menu is on the page and it's taller than the
  // content.

  if ($('div#content').height() < $('div#content').parent().height()) {
    $('div#content').height($('div#content').parent().height());
  }

});
