(function ($) {
    $.fn.LogoSlideshow = function (logos, speed, interval) {
        var fadeSpeed = speed;
        return $(this).each(function () {
            var root = $(this);
            var logoItems = root.find(logos);

            if (!logoItems.filter('.Current').length) {
                logoItems.filter(':first').addClass('Current');
            }

            var t = setInterval(function () {
                if (logoItems.length == 1)
                    return;

                var currentItem = logoItems.filter('.Current');
                var nextItem = currentItem.next().length ? currentItem.next() : logoItems.filter(':first');
                currentItem.fadeOut(fadeSpeed);
                nextItem.fadeIn(fadeSpeed, function () {
                    currentItem.removeClass('Current');
                    nextItem.addClass('Current');
                });

            }, interval || 3000);

        });
    };

    $.fn.LanguageSwitcher = function () {

        return $(this).each(function () {
            var root = $(this);

            root.find('option').click(function (e) {
                e.preventDefault();
                e.stopPropagation();
                window.location = root.val();
            });

            root.change(function (e) {
                e.preventDefault();
                e.stopPropagation();
                window.location = root.val();
            });


        });
    };

})(jQuery);