var $$ = $.fn;


$$.extend({
  SplitID : function()
  {
    return this.attr('id').split('-').pop();
  },

  Slideshow : {
    Ready : function()
    {
	  slider_lengthvar = jQuery('.tmpSlideshowControl').length;
	  
      jQuery('div.tmpSlideshowControl')
        .hover(
          function() {
            $(this).addClass('tmpSlideshowControlOn');
          },
          function() {
            $(this).removeClass('tmpSlideshowControlOn');
          }
        )
        .click(
          function() {
            $$.Slideshow.Interrupted = true;

            $('div.tmpSlide').hide();
            $('div.tmpSlideshowControl').removeClass('tmpSlideshowControlActive');
            $('div#tmpSlide-' + $(this).SplitID()).fadeIn(1000)
            $(this).addClass('tmpSlideshowControlActive');
           if($(this).SplitID()==1){
        	   //$('body').fadeOut(2000).css({'background':'#070b0c'});
        	   $('body').css({'background':'#c0d4f0'});
        	  
        	  
           }
           else if($(this).SplitID()==2){
        	  // $('body').fadeOut(2000).css({'background':'#c0d4f0'});   
        	   $('body').css({'background':'#070b0c'});   
        	   
           }
           else if($(this).SplitID()==3){
        	   $('body').css({'background':'#FFFFFF'});  
        	   
           }
          }
        );

      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 = slider_lengthvar;
      }

      jQuery('div#tmpSlide-' + this.Last).fadeOut(
        "slow",
        function() {
          jQuery('div#tmpSlideshowControl-' + $$.Slideshow.Last).removeClass('tmpSlideshowControlActive');
          jQuery('div#tmpSlideshowControl-' + $$.Slideshow.Counter).addClass('tmpSlideshowControlActive');
          jQuery('div#tmpSlide-' + $$.Slideshow.Counter).fadeIn("slow");
          //code by suresh	
         
          if( $$.Slideshow.Counter==1){
        	  //$('body').fadeOut(2000).css({'background':'#070b0c'});
       	   jQuery('body').css({'background':'#c0d4f0'});
          		
          			//$('#footer').css({'background':'#cccccc'});
          	}
          else if( $$.Slideshow.Counter==2){
        	  //$('body').fadeOut(2000).css({'background':'#c0d4f0'});   
       	   jQuery('body').css({'background':'#070b0c'});  
        	}
          else if( $$.Slideshow.Counter==3){
        	  //$('body').fadeOut(2000).css({'background':'#c0d4f0'});   
       	   jQuery('body').css({'background':'#FFFFFF'});  
        	}
        	
          $$.Slideshow.Counter++;

          if ($$.Slideshow.Counter > slider_lengthvar) {
            $$.Slideshow.Counter = 1;
          }

          setTimeout('$$.Slideshow.Transition();', 8000);
        }
      );
    }
  }
});

jQuery(document).ready(
  function() {
    $$.Slideshow.Ready();
    
  }
);

