/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function () {
    var g = this,
        j, z = g.jQuery,
        p = g.$,
        b = g.jQuery = g.$ = function (E, F) {
            return new b.fn.init(E, F)
        },
        D = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
        k = /^.[^:#\[\.,]*$/;
    b.fn = b.prototype = {
            init: function (E, H) {
                E = E || document;
                if (E.nodeType) {
                    this[0] = E;
                    this.length = 1;
                    this.context = E;
                    return this
                }
                if (typeof E === "string") {
                    var G = D.exec(E);
                    if (G && (G[1] || !H)) {
                        if (G[1]) {
                            E = b.clean([G[1]], H)
                        } else {
                            var I = document.getElementById(G[3]);
                            if (I && I.id != G[3]) {
                                return b().find(E)
                            }
                            var F = b(I || []);
                            F.context = document;
                            F.selector = E;
                            return F
                        }
                    } else {
                        return b(H).find(E)
                    }
                } else {
                    if (b.isFunction(E)) {
                        return b(document).ready(E)
                    }
                }
                if (E.selector && E.context) {
                    this.selector = E.selector;
                    this.context = E.context
                }
                return this.setArray(b.isArray(E) ? E : b.makeArray(E))
            },
            selector: "",
            jquery: "1.3.2",
            size: function () {
                return this.length
            },
            get: function (E) {
                return E === j ? Array.prototype.slice.call(this) : this[E]
            },
            pushStack: function (F, H, E) {
                var G = b(F);
                G.prevObject = this;
                G.context = this.context;
                if (H === "find") {
                    G.selector = this.selector + (this.selector ? " " : "") + E
                } else {
                    if (H) {
                        G.selector = this.selector + "." + H + "(" + E + ")"
                    }
                }
                return G
            },
            setArray: function (E) {
                this.length = 0;
                Array.prototype.push.apply(this, E);
                return this
            },
            each: function (F, E) {
                return b.each(this, F, E)
            },
            index: function (E) {
                return b.inArray(E && E.jquery ? E[0] : E, this)
            },
            attr: function (E, H, G) {
                var F = E;
                if (typeof E === "string") {
                    if (H === j) {
                        return this[0] && b[G || "attr"](this[0], E)
                    } else {
                        F = {};
                        F[E] = H
                    }
                }
                return this.each(function (I) {
                    for (E in F) {
                        b.attr(G ? this.style : this, E, b.prop(this, F[E], G, I, E))
                    }
                })
            },
            css: function (E, F) {
                if ((E == "width" || E == "height") && parseFloat(F) < 0) {
                    F = j
                }
                return this.attr(E, F, "curCSS")
            },
            text: function (F) {
                if (typeof F !== "object" && F != null) {
                    return this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(F))
                }
                var E = "";
                b.each(F || this, function () {
                    b.each(this.childNodes, function () {
                        if (this.nodeType != 8) {
                            E += this.nodeType != 1 ? this.nodeValue : b.fn.text([this])
                        }
                    })
                });
                return E
            },
            wrapAll: function (E) {
                if (this[0]) {
                    var F = b(E, this[0].ownerDocument).clone();
                    if (this[0].parentNode) {
                        F.insertBefore(this[0])
                    }
                    F.map(function () {
                        var G = this;
                        while (G.firstChild) {
                            G = G.firstChild
                        }
                        return G
                    }).append(this)
                }
                return this
            },
            wrapInner: function (E) {
                return this.each(function () {
                    b(this).contents().wrapAll(E)
                })
            },
            wrap: function (E) {
                return this.each(function () {
                    b(this).wrapAll(E)
                })
            },
            append: function () {
                return this.domManip(arguments, true, function (E) {
                    if (this.nodeType == 1) {
                        this.appendChild(E)
                    }
                })
            },
            prepend: function () {
                return this.domManip(arguments, true, function (E) {
                    if (this.nodeType == 1) {
                        this.insertBefore(E, this.firstChild)
                    }
                })
            },
            before: function () {
                return this.domManip(arguments, false, function (E) {
                    this.parentNode.insertBefore(E, this)
                })
            },
            after: function () {
                return this.domManip(arguments, false, function (E) {
                    this.parentNode.insertBefore(E, this.nextSibling)
                })
            },
            end: function () {
                return this.prevObject || b([])
            },
            push: [].push,
            sort: [].sort,
            splice: [].splice,
            find: function (E) {
                if (this.length === 1) {
                    var F = this.pushStack([], "find", E);
                    F.length = 0;
                    b.find(E, this[0], F);
                    return F
                } else {
                    return this.pushStack(b.unique(b.map(this, function (G) {
                        return b.find(E, G)
                    })), "find", E)
                }
            },
            clone: function (F) {
                var E = this.map(function () {
                    if (!b.support.noCloneEvent && !b.isXMLDoc(this)) {
                        var I = this.outerHTML;
                        if (!I) {
                            var J = this.ownerDocument.createElement("div");
                            J.appendChild(this.cloneNode(true));
                            I = J.innerHTML
                        }
                        return b.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]
                    } else {
                        return this.cloneNode(true)
                    }
                });
                if (F === true) {
                    var H = this.find("*").andSelf(),
                        G = 0;
                    E.find("*").andSelf().each(function () {
                            if (this.nodeName !== H[G].nodeName) {
                                return
                            }
                            var I = b.data(H[G], "events");
                            for (var K in I) {
                                for (var J in I[K]) {
                                    b.event.add(this, K, I[K][J], I[K][J].data)
                                }
                            }
                            G++
                        })
                }
                return E
            },
            filter: function (E) {
                return this.pushStack(b.isFunction(E) && b.grep(this, function (G, F) {
                    return E.call(G, F)
                }) || b.multiFilter(E, b.grep(this, function (F) {
                    return F.nodeType === 1
                })), "filter", E)
            },
            closest: function (E) {
                var G = b.expr.match.POS.test(E) ? b(E) : null,
                    F = 0;
                return this.map(function () {
                        var H = this;
                        while (H && H.ownerDocument) {
                            if (G ? G.index(H) > -1 : b(H).is(E)) {
                                b.data(H, "closest", F);
                                return H
                            }
                            H = H.parentNode;
                            F++
                        }
                    })
            },
            not: function (E) {
                if (typeof E === "string") {
                    if (k.test(E)) {
                        return this.pushStack(b.multiFilter(E, this, true), "not", E)
                    } else {
                        E = b.multiFilter(E, this)
                    }
                }
                var F = E.length && E[E.length - 1] !== j && !E.nodeType;
                return this.filter(function () {
                    return F ? b.inArray(this, E) < 0 : this != E
                })
            },
            add: function (E) {
                return this.pushStack(b.unique(b.merge(this.get(), typeof E === "string" ? b(E) : b.makeArray(E))))
            },
            is: function (E) {
                return !!E && b.multiFilter(E, this).length > 0
            },
            hasClass: function (E) {
                return !!E && this.is("." + E)
            },
            val: function (L) {
                if (L === j) {
                    var F = this[0];
                    if (F) {
                        if (b.nodeName(F, "option")) {
                            return (F.attributes.value || {}).specified ? F.value : F.text
                        }
                        if (b.nodeName(F, "select")) {
                            var I = F.selectedIndex,
                                M = [],
                                K = F.options,
                                H = F.type == "select-one";
                            if (I < 0) {
                                    return null
                                }
                            for (var G = H ? I : 0, J = H ? I + 1 : K.length; G < J; G++) {
                                    var E = K[G];
                                    if (E.selected) {
                                        L = b(E).val();
                                        if (H) {
                                            return L
                                        }
                                        M.push(L)
                                    }
                                }
                            return M
                        }
                        return (F.value || "").replace(/\r/g, "")
                    }
                    return j
                }
                if (typeof L === "number") {
                    L += ""
                }
                return this.each(function () {
                    if (this.nodeType != 1) {
                        return
                    }
                    if (b.isArray(L) && /radio|checkbox/.test(this.type)) {
                        this.checked = (b.inArray(this.value, L) >= 0 || b.inArray(this.name, L) >= 0)
                    } else {
                        if (b.nodeName(this, "select")) {
                            var N = b.makeArray(L);
                            b("option", this).each(function () {
                                this.selected = (b.inArray(this.value, N) >= 0 || b.inArray(this.text, N) >= 0)
                            });
                            if (!N.length) {
                                this.selectedIndex = -1
                            }
                        } else {
                            this.value = L
                        }
                    }
                })
            },
            html: function (E) {
                return E === j ? (this[0] ? this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : null) : this.empty().append(E)
            },
            replaceWith: function (E) {
                return this.after(E).remove()
            },
            eq: function (E) {
                return this.slice(E, +E + 1)
            },
            slice: function () {
                return this.pushStack(Array.prototype.slice.apply(this, arguments), "slice", Array.prototype.slice.call(arguments).join(","))
            },
            map: function (E) {
                return this.pushStack(b.map(this, function (G, F) {
                    return E.call(G, F, G)
                }))
            },
            andSelf: function () {
                return this.add(this.prevObject)
            },
            domManip: function (J, M, L) {
                if (this[0]) {
                    var E = (this[0].ownerDocument || this[0]).createDocumentFragment(),
                        G = b.clean(J, (this[0].ownerDocument || this[0]), E),
                        I = E.firstChild;
                    if (I) {
                            for (var H = 0, F = this.length; H < F; H++) {
                                L.call(K(this[H], I), this.length > 1 || H > 0 ? E.cloneNode(true) : E)
                            }
                        }
                    if (G) {
                            b.each(G, r)
                        }
                }
                return this;

                function K(N, O) {
                    return M && b.nodeName(N, "table") && b.nodeName(O, "tr") ? (N.getElementsByTagName("tbody")[0] || N.appendChild(N.ownerDocument.createElement("tbody"))) : N
                }
            }
        };
    b.fn.init.prototype = b.fn;

    function r(E, F) {
            if (F.src) {
                b.ajax({
                    url: F.src,
                    async: false,
                    dataType: "script"
                })
            } else {
                b.globalEval(F.text || F.textContent || F.innerHTML || "")
            }
            if (F.parentNode) {
                F.parentNode.removeChild(F)
            }
        }
    function d() {
            return +new Date
        }
    b.extend = b.fn.extend = function () {
            var L = arguments[0] || {},
                I = 1,
                F = arguments.length,
                E = false,
                H;
            if (typeof L === "boolean") {
                    E = L;
                    L = arguments[1] || {};
                    I = 2
                }
            if (typeof L !== "object" && !b.isFunction(L)) {
                    L = {}
                }
            if (F == I) {
                    L = this;
                    --I
                }
            for (; I < F; I++) {
                    if ((H = arguments[I]) != null) {
                        for (var G in H) {
                            var J = L[G],
                                K = H[G];
                            if (L === K) {
                                    continue
                                }
                            if (E && K && typeof K === "object" && !K.nodeType) {
                                    L[G] = b.extend(E, J || (K.length != null ? [] : {}), K)
                                } else {
                                    if (K !== j) {
                                        L[G] = K
                                    }
                                }
                        }
                    }
                }
            return L
        };
    var o = /z-?index|font-?weight|opacity|zoom|line-?height/i,
        A = document.defaultView || {},
        x = Object.prototype.toString;
    b.extend({
            noConflict: function (E) {
                g.$ = p;
                if (E) {
                    g.jQuery = z
                }
                return b
            },
            isFunction: function (E) {
                return x.call(E) === "[object Function]"
            },
            isArray: function (E) {
                return x.call(E) === "[object Array]"
            },
            isXMLDoc: function (E) {
                return E.nodeType === 9 && E.documentElement.nodeName !== "HTML" || !! E.ownerDocument && b.isXMLDoc(E.ownerDocument)
            },
            globalEval: function (G) {
                if (G && /\S/.test(G)) {
                    var E = document.getElementsByTagName("head")[0] || document.documentElement,
                        F = document.createElement("script");
                    F.type = "text/javascript";
                    if (b.support.scriptEval) {
                            F.appendChild(document.createTextNode(G))
                        } else {
                            F.text = G
                        }
                    E.insertBefore(F, E.firstChild);
                    E.removeChild(F)
                }
            },
            nodeName: function (F, E) {
                return F.nodeName && F.nodeName.toUpperCase() == E.toUpperCase()
            },
            each: function (I, K, G) {
                var F, H = 0,
                    E = I.length;
                if (G) {
                        if (E === j) {
                            for (F in I) {
                                if (K.apply(I[F], G) === false) {
                                    break
                                }
                            }
                        } else {
                            for (; H < E;) {
                                if (K.apply(I[H++], G) === false) {
                                    break
                                }
                            }
                        }
                    } else {
                        if (E === j) {
                            for (F in I) {
                                if (K.call(I[F], F, I[F]) === false) {
                                    break
                                }
                            }
                        } else {
                            for (var J = I[0]; H < E && K.call(J, H, J) !== false; J = I[++H]) {}
                        }
                    }
                return I
            },
            prop: function (H, I, G, F, E) {
                if (b.isFunction(I)) {
                    I = I.call(H, F)
                }
                return typeof I === "number" && G == "curCSS" && !o.test(E) ? I + "px" : I
            },
            className: {
                add: function (E, F) {
                    b.each((F || "").split(/\s+/), function (H, G) {
                        if (E.nodeType == 1 && !b.className.has(E.className, G)) {
                            E.className += (E.className ? " " : "") + G
                        }
                    })
                },
                remove: function (E, F) {
                    if (E.nodeType == 1) {
                        E.className = F !== j ? b.grep(E.className.split(/\s+/), function (G) {
                            return !b.className.has(F, G)
                        }).join(" ") : ""
                    }
                },
                has: function (F, E) {
                    return F && b.inArray(E, (F.className || F).toString().split(/\s+/)) > -1
                }
            },
            swap: function (H, G, I) {
                var E = {};
                for (var F in G) {
                    E[F] = H.style[F];
                    H.style[F] = G[F]
                }
                I.call(H);
                for (var F in G) {
                    H.style[F] = E[F]
                }
            },
            css: function (H, F, J, E) {
                if (F == "width" || F == "height") {
                    var L, G = {
                        position: "absolute",
                        visibility: "hidden",
                        display: "block"
                    },
                        K = F == "width" ? ["Left", "Right"] : ["Top", "Bottom"];

                    function I() {
                            L = F == "width" ? H.offsetWidth : H.offsetHeight;
                            if (E === "border") {
                                return
                            }
                            b.each(K, function () {
                                if (!E) {
                                    L -= parseFloat(b.curCSS(H, "padding" + this, true)) || 0
                                }
                                if (E === "margin") {
                                    L += parseFloat(b.curCSS(H, "margin" + this, true)) || 0
                                } else {
                                    L -= parseFloat(b.curCSS(H, "border" + this + "Width", true)) || 0
                                }
                            })
                        }
                    if (H.offsetWidth !== 0) {
                            I()
                        } else {
                            b.swap(H, G, I)
                        }
                    return Math.max(0, Math.round(L))
                }
                return b.curCSS(H, F, J)
            },
            curCSS: function (I, E, G) {
                var L, F = I.style;
                if (E == "opacity" && !b.support.opacity) {
                    L = b.attr(F, "opacity");
                    return L == "" ? "1" : L
                }
                if (E.match(/float/i)) {
                    E = w
                }
                if (!G && F && F[E]) {
                    L = F[E]
                } else {
                    if (A.getComputedStyle) {
                        if (E.match(/float/i)) {
                            E = "float"
                        }
                        E = E.replace(/([A-Z])/g, "-$1").toLowerCase();
                        var M = A.getComputedStyle(I, null);
                        if (M) {
                            L = M.getPropertyValue(E)
                        }
                        if (E == "opacity" && L == "") {
                            L = "1"
                        }
                    } else {
                        if (I.currentStyle) {
                            var K = E.replace(/\-(\w)/g, function (O, N) {
                                return N.toUpperCase()
                            });
                            L = I.currentStyle[E] || I.currentStyle[K];
                            if (!/^\d+(px)?$/i.test(L) && /^\d/.test(L)) {
                                var J = F.left,
                                    H = I.runtimeStyle.left;
                                I.runtimeStyle.left = I.currentStyle.left;
                                F.left = L || 0;
                                L = F.pixelLeft + "px";
                                F.left = J;
                                I.runtimeStyle.left = H
                            }
                        }
                    }
                }
                return L
            },
            clean: function (F, K, J) {
                K = K || document;
                if (typeof K.createElement === "undefined") {
                    K = K.ownerDocument || K[0] && K[0].ownerDocument || document
                }
                if (!J && F.length === 1 && typeof F[0] === "string") {
                    var H = /^<(\w+)\s*\/?>$/.exec(F[0]);
                    if (H) {
                        return [K.createElement(H[1])]
                    }
                }
                var G = [],
                    E = [],
                    L = K.createElement("div");
                b.each(F, function (P, S) {
                        if (typeof S === "number") {
                            S += ""
                        }
                        if (!S) {
                            return
                        }
                        if (typeof S === "string") {
                            S = S.replace(/(<(\w+)[^>]*?)\/>/g, function (U, V, T) {
                                return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? U : V + "></" + T + ">"
                            });
                            var O = S.replace(/^\s+/, "").substring(0, 10).toLowerCase();
                            var Q = !O.indexOf("<opt") && [1, "<select multiple='multiple'>", "</select>"] || !O.indexOf("<leg") && [1, "<fieldset>", "</fieldset>"] || O.match(/^<(thead|tbody|tfoot|colg|cap)/) && [1, "<table>", "</table>"] || !O.indexOf("<tr") && [2, "<table><tbody>", "</tbody></table>"] || (!O.indexOf("<td") || !O.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] || !O.indexOf("<col") && [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] || !b.support.htmlSerialize && [1, "div<div>", "</div>"] || [0, "", ""];
                            L.innerHTML = Q[1] + S + Q[2];
                            while (Q[0]--) {
                                L = L.lastChild
                            }
                            if (!b.support.tbody) {
                                var R = /<tbody/i.test(S),
                                    N = !O.indexOf("<table") && !R ? L.firstChild && L.firstChild.childNodes : Q[1] == "<table>" && !R ? L.childNodes : [];
                                for (var M = N.length - 1; M >= 0; --M) {
                                        if (b.nodeName(N[M], "tbody") && !N[M].childNodes.length) {
                                            N[M].parentNode.removeChild(N[M])
                                        }
                                    }
                            }
                            if (!b.support.leadingWhitespace && /^\s/.test(S)) {
                                L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]), L.firstChild)
                            }
                            S = b.makeArray(L.childNodes)
                        }
                        if (S.nodeType) {
                            G.push(S)
                        } else {
                            G = b.merge(G, S)
                        }
                    });
                if (J) {
                        for (var I = 0; G[I]; I++) {
                            if (b.nodeName(G[I], "script") && (!G[I].type || G[I].type.toLowerCase() === "text/javascript")) {
                                E.push(G[I].parentNode ? G[I].parentNode.removeChild(G[I]) : G[I])
                            } else {
                                if (G[I].nodeType === 1) {
                                    G.splice.apply(G, [I + 1, 0].concat(b.makeArray(G[I].getElementsByTagName("script"))))
                                }
                                J.appendChild(G[I])
                            }
                        }
                        return E
                    }
                return G
            },
            attr: function (J, H, K) {
                if (!J || J.nodeType == 3 || J.nodeType == 8) {
                    return j
                }
                var G = !b.isXMLDoc(J),
                    L = K !== j;
                H = G && b.props[H] || H;
                if (J.tagName) {
                        var I = /href|src|style/.test(H);
                        if (H == "selected" && J.parentNode) {
                            J.parentNode.selectedIndex
                        }
                        if (H in J && G && !I) {
                            if (L) {
                                if (H == "type" && b.nodeName(J, "input") && J.parentNode) {
                                    throw "type property can't be changed"
                                }
                                J[H] = K
                            }
                            if (b.nodeName(J, "form") && J.getAttributeNode(H)) {
                                return J.getAttributeNode(H).nodeValue
                            }
                            if (H == "tabIndex") {
                                var F = J.getAttributeNode("tabIndex");
                                return F && F.specified ? F.value : J.nodeName.match(/(button|input|object|select|textarea)/i) ? 0 : J.nodeName.match(/^(a|area)$/i) && J.href ? 0 : j
                            }
                            return J[H]
                        }
                        if (!b.support.style && G && H == "style") {
                            return b.attr(J.style, "cssText", K)
                        }
                        if (L) {
                            J.setAttribute(H, "" + K)
                        }
                        var E = !b.support.hrefNormalized && G && I ? J.getAttribute(H, 2) : J.getAttribute(H);
                        return E === null ? j : E
                    }
                if (!b.support.opacity && H == "opacity") {
                        if (L) {
                            J.zoom = 1;
                            J.filter = (J.filter || "").replace(/alpha\([^)]*\)/, "") + (parseInt(K) + "" == "NaN" ? "" : "alpha(opacity=" + K * 100 + ")")
                        }
                        return J.filter && J.filter.indexOf("opacity=") >= 0 ? (parseFloat(J.filter.match(/opacity=([^)]*)/)[1]) / 100) + "" : ""
                    }
                H = H.replace(/-([a-z])/ig, function (N, M) {
                        return M.toUpperCase()
                    });
                if (L) {
                        J[H] = K
                    }
                return J[H]
            },
            trim: function (E) {
                return (E || "").replace(/^\s+|\s+$/g, "")
            },
            makeArray: function (G) {
                var E = [];
                if (G != null) {
                    var F = G.length;
                    if (F == null || typeof G === "string" || b.isFunction(G) || G.setInterval) {
                        E[0] = G
                    } else {
                        while (F) {
                            E[--F] = G[F]
                        }
                    }
                }
                return E
            },
            inArray: function (G, H) {
                for (var F = 0, E = H.length; F < E; F++) {
                    if (H[F] === G) {
                        return F
                    }
                }
                return -1
            },
            merge: function (H, F) {
                var E = 0,
                    G, I = H.length;
                if (!b.support.getAll) {
                        while ((G = F[E++]) != null) {
                            if (G.nodeType != 8) {
                                H[I++] = G
                            }
                        }
                    } else {
                        while ((G = F[E++]) != null) {
                            H[I++] = G
                        }
                    }
                return H
            },
            unique: function (K) {
                var G = [],
                    F = {};
                try {
                        for (var H = 0, E = K.length; H < E; H++) {
                            var J = b.data(K[H]);
                            if (!F[J]) {
                                F[J] = true;
                                G.push(K[H])
                            }
                        }
                    } catch (I) {
                        G = K
                    }
                return G
            },
            grep: function (G, J, E) {
                var H = [];
                for (var I = 0, F = G.length; I < F; I++) {
                    if (!E != !J(G[I], I)) {
                        H.push(G[I])
                    }
                }
                return H
            },
            map: function (F, J) {
                var G = [];
                for (var H = 0, E = F.length; H < E; H++) {
                    var I = J(F[H], H);
                    if (I != null) {
                        G[G.length] = I
                    }
                }
                return G.concat.apply([], G)
            }
        });
    var C = navigator.userAgent.toLowerCase();
    b.browser = {
            version: (C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [0, "0"])[1],
            safari: /webkit/.test(C),
            opera: /opera/.test(C),
            msie: /msie/.test(C) && !/opera/.test(C),
            mozilla: /mozilla/.test(C) && !/(compatible|webkit)/.test(C)
        };
    b.each({
            parent: function (E) {
                return E.parentNode
            },
            parents: function (E) {
                return b.dir(E, "parentNode")
            },
            next: function (E) {
                return b.nth(E, 2, "nextSibling")
            },
            prev: function (E) {
                return b.nth(E, 2, "previousSibling")
            },
            nextAll: function (E) {
                return b.dir(E, "nextSibling")
            },
            prevAll: function (E) {
                return b.dir(E, "previousSibling")
            },
            siblings: function (E) {
                return b.sibling(E.parentNode.firstChild, E)
            },
            children: function (E) {
                return b.sibling(E.firstChild)
            },
            contents: function (E) {
                return b.nodeName(E, "iframe") ? E.contentDocument || E.contentWindow.document : b.makeArray(E.childNodes)
            }
        }, function (E, F) {
            b.fn[E] = function (G) {
                var H = b.map(this, F);
                if (G && typeof G == "string") {
                    H = b.multiFilter(G, H)
                }
                return this.pushStack(b.unique(H), E, G)
            }
        });
    b.each({
            appendTo: "append",
            prependTo: "prepend",
            insertBefore: "before",
            insertAfter: "after",
            replaceAll: "replaceWith"
        }, function (E, F) {
            b.fn[E] = function (H) {
                var K = [],
                    G = b(H);
                for (var L = 0, I = G.length; L < I; L++) {
                        var J = (L > 0 ? this.clone(true) : this).get();
                        b.fn[F].apply(b(G[L]), J);
                        K = K.concat(J)
                    }
                return this.pushStack(K, E, H)
            }
        });
    b.each({
            removeAttr: function (E) {
                b.attr(this, E, "");
                if (this.nodeType == 1) {
                    this.removeAttribute(E)
                }
            },
            addClass: function (E) {
                b.className.add(this, E)
            },
            removeClass: function (E) {
                b.className.remove(this, E)
            },
            toggleClass: function (F, E) {
                if (typeof E !== "boolean") {
                    E = !b.className.has(this, F)
                }
                b.className[E ? "add" : "remove"](this, F)
            },
            remove: function (E) {
                if (!E || b.filter(E, [this]).length) {
                    b("*", this).add([this]).each(function () {
                        b.event.remove(this);
                        b.removeData(this)
                    });
                    if (this.parentNode) {
                        this.parentNode.removeChild(this)
                    }
                }
            },
            empty: function () {
                b(this).children().remove();
                while (this.firstChild) {
                    this.removeChild(this.firstChild)
                }
            }
        }, function (E, F) {
            b.fn[E] = function () {
                return this.each(F, arguments)
            }
        });

    function l(E, F) {
            return E[0] && parseInt(b.curCSS(E[0], F, true), 10) || 0
        }
    var i = "jQuery" + d(),
        v = 0,
        B = {};
    b.extend({
            cache: {},
            data: function (F, E, G) {
                F = F == g ? B : F;
                var H = F[i];
                if (!H) {
                    H = F[i] = ++v
                }
                if (E && !b.cache[H]) {
                    b.cache[H] = {}
                }
                if (G !== j) {
                    b.cache[H][E] = G
                }
                return E ? b.cache[H][E] : H
            },
            removeData: function (F, E) {
                F = F == g ? B : F;
                var H = F[i];
                if (E) {
                    if (b.cache[H]) {
                        delete b.cache[H][E];
                        E = "";
                        for (E in b.cache[H]) {
                            break
                        }
                        if (!E) {
                            b.removeData(F)
                        }
                    }
                } else {
                    try {
                        delete F[i]
                    } catch (G) {
                        if (F.removeAttribute) {
                            F.removeAttribute(i)
                        }
                    }
                    delete b.cache[H]
                }
            },
            queue: function (F, E, H) {
                if (F) {
                    E = (E || "fx") + "queue";
                    var G = b.data(F, E);
                    if (!G || b.isArray(H)) {
                        G = b.data(F, E, b.makeArray(H))
                    } else {
                        if (H) {
                            G.push(H)
                        }
                    }
                }
                return G
            },
            dequeue: function (H, G) {
                var E = b.queue(H, G),
                    F = E.shift();
                if (!G || G === "fx") {
                        F = E[0]
                    }
                if (F !== j) {
                        F.call(H)
                    }
            }
        });
    b.fn.extend({
            data: function (E, G) {
                var H = E.split(".");
                H[1] = H[1] ? "." + H[1] : "";
                if (G === j) {
                    var F = this.triggerHandler("getData" + H[1] + "!", [H[0]]);
                    if (F === j && this.length) {
                        F = b.data(this[0], E)
                    }
                    return F === j && H[1] ? this.data(H[0]) : F
                } else {
                    return this.trigger("setData" + H[1] + "!", [H[0], G]).each(function () {
                        b.data(this, E, G)
                    })
                }
            },
            removeData: function (E) {
                return this.each(function () {
                    b.removeData(this, E)
                })
            },
            queue: function (E, F) {
                if (typeof E !== "string") {
                    F = E;
                    E = "fx"
                }
                if (F === j) {
                    return b.queue(this[0], E)
                }
                return this.each(function () {
                    var G = b.queue(this, E, F);
                    if (E == "fx" && G.length == 1) {
                        G[0].call(this)
                    }
                })
            },
            dequeue: function (E) {
                return this.each(function () {
                    b.dequeue(this, E)
                })
            }
        });
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
    (function () {
            var R = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
                I = 0,
                L = Object.prototype.toString;
            var N = function (Y, U, ab, ac) {
                    ab = ab || [];
                    U = U || document;
                    if (U.nodeType !== 1 && U.nodeType !== 9) {
                        return []
                    }
                    if (!Y || typeof Y !== "string") {
                        return ab
                    }
                    var Z = [],
                        W, af, ai, T, ad, V, X = true;
                    R.lastIndex = 0;
                    while ((W = R.exec(Y)) !== null) {
                            Z.push(W[1]);
                            if (W[2]) {
                                V = RegExp.rightContext;
                                break
                            }
                        }
                    if (Z.length > 1 && G.exec(Y)) {
                            if (Z.length === 2 && F.relative[Z[0]]) {
                                af = H(Z[0] + Z[1], U)
                            } else {
                                af = F.relative[Z[0]] ? [U] : N(Z.shift(), U);
                                while (Z.length) {
                                    Y = Z.shift();
                                    if (F.relative[Y]) {
                                        Y += Z.shift()
                                    }
                                    af = H(Y, af)
                                }
                            }
                        } else {
                            var ae = ac ? {
                                expr: Z.pop(),
                                set: E(ac)
                            } : N.find(Z.pop(), Z.length === 1 && U.parentNode ? U.parentNode : U, Q(U));
                            af = N.filter(ae.expr, ae.set);
                            if (Z.length > 0) {
                                ai = E(af)
                            } else {
                                X = false
                            }
                            while (Z.length) {
                                var ah = Z.pop(),
                                    ag = ah;
                                if (!F.relative[ah]) {
                                        ah = ""
                                    } else {
                                        ag = Z.pop()
                                    }
                                if (ag == null) {
                                        ag = U
                                    }
                                F.relative[ah](ai, ag, Q(U))
                            }
                        }
                    if (!ai) {
                            ai = af
                        }
                    if (!ai) {
                            throw "Syntax error, unrecognized expression: " + (ah || Y)
                        }
                    if (L.call(ai) === "[object Array]") {
                            if (!X) {
                                ab.push.apply(ab, ai)
                            } else {
                                if (U.nodeType === 1) {
                                    for (var aa = 0; ai[aa] != null; aa++) {
                                        if (ai[aa] && (ai[aa] === true || ai[aa].nodeType === 1 && J(U, ai[aa]))) {
                                            ab.push(af[aa])
                                        }
                                    }
                                } else {
                                    for (var aa = 0; ai[aa] != null; aa++) {
                                        if (ai[aa] && ai[aa].nodeType === 1) {
                                            ab.push(af[aa])
                                        }
                                    }
                                }
                            }
                        } else {
                            E(ai, ab)
                        }
                    if (V) {
                            N(V, U, ab, ac);
                            if (K) {
                                hasDuplicate = false;
                                ab.sort(K);
                                if (hasDuplicate) {
                                    for (var aa = 1; aa < ab.length; aa++) {
                                        if (ab[aa] === ab[aa - 1]) {
                                            ab.splice(aa--, 1)
                                        }
                                    }
                                }
                            }
                        }
                    return ab
                };
            N.matches = function (T, U) {
                    return N(T, null, null, U)
                };
            N.find = function (Z, T, ab) {
                    var aa, X;
                    if (!Z) {
                        return []
                    }
                    for (var W = 0, V = F.order.length; W < V; W++) {
                        var Y = F.order[W],
                            X;
                        if ((X = F.match[Y].exec(Z))) {
                                var U = RegExp.leftContext;
                                if (U.substr(U.length - 1) !== "\\") {
                                    X[1] = (X[1] || "").replace(/\\/g, "");
                                    aa = F.find[Y](X, T, ab);
                                    if (aa != null) {
                                        Z = Z.replace(F.match[Y], "");
                                        break
                                    }
                                }
                            }
                    }
                    if (!aa) {
                        aa = T.getElementsByTagName("*")
                    }
                    return {
                        set: aa,
                        expr: Z
                    }
                };
            N.filter = function (ad, ae, ah, U) {
                    var T = ad,
                        ac = [],
                        Y = ae,
                        W, aa, X = ae && ae[0] && Q(ae[0]);
                    while (ad && ae.length) {
                            for (var ab in F.filter) {
                                if ((W = F.match[ab].exec(ad)) != null) {
                                    var Z = F.filter[ab],
                                        ai, ag;
                                    aa = false;
                                    if (Y == ac) {
                                            ac = []
                                        }
                                    if (F.preFilter[ab]) {
                                            W = F.preFilter[ab](W, Y, ah, ac, U, X);
                                            if (!W) {
                                                aa = ai = true
                                            } else {
                                                if (W === true) {
                                                    continue
                                                }
                                            }
                                        }
                                    if (W) {
                                            for (var V = 0;
                                            (ag = Y[V]) != null; V++) {
                                                if (ag) {
                                                    ai = Z(ag, W, V, Y);
                                                    var af = U ^ !! ai;
                                                    if (ah && ai != null) {
                                                        if (af) {
                                                            aa = true
                                                        } else {
                                                            Y[V] = false
                                                        }
                                                    } else {
                                                        if (af) {
                                                            ac.push(ag);
                                                            aa = true
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    if (ai !== j) {
                                            if (!ah) {
                                                Y = ac
                                            }
                                            ad = ad.replace(F.match[ab], "");
                                            if (!aa) {
                                                return []
                                            }
                                            break
                                        }
                                }
                            }
                            if (ad == T) {
                                if (aa == null) {
                                    throw "Syntax error, unrecognized expression: " + ad
                                } else {
                                    break
                                }
                            }
                            T = ad
                        }
                    return Y
                };
            var F = N.selectors = {
                    order: ["ID", "NAME", "TAG"],
                    match: {
                        ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
                        CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
                        NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
                        ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
                        TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
                        CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
                        POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
                        PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
                    },
                    attrMap: {
                        "class": "className",
                        "for": "htmlFor"
                    },
                    attrHandle: {
                        href: function (T) {
                            return T.getAttribute("href")
                        }
                    },
                    relative: {
                        "+": function (aa, T, ab) {
                            var U = typeof T === "string",
                                Z = U && !/\W/.test(T),
                                Y = U && !Z;
                            if (Z && !ab) {
                                    T = T.toUpperCase()
                                }
                            for (var X = 0, W = aa.length, V; X < W; X++) {
                                    if ((V = aa[X])) {
                                        while ((V = V.previousSibling) && V.nodeType !== 1) {}
                                        aa[X] = Y || V && V.nodeName === T ? V || false : V === T
                                    }
                                }
                            if (Y) {
                                    N.filter(T, aa, true)
                                }
                        },
                        ">": function (Z, W, aa) {
                            var V = typeof W === "string";
                            if (V && !/\W/.test(W)) {
                                W = aa ? W : W.toUpperCase();
                                for (var X = 0, T = Z.length; X < T; X++) {
                                    var Y = Z[X];
                                    if (Y) {
                                        var U = Y.parentNode;
                                        Z[X] = U.nodeName === W ? U : false
                                    }
                                }
                            } else {
                                for (var X = 0, T = Z.length; X < T; X++) {
                                    var Y = Z[X];
                                    if (Y) {
                                        Z[X] = V ? Y.parentNode : Y.parentNode === W
                                    }
                                }
                                if (V) {
                                    N.filter(W, Z, true)
                                }
                            }
                        },
                        "": function (W, U, Y) {
                            var V = I++,
                                T = S;
                            if (!U.match(/\W/)) {
                                    var X = U = Y ? U : U.toUpperCase();
                                    T = P
                                }
                            T("parentNode", U, V, W, X, Y)
                        },
                        "~": function (W, U, Y) {
                            var V = I++,
                                T = S;
                            if (typeof U === "string" && !U.match(/\W/)) {
                                    var X = U = Y ? U : U.toUpperCase();
                                    T = P
                                }
                            T("previousSibling", U, V, W, X, Y)
                        }
                    },
                    find: {
                        ID: function (U, V, W) {
                            if (typeof V.getElementById !== "undefined" && !W) {
                                var T = V.getElementById(U[1]);
                                return T ? [T] : []
                            }
                        },
                        NAME: function (V, Y, Z) {
                            if (typeof Y.getElementsByName !== "undefined") {
                                var U = [],
                                    X = Y.getElementsByName(V[1]);
                                for (var W = 0, T = X.length; W < T; W++) {
                                        if (X[W].getAttribute("name") === V[1]) {
                                            U.push(X[W])
                                        }
                                    }
                                return U.length === 0 ? null : U
                            }
                        },
                        TAG: function (T, U) {
                            return U.getElementsByTagName(T[1])
                        }
                    },
                    preFilter: {
                        CLASS: function (V, T, U, Z, Y, aa) {
                            V = " " + V[1].replace(/\\/g, "") + " ";
                            if (aa) {
                                return V
                            }
                            for (var W = 0, X;
                            (X = T[W]) != null; W++) {
                                if (X) {
                                    if (Y ^ (X.className && (" " + X.className + " ").indexOf(V) >= 0)) {
                                        if (!U) {
                                            Z.push(X)
                                        }
                                    } else {
                                        if (U) {
                                            T[W] = false
                                        }
                                    }
                                }
                            }
                            return false
                        },
                        ID: function (T) {
                            return T[1].replace(/\\/g, "")
                        },
                        TAG: function (U, T) {
                            for (var V = 0; T[V] === false; V++) {}
                            return T[V] && Q(T[V]) ? U[1] : U[1].toUpperCase()
                        },
                        CHILD: function (T) {
                            if (T[1] == "nth") {
                                var U = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2] == "even" && "2n" || T[2] == "odd" && "2n+1" || !/\D/.test(T[2]) && "0n+" + T[2] || T[2]);
                                T[2] = (U[1] + (U[2] || 1)) - 0;
                                T[3] = U[3] - 0
                            }
                            T[0] = I++;
                            return T
                        },
                        ATTR: function (W, T, U, Y, X, Z) {
                            var V = W[1].replace(/\\/g, "");
                            if (!Z && F.attrMap[V]) {
                                W[1] = F.attrMap[V]
                            }
                            if (W[2] === "~=") {
                                W[4] = " " + W[4] + " "
                            }
                            return W
                        },
                        PSEUDO: function (W, T, U, Y, X) {
                            if (W[1] === "not") {
                                if (W[3].match(R).length > 1 || /^\w/.test(W[3])) {
                                    W[3] = N(W[3], null, null, T)
                                } else {
                                    var V = N.filter(W[3], T, U, true ^ X);
                                    if (!U) {
                                        Y.push.apply(Y, V)
                                    }
                                    return false
                                }
                            } else {
                                if (F.match.POS.test(W[0]) || F.match.CHILD.test(W[0])) {
                                    return true
                                }
                            }
                            return W
                        },
                        POS: function (T) {
                            T.unshift(true);
                            return T
                        }
                    },
                    filters: {
                        enabled: function (T) {
                            return T.disabled === false && T.type !== "hidden"
                        },
                        disabled: function (T) {
                            return T.disabled === true
                        },
                        checked: function (T) {
                            return T.checked === true
                        },
                        selected: function (T) {
                            T.parentNode.selectedIndex;
                            return T.selected === true
                        },
                        parent: function (T) {
                            return !!T.firstChild
                        },
                        empty: function (T) {
                            return !T.firstChild
                        },
                        has: function (V, U, T) {
                            return !!N(T[3], V).length
                        },
                        header: function (T) {
                            return /h\d/i.test(T.nodeName)
                        },
                        text: function (T) {
                            return "text" === T.type
                        },
                        radio: function (T) {
                            return "radio" === T.type
                        },
                        checkbox: function (T) {
                            return "checkbox" === T.type
                        },
                        file: function (T) {
                            return "file" === T.type
                        },
                        password: function (T) {
                            return "password" === T.type
                        },
                        submit: function (T) {
                            return "submit" === T.type
                        },
                        image: function (T) {
                            return "image" === T.type
                        },
                        reset: function (T) {
                            return "reset" === T.type
                        },
                        button: function (T) {
                            return "button" === T.type || T.nodeName.toUpperCase() === "BUTTON"
                        },
                        input: function (T) {
                            return /input|select|textarea|button/i.test(T.nodeName)
                        }
                    },
                    setFilters: {
                        first: function (U, T) {
                            return T === 0
                        },
                        last: function (V, U, T, W) {
                            return U === W.length - 1
                        },
                        even: function (U, T) {
                            return T % 2 === 0
                        },
                        odd: function (U, T) {
                            return T % 2 === 1
                        },
                        lt: function (V, U, T) {
                            return U < T[3] - 0
                        },
                        gt: function (V, U, T) {
                            return U > T[3] - 0
                        },
                        nth: function (V, U, T) {
                            return T[3] - 0 == U
                        },
                        eq: function (V, U, T) {
                            return T[3] - 0 == U
                        }
                    },
                    filter: {
                        PSEUDO: function (Z, W, X, aa) {
                            var V = W[1],
                                U = F.filters[V];
                            if (U) {
                                    return U(Z, X, W, aa)
                                } else {
                                    if (V === "contains") {
                                        return (Z.textContent || Z.innerText || "").indexOf(W[3]) >= 0
                                    } else {
                                        if (V === "not") {
                                            var Y = W[3];
                                            for (var X = 0, T = Y.length; X < T; X++) {
                                                if (Y[X] === Z) {
                                                    return false
                                                }
                                            }
                                            return true
                                        }
                                    }
                                }
                        },
                        CHILD: function (U, V) {
                            var Z = V[1],
                                T = U;
                            switch (Z) {
                                case "only":
                                case "first":
                                    while (T = T.previousSibling) {
                                        if (T.nodeType === 1) {
                                            return false
                                        }
                                    }
                                    if (Z == "first") {
                                        return true
                                    }
                                    T = U;
                                case "last":
                                    while (T = T.nextSibling) {
                                        if (T.nodeType === 1) {
                                            return false
                                        }
                                    }
                                    return true;
                                case "nth":
                                    var W = V[2],
                                        ab = V[3];
                                    if (W == 1 && ab == 0) {
                                            return true
                                        }
                                    var Y = V[0],
                                        ac = U.parentNode;
                                    if (ac && (ac.sizcache !== Y || !U.nodeIndex)) {
                                            var X = 0;
                                            for (T = ac.firstChild; T; T = T.nextSibling) {
                                                if (T.nodeType === 1) {
                                                    T.nodeIndex = ++X
                                                }
                                            }
                                            ac.sizcache = Y
                                        }
                                    var aa = U.nodeIndex - ab;
                                    if (W == 0) {
                                            return aa == 0
                                        } else {
                                            return (aa % W == 0 && aa / W >= 0)
                                        }
                                }
                        },
                        ID: function (U, T) {
                            return U.nodeType === 1 && U.getAttribute("id") === T
                        },
                        TAG: function (U, T) {
                            return (T === "*" && U.nodeType === 1) || U.nodeName === T
                        },
                        CLASS: function (U, T) {
                            return (" " + (U.className || U.getAttribute("class")) + " ").indexOf(T) > -1
                        },
                        ATTR: function (X, V) {
                            var U = V[1],
                                Z = F.attrHandle[U] ? F.attrHandle[U](X) : X[U] != null ? X[U] : X.getAttribute(U),
                                Y = Z + "",
                                W = V[2],
                                T = V[4];
                            return Z == null ? W === "!=" : W === "=" ? Y === T : W === "*=" ? Y.indexOf(T) >= 0 : W === "~=" ? (" " + Y + " ").indexOf(T) >= 0 : !T ? Y && Z !== false : W === "!=" ? Y != T : W === "^=" ? Y.indexOf(T) === 0 : W === "$=" ? Y.substr(Y.length - T.length) === T : W === "|=" ? Y === T || Y.substr(0, T.length + 1) === T + "-" : false
                        },
                        POS: function (X, V, W, Y) {
                            var U = V[2],
                                T = F.setFilters[U];
                            if (T) {
                                    return T(X, W, V, Y)
                                }
                        }
                    }
                };
            var G = F.match.POS;
            for (var O in F.match) {
                    F.match[O] = RegExp(F.match[O].source + /(?![^\[]*\])(?![^\(]*\))/.source)
                }
            var E = function (U, T) {
                    U = Array.prototype.slice.call(U);
                    if (T) {
                        T.push.apply(T, U);
                        return T
                    }
                    return U
                };
            try {
                    Array.prototype.slice.call(document.documentElement.childNodes)
                } catch (M) {
                    E = function (X, W) {
                        var U = W || [];
                        if (L.call(X) === "[object Array]") {
                            Array.prototype.push.apply(U, X)
                        } else {
                            if (typeof X.length === "number") {
                                for (var V = 0, T = X.length; V < T; V++) {
                                    U.push(X[V])
                                }
                            } else {
                                for (var V = 0; X[V]; V++) {
                                    U.push(X[V])
                                }
                            }
                        }
                        return U
                    }
                }
            var K;
            if (document.documentElement.compareDocumentPosition) {
                    K = function (U, T) {
                        var V = U.compareDocumentPosition(T) & 4 ? -1 : U === T ? 0 : 1;
                        if (V === 0) {
                            hasDuplicate = true
                        }
                        return V
                    }
                } else {
                    if ("sourceIndex" in document.documentElement) {
                        K = function (U, T) {
                            var V = U.sourceIndex - T.sourceIndex;
                            if (V === 0) {
                                hasDuplicate = true
                            }
                            return V
                        }
                    } else {
                        if (document.createRange) {
                            K = function (U, T) {
                                var W = U.ownerDocument.createRange(),
                                    X = T.ownerDocument.createRange();
                                W.setStart(U, 0);
                                W.setEnd(U, 0);
                                X.setStart(T, 0);
                                X.setEnd(T, 0);
                                var V = W.compareBoundaryPoints(Range.START_TO_END, X);
                                if (V === 0) {
                                        hasDuplicate = true
                                    }
                                return V
                            }
                        }
                    }
                }(function () {
                    var U = document.createElement("form"),
                        V = "script" + (new Date).getTime();
                    U.innerHTML = "<input name='" + V + "'/>";
                    var T = document.documentElement;
                    T.insertBefore(U, T.firstChild);
                    if ( !! document.getElementById(V)) {
                            F.find.ID = function (X, Y, Z) {
                                if (typeof Y.getElementById !== "undefined" && !Z) {
                                    var W = Y.getElementById(X[1]);
                                    return W ? W.id === X[1] || typeof W.getAttributeNode !== "undefined" && W.getAttributeNode("id").nodeValue === X[1] ? [W] : j : []
                                }
                            };
                            F.filter.ID = function (Y, W) {
                                var X = typeof Y.getAttributeNode !== "undefined" && Y.getAttributeNode("id");
                                return Y.nodeType === 1 && X && X.nodeValue === W
                            }
                        }
                    T.removeChild(U)
                })();
                (function () {
                    var T = document.createElement("div");
                    T.appendChild(document.createComment(""));
                    if (T.getElementsByTagName("*").length > 0) {
                        F.find.TAG = function (U, Y) {
                            var X = Y.getElementsByTagName(U[1]);
                            if (U[1] === "*") {
                                var W = [];
                                for (var V = 0; X[V]; V++) {
                                    if (X[V].nodeType === 1) {
                                        W.push(X[V])
                                    }
                                }
                                X = W
                            }
                            return X
                        }
                    }
                    T.innerHTML = "<a href='#'></a>";
                    if (T.firstChild && typeof T.firstChild.getAttribute !== "undefined" && T.firstChild.getAttribute("href") !== "#") {
                        F.attrHandle.href = function (U) {
                            return U.getAttribute("href", 2)
                        }
                    }
                })();
            if (document.querySelectorAll) {
                    (function () {
                        var T = N,
                            U = document.createElement("div");
                        U.innerHTML = "<p class='TEST'></p>";
                        if (U.querySelectorAll && U.querySelectorAll(".TEST").length === 0) {
                                return
                            }
                        N = function (Y, X, V, W) {
                                X = X || document;
                                if (!W && X.nodeType === 9 && !Q(X)) {
                                    try {
                                        return E(X.querySelectorAll(Y), V)
                                    } catch (Z) {}
                                }
                                return T(Y, X, V, W)
                            };
                        N.find = T.find;
                        N.filter = T.filter;
                        N.selectors = T.selectors;
                        N.matches = T.matches
                    })()
                }
            if (document.getElementsByClassName && document.documentElement.getElementsByClassName) {
                    (function () {
                        var T = document.createElement("div");
                        T.innerHTML = "<div class='test e'></div><div class='test'></div>";
                        if (T.getElementsByClassName("e").length === 0) {
                            return
                        }
                        T.lastChild.className = "e";
                        if (T.getElementsByClassName("e").length === 1) {
                            return
                        }
                        F.order.splice(1, 0, "CLASS");
                        F.find.CLASS = function (U, V, W) {
                            if (typeof V.getElementsByClassName !== "undefined" && !W) {
                                return V.getElementsByClassName(U[1])
                            }
                        }
                    })()
                }
            function P(U, ab, Y, ac, aa, ad) {
                    var Z = U == "previousSibling" && !ad;
                    for (var W = 0, V = ac.length; W < V; W++) {
                        var T = ac[W];
                        if (T) {
                            if (Z && T.nodeType === 1) {
                                T.sizcache = Y;
                                T.sizset = W
                            }
                            T = T[U];
                            var X = false;
                            while (T) {
                                if (T.sizcache === Y) {
                                    X = ac[T.sizset];
                                    break
                                }
                                if (T.nodeType === 1 && !ad) {
                                    T.sizcache = Y;
                                    T.sizset = W
                                }
                                if (T.nodeName === ab) {
                                    X = T;
                                    break
                                }
                                T = T[U]
                            }
                            ac[W] = X
                        }
                    }
                }
            function S(U, ab, Y, ac, aa, ad) {
                    var Z = U == "previousSibling" && !ad;
                    for (var W = 0, V = ac.length; W < V; W++) {
                        var T = ac[W];
                        if (T) {
                            if (Z && T.nodeType === 1) {
                                T.sizcache = Y;
                                T.sizset = W
                            }
                            T = T[U];
                            var X = false;
                            while (T) {
                                if (T.sizcache === Y) {
                                    X = ac[T.sizset];
                                    break
                                }
                                if (T.nodeType === 1) {
                                    if (!ad) {
                                        T.sizcache = Y;
                                        T.sizset = W
                                    }
                                    if (typeof ab !== "string") {
                                        if (T === ab) {
                                            X = true;
                                            break
                                        }
                                    } else {
                                        if (N.filter(ab, [T]).length > 0) {
                                            X = T;
                                            break
                                        }
                                    }
                                }
                                T = T[U]
                            }
                            ac[W] = X
                        }
                    }
                }
            var J = document.compareDocumentPosition ?
            function (U, T) {
                    return U.compareDocumentPosition(T) & 16
                } : function (U, T) {
                    return U !== T && (U.contains ? U.contains(T) : true)
                };
            var Q = function (T) {
                    return T.nodeType === 9 && T.documentElement.nodeName !== "HTML" || !! T.ownerDocument && Q(T.ownerDocument)
                };
            var H = function (T, Z) {
                    var aa = [],
                        W = "",
                        X, V = Z.nodeType ? [Z] : Z;
                    while ((X = F.match.PSEUDO.exec(T))) {
                            W += X[0];
                            T = T.replace(F.match.PSEUDO, "")
                        }
                    T = F.relative[T] ? T + "*" : T;
                    for (var Y = 0, U = V.length; Y < U; Y++) {
                            N(T, V[Y], aa)
                        }
                    return N.filter(W, aa)
                };
            b.find = N;
            b.filter = N.filter;
            b.expr = N.selectors;
            b.expr[":"] = b.expr.filters;
            N.selectors.filters.hidden = function (T) {
                    return T.offsetWidth === 0 || T.offsetHeight === 0
                };
            N.selectors.filters.visible = function (T) {
                    return T.offsetWidth > 0 || T.offsetHeight > 0
                };
            N.selectors.filters.animated = function (T) {
                    return b.grep(b.timers, function (U) {
                        return T === U.elem
                    }).length
                };
            b.multiFilter = function (V, T, U) {
                    if (U) {
                        V = ":not(" + V + ")"
                    }
                    return N.matches(V, T)
                };
            b.dir = function (V, U) {
                    var T = [],
                        W = V[U];
                    while (W && W != document) {
                            if (W.nodeType == 1) {
                                T.push(W)
                            }
                            W = W[U]
                        }
                    return T
                };
            b.nth = function (X, W, U, V) {
                    W = W || 1;
                    var T = 0;
                    for (; X; X = X[U]) {
                        if (X.nodeType == 1 && ++T == W) {
                            break
                        }
                    }
                    return X
                };
            b.sibling = function (V, U) {
                    var T = [];
                    for (; V; V = V.nextSibling) {
                        if (V.nodeType == 1 && V != U) {
                            T.push(V)
                        }
                    }
                    return T
                };
            return;
            g.Sizzle = N
        })();
    b.event = {
            add: function (J, G, I, K) {
                if (J.nodeType == 3 || J.nodeType == 8) {
                    return
                }
                if (J.setInterval && J != g) {
                    J = g
                }
                if (!I.guid) {
                    I.guid = this.guid++
                }
                if (K !== j) {
                    var H = I;
                    I = this.proxy(H);
                    I.data = K
                }
                var F = b.data(J, "events") || b.data(J, "events", {}),
                    E = b.data(J, "handle") || b.data(J, "handle", function () {
                        return typeof b !== "undefined" && !b.event.triggered ? b.event.handle.apply(arguments.callee.elem, arguments) : j
                    });
                E.elem = J;
                b.each(G.split(/\s+/), function (M, N) {
                        var O = N.split(".");
                        N = O.shift();
                        I.type = O.slice().sort().join(".");
                        var L = F[N];
                        if (b.event.specialAll[N]) {
                            b.event.specialAll[N].setup.call(J, K, O)
                        }
                        if (!L) {
                            L = F[N] = {};
                            if (!b.event.special[N] || b.event.special[N].setup.call(J, K, O) === false) {
                                if (J.addEventListener) {
                                    J.addEventListener(N, E, false)
                                } else {
                                    if (J.attachEvent) {
                                        J.attachEvent("on" + N, E)
                                    }
                                }
                            }
                        }
                        L[I.guid] = I;
                        b.event.global[N] = true
                    });
                J = null
            },
            guid: 1,
            global: {},
            remove: function (L, I, K) {
                if (L.nodeType == 3 || L.nodeType == 8) {
                    return
                }
                var H = b.data(L, "events"),
                    G, F;
                if (H) {
                        if (I === j || (typeof I === "string" && I.charAt(0) == ".")) {
                            for (var J in H) {
                                this.remove(L, J + (I || ""))
                            }
                        } else {
                            if (I.type) {
                                K = I.handler;
                                I = I.type
                            }
                            b.each(I.split(/\s+/), function (N, P) {
                                var Q = P.split(".");
                                P = Q.shift();
                                var O = RegExp("(^|\\.)" + Q.slice().sort().join(".*\\.") + "(\\.|$)");
                                if (H[P]) {
                                    if (K) {
                                        delete H[P][K.guid]
                                    } else {
                                        for (var M in H[P]) {
                                            if (O.test(H[P][M].type)) {
                                                delete H[P][M]
                                            }
                                        }
                                    }
                                    if (b.event.specialAll[P]) {
                                        b.event.specialAll[P].teardown.call(L, Q)
                                    }
                                    for (G in H[P]) {
                                        break
                                    }
                                    if (!G) {
                                        if (!b.event.special[P] || b.event.special[P].teardown.call(L, Q) === false) {
                                            if (L.removeEventListener) {
                                                L.removeEventListener(P, b.data(L, "handle"), false)
                                            } else {
                                                if (L.detachEvent) {
                                                    L.detachEvent("on" + P, b.data(L, "handle"))
                                                }
                                            }
                                        }
                                        G = null;
                                        delete H[P]
                                    }
                                }
                            })
                        }
                        for (G in H) {
                            break
                        }
                        if (!G) {
                            var E = b.data(L, "handle");
                            if (E) {
                                E.elem = null
                            }
                            b.removeData(L, "events");
                            b.removeData(L, "handle")
                        }
                    }
            },
            trigger: function (J, K, I, G) {
                var H = J.type || J;
                if (!G) {
                    J = typeof J === "object" ? J[i] ? J : b.extend(b.Event(H), J) : b.Event(H);
                    if (H.indexOf("!") >= 0) {
                        J.type = H = H.slice(0, -1);
                        J.exclusive = true
                    }
                    if (!I) {
                        J.stopPropagation();
                        if (this.global[H]) {
                            b.each(b.cache, function () {
                                if (this.events && this.events[H]) {
                                    b.event.trigger(J, K, this.handle.elem)
                                }
                            })
                        }
                    }
                    if (!I || I.nodeType == 3 || I.nodeType == 8) {
                        return j
                    }
                    J.result = j;
                    J.target = I;
                    K = b.makeArray(K);
                    K.unshift(J)
                }
                J.currentTarget = I;
                var E = b.data(I, "handle");
                if (E) {
                    E.apply(I, K)
                }
                if ((!I[H] || (b.nodeName(I, "a") && H == "click")) && I["on" + H] && I["on" + H].apply(I, K) === false) {
                    J.result = false
                }
                if (!G && I[H] && !J.isDefaultPrevented() && !(b.nodeName(I, "a") && H == "click")) {
                    this.triggered = true;
                    try {
                        I[H]()
                    } catch (L) {}
                }
                this.triggered = false;
                if (!J.isPropagationStopped()) {
                    var F = I.parentNode || I.ownerDocument;
                    if (F) {
                        b.event.trigger(J, K, F, true)
                    }
                }
            },
            handle: function (K) {
                var J, E;
                K = arguments[0] = b.event.fix(K || g.event);
                K.currentTarget = this;
                var L = K.type.split(".");
                K.type = L.shift();
                J = !L.length && !K.exclusive;
                var I = RegExp("(^|\\.)" + L.slice().sort().join(".*\\.") + "(\\.|$)");
                E = (b.data(this, "events") || {})[K.type];
                for (var G in E) {
                    var H = E[G];
                    if (J || I.test(H.type)) {
                        K.handler = H;
                        K.data = H.data;
                        var F = H.apply(this, arguments);
                        if (F !== j) {
                            K.result = F;
                            if (F === false) {
                                K.preventDefault();
                                K.stopPropagation()
                            }
                        }
                        if (K.isImmediatePropagationStopped()) {
                            break
                        }
                    }
                }
            },
            props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
            fix: function (H) {
                if (H[i]) {
                    return H
                }
                var F = H;
                H = b.Event(F);
                for (var G = this.props.length, J; G;) {
                    J = this.props[--G];
                    H[J] = F[J]
                }
                if (!H.target) {
                    H.target = H.srcElement || document
                }
                if (H.target.nodeType == 3) {
                    H.target = H.target.parentNode
                }
                if (!H.relatedTarget && H.fromElement) {
                    H.relatedTarget = H.fromElement == H.target ? H.toElement : H.fromElement
                }
                if (H.pageX == null && H.clientX != null) {
                    var I = document.documentElement,
                        E = document.body;
                    H.pageX = H.clientX + (I && I.scrollLeft || E && E.scrollLeft || 0) - (I.clientLeft || 0);
                    H.pageY = H.clientY + (I && I.scrollTop || E && E.scrollTop || 0) - (I.clientTop || 0)
                }
                if (!H.which && ((H.charCode || H.charCode === 0) ? H.charCode : H.keyCode)) {
                    H.which = H.charCode || H.keyCode
                }
                if (!H.metaKey && H.ctrlKey) {
                    H.metaKey = H.ctrlKey
                }
                if (!H.which && H.button) {
                    H.which = (H.button & 1 ? 1 : (H.button & 2 ? 3 : (H.button & 4 ? 2 : 0)))
                }
                return H
            },
            proxy: function (F, E) {
                E = E ||
                function () {
                    return F.apply(this, arguments)
                };
                E.guid = F.guid = F.guid || E.guid || this.guid++;
                return E
            },
            special: {
                ready: {
                    setup: q,
                    teardown: function () {}
                }
            },
            specialAll: {
                live: {
                    setup: function (E, F) {
                        b.event.add(this, F[0], n)
                    },
                    teardown: function (G) {
                        if (G.length) {
                            var F = 0,
                                E = RegExp("(^|\\.)" + G[0] + "(\\.|$)");
                            b.each((b.data(this, "events").live || {}), function () {
                                    if (E.test(this.type)) {
                                        F++
                                    }
                                });
                            if (F < 1) {
                                    b.event.remove(this, G[0], n)
                                }
                        }
                    }
                }
            }
        };
    b.Event = function (E) {
            if (!this.preventDefault) {
                return new b.Event(E)
            }
            if (E && E.type) {
                this.originalEvent = E;
                this.type = E.type
            } else {
                this.type = E
            }
            this.timeStamp = d();
            this[i] = true
        };

    function f() {
            return false
        }
    function u() {
            return true
        }
    b.Event.prototype = {
            preventDefault: function () {
                this.isDefaultPrevented = u;
                var E = this.originalEvent;
                if (!E) {
                    return
                }
                if (E.preventDefault) {
                    E.preventDefault()
                }
                E.returnValue = false
            },
            stopPropagation: function () {
                this.isPropagationStopped = u;
                var E = this.originalEvent;
                if (!E) {
                    return
                }
                if (E.stopPropagation) {
                    E.stopPropagation()
                }
                E.cancelBubble = true
            },
            stopImmediatePropagation: function () {
                this.isImmediatePropagationStopped = u;
                this.stopPropagation()
            },
            isDefaultPrevented: f,
            isPropagationStopped: f,
            isImmediatePropagationStopped: f
        };
    var a = function (F) {
            var E = F.relatedTarget;
            while (E && E != this) {
                try {
                    E = E.parentNode
                } catch (G) {
                    E = this
                }
            }
            if (E != this) {
                F.type = F.data;
                b.event.handle.apply(this, arguments)
            }
        };
    b.each({
            mouseover: "mouseenter",
            mouseout: "mouseleave"
        }, function (F, E) {
            b.event.special[E] = {
                setup: function () {
                    b.event.add(this, F, a, E)
                },
                teardown: function () {
                    b.event.remove(this, F, a)
                }
            }
        });
    b.fn.extend({
            bind: function (F, G, E) {
                return F == "unload" ? this.one(F, G, E) : this.each(function () {
                    b.event.add(this, F, E || G, E && G)
                })
            },
            one: function (G, H, F) {
                var E = b.event.proxy(F || H, function (I) {
                    b(this).unbind(I, E);
                    return (F || H).apply(this, arguments)
                });
                return this.each(function () {
                    b.event.add(this, G, E, F && H)
                })
            },
            unbind: function (F, E) {
                return this.each(function () {
                    b.event.remove(this, F, E)
                })
            },
            trigger: function (E, F) {
                return this.each(function () {
                    b.event.trigger(E, F, this)
                })
            },
            triggerHandler: function (E, G) {
                if (this[0]) {
                    var F = b.Event(E);
                    F.preventDefault();
                    F.stopPropagation();
                    b.event.trigger(F, G, this[0]);
                    return F.result
                }
            },
            toggle: function (G) {
                var E = arguments,
                    F = 1;
                while (F < E.length) {
                        b.event.proxy(G, E[F++])
                    }
                return this.click(b.event.proxy(G, function (H) {
                        this.lastToggle = (this.lastToggle || 0) % F;
                        H.preventDefault();
                        return E[this.lastToggle++].apply(this, arguments) || false
                    }))
            },
            hover: function (E, F) {
                return this.mouseenter(E).mouseleave(F)
            },
            ready: function (E) {
                q();
                if (b.isReady) {
                    E.call(document, b)
                } else {
                    b.readyList.push(E)
                }
                return this
            },
            live: function (G, F) {
                var E = b.event.proxy(F);
                E.guid += this.selector + G;
                b(document).bind(h(G, this.selector), this.selector, E);
                return this
            },
            die: function (F, E) {
                b(document).unbind(h(F, this.selector), E ? {
                    guid: E.guid + this.selector + F
                } : null);
                return this
            }
        });

    function n(H) {
            var E = RegExp("(^|\\.)" + H.type + "(\\.|$)"),
                G = true,
                F = [];
            b.each(b.data(this, "events").live || [], function (I, J) {
                    if (E.test(J.type)) {
                        var K = b(H.target).closest(J.data)[0];
                        if (K) {
                            F.push({
                                elem: K,
                                fn: J
                            })
                        }
                    }
                });
            F.sort(function (J, I) {
                    return b.data(J.elem, "closest") - b.data(I.elem, "closest")
                });
            b.each(F, function () {
                    if (this.fn.call(this.elem, H, this.fn.data) === false) {
                        return (G = false)
                    }
                });
            return G
        }
    function h(F, E) {
            return ["live", F, E.replace(/\./g, "`").replace(/ /g, "|")].join(".")
        }
    b.extend({
            isReady: false,
            readyList: [],
            ready: function () {
                if (!b.isReady) {
                    b.isReady = true;
                    if (b.readyList) {
                        b.each(b.readyList, function () {
                            this.call(document, b)
                        });
                        b.readyList = null
                    }
                    b(document).triggerHandler("ready")
                }
            }
        });
    var y = false;

    function q() {
            if (y) {
                return
            }
            y = true;
            if (document.addEventListener) {
                document.addEventListener("DOMContentLoaded", function () {
                    document.removeEventListener("DOMContentLoaded", arguments.callee, false);
                    b.ready()
                }, false)
            } else {
                if (document.attachEvent) {
                    document.attachEvent("onreadystatechange", function () {
                        if (document.readyState === "complete") {
                            document.detachEvent("onreadystatechange", arguments.callee);
                            b.ready()
                        }
                    });
                    if (document.documentElement.doScroll && g == g.top) {
                        (function () {
                            if (b.isReady) {
                                return
                            }
                            try {
                                document.documentElement.doScroll("left")
                            } catch (E) {
                                setTimeout(arguments.callee, 0);
                                return
                            }
                            b.ready()
                        })()
                    }
                }
            }
            b.event.add(g, "load", b.ready)
        }
    b.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","), function (F, E) {
            b.fn[E] = function (G) {
                return G ? this.bind(E, G) : this.trigger(E)
            }
        });
    b(g).bind("unload", function () {
            for (var E in b.cache) {
                if (E != 1 && b.cache[E].handle) {
                    b.event.remove(b.cache[E].handle.elem)
                }
            }
        });
        (function () {
            b.support = {};
            var F = document.documentElement,
                H = document.createElement("script"),
                K = document.createElement("div"),
                J = "script" + (new Date).getTime();
            K.style.display = "none";
            K.innerHTML = '   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
            var G = K.getElementsByTagName("*"),
                E = K.getElementsByTagName("a")[0];
            if (!G || !G.length || !E) {
                    return
                }
            b.support = {
                    leadingWhitespace: K.firstChild.nodeType == 3,
                    tbody: !K.getElementsByTagName("tbody").length,
                    objectAll: !! K.getElementsByTagName("object")[0].getElementsByTagName("*").length,
                    htmlSerialize: !! K.getElementsByTagName("link").length,
                    style: /red/.test(E.getAttribute("style")),
                    hrefNormalized: E.getAttribute("href") === "/a",
                    opacity: E.style.opacity === "0.5",
                    cssFloat: !! E.style.cssFloat,
                    scriptEval: false,
                    noCloneEvent: true,
                    boxModel: null
                };
            H.type = "text/javascript";
            try {
                    H.appendChild(document.createTextNode("window." + J + "=1;"))
                } catch (I) {}
            F.insertBefore(H, F.firstChild);
            if (g[J]) {
                    b.support.scriptEval = true;
                    delete g[J]
                }
            F.removeChild(H);
            if (K.attachEvent && K.fireEvent) {
                    K.attachEvent("onclick", function () {
                        b.support.noCloneEvent = false;
                        K.detachEvent("onclick", arguments.callee)
                    });
                    K.cloneNode(true).fireEvent("onclick")
                }
            b(function () {
                    var L = document.createElement("div");
                    L.style.width = L.style.paddingLeft = "1px";
                    document.body.appendChild(L);
                    b.boxModel = b.support.boxModel = L.offsetWidth === 2;
                    document.body.removeChild(L).style.display = "none"
                })
        })();
    var w = b.support.cssFloat ? "cssFloat" : "styleFloat";
    b.props = {
            "for": "htmlFor",
            "class": "className",
            "float": w,
            cssFloat: w,
            styleFloat: w,
            readonly: "readOnly",
            maxlength: "maxLength",
            cellspacing: "cellSpacing",
            rowspan: "rowSpan",
            tabindex: "tabIndex"
        };
    b.fn.extend({
            _load: b.fn.load,
            load: function (G, K, I) {
                if (typeof G !== "string") {
                    return this._load(G)
                }
                var J = G.indexOf(" ");
                if (J >= 0) {
                    var E = G.slice(J, G.length);
                    G = G.slice(0, J)
                }
                var H = "GET";
                if (K) {
                    if (b.isFunction(K)) {
                        I = K;
                        K = null
                    } else {
                        if (typeof K === "object") {
                            K = b.param(K);
                            H = "POST"
                        }
                    }
                }
                var F = this;
                b.ajax({
                    url: G,
                    type: H,
                    dataType: "html",
                    data: K,
                    complete: function (L, M) {
                        if (M == "success" || M == "notmodified") {
                            F.html(E ? b("<div/>").append(L.responseText.replace(/<script(.|\s)*?\/script>/g, "")).find(E) : L.responseText)
                        }
                        if (I) {
                            F.each(I, [L.responseText, M, L])
                        }
                    }
                });
                return this
            },
            serialize: function () {
                return b.param(this.serializeArray())
            },
            serializeArray: function () {
                return this.map(function () {
                    return this.elements ? b.makeArray(this.elements) : this
                }).filter(function () {
                    return this.name && !this.disabled && (this.checked || /select|textarea/i.test(this.nodeName) || /text|hidden|password|search/i.test(this.type))
                }).map(function (E, F) {
                    var G = b(this).val();
                    return G == null ? null : b.isArray(G) ? b.map(G, function (I, H) {
                        return {
                            name: F.name,
                            value: I
                        }
                    }) : {
                        name: F.name,
                        value: G
                    }
                }).get()
            }
        });
    b.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function (E, F) {
            b.fn[F] = function (G) {
                return this.bind(F, G)
            }
        });
    var s = d();
    b.extend({
            get: function (E, G, H, F) {
                if (b.isFunction(G)) {
                    H = G;
                    G = null
                }
                return b.ajax({
                    type: "GET",
                    url: E,
                    data: G,
                    success: H,
                    dataType: F
                })
            },
            getScript: function (E, F) {
                return b.get(E, null, F, "script")
            },
            getJSON: function (E, F, G) {
                return b.get(E, F, G, "json")
            },
            post: function (E, G, H, F) {
                if (b.isFunction(G)) {
                    H = G;
                    G = {}
                }
                return b.ajax({
                    type: "POST",
                    url: E,
                    data: G,
                    success: H,
                    dataType: F
                })
            },
            ajaxSetup: function (E) {
                b.extend(b.ajaxSettings, E)
            },
            ajaxSettings: {
                url: location.href,
                global: true,
                type: "GET",
                contentType: "application/x-www-form-urlencoded",
                processData: true,
                async: true,
                xhr: function () {
                    return g.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest()
                },
                accepts: {
                    xml: "application/xml, text/xml",
                    html: "text/html",
                    script: "text/javascript, application/javascript",
                    json: "application/json, text/javascript",
                    text: "text/plain",
                    _default: "*/*"
                }
            },
            lastModified: {},
            ajax: function (L) {
                L = b.extend(true, L, b.extend(true, {}, b.ajaxSettings, L));
                var V, F = /=\?(&|$)/g,
                    Q, S, G = L.type.toUpperCase();
                if (L.data && L.processData && typeof L.data !== "string") {
                        L.data = b.param(L.data)
                    }
                if (L.dataType == "jsonp") {
                        if (G == "GET") {
                            if (!L.url.match(F)) {
                                L.url += (L.url.match(/\?/) ? "&" : "?") + (L.jsonp || "callback") + "=?"
                            }
                        } else {
                            if (!L.data || !L.data.match(F)) {
                                L.data = (L.data ? L.data + "&" : "") + (L.jsonp || "callback") + "=?"
                            }
                        }
                        L.dataType = "json"
                    }
                if (L.dataType == "json" && (L.data && L.data.match(F) || L.url.match(F))) {
                        V = "jsonp" + s++;
                        if (L.data) {
                            L.data = (L.data + "").replace(F, "=" + V + "$1")
                        }
                        L.url = L.url.replace(F, "=" + V + "$1");
                        L.dataType = "script";
                        g[V] = function (X) {
                            S = X;
                            H();
                            U();
                            g[V] = j;
                            try {
                                delete g[V]
                            } catch (Y) {}
                            if (I) {
                                I.removeChild(N)
                            }
                        }
                    }
                if (L.dataType == "script" && L.cache == null) {
                        L.cache = false
                    }
                if (L.cache === false && G == "GET") {
                        var E = d();
                        var T = L.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + E + "$2");
                        L.url = T + ((T == L.url) ? (L.url.match(/\?/) ? "&" : "?") + "_=" + E : "")
                    }
                if (L.data && G == "GET") {
                        L.url += (L.url.match(/\?/) ? "&" : "?") + L.data;
                        L.data = null
                    }
                if (L.global && !b.active++) {
                        b.event.trigger("ajaxStart")
                    }
                var P = /^(\w+:)?\/\/([^\/?#]+)/.exec(L.url);
                if (L.dataType == "script" && G == "GET" && P && (P[1] && P[1] != location.protocol || P[2] != location.host)) {
                        var I = document.getElementsByTagName("head")[0];
                        var N = document.createElement("script");
                        N.src = L.url;
                        if (L.scriptCharset) {
                            N.charset = L.scriptCharset
                        }
                        if (!V) {
                            var M = false;
                            N.onload = N.onreadystatechange = function () {
                                if (!M && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) {
                                    M = true;
                                    H();
                                    U();
                                    N.onload = N.onreadystatechange = null;
                                    I.removeChild(N)
                                }
                            }
                        }
                        I.appendChild(N);
                        return j
                    }
                var K = false;
                var J = L.xhr();
                if (L.username) {
                        J.open(G, L.url, L.async, L.username, L.password)
                    } else {
                        J.open(G, L.url, L.async)
                    }
                try {
                        if (L.data) {
                            J.setRequestHeader("Content-Type", L.contentType)
                        }
                        if (L.ifModified) {
                            J.setRequestHeader("If-Modified-Since", b.lastModified[L.url] || "Thu, 01 Jan 1970 00:00:00 GMT")
                        }
                        J.setRequestHeader("X-Requested-With", "XMLHttpRequest");
                        J.setRequestHeader("Accept", L.dataType && L.accepts[L.dataType] ? L.accepts[L.dataType] + ", */*" : L.accepts._default)
                    } catch (R) {}
                if (L.beforeSend && L.beforeSend(J, L) === false) {
                        if (L.global && !--b.active) {
                            b.event.trigger("ajaxStop")
                        }
                        J.abort();
                        return false
                    }
                if (L.global) {
                        b.event.trigger("ajaxSend", [J, L])
                    }
                var W = function (Y) {
                        if (J.readyState == 0) {
                            if (O) {
                                clearInterval(O);
                                O = null;
                                if (L.global && !--b.active) {
                                    b.event.trigger("ajaxStop")
                                }
                            }
                        } else {
                            if (!K && J && (J.readyState == 4 || Y == "timeout")) {
                                K = true;
                                if (O) {
                                    clearInterval(O);
                                    O = null
                                }
                                Q = Y == "timeout" ? "timeout" : !b.httpSuccess(J) ? "error" : L.ifModified && b.httpNotModified(J, L.url) ? "notmodified" : "success";
                                if (Q == "success") {
                                    try {
                                        S = b.httpData(J, L.dataType, L)
                                    } catch (Z) {
                                        Q = "parsererror"
                                    }
                                }
                                if (Q == "success") {
                                    var X;
                                    try {
                                        X = J.getResponseHeader("Last-Modified")
                                    } catch (Z) {}
                                    if (L.ifModified && X) {
                                        b.lastModified[L.url] = X
                                    }
                                    if (!V) {
                                        H()
                                    }
                                } else {
                                    b.handleError(L, J, Q)
                                }
                                U();
                                if (Y) {
                                    J.abort()
                                }
                                if (L.async) {
                                    J = null
                                }
                            }
                        }
                    };
                if (L.async) {
                        var O = setInterval(W, 13);
                        if (L.timeout > 0) {
                            setTimeout(function () {
                                if (J && !K) {
                                    W("timeout")
                                }
                            }, L.timeout)
                        }
                    }
                try {
                        J.send(L.data)
                    } catch (R) {
                        b.handleError(L, J, null, R)
                    }
                if (!L.async) {
                        W()
                    }
                function H() {
                        if (L.success) {
                            L.success(S, Q)
                        }
                        if (L.global) {
                            b.event.trigger("ajaxSuccess", [J, L])
                        }
                    }
                function U() {
                        if (L.complete) {
                            L.complete(J, Q)
                        }
                        if (L.global) {
                            b.event.trigger("ajaxComplete", [J, L])
                        }
                        if (L.global && !--b.active) {
                            b.event.trigger("ajaxStop")
                        }
                    }
                return J
            },
            handleError: function (E, H, F, G) {
                if (E.error) {
                    E.error(H, F, G)
                }
                if (E.global) {
                    b.event.trigger("ajaxError", [H, E, G])
                }
            },
            active: 0,
            httpSuccess: function (F) {
                try {
                    return !F.status && location.protocol == "file:" || (F.status >= 200 && F.status < 300) || F.status == 304 || F.status == 1223
                } catch (E) {}
                return false
            },
            httpNotModified: function (H, E) {
                try {
                    var G = H.getResponseHeader("Last-Modified");
                    return H.status == 304 || G == b.lastModified[E]
                } catch (F) {}
                return false
            },
            httpData: function (J, H, G) {
                var F = J.getResponseHeader("content-type"),
                    E = H == "xml" || !H && F && F.indexOf("xml") >= 0,
                    I = E ? J.responseXML : J.responseText;
                if (E && I.documentElement.tagName == "parsererror") {
                        throw "parsererror"
                    }
                if (G && G.dataFilter) {
                        I = G.dataFilter(I, H)
                    }
                if (typeof I === "string") {
                        if (H == "script") {
                            b.globalEval(I)
                        }
                        if (H == "json") {
                            I = g["eval"]("(" + I + ")")
                        }
                    }
                return I
            },
            param: function (E) {
                var G = [];

                function H(I, J) {
                    G[G.length] = encodeURIComponent(I) + "=" + encodeURIComponent(J)
                }
                if (b.isArray(E) || E.jquery) {
                    b.each(E, function () {
                        H(this.name, this.value)
                    })
                } else {
                    for (var F in E) {
                        if (b.isArray(E[F])) {
                            b.each(E[F], function () {
                                H(F, this)
                            })
                        } else {
                            H(F, b.isFunction(E[F]) ? E[F]() : E[F])
                        }
                    }
                }
                return G.join("&").replace(/%20/g, "+")
            }
        });
    var e = {},
        c, m = [
            ["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom"],
            ["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight"],
            ["opacity"]
    ];

    function t(F, E) {
            var G = {};
            b.each(m.concat.apply([], m.slice(0, E)), function () {
                G[this] = F
            });
            return G
        }
    b.fn.extend({
            show: function (J, L) {
                if (J) {
                    return this.animate(t("show", 3), J, L)
                } else {
                    for (var H = 0, F = this.length; H < F; H++) {
                        var E = b.data(this[H], "olddisplay");
                        this[H].style.display = E || "";
                        if (b.css(this[H], "display") === "none") {
                            var G = this[H].tagName,
                                K;
                            if (e[G]) {
                                    K = e[G]
                                } else {
                                    var I = b("<" + G + " />").appendTo("body");
                                    K = I.css("display");
                                    if (K === "none") {
                                        K = "block"
                                    }
                                    I.remove();
                                    e[G] = K
                                }
                            b.data(this[H], "olddisplay", K)
                        }
                    }
                    for (var H = 0, F = this.length; H < F; H++) {
                        this[H].style.display = b.data(this[H], "olddisplay") || ""
                    }
                    return this
                }
            },
            hide: function (H, I) {
                if (H) {
                    return this.animate(t("hide", 3), H, I)
                } else {
                    for (var G = 0, F = this.length; G < F; G++) {
                        var E = b.data(this[G], "olddisplay");
                        if (!E && E !== "none") {
                            b.data(this[G], "olddisplay", b.css(this[G], "display"))
                        }
                    }
                    for (var G = 0, F = this.length; G < F; G++) {
                        this[G].style.display = "none"
                    }
                    return this
                }
            },
            _toggle: b.fn.toggle,
            toggle: function (G, F) {
                var E = typeof G === "boolean";
                return b.isFunction(G) && b.isFunction(F) ? this._toggle.apply(this, arguments) : G == null || E ? this.each(function () {
                    var H = E ? G : b(this).is(":hidden");
                    b(this)[H ? "show" : "hide"]()
                }) : this.animate(t("toggle", 3), G, F)
            },
            fadeTo: function (E, G, F) {
                return this.animate({
                    opacity: G
                }, E, F)
            },
            animate: function (I, F, H, G) {
                var E = b.speed(F, H, G);
                return this[E.queue === false ? "each" : "queue"](function () {
                    var L = b.extend({}, E),
                        M, J = this.nodeType == 1 && b(this).is(":hidden"),
                        K = this;
                    for (M in I) {
                            if (I[M] == "hide" && J || I[M] == "show" && !J) {
                                return L.complete.call(this)
                            }
                            if ((M == "height" || M == "width") && this.style) {
                                L.display = b.css(this, "display");
                                L.overflow = this.style.overflow
                            }
                        }
                    if (L.overflow != null) {
                            this.style.overflow = "hidden"
                        }
                    L.curAnim = b.extend({}, I);
                    b.each(I, function (O, S) {
                            var R = new b.fx(K, L, O);
                            if (/toggle|show|hide/.test(S)) {
                                R[S == "toggle" ? J ? "show" : "hide" : S](I)
                            } else {
                                var Q = S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
                                    T = R.cur(true) || 0;
                                if (Q) {
                                        var N = parseFloat(Q[2]),
                                            P = Q[3] || "px";
                                        if (P != "px") {
                                                K.style[O] = (N || 1) + P;
                                                T = ((N || 1) / R.cur(true)) * T;
                                                K.style[O] = T + P
                                            }
                                        if (Q[1]) {
                                                N = ((Q[1] == "-=" ? -1 : 1) * N) + T
                                            }
                                        R.custom(T, N, P)
                                    } else {
                                        R.custom(T, S, "")
                                    }
                            }
                        });
                    return true
                })
            },
            stop: function (F, G) {
                var E = b.timers;
                if (F) {
                    this.queue([])
                }
                this.each(function () {
                    for (var H = E.length - 1; H >= 0; H--) {
                        if (E[H].elem == this) {
                            if (G) {
                                E[H](true)
                            }
                            E.splice(H, 1)
                        }
                    }
                });
                if (!G) {
                    this.dequeue()
                }
                return this
            }
        });
    b.each({
            slideDown: t("show", 1),
            slideUp: t("hide", 1),
            slideToggle: t("toggle", 1),
            fadeIn: {
                opacity: "show"
            },
            fadeOut: {
                opacity: "hide"
            }
        }, function (E, F) {
            b.fn[E] = function (G, H) {
                return this.animate(F, G, H)
            }
        });
    b.extend({
            speed: function (G, H, F) {
                var E = typeof G === "object" ? G : {
                    complete: F || !F && H || b.isFunction(G) && G,
                    duration: G,
                    easing: F && H || H && !b.isFunction(H) && H
                };
                E.duration = b.fx.off ? 0 : typeof E.duration === "number" ? E.duration : b.fx.speeds[E.duration] || b.fx.speeds._default;
                E.old = E.complete;
                E.complete = function () {
                    if (E.queue !== false) {
                        b(this).dequeue()
                    }
                    if (b.isFunction(E.old)) {
                        E.old.call(this)
                    }
                };
                return E
            },
            easing: {
                linear: function (G, H, E, F) {
                    return E + F * G
                },
                swing: function (G, H, E, F) {
                    return ((-Math.cos(G * Math.PI) / 2) + 0.5) * F + E
                }
            },
            timers: [],
            fx: function (F, E, G) {
                this.options = E;
                this.elem = F;
                this.prop = G;
                if (!E.orig) {
                    E.orig = {}
                }
            }
        });
    b.fx.prototype = {
            update: function () {
                if (this.options.step) {
                    this.options.step.call(this.elem, this.now, this)
                }(b.fx.step[this.prop] || b.fx.step._default)(this);
                if ((this.prop == "height" || this.prop == "width") && this.elem.style) {
                    this.elem.style.display = "block"
                }
            },
            cur: function (F) {
                if (this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null)) {
                    return this.elem[this.prop]
                }
                var E = parseFloat(b.css(this.elem, this.prop, F));
                return E && E > -10000 ? E : parseFloat(b.curCSS(this.elem, this.prop)) || 0
            },
            custom: function (I, H, G) {
                this.startTime = d();
                this.start = I;
                this.end = H;
                this.unit = G || this.unit || "px";
                this.now = this.start;
                this.pos = this.state = 0;
                var E = this;

                function F(J) {
                    return E.step(J)
                }
                F.elem = this.elem;
                F.baduserfunc = 1;
                if (F() && b.timers.push(F) && !c) {
                    c = setInterval(function () {
                        var J = b.timers;
                        for (var K = 0; K < J.length; K++) {
                            if (J[K].baduserfunc == 2 || !J[K]()) {
                                J.splice(K--, 1)
                            }
                        }
                        if (!J.length) {
                            clearInterval(c);
                            c = j
                        }
                    }, 13)
                }
            },
            show: function () {
                this.options.orig[this.prop] = b.attr(this.elem.style, this.prop);
                this.options.show = true;
                this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur());
                b(this.elem).show()
            },
            hide: function () {
                this.options.orig[this.prop] = b.attr(this.elem.style, this.prop);
                this.options.hide = true;
                this.custom(this.cur(), 0)
            },
            step: function (H) {
                var G = d();
                if (H || G >= this.options.duration + this.startTime) {
                    this.now = this.end;
                    this.pos = this.state = 1;
                    this.update();
                    this.options.curAnim[this.prop] = true;
                    var E = true;
                    for (var F in this.options.curAnim) {
                        if (this.options.curAnim[F] !== true) {
                            E = false
                        }
                    }
                    if (E) {
                        if (this.options.display != null) {
                            this.elem.style.overflow = this.options.overflow;
                            this.elem.style.display = this.options.display;
                            if (b.css(this.elem, "display") == "none") {
                                this.elem.style.display = "block"
                            }
                        }
                        if (this.options.hide) {
                            b(this.elem).hide()
                        }
                        if (this.options.hide || this.options.show) {
                            for (var I in this.options.curAnim) {
                                b.attr(this.elem.style, I, this.options.orig[I])
                            }
                        }
                        if (arguments.callee && arguments.callee.caller && arguments.callee.caller.baduserfunc == 1) {
                            arguments.callee.caller.baduserfunc = 2
                        }
                        this.options.complete.call(this.elem);
                        if (arguments.callee && arguments.callee.caller && arguments.callee.caller.baduserfunc == 2) {
                            arguments.callee.caller.baduserfunc = 1
                        }
                    }
                    return false
                } else {
                    var J = G - this.startTime;
                    this.state = J / this.options.duration;
                    this.pos = b.easing[this.options.easing || (b.easing.swing ? "swing" : "linear")](this.state, J, 0, 1, this.options.duration);
                    this.now = this.start + ((this.end - this.start) * this.pos);
                    this.update()
                }
                return true
            }
        };
    b.extend(b.fx, {
            speeds: {
                slow: 600,
                fast: 200,
                _default: 400
            },
            step: {
                opacity: function (E) {
                    b.attr(E.elem.style, "opacity", E.now)
                },
                _default: function (E) {
                    if (E.elem.style && E.elem.style[E.prop] != null) {
                        E.elem.style[E.prop] = E.now + E.unit
                    } else {
                        E.elem[E.prop] = E.now
                    }
                }
            }
        });
    if (document.documentElement.getBoundingClientRect) {
            b.fn.offset = function () {
                if (!this[0]) {
                    return {
                        top: 0,
                        left: 0
                    }
                }
                if (this[0] === this[0].ownerDocument.body) {
                    return b.offset.bodyOffset(this[0])
                }
                var G = this[0].getBoundingClientRect(),
                    K = this[0].ownerDocument,
                    F = K.body,
                    E = K.documentElement,
                    J = E.clientTop || F.clientTop || 0,
                    L = E.clientLeft || F.clientLeft || 0,
                    I = G.top + (self.pageYOffset || b.boxModel && E.scrollTop || F.scrollTop) - J,
                    H = G.left + (self.pageXOffset || b.boxModel && E.scrollLeft || F.scrollLeft) - L;
                return {
                        top: I,
                        left: H
                    }
            }
        } else {
            b.fn.offset = function () {
                if (!this[0]) {
                    return {
                        top: 0,
                        left: 0
                    }
                }
                if (this[0] === this[0].ownerDocument.body) {
                    return b.offset.bodyOffset(this[0])
                }
                b.offset.initialized || b.offset.initialize();
                var I = this[0],
                    E = I.offsetParent,
                    M = I,
                    O = I.ownerDocument,
                    L, G = O.documentElement,
                    J = O.body,
                    F = O.defaultView,
                    K = F.getComputedStyle(I, null),
                    N = I.offsetTop,
                    H = I.offsetLeft;
                while ((I = I.parentNode) && I !== J && I !== G) {
                        L = F.getComputedStyle(I, null);
                        N -= I.scrollTop,
                        H -= I.scrollLeft;
                        if (I === E) {
                            N += I.offsetTop,
                            H += I.offsetLeft;
                            if (b.offset.doesNotAddBorder && !(b.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(I.tagName))) {
                                N += parseInt(L.borderTopWidth, 10) || 0,
                                H += parseInt(L.borderLeftWidth, 10) || 0
                            }
                            M = E,
                            E = I.offsetParent
                        }
                        if (b.offset.subtractsBorderForOverflowNotVisible && L.overflow !== "visible") {
                            N += parseInt(L.borderTopWidth, 10) || 0,
                            H += parseInt(L.borderLeftWidth, 10) || 0
                        }
                        K = L
                    }
                if (K.position === "relative" || K.position === "static") {
                        N += J.offsetTop,
                        H += J.offsetLeft
                    }
                if (K.position === "fixed") {
                        N += Math.max(G.scrollTop, J.scrollTop),
                        H += Math.max(G.scrollLeft, J.scrollLeft)
                    }
                return {
                        top: N,
                        left: H
                    }
            }
        }
    b.offset = {
            initialize: function () {
                if (this.initialized) {
                    return
                }
                var K = document.body,
                    L = document.createElement("div"),
                    G, F, N, H, M, E, I = K.style.marginTop,
                    J = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
                M = {
                        position: "absolute",
                        top: 0,
                        left: 0,
                        margin: 0,
                        border: 0,
                        width: "1px",
                        height: "1px",
                        visibility: "hidden"
                    };
                for (E in M) {
                        L.style[E] = M[E]
                    }
                L.innerHTML = J;
                K.insertBefore(L, K.firstChild);
                G = L.firstChild,
                F = G.firstChild,
                H = G.nextSibling.firstChild.firstChild;
                this.doesNotAddBorder = (F.offsetTop !== 5);
                this.doesAddBorderForTableAndCells = (H.offsetTop === 5);
                G.style.overflow = "hidden",
                G.style.position = "relative";
                this.subtractsBorderForOverflowNotVisible = (F.offsetTop === -5);
                K.style.marginTop = "1px";
                this.doesNotIncludeMarginInBodyOffset = (K.offsetTop === 0);
                K.style.marginTop = I;
                K.removeChild(L);
                this.initialized = true
            },
            bodyOffset: function (E) {
                b.offset.initialized || b.offset.initialize();
                var G = E.offsetTop,
                    F = E.offsetLeft;
                if (b.offset.doesNotIncludeMarginInBodyOffset) {
                        G += parseInt(b.curCSS(E, "marginTop", true), 10) || 0,
                        F += parseInt(b.curCSS(E, "marginLeft", true), 10) || 0
                    }
                return {
                        top: G,
                        left: F
                    }
            }
        };
    b.fn.extend({
            position: function () {
                var I = 0,
                    H = 0,
                    F;
                if (this[0]) {
                        var G = this.offsetParent(),
                            J = this.offset(),
                            E = /^body|html$/i.test(G[0].tagName) ? {
                                top: 0,
                                left: 0
                            } : G.offset();
                        J.top -= l(this, "marginTop");
                        J.left -= l(this, "marginLeft");
                        E.top += l(G, "borderTopWidth");
                        E.left += l(G, "borderLeftWidth");
                        F = {
                                top: J.top - E.top,
                                left: J.left - E.left
                            }
                    }
                return F
            },
            offsetParent: function () {
                var E = this[0].offsetParent || document.body;
                while (E && (!/^body|html$/i.test(E.tagName) && b.css(E, "position") == "static")) {
                    E = E.offsetParent
                }
                return b(E)
            }
        });
    b.each(["Left", "Top"], function (F, E) {
            var G = "scroll" + E;
            b.fn[G] = function (H) {
                if (!this[0]) {
                    return null
                }
                return H !== j ? this.each(function () {
                    this == g || this == document ? g.scrollTo(!F ? H : b(g).scrollLeft(), F ? H : b(g).scrollTop()) : this[G] = H
                }) : this[0] == g || this[0] == document ? self[F ? "pageYOffset" : "pageXOffset"] || b.boxModel && document.documentElement[G] || document.body[G] : this[0][G]
            }
        });
    b.each(["Height", "Width"], function (I, G) {
            var E = I ? "Left" : "Top",
                H = I ? "Right" : "Bottom",
                F = G.toLowerCase();
            b.fn["inner" + G] = function () {
                    return this[0] ? b.css(this[0], F, false, "padding") : null
                };
            b.fn["outer" + G] = function (K) {
                    return this[0] ? b.css(this[0], F, false, K ? "margin" : "border") : null
                };
            var J = G.toLowerCase();
            b.fn[J] = function (K) {
                    return this[0] == g ? document.compatMode == "CSS1Compat" && document.documentElement["client" + G] || document.body["client" + G] : this[0] == document ? Math.max(document.documentElement["client" + G], document.body["scroll" + G], document.documentElement["scroll" + G], document.body["offset" + G], document.documentElement["offset" + G]) : K === j ? (this.length ? b.css(this[0], J) : null) : this.css(J, typeof K === "string" ? K : K + "px")
                }
        })
})();
(function (b) {
    b.fn.ajaxSubmit = function (m) {
        if (!this.length) {
            a("ajaxSubmit: skipping submit process - no element selected");
            return this
        }
        if (typeof m == "function") {
            m = {
                success: m
            }
        }
        var d = b.trim(this.attr("action"));
        if (d) {
            d = (d.match(/^([^#]+)/) || [])[1]
        }
        d = d || window.location.href || "";
        m = b.extend({
            url: d,
            type: this.attr("method") || "GET"
        }, m || {});
        var t = {};
        this.trigger("form-pre-serialize", [this, m, t]);
        if (t.veto) {
            a("ajaxSubmit: submit vetoed via form-pre-serialize trigger");
            return this
        }
        if (m.beforeSerialize && m.beforeSerialize(this, m) === false) {
            a("ajaxSubmit: submit aborted via beforeSerialize callback");
            return this
        }
        var o = this.formToArray(m.semantic);
        if (m.data) {
            m.extraData = m.data;
            for (var g in m.data) {
                if (m.data[g] instanceof Array) {
                    for (var i in m.data[g]) {
                        o.push({
                            name: g,
                            value: m.data[g][i]
                        })
                    }
                } else {
                    o.push({
                        name: g,
                        value: m.data[g]
                    })
                }
            }
        }
        if (m.beforeSubmit && m.beforeSubmit(o, this, m) === false) {
            a("ajaxSubmit: submit aborted via beforeSubmit callback");
            return this
        }
        this.trigger("form-submit-validate", [o, this, m, t]);
        if (t.veto) {
            a("ajaxSubmit: submit vetoed via form-submit-validate trigger");
            return this
        }
        var e = b.param(o);
        if (m.type.toUpperCase() == "GET") {
            m.url += (m.url.indexOf("?") >= 0 ? "&" : "?") + e;
            m.data = null
        } else {
            m.data = e
        }
        var u = this,
            f = [];
        if (m.resetForm) {
                f.push(function () {
                    u.resetForm()
                })
            }
        if (m.clearForm) {
                f.push(function () {
                    u.clearForm()
                })
            }
        if (!m.dataType && m.target) {
                var r = m.success ||
                function () {};
                f.push(function (j) {
                    b(m.target).html(j).each(r, arguments)
                })
            } else {
                if (m.success) {
                    f.push(m.success)
                }
            }
        m.success = function (q, n) {
                for (var k = 0, j = f.length; k < j; k++) {
                    f[k].apply(m, [q, n, u])
                }
            };
        var c = b("input:file", this).fieldValue();
        var s = false;
        for (var l = 0; l < c.length; l++) {
                if (c[l]) {
                    s = true
                }
            }
        var h = false;
        if (m.iframe || s || h) {
                if (m.closeKeepAlive) {
                    b.get(m.closeKeepAlive, p)
                } else {
                    p()
                }
            } else {
                b.ajax(m)
            }
        this.trigger("form-submit-notify", [this, m]);
        return this;

        function p() {
                var q = u[0];
                if (b(":input[name=submit]", q).length) {
                    alert('Error: Form elements must not be named "submit".');
                    return
                }
                var k = b.extend({}, b.ajaxSettings, m);
                var G = b.extend(true, {}, b.extend(true, {}, b.ajaxSettings), k);
                var v = "jqFormIO" + (new Date().getTime());
                var B = b('<iframe id="' + v + '" name="' + v + '" src="about:blank" />');
                var D = B[0];
                B.css({
                    position: "absolute",
                    top: "-1000px",
                    left: "-1000px"
                });
                var F = {
                    aborted: 0,
                    responseText: null,
                    responseXML: null,
                    status: 0,
                    statusText: "n/a",
                    getAllResponseHeaders: function () {},
                    getResponseHeader: function () {},
                    setRequestHeader: function () {},
                    abort: function () {
                        this.aborted = 1;
                        B.attr("src", "about:blank")
                    }
                };
                var C = k.global;
                if (C && !b.active++) {
                    b.event.trigger("ajaxStart")
                }
                if (C) {
                    b.event.trigger("ajaxSend", [F, k])
                }
                if (G.beforeSend && G.beforeSend(F, G) === false) {
                    G.global && b.active--;
                    return
                }
                if (F.aborted) {
                    return
                }
                var E = 0;
                var A = 0;
                var j = q.clk;
                if (j) {
                    var w = j.name;
                    if (w && !j.disabled) {
                        m.extraData = m.extraData || {};
                        m.extraData[w] = j.value;
                        if (j.type == "image") {
                            m.extraData[name + ".x"] = q.clk_x;
                            m.extraData[name + ".y"] = q.clk_y
                        }
                    }
                }
                setTimeout(function () {
                    var J = u.attr("target"),
                        H = u.attr("action");
                    q.setAttribute("target", v);
                    if (q.getAttribute("method") != "POST") {
                            q.setAttribute("method", "POST")
                        }
                    if (q.getAttribute("action") != k.url) {
                            q.setAttribute("action", k.url)
                        }
                    if (!m.skipEncodingOverride) {
                            u.attr({
                                encoding: "multipart/form-data",
                                enctype: "multipart/form-data"
                            })
                        }
                    if (b.browser.opera && parseFloat(b.browser.version) > 9.799 && !k.timeout) {
                            k.timeout = 3 * 60000
                        }
                    if (k.timeout) {
                            setTimeout(function () {
                                A = true;
                                x()
                            }, k.timeout)
                        }
                    var I = [];
                    try {
                            if (m.extraData) {
                                for (var K in m.extraData) {
                                    I.push(b('<input type="hidden" name="' + K + '" value="' + m.extraData[K] + '" />').appendTo(q)[0])
                                }
                            }
                            B.appendTo("body");
                            D.attachEvent ? D.attachEvent("onload", x) : D.addEventListener("load", x, false);
                            q.submit()
                        } finally {
                            q.setAttribute("action", H);
                            J ? q.setAttribute("target", J) : u.removeAttr("target");
                            b(I).remove()
                        }
                }, 10);
                var y = 0;

                function x() {
                    if (E++) {
                        return
                    }
                    D.detachEvent ? D.detachEvent("onload", x) : D.removeEventListener("load", x, false);
                    var H = true;
                    try {
                        if (A) {
                            throw "timeout"
                        }
                        var I, K;
                        K = D.contentWindow ? D.contentWindow.document : D.contentDocument ? D.contentDocument : D.document;
                        if ((!K || !K.body || K.body.innerHTML == "") && !y) {
                            if (!(b.browser.opera && parseFloat(b.browser.version) > 9.799 && K && K.baseURI == "about:blank")) {
                                y = 1
                            }
                            E--;
                            setTimeout(x, 100);
                            return
                        }
                        F.responseText = K.body ? K.body.innerHTML : null;
                        F.responseXML = K.XMLDocument ? K.XMLDocument : K;
                        F.getResponseHeader = function (L) {
                            var M = {
                                "content-type": k.dataType
                            };
                            return M[L]
                        };
                        if (k.dataType == "json" || k.dataType == "script") {
                            var n = K.getElementsByTagName("textarea")[0];
                            F.responseText = n ? n.value : F.responseText
                        } else {
                            if (k.dataType == "xml" && !F.responseXML && F.responseText != null) {
                                F.responseXML = z(F.responseText)
                            }
                        }
                        I = b.httpData(F, k.dataType)
                    } catch (J) {
                        H = false;
                        b.handleError(k, F, "error", J)
                    }
                    if (H) {
                        k.success(I, "success");
                        if (C) {
                            b.event.trigger("ajaxSuccess", [F, k])
                        }
                    }
                    if (C) {
                        b.event.trigger("ajaxComplete", [F, k])
                    }
                    if (C && !--b.active) {
                        b.event.trigger("ajaxStop")
                    }
                    if (k.complete) {
                        k.complete(F, H ? "success" : "error")
                    }
                    setTimeout(function () {
                        B.remove();
                        F.responseXML = null
                    }, 100)
                }
                function z(n, H) {
                    if (window.ActiveXObject) {
                        H = new ActiveXObject("Microsoft.XMLDOM");
                        H.async = "false";
                        H.loadXML(n)
                    } else {
                        H = (new DOMParser()).parseFromString(n, "text/xml")
                    }
                    return (H && H.documentElement && H.documentElement.tagName != "parsererror") ? H : null
                }
            }
    };
    b.fn.ajaxForm = function (c) {
        return this.ajaxFormUnbind().bind("submit.form-plugin", function () {
            b(this).ajaxSubmit(c);
            return false
        }).each(function () {
            b(":submit,input:image", this).bind("click.form-plugin", function (f) {
                var d = this.form;
                d.clk = this;
                if (this.type == "image") {
                    if (f.offsetX != undefined) {
                        d.clk_x = f.offsetX;
                        d.clk_y = f.offsetY
                    } else {
                        if (typeof b.fn.offset == "function") {
                            var g = b(this).offset();
                            d.clk_x = f.pageX - g.left;
                            d.clk_y = f.pageY - g.top
                        } else {
                            d.clk_x = f.pageX - this.offsetLeft;
                            d.clk_y = f.pageY - this.offsetTop
                        }
                    }
                }
                setTimeout(function () {
                    d.clk = d.clk_x = d.clk_y = null
                }, 10)
            })
        })
    };
    b.fn.ajaxFormUnbind = function () {
        this.unbind("submit.form-plugin");
        return this.each(function () {
            b(":submit,input:image", this).unbind("click.form-plugin")
        })
    };
    b.fn.formToArray = function (q) {
        var p = [];
        if (this.length == 0) {
            return p
        }
        var d = this[0];
        var h = q ? d.getElementsByTagName("*") : d.elements;
        if (!h) {
            return p
        }
        for (var k = 0, m = h.length; k < m; k++) {
            var e = h[k];
            var f = e.name;
            if (!f) {
                continue
            }
            if (q && d.clk && e.type == "image") {
                if (!e.disabled && d.clk == e) {
                    p.push({
                        name: f,
                        value: b(e).val()
                    });
                    p.push({
                        name: f + ".x",
                        value: d.clk_x
                    }, {
                        name: f + ".y",
                        value: d.clk_y
                    })
                }
                continue
            }
            var r = b.fieldValue(e, true);
            if (r && r.constructor == Array) {
                for (var g = 0, c = r.length; g < c; g++) {
                    p.push({
                        name: f,
                        value: r[g]
                    })
                }
            } else {
                if (r !== null && typeof r != "undefined") {
                    p.push({
                        name: f,
                        value: r
                    })
                }
            }
        }
        if (!q && d.clk) {
            var l = b(d.clk),
                o = l[0],
                f = o.name;
            if (f && !o.disabled && o.type == "image") {
                    p.push({
                        name: f,
                        value: l.val()
                    });
                    p.push({
                        name: f + ".x",
                        value: d.clk_x
                    }, {
                        name: f + ".y",
                        value: d.clk_y
                    })
                }
        }
        return p
    };
    b.fn.formSerialize = function (c) {
        return b.param(this.formToArray(c))
    };
    b.fn.fieldSerialize = function (d) {
        var c = [];
        this.each(function () {
            var h = this.name;
            if (!h) {
                return
            }
            var f = b.fieldValue(this, d);
            if (f && f.constructor == Array) {
                for (var g = 0, e = f.length; g < e; g++) {
                    c.push({
                        name: h,
                        value: f[g]
                    })
                }
            } else {
                if (f !== null && typeof f != "undefined") {
                    c.push({
                        name: this.name,
                        value: f
                    })
                }
            }
        });
        return b.param(c)
    };
    b.fn.fieldValue = function (g) {
        for (var h = [], e = 0, c = this.length; e < c; e++) {
            var f = this[e];
            var d = b.fieldValue(f, g);
            if (d === null || typeof d == "undefined" || (d.constructor == Array && !d.length)) {
                continue
            }
            d.constructor == Array ? b.merge(h, d) : h.push(d)
        }
        return h
    };
    b.fieldValue = function (d, e) {
        var f = d.name,
            p = d.type,
            q = d.tagName.toLowerCase();
        if (typeof e == "undefined") {
                e = true
            }
        if (e && (!f || d.disabled || p == "reset" || p == "button" || (p == "checkbox" || p == "radio") && !d.checked || (p == "submit" || p == "image") && d.form && d.form.clk != d || q == "select" && d.selectedIndex == -1)) {
                return null
            }
        if (q == "select") {
                var k = d.selectedIndex;
                if (k < 0) {
                    return null
                }
                var m = [],
                    c = d.options;
                var h = (p == "select-one");
                var l = (h ? k + 1 : c.length);
                for (var g = (h ? k : 0); g < l; g++) {
                        var j = c[g];
                        if (j.selected) {
                            var o = j.value;
                            if (!o) {
                                o = (j.attributes && j.attributes.value && !(j.attributes.value.specified)) ? j.text : j.value
                            }
                            if (h) {
                                return o
                            }
                            m.push(o)
                        }
                    }
                return m
            }
        return d.value
    };
    b.fn.clearForm = function () {
        return this.each(function () {
            b("input,select,textarea", this).clearFields()
        })
    };
    b.fn.clearFields = b.fn.clearInputs = function () {
        return this.each(function () {
            var d = this.type,
                c = this.tagName.toLowerCase();
            if (d == "text" || d == "password" || c == "textarea") {
                    this.value = ""
                } else {
                    if (d == "checkbox" || d == "radio") {
                        this.checked = false
                    } else {
                        if (c == "select") {
                            this.selectedIndex = -1
                        }
                    }
                }
        })
    };
    b.fn.resetForm = function () {
        return this.each(function () {
            if (typeof this.reset == "function" || (typeof this.reset == "object" && !this.reset.nodeType)) {
                this.reset()
            }
        })
    };
    b.fn.enable = function (c) {
        if (c == undefined) {
            c = true
        }
        return this.each(function () {
            this.disabled = !c
        })
    };
    b.fn.selected = function (c) {
        if (c == undefined) {
            c = true
        }
        return this.each(function () {
            var d = this.type;
            if (d == "checkbox" || d == "radio") {
                this.checked = c
            } else {
                if (this.tagName.toLowerCase() == "option") {
                    var e = b(this).parent("select");
                    if (c && e[0] && e[0].type == "select-one") {
                        e.find("option").selected(false)
                    }
                    this.selected = c
                }
            }
        })
    };

    function a() {
        if (b.fn.ajaxSubmit.debug && window.console && window.console.log) {
            window.console.log("[jquery.form] " + Array.prototype.join.call(arguments, ""))
        }
    }
})(jQuery);
(function (c) {
    var b = c.scrollTo = function (f, e, d) {
        c(window).scrollTo(f, e, d)
    };
    b.defaults = {
        axis: "xy",
        duration: parseFloat(c.fn.jquery) >= 1.3 ? 0 : 1
    };
    b.window = function (d) {
        return c(window)._scrollable()
    };
    c.fn._scrollable = function () {
        return this.map(function () {
            var e = this,
                d = !e.nodeName || c.inArray(e.nodeName.toLowerCase(), ["iframe", "#document", "html", "body"]) != -1;
            if (!d) {
                    return e
                }
            var f = (e.contentWindow || e).document || e.ownerDocument || e;
            return c.browser.safari || f.compatMode == "BackCompat" ? f.body : f.documentElement
        })
    };
    c.fn.scrollTo = function (f, e, d) {
        if (typeof e == "object") {
            d = e;
            e = 0
        }
        if (typeof d == "function") {
            d = {
                onAfter: d
            }
        }
        if (f == "max") {
            f = 9000000000
        }
        d = c.extend({}, b.defaults, d);
        e = e || d.speed || d.duration;
        d.queue = d.queue && d.axis.length > 1;
        if (d.queue) {
            e /= 2
        }
        d.offset = a(d.offset);
        d.over = a(d.over);
        return this._scrollable().each(function () {
            var l = this,
                i = c(l),
                j = f,
                h, g = {},
                m = i.is("html,body");
            switch (typeof j) {
                case "number":
                case "string":
                    if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(j)) {
                        j = a(j);
                        break
                    }
                    j = c(j, this);
                case "object":
                    if (j.is || j.style) {
                        h = (j = c(j)).offset()
                    }
                }
            c.each(d.axis.split(""), function (q, r) {
                    var s = r == "x" ? "Left" : "Top",
                        u = s.toLowerCase(),
                        p = "scroll" + s,
                        o = l[p],
                        n = b.max(l, r);
                    if (h) {
                            g[p] = h[u] + (m ? 0 : o - i.offset()[u]);
                            if (d.margin) {
                                g[p] -= parseInt(j.css("margin" + s)) || 0;
                                g[p] -= parseInt(j.css("border" + s + "Width")) || 0
                            }
                            g[p] += d.offset[u] || 0;
                            if (d.over[u]) {
                                g[p] += j[r == "x" ? "width" : "height"]() * d.over[u]
                            }
                        } else {
                            var t = j[u];
                            g[p] = t.slice && t.slice(-1) == "%" ? parseFloat(t) / 100 * n : t
                        }
                    if (/^\d+$/.test(g[p])) {
                            g[p] = g[p] <= 0 ? 0 : Math.min(g[p], n)
                        }
                    if (!q && d.queue) {
                            if (o != g[p]) {
                                k(d.onAfterFirst)
                            }
                            delete g[p]
                        }
                });
            k(d.onAfter);

            function k(n) {
                    i.animate(g, e, d.easing, n &&
                    function () {
                        n.call(this, f, d)
                    })
                }
        }).end()
    };
    b.max = function (i, h) {
        var g = h == "x" ? "Width" : "Height",
            j = "scroll" + g;
        if (!c(i).is("html,body")) {
                return i[j] - c(i)[g.toLowerCase()]()
            }
        var f = "client" + g,
            e = i.ownerDocument.documentElement,
            d = i.ownerDocument.body;
        return Math.max(e[j], d[j]) - Math.min(e[f], d[f])
    };

    function a(d) {
        return typeof d == "object" ? d : {
            top: d,
            left: d
        }
    }
})(jQuery);
(function (b) {
    var a = b.preload = function (f, h) {
        if (f.split) {
            f = b(f)
        }
        h = b.extend({}, a.defaults, h);
        var e = b.map(f, function (k) {
            if (!k) {
                return
            }
            if (k.split) {
                return h.base + k + h.ext
            }
            var l = k.src || k.href;
            if (typeof h.placeholder == "string" && k.src) {
                k.src = h.placeholder
            }
            if (l && h.find) {
                l = l.replace(h.find, h.replace)
            }
            return l || null
        });
        var i = {
            loaded: 0,
            failed: 0,
            next: 0,
            done: 0,
            total: e.length
        };
        if (!i.total) {
            return c()
        }
        var j = b(Array(h.threshold + 1).join("<img/>")).load(g).error(g).bind("abort", g).each(d);

        function g(k) {
            i.element = this;
            i.found = k.type == "load";
            i.image = this.src;
            i.index = this.index;
            var l = i.original = f[this.index];
            i[i.found ? "loaded" : "failed"]++;
            i.done++;
            if (h.enforceCache) {
                a.cache.push(b("<img/>").attr("src", i.image)[0])
            }
            if (h.placeholder && l.src) {
                l.src = i.found ? i.image : h.notFound || l.src
            }
            if (h.onComplete) {
                h.onComplete(i)
            }
            if (i.done < i.total) {
                d(0, this)
            } else {
                if (j && j.unbind) {
                    j.unbind("load").unbind("error").unbind("abort")
                }
                j = null;
                c()
            }
        }
        function d(m, l, k) {
            if (l.attachEvent && i.next && i.next % a.gap == 0 && !k) {
                setTimeout(function () {
                    d(m, l, true)
                }, 0);
                return false
            }
            if (i.next == i.total) {
                return false
            }
            l.index = i.next;
            l.src = e[i.next++];
            if (h.onRequest) {
                i.index = l.index;
                i.element = l;
                i.image = l.src;
                i.original = f[i.next - 1];
                h.onRequest(i)
            }
        }
        function c() {
            if (h.onFinish) {
                h.onFinish(i)
            }
        }
    };
    a.gap = 14;
    a.cache = [];
    a.defaults = {
        threshold: 2,
        base: "",
        ext: "",
        replace: ""
    };
    b.fn.preload = function (c) {
        a(this, c);
        return this
    }
})(jQuery);
(function (a) {
    a.fn.wheel = function (d) {
        return this[d ? "bind" : "trigger"]("wheel", d)
    };
    var c = !a.browser.mozilla ? "mousewheel" : "DOMMouseScroll" + (a.browser.version < "1.9" ? " mousemove" : "");
    a.event.special.wheel = {
        setup: function () {
            a.event.add(this, c, b, {})
        },
        teardown: function () {
            a.event.remove(this, c, b)
        }
    };

    function b(d) {
        switch (d.type) {
        case "mousemove":
            return a.extend(d.data, {
                clientX: d.clientX,
                clientY: d.clientY,
                pageX: d.pageX,
                pageY: d.pageY
            });
        case "DOMMouseScroll":
            a.extend(d, d.data);
            d.delta = -d.detail / 3;
            break;
        case "mousewheel":
            d.delta = d.wheelDelta / 120;
            if (a.browser.opera) {
                d.delta *= -1
            }
            break
        }
        d.type = "wheel";
        return a.event.handle.call(this, d, d.delta)
    }
})(jQuery);

function _uFocus(a) {
    if (!a) {
        a = {}
    }
    this.constructor = _uFocus;
    this._tp = a.type || 0;
    this._thispar = a.thispar || null;
    this._param = a.param || null;
    this._parent = a.parent || null;
    delete a.type;
    delete a.thispar;
    delete a.param;
    delete a.parent;
    this.owner = null;
    $.extend(this, a || {});
    this.destroyed = 0;
    if (!_uFocus.globalset) {
        _uFocus.globalset = true;
        $(document).bind("keydown keyup keypress", _uFocus._onkey)
    }
    if (this._tp == 2) {
        _uFocus.glisteners.push(this)
    }
}
_uFocus.current = null;
_uFocus.last_fixed = null;
_uFocus.glisteners = [];
_uFocus.globalset = false;
_uFocus.inprocess = 0;
_uFocus.delayedactivate = null;
_uFocus._onkey = function (f) {
    var d = "on" + f.type,
        c;
    if (f.type == "keypress") {
            if (((f.keyCode == 37 || f.keyCode == 38 || f.keyCode == 39 || f.keyCode == 40 || (f.keyCode == 0 && $.browser.opera)) && f.target && f.target.tagName.toLowerCase() != "input" && f.target.tagName.toLowerCase() != "textarea") || (f.keyCode == 32 && f.ctrlKey)) {
                if (_uFocus.current) {
                    f.preventDefault()
                }
            }
        }
    if (f.type == "keydown" && $.browser.opera && f.keyCode == 0) {
            f.keyCode = 93
        }
    for (var b = 0; b < _uFocus.glisteners.length; b++) {
            c = _uFocus.glisteners[b];
            if (!c[d]) {
                continue
            }
            if (c[d].call(c._thispar, f, c._param, _uFocus.current)) {
                return
            }
        }
    c = _uFocus.current;
    if (!c) {
            return
        }
    var a = [];
    while (c) {
            a.unshift(c);
            c = c._parent
        }
    for (var b = 0; b < a.length; b++) {
            if (!a[b][d]) {
                continue
            }
            if (a[b][d].call(a[b]._thispar, f, a[b]._param, _uFocus.current)) {
                return
            }
        }
};
_uFocus.prototype = {
    activate: function () {
        if (this.destroyed || (this._tp != 0 && this._tp != 1)) {
            return 0
        }
        if (_uFocus.inprocess) {
            _uFocus.delayedactivate = this;
            return -1
        }
        var a;
        _uFocus.inprocess = 1;
        a = this._activate(this, _uFocus.current);
        _uFocus.inprocess = 0;
        if (_uFocus.delayedactivate) {
            setTimeout("var f=_uFocus.delayedactivate;_uFocus.delayedactivate=null;if(f)f.activate();", 0)
        }
        return a
    },
    deactivate: function () {
        if (this.destroyed || (this._tp != 0 && this._tp != 1) || _uFocus.inprocess) {
            return
        }
        var a;
        _uFocus.inprocess = 1;
        a = this._deactivate(_uFocus.current, null);
        _uFocus.inprocess = 0;
        if (_uFocus.delayedactivate) {
            setTimeout("var f=_uFocus.delayedactivate;_uFocus.delayedactivate=null;if(f)f.activate();", 0);
            return
        }
        if (a == 1 && _uFocus.last_fixed && (!_uFocus.current || _uFocus.current._tp != 1)) {
            _uFocus.last_fixed.activate()
        }
    },
    isactive: function (a) {
        return this == _uFocus.current || (!a && this.isparentof(_uFocus.current))
    },
    isparentof: function (b) {
        if (!b) {
            return 0
        }
        var a = b._parent;
        while (a) {
            if (a == this) {
                return 1
            }
            a = a._parent
        }
        return 0
    },
    _activate: function (a, f, b) {
        var e, g;
        if (this.isactive()) {
            e = _uFocus.current;
            if (!b || e == this) {
                return 1
            }
        }
        if (this._parent) {
            if (!this._parent._activate(this._parent, f)) {
                return 0
            }
        }
        e = _uFocus.current;
        if (e && e != this._parent) {
            while (e._parent && e._parent != this._parent) {
                e = e._parent
            }
            if (e._deactivate(f, a) == -1) {
                return 0
            }
        }
        for (var d = 0; d < _uFocus.glisteners.length; d++) {
            e = _uFocus.glisteners[d];
            if (!e.canactivate) {
                continue
            }
            g = e.canactivate.call(e._thispar, e._param, f, a);
            if (!g || (g == -1 && _uFocus.delayedactivate)) {
                return 0
            }
        }
        var c = [this];
        e = this._parent;
        while (e) {
            c.unshift(e);
            e = e._parent
        }
        for (var d = 0; d < c.length; d++) {
            if (!c[d].canactivate) {
                continue
            }
            g = c[d].canactivate.call(c[d]._thispar, c[d]._param, f, a);
            if (!g || (g == -1 && _uFocus.delayedactivate)) {
                return 0
            }
        }
        _uFocus.current = this;
        if (this._tp == 1 && f && f._tp == 0) {
            _uFocus.last_fixed = f
        } else {
            if (this._tp == 0) {
                _uFocus.last_fixed = null
            }
        }
        for (var d = 0; d < _uFocus.glisteners.length; d++) {
            e = _uFocus.glisteners[d];
            if (e.onactivate) {
                if (e.onactivate.call(e._thispar, e._param, f, a) == -1 && _uFocus.delayedactivate) {
                    return 0
                }
            }
        }
        for (var d = 0; d < c.length; d++) {
            if (c[d].onactivate) {
                if (c[d].onactivate.call(c[d]._thispar, c[d]._param, f, a) == -1 && _uFocus.delayedactivate) {
                    return 0
                }
            }
        }
        return 1
    },
    _deactivate: function (b, a) {
        if (!this.isactive()) {
            return 0
        }
        var e, d;
        var c = _uFocus.current;
        while (c) {
            _uFocus.current = c._parent;
            if (c.ondeactivate) {
                if (c.ondeactivate.call(c._thispar, c._param, b, a) == -1 && _uFocus.delayedactivate) {
                    return -1
                }
            }
            if (c._tp != 1) {
                _uFocus.last_fixed = null
            }
            for (e = 0; e < _uFocus.glisteners.length; e++) {
                d = _uFocus.glisteners[e];
                if (d.ondeactivate) {
                    d.ondeactivate.call(d._thispar, d._param, c, a)
                }
            }
            if (c == this) {
                break
            }
            c = c._parent
        }
        return 1
    },
    destroy: function () {
        if (this.destroyed) {
            return
        }
        this.deactivate();
        if (this._tp == 2) {
            for (var a = 0; a < _uFocus.glisteners.length; a++) {
                if (_uFocus.glisteners[a] == this) {
                    _uFocus.glisteners.splice(a, 1);
                    break
                }
            }
        }
        this.destroyed = 1
    }
};

function _uGetOffset(c) {
    if (!c) {
        return {
            left: 0,
            top: 0
        }
    }
    var b = c.offsetLeft;
    var a = c.offsetTop;
    if (!b && !a && c.offsetParent == null) {
        b = parseInt(c.style.left);
        a = parseInt(c.style.top)
    } else {
        while ((c = c.offsetParent) != null) {
            b += c.offsetLeft;
            a += c.offsetTop
        }
    }
    return {
        left: b,
        top: a
    }
}
function _uMenu(c, a, b) {
    this.init(c, a, b)
}
_uMenu.get = function (b) {
    var a = $("#" + b)[0];
    if (a) {
        return a._umenu
    }
    return null
};
_uMenu.show = function (g, d, f, c, a, b) {
    var e = _uMenu.get(g);
    if (e) {
        e.show_menu(d, f, c, a, b)
    }
};
_uMenu.hide = function (d, b) {
    var a = _uMenu.get(d);
    if (a) {
        if (!b) {
            a.hide_menu()
        } else {
            a.hide_child()
        }
    }
};
_uMenu.hideAll = function (e) {
    var gr;
    with(_uMenu.prototype) {
        for (gr in have_active) {
            if (have_active[gr] && !donothide[gr]) {
                for (var i in all_menus[gr]) {
                    _uMenu.hide(i)
                }
                have_active[gr] = ""
            }
            donothide[gr] = false
        }
    }
};
_uMenu.showOver = function (id, par, tp, mid, dy, dx) {
    var o = _uMenu.get(id);
    if (o) {
        var gr = o.group;
        with(_uMenu.prototype) {
            if (timerid2[gr]) {
                clearTimeout(timerid2[gr])
            }
            if (have_active[gr].length > 0 && have_active[gr].indexOf("," + id + ",") == -1) {
                o.show_menu(par, tp, mid, dy, dx)
            }
        }
    }
};
_uMenu.schedule_hidechild = function (id) {
    var o = _uMenu.get(id);
    if (o) {
        var gr = o.group;
        with(_uMenu.prototype) {
            if (timerid2[gr]) {
                clearTimeout(timerid2[gr])
            }
            timerid2[gr] = setTimeout("_uMenu.hide('" + id + "',1);_uMenu.prototype.timerid2['" + gr + "']=0;", 800)
        }
    }
};
_uMenu.prototype = {
    donothide: [],
    all_menus: [],
    have_active: [],
    timerid: [],
    timerid2: [],
    global_set: false,
    init: function (c, a, b) {
        this.id = c;
        this.obj = $("#" + c)[0];
        if (!this.obj) {
            return
        }
        this.obj._umenu = this;
        if (!a) {
            a = c
        }
        this.parentid = a;
        if (!b) {
            b = "def"
        }
        this.group = b;
        this.obj.style.display = "none";
        $(this.obj).bind("click", this, function (d) {
            d.data.donothide[d.data.group] = true
        });
        if (this.all_menus[b] == undefined) {
            this.all_menus[b] = []
        }
        if (this.have_active[b] == undefined) {
            this.have_active[b] = ""
        }
        this.all_menus[b][c] = this;
        if (!this.global_set) {
            $(document).bind("click", _uMenu.hideAll);
            $(window).bind("resize", _uMenu.hideAll);
            _uMenu.prototype.global_set = true
        }
    },
    show_menu: function (par, tp, mid, dy, dx) {
        var ddX = 0;
        var ddY = 0;
        if (this.timerid2[this.group]) {
            clearTimeout(this.timerid2[this.group])
        }
        if (this.have_active[this.group].indexOf("," + this.id + ",") >= 0) {
            this.hide_menu();
            return
        }
        if (!dy) {
            dy = 0
        }
        if (!dx) {
            dx = 0
        }
        if (mid) {
            ddX = $("#" + mid)[0].offsetLeft;
            ddY = $("#" + mid)[0].offsetTop
        }
        this.allmenus_hidenp();
        if (!par) {
            par = this.obj.parentNode
        } else {
            par = $("#" + par)[0]
        }
        var pos = _uGetOffset(par);
        pos.left += dx - ddX;
        pos.top += dy - ddY;
        if (tp == "r") {
            pos.left += par.offsetWidth - 4
        } else {
            pos.top += par.offsetHeight + 1
        }
        var ww = $(window).width();
        with(this.obj.style) {
            left = pos.left + "px";
            top = pos.top + "px";
            display = "";
            visibility = "visible"
        }
        try {
            if (pos.left + this.obj.offsetWidth > ww) {
                pos.left = ww - this.obj.offsetWidth - 5;
                this.obj.style.left = pos.left + "px"
            }
        } catch (e) {}
        if (!this.have_active[this.group]) {
            this.have_active[this.group] = ""
        }
        this.have_active[this.group] += "," + this.id + ",";
        if (this.timerid[this.group]) {
            clearTimeout(this.timerid[this.group])
        }
        this.donothide[this.group] = true;
        this.timerid[this.group] = setTimeout("with(_uMenu.prototype){donothide['" + this.group + "']=false;timerid['" + this.group + "']=null;};", 100)
    },
    allmenus_hidenp: function () {
        var b = {};
        var c = this.id;
        while (this.all_menus[this.group][c] && this.all_menus[this.group][c].parentid != c && c) {
            b[this.all_menus[this.group][c].parentid] = 1;
            c = this.all_menus[this.group][c].parentid
        }
        for (var a in this.all_menus[this.group]) {
            if (b[a] == 1) {
                continue
            }
            this.all_menus[this.group][a].hide_menu()
        }
    },
    hide_menu: function () {
        with(this) {
            hide_child();
            var x = have_active[group].indexOf("," + id + ",");
            if (x >= 0) {
                have_active[group] = have_active[group].substring(0, x)
            }
            obj.style.display = "none";
            obj.style.visibility = "hidden"
        }
    },
    hide_child: function () {
        with(this) {
            for (var i in all_menus[group]) {
                if (all_menus[group][i].parentid == id && i != id) {
                    all_menus[group][i].hide_menu()
                }
            }
        }
    }
};

function _uMENU(d, h, g, c, b) {
    this.constructor = _uMENU;
    this.name = d;
    this.pos = $.extend({
        pos: null,
        alignObj: null,
        align: "d",
        parent: null,
        parentfocus: null,
        dx: 0,
        dy: 0,
        childdy: 0,
        childdx: 0
    }, h || {});
    this.props = $.extend({
        parentnode: null,
        design: _uMENU.defdesign || "std",
        hidden: g.statical && c && c.length > 0 ? 0 : 1,
        shadow: 1,
        addclass: "",
        withmarks: null,
        highlight: 1,
        statical: g.horiz ? 1 : 0,
        hidetimer: 0,
        horiz: 0,
        noabs: 0,
        width: 0,
        onshow: null,
        onhide: null,
        ondestroy: null,
        onitem: null,
        onldown: null,
        onrdown: null,
        thispar: null,
        onreadycreate: null,
        wnd: null,
        rtl: 0
    }, g || {});
    this.state = {
        visible: false,
        init: false,
        destroyed: false
    };
    this.design = this.props.design && _uMENU.designs[this.props.design] ? _uMENU.designs[this.props.design] : _uMENU.designs.std;
    this.idx = _uMENU.nextidx++;
    _uMENU.all[this.idx] = this;
    if (!this.pos.parent) {
        this.zpos = _uMENU.defz
    } else {
        this.zpos = this.pos.parent.zpos + 5
    }
    this.xpos = this.ypos = 0;
    this.width = 10;
    this.height = 10;
    this.elems = [];
    this.add_elems = c && c.length > 0 ? [c] : [];
    this.del_elems = [];
    this.pend_show = null;
    this.appendtimer = null;
    this.decor = {
        w: 0,
        h: 0
    };
    this.frame = null;
    this.childtimer = null;
    this.sh = null;
    this.hidetimer = null;
    this.hlitem = -1;
    this.have_active = null;
    this._focus = new _uFocus({
        type: 1,
        thispar: this,
        owner: this,
        parent: this.pos.parentfocus ? this.pos.parentfocus : (this.pos.parent ? this.pos.parent._focus : (this.props.wnd ? this.props.wnd._focus : null)),
        onkeydown: this.onkeydown,
        ondeactivate: this.onfocusdeactivate
    });
    var f = document.createElement("div");
    f.id = "_umenu" + this.idx;
    if (!this.props.parentnode) {
        $($("body")[0]).prepend(f)
    } else {
        this.props.parentnode.appendChild(f)
    }
    this.top = f;
    $(f).addClass("x-unselectable").css({
        visibility: "hidden",
        display: "block"
    });
    var a = document.createElement("div");
    f.appendChild(a);
    this.menu = a;
    if (!this.props.noabs) {
        $(f).css({
            position: "absolute",
            zIndex: this.zpos
        });
        if ($.browser.msie && parseFloat($.browser.version) < 7) {
            var e = '<iframe tabindex="-1" style="display:block; position:absolute; filter:Alpha(Opacity=\'0\'); width:' + this.width + "pxheight:" + this.height + 'px;border:0"/>';
            this.frame = document.createElement(e);
            f.appendChild(this.frame)
        }
        if (this.props.shadow && !this.props.horiz && (!$.browser.msie || $.browser.version > 6)) {
            this.shadow_init();
            this._resizeSh()
        }
        $(a).css({
            position: "absolute",
            zIndex: 2,
            left: 0
        })
    }
    $(a).css("width", "50px").bind("mousedown", this, _uMENU._onmenumousedown);
    this.parts = this.design.menu_init(a, this.props.horiz ? 10 : 50, this.props, this.pos.parent);
    if (!_uMENU.globalset) {
        _uMENU.globalset = true;
        $(document).bind("mousedown", _uMENU.hideallmenus);
        $(window).bind("resize", _uMENU.hideallmenus)
    }
    this.toinit = [];
    this.tocalcsize = [];
    this.createsubmenus();
    if (!this.props.hidden) {
        this.show()
    }
    if (!b) {
        setTimeout("var m=_uMENU.all[" + this.idx + "];if(m)m.init1();", 10)
    }
}
_uMENU.all = [];
_uMENU.nextidx = 0;
_uMENU.lastz = 0;
_uMENU.defz = 25050;
_uMENU.defdesign = "std";
_uMENU.globalset = false;
_uMENU.ignoreclick = null;
_uMENU.getbyname = function (c) {
    var b = this.all;
    for (var d = 0; d < b.length; d++) {
        if (b[d] && b[d].name == c) {
            return b[d]
        }
    }
    return null
};
_uMENU.designs = {
    std: {
        sh_sz: [4, 2],
        shadow_init: function (c) {
            var b = [];
            for (var a = 0; a < 3; a++) {
                b[a] = document.createElement("div");
                c.appendChild(b[a]);
                $(b[a]).attr("class", "x-sh").css("position", "absolute").css("z-index", 1)
            }
            $(b[0]).addClass("xsl").css({
                width: (this.sh_sz[0] + this.sh_sz[1]) + "px",
                left: (-this.sh_sz[0]) + "px",
                top: "0px"
            }).html('<div class="xstl"><div class="xsml"></div></div>');
            $(b[1]).addClass("xsr").css({
                width: (this.sh_sz[0] + this.sh_sz[1]) + "px",
                top: "0px"
            }).html('<div class="xstr"><div class="xsmr"></div></div>');
            $(b[2]).addClass("xsb").css({
                height: (this.sh_sz[0] + this.sh_sz[1]) + "px",
                left: (-this.sh_sz[0]) + "px"
            }).html('<div class="xsbl"><div class="xsbr"><div class="xsbc"></div></div></div>');
            return b
        },
        shadow_resize: function (b, a, c) {
            $(b[0]).css({
                height: (c - this.sh_sz[1]) + "px"
            });
            $(b[1]).css({
                height: (c - this.sh_sz[1]) + "px",
                left: (a - this.sh_sz[1]) + "px"
            });
            $(b[2]).css({
                width: (a + this.sh_sz[0] * 2) + "px",
                top: (c - this.sh_sz[1]) + "px"
            })
        },
        shadow_hide: function (a) {
            $(a[0]).add(a[1]).add(a[2]).hide()
        },
        shadow_show: function (a) {
            $(a[0]).add(a[1]).add(a[2]).show()
        },
        menu_init: function (e, c, b, a) {
            var d = {};
            if (!b.horiz) {
                $(e).attr("class", "u-menu" + (b.addclass ? " " + String(b.addclass) : "") + (b.withmarks ? " u-menumarks" : ""));
                if ($.browser.msie) {
                    $(e).css("overflow", "hidden")
                }
                $(e).html((a && a.props.horiz ? "" : '<div class="xw-tl"><div class="xw-tr"><div class="xw-tc xw-tsps"></div></div></div>') + '<div class="xw-ml"><div class="xw-mr"><div class="xw-mc"><div class="u-menubody"><div class="u-menucont" style="overflow:visible;height:' + c + 'px"></div></div></div></div></div><div class="xw-bl"><div class="xw-br"><div class="xw-bc"><div class="xw-footer"></div></div></div></div>')
            } else {
                $(e).attr("class", "u-menuh" + (b.addclass ? " " + String(b.addclass) : "") + (b.withmarks ? " u-menumarks" : "")).css("overflow", "hidden");
                $(e).html('<div class="u-menubody"><div class="u-menucont" style="overflow:hidden;height:' + c + 'px"></div></div>')
            }
            d.content = $(e).find(".u-menucont")[0];
            d.elems = [];
            d.marks = [];
            $(e).find("div,span").andSelf().attr("unselectable", "on");
            return d
        },
        append_item: function (e, d, b) {
            var h = e.elems.length,
                k, g, j = null,
                f, c, l;
            j = d[1] ? d[1] : (typeof(d[2].action) != "undefined" ? d[2].action : e.props.onitem);
            c = d[2].onldown || e.props.onldown;
            l = d[2].onrdown || e.props.onrdown;
            g = d[0];
            if (d[2].hl != undefined) {
                    b = d[2].hl
                }
            if (e.props.withmarks && g != "sep" && d[2].mark != undefined) {
                    g = '<div class="u-menumark"></div>' + g;
                    f = 1
                }
            if (j && (j == "a" || d[2].action == "a")) {
                    k = document.createElement("a");
                    $(k).css("display", "block")
                } else {
                    k = document.createElement("div")
                }
            if (!e.props.horiz) {
                    if (g == "sep") {
                        k.className = "u-menuvsep"
                    } else {
                        k.className = "u-menuvitem";
                        if (!j || j.constructor != _uMENU) {
                            $(k).html(g);
                            if (b) {
                                $(k).bind("mouseover", {
                                    hl: b,
                                    item: h,
                                    obj: e
                                }, _uMENU._onitemmouseover).bind("mouseout", {
                                    hl: b,
                                    item: -1,
                                    obj: e
                                }, _uMENU._onitemmouseout)
                            }
                            if (j) {
                                $(k).bind("click", {
                                    act: j,
                                    obj: e,
                                    item: h,
                                    itemobj: d
                                }, _uMENU._onitemclick)
                            }
                            if (c || l) {
                                $(k).bind("mousedown", {
                                    actl: c,
                                    actr: l,
                                    obj: e,
                                    item: h,
                                    itemobj: d
                                }, _uMENU._onitemmousedown)
                            }
                        } else {
                            $(k).addClass("u-menuvitemparent").html('<div class="u-menuarrow"></div>' + g);
                            $(k).bind("mouseover", {
                                hl: b,
                                item: h,
                                obj: e
                            }, _uMENU._onitemmouseover).bind("mouseout", {
                                hl: b,
                                item: h,
                                obj: e
                            }, _uMENU._onitemmouseout);
                            $(k).bind("mousedown", {
                                child: j,
                                obj: e,
                                item: h,
                                itemobj: d
                            }, _uMENU._onitemclick);
                            if (d[2].action) {
                                $(k).bind("click", {
                                    act: d[2].action,
                                    obj: e,
                                    item: h,
                                    itemobj: d
                                }, _uMENU._onitemclick)
                            }
                            if (c || l) {
                                $(k).bind("mousedown", {
                                    actl: c,
                                    actr: l,
                                    obj: e,
                                    item: h,
                                    itemobj: d
                                }, _uMENU._onitemmousedown)
                            }
                        }
                    }
                } else {
                    $(k).css("float", "left");
                    if (g == "sep") {
                        k.className = "u-menuhsep"
                    } else {
                        k.className = "u-menuhitem";
                        if (!j || j.constructor != _uMENU) {
                            $(k).html(g);
                            if (b) {
                                $(k).bind("mouseover", {
                                    hl: b,
                                    item: h,
                                    obj: e
                                }, _uMENU._onitemmouseover).bind("mouseout", {
                                    hl: b,
                                    item: h,
                                    obj: e
                                }, _uMENU._onitemmouseout)
                            }
                            if (j) {
                                $(k).bind("click", {
                                    act: j,
                                    obj: e,
                                    item: h,
                                    itemobj: d
                                }, _uMENU._onitemclick)
                            }
                            if (c || l) {
                                $(k).bind("mousedown", {
                                    actl: c,
                                    actr: l,
                                    obj: e,
                                    item: h,
                                    itemobj: d
                                }, _uMENU._onitemmousedown)
                            }
                        } else {
                            $(k).addClass("u-menuhitemparent").html(g);
                            $(k).bind("mouseover", {
                                hl: b,
                                item: h,
                                obj: e
                            }, _uMENU._onitemmouseover).bind("mouseout", {
                                hl: b,
                                item: h,
                                obj: e
                            }, _uMENU._onitemmouseout);
                            $(k).bind("mousedown", {
                                child: j,
                                obj: e,
                                item: h,
                                itemobj: d
                            }, _uMENU._onitemclick);
                            if (d[2].action) {
                                $(k).bind("click", {
                                    act: d[2].action,
                                    obj: e,
                                    item: h,
                                    itemobj: d
                                }, _uMENU._onitemclick)
                            }
                            if (c || l) {
                                $(k).bind("mousedown", {
                                    actl: c,
                                    actr: l,
                                    obj: e,
                                    item: h,
                                    itemobj: d
                                }, _uMENU._onitemmousedown)
                            }
                        }
                    }
                }
            if (b) {
                    $(k).find("*").andSelf().filter("[nodeType=1]").attr("unselectable", "on")
                }
            e.elems[h] = d;
            e.parts.elems[h] = k;
            if (f) {
                    e.parts.marks[h] = $(k).find(".u-menumark")[0]
                }
            if (e.props.horiz && (e.props.rtl || window._rtl)) {
                    e.parts.content.insertBefore(k, e.parts.content.firstChild)
                } else {
                    e.parts.content.appendChild(k)
                }
        },
        calc_size: function (e) {
            var a = 0,
                c = 0,
                f = 0,
                d = 0;
            if (!e.props.horiz) {
                    for (var b = 0; b < e.parts.elems.length; b++) {
                        a = Math.max(a, Math.max(e.parts.elems[b].offsetWidth, e.parts.elems[b].scrollWidth));
                        f += Math.max(d, parseInt("0" + $(e.parts.elems[b]).css("margin-top")));
                        d = parseInt("0" + $(e.parts.elems[b]).css("margin-bottom"));
                        c += e.parts.elems[b].offsetHeight
                    }
                    c += f + d
                } else {
                    for (var b = 0; b < e.parts.elems.length; b++) {
                        a += Math.max(e.parts.elems[b].offsetWidth, e.parts.elems[b].scrollWidth);
                        c = Math.max(c, e.parts.elems[b].offsetHeight)
                    }
                }
            return {
                    w: a,
                    h: c
                }
        },
        _onitemhl: function (b, a) {
            if (a) {
                $(this).addClass("u-menuitemhl")
            } else {
                $(this).removeClass("u-menuitemhl")
            }
        }
    }
};
_uMENU._onitemmouseover = function (f) {
    var g = f.data;
    var c = g.obj.hlitem,
        b, a;
    if (c >= 0 && c != g.item) {
            b = g.obj.elems[c];
            if (b && b[0] != "sep") {
                a = g.obj.props.highlight;
                if (b[2].hl != undefined) {
                    a = b[2].hl
                }
                if (a) {
                    g.obj.design._onitemhl.apply(g.obj.parts.elems[c], [null, 0])
                }
            }
        }
    if (g.hl) {
            g.obj.design._onitemhl.apply(this, [f, 1])
        }
    g.obj.hlitem = g.item;
    if (g.obj.hidetimer) {
            clearTimeout(g.obj.hidetimer)
        }
    g.obj.hidetimer = null;
    if (g.item >= 0) {
            if (!g.obj.props.horiz || g.obj._focus.isactive()) {
                g.obj.schedule_childopen(g.item)
            }
        }
};
_uMENU._onitemmouseout = function (b) {
    var c = b.data,
        a;
    if (c.hl) {
            if (c.obj.props.statical && c.obj._focus.isactive()) {
                return
            }
            if (c.item == c.obj.hlitem && c.item >= 0) {
                a = c.obj.elems[c.item];
                if (a && a[1] && a[1].constructor == _uMENU && a[1].state.visible) {
                    return
                }
                c.obj.design._onitemhl.apply(this, [b, 0]);
                c.obj.hlitem = -1
            }
        }
};
_uMENU._onitemclick = function (g) {
    var h = g.data,
        b = h.itemobj[1] || h.itemobj[2].action || h.obj.props.onitem;
    if (!h.child && b) {
            if (!h.obj.props.statical) {
                h.obj.hide(true)
            } else {
                h.obj.hidechildren()
            }
            if (b.constructor == Function) {
                b.apply(h.itemobj[2].thispar || h.obj.props.thispar, [h.item, h.obj, h.itemobj[2].id, h.itemobj[2], g])
            } else {
                if (b == "a") {
                    var a = null;
                    if (this == g.target || g.target.tagName.toLowerCase() != "a") {
                        if (this != g.target) {
                            var f = $(g.target).find("*").andSelf(),
                                c = $(this).find("*").not(f);
                            if (c.filter("A").length == 0) {
                                    a = $(this).find("a")[0]
                                } else {
                                    a = null
                                }
                        } else {
                            a = $(this).find("a")[0]
                        }
                        if (a) {
                            this.target = a.target;
                            this.href = a.href;
                            if (a.onclick) {
                                return a.onclick()
                            }
                        }
                    }
                    if (!a) {
                        this.removeAttribute("href")
                    }
                }
            }
            return
        }
    if (!h.child) {
            return
        }
    h.obj.reset_childopen();
    h.obj.hidechildren(h.child);
    if (h.obj.props.horiz && h.child.state.visible) {
            h.child.hide();
            h.obj._focus.deactivate()
        } else {
            if (!h.child.state.visible) {
                h.obj.childopen(h.item)
            }
        }
};
_uMENU._onitemmousedown = function (c) {
    var f = c.data,
        b = f.actl || f.obj.props.onldown,
        a = f.actr || f.obj.props.onrdown;
    if (c.which == 1 && c.ctrlKey) {
            c.which = 3
        }
    if (c.which == 1 && b) {
            _uWnd.globalmousedown();
            b.apply(f.itemobj[2].thispar || f.obj.props.thispar, [f.item, f.obj, f.itemobj[2].id, f.itemobj[2], c]);
            c.stopPropagation()
        } else {
            if (c.which == 3 && a) {
                a.apply(f.itemobj[2].thispar || f.obj.props.thispar, [f.item, f.obj, f.itemobj[2].id, f.itemobj[2], c]);
                c.preventDefault();
                c.stopPropagation()
            }
        }
};
_uMENU.hideallmenus = function () {
    var b, a, c;
    loop: for (b = 0; b < _uMENU.all.length; b++) {
        a = _uMENU.all[b];
        if (!a || !a.state.visible) {
            continue
        }
        if (a.props.statical) {
            a._focus.deactivate();
            continue
        }
        c = _uMENU.ignoreclick;
        while (c) {
            if (c == a) {
                continue loop
            }
            c = c.pos.parent
        }
        a.hide()
    }
    if (_uMENU.ignoreclick) {
        setTimeout("_uMENU.ignoreclick=null;", 10)
    }
};
_uMENU._onmenumousedown = function (a) {
    if (a.data.props.wnd) {
        a.data.props.wnd.activate(a, 1)
    }
    if (a.which == 1 && a.ctrlKey) {
        a.which = 3
    }
    if (a.which == 3 && a.data.props.horiz) {
        return
    }
    a.stopPropagation()
};
_uMENU.prototype = {
    onfocusdeactivate: function () {
        if (this.props.statical) {
            var c = this.hlitem,
                b, a;
            if (c >= 0) {
                    b = this.elems[c];
                    if (b && b[0] != "sep") {
                        a = this.props.highlight;
                        if (b[2].hl != undefined) {
                            a = b[2].hl
                        }
                        if (a) {
                            this.design._onitemhl.apply(this.parts.elems[c], [null, 0])
                        }
                    }
                }
        } else {
            this.hide()
        }
    },
    onkeydown: function (m, j, r) {
        var f = m.keyCode,
            c, p, h, a, d, g, o;
        if (f == 27 && r == this._focus) {
                if (!this.props.statical) {
                    this.hide();
                    if (this.pos.parent && this.pos.parent.props.statical) {
                        this.pos.parent._focus.deactivate()
                    }
                } else {
                    this.hidechildren();
                    this._focus.deactivate()
                }
                m.preventDefault();
                m.stopPropagation();
                return 1
            }
        if ((f == 17 || f == 18) && m.ctrlKey && m.altKey) {
                this._focus.deactivate();
                m.preventDefault();
                m.stopPropagation();
                return 1
            }
        if ((f == 13 || (f == 40 && this.props.horiz)) && r == this._focus) {
                m.preventDefault();
                m.stopPropagation();
                if (this.hlitem < 0) {
                    return 1
                }
                p = this.hlitem;
                h = this.elems[p];
                var l = h[1] || h[2].action || this.props.onitem;
                var b = h[2].onldown || this.props.onldown;
                a = 0;
                if (l && l.constructor == _uMENU) {
                    this.reset_childopen();
                    this.hidechildren(p);
                    if (!l.state.visible) {
                        this.childopen(p, 0)
                    }
                } else {
                    if (h[2].action) {
                        l = h[2].action
                    } else {
                        if (!l || l.constructor != Function) {
                            l = null
                        }
                    }
                }
                if (f == 40) {
                    return 1
                }
                if (l && l.constructor == Function) {
                    l.apply(h[2].thispar || this.props.thispar, [p, this, h[2].id, h[2], m]);
                    a = 1
                }
                if (b && b.constructor == Function) {
                    b.apply(h[2].thispar || this.props.thispar, [p, this, h[2].id, h[2], m]);
                    a = 1
                }
                if (a) {
                    if (!this.props.statical) {
                        this.hide(1)
                    } else {
                        this.hidechildren()
                    }
                }
                return 1
            }
        if (f == 93 && r == this._focus) {
                m.preventDefault();
                m.stopPropagation();
                if (this.hlitem < 0) {
                    return 1
                }
                p = this.hlitem;
                h = this.elems[p];
                var q = h[2].onrdown || this.props.onrdown;
                if (q && q.constructor == Function) {
                    q.apply(h[2].thispar || this.props.thispar, [p, this, h[2].id, h[2], m])
                }
                return 1
            }
        if ((f == 37 || f == 39) && r == this._focus && !this.props.horiz) {
                m.preventDefault();
                m.stopPropagation();
                if (f == 39 && this.hlitem >= 0) {
                    p = this.hlitem;
                    h = this.elems[p];
                    if (h && h[1] && h[1].constructor == _uMENU) {
                        this.childopen(p, 0);
                        return 1
                    }
                } else {
                    if (f == 37 && this.pos.parent && !this.pos.parent.props.horiz) {
                        this.hide();
                        return 1
                    }
                }
                h = this.pos.parent;
                while (h && !h.props.horiz && h != this) {
                    h = h.pos.parent
                }
                if (h && h.props.horiz) {
                    h.onkeydown(m, j, h._focus)
                }
            }
        if ((f == 40 || f == 38 || ((f == 37 || f == 39) && this.props.horiz)) && r == this._focus) {
                m.preventDefault();
                m.stopPropagation();
                if (this.props.horiz && (f == 40 || f == 38)) {
                    return 1
                }
                if (f == 40 || f == 39) {
                    o = 1
                } else {
                    o = -1
                }
                d = p = this.hlitem;
                c = this.elems.length;
                for (g = 0; g < c; g++) {
                    p += o;
                    if (p >= c || p < 0) {
                        p = o > 0 ? 0 : c - 1
                    }
                    h = this.elems[p];
                    if (h && h[0] != "sep") {
                        a = this.props.highlight;
                        if (h[2].hl != undefined) {
                            a = h[2].hl
                        }
                        if (a) {
                            break
                        }
                    }
                }
                if (g >= c || d == p) {
                    return 1
                }
                this.hlitem = p;
                if (d >= 0) {
                    h = this.elems[d];
                    if (h && h[0] != "sep") {
                        a = this.props.highlight;
                        if (h[2].hl != undefined) {
                            a = h[2].hl
                        }
                        if (a) {
                            this.design._onitemhl.apply(this.parts.elems[d], [m, 0]);
                            this.reset_childopen()
                        }
                    }
                }
                this.design._onitemhl.apply(this.parts.elems[p], [m, 1]);
                if (this.hidetimer) {
                    clearTimeout(this.hidetimer)
                }
                this.hidetimer = null;
                if (this.props.horiz) {
                    this.childopen(p, 0)
                }
                return 1
            }
    },
    shadow_init: function () {
        this.sh = this.design.shadow_init(this.top)
    },
    _resizeSh: function () {
        if (this.sh) {
            this.design.shadow_resize(this.sh, this.width, this.height)
        }
    },
    moveTo: function (x, y) {
        with(this) {
            $(top).css("left", x + "px").css("top", y + "px");
            xpos = x;
            ypos = y
        }
    },
    resizeTo: function (w, h) {
        with(this) {
            if (props.width == 0) {
                $(menu).css("width", w + "px")
            } else {
                if (props.width != "auto") {
                    $(menu).css("width", props.width)
                } else {
                    $(menu).css("width", "auto")
                }
            }
            if (props.horiz) {
                $(menu).css("height", h + "px");
                $(parts.content).css("width", (w - decor.w) + "px").css("height", (h - decor.h) + "px")
            } else {
                $(parts.content).css("width", (w - decor.w) + "px");
                if ($.browser.opera) {
                    $(top).css("width", w + "px")
                }
            }
            if (frame) {
                $(frame).css("width", w + "px").css("height", h + "px")
            }
            width = w;
            height = h;
            _resizeSh()
        }
    },
    init1: function (nocalcsize) {
        with(this) {
            decor.w = 50 - parts.content.offsetWidth;
            decor.h = menu.offsetHeight - (props.horiz ? 10 : 50);
            state.init = true;
            _initsubmenus();
            if (add_elems) {
                appendItems(null, 0, nocalcsize)
            } else {
                if (pend_show) {
                    show(pend_show)
                }
                if (props.onreadycreate) {
                    props.onreadycreate.call(props.thispar, this)
                }
                props.onreadycreate = null
            }
        }
    },
    show: function (f, q) {
        if (this.state.destroyed) {
            return
        }
        if (!this.state.init) {
            this.pend_show = f || {};
            return
        }
        this.pend_show = null;
        this.pos = $.extend(this.pos, f || {});
        if (this.pos.parent && !this.pos.parent.state.visible) {
            return
        }
        this._focus.deactivate();
        this._focus._parent = this.pos.parentfocus ? this.pos.parentfocus : (this.pos.parent ? this.pos.parent._focus : (this.props.wnd ? this.props.wnd._focus : null));
        if (!this.pos.parent) {
            this.zpos = _uMENU.defz
        } else {
            this.zpos = this.pos.parent.zpos + 5
        }
        $(this.top).css("z-index", this.zpos);
        if (this.pos.pos || this.pos.alignObj) {
            var w, l, h, p;
            if (this.pos.alignObj) {
                w = this.pos.alignObj;
                l = $(w).offset();
                h = w.offsetWidth;
                p = w.offsetHeight
            } else {
                l = {
                    left: this.pos.pos.x,
                    top: this.pos.pos.y
                };
                h = p = 0
            }
            var A, o, n, u = _uWnd.getdims(),
                z = u.clientW,
                k = u.clientH,
                g = u.clientLeft,
                b = u.clientTop,
                s = this.pos.align || "d";
            if (this.props.wnd && this.props.wnd.desktop) {
                    u = this.props.wnd.desktop;
                    z = u.width;
                    k = u.height;
                    g = 0;
                    b = 0
                }
            if (this.props.rtl || window._rtl) {
                    o = l.left + h + this.pos.dx - this.width
                } else {
                    o = l.left + this.pos.dx
                }
            n = l.top + this.pos.dy;
            if (s == "r" || s == "R") {
                    o = l.left + h + this.pos.dx
                } else {
                    if (s == "l" || s == "L") {
                        o = l.left - this.width + this.pos.dx
                    } else {
                        if (s == "d" || s == "D") {
                            n = l.top + p + this.pos.dy
                        } else {
                            if (s == "u" || s == "U") {
                                n = l.top - this.height + this.pos.dy
                            }
                        }
                    }
                }
            if (o - g + this.width > z - 3 - this.design.sh_sz[0] || o - g < 1) {
                    if (s == "R" || s == "U") {
                        o = l.left - this.width - this.pos.dx
                    } else {
                        if (s == "L") {
                            o = l.left + h - this.pos.dx
                        }
                    }
                }
            if (o - g + this.width > z - 3) {
                    o = z - 3 - this.design.sh_sz[0] - this.width + g
                }
            if (o - g < 1) {
                    o = 1 + g
                }
            if (n - b + this.height > k - 3 - this.design.sh_sz[1] || n - b < 1) {
                    if (s == "D") {
                        n = l.top - this.height - this.pos.dy
                    } else {
                        if (s == "U") {
                            n = l.top + p - this.pos.dy
                        }
                    }
                }
            if (n - b + this.height > k - 3) {
                    n = k - 3 - this.design.sh_sz[1] - this.height + b
                }
            if (n - b < 1) {
                    n = 1 + b
                }
            if (this.props.parentnode) {
                    A = $(this.props.parentnode).offset();
                    o -= A.left;
                    n -= A.top
                }
            this.moveTo(o, n)
        }
        if (this.props.onshow) {
            this.props.onshow.apply(this.props.thispar, [this, this.idx])
        }
        if (this.props.withmarks) {
            for (var t = 0; t < this.elems.length; t++) {
                var v = this.elems[t];
                if (v && v[2] && this.parts.marks[t]) {
                    if (!v[2].mark) {
                        this.parts.marks[t].style.display = "none"
                    } else {
                        var r = v[2].marktext || this.props.withmarks;
                        if (typeof r == "object" && r.constructr != String) {
                            r = r[v[2].mark]
                        }
                        this.parts.marks[t].innerHTML = String(r);
                        this.parts.marks[t].style.display = "block"
                    }
                }
            }
        }
        if (!this.props.statical && this.hlitem >= 0) {
            var j = this.elems[this.hlitem];
            if (j && j[0] != "sep") {
                var e = this.props.highlight;
                if (j[2].hl != undefined) {
                    e = j[2].hl
                }
                if (e) {
                    this.design._onitemhl.apply(this.parts.elems[this.hlitem], [null, 0])
                }
            }
            this.hlitem = -1
        }
        $(this.top).show();
        this.state.visible = true;
        if (!this.props.statical) {
            this._focus.activate()
        }
        if (typeof q != undefined && Number(q) != NaN) {
            var w = Number(q);
            if (w >= 0 && w < this.elems.length) {
                var j = this.elems[w];
                if (j && j[0] != "sep") {
                    var e = this.props.highlight;
                    if (j[2].hl != undefined) {
                        e = j[2].hl
                    }
                    if (e) {
                        this.design._onitemhl.apply(this.parts.elems[w], [null, 1]);
                        this.hlitem = w
                    }
                }
            }
        }
        if (this.props.hidetimer > 0) {
            this.hidetimer = setTimeout("var m=_uMENU.all[" + this.idx + "];if(m)m.hide();", this.props.hidetimer)
        }
    },
    hidechildren: function (a) {
        if (this.state.destroyed) {
            return
        }
        var c = this.elems;
        for (var b = 0; b < c.length; b++) {
            if (c[b] && c[b].constructor == Array && c[b][1] && c[b][1].constructor == _uMENU) {
                if (c[b][1] != a) {
                    c[b][1].hide()
                }
            }
        }
    },
    hide: function (a) {
        if (this.state.destroyed) {
            return
        }
        if (!this.state.visible) {
            return
        }
        $(this.top).hide();
        this.state.visible = false;
        if (this.hidetimer) {
            clearTimeout(this.hidetimer)
        }
        this.hidetimer = null;
        this.pend_show = null;
        this.hidechildren();
        if (this.props.onhide) {
            this.props.onhide.apply(this.props.thispar, [this, this.idx])
        }
        this._focus.deactivate();
        if (a) {
            var b = this.pos.parent;
            while (b && !b.props.statical && b != this) {
                b.hide(false);
                b = b.pos.parent
            }
            if (b && b != this && b.props.statical) {
                b._focus.deactivate()
            }
        }
    },
    childopen: function (b, a) {
        if (this.state.destroyed) {
            return
        }
        if (this.childtimer) {
            clearTimeout(this.childtimer)
        }
        this.childtimer = null;
        var d = this.parts.elems[b];
        var e = this.elems[b];
        if (!e) {
            return
        }
        e = e[1];
        if (!e || e.constructor != _uMENU) {
            this.hidechildren(e);
            return
        }
        this.hidechildren(e);
        e.show({
            dx: (this.props.horiz ? 0 : -3 * (this.props.rtl || window._rtl ? -1 : 1)),
            alignObj: d,
            align: (this.props.horiz ? "D" : (this.props.rtl || window._rtl ? "L" : "R")),
            parent: this
        }, a)
    },
    schedule_childopen: function (a) {
        if (this.state.destroyed) {
            return
        }
        if (this.childtimer) {
            clearTimeout(this.childtimer)
        }
        this.childtimer = setTimeout("var m=_uMENU.all[" + this.idx + "];if(m)m.childopen(" + a + ");", 100)
    },
    reset_childopen: function () {
        if (this.childtimer) {
            clearTimeout(this.childtimer)
        }
    },
    _initsubmenus: function () {
        with(this) {
            for (var i = 0; i < toinit.length; i++) {
                toinit[i].init1(true);
                tocalcsize[tocalcsize.length] = toinit[i]
            }
            toinit.length = 0
        }
    },
    _calcsizesubmenus: function () {
        with(this) {
            for (var i = 0; i < tocalcsize.length; i++) {
                tocalcsize[i]._setsize()
            }
            tocalcsize.length = 0
        }
    },
    createsubmenus: function () {
        var g, b = false;
        for (g = 0; g < this.add_elems.length; g++) {
            var c = this.add_elems[g];
            var e = c.length;
            for (var f = 0; f < e; f++) {
                if (c[f] && c[f].constructor == Array && c[f][1] && c[f][1].constructor == Array) {
                    var d = {},
                        h, a, k;
                    if (c[f][2] && (typeof c[f][2]) == "object") {
                            d = c[f][2]
                        } else {
                            if ((typeof c[f][2]) == "number") {
                                d = {
                                    hl: c[f][2]
                                }
                            } else {
                                if ((typeof c[f][2]) == "string") {
                                    d = {
                                        id: c[f][2]
                                    }
                                }
                            }
                        }
                    c[f][2] = d;
                    h = $.extend({
                            parent: this,
                            dx: this.props.horiz ? this.pos.childdx : 0,
                            dy: this.props.horiz ? this.pos.childdy : 0
                        }, d.pos || {});
                    a = $.extend({
                            shadow: this.props.shadow,
                            rtl: this.props.rtl ? 1 : 0,
                            parentnode: this.props.wnd ? this.props.wnd.top : this.props.parentnode,
                            wnd: this.props.wnd,
                            onitem: this.props.onitem,
                            thispar: this.props.thispar
                        }, d.opts || {});
                    k = new _uMENU("", h, a, c[f][1], true);
                    c[f][1] = k;
                    this.toinit[this.toinit.length] = k;
                    b = true
                }
            }
        }
        return b
    },
    indexById: function (b) {
        b = String(b);
        for (var a = 0; a < this.elems.length; a++) {
            if (this.elems[a][2].id == b) {
                return a
            }
        }
        return -1
    },
    removeItems: function (a, f, g) {
        var b, d, c;
        if (a == undefined || a == null) {
            a = [];
            for (b = 0; b < this.elems.length; b++) {
                a[b] = this.elems.length - 1 - b
            }
        } else {
            if (a.constructor != Array) {
                a = [a]
            }
        }
        for (b = 0; b < a.length; b++) {
            if (a[b] == undefined || a[b] == null || a[b].constructor != Number) {
                a[b] = this.indexById(a[b])
            }
        }
        a.sort(function (h, e) {
            return e - h
        });
        d = -1;
        for (b = 0; b < a.length; b++) {
            if (a[b] == d || a[b] < 0 || a[b] >= this.elems.length) {
                continue
            }
            c = this.elems[a[b]];
            if (!f && c && c.constructor == Array && c[1] && c[1].constructor == _uMENU) {
                c[1].destroy()
            }
            this.elems.splice(a[b], 1);
            this.parts.elems[a[b]].parentNode.removeChild(this.parts.elems[a[b]]);
            this.parts.elems.splice(a[b], 1);
            d = a[b]
        }
        if (!g) {
            this.appendItems(null, 0)
        }
    },
    appendItems: function (d, a, e) {
        if (this.state.destroyed) {
            return
        }
        if (d && d.constructor == Array && d.length > 0) {
            this.add_elems[this.add_elems.length] = d
        }
        if (!this.state.init) {
            return
        }
        if (this.createsubmenus()) {
            setTimeout("var m=_uMENU.all[" + this.idx + "];if(m){m._initsubmenus();m.appendItems(null,0," + e + ");}", 10);
            return
        }
        if (this.appendtimer) {
            clearTimeout(this.appendtimer)
        }
        this.appendtimer = null;
        $(this.top).css("visibility", "hidden").css("display", "block");
        if (this.props.horiz) {
            if (!this.props.noabs) {
                $(this.menu).css("width", "2100px").css("height", "auto")
            } else {
                $(this.menu).css("width", this.props.width == 0 ? "auto" : this.props.width == "auto" ? "auto" : this.props.width + "px")
            }
            $(this.parts.content).css("width", "2000px").css("height", "auto")
        } else {
            if ($.browser.opera) {
                $(this.top).css("width", "2000px")
            }
            $(this.menu).css("width", "auto").css("height", "auto");
            $(this.parts.content).css("width", $.browser.msie ? "50px" : "auto").css("height", "auto")
        }
        var c;
        for (c = 0; c < this.add_elems.length; c++) {
            d = this.add_elems[c];
            var g = d.length;
            for (var b = 0; b < g; b++) {
                if (!d[b] || d[b].constructor != Array) {
                    d[b] = ["" + d[b]]
                }
                var f = {};
                if (d[b][2] && (typeof d[b][2]) == "object") {
                    f = d[b][2]
                } else {
                    if ((typeof d[b][2]) == "number") {
                        f = {
                            hl: d[b][2]
                        }
                    } else {
                        if ((typeof d[b][2]) == "string") {
                            f = {
                                id: d[b][2]
                            }
                        }
                    }
                }
                d[b][2] = f;
                this.design.append_item(this, d[b], this.props.highlight)
            }
        }
        this.add_elems.splice(0, c);
        if (!e) {
            this.appendtimer = setTimeout("var m=_uMENU.all[" + this.idx + "];if(m){m.appendtimer=null;m._setsize();}", 10)
        }
    },
    _setsize: function () {
        var e = this.design.calc_size(this);
        this.resizeTo(e.w + this.decor.w, e.h + this.decor.h);
        this._calcsizesubmenus();
        $(this.top).css("display", "none").css("visibility", "visible");
        if (this.pend_show || this.state.visible) {
            this.show(this.pend_show)
        }
        var c = this.props.onreadycreate;
        if (c) {
            this.props.onreadycreate = null;
            c.call(this.props.thispar, this)
        }
        if (this.onsetsize) {
            var b = this.onsetsize;
            this.onsetsize = null;
            if (this.props.wnd) {
                b.apply(this.props.wnd)
            }
        }
    },
    destroy: function () {
        if (this.state.destroyed) {
            return
        }
        this.removeItems();
        this.top.parentNode.removeChild(this.top);
        _uMENU.all[this.idx] = null;
        this._focus.destroy();
        this.state.destroyed = true;
        if (this.props.ondestroy) {
            this.props.ondestroy.apply(this.props.thispar, [this, this.idx])
        }
    }
};

function _uComboBox(b, h, a, g, f) {
    this.constructor = _uComboBox;
    this.name = b;
    this.obj = h && h.tagName ? h : document.getElementById(h);
    if (!this.obj) {
        return null
    }
    this.props = $.extend({
        design: "std",
        readonly: false,
        noicons: -1,
        deficon: null,
        listwidth: "auto",
        maxlistheight: "auto",
        colwidth: null,
        onchange: null,
        wnd: null,
        rtl: 0
    }, a || {});
    this.app = this.props.wnd && this.props.wnd.app ? this.props.wnd.app : null;
    this.textvals = g > 0 ? g : 0;
    this.tablecols = g <= 0 ? 1 : g;
    this.colwidth = this.props.colwidth || [];
    this.destroyed = false;
    this.design = this.props.design && _uComboBox.designs[this.props.design] ? _uComboBox.designs[this.props.design] : _uComboBox.designs.std;
    this.idx = _uComboBox.nextidx++;
    _uComboBox.all[this.idx] = this;
    this.data = [];
    if (!f) {
        f = []
    }
    var e = -1;
    for (var c = 0; c < f.length; c++) {
        if (e < 0 && f[c][2]) {
            e = c
        }
    }
    this.userInput = this.prevInput = this.obj.value;
    if (this.props.readonly) {
        this.obj.readOnly = true;
        this.valobj = $('<input type="hidden" name="' + this.obj.name + '" value="">')[0];
        this.obj.removeAttribute("name");
        if (this.obj.form) {
            this.obj.form.appendChild(this.valobj)
        }
        if (e < 0 || e >= f.length) {
            e = 0
        }
    } else {
        this.obj.readOnly = false;
        this.valobj = this.obj;
        if (e < 0 || e >= f.length) {
            e = -1
        }
    }
    this.selected = this.userIdx = e;
    this.changetimer = null;
    this.haveicons = this.props.noicons > 0;
    if (this.props.noicons < 0) {
        for (var c = 0; c < f.length; c++) {
            if (f[c][1]) {
                this.haveicons = true;
                break
            }
        }
    }
    this.frame = null;
    this.opened = false;
    this.updated = true;
    this.showtimer = null;
    this.blurtimer = null;
    this.cancelblur = false;
    this.combo = null;
    var j = document.createElement("div");
    j.id = "_ucombolist" + this.idx;
    this.toplist = j;
    $(j).css({
        position: "absolute",
        zIndex: 5,
        display: "none"
    });
    if ($.browser.msie && parseFloat($.browser.version) < 8) {
        var d = '<iframe tabindex="-1" style="display:block; position:absolute; filter:Alpha(Opacity=\'0\'); width:1px;height:1px;border:0"/>';
        this.frame = document.createElement(d);
        j.appendChild(this.frame)
    }
    this.parts = this.design.combo_init(this);
    $(this.obj).attr("autocomplete", "off").bind("focus", this, _uComboBox._onobjfocus).bind("blur", this, _uComboBox._onobjblur).bind("beforedeactivate", this, _uComboBox._onobjdeact).bind("keydown", this, function (i) {
        return i.data.onkeydown(i)
    }).bind("keyup", this, function (i) {
        return i.data.onkeyup(i)
    });
    $(this.combo).bind("mousedown", this, _uComboBox._oncombomousedown);
    $(this.toplist).bind("mousedown", this, _uComboBox._onlistmousedown);
    for (var c = 0; c < f.length; c++) {
        this.appendItem(f[c])
    }
    if (!_uComboBox.globalset) {
        _uComboBox.globalset = true;
        $(document).bind("mousedown", _uComboBox.hideall);
        $(window).bind("resize", _uComboBox.hideall)
    }
    if (e >= 0) {
        this.select(e, false, true)
    }
}
_uComboBox.all = [];
_uComboBox.nextidx = 0;
_uComboBox.defz = 20015;
_uComboBox.globalset = false;
_uComboBox.ignoreclick = null;
_uComboBox.getbyname = function (c) {
    var b = this.all;
    for (var d = 0; d < b.length; d++) {
        if (b[d] && b[d].name == c) {
            return b[d]
        }
    }
    return null
};
_uComboBox.hideall = function () {
    var b = _uComboBox.all;
    for (var c = 0; c < b.length; c++) {
        if (b[c] && !b[c].destroyed && _uComboBox.ignoreclick != b[c]) {
            b[c].hidelist()
        }
    }
    if (_uComboBox.ignoreclick) {
        setTimeout("_uComboBox.ignoreclick=null;", 10)
    }
};
_uComboBox.designs = {
    std: {
        combo_init: function (b) {
            var a = {};
            b.combo = $('<table id="_ucombo' + b.idx + '" style="position:relative" cellspacing="0" cellpadding="0" border="0" class="x-unselectable u-combo" align="left"><tr><td class="u-comboeditcell"></td><td class="u-combobutcell"><div class="u-combobut"></td></tr></table>')[0];
            b.obj.parentNode.insertBefore(b.combo, b.obj);
            if (!b.props.wnd) {
                b.obj.parentNode.insertBefore(b.toplist, b.obj)
            } else {
                b.props.wnd.top.appendChild(b.toplist)
            }
            a.editcell = $(b.combo).find(".u-comboeditcell")[0];
            a.button = $(b.combo).find(".u-combobut")[0];
            a.butcell = $(b.combo).find(".u-combobutcell")[0];
            a.editcell.appendChild(b.obj);
            $(b.obj).attr("class", "x-selectable u-comboedit" + (b.haveicons ? " u-comboeditimg" : "") + " " + $(b.obj).attr("class"));
            $(b.toplist).append('<div class="u-combolist"><div style="zoom:1"><table border="0" cellspacing="0" class="x-unselectable u-combocont" width="100%"></table></div></div>');
            a.list = $(b.toplist).find(".u-combolist")[0];
            a.content = $(b.toplist).find(".u-combocont")[0];
            if (!b.props.readonly) {
                $(a.button).bind("mousedown", b, _uComboBox._onbutclick)
            } else {
                $(b.obj).bind("mousedown", function (c) {
                    c.preventDefault();
                    return 0
                })
            }
            $(a.button).bind("mouseover", b.design._onbutmouseover).bind("mouseout", b.design._onbutmouseout);
            a.items = [];
            $(b.toplist).find("div,span,table").andSelf().attr("unselectable", "on");
            return a
        },
        append_item: function (h, f) {
            var g, b, e = h.parts.content,
                d = e.rows.length,
                a;
            g = h.parts.items[d] = e.insertRow(d);
            $(g).attr("class", "u-comborow").bind("mouseover", h, _uComboBox._onitemmouseover).bind("mouseout", h, _uComboBox._onitemmouseout).bind("click", h, _uComboBox._onitemclick);
            for (var c = 0; c < h.tablecols; c++) {
                    b = g.insertCell(c);
                    a = c + 3 < f.length ? f[c + 3] : (c == 0 ? f[0] : "&nbsp;");
                    if (c == 0 && f[1]) {
                        a = '<img class="u-comborowicon" border="0" src="' + f[1] + '">' + a
                    }
                    $(b).attr("class", "u-combocell" + c).html(a);
                    if (h.colwidth[c]) {
                        $(b).attr("width", h.colwidth[c])
                    }
                }
            $(g).find("*").andSelf().attr("unselectable", "on")
        },
        remove_item: function (c, b) {
            var a = c.parts.content;
            if (b < 0 || b >= a.rows.length) {
                return
            }
            $(a.rows[b]).unbind();
            c.parts.items.splice(b, 1);
            a.deleteRow(b)
        },
        calc_size: function (d) {
            var a = 0,
                c = 0;
            if (!d.props.horiz) {
                    for (var b = 0; b < d.parts.elems.length; b++) {
                        a = Math.max(a, Math.max(d.parts.elems[b].offsetWidth, d.parts.elems[b].scrollWidth));
                        c += d.parts.elems[b].offsetHeight
                    }
                } else {
                    for (var b = 0; b < d.parts.elems.length; b++) {
                        a += Math.max(d.parts.elems[b].offsetWidth, d.parts.elems[b].scrollWidth);
                        c = Math.max(c, d.parts.elems[b].offsetHeight)
                    }
                }
            return {
                    w: a,
                    h: c
                }
        },
        _onitemmouseover: function (a) {
            $(this).addClass("u-comborowhl")
        },
        _onitemmouseout: function (a) {
            $(this).removeClass("u-comborowhl")
        },
        _onbutmouseover: function () {
            $(this).addClass("u-combobuthl")
        },
        _onbutmouseout: function () {
            $(this).removeClass("u-combobuthl")
        },
        _onlistopen: function (a) {
            $(a.combo).addClass("u-comboopen")
        },
        _onlisthide: function (a) {
            $(a.combo).removeClass("u-comboopen")
        },
        _onfocus: function (b, a) {
            $(b.combo).addClass("u-combofocus")
        },
        _onblur: function (b, a) {
            $(b.combo).removeClass("u-combofocus")
        },
        _select: function (b, a) {
            $(b.parts.items[a]).addClass("u-comborowsel")
        },
        _deselect: function (b, a) {
            $(b.parts.items[a]).removeClass("u-comborowsel")
        },
        seticon: function (b, a) {
            if (a) {
                $(b.obj).css("background-image", "url(" + a + ")")
            } else {
                $(b.obj).css("background-image", b.props.deficon ? "url(" + b.props.deficon + ")" : "none")
            }
        }
    }
};
_uComboBox._onitemmouseover = function (a) {
    a.data.design._onitemmouseover.apply(this, [a])
};
_uComboBox._onitemmouseout = function (a) {
    a.data.design._onitemmouseout.apply(this, [a])
};
_uComboBox._onitemclick = function (b) {
    var c = b.data;
    for (var a = 0; a < c.parts.items.length; a++) {
        if (c.parts.items[a] == this) {
            c.select(a);
            c.hidelist();
            c.obj.focus()
        }
    }
    b.preventDefault()
};
_uComboBox._onbutclick = function (a) {
    var b = a.data;
    _uComboBox.ignoreclick = a.data;
    _uWnd.globalmousedown();
    if (b.opened) {
        b.hidelist()
    } else {
        b.showlist();
        _uComboBox.ignoreclick = a.data
    }
    b.obj.focus();
    if ($.browser.msie && !a.data.cancelblur) {
        a.data.cancelblur = true;
        setTimeout("var c=_uComboBox.all[" + a.data.idx + "];if(c)c.cancelblur=false;", 10)
    }
    a.preventDefault()
};
_uComboBox._onlistmousedown = function (a) {
    _uComboBox.ignoreclick = a.data;
    a.data.obj.focus();
    if ($.browser.msie && !a.data.cancelblur) {
        a.data.cancelblur = true;
        setTimeout("var c=_uComboBox.all[" + a.data.idx + "];if(c)c.cancelblur=false;", 10)
    }
    a.preventDefault()
};
_uComboBox._oncombomousedown = function (a) {
    _uComboBox.ignoreclick = a.data;
    _uWnd.globalmousedown();
    if (a.which != 1) {
        return
    }
    var b = a.data;
    if (b.props.readonly) {
        if (b.opened) {
            b.hidelist()
        } else {
            b.showlist();
            _uComboBox.ignoreclick = a.data
        }
    }
    b.obj.focus();
    if ($.browser.msie && !b.cancelblur) {
        b.cancelblur = true;
        setTimeout("var c=_uComboBox.all[" + b.idx + "];if(c)c.cancelblur=false;", 10)
    }
    if (a.target != b.obj) {
        a.preventDefault()
    }
};
_uComboBox._onobjfocus = function (a) {
    var b = a.data;
    if (b.blurtimer) {
        clearTimeout(b.blurtimer)
    }
    b.blurtimer = null;
    b.design._onfocus(b, a)
};
_uComboBox._onobjblur = function (a) {
    a.data.onblur()
};
_uComboBox._onobjdeact = function (a) {
    var b = a.data;
    if (b.cancelblur) {
        a.preventDefault()
    }
};
_uComboBox.isUpKey = function (a) {
    return a == 38 || a == 63232
};
_uComboBox.isDownKey = function (a) {
    return a == 40 || a == 63233
};
_uComboBox.prototype = {
    _setvalue: function (i) {
        with(this) {
            if (i >= 0 && i < data.length) {
                valobj.value = prevInput = data[i][0];
                if (props.readonly) {
                    obj.value = data[i].length > 2 ? data[i][2] : data[i][0]
                }
                if (haveicons) {
                    design.seticon(this, data[i][1])
                }
            } else {
                if (props.readonly) {
                    valobj.value = "";
                    obj.value = userInput
                } else {
                    valobj.value = prevInput = userInput
                }
                if (haveicons) {
                    this.design.seticon(this, null)
                }
            }
        }
    },
    _selectitem: function (i) {
        with(this) {
            if (selected >= 0 && selected < data.length) {
                design._deselect(this, selected);
                selected = -1
            }
            if (i >= 0 && i < data.length) {
                design._select(this, i);
                selected = i
            }
        }
    },
    setvalue: function (v) {
        with(this) {
            var ch = false;
            if (props.readonly) {
                return
            }
            if (changetimer) {
                clearTimeout(changetimer)
            }
            if (valobj.value != v) {
                ch = true
            }
            valobj.value = prevInput = userInput = v;
            if (selected != -1) {
                ch = true
            }
            _selectitem(-1);
            userIdx = -1;
            if (haveicons) {
                this.design.seticon(this, null)
            }
            if (props.onchange && ch) {
                props.onchange.apply(this.app || this, [selected, v])
            }
        }
    },
    select: function (i, soft) {
        with(this) {
            var ch = false;
            if (changetimer) {
                clearTimeout(changetimer)
            }
            changetimer = null;
            _selectitem(i);
            _setvalue(selected);
            if (!soft) {
                if (selected != userIdx) {
                    ch = true
                }
                userIdx = selected;
                if (props.onchange && ch) {
                    props.onchange.apply(this.app || this, [selected, valobj.value])
                }
            }
        }
    },
    onblur: function (a) {
        if (this.blurtimer) {
            clearTimeout(this.blurtimer)
        }
        this.blurtimer = setTimeout("var c=_uComboBox.all[" + this.idx + "];if(c)c._onblur2();", 10)
    },
    _onblur2: function (a) {
        this.blurtimer = null;
        this.design._onblur(this, a)
    },
    onkeydown: function (e) {
        var i;
        with(this) {
            var c = e.keyCode;
            if (c == 27 && opened) {
                select(userIdx, true);
                hidelist();
                return false
            }
            if (data.length == 0) {
                return
            }
            if (c == 13) {
                select(selected);
                hidelist();
                obj.focus();
                e.preventDefault();
                e.stopPropagation();
                return false
            }
            if (c == 9) {
                if (changetimer) {
                    select(selected)
                }
                return
            }
            if (_uComboBox.isDownKey(c) || _uComboBox.isUpKey(c)) {
                i = selected + (_uComboBox.isDownKey(c) ? 1 : -1);
                if (props.readonly) {
                    if (i >= data.length) {
                        i = 0
                    } else {
                        if (i < 0) {
                            i = data.length - 1
                        }
                    }
                } else {
                    if (i >= data.length) {
                        i = -1
                    } else {
                        if (i < -1) {
                            i = data.length - 1
                        }
                    }
                }
                select(i, true);
                if (!opened) {
                    changetimer = setTimeout("var c=_uComboBox.all[" + this.idx + "];if(c)c.select(" + i + ");", 500)
                }
                return false
            }
        }
    },
    onkeyup: function (e) {
        with(this) {
            if (props.readonly || obj.value == prevInput) {
                return
            }
            if (changetimer) {
                clearTimeout(changetimer)
            }
            prevInput = userInput = obj.value;
            _selectitem(-1);
            userIdx = -1;
            if (haveicons) {
                this.design.seticon(this, null)
            }
            if (props.onchange) {
                props.onchange.apply(this.app || this, [-1, obj.value])
            }
        }
    },
    appendItem: function (a) {
        this.data[this.data.length] = [a[0], a[1], a[3]];
        this.design.append_item(this, a);
        this.updated = true
    },
    removeItem: function (a) {
        if (a < 0 || a >= this.data.length) {
            return
        }
        this.design.remove_item(this, a);
        this.data.splice(a, 1);
        this.updated = true
    },
    removeAll: function () {
        for (var a = 0; a < this.data.length; a++) {
            this.design.remove_item(this, 0)
        }
        this.data.splice(0, this.data.length);
        this.updated = true
    },
    hidelist: function () {
        this.toplist.style.display = "none";
        this.opened = false;
        this.design._onlisthide(this)
    },
    showlist: function () {
        var b, a, e;
        if (!this.props.wnd) {
            a = this.combo.offsetLeft;
            e = this.combo.offsetTop
        } else {
            var d = $(this.combo).offset(),
                c = $(this.props.wnd.top).offset();
            a = d.left - c.left;
            e = d.top - c.top
        }
        if (this.props.listwidth == "auto") {
            b = this.combo.offsetWidth + "px"
        } else {
            b = this.props.listwidth
        }
        $(this.toplist).css({
            left: a + "px",
            top: (e + this.combo.offsetHeight - 1) + "px",
            width: b,
            minWidth: this.combo.offsetWidth + "px"
        });
        if (this.frame) {
            $(this.frame).css({
                width: b
            })
        }
        if (this.updated) {
            $(this.parts.list).css({
                height: "auto",
                overflow: "hidden"
            });
            $(this.toplist).css({
                visibility: "hidden"
            }).css({
                display: "block"
            });
            if (this.showtimer) {
                clearTimeout(this.showtimer)
            }
            this.showtimer = setTimeout("var c=_uComboBox.all[" + this.idx + "];if(c)c._showlist();", 10)
        } else {
            this.toplist.style.display = "block"
        }
        this.design._onlistopen(this);
        this.opened = true;
        this.updated = false
    },
    _showlist: function () {
        this.showtimer = null;
        var e = this.parts.list,
            b, a, f, c = _uWnd.getdims();
        b = Math.max(e.scrollHeight, e.offsetHeight);
        f = $(this.toplist).offset();
        if (this.props.maxlistheight > 0) {
                a = Math.max(50, Math.min(this.props.maxlistheight, c.clientH - f.top))
            } else {
                a = Math.max(50, c.clientH - f.top)
            }
        if (b > a) {
                $(this.parts.list).css({
                    height: a + "px",
                    overflow: "auto"
                });
                b = a
            }
        if (this.frame) {
                $(this.frame).css({
                    height: b + "px"
                })
            }
        $(this.toplist).css({
                visibility: "visible"
            })
    }
};

function _uSuggestList(b, a, f, g) {
    this.constructor = _uSuggestList;
    this.name = b;
    this.obj = typeof a == "string" ? document.getElementById(a) : a;
    if (!this.obj) {
        return null
    }
    this.props = $.extend({
        design: "std",
        maxlistheight: "auto",
        colwidth: null,
        cachegroup: "def",
        minlen: 2,
        url: null,
        separator: null
    }, f || {});
    this.colwidth = this.props.colwidth || [];
    this.design = this.props.design && _uSuggestList.designs[this.props.design] ? _uSuggestList.designs[this.props.design] : _uSuggestList.designs.std;
    this.idx = _uSuggestList.nextidx++;
    _uSuggestList.all[this.idx] = this;
    this.cacheGroup = this.props.cachegroup;
    if (!this.queryCache[this.cacheGroup]) {
        this.queryCache[this.cacheGroup] = []
    }
    if (g) {
        this.queryCache[this.cacheGroup] = g
    }
    this.visible = true;
    this.hlIndex = -1;
    this.hlRow = null;
    this.blockMouseOver = false;
    this.userInput = this.obj.value;
    this.previousInput = this.obj.value;
    this.resultInput = "";
    this.requestedInput = "";
    this.ignoreInput = "";
    this.sep_pos = -1;
    this.remoteReqTimer = null;
    this.hideTimer = null;
    this.AJAXretries = 0;
    this.AJAXTimer = null;
    this.frame = null;
    var d = document.createElement("div");
    d.id = "_usuggest" + this.idx;
    this.top = d;
    var e;
    if (e = _uWnd.findparent(this.obj)) {
        this.parent = e.top;
        this.parent.appendChild(d)
    } else {
        this.parent = this.obj.parentNode;
        this.parent.insertBefore(d, this.obj)
    }
    $(d).css({
        position: "absolute",
        zIndex: 5,
        display: "none",
        zoom: 1
    });
    if (0 && $.browser.msie && parseFloat($.browser.version) < 7) {
        var c = '<iframe tabindex="-1" style="display:block; position:absolute;filter:Alpha(Opacity=\'100\'); width:1px;height:20px;border:0"/>';
        this.frame = document.createElement(c);
        d.appendChild(this.frame)
    }
    this.parts = this.design.suggest_init(this);
    $(this.obj).attr("autocomplete", "off").css("position", "relative").bind("blur", this, function (h) {
        return h.data.onblur(h)
    }).bind("keydown", this, function (h) {
        return h.data.onkeydown(h)
    }).bind("keyup", this, function (h) {
        return h.data.onkeyup(h)
    });
    if (!_uSuggestList.globalset) {
        _uSuggestList.globalset = true;
        $(document).bind("mousedown", _uSuggestList.hideall);
        $(window).bind("resize", _uSuggestList.hideall)
    }
    this.hide();
    if (this.obj.form) {
        $(this.obj.form).bind("submit." + this.idx, this, function (h) {
            return h.data.onsubmitform(h)
        })
    }
}
_uSuggestList.all = [];
_uSuggestList.nextidx = 0;
_uSuggestList.defz = 20015;
_uSuggestList.globalset = false;
_uSuggestList.ignoreclick = null;
_uSuggestList.getbyname = function (c) {
    var b = this.all;
    for (var d = 0; d < b.length; d++) {
        if (b[d] && b[d].name == c) {
            return b[d]
        }
    }
    return null
};
_uSuggestList.hideall = function () {
    var b = _uSuggestList.all;
    for (var c = 0; c < b.length; c++) {
        if (b[c] && !b[c].destroyed && _uSuggestList.ignoreclick != b[c]) {
            b[c].hide()
        }
    }
    if (_uSuggestList.ignoreclick) {
        setTimeout("_uSuggestList.ignoreclick=null;", 10)
    }
};
_uSuggestList.designs = {
    std: {
        suggest_init: function (b) {
            var a = {};
            $(b.obj).attr("class", "x-selectable u-suggedit " + $(b.obj).attr("class"));
            $(b.top).append('<div class="u-sugglist" style="zoom:1"><div style="zoom:1"><table border="0" cellspacing="0" class="x-unselectable u-suggcont" width="100%"></table></div></div>');
            a.list = $(b.top).find(".u-sugglist")[0];
            a.content = $(b.top).find(".u-suggcont")[0];
            $(b.top).find("div,span,table").andSelf().attr("unselectable", "on");
            return a
        },
        append_row: function (g, d, e, c) {
            var f = g.parts.content.insertRow(-1);
            $(f).bind("mousedown", g, g._onrowmousedown).bind("mousemove", g, g._onrowmousemove).bind("mouseover", g, g._onrowmouseover).addClass("u-suggrow").attr("usuggeststr", d[0]);
            var a = String(d[0]);
            if (a.toLowerCase().substr(0, c.length) == c.toLowerCase()) {
                a = '<span class="u-suggmark">' + a.substr(0, c.length) + "</span>" + a.substr(c.length)
            }
            for (var b = 0; b < e; b++) {
                $(f).append("<td unselectable='on' class='u-suggcell" + b + "'>" + (b == 0 ? a : d[b]) + "</td>")
            }
        },
        _select: function (b, a) {
            $(a).addClass("u-suggrowhl")
        },
        _deselect: function (b, a) {
            $(a).removeClass("u-suggrowhl")
        }
    }
};
_uSuggestList.prototype = {
    queryCache: [],
    onsubmitform: function (a) {
        if (this.visible) {
            if (this.resultInput != "") {
                this.obj.value = this.userInput
            }
            this.hide()
        }
    },
    hide: function () {
        with(this) {
            top.style.display = "none";
            visible = false;
            if (hlRow) {
                design._deselect(this, hlRow)
            }
            hlRow = null;
            hlIndex = -1
        }
    },
    show: function () {
        with(this) {
            if (!visible && numItems() > 0) {
                var w = obj.offsetWidth,
                    x, y, off, offp;
                off = $(obj).offset();
                offp = $(parent).offset();
                $(top).css({
                        left: off.left - offp.left + "px",
                        top: off.top - offp.top + obj.offsetHeight + "px",
                        width: w + "px"
                    });
                if (frame) {
                        $(frame).css({
                            width: w + "px"
                        })
                    }
                top.style.display = "block";
                visible = true;
                blockMouseOver = true
            }
        }
    },
    numItems: function () {
        return this.parts.content ? this.parts.content.rows.length : 0
    },
    onblur: function (e) {
        with(this) {
            if (visible) {
                if (hlIndex >= 0) {
                    obj.value = userInput
                }
                hide()
            }
        }
    },
    onkeydown: function (e) {
        with(this) {
            var c = e.keyCode;
            if (c == 27 && visible) {
                if (resultInput != "") {
                    _setvalue_sep(userInput)
                }
                hide();
                return false
            }
            if (resultInput == "") {
                return
            }
            if (c == 13 && hlIndex >= 0 && visible) {
                previousInput = obj.value;
                userInput = _getvalue_sep();
                resetRequest(userInput);
                hide();
                if (userInput != resultInput) {
                    clearResult()
                }
                obj.focus();
                e.preventDefault();
                e.stopPropagation();
                return false
            }
            if (isDownKey(c)) {
                moveSelection(hlIndex + 1);
                return false
            }
            if (isUpKey(c)) {
                moveSelection(hlIndex - 1);
                return false
            }
        }
    },
    onkeyup: function (e) {
        with(this) {
            if (ignoreInput != "" && _getvalue_sep() == ignoreInput) {
                return
            }
            if (obj.value == previousInput) {
                return
            }
            ignoreInput = resultInput = "";
            previousInput = obj.value;
            userInput = _getvalue_sep();
            if (hideTimer) {
                clearTimeout(hideTimer)
            }
            hideTimer = setTimeout("var c=_uSuggestList.all[" + idx + "];if(c)c.clearResult(true);", 2000);
            procRequest(userInput)
        }
    },
    _setvalue_sep: function (v) {
        with(this) {
            if (sep_pos >= 0) {
                obj.value = obj.value.substr(0, sep_pos) + props.separator + " " + v
            } else {
                obj.value = v
            }
        }
    },
    _getvalue_sep: function () {
        with(this) {
            if (props.separator) {
                sep_pos = obj.value.lastIndexOf(props.separator)
            }
            if (sep_pos >= 0) {
                var t = obj.value.substr(sep_pos + props.separator.length);
                t = t.replace(/^\s+/, "");
                return t
            } else {
                return obj.value
            }
        }
    },
    moveSelection: function (newi) {
        with(this) {
            if (resultInput == "" && ignoreInput != "" && _getvalue_sep() == ignoreInput) {
                procRequest(_getvalue_sep(), true);
                return
            }
            if (!visible && resultInput.length > 0 && resultInput == _getvalue_sep()) {
                show();
                return
            }
            if (!visible) {
                return
            }
            if (hlRow) {
                design._deselect(this, hlRow)
            }
            hlRow = null;
            var cnt = numItems();
            if (newi >= cnt) {
                newi = -1
            } else {
                if (newi < -1) {
                    newi = cnt - 1
                }
            }
            if (newi == -1) {
                hlIndex = -1;
                _setvalue_sep(userInput);
                obj.focus();
                return
            }
            hlIndex = newi;
            hlRow = parts.content.rows[newi];
            design._select(this, hlRow);
            ignoreInput = $(hlRow).attr("usuggeststr");
            _setvalue_sep(ignoreInput)
        }
    },
    isUpKey: function (a) {
        return a == 38 || a == 63232
    },
    isDownKey: function (a) {
        return a == 40 || a == 63233
    },
    resetRequest: function (txt) {
        with(this) {
            if (remoteReqTimer && requestedInput == txt) {
                return
            }
            clearTimeout(remoteReqTimer);
            remoteReqTimer = null;
            requestedInput = txt;
            clearTimeout(AJAXTimer);
            AJAXTimer = null;
            try {
                if (AJAXObj) {
                    AJAXObj.abort()
                }
                AJAXObj = null
            } catch (e) {}
        }
    },
    procRequest: function (txt, nopause) {
        with(this) {
            resetRequest(txt);
            if (txt.length < props.minlen) {
                clearResult(true);
                return
            }
            if (queryCache[cacheGroup][txt]) {
                setResult(txt, queryCache[cacheGroup][txt]);
                return
            }
            AJAXretries = 0;
            if (!props.url) {
                return
            }
            if (nopause) {
                remoteRequest()
            } else {
                remoteReqTimer = setTimeout("var c=_uSuggestList.all[" + this.idx + "];if(c)c.remoteRequest();", 350)
            }
        }
    },
    remoteRequest: function () {
        with(this) {
            clearTimeout(remoteReqTimer);
            remoteReqTimer = null;
            try {
                if (AJAXObj) {
                    AJAXObj.abort()
                }
                AJAXObj = null
            } catch (e) {}
            if (AJAXretries > 1) {
                return
            }
            clearTimeout(AJAXTimer);
            AJAXTimer = setTimeout("var c=_uSuggestList.all[" + this.idx + "];if(c){c.AJAXretries++;c.remoteRequest();}", 12000);
            AJAXObj = $.ajax({
                type: "GET",
                dataType: "text",
                cache: false,
                url: props.url,
                data: {
                    tag: requestedInput
                },
                success: new Function("resp", "status", "var c=_uSuggestList.all[" + this.idx + "];if(c)c.parseRequest(resp,status);"),
                timeout: 10000
            })
        }
    },
    parseRequest: function (resp, status) {
        clearTimeout(this.AJAXTimer);
        this.AJAXTimer = null;
        this.AJAXretries = 0;
        var res = [];
        try {
            res = eval("res=" + resp)
        } catch (e) {}
        this.AJAXObj = null;
        if (!res || res.length < 2 || res[1] < 1 || res[1] > 10) {
            this.clearResult();
            return
        }
        var n = res[1],
            idx = 0;
        var data = [];
        for (var i = 2; i < res.length; i += n, idx++) {
                data[idx] = [];
                for (var j = 0; j < n; j++) {
                    data[idx][j] = res[i + j]
                }
            }
        this.queryCache[this.cacheGroup][res[0]] = data;
        if (res[0] == this.requestedInput) {
                this.setResult(res[0], this.queryCache[this.cacheGroup][res[0]])
            }
    },
    _onrowmousemove: function (a) {
        return a.data.onrowmousemove(a)
    },
    _onrowmouseover: function (a) {
        return a.data.onrowmouseover(a)
    },
    _onrowmousedown: function (a) {
        return a.data.onrowmousedown(a)
    },
    onrowmousemove: function (a) {
        if (this.blockMouseOver) {
            this.blockMouseOver = false;
            this.onrowmouseover(a)
        }
    },
    onrowmouseover: function (e) {
        with(this) {
            if (blockMouseOver) {
                return
            }
            if (hlRow) {
                design._deselect(this, hlRow)
            }
            hlRow = null;
            hlIndex = -1;
            for (var i = 0; i < parts.content.rows.length; i++) {
                if (parts.content.rows[i] == e.target || jQuery.inArray(e.target, $(parts.content.rows[i]).contents()) >= 0) {
                    hlIndex = i;
                    hlRow = parts.content.rows[i];
                    design._select(this, hlRow);
                    break
                }
            }
        }
    },
    onrowmousedown: function (e) {
        with(this) {
            if (numItems() <= 0 || !hlIndex < 0 || !hlRow) {
                return
            }
            ignoreInput = userInput = $(hlRow).attr("usuggeststr");
            _setvalue_sep(userInput);
            previousInput = obj.value;
            resetRequest(userInput);
            hide();
            if (userInput != resultInput) {
                clearResult()
            }
            obj.focus()
        }
    },
    setResult: function (phrase, table) {
        with(this) {
            if (hideTimer) {
                clearTimeout(hideTimer)
            }
            hideTimer = null;
            clearResult();
            hlIndex = -1;
            hlRow = null;
            resultInput = phrase;
            var cnt = table.length;
            if (cnt <= 0) {
                hide();
                return
            }
            var cols = table[0].length;
            for (var i = 0; i < cnt; i++) {
                design.append_row(this, table[i], cols, phrase)
            }
            show()
        }
    },
    clearResult: function (hide) {
        with(this) {
            if (hide) {
                hide()
            }
            resultInput = "";
            hlRow = null;
            hlIndex = -1;
            while (parts.content.rows.length > 0) {
                parts.content.deleteRow(-1)
            }
        }
    }
};

function _uDraggable(e, d, c, b, a) {
    this.par = e;
    this.x = this.y = this.w = this.h = this.m = 0;
    this.moved = false;
    this.active = false;
    this.onmove = d || _uDraggable.dummy;
    this.oninitdrag = c || _uDraggable.dummy;
    this.onstartdrag = b || _uDraggable.dummy;
    this.onstopdrag = a || _uDraggable.dummy;
    if (!_uDraggable.globalset) {
        _uDraggable.globalset = true;
        $(document).bind("mouseup", _uDraggable.onmouseup);
        $(document).bind("mousemove", _uDraggable.onmousemove)
    }
}
_uDraggable.dummy = function () {};
_uDraggable.obj = null;
_uDraggable.clkX = 0;
_uDraggable.clkY = 0;
_uDraggable.scrL = 0;
_uDraggable.scrT = 0;
_uDraggable.globalset = false;
_uDraggable.onmousemove = function (e) {
    with(_uDraggable) {
        var o = obj;
        if (!o) {
            return
        }
        o.event = e;
        if (typeof(e.which) != "undefined" && e.which != 1) {
            o.stop();
            obj = null;
            return
        }
        e.stopPropagation();
        e.preventDefault();
        var d = _uWnd.getdims();
        if (!o.moved && (e.clientX != clkX || e.clientY != clkY)) {
            o.onstartdrag.apply(o.par, [o.x, o.y, o.w, o.h, o.m]);
            o.moved = true
        }
        o.onmove.apply(o.par, [e.clientX - clkX - (scrL - d.clientLeft), e.clientY - clkY - (scrT - d.clientTop), o.x, o.y, o.w, o.h, o.m]);
        o.event = null;
        return false
    }
};
_uDraggable.onmouseup = function (e) {
    if (e.which != 1) {
        return
    }
    with(_uDraggable) {
        var o = obj;
        if (!o) {
            return
        }
        if (o.moved) {
            onmousemove(e)
        }
        o.event = e;
        o.stop();
        o.event = null;
        obj = null
    }
};
_uDraggable.prototype = {
    start: function (i, b, k, c, f, a) {
        var g = _uDraggable;
        if (g.obj) {
            g.obj.event = i;
            g.obj.onstopdrag.apply(g.obj.par);
            g.obj.event = null
        }
        this.x = b;
        this.y = k;
        this.w = c;
        this.h = f;
        this.m = a;
        this.active = true;
        this.moved = false;
        g.obj = this;
        var j = _uWnd.getdims();
        g.clkX = i.clientX;
        g.clkY = i.clientY;
        g.scrL = j.clientLeft;
        g.scrT = j.clientTop;
        this.event = i;
        this.oninitdrag.apply(this.par, [b, k, c, f, a])
    },
    stop: function () {
        var a = _uDraggable;
        if (a.obj == this) {
            a.obj = null
        }
        if (this.active) {
            this.onstopdrag.apply(this.par, [this.x, this.y, this.w, this.h, this.m]);
            this.active = false
        }
    }
};

function _uSlider(c, b, a, f, d) {
    if (a == f) {
        return
    }
    if (typeof(c) != "object") {
        this.slider = $("#" + c)[0]
    } else {
        this.slider = c
    }
    if (!this.slider) {
        return
    }
    this.slider._uslider = this;
    this.type = b.substr(0, 1).toLowerCase() == "v" ? "v" : "h";
    this.props = $.extend({
        step: 0,
        initval: (a + f) / 2,
        disabled: 0,
        minpos: 0,
        maxpos: null,
        hotspot: null,
        thispar: null,
        onchange: null,
        param: null
    }, d || {});
    this.disabled = !! this.props.disabled;
    this.min_value = a;
    this.max_value = f;
    this.step = Math.abs(this.props.step);
    this.value = 0;
    this.min_pos = this.props.minpos;
    if (this.props.maxpos != null) {
        this.max_pos = this.props.maxpos
    } else {
        var e = this.slider.parentNode;
        if (e) {
            this.max_pos = this.type == "h" ? e.offsetWidth - this.slider.offsetWidth : e.offsetHeight - this.slider.offsetHeight
        } else {
            this.max_pos = 1
        }
    }
    if (this.props.hotspot != null) {
        this.hotoff = this.props.hotspot
    } else {
        this.hotoff = this.type == "h" ? Math.floor(this.slider.offsetWidth / 2) : Math.floor(this.slider.offsetHeight / 2)
    }
    if (this.min_pos == this.max_pos) {
        this.max_pos = this.min_pos + 1
    }
    this.pos = 0;
    this.setValue(this.props.initval);
    this.drag = new _uDraggable(this, this._ondrag, null, null, this._ondragstop);
    $(this.slider).unbind("onmousemove mousedown").bind("onmousemove", _uSlider._onmousemove).bind("mousedown", this, _uSlider._onmousedown);
    if (this.slider.parentNode) {
        $(this.slider.parentNode).unbind("mousedown").bind("mousedown", this, _uSlider._onmousedownparent)
    }
}
_uSlider._onmousedownparent = function (c) {
    var d = c.data;
    if (d.disabled) {
        return
    }
    var a = d.type == "h" ? c.pageX : c.pageY,
        f = $(this).offset(),
        b = d.type == "h" ? a - f.left : a - f.top;
    d.setPos(b - d.hotoff);
    c.preventDefault()
};
_uSlider._onmousedown = function (a) {
    var b = a.data;
    if (b.disabled) {
        return
    }
    b.drag.start(a, b.pos)
};
_uSlider._onmousemove = function (a) {
    a.preventDefault()
};
_uSlider.prototype = {
    setPos: function (c) {
        if (c < this.min_pos) {
            c = this.min_pos
        } else {
            if (c > this.max_pos) {
                c = this.max_pos
            }
        }
        var a = this.min_value < this.max_value ? 1 : -1;
        var b = (c - this.min_pos) / (this.max_pos - this.min_pos) * (this.max_value - this.min_value) + this.min_value;
        if (this.step > 0) {
            b = Math.round((b - this.min_value) / this.step) * this.step + this.min_value;
            c = (b - this.min_value) / (this.max_value - this.min_value) * (this.max_pos - this.min_pos) + this.min_pos;
            c = Math.round(c)
        }
        if (b * a < this.min_value * a) {
            b = this.min_value
        } else {
            if (b * a > this.max_value * a) {
                b = this.max_value
            }
        }
        if (b != this.value) {
            this.pos = c;
            if (this.type == "h") {
                this.slider.style.left = this.pos + "px"
            } else {
                this.slider.style.top = this.pos + "px"
            }
            this.value = b;
            if (this.props.onchange) {
                this.props.onchange.call(this.props.thispar, this.value, this.props.param, this)
            }
        }
    },
    _ondrag: function (b, a, c) {
        if (this.disabled) {
            return
        }
        this.setPos(c + b)
    },
    setValue: function (b) {
        var a = this.min_value < this.max_value ? 1 : -1;
        if (b * a < this.min_value * a || b * a > this.max_value * a) {
            return
        }
        if (this.step > 0) {
            b = Math.round((b - this.min_value) / this.step) * this.step + this.min_value;
            if (b * a < this.min_value * a) {
                b = this.min_value
            } else {
                if (b * a > this.max_value * a) {
                    b = this.max_value
                }
            }
        }
        var c = (b - this.min_value) / (this.max_value - this.min_value) * (this.max_pos - this.min_pos) + this.min_pos;
        this.pos = Math.round(c);
        if (this.type == "h") {
            this.slider.style.left = this.pos + "px"
        } else {
            this.slider.style.top = this.pos + "px"
        }
        this.value = b;
        if (!this.disabled && this.props.onchange) {
            this.props.onchange.call(this.props.thispar, this.value, this.props.param, this)
        }
    }
};
_uSlider.buildH = function (c, a) {
    var b = $.extend({
        w: 124,
        lw: 0,
        limg: "",
        limgcss: "",
        rw: 0,
        rimg: null,
        rimgcss: "",
        title: "",
        ch: 20,
        cw: 120,
        cimg: "/img/d/sldBg.gif",
        cimgcss: "no-repeat 0 10px",
        simg: "/img/d/sld.gif",
        simgcss: "no-repeat 0 0",
        sh: 20,
        sw: 9,
        st: 2
    }, a || {});
    if (String(b.w).indexOf("%") < 0 && String(b.w).toLowerCase().indexOf("px") < 0) {
        b.w += "px"
    }
    return '<table border="0" cellpadding="1" cellspacing="1" style="width:' + b.w + '"><tr>' + (b.lw > 0 ? '<td width="' + b.lw + '" ' + (b.limg || b.limgcss ? 'style="background:' + (b.limg ? "url(" + b.limg + ") " : "") + b.limgcss + '"' : "") + "></td>" : "") + "<td><div" + (b.title ? ' title="' + b.title + '"' : "") + ' style="height:' + b.ch + "px;width:" + b.cw + "px" + (b.cimg || b.cimgcss ? ";background:" + (b.cimg ? "url(" + b.cimg + ") " : "") + b.cimgcss : "") + '"><div unselectable="on" id="' + c + '" style="cursor:pointer;-moz-user-select:none;height:' + b.sh + "px; width:" + b.sw + "px; position:relative; top:" + b.st + "px" + (b.simg || b.simgcss ? ";background:" + (b.simg ? "url(" + b.simg + ") " : "") + b.simgcss : "") + '"></div></div></td>' + (b.rw > 0 ? '<td width="' + b.rw + '" ' + (b.rimg || b.rimgcss ? 'style="background:' + (b.rimg ? "url(" + b.rimg + ") " : "") + b.rimgcss + '"' : "") + "></td>" : "") + "</tr></table>"
};

function _uTabCtrl(b, e, a, f, h, j) {
    this.constructor = _uTabCtrl;
    this.name = b;
    this.ntabs = e;
    this.props = $.extend({
        parentnode: null,
        wnd: null,
        app: a && a.wnd && a.wnd.app || null,
        width: "auto",
        height: "auto",
        min_height: 50,
        active_tab: -1,
        close: 0,
        design: "std",
        noinit: false,
        markload: '<div align="left"><div class="myWinLoad"></div></div>',
        emptycontent: "",
        onload: null,
        onshow: null,
        onhide: null,
        onbeforechange: null,
        onchange: null,
        onbeforeclose: null,
        onclose: null,
        ondestroy: null,
        onresize: null,
        rtl: 0
    }, a || {});
    this.app = this.props.app;
    this.state = {
        init: false,
        destroyed: false
    };
    this.design = this.props.design && _uTabCtrl.designs[this.props.design] ? _uTabCtrl.designs[this.props.design] : _uTabCtrl.designs.std;
    this.idx = _uTabCtrl.nextidx++;
    _uTabCtrl.all[this.idx] = this;
    this.width = parseInt(this.props.width) || 0;
    this.height = parseInt(this.props.height) || 0;
    this.data = [];
    this.pend_show = null;
    this.decor = {
        cdw: 0,
        cdh: 0,
        pdw: 0,
        pdh: 0,
        ph: 0
    };
    this.maxid = 0;
    this.wnd = null;
    this.scrollpos = {
        tabswidth: 0,
        havewidth: 0,
        pos: null
    };
    for (var g = 0; g < e; g++) {
        var d = (j && j[g]) || {};
        var c = d.id || "";
        if (!c || c.length == 0) {
            c = "_tc" + this.idx + "tb" + (this.maxid++)
        }
        this.data[g] = {
            id: c,
            title: (f && f[g]) || ".",
            dat: (h && h[g]) || "",
            footer: d.footerc || null,
            footerh: d.footerh && d.footerh > 0 ? d.footerh : 0,
            header: d.headerc || null,
            headerh: d.headerh && d.headerh > 0 ? d.headerh : 0,
            footercont: null,
            headercont: null,
            cont: null,
            ismarkload: 0,
            markloadcont: null,
            obj: null,
            ishidden: d.hidden,
            clbut: null,
            link: null,
            href: d.href,
            target: d.target,
            label: null,
            close: d.close == undefined ? this.props.close : d.close,
            icon: d.icon,
            markload: d.markload,
            firstload: 0,
            onload: d.onload == undefined ? this.props.onload : d.onload,
            onshow: d.onshow == undefined ? this.props.onshow : d.onshow,
            onhide: d.onhide == undefined ? this.props.onhide : d.onhide,
            onbeforechange: d.onbeforechange == undefined ? this.props.onbeforechange : d.onbeforechange,
            onchange: d.onchange == undefined ? this.props.onchange : d.onchange,
            onbeforeclose: d.onbeforeclose == undefined ? this.props.onbeforeclose : d.onbeforeclose,
            onclose: d.onclose == undefined ? this.props.onclose : d.onclose
        }
    }
    this.active_tab = this.props.active_tab == "auto" ? "auto" : this.idxbyid(this.props.active_tab);
    this.sesupdate = 0;
    if (!_uTabCtrl.globalset) {
        _uTabCtrl.globalset = true
    }
    this.butdown = new _uDraggable(this, null, null, null, function (i, k) {
        this.design._onbuttonup(this, i, k)
    });
    if (!this.props.noinit) {
        this.init()
    }
}
_uTabCtrl.all = [];
_uTabCtrl.nextidx = 1;
_uTabCtrl.globalset = false;
_uTabCtrl.getbyname = function (c) {
    var b = this.all;
    for (var d = 0; d < b.length; d++) {
        if (b[d] && b[d].name == c) {
            return b[d]
        }
    }
    return null
};
_uTabCtrl.closeTab = function (c, a) {
    var b = this.getbyname(c);
    if (b) {
        b.closeTab(a)
    }
};
_uTabCtrl.content = function (d, a, e) {
    var b = this.getbyname(d);
    if (b) {
        b.content(a, e)
    }
};
_uTabCtrl.headerheight = function (c, a, d) {
    var b = this.getbyname(c);
    if (b) {
        b.headerheight(a, d)
    }
};
_uTabCtrl.footerheight = function (c, a, d) {
    var b = this.getbyname(c);
    if (b) {
        b.footerheight(a, d)
    }
};
_uTabCtrl.setTitle = function (c, a, d) {
    var b = this.getbyname(c);
    if (b) {
        b.setTitle(a, d)
    }
};
_uTabCtrl.designs = {
    std: {
        content_class: "u-tabc-content",
        header_class: "u-tabc-header",
        footer_class: "u-tabc-footer",
        tabctrl_init: function (b) {
            var a = {};
            $(b.top).attr("class", "x-unselectable u-tabc").html('<div class="u-tabc-p"><div class="u-tabc-listp"><div class="u-tabc-list"></div><div class="u-tabc-pbot"></div></div><div class="u-tabc-scrbut"><div class="u-tabc-tabl"><div class="u-tabc-label"><div class="u-tabc-scrl"></div><div class="u-tabc-scrr"></div></div></div></div></div><div class="u-tabc-body"><div class="u-tabc-content" style="height:' + b.props.min_height + 'px">' + b.props.emptycontent + "</div></div>");
            a.pane = $(b.top).find(".u-tabc-p")[0];
            a.panebot = $(b.top).find(".u-tabc-pbot")[0];
            a.listp = $(b.top).find(".u-tabc-listp")[0];
            a.list = $(b.top).find(".u-tabc-list")[0];
            a.scrbut = $(b.top).find(".u-tabc-scrbut")[0];
            a.scrl = $(b.top).find(".u-tabc-scrl")[0];
            a.scrr = $(b.top).find(".u-tabc-scrr")[0];
            a.body = $(b.top).find(".u-tabc-body")[0];
            a.emptycontent = a.content = $(b.top).find(".u-tabc-content")[0];
            $(b.top).find("div,span").andSelf().attr("unselectable", "on");
            $(a.scrl).bind("click mousedown mouseover mouseout", {
                obj: b,
                but: 0
            }, _uTabCtrl._onscrbutevent);
            $(a.scrr).bind("click mousedown mouseover mouseout", {
                obj: b,
                but: 1
            }, _uTabCtrl._onscrbutevent);
            return a
        },
        remove_item: function (b, a) {
            b.parts.list.removeChild(b.data[a].obj)
        },
        set_title: function (b, a) {
            $(b.data[a].label).html((b.data[a].icon ? '<img class="u-tabc-icon" border="0" src="' + b.data[a].icon + '">' : ($.browser.msie && $.browser.version < 8 ? '<img class="u-tabc-spacer" src="/img/1px.gif" width="1" height="1" border="0">' : "")) + b.data[a].title)
        },
        insert_item: function (d, b) {
            var c = document.createElement("div");
            $(c).attr("class", "u-tabc-tab" + (d.data[b].close ? " u-tabc-wcl" : "")).html((d.data[b].href ? "<a " + (d.data[b].target ? 'target="' + d.data[b].target + '" ' : "") + 'href="' + d.data[b].href + '" class="u-tabc-tabl" style="display:block">' : '<div class="u-tabc-tabl">') + (d.data[b].close ? '<div class="u-tabc-closebut"></div>' : "") + '<div class="u-tabc-tabr"><div class="u-tabc-label">' + (d.data[b].icon ? '<img class="u-tabc-icon" border="0" src="' + d.data[b].icon + '">' : ($.browser.msie && $.browser.version < 8 ? '<img class="u-tabc-spacer" src="/img/1px.gif" width="1" height="1" border="0">' : "")) + d.data[b].title + "</div></div>" + (d.data[b].href ? "</a>" : "</div>"));
            d.data[b].obj = c;
            d.data[b].label = $(c).find(".u-tabc-label")[0];
            d.data[b].link = $(c).find(".u-tabc-tabl")[0];
            if (d.data[b].close) {
                d.data[b].clbut = $(c).find(".u-tabc-closebut")[0];
                $(d.data[b].clbut).bind("mouseover", this._onclbutmouseover).bind("mouseout", this._onclbutmouseout).bind("click", {
                    obj: d,
                    tab: d.data[b]
                }, _uTabCtrl._onclbutclick).bind("mousedown", {
                    obj: d,
                    tab: d.data[b]
                }, _uTabCtrl._onclbutdown)
            }
            $(d.data[b].link).bind("mouseover", this._ontabmouseover).bind("mouseout", this._ontabmouseout).bind("mousedown", {
                obj: d,
                tab: d.data[b]
            }, _uTabCtrl._ontabclick);
            $(c).find("div,span,a,img").andSelf().attr("unselectable", "on");
            if (d.data[b].ishidden) {
                c.style.display = "none"
            }
            var e = d.parts.list.childNodes.length;
            d.parts.list.insertBefore(c, b >= e ? null : d.parts.list.childNodes[b])
        },
        _ontabmouseover: function (a) {
            $(this.parentNode).addClass("u-tabc-tab-over")
        },
        _ontabmouseout: function (a) {
            $(this.parentNode).removeClass("u-tabc-tab-over")
        },
        _onclbutmouseover: function (a) {
            $(this).addClass("u-tabc-closebut-over")
        },
        _onclbutmouseout: function (a) {
            $(this).removeClass("u-tabc-closebut-over")
        },
        _onclbutmousedown: function (a, c) {
            if (c) {
                $(a).addClass("u-tabc-closebut-down")
            } else {
                $(a).removeClass("u-tabc-closebut-down")
            }
        },
        _ontabactivate: function (b, a) {
            $(b.data[a].obj).addClass("u-tabc-tab-act")
        },
        _ontabdeactivate: function (b, a) {
            $(b.data[a].obj).removeClass("u-tabc-tab-act")
        },
        _onscrbutactivate: function (c, a, b) {
            if (b) {
                $(!a ? c.parts.scrl : c.parts.scrr).removeClass("u-tabc-scr-dis")
            } else {
                $(!a ? c.parts.scrl : c.parts.scrr).addClass("u-tabc-scr-dis")
            }
        },
        _onscrbutover: function (e, c, d) {
            var a = !c ? e.parts.scrl : e.parts.scrr;
            if (d) {
                $(a).addClass("u-tabc-scr-over")
            } else {
                $(a).removeClass("u-tabc-scr-over")
            }
        },
        _onscrbutdown: function (e, c, d) {
            var a = !c ? e.parts.scrl : e.parts.scrr;
            if (d) {
                $(a).addClass("u-tabc-scr-down")
            } else {
                $(a).removeClass("u-tabc-scr-down")
            }
        },
        _onbuttonup: function (c, a, b) {
            if (a < 2) {
                this._onscrbutdown(c, a, 0)
            } else {
                this._onclbutmousedown(b.clbut, 0)
            }
        }
    }
};
_uTabCtrl._onclbutdown = function (a) {
    if (a.which == 1) {
        a.stopPropagation();
        a.data.obj.design._onclbutmousedown(a.data.tab.clbut, 1);
        a.data.obj.butdown.start(a, 2, a.data.tab)
    }
    _uWnd.globalmousedown()
};
_uTabCtrl._onscrbutevent = function (b) {
    var c = b.data.obj,
        a = b.data.but;
    if (b.type == "click" && b.which == 1) {
            c.scrollTabPane(a ? 40 : -40)
        } else {
            if (b.type == "mouseover") {
                c.design._onscrbutover(c, a, 1)
            } else {
                if (b.type == "mouseout") {
                    c.design._onscrbutover(c, a, 0)
                } else {
                    if (b.type == "mousedown" && b.which == 1) {
                        c.design._onscrbutdown(c, a, 1);
                        c.butdown.start(b, a)
                    }
                }
            }
        }
};
_uTabCtrl._onclbutclick = function (b) {
    var f = b.data,
        c = f.obj;
    for (var a = 0; a < c.data.length; a++) {
            if (c.data[a] == f.tab) {
                if (typeof c.data[a].onbeforeclose == "function") {
                    if (!c.data[a].onbeforeclose.call(c.app, c, a, c.data[a].id)) {
                        break
                    }
                }
                c.closeTab(a);
                break
            }
        }
    b.preventDefault();
    b.stopPropagation()
};
_uTabCtrl._ontabclick = function (b) {
    var f = b.data,
        c = f.obj;
    b.preventDefault();
    for (var a = 0; a < c.data.length; a++) {
            if (c.data[a] == b.data.tab) {
                if (a == c.active_tab) {
                    return
                }
                if (typeof c.data[a].onbeforechange == "function") {
                    if (!c.data[a].onbeforechange.call(c.app, c, a, c.data[a].id)) {
                        break
                    }
                }
                c.activateTab(a);
                break
            }
        }
};
_uTabCtrl.prototype = {
    saveSession: function () {
        this.sesupdate = 0;
        return {
            tab: this.active_tab
        }
    },
    init: function (a) {
        var b = document.createElement("div");
        b.id = "_utabctrl" + this.idx;
        if (this.props.parentnode) {
            this.props.parentnode.appendChild(b)
        } else {
            if (this.props.wnd) {
                var c = this.props.wnd.parts.wndcont;
                while (c.firstChild) {
                    c.removeChild(c.firstChild)
                }
                c.appendChild(b);
                this.wnd = this.props.wnd;
                this.wnd.tabctrl = this;
                this.wnd.state.loaded = true
            } else {
                $($("body")[0]).append(b)
            }
        }
        this.top = b;
        $(b).css({
            visibility: "hidden",
            display: "block"
        });
        if (this.width > 0) {
            $(b).css("width", this.width + "px")
        }
        this.parts = this.design.tabctrl_init(this);
        this.parts.markloadcont = null;
        this.parts.headercontent = null;
        this.parts.footercontent = null;
        this.show();
        if (!a) {
            setTimeout("var m=_uTabCtrl.all[" + this.idx + "];if(m)m.init1();", 10)
        }
    },
    init1: function (g) {
        var a = this.parts,
            h = this.decor;
        if (!(this.width > 0)) {
                this.width = this.top.offsetWidth
            }
        if (!(this.height > 0)) {
                this.height = this.top.offsetHeight
            }
        h.cdw = this.top.offsetWidth - a.content.offsetWidth;
        h.cdh = this.top.offsetHeight - a.content.offsetHeight;
        h.pdw = this.top.offsetWidth - a.listp.offsetWidth;
        h.hh = 0;
        h.fh = 0;
        if (!this.props.wnd && !g) {
                $(this.top).css("height", this.height + "px");
                $(a.content).css({
                    width: (this.top.offsetWidth - h.cdw) + "px",
                    height: (this.top.offsetHeight - h.cdh) + "px"
                });
                $(a.listp).css({
                    width: (this.top.offsetWidth - h.pdw) + "px"
                })
            }
        $(a.listp).css({
                overflow: "hidden"
            });
        $(a.panebot).css("width", "4000px");
        $(a.list).css("width", "4000px");
        for (var f = 0; f < this.ntabs; f++) {
                this.design.insert_item(this, f)
            }
        if (this.props.wnd) {
                this.resizeTo(this.props.wnd.width - this.props.wnd.decor.w, this.props.wnd.height - this.props.wnd.decor.h)
            }
        this.state.init = true;
        var b = this.active_tab;
        this.active_tab = -1;
        if (b == "auto") {
                if (this.name && this.name.length > 0 && self.location.hash.length > 1) {
                    var l = self.location.hash.substr(1).split(";");
                    var m = "T_" + this.name + "=";
                    for (var k = 0; k < l.length; k++) {
                        if (l[k].length > m.length && l[k].substr(0, m.length) == m) {
                            var e = this.idxbyid(l[k].substr(m.length));
                            if (e >= 0 && e < this.data.length) {
                                b = e;
                                break
                            }
                        }
                    }
                } else {
                    b = -1
                }
            }
        $(this.top).css("display", "block").css("visibility", "");
        if (b == -1 && this.data.length > 0) {
                b = 0
            }
        if (b >= 0 && b < this.ntabs) {
                for (var f = 0; f < this.ntabs; f++) {
                    var c = (b + f) % this.ntabs;
                    if (!this.data[c].ishidden && (!this.data[c].onbeforechange || !! this.data[c].onbeforechange(this, c, this.data[c].id))) {
                        this.activateTab(c, true);
                        break
                    }
                }
            } else {
                this.activateTab(-1, true)
            }
        $(this.top).css("display", "none").css("visibility", "");
        if (pend_show) {
                this.show(pend_show[0])
            }
        if (this.props.wnd) {
                this.props.wnd.onexternalload()
            }
    },
    scrollTabPane: function (b) {
        var e = this.scrollpos.pos += b;
        var a = this.scrollpos.tabswidth,
            d = this.scrollpos.havewidth;
        if (a < d) {
                this.design._onscrbutactivate(this, 0, 0);
                this.design._onscrbutactivate(this, 1, 0);
                if ((this.props.rtl || window._rtl) && this.data.length > 0) {
                    e = this.data[this.data.length - 1].obj.offsetLeft + d - a
                } else {
                    e = 0
                }
                this.scrollpos.pos = e;
                this.parts.listp.scrollLeft = e
            } else {
                if (this.props.rtl || window._rtl) {
                    var c = this.data[this.data.length - 1].obj.offsetLeft;
                    if (e < c) {
                        e = c
                    } else {
                        if (e > c + a - d) {
                            e = c + a - d
                        }
                    }
                } else {
                    if (e < 0) {
                        e = 0
                    } else {
                        if (e > a - d) {
                            e = a - d
                        }
                    }
                }
                this.scrollpos.pos = e;
                this.parts.listp.scrollLeft = e;
                if (e > 0) {
                    this.design._onscrbutactivate(this, 0, 1)
                } else {
                    this.design._onscrbutactivate(this, 0, 0)
                }
                if (e < a - d) {
                    this.design._onscrbutactivate(this, 1, 1)
                } else {
                    this.design._onscrbutactivate(this, 1, 0)
                }
            }
    },
    _setscrolls: function () {
        if (!this.state.init) {
            return
        }
        var a = 0,
            d = this.parts.listp.offsetWidth;
        if (this.parts.listp.clientWidth > 0 && this.parts.listp.clientWidth < d) {
                d = this.parts.listp.clientWidth
            }
        if (this.data.length > 0) {
                var c = this.data[this.data.length - 1];
                if (this.props.rtl || window._rtl) {
                    var b = this.data[0];
                    a = b.obj.offsetLeft + b.obj.offsetWidth - c.obj.offsetLeft
                } else {
                    a = c.obj.offsetLeft + c.obj.offsetWidth
                }
            }
        if (d < a) {
                this.parts.scrbut.style.display = "block";
                d -= this.parts.scrbut.offsetWidth
            } else {
                this.parts.scrbut.style.display = "none"
            }
        if (this.scrollpos.pos == null) {
                if ((this.props.rtl || window._rtl) && this.data.length > 0) {
                    this.scrollpos.pos = this.data[this.data.length - 1].obj.offsetLeft + a - d
                } else {
                    this.scrollpos.pos = 0
                }
            } else {
                if (this.scrollpos.havewidth != d) {
                    if (this.props.rtl || window._rtl) {
                        this.scrollpos.pos += this.scrollpos.havewidth - d
                    }
                }
            }
        this.scrollpos.havewidth = d;
        this.scrollpos.tabswidth = a;
        this.scrollTabPane(0)
    },
    show: function (a) {
        if (!this.state.init) {
            pend_show = [a];
            return
        }
        $(this.top).show();
        this.state.visible = true
    },
    resizeTo: function (w, h) {
        var d = this.decor;
        with(this) {
            width = w;
            height = h;
            $(top).width(w).height(h);
            $(parts.content).css({
                width: (w - d.cdw) + "px",
                height: (h - d.cdh - d.fh - d.hh) + "px"
            });
            if (parts.headercontent) {
                $(parts.headercontent).css({
                    width: (w - d.cdw) + "px",
                    height: d.hh + "px"
                })
            }
            if (parts.footercontent) {
                $(parts.footercontent).css({
                    width: (w - d.cdw) + "px",
                    height: d.fh + "px"
                })
            }
            $(parts.listp).css({
                width: (w - d.pdw) + "px"
            });
            if (props.onresize) {
                props.onresize.call(app, w - d.cdw, h - d.cdh, this, name)
            }
            _setscrolls()
        }
    },
    addTab: function (g, e, f, a) {
        var c = a != undefined && a >= 0 && a < this.data.length ? a : this.data.length;
        var b = f || {};
        var h = b.id || "";
        if (!h || h.length == 0) {
            h = "_tc" + this.idx + "tb" + (this.maxid++)
        }
        var d = {
            id: h,
            title: g || ".",
            dat: e || "",
            footer: b.footerc || null,
            footerh: b.footerh && b.footerh > 0 ? b.footerh : 0,
            header: b.headerc || null,
            headerh: b.headerh && b.headerh > 0 ? b.headerh : 0,
            footercont: null,
            headercont: null,
            cont: null,
            ismarkload: 0,
            markloadcont: null,
            obj: null,
            ishidden: b.hidden,
            clbut: null,
            link: null,
            href: b.href,
            target: b.target,
            label: null,
            close: b.close == undefined ? this.props.close : b.close,
            icon: b.icon,
            markload: b.markload,
            firstload: 0,
            firstshow: 0,
            onload: b.onload == undefined ? this.props.onload : b.onload,
            onshow: b.onshow == undefined ? this.props.onshow : b.onshow,
            onhide: b.onhide == undefined ? this.props.onhide : b.onhide,
            onbeforechange: b.onbeforechange == undefined ? this.props.onbeforechange : b.onbeforechange,
            onchange: b.onchange == undefined ? this.props.onchange : b.onchange,
            onbeforeclose: b.onbeforeclose == undefined ? this.props.onbeforeclose : b.onbeforeclose,
            onclose: b.onclose == undefined ? this.props.onclose : b.onclose
        };
        if (c < this.data.length) {
            this.data.splice(c, 0, d)
        } else {
            this.data[c] = d
        }
        this.design.insert_item(this, c);
        this._setscrolls();
        return c
    },
    tabHidden: function (b, d) {
        b = this.idxbyid(b);
        if (b < 0 || b >= this.data.length) {
            return
        }
        var c = this.data[b];
        c.obj.style.display = d ? "none" : "";
        c.ishidden = !! d;
        this._setscrolls()
    },
    activateTab: function (a, b) {
        a = this.idxbyid(a);
        if (!this.state.init) {
            this.active_tab = a;
            return
        }
        if (a < 0 || a >= this.data.length || this.active_tab == a) {
            if (b && this.data.length > 0) {
                a = 0
            } else {
                return
            }
        }
        this.design._ontabactivate(this, a);
        if (this.active_tab >= 0 && this.active_tab < this.data.length) {
            if (typeof this.data[this.active_tab].onhide == "function") {
                this.data[this.active_tab].onhide.call(this.app, this, this.active_tab, this.data[this.active_tab].id)
            }
            this.design._ontabdeactivate(this, this.active_tab)
        }
        this.active_tab = a;
        this._setscrolls();
        if (!b) {
            this.sesupdate = 1
        }
        this.data[a].firstshow = 1;
        if (typeof this.data[a].onchange == "function") {
            if (!this.data[a].onchange.call(this.app, this, a, this.data[a].id)) {
                return
            }
        }
        this.load(a)
    },
    closeTab: function (a) {
        if (!this.state.init) {
            return
        }
        a = this.idxbyid(a);
        if (a < 0 || a >= this.data.length) {
            return
        }
        if (a == this.active_tab && typeof this.data[a].onhide == "function") {
            this.data[a].onhide.call(this.app, this, a, this.data[a].id)
        }
        this.design.remove_item(this, a);
        var c = this.data[a].id;
        var b = this.data[a].onclose;
        this.data.splice(a, 1);
        if (a == this.active_tab) {
            this.active_tab = -1;
            if (a == this.data.length) {
                if (a == 0) {
                    this._assign_content(-1)
                } else {
                    this.activateTab(a - 1)
                }
            } else {
                this.activateTab(a)
            }
        } else {
            if (a < this.active_tab) {
                this.active_tab--
            }
        }
        this._setscrolls();
        if (b) {
            b(this, a, c)
        }
    },
    setTitle: function (a, b) {
        a = this.idxbyid(a);
        if (a < 0 || a >= this.data.length) {
            return
        }
        this.data[a].title = b;
        this.design.set_title(this, a);
        this._setscrolls()
    },
    headerheight: function (b, a) {
        b = this.idxbyid(b);
        if (b < 0 || b >= this.data.length) {
            return
        }
        if (typeof(a) != "number" || isNaN(a)) {
            return
        }
        this.data[b].headerh = a
    },
    footerheight: function (b, a) {
        b = this.idxbyid(b);
        if (b < 0 || b >= this.data.length) {
            return
        }
        if (typeof(a) != "number" || isNaN(a)) {
            return
        }
        this.data[b].footerh = a
    },
    content: function (a, f, d, b, e) {
        a = this.idxbyid(a);
        if (a < 0 || a >= this.data.length) {
            return
        }
        if ((typeof(d) == "undefined" || d == null)) {
            if (!this.data[a].headercont) {
                if (this.data[a].header) {
                    d = this.data[a].header
                } else {
                    d = ""
                }
            } else {
                d = null
            }
        }
        if ((typeof(b) == "undefined" || b == null)) {
            if (!this.data[a].footercont) {
                if (this.data[a].footer) {
                    b = this.data[a].footer
                } else {
                    b = ""
                }
            } else {
                b = null
            }
        }
        if ((typeof(f) == "undefined" || f == null)) {
            if (!this.data[a].cont) {
                f = ""
            } else {
                f = null
            }
        }
        if (!this.data[a].cont) {
            this.data[a].cont = document.createElement("DIV");
            $(this.data[a].cont).addClass(this.design.content_class)
        }
        if (f != null) {
            $(this.data[a].cont).html(f);
            this.data[a].firstload = e ? 0 : 1;
            this.data[a].ismarkload = 0
        }
        if (d || d == null) {
            if (!this.data[a].headercont) {
                this.data[a].headercont = document.createElement("DIV");
                $(this.data[a].headercont).attr("class", this.design.content_class + " " + this.design.header_class).css("overflow", "hidden")
            }
            if (d) {
                $(this.data[a].headercont).html(d)
            }
        } else {
            if (this.data[a].headercont) {
                $(this.data[a].headercont).html("")
            }
        }
        if (b || b == null) {
            if (!this.data[a].footercont) {
                this.data[a].footercont = document.createElement("DIV");
                $(this.data[a].footercont).attr("class", this.design.content_class + " " + this.design.footer_class).css("overflow", "hidden")
            }
            if (b) {
                $(this.data[a].footercont).html(b)
            }
        } else {
            if (this.data[a].footercont) {
                $(this.data[a].footercont).html("")
            }
        }
        if (a == this.active_tab) {
            this._assign_content(a)
        }
    },
    _assign_content: function (c) {
        var b = 0,
            f = 0,
            d;
        if (c < 0) {
                this.parts.content = this.parts.emptycontent;
                this.parts.headercontent = this.parts.footercontent = null
            } else {
                if (this.data[c].ismarkload) {
                    this.parts.content = this.data[c].markloadcont;
                    this.parts.headercontent = this.parts.footercontent = null
                } else {
                    this.parts.content = this.data[c].cont;
                    this.parts.headercontent = this.data[c].headercont;
                    f = this.data[c].headerh;
                    this.parts.footercontent = this.data[c].footercont;
                    b = this.data[c].footerh
                }
            }
        d = 0;
        if (this.parts.headercontent) {
                $(this.parts.headercontent).css({
                    width: (this.width - this.decor.cdw) + "px",
                    height: f + "px"
                });
                if (this.parts.body.childNodes[d]) {
                    this.parts.body.replaceChild(this.parts.headercontent, this.parts.body.childNodes[d])
                } else {
                    this.parts.body.appendChild(this.parts.headercontent)
                }
                this.decor.hh = f;
                d++
            } else {
                this.decor.hh = 0
            }
        $(this.parts.content).css({
                width: (this.width - this.decor.cdw) + "px",
                height: (this.height - this.decor.cdh - b - f) + "px"
            });
        if (this.parts.body.childNodes[d]) {
                this.parts.body.replaceChild(this.parts.content, this.parts.body.childNodes[d])
            } else {
                this.parts.body.appendChild(this.parts.content)
            }
        d++;
        if (this.parts.footercontent) {
                $(this.parts.footercontent).css({
                    width: (this.width - this.decor.cdw) + "px",
                    height: b + "px"
                });
                if (this.parts.body.childNodes[d]) {
                    this.parts.body.replaceChild(this.parts.footercontent, this.parts.body.childNodes[d])
                } else {
                    this.parts.body.appendChild(this.parts.footercontent)
                }
                this.decor.fh = b;
                d++
            } else {
                this.decor.fh = 0
            }
        while (this.parts.body.childNodes[d]) {
                this.parts.body.removeChild(this.parts.body.childNodes[d])
            }
        if (c >= 0 && !this.data[c].ismarkload) {
                if (typeof this.data[c].onload == "function" && this.data[c].firstload) {
                    var a, h;
                    try {
                        for (a = 10, h = arguments.callee.caller; a >= 0; a--) {
                            if (!h || h.caller == arguments.callee) {
                                break
                            } else {
                                h = h.caller
                            }
                        }
                    } catch (g) {}
                    if (!h || a < 0) {
                        this.data[c].onload.call(this.app, this, c, this.data[c].id, this.parts.content, this.parts.headercontent, this.parts.footercontent)
                    }
                }
                if (typeof this.data[c].onshow == "function" && this.data[c].firstshow) {
                    this.data[c].onshow.call(this.app, this, c, this.data[c].id, this.parts.content, this.parts.headercontent, this.parts.footercontent)
                }
                this.data[c].firstshow = 0
            }
        if (c >= 0) {
                this.data[c].firstload = 0
            }
    },
    markload: function (a) {
        a = this.idxbyid(a);
        if (a < 0 || a >= this.data.length) {
            return
        }
        var b;
        if (this.data[a].markload) {
            if (!this.data[a].markloadcont) {
                this.data[a].markloadcont = document.createElement("DIV");
                $(this.data[a].markloadcont).addClass("u-tabc-content").html(this.data[a].markload)
            }
        } else {
            if (!this.parts.markloadcont) {
                this.parts.markloadcont = document.createElement("DIV");
                $(this.parts.markloadcont).addClass("u-tabc-content").html(this.props.markload)
            }
            this.data[a].markloadcont = this.parts.markloadcont
        }
        this.data[a].ismarkload = 1;
        this.data[a].iserrorload = 0;
        if (a == this.active_tab) {
            this._assign_content(a)
        }
    },
    idxbyid: function (b) {
        if (typeof b == "string") {
            for (var a = 0; a < this.data.length; a++) {
                if (this.data[a].id == b) {
                    return a
                }
            }
            return -1
        } else {
            return b
        }
    },
    findintab: function (a, c) {
        a = this.idxbyid(a);
        if (a < 0 || a >= this.data.length) {
            return $([])
        }
        var b = $(this.data[a].cont);
        if (this.data[a].headercont) {
            b = b.add(this.data[a].headercont)
        }
        if (this.data[a].footercont) {
            b = b.add(this.data[a].footercont)
        }
        return b.find(c)
    },
    load: function (a, b) {
        a = this.idxbyid(a);
        if (a < 0 || a >= this.data.length) {
            return
        }
        if (this.data[a].cont != null && !b) {
            if (a == this.active_tab) {
                this._assign_content(a)
            }
            return
        }
        var f = !b || b === true || b === 1 ? this.data[a].dat : b;
        if (typeof(f) == "string") {
            this.content(a, f, this.data[a].header, this.data[a].footer)
        } else {
            if (typeof f == "function") {
                this.content(a, f(), this.data[a].header, this.data[a].footer)
            } else {
                if (typeof f == "object") {
                    this.markload(a);
                    if (!f.data) {
                        f.data = {}
                    }
                    if (!("_tci" in f.data)) {
                        f.data._tci = this.idx
                    }
                    if (!("_ti" in f.data)) {
                        f.data._ti = a
                    }
                    if (this.app && !("_ai" in f.data)) {
                        f.data._ai = this.app.pid
                    }
                    if (this.app && !("app" in f)) {
                        f.app = this.app.pid
                    }
                    if (this.wnd && !("wnd" in f)) {
                        f.wnd = this.wnd.idx
                    }
                    if (!("tabctrl" in f)) {
                        f.tabctrl = this.idx
                    }
                    if (!("tabidx" in f)) {
                        f.tabidx = a
                    }
                    if (!f.success && f.xml === false) {
                        f.dataType = "text";
                        f.success = new Function("data", "st", "var w=_uTabCtrl.all[" + this.idx + "];if(w)w.content('" + this.data[a].id + "',data);")
                    } else {
                        if (!f.success && f.xml !== false) {
                            f.success = new Function("data", "st", "var w=_uTabCtrl.all[" + this.idx + "];_uParseXML(data,w,'" + this.data[a].id + "',w.app);")
                        }
                    }
                    if (!f.error) {
                        f.error = new Function("xml", "st", "er", "var w=_uTabCtrl.all[" + this.idx + "];if(w)w._onerror('" + this.data[a].id + "',xml,st,er);")
                    }
                    try {
                        if (f.form && (f.form.length > 0 || f.form.nodeType)) {
                            _uPostForm(f.form, f)
                        } else {
                            if (f.url) {
                                _uAjaxRequest(f.url, f)
                            }
                        }
                    } catch (d) {
                        this._onerror(this.data[a].id, null, "", d)
                    }
                }
            }
        }
        return true
    },
    _onerror: function (f, c, b, e) {
        var a = this.idxbyid(f);
        if (a < 0 || a >= this.data.length) {
            return
        }
        var d = this.props.onerror;
        if (d && typeof(d) == "function") {
            d.apply(this.app, arguments)
        } else {
            this.content(a, _txt("ErrorLoadTab", this.idx, a), null, null, 1)
        }
    },
    destroy: function () {
        if (this.state.destroyed) {
            return
        }
        this.data.splice(0, this.data.length);
        this.parts = null;
        if (this.top.parentNode) {
            this.top.parentNode.removeChild(this.top)
        }
        this.top = null;
        if (this.wnd && this.wnd.tabctrl == this) {
            this.wnd.tabctrl = null
        }
        this.state.destroyed = true;
        _uTabCtrl.all[this.idx] = null;
        if (this.props.ondestroy) {
            this.props.ondestroy(this, this.name)
        }
    }
};

function _uWnd(b, g, c, h, a, f, e, d) {
    if (b && b.length > 0) {
        var i = _uWnd.getbyname(b);
        if (i) {
            if (a && a.attachobj) {
                i.attachTo(a.attachobj, a.attachtype, a.attachdx, a.attachdy)
            }
            if (i.props.reloadonnew) {
                i.reload(f)
            } else {
                i.show()
            }
            return false
        }
    }
    this.constructor = _uWnd;
    this.desktop = this.opts && this.opts.desktop || _uWnd.defdesktop;
    this.props = $.extend({
        parent: null,
        popup: 0,
        alert: 0,
        closeonesc: a.popup ? 1 : 0,
        nohide: 0,
        reloadonnew: a.attachobj ? 0 : 1,
        x: "auto",
        y: "auto",
        attachobj: null,
        attachdx: 0,
        attachdy: 0,
        attachtype: null,
        initstate: null,
        headerh: 0,
        headerc: null,
        hideheader: 1,
        footerh: 0,
        footerc: null,
        hidefooter: 1,
        contentsizeprio: a.footerh > 0 || a.headerh > 0 ? 1 : 0,
        nomove: a.attachobj ? 1 : 0,
        hideonmove: 1,
        center: a.modal ? 1 : 0,
        session: null,
        hidden: 0,
        modal: 0,
        toolwindow: 0,
        resize: a.toolwindow || a.attachobj ? 0 : 1,
        fixed: _uWnd.defdesktop || a.desktop ? 0 : 1,
        minh: 50,
        minw: 0,
        maxh: 0,
        maxw: 0,
        autosize: a.toolwindow || a.attachobj ? 0 : 1,
        autosizewidth: 0,
        autosizeonimages: 0,
        waitimages: 0,
        hideonresize: 0,
        attachicon: null,
        attachicontype: "",
        attachicondelta: 2,
        attachiconact: "hide",
        icon: "",
        header: g ? 1 : 0,
        min: this.desktop && !(a.notaskbar || a.parent || a.toolwindow || a.alert || a.modal || a.attachobj) ? 1 : 0,
        max: this.desktop && !a.modal && !a.attachobj ? 1 : 0,
        close: 1,
        customButtons: null,
        notaskbar: a.parent || a.toolwindow || a.alert || a.modal || a.attachobj ? 1 : 0,
        align: "center",
        shadow: a.toolwindow ? 0 : 1,
        design: "std",
        fadetype: a.toolwindow || a.modal || a.attachobj ? 0 : 1,
        fadespeed: 800,
        fadeclosetype: a.toolwindow || a.modal || a.attachobj ? 0 : 1,
        fadeclosespeed: 250,
        havemenu: e ? 1 : 0,
        menuopts: null,
        trayicon: null,
        traymenu: null,
        actlayer: 0,
        markload: '<div align="left"><div class="myWinLoad"></div></div>',
        havegrid: 0,
        markwaitcont: '<div class="myWinLoad"></div>',
        markwaitclass: "myWinGrid",
        oninit: null,
        oncontent: null,
        onposchange: null,
        onactivate: null,
        ondeactivate: null,
        onerror: null,
        onbeforeclose: null,
        onclose: null,
        desktop: null,
        notabdestroy: 0
    }, a || {});
    if (this.props.modal || this.props.toolwindow) {
        this.props.min = 0
    }
    if (this.props.toolwindow) {
        this.props.max = 0
    }
    if (this.props.session) {
        this.props.x = this.props.session.x;
        this.props.y = this.props.session.y
    }
    $.extend(this, {
        name: b,
        title: g ? g : "",
        letsize: 1,
        width: c && Math.abs(c) > 10 ? c : -300,
        height: h && Math.abs(h) > 10 ? h : -200,
        headerh: this.props.headerc && this.props.headerh >= 0 ? this.props.headerh : 0,
        footerh: this.props.footerc && this.props.footerh >= 0 ? this.props.footerh : 0,
        decor: {
            w: 0,
            h: 0,
            th: 0
        },
        _content: f,
        state: {
            visible: false,
            prevvisible: false,
            minimized: false,
            maximized: false,
            loaded: false,
            init: false,
            disabled: false,
            grided: false,
            noshadow: false,
            resizing: false,
            destroyed: false,
            focused: false
        },
        grid: null,
        frame: null,
        sh: null,
        sh_sz: [4, 2],
        xpos: 0,
        ypos: 0,
        zpos: this.props.modal || this.props.alert ? _uWnd.getModalTopZ() : _uWnd.getTopZ(),
        _drag: new _uDraggable(this, this._ondragmousemove, null, this.onstartdrag, this.onstopdrag),
        _resize: new _uDraggable(this, this._onrsmousemove, null, this.onstartrs, this.onstoprs),
        restRect: null,
        minheight: this.props.minh,
        minwidth: this.props.minw,
        maxheight: this.props.maxh,
        maxwidth: this.props.maxw,
        pend_show: null,
        autosz: {
            active: false
        },
        imgloader: {
            timer: null,
            active: false
        },
        menu: null,
        app: d || null,
        childs: [],
        nchilds: 0,
        tabctrl: null,
        attachicon: "",
        sesupdate: 0
    });
    this.design = this.props.design && _uWnd.designs[this.props.design] || _uWnd.designs.std;
    this.idx = _uWnd.nextidx++;
    _uWnd.all[this.idx] = this;
    this._focus = new _uFocus({
        type: 0,
        owner: this,
        thispar: this,
        parent: this.props.parent && this.props.toolwindow ? this.props.parent._focus : (this.app ? this.app._focus : null),
        onkeydown: this._onkeydown,
        onkeypress: this._onkeypress,
        onactivate: this._onactivate,
        ondeactivate: this._ondeactivate,
        canactivate: this._canactivate
    });
    if (!_uWnd.globalset) {
        _uWnd.globalset = true;
        $(document).bind("mousedown", _uWnd.closepopup);
        $(window).bind("scroll", _uWnd._onscroll);
        $(window).bind("resize", _uWnd._onresize);
        _uWnd.sysmenu = new _uMENU("", {
            align: "D"
        }, {
            hidden: 1,
            withmarks: 1,
            onitem: _uWnd._onsysmenuitem
        }, _uWnd.sysmenuitems)
    }
    this.init(e)
}
_uWnd.all = {};
_uWnd.nextidx = 1;
_uWnd.zchilds = [];
_uWnd.lastz = 0;
_uWnd.zstep = 2;
_uWnd.minz = 10000;
_uWnd.maxz = 20000;
_uWnd.lastmodalz = 0;
_uWnd.minmodalz = 21000;
_uWnd.maxmodalz = 25000;
_uWnd.globalset = false;
_uWnd.defdesktop = null;
_uWnd.ignoreclick = null;
_uWnd.findactive = function () {
    var a = _uFocus.current;
    while (a) {
        if (a.owner && a.owner.constructor == _uWnd) {
            return a
        }
        a = a._parent
    }
    return null
};
_uWnd.globalmousedown = function () {
    _uMENU.hideallmenus();
    _uSuggestList.hideall();
    _uComboBox.hideall();
    _uWnd.closepopup()
};
_uWnd.messageBoxclose = function (b, a) {
    var c = b.props._msgdata;
    if (!c.retval) {
        c.retval = c.defc
    }
    if (c.onsel) {
        c.onsel.call(c.app, c.retval, c.param, b)
    }
};
_uWnd.messageBox = function (j, n, m, c, a, f, e) {
    var l = $.extend({
        w: "auto",
        h: "auto",
        name: "",
        modal: 1,
        closeonesc: 1,
        align: "center",
        min: 0,
        max: 0,
        close: 1,
        fadetype: 0,
        fadeclosetype: 0,
        resize: 0,
        autosize: 0
    }, a || {});
    var k = {
        onsel: c,
        app: e,
        param: f
    };
    l._msgdata = k;
    l.onclose = _uWnd.messageBoxclose;
    l.oncontent = _uWnd.messageBoxoncont;
    var h, g, o;
    g = {
        ok: 1,
        yes: 1,
        no: 1,
        retry: 1,
        cancel: 1
    };
    k.buts = [];
    k.def = null;
    k.defc = null;
    if (!m || m.constructor != Array) {
        m = ["ok"]
    }
    for (h = 0; h < m.length; h++) {
        if (typeof m[h] == "string") {
            k.buts.push({
                id: m[h],
                t: (g[m[h]] ? _txt(m[h]) : m[h])
            })
        } else {
            if (typeof m[h] == "object" && m[h].id) {
                k.buts.push({
                    id: m[h].id,
                    t: m[h].t || (g[m[h].id] ? _txt(m[h].id) : m[h].id),
                    def: m[h].def
                })
            }
        }
    }
    if (k.buts.length == 0) {
        return 0
    }
    o = 0;
    for (h = 0; h < k.buts.length; h++) {
        o += 60;
        if (k.buts[h].def) {
            if (k.buts[h].def & 1) {
                k.def = k.buts[h].id;
                if (typeof(k.buts[h].style) == "undefined") {
                    k.buts[h].style = 0
                }
            }
            if (k.buts[h].def & 2) {
                k.defc = k.buts[h].id
            }
        }
    }
    if (!k.def) {
        k.def = k.buts[0].id;
        if (typeof(k.buts[0].style) == "undefined") {
            k.buts[0].style = 0
        }
    }
    if (!k.defc) {
        k.defc = k.buts[k.buts.length - 1].id
    }
    k.txt = j;
    return new _uWnd(l.name || "", n, !l.w || l.w == "auto" ? -(o + 50) : l.w, !l.h || l.h == "auto" ? -100 : l.h, l, _uWnd.messageBoxcont, null, e)
};
_uWnd.messageBoxoncont = function (a, f) {
    var e = a.props._msgdata,
        b;
    b = $(a.parts.content).find("#_uw" + a.idx + "msg" + e.def)[0];
    if (b) {
            b.focus()
        }
};
_uWnd.messageBoxcont = function (b) {
    var a, e, c;
    e = b.props._msgdata;
    a = "";
    for (c = 0; c < e.buts.length; c++) {
        a += "<td>" + _uButton("", "b", {
            style: typeof(e.buts[c].style) == "undefined" ? 1 : e.buts[c].style,
            text: e.buts[c].t,
            content: 'onclick="var w=_uWnd.all[' + b.idx + "];if(w){w.props._msgdata.retval='" + encodeHtmlVal(e.buts[c].id) + "';w.close()}\"",
            id: "_uw" + b.idx + "msg" + e.buts[c].id
        }) + "</td>"
    }
    return '<div style="padding:20px 10px 10px 10px">' + e.txt + '</div><div style="padding:0px 10px 10px 10px"><table align="center" callpadding="0" cellspacing="10" border="0"><tr>' + a + "</tr></table></div>"
};
_uWnd.alerts = null;
_uWnd.alert = function (e, k, a, c) {
    a = $.extend({
        w: 150,
        h: 100,
        tm: 5000,
        close: 1,
        align: "center",
        icon: "",
        name: "",
        pad: null
    }, a || {});
    if (a.pad) {
        e = '<div style="padding:' + a.pad + '">' + e + "</div>"
    }
    var h, j, i, g, b, f;
    if (!(h = _uWnd.defdesktop)) {
        h = _uWnd.getdims();
        j = h.clientW - a.w - 5;
        g = h.clientH - a.h - 5;
        b = _uWnd.alerts;
        f = 0;
        h = null
    } else {
        j = h.width - h.calcexclude(1) - a.w - 5;
        g = h.height - h.calcexclude(3) - a.h - 5;
        b = h.alerts;
        f = h.calcexclude(2)
    }
    i = g;
    if (b) {
        if (b.y - (a.h + 5) >= 0) {
            i = b.y - (a.h + 5)
        }
        while (b) {
            if (b.y > f) {
                f = b.y
            }
            b = b.prev
        }
        if (f > 0 && g - f >= a.h + 5) {
            i = g
        }
    }
    var l = new _uWnd(a.name, k, a.w, a.h, {
        close: a.close,
        min: 0,
        max: 0,
        icon: a.icon,
        align: a.align,
        x: j,
        y: i,
        alert: 1,
        autosize: 0,
        fixed: 1,
        shadow: 0,
        resize: 0,
        nomove: 1,
        hidden: 0,
        notaskbar: 1,
        fadetype: 2,
        fadespeed: 500,
        fadeclosetype: 2,
        fadeclosespeed: 500,
        onclose: function (m, d) {
            _uWnd.rmalert(m, d)
        }
    }, e, null, c);
    if (!h) {
        _uWnd.alerts = {
            prev: _uWnd.alerts,
            wnd: l,
            y: i
        }
    } else {
        h.alerts = {
            prev: h.alerts,
            wnd: l,
            y: i
        }
    }
    if (a.tm > 0) {
        setTimeout("var w=_uWnd.all[" + l.idx + "];if(w)w.close();", a.tm)
    }
    return l
};
_uWnd.rmalert = function (d, b) {
    var c = d.desktop ? d.desktop.alerts : _uWnd.alerts,
        e = null;
    while (c && c.wnd !== d) {
            e = c;
            c = c.prev
        }
    if (c && c.wnd === d) {
            if (e) {
                e.prev = c.prev
            } else {
                if (d.desktop) {
                    d.desktop.alerts = c.prev
                } else {
                    _uWnd.alerts = c.prev
                }
            }
        }
};
_uWnd._onscroll = function (f) {
    if (!$.browser.msie) {
        return
    }
    var g = _uWnd.getdims(),
        b = _uWnd.all;
    for (var c in b) {
            if (b[c]) {
                if (b[c].props.fixed || b[c].grid) {
                    b[c].moveTo(b[c].xpos, b[c].ypos)
                }
            }
        }
};
_uWnd._onresize = function (g, f) {
    var h = _uWnd.getdims(),
        b = _uWnd.all;
    for (var c in b) {
            if (b[c]) {
                if ((!f && !b[c].desktop) || b[c].desktop == f) {
                    b[c]._onresize(h)
                }
            }
        }
};
_uWnd.closepopup = function () {
    var b = _uWnd.all;
    for (var c in b) {
        if (b[c] && b[c].props.popup && _uWnd.ignoreclick != b[c]) {
            b[c].closeevent()
        }
    }
    if (_uWnd.ignoreclick) {
        setTimeout("_uWnd.ignoreclick=null;", 10)
    }
};
_uWnd.findparent = function (a) {
    var b = a;
    while (b && b != document.body) {
        if (b.id && b.id.indexOf && b.id.indexOf("_uwndTop") == 0 && b._uwndobj) {
            return b._uwndobj
        }
        b = b.parentNode
    }
    return null
};
_uWnd.getbyname = function (c) {
    var b = this.all;
    for (var d in b) {
        if (b[d] && b[d].name == c) {
            return b[d]
        }
    }
    return null
};
_uWnd.getTopZ = function (nc, ignw) {
    if (!nc) {
        nc = 0
    }
    with(_uWnd) {
        var z = lastz;
        if (z < minz) {
            z = minz
        } else {
            z += zstep
        }
        if (z + (1 + nc) * zstep > maxz) {
            var x = minz;
            var ar = [];
            for (var i in all) {
                if (all[i] && all[i] != ignw && all[i].props && !all[i].props.parent) {
                    ar[ar.length] = all[i]
                }
            }
            for (var i = 0; i < zchilds.length; i++) {
                if (zchilds[i]) {
                    ar[ar.length] = zchilds[i]
                }
            }
            ar.sort(function (a, b) {
                return a.zpos - b.zpos
            });
            for (var i = 0; i < ar.length; i++) {
                ar[i].setZ(x);
                x += zstep * (1 + (ar[i].nchilds ? ar[i].nchilds : 0))
            }
            z = x
        }
        lastz = z + (1 + nc) * zstep;
        return z
    }
};
_uWnd.getModalTopZ = function (nc, ignw) {
    if (!nc) {
        nc = 0
    }
    with(_uWnd) {
        var z = lastmodalz;
        if (z < minmodalz) {
            z = minmodalz
        } else {
            z += zstep
        }
        if (z + (1 + nc) * zstep > maxmodalz) {
            var x = minmodalz;
            var ar = [];
            for (var i in all) {
                if (all[i] && all[i] != ignw && all[i].props && !all[i].props.parent && (all[i].props.modal || all[i].props.alert)) {
                    ar[ar.length] = all[i]
                }
            }
            ar.sort(function (a, b) {
                return a.zpos - b.zpos
            });
            for (var i = 0; i < ar.length; i++) {
                ar[i].setZ(x);
                x += zstep * (1 + (ar[i].nchilds ? ar[i].nchilds : 0))
            }
            z = x
        }
        lastmodalz = z + (1 + nc) * zstep;
        return z
    }
};
_uWnd.getdims = function () {
    var b = document;
    var a = "";
    return {
        clientW: Math.min($.browser.opera && window.innerWidth || $(window).width(), $.browser.safari && b.body.clientWidth || $(window).width(), $(window).width()),
        clientH: Math.min($.browser.opera && window.innerHeight || $(window).height(), $.browser.safari && b.body.clientHeight || $(window).height(), $(window).height()),
        clientLeft: $(b).scrollLeft(),
        clientTop: $(b).scrollTop(),
        docW: $(b).width(),
        docH: $(b).height()
    }
};
_uWnd.csize = function (c, a) {
    if (a != "width" && a != "height") {
        return 0
    }
    var e, d = a == "width" ? ["Left", "Right"] : ["Top", "Bottom"];
    e = a == "width" ? c.offsetWidth : c.offsetHeight;
    var f = 0,
        b = 0;
    jQuery.each(d, function () {
            f += parseFloat(jQuery.curCSS(c, "padding" + this, true)) || 0;
            b += parseFloat(jQuery.curCSS(c, "border" + this + "Width", true)) || 0
        });
    e -= Math.round(f + b);
    return Math.max(0, e)
};
_uWnd.close = function (b) {
    var a = _uWnd.getbyname(b);
    if (a) {
        a.close()
    }
};
_uWnd.content = function (b, d) {
    var a = _uWnd.getbyname(b);
    if (a) {
        a.content(d)
    }
};
_uWnd.header = function (b, d) {
    var a = _uWnd.getbyname(b);
    if (a) {
        a.header(d)
    }
};
_uWnd.footer = function (b, d) {
    var a = _uWnd.getbyname(b);
    if (a) {
        a.footer(d)
    }
};
_uWnd.headerheight = function (b, c) {
    var a = _uWnd.getbyname(b);
    if (a) {
        a.headerheight(c)
    }
};
_uWnd.footerheight = function (b, c) {
    var a = _uWnd.getbyname(b);
    if (a) {
        a.footerheight(c)
    }
};
_uWnd.reload = function (b, d) {
    var a = _uWnd.getbyname(b);
    if (a) {
        a.reload(d)
    }
};
_uWnd.setTitle = function (b, c) {
    var a = _uWnd.getbyname(b);
    if (a) {
        a.setTitle(c)
    }
};
_uWnd.activatetopwnd = function (e) {
    var d = 0,
        f = null,
        b = _uWnd.all;
    for (var c in b) {
            if (!b[c] || (e && b[c].desktop != e) || !b[c].state.visible || b[c].state.minimized || b[c].props.alert) {
                continue
            }
            if (b[c].zpos > d) {
                d = b[c].zpos;
                f = b[c]
            }
        }
    if (f) {
            f.activate()
        } else {
            if (e) {
                e.activate()
            }
        }
};
_uWnd.sysmenu = null;
_uWnd.sysmenuitems = [
    [_txt("Restore"), null, "rest"],
    [_txt("Minimize"), null, "min"],
    [_txt("Maximize"), null, "max"], "sep", [_txt("Close"), null, "close"]
];
_uWnd._onsysmenuitem = function (b, a, d) {
    var c = a.forwnd;
    if (!c) {
        return
    }
    switch (d) {
    case "rest":
        if (c.state.minimized && c.ontaskbar) {
            c.desktop.wndlist.design.animatewndrestore(c.desktop.wndlist, c)
        } else {
            c.restore(1)
        }
        break;
    case "min":
        c.minimize();
        break;
    case "max":
        if (c.state.minimized && c.ontaskbar) {
            c.desktop.wndlist.design.animatewndmaximize(c.desktop.wndlist, c)
        } else {
            c.maximize(1)
        }
        break;
    case "close":
        c.closeevent();
        break
    }
};
_uWnd.designs = {
    std: {
        sh_sz: [4, 2],
        altcloseclass: "xt-close2",
        shadow_init: function (c) {
            var b = [];
            for (var a = 0; a < 3; a++) {
                b[a] = document.createElement("div");
                c.appendChild(b[a]);
                $(b[a]).attr("class", "x-sh").css({
                    position: "absolute",
                    zIndex: 1
                })
            }
            $(b[0]).addClass("xsl").css({
                width: (this.sh_sz[0] + this.sh_sz[1]) + "px",
                left: (-this.sh_sz[0]) + "px",
                top: "0px"
            }).html('<div class="xstl"><div class="xsml"></div></div>');
            $(b[1]).addClass("xsr").css({
                width: (this.sh_sz[0] + this.sh_sz[1]) + "px",
                top: "0px"
            }).html('<div class="xstr"><div class="xsmr"></div></div>');
            $(b[2]).addClass("xsb").css({
                height: (this.sh_sz[0] + this.sh_sz[1]) + "px",
                left: (-this.sh_sz[0]) + "px"
            }).html('<div class="xsbl"><div class="xsbr"><div class="xsbc"></div></div></div>');
            return b
        },
        shadow_resize: function (b, a, c) {
            $(b[0]).css({
                height: (c - this.sh_sz[1]) + "px"
            });
            $(b[1]).css({
                height: (c - this.sh_sz[1]) + "px",
                left: (a - this.sh_sz[1]) + "px"
            });
            $(b[2]).css({
                width: (a + this.sh_sz[0] * 2) + "px",
                top: (c - this.sh_sz[1]) + "px"
            })
        },
        shadow_hide: function (a) {
            $(a[0]).add(a[1]).add(a[2]).hide()
        },
        shadow_show: function (a) {
            $(a[0]).add(a[1]).add(a[2]).show()
        },
        custButMargin: 5,
        wnd_init: function (d, e, q, k, b, l, m, j, c) {
            $(e).addClass("xw-plain").addClass("x-unselectable");
            if (d.props.alert) {
                $(e).addClass("xw-active")
            }
            if (j) {
                $(e).addClass("xw-resize")
            }
            var g = "";
            if (d.props.customButtons) {
                for (var f in d.props.customButtons) {
                    g += '<div class="xt xt-' + f + '"></div>'
                }
            }
            $(e).html('<div class="xw-disabled" style="display:none;overflow:hidden;position:absolute;z-index:30010"></div>' + (l ? '<div class="xw-tl"><div class="xw-tr"><div class="xw-tc"><div class="xw-sps"></div><div class="xw-hdr"><div class="xt xt-close"></div><div class="xt xt-maxi"></div><div class="xt xt-rest"></div><div class="xt xt-mini"></div>' + g + (m ? '<img unselectable="on" onmousedown="return false;" class="xw-icon x-unselectable" src="' + m + '">' : "") + '<span class="xw-hdr-text">' + q + "</span></div></div></div></div>" : '<div class="xw-tl"><div class="xw-tr"><div class="xw-tc xw-tsps"></div></div></div>') + '<div class="xw-ml"><div class="xw-mr"><div class="xw-mc">' + (c ? '<div class="u-wndmenufr"><div class="u-wndmenu" style="position:relative"></div></div>' : "") + '<div class="xw-body">' + (d.props.havegrid ? '<div class="' + d.props.markwaitclass + '" style="display:none;overflow:hidden;position:absolute;z-index:30000"></div>' : "") + (d.props.headerc ? '<div class="myWinCont myWinHeader" style="overflow:hidden;height:' + d.headerh + 'px"></div>' : "") + (d.props.actlayer ? '<div class="xw-actlayer" style="overflow:hidden;position:absolute;z-index:30005"></div>' : "") + '<div style="overflow:scroll;height:' + b + 'px"><div class="myWinCont" style="display:none;overflow:hidden"' + (k ? ' align="' + k + '"' : "") + '></div><div class="myWinCont" style="overflow:hidden"' + (k ? ' align="' + k + '"' : "") + "></div></div>" + (d.props.footerc ? '<div class="myWinCont myWinFooter" style="overflow:hidden;height:' + d.footerh + 'px"></div>' : "") + '</div></div></div></div><div class="xw-bl"><div class="xw-br"><div class="xw-bc"></div></div></div><div class="xw-blank" style="display:none"></div>');
            var a = {},
                n = 0;
            if (d.props.attachicon) {
                    $(d.top).append('<div class="xw-attachicon" style="display:none;position:absolute;z-index:3"></div>');
                    a.attachicon = $(d.top).find(".xw-attachicon")[0]
                }
            a.markdis = $(e).find(".xw-disabled")[0];
            a.actlayer = $(e).find(".xw-actlayer")[0];
            a.wndmove = $(e).find(".xw-blank")[0];
            a.upper = $(e).find(".xw-tl")[0];
            a.center = $(e).find(".xw-ml")[0];
            a.bottom = $(e).find(".xw-bl")[0];
            a.bottomc = $(e).find(".xw-bc")[0];
            $(e).find(".xw-mc").bind("mousedown", d, _uWnd._activateonmousedown);
            if (d.props.headerc) {
                    a.headercont = $(e).find(".myWinCont")[n];
                    $(a.headercont).html(d.props.headerc);
                    n++
                }
            a.markload = $(e).find(".myWinCont")[n];
            $(a.markload).html(d.props.markload);
            a.wndcont = $(e).find(".myWinCont")[n + 1];
            if (d.props.footerc) {
                    a.footercont = $(e).find(".myWinCont")[n + 2];
                    $(a.footercont).html(d.props.footerc)
                }
            if (d.props.havegrid) {
                    a.markwait = $(e).find("." + d.props.markwaitclass)[0];
                    $(a.markwait).html(d.props.markwaitcont)
                }
            a.hwndcont = a.wndcont.parentNode;
            if (l) {
                    a.hdr = $(e).find(".xw-hdr")[0];
                    a.htitle = $(e).find(".xw-hdr-text")[0];
                    var h = {
                        cbut: "xt-close",
                        mbut: "xt-mini",
                        xbut: "xt-maxi",
                        rbut: "xt-rest",
                        icon: "xw-icon"
                    };
                    for (var f in h) {
                        a[f] = $(a.hdr).find("." + h[f])[0]
                    }
                    a.custom = {};
                    for (var f in d.props.customButtons) {
                        a.custom[f] = $(a.hdr).find(".xt-" + f)[0]
                    }
                } else {
                    a.hdr = a.htitle = a.cbut = a.mbut = a.xbut = a.rbut = a.icon = null
                }
            if (c) {
                    a.menu = $(e).find(".u-wndmenu")[0]
                } else {
                    a.menu = null
                }
            $(e).find("div,span").andSelf().attr("unselectable", "on");
            return a
        },
        onstartautosz: function (a) {
            a.parts.wndcont.style.overflow = "hidden";
            a.parts.wndcont.style.height = "auto"
        },
        onstopautosz: function (b, a) {
            if (!a) {
                b.parts.hwndcont.style.visibility = ""
            }
            b.parts.wndcont.style.overflow = "auto";
            b.parts.wndcont.style.height = "100%"
        },
        get_szbuts: function (c) {
            var a = {
                nw: "xw-tl",
                n: "xw-sps",
                ne: "xw-tr",
                w: "xw-ml",
                e: "xw-mr",
                sw: "xw-bl",
                s: "xw-bc",
                se: "xw-br"
            };
            for (var b in a) {
                a[b] = $(c).find("." + a[b])[0]
            }
            if (!a.n) {
                a.n = $(c).find(".xw-tsps")[0]
            }
            return a
        },
        onbuttonover: function (b) {
            var a = b.data.cls;
            if (b.data.state) {
                $(this).addClass(a + "-over")
            } else {
                $(this).removeClass(a + "-over")
            }
        },
        onstartdrag: function (a) {
            $(a.wnd).addClass("xw-dragging");
            if (!a.state.minimized && a.props.hideonmove) {
                a.hideSh();
                $(a.parts.center).add(a.parts.bottom).hide();
                $(a.parts.wndmove).css("width", a.width + "px").css("height", (a.height - a.decor.th) + "px").show()
            }
        },
        onstopdrag: function (a) {
            $(a.wnd).removeClass("xw-dragging");
            if (!a.state.minimized && a.props.hideonmove) {
                a.showSh();
                $(a.parts.center).add(a.parts.bottom).show();
                $(a.parts.wndmove).hide()
            }
        },
        ondisable: function (b, a) {
            if (!a) {
                $(b.parts.markdis).hide();
                if (b.state.focused || b.props.alert) {
                    $(b.wnd).addClass("xw-active")
                }
            } else {
                $(b.parts.markdis).css("width", Math.abs(b.width) + "px").css("height", Math.abs(b.height) + "px").show();
                $(b.wnd).removeClass("xw-active")
            }
        },
        onfocus: function (b, a) {
            if (a && !b.state.disabled) {
                $(b.wnd).addClass("xw-active")
            } else {
                $(b.wnd).removeClass("xw-active")
            }
        },
        onstartresize: function (a) {},
        onstopresize: function (a) {},
        onminimize: function (a) {
            $(a.parts.center).css("display", "none");
            $(a.parts.bottomc).addClass("xw-bcm");
            a.hideSh()
        },
        onrestore: function (a) {
            $(a.parts.bottomc).removeClass("xw-bcm");
            $(a.parts.center).css("display", "block");
            a.showSh()
        }
    }
};
_uWnd.prototype = {
    showsysmenu: function (b, d) {
        this.activate();
        var a = _uWnd.sysmenu,
            c;
        if (!a) {
                return
            }
        if ((c = a.indexById("rest")) >= 0) {
                if ((this.state.minimized && (this.props.max || this.state.beforemin != "max")) || (this.props.max && this.state.maximized)) {
                    $(a.parts.elems[c]).removeClass("u-graymenuitem");
                    a.elems[c][1] = null
                } else {
                    $(a.parts.elems[c]).addClass("u-graymenuitem");
                    a.elems[c][1] = 1
                }
            }
        if ((c = a.indexById("min")) >= 0) {
                if (this.props.min && !this.state.minimized) {
                    $(a.parts.elems[c]).removeClass("u-graymenuitem");
                    a.elems[c][1] = null
                } else {
                    $(a.parts.elems[c]).addClass("u-graymenuitem");
                    a.elems[c][1] = 1
                }
            }
        if ((c = a.indexById("max")) >= 0) {
                if ((this.props.max || (this.state.minimized && this.state.beforemin == "max")) && !this.state.maximized) {
                    $(a.parts.elems[c]).removeClass("u-graymenuitem");
                    a.elems[c][1] = null
                } else {
                    $(a.parts.elems[c]).addClass("u-graymenuitem");
                    a.elems[c][1] = 1
                }
            }
        a.forwnd = this;
        if (this.props.popup) {
                _uWnd.ignoreclick = this
            }
        _uWnd.globalmousedown();
        a.show({
                pos: {
                    x: b,
                    y: d
                },
                parentfocus: this._focus
            })
    },
    _foreachchild: function (b, d) {
        var e;
        for (var a = 0; a < this.childs.length; a++) {
            e = this.childs[a];
            if (!e || e.state.destroyed) {
                continue
            }
            if (d) {
                e._foreachchild(b, d);
                b.call(this, e)
            } else {
                if (!b.call(this, e)) {
                    e._foreachchild(b, d)
                }
            }
        }
    },
    showattachicon: function (g) {
        var f = this.props.attachicon,
            b, d = this.parts.attachicon,
            a = this.props.attachicondelta,
            e = {
                lt: "l",
                lb: "l",
                rt: "r",
                rb: "r",
                tl: "t",
                tr: "t",
                bl: "b",
                br: "b"
            },
            c = {
                lt: "h",
                lb: "h",
                rt: "h",
                rb: "h",
                tl: "v",
                tr: "v",
                bl: "v",
                br: "v"
            };
        if (!this.parts.attachicon) {
                return
            }
        if (arguments.length > 0) {
                if (g && f) {
                    b = typeof(f) == "object" ? f[g] : f;
                    if (!b) {
                        b = f[e[g]];
                        if (!b) {
                            b = f[c[g]]
                        }
                    }
                }
                if (!b || !g) {
                    this.parts.attachicon.style.display = "none";
                    return
                }
            } else {
                g = this.attachicon;
                if (!g) {
                    return
                }
            }
        if (this.attachicon != g) {
                $(d).html(b)
            }
        if (c[g] == "h") {
                if (g == "lt" || g == "rt") {
                    $(d).css({
                        top: 0,
                        bottom: ""
                    })
                } else {
                    $(d).css({
                        bottom: (-this.height) + "px",
                        top: ""
                    })
                }
                if (e[g] == "l") {
                    $(d).css({
                        left: "",
                        right: (-a) + "px"
                    })
                } else {
                    $(d).css({
                        right: "",
                        left: (this.width - a) + "px"
                    })
                }
            } else {
                if (g == "tl" || g == "bl") {
                    $(d).css({
                        right: "",
                        left: 0 + "px"
                    })
                } else {
                    $(d).css({
                        left: "",
                        right: (-this.width) + "px"
                    })
                }
                if (e[g] == "t") {
                    $(d).css({
                        bottom: (-a) + "px",
                        top: ""
                    })
                } else {
                    $(d).css({
                        top: (this.height - a) + "px",
                        bottom: ""
                    })
                }
            }
        if (!this.attachicon) {
                this.parts.attachicon.style.display = ""
            }
        this.attachicon = g
    },
    setZ: function (z) {
        with(this) {
            zpos = z;
            var c;
            for (var i = 0; i < this.childs.length; i++) {
                c = this.childs[i];
                if (!c || c.state.destroyed) {
                    continue
                }
                z += _uWnd.zstep;
                c.setZ(z);
                z += _uWnd.zstep * c.nchilds
            }
            $(top).css("z-index", zpos);
            if (grid) {
                $(grid).css("z-index", zpos - 1)
            }
        }
    },
    saveSession: function () {
        var a;
        if (this.state.maximized || this.state.minimized) {
            a = this.restRect
        } else {
            a = [this.xpos, this.ypos, this.width, this.height]
        }
        return {
            x: a[0],
            y: a[1],
            w: a[2] - this.decor.w,
            h: a[3] - this.decor.h,
            bm: this.state.minimized ? this.state.beforemin : "",
            s: this.state.maximized ? "max" : (this.state.minimized ? "min" : "")
        };
        this.sesupdate = false
    },
    attachTo: function (q, t, p, o) {
        var A, j, g, r, C, n, m, z, B, h, e, b, s, u, f, c, l, v, w, k;
        if (q && q.nodeType || (q[0] && q[0].nodeType)) {
            if (q.nodeType) {
                A = q
            } else {
                A = q[0]
            }
            j = $(A).offset();
            g = A.offsetWidth;
            r = A.offsetHeight
        } else {
            if (q && q.length == 2) {
                j = {
                    left: q[0],
                    top: q[1]
                };
                g = r = 0
            } else {
                return
            }
        }
        z = _uWnd.getdims();
        B = z.clientW;
        h = z.clientH;
        e = z.clientLeft;
        b = z.clientTop;
        t = t || "rt";
        p = p || 0;
        o = o || 0;
        if (this.desktop) {
            z = this.desktop;
            B = z.width;
            h = z.height;
            e = 0;
            b = 0
        }
        if (this.props.fixed) {
            e = b = 0
        }
        if (t.length == 1) {
            if (t.toLowerCase() == "u" || t.toLowerCase() == "d") {
                t += "r"
            } else {
                t += "t"
            }
        }
        if (window._rtl) {
            t = t.replace(/[lLrR]/g, function (a) {
                if (a == "l") {
                    return "r"
                }
                if (a == "L") {
                    return "R"
                }
                if (a == "r") {
                    return "l"
                }
                if (a == "R") {
                    return "L"
                }
            })
        }
        s = t.substr(0, 1);
        c = j.left + g + p;
        f = j.left - p - this.width;
        v = j.top + r + o;
        l = j.top - o - this.height;
        n = c;
        w = "l";
        m = j.top - o;
        k = "t";
        if (s == "l") {
            n = f;
            w = "r"
        } else {
            if (s == "r") {
                n = c;
                w = "l"
            } else {
                if (s == "L" && f - e < 1 && e - f > c - e + this.width - B) {
                    n = c;
                    w = "l"
                } else {
                    if (s == "R" && c - e + this.width > B - 3 && e - f < c - e + this.width - B) {
                        n = f;
                        w = "r"
                    } else {
                        if (s == "u") {
                            m = l;
                            w = "b"
                        } else {
                            if (s == "d") {
                                m = v;
                                w = "t"
                            } else {
                                if (s == "U" && l - b < 1 && b - l > v - b + this.height - h) {
                                    m = v;
                                    w = "t"
                                } else {
                                    if (s == "D" && v - b + this.height > h - 3 && b - l < v - b + this.height - h) {
                                        m = l;
                                        w = "b"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        s = t.substr(1, 1);
        c = j.left + g - this.width + p;
        f = j.left - p;
        v = j.top + r + -this.height + o;
        l = j.top - o;
        if (s == "l") {
            n = f;
            k = "l"
        } else {
            if (s == "r") {
                n = c;
                k = "r"
            } else {
                if (s == "L" && f - e < 1 && e - f > c - e + this.width - B) {
                    n = c;
                    k = "r"
                } else {
                    if (s == "R" && c - e + this.width > B - 3 && e - f < c - e + this.width - B) {
                        n = f;
                        k = "l"
                    } else {
                        if (s == "t") {
                            m = l;
                            k = "t"
                        } else {
                            if (s == "b") {
                                m = v;
                                k = "b"
                            } else {
                                if (s == "T" && l - b < 1 && b - l > v - b + this.height - h) {
                                    m = v;
                                    k = "b"
                                } else {
                                    if (s == "B" && v - b + this.height > h - 3 && b - l < v - b + this.height - h) {
                                        m = l;
                                        k = "t"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        this.showattachicon(w + k);
        if (n != this.xpos || m != this.ypos) {
            this.moveTo(n, m)
        }
    },
    moveTo: function (_x, _y, nopos) {
        var d = _uWnd.getdims();
        with(this) {
            if (_x == "auto" && _y == "auto" && desktop && !props.fixed && !props.autosize && !props.center) {
                var p = desktop.getwndcoord(width, height);
                _x = p.x;
                _y = p.y
            } else {
                if (_x == "auto") {
                    if (props.parent) {
                        _x = Math.floor((props.parent.width - width) / 2) + props.parent.xpos
                    } else {
                        if (desktop && !props.fixed) {
                            _x = Math.floor((desktop.calcwidth() - width) / 2) + desktop.calcexclude(0)
                        } else {
                            _x = Math.floor((d.clientW - width) / 2) + (props.fixed ? 0 : d.clientLeft)
                        }
                    }
                    if (_x < 0) {
                        _x = 0
                    }
                }
                if (_y == "auto") {
                    if (props.parent) {
                        _y = Math.floor((props.parent.height - height) / 2) + props.parent.ypos
                    } else {
                        if (desktop && !props.fixed) {
                            _y = Math.floor((desktop.calcheight() - height) / 2) + desktop.calcexclude(2)
                        } else {
                            _y = Math.floor((d.clientH - height) / 2) + (props.fixed ? 0 : d.clientTop)
                        }
                    }
                    if (_y < 0) {
                        _y = 0
                    }
                }
            }
            if (props.fixed && $.browser.msie && parseFloat($.browser.version) <= 8) {
                $(top).css("left", (d.clientLeft + _x) + "px").css("top", (d.clientTop + _y) + "px")
            } else {
                $(top).css("left", _x + "px").css("top", _y + "px")
            }
            if (grid) {
                if ($.browser.msie && parseFloat($.browser.version) <= 8) {
                    $(grid).css("left", d.clientLeft + "px").css("top", d.clientTop + "px")
                } else {
                    $(grid).css("left", "0px").css("top", "0px")
                }
            }
            xpos = _x;
            ypos = _y;
            if (!nopos) {
                sesupdate = 1
            }
            if (this.props.onposchange) {
                this.props.onposchange.apply(this.app, [this])
            }
        }
    },
    setTitle: function (t) {
        if (t != null) {
            this.title = t
        }
        if (!this.title) {
            this.title = ""
        }
        with(this) {
            if (!props.header) {
                return
            }
            var ts = width - decor.w,
                l;
            ts -= _countbuttonwidth();
            l = title.length;
            if (l * letsize > ts) {
                    l = Math.floor(ts / letsize) - 2
                }
            if (l < title.length) {
                    $(parts.htitle).attr("title", title).text(title.substr(0, l) + "...")
                } else {
                    $(parts.htitle).attr("title", "").text(title)
                }
            if (ontaskbar) {
                    desktop._onsetwindowtitle(this)
                }
        }
    },
    resizeTo: function (w, h, center, nopos) {
        with(this) {
            if (w < 0) {
                w = (-w) + decor.w
            }
            if (h < 0) {
                h = (-h) + decor.h
            }
            if (center && !props.attachobj) {
                var d = _uWnd.getdims();
                var _x = xpos,
                    _y = ypos;
                if (props.x == "auto") {
                        if (props.parent) {
                            _x = Math.floor((props.parent.width - w) / 2) + props.parent.xpos
                        } else {
                            if (desktop && !props.fixed) {
                                _x = Math.floor((desktop.calcwidth() - w) / 2) + desktop.calcexclude(0)
                            } else {
                                _x = Math.floor((d.clientW - w) / 2) + (props.fixed ? 0 : d.clientLeft)
                            }
                        }
                        if (_x < 0) {
                            _x = 0
                        }
                    }
                if (props.y == "auto") {
                        if (props.parent) {
                            _y = Math.floor((props.parent.height - h) / 2) + props.parent.ypos
                        } else {
                            if (desktop && !props.fixed) {
                                _y = Math.floor((desktop.calcheight() - h) / 2) + desktop.calcexclude(2)
                            } else {
                                _y = Math.floor((d.clientH - h) / 2) + (props.fixed ? 0 : d.clientTop)
                            }
                        }
                        if (_y < 0) {
                            _y = 0
                        }
                    }
                if (_x != xpos | _y != ypos) {
                        moveTo(_x, _y, 1)
                    }
            }
            $(wnd).css("width", w + "px");
            $(parts.wndcont).css("width", (w - decor.w) + "px");
            $(parts.hwndcont).css("height", (h - decor.h) + "px");
            if (parts.markwait) {
                $(parts.markwait).css({
                    height: (h - decor.h + footerh + headerh) + "px",
                    width: (w - decor.w) + "px"
                })
            }
            if (parts.actlayer) {
                $(parts.actlayer).css({
                    height: (h - decor.h) + "px",
                    width: (w - decor.w) + "px"
                })
            }
            if (parts.markdis) {
                $(parts.markdis).css("width", w + "px").css("height", h + "px")
            }
            if (menu) {
                $(parts.menu).css("width", (w - decor.w) + "px")
            }
            if (tabctrl) {
                tabctrl.resizeTo(w - decor.w, h - decor.h)
            }
            if (frame) {
                $(frame).css("width", w + "px").css("height", h + "px")
            }
            width = w;
            height = h;
            if (props.attachobj) {
                attachTo(props.attachobj, props.attachtype, props.attachdx, props.attachdy)
            }
            if (!nopos && !this.state.maximized && !this.state.minimized) {
                sesupdate = 1
            }
            if (this.props.onposchange && !this.state.maximized && !this.state.minimized) {
                this.props.onposchange.apply(this.app, [this])
            }
            _resizeSh();
            showattachicon();
            setTitle()
        }
    },
    _onresize: function (a) {
        if (this.state.maximized) {
            if (this.desktop && !this.props.fixed) {
                this.moveTo(this.desktop.calcexclude(0), this.desktop.calcexclude(2), 1);
                this.resizeTo(this.desktop.calcwidth(), this.desktop.calcheight(), 0, 1)
            } else {
                this.resizeTo(a.clientW, a.clientH)
            }
        }
        if (this.grid) {
            $(this.grid).css("width", a.clientW + "px").css("height", a.clientH + "px")
        }
    },
    _resizeSh: function () {
        if (this.sh) {
            this.design.shadow_resize(this.sh, Math.abs(this.width), Math.abs(this.height))
        }
    },
    hideSh: function () {
        if (this.sh) {
            this.design.shadow_hide(this.sh)
        }
    },
    showSh: function () {
        if (this.sh && !this.state.noshadow) {
            this.design.shadow_show(this.sh)
        }
    },
    shadow_init: function () {
        this.sh = this.design.shadow_init(this.top)
    },
    showcustombutton: function (a, b) {
        if (!this.props.customButtons[a]) {
            return
        }
        this.props.customButtons[a][0] = b;
        if (!this.parts.custom[a]) {
            return
        }
        if (!b) {
            $(this.parts.custom[a]).css("display", "none")
        } else {
            $(this.parts.custom[a]).css("display", "block")
        }
    },
    init: function (menuitems) {
        var p = this.props,
            t = document.createElement("div"),
            w;
        t.id = "_uwndTop" + this.idx;
        t._uwndobj = this;
        if (!this.desktop) {
                $($("body")[0]).prepend(t)
            } else {
                this.desktop.dsk.appendChild(t)
            }
        this.top = t;
        if (!p.fixed || ($.browser.msie && parseFloat($.browser.version) <= 8)) {
                $(t).css("position", "absolute")
            } else {
                $(t).css("position", "fixed")
            }
        $(t).css("visibility", "hidden").css({
                display: "block",
                zIndex: this.zpos,
                overflow: "visible"
            });
        if (p.modal && !p.parent) {
                var g = document.createElement("div"),
                    d = _uWnd.getdims();
                $(g).addClass("myWinGrid").css("width", d.clientW + "px").css("height", d.clientH + "px").css("z-index", this.zpos - 1).hide().bind("mousedown", function (e) {
                        e.stopPropagation();
                        e.preventDefault();
                        _uWnd.globalmousedown()
                    });
                if ($.browser.msie && parseFloat($.browser.version) <= 8) {
                        $(g).css("position", "absolute")
                    } else {
                        $(g).css("position", "fixed")
                    }
                if (!this.desktop) {
                        $($("body")[0]).prepend(g)
                    } else {
                        this.desktop.dsk.appendChild(g)
                    }
                this.grid = g
            }
        if ($.browser.msie && parseFloat($.browser.version) < 7) {
                this.frame = document.createElement("iframe");
                with(this.frame.style) {
                    filter = "Alpha(Opacity='0')";
                    display = "block";
                    position = "absolute";
                    borderWidth = 0;
                    width = Math.abs(this.width) + "px";
                    height = Math.abs(this.height) + "px"
                }
                t.appendChild(this.frame)
            }
        if (p.shadow && !($.browser.msie && parseFloat($.browser.version) < 7)) {
                this.shadow_init();
                this._resizeSh()
            }
        this.moveTo(0, 0, 1);
        w = document.createElement("div");
        w.id = "_uwndWnd" + this.idx;
        t.appendChild(w);
        this.wnd = w;
        $(w).css({
                position: "absolute",
                width: Math.abs(this.width) + "px",
                zIndex: 2,
                left: 0,
                overflow: "visible"
            });
        if (!_uWnd._activateonmousedown) {
                _uWnd._activateonmousedown = function (e) {
                    e.stopPropagation();
                    e.data.activate(e);
                    if (e.data.props.popup) {
                        _uWnd.ignoreclick = e.data
                    }
                    _uWnd.globalmousedown()
                }
            }
        this.parts = this.design.wnd_init(this, w, this.title, p.align, 60, p.header, p.icon, p.resize, p.havemenu);
        if (!_uWnd._onbuttonclose) {
                _uWnd._onbuttonclose = function (e) {
                    e.data.activate(e);
                    e.data.closeevent()
                }
            }
        if (!_uWnd._onbuttonhide) {
                _uWnd._onbuttonhide = function (e) {
                    e.data.hide()
                }
            }
        if (p.header) {
                var bb = {
                    cbut: "xt-close",
                    mbut: "xt-mini",
                    xbut: "xt-maxi",
                    rbut: "xt-rest"
                };
                if (!_uWnd._retfalse) {
                    _uWnd._retfalse = function (e) {
                        return false
                    }
                }
                if (!_uWnd._onclickcustom) {
                    _uWnd._onclickcustom = function (e) {
                        var d = e.data;
                        d.wnd.activate(e);
                        d.func.call(d.thispar, d.wnd, d.param)
                    }
                }
                if (!_uWnd._onbuttonmin) {
                    _uWnd._onbuttonmin = function (e) {
                        e.data.activate(e);
                        e.data.minimize()
                    }
                }
                if (!_uWnd._onbuttonmax) {
                    _uWnd._onbuttonmax = function (e) {
                        e.data.activate(e);
                        e.data.maximize()
                    }
                }
                if (!_uWnd._onbuttonrest) {
                    _uWnd._onbuttonrest = function (e) {
                        e.data.activate(e);
                        e.data.restore()
                    }
                }
                for (var i in bb) {
                    $(this.parts[i]).bind("dblclick", _uWnd._retfalse).bind("mouseover", {
                        cls: bb[i],
                        state: 1
                    }, this.design.onbuttonover).bind("mouseout", {
                        cls: bb[i],
                        state: 0
                    }, this.design.onbuttonover).bind("mousedown", this, _uWnd._activateonmousedown)
                }
                for (var i in p.customButtons) {
                    $(this.parts.custom[i]).bind("dblclick", _uWnd._retfalse).bind("mouseover", {
                        cls: "xt-" + i,
                        state: 1
                    }, this.design.onbuttonover).bind("mouseout", {
                        cls: "xt-" + i,
                        state: 0
                    }, this.design.onbuttonover).bind("mousedown", this, _uWnd._activateonmousedown);
                    if (!p.customButtons[i][0]) {
                        $(this.parts.custom[i]).css("display", "none")
                    }
                    if (p.customButtons[i][1]) {
                        $(this.parts.custom[i]).bind("click", {
                            wnd: this,
                            func: p.customButtons[i][1],
                            thispar: p.customButtons[i][2],
                            param: (p.customButtons[i][3] || i)
                        }, _uWnd._onclickcustom)
                    }
                }
                if (!p.close) {
                    $(this.parts.cbut).css("display", "none")
                }
                $(this.parts.cbut).bind("click", this, _uWnd._onbuttonclose);
                if (!p.min) {
                    $(this.parts.mbut).css("display", "none")
                }
                $(this.parts.mbut).bind("click", this, _uWnd._onbuttonmin);
                if (!p.max) {
                    $(this.parts.xbut).css("display", "none")
                }
                $(this.parts.xbut).bind("click", this, _uWnd._onbuttonmax);
                $(this.parts.rbut).css("display", "none").bind("click", this, _uWnd._onbuttonrest);
                if (p.close && !p.min && !p.max && this.design.altcloseclass) {
                    $(this.parts.cbut).addClass(this.design.altcloseclass)
                }
                if (!_uWnd._onclicktodrag) {
                    _uWnd._onclicktodrag = function (e) {
                        e.stopPropagation();
                        e.data.activate(e);
                        if (e.data.props.popup) {
                            _uWnd.ignoreclick = e.data
                        }
                        _uWnd.globalmousedown();
                        return e.data._ondragmousedown(e)
                    }
                }
                if (!_uWnd._ondclicktomax) {
                    _uWnd._ondclicktomax = function (e) {
                        var a = e.data;
                        if ((a.state.maximized && a.props.max) || a.state.minimized) {
                            a.restore()
                        } else {
                            a.maximize()
                        }
                    }
                }
                if (!p.nomove) {
                    $(this.parts.hdr).addClass("xw-draggable")
                }
                $(this.parts.hdr).add(this.parts.htitle).bind("mousedown", this, _uWnd._onclicktodrag);
                if (p.max || p.min) {
                    $(this.parts.hdr).bind("dblclick", this, _uWnd._ondclicktomax)
                }
            }
        if (this.parts.attachicon && p.attachiconact) {
                $(this.parts.attachicon).bind("click", this, p.attachiconact == "hide" ? _uWnd._onbuttonhide : _uWnd._onbuttonclose)
            }
        var rs = this.design.get_szbuts(w);
        if (!_uWnd._onresizebuttondown) {
                _uWnd._onresizebuttondown = function (e) {
                    e.stopPropagation();
                    e.data.w.activate(e);
                    if (e.data.w.props.popup) {
                        _uWnd.ignoreclick = e.data.w
                    }
                    _uWnd.globalmousedown();
                    return e.data.w._onrsmousedown(e, e.data.tp)
                }
            }
        for (var i in rs) {
                $(rs[i]).bind("mousedown", {
                    w: this,
                    tp: i
                }, _uWnd._onresizebuttondown)
            }
        $(w).bind("mousedown", this, _uWnd._activateonmousedown);
        if (p.havemenu) {
                var mopts = $.extend({
                    parentnode: this.parts.menu,
                    wnd: this,
                    noabs: 1,
                    horiz: 1,
                    statical: 1,
                    width: "auto"
                }, p.menuopts || {});
                this.menu = new _uMENU("", {}, mopts, menuitems, true)
            }
        if (typeof this._content == "object" && this._content.constructor == _uTabCtrl) {
                this.tabctrl = this._content;
                this.tabctrl.props.parentnode = this.parts.wndcont;
                this.tabctrl.wnd = this;
                this.tabctrl.init(true)
            } else {
                this.tabctrl = null
            }
        if (p.trayicon && this.desktop) {
                var to = {};
                if (p.trayicon.contructor == String) {
                    to.img = p.trayicon
                } else {
                    if (p.trayicon.contructor != Object) {
                        if (p.icon) {
                            to.img = p.icon
                        }
                    }
                }
                if (to.img) {
                    if (!p.trayicon.thisobj) {
                        to.thisobj = this;
                        if (!p.trayicon.ondown) {
                            to.ondown = this.ontrayicondown
                        }
                        if (!p.trayicon.onrdown) {
                            to.onrdown = this.ontrayiconrdown
                        }
                        to.param = p.trayicon.param
                    } else {
                        $.extend(to, p.trayicon)
                    }
                    if (!to.title) {
                        to.title = this.title || ""
                    }
                    this.trayicon = this.desktop.addTrayIcon(to.img, to.title, to.thisobj, to.ondown, to.onclick, to.onrdown, to.param);
                    if (p.traymenu) {
                        this.traymenu = new _uMENU("", {
                            align: "U"
                        }, {
                            hidden: 1
                        }, p.traymenu)
                    }
                }
            }
        if (!p.hidden) {
                this.show(false)
            }
        if (this.desktop && !p.popup && !p.alert && p.header && !p.notaskbar) {
                this.ontaskbar = true;
                this.desktop._addwindow(this)
            } else {
                this.ontaskbar = false
            }
        if (p.modal && p.parent) {
                p.parent.disable(1)
            }
        if (this.props.parent) {
                this.props.parent._onnewchild(this)
            }
        this.activate();
        if (p.header || this.menu) {
                setTimeout("var w=_uWnd.all[" + this.idx + "];if(w)w.init1();", 10)
            } else {
                setTimeout("var w=_uWnd.all[" + this.idx + "];if(w)w.init2();", 10)
            }
    },
    init1: function () {
        if (this.props.header) {
            if (!this.title) {
                this.letsize = 8
            } else {
                with(this) {
                    if (title.length == 0) {
                        letsize = 8
                    } else {
                        letsize = parts.htitle.offsetWidth / title.length
                    }
                    parts.htitle.innerHTML = "..."
                }
            }
        }
        if (this.menu) {
            this.menu.init1(true)
        }
        setTimeout("var w=_uWnd.all[" + this.idx + "];if(w)w.init2();", 10)
    },
    init2: function () {
        with(this) {
            decor.sbw = parts.hwndcont.offsetWidth - parts.hwndcont.clientWidth;
            decor.sbh = parts.hwndcont.offsetHeight - parts.hwndcont.clientHeight;
            decor.w = Math.abs(width) - _uWnd.csize(parts.wndcont, "width") - decor.sbw;
            decor.h = wnd.offsetHeight - 60;
            decor.th = parts.upper.offsetHeight;
            parts.hwndcont.style.overflow = "hidden";
            if (tabctrl) {
                tabctrl.init1(true)
            } else {
                if (parts.headercont) {
                    parts.headercont.style.visibility = "hidden"
                }
                if (parts.footercont) {
                    parts.footercont.style.visibility = "hidden"
                }
            }
            showattachicon(props.attachicontype);
            if (props.session) {
                resizeTo(props.session.w + decor.w, props.session.h + decor.h, 0, 1)
            } else {
                resizeTo(width, height, 0, 1)
            }
            if (!props.attachobj) {
                moveTo(props.x, props.y, 1)
            }
            if (menu) {
                menu._setsize()
            }
            state.init = true;
            var rel = pend_show ? pend_show[0] : false;
            if (props.oninit) {
                if (!props.oninit.call(app, this, name)) {
                    rel = false
                }
            }
            $(top).css("display", "none").css("visibility", "");
            var s = props.session;
            s = (s && s.s) || props.initstate;
            if (s == "min") {
                minimize(1);
                state.beforemin = (s && s.bm) || "";
                if (!props.max && props.initstate == "max") {
                    state.beforemin = "max"
                }
            } else {
                if (s == "max") {
                    maximize(0, 1)
                } else {
                    if (pend_show) {
                        show(rel, pend_show[1], pend_show[2])
                    }
                }
            }
            sesupdate = 0
        }
    },
    disable: function (a, d) {
        var e;
        if (!d) {
            if (a) {
                if (!this.state.disabled) {
                    for (var b = 0; b < this.childs.length; b++) {
                        e = this.childs[b];
                        if (!e || e.state.destroyed || e.props.alert) {
                            continue
                        }
                        e.state.prevdisabled = e.state.disabled;
                        e.disable(1)
                    }
                }
                this.state.disabled = true
            } else {
                if (this.state.disabled) {
                    for (var b = 0; b < this.childs.length; b++) {
                        e = this.childs[b];
                        if (!e || e.state.destroyed || e.props.alert || typeof e.state.prevdisabled == "undefined") {
                            continue
                        }
                        e.disable(e.state.prevdisabled)
                    }
                }
                this.state.disabled = false
            }
        }
        this.design.ondisable(this, a)
    },
    _onkeypress: function (c, a, b) {
        if (!this.state.disabled && this.state.visible && !this.props.toolwindow) {
            if (c.keyCode == 115 && c.ctrlKey && c.shiftKey) {
                c.preventDefault();
                return
            }
        }
    },
    _onkeydown: function (c, a, b) {
        if (!this.state.disabled && this.state.visible && !this.props.toolwindow) {
            if ((c.keyCode == 115 && c.ctrlKey && c.shiftKey) || (c.keyCode == 27 && this.props.closeonesc)) {
                if (this.props.close) {
                    this.closeevent()
                }
                return 1
            }
            if (this.menu && (c.keyCode == 17 || c.keyCode == 18) && c.ctrlKey && c.altKey && b.owner.constructor != _uMENU) {
                if (this.props.popup) {
                    _uWnd.ignoreclick = this
                }
                _uWnd.globalmousedown();
                this.menu.show(null, 0);
                this.menu._focus.activate();
                c.preventDefault();
                c.stopPropagation();
                return 1
            }
            if (this.props.header && this.parts.hdr && c.keyCode == 32 && c.ctrlKey && !this.state.resizing) {
                var d = $(this.parts.hdr).offset();
                this.showsysmenu(d.left, d.top + this.parts.hdr.offsetHeight);
                c.preventDefault();
                c.stopPropagation();
                return 1
            }
        }
    },
    _ondeactivate: function (a, b, c) {
        if (this.props.toolwindow) {
            var d = this.props.parent;
            while (d && d.props.toolwindow) {
                d = d.props.parent
            }
            if (d && d._focus.isparentof(c)) {
                return
            }
        }
        this.state.focused = 0;
        this.design.onfocus(this, 0);
        if (this.props.ondeactivate) {
            this.props.ondeactivate.apply(this.app, [this])
        }
        if (!this.props.toolwindow) {
            this._foreachchild(function (e) {
                if (!e.props.toolwindow) {
                    return 1
                }
                e.state.focused = 0;
                e.design.onfocus(e, 0)
            }, 0)
        }
    },
    _canactivate: function (b, a, c) {
        if (this.props.alert || this.state.minimized) {
            return 0
        }
        return 1
    },
    activate: function (b, a) {
        if (this.menu && !a && this.menu._focus.isactive()) {
            this.menu._focus.deactivate()
        }
        if (this.props.alert) {
            return
        }
        if (this.props.modal && this.props.parent) {
            this.props.parent.setforeground()
        }
        return this._focus.activate()
    },
    _onactivate: function (b, a, e) {
        if (e != this._focus) {
            return
        }
        if (!this.state.disabled) {
            this.state.focused = 1;
            this.design.onfocus(this, 1);
            if (this.props.onactivate) {
                this.props.onactivate.apply(this.app, [this])
            }
            if (!this.props.toolwindow) {
                this._foreachchild(function (g) {
                    if (!g.props.toolwindow) {
                        return 1
                    }
                    g.state.focused = 1;
                    g.design.onfocus(g, 1)
                }, 0)
            }
        } else {
            var f;
            for (var d = 0; d < this.childs.length; d++) {
                f = this.childs[d];
                if (!f || f.state.destroyed || f.state.disabled || f.props.alert) {
                    continue
                }
                this.setforeground();
                f.activate();
                return -1
            }
            return
        }
        this.setforeground()
    },
    setforeground: function () {
        if ((this.props.modal && !this.props.parent) || this.props.alert) {
            if (this.zpos + this.nchilds * _uWnd.zstep != _uWnd.lastmodalz) {
                this.setZ(_uWnd.getModalTopZ(this.nchilds))
            }
        } else {
            if (this.zpos + this.nchilds * _uWnd.zstep != _uWnd.lastz) {
                this.setZ(_uWnd.getTopZ(this.nchilds))
            }
        }
    },
    ontrayicondown: function (b, a, c) {
        if (!this.state.visible && !this.state.minimized) {
            if (b) {
                this.show(false)
            } else {
                this.show(false, 0, 0)
            }
        } else {
            if (this.state.minimized) {
                if (this.state.beforemin == "max") {
                    this.maximize(1)
                } else {
                    this.restore(1)
                }
            } else {
                if (this.props.min && !this.props.notaskbar) {
                    this.minimize()
                } else {
                    if (b) {
                        this.hide()
                    } else {
                        this.hide(0, 0)
                    }
                }
            }
        }
    },
    ontrayiconrdown: function (a, b, c) {
        if (!this.traymenu) {
            return
        }
        this.traymenu.show({
            pos: {
                x: c.pageX,
                y: c.pageY
            }
        });
        _uMENU.ignoreclick = this.traymenu
    },
    show: function (rel, fadetp, fadesp) {
        if (arguments.length < 2 || fadetp == undefined) {
            fadetp = this.props.fadetype
        }
        if (arguments.length < 3 || fadesp == undefined) {
            fadesp = this.props.fadespeed
        }
        if (!_uWnd._onshowanimend) {
            _uWnd._onshowanimend = function () {
                var w = _uWnd.findparent(this);
                if (!w) {
                    return
                }
                w.disable(w.state.disabled, 1);
                w.showSh()
            }
        }
        with(this) {
            if (!state.init) {
                pend_show = [rel, fadetp, fadesp];
                return
            }
            if (state.visible) {
                return
            }
            state.visible = true;
            if (grid) {
                $(grid).show()
            }
            if (fadetp == 1) {
                disable(1, 1);
                if ($.browser.safari) {
                    hideSh()
                }
                if ($.browser.msie) {
                    hideSh();
                    $(wnd).hide();
                    $(top).show();
                    $(wnd).css("opacity", "0").show().animate({
                        opacity: 1
                    }, {
                        duration: fadesp,
                        complete: _uWnd._onshowanimend
                    })
                } else {
                    $(top).fadeIn(fadesp, _uWnd._onshowanimend)
                }
            } else {
                if (fadetp == 2) {
                    disable(1, 1);
                    var endy = parseInt($(top).css("top"));
                    $(top).css("top", (endy + (height > 100 ? 100 : height)) + "px");
                    if ($.browser.msie) {
                        hideSh();
                        $(wnd).hide();
                        $(top).show().animate({
                            top: endy + "px"
                        }, {
                            duration: fadesp,
                            complete: _uWnd._onshowanimend
                        });
                        $(wnd).css("opacity", "0").show().animate({
                            opacity: 1
                        }, fadesp)
                    } else {
                        $(top).css("opacity", "0").show().animate({
                            top: endy + "px",
                            opacity: 1
                        }, {
                            duration: fadesp,
                            complete: _uWnd._onshowanimend
                        })
                    }
                } else {
                    if (props.nohide) {
                        $(top).css({
                            visibility: ""
                        })
                    }
                    $(top).show();
                    disable(state.disabled)
                }
            }
            if (!state.loaded || rel) {
                load()
            }
        }
    },
    hide: function (fadetp, fadesp, doclose) {
        if (arguments.length < 1 || fadetp == undefined) {
            fadetp = this.props.fadeclosetype
        }
        if (arguments.length < 2 || fadesp == undefined) {
            fadesp = this.props.fadeclosespeed
        }
        if (!_uWnd._onhideanimendcl) {
            _uWnd._onhideanimendcl = function () {
                var w = _uWnd.findparent(this);
                if (!w) {
                    return
                }
                w.close(1)
            }
        }
        with(this) {
            if (!state.visible) {
                return 0
            }
            state.visible = false;
            if (fadetp == 1) {
                disable(1, doclose ? 0 : 1);
                if ($.browser.msie) {
                    hideSh();
                    $(wnd).animate({
                        opacity: 0
                    }, {
                        duration: fadesp,
                        complete: doclose ? _uWnd._onhideanimendcl : null
                    })
                } else {
                    $(top).animate({
                        opacity: 0
                    }, {
                        duration: fadesp,
                        complete: doclose ? _uWnd._onhideanimendcl : null
                    })
                }
            } else {
                if (fadetp == 2) {
                    disable(1, doclose ? 0 : 1);
                    var endy = parseInt($(top).css("top")) + (height > 100 ? 100 : height);
                    if ($.browser.msie) {
                        hideSh();
                        $(top).animate({
                            top: endy + "px"
                        }, {
                            duration: fadesp,
                            complete: doclose ? _uWnd._onhideanimendcl : null
                        });
                        $(wnd).animate({
                            opacity: 0
                        }, fadesp)
                    } else {
                        $(top).animate({
                            top: endy + "px",
                            opacity: 0
                        }, {
                            duration: fadesp,
                            complete: doclose ? _uWnd._onhideanimendcl : null
                        })
                    }
                } else {
                    if (props.nohide) {
                        $(top).css({
                            visibility: "hidden"
                        })
                    } else {
                        $(top).hide()
                    }
                    doclose = false
                }
            }
            if (grid) {
                $(grid).hide()
            }
            if (_focus.isactive()) {
                _focus.deactivate();
                _uWnd.activatetopwnd(this.desktop)
            }
        }
        if (doclose) {
            return 1
        }
        return 0
    },
    markload: function () {
        with(this) {
            parts.wndcont.style.display = "none";
            parts.markload.style.display = "block";
            if (parts.headercont && props.hideheader) {
                parts.headercont.style.visibility = "hidden"
            }
            if (parts.footercont && props.hidefooter) {
                parts.footercont.style.visibility = "hidden"
            }
        }
    },
    showgrid: function () {
        if (this.parts.markwait) {
            this.parts.markwait.style.display = "block"
        }
    },
    hidegrid: function () {
        if (this.parts.markwait) {
            this.parts.markwait.style.display = "none"
        }
    },
    reload: function (b) {
        if (typeof b == "object" && b.constructor == _uTabCtrl) {
            if (this.tabctrl != b) {
                if (b.state.init && b.state.wnd != this) {
                    return
                }
                this.tabctrl = b;
                b.props.parentnode = this.parts.wndcont;
                b.wnd = this;
                if (!b.state.init) {
                    b.init(true);
                    setTimeout("var w=_uWnd.all[" + this.idx + "];if(w && w.tabctrl){w.tabctrl.init1(true);this.resizeTo(w.width,w.height,0,1);}", 10)
                } else {
                    var a = this.parts.wndcont;
                    while (a.firstChild) {
                        a.removeChild(a.firstChild)
                    }
                    a.appendChild(b.top)
                }
            }
        } else {
            if (this.tabctrl) {
                if (!this.props.notabdestroy) {
                    this.tabctrl.destroy()
                } else {
                    this.parts.wndcont.removeChild(this.tabctrl.top);
                    this.tabctrl.parentnode = null;
                    this.tabctrl.wnd = null
                }
            }
            this.tabctrl = null
        }
        this._content = b;
        this.state.loaded = false;
        this.load();
        if (!this.props.hidden && !this.state.visible) {
            this.show(false)
        }
    },
    load: function () {
        if (this.tabctrl) {
            return
        }
        var b = this._content;
        if (typeof(b) == "string") {
            this.content(b)
        } else {
            if (typeof b == "function") {
                this.content(b.apply(this.app, [this]))
            } else {
                if (typeof b == "object") {
                    this.markload();
                    if (!b.data) {
                        b.data = {}
                    }
                    if (!("_wi" in b.data)) {
                        b.data._wi = this.idx
                    }
                    if (this.app && !("_ai" in b.data)) {
                        b.data._ai = this.app.pid
                    }
                    if (this.app && !("app" in b)) {
                        b.app = this.app.pid
                    }
                    if (!("wnd" in b)) {
                        b.wnd = this.idx
                    }
                    if (!b.success && b.xml === false) {
                        b.dataType = "text";
                        b.success = new Function("data", "st", "var w=_uWnd.all[" + this.idx + "];if(w)w.content(data);")
                    } else {
                        if (!b.success && b.xml !== false) {
                            b.success = new Function("data", "st", "var w=_uWnd.all[" + this.idx + "];_uParseXML(data,w,0,w && w.app);")
                        }
                    }
                    if (!b.error) {
                        b.error = new Function("xml", "st", "er", "var w=_uWnd.all[" + this.idx + "];if(w)w._onerror(xml,st,er);")
                    }
                    try {
                        if (b.form && b.form.length > 0) {
                            _uPostForm(b.form, b)
                        } else {
                            if (b.url) {
                                _uAjaxRequest(b.url, b)
                            }
                        }
                    } catch (a) {
                        this._onerror(null, "", a)
                    }
                }
            }
        }
    },
    _onerror: function (b, a, d) {
        var c = this.props.onerror;
        if (c && typeof(c) == "function") {
            c.apply(this, arguments)
        } else {
            this.close()
        }
    },
    header: function (a) {
        var b = this.parts.headercont;
        if (!b) {
            return
        }
        if (a) {
            $(b).html(a)
        } else {
            $(b).html("")
        }
    },
    footer: function (a) {
        var b = this.parts.footercont;
        if (!b) {
            return
        }
        if (a) {
            $(b).html(a)
        } else {
            $(b).html("")
        }
    },
    headerheight: function (a) {
        if (!this.parts.headercont || typeof(a) != "number" || isNaN(a)) {
            return
        }
        var b = this.headerh;
        if (b == a) {
            return
        }
        this.decor.h += a - b;
        this.headerh = a;
        $(this.parts.headercont).css("height", (a) + "px");
        this.resizeTo(this.width, this.height + (this.props.contentsizeprio ? a - b : 0))
    },
    footerheight: function (a) {
        if (!this.parts.footercont || typeof(a) != "number" || isNaN(a)) {
            return
        }
        var b = this.footerh;
        if (b == a) {
            return
        }
        this.decor.h += a - b;
        this.footerh = a;
        $(this.parts.footercont).css("height", (a) + "px");
        this.resizeTo(this.width, this.height + (this.props.contentsizeprio ? a - b : 0))
    },
    _checkimgload: function (load) {
        var im = this.imgloader;
        var i;
        if (!im.active) {
            return
        }
        if (load) {
            im.count++
        }
        if (im.images) {
            for (i = 0; i < im.images.length; i++) {
                if (!im.images[i].complete) {
                    break
                }
            }
        }
        if (i >= im.images.length) {
            this._stopimgload(true);
            return
        }
        if (im.count >= im.images.length) {
            if (im.timer) {
                clearTimeout(im.timer)
            }
            im.timer = setTimeout("var w=_uWnd.all[" + this.idx + "];if(w){w.imgloader.timer=null;w._checkimgload();}", 100)
        }
        if ($.browser.opera && im.images2) {
            for (i = 0; i < im.images2.length; i++) {
                if (!im.images2[i].complete) {
                    return
                }
            }
            $(im.images2).unbind();
            im.images2 = null;
            with(this) {
                parts.hwndcont.style.visibility = "hidden";
                parts.markload.style.display = "none";
                $(parts.wndcont).css("display", "block");
                if (parts.headercont) {
                    parts.headercont.style.visibility = ""
                }
                if (parts.footercont) {
                    parts.footercont.style.visibility = ""
                }
            }
        }
    },
    _stopimgload: function (start) {
        var im = this.imgloader;
        if (im.active) {
            im.active = false;
            if (im.stoptimer) {
                clearTimeout(im.stoptimer);
                im.stoptimer = null
            }
            if (im.timer) {
                clearTimeout(im.timer);
                im.timer = null
            }
            if (im.images) {
                im.images.unbind();
                im.images = null
            }
            if (im.images2) {
                $(im.images2).unbind();
                im.images2 = null
            }
            if (start) {
                with(this) {
                    if (props.hideonresize) {
                        parts.hwndcont.style.visibility = "hidden"
                    }
                    parts.markload.style.display = "none";
                    $(parts.wndcont).css("display", "block");
                    if (parts.headercont) {
                        parts.headercont.style.visibility = ""
                    }
                    if (parts.footercont) {
                        parts.footercont.style.visibility = ""
                    }
                    autosz.load = true;
                    delaychecksize()
                }
            }
        }
    },
    find: function (b) {
        var a = $(this.parts.headercont);
        if (this.parts.headercont) {
            a = a.add(this.parts.headercont)
        }
        if (this.parts.footercont) {
            a = a.add(this.parts.footercont)
        }
        return a.find(b)
    },
    content: function (m) {
        this._stopimgload();
        this.stopautosize();
        var e = this.autosz,
            d = this.parts.wndcont,
            l = this.props,
            b = this.imgloader,
            k = this.parts.footercont,
            j = this.parts.headercont;
        this.state.loaded = true;
        if (l.autosize && l.waitimages > 0) {
                this.markload();
                $(d).html(m);
                if (this.props.oncontent) {
                    this.props.oncontent.apply(this.app, [this, d])
                }
                b.active = true;
                b.stoptimer = setTimeout("var w=_uWnd.all[" + this.idx + "];if(w)w._stopimgload(true);", l.waitimages);
                if (!_uWnd.waitimagesfunc) {
                    _uWnd.waitimagesfunc = function (c) {
                        var a = c.data.imgloader;
                        if (a.timer) {
                            clearTimeout(a.timer)
                        }
                        a.timer = setTimeout("var w=_uWnd.all[" + c.data.idx + "];if(w){w.imgloader.timer=null;w._checkimgload(1);}", 10)
                    }
                }
                b.count = 0;
                b.images = $(d).find("img").bind("error", this, _uWnd.waitimagesfunc).bind("load", this, _uWnd.waitimagesfunc);
                if ($.browser.opera && b.images.length > 0) {
                    b.images2 = [];
                    for (var g = 0; g < b.images.length; g++) {
                        b.images2[g] = $("<img>").attr("src", b.images[g].src).bind("load", this, _uWnd.waitimagesfunc)[0]
                    }
                }
                this._checkimgload()
            } else {
                if (l.autosize && l.hideonresize) {
                    this.parts.hwndcont.style.visibility = "hidden"
                }
                this.parts.markload.style.display = "none";
                $(d).css("display", "block").html(m);
                if (j) {
                    j.style.visibility = ""
                }
                if (k) {
                    k.style.visibility = ""
                }
                e.load = true;
                if (l.autosize) {
                    if (this.props.oncontent) {
                        this.props.oncontent.apply(this.app, [this, d])
                    }
                    this.delaychecksize()
                } else {
                    this.design.onstopautosz(this);
                    if (this.props.oncontent) {
                        this.props.oncontent.apply(this.app, [this, d])
                    }
                }
            }
    },
    onexternalload: function () {
        with(this) {
            _stopimgload();
            stopautosize();
            state.loaded = true;
            autosz.load = true;
            if (parts.headercont) {
                parts.headercont.style.visibility = ""
            }
            if (parts.footercont) {
                parts.footercont.style.visibility = ""
            }
            if (props.autosize) {
                delaychecksize()
            }
        }
    },
    stopautosize: function () {
        var b = this.autosz;
        if (b.inittimer) {
            clearTimeout(b.inittimer);
            b.inittimer = null
        }
        if (b.timer) {
            clearTimeout(b.timer);
            b.timer = null
        }
        if (b.images) {
            $(b.images).unbind();
            b.images = null
        }
        if (b.active) {
            this.design.onstopautosz(this)
        }
        b.active = false
    },
    delaychecksize: function (c) {
        c = c || 10;
        var b = this.autosz;
        if (b.inittimer) {
            clearTimeout(b.inittimer)
        }
        b.inittimer = setTimeout("var w=_uWnd.all[" + this.idx + "];if(w)w.checksize();", c)
    },
    _countbuttonwidth: function () {
        var a = 0;
        var b = {
            cbut: 1,
            mbut: 1,
            xbut: 1,
            rbut: 1,
            icon: 1
        };
        for (var c in b) {
            if (this.parts[c]) {
                a += this.parts[c].offsetWidth
            }
        }
        for (var c in this.props.customButtons) {
            a += this.parts.custom[c].offsetWidth + this.design.custButMargin
        }
        return a
    },
    checksize: function (k) {
        var i = this.autosz,
            j = this.parts.wndcont;
        i.inittimer = null;
        if (this.state.maximized || this.state.minimized) {
                return
            }
        this.stopdrag();
        this.stopresize();
        if (i.load) {
                i.load = false;
                if (i.images) {
                    $(i.images).unbind();
                    i.images = null
                }
                if (this.props.autosizeonimages) {
                    if (!_uWnd.autosizeonimagesfunc) {
                        _uWnd.autosizeonimagesfunc = function (a) {
                            a.data.delaychecksize()
                        }
                    }
                    i.images = $(j).find("img").bind("load", this, _uWnd.autosizeonimagesfunc)
                }
            }
        i.active = true;
        this.design.onstartautosz(this);
        if (i.timer) {
                clearTimeout(i.timer);
                i.timer = null
            }
        var f = _uWnd.getdims(),
            m = 10,
            e = 10,
            h, c;
        if (this.props.header) {
                m += this._countbuttonwidth()
            }
        m = Math.max(m, this.minwidth);
        e = Math.max(e, this.minheight);
        h = this.maxwidth;
        if (h == 0) {
                h = f.clientW - this.decor.w
            }
        c = this.maxheight;
        if (c == 0) {
                c = f.clientH - this.decor.h
            }
        var b, l;
        if (this.props.autosizewidth) {
                $(this.parts.wndcont).css("width", "10px");
                b = j.scrollWidth;
                $(this.parts.wndcont).css({
                    width: (this.width - this.decor.w) + "px"
                })
            } else {
                b = j.scrollWidth
            }
        l = j.scrollHeight + 1;
        i.tw = Math.max(b, m);
        i.th = Math.max(l, e);
        var g = false;
        if (i.tw > h) {
                i.tw = h;
                i.th += this.decor.sbh;
                g = true
            }
        if (i.th > c) {
                i.th = c;
                if (i.tw + this.decor.sbw <= h) {
                    i.tw += this.decor.sbw;
                    g = true
                } else {
                    i.tw = h
                }
            }
        if (g) {
                this.design.onstopautosz(this, true)
            }
        i.timer = setTimeout("try{_uWnd.all[" + this.idx + "]._checksize();}catch(e){}", 10)
    },
    _checksize: function () {
        this.stopdrag();
        this.stopresize();
        var c = this.autosz,
            d = c.tw - (this.width - this.decor.w),
            f = c.th - (this.height - this.decor.h),
            b = 10,
            e = 10;
        if (d != 0) {
                if (d > 0) {
                    b = Math.min(b, d)
                } else {
                    if (d < 0) {
                        b = Math.max(-b, d)
                    }
                }
                this.resizeTo(this.width + b, this.height, true, 1)
            } else {
                if (f != 0) {
                    if (f > 0) {
                        e = Math.min(e, f)
                    } else {
                        if (f < 0) {
                            e = Math.max(-e, f)
                        }
                    }
                    this.resizeTo(this.width, this.height + e, true, 1)
                } else {
                    c.timer = null;
                    c.active = false;
                    this.design.onstopautosz(this);
                    return
                }
            }
        c.timer = setTimeout("try{_uWnd.all[" + this.idx + "]._checksize();}catch(e){}", 10)
    },
    closeevent: function () {
        if (this.props.onbeforeclose) {
            if (this.props.onbeforeclose.apply(this.app, [this])) {
                return
            }
        }
        this.close()
    },
    close: function (f) {
        if (this.state.destroyed) {
            return
        }
        if (this.state.pendingdestroy) {
            f = 1
        }
        var e = 0;
        for (var d = 0; d < this.childs.length; d++) {
            var g = this.childs[d];
            if (!g) {
                continue
            }
            if (g.state.destroyed) {
                delete this.childs[d];
                continue
            }
            if (this.state.pendingdestroy) {
                e = 1;
                break
            }
            g.close();
            if (this.childs[d]) {
                e = 1
            }
        }
        this.state.pendingdestroy = true;
        if (this.props.modal && this.props.parent) {
            this.props.parent.disable(0)
        }
        if (!f && this.state.visible) {
            var b = this.hide(this.props.fadeclosetype, this.props.fadeclosespeed, true);
            if (b == 1) {
                return
            }
        }
        if (!e) {
            this._destroy()
        }
    },
    _destroy: function () {
        if (this.state.destroyed) {
            return
        }
        this._focus.destroy();
        if (this.desktop) {
            this.desktop._removewindow(this)
        }
        if (this.menu) {
            this.menu.destroy()
        }
        if (this.traymenu) {
            this.traymenu.destroy()
        }
        if (this.trayicon) {
            this.trayicon.remove()
        }
        this.top.parentNode.removeChild(this.top);
        if (this.grid) {
            this.grid.parentNode.removeChild(this.grid)
        }
        if (this.tabctrl && !this.props.notabdestroy) {
            this.tabctrl.destroy()
        }
        _uWnd.all[this.idx] = null;
        this.state.destroyed = true;
        this.state.visible = false;
        if (this.props.onclose) {
            this.props.onclose.apply(this.app, [this, this.idx])
        }
        if (this.props.parent) {
            this.props.parent._ondelchild(this)
        }
        if (this.app) {
            this.app._ondestroywnd(this)
        }
    },
    _onnewchild: function (a) {
        if (a) {
            this.childs.push(a)
        }
        var b = 0;
        this._foreachchild(function (d) {
            b++
        });
        this.nchilds = b;
        if (this.props.parent) {
            this.props.parent._onnewchild(null)
        }
    },
    _ondelchild: function (a) {
        var c = 0;
        for (var b = 0; b < this.childs.length; b++) {
            if (this.childs[b]) {
                if (this.childs[b] == a) {
                    delete this.childs[b];
                    a.props.parent = null;
                    if (!this.state.pendingdestroy) {
                        break
                    }
                } else {
                    c++
                }
            }
        }
        if (this.state.pendingdestroy && c == 0) {
            this._destroy()
        } else {
            this._onnewchild(null)
        }
    },
    minimize: function (frominit) {
        with(this) {
            if (autosz.active || (!props.min && !(frominit && props.initstate == "min")) || !props.header || props.modal || props.alert || props.popup) {
                return
            }
            state.beforemin = state.maximized ? "max" : "";
            stopdrag();
            stopresize();
            if (!state.maximized && !state.minimized) {
                restRect = [xpos, ypos, width, height, props.fixed]
            }
            if (!frominit) {
                sesupdate = 1
            }
            if (props.onposchange && !state.minimized) {
                props.onposchange.apply(app, [this])
            }
            state.maximized = false;
            state.minimized = true;
            this._foreachchild(function (w) {
                if (w.props.min) {
                    return 1
                }
                w.state.prevvisible = w.state.visible;
                w.hide(0)
            }, 0);
            if (!ontaskbar) {
                if (props.min) {
                    $(parts.mbut).css("display", "none");
                    $(parts.rbut).css("display", "block")
                }
                if (props.max) {
                    $(parts.xbut).css("display", "block")
                }
                $(wnd).removeClass("xw-resize");
                if (!props.fixed && !$.browser.msie) {
                    $(top).css("position", "fixed")
                }
                design.onminimize(this);
                props.fixed = true;
                if (desktop) {
                    moveTo(desktop.calcexclude(0), desktop.calcexclude(2), 1)
                } else {
                    moveTo(0, 0, 1)
                }
                resizeTo(200, 30, 0, 1);
                if (_focus.isactive()) {
                    _focus.deactivate();
                    if (!frominit) {
                        _uWnd.activatetopwnd(desktop)
                    }
                }
            } else {
                if (!frominit) {
                    hide(0);
                    if (!props.notaskbar) {
                        desktop._onwndminimize(this, xpos, ypos, width, height)
                    }
                }
            }
        }
    },
    maximize: function (act, frominit) {
        with(this) {
            if (autosz.active || (!props.max && !(frominit && props.initstate == "max") && !(state.minimized && state.beforemin == "max")) || !props.header) {
                return
            }
            stopdrag();
            stopresize();
            if (!state.maximized && !state.minimized) {
                restRect = [xpos, ypos, width, height, props.fixed]
            }
            if (!frominit) {
                sesupdate = 1
            }
            if (props.onposchange && !state.maximized) {
                props.onposchange.apply(app, [this])
            }
            $(parts.hdr).removeClass("xw-draggable");
            $(wnd).removeClass("xw-resize");
            if (props.max) {
                $(parts.xbut).css("display", "none");
                $(parts.rbut).css("display", "block")
            }
            if (props.min) {
                $(parts.mbut).css("display", "block")
            }
            if (!desktop && !props.fixed && !$.browser.msie) {
                $(top).css("position", "fixed")
            }
            hideSh();
            if (desktop && !props.fixed) {
                moveTo(desktop.calcexclude(0), desktop.calcexclude(2), 1);
                resizeTo(desktop.calcwidth(), desktop.calcheight(), 0, 1)
            } else {
                var d = _uWnd.getdims();
                props.fixed = true;
                moveTo(0, 0, 1);
                resizeTo(d.clientW, d.clientH, 0, 1)
            }
            if (state.minimized) {
                if (!ontaskbar) {
                    this.design.onrestore(this)
                } else {
                    show(false, 0)
                }
            } else {
                if (frominit) {
                    show(false, 0)
                }
            }
            state.maximized = true;
            state.minimized = false;
            _foreachchild(function (w) {
                if (w.props.min) {
                    return 1
                }
                if (w.state.prevvisible) {
                    w.show(0, 0)
                }
            }, 0);
            if (act) {
                activate()
            }
        }
    },
    restore: function (act) {
        with(this) {
            if (!props.header) {
                return
            }
            stopdrag();
            stopresize();
            if (this.props.onposchange && (state.minimized || state.maximized)) {
                props.onposchange.apply(app, [this])
            }
            $(parts.rbut).css("display", "none");
            if (props.max) {
                $(parts.xbut).css("display", "block")
            }
            if (state.minimized && props.min) {
                $(parts.mbut).css("display", "block")
            }
            if (!props.nomove) {
                $(parts.hdr).addClass("xw-draggable")
            }
            if (props.resize) {
                $(wnd).addClass("xw-resize")
            }
            if (state.minimized) {
                if (!ontaskbar) {
                    this.design.onrestore(this)
                } else {
                    show(false, 0)
                }
            }
            showSh();
            state.maximized = state.minimized = false;
            var r = restRect;
            if (r) {
                props.fixed = r[4];
                if (!props.fixed && !$.browser.msie) {
                    $(top).css("position", "absolute")
                }
                moveTo(r[0], r[1], 1);
                resizeTo(r[2], r[3], 0, 1)
            }
            _foreachchild(function (w) {
                if (w.props.min) {
                    return 1
                }
                if (w.state.prevvisible) {
                    w.show(0, 0)
                }
            }, 0);
            if (act) {
                activate()
            }
        }
    },
    _ondragmousemove: function (c, b, a, f) {
        var e = _uWnd.getdims();
        a += c;
        f += b;
        if (a + this.width < 30) {
            a = 30 - this.width
        }
        if (f < -5) {
            f = -5
        }
        if (this.desktop && !this.props.fixed) {
            if (a > this.desktop.width - 20) {
                a = this.desktop.width - 20
            }
            if (f > this.desktop.height - 20) {
                f = this.desktop.height - 20
            }
        } else {
            if (this.props.fixed) {
                if (a > e.clientW - 20) {
                    a = e.clientW - 20
                }
                if (f > e.clientH - 20) {
                    f = e.clientH - 20
                }
            } else {
                if (a > e.docW - 20) {
                    a = e.docW - 20
                }
                if (f > e.docH - 20) {
                    f = e.docH - 20
                }
            }
        }
        this.moveTo(a, f)
    },
    onstartdrag: function () {
        this.design.onstartdrag(this)
    },
    onstopdrag: function () {
        this.design.onstopdrag(this)
    },
    _ondragmousedown: function (e) {
        with(this) {
            if (e.which == 3 && typeof _uDesk == "undefined") {
                return
            }
            if (e.which == 1 && e.ctrlKey) {
                e.which = 3
            }
            if (e.which == 3 && !state.resizing && !state.disabled && !props.toolwindow) {
                this.showsysmenu(e.pageX, e.pageY);
                return
            }
            if (props.nomove || state.resizing || state.maximized || state.disabled || e.which != 1) {
                return
            }
            _drag.start(e, xpos, ypos);
            props.x = xpos;
            props.y = ypos
        }
    },
    stopdrag: function () {
        this._drag.stop()
    },
    _onrsmousemove: function (s, r, f, e, i, a, b) {
        var o, n, p, g, k = _uWnd.getdims(),
            q = 10,
            j = 10,
            l, c;
        o = f;
        n = e;
        p = i;
        g = a;
        if (this.props.header) {
                q += this._countbuttonwidth()
            }
        q = Math.max(q, this.minwidth) + this.decor.w;
        j = Math.max(j, this.minheight) + this.decor.h;
        l = this.maxwidth;
        if (l == 0) {
                l = k.clientW
            } else {
                l += this.decor.w
            }
        c = this.maxheight;
        if (c == 0) {
                c = k.clientH
            } else {
                c += this.decor.h
            }
        if (b.indexOf("n") >= 0) {
                n = e + r;
                if (n < 0) {
                    n = 0
                }
                g = e + a - n;
                if (g < j) {
                    g = j;
                    n = e + a - g
                } else {
                    if (g > c) {
                        g = c;
                        n = e + a - g
                    }
                }
            }
        if (b.indexOf("s") >= 0) {
                g = a + r;
                if (g < j) {
                    g = j
                } else {
                    if (g > c) {
                        g = c
                    }
                }
            }
        if (b.indexOf("w") >= 0) {
                o = f + s;
                if (o < 0) {
                    o = 0
                }
                p = f + i - o;
                if (p < q) {
                    p = q;
                    o = f + i - p
                } else {
                    if (p > l) {
                        p = l;
                        o = f + i - p
                    }
                }
            }
        if (b.indexOf("e") >= 0) {
                p = i + s;
                if (p < q) {
                    p = q
                } else {
                    if (p > l) {
                        p = l
                    }
                }
            }
        this.moveTo(o, n);
        this.resizeTo(p, g)
    },
    _onrsmousedown: function (e, b) {
        with(this) {
            if (_drag.active || state.disabled || state.maximized || state.minimized || autosz.active || !props.resize || e.which != 1) {
                return
            }
            props.x = xpos;
            props.y = ypos;
            this.stopautosize();
            _resize.start(e, xpos, ypos, width, height, b)
        }
    },
    onstartrs: function () {
        this.design.onstartresize(this)
    },
    onstoprs: function () {
        this.design.onstopresize(this)
    },
    stopresize: function () {
        this._resize.stop()
    }
};

function _txt(c) {
    var f = window._uDeflang,
        b, g = arguments;
    if (!f) {
            b = c
        } else {
            var e = window._uSigns;
            if (!e || !e[f]) {
                b = c
            } else {
                if (c in e[f]) {
                    b = e[f][c]
                } else {
                    b = c
                }
            }
        }
    function d(h, a) {
            return g[a]
        }
    if (g.length > 1) {
            b = b.replace(/%([1-9])/g, d)
        }
    return b
}
function _uColorBox(t, c) {
    var s = new Array("00", "33", "66", "99", "CC", "FF");
    var d = new Array("00", "33", "66", "99", "CC", "FF");
    var n = new Array("00", "33", "66", "99", "CC", "FF");
    var p = new Array("909090", "939393", "969696", "999999", "9C9C9C", "9F9F9F", "C0C0C0", "C3C3C3", "C6C6C6", "C9C9C9", "CCCCCC", "E0E0E0", "F0F0F0", "F3F3F3", "F6F6F6", "F9F9F9", "FCFCFC", "FFFFFF");
    var h = "00",
        r = "00",
        f = "00",
        b = "00";
    var g = 0,
        l = 0,
        a = 0;
    var m = 0,
        k = 0,
        j = 0;
    var u = 0;
    var o = '<table border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">';
    while (k < 6) {
            o += "<tr>";
            var m = 0;
            var f = n[a];
            while (m < 6) {
                var j = 0;
                var r = d[l];
                while (j < 6) {
                    var h = s[g];
                    var e = "" + h + r + f;
                    o += '<td style="width:8px;height:8px;cursor:pointer;background-color:#' + e + ';" onclick="$(\'#' + t + "').hide(); $('#" + c + "').val('" + e + '\');" bgcolor="' + e + '"></td>';
                    j++;
                    g++;
                    if (g == 6) {
                        g = 0
                    }
                }
                m++;
                l++;
                if (l == 6) {
                    l = 0
                }
                u++;
                if (u == 3) {
                    o += "</tr>";
                    u = 0
                }
            }
            k++;
            a++;
            if (a == 6) {
                a = 0
            }
        }
    for (var q = 0; q < p.length; q++) {
            o += '<td style="width:8px;height:8px;cursor:pointer;background-color:#' + p[q] + ';" onclick="$(\'#' + t + "').hide(); $('#" + c + "').val('" + p[q] + '\');" bgcolor="' + p[q] + '"></td>'
        }
    o += "</table>";
    $("#" + t).html(o)
}
function _uParseXML(xml, wnd, tabid, papp) {
    xml = xml.documentElement;
    var tabctrl = null,
        app = null,
        footers = {};
    if (wnd && wnd.constructor == _uTabCtrl) {
            tabctrl = wnd;
            wnd = null;
            app = papp || tabctrl.app
        } else {
            if (wnd && wnd.constructor == _uWnd) {
                app = papp || wnd.app
            } else {
                app = papp || null;
                wnd = null
            }
        }
    if (xml == null) {
            alert("Server connection Error. Sorry.")
        }
    for (var i = 0; i < xml.childNodes.length; i++) {
            if (xml.childNodes[i].nodeName == "cmd") {
                var cmd = "",
                    target = "",
                    data, height = null;
                for (var j = 0; j < xml.childNodes[i].attributes.length; j++) {
                        if (xml.childNodes[i].attributes[j].name == "h") {
                            height = parseInt(xml.childNodes[i].attributes[j].value)
                        }
                        if (xml.childNodes[i].attributes[j].name == "p") {
                            cmd = xml.childNodes[i].attributes[j].value
                        }
                        if (xml.childNodes[i].attributes[j].name == "t") {
                            target = xml.childNodes[i].attributes[j].value
                        }
                    }
                if (xml.childNodes[i].firstChild && xml.childNodes[i].firstChild.data) {
                        data = xml.childNodes[i].firstChild.data
                    } else {
                        data = ""
                    }
                if (cmd == "innerHTML" && target.match(/^layerContent(.+)/)) {
                        _uWnd.content(RegExp.$1, data)
                    }
                if (cmd == "innerHTML" && target.match(/^layerTitle(.+)/)) {
                        _uWnd.setTitle(RegExp.$1, data)
                    }
                if (cmd == "innerHTML") {
                        $("#" + target).html(data)
                    } else {
                        if (cmd == "+innerHTML") {
                            $("#" + target).prepend(data)
                        } else {
                            if (cmd == "innerHTML+") {
                                $("#" + target).append(data)
                            } else {
                                if (cmd == "innerHTMLspanAll") {
                                    $("span." + target).html(data)
                                } else {
                                    if (cmd == "innerHTMLdivAll") {
                                        $("div." + target).html(data)
                                    } else {
                                        if (cmd == "value") {
                                            $("#" + target).val(data)
                                        } else {
                                            if (cmd == "jsa") {
                                                includeJSfile(data, target)
                                            } else {
                                                if (cmd == "js") {
                                                    eval(data)
                                                } else {
                                                    if (cmd == "content" && target.length > 0) {
                                                        var r = target.match(/^([^:]+):(.+)/);
                                                        if (r) {
                                                            if (typeof footers["_uhh" + r] == "number" && footers["_uhh" + r] != NaN) {
                                                                _uTabCtrl.headerheight(r[1], r[2], footers["_uhh" + r])
                                                            }
                                                            if (typeof footers["_ufh" + r] == "number" && footers["_ufh" + r] != NaN) {
                                                                _uTabCtrl.footerheight(r[1], r[2], footers["_ufh" + r])
                                                            }
                                                            _uTabCtrl.content(r[1], r[2], data, footers["_uhc" + r], footers["_ufc" + r])
                                                        } else {
                                                            _uWnd.content(target, data)
                                                        }
                                                    } else {
                                                        if (cmd == "header" && target.length > 0) {
                                                            var r = target.match(/^([^:]+):(.+)/);
                                                            if (r) {
                                                                footers["_uhc" + r] = data;
                                                                footers["_uhh" + r] = height
                                                            } else {
                                                                if (height != NaN) {
                                                                    _uWnd.headerheight(target, height)
                                                                }
                                                                _uWnd.header(target, data)
                                                            }
                                                        } else {
                                                            if (cmd == "footer" && target.length > 0) {
                                                                var r = target.match(/^([^:]+):(.+)/);
                                                                if (r) {
                                                                    footers["_ufc" + r] = data;
                                                                    footers["_ufh" + r] = height
                                                                } else {
                                                                    if (height != NaN) {
                                                                        _uWnd.footerheight(target, height)
                                                                    }
                                                                    _uWnd.footer(target, data)
                                                                }
                                                            } else {
                                                                if (cmd == "title" && target.length > 0) {
                                                                    var r = target.match(/^([^:]+):(.+)/);
                                                                    if (r) {
                                                                        _uTabCtrl.setTitle(r[1], r[2], data)
                                                                    } else {
                                                                        _uWnd.setTitle(target, data)
                                                                    }
                                                                } else {
                                                                    if (cmd == "close" && target.length > 0) {
                                                                        var r = target.match(/^([^:]+):(.+)/);
                                                                        if (r) {
                                                                            if (!data || isNaN(parseInt(data))) {
                                                                                _uTabCtrl.closeTab(r[1], r[2])
                                                                            } else {
                                                                                setTimeout("_uTabCtrl.closeTab('" + r[1] + "','" + r[2] + "');", parseInt(data))
                                                                            }
                                                                        } else {
                                                                            if (!data || isNaN(parseInt(data))) {
                                                                                _uWnd.close(target)
                                                                            } else {
                                                                                setTimeout("_uWnd.close('" + target + "');", parseInt(data))
                                                                            }
                                                                        }
                                                                    } else {
                                                                        if (wnd) {
                                                                            if (cmd == "content") {
                                                                                wnd.content(data)
                                                                            } else {
                                                                                if (cmd == "header") {
                                                                                    if (height != NaN) {
                                                                                        wnd.headerheight(height)
                                                                                    }
                                                                                    wnd.header(data)
                                                                                } else {
                                                                                    if (cmd == "footer") {
                                                                                        if (height != NaN) {
                                                                                            wnd.footerheight(height)
                                                                                        }
                                                                                        wnd.footer(data)
                                                                                    } else {
                                                                                        if (cmd == "title") {
                                                                                            wnd.setTitle(data)
                                                                                        } else {
                                                                                            if (cmd == "close") {
                                                                                                if (!data || isNaN(parseInt(data))) {
                                                                                                    wnd.close()
                                                                                                } else {
                                                                                                    setTimeout("var w=_uWnd.all[" + wnd.idx + "];if(w)w.close();", parseInt(data))
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        } else {
                                                                            if (tabctrl && tabid) {
                                                                                if (cmd == "content") {
                                                                                    if (typeof footers._uhh == "number" && footers._uhh != NaN) {
                                                                                        tabctrl.headerheight(tabid, footers._uhh)
                                                                                    }
                                                                                    if (typeof footers._ufh == "number" && footers._ufh != NaN) {
                                                                                        tabctrl.footerheight(tabid, footers._ufh)
                                                                                    }
                                                                                    tabctrl.content(tabid, data, footers._uhc, footers._ufc)
                                                                                } else {
                                                                                    if (cmd == "header") {
                                                                                        footers._uhc = data;
                                                                                        footers._uhh = height
                                                                                    } else {
                                                                                        if (cmd == "footer") {
                                                                                            footers._ufc = data;
                                                                                            footers._ufh = height
                                                                                        } else {
                                                                                            if (cmd == "title") {
                                                                                                tabctrl.setTitle(tabid, data)
                                                                                            } else {
                                                                                                if (cmd == "close") {
                                                                                                    if (!data || isNaN(parseInt(data))) {
                                                                                                        tabctrl.closeTab(tabid)
                                                                                                    } else {
                                                                                                        setTimeout("var w=_uTabCtrl.all[" + tabctrl.idx + "];if(w)w.closeTab('" + tabid + "');", parseInt(data))
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
            }
        }
}
var _defAjaxError = function (d, b, a) {
    try {
        _show_log_form();
        return
    } catch (c) {}
    window.location.reload()
};
var _hookAjaxError = null;

function _uAjaxRequest(a, b) {
    if (!a) {
        return null
    }
    var c = $.extend({
        app: 0,
        wnd: 0,
        async: 1,
        cache: true,
        dataType: "xml",
        error: _defAjaxError,
        type: "GET",
        success: _defAjaxSuccess,
        timeout: 25000
    }, b || {});
    if (c.app && c.app.appname && c.app.pid > 0) {
        c.app = c.app.pid
    }
    if (c.wnd && c.wnd.constructor == _uWnd) {
        c.wnd = c.wnd.idx
    }
    if (!c.data) {
        c.data = {}
    }
    if (c.app > 0 && !("_ai" in c.data)) {
        c.data._ai = c.app
    }
    if (c.app > 0 && _uApp.all[c.app] && _uApp.all[c.app]._admpasscook) {
        c.data._apc = _uApp.all[c.app]._admpasscook
    }
    if (c.wnd > 0 && !("_wi" in c.data)) {
        c.data._wi = c.wnd
    }
    if (_hookAjaxError && !c.noerrorhook) {
        c.prev_error = c.error;
        c.error = _hookAjaxError
    }
    c.url = a;
    if (c.app > 0 && !c.nosuccesshook) {
        c.prev_success = c.success;
        c.success = _hookAjaxSuccess
    }
    return jQuery.ajax(c)
}
var _hookAjaxSuccess = function (b, a) {
    if (!this.prev_success) {
        return
    }
    if (this.app > 0 && typeof _uApp != "undefined" && _uApp.all[this.app] && !_uApp.all[this.app].exited && this.prev_success != _defAjaxSuccess) {
        this.prev_success.call(_uApp.all[this.app], b, a, this)
    } else {
        this.prev_success.call(this, b, a)
    }
};
var _defAjaxSuccess = function (c, b) {
    var a = null,
        d = null;
    if (this.dataType == "xml") {
            if (this.wnd > 0 && _uWnd.all[this.wnd] && !_uWnd.all[this.wnd].state.destroyed) {
                a = _uWnd.all[this.wnd]
            }
            if (this.app > 0 && typeof _uApp != "undefined" && _uApp.all[this.app] && !_uApp.all[this.app].exited) {
                d = _uApp.all[this.app]
            }
            _uParseXML(c, a, 0, d)
        }
};
var _defAjaxFormError = function (g, d, c) {
    if (!this._formobj) {
        return
    }
    var b = this._formobj.onerror || this._formobj.getAttribute("onerror");
    if (!b) {
        return
    }
    if (typeof b == "string") {
        try {
            b = new Function(b)
        } catch (f) {
            return
        }
    }
    if (typeof b == "function" || typeof b == "object") {
        try {
            b.call(this._formobj, g, d, c)
        } catch (f) {
            return
        }
    }
};
var _defAjaxFormComplete = function (f, c) {
    if (!this._formobj) {
        return
    }
    var b = this._formobj.oncomplete || this._formobj.getAttribute("oncomplete");
    if (!b) {
        return
    }
    if (typeof b == "string") {
        try {
            b = new Function(b)
        } catch (d) {
            return
        }
    }
    if (typeof b == "function" || typeof b == "object") {
        try {
            b.call(this._formobj, f, c)
        } catch (d) {
            return
        }
    }
};

function _uPostForm(a, b) {
    if (!a && b && b.url) {
        _uAjaxRequest(b.url, b);
        return
    }
    var c;
    if (typeof(a) != "object") {
        c = $("#" + a)
    } else {
        c = $(a)
    }
    if (!c.length) {
        return
    }
    var d = $.extend({
        app: 0,
        wnd: 0,
        url: c.attr("action") || window.location.toString(),
        type: c.attr("method") || "GET",
        error: _defAjaxFormError,
        success: _defAjaxSuccess,
        complete: _defAjaxFormComplete,
        dataType: "xml",
        semantic: false
    }, b || {});
    if (d.app && d.app.appname && d.app.pid > 0) {
        d.app = d.app.pid
    }
    if (d.wnd && d.wnd.constructor == _uWnd) {
        d.wnd = d.wnd.idx
    }
    if (!d.data) {
        d.data = {}
    }
    if (d.app > 0 && !("_ai" in d.data)) {
        d.data._ai = d.app
    }
    if (d.app > 0 && _uApp.all[d.app] && _uApp.all[d.app]._admpasscook) {
        d.data._apc = _uApp.all[d.app]._admpasscook
    }
    if (d.wnd > 0 && !("_wi" in d.data)) {
        d.data._wi = d.wnd
    }
    if (_hookAjaxError && !d.noerrorhook) {
        d.prev_error = d.error;
        d.error = _hookAjaxError
    }
    d._formobj = c[0];
    if (d.app > 0 && !d.nosuccesshook) {
        d.prev_success = d.success;
        d.success = _hookAjaxSuccess
    }
    c.ajaxSubmit(d)
}
function includeJSfile(b, c) {
    if (c && document.getElementById(c)) {
        return
    }
    var a = document.createElement("script");
    a.setAttribute("type", "text/javascript");
    if (c) {
        a.setAttribute("id", c)
    }
    a.setAttribute("src", b);
    document.getElementsByTagName("head").item(0).appendChild(a)
}
var _entrRm = {};

function _entrRem(c, a, b, d) {
    if (!d) {
        d = "Are you sure?"
    }
    if (!_entrRm[c] && confirm(d)) {
        _entrRm[c] = 1;
        document.getElementById(c).src = b + "/img/fr/EmnAjax.gif";
        _uPostForm("", {
            url: a
        })
    }
}
function _coloredTDs(d, e) {
    var a = "";
    if (typeof(d) != "object") {
        d = document.getElementById(d)
    }
    if (typeof(document.getElementsByTagName) != "undefined") {
        a = d.getElementsByTagName("td")
    } else {
        if (typeof(d.cells) != "undefined") {
            a = d.cells
        } else {
            return false
        }
    }
    for (var b = 0; b < a.length; b++) {
        a[b].className = e
    }
}
function openLayerB(d, i, c, m, l, e, g, b, a, k, j) {
    new _uWnd(d, m, l, e, {
        autosize: g ? 1 : 0,
        modal: a ? 1 : 0,
        align: j ? j : "center"
    }, {
        url: c,
        form: i,
        cache: 1
    })
}
function _showOnTop(c, a) {
    var b = _uWnd.getTopZ();
    if (a) {
        document.getElementById(c).style.zIndex = b + 1
    } else {
        document.getElementById("outLayer" + c).style.zIndex = b + 1
    }
}
function encodeHtmlVal(b, a) {
    if (a) {
        return String(b).replace(/'/g, "&#39;").replace(/"/g, "&quot;")
    }
    return String(b).replace(/&/g, "&amp;").replace(/'/g, "&#39;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;")
}
Date.fullYearStart = "20";
(function () {
    function c(d, e) {
        if (!Date.prototype[d]) {
            Date.prototype[d] = e
        }
    }
    c("isLeapYear", function () {
        var d = this.getFullYear();
        return (d % 4 == 0 && d % 100 != 0) || d % 400 == 0
    });
    c("isWeekend", function () {
        return this.getDay() == 0 || this.getDay() == 6
    });
    c("isWeekDay", function () {
        return !this.isWeekend()
    });
    c("getDaysInMonth", function () {
        return [31, (this.isLeapYear() ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][this.getMonth()]
    });
    c("getDayName", function (d) {
        return d ? Date.abbrDayNames[this.getDay()] : Date.dayNames[this.getDay()]
    });
    c("getMonthName", function (d) {
        return d && d != 2 ? Date.abbrMonthNames[this.getMonth()] : (d == 2 ? Date.rMonthNames[this.getMonth()] : Date.monthNames[this.getMonth()])
    });
    c("getDayOfYear", function () {
        var d = new Date("1/1/" + this.getFullYear());
        return Math.floor((this.getTime() - d.getTime()) / 86400000)
    });
    c("getWeekOfYear", function () {
        return Math.ceil(this.getDayOfYear() / 7)
    });
    c("setDayOfYear", function (d) {
        this.setMonth(0);
        this.setDate(d);
        return this
    });
    c("addYears", function (d) {
        this.setFullYear(this.getFullYear() + d);
        return this
    });
    c("addMonths", function (d) {
        var e = this.getDate();
        this.setMonth(this.getMonth() + d);
        if (e > this.getDate()) {
            this.addDays(-this.getDate())
        }
        return this
    });
    c("addDays", function (d) {
        this.setDate(this.getDate() + d);
        return this
    });
    c("addHours", function (d) {
        this.setHours(this.getHours() + d);
        return this
    });
    c("addMinutes", function (d) {
        this.setMinutes(this.getMinutes() + d);
        return this
    });
    c("addSeconds", function (d) {
        this.setSeconds(this.getSeconds() + d);
        return this
    });
    c("zeroTime", function () {
        this.setMilliseconds(0);
        this.setSeconds(0);
        this.setMinutes(0);
        this.setHours(0);
        return this
    });
    var b = function (d) {
        if (!d.match(/\$[a-zA-Z]+\$/)) {
            return d.replace(/yyyy/g, "$yyyy$").replace(/yy/g, "$yy$").replace(/mmmm/g, "$MO$").replace(/mmm/g, "$Mo$").replace(/mm/g, "$mo$").replace(/dd/g, "$dd$")
        }
        return d
    };
    c("asString", function (i, d) {
        var l = null,
            k = null,
            g, e = "";
        if (i !== false) {
                l = i || Date.udateformat
            }
        if (d) {
                if (d == 1 || d === true) {
                    k = Date.utimeformat
                } else {
                    k = d
                }
            }
        if (l) {
                l = b(l);
                g = {
                    yyyy: this.getFullYear(),
                    yy: (this.getFullYear() + "").substring(2),
                    MO: this.getMonthName(0),
                    Mo: this.getMonthName(1),
                    MOD: this.getMonthName(2),
                    WD: this.getDayName(0),
                    wd: this.getDayName(1),
                    mo: a(this.getMonth() + 1),
                    d: this.getDate(),
                    dd: a(this.getDate())
                };
                e += l.replace(/\$([a-zA-Z]+)\$/g, function (m, h) {
                    return g[h]
                })
            }
        if (k) {
                if (e) {
                    e += " "
                }
                var j = this.getHours(),
                    f = "AM";
                if (j > 12) {
                        j -= 12;
                        f = "PM"
                    } else {
                        if (j == 12) {
                            f = "PM"
                        }
                    }
                g = {
                        H: this.getHours(),
                        HH: a(this.getHours()),
                        h: j,
                        hh: a(j),
                        AP: f,
                        mm: a(this.getMinutes()),
                        ss: a(this.getSeconds())
                    };
                e += k.replace(/\$([a-zA-Z]+)\$/g, function (m, h) {
                        return g[h]
                    })
            }
        return e
    });
    Date.fromString = function (y, x, t) {
        var v = b(Date.udateformat),
            f = Date.utimeformat,
            w, g, u, r, o, k, q, l;
        if (t) {
                v += " " + f
            }
        y = y.replace(/[\x00-\x1f]+/g, " ");
        o = {
                yyyy: "(\\d{4}|\\d{2})",
                yy: "(\\d{2}|\\d{4})",
                MO: '([^ 0-9@"#$%^&*(){}\\[\\]+=_\\\\|;:/?.>,<~\\-]+)',
                Mo: '([^ 0-9@"#$%^&*(){}\\[\\]+=_\\\\|;:/?.>,<~\\-]+)',
                MOD: '([^0-9@"#$%^&*(){}\\[\\]+=_\\\\|;:/?.>,<~\\-]+)',
                mo: "(\\d{1,2})",
                dd: "(\\d{1,2})",
                d: "(\\d{1,2})",
                HH: "(\\d{1,2})",
                hh: "(\\d{1,2})",
                H: "(\\d{1,2})",
                h: "(\\d{1,2})",
                AP: "(AM|PM)?",
                mm: "(\\d{1,2})",
                ss: "(\\d{1,2})?"
            };
        w = new RegExp("\\$([a-zA-Z]+)\\$", "g");
        g = 0;
        r = "^";
        if (!x) {
                r += " *"
            }
        k = [];
        while (u = w.exec(v)) {
                if (u.index > g) {
                    if (x) {
                        r += v.substr(g, u.index - g).replace(/([\\^\$*+?.|()\[\]{}])/g, "\\$1")
                    } else {
                        r += '[ @"#$%^&*(){}\\[\\]+=_\\\\|;:/?.>,<~\\-]+'
                    }
                }
                g = u.index + u[0].length;
                if (o[u[1]]) {
                    r += o[u[1]];
                    k.push(u[1])
                } else {
                    g = u.index
                }
            }
        if (v.length > g) {
                if (x) {
                    r += v.substr(g, v.length - g).replace(/([\\^\$*+?.|()\[\]{}])/g, "\\$1")
                } else {
                    r += '[ @"#$%^&*(){}\\[\\]+=_\\\\|;:/?.>,<~\\-]+'
                }
            }
        if (!x) {
                r += " *"
            }
        r += "$";
        r = new RegExp(r, "i");
        u = r.exec(y);
        if (!u) {
                return false
            }
        q = new Date();
        q.zeroTime();
        var n = q.getDate(),
            e = q.getMonth(),
            p = q.getFullYear();
        for (var m = 0; m < k.length; m++) {
                if (k[m] == "yyyy" || k[m] == "yy") {
                    l = parseInt(u[m + 1], 10);
                    if (isNaN(l) || l < 0) {
                        return false
                    }
                    if (l < 30) {
                        l += 2000
                    } else {
                        if (l < 100) {
                            l += 1900
                        }
                    }
                    p = l
                } else {
                    if (k[m] == "MO" || k[m] == "MOD" || k[m] == "Mo") {
                        for (l = 0; l < 12; l++) {
                            if (Date.abbrMonthNames[l].indexOf(u[m + 1]) >= 0) {
                                e = l;
                                break
                            }
                        }
                        if (l >= 12) {
                            for (l = 0; l < 12; l++) {
                                if (Date.rMonthNames[l].indexOf(u[m + 1]) >= 0) {
                                    e = l;
                                    break
                                }
                            }
                        }
                        if (l >= 12) {
                            for (l = 0; l < 12; l++) {
                                if (Date.monthNames[l].indexOf(u[m + 1]) >= 0) {
                                    e = l;
                                    break
                                }
                            }
                        }
                        if (l >= 12) {
                            return false
                        }
                    } else {
                        if (k[m] == "mo") {
                            l = parseInt(u[m + 1], 10);
                            if (isNaN(l) || l <= 0 || l > 12) {
                                return false
                            }
                            e = l - 1
                        } else {
                            if (k[m] == "dd" || k[m] == "d") {
                                l = parseInt(u[m + 1], 10);
                                if (isNaN(l) || l <= 0 || l > 31) {
                                    return false
                                }
                                n = l
                            } else {
                                if (k[m] == "HH" || k[m] == "H") {
                                    l = parseInt(u[m + 1], 10);
                                    if (isNaN(l) || l < 0 || l > 24) {
                                        return false
                                    }
                                    q.setHours(l)
                                } else {
                                    if (k[m] == "hh" || k[m] == "h") {
                                        l = parseInt(u[m + 1], 10);
                                        if (isNaN(l) || l < 0 || l > 12) {
                                            return false
                                        }
                                        q.setHours(l)
                                    } else {
                                        if (k[m] == "mm") {
                                            l = parseInt(u[m + 1], 10);
                                            if (isNaN(l) || l < 0 || l > 59) {
                                                return false
                                            }
                                            q.setMinutes(l)
                                        } else {
                                            if (k[m] == "ss") {
                                                l = u[m + 1] && u[m + 1].length > 0 ? parseInt(u[m + 1], 10) : 0;
                                                if (isNaN(l) || l < 0 || l > 61) {
                                                    return false
                                                }
                                                q.setSeconds(l)
                                            } else {
                                                if (k[m] == "AP") {
                                                    if (u[m + 1] && u[m + 1].length > 0) {
                                                        if (u[m + 1].toLowerCase() == "pm") {
                                                            if (q.getHours() < 12) {
                                                                q.addHours(12)
                                                            }
                                                        } else {
                                                            if (u[m + 1].toLowerCase() != "am") {
                                                                return false
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        q.setFullYear(p);
        q.setMonth(e);
        q.setDate(n);
        return q
    };
    var a = function (d) {
        var e = "0" + d;
        return e.substring(e.length - 2)
    }
})();

function _uLoadJS(c, b, a) {
    if (typeof c != "string" && typeof c != "number") {
        return 0
    }
    if (typeof b == "function") {
        b = {
            func: b
        }
    }
    var e = _uLoadJS._loadedJS[c];
    if (typeof e == "object") {
        if (e[0] == 2) {
            if (a) {
                return 2
            }
            if (b) {
                b.func.call(b.thispar, "success", b.param)
            }
            return 1
        }
        if (e[0] == 1) {
            e[e.length] = b;
            return 1
        }
        e[e.length] = b
    } else {
        _uLoadJS._loadedJS[c] = [1, b]
    }
    var d = {
        url: c,
        oldurl: c,
        dataType: "script",
        cache: 1,
        complete: _uLoadJS._onloadJS
    };
    $.ajax(d)
}
_uLoadJS._loadedJS = {};
_uLoadJS._onloadJS = function (a, c) {
    var d = _uLoadJS._loadedJS[this.oldurl];
    if (c != "success") {
        d[0] = 0
    } else {
        d[0] = 2
    }
    for (var b = 1; b < d.length; b++) {
        d[b].func.call(d[b].thispar, c, d[b].param)
    }
    d.splice(1, d.length - 1)
};

function dumpObject(j, h, c) {
    var g = typeof j,
        d;
    if (arguments.length < 2) {
            h = 10
        }
    function a(m, k) {
            var i, l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "a", "b", "c", "d", "e", "f"],
                e = "";
            for (i = 0; i < k; i++) {
                    e = "" + l[m % 16] + e;
                    m >>>= 4
                }
            return e
        }
    if (g == "object") {
            if (!j) {
                g = "null"
            } else {
                if (j.constructor == String) {
                    g = "string"
                } else {
                    if (j.constructor == Number) {
                        g = "number"
                    } else {
                        if (j.constructor == Boolean) {
                            g = "boolean"
                        } else {
                            if (j.constructor == Array) {
                                g = "array"
                            }
                        }
                    }
                }
            }
        }
    switch (g) {
        case "number":
        case "boolean":
        case "null":
        case "undefined":
            return String(j);
        case "string":
            return '"' + j.replace(/([\\"])/g, "\\$1").replace(/\n/g, "\\n").replace(/([\x00-\x1f])/g, function (e, i) {
                return "\\x" + a(i.charCodeAt(0), 2)
            }).replace(/([\u2028\u2029])/g, function (e, i) {
                return "\\u" + a(i.charCodeAt(0), 4)
            }) + '"';
        case "array":
            if (h <= 0) {
                return "[?]"
            }
            d = "";
            for (var b = 0; b < j.length; b++) {
                if (b > 0) {
                    d += ","
                }
                d += dumpObject(j[b])
            }
            return "[" + d + "]";
        case "object":
            if (h <= 0) {
                return "{?}"
            }
            d = "";
            for (var b in j) {
                if (c && c[b]) {
                    continue
                }
                if (d) {
                    d += ","
                }
                try {
                    d += dumpObject(b) + ":" + dumpObject(j[b], h - 1)
                } catch (f) {
                    d += dumpObject(b) + ":?"
                }
            }
            return "{" + d + "}"
        }
}
function _uHighlightA(c, e, f) {
    var b = $(c).find("a").get(),
        g = null,
        a = 0;
    for (var d in b) {
            if (b[d].href && e.indexOf(b[d].href) >= 0) {
                if (!g || a < b[d].href.length) {
                    g = b[d];
                    a = b[d].href.length
                }
            }
        }
    if (g) {
            $(g).addClass(f)
        }
}
function _uBuildMenu(d, b, o, q, a, e) {
    var c, k, h, g, n, r, j, l;
    c = $(d)[0];
    if (!c) {
        return
    }
    e = e || 2000;
    l = function (f) {
        _uMENU.hideallmenus();
        this.__umenu.show()
    };
    if ($.browser.msie) {
        c.style.zoom = "1"
    }
    h = $(d + ">ul").children("li").children("ul");
    for (k = 0; k < h.length; k++) {
        g = _ubuild_submenus(h[k]);
        n = j = h[k].parentNode;
        if (!b && a && (r = $(n).children("." + a)[0])) {
            n = r
        }
        j.__umenu = new _uMENU("", {
            alignObj: n,
            align: b ? "D" : (window._rtl ? "L" : "R")
        }, {
            parentnode: c,
            hidetimer: e
        }, g);
        $(j).bind("mouseover", l);
        j.removeChild(h[k])
    }
    if (!o || !q) {
        return
    }
    setTimeout("_uHighlightA($('" + d + "')[0],'" + o + "','" + q + "');", 100)
}
function _uReplaceMenu(h, d, c, f, b) {
    var e, a, g;
    e = $(h)[0];
    if (!e) {
        return
    }
    if ($.browser.msie) {
        e.style.zoom = "1"
    }
    g = $(h).children("ul")[0];
    if (!g) {
        return
    }
    if (b) {
        $(g).find("." + b).remove()
    }
    a = _ubuild_submenus(g);
    g.parentNode.__umenu = new _uMENU("", {}, {
        width: "auto",
        horiz: d,
        statical: 1,
        parentnode: e,
        noabs: 1
    }, a);
    g.parentNode.removeChild(g);
    if (!c || !f) {
        return
    }
    setTimeout("_uHighlightA($('" + h + "')[0],'" + c + "','" + f + "');", 100)
}
function _ubuild_submenus(e) {
    var f = $(e).children("li"),
        d, c = [],
        g, a, b;
    for (d = 0; d < f.length; d++) {
            g = $(f[d]).children("ul")[0];
            if (g) {
                a = _ubuild_submenus(g);
                g.parentNode.removeChild(g);
                b = $(f[d]).find("a").get();
                c[c.length] = [$(f[d]).html(), a, b.length > 0 ? {
                    action: "a"
                } : null]
            } else {
                b = $(f[d]).find("a").get();
                c[c.length] = [$(f[d]).html(), b.length > 0 ? "a" : ""]
            }
        }
    return c
}
function _uButtonExt(a) {
    return '<span style="visibility:hidden"><input type="image" src="/.s/img/1px.gif" style="width:1px" id="subm' + a + '" /></span>'
}
function _uButton(f, d, a) {
    var c = $.extend({
        ext: 0,
        text: "Ok",
        content: "",
        style: 0,
        id: null
    }, a || {});
    var g = {
        s: "onclick=\"if (this.dis)return; $(this).addClass('myBtnDis'); this.dis=true; $('#subm" + f + "').click();\"",
        r: "onclick=\"document.getElementById('" + f + "').reset();\""
    };
    var i = (g[d] != "undefined") ? g[d] : "";
    var j = (c.style == 1) ? ["myBtnLeft", "myBtnCenter", "myBtnRight"] : ["myBtnLeftA", "myBtnCenterA", "myBtnRightA"];
    var e = (d == "s" && !c.ext) ? '<input type="image" src="/.s/img/1px.gif" style="width:1px" id="subm' + f + '" />' : "";
    var b = (c.style == 2) ? "myBtnCont x-unselectable myBtnDis" : "myBtnCont x-unselectable";
    var h = '<table border="0" cellpadding="0" cellspacing="0" onmousedown="this.className=\'downBtn\'" onmouseover="this.className=\'overBtn\'" onmouseout="this.className=\'outBtn\'"><tr><td class="' + j[0] + '"><img border="0" src="/.s/img/1px.gif"></td><td class="' + j[1] + '"><div class="' + b + '" unselectable="on" ' + i + " " + c.content + "><a " + (c.id ? 'id="' + c.id + '" ' : "") + 'href="javascript://" onclick="return false;">' + c.text + '</a></div></td><td class="' + j[2] + '"><img border="0" src="/.s/img/1px.gif"></td><td style="visibility:hidden;">' + e + "</td></tr></table>";
    return h
}
function _uButtonEn(c, a) {
    var b = typeof(c) == "string" ? $("#" + c)[0] : c;
    if (!b) {
        return
    }
    if (a) {
        b.dis = false;
        $(b).removeClass("myBtnDis")
    } else {
        b.dis = true;
        $(b).addClass("myBtnDis")
    }
}
function _uStopAllAudioPlayers() {
    $(".uAudioPlayer").each(function (a, b) {
        b.Stop()
    })
}
function _uAudioPlayer(b, e, d) {
    var c = $("#" + e)[0];
    if (!c) {
        if (typeof d != "number" || isNaN(d)) {
            d = 0
        }
        if (d >= 10) {
            return
        }
        setTimeout("_uAudioPlayer(" + dumpObject(b) + "," + dumpObject(e) + "," + (d + 1) + ");", 100);
        return
    }
    var a = "";
    if (b.autoplay && b.autoplay == "1") {
        b.autoplay = 1
    } else {
        b.autoplay = 0
    }
    if (b.loop && b.loop == "1") {
        b.loop = 1
    } else {
        b.loop = 0
    }
    if (b.small && b.small == "1") {
        a = '<object type="application/x-shockwave-flash" class="uAudioPlayer" allowScriptAccess="always" width="35" height="16" data="/.s/flash/audio1.swf?song_url=' + b.url + "&autoplay=" + b.autoplay + "&loop=" + b.loop + '"><param name="movie" value="/.s/flash/audio1.swf?song_url=' + b.url + "&autoplay=" + b.autoplay + "&loop=" + b.loop + '"/><param name="wmode" value="transparent"/><param name="allowScriptAccess" value="always"/></object>'
    } else {
        a = '<object type="application/x-shockwave-flash" class="uAudioPlayer" allowScriptAccess="always" width="190" height="16" data="/.s/flash/audio.swf?song_url=' + b.url + "&background_color=#2D548A&show_copyright=0&autoplay=" + b.autoplay + "&textoff=0&loop=" + b.loop + '"><param name="movie" value="/.s/flash/audio.swf?song_url=' + b.url + "&background_color=#2D548A&show_copyright=0&autoplay=" + b.autoplay + "&textoff=0&loop=" + b.loop + '"/><param name="wmode" value="transparent"/><param name="allowScriptAccess" value="always"/></object>'
    }
    $(c).html(a)
}
function _uVideoPlayer(b, i, l) {
    var g = $("#" + i)[0];
    if (!g) {
        if (typeof l != "number" || isNaN(l)) {
            l = 0
        }
        if (l >= 10) {
            return
        }
        setTimeout("_uVideoPlayer(" + dumpObject(b) + "," + dumpObject(i) + "," + (l + 1) + ");", 100);
        return
    }
    var k = "";
    var f = 0;
    if (b.url.match(/youtube\.com/i)) {
        f = 1;
        var a = /v=([^\s\&\;]+)/;
        var d = a.exec(b.url);
        if (d && d[1]) {
            k = "http://youtube.com/v/" + d[1] + ".swf"
        }
    } else {
        if (b.url.match(/rutube\.ru/i)) {
            f = 1;
            var a = /v=([^\s\&\;]+)/;
            var d = a.exec(b.url);
            if (d && d[1]) {
                k = "http://video.rutube.ru/" + d[1]
            }
        } else {
            if (b.url.match(/dailymotion\.com/i)) {
                f = 1;
                var a = /video\/([^\s]+)/;
                var d = a.exec(b.url);
                if (d && d[1]) {
                    k = "http://www.dailymotion.com/swf/" + d[1]
                }
            } else {
                if (b.url.match(/smotri\.com/i)) {
                    f = 1;
                    var a = /id=([^\s\&\;]+)/;
                    var d = a.exec(b.url);
                    if (d && d[1]) {
                        k = "http://pics.smotri.com/scrubber_custom8.swf?file=" + d[1] + "&bufferTime=3&autoStart=false&str_lang=rus&xmlsource=http%3A%2F%2Fpics.smotri.com%2Fcskins%2Fblue%2Fskin_color_lightaqua.xml&xmldatasource=http%3A%2F%2Fpics.smotri.com%2Fskin_ng.xml"
                    }
                } else {
                    if (b.url.match(/video\.mail\.ru/i)) {
                        f = 1;
                        var a = /(.*?)\/(\d+)\.html/;
                        var d = a.exec(b.url);
                        if (d && d[1] && d[2]) {
                            k = "http://img.mail.ru/r/video2/player_v2.swf?par=" + d[1] + "/$" + d[2] + "$0$300"
                        }
                    } else {
                        if (b.url.match(/vision\.rambler\.ru/i)) {
                            f = 1;
                            var a = /users\/([^\s]+)/;
                            var d = a.exec(b.url);
                            if (d && d[1]) {
                                var n = d[1];
                                n = n.replace(/\/+$/, "");
                                k = "http://vision.rambler.ru/i/e.swf?id=" + n
                            }
                        }
                    }
                }
            }
        }
    }
    var c = "";
    if (k && k.length > 1) {
        var j = b.width ? b.width : 640;
        var e = b.height ? b.height : 385;
        c = '<object type="application/x-shockwave-flash" width="' + j + '" height="' + e + '" data="' + k + '"><param name="movie" value="' + k + '" /><param name="wmode" value="transparent"></object>'
    } else {
        if (f) {
            c = '<span style="border-bottom:1px dashed red;text-align:center;">Incorrect video URL.</span>'
        } else {
            c = '<span style="border-bottom:1px dashed red;text-align:center;">Not supported video service. Please use YouTube.com for your video files.</span>'
        }
    }
    $(g).html(c)
};
		$(document).ready(function() {
			$("#cotatie").fancybox({
				'width'				: 660,
				'height'			: 500,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});
		});
		$(document).ready(function() {
			$("#cota").fancybox({
				'width'				: 660,
				'height'			: 500,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});
		});	
		$(document).ready(function() {
			$("#cotaa").fancybox({
				'width'				: 660,
				'height'			: 500,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});
		});	
