/*** Slideshow modeFixedSize ***/
var slideShow = {
    delay: 3500,

    initSlideSwitchFixedSize: function () {
        this.slideSwitchFixedSize();
    },

    initSlideSwitchFullHeight: function () {
        this.slideSwitchFullHeight();
    },

    /*** Slideshow modeFixedSize ***/
    slideSwitchFixedSize: function () {

        var count = $('#slideshow DIV').length;

        if (count > 1) {


            var $active = $('#slideshow DIV.active');

            if ($active.length == 0) $active = $('#slideshow DIV:last');

            var $next = $active.next().length ? $active.next() : $('#slideshow DIV:first');

            $active.addClass('last-active');

            $next.css({ opacity: 0.0 }).addClass('active').animate({ opacity: 1.0 }, 1000, function () {
                
                $active.removeClass('active last-active');

                setTimeout("slideShow.slideSwitchFixedSize();", slideShow.delay);
            });

        }
        else {
            var $next = $('#slideshow DIV:first');
            if (!$next.hasClass("active")) {
                $next.css({ opacity: 0.0 }).addClass('active').animate({ opacity: 1.0 }, 1000, function () { });
            }
        }
    },

    /*** Slideshow modeFullHeight ***/
    slideSwitchFullHeight: function () {

        var count = $('#slideshowfull DIV').length;

        if (count > 1) {

            var $active = $('#slideshowfull DIV.active');

            if ($active.length == 0) $active = $('#slideshowfull DIV:last');

            var $next = $active.next().length ? $active.next() : $('#slideshowfull DIV:first');

            $active.addClass('last-active');


            var slideHeight = $next.find("IMG").height();

            if (slideHeight > 0)
                $next.parent().css({ 'min-height': slideHeight });


            $next.css({ opacity: 0.0 }).addClass('active').animate({ opacity: 1.0 }, 1000, function () {
                $active.removeClass('active last-active');
                setTimeout("slideShow.slideSwitchFullHeight();", slideShow.delay);
            });
        }
        else {
            var $next = $('#slideshowfull DIV:first');
            if (!$next.hasClass("active")) {
                $next.css({ opacity: 0.0 }).addClass('active').animate({ opacity: 1.0 }, 1000, function () { });
            }
        }
    }
}
