$.fn.extend({
    TrunAd2: function (options) {
        var auto = null;
        var obj = $(this);
        count = $("a", obj).size();
        n = 0;
        var settings = { timer: 5000, menu: "#play_text" };
        options = options || {};
        $.extend(settings, options);
        var ulcontent = "<ul>";
        for (i = 1; i <= count; i++) { ulcontent = ulcontent + "<li><span class='n' style='display:none;'>" + i + "</span>" + $("#play_text_" + i).html() + "</li>"; $("#play_text_" + i).remove(); }
        ulcontent = ulcontent + "</ul>";
        $(settings.menu).html(ulcontent);
        $("a:not(:first-child)", this).hide();
        $(settings.menu + " li").eq(0).css({ "background": "#CCC", "margin-bottom": "50px", "color": "#000", "font-weight": "bold" });
        $(settings.menu + " li").mouseover(function () {
            i = $(".n", $(this)).text() - 1;
            n = i;
            if (n >= count) return;
            clearInterval(auto);
            $("a", obj).filter(":visible").fadeOut(1, function () { $(this).parent().children().eq(n).fadeIn(3); });
            $(this).css({ "background": "#CCC","color": "#000", "font-weight": "bold" }).siblings().css({ "background": "#fff", "color": "#7f0019", "font-weight": "normal" });
        }).mouseout(function(){auto = setInterval(showAuto, settings.timer); });
        auto = setInterval(showAuto, settings.timer);
        obj.hover(function () { clearInterval(auto); }, function () { auto = setInterval(showAuto, settings.timer); });
        function showAuto() {
            n = n >= (count - 1) ? 0 : ++n;
            $("a", obj).filter(":visible").fadeOut(1, function () { obj.children().eq(n).fadeIn(3); });
            $(settings.menu + " li").eq(n).css({ "background": "#CCC","color": "#000", "font-weight": "bold" }).siblings().css({ "background": "#fff", "color": "#7f0019", "font-weight": "normal" });


        }
    }
}); 
