/**
 * PEPS ROLLOVER FUNCTION
 **/

PEPS = {};
PEPS.rollover = 
{
   init: function()
   {
      this.preload();
      
      $(".ro").children("img").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').children("img").each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
      });
   },
   
   newimage: function( src )
   { 
      return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '1' + src.match(/(\.[a-z]+)$/)[0]; 
   },

   oldimage: function( src )
   { 
      return src.replace(/1\./, '.'); 
   }
};

var inputTxt = "";

$(function(){

   PEPS.rollover.init();

   
   $('#topNav').superfish({
            delay:       1000,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
            speed:       'fast',                          // faster animation speed 
            autoArrows:  true,                           // disable generation of arrow mark-up 
            dropShadows: false                            // disable drop shadows
   });
   
   $("input.inputFld").focus(function(){
      inputTxt = $(this).attr("title");
      if($(this).val() == inputTxt)
         $(this).val("");
   })
   
   $("input.inputFld").blur(function(){
      if($(this).val() == "")
      {
         $(this).val(inputTxt);
      }
   });
   
});
