  
  $(document).ready
  ( function()
    { 
      
      var homeSlideshowTimer;
      var homeSlideshowItem = 0;
      var homeSlideshowRunning = false;
      
      function homeSlideshowLoop()
      { $('#homeSlideshow').find('li').removeClass('active');
        $('#homeSlideshow').find('li').eq(homeSlideshowItem).addClass('active');
        $('#homeSlideshow').find('div.overlay > div.txt').html( $('#homeSlideshow').find('li.active').find('div.txtcontent').html() );
        $('#homeSlideshow').find('.imager').html( $('#homeSlideshow').find('li.active').find('div.imgcontent').html() );
        
        homeSlideshowItem++;
        
        if( homeSlideshowItem >= $('#homeSlideshow').find('li').size() )
        { homeSlideshowItem = 0;
        }
        
        $('#homeSlideshow').find('a.playpause').removeClass('play');
        homeSlideshowRunning = true;
        
      }
      
      if( $('#homeSlideshow').size() > 0 )
      { 
        function playHomeSlideshow()
        { homeSlideshowTimer = window.setInterval(homeSlideshowLoop, 5000);
        }
        
        $('#homeSlideshow').find('li > a').click
        ( function()
          { homeSlideshowItem = $(this).parent().index();
            window.clearInterval(homeSlideshowTimer);
            homeSlideshowLoop();
            homeSlideshowRunning = false;
            $('#homeSlideshow').find('a.playpause').addClass('play');
            
            //if( $(this).attr('href') == '' )
            { return false;
            }
          }
        );
        
        $('#homeSlideshow').find('a.playpause').click
        ( function()
          { 
            if( $(this).hasClass('play') )
            { playHomeSlideshow();
              $(this).removeClass('play');
            }
            else
            { window.clearInterval(homeSlideshowTimer);
              homeSlideshowRunning = false;
              $(this).addClass('play');
            }
          }
        );
        
        homeSlideshowLoop();
        playHomeSlideshow();
        
      }
      
    }
  );
