MDF = {};

MDF.rollover =
{
   init: function()
   {
      this.preload();

      $(".ro").hover(
         function () { 
	     if ($(this).attr( 'hover')!='true') {
                 $(this).attr( 'src', MDF.rollover.newimage($(this).attr('src')) ); 
                 $(this).attr( 'hover', 'true'); 
             }
         },
         function () { 
             $(this).attr( 'src', MDF.rollover.oldimage($(this).attr('src')) ); 
             $(this).attr( 'hover', 'false'); 
         }
      );
   },

   preload: function()
   {
      $(window).bind('load', function() {
         $('.ro').each( function( key, elm ) { $('<img>').attr( 'src', MDF.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\./, '.');
   }
};

