$(function () {
    // Clean up login form 
    $(".uam_login_form br").css("display", "none");

    $("#LinkList ul").hide();

    $("#LinkList h3, #LinkList li > h4").click(function () {
        $(this).toggleClass("active");
        $(this).next().toggle();
    });


    $(".intro .gallery .gallery-icon").each(function () {
        $("a img").unwrap();
    });
   $(".intro .gallery br").remove();

//    $(".intro .gallery .gallery-item:first-child").addClass("active");


//    setInterval("slideSwitch()", 5000);

    // bind change event to select
    
    $('#WorkStationList select').bind('change', function () {
        var url = $(this).val(); // get selected value
        if (url) { // require a URL
            window.location = url; // redirect
        }
        return false;
    });

});

function slideSwitch() {
    var $active = $('.intro .gallery .gallery-item.active');
    var $next = $active.next();

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

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

        var $active = $('.intro .gallery .gallery-item.active');

    if ($active.length == 0) $active = $('.intro .gallery .gallery-item:last');

    var $next = $active.next().length ? $active.next()
    : $('.intro .gallery .gallery-item:first');

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

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