
/*** Slideshow modeFixedSize ***/

var slideShow =
{
    delay: 3500,
    firstdelay: 7000,
    SlideShowDivId: '#slideshow',

    initSlideSwitchFixedSize: function (SlideShowDivIdArg, FirstDelay, Delay) {
        this.slideSwitchFixedSize(SlideShowDivIdArg, true, FirstDelay, Delay);
    },

    initSlideSwitchFullHeight: function (SlideShowDivIdArg, FirstDelay, Delay) {
        this.slideSwitchFullHeight(SlideShowDivIdArg, true, FirstDelay, Delay);
    },

    /*** Slideshow modeFixedSize ***/
    slideSwitchFixedSize: function (SlideShowDivIdArg, isFirstDelay, FirstDelayArg, DelayArg) {

        var count = $(SlideShowDivIdArg + ' DIV').length;

        if (count > 1) {


            var $active = $(SlideShowDivIdArg + ' DIV.active');

            if ($active.length == 0) $active = $(SlideShowDivIdArg + ' DIV:last');

            var $next = $active.next().length ? $active.next() : $(SlideShowDivIdArg + ' DIV:first');

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

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

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

                if (isFirstDelay == true) {
                    setTimeout("slideShow.slideSwitchFixedSize('" + SlideShowDivIdArg + "',false," + FirstDelayArg + "," + DelayArg + ");", FirstDelayArg);

                }
                else {
                    setTimeout("slideShow.slideSwitchFixedSize('" + SlideShowDivIdArg + "',false," + FirstDelayArg + "," + DelayArg + ");", DelayArg);
                }
            });

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

    /*** Slideshow modeFullHeight ***/
    slideSwitchFullHeight: function (SlideShowDivIdArg, isFirstDelay, FirstDelayArg, DelayArg) {

	
	
        var count = $(SlideShowDivIdArg + ' DIV').length;

        if (count > 1) {

            var $active = $(SlideShowDivIdArg + ' DIV.active');

            if ($active.length == 0) $active = $(SlideShowDivIdArg + ' DIV:last');

            var $next = $active.next().length ? $active.next() : $(SlideShowDivIdArg + ' DIV:first');

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




		

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

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

                if (isFirstDelay == true) {
                    setTimeout("slideShow.slideSwitchFullHeight('" + SlideShowDivIdArg + "',false," + FirstDelayArg + "," + DelayArg + ");", FirstDelayArg);
                }
                else {
                    setTimeout("slideShow.slideSwitchFullHeight('" + SlideShowDivIdArg + "',false," + FirstDelayArg + "," + DelayArg + ");", DelayArg);

                }

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

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

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

        }

    }
}
