var $$ = $.fn;
var t;
$$.extend({
	
  SplitID : function()
  {
    return this.attr('id').split('-').pop();
  },

  Slideshow : {
    Ready : function()
    { 
      
      this.Counter = 1;
      this.Interrupted = false;

      this.Transition();
    },

    Transition : function()
    {
      if (this.Interrupted) {
        return;
      }

      this.Last = this.Counter - 1;

      if (this.Last < 1) {
        this.Last = slidesNum;
      }
	  $('div#tmpSlide-' + $$.Slideshow.Counter).fadeIn('slow');
      $('div#tmpSlide-' + this.Last).fadeOut(
        'slow',
        function() {
          $('div#tmpSlideshowControl-' + $$.Slideshow.Last).removeClass('tmpSlideshowControlActive');
          $('div#tmpSlideshowControl-' + $$.Slideshow.Counter).addClass('tmpSlideshowControlActive');
          //$('div#tmpSlide-' + $$.Slideshow.Counter).fadeIn('slow');
		  //$('div#tmpSlide-' + $$.Slideshow.Counter).fadeIn('fast');

          $$.Slideshow.Counter++;

          if ($$.Slideshow.Counter > slidesNum) {
            $$.Slideshow.Counter = 1;
          }
         t = setTimeout('$$.Slideshow.Transition();', 3000);
        }
      );
	  
    }
  }
});

$(document).ready(
  function() {
    $$.Slideshow.Ready();
  }
);
