/*
 *  Javascript Library v1.4.2
 * Creation date: 2008/2/6
 * Modified date: 2011/05/12 10:37
 */
 (function(T, l) {
    var h = "1.4.2 Build 201106121037",
    _ = "NTES";
    if (T[_] && T[_].version >= h) return;
    var A = T.$,
    i = T.document,
    Y = T[_] = T.$ = function($, _) {
        if (!$) return $;
        "string" == typeof $ && ($ = $0.exec($, _ || i));
        return O($)
    };
    Y.one = function($, A) {
        var _ = Y($, A);
        return _ && !_.nodeType ? O(_[0]) : _
    };
    Y.all = function($, A) {
        var _ = Y(null == $ ? [] : $) || [];
        return _.nodeType ? O([_]) : _
    };
    function O(A) {
        if (A && !A[_]) if (A.nodeType) {
            if ("unknown" !== typeof A.getAttribute) for (var $ in Y.element) l === A[$] && (A[$] = Y.element[$])
        } else A = Y.util.extend(Y.util.toArray(A), Y.element);
        return A
    }
    Y.version = h;
    Y.resume = function() {
        A = T.$;
        T.$ = T[_] = Y;
        return Y
    };
    Y.retire = function() {
        T.$ = A;
        return A
    };
    var V = T.isNaN,
    B = T.Math,
    Q = i.createElement("div");
    Q.innerHTML = "<p class='TEST'></p>";
    var $0 = {
        SPACE: /\s*([\s>~+,])\s*/g,
        ISSIMPLE: /^#?[\w\u00c0-\uFFFF_-]+$/,
        IMPLIEDALL: /([>\s~\+,]|^)([#\.\[:])/g,
        ATTRVALUES: /=(["'])([^'"]*)\1]/g,
        ATTR: /\[\s*([\w\u00c0-\uFFFF_-]+)\s*(?:(\S?\=)\s*(.*?))?\s*\]/g,
        PSEUDOSEQ: /\(([^\(\)]*)\)$/g,
        BEGINIDAPART: /^(?:\*#([\w\u00c0-\uFFFF_-]+))/,
        STANDARD: /^[>\s~\+:]/,
        STREAM: /[#\.>\s\[\]:~\+]+|[^#\.>\s\[\]:~\+]+/g,
        ISINT: /^\d+$/,
        enableQuerySelector: Q.querySelectorAll && Q.querySelectorAll(".TEST").length > 0,
        tempAttrValues: [],
        tempAttrs: [],
        idName: _ + "UniqueId",
        id: 0,
        exec: function($, I) {
            var _,
            G,
            E,
            C,
            B,
            J,
            K,
            F,
            H,
            L,
            D = this;
            $ = $.trim();
            if ("" === $) return;
            if (D.ISSIMPLE.test($)) if (0 === $.indexOf("#") && typeof I.getElementById !== "undefined") return D.getElemById(I, $.substr(1));
            else if (typeof I.getElementsByTagName !== "undefined") return Y.util.toArray(I.getElementsByTagName($));
            if (D.enableQuerySelector && I.nodeType) {
                try {
                    return Y.util.toArray(I.querySelectorAll($))
                } catch(A) {}
            }
            I = I.nodeType ? [I] : Y.util.toArray(I);
            G = $.replace(D.SPACE, "$1").replace(D.ATTRVALUES, D.analyzeAttrValues).replace(D.ATTR, D.analyzeAttrs).replace(D.IMPLIEDALL, "$1*$2").split(",");
            E = G.length;
            C = -1;
            _ = [];
            while (++C < E) {
                J = I;
                $ = G[C];
                if (D.BEGINIDAPART.test($)) if (typeof I[0].getElementById !== "undefined") {
                    J = [D.getElemById(I[0], RegExp.$1)];
                    if (!J[0]) continue;
                    $ = RegExp.rightContext
                } else $ = G[C];
                if ($ !== "") {
                    if (!D.STANDARD.test($)) $ = " " + $;
                    K = $.match(D.STREAM) || [];
                    F = K.length;
                    B = 0;
                    while (B < F) {
                        H = K[B++];
                        L = K[B++];
                        J = D.operators[H] ? D.operators[H](J, L) : [];
                        if (0 === J.length) break
                    }
                }
                Y.util.merge(_, J)
            }
            D.tempAttrValues.length = D.tempAttrs.length = 0;
            return _.length > 1 ? D.unique(_) : _
        },
        analyzeAttrs: function(_, B, A, $) {
            return "[]" + ($0.tempAttrs.push([B, A, $]) - 1)
        },
        analyzeAttrValues: function($, A, _) {
            return "=" + ($0.tempAttrValues.push(_) - 1) + "]"
        },
        generateId: function(_) {
            var B = this.idName,
            $;
            try {
                $ = _[B] = _[B] || new Number(++this.id)
            } catch(A) {
                $ = _.getAttribute(B);
                if (!$) {
                    $ = new Number(++this.id);
                    _.setAttribute(B, $)
                }
            }
            return $.valueOf()
        },
        unique: function(C) {
            var A = [],
            D = 0,
            B = {},
            _,
            $;
            while (_ = C[D++]) if (1 === _.nodeType) {
                $ = this.generateId(_);
                if (!B[$]) {
                    B[$] = true;
                    A.push(_)
                }
            }
            return A
        },
        attrMap: {
            "class": "className",
            "for": "htmlFor"
        },
        getAttribute: function($, A) {
            var _ = this.attrMap[A] || A,
            B = $[_];
            if ("string" !== typeof B) if ("undefined" !== typeof $.getAttributeNode) {
                B = $.getAttributeNode(A);
                B = l == B ? B: B.value
            } else if ($.attributes) B = String($.attributes[A]);
            return null == B ? "": B
        },
        getElemById: function(A, $) {
            var _ = A.getElementById($);
            if (_ && _.id !== $ && A.all) {
                _ = A.all[$];
                if (_) {
                    _.nodeType && (_ = [_]);
                    for (var B = 0; B < _.length; B++) if (this.getAttribute(_[B], "id") === $) return _[B]
                }
            } else return _
        },
        getElemsByTagName: function(F, H, E, D, _) {
            var A = [],
            I = -1,
            G = F.length,
            $,
            C,
            B;
            D !== "*" && (B = D.toUpperCase());
            while (++I < G) {
                $ = F[I][H];
                C = 0;
                while ($ && (!_ || C < _)) {
                    if (1 === $.nodeType) { ($.nodeName.toUpperCase() === B || !B) && A.push($);
                        C++
                    }
                    $ = $[E]
                }
            }
            return A
        },
        checkElemPosition: function(G, H, J, A) {
            var $ = [];
            if (!V(H)) {
                var C = G.length,
                D = -1,
                _ = {},
                B,
                E,
                I,
                F;
                while (++D < C) {
                    B = G[D].parentNode;
                    E = this.generateId(B);
                    if (l === _[E]) {
                        I = 0;
                        F = B[J];
                        while (F) {
                            1 === F.nodeType && I++;
                            if (I < H) F = F[A];
                            else break
                        }
                        _[E] = F || 0
                    } else F = _[E];
                    G[D] === F && $.push(G[D])
                }
            }
            return $
        },
        getElemsByPosition: function(A, C, _) {
            var D = C,
            B = A.length,
            $ = [];
            while (D >= 0 && D < B) {
                $.push(A[D]);
                D += _
            }
            return $
        },
        getElemsByAttribute: function(B, D) {
            var _ = [],
            $,
            E = 0,
            A = this.attrOperators[D[1] || ""],
            C = "~=" === D[1] ? " " + D[2] + " ": D[2];
            if (A) while ($ = B[E++]) A(this.getAttribute($, D[0]), C) && _.push($);
            return _
        },
        operators: {
            "#": function(_, $) {
                return $0.getElemsByAttribute(_, ["id", "=", $])
            },
            " ": function(A, _) {
                var B = A.length;
                if (1 === B) return A[0].getElementsByTagName(_);
                else {
                    var $ = [],
                    C = -1;
                    while (++C < B) Y.util.merge($, A[C].getElementsByTagName(_));
                    return $
                }
            },
            ".": function($, _) {
                return $0.getElemsByAttribute($, ["class", "~=", _])
            },
            ">": function(_, $) {
                return $0.getElemsByTagName(_, "firstChild", "nextSibling", $)
            },
            "+": function(_, $) {
                return $0.getElemsByTagName(_, "nextSibling", "nextSibling", $, 1)
            },
            "~": function(_, $) {
                return $0.getElemsByTagName(_, "nextSibling", "nextSibling", $)
            },
            "[]": function($, _) {
                _ = $0.tempAttrs[_];
                if (_) {
                    if ($0.ISINT.test(_[2])) _[2] = $0.tempAttrValues[_[2]];
                    return $0.getElemsByAttribute($, _)
                } else return $
            },
            ":": function(_, A) {
                var $;
                if ($0.PSEUDOSEQ.test(A)) {
                    $ = parseInt(RegExp.$1);
                    A = RegExp.leftContext
                }
                return $0.pseOperators[A] ? $0.pseOperators[A](_, $) : []
            }
        },
        attrOperators: {
            "": function($) {
                return $ !== ""
            },
            "=": function(_, $) {
                return $ === _
            },
            "~=": function(_, $) {
                return (" " + _ + " ").indexOf($) >= 0
            },
            "!=": function(_, $) {
                return $ !== _
            },
            "^=": function(_, $) {
                return _.indexOf($) === 0
            },
            "$=": function(_, $) {
                return _.substr(_.length - $.length) === $
            },
            "*=": function(_, $) {
                return _.indexOf($) >= 0
            }
        },
        pseOperators: {
            "first-child": function($) {
                return $0.checkElemPosition($, 1, "firstChild", "nextSibling")
            },
            "nth-child": function(_, $) {
                return $0.checkElemPosition(_, $, "firstChild", "nextSibling")
            },
            "last-child": function($) {
                return $0.checkElemPosition($, 1, "lastChild", "previousSibling")
            },
            "nth-last-child": function(_, $) {
                return $0.checkElemPosition(_, $, "lastChild", "previousSibling")
            },
            "odd": function($) {
                return $0.getElemsByPosition($, 0, 2)
            },
            "even": function($) {
                return $0.getElemsByPosition($, 1, 2)
            },
            "lt": function(_, $) {
                return $0.getElemsByPosition(_, $ - 1, -1)
            },
            "gt": function(_, $) {
                return $0.getElemsByPosition(_, $ + 1, 1)
            }
        }
    };
    Y.element = {
        get: function($) {
            return Y.dom.single(this, $)
        },
        $: function($) {
            return Y("number" === typeof $ ? this.get($) : $, this)
        },
        hasClass: function($) {
            return Y.style.hasClass(this, $)
        },
        addCss: function($) {
            return Y.style.addCss(this, $)
        },
        removeCss: function($) {
            return Y.style.removeCss(this, $)
        },
        css: function(_, $) {
            var A;
            if (arguments.length > 1) {
                A = {};
                A[_] = $;
                return this.addCss(A)
            } else {
                A = this.get(0);
                return A ? Y.style.getCurrentStyle(A, _) : l
            }
        },
        addEvent: function(_, A, $) {
            return Y.event.addEvent(this, _, A, $)
        },
        removeEvent: function($, _) {
            return Y.event.removeEvent(this, $, _)
        },
        attr: function(A, B) {
            var _ = this;
            A = $0.attrMap[A] || A;
            if (B !== l) return Y.dom.eachNode(_, 
            function($, _) {
                this[$] = Y.util.isFunction(_) ? _.call(this) : _
            },
            arguments);
            else {
                var $ = this.get(0);
                return $ ? $[A] : l
            }
        },
        each: function($) {
            return Y.dom.eachNode(this, $)
        }
    };
    Y.element[_] = Y.element.$;
    T.addEvent = i.addEvent = Y.element.addEvent;
    T.removeEvent = i.removeEvent = Y.element.removeEvent;
    var b = {},
    y = Array.prototype.slice,
    W = Object.prototype.toString;
    Y.util = {
        toQueryString: function($) {
            if ($) {
                var _ = [];
                for (var A in $) $[A] != null && _.push(A + "=" + T.encodeURIComponent($[A]));
                return _.join("&").replace(/%20/g, "+")
            }
        },
        isArray: function($) {
            return W.call($) === "[object Array]"
        },
        isFunction: function($) {
            return W.call($) === "[object Function]"
        },
        isObject: function($) {
            return W.call($) === "[object Object]"
        },
        isEmptyObject: function($) {
            for (var _ in $) return false;
            return true
        },
        toArray: function($) {
            if (Y.util.isArray($)) return $;
            var A;
            try {
                A = y.call($)
            } catch(_) {
                A = [];
                var B = $.length;
                while (B) A[--B] = $[B]
            }
            return A
        },
        merge: function(_, $) {
            var B = $.length,
            A = _.length;
            while (--B >= 0) _[A + B] = $[B];
            return _
        },
        parseTpl: function(A, $, _) {
            if (null == A) return;
            if (null == $) return A;
            var B = b[A];
            if (!B) {
                B = new Function("obj", "var _=[];with(obj){_.push('" + A.replace(/[\r\t\n]/g, " ").replace(/'(?=[^#]*#>)/g, "\t").split("'").join("\\'").split("\t").join("'").replace(/<#=(.+?)#>/g, "',$1,'").split("<#").join("');").split("#>").join("_.push('") + "');}return _.join('');");
                _ !== false && (b[A] = B)
            }
            return B($)
        },
        extend: function($, _) {
            if (_ != null) {
                null == $ && ($ = {});
                for (var A in _) $[A] = _[A]
            }
            return $
        },
        each: function(A, _, $) {
            if (A != null) {
                var D = -1,
                B = A.length,
                C = B === l || Y.util.isFunction(A);
                if ($) {
                    if (C) {
                        for (D in A) if (false === _.apply(A[D], $)) break
                    } else while (++D < B) if (false === _.apply(A[D], $)) break
                } else if (C) {
                    for (D in A) if (false === _.call(A[D], D, A[D])) break
                } else while (++D < B) if (false === _.call(A[D], D, A[D])) break
            }
            return A
        }
    };
    Y.parseTpl = Y.util.parseTpl;
    Y.each = Y.util.each;
    Y.oo = {
        create: function(A, $, B, _) {
            $ && Y.util.extend(A.prototype, $);
            return B ? Y.oo._inherit(A, B, _) : A
        },
        _inherit: function(B, A, $) {
            var _ = $ ? 
            function() {
                $.call(this, A, arguments);
                B.apply(this, arguments)
            }: function() {
                A.apply(this, arguments);
                B.apply(this, arguments)
            };
            Y.util.extend(_.prototype, A.prototype);
            Y.util.extend(_.prototype, B.prototype);
            return _
        }
    };
    var a = [],
    E,
    $;
    if (i.addEventListener) $ = function() {
        i.removeEventListener("DOMContentLoaded", $, false);
        p()
    };
    else if (i.attachEvent) $ = function() {
        if ("complete" === i.readyState) {
            i.detachEvent("onreadystatechange", $);
            p()
        }
    };

 
    Y.dom = {
        single: function($, _) {
            null == _ && (_ = 0);
            return $.nodeType || $.setInterval ? (0 == _ ? $: l) : $[_]
        },
        wrapByArray: function($) {
            if (!$) return [];
            else if ($.nodeType || $.setInterval) return [$];
            else return Y.util.toArray($)
        },
        eachNode: function(_, A, $) {
            Y.each(Y.dom.wrapByArray(_), A, $);
            return _
        },
        ready: function($) {
            R();
            if (Y.dom.isReady) $.call(i, Y);
            else a.push($);
            return this
        },
        replaceNode: function(_, $) {
            if ($.replaceNode) $.replaceNode(_);
            else if ($.parentNode.replaceChild) $.parentNode.replaceChild(_, $);
            return _
        }
    };
    Y.ready = Y.dom.ready;
    var q = /\s*([:;])\s*/g,
    g = /[^:;]+?(?=:)/g,
    K = /[^:;]+/g,
    j = /[^\s]+/g,
    G = /-([a-z])/gi,
    f = Q.style.styleFloat !== l ? "styleFloat": "cssFloat",
    N = /^(?:zIndex|fontWeight|opacity|zoom)$/,
    u = /^float$/i,
    U = /opacity=([^,)]+)/,
    d = /alpha\([^\)]*\)/,
    X = {
        opacity: function(_, $) {
            var B = Y.style.getCurrentStyle(_, "filter") || "";
            if ($ !== "") {
                var A = "alpha(opacity=" + $ * 100 + ")";
                _.style.filter = d.test(B) ? B.replace(d, A) : A
            } else _.style.filter = B.replace(d, "")
        }
    },
    n = {
        opacity: function(_, $) {
            return U.test(Y.style.getCurrentStyle(_, "filter") || "") ? parseFloat(RegExp.$1) / 100: ""
        }
    };
    function _0($, B, _) {
        if (this.className) {
            var A = " " + this.className + " ",
            C = -1;
            while (++C < B) - 1 === A.indexOf(" " + $[C] + " ") && (A += ($[C] + " "));
            this.className = A.trim()
        } else this.className = _
    }
    function m($, B, _) {
        switch (this.className) {
        case _:
            this.className = "";
            break;
        case "":
            return;
            break;
        default:
            var A = " " + this.className + " ",
            C = -1;
            while (++C < B) A = A.replace(" " + $[C] + " ", " ");
            this.className = A.trim();
            break
        }
    }
    function z(_) {
        for (var $ in _) if (this.style[$] !== l) this.style[$] = N.test($) || "" == _[$] || V(_[$]) ? _[$] : _[$] + "px";
        else if (X[$]) X[$](this, _[$])
    }
    function t(_) {
        for (var $ in _) if (X[$]) X[$](this, "");
        else this.style[$] !== l && (this.style[$] = "")
    }
    Y.style = {
        fixStyleName: function($) {
            return u.test($) ? f: $.replace(G, 
            function(_, $) {
                return $.toUpperCase()
            })
        },
        hasClass: function(_, $) {
            _ = Y.dom.wrapByArray(_);
            var A = _.length;
            if (A > 0) {
                $ = " " + $ + " ";
                while (--A >= 0) if ((" " + _[A].className + " ").indexOf($) >= 0) return true
            }
            return false
        },
        parse: function(B) {
            var _,
            $,
            C;
            if ("string" === typeof B) {
                _ = B.indexOf(":") >= 0;
                if (B.indexOf(";") >= 0 || _) {
                    $ = {};
                    B = B.trim().replace(q, "$1").replace(_ ? g: K, Y.style.fixStyleName).match(K);
                    var A = B.length;
                    C = 0;
                    if (_) {
                        if (A % 2 !== 0) throw "invalid inline style";
                        while (C < A) $[B[C++]] = B[C++]
                    } else while (C < A) $[B[C++]] = ""
                } else $ = B.match(j) || []
            } else {
                $ = B;
                if ("object" === typeof $) for (C in $) {
                    _ = Y.style.fixStyleName(C);
                    if (_ !== C) {
                        $[_] = $[C];
                        delete $[C]
                    }
                }
            }
            return $
        },
        addCss: function(_, A) {
            if (A) {
                var $ = Y.style.parse(A);
                if (Y.util.isArray($)) Y.dom.eachNode(_, _0, [$, $.length, A]);
                else Y.dom.eachNode(_, z, [$, A])
            }
            return _
        },
        removeCss: function(_, A) {
            if (A) {
                var $ = Y.style.parse(A);
                if (Y.util.isArray($)) Y.dom.eachNode(_, m, [$, $.length, A]);
                else Y.dom.eachNode(_, t, [$])
            }
            return _
        },
        getCurrentStyle: function(A, _, $) {
            if (!A) return l; ! A.nodeType && (A = A[0]);
            _ = Y.style.fixStyleName(_);
            if (A.style[_] !== l) return A.style[_] || ((A.currentStyle || ($ || T).getComputedStyle(A, null))[_]);
            else if (n[_]) return n[_](A)
        }
    };
    var L,
    v;
    if (T.addEventListener) {
        L = function($, _, A) {
            $.addEventListener(_, A, false)
        };
        v = function($, _, A) {
            $.removeEventListener(_, A, false)
        }
    } else if (T.attachEvent) {
        L = function($, _, A) {
            $.attachEvent("on" + _, A)
        };
        v = function($, _, A) {
            $.detachEvent("on" + _, A)
        }
    }
    function s(A, B, _) {
        var $ = this;
        B = Y.event.delegate($, A, B, _);
        L($, A, B)
    }
    function k(_, B) {
        var $ = this,
        A = Y.event.getDelegate($, _, B);
        if (B) v($, _, A);
        else if (_) Y.each(A, 
        function(B, A) {
            A && k.call($, _, A)
        });
        else Y.each(A, 
        function(_) {
            k.call($, _)
        })
    }
    var J = /\s*,\s*/,
    F = 0;
    Y.event = {
        idName: _ + "EventId",
        eventSpace: _ + "Events",
        addEvent: function(_, A, C, $) {
            A = A.split(J);
            var B = A.length;
            while (--B >= 0) Y.dom.eachNode(_, s, [A[B], C, $]);
            return _
        },
        removeEvent: function($, _, B) {
            if (_) {
                _ = _.split(J);
                var A = _.length;
                while (--A >= 0) Y.dom.eachNode($, k, [_[A], B])
            } else Y.dom.eachNode($, k, []);
            return $
        },
        delegate: function(_, D, G, C) {
            var A = Y.event,
            B = _[A.eventSpace] = _[A.eventSpace] || {},
            $ = G[A.idName] = G[A.idName] || ++F;
            B[D] = B[D] || {};
            var E = B[D][$];
            if (!E) {
                E = function(B) {
                    B = A.fix(B);
                    B.data = C;
                    var $ = G.call(_, B, B.data);
                    false === $ && B.preventDefault();
                    true === B.cancelBubble && B.stopPropagation();
                    return $
                };
                B[D][$] = E
            }
            return E
        },
        getDelegate: function($, D, E) {
            var A = Y.event,
            C = $[A.eventSpace];
            if (C) {
                try {
                    if (E) {
                        var B = E[A.idName];
                        if (B) return C[D][B]
                    } else if (D) return C[D];
                    else return C
                } catch(_) {}
            }
            return E
        },
        fix: function($) {
            return new Y.event.EventArg($)
        }
    };
    Y.event.EventArg = Y.oo.create(function(B) {
        var _ = this;
        _._src = B;
        Y.each(_._props, 
        function(A, $) {
            if (B[$] != null) _[$] = B[$]
        });
        _.timeStamp = Date.now();
        _.target = _.target || _.srcElement || i;
        3 == _.target.nodeType && (_.target = _.target.parentNode);
        if (null == _.pageX && _.clientX != null) {
            var A = i.documentElement,
            $ = i.body;
            _.pageX = _.clientX + (A && A.scrollLeft || $ && $.scrollLeft || 0) - (A && A.clientLeft || $ && $.clientLeft || 0);
            _.pageY = _.clientY + (A && A.scrollTop || $ && $.scrollTop || 0) - (A && A.clientTop || $ && $.clientTop || 0)
        }
        if (null == _.which) if (_.charCode != null ? _.charCode: _.keyCode) _.which = _.charCode || _.keyCode;
        else if (_.button) _.which = (_.button & 1 ? 1: (_.button & 2 ? 3: (_.button & 4 ? 2: 0)))
    },
    {
        _props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
        stopPropagation: function() {
            if (this._src.stopPropagation) this._src.stopPropagation();
            else this._src.cancelBubble = true
        },
        preventDefault: function() {
            if (this._src.preventDefault) this._src.preventDefault();
            else this._src.returnValue = false
        }
    });

    var P = /^\s+|\s+$/g; ! String.prototype.trim && (String.prototype.trim = function() {
        return this.replace(P, "")
    });
    String.prototype.left = function($) {
        return this.substr(0, $)
    };
    String.prototype.right = function($) {
        return this.slice( - $)
    };
    String.format = function($) {
        var _ = arguments,
        A = new RegExp("%([1-" + _.length + "])", "g");
        return String($).replace(A, 
        function(A, $) {
            return _[$]
        })
    };
    Function.prototype.bind = function() {
        if (!arguments.length) return this;
        var _ = this,
        $ = y.call(arguments),
        A = $.shift();
        return function() {
            return _.apply(A, $.concat(y.call(arguments)))
        }
    };
    var C = Array.prototype; ! C.indexOf && (C.indexOf = function(A, _) {
        var $ = this.length;
        _ = Number(_) || 0;
        _ = _ < 0 ? B.ceil(_) : B.floor(_);
        _ < 0 && (_ += $);
        while (_ < $) {
            if (this[_] === A) return _;
            _++
        }
        return - 1
    }); ! C.lastIndexOf && (C.lastIndexOf = function(A, _) {
        var $ = this.length;
        _ = Number(_);
        if (V(_)) _ = $ - 1;
        else _ = _ < 0 ? B.ceil(_) : B.floor(_);
        if (_ < 0) _ += $;
        else if (_ >= $) _ = $ - 1;
        while (_ > -1) {
            if (this[_] === A) return _;
            _--
        }
        return - 1
    }); ! C.forEach && (C.forEach = function(A, $) {
        var B = -1,
        _ = this.length;
        while (++B < _) A.call($, this[B], B, this)
    }); ! C.every && (C.every = function(A, _) {
        var $ = true;
        this.forEach(function() {
            if (true === $ && !A.apply(this, arguments)) $ = false
        },
        _);
        return $
    }); ! C.some && (C.some = function(A, _) {
        var $ = false;
        this.forEach(function() {
            if (false === $ && A.apply(this, arguments)) $ = true
        },
        _);
        return $
    }); ! C.filter && (C.filter = function(A, _) {
        var $ = [];
        this.forEach(function(_) {
            A.apply(this, arguments) && $.push(_)
        },
        _);
        return $
    }); ! C.map && (C.map = function(A, _) {
        var $ = [];
        this.forEach(function(_, B) {
            $[B] = A.apply(this, arguments)
        },
        _);
        return $
    });
    C.remove = function($) {
        $ >= 0 && this.splice($, 1);
        return this
    };
    function D($) {
        return $ < 10 ? "0" + $: $
    }
    var Z,
    H,
    w,
    S,
    e,
    I;
    function r($) {
        switch ($) {
        case "yyyy":
            return Z;
        case "yy":
            return Z.toString().slice( - 2);
        case "MM":
            return D(H);
        case "M":
            return H;
        case "dd":
            return D(w);
        case "d":
            return w;
        case "HH":
            return D(S);
        case "H":
            return S;
        case "hh":
            return D(S > 12 ? S - 12: S);
        case "h":
            return S > 12 ? S - 12: S;
        case "mm":
            return D(e);
        case "m":
            return e;
        case "ss":
            return D(I);
        case "s":
            return I;
        default:
            return $
        }
    } ! Date.now && (Date.now = function() {
        return + new Date
    });
    Date.prototype.format = function($) {
        Z = this.getFullYear();
        H = this.getMonth() + 1;
        w = this.getDate();
        S = this.getHours();
        e = this.getMinutes();
        I = this.getSeconds();
        return $.replace(/y+|m+|d+|h+|s+|H+|M+/g, r)
    };
    Q = null
})(window); (function(N, O) {
    var D = N.NTES || {};
    if (!D.ui) D.ui = {};
    D.ui.version = "0.1.8";
    D.ui.Template = function() {
        this._cache = {}
    };
    D.ui.Template.prototype = {
        get: function($) {
            return null == this._cache[$] ? "": this._cache[$]
        },
        parse: function(_, $) {
            return D.util.parseTpl(this.get(_), $)
        },
        load: function($) {
            var _;
            if (D.util.isArray($)) {
                _ = $.length;
                while (--_ >= 0) this._cache[$[_].title] = $[_].innerHTML.replace(/(?:^\s*<!--)|(?:-->\s*$)/g, "")
            } else for (_ in $) $.hasOwnProperty(_) && (this._cache[_] = $[_])
        }
    };
    D.ui.Template._cache = {};
    D.ui.Template.get = D.ui.Template.prototype.get;
    D.ui.Template.parse = D.ui.Template.prototype.parse;
    D.ui.Template.load = function($) {
        $ = $ || D("#templates > *");
        D.ui.Template.prototype.load.call(this, $)
    };
    function M(_, $) {
        return (_ + 1) % $
    }
    function $(_, $) {
        return _ <= 0 ? $ - 1: (_ - 1) % $
    }
    D.ui.Slide = function(A, C, I, G, B, H) {
        if (!arguments.length) return;
        var _ = this;
        _.total = C.length;
        if (A && _.total !== A.length) throw "can not match ctrls(" + A.length + ") and contents(" + _.total + ")";
        _.constructor = arguments.callee;
        _._curIndex = -1;
        _._ctrls = A;
        _._contents = C;
        _._css = I;
        _._eventName = G;
        _.interval = B;
        _.playMode = M;
        _.rollbackMode = $;
        _.delay = H;
        if (_._ctrls && _._ctrls.length && _._eventName) {
            var F,
            E;
            if (H) {
                F = function(_, $) { ! this._delayTimer && (this._delayTimer = setTimeout(this.show.bind(this, $), this.delay));
                    _.preventDefault()
                }.bind(_);
                E = function() {
                    if (this._delayTimer) {
                        clearTimeout(this._delayTimer);
                        delete this._delayTimer
                    }
                }.bind(_)
            } else F = function(_, $) {
                this.show($);
                _.preventDefault()
            }.bind(_);
            for (var J = _.total - 1; J >= 0; J--) {
                D.event.addEvent(_._ctrls[J], G, F, new Number(J));
                E && D.event.addEvent(_._ctrls[J], "mouseout", E)
            }
        }
        _.interval && _.play()
    };
    D.ui.Slide.prototype = {
        show: function(_) {
            var A = this;
            _ = _ < 0 ? 0: _ >= A.total ? A.total - 1: _;
            var B = A._ctrls ? A._ctrls[_] : null,
            $ = A._contents[_];
            if ( - 1 === A._curIndex) A._curIndex = 0;
            D.style.removeCss(A._ctrls, A._css);
            D.style.removeCss(A._contents, A._css);
            D.style.addCss(B, A._css);
            D.style.addCss($, A._css);
            A.onShow && A.onShow(_, B, $);
            A._curIndex = _
        },
        showNext: function() {
            this.show(this.playMode(this._curIndex, this.total))
        },
        showPrevious: function() {
            this.show(this.rollbackMode(this._curIndex, this.total))
        },
        play: function(A) {
            var _ = this;
            if (!isNaN(A)) _.interval = parseInt(A);
            if (!_._playTimer) {
                if (!_._hasEvent) {
                    var $ = _.pause.bind(_),
                    B = _.play.bind(_);
                    D.event.addEvent(_._ctrls, "mouseover", $);
                    D.event.addEvent(_._ctrls, "mouseout", B);
                    D.event.addEvent(_._contents, "mouseover", $);
                    D.event.addEvent(_._contents, "mouseout", B);
                    _._hasEvent = 1
                }
                _._playTimer = setInterval(_.showNext.bind(_), _.interval)
            }
        },
        pause: function() {
            var _ = this;
            if (_._playTimer) {
                clearInterval(_._playTimer);
                delete _._playTimer;
                if (_.onStop) {
                    var $ = _._curIndex;
                    _.onStop($, _._ctrls[$], _._contents[$])
                }
            }
        }
    };
    D.ui.PopupLayer = function(E, $, B, C) {
        if (!arguments.length) return;
        var _ = this;
        _.constructor = arguments.callee;
        _._ctrl = E;
        _._content = $;
        _.delay = isNaN(C) ? 300: C;
        var A = _.delayHide.bind(_),
        F = _.clearDelay.bind(_);
        D.event.addEvent(E, B, _.show.bind(_));
        D.event.addEvent(E, "mouseout", A);
        D.event.addEvent(E, "mouseover", F);
        D.event.addEvent($, "mouseover", F);
        D.event.addEvent($, "mouseout", A)
    };
    D.ui.PopupLayer.prototype = {
        show: function() {
            D.style.addCss(this._content, "display:block;");
            this.onShow && this.onShow()
        },
        hide: function() {
            D.style.addCss(this._content, "display:none;");
            this.onHide && this.onHide()
        },
        delayHide: function() {
            if (this._timerId === O) this._timerId = setTimeout(this.hide.bind(this), this.delay)
        },
        clearDelay: function() {
            if (this._timerId !== O) {
                clearTimeout(this._timerId);
                this._timerId = O
            }
        }
    };

    var E = "NTES",
    S = E + "AnimateId",
    F = {},
    H = D.style.getCurrentStyle;
    function L($, _, A) {
        var B = $["offset" + _];
        A = A || "";
        D.each("Width" == _ ? ["Left", "Right"] : ["Top", "Bottom"], 
        function(C, _) {
            if ( - 1 == A.indexOf("padding")) B -= parseFloat(H($, "padding" + _)) || 0;
            if ( - 1 == A.indexOf("border")) B -= parseFloat(H($, "border" + _ + "Width")) || 0;
            if (A.indexOf("margin") != -1) B += parseFloat(H($, "margin" + _)) || 0
        });
        return B
    }
    D.element.width = function() {
        if ("number" == typeof arguments[0]) return this.addCss({
            width: arguments[0] + "px"
        });
        else return L(this.get(0), "Width", arguments[0])
    };
    D.element.height = function() {
        if ("number" == typeof arguments[0]) return this.addCss({
            height: arguments[0] + "px"
        });
        else return L(this.get(0), "Height", arguments[0])
    };
    var K = /opacity=([^,)]*)/,
    A = /alpha\([^\)]*\)/;
    D.element.opacity = function(_) {
        if ("number" == typeof _) return this.each(function(C) {
            if (this.style.opacity === O) {
                var B = H(this, "filter") || "",
                $ = "alpha(opacity=" + _ * 100 + ")";
                this.style.filter = A.test(B) ? B.replace(A, $) : $
            } else this.style.opacity = _
        });
        else {
            var $ = this.get(0),
            B,
            C;
            if ($.style.opacity === O) B = K.test(H($, "filter") || "") ? (B = parseFloat(RegExp.$1) / 100) : "";
            else {
                B = this.style.opacity || H($, "opacity");
                B !== "" && (B = parseFloat(B))
            }
            return "" === B ? 1: B
        }
    };
    var C = /^\-{0,1}\d+(?:\.\d+)?[^\s]*$/,
    T = /^(?:width|height|opacity)$/i,
    R = /^(?:zIndex|fontWeight|opacity|zoom|lineHeight)$/;
    function I($) {
        var _ = C.test($) ? parseFloat($) || 0: $.toLowerCase();
        return _
    }
    function B(B, A) {
        var $ = [],
        _;
        for (_ in A) {
            A[_] = I(A[_]);
            B.each(function(A) { ! $[A] && ($[A] = {});
                $[A][_] = T.test(_) ? D(this)[_]() : I(H(this, _))
            })
        }
        return $
    }
    D.element.animate = function(I, A, J, E) {
        typeof J !== "function" && (J = Q[J]);
        var C = Math.abs(100 - A * 100); (C >= 100) && (C = 5);
        A = A * 1000;
        I = D.style.parse(I);
        var H = this;
        H.stop();
        H.isPause = false;
        var _ = B(H, I);
        "visible" == I.visibility && H.addCss({
            visibility: "visible"
        });
        "block" == I.display && H.addCss({
            display: "block"
        });
        var G = 0,
        $ = setInterval(function() {
            if (H.isPause) return;
            G = G + C;
            var B = G / A,
            L,
            N,
            D,
            K,
            O,
            M = _.length;
            for (K in I) {
                O = -1;
                while (++O < M) {
                    L = _[O][K];
                    N = I[K];
                    if ("number" == typeof L && L != N) {
                        D = L + (N - L) * J(0, 1, B); ((N > L && D > N) || (N < L && D < N)) && (D = N);
                        if (T.test(K)) H.$(O)[K](D);
                        else H.get(O).style[K] = R.test(K) ? D: D + "px"
                    }
                }
            }
            if (G >= A) if (!F[$]) {
                clearInterval($);
                "hidden" == I.visibility && H.addCss({
                    visibility: "hidden"
                });
                "none" == I.display && H.addCss({
                    display: "none"
                });
                E && E();
                F[$] = true
            }
        },
        13);
        return this.attr(S, new Number($))
    };
    D.element.stop = function() {
        return this.each(function() {
            var $ = this[S];
            if ($ != null) {
                if (!F[$]) {
                    clearInterval($);
                    F[$] = true
                }
                try {
                    delete this[S]
                } catch(_) {}
            }
        })
    };
    D.element.pauseAnimate = function() {
        this.isPause = true
    };
    D.element.resumeAnimate = function() {
        this.isPause = false
    };
    var Q = {
        linear: function(A, _, $) {
            return A + _ * $
        }
    };
    D.ui.FadeSwitch = function(A, E, D, B, $, C) {
        if (!arguments.length) return;
        var _ = this;
        _.constructor = arguments.callee;
        _.fadeWrapperElement = A;
        _.triggerWrapperElement = E;
        _.fadeElements = _.fadeWrapperElement.$(".hotwrapper-inner");
        _.triggerElements = _.triggerWrapperElement.$("li");
        _._isAutoSwitch = B || false;
        _._triggerType = D || "mouseover";
        _._duration = $ * 1000 || 8000;
        _._frequency = C || 0.6;
        _.init()
    };
    D.ui.FadeSwitch.prototype = {
        _clearInterval: null,
        init: function($) {
            var _ = this;
            _._index = $ || 1;
            _.fadeElements.removeCss("current");
            D(_.fadeElements[_._index - 1]).addCss("current");
            _.triggerElements.removeCss("current");
            D(_.triggerElements[_._index - 1]).addCss("current");
            if (_._isAutoSwitch) _.initAutoSwitch();
            _.triggerElements.addEvent(_._triggerType, _.triggerSwitch.bind(_))
        },
        initAutoSwitch: function() {
            var $ = this;
            $._clearInterval = setInterval(function() {
                $._index = $._index + 1;
                $._index = $._index > $.triggerElements.length ? 1: $._index;
                $.activeSwitch()
            },
            $._duration)
        },
        triggerSwitch: function(_) {
            var $ = this,
            A,
            C = 1,
            B = _.target ? _.target: event.srcElement;
            for (C = 1, len = $.triggerElements.length; C <= len; C++) if ($.triggerElements[C - 1] === B) {
                A = C;
                break
            }
            if (A === $._index) return;
            else $._index = A;
            $.activeSwitch();
            if ($._isAutoSwitch) {
                if ($._clearInterval) clearInterval($._clearInterval);
                $.initAutoSwitch()
            }
        },
        activeSwitch: function() {
            var $ = this,
            _ = {
                opacity: 1
            };
            $.fadeElements.removeCss("current").opacity(0);
            $.triggerElements.removeCss("current");
            D($.triggerElements[$._index - 1]).addCss("current");
            D($.fadeElements[$._index - 1]).addCss("current").animate(_, $._frequency, "linear", 
            function() {})
        }
    };

})(window)


