(function($) {
    $(function() {
        if ($.browser.msie && ($.browser.version == "6.0")) {
            transShow = 0
        } else {
            transShow = 550
        }



        var delayTime = 7000;

        $("img.sys_homeDgreyBoxImg, div.imgContent").hide();
        $("img.sys_homeDgreyBoxImg:last, div.imgContent:last").addClass('last');

        photoIndex = 0;
        function play() {
            $("ul.sys_homeGreyBoxLink li").eq(photoIndex).addClass('sys_linkSelect');
            $("img.sys_homeDgreyBoxImg").eq(photoIndex).fadeIn(transShow).animate({ left: 0 }, delayTime, function() {
                $(this).fadeOut(transShow, function() {
                    if ($(this).hasClass('last')) {
                        photoIndex = 0;
                        play();
                    } else {
                        photoIndex++
                        play();
                    }
                    $("ul.sys_homeGreyBoxLink li").removeClass('sys_linkSelect');
                    $("ul.sys_homeGreyBoxLink li").eq(photoIndex).addClass('sys_linkSelect');
                });
            });

            $("div.imgContent").eq(photoIndex).fadeIn(transShow).animate({ left: 0 }, delayTime, function() {
                $(this).fadeOut(transShow);
            });



            $("ul.sys_homeGreyBoxLink li").click(function() {
                $("ul.sys_homeGreyBoxLink li").removeClass('sys_linkSelect');
                $(this).addClass('sys_linkSelect');
                clickIndex = $(this).parent().children("li").index(this);
                $("div.imgContent").stop().fadeOut(transShow);
                $("img.sys_homeDgreyBoxImg").eq(photoIndex).stop().fadeOut(transShow, function() {
                    photoIndex = clickIndex;
                    play();
                });

                return false;
            });

        }
        play();
    });
})(jQuery);