  
   if( typeof FUEL == "undefined"  ) var FUEL = {};   

   $(document).ready( function()
   {
      new FUEL.buttons();
      $(".addfriendbtn").click( function(){ FUEL.stf.add( this ); } );
   });
   
   function loadVideo( guid, title ) 
   {
      $('#videoreplace').html('<embed src="http://images.video.msn.com/flash/soapbox1_1.swf" quality="high" width="432" height="364" base="http://images.video.msn.com" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" pluginspage="http://macromedia.com/go/getflashplayer" flashvars="c=v&v='+guid+'&ifs=true&fr=msnvideo&mkt=en-US&brand="></embed><br /><a href="http://video.msn.com/video.aspx?vid='+guid+'" target="_new" title="'+title+'">Video: Server '+title+'</a>');
   }
   
   FUEL.stf = {
      
      add: function( that )
      {
         $('.friends:last').clone().insertAfter('.friends:last');
         var length = $('.friends').length;
         
         $('.friends:last input, .friends:last label').each( function()
         { 
            var id;
            
            if( $(this).attr('id') != '' )
            {
               id = $(this).attr('id');
               id = id.replace( /([0-9]+)/, length );
               $(this).attr('id', id);
               $(this).val('');
            }
            else
            {
               id = $(this).attr('for');
               id = id.replace( /([0-9]+)/, length );
               $(this).attr('for', id);
            }
            
         });
         
         if( length >= 10 )
         {
            $(that).remove();
         }
      }
      
   };
   
   FUEL.buttons = function( active, filter )
   {
      var that = this;
      active = active||false;
      filter = filter||"img, input:image";
      
      $(filter).each(function(i, val)
      {
         if( $(val).attr('src').match(/_u/) != null )
         {
            $('<img>').attr( 'src', that.over( $(val).attr('src') ) );
            
            $(val).hover (
               function() { $(this).attr( 'src', that.over($(this).attr('src')) ); },
               function() { $(this).attr( 'src', that.reset($(this).attr('src')) ); }
            );
            
            if( active )
            {
               $('<img>').attr( 'src', that.active( $(val).attr('src') ) );
               
               $(val).mousedown (
                  function() { $(this).attr( 'src', that.active($(this).attr('src')) ); }
               ).mouseup (
                  function() { $(this).attr( 'src', that.over($(this).attr('src')) ); }
               );
            }
         }
      });
   };
   
   FUEL.buttons.prototype =
   {
      over:   function( src ) { return src.replace(/(_a\.|_u\.)/, '_o.'); },
      active: function( src ) { return src.replace(/(_o\.|_u\.)/, '_a.'); },
      reset:  function( src ) { return src.replace(/(_o\.|_a\.)/, '_u.'); }
   };
   