jQuery.extend(jQuery.easing, {
    easeOutExpo: function(e, f, a, h, g) {
        return (f == g) ? a + h: h * ( - Math.pow(2, -10 * f / g) + 1) + a
    }
});
var LRCycle = function(b) {
    var d = {
        duration: 600
    };
    var b = $.extend(d, b);
    this.options = b;
    b.LeftBtn = $(b.LeftBtnSel);
    b.RightBtn = $(b.LeftBtnSel);
    var c = $(b.ContentSep).length;
    this.NowContent = 0;
    if ((typeof this.options.sepWidth) == "undefined") {
        this.options.sepWidth = $(b.ContentSep).eq(0).width()
    }
    var a = this;
    this.Show = function(g) {
        a.unbindClick();
        g = parseInt(g);
        if (g < 0) {
            g = c - 2;
            var f = "-" + (g + 1) * this.options.sepWidth + "px";
            $(a.options.Content).css("left", f)
        }
        var e = g * this.options.sepWidth;
        $(a.options.Content).animate({
            top: 0,
            left: "-" + e + "px"
        },
        {
            duration: a.options.duration,
            specialEasing: {
                top: "easeOutExpo"
            },
            complete: function() {
                a.bindClick();
                if (g >= (c - 1)) {
                    $(a.options.Content).css("left", "0px");
                    a.NowContent = 0
                }
            }
        });
        if (g < 0) {
            g = (c - 1)
        }
        a.NowContent = g
    };
    this.next = function() {
        a.Show(a.NowContent + 1)
    };
    this.pre = function() {
        a.Show(a.NowContent - 1)
    };
    this.bindClick = function() {
        $(a.options.LeftBtnSel).bind("click", a.pre);
        $(a.options.RightBtnSel).bind("click", a.next)
    };
    this.unbindClick = function() {
        $(a.options.LeftBtnSel).unbind("click", a.pre);
        $(a.options.RightBtnSel).unbind("click", a.next)
    };
    this.bindClick()
};
var Cycle = function(m) {
    var e = {};
    var m = $.extend(e, m);
    var g = $(m.MainPicSel).length;
    var f = 1;
    var l = 0;
    var b = 5000;
    var h = 300;
    function a() {
        f = parseInt(f);
        var q = 1 + f;
        if (q > g) {
            q = 1
        }
        if (l == 0) {
            l = 1;
            k();
            return
        } else {
            var p = $(m.MainPicSel + "[" + m.GroupAttrName + "='" + q + "']").parents("a:first");
            var o = f;
            var n = q;
            $(m.MainPicSel + "[" + m.GroupAttrName + "='" + o + "']").parents("a:first").fadeOut("fast", 
            function() {
                p.fadeIn("fast");
                j(q);
                if (f >= g) {
                    f = 1
                } else {
                    f++
                }
            })
        }
        k()
    }
    function c(n) {
        if (f == n) {
            return
        }
        if (n < 0 || n > g) {
            return false
        }
        if (window.lbt) {
            clearTimeout(window.lbt)
        }
        window.lbt = setTimeout(function() {
            d(n)
        },
        h)
    }
    var d = function(q) {
        var p = $(m.MainPicSel + "[" + m.GroupAttrName + "='" + q + "']").parents("a:first");
        var o = f;
        var n = q;
        $(m.MainPicSel + "[" + m.GroupAttrName + "='" + o + "']").parents("a:first").fadeOut("fast", 
        function() {
            p.fadeIn("fast");
            j(q);
            f = q
        })
    };
    function j(n) {
        for (i = 1; i <= g; i++) {
            $(m.ControlSel + "[" + m.GroupAttrName + "='" + i + "']").removeClass("current")
        }
        $(m.ControlSel + "[" + m.GroupAttrName + "='" + n + "']").addClass("current")
    }
    function k() {
        if (window.lbt) {
            clearTimeout(window.lbt)
        }
        window.lbt = setTimeout(function() {
            a()
        },
        b)
    }
    a();
    $(m.ControlSel).each(function() {
        $(this).mouseover(function() {
            c($(this).attr("gid"))
        }).mouseout(function() {
            k()
        })
    })
};
var TDCycle = function(b) {
    var c = {};
    this.options = $.extend(c, b);
    var a = this;
    a.i = 0;
    $(this.options.ControlSel).mouseover(function() {
        $(a.options.ImgContainerSel).hide();
        $(this).next(a.options.ImgContainerSel).eq(0).show()
    })
};
var TDCycleEffect = function(b) {
    var c = {};
    this.options = $.extend(c, b);
    var a = this;
    this.NowImg = $(a.options.ImgContainerSel).eq(0)[0];
    a.i = 0;
    $(this.options.ControlSel).mouseover(function() {
        var d = $(this).next(a.options.ImgContainerSel).eq(0)[0];
        if (d == this.NowImg) {
            return
        }
        $(a.NowImg).animate({
            height: 0
        },
        {
            specialEasing: {
                height: "easeOutExpo"
            }
        });
        $(d).animate({
            height: "253px"
        },
        {
            specialEasing: {
                height: "easeOutExpo"
            }
        });
        a.NowImg = d
    })
};
$(document).ready(function() {
    var e = new Cycle({
        MainPicSel: "#top_ad_img a img",
        ControlSel: "#top_ad_txt li",
        GroupAttrName: "gid"
    });
    var f = new LRCycle({
        LeftBtnSel: "#brandlist .bl1",
        RightBtnSel: "#brandlist .bl3",
        ContentSep: "#brand_list dl",
        Content: "#brand_list"
    });
    var d = new TDCycle({
        ControlSel: "#sort_ad .top3_ad_txt",
        ImgContainerSel: "#sort_ad .top3_ad_img"
    });
    var c = new TDCycle({
        ControlSel: "#top5 .col_txt",
        ImgContainerSel: "#top5 .floor_ad_img"
    });
    var b = new TDCycle({
        ControlSel: "#top6 .col_txt",
        ImgContainerSel: "#top6 .floor_ad_img"
    });
    var a = new TDCycle({
        ControlSel: "#top4_1_5 .col_txt",
        ImgContainerSel: "#top4_1_5 .floor_ad_img"
    })
});
$(document).ready(function() {
    if (!$.browser.msie) {
        $("#navbot .search_btn").attr("align", "")
    }
});
