var $$ = $.fn;

$$.extend({
  SplitID1 : function()
  {
    return this.attr('id').split('-').pop();
  },

  Slideshow1 : {
    Ready : function()
    {
      $('div.tmpSlide1show1Control')
        .hover(
          function() {
            $(this).addClass('tmpSlide1show1ControlOn');
          },
          function() {
            $(this).removeClass('tmpSlide1show1ControlOn');
          }
        )
        .click(
          function() {
            $$.Slideshow1.Interrupted = true;

            $('div.tmpSlide1').hide();
            $('div.tmpSlide1show1Control').removeClass('tmpSlide1show1ControlActive');

            $('div#tmpSlide1-' + $(this).SplitID1()).show()
            $(this).addClass('tmpSlide1show1ControlActive');
          }
        );

      this.Counter1 = 1;
      this.Interrupted = false;

      this.Transition1();
    },

    Transition1 : function()
    {
      if (this.Interrupted) {
        return;
      }

      this.Last = this.Counter1 - 1;

      if (this.Last < 1) {
        this.Last = 3;
      }

      $('div#tmpSlide1-' + this.Last).fadeOut(
        'slow',
        function() {
          $('div#tmpSlide1show1Control-' + $$.Slideshow1.Last).removeClass('tmpSlide1show1ControlActive');
          $('div#tmpSlide1show1Control-' + $$.Slideshow1.Counter1).addClass('tmpSlide1show1ControlActive');
          $('div#tmpSlide1-' + $$.Slideshow1.Counter1).fadeIn('slow');

          $$.Slideshow1.Counter1++;

          if ($$.Slideshow1.Counter1 > 3) {
            $$.Slideshow1.Counter1 = 1;
          }

          setTimeout('$$.Slideshow1.Transition1();', 3000);
        }
      );
    }
  }
});

$(document).ready(
  function() {
    $$.Slideshow1.Ready();
  }
);