﻿var slideshow =
			{
			  intervalId: null,

			  slideSwitch: function()
			  {
			    var $active = $('div.slideShow div.active');
			    if ($active.length == 0) $active = $('div.slideShow div:last');

			    var $next = $active.next().length ? $active.next() : $('div.slideShow div:first');

//			    if ($next[0] == $('div.slideShow div.intro')[0])
//			    {
//			      clearInterval(this.intervalId);
//			      this.intervalId = setInterval("slideshow.slideSwitch()", 6000);
//			    }
//			    else
//			    {
//			      clearInterval(this.intervalId);
//			      this.intervalId = setInterval("slideshow.slideSwitch()", 2000);
//			    }

			    $active.addClass('last-active');

			    $next.css({ opacity: 0.0 })
            .addClass('active')
            .animate({ opacity: 1.0 }, 1000, function()
            {
              $active.removeClass('active last-active');
            });
			  }
			}
$(function()
{
  slideshow.intervalId = setInterval("slideshow.slideSwitch()", 2500);
});