$(document).ready(function(){

// enable content within hidden divs - by default they are commented out

reg_exp = /^<!--(.*)-->$/;

$('#divMenu div').each( 

   function(i)
   {
   html = $(this).html();

      if (match_array = reg_exp.exec(html))
      {

         if (match_array.length) $(this).html(match_array[1]);

      }

   }

);





// preload menu images

preload_array = new Array();

$('#divMenu img').each( 

   function(i)
   {
   preload_array[i] = new Image(); 
   preload_array[i].src = $(this).attr('src');  
   }

);





// permanantly display rollover image for current page

$('#divMenu ul li#selected').each(

   function(i)
   {
   class_name = $(this).attr('class');
   $('#divMenu div.' + class_name).removeClass('hide').addClass('top').addClass('show').addClass('selected');
   }

);





// show hidden menu rollovers

$('#divMenu ul li').not('#selected').bind('mouseover', 

   function(i)
   {
   class_name = $(this).attr('class'); // list items and hidden divs have same class names so can be correlated
   $('#divMenu div.' + class_name).removeClass('hide').addClass('show'); // target related hidden div and show it on mouseover
   $('#divMenu div.' + class_name).siblings().not('.selected').removeClass('show').addClass('hide'); // also hide any divs which might still be showing
   }

);





// hide menu rollovers

$('#divMenu div').not('.selected').bind('mouseout', 

   function(i)
   {
   $(this).removeClass('show').addClass('hide'); // hide this div on mouseout
   }

);





// enable contact rollover

$('#divContact a').hover(

   function()
   {
   $(this).children().attr({src:'images/header_contact_on.gif'});
   }, 

   function()
   {
   $(this).children().attr({src:'images/header_contact_off.gif'});
   }

);

});