$(document).ready( function()
{
   PEPS.rollover.init();
   
	$("#headerLinks img").fadeTo("slow", 0.7); // This sets the opacity of the thumbs to fade down to 30% when the page loads
	$("#headerLinks img").hover(function(){
			$(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover
				},function(){
			$(this).fadeTo("slow", 0.7); // This should set the opacity back to 30% on mouseout
	});

});

PEPS = {};

PEPS.rollover =
{
   init: function()
   {
      this.preload();
     
      $(".ro").hover(
         function () { $(this).attr( 'src', PEPS.rollover.newimage($(this).attr('src')) ); },
         function () { $(this).attr( 'src', PEPS.rollover.oldimage($(this).attr('src')) ); }
      );
   },

   preload: function()
   {
      $(window).bind('load', function() {
         $('.ro').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
      });
   },
   
   newimage: function( src )
   {
      return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_o' + src.match(/(\.[a-z]+)$/)[0];
   },

   oldimage: function( src )
   {
      return src.replace(/_o\./, '.');
   }
};