﻿$(function() {
    $('#ListTestLeftCol li').hover(function(){
        $(this).addClass('current');
        }, function() {
        $(this).removeClass('current');
        }
    );

    $('#TestSecondaryImages input, #TestWinners input').each(function() {
    $('#TestSecondaryImages #SecondaryImageWrapper:first-child, #TestSecondaryImages #SecondaryImageWrapper:first-child input').addClass('current');
    $('#TestWinners #TestWinnerImage:first-child, #TestWinners #TestWinnerImage:first-child input').addClass('current');

        $(this).click(function() {
            $('#TestSecondaryImages input, #TestWinnerImage input').each(function() {
            $('#SecondaryImageWrapper').removeClass('current').css({ 'border-bottom': '' });
                $(this).stop().animate({ opacity: 0.6 }, 300);
            });
            $(this).parent().addClass('current').css({ 'border-bottom': '3px solid #FFFFFF' });
            $(this).stop().animate({ opacity: 1.0 }, 300);

            if ($(this).parent().hasClass('current'))
                $(this).hover(
                    function() {
                        $(this).stop().animate({ opacity: 1.0 }, 300);
                    }, function() {
                        $(this).stop().animate({ opacity: 1.0 }, 300);
                    }
                );
            else
                $(this).hover(
                    function() {
                        $(this).stop().animate({ opacity: 1.0 }, 300);
                    }, function() {
                        $(this).stop().animate({ opacity: 0.6 }, 300);
                    }
                );
        });

        if ($(this).hasClass('current'))
            $(this).hover(
                function() {
                    $(this).stop().animate({ opacity: 1.0 }, 300);
                }, function() {
                    $(this).stop().animate({ opacity: 1.0 }, 300);
                }
            );
        else
            $(this).hover(
                function() {
                    $(this).stop().animate({ opacity: 1.0 }, 300);
                }, function() {
                    $(this).stop().animate({ opacity: 0.6 }, 300);
                }
            );
    });
});
