(function(a, l, g) {
    if (a[l] === g) a[l] = {};
    l = a[l];
    var j = a.document,
    k = function(m, d, f, p) {
        if (!d || !m) return m;
        if (f === g) f = true;
        var r, u, t;
        if (p && (t = p.length)) for (r = 0; r < t; r++) {
            u = p[r];
            if (u in d) if (f || !(u in m)) m[u] = d[u]
        } else for (u in d) if (f || !(u in m)) m[u] = d[u];
        return m
    },
    h = false,
    c = [],
    i = false,
    n = /^#?([\w-]+)$/;
    k(l, {
        version: "1.1.0",
        _init: function() {
            this.Env = {
                mods: {},
                guid: 0
            }
        },
        add: function(m, d) {
            this.Env.mods[m] = {
                name: m,
                fn: d
            };
            d(this);
            return this
        },
        ready: function(m) {
            i || this._bindReady();
            h ? m.call(a, this) : c.push(m);
            return this
        },
        _bindReady: function() {
            var m = this,
            d = j.documentElement.doScroll,
            f = d ? "onreadystatechange": "DOMContentLoaded",
            p = function() {
                m._fireReady()
            };
            i = true;
            if (j.readyState === "complete") return p();
            if (j.addEventListener) {
                var r = function() {
                    j.removeEventListener(f, r, false);
                    p()
                };
                j.addEventListener(f, r, false);
                a.addEventListener("load", p, false)
            } else {
                var u = function() {
                    if (j.readyState === "complete") {
                        j.detachEvent(f, u);
                        p()
                    }
                };
                j.attachEvent(f, u);
                a.attachEvent("onload", p);
                if (a == a.top) {
                    var t = function() {
                        try {
                            d("left");
                            p()
                        } catch(b) {
                            setTimeout(t, 1)
                        }
                    };
                    t()
                }
            }
        },
        _fireReady: function() {
            if (!h) {
                h = true;
                if (c) {
                    for (var m, d = 0; m = c[d++];) m.call(a, this);
                    c = null
                }
            }
        },
        available: function(m, d) {
            if ((m = (m + "").match(n)[1]) && l.isFunction(d)) var f = 1,
            p = l.later(function() {
                if (j.getElementById(m) && (d() || 1) || ++f > 500) p.cancel()
            },
            40, true)
        },
        mix: k,
        merge: function() {
            var m = {},
            d, f = arguments.length;
            for (d = 0; d < f; ++d) k(m, arguments[d]);
            return m
        },
        augment: function() {
            var m = arguments,
            d = m.length - 2,
            f = m[0],
            p = m[d],
            r = m[d + 1],
            u = 1;
            if (!l.isArray(r)) {
                p = r;
                r = g;
                d++
            }
            if (!l.isBoolean(p)) {
                p = g;
                d++
            }
            for (; u < d; u++) k(f.prototype, m[u].prototype || m[u], p, r);
            return f
        },
        extend: function(m, d, f, p) {
            if (!d || !m) return m;
            var r = Object.prototype,
            u = d.prototype,
            t = function(b) {
                function e() {}
                e.prototype = b;
                return new e
            } (u);
            m.prototype = t;
            t.constructor = m;
            m.superclass = u;
            if (d !== Object && u.constructor === r.constructor) u.constructor = d;
            f && k(t, f);
            p && k(m, p);
            return m
        },
        namespace: function() {
            var m = arguments.length,
            d = null,
            f, p, r;
            for (f = 0; f < m; ++f) {
                r = ("" + arguments[f]).split(".");
                d = this;
                for (p = a[r[0]] === d ? 1 : 0; p < r.length; ++p) d = d[r[p]] = d[r[p]] || {}
            }
            return d
        },
        app: function(m, d) {
            var f = a[m] || {};
            k(f, this, true, ["_init", "add", "namespace"]);
            f._init();
            return k(a[m] = f, typeof d === "function" ? d() : d)
        },
        log: function(m, d, f) {
            if (this.Config.debug) {
                if (f) m = f + ": " + m;
                if (a.console !== g && console.log) console[d && console[d] ? d: "log"](m)
            }
            return this
        },
        error: function(m) {
            if (this.Config.debug) throw m;
        },
        guid: function(m) {
            var d = this.Env.guid+++"";
            return m ? m + d: d
        }
    });
    l._init();
    l.Config = {
        debug: ""
    }
})(window, "KISSY");
KISSY.add("lang",
function(a, l) {
    function g(b) {
        var e = typeof b;
        return b === null || e !== "object" && e !== "function"
    }
    var j = window,
    k = document,
    h = location,
    c = Array.prototype,
    i = c.indexOf,
    n = c.filter,
    m = String.prototype.trim,
    d = Object.prototype.toString,
    f = encodeURIComponent,
    p = decodeURIComponent,
    r = /^\s+|\s+$/g,
    u = /^(\w+)\[\]$/,
    t = /\S/;
    a.mix(a, {
        isUndefined: function(b) {
            return b === l
        },
        isBoolean: function(b) {
            return typeof b === "boolean"
        },
        isString: function(b) {
            return typeof b === "string"
        },
        isNumber: function(b) {
            return typeof b === "number" && isFinite(b)
        },
        isPlainObject: function(b) {
            return b && d.call(b) === "[object Object]" && !b.nodeType && !b.setInterval
        },
        isEmptyObject: function(b) {
            for (var e in b) return false;
            return true
        },
        isFunction: function(b) {
            return d.call(b) === "[object Function]"
        },
        isArray: function(b) {
            return d.call(b) === "[object Array]"
        },
        trim: m ?
        function(b) {
            return b == l ? "": m.call(b)
        }: function(b) {
            return b == l ? "": b.toString().replace(r, "")
        },
        substitute: function(b, e, o) {
            if (!a.isString(b) || !a.isPlainObject(e)) return b;
            return b.replace(o || /\\?\{([^{}]+)\}/g,
            function(q, v) {
                if (q.charAt(0) === "\\") return q.slice(1);
                return e[v] !== l ? e[v] : ""
            })
        },
        each: function(b, e, o) {
            for (var q = b && b.length || 0,
            v = 0; v < q; ++v) e.call(o || j, b[v], v, b)
        },
        indexOf: i ?
        function(b, e) {
            return i.call(e, b)
        }: function(b, e) {
            for (var o = 0,
            q = e.length; o < q; ++o) if (e[o] === b) return o;
            return - 1
        },
        inArray: function(b, e) {
            return a.indexOf(b, e) > -1
        },
        makeArray: function(b) {
            if (b === null || b === l) return [];
            if (a.isArray(b)) return b;
            if (typeof b.length !== "number" || typeof b === "string" || a.isFunction(b)) return [b];
            if (b.item && a.UA.ie) {
                for (var e = [], o = 0, q = b.length; o < q; ++o) e[o] = b[o];
                return e
            }
            return c.slice.call(b)
        },
        filter: n ?
        function(b, e, o) {
            return n.call(b, e, o)
        }: function(b, e, o) {
            var q = [];
            a.each(b,
            function(v, s, w) {
                e.call(o, v, s, w) && q.push(v)
            });
            return q
        },
        param: function(b, e) {
            if (!a.isPlainObject(b)) return "";
            e = e || "&";
            var o = [],
            q,
            v;
            for (q in b) {
                v = b[q];
                q = f(q);
                if (g(v)) o.push(q, "=", f(v + ""), e);
                else if (a.isArray(v) && v.length) for (var s = 0,
                w = v.length; s < w; ++s) g(v[s]) && o.push(q, "[]=", f(v[s] + ""), e)
            }
            o.pop();
            return o.join("")
        },
        unparam: function(b, e) {
            if (typeof b !== "string" || (b = a.trim(b)).length === 0) return {};
            var o = {};
            b = b.split(e || "&");
            for (var q, v, s, w = 0,
            z = b.length; w < z; ++w) {
                e = b[w].split("=");
                q = p(e[0]);
                try {
                    v = p(e[1] || "")
                } catch(A) {
                    v = e[1] || ""
                }
                if ((s = q.match(u)) && s[1]) {
                    o[s[1]] = o[s[1]] || [];
                    o[s[1]].push(v)
                } else o[q] = v
            }
            return o
        },
        later: function(b, e, o, q, v) {
            e = e || 0;
            q = q || {};
            var s = b,
            w = a.makeArray(v),
            z;
            if (typeof b === "string") s = q[b];
            s || a.error("method undefined");
            b = function() {
                s.apply(q, w)
            };
            z = o ? setInterval(b, e) : setTimeout(b, e);
            return {
                id: z,
                interval: o,
                cancel: function() {
                    this.interval ? clearInterval(z) : clearTimeout(z)
                }
            }
        },
        clone: function(b) {
            var e = b,
            o, q;
            if (b && ((o = a.isArray(b)) || a.isPlainObject(b))) {
                e = o ? [] : {};
                for (q in b) if (b.hasOwnProperty(q)) e[q] = a.clone(b[q])
            }
            return e
        },
        now: function() {
            return (new Date).getTime()
        },
        globalEval: function(b) {
            if (b && t.test(b)) {
                var e = k.getElementsByTagName("head")[0] || k.documentElement,
                o = k.createElement("script");
                o.text = b;
                e.insertBefore(o, e.firstChild);
                e.removeChild(o)
            }
        }
    });
    if (h && h.search && h.search.indexOf("ks-debug") !== -1) a.Config.debug = true
});
KISSY.add("ua",
function(a) {
    var l = navigator.userAgent,
    g, j = {
        webkit: 0,
        chrome: 0,
        safari: 0,
        gecko: 0,
        firefox: 0,
        ie: 0,
        opera: 0,
        mobile: ""
    },
    k = function(h) {
        var c = 0;
        return parseFloat(h.replace(/\./g,
        function() {
            return c++===0 ? ".": ""
        }))
    };
    if ((g = l.match(/AppleWebKit\/([\d.]*)/)) && g[1]) {
        j.webkit = k(g[1]);
        if ((g = l.match(/Chrome\/([\d.]*)/)) && g[1]) j.chrome = k(g[1]);
        else if ((g = l.match(/\/([\d.]*) Safari/)) && g[1]) j.safari = k(g[1]);
        if (/ Mobile\//.test(l)) j.mobile = "Apple";
        else if (g = l.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/)) j.mobile = g[0]
    } else if ((g = l.match(/Opera\/.* Version\/([\d.]*)/)) && g[1]) {
        j.opera = k(g[1]);
        if (l.match(/Opera Mini[^;]*/)) j.mobile = g[0]
    } else if ((g = l.match(/MSIE\s([^;]*)/)) && g[1]) j.ie = k(g[1]);
    else if (g = l.match(/Gecko/)) {
        j.gecko = 1;
        if ((g = l.match(/rv:([\d.]*)/)) && g[1]) j.gecko = k(g[1]);
        if ((g = l.match(/Firefox\/([\d.]*)/)) && g[1]) j.firefox = k(g[1])
    }
    j._numberify = k;
    a.UA = j

});
KISSY.add("dom",
function(a) {
    var l = {
        _isSupportedNode: function(g) {
            return l._isElementNode(g) || l._isTextNode(g)
        },
        _isElementNode: function(g) {
            return g && g.nodeType === 1
        },
        _isTextNode: function(g) {
            return g && g.nodeType === 3
        },
        _isKSNode: function(g) {
            return g && a.Node && g.nodeType === a.Node.TYPE
        }
    };
    a.DOM = l
});
KISSY.add("selector",
function(a, l) {
    function g(b, e) {
        var o, q = [],
        v,
        s;
        e = j(e);
        if (a.isString(b)) {
            b = a.trim(b);
            if (u.test(b)) {
                if (b = k(b.slice(1), e)) q = [b]
            } else if (o = t.exec(b)) {
                v = o[1];
                s = o[2];
                o = o[3];
                if (e = v ? k(v, e) : e) if (o) if (!v || b.indexOf(d) !== -1) q = c(o, s, e);
                else {
                    if ((b = k(v, e)) && m.hasClass(b, o)) q = [b]
                } else if (s) q = h(s, e)
            } else if (a.ExternalSelector) return a.ExternalSelector(b, e);
            else i(b)
        } else if (b && (b[p] || b[r])) q = b[p] ? [b[p]()] : b[r]();
        else if (b && b.nodeType) q = [b];
        else if (b && (a.isArray(b) || b.item)) q = b;
        if (q.item) q = a.makeArray(q);
        return q
    }
    function j(b) {
        if (b === l) b = n;
        else if (a.isString(b) && u.test(b)) b = k(b.slice(1), n);
        else if (b && b.nodeType !== 1 && b.nodeType !== 9) b = null;
        return b
    }
    function k(b, e) {
        if (e.nodeType !== 9) e = e.ownerDocument;
        return e.getElementById(b)
    }
    function h(b, e) {
        return e.getElementsByTagName(b)
    }
    function c(b, e, o) {
        o = b = o.getElementsByClassName(b);
        var q = 0,
        v = 0,
        s = b.length,
        w;
        if (e && e !== f) {
            o = [];
            for (e = e.toUpperCase(); q < s; ++q) {
                w = b[q];
                if (w.tagName === e) o[v++] = w
            }
        }
        return o
    }
    function i(b) {
        a.error("Unsupported selector: " + b)
    }
    var n = document,
    m = a.DOM,
    d = " ",
    f = "*",
    p = "getDOMNode",
    r = p + "s",
    u = /^#[\w-]+$/,
    t = /^(?:#([\w-]+))?\s*([\w-]+|\*)?\.?([\w-]+)?$/; (function() {
        var b = n.createElement("div");
        b.appendChild(n.createComment(""));
        if (b.getElementsByTagName(f).length > 0) h = function(e, o) {
            o = o.getElementsByTagName(e);
            if (e === f) {
                e = [];
                for (var q = 0,
                v = 0,
                s; s = o[q++];) if (s.nodeType === 1) e[v++] = s;
                o = e
            }
            return o
        }
    })();
    n.getElementsByClassName || (c = n.querySelectorAll ?
    function(b, e, o) {
        return o.querySelectorAll((e ? e: "") + "." + b)
    }: function(b, e, o) {
        e = o.getElementsByTagName(e || f);
        o = [];
        var q = 0,
        v = 0,
        s = e.length,
        w, z;
        for (b = d + b + d; q < s; ++q) {
            w = e[q];
            if ((z = w.className) && (d + z + d).indexOf(b) > -1) o[v++] = w
        }
        return o
    });
    a.query = g;
    a.get = function(b, e) {
        return g(b, e)[0] || null
    };
    a.mix(m, {
        query: g,
        get: a.get,
        filter: function(b, e) {
            var o = g(b),
            q,
            v,
            s,
            w = [];
            if (a.isString(e) && (q = t.exec(e)) && !q[1]) {
                v = q[2];
                s = q[3];
                e = function(z) {
                    return ! (v && z.tagName !== v.toUpperCase() || s && !m.hasClass(z, s))
                }
            }
            if (a.isFunction(e)) w = a.filter(o, e);
            else if (e && a.ExternalSelector) w = a.ExternalSelector._filter(b, e);
            else i(e);
            return w
        },
        test: function(b, e) {
            b = g(b);
            return m.filter(b, e).length === b.length
        }
    })
});
KISSY.add("dom-class",
function(a, l) {
    function g(c, i, n, m) {
        if (! (i = a.trim(i))) return m ? false: l;
        c = a.query(c);
        var d = 0,
        f = c.length;
        i = i.split(k);
        for (var p; d < f; d++) {
            p = c[d];
            if (j._isElementNode(p)) {
                p = n(p, i, i.length);
                if (p !== l) return p
            }
        }
        if (m) return false
    }
    var j = a.DOM,
    k = /[\.\s]\s*\.?/,
    h = /[\n\t]/g;
    a.mix(j, {
        hasClass: function(c, i) {
            return g(c, i,
            function(n, m, d) {
                if (n = n.className) {
                    n = " " + n + " ";
                    for (var f = 0,
                    p = true; f < d; f++) if (n.indexOf(" " + m[f] + " ") < 0) {
                        p = false;
                        break
                    }
                    if (p) return true
                }
            },
            true)
        },
        addClass: function(c, i) {
            g(c, i,
            function(n, m, d) {
                var f = n.className;
                if (f) {
                    var p = " " + f + " ";
                    f = f;
                    for (var r = 0; r < d; r++) if (p.indexOf(" " + m[r] + " ") < 0) f += " " + m[r];
                    n.className = a.trim(f)
                } else n.className = i
            })
        },
        removeClass: function(c, i) {
            g(c, i,
            function(n, m, d) {
                var f = n.className;
                if (f) if (d) {
                    f = (" " + f + " ").replace(h, " ");
                    for (var p = 0,
                    r; p < d; p++) for (r = " " + m[p] + " "; f.indexOf(r) >= 0;) f = f.replace(r, " ");
                    n.className = a.trim(f)
                } else n.className = ""
            })
        },
        replaceClass: function(c, i, n) {
            j.removeClass(c, i);
            j.addClass(c, n)
        },
        toggleClass: function(c, i, n) {
            var m = a.isBoolean(n),
            d;
            g(c, i,
            function(f, p, r) {
                for (var u = 0,
                t; u < r; u++) {
                    t = p[u];
                    d = m ? !n: j.hasClass(f, t);
                    j[d ? "removeClass": "addClass"](f, t)
                }
            })
        }
    })
});
KISSY.add("dom-attr",
function(a, l) {
    function g(t, b) {
        return b && b.nodeName.toUpperCase() === t.toUpperCase()
    }
    var j = a.UA,
    k = j.ie,
    h = k && k < 8,
    c = document.documentElement.textContent !== l ? "textContent": "innerText",
    i = a.DOM,
    n = i._isElementNode,
    m = i._isTextNode,
    d = /href|src|style/,
    f = /href|src|colspan|rowspan/,
    p = /\r/g,
    r = /radio|checkbox/,
    u = {
        readonly: "readOnly"
    };
    h && a.mix(u, {
        "for": "htmlFor",
        "class": "className"
    });
    a.mix(i, {
        attr: function(t, b, e) {
            if (a.isPlainObject(b)) for (var o in b) i.attr(t, o, b[o]);
            else if (b = a.trim(b)) {
                b = b.toLowerCase();
                b = u[b] || b;
                if (e === l) {
                    t = a.get(t);
                    if (!n(t)) return l;
                    var q;
                    d.test(b) || (q = t[b]);
                    if (q === l) q = t.getAttribute(b);
                    if (h) if (f.test(b)) q = t.getAttribute(b, 2);
                    else if (b === "style") q = t.style.cssText;
                    return q === null ? l: q
                }
                a.each(a.query(t),
                function(v) {
                    if (n(v)) if (b === "style") v.style.cssText = e;
                    else {
                        if (b === "checked") v[b] = !!e;
                        v.setAttribute(b, "" + e)
                    }
                })
            }
        },
        removeAttr: function(t, b) {
            a.each(a.query(t),
            function(e) {
                if (n(e)) {
                    i.attr(e, b, "");
                    e.removeAttribute(b)
                }
            })
        },
        val: function(t, b) {
            if (b === l) {
                var e = a.get(t);
                if (!n(e)) return l;
                if (g("option", e)) return (e.attributes.value || {}).specified ? e.value: e.text;
                if (g("select", e)) {
                    var o = e.selectedIndex;
                    t = e.options;
                    if (o < 0) return null;
                    else if (e.type === "select-one") return i.val(t[o]);
                    e = [];
                    for (var q = 0,
                    v = t.length; q < v; ++q) t[q].selected && e.push(i.val(t[q]));
                    return e
                }
                if (j.webkit && r.test(e.type)) return e.getAttribute("value") === null ? "on": e.value;
                return (e.value || "").replace(p, "")
            }
            a.each(a.query(t),
            function(s) {
                if (g("select", s)) {
                    if (a.isNumber(b)) b += "";
                    var w = a.makeArray(b),
                    z = s.options,
                    A;
                    q = 0;
                    for (v = z.length; q < v; ++q) {
                        A = z[q];
                        A.selected = a.inArray(i.val(A), w)
                    }
                    if (!w.length) s.selectedIndex = -1
                } else if (n(s)) s.value = b
            })
        },
        text: function(t, b) {
            if (b === l) {
                t = a.get(t);
                if (n(t)) return t[c] || "";
                else if (m(t)) return t.nodeValue
            } else a.each(a.query(t),
            function(e) {
                if (n(e)) e[c] = b;
                else if (m(e)) e.nodeValue = b
            })
        }
    })
});
KISSY.add("dom-style",
function(a, l) {
    function g(b, e) {
        var o = a.get(b),
        q = e === n ? o.offsetWidth: o.offsetHeight;
        a.each(e === n ? ["Left", "Right"] : ["Top", "Bottom"],
        function(v) {
            q -= parseFloat(k._getComputedStyle(o, "padding" + v)) || 0;
            q -= parseFloat(k._getComputedStyle(o, "border" + v + "Width")) || 0
        });
        return q
    }
    function j(b, e, o) {
        var q = o;
        if (o === m && f.test(e)) {
            q = 0;
            if (k.css(b, "position") === "absolute") {
                o = b[e === "left" ? "offsetLeft": "offsetTop"];
                if (h.ie === 8 || h.opera) o -= d(k.css(b.offsetParent, "border-" + e + "-width")) || 0;
                q = o - (d(k.css(b, "margin-" + e)) || 0)
            }
        }
        return q
    }
    var k = a.DOM,
    h = a.UA,
    c = document,
    i = c.documentElement,
    n = "width",
    m = "auto",
    d = parseInt,
    f = /^left|top$/,
    p = /width|height|top|left|right|bottom|margin|padding/i,
    r = /-([a-z])/ig,
    u = function(b, e) {
        return e.toUpperCase()
    },
    t = {};
    a.mix(k, {
        _CUSTOM_STYLES: t,
        _getComputedStyle: function(b, e) {
            var o = "",
            q = b.ownerDocument;
            if (b.style) o = q.defaultView.getComputedStyle(b, null)[e];
            return o
        },
        css: function(b, e, o) {
            if (a.isPlainObject(e)) for (var q in e) k.css(b, q, e[q]);
            else {
                if (e.indexOf("-") > 0) e = e.replace(r, u);
                e = t[e] || e;
                if (o === l) {
                    b = a.get(b);
                    q = "";
                    if (b && b.style) {
                        q = e.get ? e.get(b) : b.style[e];
                        if (q === "" && !e.get) q = j(b, e, k._getComputedStyle(b, e))
                    }
                    return q === l ? "": q
                } else {
                    if (o === null || o === "") o = "";
                    else if (!isNaN(new Number(o)) && p.test(e)) o += "px"; (e === n || e === "height") && parseFloat(o) < 0 || a.each(a.query(b),
                    function(v) {
                        if (v && v.style) {
                            e.set ? e.set(v, o) : (v.style[e] = o);
                            if (o === "") v.style.cssText || v.removeAttribute("style")
                        }
                    })
                }
            }
        },
        width: function(b, e) {
            if (e === l) return g(b, n);
            else k.css(b, n, e)
        },
        height: function(b, e) {
            if (e === l) return g(b, "height");
            else k.css(b, "height", e)
        },
        addStyleSheet: function(b, e) {
            var o;
            if (e) o = a.get(e);
            o || (o = k.create("<style>", {
                id: e
            }));
            a.get("head").appendChild(o);
            if (o.styleSheet) o.styleSheet.cssText = b;
            else o.appendChild(c.createTextNode(b))
        }
    });
    if (i.style.cssFloat !== l) t["float"] = "cssFloat";
    else if (i.style.styleFloat !== l) t["float"] = "styleFloat"
});
KISSY.add("dom-style-ie",
function(a, l) {
    if (a.UA.ie) {
        var g = a.DOM,
        j = document,
        k = j.documentElement,
        h = g._CUSTOM_STYLES,
        c = /^-?\d+(?:px)?$/i,
        i = /^-?\d/,
        n = /^width|height$/;
        try {
            if (k.style.opacity === l && k.filters) h.opacity = {
                get: function(d) {
                    var f = 100;
                    try {
                        f = d.filters["DXImageTransform.Microsoft.Alpha"].opacity
                    } catch(p) {
                        try {
                            f = d.filters("alpha").opacity
                        } catch(r) {}
                    }
                    return f / 100 + ""
                },
                set: function(d, f) {
                    d = d.style;
                    d.zoom = 1;
                    d.filter = "alpha(opacity=" + f * 100 + ")"
                }
            }
        } catch(m) {
            a.log("IE filters ActiveX is disabled. ex = " + m)
        }
        if (! (j.defaultView || {}).getComputedStyle && k.currentStyle) g._getComputedStyle = function(d, f) {
            var p = d.style,
            r = d.currentStyle[f];
            if (n.test(f)) r = g[f](d) + "px";
            else if (!c.test(r) && i.test(r)) {
                var u = p.left,
                t = d.runtimeStyle.left;
                d.runtimeStyle.left = d.currentStyle.left;
                p.left = f === "fontSize" ? "1em": r || 0;
                r = p.pixelLeft + "px";
                p.left = u;
                d.runtimeStyle.left = t
            }
            return r
        }
    }
});
KISSY.add("dom-offset",
function(a, l) {
    function g(s) {
        var w = 0,
        z = 0,
        A = k(s[t]);
        if (s[v]) {
            s = s[v]();
            w = s[b] + h[o](A);
            z = s[e] + h[q](A)
        }
        return {
            left: w,
            top: z
        }
    }
    function j(s, w) {
        if (h.css(s, p) === "static") s.style[p] = r;
        var z = g(s),
        A = {},
        x,
        y;
        for (y in w) {
            x = f(h.css(s, y), 10) || 0;
            A[y] = x + w[y] - z[y]
        }
        h.css(s, A)
    }
    function k(s) {
        return s && "scrollTo" in s && s[u] ? s: s && s.nodeType === 9 ? s.defaultView || s.parentWindow: false
    }
    var h = a.DOM,
    c = window,
    i = document,
    n = h._isElementNode,
    m = i.compatMode === "CSS1Compat",
    d = Math.max,
    f = parseInt,
    p = "position",
    r = "relative",
    u = "document",
    t = "ownerDocument",
    b = "left",
    e = "top",
    o = "scrollLeft",
    q = "scrollTop",
    v = "getBoundingClientRect";
    a.mix(h, {
        offset: function(s, w) {
            if (! (s = a.get(s)) || !s[t]) return null;
            if (w === l) return g(s);
            j(s, w)
        },
        scrollIntoView: function(s, w, z, A) {
            if ((s = a.get(s)) && s[t]) {
                w = a.get(w);
                A = A === l ? true: !!A;
                z = z === l ? true: !!z;
                if (!n(w)) return s.scrollIntoView(z);
                var x = h.offset(s),
                y = h.offset(w),
                B = {
                    left: x[b] - y[b],
                    top: x[e] - y[e]
                };
                x = w.clientHeight;
                y = w.clientWidth;
                var C = h[o](w),
                D = h[q](w),
                G = C + y,
                F = D + x,
                E = s.offsetHeight;
                s = s.offsetWidth;
                var H = B.left + C - (f(h.css(w, "borderLeftWidth")) || 0);
                B = B.top + D - (f(h.css(w, "borderTopWidth")) || 0);
                var I = H + s,
                J = B + E;
                if (E > x || B < D || z) w[q] = B;
                else if (J > F) w[q] = J - x;
                if (A) if (s > y || H < C || z) w[o] = H;
                else if (I > G) w[o] = I - y
            }
        }
    });
    a.each(["Left", "Top"],
    function(s, w) {
        var z = "scroll" + s;
        h[z] = function(A) {
            var x = 0,
            y = A === l ? c: k(A),
            B;
            if (y && (B = y[u])) x = y[w ? "pageYOffset": "pageXOffset"] || B.documentElement[z] || B.body[z];
            else if (n(A = a.get(A))) x = A[z];
            return x
        }
    });
    a.each(["Width", "Height"],
    function(s) {
        h["doc" + s] = function(w) {
            w = w || i;
            return d(m ? w.documentElement["scroll" + s] : w.body["scroll" + s], h["viewport" + s](w))
        };
        h["viewport" + s] = function(w) {
            var z = "inner" + s;
            w = k(w) || c;
            var A = w[u];
            return z in w ? w[z] : m ? A.documentElement["client" + s] : A.body["client" + s]
        }
    })
});
KISSY.add("dom-traversal",
function(a, l) {
    function g(c, i, n, m) {
        if (! (c = a.get(c))) return null;
        if (i === l) i = 1;
        var d = null,
        f, p;
        if (a.isNumber(i) && i >= 0) {
            if (i === 0) return c;
            f = 0;
            p = i;
            i = function() {
                return++f === p
            }
        }
        for (; c = c[n];) if (h(c) && (!i || k.test(c, i)) && (!m || m(c))) {
            d = c;
            break
        }
        return d
    }
    function j(c, i, n) {
        var m = [];
        var d = c = a.get(c);
        if (c && n) d = c.parentNode;
        if (d) {
            n = 0;
            for (d = d.firstChild; d; d = d.nextSibling) if (h(d) && d !== c && (!i || k.test(d, i))) m[n++] = d
        }
        return m
    }
    var k = a.DOM,
    h = k._isElementNode;
    a.mix(k, {
        parent: function(c, i) {
            return g(c, i, "parentNode",
            function(n) {
                return n.nodeType != 11
            })
        },
        next: function(c, i) {
            return g(c, i, "nextSibling")
        },
        prev: function(c, i) {
            return g(c, i, "previousSibling")
        },
        siblings: function(c, i) {
            return j(c, i, true)
        },
        children: function(c, i) {
            return j(c, i)
        },
        contains: function(c, i) {
            var n = false;
            if ((c = a.get(c)) && (i = a.get(i))) if (c.contains) return c.contains(i);
            else if (c.compareDocumentPosition) return !! (c.compareDocumentPosition(i) & 16);
            else for (; ! n && (i = i.parentNode);) n = i == c;
            return n
        }
    })
});
KISSY.add("dom-create",
function(a, l) {
    function g(x, y) {
        p(x) && a.isPlainObject(y) && n.attr(x, y);
        return x
    }
    function j(x, y) {
        var B = null,
        C;
        if (x && (x.push || x.item) && x[0]) {
            y = y || x[0].ownerDocument;
            B = y.createDocumentFragment();
            if (x.item) x = a.makeArray(x);
            y = 0;
            for (C = x.length; y < C; y++) B.appendChild(x[y])
        } else a.log("Unable to convert " + x + " to fragment.");
        return B
    }
    function k(x) {
        var y = x.cloneNode(true);
        if (m.ie < 8) y.innerHTML = x.innerHTML;
        return y
    }
    function h(x, y, B, C) {
        if (B) {
            var D = a.guid("ks-tmp-"),
            G = new RegExp(b);
            y += '<span id="' + D + '"></span>';
            a.available(D,
            function() {
                var F = a.get("head"),
                E,
                H,
                I,
                J,
                L,
                K;
                for (G.lastIndex = 0; E = G.exec(y);) if ((I = (H = E[1]) ? H.match(o) : false) && I[2]) {
                    E = i.createElement("script");
                    E.src = I[2];
                    if ((J = H.match(q)) && J[2]) E.charset = J[2];
                    E.async = true;
                    F.appendChild(E)
                } else if ((K = E[2]) && K.length > 0) a.globalEval(K); (L = i.getElementById(D)) && n.remove(L);
                a.isFunction(C) && C()
            });
            c(x, y)
        } else {
            c(x, y);
            a.isFunction(C) && C()
        }
    }
    function c(x, y) {
        y = (y + "").replace(b, "");
        try {
            x.innerHTML = y
        } catch(B) {
            for (; x.firstChild;) x.removeChild(x.firstChild);
            y && x.appendChild(n.create(y))
        }
    }
    var i = document,
    n = a.DOM,
    m = a.UA,
    d = m.ie,
    f = n._isSupportedNode,
    p = n._isElementNode,
    r = n._isKSNode,
    u = i.createElement("div"),
    t = /<(\w+)/,
    b = /<script([^>]*)>([\s\S]*?)<\/script>/ig,
    e = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
    o = /\ssrc=(['"])(.*?)\1/i,
    q = /\scharset=(['"])(.*?)\1/i;
    a.mix(n, {
        create: function(x, y, B) {
            if (f(x)) return k(x);
            if (r(x)) return k(x[0]);
            if (! (x = a.trim(x))) return null;
            var C = null;
            C = n._creators;
            var D, G = "div",
            F;
            if (D = e.exec(x)) C = (B || i).createElement(D[1]);
            else {
                if ((D = t.exec(x)) && (F = D[1]) && a.isFunction(C[F = F.toLowerCase()])) G = F;
                x = C[G](x, B).childNodes;
                C = x.length === 1 ? x[0].parentNode.removeChild(x[0]) : j(x, B || i)
            }
            return g(C, y)
        },
        _creators: {
            div: function(x, y) {
                y = y ? y.createElement("div") : u;
                y.innerHTML = x;
                return y
            }
        },
        html: function(x, y, B, C) {
            if (y === l) {
                x = a.get(x);
                if (p(x)) return x.innerHTML
            } else a.each(a.query(x),
            function(D) {
                p(D) && h(D, y, B, C)
            })
        },
        remove: function(x) {
            a.each(a.query(x),
            function(y) {
                p(y) && y.parentNode && y.parentNode.removeChild(y)
            })
        }
    });
    if (m.gecko || d) {
        var v = n._creators,
        s = n.create,
        w = /(?:\/(?:thead|tfoot|caption|col|colgroup)>)+\s*<tbody/,
        z = {
            option: "select",
            td: "tr",
            tr: "tbody",
            tbody: "table",
            col: "colgroup",
            legend: "fieldset"
        };
        for (var A in z)(function(x) {
            v[A] = function(y, B) {
                return s("<" + x + ">" + y + "</" + x + ">", null, B)
            }
        })(z[A]);
        if (d) {
            v.script = function(x, y) {
                y = y ? y.createElement("div") : u;
                y.innerHTML = "-" + x;
                y.removeChild(y.firstChild);
                return y
            };
            if (d < 8) v.tbody = function(x, y) {
                y = s("<table>" + x + "</table>", null, y);
                var B = y.children.tags("tbody")[0];
                y.children.length > 1 && B && !w.test(x) && B.parentNode.removeChild(B);
                return y
            }
        }
        a.mix(v, {
            optgroup: v.option,
            th: v.td,
            thead: v.tbody,
            tfoot: v.tbody,
            caption: v.tbody,
            colgroup: v.tbody
        })
    }
});
KISSY.add("dom-insertion",
function(a) {
    a.mix(a.DOM, {
        insertBefore: function(l, g) {
            if ((l = a.get(l)) && (g = a.get(g)) && g.parentNode) g.parentNode.insertBefore(l, g);
            return l
        },
        insertAfter: function(l, g) {
            if ((l = a.get(l)) && (g = a.get(g)) && g.parentNode) g.nextSibling ? g.parentNode.insertBefore(l, g.nextSibling) : g.parentNode.appendChild(l);
            return l
        }
    })
});
KISSY.add("event",
function(a, l) {
    function g(b, e, o, q, v) {
        if (a.isString(e)) e = a.query(e);
        if (a.isArray(e)) {
            a.each(e,
            function(s) {
                t[b](s, o, q, v)
            });
            return true
        }
        if ((o = a.trim(o)) && o.indexOf(p) > 0) {
            a.each(o.split(p),
            function(s) {
                t[b](e, s, q, v)
            });
            return true
        }
    }
    function j(b) {
        return c(b) ? b[f] : -1
    }
    function k(b, e) {
        if (!c(b)) return a.error("Text or comment node is not valid event target.");
        try {
            b[f] = e
        } catch(o) {
            a.error(o)
        }
    }
    function h(b) {
        try {
            b[f] = l;
            delete b[f]
        } catch(e) {}
    }
    function c(b) {
        return b && b.nodeType !== 3 && b.nodeType !== 8
    }
    var i = window,
    n = document,
    m = n.addEventListener ?
    function(b, e, o, q) {
        b.addEventListener && b.addEventListener(e, o, !!q)
    }: function(b, e, o) {
        b.attachEvent && b.attachEvent("on" + e, o)
    },
    d = n.removeEventListener ?
    function(b, e, o, q) {
        b.removeEventListener && b.removeEventListener(e, o, !!q)
    }: function(b, e, o) {
        b.detachEvent && b.detachEvent("on" + e, o)
    },
    f = "ksEventTargetId",
    p = " ",
    r = a.now(),
    u = {},
    t = {
        EVENT_GUID: f,
        special: {},
        add: function(b, e, o, q) {
            if (!g("add", b, e, o, q)) {
                var v = j(b),
                s,
                w;
                if (! (v === -1 || !e || !a.isFunction(o))) {
                    if (!v) {
                        k(b, v = r++);
                        u[v] = {
                            target: b,
                            events: {}
                        }
                    }
                    w = u[v].events;
                    s = !b.isCustomEventTarget && t.special[e] || {};
                    if (!w[e]) {
                        v = function(z, A) {
                            if (!z || !z.fixed) {
                                z = new a.EventObject(b, z, e);
                                a.isPlainObject(A) && a.mix(z, A)
                            }
                            s.setup && s.setup(z);
                            return (s.handle || t._handle)(b, z, w[e].listeners)
                        };
                        w[e] = {
                            handle: v,
                            listeners: []
                        };
                        if (b.isCustomEventTarget) b._addEvent && b._addEvent(e, v);
                        else m(b, s.fix || e, v, s.capture)
                    }
                    w[e].listeners.push({
                        fn: o,
                        scope: q
                    })
                }
            }
        },
        remove: function(b, e, o) {
            if (!g("remove", b, e, o)) {
                var q = j(b),
                v,
                s,
                w,
                z,
                A,
                x;
                if (q !== -1) if (q && (v = u[q])) if (v.target === b) {
                    v = v.events || {};
                    if (s = v[e]) {
                        w = s.listeners;
                        A = w.length;
                        if (a.isFunction(o) && A && a.inArray(o, w)) {
                            x = [];
                            for (z = 0; z < A; ++z) o !== w[z] && x.push(w[z]);
                            A = x.length
                        }
                        if (o === l || A === 0) {
                            if (b.isCustomEventTarget) b._addEvent && b._removeEvent(e, s.handle);
                            else d(b, e, s.handle);
                            delete v[e]
                        }
                    }
                    if (e === l || a.isEmptyObject(v)) {
                        for (e in v) t.remove(b, e);
                        delete u[q];
                        h(b)
                    }
                }
            }
        },
        _handle: function(b, e, o) {
            o = o.slice(0);
            for (var q, v = 0,
            s = o.length; v < s; ++v) {
                q = o[v];
                q = q.fn.call(q.scope || b, e);
                if (q === false && b.isCustomEventTarget || e.isImmediatePropagationStopped) break
            }
            return q
        },
        _getCache: function(b) {
            return u[b]
        },
        _simpleAdd: m,
        _simpleRemove: d
    };
    t.on = t.add;
    a.Event = t;
    i.attachEvent && !i.addEventListener && i.attachEvent("onunload",
    function() {
        var b, e;
        for (b in u) if (e = u[b].target) try {
            t.remove(e)
        } catch(o) {}
    })
});
KISSY.add("event-object",
function(a, l) {
    function g(h, c, i) {
        this.currentTarget = h;
        this.originalEvent = c || {};
        if (c) {
            this.type = c.type;
            this._fix()
        } else {
            this.type = i;
            this.target = h
        }
        this.fixed = true
    }
    var j = document,
    k = "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(" ");
    a.augment(g, {
        _fix: function() {
            var h = this.originalEvent,
            c = k.length,
            i, n = this.currentTarget;
            for (n = n.nodeType === 9 ? n: n.ownerDocument || j; c;) {
                i = k[--c];
                this[i] = h[i]
            }
            if (!this.target) this.target = this.srcElement || j;
            if (this.target.nodeType === 3) this.target = this.target.parentNode;
            if (!this.relatedTarget && this.fromElement) this.relatedTarget = this.fromElement === this.target ? this.toElement: this.fromElement;
            if (this.pageX === l && this.clientX !== l) {
                h = n.documentElement;
                c = n.body;
                this.pageX = this.clientX + (h && h.scrollLeft || c && c.scrollLeft || 0) - (h && h.clientLeft || c && c.clientLeft || 0);
                this.pageY = this.clientY + (h && h.scrollTop || c && c.scrollTop || 0) - (h && h.clientTop || c && c.clientTop || 0)
            }
            if (this.which === l) this.which = this.charCode !== l ? this.charCode: this.keyCode;
            if (this.metaKey === l) this.metaKey = this.ctrlKey;
            if (!this.which && this.button !== l) this.which = this.button & 1 ? 1 : this.button & 2 ? 3 : this.button & 4 ? 2 : 0
        },
        preventDefault: function() {
            var h = this.originalEvent;
            if (h.preventDefault) h.preventDefault();
            else h.returnValue = false;
            this.isDefaultPrevented = true
        },
        stopPropagation: function() {
            var h = this.originalEvent;
            if (h.stopPropagation) h.stopPropagation();
            else h.cancelBubble = true;
            this.isPropagationStopped = true
        },
        stopImmediatePropagation: function() {
            var h = this.originalEvent;
            h.stopImmediatePropagation ? h.stopImmediatePropagation() : this.stopPropagation();
            this.isImmediatePropagationStopped = true
        },
        halt: function(h) {
            h ? this.stopImmediatePropagation() : this.stopPropagation();
            this.preventDefault()
        }
    });
    a.EventObject = g
});
KISSY.add("event-target",
function(a, l) {
    var g = a.Event,
    j = g.EVENT_GUID;
    a.EventTarget = {
        isCustomEventTarget: true,
        fire: function(k, h) {
            if ((k = ((g._getCache(this[j] || -1) || {}).events || {})[k]) && a.isFunction(k.handle)) return k.handle(l, h)
        },
        on: function(k, h, c) {
            g.add(this, k, h, c)
        },
        detach: function(k, h) {
            g.remove(this, k, h)
        }
    }
});
KISSY.add("event-mouseenter",
function(a) {
    var l = a.Event;
    a.UA.ie || a.each([{
        name: "mouseenter",
        fix: "mouseover"
    },
    {
        name: "mouseleave",
        fix: "mouseout"
    }],
    function(g) {
        l.special[g.name] = {
            fix: g.fix,
            setup: function(j) {
                j.type = g.name
            },
            handle: function(j, k, h) {
                var c = k.relatedTarget;
                try {
                    for (; c && c !== j;) c = c.parentNode;
                    c !== j && l._handle(j, k, h)
                } catch(i) {}
            }
        }
    })
});
KISSY.add("event-focusin",
function(a) {
    var l = a.Event;
    document.addEventListener && a.each([{
        name: "focusin",
        fix: "focus"
    },
    {
        name: "focusout",
        fix: "blur"
    }],
    function(g) {
        l.special[g.name] = {
            fix: g.fix,
            capture: true,
            setup: function(j) {
                j.type = g.name
            }
        }
    })
});
KISSY.add("node",
function(a) {
    function l(j, k, h) {
        var c;
        if (! (this instanceof l)) return new l(j, k, h);
        if (j) {
            if (g._isSupportedNode(j)) c = j;
            else if (typeof j === "string") c = g.create(j, k, h);
            this[0] = c
        } else this.length = 0
    }
    var g = a.DOM;
    l.TYPE = "-ks-Node";
    a.augment(l, {
        length: 1,
        getDOMNode: function() {
            return this[0]
        },
        nodeType: l.TYPE
    });
    a.one = function(j, k) {
        return (j = a.get(j, k)) ? new l(j) : null
    };
    a.Node = l
});
KISSY.add("nodelist",
function(a) {
    function l(k) {
        if (! (this instanceof l)) return new l(k);
        j.push.apply(this, k || [])
    }
    var g = a.DOM,
    j = Array.prototype;
    a.mix(l.prototype, {
        length: 0,
        item: function(k) {
            var h = null;
            if (g._isElementNode(this[k])) h = new a.Node(this[k]);
            return h
        },
        getDOMNodes: function() {
            return j.slice.call(this)
        },
        each: function(k, h) {
            for (var c = this.length,
            i = 0,
            n; i < c; ++i) {
                n = new a.Node(this[i]);
                k.call(h || n, n, i, this)
            }
            return this
        }
    });
    a.all = function(k, h) {
        return new l(a.query(k, h, true))
    };
    a.NodeList = l
});
KISSY.add("node-attach",
function(a, l) {
    function g(r, arguments, u, t) {
        var b = [this[r ? m: n]()].concat(a.makeArray(arguments));
        if (arguments[u] === l) return t.apply(k, b);
        else {
            t.apply(k, b);
            return this
        }
    }
    function j(r, u) {
        a.each(r,
        function(t) {
            a.each([c, i],
            function(b, e) {
                b[t] = function(o) {
                    switch (u) {
                    case d:
                        return function() {
                            return g.call(this, e, arguments, 1, o)
                        };
                    case f:
                        return function() {
                            return g.call(this, e, arguments, 0, o)
                        };
                    case p:
                        return function() {
                            var q = this[e ? m: n]();
                            return (q = o.apply(k, [q].concat(a.makeArray(arguments)))) ? new(a[a.isArray(q) ? "NodeList": "Node"])(q) : null
                        };
                    default:
                        return function() {
                            var q = this[e ? m: n]();
                            q = o.apply(k, [q].concat(a.makeArray(arguments)));
                            return q === l ? this: q
                        }
                    }
                } (k[t])
            })
        })
    }
    var k = a.DOM,
    h = a.Event,
    c = a.Node.prototype,
    i = a.NodeList.prototype,
    n = "getDOMNode",
    m = n + "s",
    d = 1,
    f = 2,
    p = 4;
    a.mix(c, {
        one: function(r) {
            return a.one(r, this[0])
        },
        all: function(r) {
            return a.all(r, this[0])
        }
    });
    j(["hasClass", "addClass", "removeClass", "replaceClass", "toggleClass"]);
    j(["attr", "removeAttr"], d);
    j(["val", "text"], f);
    j(["css"], d);
    j(["width", "height"], f);
    j(["offset"], f);
    j(["scrollIntoView"]);
    j(["parent", "next", "prev", "siblings", "children"], p);
    j(["contains"]);
    j(["html"], f);
    j(["remove"]);
    a.each(["insertBefore", "insertAfter"],
    function(r) {
        c[r] = function(u) {
            k[r].call(k, this[0], u);
            return this
        }
    });
    a.each([c, i],
    function(r) {
        a.mix(r, {
            append: function(u) {
                u && a.each(this,
                function(t) {
                    t.appendChild(k.create(u))
                });
                return this
            },
            appendTo: function(u) {
                if ((u = a.get(u)) && u.appendChild) a.each(this,
                function(t) {
                    u.appendChild(t)
                });
                return this
            }
        })
    });
    a.each([c, i],
    function(r) {
        a.mix(r, a.EventTarget);
        r._addEvent = function(u, t) {
            for (var b = 0,
            e = this.length; b < e; b++) h._simpleAdd(this[b], u, t)
        };
        r._removeEvent = function(u, t) {
            for (var b = 0,
            e = this.length; b < e; b++) h._simpleRemove(this[b], u, t)
        };
        delete r.fire
    })
});
KISSY.add("ajax",
function(a) {
    var l = document,
    g = l.createElement("script").readyState ?
    function(j, k) {
        j.onreadystatechange = function() {
            var h = j.readyState;
            if (h === "loaded" || h === "complete") {
                j.onreadystatechange = null;
                k.call(this)
            }
        }
    }: function(j, k) {
        j.onload = k
    };
    a.mix(a, {
        getScript: function(j, k, h) {
            var c = a.get("head") || l.documentElement,
            i = l.createElement("script");
            i.src = j;
            if (h) i.charset = h;
            i.async = true;
            a.isFunction(k) && g(i, k);
            c.insertBefore(i, c.firstChild)
        }
    })
});
KISSY.add("cookie",
function(a) {
    function l(h) {
        return a.isString(h) && h !== ""
    }
    var g = document,
    j = encodeURIComponent,
    k = decodeURIComponent;
    a.Cookie = {
        get: function(h) {
            var c;
            if (l(h)) if (h = g.cookie.match("(?:^| )" + h + "(?:(?:=([^;]*))|;|$)")) c = h[1] ? k(h[1]) : "";
            return c
        },
        set: function(h, c, i, n, m, d) {
            c = j(c);
            var f = i;
            if (typeof f === "number") {
                f = new Date;
                f.setTime(f.getTime() + i * 864E5)
            }
            if (f instanceof Date) c += "; expires=" + f.toUTCString();
            if (l(n)) c += "; domain=" + n;
            if (l(m)) c += "; path=" + m;
            if (d) c += "; secure";
            g.cookie = h + "=" + c
        },
        remove: function(h, c, i, n) {
            this.set(h, "", 0, c, i, n)
        }
    }
});
KISSY.add("json",
function(a) {
    function l(d) {
        return d < 10 ? "0" + d: d
    }
    function g(d) {
        h.lastIndex = 0;
        return h.test(d) ? '"' + d.replace(h,
        function(f) {
            var p = n[f];
            return typeof p === "string" ? p: "\\u" + ("0000" + f.charCodeAt(0).toString(16)).slice( - 4)
        }) + '"': '"' + d + '"'
    }
    function j(d, f) {
        var p, r, u = c,
        t, b = f[d];
        if (b && typeof b === "object" && typeof b.toJSON === "function") b = b.toJSON(d);
        if (typeof m === "function") b = m.call(f, d, b);
        switch (typeof b) {
        case "string":
            return g(b);
        case "number":
            return isFinite(b) ? String(b) : "null";
        case "boolean":
        case "null":
            return String(b);
        case "object":
            if (!b) return "null";
            c += i;
            t = [];
            if (Object.prototype.toString.apply(b) === "[object Array]") {
                r = b.length;
                for (d = 0; d < r; d += 1) t[d] = j(d, b) || "null";
                f = t.length === 0 ? "[]": c ? "[\n" + c + t.join(",\n" + c) + "\n" + u + "]": "[" + t.join(",") + "]";
                c = u;
                return f
            }
            if (m && typeof m === "object") {
                r = m.length;
                for (d = 0; d < r; d += 1) {
                    p = m[d];
                    if (typeof p === "string") if (f = j(p, b)) t.push(g(p) + (c ? ": ": ":") + f)
                }
            } else for (p in b) if (Object.hasOwnProperty.call(b, p)) if (f = j(p, b)) t.push(g(p) + (c ? ": ": ":") + f);
            f = t.length === 0 ? "{}": c ? "{\n" + c + t.join(",\n" + c) + "\n" + u + "}": "{" + t.join(",") + "}";
            c = u;
            return f
        }
    }
    a = a.JSON = window.JSON || {};
    if (typeof Date.prototype.toJSON !== "function") {
        Date.prototype.toJSON = function() {
            return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + l(this.getUTCMonth() + 1) + "-" + l(this.getUTCDate()) + "T" + l(this.getUTCHours()) + ":" + l(this.getUTCMinutes()) + ":" + l(this.getUTCSeconds()) + "Z": null
        };
        String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function() {
            return this.valueOf()
        }
    }
    var k = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
    h = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
    c, i, n = {
        "\u0008": "\\b",
        "\t": "\\t",
        "\n": "\\n",
        "\u000c": "\\f",
        "\r": "\\r",
        '"': '\\"',
        "\\": "\\\\"
    },
    m;
    if (typeof a.stringify !== "function") a.stringify = function(d, f, p) {
        var r;
        i = c = "";
        if (typeof p === "number") for (r = 0; r < p; r += 1) i += " ";
        else if (typeof p === "string") i = p;
        if ((m = f) && typeof f !== "function" && (typeof f !== "object" || typeof f.length !== "number")) throw new Error("JSON.stringify");
        return j("", {
            "": d
        })
    };
    if (typeof a.parse !== "function") a.parse = function(d, f) {
        function p(r, u) {
            var t, b, e = r[u];
            if (e && typeof e === "object") for (t in e) if (Object.hasOwnProperty.call(e, t)) {
                b = p(e, t);
                if (b !== undefined) e[t] = b;
                else delete e[t]
            }
            return f.call(r, u, e)
        }
        d = String(d);
        k.lastIndex = 0;
        if (k.test(d)) d = d.replace(k,
        function(r) {
            return "\\u" + ("0000" + r.charCodeAt(0).toString(16)).slice( - 4)
        });
        if (/^[\],:{}\s]*$/.test(d.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) {
            d = eval("(" + d + ")");
            return typeof f === "function" ? p({
                "": d
            },
            "") : d
        }
        throw new SyntaxError("JSON.parse");
    }
});
KISSY.add("attribute-base",
function(a, l) {
    function g(c) {
        return c.charAt(0).toUpperCase() + c.substring(1)
    }
    function j() {
        this._state = {};
        this._values = {}
    }
    function k(c) {
        j.call(this);
        this._initAttr();
        this._initial(c)
    }
    var h = a.EventTarget;
    a.augment(j, {
        addAttribute: function(c, i) {
            this._state[c] = i
        },
        set: function(c, i) {
            var n = this.get(c);
            if (n !== i) if (this.fire("before" + g(c) + "Change", {
                preVal: n,
                newVal: i
            }) !== false) {
                this._set.apply(this, arguments);
                this.fire("after" + g(c) + "Change", {
                    preVal: n,
                    newVal: this._values[c]
                })
            }
        },
        _set: function(c, i) {
            var n = this._state[c],
            m = l;
            if (n = n && n.setter) m = n.apply(this, [i]);
            if (m !== l) i = m;
            this._values[c] = i
        },
        _getDefaultValue: function(c) {
            if (c = this._state[c]) {
                if (c.valueFn) {
                    c.value = c.valueFn.call(this);
                    delete c.valueFn
                }
                return c.value
            }
        },
        get: function(c) {
            var i = this._state[c];
            i = i && i.getter;
            c = c in this._values ? this._values[c] : this._getDefaultValue(c);
            if (i) c = i.call(this, c);
            return c
        },
        reset: function(c) {
            if (c !== l) this.set(c, this._getDefaultValue(c));
            else for (c in this._state) this._state.hasOwnProperty(c) && this.reset(c)
        }
    });
    a.augment(k, h, j, {
        constructor: k,
        _initAttr: function() {
            for (var c = this.constructor; c;) {
                if (c.ATTRS) for (var i in c.ATTRS) c.ATTRS.hasOwnProperty(i) && this.addAttribute(i, c.ATTRS[i]);
                c = c.superclass ? c.superclass.constructor: null
            }
        },
        _initial: function(c) {
            for (var i in c) c.hasOwnProperty(i) && this._set(i, c[i])
        }
    });
    a.Base = k
});
KISSY.add("datalazyload",
function(a, l) {
    function g(d, f) {
        if (! (this instanceof g)) return new g(d, f);
        if (f === l) {
            f = d;
            d = [c]
        }
        a.isArray(d) || (d = [a.get(d) || c]);
        this.containers = d;
        this.config = a.merge(m, f);
        this._init()
    }
    var j = a.DOM,
    k = a.Event,
    h = window,
    c = document,
    i = "scroll",
    n = "resize",
    m = {
        mod: "manual",
        diff: "default",
        placeholder: "none"
    };
    a.augment(g, {
        _init: function() {
            this.threshold = this._getThreshold();
            this._filterItems();
            this._getItemsLength() && this._initLoadEvent()
        },
        _filterItems: function() {
            var d = this.containers,
            f, p, r, u = [],
            t = [];
            f = 0;
            for (p = d.length; f < p; ++f) {
                r = a.query("img", d[f]);
                u = u.concat(a.filter(r, this._filterImg, this));
                r = a.query("textarea", d[f]);
                t = t.concat(a.filter(r, this._filterArea, this))
            }
            this.images = u;
            this.areas = t
        },
        _filterImg: function(d) {
            var f = d.getAttribute("data-ks-lazyload"),
            p = this.threshold,
            r = this.config.placeholder;
            if (this.config.mod === "manual") {
                if (f) {
                    if (r !== "none") d.src = r;
                    return true
                }
            } else if (j.offset(d).top > p && !f) {
                j.attr(d, "data-ks-lazyload", d.src);
                if (r !== "none") d.src = r;
                else d.removeAttribute("src");
                return true
            }
        },
        _filterArea: function(d) {
            return j.hasClass(d, "ks-datalazyload")
        },
        _initLoadEvent: function() {
            function d() {
                p || (p = setTimeout(function() {
                    f();
                    p = null
                },
                100))
            }
            function f() {
                r._loadItems();
                if (r._getItemsLength() === 0) {
                    k.remove(h, i, d);
                    k.remove(h, n, d)
                }
            }
            var p, r = this;
            k.on(h, i, d);
            k.on(h, n,
            function() {
                r.threshold = r._getThreshold();
                d()
            });
            r._getItemsLength() && a.ready(function() {
                f()
            })
        },
        _loadItems: function() {
            this._loadImgs();
            this._loadAreas()
        },
        _loadImgs: function() {
            this.images = a.filter(this.images, this._loadImg, this)
        },
        _loadImg: function(d) {
            var f = this.threshold + j.scrollTop();
            if (j.offset(d).top <= f) this._loadImgSrc(d);
            else return true
        },
        _loadImgSrc: function(d, f) {
            f = f || "data-ks-lazyload";
            var p = d.getAttribute(f);
            if (p && d.src != p) {
                d.src = p;
                d.removeAttribute(f)
            }
        },
        _loadAreas: function() {
            this.areas = a.filter(this.areas, this._loadArea, this)
        },
        _loadArea: function(d) {
            var f = j.css(d, "display") === "none";
            if (j.offset(f ? d.parentNode: d).top <= this.threshold + j.scrollTop()) this._loadAreaData(d.parentNode, d);
            else return true
        },
        _loadAreaData: function(d, f) {
            f.style.display = "none";
            f.className = "";
            var p = j.create("<div>");
            d.insertBefore(p, f);
            j.html(p, f.value, true)
        },
        _getThreshold: function() {
            var d = this.config.diff,
            f = j.viewportHeight();
            return d === "default" ? 2 * f: f + d
        },
        _getItemsLength: function() {
            return this.images.length + this.areas.length
        },
        loadCustomLazyData: function(d, f) {
            var p = this,
            r, u;
            a.isArray(d) || (d = [a.get(d)]);
            a.each(d,
            function(t) {
                switch (f) {
                case "img-src":
                    u = t.nodeName === "IMG" ? [t] : a.query("img", t);
                    a.each(u,
                    function(b) {
                        p._loadImgSrc(b, "data-ks-lazyload-custom")
                    });
                    break;
                default:
                    (r = a.get("textarea", t)) && j.hasClass(r, "ks-datalazyload-custom") && p._loadAreaData(t, r)
                }
            })
        }
    });
    a.mix(g, g.prototype, true, ["loadCustomLazyData", "_loadImgSrc", "_loadAreaData"]);
    a.DataLazyload = g
});
KISSY.add("switchable",
function(a, l) {
    function g(h, c) {
        c = c || {};
        if (! ("markupType" in c)) if (c.panelCls) c.markupType = 1;
        else if (c.panels) c.markupType = 2;
        c = a.merge(g.Config, c);
        this.container = a.get(h);
        this.config = c;
        this.activeIndex = c.activeIndex;
        this._init()
    }
    var j = a.DOM,
    k = a.Event;
    g.Config = {
        markupType: 0,
        navCls: "ks-switchable-nav",
        contentCls: "ks-switchable-content",
        triggerCls: "ks-switchable-trigger",
        panelCls: "ks-switchable-panel",
        triggers: [],
        panels: [],
        hasTriggers: true,
        triggerType: "mouse",
        delay: 0.1,
        activeIndex: 0,
        activeTriggerCls: "ks-active",
        steps: 1,
        viewSize: []
    };
    g.Plugins = [];
    a.augment(g, a.EventTarget, {
        _init: function() {
            var h = this,
            c = h.config;
            if (h.fire("beforeInit") !== false) {
                h._parseMarkup();
                c.hasTriggers && h._bindTriggers();
                a.each(g.Plugins,
                function(i) {
                    i.init && i.init(h)
                });
                h.fire("init")
            }
        },
        _parseMarkup: function() {
            var h = this.container,
            c = this.config,
            i, n = [],
            m = [];
            switch (c.markupType) {
            case 0:
                if (i = a.get("." + c.navCls, h)) n = j.children(i);
                i = a.get("." + c.contentCls, h);
                m = j.children(i);
                break;
            case 1:
                n = a.query("." + c.triggerCls, h);
                m = a.query("." + c.panelCls, h);
                break;
            case 2:
                n = c.triggers;
                m = c.panels;
                break
            }
            h = m.length;
            this.length = h / c.steps;
            if (c.hasTriggers && h > 0 && n.length === 0) n = this._generateTriggersMarkup(this.length);
            this.triggers = a.makeArray(n);
            this.panels = a.makeArray(m);
            this.content = i || m[0].parentNode
        },
        _generateTriggersMarkup: function(h) {
            var c = this.config,
            i = j.create("<ul>"),
            n,
            m;
            i.className = c.navCls;
            for (m = 0; m < h; m++) {
                n = j.create("<li>");
                if (m === this.activeIndex) n.className = c.activeTriggerCls;
                n.innerHTML = m + 1;
                i.appendChild(n)
            }
            this.container.appendChild(i);
            return j.children(i)
        },
        _bindTriggers: function() {
            var h = this,
            c = h.config,
            i = h.triggers,
            n, m, d = i.length;
            for (m = 0; m < d; m++)(function(f) {
                n = i[f];
                k.on(n, "click focus",
                function() {
                    h._onFocusTrigger(f)
                });
                if (c.triggerType === "mouse") {
                    k.on(n, "mouseenter",
                    function() {
                        h._onMouseEnterTrigger(f)
                    });
                    k.on(n, "mouseleave",
                    function() {
                        h._onMouseLeaveTrigger(f)
                    })
                }
            })(m)
        },
        _onFocusTrigger: function(h) {
            if (this._triggerIsValid()) {
                this._cancelSwitchTimer();
                this.switchTo(h)
            }
        },
        _onMouseEnterTrigger: function(h) {
            var c = this;
            if (c._triggerIsValid()) c.switchTimer = a.later(function() {
                c.switchTo(h)
            },
            c.config.delay * 1E3)
        },
        _onMouseLeaveTrigger: function() {
            this._cancelSwitchTimer()
        },
        _triggerIsValid: function(h) {
            return this.activeIndex !== h
        },
        _cancelSwitchTimer: function() {
            if (this.switchTimer) {
                this.switchTimer.cancel();
                this.switchTimer = l
            }
        },
        switchTo: function(h, c) {
            var i = this.config,
            n = this.triggers,
            m = this.panels,
            d = this.activeIndex,
            f = i.steps,
            p = d * f,
            r = h * f;
            if (!this._triggerIsValid()) return this;
            if (this.fire("beforeSwitch", {
                toIndex: h
            }) === false) return this;
            if (i.hasTriggers) this._switchTrigger(d > -1 ? n[d] : null, n[h]);
            if (c === l) c = h > d ? "forward": "backward";
            this._switchView(m.slice(p, p + f), m.slice(r, r + f), h, c);
            this.activeIndex = h;
            return this
        },
        _switchTrigger: function(h, c) {
            var i = this.config.activeTriggerCls;
            h && j.removeClass(h, i);
            j.addClass(c, i)
        },
        _switchView: function(h, c, i) {
            j.css(h, "display", "none");
            j.css(c, "display", "block");
            this._fireOnSwitch(i)
        },
        _fireOnSwitch: function(h) {
            this.fire("switch", {
                currentIndex: h
            })
        },
        prev: function() {
            var h = this.activeIndex;
            this.switchTo(h > 0 ? h - 1 : this.length - 1, "backward")
        },
        next: function() {
            var h = this.activeIndex;
            this.switchTo(h < this.length - 1 ? h + 1 : 0, "forward")
        }
    });
    a.Switchable = g
});
KISSY.add("switchable-autoplay",
function(a, l) {
    var g = a.Event,
    j = a.Switchable;
    a.mix(j.Config, {
        autoplay: false,
        interval: 5,
        pauseOnHover: true
    });
    j.Plugins.push({
        name: "autoplay",
        init: function(k) {
            function h() {
                n = a.later(function() {
                    k.paused || k.switchTo(k.activeIndex < k.length - 1 ? k.activeIndex + 1 : 0, "forward")
                },
                i, true)
            }
            var c = k.config,
            i = c.interval * 1E3,
            n;
            if (c.autoplay) {
                if (c.pauseOnHover) {
                    g.on(k.container, "mouseenter",
                    function() {
                        if (n) {
                            n.cancel();
                            n = l
                        }
                        k.paused = true
                    });
                    g.on(k.container, "mouseleave",
                    function() {
                        k.paused = false;
                        h()
                    })
                }
                h()
            }
        }
    })
});
KISSY.add("switchable-effect",
function(a, l) {
    var g = a.DOM,
    j = a.Anim,
    k = a.Switchable,
    h;
    a.mix(k.Config, {
        effect: "none",
        duration: 0.5,
        easing: "easeNone"
    });
    k.Effects = {
        none: function(c, i, n) {
            g.css(c, "display", "none");
            g.css(i, "display", "block");
            n()
        },
        fade: function(c, i, n) {
            c.length !== 1 && a.error("fade effect only supports steps == 1.");
            var m = this,
            d = m.config,
            f = c[0],
            p = i[0];
            m.anim && m.anim.stop(true);
            g.css(p, "opacity", 1);
            m.anim = (new j(f, {
                opacity: 0
            },
            d.duration, d.easing,
            function() {
                m.anim = l;
                g.css(p, "z-index", 9);
                g.css(f, "z-index", 1);
                n()
            })).run()
        },
        scroll: function(c, i, n, m) {
            var d = this;
            c = d.config;
            i = c.effect === "scrollx";
            var f = {};
            f[i ? "left": "top"] = -(d.viewSize[i ? 0 : 1] * m) + "px";
            d.anim && d.anim.stop();
            d.anim = (new j(d.content, f, c.duration, c.easing,
            function() {
                d.anim = l;
                n()
            })).run()
        }
    };
    h = k.Effects;
    h.scrollx = h.scrolly = h.scroll;
    k.Plugins.push({
        name: "effect",
        init: function(c) {
            var i = c.config,
            n = i.effect,
            m = c.panels,
            d = c.content,
            f = i.steps,
            p = c.activeIndex,
            r = m.length;
            c.viewSize = [i.viewSize[0] || m[0].offsetWidth * f, i.viewSize[1] || m[0].offsetHeight * f];
            if (n !== "none") {
                a.each(m,
                function(e) {
                    g.css(e, "display", "block")
                });
                switch (n) {
                case "scrollx":
                case "scrolly":
                    g.css(d, "position", "absolute");
                    g.css(d.parentNode, "position", "relative");
                    if (n === "scrollx") {
                        g.css(m, "float", "left");
                        g.width(d, c.viewSize[0] * (r / f))
                    }
                    break;
                case "fade":
                    var u = p * f,
                    t = u + f - 1,
                    b;
                    a.each(m,
                    function(e, o) {
                        b = o >= u && o <= t;
                        g.css(e, {
                            opacity: b ? 1 : 0,
                            position: "absolute",
                            zIndex: b ? 9 : 1
                        })
                    });
                    break
                }
            }
        }
    });
    a.augment(k, {
        _switchView: function(c, i, n, m) {
            var d = this,
            f = d.config.effect; (a.isFunction(f) ? f: h[f]).call(d, c, i,
            function() {
                d._fireOnSwitch(n)
            },
            n, m)
        }
    })
});
KISSY.add("switchable-circular",
function(a, l) {
    function g(b, e, o, q, v) {
        var s = this;
        b = s.config;
        e = s.length;
        var w = s.activeIndex,
        z = b.scrollType === u,
        A = z ? n: m,
        x = s.viewSize[z ? 0 : 1];
        z = -x * q;
        var y = {},
        B, C = v === r;
        if (B = C && w === 0 && q === e - 1 || v === p && w === e - 1 && q === 0) z = j.call(s, s.panels, q, C, A, x);
        y[A] = z + f;
        s.anim && s.anim.stop();
        s.anim = (new a.Anim(s.content, y, b.duration, b.easing,
        function() {
            B && k.call(s, s.panels, q, C, A, x);
            s.anim = l;
            o()
        })).run()
    }
    function j(b, e, o, q, v) {
        var s = this.config.steps;
        e = this.length;
        var w = o ? e - 1 : 0,
        z = (w + 1) * s;
        for (s = w * s; s < z; s++) {
            h.css(b[s], c, i);
            h.css(b[s], q, (o ? -1 : 1) * v * e)
        }
        return o ? v: -v * e
    }
    function k(b, e, o, q, v) {
        var s = this.config.steps;
        e = this.length;
        var w = o ? e - 1 : 0,
        z = (w + 1) * s;
        for (s = w * s; s < z; s++) {
            h.css(b[s], c, d);
            h.css(b[s], q, d)
        }
        h.css(this.content, q, o ? -v * (e - 1) : d)
    }
    var h = a.DOM,
    c = "position",
    i = "relative",
    n = "left",
    m = "top",
    d = "",
    f = "px",
    p = "forward",
    r = "backward",
    u = "scrollx",
    t = a.Switchable;
    a.mix(t.Config, {
        circular: false
    });
    t.Plugins.push({
        name: "circular",
        init: function(b) {
            b = b.config;
            if (b.circular && (b.effect === u || b.effect === "scrolly")) {
                b.scrollType = b.effect;
                b.effect = g
            }
        }
    })
});
KISSY.add("switchable-lazyload",
function(a) {
    var l = a.DOM,
    g = "beforeSwitch",
    j = "img-src",
    k = "area-data",
    h = {},
    c = a.Switchable;
    h[j] = "data-ks-lazyload-custom";
    h[k] = "ks-datalazyload-custom";
    a.mix(c.Config, {
        lazyDataType: k
    });
    c.Plugins.push({
        name: "lazyload",
        init: function(i) {
            function n(u) {
                var t = f.steps;
                u = u.toIndex * t;
                d.loadCustomLazyData(i.panels.slice(u, u + t), p);
                m() && i.detach(g, n)
            }
            function m() {
                var u, t, b, e = p === j;
                if (u = e ? "img": p === k ? "textarea": "") {
                    u = a.query(u, i.container);
                    t = 0;
                    for (b = u.length; t < b; t++) if (e ? l.attr(u[t], r) : l.hasClass(u[t], r)) return false
                }
                return true
            }
            var d = a.DataLazyload,
            f = i.config,
            p = f.lazyDataType,
            r = h[p]; ! d || !p || !r || i.on(g, n)
        }
    })
});
KISSY.add("switchable-countdown",
function(a, l) {
    var g = a.DOM,
    j = a.Event,
    k = a.Anim,
    h = a.Switchable;
    a.mix(h.Config, {
        countdown: false,
        countdownFromStyle: "",
        countdownToStyle: "width: 0"
    });
    h.Plugins.push({
        name: "countdown",
        init: function(c) {
            function i() {
                n();
                u = (new k(f[c.activeIndex], r, d - 0.5)).run()
            }
            function n() {
                if (u) {
                    u.stop();
                    u = l
                }
            }
            var m = c.config,
            d = m.interval,
            f = [],
            p = m.countdownFromStyle,
            r = m.countdownToStyle,
            u;
            if (! (!m.autoplay || !m.hasTriggers || !m.countdown)) {
                a.each(c.triggers,
                function(t, b) {
                    t.innerHTML = '<div class="ks-switchable-trigger-mask"></div><div class="ks-switchable-trigger-content">' + t.innerHTML + "</div>";
                    f[b] = t.firstChild
                });
                if (m.pauseOnHover) {
                    j.on(c.container, "mouseenter",
                    function() {
                        n();
                        var t = f[c.activeIndex];
                        if (p) u = (new k(t, p, 0.2, "easeOut")).run();
                        else g.removeAttr(t, "style")
                    });
                    j.on(c.container, "mouseleave",
                    function() {
                        n();
                        g.removeAttr(f[c.activeIndex], "style");
                        a.later(i, 200)
                    })
                }
                c.on("beforeSwitch",
                function() {
                    n();
                    g.removeAttr(f[c.activeIndex], "style")
                });
                c.on("switch",
                function() {
                    c.paused || i()
                });
                i(c.activeIndex)
            }
        }
    })
});
KISSY.add("switchable-autorender",
function(a) {
    a.Switchable.autoRender = function(l, g, j) {
        g = "." + (g || "KS_");
        j = j || "data-ks-switchable";
        a.each(["Switchable", "Tabs", "Slide", "Carousel", "Accordion"],
        function(k) {
            a.each(a.query(g + k, l),
            function(h) {
                try {
                    var c = h.getAttribute(j);
                    if (c) c = c.replace(/'/g, '"');
                    new a[k](h, a.JSON.parse(c))
                } catch(i) {
                    a.log("Switchable.autoRender: " + i, "warn")
                }
            })
        })
    }
});
KISSY.add("tabs",
function(a) {
    function l(g, j) {
        if (! (this instanceof l)) return new l(g, j);
        l.superclass.constructor.call(this, g, j)
    }
    a.extend(l, a.Switchable);
    a.Tabs = l
});
KISSY.add("slide",
function(a) {
    function l(j, k) {
        if (! (this instanceof l)) return new l(j, k);
        l.superclass.constructor.call(this, j, a.merge(g, k))
    }
    var g = {
        autoplay: true,
        circular: true
    };
    a.extend(l, a.Switchable);
    a.Slide = l
});
KISSY.add("carousel",
function(a, l) {
    function g(d, f) {
        var p = this;
        if (! (p instanceof g)) return new g(d, f);
        p.on("init",
        function() {
            j(p)
        });
        g.superclass.constructor.call(p, d, a.merge(m, f))
    }
    function j(d) {
        var f = d.config,
        p = f.disableBtnCls;
        a.each(["prev", "next"],
        function(r) {
            var u = d[r + "Btn"] = a.get(c + f[r + "BtnCls"], d.container);
            h.on(u, "click",
            function(t) {
                t.preventDefault();
                k.hasClass(u, p) || d[r]()
            })
        });
        f.circular || d.on("switch",
        function(r) {
            r = r.currentIndex;
            r = r === 0 ? d[i] : r === d.length - 1 ? d[n] : l;
            k.removeClass([d[i], d[n]], p);
            r && k.addClass(r, p)
        });
        h.on(d.panels, "click focus",
        function() {
            d.fire("itemSelected", {
                item: this
            })
        })
    }
    var k = a.DOM,
    h = a.Event,
    c = ".",
    i = "prevBtn",
    n = "nextBtn",
    m = {
        circular: true,
        prevBtnCls: "ks-switchable-prev-btn",
        nextBtnCls: "ks-switchable-next-btn",
        disableBtnCls: "ks-switchable-disable-btn"
    };
    a.extend(g, a.Switchable);
    a.Carousel = g
});
KISSY.add("accordion",
function(a) {
    function l(k, h) {
        if (! (this instanceof l)) return new l(k, h);
        l.superclass.constructor.call(this, k, a.merge(j, h))
    }
    var g = a.DOM,
    j = {
        markupType: 1,
        triggerType: "click",
        multiple: false
    };
    a.extend(l, a.Switchable);
    a.Accordion = l;
    a.augment(l, {
        _triggerIsValid: function(k) {
            return this.activeIndex !== k || this.config.multiple
        },
        _switchView: function(k, h, c) {
            var i = this.config,
            n = h[0];
            if (i.multiple) {
                g.toggleClass(this.triggers[c], i.activeTriggerCls);
                g.css(n, "display", n.style.display == "none" ? "block": "none");
                this._fireOnSwitch(c)
            } else l.superclass._switchView.call(this, k, h, c)
        }
    })
});
KISSY.add("swf-ua",
function(a) {
    function l() {
        var j = 0,
        k = navigator.mimeTypes["application/x-shockwave-flash"],
        h;
        if (k) {
            if (k = k.enabledPlugin) j = g(k.description.replace(/\s[rd]/g, ".").replace(/[a-z\s]+/ig, "").split("."))
        } else {
            try {
                h = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
                h.AllowScriptAccess = "always"
            } catch(c) {
                if (h !== null) j = 6
            }
            if (j === 0) try {
                j = g((new ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version").replace(/[A-Za-z\s]+/g, "").split(","))
            } catch(i) {}
        }
        return parseFloat(j)
    }
    function g(j) {
        var k = j[0] + ".";
        switch (j[2].toString().length) {
        case 1:
            k += "00";
            break;
        case 2:
            k += "0";
            break
        }
        return k + j[2]
    }
    a.UA.flash = l()
});
KISSY.add("swf",
function(a) {
    function l(d, f, p) {
        var r = "ks-swf-" + j++,
        u = parseFloat(p.version) || k,
        t = g.flash >= u,
        b = g.flash >= 8 && p.useExpressInstall && !t,
        e = b ? i: f;
        u = "YUISwfId=" + r + "&YUIBridgeCallback=" + n;
        this.id = r;
        l.instances[r] = this;
        if ((d = a.get(d)) && (t || b) && e) if (g.ie) {
            var o = "<object ";
            o += 'id="' + r + '" ';
            o += g.ie ? 'classid="' + h + '" ': 'type="' + c + '" data="' + e + '" ';
            o += 'width="100%" height="100%">';
            if (g.ie) o += '<param name="movie" value="' + e + '"/>';
            for (var q in p.fixedAttributes) if (m.hasOwnProperty(q)) o += '<param name="' + q + '" value="' + p.fixedAttributes[q] + '"/>';
            for (var v in p.flashVars) {
                f = p.flashVars[v];
                if (typeof f === "string") u += "&" + v + "=" + encodeURIComponent(f)
            }
            o += '<param name="flashVars" value="' + u + '"/>';
            o += "</object>"
        } else {
            o = "<embed ";
            o += ' id="' + r + '" ';
            o += ' src="' + f + '" ';
            for (q in p.fixedAttributes) if (m.hasOwnProperty(q)) o += q + '="' + p.fixedAttributes[q] + '" ';
            for (v in p.flashVars) {
                f = p.flashVars[v];
                if (typeof f === "string") u += "&" + v + "=" + encodeURIComponent(f)
            }
            o += ' FlashVars="' + u + '" ';
            o += " />"
        }
        d.innerHTML = o;
        this.swf = a.get("#" + r)
    }
    var g = a.UA,
    j = a.now(),
    k = 10.22,
    h = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",
    c = "application/x-shockwave-flash",
    i = "http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?" + j,
    n = "KISSY.SWF.eventHandler",
    m = {
        align: "",
        allowNetworking: "",
        allowScriptAccess: "",
        base: "",
        bgcolor: "",
        menu: "",
        name: "",
        quality: "",
        salign: "",
        scale: "",
        tabindex: "",
        wmode: ""
    };
    l.instances = (a.SWF || {}).instances || {};
    l.eventHandler = function(d, f) {
        l.instances[d]._eventHandler(f)
    };
    a.augment(l, a.EventTarget);
    a.augment(l, {
        _eventHandler: function(d) {
            var f = d.type;
            if (f === "log") a.log(d.message);
            else f && this.fire(f, d)
        },
        callSWF: function(d, f) {
            f = f || [];
            try {
                if (this.swf[d]) return this.swf[d].apply(this.swf, f)
            } catch(p) {
                var r = "",
                u = "";
                if (f.length != 0) r = "'" + f.join("','") + "'";
                u = "return self.swf." + d + "(" + r + ");";
                return (new Function("self", u))(this)
            }
        }
    });
    a.SWF = l
});
KISSY.add("swfstore",
function(a, l) {
    function g(i, n, m, d) {
        var f = "other",
        p = k.get(h),
        r = this;
        m = (m !== l ? m: true) + "";
        d = (d !== l ? d: true) + "";
        if (j.ie) f = "ie";
        else if (j.gecko) f = "gecko";
        else if (j.webkit) f = "webkit";
        else if (j.opera) f = "opera";
        if (!p || p === "null") k.set(h, p = Math.round(Math.random() * Math.PI * 1E5));
        m = {
            version: 9.115,
            useExpressInstall: false,
            fixedAttributes: {
                allowScriptAccess: "always",
                allowNetworking: "all",
                scale: "noScale"
            },
            flashVars: {
                allowedDomain: c.location.hostname,
                shareData: m,
                browser: p,
                useCompression: d
            }
        };
        n || (n = c.body.appendChild(a.DOM.create('<div style="height:0;width:0;overflow:hidden"></div>')));
        r.embeddedSWF = new a.SWF(n, i || "swfstore.swf", m);
        r.embeddedSWF._eventHandler = function(u) {
            a.SWF.prototype._eventHandler.call(r, u)
        }
    }
    var j = a.UA,
    k = a.Cookie,
    h = "swfstore",
    c = document;
    a.augment(g, a.EventTarget);
    a.augment(g, {
        setItem: function(i, n) {
            n = typeof n === "string" ? n.replace(/\\/g, "\\\\") : a.JSON.stringify(n) + "";
            if (i = a.trim(i + "")) try {
                return this.embeddedSWF.callSWF("setItem", [i, n])
            } catch(m) {
                this.fire("error", {
                    message: m
                })
            }
        },
        getItem: function(i) {
            return this.embeddedSWF.callSWF("getValueOf", [i])
        }
    });
    a.each(["getValueAt", "getNameAt", "getValueOf", "getItems", "getLength", "removeItem", "removeItemAt", "clear", "calculateCurrentSize", "hasAdequateDimensions", "setSize", "getModificationDate", "displaySettings"],
    function(i) {
        g.prototype[i] = function() {
            try {
                return this.embeddedSWF.callSWF(i, a.makeArray(arguments))
            } catch(n) {
                this.fire("error", {
                    message: n
                })
            }
        }
    });
    a.SWFStore = g
});
KISSY.add("swfAudioLite",
function(a) {
    function l(g, j) {
        var k = this;
        j || (j = document.body.appendChild(a.DOM.create('<div style="height:0;width:0;overflow:hidden"></div>')));
        k.embeddedSWF = new a.SWF(j, g || "niftyplayer.swf", {
            version: 9.115,
            useExpressInstall: false
        });
        this._waits = [];
        var h = setInterval(function() {
            if (k._loaded()) {
                clearInterval(h);
                h = null;
                for (var c = 0; c < k._waits.length; c++) k._waits[c].call(k);
                k._waits = null
            }
        },
        100)
    }
    a.augment(l, {
        loadUrl: function(g) {
            this.embeddedSWF.callSWF("SetVariable", ["currentSong", g]);
            this.load()
        },
        loadAndPlay: function(g) {
            this.loadUrl(g);
            this.play()
        },
        getState: function() {
            var g = this.embeddedSWF.callSWF("GetVariable", ["playingState"]),
            j = this.embeddedSWF.callSWF("GetVariable", ["loadingState"]);
            if (g == "playing") return j == "loaded" ? g: j;
            if (g == "stopped") if (j == "empty") return j;
            return j == "error" ? j: g
        },
        _loaded: function() {
            return this.embeddedSWF.callSWF("PercentLoaded") == 100
        },
        _ready: function(g) {
            this._loaded() ? g() : this._waits.push(g)
        },
        on: function(g, j) {
            if (g == "ready") this._ready(j);
            else try {
                return this.embeddedSWF.callSWF("SetVariable", arguments)
            } catch(k) {}
        }
    });
    a.each(["play", "load", "stop", "pause", "playToggle", "reset"],
    function(g) {
        l.prototype[g] = function() {
            try {
                return this.embeddedSWF.callSWF("TCallLabel", ["/", g])
            } catch(j) {}
        }
    });
    a.each(["getPlayingState", "getLoadingState"],
    function(g) {
        l.prototype[g] = function() {
            try {
                return this.embeddedSWF.callSWF("GetVariable", [g])
            } catch(j) {}
        }
    });
    a.SWFAudioLite = l
});
KISSY.Ajax = KISSY.Ajax || {};
KISSY.Ajax.getScript = KISSY.getScript;
KISSY.ready(function(a) {
    var l = new a.Node(document.body);
    l.on("click",
    function(j) {
        var k = j.target;
        if (k.nodeName.toLowerCase() === "a") {
            k = new a.Node(k);
            j = k.attr("href") || "";
            k = k.html() || "";
            var h = document.title || "";
            j = {
                href: j,
                name: k,
                menu_page: h,
                t: (new Date).valueOf()
            }; 
        } else if (k.parentNode.nodeName.toLowerCase() === "a") {
            k = new a.Node(k.parentNode);
            j = k.attr("href") || "";
            k = k.html() || "";
            h = document.title || "";
            j = {
                href: j,
                name: k,
                menu_page: h,
                t: (new Date).valueOf()
            }; 
        }
    });
    l[0].appendChild(a.DOM.create('<a href="#" class="hide" id="dp">\u70b9\u8bc4</a>'));
    var g = a.one("#dp");
    a.all("a").each(function(j) {
        var k = j.attr("data-siteid");
        if (k) {
            j.on("mouseover",
            function() {
                var h = j.offset();
                g.css("left", h.left + j.width() + 3 + "px");
                g.css("top", h.top + j.height() / 2 - 14 + "px");
                g.attr("href", "http://hao.taobao.com/dianping/dianping.php?siteid=" + k);
                g.removeClass("hide")
            });
            j.on("mouseout",
            function(h) {
                var c = parseInt(g.css("left")),
                i = parseInt(g.css("top")),
                n = g.width(),
                m = g.height();
                h.pageX > c - 6 && h.pageX < c + n + 4 && h.pageY > i && h.pageY < i + m || g.addClass("hide")
            });
            g.on("mouseout",
            function() {
                g.addClass("hide")
            })
        }
    })
});

