// initialise plugins
$(document).ready( function()
{
	PEPS.rollover.init();	               
});

PEPS = {};

PEPS.rollover =
{
   init: function()
   {
      this.preload();

      var browser;

      $.browser.msie6 = $.browser.msie && /MSIE 6\.0/i.test(window.navigator.userAgent) && !/MSIE 7\.0/i.test(window.navigator.userAgent);

      if(!($.browser.msie6)) {
        $(".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]+)/) ) + '-over' + src.match(/(\.[a-z]+)/)[0]; },
   oldimage: function( src ){ return src.replace(/-over/, ''); }
};

$(function() {
    swapValues = [];
    $(".swap_value").each(function(i){
        swapValues[i] = $(this).val();
        $(this).focus(function(){
            if ($(this).val() == swapValues[i]) {
                $(this).val("");
            }
        }).blur(function(){
            if ($.trim($(this).val()) == "") {
                $(this).val(swapValues[i]);
            }
        });
    });
});
