/*
 * Global treatment for pages.
 */
$(document).ready(function()
{
  var filename = document.location.href.substr(document.location.href.lastIndexOf('/') + 1);

  //this code assumes that the file extension is 4 chars (.php)
  $(".navButton").hover(
    function()
    {//mouse in
      if(filename.substr(0, filename.length - 4) != $(this).attr('id'))
        $(this).addClass("navButtonSelected");
    },
    function()
    {//mouse out
      if(filename.substr(0, filename.length - 4) != $(this).attr('id'))
        $(this).removeClass("navButtonSelected");
    }
  );

  //dress the "this page" header link
  var navItem;
  switch(filename)
  {
    case 'solutions.php':
      navItem = $("img#solutions.navButton");
      break;

    case 'work.php':
      navItem = $("img#work.navButton");
      break;

    case 'company.php':
      navItem = $("img#company.navButton");
      break;

    case 'contact.php':
      navItem = $("img#contact.navButton");
      break;
  }

  $(navItem).addClass("navButtonSelected");
});
