function Delegate(A, B) {
    return function () {
        B.apply(A, arguments)
    }
}
Function.prototype.extend = function (C) {
    var B = function () {};
    B.prototype = C.prototype;
    var A = this.prototype;
    this.prototype = new B();
    this.prototype.constructor = this;
    for (var D in A) {
        this.prototype[D] = A[D]
    }
};
(function () {
    var _jQuery = window.jQuery,
    _$ = window.$;
    var jQuery = window.jQuery = window.$ = function (selector, context) {
        return new jQuery.fn.init(selector, context)
    };
    var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
    isSimple = /^.[^:#\[\.]*$/,
    undefined;
    jQuery.fn = jQuery.prototype = {
        init: function (selector, context) {
            selector = selector || document;
            if (selector.nodeType) {
                this[0] = selector;
                this.length = 1;
                return this
            }
            if (typeof selector == "string") {
                var match = quickExpr.exec(selector);
                if (match && (match[1] || !context)) {
                    if (match[1]) {
                        selector = jQuery.clean([match[1]], context)
                    } else {
                        var elem = document.getElementById(match[3]);
                        if (elem) {
                            if (elem.id != match[3]) {
                                return jQuery().find(selector)
                            }
                            return jQuery(elem)
                        }
                        selector = []
                    }
                } else {
                    return jQuery(context).find(selector)
                }
            } else {
                if (jQuery.isFunction(selector)) {
                    return jQuery(document)[jQuery.fn.ready ? "ready" : "load"](selector)
                }
            }
            return this.setArray(jQuery.makeArray(selector))
        },
        jquery: "1.2.6",
        size: function () {
            return this.length
        },
        length: 0,
        get: function (num) {
            return num == undefined ? jQuery.makeArray(this) : this[num]
        },
        pushStack: function (elems) {
            var ret = jQuery(elems);
            ret.prevObject = this;
            return ret
        },
        setArray: function (elems) {
            this.length = 0;
            Array.prototype.push.apply(this, elems);
            return this
        },
        each: function (callback, args) {
            return jQuery.each(this, callback, args)
        },
        index: function (elem) {
            var ret = -1;
            return jQuery.inArray(elem && elem.jquery ? elem[0] : elem, this)
        },
        attr: function (name, value, type) {
            var options = name;
            if (name.constructor == String) {
                if (value === undefined) {
                    return this[0] && jQuery[type || "attr"](this[0], name)
                } else {
                    options = {};
                    options[name] = value
                }
            }
            return this.each(function (i) {
                for (name in options) {
                    jQuery.attr(type ? this.style : this, name, jQuery.prop(this, options[name], type, i, name))
                }
            })
        },
        css: function (key, value) {
            if ((key == "width" || key == "height") && parseFloat(value) < 0) {
                value = undefined
            }
            return this.attr(key, value, "curCSS")
        },
        text: function (text) {
            if (typeof text != "object" && text != null) {
                return this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(text))
            }
            var ret = "";
            jQuery.each(text || this, function () {
                jQuery.each(this.childNodes, function () {
                    if (this.nodeType != 8) {
                        ret += this.nodeType != 1 ? this.nodeValue : jQuery.fn.text([this])
                    }
                })
            });
            return ret
        },
        wrapAll: function (html) {
            if (this[0]) {
                jQuery(html, this[0].ownerDocument).clone().insertBefore(this[0]).map(function () {
                    var elem = this;
                    while (elem.firstChild) {
                        elem = elem.firstChild
                    }
                    return elem
                }).append(this)
            }
            return this
        },
        wrapInner: function (html) {
            return this.each(function () {
                jQuery(this).contents().wrapAll(html)
            })
        },
        wrap: function (html) {
            return this.each(function () {
                jQuery(this).wrapAll(html)
            })
        },
        append: function () {
            return this.domManip(arguments, true, false, function (elem) {
                if (this.nodeType == 1) {
                    this.appendChild(elem)
                }
            })
        },
        prepend: function () {
            return this.domManip(arguments, true, true, function (elem) {
                if (this.nodeType == 1) {
                    this.insertBefore(elem, this.firstChild)
                }
            })
        },
        before: function () {
            return this.domManip(arguments, false, false, function (elem) {
                this.parentNode.insertBefore(elem, this)
            })
        },
        after: function () {
            return this.domManip(arguments, false, true, function (elem) {
                this.parentNode.insertBefore(elem, this.nextSibling)
            })
        },
        end: function () {
            return this.prevObject || jQuery([])
        },
        find: function (selector) {
            var elems = jQuery.map(this, function (elem) {
                return jQuery.find(selector, elem)
            });
            return this.pushStack(/[^+>] [^+>]/.test(selector) || selector.indexOf("..") > -1 ? jQuery.unique(elems) : elems)
        },
        clone: function (events) {
            var ret = this.map(function () {
                if (jQuery.browser.msie && !jQuery.isXMLDoc(this)) {
                    var clone = this.cloneNode(true),
                    container = document.createElement("div");
                    container.appendChild(clone);
                    return jQuery.clean([container.innerHTML])[0]
                } else {
                    return this.cloneNode(true)
                }
            });
            var clone = ret.find("*").andSelf().each(function () {
                if (this[expando] != undefined) {
                    this[expando] = null
                }
            });
            if (events === true) {
                this.find("*").andSelf().each(function (i) {
                    if (this.nodeType == 3) {
                        return
                    }
                    var events = jQuery.data(this, "events");
                    for (var type in events) {
                        for (var handler in events[type]) {
                            jQuery.event.add(clone[i], type, events[type][handler], events[type][handler].data)
                        }
                    }
                })
            }
            return ret
        },
        filter: function (selector) {
            return this.pushStack(jQuery.isFunction(selector) && jQuery.grep(this, function (elem, i) {
                return selector.call(elem, i)
            }) || jQuery.multiFilter(selector, this))
        },
        not: function (selector) {
            if (selector.constructor == String) {
                if (isSimple.test(selector)) {
                    return this.pushStack(jQuery.multiFilter(selector, this, true))
                } else {
                    selector = jQuery.multiFilter(selector, this)
                }
            }
            var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
            return this.filter(function () {
                return isArrayLike ? jQuery.inArray(this, selector) < 0 : this != selector
            })
        },
        add: function (selector) {
            return this.pushStack(jQuery.unique(jQuery.merge(this.get(), typeof selector == "string" ? jQuery(selector) : jQuery.makeArray(selector))))
        },
        is: function (selector) {
            return !! selector && jQuery.multiFilter(selector, this).length > 0
        },
        hasClass: function (selector) {
            return this.is("." + selector)
        },
        val: function (value) {
            if (value == undefined) {
                if (this.length) {
                    var elem = this[0];
                    if (jQuery.nodeName(elem, "select")) {
                        var index = elem.selectedIndex,
                        values = [],
                        options = elem.options,
                        one = elem.type == "select-one";
                        if (index < 0) {
                            return null
                        }
                        for (var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++) {
                            var option = options[i];
                            if (option.selected) {
                                value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
                                if (one) {
                                    return value
                                }
                                values.push(value)
                            }
                        }
                        return values
                    } else {
                        return (this[0].value || "").replace(/\r/g, "")
                    }
                }
                return undefined
            }
            if (value.constructor == Number) {
                value += ""
            }
            return this.each(function () {
                if (this.nodeType != 1) {
                    return
                }
                if (value.constructor == Array && /radio|checkbox/.test(this.type)) {
                    this.checked = (jQuery.inArray(this.value, value) >= 0 || jQuery.inArray(this.name, value) >= 0)
                } else {
                    if (jQuery.nodeName(this, "select")) {
                        var values = jQuery.makeArray(value);
                        jQuery("option", this).each(function () {
                            this.selected = (jQuery.inArray(this.value, values) >= 0 || jQuery.inArray(this.text, values) >= 0)
                        });
                        if (!values.length) {
                            this.selectedIndex = -1
                        }
                    } else {
                        this.value = value
                    }
                }
            })
        },
        html: function (value) {
            return value == undefined ? (this[0] ? this[0].innerHTML : null) : this.empty().append(value)
        },
        replaceWith: function (value) {
            return this.after(value).remove()
        },
        eq: function (i) {
            return this.slice(i, i + 1)
        },
        slice: function () {
            return this.pushStack(Array.prototype.slice.apply(this, arguments))
        },
        map: function (callback) {
            return this.pushStack(jQuery.map(this, function (elem, i) {
                return callback.call(elem, i, elem)
            }))
        },
        andSelf: function () {
            return this.add(this.prevObject)
        },
        data: function (key, value) {
            var parts = key.split(".");
            parts[1] = parts[1] ? "." + parts[1] : "";
            if (value === undefined) {
                var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
                if (data === undefined && this.length) {
                    data = jQuery.data(this[0], key)
                }
                return data === undefined && parts[1] ? this.data(parts[0]) : data
            } else {
                return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function () {
                    jQuery.data(this, key, value)
                })
            }
        },
        removeData: function (key) {
            return this.each(function () {
                jQuery.removeData(this, key)
            })
        },
        domManip: function (args, table, reverse, callback) {
            var clone = this.length > 1,
            elems;
            return this.each(function () {
                if (!elems) {
                    elems = jQuery.clean(args, this.ownerDocument);
                    if (reverse) {
                        elems.reverse()
                    }
                }
                var obj = this;
                if (table && jQuery.nodeName(this, "table") && jQuery.nodeName(elems[0], "tr")) {
                    obj = this.getElementsByTagName("tbody")[0] || this.appendChild(this.ownerDocument.createElement("tbody"))
                }
                var scripts = jQuery([]);
                jQuery.each(elems, function () {
                    var elem = clone ? jQuery(this).clone(true)[0] : this;
                    if (jQuery.nodeName(elem, "script")) {
                        scripts = scripts.add(elem)
                    } else {
                        if (elem.nodeType == 1) {
                            scripts = scripts.add(jQuery("script", elem).remove())
                        }
                        callback.call(obj, elem)
                    }
                });
                scripts.each(evalScript)
            })
        }
    };
    jQuery.fn.init.prototype = jQuery.fn;
    function evalScript(i, elem) {
        if (elem.src) {
            jQuery.ajax({
                url: elem.src,
                async: false,
                dataType: "script"
            })
        } else {
            jQuery.globalEval(elem.text || elem.textContent || elem.innerHTML || "")
        }
        if (elem.parentNode) {
            elem.parentNode.removeChild(elem)
        }
    }
    function now() {
        return +new Date
    }
    jQuery.extend = jQuery.fn.extend = function () {
        var target = arguments[0] || {},
        i = 1,
        length = arguments.length,
        deep = false,
        options;
        if (target.constructor == Boolean) {
            deep = target;
            target = arguments[1] || {};
            i = 2
        }
        if (typeof target != "object" && typeof target != "function") {
            target = {}
        }
        if (length == i) {
            target = this;
            --i
        }
        for (; i < length; i++) {
            if ((options = arguments[i]) != null) {
                for (var name in options) {
                    var src = target[name],
                    copy = options[name];
                    if (target === copy) {
                        continue
                    }
                    if (deep && copy && typeof copy == "object" && !copy.nodeType) {
                        target[name] = jQuery.extend(deep, src || (copy.length != null ? [] : {}), copy)
                    } else {
                        if (copy !== undefined) {
                            target[name] = copy
                        }
                    }
                }
            }
        }
        return target
    };
    var expando = "jQuery" + now(),
    uuid = 0,
    windowData = {},
    exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
    defaultView = document.defaultView || {};
    jQuery.extend({
        noConflict: function (deep) {
            window.$ = _$;
            if (deep) {
                window.jQuery = _jQuery
            }
            return jQuery
        },
        isFunction: function (fn) {
            return !! fn && typeof fn != "string" && !fn.nodeName && fn.constructor != Array && /^[\s[]?function/.test(fn + "")
        },
        isXMLDoc: function (elem) {
            return elem.documentElement && !elem.body || elem.tagName && elem.ownerDocument && !elem.ownerDocument.body
        },
        globalEval: function (data) {
            data = jQuery.trim(data);
            if (data) {
                var head = document.getElementsByTagName("head")[0] || document.documentElement,
                script = document.createElement("script");
                script.type = "text/javascript";
                if (jQuery.browser.msie) {
                    script.text = data
                } else {
                    script.appendChild(document.createTextNode(data))
                }
                head.insertBefore(script, head.firstChild);
                head.removeChild(script)
            }
        },
        nodeName: function (elem, name) {
            return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase()
        },
        cache: {},
        data: function (elem, name, data) {
            elem = elem == window ? windowData : elem;
            var id = elem[expando];
            if (!id) {
                id = elem[expando] = ++uuid
            }
            if (name && !jQuery.cache[id]) {
                jQuery.cache[id] = {}
            }
            if (data !== undefined) {
                jQuery.cache[id][name] = data
            }
            return name ? jQuery.cache[id][name] : id
        },
        removeData: function (elem, name) {
            elem = elem == window ? windowData : elem;
            var id = elem[expando];
            if (name) {
                if (jQuery.cache[id]) {
                    delete jQuery.cache[id][name];
                    name = "";
                    for (name in jQuery.cache[id]) {
                        break
                    }
                    if (!name) {
                        jQuery.removeData(elem)
                    }
                }
            } else {
                try {
                    delete elem[expando]
                } catch(e) {
                    if (elem.removeAttribute) {
                        elem.removeAttribute(expando)
                    }
                }
                delete jQuery.cache[id]
            }
        },
        each: function (object, callback, args) {
            var name, i = 0,
            length = object.length;
            if (args) {
                if (length == undefined) {
                    for (name in object) {
                        if (callback.apply(object[name], args) === false) {
                            break
                        }
                    }
                } else {
                    for (; i < length;) {
                        if (callback.apply(object[i++], args) === false) {
                            break
                        }
                    }
                }
            } else {
                if (length == undefined) {
                    for (name in object) {
                        if (callback.call(object[name], name, object[name]) === false) {
                            break
                        }
                    }
                } else {
                    for (var value = object[0]; i < length && callback.call(value, i, value) !== false; value = object[++i]) {}
                }
            }
            return object
        },
        prop: function (elem, value, type, i, name) {
            if (jQuery.isFunction(value)) {
                value = value.call(elem, i)
            }
            return value && value.constructor == Number && type == "curCSS" && !exclude.test(name) ? value + "px" : value
        },
        className: {
            add: function (elem, classNames) {
                jQuery.each((classNames || "").split(/\s+/), function (i, className) {
                    if (elem.nodeType == 1 && !jQuery.className.has(elem.className, className)) {
                        elem.className += (elem.className ? " " : "") + className
                    }
                })
            },
            remove: function (elem, classNames) {
                if (elem.nodeType == 1) {
                    elem.className = classNames != undefined ? jQuery.grep(elem.className.split(/\s+/), function (className) {
                        return !jQuery.className.has(classNames, className)
                    }).join(" ") : ""
                }
            },
            has: function (elem, className) {
                return jQuery.inArray(className, (elem.className || elem).toString().split(/\s+/)) > -1
            }
        },
        swap: function (elem, options, callback) {
            var old = {};
            for (var name in options) {
                old[name] = elem.style[name];
                elem.style[name] = options[name]
            }
            callback.call(elem);
            for (var name in options) {
                elem.style[name] = old[name]
            }
        },
        css: function (elem, name, force) {
            if (name == "width" || name == "height") {
                var val, props = {
                    position: "absolute",
                    visibility: "hidden",
                    display: "block"
                },
                which = name == "width" ? ["Left", "Right"] : ["Top", "Bottom"];
                function getWH() {
                    val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
                    var padding = 0,
                    border = 0;
                    jQuery.each(which, function () {
                        padding += parseFloat(jQuery.curCSS(elem, "padding" + this, true)) || 0;
                        border += parseFloat(jQuery.curCSS(elem, "border" + this + "Width", true)) || 0
                    });
                    val -= Math.round(padding + border)
                }
                if (jQuery(elem).is(":visible")) {
                    getWH()
                } else {
                    jQuery.swap(elem, props, getWH)
                }
                return Math.max(0, val)
            }
            return jQuery.curCSS(elem, name, force)
        },
        curCSS: function (elem, name, force) {
            var ret, style = elem.style;
            function color(elem) {
                if (!jQuery.browser.safari) {
                    return false
                }
                var ret = defaultView.getComputedStyle(elem, null);
                return !ret || ret.getPropertyValue("color") == ""
            }
            if (name == "opacity" && jQuery.browser.msie) {
                ret = jQuery.attr(style, "opacity");
                return ret == "" ? "1" : ret
            }
            if (jQuery.browser.opera && name == "display") {
                var save = style.outline;
                style.outline = "0 solid black";
                style.outline = save
            }
            if (name.match(/float/i)) {
                name = styleFloat
            }
            if (!force && style && style[name]) {
                ret = style[name]
            } else {
                if (defaultView.getComputedStyle) {
                    if (name.match(/float/i)) {
                        name = "float"
                    }
                    name = name.replace(/([A-Z])/g, "-$1").toLowerCase();
                    var computedStyle = defaultView.getComputedStyle(elem, null);
                    if (computedStyle && !color(elem)) {
                        ret = computedStyle.getPropertyValue(name)
                    } else {
                        var swap = [],
                        stack = [],
                        a = elem,
                        i = 0;
                        for (; a && color(a); a = a.parentNode) {
                            stack.unshift(a)
                        }
                        for (; i < stack.length; i++) {
                            if (color(stack[i])) {
                                swap[i] = stack[i].style.display;
                                stack[i].style.display = "block"
                            }
                        }
                        ret = name == "display" && swap[stack.length - 1] != null ? "none" : (computedStyle && computedStyle.getPropertyValue(name)) || "";
                        for (i = 0; i < swap.length; i++) {
                            if (swap[i] != null) {
                                stack[i].style.display = swap[i]
                            }
                        }
                    }
                    if (name == "opacity" && ret == "") {
                        ret = "1"
                    }
                } else {
                    if (elem.currentStyle) {
                        var camelCase = name.replace(/\-(\w)/g, function (all, letter) {
                            return letter.toUpperCase()
                        });
                        ret = elem.currentStyle[name] || elem.currentStyle[camelCase];
                        if (!/^\d+(px)?$/i.test(ret) && /^\d/.test(ret)) {
                            var left = style.left,
                            rsLeft = elem.runtimeStyle.left;
                            elem.runtimeStyle.left = elem.currentStyle.left;
                            style.left = ret || 0;
                            ret = style.pixelLeft + "px";
                            style.left = left;
                            elem.runtimeStyle.left = rsLeft
                        }
                    }
                }
            }
            return ret
        },
        clean: function (elems, context) {
            var ret = [];
            context = context || document;
            if (typeof context.createElement == "undefined") {
                context = context.ownerDocument || context[0] && context[0].ownerDocument || document
            }
            jQuery.each(elems, function (i, elem) {
                if (!elem) {
                    return
                }
                if (elem.constructor == Number) {
                    elem += ""
                }
                if (typeof elem == "string") {
                    elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function (all, front, tag) {
                        return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? all : front + "></" + tag + ">"
                    });
                    var tags = jQuery.trim(elem).toLowerCase(),
                    div = context.createElement("div");
                    var wrap = !tags.indexOf("<opt") && [1, "<select multiple='multiple'>", "</select>"] || !tags.indexOf("<leg") && [1, "<fieldset>", "</fieldset>"] || tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && [1, "<table>", "</table>"] || !tags.indexOf("<tr") && [2, "<table><tbody>", "</tbody></table>"] || (!tags.indexOf("<td") || !tags.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] || !tags.indexOf("<col") && [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] || jQuery.browser.msie && [1, "div<div>", "</div>"] || [0, "", ""];
                    div.innerHTML = wrap[1] + elem + wrap[2];
                    while (wrap[0]--) {
                        div = div.lastChild
                    }
                    if (jQuery.browser.msie) {
                        var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ? div.firstChild && div.firstChild.childNodes : wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ? div.childNodes : [];
                        for (var j = tbody.length - 1; j >= 0; --j) {
                            if (jQuery.nodeName(tbody[j], "tbody") && !tbody[j].childNodes.length) {
                                tbody[j].parentNode.removeChild(tbody[j])
                            }
                        }
                        if (/^\s/.test(elem)) {
                            div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]), div.firstChild)
                        }
                    }
                    elem = jQuery.makeArray(div.childNodes)
                }
                if (elem.length === 0 && (!jQuery.nodeName(elem, "form") && !jQuery.nodeName(elem, "select"))) {
                    return
                }
                if (elem[0] == undefined || jQuery.nodeName(elem, "form") || elem.options) {
                    ret.push(elem)
                } else {
                    ret = jQuery.merge(ret, elem)
                }
            });
            return ret
        },
        attr: function (elem, name, value) {
            if (!elem || elem.nodeType == 3 || elem.nodeType == 8) {
                return undefined
            }
            var notxml = !jQuery.isXMLDoc(elem),
            set = value !== undefined,
            msie = jQuery.browser.msie;
            name = notxml && jQuery.props[name] || name;
            if (elem.tagName) {
                var special = /href|src|style/.test(name);
                if (name == "selected" && jQuery.browser.safari) {
                    elem.parentNode.selectedIndex
                }
                if (name in elem && notxml && !special) {
                    if (set) {
                        if (name == "type" && jQuery.nodeName(elem, "input") && elem.parentNode) {
                            throw "type property can't be changed"
                        }
                        elem[name] = value
                    }
                    if (jQuery.nodeName(elem, "form") && elem.getAttributeNode(name)) {
                        return elem.getAttributeNode(name).nodeValue
                    }
                    return elem[name]
                }
                if (msie && notxml && name == "style") {
                    return jQuery.attr(elem.style, "cssText", value)
                }
                if (set) {
                    elem.setAttribute(name, "" + value)
                }
                var attr = msie && notxml && special ? elem.getAttribute(name, 2) : elem.getAttribute(name);
                return attr === null ? undefined : attr
            }
            if (msie && name == "opacity") {
                if (set) {
                    elem.zoom = 1;
                    elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/, "") + (parseInt(value) + "" == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")")
                }
                return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? (parseFloat(elem.filter.match(/opacity=([^)]*)/)[1]) / 100) + "" : ""
            }
            name = name.replace(/-([a-z])/ig, function (all, letter) {
                return letter.toUpperCase()
            });
            if (set) {
                elem[name] = value
            }
            return elem[name]
        },
        trim: function (text) {
            return (text || "").replace(/^\s+|\s+$/g, "")
        },
        makeArray: function (array) {
            var ret = [];
            if (array != null) {
                var i = array.length;
                if (i == null || array.split || array.setInterval || array.call) {
                    ret[0] = array
                } else {
                    while (i) {
                        ret[--i] = array[i]
                    }
                }
            }
            return ret
        },
        inArray: function (elem, array) {
            for (var i = 0, length = array.length; i < length; i++) {
                if (array[i] === elem) {
                    return i
                }
            }
            return -1
        },
        merge: function (first, second) {
            var i = 0,
            elem, pos = first.length;
            if (jQuery.browser.msie) {
                while (elem = second[i++]) {
                    if (elem.nodeType != 8) {
                        first[pos++] = elem
                    }
                }
            } else {
                while (elem = second[i++]) {
                    first[pos++] = elem
                }
            }
            return first
        },
        unique: function (array) {
            var ret = [],
            done = {};
            try {
                for (var i = 0, length = array.length; i < length; i++) {
                    var id = jQuery.data(array[i]);
                    if (!done[id]) {
                        done[id] = true;
                        ret.push(array[i])
                    }
                }
            } catch(e) {
                ret = array
            }
            return ret
        },
        grep: function (elems, callback, inv) {
            var ret = [];
            for (var i = 0, length = elems.length; i < length; i++) {
                if (!inv != !callback(elems[i], i)) {
                    ret.push(elems[i])
                }
            }
            return ret
        },
        map: function (elems, callback) {
            var ret = [];
            for (var i = 0, length = elems.length; i < length; i++) {
                var value = callback(elems[i], i);
                if (value != null) {
                    ret[ret.length] = value
                }
            }
            return ret.concat.apply([], ret)
        }
    });
    var userAgent = navigator.userAgent.toLowerCase();
    jQuery.browser = {
        version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
        safari: /webkit/.test(userAgent),
        opera: /opera/.test(userAgent),
        msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
        mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
    };
    var styleFloat = jQuery.browser.msie ? "styleFloat" : "cssFloat";
    jQuery.extend({
        boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
        props: {
            "for": "htmlFor",
            "class": "className",
            "float": styleFloat,
            cssFloat: styleFloat,
            styleFloat: styleFloat,
            readonly: "readOnly",
            maxlength: "maxLength",
            cellspacing: "cellSpacing"
        }
    });
    jQuery.each({
        parent: function (elem) {
            return elem.parentNode
        },
        parents: function (elem) {
            return jQuery.dir(elem, "parentNode")
        },
        next: function (elem) {
            return jQuery.nth(elem, 2, "nextSibling")
        },
        prev: function (elem) {
            return jQuery.nth(elem, 2, "previousSibling")
        },
        nextAll: function (elem) {
            return jQuery.dir(elem, "nextSibling")
        },
        prevAll: function (elem) {
            return jQuery.dir(elem, "previousSibling")
        },
        siblings: function (elem) {
            return jQuery.sibling(elem.parentNode.firstChild, elem)
        },
        children: function (elem) {
            return jQuery.sibling(elem.firstChild)
        },
        contents: function (elem) {
            return jQuery.nodeName(elem, "iframe") ? elem.contentDocument || elem.contentWindow.document : jQuery.makeArray(elem.childNodes)
        }
    },
    function (name, fn) {
        jQuery.fn[name] = function (selector) {
            var ret = jQuery.map(this, fn);
            if (selector && typeof selector == "string") {
                ret = jQuery.multiFilter(selector, ret)
            }
            return this.pushStack(jQuery.unique(ret))
        }
    });
    jQuery.each({
        appendTo: "append",
        prependTo: "prepend",
        insertBefore: "before",
        insertAfter: "after",
        replaceAll: "replaceWith"
    },
    function (name, original) {
        jQuery.fn[name] = function () {
            var args = arguments;
            return this.each(function () {
                for (var i = 0, length = args.length; i < length; i++) {
                    jQuery(args[i])[original](this)
                }
            })
        }
    });
    jQuery.each({
        removeAttr: function (name) {
            jQuery.attr(this, name, "");
            if (this.nodeType == 1) {
                this.removeAttribute(name)
            }
        },
        addClass: function (classNames) {
            jQuery.className.add(this, classNames)
        },
        removeClass: function (classNames) {
            jQuery.className.remove(this, classNames)
        },
        toggleClass: function (classNames) {
            jQuery.className[jQuery.className.has(this, classNames) ? "remove" : "add"](this, classNames)
        },
        remove: function (selector) {
            if (!selector || jQuery.filter(selector, [this]).r.length) {
                jQuery("*", this).add(this).each(function () {
                    jQuery.event.remove(this);
                    jQuery.removeData(this)
                });
                if (this.parentNode) {
                    this.parentNode.removeChild(this)
                }
            }
        },
        empty: function () {
            jQuery(">*", this).remove();
            while (this.firstChild) {
                this.removeChild(this.firstChild)
            }
        }
    },
    function (name, fn) {
        jQuery.fn[name] = function () {
            return this.each(fn, arguments)
        }
    });
    jQuery.each(["Height", "Width"], function (i, name) {
        var type = name.toLowerCase();
        jQuery.fn[type] = function (size) {
            return this[0] == window ? jQuery.browser.opera && document.body["client" + name] || jQuery.browser.safari && window["inner" + name] || document.compatMode == "CSS1Compat" && document.documentElement["client" + name] || document.body["client" + name] : this[0] == document ? Math.max(Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]), Math.max(document.body["offset" + name], document.documentElement["offset" + name])) : size == undefined ? (this.length ? jQuery.css(this[0], type) : null) : this.css(type, size.constructor == String ? size : size + "px")
        }
    });
    function num(elem, prop) {
        return elem[0] && parseInt(jQuery.curCSS(elem[0], prop, true), 10) || 0
    }
    var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ? "(?:[\\w*_-]|\\\\.)" : "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
    quickChild = new RegExp("^>\\s*(" + chars + "+)"),
    quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
    quickClass = new RegExp("^([#.]?)(" + chars + "*)");
    jQuery.extend({
        expr: {
            "": function (a, i, m) {
                return m[2] == "*" || jQuery.nodeName(a, m[2])
            },
            "#": function (a, i, m) {
                return a.getAttribute("id") == m[2]
            },
            ":": {
                lt: function (a, i, m) {
                    return i < m[3] - 0
                },
                gt: function (a, i, m) {
                    return i > m[3] - 0
                },
                nth: function (a, i, m) {
                    return m[3] - 0 == i
                },
                eq: function (a, i, m) {
                    return m[3] - 0 == i
                },
                first: function (a, i) {
                    return i == 0
                },
                last: function (a, i, m, r) {
                    return i == r.length - 1
                },
                even: function (a, i) {
                    return i % 2 == 0
                },
                odd: function (a, i) {
                    return i % 2
                },
                "first-child": function (a) {
                    return a.parentNode.getElementsByTagName("*")[0] == a
                },
                "last-child": function (a) {
                    return jQuery.nth(a.parentNode.lastChild, 1, "previousSibling") == a
                },
                "only-child": function (a) {
                    return !jQuery.nth(a.parentNode.lastChild, 2, "previousSibling")
                },
                parent: function (a) {
                    return a.firstChild
                },
                empty: function (a) {
                    return !a.firstChild
                },
                contains: function (a, i, m) {
                    return (a.textContent || a.innerText || jQuery(a).text() || "").indexOf(m[3]) >= 0
                },
                visible: function (a) {
                    return "hidden" != a.type && jQuery.css(a, "display") != "none" && jQuery.css(a, "visibility") != "hidden"
                },
                hidden: function (a) {
                    return "hidden" == a.type || jQuery.css(a, "display") == "none" || jQuery.css(a, "visibility") == "hidden"
                },
                enabled: function (a) {
                    return !a.disabled
                },
                disabled: function (a) {
                    return a.disabled
                },
                checked: function (a) {
                    return a.checked
                },
                selected: function (a) {
                    return a.selected || jQuery.attr(a, "selected")
                },
                text: function (a) {
                    return "text" == a.type
                },
                radio: function (a) {
                    return "radio" == a.type
                },
                checkbox: function (a) {
                    return "checkbox" == a.type
                },
                file: function (a) {
                    return "file" == a.type
                },
                password: function (a) {
                    return "password" == a.type
                },
                submit: function (a) {
                    return "submit" == a.type
                },
                image: function (a) {
                    return "image" == a.type
                },
                reset: function (a) {
                    return "reset" == a.type
                },
                button: function (a) {
                    return "button" == a.type || jQuery.nodeName(a, "button")
                },
                input: function (a) {
                    return /input|select|textarea|button/i.test(a.nodeName)
                },
                has: function (a, i, m) {
                    return jQuery.find(m[3], a).length
                },
                header: function (a) {
                    return /h\d/i.test(a.nodeName)
                },
                animated: function (a) {
                    return jQuery.grep(jQuery.timers, function (fn) {
                        return a == fn.elem
                    }).length
                }
            }
        },
        parse: [/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/, /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/, new RegExp("^([:.#]*)(" + chars + "+)")],
        multiFilter: function (expr, elems, not) {
            var old, cur = [];
            while (expr && expr != old) {
                old = expr;
                var f = jQuery.filter(expr, elems, not);
                expr = f.t.replace(/^\s*,\s*/, "");
                cur = not ? elems = f.r : jQuery.merge(cur, f.r)
            }
            return cur
        },
        find: function (t, context) {
            if (typeof t != "string") {
                return [t]
            }
            if (context && context.nodeType != 1 && context.nodeType != 9) {
                return []
            }
            context = context || document;
            var ret = [context],
            done = [],
            last,
            nodeName;
            while (t && last != t) {
                var r = [];
                last = t;
                t = jQuery.trim(t);
                var foundToken = false,
                re = quickChild,
                m = re.exec(t);
                if (m) {
                    nodeName = m[1].toUpperCase();
                    for (var i = 0; ret[i]; i++) {
                        for (var c = ret[i].firstChild; c; c = c.nextSibling) {
                            if (c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName)) {
                                r.push(c)
                            }
                        }
                    }
                    ret = r;
                    t = t.replace(re, "");
                    if (t.indexOf(" ") == 0) {
                        continue
                    }
                    foundToken = true
                } else {
                    re = /^([>+~])\s*(\w*)/i;
                    if ((m = re.exec(t)) != null) {
                        r = [];
                        var merge = {};
                        nodeName = m[2].toUpperCase();
                        m = m[1];
                        for (var j = 0, rl = ret.length; j < rl; j++) {
                            var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
                            for (; n; n = n.nextSibling) {
                                if (n.nodeType == 1) {
                                    var id = jQuery.data(n);
                                    if (m == "~" && merge[id]) {
                                        break
                                    }
                                    if (!nodeName || n.nodeName.toUpperCase() == nodeName) {
                                        if (m == "~") {
                                            merge[id] = true
                                        }
                                        r.push(n)
                                    }
                                    if (m == "+") {
                                        break
                                    }
                                }
                            }
                        }
                        ret = r;
                        t = jQuery.trim(t.replace(re, ""));
                        foundToken = true
                    }
                }
                if (t && !foundToken) {
                    if (!t.indexOf(",")) {
                        if (context == ret[0]) {
                            ret.shift()
                        }
                        done = jQuery.merge(done, ret);
                        r = ret = [context];
                        t = " " + t.substr(1, t.length)
                    } else {
                        var re2 = quickID;
                        var m = re2.exec(t);
                        if (m) {
                            m = [0, m[2], m[3], m[1]]
                        } else {
                            re2 = quickClass;
                            m = re2.exec(t)
                        }
                        m[2] = m[2].replace(/\\/g, "");
                        var elem = ret[ret.length - 1];
                        if (m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem)) {
                            var oid = elem.getElementById(m[2]);
                            if ((jQuery.browser.msie || jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2]) {
                                oid = jQuery('[@id="' + m[2] + '"]', elem)[0]
                            }
                            ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : []
                        } else {
                            for (var i = 0; ret[i]; i++) {
                                var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
                                if (tag == "*" && ret[i].nodeName.toLowerCase() == "object") {
                                    tag = "param"
                                }
                                r = jQuery.merge(r, ret[i].getElementsByTagName(tag))
                            }
                            if (m[1] == ".") {
                                r = jQuery.classFilter(r, m[2])
                            }
                            if (m[1] == "#") {
                                var tmp = [];
                                for (var i = 0; r[i]; i++) {
                                    if (r[i].getAttribute("id") == m[2]) {
                                        tmp = [r[i]];
                                        break
                                    }
                                }
                                r = tmp
                            }
                            ret = r
                        }
                        t = t.replace(re2, "")
                    }
                }
                if (t) {
                    var val = jQuery.filter(t, r);
                    ret = r = val.r;
                    t = jQuery.trim(val.t)
                }
            }
            if (t) {
                ret = []
            }
            if (ret && context == ret[0]) {
                ret.shift()
            }
            done = jQuery.merge(done, ret);
            return done
        },
        classFilter: function (r, m, not) {
            m = " " + m + " ";
            var tmp = [];
            for (var i = 0; r[i]; i++) {
                var pass = (" " + r[i].className + " ").indexOf(m) >= 0;
                if (!not && pass || not && !pass) {
                    tmp.push(r[i])
                }
            }
            return tmp
        },
        filter: function (t, r, not) {
            var last;
            while (t && t != last) {
                last = t;
                var p = jQuery.parse,
                m;
                for (var i = 0; p[i]; i++) {
                    m = p[i].exec(t);
                    if (m) {
                        t = t.substring(m[0].length);
                        m[2] = m[2].replace(/\\/g, "");
                        break
                    }
                }
                if (!m) {
                    break
                }
                if (m[1] == ":" && m[2] == "not") {
                    r = isSimple.test(m[3]) ? jQuery.filter(m[3], r, true).r : jQuery(r).not(m[3])
                } else {
                    if (m[1] == ".") {
                        r = jQuery.classFilter(r, m[2], not)
                    } else {
                        if (m[1] == "[") {
                            var tmp = [],
                            type = m[3];
                            for (var i = 0, rl = r.length; i < rl; i++) {
                                var a = r[i],
                                z = a[jQuery.props[m[2]] || m[2]];
                                if (z == null || /href|src|selected/.test(m[2])) {
                                    z = jQuery.attr(a, m[2]) || ""
                                }
                                if ((type == "" && !!z || type == "=" && z == m[5] || type == "!=" && z != m[5] || type == "^=" && z && !z.indexOf(m[5]) || type == "$=" && z.substr(z.length - m[5].length) == m[5] || (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not) {
                                    tmp.push(a)
                                }
                            }
                            r = tmp
                        } else {
                            if (m[1] == ":" && m[2] == "nth-child") {
                                var merge = {},
                                tmp = [],
                                test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" || !/\D/.test(m[3]) && "0n+" + m[3] || m[3]),
                                first = (test[1] + (test[2] || 1)) - 0,
                                last = test[3] - 0;
                                for (var i = 0, rl = r.length; i < rl; i++) {
                                    var node = r[i],
                                    parentNode = node.parentNode,
                                    id = jQuery.data(parentNode);
                                    if (!merge[id]) {
                                        var c = 1;
                                        for (var n = parentNode.firstChild; n; n = n.nextSibling) {
                                            if (n.nodeType == 1) {
                                                n.nodeIndex = c++
                                            }
                                        }
                                        merge[id] = true
                                    }
                                    var add = false;
                                    if (first == 0) {
                                        if (node.nodeIndex == last) {
                                            add = true
                                        }
                                    } else {
                                        if ((node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0) {
                                            add = true
                                        }
                                    }
                                    if (add ^ not) {
                                        tmp.push(node)
                                    }
                                }
                                r = tmp
                            } else {
                                var fn = jQuery.expr[m[1]];
                                if (typeof fn == "object") {
                                    fn = fn[m[2]]
                                }
                                if (typeof fn == "string") {
                                    fn = eval("false||function(a,i){return " + fn + ";}")
                                }
                                r = jQuery.grep(r, function (elem, i) {
                                    return fn(elem, i, m, r)
                                },
                                not)
                            }
                        }
                    }
                }
            }
            return {
                r: r,
                t: t
            }
        },
        dir: function (elem, dir) {
            var matched = [],
            cur = elem[dir];
            while (cur && cur != document) {
                if (cur.nodeType == 1) {
                    matched.push(cur)
                }
                cur = cur[dir]
            }
            return matched
        },
        nth: function (cur, result, dir, elem) {
            result = result || 1;
            var num = 0;
            for (; cur; cur = cur[dir]) {
                if (cur.nodeType == 1 && ++num == result) {
                    break
                }
            }
            return cur
        },
        sibling: function (n, elem) {
            var r = [];
            for (; n; n = n.nextSibling) {
                if (n.nodeType == 1 && n != elem) {
                    r.push(n)
                }
            }
            return r
        }
    });
    jQuery.event = {
        add: function (elem, types, handler, data) {
            if (elem.nodeType == 3 || elem.nodeType == 8) {
                return
            }
            if (jQuery.browser.msie && elem.setInterval) {
                elem = window
            }
            if (!handler.guid) {
                handler.guid = this.guid++
            }
            if (data != undefined) {
                var fn = handler;
                handler = this.proxy(fn, function () {
                    return fn.apply(this, arguments)
                });
                handler.data = data
            }
            var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}),
            handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function () {
                if (typeof jQuery != "undefined" && !jQuery.event.triggered) {
                    return jQuery.event.handle.apply(arguments.callee.elem, arguments)
                }
            });
            handle.elem = elem;
            jQuery.each(types.split(/\s+/), function (index, type) {
                var parts = type.split(".");
                type = parts[0];
                handler.type = parts[1];
                var handlers = events[type];
                if (!handlers) {
                    handlers = events[type] = {};
                    if (!jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false) {
                        if (elem.addEventListener) {
                            elem.addEventListener(type, handle, false)
                        } else {
                            if (elem.attachEvent) {
                                elem.attachEvent("on" + type, handle)
                            }
                        }
                    }
                }
                handlers[handler.guid] = handler;
                jQuery.event.global[type] = true
            });
            elem = null
        },
        guid: 1,
        global: {},
        remove: function (elem, types, handler) {
            if (elem.nodeType == 3 || elem.nodeType == 8) {
                return
            }
            var events = jQuery.data(elem, "events"),
            ret,
            index;
            if (events) {
                if (types == undefined || (typeof types == "string" && types.charAt(0) == ".")) {
                    for (var type in events) {
                        this.remove(elem, type + (types || ""))
                    }
                } else {
                    if (types.type) {
                        handler = types.handler;
                        types = types.type
                    }
                    jQuery.each(types.split(/\s+/), function (index, type) {
                        var parts = type.split(".");
                        type = parts[0];
                        if (events[type]) {
                            if (handler) {
                                delete events[type][handler.guid]
                            } else {
                                for (handler in events[type]) {
                                    if (!parts[1] || events[type][handler].type == parts[1]) {
                                        delete events[type][handler]
                                    }
                                }
                            }
                            for (ret in events[type]) {
                                break
                            }
                            if (!ret) {
                                if (!jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false) {
                                    if (elem.removeEventListener) {
                                        elem.removeEventListener(type, jQuery.data(elem, "handle"), false)
                                    } else {
                                        if (elem.detachEvent) {
                                            elem.detachEvent("on" + type, jQuery.data(elem, "handle"))
                                        }
                                    }
                                }
                                ret = null;
                                delete events[type]
                            }
                        }
                    })
                }
                for (ret in events) {
                    break
                }
                if (!ret) {
                    var handle = jQuery.data(elem, "handle");
                    if (handle) {
                        handle.elem = null
                    }
                    jQuery.removeData(elem, "events");
                    jQuery.removeData(elem, "handle")
                }
            }
        },
        trigger: function (type, data, elem, donative, extra) {
            data = jQuery.makeArray(data);
            if (type.indexOf("!") >= 0) {
                type = type.slice(0, -1);
                var exclusive = true
            }
            if (!elem) {
                if (this.global[type]) {
                    jQuery("*").add([window, document]).trigger(type, data)
                }
            } else {
                if (elem.nodeType == 3 || elem.nodeType == 8) {
                    return undefined
                }
                var val, ret, fn = jQuery.isFunction(elem[type] || null),
                event = !data[0] || !data[0].preventDefault;
                if (event) {
                    data.unshift({
                        type: type,
                        target: elem,
                        preventDefault: function () {},
                        stopPropagation: function () {},
                        timeStamp: now()
                    });
                    data[0][expando] = true
                }
                data[0].type = type;
                if (exclusive) {
                    data[0].exclusive = true
                }
                var handle = jQuery.data(elem, "handle");
                if (handle) {
                    val = handle.apply(elem, data)
                }
                if ((!fn || (jQuery.nodeName(elem, "a") && type == "click")) && elem["on" + type] && elem["on" + type].apply(elem, data) === false) {
                    val = false
                }
                if (event) {
                    data.shift()
                }
                if (extra && jQuery.isFunction(extra)) {
                    ret = extra.apply(elem, val == null ? data : data.concat(val));
                    if (ret !== undefined) {
                        val = ret
                    }
                }
                if (fn && donative !== false && val !== false && !(jQuery.nodeName(elem, "a") && type == "click")) {
                    this.triggered = true;
                    try {
                        elem[type]()
                    } catch(e) {}
                }
                this.triggered = false
            }
            return val
        },
        handle: function (event) {
            var val, ret, namespace, all, handlers;
            event = arguments[0] = jQuery.event.fix(event || window.event);
            namespace = event.type.split(".");
            event.type = namespace[0];
            namespace = namespace[1];
            all = !namespace && !event.exclusive;
            handlers = (jQuery.data(this, "events") || {})[event.type];
            for (var j in handlers) {
                var handler = handlers[j];
                if (all || handler.type == namespace) {
                    event.handler = handler;
                    event.data = handler.data;
                    ret = handler.apply(this, arguments);
                    if (val !== false) {
                        val = ret
                    }
                    if (ret === false) {
                        event.preventDefault();
                        event.stopPropagation()
                    }
                }
            }
            return val
        },
        fix: function (event) {
            if (event[expando] == true) {
                return event
            }
            var originalEvent = event;
            event = {
                originalEvent: originalEvent
            };
            var 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 timeStamp toElement type view wheelDelta which".split(" ");
            for (var i = props.length; i; i--) {
                event[props[i]] = originalEvent[props[i]]
            }
            event[expando] = true;
            event.preventDefault = function () {
                if (originalEvent.preventDefault) {
                    originalEvent.preventDefault()
                }
                originalEvent.returnValue = false
            };
            event.stopPropagation = function () {
                if (originalEvent.stopPropagation) {
                    originalEvent.stopPropagation()
                }
                originalEvent.cancelBubble = true
            };
            event.timeStamp = event.timeStamp || now();
            if (!event.target) {
                event.target = event.srcElement || document
            }
            if (event.target.nodeType == 3) {
                event.target = event.target.parentNode
            }
            if (!event.relatedTarget && event.fromElement) {
                event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement
            }
            if (event.pageX == null && event.clientX != null) {
                var doc = document.documentElement,
                body = document.body;
                event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0);
                event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0)
            }
            if (!event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode)) {
                event.which = event.charCode || event.keyCode
            }
            if (!event.metaKey && event.ctrlKey) {
                event.metaKey = event.ctrlKey
            }
            if (!event.which && event.button) {
                event.which = (event.button & 1 ? 1 : (event.button & 2 ? 3 : (event.button & 4 ? 2 : 0)))
            }
            return event
        },
        proxy: function (fn, proxy) {
            proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++;
            return proxy
        },
        special: {
            ready: {
                setup: function () {
                    bindReady();
                    return
                },
                teardown: function () {
                    return
                }
            },
            mouseenter: {
                setup: function () {
                    if (jQuery.browser.msie) {
                        return false
                    }
                    jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
                    return true
                },
                teardown: function () {
                    if (jQuery.browser.msie) {
                        return false
                    }
                    jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
                    return true
                },
                handler: function (event) {
                    if (withinElement(event, this)) {
                        return true
                    }
                    event.type = "mouseenter";
                    return jQuery.event.handle.apply(this, arguments)
                }
            },
            mouseleave: {
                setup: function () {
                    if (jQuery.browser.msie) {
                        return false
                    }
                    jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
                    return true
                },
                teardown: function () {
                    if (jQuery.browser.msie) {
                        return false
                    }
                    jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
                    return true
                },
                handler: function (event) {
                    if (withinElement(event, this)) {
                        return true
                    }
                    event.type = "mouseleave";
                    return jQuery.event.handle.apply(this, arguments)
                }
            }
        }
    };
    jQuery.fn.extend({
        bind: function (type, data, fn) {
            return type == "unload" ? this.one(type, data, fn) : this.each(function () {
                jQuery.event.add(this, type, fn || data, fn && data)
            })
        },
        one: function (type, data, fn) {
            var one = jQuery.event.proxy(fn || data, function (event) {
                jQuery(this).unbind(event, one);
                return (fn || data).apply(this, arguments)
            });
            return this.each(function () {
                jQuery.event.add(this, type, one, fn && data)
            })
        },
        unbind: function (type, fn) {
            return this.each(function () {
                jQuery.event.remove(this, type, fn)
            })
        },
        trigger: function (type, data, fn) {
            return this.each(function () {
                jQuery.event.trigger(type, data, this, true, fn)
            })
        },
        triggerHandler: function (type, data, fn) {
            return this[0] && jQuery.event.trigger(type, data, this[0], false, fn)
        },
        toggle: function (fn) {
            var args = arguments,
            i = 1;
            while (i < args.length) {
                jQuery.event.proxy(fn, args[i++])
            }
            return this.click(jQuery.event.proxy(fn, function (event) {
                this.lastToggle = (this.lastToggle || 0) % i;
                event.preventDefault();
                return args[this.lastToggle++].apply(this, arguments) || false
            }))
        },
        hover: function (fnOver, fnOut) {
            return this.bind("mouseenter", fnOver).bind("mouseleave", fnOut)
        },
        ready: function (fn) {
            bindReady();
            if (jQuery.isReady) {
                fn.call(document, jQuery)
            } else {
                jQuery.readyList.push(function () {
                    return fn.call(this, jQuery)
                })
            }
            return this
        }
    });
    jQuery.extend({
        isReady: false,
        readyList: [],
        ready: function () {
            if (!jQuery.isReady) {
                jQuery.isReady = true;
                if (jQuery.readyList) {
                    jQuery.each(jQuery.readyList, function () {
                        this.call(document)
                    });
                    jQuery.readyList = null
                }
                jQuery(document).triggerHandler("ready")
            }
        }
    });
    var readyBound = false;
    function bindReady() {
        if (readyBound) {
            return
        }
        readyBound = true;
        if (document.addEventListener && !jQuery.browser.opera) {
            document.addEventListener("DOMContentLoaded", jQuery.ready, false)
        }
        if (jQuery.browser.msie && window == top) {
            (function () {
                if (jQuery.isReady) {
                    return
                }
                try {
                    document.documentElement.doScroll("left")
                } catch(error) {
                    setTimeout(arguments.callee, 0);
                    return
                }
                jQuery.ready()
            })()
        }
        if (jQuery.browser.opera) {
            document.addEventListener("DOMContentLoaded", function () {
                if (jQuery.isReady) {
                    return
                }
                for (var i = 0; i < document.styleSheets.length; i++) {
                    if (document.styleSheets[i].disabled) {
                        setTimeout(arguments.callee, 0);
                        return
                    }
                }
                jQuery.ready()
            },
            false)
        }
        if (jQuery.browser.safari) {
            var numStyles;
            (function () {
                if (jQuery.isReady) {
                    return
                }
                if (document.readyState != "loaded" && document.readyState != "complete") {
                    setTimeout(arguments.callee, 0);
                    return
                }
                if (numStyles === undefined) {
                    numStyles = jQuery("style, link[rel=stylesheet]").length
                }
                if (document.styleSheets.length != numStyles) {
                    setTimeout(arguments.callee, 0);
                    return
                }
                jQuery.ready()
            })()
        }
        jQuery.event.add(window, "load", jQuery.ready)
    }
    jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,change,select,submit,keydown,keypress,keyup,error").split(","), function (i, name) {
        jQuery.fn[name] = function (fn) {
            return fn ? this.bind(name, fn) : this.trigger(name)
        }
    });
    var withinElement = function (event, elem) {
        var parent = event.relatedTarget;
        while (parent && parent != elem) {
            try {
                parent = parent.parentNode
            } catch(error) {
                parent = elem
            }
        }
        return parent == elem
    };
    jQuery(window).bind("unload", function () {
        jQuery("*").add(document).unbind()
    });
    jQuery.fn.extend({
        _load: jQuery.fn.load,
        load: function (url, params, callback) {
            if (typeof url != "string") {
                return this._load(url)
            }
            var off = url.indexOf(" ");
            if (off >= 0) {
                var selector = url.slice(off, url.length);
                url = url.slice(0, off)
            }
            callback = callback ||
            function () {};
            var type = "GET";
            if (params) {
                if (jQuery.isFunction(params)) {
                    callback = params;
                    params = null
                } else {
                    params = jQuery.param(params);
                    type = "POST"
                }
            }
            var self = this;
            jQuery.ajax({
                url: url,
                type: type,
                dataType: "html",
                data: params,
                complete: function (res, status) {
                    if (status == "success" || status == "notmodified") {
                        self.html(selector ? jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")).find(selector) : res.responseText)
                    }
                    self.each(callback, [res.responseText, status, res])
                }
            });
            return this
        },
        serialize: function () {
            return jQuery.param(this.serializeArray())
        },
        serializeArray: function () {
            return this.map(function () {
                return jQuery.nodeName(this, "form") ? jQuery.makeArray(this.elements) : this
            }).filter(function () {
                return this.name && !this.disabled && (this.checked || /select|textarea/i.test(this.nodeName) || /text|hidden|password/i.test(this.type))
            }).map(function (i, elem) {
                var val = jQuery(this).val();
                return val == null ? null : val.constructor == Array ? jQuery.map(val, function (val, i) {
                    return {
                        name: elem.name,
                        value: val
                    }
                }) : {
                    name: elem.name,
                    value: val
                }
            }).get()
        }
    });
    jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function (i, o) {
        jQuery.fn[o] = function (f) {
            return this.bind(o, f)
        }
    });
    var jsc = now();
    jQuery.extend({
        get: function (url, data, callback, type) {
            if (jQuery.isFunction(data)) {
                callback = data;
                data = null
            }
            return jQuery.ajax({
                type: "GET",
                url: url,
                data: data,
                success: callback,
                dataType: type
            })
        },
        getScript: function (url, callback) {
            return jQuery.get(url, null, callback, "script")
        },
        getJSON: function (url, data, callback) {
            return jQuery.get(url, data, callback, "json")
        },
        post: function (url, data, callback, type) {
            if (jQuery.isFunction(data)) {
                callback = data;
                data = {}
            }
            return jQuery.ajax({
                type: "POST",
                url: url,
                data: data,
                success: callback,
                dataType: type
            })
        },
        ajaxSetup: function (settings) {
            jQuery.extend(jQuery.ajaxSettings, settings)
        },
        ajaxSettings: {
            url: location.href,
            global: true,
            type: "GET",
            timeout: 0,
            contentType: "application/x-www-form-urlencoded",
            processData: true,
            async: true,
            data: null,
            username: null,
            password: null,
            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 (s) {
            s = jQuery.extend(true, s, jQuery.extend(true, {},
            jQuery.ajaxSettings, s));
            var jsonp, jsre = /=\?(&|$)/g,
            status, data, type = s.type.toUpperCase();
            if (s.data && s.processData && typeof s.data != "string") {
                s.data = jQuery.param(s.data)
            }
            if (s.dataType == "jsonp") {
                if (type == "GET") {
                    if (!s.url.match(jsre)) {
                        s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?"
                    }
                } else {
                    if (!s.data || !s.data.match(jsre)) {
                        s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"
                    }
                }
                s.dataType = "json"
            }
            if (s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre))) {
                jsonp = "jsonp" + jsc++;
                if (s.data) {
                    s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1")
                }
                s.url = s.url.replace(jsre, "=" + jsonp + "$1");
                s.dataType = "script";
                window[jsonp] = function (tmp) {
                    data = tmp;
                    success();
                    complete();
                    window[jsonp] = undefined;
                    try {
                        delete window[jsonp]
                    } catch(e) {}
                    if (head) {
                        head.removeChild(script)
                    }
                }
            }
            if (s.dataType == "script" && s.cache == null) {
                s.cache = false
            }
            if (s.cache === false && type == "GET") {
                var ts = now();
                var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
                s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : "")
            }
            if (s.data && type == "GET") {
                s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
                s.data = null
            }
            if (s.global && !jQuery.active++) {
                jQuery.event.trigger("ajaxStart")
            }
            var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
            if (s.dataType == "script" && type == "GET" && remote.test(s.url) && remote.exec(s.url)[1] != location.host) {
                var head = document.getElementsByTagName("head")[0];
                var script = document.createElement("script");
                script.src = s.url;
                if (s.scriptCharset) {
                    script.charset = s.scriptCharset
                }
                if (!jsonp) {
                    var done = false;
                    script.onload = script.onreadystatechange = function () {
                        if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) {
                            done = true;
                            success();
                            complete();
                            head.removeChild(script)
                        }
                    }
                }
                head.appendChild(script);
                return undefined
            }
            var requestDone = false;
            var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
            if (s.username) {
                xhr.open(type, s.url, s.async, s.username, s.password)
            } else {
                xhr.open(type, s.url, s.async)
            }
            try {
                if (s.data) {
                    xhr.setRequestHeader("Content-Type", s.contentType)
                }
                if (s.ifModified) {
                    xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT")
                }
                xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
                xhr.setRequestHeader("Accept", s.dataType && s.accepts[s.dataType] ? s.accepts[s.dataType] + ", */*" : s.accepts._default)
            } catch(e) {}
            if (s.beforeSend && s.beforeSend(xhr, s) === false) {
                s.global && jQuery.active--;
                xhr.abort();
                return false
            }
            if (s.global) {
                jQuery.event.trigger("ajaxSend", [xhr, s])
            }
            var onreadystatechange = function (isTimeout) {
                if (!requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout")) {
                    requestDone = true;
                    if (ival) {
                        clearInterval(ival);
                        ival = null
                    }
                    status = isTimeout == "timeout" && "timeout" || !jQuery.httpSuccess(xhr) && "error" || s.ifModified && jQuery.httpNotModified(xhr, s.url) && "notmodified" || "success";
                    if (status == "success") {
                        try {
                            data = jQuery.httpData(xhr, s.dataType, s.dataFilter)
                        } catch(e) {
                            status = "parsererror"
                        }
                    }
                    if (status == "success") {
                        var modRes;
                        try {
                            modRes = xhr.getResponseHeader("Last-Modified")
                        } catch(e) {}
                        if (s.ifModified && modRes) {
                            jQuery.lastModified[s.url] = modRes
                        }
                        if (!jsonp) {
                            success()
                        }
                    } else {
                        jQuery.handleError(s, xhr, status)
                    }
                    complete();
                    if (s.async) {
                        xhr = null
                    }
                }
            };
            if (s.async) {
                var ival = setInterval(onreadystatechange, 13);
                if (s.timeout > 0) {
                    setTimeout(function () {
                        if (xhr) {
                            xhr.abort();
                            if (!requestDone) {
                                onreadystatechange("timeout")
                            }
                        }
                    },
                    s.timeout)
                }
            }
            try {
                xhr.send(s.data)
            } catch(e) {
                jQuery.handleError(s, xhr, null, e)
            }
            if (!s.async) {
                onreadystatechange()
            }
            function success() {
                if (s.success) {
                    s.success(data, status)
                }
                if (s.global) {
                    jQuery.event.trigger("ajaxSuccess", [xhr, s])
                }
            }
            function complete() {
                if (s.complete) {
                    s.complete(xhr, status)
                }
                if (s.global) {
                    jQuery.event.trigger("ajaxComplete", [xhr, s])
                }
                if (s.global && !--jQuery.active) {
                    jQuery.event.trigger("ajaxStop")
                }
            }
            return xhr
        },
        handleError: function (s, xhr, status, e) {
            if (s.error) {
                s.error(xhr, status, e)
            }
            if (s.global) {
                jQuery.event.trigger("ajaxError", [xhr, s, e])
            }
        },
        active: 0,
        httpSuccess: function (xhr) {
            try {
                return !xhr.status && location.protocol == "file:" || (xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || xhr.status == 1223 || jQuery.browser.safari && xhr.status == undefined
            } catch(e) {}
            return false
        },
        httpNotModified: function (xhr, url) {
            try {
                var xhrRes = xhr.getResponseHeader("Last-Modified");
                return xhr.status == 304 || xhrRes == jQuery.lastModified[url] || jQuery.browser.safari && xhr.status == undefined
            } catch(e) {}
            return false
        },
        httpData: function (xhr, type, filter) {
            var ct = xhr.getResponseHeader("content-type"),
            xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
            data = xml ? xhr.responseXML : xhr.responseText;
            if (xml && data.documentElement.tagName == "parsererror") {
                throw "parsererror"
            }
            if (filter) {
                data = filter(data, type)
            }
            if (type == "script") {
                jQuery.globalEval(data)
            }
            if (type == "json") {
                data = eval("(" + data + ")")
            }
            return data
        },
        param: function (a) {
            var s = [];
            if (a.constructor == Array || a.jquery) {
                jQuery.each(a, function () {
                    s.push(encodeURIComponent(this.name) + "=" + encodeURIComponent(this.value))
                })
            } else {
                for (var j in a) {
                    if (a[j] && a[j].constructor == Array) {
                        jQuery.each(a[j], function () {
                            s.push(encodeURIComponent(j) + "=" + encodeURIComponent(this))
                        })
                    } else {
                        s.push(encodeURIComponent(j) + "=" + encodeURIComponent(jQuery.isFunction(a[j]) ? a[j]() : a[j]))
                    }
                }
            }
            return s.join("&").replace(/%20/g, "+")
        }
    });
    jQuery.fn.extend({
        show: function (speed, callback) {
            return speed ? this.animate({
                height: "show",
                width: "show",
                opacity: "show"
            },
            speed, callback) : this.filter(":hidden").each(function () {
                this.style.display = this.oldblock || "";
                if (jQuery.css(this, "display") == "none") {
                    var elem = jQuery("<" + this.tagName + " />").appendTo("body");
                    this.style.display = elem.css("display");
                    if (this.style.display == "none") {
                        this.style.display = "block"
                    }
                    elem.remove()
                }
            }).end()
        },
        hide: function (speed, callback) {
            return speed ? this.animate({
                height: "hide",
                width: "hide",
                opacity: "hide"
            },
            speed, callback) : this.filter(":visible").each(function () {
                this.oldblock = this.oldblock || jQuery.css(this, "display");
                this.style.display = "none"
            }).end()
        },
        _toggle: jQuery.fn.toggle,
        toggle: function (fn, fn2) {
            return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? this._toggle.apply(this, arguments) : fn ? this.animate({
                height: "toggle",
                width: "toggle",
                opacity: "toggle"
            },
            fn, fn2) : this.each(function () {
                jQuery(this)[jQuery(this).is(":hidden") ? "show" : "hide"]()
            })
        },
        slideDown: function (speed, callback) {
            return this.animate({
                height: "show"
            },
            speed, callback)
        },
        slideUp: function (speed, callback) {
            return this.animate({
                height: "hide"
            },
            speed, callback)
        },
        slideToggle: function (speed, callback) {
            return this.animate({
                height: "toggle"
            },
            speed, callback)
        },
        fadeIn: function (speed, callback) {
            return this.animate({
                opacity: "show"
            },
            speed, callback)
        },
        fadeOut: function (speed, callback) {
            return this.animate({
                opacity: "hide"
            },
            speed, callback)
        },
        fadeTo: function (speed, to, callback) {
            return this.animate({
                opacity: to
            },
            speed, callback)
        },
        animate: function (prop, speed, easing, callback) {
            var optall = jQuery.speed(speed, easing, callback);
            return this[optall.queue === false ? "each" : "queue"](function () {
                if (this.nodeType != 1) {
                    return false
                }
                var opt = jQuery.extend({},
                optall),
                p,
                hidden = jQuery(this).is(":hidden"),
                self = this;
                for (p in prop) {
                    if (prop[p] == "hide" && hidden || prop[p] == "show" && !hidden) {
                        return opt.complete.call(this)
                    }
                    if (p == "height" || p == "width") {
                        opt.display = jQuery.css(this, "display");
                        opt.overflow = this.style.overflow
                    }
                }
                if (opt.overflow != null) {
                    this.style.overflow = "hidden"
                }
                opt.curAnim = jQuery.extend({},
                prop);
                jQuery.each(prop, function (name, val) {
                    var e = new jQuery.fx(self, opt, name);
                    if (/toggle|show|hide/.test(val)) {
                        e[val == "toggle" ? hidden ? "show" : "hide" : val](prop)
                    } else {
                        var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
                        start = e.cur(true) || 0;
                        if (parts) {
                            var end = parseFloat(parts[2]),
                            unit = parts[3] || "px";
                            if (unit != "px") {
                                self.style[name] = (end || 1) + unit;
                                start = ((end || 1) / e.cur(true)) * start;
                                self.style[name] = start + unit
                            }
                            if (parts[1]) {
                                end = ((parts[1] == "-=" ? -1 : 1) * end) + start
                            }
                            e.custom(start, end, unit)
                        } else {
                            e.custom(start, val, "")
                        }
                    }
                });
                return true
            })
        },
        queue: function (type, fn) {
            if (jQuery.isFunction(type) || (type && type.constructor == Array)) {
                fn = type;
                type = "fx"
            }
            if (!type || (typeof type == "string" && !fn)) {
                return queue(this[0], type)
            }
            return this.each(function () {
                if (fn.constructor == Array) {
                    queue(this, type, fn)
                } else {
                    queue(this, type).push(fn);
                    if (queue(this, type).length == 1) {
                        fn.call(this)
                    }
                }
            })
        },
        stop: function (clearQueue, gotoEnd) {
            var timers = jQuery.timers;
            if (clearQueue) {
                this.queue([])
            }
            this.each(function () {
                for (var i = timers.length - 1; i >= 0; i--) {
                    if (timers[i].elem == this) {
                        if (gotoEnd) {
                            timers[i](true)
                        }
                        timers.splice(i, 1)
                    }
                }
            });
            if (!gotoEnd) {
                this.dequeue()
            }
            return this
        }
    });
    var queue = function (elem, type, array) {
        if (elem) {
            type = type || "fx";
            var q = jQuery.data(elem, type + "queue");
            if (!q || array) {
                q = jQuery.data(elem, type + "queue", jQuery.makeArray(array))
            }
        }
        return q
    };
    jQuery.fn.dequeue = function (type) {
        type = type || "fx";
        return this.each(function () {
            var q = queue(this, type);
            q.shift();
            if (q.length) {
                q[0].call(this)
            }
        })
    };
    jQuery.extend({
        speed: function (speed, easing, fn) {
            var opt = speed && speed.constructor == Object ? speed : {
                complete: fn || !fn && easing || jQuery.isFunction(speed) && speed,
                duration: speed,
                easing: fn && easing || easing && easing.constructor != Function && easing
            };
            opt.duration = (opt.duration && opt.duration.constructor == Number ? opt.duration : jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
            opt.old = opt.complete;
            opt.complete = function () {
                if (opt.queue !== false) {
                    jQuery(this).dequeue()
                }
                if (jQuery.isFunction(opt.old)) {
                    opt.old.call(this)
                }
            };
            return opt
        },
        easing: {
            linear: function (p, n, firstNum, diff) {
                return firstNum + diff * p
            },
            swing: function (p, n, firstNum, diff) {
                return ((-Math.cos(p * Math.PI) / 2) + 0.5) * diff + firstNum
            }
        },
        timers: [],
        timerId: null,
        fx: function (elem, options, prop) {
            this.options = options;
            this.elem = elem;
            this.prop = prop;
            if (!options.orig) {
                options.orig = {}
            }
        }
    });
    jQuery.fx.prototype = {
        update: function () {
            if (this.options.step) {
                this.options.step.call(this.elem, this.now, this)
            } (jQuery.fx.step[this.prop] || jQuery.fx.step._default)(this);
            if (this.prop == "height" || this.prop == "width") {
                this.elem.style.display = "block"
            }
        },
        cur: function (force) {
            if (this.elem[this.prop] != null && this.elem.style[this.prop] == null) {
                return this.elem[this.prop]
            }
            var r = parseFloat(jQuery.css(this.elem, this.prop, force));
            return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0
        },
        custom: function (from, to, unit) {
            this.startTime = now();
            this.start = from;
            this.end = to;
            this.unit = unit || this.unit || "px";
            this.now = this.start;
            this.pos = this.state = 0;
            this.update();
            var self = this;
            function t(gotoEnd) {
                return self.step(gotoEnd)
            }
            t.elem = this.elem;
            jQuery.timers.push(t);
            if (jQuery.timerId == null) {
                jQuery.timerId = setInterval(function () {
                    var timers = jQuery.timers;
                    for (var i = 0; i < timers.length; i++) {
                        if (!timers[i]()) {
                            timers.splice(i--, 1)
                        }
                    }
                    if (!timers.length) {
                        clearInterval(jQuery.timerId);
                        jQuery.timerId = null
                    }
                },
                13)
            }
        },
        show: function () {
            this.options.orig[this.prop] = jQuery.attr(this.elem.style, this.prop);
            this.options.show = true;
            this.custom(0, this.cur());
            if (this.prop == "width" || this.prop == "height") {
                this.elem.style[this.prop] = "1px"
            }
            jQuery(this.elem).show()
        },
        hide: function () {
            this.options.orig[this.prop] = jQuery.attr(this.elem.style, this.prop);
            this.options.hide = true;
            this.custom(this.cur(), 0)
        },
        step: function (gotoEnd) {
            var t = now();
            if (gotoEnd || t > this.options.duration + this.startTime) {
                this.now = this.end;
                this.pos = this.state = 1;
                this.update();
                this.options.curAnim[this.prop] = true;
                var done = true;
                for (var i in this.options.curAnim) {
                    if (this.options.curAnim[i] !== true) {
                        done = false
                    }
                }
                if (done) {
                    if (this.options.display != null) {
                        this.elem.style.overflow = this.options.overflow;
                        this.elem.style.display = this.options.display;
                        if (jQuery.css(this.elem, "display") == "none") {
                            this.elem.style.display = "block"
                        }
                    }
                    if (this.options.hide) {
                        this.elem.style.display = "none"
                    }
                    if (this.options.hide || this.options.show) {
                        for (var p in this.options.curAnim) {
                            jQuery.attr(this.elem.style, p, this.options.orig[p])
                        }
                    }
                }
                if (done) {
                    this.options.complete.call(this.elem)
                }
                return false
            } else {
                var n = t - this.startTime;
                this.state = n / this.options.duration;
                this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
                this.now = this.start + ((this.end - this.start) * this.pos);
                this.update()
            }
            return true
        }
    };
    jQuery.extend(jQuery.fx, {
        speeds: {
            slow: 600,
            fast: 200,
            def: 400
        },
        step: {
            scrollLeft: function (fx) {
                fx.elem.scrollLeft = fx.now
            },
            scrollTop: function (fx) {
                fx.elem.scrollTop = fx.now
            },
            opacity: function (fx) {
                jQuery.attr(fx.elem.style, "opacity", fx.now)
            },
            _default: function (fx) {
                fx.elem.style[fx.prop] = fx.now + fx.unit
            }
        }
    });
    jQuery.fn.offset = function () {
        var left = 0,
        top = 0,
        elem = this[0],
        results;
        if (elem) {
            with(jQuery.browser) {
                var parent = elem.parentNode,
                offsetChild = elem,
                offsetParent = elem.offsetParent,
                doc = elem.ownerDocument,
                safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
                css = jQuery.curCSS,
                fixed = css(elem, "position") == "fixed";
                if (elem.getBoundingClientRect) {
                    var box = elem.getBoundingClientRect();
                    add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
                    add(-doc.documentElement.clientLeft, -doc.documentElement.clientTop)
                } else {
                    add(elem.offsetLeft, elem.offsetTop);
                    while (offsetParent) {
                        add(offsetParent.offsetLeft, offsetParent.offsetTop);
                        if (mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2) {
                            border(offsetParent)
                        }
                        if (!fixed && css(offsetParent, "position") == "fixed") {
                            fixed = true
                        }
                        offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent;
                        offsetParent = offsetParent.offsetParent
                    }
                    while (parent && parent.tagName && !/^body|html$/i.test(parent.tagName)) {
                        if (!/^inline|table.*$/i.test(css(parent, "display"))) {
                            add(-parent.scrollLeft, -parent.scrollTop)
                        }
                        if (mozilla && css(parent, "overflow") != "visible") {
                            border(parent)
                        }
                        parent = parent.parentNode
                    }
                    if ((safari2 && (fixed || css(offsetChild, "position") == "absolute")) || (mozilla && css(offsetChild, "position") != "absolute")) {
                        add(-doc.body.offsetLeft, -doc.body.offsetTop)
                    }
                    if (fixed) {
                        add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), Math.max(doc.documentElement.scrollTop, doc.body.scrollTop))
                    }
                }
                results = {
                    top: top,
                    left: left
                }
            }
        }
        function border(elem) {
            add(jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true))
        }
        function add(l, t) {
            left += parseInt(l, 10) || 0;
            top += parseInt(t, 10) || 0
        }
        return results
    };
    jQuery.fn.extend({
        position: function () {
            var left = 0,
            top = 0,
            results;
            if (this[0]) {
                var offsetParent = this.offsetParent(),
                offset = this.offset(),
                parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? {
                    top: 0,
                    left: 0
                } : offsetParent.offset();
                offset.top -= num(this, "marginTop");
                offset.left -= num(this, "marginLeft");
                parentOffset.top += num(offsetParent, "borderTopWidth");
                parentOffset.left += num(offsetParent, "borderLeftWidth");
                results = {
                    top: offset.top - parentOffset.top,
                    left: offset.left - parentOffset.left
                }
            }
            return results
        },
        offsetParent: function () {
            var offsetParent = this[0].offsetParent;
            while (offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, "position") == "static")) {
                offsetParent = offsetParent.offsetParent
            }
            return jQuery(offsetParent)
        }
    });
    jQuery.each(["Left", "Top"], function (i, name) {
        var method = "scroll" + name;
        jQuery.fn[method] = function (val) {
            if (!this[0]) {
                return
            }
            return val != undefined ? this.each(function () {
                this == window || this == document ? window.scrollTo(!i ? val : jQuery(window).scrollLeft(), i ? val : jQuery(window).scrollTop()) : this[method] = val
            }) : this[0] == window || this[0] == document ? self[i ? "pageYOffset" : "pageXOffset"] || jQuery.boxModel && document.documentElement[method] || document.body[method] : this[0][method]
        }
    });
    jQuery.each(["Height", "Width"], function (i, name) {
        var tl = i ? "Left" : "Top",
        br = i ? "Right" : "Bottom";
        jQuery.fn["inner" + name] = function () {
            return this[name.toLowerCase()]() + num(this, "padding" + tl) + num(this, "padding" + br)
        };
        jQuery.fn["outer" + name] = function (margin) {
            return this["inner" + name]() + num(this, "border" + tl + "Width") + num(this, "border" + br + "Width") + (margin ? num(this, "margin" + tl) + num(this, "margin" + br) : 0)
        }
    })
})();
function Poll(A) {
    this._element = $(A);
    if (this._element.children().length > 0) {
        this._createPoll()
    }
}
Poll.prototype = {
    _element: null,
    _createPoll: function () {
        var A = [];
        var B = 0;
        $.each(this._element.children("dd"), function (D, F) {
            var C = $(F).text();
            var E = parseInt(C.match(/([0-9]+)/)[1], 10);
            A.push(E);
            if (E > B) {
                B = E
            }
        });
        $.each(this._element.children("dd"), function (E, H) {
            var C = $(H).text();
            var F = parseInt(C.match(/([0-9]+)/)[1], 10);
            var D = parseInt((F / B) * 100, 10);
            var G = $("<div></div>").css({
                width: D + "%",
                opacity: (D / 200) + 0.5
            }).html("&nbsp;");
            var I = $("<dd></dd>").addClass("graph");
            I.append(G);
            $(H).after(I)
        })
    }
};
$(document).ready(function () {
    if (typeof MainMenu == "function") {
        new MainMenu(".main-navigation")
    }
    $(".tabbed-module").each(function (A, B) {
        if (typeof TabbedModule == "function") {
            new TabbedModule(B)
        }
    });
    $(".flash-player > a.flash-link, .flash-player > object").each(function (A, B) {
        if (typeof FlashPlayer == "function") {
            new FlashPlayer(B)
        }
    });
    if ($(document.body).hasClass("home-page")) {
        if (typeof CompanyViewer == "function") {
            new CompanyViewer(".company-viewer .companies")
        }
        if (typeof Poll == "function") {
            new Poll(".poll-results .poll-options")
        }
    }
    if ($(document.body).hasClass("content-page")) {
        if (typeof ExpandableModule == "function") {
            new ExpandableModule(".expandable-sidebar-module")
        }
        if (typeof SemanticForm == "function") {
            new SemanticForm("form.form-section")
        }
    }
    if ($(document.body).hasClass("results-page")) {
        if (typeof ExpandableModule == "function") {
            new ExpandableModule(".expandable-sidebar-module")
        }
        if (typeof RefineSearch == "function") {
            new RefineSearch(".expandable-refine-filter")
        }
    }
    $(".branch-results-page .resultlisting").each(function (A, B) {
        if (typeof Map == "function") {
            new Map(B, ".branch-result .branch-postcode-city", Map.USETEXT)
        }
    });
    if (document.location.href.indexOf("-debug.html") >= 0) {
        $("a[href]").each(function (B, C) {
            var A = $(C).attr("href");
            if (A.indexOf("-debug.html") == -1) {
                $(C).attr("href", A.replace(".html", "-debug.html"))
            }
        });
        $("form[action]").each(function (A, B) {
            var C = $(B).attr("action");
            if (C.indexOf("-debug.html") == -1) {
                $(B).attr("action", C.replace(".html", "-debug.html"))
            }
        })
    }
    $(".brand-header .service-concept").each(function (A, B) {
        if ($("a", B).attr("href") != "#") {
            return
        }
        $(B).click(function (C) {
            $(".brand-header .service-concept").each(function (D, E) {
                $(document.body).removeClass($(E).attr("id"))
            });
            $(document.body).addClass($(this).attr("id"))
        })
    });
    $(".sidebar-map a, .job-search .tabs li:nth-child(2) a").click(function () {
        $(".search-results-page .resultlisting").each(function (A, B) {
            if (typeof Map == "function") {
                Map.addLocation(0, 52.1, 4.4);
                Map.addLocation(1, 52.2, 4.5);
                Map.addLocation(2, 52.3, 4.6);
                new Map(B, ".search-result", Map.USEINDEX)
            }
        })
    })
});
function MainMenu(A) {
    this._element = $(A);
    this._buildMenu()
}
MainMenu.prototype = {
    _element: null,
    _buildMenu: function () {
        this._element.find("ul").each(function (A, B) {
            B = $(B);
            if (B.parent("li").hasClass("active")) {
                B.parent("li").addClass("has-children")
            } else {
                B.hide().parent("li").addClass("has-children")
            }
        });
        this._element.find("li").hover(function () {
            $(this).addClass("active");
            $(this).parent("ul").parent("li").addClass("child-selected");
            $(this).children("ul").show()
        },
        function () {
            $(this).removeClass("active");
            $(this).parent("ul").parent("li").removeClass("child-selected");
            $(this).children("ul").hide()
        })
    }
};
function CompanyViewer(B, D, C, A) {
    this._element = $(B);
    this._direction = D || CompanyViewer.HORIZONTAL;
    this._numCompanies = C || 4;
    this._movement = A || 150;
    if (this._element.children().length > this._numCompanies) {
        this._hideCompanies();
        this._createNavigation();
        this._startSlider();
        this._element.mouseover(new Delegate(this, this._stopSlider));
        this._element.mouseout(new Delegate(this, this._startSlider))
    }
}
CompanyViewer.prototype = {
    _numCompanies: null,
    _direction: null,
    _TIME_PER_COMPANY: 3000,
    _element: null,
    _companies: null,
    _interval: null,
    _movement: null,
    _hideCompanies: function () {
        $.each(this._element.children(), new Delegate(this, function (B, A) {
            if (B >= this._numCompanies) {
                $(A).hide()
            }
        }))
    },
    _createNavigation: function () {
        var A = $('<a class="previous-company"></a>').insertBefore(this._element);
        var B = $('<a class="next-company"></a>').insertAfter(this._element);
        A.mouseover(new Delegate(this, this._stopSlider));
        A.mouseout(new Delegate(this, this._startSlider));
        B.mouseover(new Delegate(this, this._stopSlider));
        B.mouseout(new Delegate(this, this._startSlider));
        if (this._direction == CompanyViewer.HORIZONTAL) {
            A.click(new Delegate(this, this._moveRight));
            B.click(new Delegate(this, this._moveLeft))
        } else {
            A.click(new Delegate(this, this._moveDown));
            B.click(new Delegate(this, this._moveUp))
        }
    },
    _startSlider: function () {
        if (this._interval) {
            return
        }
        if (this._direction == CompanyViewer.HORIZONTAL) {
            this._interval = setInterval(new Delegate(this, this._moveLeft), this._TIME_PER_COMPANY)
        } else {
            this._interval = setInterval(new Delegate(this, this._moveUp), this._TIME_PER_COMPANY)
        }
    },
    _moveLeft: function () {
        var A = this._element.children()[0];
        var B = this._element.children()[this._numCompanies];
        $(A).animate({
            marginLeft: "-" + this._movement + "px"
        },
        1000, new Delegate(this, function () {
            $(A).hide().css("margin-left", "").appendTo(this._element)
        }));
        $(B).css("margin-right", "-" + this._movement + "px").show().animate({
            marginRight: "0px"
        },
        1000)
    },
    _moveRight: function () {
        var A = this._element.children()[this._numCompanies - 1];
        var B = this._element.children()[this._element.children().length - 1];
        $(A).animate({
            marginRight: "-" + this._movement + "px"
        },
        1000, new Delegate(this, function () {
            $(A).hide().css("margin-right", "")
        }));
        $(B).prependTo(this._element).css("margin-left", "-" + this._movement + "px").show().animate({
            marginLeft: "0px"
        },
        1000)
    },
    _moveUp: function () {
        var A = this._element.children()[0];
        var B = this._element.children()[this._numCompanies];
        $(A).animate({
            marginTop: "-" + this._movement + "px"
        },
        1000, new Delegate(this, function () {
            $(A).hide().css("margin-top", "").appendTo(this._element)
        }));
        $(B).css("margin-bottom", "-" + this._movement + "px").show().animate({
            marginBottom: "0px"
        },
        1000)
    },
    _moveDown: function () {
        var A = this._element.children()[this._numCompanies - 1];
        var B = this._element.children()[this._element.children().length - 1];
        $(A).animate({
            marginBottom: "-" + this._movement + "px"
        },
        1000, new Delegate(this, function () {
            $(A).hide().css("margin-bottom", "")
        }));
        $(B).prependTo(this._element).css("margin-top", "-" + this._movement + "px").show().animate({
            marginTop: "0px"
        },
        1000)
    },
    _stopSlider: function () {
        if (this._interval) {
            clearInterval(this._interval)
        }
        this._interval = null
    }
};
CompanyViewer.HORIZONTAL = 1;
CompanyViewer.VERTICAL = 2;
function ExpandableModule(A) {
    this._element = $(A);
    this._element.addClass("expanded-sidebar-module");
    this._element.children("h3:first-child").addClass("activator");
    this._enable()
}
ExpandableModule.prototype = {
    _element: null,
    _duration: 500,
    _disable: function () {
        this._element.children("h3:first-child").unbind("toggle").unbind("click")
    },
    _enable: function () {
        this._element.children("h3:first-child").toggle(new Delegate(this, this._hideContent), new Delegate(this, this._showContent))
    },
    _showContent: function (C) {
        this._disable();
        var A = $(C.target).parent(".expandable-sidebar-module");
        A.removeClass("collapsed-sidebar-module").addClass("expanded-sidebar-module");
        A.css("overflow", "visible");
        var D = A.css("height");
        A.css("height", "");
        var B = A.height();
        A.css("height", D);
        A.css("overflow", "hidden");
        A.animate({
            height: B + "px"
        },
        this._duration, new Delegate(this, function () {
            A.css("overflow", "");
            A.css("height", "");
            this._enable()
        }))
    },
    _hideContent: function (C) {
        this._disable();
        var A = $(C.target).parent(".expandable-sidebar-module");
        A.removeClass("expanded-sidebar-module").addClass("collapsed-sidebar-module");
        var B = A.height();
        A.removeClass("collapsed-sidebar-module").addClass("expanded-sidebar-module");
        A.css("overflow", "hidden");
        A.animate({
            height: B + "px"
        },
        this._duration, new Delegate(this, function () {
            A.css("overflow", "");
            A.removeClass("expanded-sidebar-module").addClass("collapsed-sidebar-module");
            this._enable()
        }))
    }
};
function Styleguide() {
    this._init()
}
Styleguide.prototype = {
    _tocContainer: null,
    _tocContainerFrame: null,
    _infoButton: null,
    _infoContainer: null,
    _init: function () {
        $(".container").css("z-index", "1");
        this._tocContainerFrame = $('<iframe src=""></iframe>').css({
            position: "absolute",
            top: "0",
            left: "0",
            height: "600px",
            width: "20px",
            margin: "0",
            padding: "0",
            "border-width": "0",
            "z-index": "2"
        }).appendTo(document.body);
        this._tocContainer = $("<div><div>").css({
            position: "absolute",
            top: "0",
            left: "0",
            height: "600px",
            width: "0",
            padding: "10px 0 10px 20px",
            overflow: "hidden",
            "background-color": "#666",
            "z-index": "3"
        }).appendTo(document.body);
        var F = {
            templates: {
                "t03 - content page": "t3-normalcontentpage-debug.html",
                "t04 - job search results": "t4-searchresults-debug.html",
                "t10 - homepage": "t10-homepage-debug.html"
            }
        };
        var A = $("<ul></ul>").appendTo(this._tocContainer).css("color", "#E0E0E0");
        $.each(F, new Delegate(this, function (G, I) {
            var H = $("<ul></ul>").appendTo(A).append($("<li></li>").append($("<h1></h1>").text(G).css("color", "#E0E0E0")));
            $.each(I, new Delegate(this, function (J, L) {
                var K = $("<li></li>").appendTo(H).append($("<a></a>").attr("href", L).text(J).css("color", "#E0E0E0"));
                if (window.location.pathname.match(L + "$")) {
                    K.css("font-weight", "bold")
                }
            }))
        }));
        this._infoButton = $("<div><div>").css({
            position: "absolute",
            top: "16px",
            right: "16px",
            width: "20px",
            height: "20px",
            "background-image": "url(images/info.png)",
            "z-index": "2",
            cursor: "pointer"
        }).appendTo(document.body);
        this._infoContainerFrame = $('<iframe src=""></iframe>').css({
            position: "absolute",
            top: "36px",
            right: "16px",
            height: "250px",
            width: "40px",
            margin: "0",
            padding: "0",
            "border-width": "0",
            "z-index": "3"
        }).hide().appendTo(document.body);
        this._infoContainer = $("<div><div>").css({
            position: "absolute",
            top: "36px",
            right: "16px",
            height: "250px",
            width: "400px",
            padding: "10px",
            "background-color": "#666",
            "z-index": "4"
        }).hide().appendTo(document.body);
        var E = {
            title: "T10 - Homepage",
            description: "This is the homepage, the website opens with this page",
            downloads: {
                PSD: "#",
                HTML: "#",
                Images: "#"
            },
            related: {
                "C21 - Company Viewer": "#",
                "C25 - Poll": "#"
            },
            overlays: {
                Components: "images/homepage-overlay.png"
            }
        };
        this._infoContainer.append($("<h1></h1>").text(E.title).css("color", "#E0E0E0"));
        this._infoContainer.append($("<p></p>").text(E.description).css("color", "#E0E0E0"));
        this._infoContainer.append($("<h2></h2>").text("Downloads").css("color", "#E0E0E0"));
        var D = $("<ul></ul>").appendTo(this._infoContainer).css("margin-bottom", "16px");
        $.each(E.downloads, function (G, H) {
            D.append($("<li></li>").append($("<a></a>").attr("href", H).text(G).css("color", "#E0E0E0")))
        });
        this._infoContainer.append($("<h2></h2>").text("Related").css("color", "#E0E0E0"));
        var C = $("<ul></ul>").appendTo(this._infoContainer).css("margin-bottom", "16px");
        $.each(E.related, function (G, H) {
            C.append($("<li></li>").append($("<a></a>").attr("href", H).text(G).css("color", "#E0E0E0")))
        });
        this._infoContainer.append($("<h2></h2>").text("Overlays").css("color", "#E0E0E0"));
        var B = $("<ul></ul>").appendTo(this._infoContainer).css("margin-bottom", "16px");
        $.each(E.overlays, function (G, H) {
            B.append($("<li></li>").append($("<a></a>").attr("href", "#").text(G).css("color", "#E0E0E0").toggle(function () {
                $(document.body).append($("<img />").attr({
                    src: H,
                    id: "overlay"
                }).css({
                    position: "absolute",
                    "z-index": "1",
                    top: "0",
                    left: "0"
                }))
            },
            function () {
                $("#overlay").remove()
            })))
        });
        this._tocContainer.hover(new Delegate(this, function () {
            this._tocContainerFrame.css({
                width: "200px"
            });
            this._tocContainer.css({
                width: "200px",
                padding: "10px"
            })
        }), new Delegate(this, function () {
            this._tocContainerFrame.css({
                width: "20px"
            });
            this._tocContainer.css({
                width: "0",
                padding: "10px 0 10px 20px"
            })
        }));
        this._infoButton.hover(new Delegate(this, function () {
            this._infoButton.css({
                "background-image": "url(images/info-highlight.png)"
            })
        }), new Delegate(this, function () {
            this._infoButton.css({
                "background-image": "url(images/info.png)"
            })
        }));
        this._infoButton.toggle(new Delegate(this, function () {
            this._infoContainerFrame.show();
            this._infoContainer.show()
        }), new Delegate(this, function () {
            this._infoContainerFrame.hide();
            this._infoContainer.hide()
        }))
    }
};
function TabbedModule(A) {
    this._element = $(A);
    this._element.find(".tabs li a").each(new Delegate(this, function (B, C) {
        C = $(C);
        if (!C.parent("li").hasClass("selected")) {
            this._element.find(C.attr("href")).hide()
        }
        C.click(new Delegate(this, function (D) {
            var E = $(C.parents("ul").find("li.selected a"));
            E.parent("li").removeClass("selected");
            this._element.find(E.attr("href")).hide();
            C.parent("li").addClass("selected");
            this._element.find(C.attr("href")).show();
            D.preventDefault()
        }))
    }))
}
TabbedModule.prototype = {
    _element: null
};
/* SWFObject v2.2 alpha10 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2009 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject = function () {
    var UNDEF = "undefined",
    OBJECT = "object",
    SHOCKWAVE_FLASH = "Shockwave Flash",
    SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
    FLASH_MIME_TYPE = "application/x-shockwave-flash",
    EXPRESS_INSTALL_ID = "SWFObjectExprInst",
    ON_READY_STATE_CHANGE = "onreadystatechange",
    win = window,
    doc = document,
    nav = navigator,
    plugin = false,
    domLoadFnArr = [main],
    regObjArr = [],
    objIdArr = [],
    listenersArr = [],
    storedAltContent,
    storedAltContentId,
    storedCallbackFn,
    storedCallbackObj,
    isDomLoaded = false,
    isExpressInstallActive = false,
    dynamicStylesheet,
    dynamicStylesheetMedia,
    ua = function () {
        var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
        playerVersion = [0, 0, 0],
        d = null;
        if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
            d = nav.plugins[SHOCKWAVE_FLASH].description;
            if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) {
                plugin = true;
                d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
                playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
                playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
                playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0
            }
        } else {
            if (typeof win.ActiveXObject != UNDEF) {
                try {
                    var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
                    if (a) {
                        d = a.GetVariable("$version");
                        if (d) {
                            d = d.split(" ")[1].split(",");
                            playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]
                        }
                    }
                } catch(e) {}
            }
        }
        var u = nav.userAgent.toLowerCase(),
        p = nav.platform.toLowerCase(),
        webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false,
        ie = false,
        windows = p ? /win/.test(p) : /win/.test(u),
        mac = p ? /mac/.test(p) : /mac/.test(u);
        /*@cc_on
			ie = true;
			@if (@_win32)
				windows = true;
			@elif (@_mac)
				mac = true;
			@end
		@*/
        return {
            w3: w3cdom,
            pv: playerVersion,
            wk: webkit,
            ie: ie,
            win: windows,
            mac: mac
        }
    } (),
    onDomLoad = function () {
        if (!ua.w3) {
            return
        }
        if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) {
            callDomLoadFunctions()
        }
        if (!isDomLoaded) {
            if (typeof doc.addEventListener != UNDEF) {
                doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false)
            }
            if (ua.ie && ua.win) {
                doc.attachEvent(ON_READY_STATE_CHANGE, function () {
                    if (doc.readyState == "complete") {
                        doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
                        callDomLoadFunctions()
                    }
                });
                if (win == top) {
                    (function () {
                        if (isDomLoaded) {
                            return
                        }
                        try {
                            doc.documentElement.doScroll("left")
                        } catch(e) {
                            setTimeout(arguments.callee, 0);
                            return
                        }
                        callDomLoadFunctions()
                    })()
                }
            }
            if (ua.wk) {
                (function () {
                    if (isDomLoaded) {
                        return
                    }
                    if (!/loaded|complete/.test(doc.readyState)) {
                        setTimeout(arguments.callee, 0);
                        return
                    }
                    callDomLoadFunctions()
                })()
            }
            addLoadEvent(callDomLoadFunctions)
        }
    } ();
    function callDomLoadFunctions() {
        if (isDomLoaded) {
            return
        }
        try {
            var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
            t.parentNode.removeChild(t)
        } catch(e) {
            return
        }
        isDomLoaded = true;
        var dl = domLoadFnArr.length;
        for (var i = 0; i < dl; i++) {
            domLoadFnArr[i]()
        }
    }
    function addDomLoadEvent(fn) {
        if (isDomLoaded) {
            fn()
        } else {
            domLoadFnArr[domLoadFnArr.length] = fn
        }
    }
    function addLoadEvent(fn) {
        if (typeof win.addEventListener != UNDEF) {
            win.addEventListener("load", fn, false)
        } else {
            if (typeof doc.addEventListener != UNDEF) {
                doc.addEventListener("load", fn, false)
            } else {
                if (typeof win.attachEvent != UNDEF) {
                    addListener(win, "onload", fn)
                } else {
                    if (typeof win.onload == "function") {
                        var fnOld = win.onload;
                        win.onload = function () {
                            fnOld();
                            fn()
                        }
                    } else {
                        win.onload = fn
                    }
                }
            }
        }
    }
    function main() {
        if (plugin) {
            testPlayerVersion()
        } else {
            matchVersions()
        }
    }
    function testPlayerVersion() {
        var b = doc.getElementsByTagName("body")[0];
        var o = createElement(OBJECT);
        o.setAttribute("type", FLASH_MIME_TYPE);
        var t = b.appendChild(o);
        if (t) {
            var counter = 0;
            (function () {
                if (typeof t.GetVariable != UNDEF) {
                    var d = t.GetVariable("$version");
                    if (d) {
                        d = d.split(" ")[1].split(",");
                        ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]
                    }
                } else {
                    if (counter < 10) {
                        counter++;
                        setTimeout(arguments.callee, 10);
                        return
                    }
                }
                b.removeChild(o);
                t = null;
                setTimeout(matchVersions, 10)
            })()
        } else {
            setTimeout(matchVersions, 10)
        }
    }
    function matchVersions() {
        var rl = regObjArr.length;
        if (rl > 0) {
            for (var i = 0; i < rl; i++) {
                var id = regObjArr[i].id;
                var cb = regObjArr[i].callbackFn;
                var cbObj = {
                    success: false,
                    id: id
                };
                if (ua.pv[0] > 0) {
                    var obj = getElementById(id);
                    if (obj) {
                        if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) {
                            setVisibility(id, true);
                            if (cb) {
                                cbObj.success = true;
                                cbObj.ref = getObjectById(id);
                                cb(cbObj)
                            }
                        } else {
                            if (regObjArr[i].expressInstall && canExpressInstall()) {
                                var att = {};
                                att.data = regObjArr[i].expressInstall;
                                att.width = obj.getAttribute("width") || "0";
                                att.height = obj.getAttribute("height") || "0";
                                if (obj.getAttribute("class")) {
                                    att.styleclass = obj.getAttribute("class")
                                }
                                if (obj.getAttribute("align")) {
                                    att.align = obj.getAttribute("align")
                                }
                                var par = {};
                                var p = obj.getElementsByTagName("param");
                                var pl = p.length;
                                for (var j = 0; j < pl; j++) {
                                    if (p[j].getAttribute("name").toLowerCase() != "movie") {
                                        par[p[j].getAttribute("name")] = p[j].getAttribute("value")
                                    }
                                }
                                showExpressInstall(att, par, id, cb)
                            } else {
                                displayAltContent(obj);
                                if (cb) {
                                    cb(cbObj)
                                }
                            }
                        }
                    }
                } else {
                    setVisibility(id, true);
                    if (cb) {
                        var o = getObjectById(id);
                        if (o) {
                            cbObj.success = true;
                            cbObj.ref = o
                        }
                        cb(cbObj)
                    }
                }
            }
        }
    }
    function getObjectById(objectIdStr) {
        var r = null;
        var o = getElementById(objectIdStr);
        if (o && o.nodeName == "OBJECT") {
            var n = o.getElementsByTagName(OBJECT)[0];
            if (!n || (n && typeof o.SetVariable != UNDEF)) {
                r = o
            } else {
                if (typeof n.SetVariable != UNDEF) {
                    r = n
                }
            }
        }
        return r
    }
    function canExpressInstall() {
        return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312)
    }
    function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
        isExpressInstallActive = true;
        storedCallbackFn = callbackFn || null;
        storedCallbackObj = {
            success: false,
            id: replaceElemIdStr
        };
        var obj = getElementById(replaceElemIdStr);
        if (obj) {
            if (obj.nodeName == "OBJECT") {
                storedAltContent = abstractAltContent(obj);
                storedAltContentId = null
            } else {
                storedAltContent = obj;
                storedAltContentId = replaceElemIdStr
            }
            att.id = EXPRESS_INSTALL_ID;
            if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) {
                att.width = "310"
            }
            if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) {
                att.height = "137"
            }
            doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
            var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
            fv = "MMredirectURL=" + win.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
            if (typeof par.flashvars != UNDEF) {
                par.flashvars += "&" + fv
            } else {
                par.flashvars = fv
            }
            if (ua.ie && ua.win && obj.readyState != 4) {
                var newObj = createElement("div");
                replaceElemIdStr += "SWFObjectNew";
                newObj.setAttribute("id", replaceElemIdStr);
                obj.parentNode.insertBefore(newObj, obj);
                obj.style.display = "none";
                (function () {
                    if (obj.readyState == 4) {
                        obj.parentNode.removeChild(obj)
                    } else {
                        setTimeout(arguments.callee, 10)
                    }
                })()
            }
            createSWF(att, par, replaceElemIdStr)
        }
    }
    function displayAltContent(obj) {
        if (ua.ie && ua.win && obj.readyState != 4) {
            var el = createElement("div");
            obj.parentNode.insertBefore(el, obj);
            el.parentNode.replaceChild(abstractAltContent(obj), el);
            obj.style.display = "none";
            (function () {
                if (obj.readyState == 4) {
                    obj.parentNode.removeChild(obj)
                } else {
                    setTimeout(arguments.callee, 10)
                }
            })()
        } else {
            obj.parentNode.replaceChild(abstractAltContent(obj), obj)
        }
    }
    function abstractAltContent(obj) {
        var ac = createElement("div");
        if (ua.win && ua.ie) {
            ac.innerHTML = obj.innerHTML
        } else {
            var nestedObj = obj.getElementsByTagName(OBJECT)[0];
            if (nestedObj) {
                var c = nestedObj.childNodes;
                if (c) {
                    var cl = c.length;
                    for (var i = 0; i < cl; i++) {
                        if (! (c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
                            ac.appendChild(c[i].cloneNode(true))
                        }
                    }
                }
            }
        }
        return ac
    }
    function createSWF(attObj, parObj, id) {
        var r, el = getElementById(id);
        if (ua.wk && ua.wk < 312) {
            return r
        }
        if (el) {
            if (typeof attObj.id == UNDEF) {
                attObj.id = id
            }
            if (ua.ie && ua.win) {
                var att = "";
                for (var i in attObj) {
                    if (attObj[i] != Object.prototype[i]) {
                        if (i.toLowerCase() == "data") {
                            parObj.movie = attObj[i]
                        } else {
                            if (i.toLowerCase() == "styleclass") {
                                att += ' class="' + attObj[i] + '"'
                            } else {
                                if (i.toLowerCase() != "classid") {
                                    att += " " + i + '="' + attObj[i] + '"'
                                }
                            }
                        }
                    }
                }
                var par = "";
                for (var j in parObj) {
                    if (parObj[j] != Object.prototype[j]) {
                        par += '<param name="' + j + '" value="' + parObj[j] + '" />'
                    }
                }
                el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + ">" + par + "</object>";
                objIdArr[objIdArr.length] = attObj.id;
                r = getElementById(attObj.id)
            } else {
                var o = createElement(OBJECT);
                o.setAttribute("type", FLASH_MIME_TYPE);
                for (var m in attObj) {
                    if (attObj[m] != Object.prototype[m]) {
                        if (m.toLowerCase() == "styleclass") {
                            o.setAttribute("class", attObj[m])
                        } else {
                            if (m.toLowerCase() != "classid") {
                                o.setAttribute(m, attObj[m])
                            }
                        }
                    }
                }
                for (var n in parObj) {
                    if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") {
                        createObjParam(o, n, parObj[n])
                    }
                }
                el.parentNode.replaceChild(o, el);
                r = o
            }
        }
        return r
    }
    function createObjParam(el, pName, pValue) {
        var p = createElement("param");
        p.setAttribute("name", pName);
        p.setAttribute("value", pValue);
        el.appendChild(p)
    }
    function removeSWF(id) {
        var obj = getElementById(id);
        if (obj && obj.nodeName == "OBJECT") {
            if (ua.ie && ua.win) {
                obj.style.display = "none";
                (function () {
                    if (obj.readyState == 4) {
                        removeObjectInIE(id)
                    } else {
                        setTimeout(arguments.callee, 10)
                    }
                })()
            } else {
                obj.parentNode.removeChild(obj)
            }
        }
    }
    function removeObjectInIE(id) {
        var obj = getElementById(id);
        if (obj) {
            for (var i in obj) {
                if (typeof obj[i] == "function") {
                    obj[i] = null
                }
            }
            obj.parentNode.removeChild(obj)
        }
    }
    function getElementById(id) {
        var el = null;
        try {
            el = doc.getElementById(id)
        } catch(e) {}
        return el
    }
    function createElement(el) {
        return doc.createElement(el)
    }
    function addListener(target, eventType, fn) {
        target.attachEvent(eventType, fn);
        listenersArr[listenersArr.length] = [target, eventType, fn]
    }
    function hasPlayerVersion(rv) {
        var pv = ua.pv,
        v = rv.split(".");
        v[0] = parseInt(v[0], 10);
        v[1] = parseInt(v[1], 10) || 0;
        v[2] = parseInt(v[2], 10) || 0;
        return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false
    }
    function createCSS(sel, decl, media, newStyle) {
        if (ua.ie && ua.mac) {
            return
        }
        var h = doc.getElementsByTagName("head")[0];
        if (!h) {
            return
        }
        var m = (media && typeof media == "string") ? media : "screen";
        if (newStyle) {
            dynamicStylesheet = null;
            dynamicStylesheetMedia = null
        }
        if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
            var s = createElement("style");
            s.setAttribute("type", "text/css");
            s.setAttribute("media", m);
            dynamicStylesheet = h.appendChild(s);
            if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
                dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1]
            }
            dynamicStylesheetMedia = m
        }
        if (ua.ie && ua.win) {
            if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
                dynamicStylesheet.addRule(sel, decl)
            }
        } else {
            if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
                dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"))
            }
        }
    }
    function setVisibility(id, isVisible) {
        var v = isVisible ? "visible" : "hidden";
        if (isDomLoaded && getElementById(id)) {
            getElementById(id).style.visibility = v
        } else {
            createCSS("#" + id, "visibility:" + v)
        }
    }
    function urlEncodeIfNecessary(s) {
        var regex = /[\\\"<>\.;]/;
        var hasBadChars = regex.exec(s) != null;
        return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s
    }
    var cleanup = function () {
        if (ua.ie && ua.win) {
            window.attachEvent("onunload", function () {
                var ll = listenersArr.length;
                for (var i = 0; i < ll; i++) {
                    listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2])
                }
                var il = objIdArr.length;
                for (var j = 0; j < il; j++) {
                    removeSWF(objIdArr[j])
                }
                for (var k in ua) {
                    ua[k] = null
                }
                ua = null;
                for (var l in swfobject) {
                    swfobject[l] = null
                }
                swfobject = null
            })
        }
    } ();
    return {
        registerObject: function (objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
            if (ua.w3 && objectIdStr && swfVersionStr) {
                var regObj = {};
                regObj.id = objectIdStr;
                regObj.swfVersion = swfVersionStr;
                regObj.expressInstall = xiSwfUrlStr;
                regObj.callbackFn = callbackFn;
                regObjArr[regObjArr.length] = regObj;
                setVisibility(objectIdStr, false)
            } else {
                if (callbackFn) {
                    callbackFn({
                        success: false,
                        id: objectIdStr
                    })
                }
            }
        },
        getObjectById: function (objectIdStr) {
            if (ua.w3) {
                return getObjectById(objectIdStr)
            }
        },
        embedSWF: function (swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
            var callbackObj = {
                success: false,
                id: replaceElemIdStr
            };
            if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
                setVisibility(replaceElemIdStr, false);
                addDomLoadEvent(function () {
                    widthStr += "";
                    heightStr += "";
                    var att = {};
                    if (attObj && typeof attObj === OBJECT) {
                        for (var i in attObj) {
                            att[i] = attObj[i]
                        }
                    }
                    att.data = swfUrlStr;
                    att.width = widthStr;
                    att.height = heightStr;
                    var par = {};
                    if (parObj && typeof parObj === OBJECT) {
                        for (var j in parObj) {
                            par[j] = parObj[j]
                        }
                    }
                    if (flashvarsObj && typeof flashvarsObj === OBJECT) {
                        for (var k in flashvarsObj) {
                            if (typeof par.flashvars != UNDEF) {
                                par.flashvars += "&" + k + "=" + flashvarsObj[k]
                            } else {
                                par.flashvars = k + "=" + flashvarsObj[k]
                            }
                        }
                    }
                    if (hasPlayerVersion(swfVersionStr)) {
                        var obj = createSWF(att, par, replaceElemIdStr);
                        if (att.id == replaceElemIdStr) {
                            setVisibility(replaceElemIdStr, true)
                        }
                        callbackObj.success = true;
                        callbackObj.ref = obj
                    } else {
                        if (xiSwfUrlStr && canExpressInstall()) {
                            att.data = xiSwfUrlStr;
                            showExpressInstall(att, par, replaceElemIdStr, callbackFn);
                            return
                        } else {
                            setVisibility(replaceElemIdStr, true)
                        }
                    }
                    if (callbackFn) {
                        callbackFn(callbackObj)
                    }
                })
            } else {
                if (callbackFn) {
                    callbackFn(callbackObj)
                }
            }
        },
        getFlashPlayerVersion: function () {
            return {
                major: ua.pv[0],
                minor: ua.pv[1],
                release: ua.pv[2]
            }
        },
        hasFlashPlayerVersion: hasPlayerVersion,
        createSWF: function (attObj, parObj, replaceElemIdStr) {
            if (ua.w3) {
                return createSWF(attObj, parObj, replaceElemIdStr)
            } else {
                return undefined
            }
        },
        showExpressInstall: function (att, par, replaceElemIdStr, callbackFn) {
            if (ua.w3 && canExpressInstall()) {
                showExpressInstall(att, par, replaceElemIdStr, callbackFn)
            }
        },
        removeSWF: function (objElemIdStr) {
            if (ua.w3) {
                removeSWF(objElemIdStr)
            }
        },
        createCSS: function (selStr, declStr, mediaStr, newStyleBoolean) {
            if (ua.w3) {
                createCSS(selStr, declStr, mediaStr, newStyleBoolean)
            }
        },
        addDomLoadEvent: addDomLoadEvent,
        addLoadEvent: addLoadEvent,
        getQueryParamValue: function (param) {
            var q = doc.location.search || doc.location.hash;
            if (param == null) {
                return urlEncodeIfNecessary(q)
            }
            if (q) {
                var pairs = q.substring(1).split("&");
                for (var i = 0; i < pairs.length; i++) {
                    if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
                        return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)))
                    }
                }
            }
            return ""
        },
        expressInstallCallback: function () {
            if (isExpressInstallActive) {
                var obj = getElementById(EXPRESS_INSTALL_ID);
                if (obj && storedAltContent) {
                    obj.parentNode.replaceChild(storedAltContent, obj);
                    if (storedAltContentId) {
                        setVisibility(storedAltContentId, true);
                        if (ua.ie && ua.win) {
                            storedAltContent.style.display = "block"
                        }
                    }
                    if (storedCallbackFn) {
                        storedCallbackFn(storedCallbackObj)
                    }
                }
                isExpressInstallActive = false
            }
        }
    }
} ();
function FlashPlayer(C, D, A, B) {
    this._element = $(C);
    this._registerId();
    this._width = D || 425;
    this._height = A || 344;
    this._version = B || "8";
    if (this._isEmbeddedPlayer()) {
        this._registerFlashPlayer()
    } else {
        this._replaceFlashLink()
    }
}
FlashPlayer.prototype = {
    _element: null,
    _instanceId: null,
    _width: null,
    _height: null,
    _showLink: function () {
        return false
    },
    _getMovieUrl: function () {
        var A = this._element.attr("href");
        if (A.indexOf("youtube.com") > -1) {
            var B = /(?:^|.*(?:video_id=|\/v\/|\\?v=))([A-Za-z0-9\\-_]{11})(?:$|[^A-Za-z0-9\\-_]+)/i;
            var C = A.match(B);
            if (C == null || C[1] == null) {
                return A
            }
            return "http://www.youtube.com/v/" + C[1]
        }
        return A
    },
    _getMovieLink: function () {
        var A = this._element.attr("href");
        if (A.indexOf("youtube.com") > -1) {
            var B = /(?:^|.*(?:video_id=|\/v\/|\\?v=))([A-Za-z0-9\\-_]{11})(?:$|[^A-Za-z0-9\\-_]+)/i;
            var C = A.match(B);
            if (C == null || C[1] == null) {
                return A
            }
            return "http://www.youtube.com/watch?v=" + C[1]
        }
        return A
    },
    _registerId: function () {
        this._instanceId = FlashPlayer._instanceId++;
        if (!this._element.attr("id") || this._element.attr("id") == "") {
            this._element.attr("id", "flashPlayer" + this._instanceId)
        }
    },
    _isEmbeddedPlayer: function () {
        return this._element.is("object")
    },
    _registerFlashPlayer: function () {
        swfobject.registerObject(this._element.attr("id"), this._version);
        $(".flash-link").each(new Delegate(this, function (A, B) {
            if ($(B).parents("#" + this._element.attr("id")).length > 0) {
                this._element.after('<span class="flash-title">' + $(B).text() + "</span>")
            }
        }))
    },
    _replaceFlashLink: function () {
        swfobject.embedSWF(this._getMovieUrl(), this._element.attr("id"), this._width, this._height, "8", "#fff")
    }
};
FlashPlayer._instanceId = 0;
function Map(E, A, C) {
    this._element = $(E);
    if (GBrowserIsCompatible == null || !GBrowserIsCompatible()) {
        return
    }
    this._selector = A;
    this._identifier = C || Map.USEID;
    this._element.addClass("map-results");
    var D = $('<div class="map-canvas"></div>');
    var B = $(".result:first", this._element);
    D.insertBefore(B);
    this._map = new GMap2(D.get(0));
    this._geocoder = new GClientGeocoder();
    this._map.addControl(new GSmallMapControl());
    this._map.addControl(new GMapTypeControl());
    this._map.setCenter(new GLatLng(52.21, 4.8), 7);
    this._bounds = new GLatLngBounds();
    $(this._selector, this._element).each(new Delegate(this, function (G, H) {
        var F = null;
        switch (this._identifier) {
        case Map.USEID:
            F = $(H).attr("id");
            break;
        case Map.USETEXT:
            F = $(H).text();
            break;
        case Map.USEINDEX:
            F = G;
            break
        }
        this._showLocation(F, H)
    }))
}
Map.prototype = {
    _element: null,
    _map: null,
    _geocoder: null,
    _selector: null,
    _identifier: null,
    _showLocation: function (A, B) {
        var C = Map.getLocationLatLng(A);
        if ( !! C) {
            this._displayLocationOnMap(C, B)
        } else {
            this._geocoder.getLatLng(A, new Delegate(this, function (D) {
                this._displayLocationOnMap(D, B)
            }))
        }
    },
    _displayLocationOnMap: function (A, C) {
        if (!A) {
            return
        }
        var D = new GIcon(G_DEFAULT_ICON, "images/maps-marker.png");
        var B = new GMarker(A, {
            icon: D
        });
        this._map.addOverlay(B);
        this._bounds.extend(B.getPoint());
        this._map.setZoom(Math.min(10, this._map.getBoundsZoomLevel(this._bounds)));
        this._map.setCenter(this._bounds.getCenter());
        if ($(C).is(".result")) {
            B.bindInfoWindow($(C).clone().css({
                width: "300px",
                border: "0"
            }).addClass("infowindow-result").get(0))
        } else {
            B.bindInfoWindow($(C).parents(".result").clone().css({
                width: "300px",
                border: "0"
            }).addClass("infowindow-result").get(0))
        }
    }
};
Map.USEID = 1;
Map.USETEXT = 2;
Map.USEINDEX = 3;
Map._locationMap = {};
Map.addLocation = function (B, C, A) {
    Map._locationMap[B] = new GLatLng(C, A)
};
Map.getLocationLatLng = function (A) {
    return Map._locationMap[A]
};
function RefineSearch(A) {
    this._element = $(A);
    this._element.addClass("expanded-refine-filter");
    this._element.children("h3:first-child").addClass("activator");
    this._enable()
}
RefineSearch.prototype = {
    _element: null,
    _duration: 500,
    _disable: function () {
        this._element.children("h3:first-child").unbind("toggle").unbind("click")
    },
    _enable: function () {
        this._element.children("h3:first-child").toggle(new Delegate(this, this._hideContent), new Delegate(this, this._showContent))
    },
    _showContent: function (C) {
        this._disable();
        var A = $(C.target).parent(".expandable-refine-filter");
        A.removeClass("collapsed-refine-filter").addClass("expanded-refine-filter");
        A.css("overflow", "visible");
        var D = A.css("height");
        A.css("height", "");
        var B = A.height();
        A.css("height", D);
        A.css("overflow", "hidden");
        A.animate({
            height: B + "px"
        },
        this._duration, new Delegate(this, function () {
            A.css("overflow", "");
            A.css("height", "");
            this._enable()
        }))
    },
    _hideContent: function (C) {
        this._disable();
        var A = $(C.target).parent(".expandable-refine-filter");
        A.removeClass("expanded-refine-filter").addClass("collapsed-refine-filter");
        var B = A.height();
        A.removeClass("collapsed-refine-filter").addClass("expanded-refine-filter");
        A.css("overflow", "hidden");
        A.animate({
            height: B + "px"
        },
        this._duration, new Delegate(this, function () {
            A.css("overflow", "");
            A.removeClass("expanded-refine-filter").addClass("collapsed-refine-filter");
            this._enable()
        }))
    }
};
(function (C) {
    C.ui = {
        plugin: {
            add: function (E, F, H) {
                var G = C.ui[E].prototype;
                for (var D in H) {
                    G.plugins[D] = G.plugins[D] || [];
                    G.plugins[D].push([F, H[D]])
                }
            },
            call: function (D, F, E) {
                var H = D.plugins[F];
                if (!H) {
                    return
                }
                for (var G = 0; G < H.length; G++) {
                    if (D.options[H[G][0]]) {
                        H[G][1].apply(D.element, E)
                    }
                }
            }
        },
        cssCache: {},
        css: function (D) {
            if (C.ui.cssCache[D]) {
                return C.ui.cssCache[D]
            }
            var E = C('<div class="ui-gen">').addClass(D).css({
                position: "absolute",
                top: "-5000px",
                left: "-5000px",
                display: "block"
            }).appendTo("body");
            C.ui.cssCache[D] = !!((!(/auto|default/).test(E.css("cursor")) || (/^[1-9]/).test(E.css("height")) || (/^[1-9]/).test(E.css("width")) || !(/none/).test(E.css("backgroundImage")) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(E.css("backgroundColor"))));
            try {
                C("body").get(0).removeChild(E.get(0))
            } catch(F) {}
            return C.ui.cssCache[D]
        },
        disableSelection: function (D) {
            C(D).attr("unselectable", "on").css("MozUserSelect", "none")
        },
        enableSelection: function (D) {
            C(D).attr("unselectable", "off").css("MozUserSelect", "")
        },
        hasScroll: function (G, E) {
            var D = /top/.test(E || "top") ? "scrollTop" : "scrollLeft",
            F = false;
            if (G[D] > 0) {
                return true
            }
            G[D] = 1;
            F = G[D] > 0 ? true : false;
            G[D] = 0;
            return F
        }
    };
    var B = C.fn.remove;
    C.fn.remove = function () {
        C("*", this).add(this).triggerHandler("remove");
        return B.apply(this, arguments)
    };
    function A(E, F, G) {
        var D = C[E][F].getter || [];
        D = (typeof D == "string" ? D.split(/,?\s+/) : D);
        return (C.inArray(G, D) != -1)
    }
    C.widget = function (E, D) {
        var F = E.split(".")[0];
        E = E.split(".")[1];
        C.fn[E] = function (J) {
            var H = (typeof J == "string"),
            I = Array.prototype.slice.call(arguments, 1);
            if (H && A(F, E, J)) {
                var G = C.data(this[0], E);
                return (G ? G[J].apply(G, I) : undefined)
            }
            return this.each(function () {
                var K = C.data(this, E);
                if (H && K && C.isFunction(K[J])) {
                    K[J].apply(K, I)
                } else {
                    if (!H) {
                        C.data(this, E, new C[F][E](this, J))
                    }
                }
            })
        };
        C[F][E] = function (I, H) {
            var G = this;
            this.widgetName = E;
            this.widgetBaseClass = F + "-" + E;
            this.options = C.extend({},
            C.widget.defaults, C[F][E].defaults, H);
            this.element = C(I).bind("setData." + E, function (L, J, K) {
                return G.setData(J, K)
            }).bind("getData." + E, function (K, J) {
                return G.getData(J)
            }).bind("remove", function () {
                return G.destroy()
            });
            this.init()
        };
        C[F][E].prototype = C.extend({},
        C.widget.prototype, D)
    };
    C.widget.prototype = {
        init: function () {},
        destroy: function () {
            this.element.removeData(this.widgetName)
        },
        getData: function (D) {
            return this.options[D]
        },
        setData: function (D, E) {
            this.options[D] = E;
            if (D == "disabled") {
                this.element[E ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled")
            }
        },
        enable: function () {
            this.setData("disabled", false)
        },
        disable: function () {
            this.setData("disabled", true)
        }
    };
    C.widget.defaults = {
        disabled: false
    };
    C.ui.mouse = {
        mouseInit: function () {
            var D = this;
            this.element.bind("mousedown." + this.widgetName, function (E) {
                return D.mouseDown(E)
            });
            if (C.browser.msie) {
                this._mouseUnselectable = this.element.attr("unselectable");
                this.element.attr("unselectable", "on")
            }
            this.started = false
        },
        mouseDestroy: function () {
            this.element.unbind("." + this.widgetName);
            (C.browser.msie && this.element.attr("unselectable", this._mouseUnselectable))
        },
        mouseDown: function (F) {
            (this._mouseStarted && this.mouseUp(F));
            this._mouseDownEvent = F;
            var E = this,
            G = (F.which == 1),
            D = (typeof this.options.cancel == "string" ? C(F.target).parents().add(F.target).filter(this.options.cancel).length : false);
            if (!G || D || !this.mouseCapture(F)) {
                return true
            }
            this._mouseDelayMet = !this.options.delay;
            if (!this._mouseDelayMet) {
                this._mouseDelayTimer = setTimeout(function () {
                    E._mouseDelayMet = true
                },
                this.options.delay)
            }
            if (this.mouseDistanceMet(F) && this.mouseDelayMet(F)) {
                this._mouseStarted = (this.mouseStart(F) !== false);
                if (!this._mouseStarted) {
                    F.preventDefault();
                    return true
                }
            }
            this._mouseMoveDelegate = function (H) {
                return E.mouseMove(H)
            };
            this._mouseUpDelegate = function (H) {
                return E.mouseUp(H)
            };
            C(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate);
            return false
        },
        mouseMove: function (D) {
            if (C.browser.msie && !D.button) {
                return this.mouseUp(D)
            }
            if (this._mouseStarted) {
                this.mouseDrag(D);
                return false
            }
            if (this.mouseDistanceMet(D) && this.mouseDelayMet(D)) {
                this._mouseStarted = (this.mouseStart(this._mouseDownEvent, D) !== false);
                (this._mouseStarted ? this.mouseDrag(D) : this.mouseUp(D))
            }
            return !this._mouseStarted
        },
        mouseUp: function (D) {
            C(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
            if (this._mouseStarted) {
                this._mouseStarted = false;
                this.mouseStop(D)
            }
            return false
        },
        mouseDistanceMet: function (D) {
            return (Math.max(Math.abs(this._mouseDownEvent.pageX - D.pageX), Math.abs(this._mouseDownEvent.pageY - D.pageY)) >= this.options.distance)
        },
        mouseDelayMet: function (D) {
            return this._mouseDelayMet
        },
        mouseStart: function (D) {},
        mouseDrag: function (D) {},
        mouseStop: function (D) {},
        mouseCapture: function (D) {
            return true
        }
    };
    C.ui.mouse.defaults = {
        cancel: null,
        distance: 1,
        delay: 0
    }
})(jQuery);
(function (E) {
    E.widget("ui.accordion", {
        init: function () {
            var G = this.options;
            if (G.navigation) {
                var J = this.element.find("a").filter(G.navigationFilter);
                if (J.length) {
                    if (J.filter(G.header).length) {
                        G.active = J
                    } else {
                        G.active = J.parent().parent().prev();
                        J.addClass("current")
                    }
                }
            }
            G.headers = this.element.find(G.header);
            G.active = C(G.headers, G.active);
            if (E.browser.msie) {
                this.element.find("a").css("zoom", "1")
            }
            if (!this.element.hasClass("ui-accordion")) {
                this.element.addClass("ui-accordion");
                E("<span class='ui-accordion-left'/>").insertBefore(G.headers);
                E("<span class='ui-accordion-right'/>").appendTo(G.headers);
                G.headers.addClass("ui-accordion-header").attr("tabindex", "0")
            }
            var I;
            if (G.fillSpace) {
                I = this.element.parent().height();
                G.headers.each(function () {
                    I -= E(this).outerHeight()
                });
                var H = 0;
                G.headers.next().each(function () {
                    H = Math.max(H, E(this).innerHeight() - E(this).height())
                }).height(I - H)
            } else {
                if (G.autoHeight) {
                    I = 0;
                    G.headers.next().each(function () {
                        I = Math.max(I, E(this).outerHeight())
                    }).height(I)
                }
            }
            G.headers.not(G.active || "").next().hide();
            G.active.parent().andSelf().addClass(G.selectedClass);
            if (G.event) {
                this.element.bind((G.event) + ".accordion", F)
            }
        },
        activate: function (G) {
            F.call(this.element[0], {
                target: C(this.options.headers, G)[0]
            })
        },
        destroy: function () {
            this.options.headers.next().css("display", "");
            if (this.options.fillSpace || this.options.autoHeight) {
                this.options.headers.next().css("height", "")
            }
            E.removeData(this.element[0], "accordion");
            this.element.removeClass("ui-accordion").unbind(".accordion")
        }
    });
    function B(H, G) {
        return function () {
            return H.apply(G, arguments)
        }
    }
    function D(I) {
        if (!E.data(this, "accordion")) {
            return
        }
        var G = E.data(this, "accordion");
        var H = G.options;
        H.running = I ? 0 : --H.running;
        if (H.running) {
            return
        }
        if (H.clearStyle) {
            H.toShow.add(H.toHide).css({
                height: "",
                overflow: ""
            })
        }
        E(this).triggerHandler("accordionchange", [E.event.fix({
            type: "accordionchange",
            target: G.element[0]
        }), H.data], H.change)
    }
    function A(G, K, L, J, M) {
        var I = E.data(this, "accordion").options;
        I.toShow = G;
        I.toHide = K;
        I.data = L;
        var H = B(D, this);
        I.running = K.size() === 0 ? G.size() : K.size();
        if (I.animated) {
            if (!I.alwaysOpen && J) {
                E.ui.accordion.animations[I.animated]({
                    toShow: jQuery([]),
                    toHide: K,
                    complete: H,
                    down: M,
                    autoHeight: I.autoHeight
                })
            } else {
                E.ui.accordion.animations[I.animated]({
                    toShow: G,
                    toHide: K,
                    complete: H,
                    down: M,
                    autoHeight: I.autoHeight
                })
            }
        } else {
            if (!I.alwaysOpen && J) {
                G.toggle()
            } else {
                K.hide();
                G.show()
            }
            H(true)
        }
    }
    function F(L) {
        var J = E.data(this, "accordion").options;
        if (J.disabled) {
            return false
        }
        if (!L.target && !J.alwaysOpen) {
            J.active.parent().andSelf().toggleClass(J.selectedClass);
            var I = J.active.next(),
            M = {
                options: J,
                newHeader: jQuery([]),
                oldHeader: J.active,
                newContent: jQuery([]),
                oldContent: I
            },
            G = (J.active = E([]));
            A.call(this, G, I, M);
            return false
        }
        var K = E(L.target);
        K = E(K.parents(J.header)[0] || K);
        var H = K[0] == J.active[0];
        if (J.running || (J.alwaysOpen && H)) {
            return false
        }
        if (!K.is(J.header)) {
            return
        }
        J.active.parent().andSelf().toggleClass(J.selectedClass);
        if (!H) {
            K.parent().andSelf().addClass(J.selectedClass)
        }
        var G = K.next(),
        I = J.active.next(),
        M = {
            options: J,
            newHeader: K,
            oldHeader: J.active,
            newContent: G,
            oldContent: I
        },
        N = J.headers.index(J.active[0]) > J.headers.index(K[0]);
        J.active = H ? E([]) : K;
        A.call(this, G, I, M, H, N);
        return false
    }
    function C(H, G) {
        return G != undefined ? typeof G == "number" ? H.filter(":eq(" + G + ")") : H.not(H.not(G)) : G === false ? E([]) : H.filter(":eq(0)")
    }
    E.extend(E.ui.accordion, {
        defaults: {
            selectedClass: "selected",
            alwaysOpen: true,
            animated: "slide",
            event: "click",
            header: "a",
            autoHeight: true,
            running: 0,
            navigationFilter: function () {
                return this.href.toLowerCase() == location.href.toLowerCase()
            }
        },
        animations: {
            slide: function (G, I) {
                G = E.extend({
                    easing: "swing",
                    duration: 300
                },
                G, I);
                if (!G.toHide.size()) {
                    G.toShow.animate({
                        height: "show"
                    },
                    G);
                    return
                }
                var H = G.toHide.height(),
                J = G.toShow.height(),
                K = J / H;
                G.toShow.css({
                    height: 0,
                    overflow: "hidden"
                }).show();
                G.toHide.filter(":hidden").each(G.complete).end().filter(":visible").animate({
                    height: "hide"
                },
                {
                    step: function (L) {
                        var M = (H - L) * K;
                        if (E.browser.msie || E.browser.opera) {
                            M = Math.ceil(M)
                        }
                        G.toShow.height(M)
                    },
                    duration: G.duration,
                    easing: G.easing,
                    complete: function () {
                        if (!G.autoHeight) {
                            G.toShow.css("height", "auto")
                        }
                        G.complete()
                    }
                })
            },
            bounceslide: function (G) {
                this.slide(G, {
                    easing: G.down ? "bounceout" : "swing",
                    duration: G.down ? 1000 : 200
                })
            },
            easeslide: function (G) {
                this.slide(G, {
                    easing: "easeinout",
                    duration: 700
                })
            }
        }
    });
    E.fn.activate = function (G) {
        return this.accordion("activate", G)
    }
})(jQuery);
(function (B) {
    var A = {
        dragStart: "start.draggable",
        drag: "drag.draggable",
        dragStop: "stop.draggable",
        maxHeight: "maxHeight.resizable",
        minHeight: "minHeight.resizable",
        maxWidth: "maxWidth.resizable",
        minWidth: "minWidth.resizable",
        resizeStart: "start.resizable",
        resize: "drag.resizable",
        resizeStop: "stop.resizable"
    };
    B.widget("ui.dialog", {
        init: function () {
            var J = this,
            K = this.options,
            D = typeof K.resizable == "string" ? K.resizable : "n,e,s,w,se,sw,ne,nw",
            E = this.element.addClass("ui-dialog-content").wrap("<div/>").wrap("<div/>"),
            G = (this.uiDialogContainer = E.parent().addClass("ui-dialog-container").css({
                position: "relative",
                width: "100%",
                height: "100%"
            })),
            H = K.title || E.attr("title") || "",
            C = (this.uiDialogTitlebar = B('<div class="ui-dialog-titlebar"/>')).append('<span class="ui-dialog-title">' + H + "</span>").append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>').prependTo(G),
            I = (this.uiDialog = G.parent()).appendTo(document.body).hide().addClass("ui-dialog").addClass(K.dialogClass).addClass(E.attr("className")).removeClass("ui-dialog-content").css({
                position: "absolute",
                width: K.width,
                height: K.height,
                overflow: "hidden",
                zIndex: K.zIndex
            }).attr("tabIndex", -1).css("outline", 0).keydown(function (L) {
                if (K.closeOnEscape) {
                    var M = 27;
                    (L.keyCode && L.keyCode == M && J.close())
                }
            }).mousedown(function () {
                J.moveToTop()
            }),
            F = (this.uiDialogButtonPane = B("<div/>")).addClass("ui-dialog-buttonpane").css({
                position: "absolute",
                bottom: 0
            }).appendTo(I);
            this.uiDialogTitlebarClose = B(".ui-dialog-titlebar-close", C).hover(function () {
                B(this).addClass("ui-dialog-titlebar-close-hover")
            },
            function () {
                B(this).removeClass("ui-dialog-titlebar-close-hover")
            }).mousedown(function (L) {
                L.stopPropagation()
            }).click(function () {
                J.close();
                return false
            });
            this.uiDialogTitlebar.find("*").add(this.uiDialogTitlebar).each(function () {
                B.ui.disableSelection(this)
            });
            if (B.fn.draggable) {
                I.draggable({
                    cancel: ".ui-dialog-content",
                    helper: K.dragHelper,
                    handle: ".ui-dialog-titlebar",
                    start: function (M, L) {
                        J.moveToTop();
                        (K.dragStart && K.dragStart.apply(J.element[0], arguments))
                    },
                    drag: function (M, L) {
                        (K.drag && K.drag.apply(J.element[0], arguments))
                    },
                    stop: function (M, L) {
                        (K.dragStop && K.dragStop.apply(J.element[0], arguments));
                        B.ui.dialog.overlay.resize()
                    }
                });
                (K.draggable || I.draggable("disable"))
            }
            if (B.fn.resizable) {
                I.resizable({
                    cancel: ".ui-dialog-content",
                    helper: K.resizeHelper,
                    maxWidth: K.maxWidth,
                    maxHeight: K.maxHeight,
                    minWidth: K.minWidth,
                    minHeight: K.minHeight,
                    start: function () {
                        (K.resizeStart && K.resizeStart.apply(J.element[0], arguments))
                    },
                    resize: function (M, L) {
                        (K.autoResize && J.size.apply(J));
                        (K.resize && K.resize.apply(J.element[0], arguments))
                    },
                    handles: D,
                    stop: function (M, L) {
                        (K.autoResize && J.size.apply(J));
                        (K.resizeStop && K.resizeStop.apply(J.element[0], arguments));
                        B.ui.dialog.overlay.resize()
                    }
                });
                (K.resizable || I.resizable("disable"))
            }
            this.createButtons(K.buttons);
            this.isOpen = false;
            (K.bgiframe && B.fn.bgiframe && I.bgiframe());
            (K.autoOpen && this.open())
        },
        setData: function (C, D) {
            (A[C] && this.uiDialog.data(A[C], D));
            switch (C) {
            case "buttons":
                this.createButtons(D);
                break;
            case "draggable":
                this.uiDialog.draggable(D ? "enable" : "disable");
                break;
            case "height":
                this.uiDialog.height(D);
                break;
            case "position":
                this.position(D);
                break;
            case "resizable":
                (typeof D == "string" && this.uiDialog.data("handles.resizable", D));
                this.uiDialog.resizable(D ? "enable" : "disable");
                break;
            case "title":
                B(".ui-dialog-title", this.uiDialogTitlebar).text(D);
                break;
            case "width":
                this.uiDialog.width(D);
                break
            }
            B.widget.prototype.setData.apply(this, arguments)
        },
        position: function (H) {
            var D = B(window),
            E = B(document),
            F = E.scrollTop(),
            C = E.scrollLeft(),
            G = F;
            if (B.inArray(H, ["center", "top", "right", "bottom", "left"]) >= 0) {
                H = [H == "right" || H == "left" ? H : "center", H == "top" || H == "bottom" ? H : "middle"]
            }
            if (H.constructor != Array) {
                H = ["center", "middle"]
            }
            if (H[0].constructor == Number) {
                C += H[0]
            } else {
                switch (H[0]) {
                case "left":
                    C += 0;
                    break;
                case "right":
                    C += D.width() - this.uiDialog.width();
                    break;
                default:
                case "center":
                    C += (D.width() - this.uiDialog.width()) / 2
                }
            }
            if (H[1].constructor == Number) {
                F += H[1]
            } else {
                switch (H[1]) {
                case "top":
                    F += 0;
                    break;
                case "bottom":
                    F += D.height() - this.uiDialog.height();
                    break;
                default:
                case "middle":
                    F += (D.height() - this.uiDialog.height()) / 2
                }
            }
            F = Math.max(F, G);
            this.uiDialog.css({
                top: F,
                left: C
            })
        },
        size: function () {
            var D = this.uiDialogContainer,
            G = this.uiDialogTitlebar,
            E = this.element,
            F = parseInt(E.css("margin-top"), 10) + parseInt(E.css("margin-bottom"), 10),
            C = parseInt(E.css("margin-left"), 10) + parseInt(E.css("margin-right"), 10);
            E.height(D.height() - G.outerHeight() - F);
            E.width(D.width() - C)
        },
        open: function () {
            if (this.isOpen) {
                return
            }
            this.overlay = this.options.modal ? new B.ui.dialog.overlay(this) : null;
            (this.uiDialog.next().length > 0) && this.uiDialog.appendTo("body");
            this.position(this.options.position);
            this.uiDialog.show(this.options.show);
            this.options.autoResize && this.size();
            this.moveToTop(true);
            var C = null;
            var D = {
                options: this.options
            };
            this.uiDialogTitlebarClose.focus();
            this.element.triggerHandler("dialogopen", [C, D], this.options.open);
            this.isOpen = true
        },
        moveToTop: function (E) {
            if ((this.options.modal && !E) || (!this.options.stack && !this.options.modal)) {
                return this.element.triggerHandler("dialogfocus", [null, {
                    options: this.options
                }], this.options.focus)
            }
            var D = this.options.zIndex,
            C = this.options;
            B(".ui-dialog:visible").each(function () {
                D = Math.max(D, parseInt(B(this).css("z-index"), 10) || C.zIndex)
            });
            (this.overlay && this.overlay.$el.css("z-index", ++D));
            this.uiDialog.css("z-index", ++D);
            this.element.triggerHandler("dialogfocus", [null, {
                options: this.options
            }], this.options.focus)
        },
        close: function () {
            (this.overlay && this.overlay.destroy());
            this.uiDialog.hide(this.options.hide);
            var D = null;
            var C = {
                options: this.options
            };
            this.element.triggerHandler("dialogclose", [D, C], this.options.close);
            B.ui.dialog.overlay.resize();
            this.isOpen = false
        },
        destroy: function () {
            (this.overlay && this.overlay.destroy());
            this.uiDialog.hide();
            this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content").hide().appendTo("body");
            this.uiDialog.remove()
        },
        createButtons: function (F) {
            var E = this,
            C = false,
            D = this.uiDialogButtonPane;
            D.empty().hide();
            B.each(F, function () {
                return ! (C = true)
            });
            if (C) {
                D.show();
                B.each(F, function (G, H) {
                    B("<button/>").text(G).click(function () {
                        H.apply(E.element[0], arguments)
                    }).appendTo(D)
                })
            }
        }
    });
    B.extend(B.ui.dialog, {
        defaults: {
            autoOpen: true,
            autoResize: true,
            bgiframe: false,
            buttons: {},
            closeOnEscape: true,
            draggable: true,
            height: 200,
            minHeight: 100,
            minWidth: 150,
            modal: false,
            overlay: {},
            position: "center",
            resizable: true,
            stack: true,
            width: 300,
            zIndex: 1000
        },
        overlay: function (C) {
            this.$el = B.ui.dialog.overlay.create(C)
        }
    });
    B.extend(B.ui.dialog.overlay, {
        instances: [],
        events: B.map("focus,mousedown,mouseup,keydown,keypress,click".split(","), function (C) {
            return C + ".dialog-overlay"
        }).join(" "),
        create: function (D) {
            if (this.instances.length === 0) {
                setTimeout(function () {
                    B("a, :input").bind(B.ui.dialog.overlay.events, function () {
                        var F = false;
                        var H = B(this).parents(".ui-dialog");
                        if (H.length) {
                            var E = B(".ui-dialog-overlay");
                            if (E.length) {
                                var G = parseInt(E.css("z-index"), 10);
                                E.each(function () {
                                    G = Math.max(G, parseInt(B(this).css("z-index"), 10))
                                });
                                F = parseInt(H.css("z-index"), 10) > G
                            } else {
                                F = true
                            }
                        }
                        return F
                    })
                },
                1);
                B(document).bind("keydown.dialog-overlay", function (E) {
                    var F = 27;
                    (E.keyCode && E.keyCode == F && D.close())
                });
                B(window).bind("resize.dialog-overlay", B.ui.dialog.overlay.resize)
            }
            var C = B("<div/>").appendTo(document.body).addClass("ui-dialog-overlay").css(B.extend({
                borderWidth: 0,
                margin: 0,
                padding: 0,
                position: "absolute",
                top: 0,
                left: 0,
                width: this.width(),
                height: this.height()
            },
            D.options.overlay));
            (D.options.bgiframe && B.fn.bgiframe && C.bgiframe());
            this.instances.push(C);
            return C
        },
        destroy: function (C) {
            this.instances.splice(B.inArray(this.instances, C), 1);
            if (this.instances.length === 0) {
                B("a, :input").add([document, window]).unbind(".dialog-overlay")
            }
            C.remove()
        },
        height: function () {
            if (B.browser.msie && B.browser.version < 7) {
                var D = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
                var C = Math.max(document.documentElement.offsetHeight, document.body.offsetHeight);
                if (D < C) {
                    return B(window).height() + "px"
                } else {
                    return D + "px"
                }
            } else {
                return B(document).height() + "px"
            }
        },
        width: function () {
            if (B.browser.msie && B.browser.version < 7) {
                var C = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth);
                var D = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
                if (C < D) {
                    return B(window).width() + "px"
                } else {
                    return C + "px"
                }
            } else {
                return B(document).width() + "px"
            }
        },
        resize: function () {
            var C = B([]);
            B.each(B.ui.dialog.overlay.instances, function () {
                C = C.add(this)
            });
            C.css({
                width: 0,
                height: 0
            }).css({
                width: B.ui.dialog.overlay.width(),
                height: B.ui.dialog.overlay.height()
            })
        }
    });
    B.extend(B.ui.dialog.overlay.prototype, {
        destroy: function () {
            B.ui.dialog.overlay.destroy(this.$el)
        }
    })
})(jQuery);
(function (A) {
    A.widget("ui.tabs", {
        init: function () {
            this.options.event += ".tabs";
            this.tabify(true)
        },
        setData: function (B, C) {
            if ((/^selected/).test(B)) {
                this.select(C)
            } else {
                this.options[B] = C;
                this.tabify()
            }
        },
        length: function () {
            return this.$tabs.length
        },
        tabId: function (B) {
            return B.title && B.title.replace(/\s/g, "_").replace(/[^A-Za-z0-9\-_:\.]/g, "") || this.options.idPrefix + A.data(B)
        },
        ui: function (C, B) {
            return {
                options: this.options,
                tab: C,
                panel: B,
                index: this.$tabs.index(C)
            }
        },
        tabify: function (O) {
            this.$lis = A("li:has(a[href])", this.element);
            this.$tabs = this.$lis.map(function () {
                return A("a", this)[0]
            });
            this.$panels = A([]);
            var P = this,
            D = this.options;
            this.$tabs.each(function (R, Q) {
                if (Q.hash && Q.hash.replace("#", "")) {
                    P.$panels = P.$panels.add(Q.hash)
                } else {
                    if (A(Q).attr("href") != "#") {
                        A.data(Q, "href.tabs", Q.href);
                        A.data(Q, "load.tabs", Q.href);
                        var T = P.tabId(Q);
                        Q.href = "#" + T;
                        var S = A("#" + T);
                        if (!S.length) {
                            S = A(D.panelTemplate).attr("id", T).addClass(D.panelClass).insertAfter(P.$panels[R - 1] || P.element);
                            S.data("destroy.tabs", true)
                        }
                        P.$panels = P.$panels.add(S)
                    } else {
                        D.disabled.push(R + 1)
                    }
                }
            });
            if (O) {
                this.element.addClass(D.navClass);
                this.$panels.each(function () {
                    var Q = A(this);
                    Q.addClass(D.panelClass)
                });
                if (D.selected === undefined) {
                    if (location.hash) {
                        this.$tabs.each(function (S, Q) {
                            if (Q.hash == location.hash) {
                                D.selected = S;
                                if (A.browser.msie || A.browser.opera) {
                                    var R = A(location.hash),
                                    T = R.attr("id");
                                    R.attr("id", "");
                                    setTimeout(function () {
                                        R.attr("id", T)
                                    },
                                    500)
                                }
                                scrollTo(0, 0);
                                return false
                            }
                        })
                    } else {
                        if (D.cookie) {
                            var J = parseInt(A.cookie("ui-tabs" + A.data(P.element)), 10);
                            if (J && P.$tabs[J]) {
                                D.selected = J
                            }
                        } else {
                            if (P.$lis.filter("." + D.selectedClass).length) {
                                D.selected = P.$lis.index(P.$lis.filter("." + D.selectedClass)[0])
                            }
                        }
                    }
                }
                D.selected = D.selected === null || D.selected !== undefined ? D.selected : 0;
                D.disabled = A.unique(D.disabled.concat(A.map(this.$lis.filter("." + D.disabledClass), function (R, Q) {
                    return P.$lis.index(R)
                }))).sort();
                if (A.inArray(D.selected, D.disabled) != -1) {
                    D.disabled.splice(A.inArray(D.selected, D.disabled), 1)
                }
                this.$panels.addClass(D.hideClass);
                this.$lis.removeClass(D.selectedClass);
                if (D.selected !== null) {
                    this.$panels.eq(D.selected).show().removeClass(D.hideClass);
                    this.$lis.eq(D.selected).addClass(D.selectedClass);
                    var K = function () {
                        A(P.element).triggerHandler("tabsshow", [P.fakeEvent("tabsshow"), P.ui(P.$tabs[D.selected], P.$panels[D.selected])], D.show)
                    };
                    if (A.data(this.$tabs[D.selected], "load.tabs")) {
                        this.load(D.selected, K)
                    } else {
                        K()
                    }
                }
                A(window).bind("unload", function () {
                    P.$tabs.unbind(".tabs");
                    P.$lis = P.$tabs = P.$panels = null
                })
            }
            for (var G = 0, N; N = this.$lis[G]; G++) {
                A(N)[A.inArray(G, D.disabled) != -1 && !A(N).hasClass(D.selectedClass) ? "addClass" : "removeClass"](D.disabledClass)
            }
            if (D.cache === false) {
                this.$tabs.removeData("cache.tabs")
            }
            var C, I, B = {
                "min-width": 0,
                duration: 1
            },
            E = "normal";
            if (D.fx && D.fx.constructor == Array) {
                C = D.fx[0] || B,
                I = D.fx[1] || B
            } else {
                C = I = D.fx || B
            }
            var H = {
                display: "",
                overflow: "",
                height: ""
            };
            if (!A.browser.msie) {
                H.opacity = ""
            }
            function M(R, Q, S) {
                Q.animate(C, C.duration || E, function () {
                    Q.addClass(D.hideClass).css(H);
                    if (A.browser.msie && C.opacity) {
                        Q[0].style.filter = ""
                    }
                    if (S) {
                        L(R, S, Q)
                    }
                })
            }
            function L(R, S, Q) {
                if (I === B) {
                    S.css("display", "block")
                }
                S.animate(I, I.duration || E, function () {
                    S.removeClass(D.hideClass).css(H);
                    if (A.browser.msie && I.opacity) {
                        S[0].style.filter = ""
                    }
                    A(P.element).triggerHandler("tabsshow", [P.fakeEvent("tabsshow"), P.ui(R, S[0])], D.show)
                })
            }
            function F(R, T, Q, S) {
                T.addClass(D.selectedClass).siblings().removeClass(D.selectedClass);
                M(R, Q, S)
            }
            this.$tabs.unbind(".tabs").bind(D.event, function () {
                var T = A(this).parents("li:eq(0)"),
                Q = P.$panels.filter(":visible"),
                S = A(this.hash);
                if ((T.hasClass(D.selectedClass) && !D.unselect) || T.hasClass(D.disabledClass) || A(this).hasClass(D.loadingClass) || A(P.element).triggerHandler("tabsselect", [P.fakeEvent("tabsselect"), P.ui(this, S[0])], D.select) === false) {
                    this.blur();
                    return false
                }
                P.options.selected = P.$tabs.index(this);
                if (D.unselect) {
                    if (T.hasClass(D.selectedClass)) {
                        P.options.selected = null;
                        T.removeClass(D.selectedClass);
                        P.$panels.stop();
                        M(this, Q);
                        this.blur();
                        return false
                    } else {
                        if (!Q.length) {
                            P.$panels.stop();
                            var R = this;
                            P.load(P.$tabs.index(this), function () {
                                T.addClass(D.selectedClass).addClass(D.unselectClass);
                                L(R, S)
                            });
                            this.blur();
                            return false
                        }
                    }
                }
                if (D.cookie) {
                    A.cookie("ui-tabs" + A.data(P.element), P.options.selected, D.cookie)
                }
                P.$panels.stop();
                if (S.length) {
                    var R = this;
                    P.load(P.$tabs.index(this), Q.length ?
                    function () {
                        F(R, T, Q, S)
                    } : function () {
                        T.addClass(D.selectedClass);
                        L(R, S)
                    })
                } else {
                    throw "jQuery UI Tabs: Mismatching fragment identifier."
                }
                if (A.browser.msie) {
                    this.blur()
                }
                return false
            });
            if (! (/^click/).test(D.event)) {
                this.$tabs.bind("click.tabs", function () {
                    return false
                })
            }
        },
        add: function (E, D, C) {
            if (C == undefined) {
                C = this.$tabs.length
            }
            var G = this.options;
            var I = A(G.tabTemplate.replace(/#\{href\}/g, E).replace(/#\{label\}/g, D));
            I.data("destroy.tabs", true);
            var H = E.indexOf("#") == 0 ? E.replace("#", "") : this.tabId(A("a:first-child", I)[0]);
            var F = A("#" + H);
            if (!F.length) {
                F = A(G.panelTemplate).attr("id", H).addClass(G.hideClass).data("destroy.tabs", true)
            }
            F.addClass(G.panelClass);
            if (C >= this.$lis.length) {
                I.appendTo(this.element);
                F.appendTo(this.element[0].parentNode)
            } else {
                I.insertBefore(this.$lis[C]);
                F.insertBefore(this.$panels[C])
            }
            G.disabled = A.map(G.disabled, function (K, J) {
                return K >= C ? ++K : K
            });
            this.tabify();
            if (this.$tabs.length == 1) {
                I.addClass(G.selectedClass);
                F.removeClass(G.hideClass);
                var B = A.data(this.$tabs[0], "load.tabs");
                if (B) {
                    this.load(C, B)
                }
            }
            this.element.triggerHandler("tabsadd", [this.fakeEvent("tabsadd"), this.ui(this.$tabs[C], this.$panels[C])], G.add)
        },
        remove: function (B) {
            var D = this.options,
            E = this.$lis.eq(B).remove(),
            C = this.$panels.eq(B).remove();
            if (E.hasClass(D.selectedClass) && this.$tabs.length > 1) {
                this.select(B + (B + 1 < this.$tabs.length ? 1 : -1))
            }
            D.disabled = A.map(A.grep(D.disabled, function (G, F) {
                return G != B
            }), function (G, F) {
                return G >= B ? --G : G
            });
            this.tabify();
            this.element.triggerHandler("tabsremove", [this.fakeEvent("tabsremove"), this.ui(E.find("a")[0], C[0])], D.remove)
        },
        enable: function (B) {
            var C = this.options;
            if (A.inArray(B, C.disabled) == -1) {
                return
            }
            var D = this.$lis.eq(B).removeClass(C.disabledClass);
            if (A.browser.safari) {
                D.css("display", "inline-block");
                setTimeout(function () {
                    D.css("display", "block")
                },
                0)
            }
            C.disabled = A.grep(C.disabled, function (F, E) {
                return F != B
            });
            this.element.triggerHandler("tabsenable", [this.fakeEvent("tabsenable"), this.ui(this.$tabs[B], this.$panels[B])], C.enable)
        },
        disable: function (C) {
            var B = this,
            D = this.options;
            if (C != D.selected) {
                this.$lis.eq(C).addClass(D.disabledClass);
                D.disabled.push(C);
                D.disabled.sort();
                this.element.triggerHandler("tabsdisable", [this.fakeEvent("tabsdisable"), this.ui(this.$tabs[C], this.$panels[C])], D.disable)
            }
        },
        select: function (B) {
            if (typeof B == "string") {
                B = this.$tabs.index(this.$tabs.filter("[href$=" + B + "]")[0])
            }
            this.$tabs.eq(B).trigger(this.options.event)
        },
        load: function (G, K) {
            var L = this,
            D = this.options,
            E = this.$tabs.eq(G),
            J = E[0],
            H = K == undefined || K === false,
            B = E.data("load.tabs");
            K = K ||
            function () {};
            if (!B || !H && A.data(J, "cache.tabs")) {
                K();
                return
            }
            var M = function (N) {
                var O = A(N),
                P = O.find("*:last");
                return P.length && P.is(":not(img)") && P || O
            };
            var C = function () {
                L.$tabs.filter("." + D.loadingClass).removeClass(D.loadingClass).each(function () {
                    if (D.spinner) {
                        M(this).parent().html(M(this).data("label.tabs"))
                    }
                });
                L.xhr = null
            };
            if (D.spinner) {
                var I = M(J).html();
                M(J).wrapInner("<em></em>").find("em").data("label.tabs", I).html(D.spinner)
            }
            var F = A.extend({},
            D.ajaxOptions, {
                url: B,
                success: function (O, N) {
                    A(J.hash).html(O);
                    C();
                    if (D.cache) {
                        A.data(J, "cache.tabs", true)
                    }
                    A(L.element).triggerHandler("tabsload", [L.fakeEvent("tabsload"), L.ui(L.$tabs[G], L.$panels[G])], D.load);
                    D.ajaxOptions.success && D.ajaxOptions.success(O, N);
                    K()
                }
            });
            if (this.xhr) {
                this.xhr.abort();
                C()
            }
            E.addClass(D.loadingClass);
            setTimeout(function () {
                L.xhr = A.ajax(F)
            },
            0)
        },
        url: function (C, B) {
            this.$tabs.eq(C).removeData("cache.tabs").data("load.tabs", B)
        },
        destroy: function () {
            var B = this.options;
            this.element.unbind(".tabs").removeClass(B.navClass).removeData("tabs");
            this.$tabs.each(function () {
                var C = A.data(this, "href.tabs");
                if (C) {
                    this.href = C
                }
                var D = A(this).unbind(".tabs");
                A.each(["href", "load", "cache"], function (E, F) {
                    D.removeData(F + ".tabs")
                })
            });
            this.$lis.add(this.$panels).each(function () {
                if (A.data(this, "destroy.tabs")) {
                    A(this).remove()
                } else {
                    A(this).removeClass([B.selectedClass, B.unselectClass, B.disabledClass, B.panelClass, B.hideClass].join(" "))
                }
            })
        },
        fakeEvent: function (B) {
            return A.event.fix({
                type: B,
                target: this.element[0]
            })
        }
    });
    A.ui.tabs.defaults = {
        unselect: false,
        event: "click",
        disabled: [],
        cookie: null,
        spinner: "Loading&#8230;",
        cache: false,
        idPrefix: "ui-tabs-",
        ajaxOptions: {},
        fx: null,
        tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>',
        panelTemplate: "<div></div>",
        navClass: "ui-tabs-nav",
        selectedClass: "ui-tabs-selected",
        unselectClass: "ui-tabs-unselect",
        disabledClass: "ui-tabs-disabled",
        panelClass: "ui-tabs-panel",
        hideClass: "ui-tabs-hide",
        loadingClass: "ui-tabs-loading"
    };
    A.ui.tabs.getter = "length";
    A.extend(A.ui.tabs.prototype, {
        rotation: null,
        rotate: function (C, F) {
            F = F || false;
            var B = this,
            E = this.options.selected;
            function G() {
                B.rotation = setInterval(function () {
                    E = ++E < B.$tabs.length ? E : 0;
                    B.select(E)
                },
                C)
            }
            function D(H) {
                if (!H || H.clientX) {
                    clearInterval(B.rotation)
                }
            }
            if (C) {
                G();
                if (!F) {
                    this.$tabs.bind(this.options.event, D)
                } else {
                    this.$tabs.bind(this.options.event, function () {
                        D();
                        E = B.options.selected;
                        G()
                    })
                }
            } else {
                D();
                this.$tabs.unbind(this.options.event, D)
            }
        }
    })
})(jQuery);
(function ($) {
    var PROP_NAME = "datepicker";
    function Datepicker() {
        this.debug = false;
        this._curInst = null;
        this._disabledInputs = [];
        this._datepickerShowing = false;
        this._inDialog = false;
        this._mainDivId = "ui-datepicker-div";
        this._appendClass = "ui-datepicker-append";
        this._triggerClass = "ui-datepicker-trigger";
        this._dialogClass = "ui-datepicker-dialog";
        this._promptClass = "ui-datepicker-prompt";
        this._unselectableClass = "ui-datepicker-unselectable";
        this._currentClass = "ui-datepicker-current-day";
        this.regional = [];
        this.regional[""] = {
            clearText: "Clear",
            clearStatus: "Erase the current date",
            closeText: "Close",
            closeStatus: "Close without change",
            prevText: "&#x3c;Prev",
            prevStatus: "Show the previous month",
            nextText: "Next&#x3e;",
            nextStatus: "Show the next month",
            currentText: "Today",
            currentStatus: "Show the current month",
            monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
            monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
            monthStatus: "Show a different month",
            yearStatus: "Show a different year",
            weekHeader: "Wk",
            weekStatus: "Week of the year",
            dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
            dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
            dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
            dayStatus: "Set DD as first week day",
            dateStatus: "Select DD, M d",
            dateFormat: "mm/dd/yy",
            firstDay: 0,
            initStatus: "Select a date",
            isRTL: false
        };
        this._defaults = {
            showOn: "focus",
            showAnim: "show",
            showOptions: {},
            defaultDate: null,
            appendText: "",
            buttonText: "...",
            buttonImage: "",
            buttonImageOnly: false,
            closeAtTop: true,
            mandatory: false,
            hideIfNoPrevNext: false,
            navigationAsDateFormat: false,
            gotoCurrent: false,
            changeMonth: true,
            changeYear: true,
            yearRange: "-10:+10",
            changeFirstDay: true,
            highlightWeek: false,
            showOtherMonths: false,
            showWeeks: false,
            calculateWeek: this.iso8601Week,
            shortYearCutoff: "+10",
            showStatus: false,
            statusForDate: this.dateStatus,
            minDate: null,
            maxDate: null,
            duration: "normal",
            beforeShowDay: null,
            beforeShow: null,
            onSelect: null,
            onChangeMonthYear: null,
            onClose: null,
            numberOfMonths: 1,
            stepMonths: 1,
            rangeSelect: false,
            rangeSeparator: " - ",
            altField: "",
            altFormat: ""
        };
        $.extend(this._defaults, this.regional[""]);
        this.dpDiv = $('<div id="' + this._mainDivId + '" style="display: none;"></div>')
    }
    $.extend(Datepicker.prototype, {
        markerClassName: "hasDatepicker",
        log: function () {
            if (this.debug) {
                console.log.apply("", arguments)
            }
        },
        setDefaults: function (settings) {
            extendRemove(this._defaults, settings || {});
            return this
        },
        _attachDatepicker: function (target, settings) {
            var inlineSettings = null;
            for (attrName in this._defaults) {
                var attrValue = target.getAttribute("date:" + attrName);
                if (attrValue) {
                    inlineSettings = inlineSettings || {};
                    try {
                        inlineSettings[attrName] = eval(attrValue)
                    } catch(err) {
                        inlineSettings[attrName] = attrValue
                    }
                }
            }
            var nodeName = target.nodeName.toLowerCase();
            var inline = (nodeName == "div" || nodeName == "span");
            if (!target.id) {
                target.id = "dp" + new Date().getTime()
            }
            var inst = this._newInst($(target), inline);
            inst.settings = $.extend({},
            settings || {},
            inlineSettings || {});
            if (nodeName == "input") {
                this._connectDatepicker(target, inst)
            } else {
                if (inline) {
                    this._inlineDatepicker(target, inst)
                }
            }
        },
        _newInst: function (target, inline) {
            return {
                id: target[0].id,
                input: target,
                selectedDay: 0,
                selectedMonth: 0,
                selectedYear: 0,
                drawMonth: 0,
                drawYear: 0,
                inline: inline,
                dpDiv: (!inline ? this.dpDiv : $('<div class="ui-datepicker-inline"></div>'))
            }
        },
        _connectDatepicker: function (target, inst) {
            var input = $(target);
            if (input.hasClass(this.markerClassName)) {
                return
            }
            var appendText = this._get(inst, "appendText");
            var isRTL = this._get(inst, "isRTL");
            if (appendText) {
                input[isRTL ? "before" : "after"]('<span class="' + this._appendClass + '">' + appendText + "</span>")
            }
            var showOn = this._get(inst, "showOn");
            if (showOn == "focus" || showOn == "both") {
                input.focus(this._showDatepicker)
            }
            if (showOn == "button" || showOn == "both") {
                var buttonText = this._get(inst, "buttonText");
                var buttonImage = this._get(inst, "buttonImage");
                var trigger = $(this._get(inst, "buttonImageOnly") ? $("<img/>").addClass(this._triggerClass).attr({
                    src: buttonImage,
                    alt: buttonText,
                    title: buttonText
                }) : $('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage == "" ? buttonText : $("<img/>").attr({
                    src: buttonImage,
                    alt: buttonText,
                    title: buttonText
                })));
                input[isRTL ? "before" : "after"](trigger);
                trigger.click(function () {
                    if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target) {
                        $.datepicker._hideDatepicker()
                    } else {
                        $.datepicker._showDatepicker(target)
                    }
                    return false
                })
            }
            input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker", function (event, key, value) {
                inst.settings[key] = value
            }).bind("getData.datepicker", function (event, key) {
                return this._get(inst, key)
            });
            $.data(target, PROP_NAME, inst)
        },
        _inlineDatepicker: function (target, inst) {
            var input = $(target);
            if (input.hasClass(this.markerClassName)) {
                return
            }
            input.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker", function (event, key, value) {
                inst.settings[key] = value
            }).bind("getData.datepicker", function (event, key) {
                return this._get(inst, key)
            });
            $.data(target, PROP_NAME, inst);
            this._setDate(inst, this._getDefaultDate(inst));
            this._updateDatepicker(inst)
        },
        _dialogDatepicker: function (input, dateText, onSelect, settings, pos) {
            var inst = this._dialogInst;
            if (!inst) {
                var id = "dp" + new Date().getTime();
                this._dialogInput = $('<input type="text" id="' + id + '" size="1" style="position: absolute; top: -100px;"/>');
                this._dialogInput.keydown(this._doKeyDown);
                $("body").append(this._dialogInput);
                inst = this._dialogInst = this._newInst(this._dialogInput, false);
                inst.settings = {};
                $.data(this._dialogInput[0], PROP_NAME, inst)
            }
            extendRemove(inst.settings, settings || {});
            this._dialogInput.val(dateText);
            this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
            if (!this._pos) {
                var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
                var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
                var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
                var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
                this._pos = [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]
            }
            this._dialogInput.css("left", this._pos[0] + "px").css("top", this._pos[1] + "px");
            inst.settings.onSelect = onSelect;
            this._inDialog = true;
            this.dpDiv.addClass(this._dialogClass);
            this._showDatepicker(this._dialogInput[0]);
            if ($.blockUI) {
                $.blockUI(this.dpDiv)
            }
            $.data(this._dialogInput[0], PROP_NAME, inst);
            return this
        },
        _destroyDatepicker: function (target) {
            var nodeName = target.nodeName.toLowerCase();
            var $target = $(target);
            $.removeData(target, PROP_NAME);
            if (nodeName == "input") {
                $target.siblings("." + this._appendClass).remove().end().siblings("." + this._triggerClass).remove().end().removeClass(this.markerClassName).unbind("focus", this._showDatepicker).unbind("keydown", this._doKeyDown).unbind("keypress", this._doKeyPress)
            } else {
                if (nodeName == "div" || nodeName == "span") {
                    $target.removeClass(this.markerClassName).empty()
                }
            }
        },
        _enableDatepicker: function (target) {
            target.disabled = false;
            $(target).siblings("button." + this._triggerClass).each(function () {
                this.disabled = false
            }).end().siblings("img." + this._triggerClass).css({
                opacity: "1.0",
                cursor: ""
            });
            this._disabledInputs = $.map(this._disabledInputs, function (value) {
                return (value == target ? null : value)
            })
        },
        _disableDatepicker: function (target) {
            target.disabled = true;
            $(target).siblings("button." + this._triggerClass).each(function () {
                this.disabled = true
            }).end().siblings("img." + this._triggerClass).css({
                opacity: "0.5",
                cursor: "default"
            });
            this._disabledInputs = $.map(this._disabledInputs, function (value) {
                return (value == target ? null : value)
            });
            this._disabledInputs[this._disabledInputs.length] = target
        },
        _isDisabledDatepicker: function (target) {
            if (!target) {
                return false
            }
            for (var i = 0; i < this._disabledInputs.length; i++) {
                if (this._disabledInputs[i] == target) {
                    return true
                }
            }
            return false
        },
        _changeDatepicker: function (target, name, value) {
            var settings = name || {};
            if (typeof name == "string") {
                settings = {};
                settings[name] = value
            }
            if (inst = $.data(target, PROP_NAME)) {
                extendRemove(inst.settings, settings);
                this._updateDatepicker(inst)
            }
        },
        _setDateDatepicker: function (target, date, endDate) {
            var inst = $.data(target, PROP_NAME);
            if (inst) {
                this._setDate(inst, date, endDate);
                this._updateDatepicker(inst)
            }
        },
        _getDateDatepicker: function (target) {
            var inst = $.data(target, PROP_NAME);
            if (inst) {
                this._setDateFromField(inst)
            }
            return (inst ? this._getDate(inst) : null)
        },
        _doKeyDown: function (e) {
            var inst = $.data(e.target, PROP_NAME);
            var handled = true;
            if ($.datepicker._datepickerShowing) {
                switch (e.keyCode) {
                case 9:
                    $.datepicker._hideDatepicker(null, "");
                    break;
                case 13:
                    $.datepicker._selectDay(e.target, inst.selectedMonth, inst.selectedYear, $("td.ui-datepicker-days-cell-over", inst.dpDiv)[0]);
                    return false;
                    break;
                case 27:
                    $.datepicker._hideDatepicker(null, $.datepicker._get(inst, "duration"));
                    break;
                case 33:
                    $.datepicker._adjustDate(e.target, (e.ctrlKey ? -1 : -$.datepicker._get(inst, "stepMonths")), (e.ctrlKey ? "Y" : "M"));
                    break;
                case 34:
                    $.datepicker._adjustDate(e.target, (e.ctrlKey ? +1 : +$.datepicker._get(inst, "stepMonths")), (e.ctrlKey ? "Y" : "M"));
                    break;
                case 35:
                    if (e.ctrlKey) {
                        $.datepicker._clearDate(e.target)
                    }
                    break;
                case 36:
                    if (e.ctrlKey) {
                        $.datepicker._gotoToday(e.target)
                    }
                    break;
                case 37:
                    if (e.ctrlKey) {
                        $.datepicker._adjustDate(e.target, -1, "D")
                    }
                    break;
                case 38:
                    if (e.ctrlKey) {
                        $.datepicker._adjustDate(e.target, -7, "D")
                    }
                    break;
                case 39:
                    if (e.ctrlKey) {
                        $.datepicker._adjustDate(e.target, +1, "D")
                    }
                    break;
                case 40:
                    if (e.ctrlKey) {
                        $.datepicker._adjustDate(e.target, +7, "D")
                    }
                    break;
                default:
                    handled = false
                }
            } else {
                if (e.keyCode == 36 && e.ctrlKey) {
                    $.datepicker._showDatepicker(this)
                } else {
                    handled = false
                }
            }
            if (handled) {
                e.preventDefault();
                e.stopPropagation()
            }
        },
        _doKeyPress: function (e) {
            var inst = $.data(e.target, PROP_NAME);
            var chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
            var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode);
            return e.ctrlKey || (chr < " " || !chars || chars.indexOf(chr) > -1)
        },
        _showDatepicker: function (input) {
            input = input.target || input;
            if (input.nodeName.toLowerCase() != "input") {
                input = $("input", input.parentNode)[0]
            }
            if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) {
                return
            }
            var inst = $.data(input, PROP_NAME);
            var beforeShow = $.datepicker._get(inst, "beforeShow");
            extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
            $.datepicker._hideDatepicker(null, "");
            $.datepicker._lastInput = input;
            $.datepicker._setDateFromField(inst);
            if ($.datepicker._inDialog) {
                input.value = ""
            }
            if (!$.datepicker._pos) {
                $.datepicker._pos = $.datepicker._findPos(input);
                $.datepicker._pos[1] += input.offsetHeight
            }
            var isFixed = false;
            $(input).parents().each(function () {
                isFixed |= $(this).css("position") == "fixed";
                return !isFixed
            });
            if (isFixed && $.browser.opera) {
                $.datepicker._pos[0] -= document.documentElement.scrollLeft;
                $.datepicker._pos[1] -= document.documentElement.scrollTop
            }
            var offset = {
                left: $.datepicker._pos[0],
                top: $.datepicker._pos[1]
            };
            $.datepicker._pos = null;
            inst.rangeStart = null;
            inst.dpDiv.css({
                position: "absolute",
                display: "block",
                top: "-1000px"
            });
            $.datepicker._updateDatepicker(inst);
            inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1] * $(".ui-datepicker", inst.dpDiv[0])[0].offsetWidth);
            offset = $.datepicker._checkOffset(inst, offset, isFixed);
            inst.dpDiv.css({
                position: ($.datepicker._inDialog && $.blockUI ? "static" : (isFixed ? "fixed" : "absolute")),
                display: "none",
                left: offset.left + "px",
                top: offset.top + "px"
            });
            if (!inst.inline) {
                var showAnim = $.datepicker._get(inst, "showAnim") || "show";
                var duration = $.datepicker._get(inst, "duration");
                var postProcess = function () {
                    $.datepicker._datepickerShowing = true;
                    if ($.browser.msie && parseInt($.browser.version) < 7) {
                        $("iframe.ui-datepicker-cover").css({
                            width: inst.dpDiv.width() + 4,
                            height: inst.dpDiv.height() + 4
                        })
                    }
                };
                if ($.effects && $.effects[showAnim]) {
                    inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess)
                } else {
                    inst.dpDiv[showAnim](duration, postProcess)
                }
                if (duration == "") {
                    postProcess()
                }
                if (inst.input[0].type != "hidden") {
                    inst.input[0].focus()
                }
                $.datepicker._curInst = inst
            }
        },
        _updateDatepicker: function (inst) {
            var dims = {
                width: inst.dpDiv.width() + 4,
                height: inst.dpDiv.height() + 4
            };
            inst.dpDiv.empty().append(this._generateDatepicker(inst)).find("iframe.ui-datepicker-cover").css({
                width: dims.width,
                height: dims.height
            });
            var numMonths = this._getNumberOfMonths(inst);
            inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? "add" : "remove") + "Class"]("ui-datepicker-multi");
            inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + "Class"]("ui-datepicker-rtl");
            if (inst.input && inst.input[0].type != "hidden") {
                $(inst.input[0]).focus()
            }
        },
        _checkOffset: function (inst, offset, isFixed) {
            var pos = inst.input ? this._findPos(inst.input[0]) : null;
            var browserWidth = window.innerWidth || document.documentElement.clientWidth;
            var browserHeight = window.innerHeight || document.documentElement.clientHeight;
            var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
            var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
            if (this._get(inst, "isRTL") || (offset.left + inst.dpDiv.width() - scrollX) > browserWidth) {
                offset.left = Math.max((isFixed ? 0 : scrollX), pos[0] + (inst.input ? inst.input.width() : 0) - (isFixed ? scrollX : 0) - inst.dpDiv.width() - (isFixed && $.browser.opera ? document.documentElement.scrollLeft : 0))
            } else {
                offset.left -= (isFixed ? scrollX : 0)
            }
            if ((offset.top + inst.dpDiv.height() - scrollY) > browserHeight) {
                offset.top = Math.max((isFixed ? 0 : scrollY), pos[1] - (isFixed ? scrollY : 0) - (this._inDialog ? 0 : inst.dpDiv.height()) - (isFixed && $.browser.opera ? document.documentElement.scrollTop : 0))
            } else {
                offset.top -= (isFixed ? scrollY : 0)
            }
            return offset
        },
        _findPos: function (obj) {
            while (obj && (obj.type == "hidden" || obj.nodeType != 1)) {
                obj = obj.nextSibling
            }
            var position = $(obj).offset();
            return [position.left, position.top]
        },
        _hideDatepicker: function (input, duration) {
            var inst = this._curInst;
            if (!inst) {
                return
            }
            var rangeSelect = this._get(inst, "rangeSelect");
            if (rangeSelect && this._stayOpen) {
                this._selectDate("#" + inst.id, this._formatDate(inst, inst.currentDay, inst.currentMonth, inst.currentYear))
            }
            this._stayOpen = false;
            if (this._datepickerShowing) {
                duration = (duration != null ? duration : this._get(inst, "duration"));
                var showAnim = this._get(inst, "showAnim");
                var postProcess = function () {
                    $.datepicker._tidyDialog(inst)
                };
                if (duration != "" && $.effects && $.effects[showAnim]) {
                    inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess)
                } else {
                    inst.dpDiv[(duration == "" ? "hide" : (showAnim == "slideDown" ? "slideUp" : (showAnim == "fadeIn" ? "fadeOut" : "hide")))](duration, postProcess)
                }
                if (duration == "") {
                    this._tidyDialog(inst)
                }
                var onClose = this._get(inst, "onClose");
                if (onClose) {
                    onClose.apply((inst.input ? inst.input[0] : null), [this._getDate(inst), inst])
                }
                this._datepickerShowing = false;
                this._lastInput = null;
                inst.settings.prompt = null;
                if (this._inDialog) {
                    this._dialogInput.css({
                        position: "absolute",
                        left: "0",
                        top: "-100px"
                    });
                    if ($.blockUI) {
                        $.unblockUI();
                        $("body").append(this.dpDiv)
                    }
                }
                this._inDialog = false
            }
            this._curInst = null
        },
        _tidyDialog: function (inst) {
            inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker");
            $("." + this._promptClass, inst.dpDiv).remove()
        },
        _checkExternalClick: function (event) {
            if (!$.datepicker._curInst) {
                return
            }
            var $target = $(event.target);
            if (($target.parents("#" + $.datepicker._mainDivId).length == 0) && !$target.hasClass($.datepicker.markerClassName) && !$target.hasClass($.datepicker._triggerClass) && $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) {
                $.datepicker._hideDatepicker(null, "")
            }
        },
        _adjustDate: function (id, offset, period) {
            var target = $(id);
            var inst = $.data(target[0], PROP_NAME);
            this._adjustInstDate(inst, offset, period);
            this._updateDatepicker(inst)
        },
        _gotoToday: function (id) {
            var target = $(id);
            var inst = $.data(target[0], PROP_NAME);
            if (this._get(inst, "gotoCurrent") && inst.currentDay) {
                inst.selectedDay = inst.currentDay;
                inst.drawMonth = inst.selectedMonth = inst.currentMonth;
                inst.drawYear = inst.selectedYear = inst.currentYear
            } else {
                var date = new Date();
                inst.selectedDay = date.getDate();
                inst.drawMonth = inst.selectedMonth = date.getMonth();
                inst.drawYear = inst.selectedYear = date.getFullYear()
            }
            this._adjustDate(target);
            this._notifyChange(inst)
        },
        _selectMonthYear: function (id, select, period) {
            var target = $(id);
            var inst = $.data(target[0], PROP_NAME);
            inst._selectingMonthYear = false;
            inst[period == "M" ? "drawMonth" : "drawYear"] = select.options[select.selectedIndex].value - 0;
            this._adjustDate(target);
            this._notifyChange(inst)
        },
        _clickMonthYear: function (id) {
            var target = $(id);
            var inst = $.data(target[0], PROP_NAME);
            if (inst.input && inst._selectingMonthYear && !$.browser.msie) {
                inst.input[0].focus()
            }
            inst._selectingMonthYear = !inst._selectingMonthYear
        },
        _changeFirstDay: function (id, day) {
            var target = $(id);
            var inst = $.data(target[0], PROP_NAME);
            inst.settings.firstDay = day;
            this._updateDatepicker(inst)
        },
        _selectDay: function (id, month, year, td) {
            if ($(td).hasClass(this._unselectableClass)) {
                return
            }
            var target = $(id);
            var inst = $.data(target[0], PROP_NAME);
            var rangeSelect = this._get(inst, "rangeSelect");
            if (rangeSelect) {
                this._stayOpen = !this._stayOpen;
                if (this._stayOpen) {
                    $(".ui-datepicker td").removeClass(this._currentClass);
                    $(td).addClass(this._currentClass)
                }
            }
            inst.selectedDay = inst.currentDay = $("a", td).html();
            inst.selectedMonth = inst.currentMonth = month;
            inst.selectedYear = inst.currentYear = year;
            if (this._stayOpen) {
                inst.endDay = inst.endMonth = inst.endYear = null
            } else {
                if (rangeSelect) {
                    inst.endDay = inst.currentDay;
                    inst.endMonth = inst.currentMonth;
                    inst.endYear = inst.currentYear
                }
            }
            this._selectDate(id, this._formatDate(inst, inst.currentDay, inst.currentMonth, inst.currentYear));
            if (this._stayOpen) {
                inst.rangeStart = this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
                this._updateDatepicker(inst)
            } else {
                if (rangeSelect) {
                    inst.selectedDay = inst.currentDay = inst.rangeStart.getDate();
                    inst.selectedMonth = inst.currentMonth = inst.rangeStart.getMonth();
                    inst.selectedYear = inst.currentYear = inst.rangeStart.getFullYear();
                    inst.rangeStart = null;
                    if (inst.inline) {
                        this._updateDatepicker(inst)
                    }
                }
            }
        },
        _clearDate: function (id) {
            var target = $(id);
            var inst = $.data(target[0], PROP_NAME);
            if (this._get(inst, "mandatory")) {
                return
            }
            this._stayOpen = false;
            inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null;
            this._selectDate(target, "")
        },
        _selectDate: function (id, dateStr) {
            var target = $(id);
            var inst = $.data(target[0], PROP_NAME);
            dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
            if (this._get(inst, "rangeSelect") && dateStr) {
                dateStr = (inst.rangeStart ? this._formatDate(inst, inst.rangeStart) : dateStr) + this._get(inst, "rangeSeparator") + dateStr
            }
            if (inst.input) {
                inst.input.val(dateStr)
            }
            this._updateAlternate(inst);
            var onSelect = this._get(inst, "onSelect");
            if (onSelect) {
                onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst])
            } else {
                if (inst.input) {
                    inst.input.trigger("change")
                }
            }
            if (inst.inline) {
                this._updateDatepicker(inst)
            } else {
                if (!this._stayOpen) {
                    this._hideDatepicker(null, this._get(inst, "duration"));
                    this._lastInput = inst.input[0];
                    if (typeof(inst.input[0]) != "object") {
                        inst.input[0].focus()
                    }
                    this._lastInput = null
                }
            }
        },
        _updateAlternate: function (inst) {
            var altField = this._get(inst, "altField");
            if (altField) {
                var altFormat = this._get(inst, "altFormat");
                var date = this._getDate(inst);
                dateStr = (isArray(date) ? (!date[0] && !date[1] ? "" : this.formatDate(altFormat, date[0], this._getFormatConfig(inst)) + this._get(inst, "rangeSeparator") + this.formatDate(altFormat, date[1] || date[0], this._getFormatConfig(inst))) : this.formatDate(altFormat, date, this._getFormatConfig(inst)));
                $(altField).each(function () {
                    $(this).val(dateStr)
                })
            }
        },
        noWeekends: function (date) {
            var day = date.getDay();
            return [(day > 0 && day < 6), ""]
        },
        iso8601Week: function (date) {
            var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
            var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4);
            var firstDay = firstMon.getDay() || 7;
            firstMon.setDate(firstMon.getDate() + 1 - firstDay);
            if (firstDay < 4 && checkDate < firstMon) {
                checkDate.setDate(checkDate.getDate() - 3);
                return $.datepicker.iso8601Week(checkDate)
            } else {
                if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) {
                    firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7;
                    if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) {
                        checkDate.setDate(checkDate.getDate() + 3);
                        return $.datepicker.iso8601Week(checkDate)
                    }
                }
            }
            return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1
        },
        dateStatus: function (date, inst) {
            return $.datepicker.formatDate($.datepicker._get(inst, "dateStatus"), date, $.datepicker._getFormatConfig(inst))
        },
        parseDate: function (format, value, settings) {
            if (format == null || value == null) {
                throw "Invalid arguments"
            }
            value = (typeof value == "object" ? value.toString() : value + "");
            if (value == "") {
                return null
            }
            var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
            var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
            var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
            var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
            var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
            var year = -1;
            var month = -1;
            var day = -1;
            var literal = false;
            var lookAhead = function (match) {
                var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
                if (matches) {
                    iFormat++
                }
                return matches
            };
            var getNumber = function (match) {
                lookAhead(match);
                var origSize = (match == "@" ? 14 : (match == "y" ? 4 : 2));
                var size = origSize;
                var num = 0;
                while (size > 0 && iValue < value.length && value.charAt(iValue) >= "0" && value.charAt(iValue) <= "9") {
                    num = num * 10 + (value.charAt(iValue++) - 0);
                    size--
                }
                if (size == origSize) {
                    throw "Missing number at position " + iValue
                }
                return num
            };
            var getName = function (match, shortNames, longNames) {
                var names = (lookAhead(match) ? longNames : shortNames);
                var size = 0;
                for (var j = 0; j < names.length; j++) {
                    size = Math.max(size, names[j].length)
                }
                var name = "";
                var iInit = iValue;
                while (size > 0 && iValue < value.length) {
                    name += value.charAt(iValue++);
                    for (var i = 0; i < names.length; i++) {
                        if (name == names[i]) {
                            return i + 1
                        }
                    }
                    size--
                }
                throw "Unknown name at position " + iInit
            };
            var checkLiteral = function () {
                if (value.charAt(iValue) != format.charAt(iFormat)) {
                    throw "Unexpected literal at position " + iValue
                }
                iValue++
            };
            var iValue = 0;
            for (var iFormat = 0; iFormat < format.length; iFormat++) {
                if (literal) {
                    if (format.charAt(iFormat) == "'" && !lookAhead("'")) {
                        literal = false
                    } else {
                        checkLiteral()
                    }
                } else {
                    switch (format.charAt(iFormat)) {
                    case "d":
                        day = getNumber("d");
                        break;
                    case "D":
                        getName("D", dayNamesShort, dayNames);
                        break;
                    case "m":
                        month = getNumber("m");
                        break;
                    case "M":
                        month = getName("M", monthNamesShort, monthNames);
                        break;
                    case "y":
                        year = getNumber("y");
                        break;
                    case "@":
                        var date = new Date(getNumber("@"));
                        year = date.getFullYear();
                        month = date.getMonth() + 1;
                        day = date.getDate();
                        break;
                    case "'":
                        if (lookAhead("'")) {
                            checkLiteral()
                        } else {
                            literal = true
                        }
                        break;
                    default:
                        checkLiteral()
                    }
                }
            }
            if (year < 100) {
                year += new Date().getFullYear() - new Date().getFullYear() % 100 + (year <= shortYearCutoff ? 0 : -100)
            }
            var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
            if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) {
                throw "Invalid date"
            }
            return date
        },
        ATOM: "yy-mm-dd",
        COOKIE: "D, dd M yy",
        ISO_8601: "yy-mm-dd",
        RFC_822: "D, d M y",
        RFC_850: "DD, dd-M-y",
        RFC_1036: "D, d M y",
        RFC_1123: "D, d M yy",
        RFC_2822: "D, d M yy",
        RSS: "D, d M y",
        TIMESTAMP: "@",
        W3C: "yy-mm-dd",
        formatDate: function (format, date, settings) {
            if (!date) {
                return ""
            }
            var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
            var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
            var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
            var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
            var lookAhead = function (match) {
                var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
                if (matches) {
                    iFormat++
                }
                return matches
            };
            var formatNumber = function (match, value) {
                return (lookAhead(match) && value < 10 ? "0" : "") + value
            };
            var formatName = function (match, value, shortNames, longNames) {
                return (lookAhead(match) ? longNames[value] : shortNames[value])
            };
            var output = "";
            var literal = false;
            if (date) {
                for (var iFormat = 0; iFormat < format.length; iFormat++) {
                    if (literal) {
                        if (format.charAt(iFormat) == "'" && !lookAhead("'")) {
                            literal = false
                        } else {
                            output += format.charAt(iFormat)
                        }
                    } else {
                        switch (format.charAt(iFormat)) {
                        case "d":
                            output += formatNumber("d", date.getDate());
                            break;
                        case "D":
                            output += formatName("D", date.getDay(), dayNamesShort, dayNames);
                            break;
                        case "m":
                            output += formatNumber("m", date.getMonth() + 1);
                            break;
                        case "M":
                            output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
                            break;
                        case "y":
                            output += (lookAhead("y") ? date.getFullYear() : (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100);
                            break;
                        case "@":
                            output += date.getTime();
                            break;
                        case "'":
                            if (lookAhead("'")) {
                                output += "'"
                            } else {
                                literal = true
                            }
                            break;
                        default:
                            output += format.charAt(iFormat)
                        }
                    }
                }
            }
            return output
        },
        _possibleChars: function (format) {
            var chars = "";
            var literal = false;
            for (var iFormat = 0; iFormat < format.length; iFormat++) {
                if (literal) {
                    if (format.charAt(iFormat) == "'" && !lookAhead("'")) {
                        literal = false
                    } else {
                        chars += format.charAt(iFormat)
                    }
                } else {
                    switch (format.charAt(iFormat)) {
                    case "d":
                    case "m":
                    case "y":
                    case "@":
                        chars += "0123456789";
                        break;
                    case "D":
                    case "M":
                        return null;
                    case "'":
                        if (lookAhead("'")) {
                            chars += "'"
                        } else {
                            literal = true
                        }
                        break;
                    default:
                        chars += format.charAt(iFormat)
                    }
                }
            }
            return chars
        },
        _get: function (inst, name) {
            return inst.settings[name] !== undefined ? inst.settings[name] : this._defaults[name]
        },
        _setDateFromField: function (inst) {
            var dateFormat = this._get(inst, "dateFormat");
            var dates = inst.input ? inst.input.val().split(this._get(inst, "rangeSeparator")) : null;
            inst.endDay = inst.endMonth = inst.endYear = null;
            var date = defaultDate = this._getDefaultDate(inst);
            if (dates.length > 0) {
                var settings = this._getFormatConfig(inst);
                if (dates.length > 1) {
                    date = this.parseDate(dateFormat, dates[1], settings) || defaultDate;
                    inst.endDay = date.getDate();
                    inst.endMonth = date.getMonth();
                    inst.endYear = date.getFullYear()
                }
                try {
                    date = this.parseDate(dateFormat, dates[0], settings) || defaultDate
                } catch(e) {
                    this.log(e);
                    date = defaultDate
                }
            }
            inst.selectedDay = date.getDate();
            inst.drawMonth = inst.selectedMonth = date.getMonth();
            inst.drawYear = inst.selectedYear = date.getFullYear();
            inst.currentDay = (dates[0] ? date.getDate() : 0);
            inst.currentMonth = (dates[0] ? date.getMonth() : 0);
            inst.currentYear = (dates[0] ? date.getFullYear() : 0);
            this._adjustInstDate(inst)
        },
        _getDefaultDate: function (inst) {
            var date = this._determineDate(this._get(inst, "defaultDate"), new Date());
            var minDate = this._getMinMaxDate(inst, "min", true);
            var maxDate = this._getMinMaxDate(inst, "max");
            date = (minDate && date < minDate ? minDate : date);
            date = (maxDate && date > maxDate ? maxDate : date);
            return date
        },
        _determineDate: function (date, defaultDate) {
            var offsetNumeric = function (offset) {
                var date = new Date();
                date.setDate(date.getDate() + offset);
                return date
            };
            var offsetString = function (offset, getDaysInMonth) {
                var date = new Date();
                var year = date.getFullYear();
                var month = date.getMonth();
                var day = date.getDate();
                var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
                var matches = pattern.exec(offset);
                while (matches) {
                    switch (matches[2] || "d") {
                    case "d":
                    case "D":
                        day += (matches[1] - 0);
                        break;
                    case "w":
                    case "W":
                        day += (matches[1] * 7);
                        break;
                    case "m":
                    case "M":
                        month += (matches[1] - 0);
                        day = Math.min(day, getDaysInMonth(year, month));
                        break;
                    case "y":
                    case "Y":
                        year += (matches[1] - 0);
                        day = Math.min(day, getDaysInMonth(year, month));
                        break
                    }
                    matches = pattern.exec(offset)
                }
                return new Date(year, month, day)
            };
            date = (date == null ? defaultDate : (typeof date == "string" ? offsetString(date, this._getDaysInMonth) : (typeof date == "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
            date = (date && date.toString() == "Invalid Date" ? defaultDate : date);
            if (date) {
                date.setHours(0);
                date.setMinutes(0);
                date.setSeconds(0);
                date.setMilliseconds(0)
            }
            return this._daylightSavingAdjust(date)
        },
        _daylightSavingAdjust: function (date) {
            if (!date) {
                return null
            }
            date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
            return date
        },
        _setDate: function (inst, date, endDate) {
            var clear = !(date);
            date = this._determineDate(date, new Date());
            inst.selectedDay = inst.currentDay = date.getDate();
            inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
            inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
            if (this._get(inst, "rangeSelect")) {
                if (endDate) {
                    endDate = this._determineDate(endDate, null);
                    inst.endDay = endDate.getDate();
                    inst.endMonth = endDate.getMonth();
                    inst.endYear = endDate.getFullYear()
                } else {
                    inst.endDay = inst.currentDay;
                    inst.endMonth = inst.currentMonth;
                    inst.endYear = inst.currentYear
                }
            }
            this._adjustInstDate(inst);
            if (inst.input) {
                inst.input.val(clear ? "" : this._formatDate(inst) + (!this._get(inst, "rangeSelect") ? "" : this._get(inst, "rangeSeparator") + this._formatDate(inst, inst.endDay, inst.endMonth, inst.endYear)))
            }
        },
        _getDate: function (inst) {
            var startDate = (!inst.currentYear || (inst.input && inst.input.val() == "") ? null : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
            if (this._get(inst, "rangeSelect")) {
                return [inst.rangeStart || startDate, (!inst.endYear ? inst.rangeStart || startDate : this._daylightSavingAdjust(new Date(inst.endYear, inst.endMonth, inst.endDay)))]
            } else {
                return startDate
            }
        },
        _generateDatepicker: function (inst) {
            var today = new Date();
            today = this._daylightSavingAdjust(new Date(today.getFullYear(), today.getMonth(), today.getDate()));
            var showStatus = this._get(inst, "showStatus");
            var isRTL = this._get(inst, "isRTL");
            var clear = (this._get(inst, "mandatory") ? "" : '<div class="ui-datepicker-clear"><a onclick="jQuery.datepicker._clearDate(\'#' + inst.id + "');\"" + (showStatus ? this._addStatus(inst, this._get(inst, "clearStatus") || "&#xa0;") : "") + ">" + this._get(inst, "clearText") + "</a></div>");
            var controls = '<div class="ui-datepicker-control">' + (isRTL ? "" : clear) + '<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"' + (showStatus ? this._addStatus(inst, this._get(inst, "closeStatus") || "&#xa0;") : "") + ">" + this._get(inst, "closeText") + "</a></div>" + (isRTL ? clear : "") + "</div>";
            var prompt = this._get(inst, "prompt");
            var closeAtTop = this._get(inst, "closeAtTop");
            var hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext");
            var navigationAsDateFormat = this._get(inst, "navigationAsDateFormat");
            var numMonths = this._getNumberOfMonths(inst);
            var stepMonths = this._get(inst, "stepMonths");
            var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
            var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
            var minDate = this._getMinMaxDate(inst, "min", true);
            var maxDate = this._getMinMaxDate(inst, "max");
            var drawMonth = inst.drawMonth;
            var drawYear = inst.drawYear;
            if (maxDate) {
                var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate()));
                maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
                while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
                    drawMonth--;
                    if (drawMonth < 0) {
                        drawMonth = 11;
                        drawYear--
                    }
                }
            }
            var prevText = this._get(inst, "prevText");
            prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst)));
            var prev = '<div class="ui-datepicker-prev">' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? "<a onclick=\"jQuery.datepicker._adjustDate('#" + inst.id + "', -" + stepMonths + ", 'M');\"" + (showStatus ? this._addStatus(inst, this._get(inst, "prevStatus") || "&#xa0;") : "") + ">" + prevText + "</a>" : (hideIfNoPrevNext ? "" : "<label>" + prevText + "</label>")) + "</div>";
            var nextText = this._get(inst, "nextText");
            nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst)));
            var next = '<div class="ui-datepicker-next">' + (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? "<a onclick=\"jQuery.datepicker._adjustDate('#" + inst.id + "', +" + stepMonths + ", 'M');\"" + (showStatus ? this._addStatus(inst, this._get(inst, "nextStatus") || "&#xa0;") : "") + ">" + nextText + "</a>" : (hideIfNoPrevNext ? "" : "<label>" + nextText + "</label>")) + "</div>";
            var currentText = this._get(inst, "currentText");
            currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, today, this._getFormatConfig(inst)));
            var html = (prompt ? '<div class="' + this._promptClass + '">' + prompt + "</div>" : "") + (closeAtTop && !inst.inline ? controls : "") + '<div class="ui-datepicker-links">' + (isRTL ? next : prev) + (this._isInRange(inst, (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today)) ? '<div class="ui-datepicker-current"><a onclick="jQuery.datepicker._gotoToday(\'#' + inst.id + "');\"" + (showStatus ? this._addStatus(inst, this._get(inst, "currentStatus") || "&#xa0;") : "") + ">" + currentText + "</a></div>" : "") + (isRTL ? prev : next) + "</div>";
            var firstDay = this._get(inst, "firstDay");
            var changeFirstDay = this._get(inst, "changeFirstDay");
            var dayNames = this._get(inst, "dayNames");
            var dayNamesShort = this._get(inst, "dayNamesShort");
            var dayNamesMin = this._get(inst, "dayNamesMin");
            var monthNames = this._get(inst, "monthNames");
            var beforeShowDay = this._get(inst, "beforeShowDay");
            var highlightWeek = this._get(inst, "highlightWeek");
            var showOtherMonths = this._get(inst, "showOtherMonths");
            var showWeeks = this._get(inst, "showWeeks");
            var calculateWeek = this._get(inst, "calculateWeek") || this.iso8601Week;
            var status = (showStatus ? this._get(inst, "dayStatus") || "&#xa0;" : "");
            var dateStatus = this._get(inst, "statusForDate") || this.dateStatus;
            var endDate = inst.endDay ? this._daylightSavingAdjust(new Date(inst.endYear, inst.endMonth, inst.endDay)) : currentDate;
            for (var row = 0; row < numMonths[0]; row++) {
                for (var col = 0; col < numMonths[1]; col++) {
                    var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
                    html += '<div class="ui-datepicker-one-month' + (col == 0 ? " ui-datepicker-new-row" : "") + '">' + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, selectedDate, row > 0 || col > 0, showStatus, monthNames) + '<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead><tr class="ui-datepicker-title-row">' + (showWeeks ? "<td>" + this._get(inst, "weekHeader") + "</td>" : "");
                    for (var dow = 0; dow < 7; dow++) {
                        var day = (dow + firstDay) % 7;
                        var dayStatus = (status.indexOf("DD") > -1 ? status.replace(/DD/, dayNames[day]) : status.replace(/D/, dayNamesShort[day]));
                        html += "<td" + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end-cell"' : "") + ">" + (!changeFirstDay ? "<span" : "<a onclick=\"jQuery.datepicker._changeFirstDay('#" + inst.id + "', " + day + ');"') + (showStatus ? this._addStatus(inst, dayStatus) : "") + ' title="' + dayNames[day] + '">' + dayNamesMin[day] + (changeFirstDay ? "</a>" : "</span>") + "</td>"
                    }
                    html += "</tr></thead><tbody>";
                    var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
                    if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) {
                        inst.selectedDay = Math.min(inst.selectedDay, daysInMonth)
                    }
                    var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
                    var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7));
                    var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
                    for (var dRow = 0; dRow < numRows; dRow++) {
                        html += '<tr class="ui-datepicker-days-row">' + (showWeeks ? '<td class="ui-datepicker-week-col">' + calculateWeek(printDate) + "</td>" : "");
                        for (var dow = 0; dow < 7; dow++) {
                            var daySettings = (beforeShowDay ? beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
                            var otherMonth = (printDate.getMonth() != drawMonth);
                            var unselectable = otherMonth || !daySettings[0] || (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
                            html += '<td class="ui-datepicker-days-cell' + ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end-cell" : "") + (otherMonth ? " ui-datepicker-otherMonth" : "") + (printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth ? " ui-datepicker-days-cell-over" : "") + (unselectable ? " " + this._unselectableClass : "") + (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? " " + this._currentClass : "") + (printDate.getTime() == today.getTime() ? " ui-datepicker-today" : "")) + '"' + ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : "") + (unselectable ? (highlightWeek ? " onmouseover=\"jQuery(this).parent().addClass('ui-datepicker-week-over');\" onmouseout=\"jQuery(this).parent().removeClass('ui-datepicker-week-over');\"" : "") : " onmouseover=\"jQuery(this).addClass('ui-datepicker-days-cell-over')" + (highlightWeek ? ".parent().addClass('ui-datepicker-week-over')" : "") + ";" + (!showStatus || (otherMonth && !showOtherMonths) ? "" : "jQuery('#ui-datepicker-status-" + inst.id + "').html('" + (dateStatus.apply((inst.input ? inst.input[0] : null), [printDate, inst]) || "&#xa0;") + "');") + "\" onmouseout=\"jQuery(this).removeClass('ui-datepicker-days-cell-over')" + (highlightWeek ? ".parent().removeClass('ui-datepicker-week-over')" : "") + ";" + (!showStatus || (otherMonth && !showOtherMonths) ? "" : "jQuery('#ui-datepicker-status-" + inst.id + "').html('&#xa0;');") + '" onclick="jQuery.datepicker._selectDay(\'#' + inst.id + "'," + drawMonth + "," + drawYear + ', this);"') + ">" + (otherMonth ? (showOtherMonths ? printDate.getDate() : "&#xa0;") : (unselectable ? printDate.getDate() : "<a>" + printDate.getDate() + "</a>")) + "</td>";
                            printDate.setDate(printDate.getDate() + 1);
                            printDate = this._daylightSavingAdjust(printDate)
                        }
                        html += "</tr>"
                    }
                    drawMonth++;
                    if (drawMonth > 11) {
                        drawMonth = 0;
                        drawYear++
                    }
                    html += "</tbody></table></div>"
                }
            }
            html += (showStatus ? '<div style="clear: both;"></div><div id="ui-datepicker-status-' + inst.id + '" class="ui-datepicker-status">' + (this._get(inst, "initStatus") || "&#xa0;") + "</div>" : "") + (!closeAtTop && !inst.inline ? controls : "") + '<div style="clear: both;"></div>' + ($.browser.msie && parseInt($.browser.version) < 7 && !inst.inline ? '<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>' : "");
            return html
        },
        _generateMonthYearHeader: function (inst, drawMonth, drawYear, minDate, maxDate, selectedDate, secondary, showStatus, monthNames) {
            minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate);
            var html = '<div class="ui-datepicker-header">';
            if (secondary || !this._get(inst, "changeMonth")) {
                html += monthNames[drawMonth] + "&#xa0;"
            } else {
                var inMinYear = (minDate && minDate.getFullYear() == drawYear);
                var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
                html += '<select class="ui-datepicker-new-month" onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + "', this, 'M');\" onclick=\"jQuery.datepicker._clickMonthYear('#" + inst.id + "');\"" + (showStatus ? this._addStatus(inst, this._get(inst, "monthStatus") || "&#xa0;") : "") + ">";
                for (var month = 0; month < 12; month++) {
                    if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
                        html += '<option value="' + month + '"' + (month == drawMonth ? ' selected="selected"' : "") + ">" + monthNames[month] + "</option>"
                    }
                }
                html += "</select>"
            }
            if (secondary || !this._get(inst, "changeYear")) {
                html += drawYear
            } else {
                var years = this._get(inst, "yearRange").split(":");
                var year = 0;
                var endYear = 0;
                if (years.length != 2) {
                    year = drawYear - 10;
                    endYear = drawYear + 10
                } else {
                    if (years[0].charAt(0) == "+" || years[0].charAt(0) == "-") {
                        year = endYear = new Date().getFullYear();
                        year += parseInt(years[0], 10);
                        endYear += parseInt(years[1], 10)
                    } else {
                        year = parseInt(years[0], 10);
                        endYear = parseInt(years[1], 10)
                    }
                }
                year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
                endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
                html += '<select class="ui-datepicker-new-year" onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + "', this, 'Y');\" onclick=\"jQuery.datepicker._clickMonthYear('#" + inst.id + "');\"" + (showStatus ? this._addStatus(inst, this._get(inst, "yearStatus") || "&#xa0;") : "") + ">";
                for (; year <= endYear; year++) {
                    html += '<option value="' + year + '"' + (year == drawYear ? ' selected="selected"' : "") + ">" + year + "</option>"
                }
                html += "</select>"
            }
            html += "</div>";
            return html
        },
        _addStatus: function (inst, text) {
            return " onmouseover=\"jQuery('#ui-datepicker-status-" + inst.id + "').html('" + text + "');\" onmouseout=\"jQuery('#ui-datepicker-status-" + inst.id + "').html('&#xa0;');\""
        },
        _adjustInstDate: function (inst, offset, period) {
            var year = inst.drawYear + (period == "Y" ? offset : 0);
            var month = inst.drawMonth + (period == "M" ? offset : 0);
            var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period == "D" ? offset : 0);
            var date = this._daylightSavingAdjust(new Date(year, month, day));
            var minDate = this._getMinMaxDate(inst, "min", true);
            var maxDate = this._getMinMaxDate(inst, "max");
            date = (minDate && date < minDate ? minDate : date);
            date = (maxDate && date > maxDate ? maxDate : date);
            inst.selectedDay = date.getDate();
            inst.drawMonth = inst.selectedMonth = date.getMonth();
            inst.drawYear = inst.selectedYear = date.getFullYear();
            if (period == "M" || period == "Y") {
                this._notifyChange(inst)
            }
        },
        _notifyChange: function (inst) {
            var onChange = this._get(inst, "onChangeMonthYear");
            if (onChange) {
                onChange.apply((inst.input ? inst.input[0] : null), [new Date(inst.selectedYear, inst.selectedMonth, 1), inst])
            }
        },
        _getNumberOfMonths: function (inst) {
            var numMonths = this._get(inst, "numberOfMonths");
            return (numMonths == null ? [1, 1] : (typeof numMonths == "number" ? [1, numMonths] : numMonths))
        },
        _getMinMaxDate: function (inst, minMax, checkRange) {
            var date = this._determineDate(this._get(inst, minMax + "Date"), null);
            return (!checkRange || !inst.rangeStart ? date : (!date || inst.rangeStart > date ? inst.rangeStart : date))
        },
        _getDaysInMonth: function (year, month) {
            return 32 - new Date(year, month, 32).getDate()
        },
        _getFirstDayOfMonth: function (year, month) {
            return new Date(year, month, 1).getDay()
        },
        _canAdjustMonth: function (inst, offset, curYear, curMonth) {
            var numMonths = this._getNumberOfMonths(inst);
            var date = this._daylightSavingAdjust(new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1));
            if (offset < 0) {
                date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()))
            }
            return this._isInRange(inst, date)
        },
        _isInRange: function (inst, date) {
            var newMinDate = (!inst.rangeStart ? null : this._daylightSavingAdjust(new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay)));
            newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate);
            var minDate = newMinDate || this._getMinMaxDate(inst, "min");
            var maxDate = this._getMinMaxDate(inst, "max");
            return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate))
        },
        _getFormatConfig: function (inst) {
            var shortYearCutoff = this._get(inst, "shortYearCutoff");
            shortYearCutoff = (typeof shortYearCutoff != "string" ? shortYearCutoff : new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
            return {
                shortYearCutoff: shortYearCutoff,
                dayNamesShort: this._get(inst, "dayNamesShort"),
                dayNames: this._get(inst, "dayNames"),
                monthNamesShort: this._get(inst, "monthNamesShort"),
                monthNames: this._get(inst, "monthNames")
            }
        },
        _formatDate: function (inst, day, month, year) {
            if (!day) {
                inst.currentDay = inst.selectedDay;
                inst.currentMonth = inst.selectedMonth;
                inst.currentYear = inst.selectedYear
            }
            var date = (day ? (typeof day == "object" ? day : this._daylightSavingAdjust(new Date(year, month, day))) : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
            return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst))
        }
    });
    function extendRemove(target, props) {
        $.extend(target, props);
        for (var name in props) {
            if (props[name] == null || props[name] == undefined) {
                target[name] = props[name]
            }
        }
        return target
    }
    function isArray(a) {
        return (a && (($.browser.safari && typeof a == "object" && a.length) || (a.constructor && a.constructor.toString().match(/\Array\(\)/))))
    }
    $.fn.datepicker = function (options) {
        var otherArgs = Array.prototype.slice.call(arguments, 1);
        if (typeof options == "string" && (options == "isDisabled" || options == "getDate")) {
            return $.datepicker["_" + options + "Datepicker"].apply($.datepicker, [this[0]].concat(otherArgs))
        }
        return this.each(function () {
            typeof options == "string" ? $.datepicker["_" + options + "Datepicker"].apply($.datepicker, [this].concat(otherArgs)) : $.datepicker._attachDatepicker(this, options)
        })
    };
    $.datepicker = new Datepicker();
    $(document).ready(function () {
        $(document.body).append($.datepicker.dpDiv).mousedown($.datepicker._checkExternalClick)
    })
})(jQuery);
(function (C) {
    C.effects = C.effects || {};
    C.extend(C.effects, {
        save: function (F, G) {
            for (var E = 0; E < G.length; E++) {
                if (G[E] !== null) {
                    C.data(F[0], "ec.storage." + G[E], F[0].style[G[E]])
                }
            }
        },
        restore: function (F, G) {
            for (var E = 0; E < G.length; E++) {
                if (G[E] !== null) {
                    F.css(G[E], C.data(F[0], "ec.storage." + G[E]))
                }
            }
        },
        setMode: function (E, F) {
            if (F == "toggle") {
                F = E.is(":hidden") ? "show" : "hide"
            }
            return F
        },
        getBaseline: function (F, G) {
            var H, E;
            switch (F[0]) {
            case "top":
                H = 0;
                break;
            case "middle":
                H = 0.5;
                break;
            case "bottom":
                H = 1;
                break;
            default:
                H = F[0] / G.height
            }
            switch (F[1]) {
            case "left":
                E = 0;
                break;
            case "center":
                E = 0.5;
                break;
            case "right":
                E = 1;
                break;
            default:
                E = F[1] / G.width
            }
            return {
                x: E,
                y: H
            }
        },
        createWrapper: function (F) {
            if (F.parent().attr("id") == "fxWrapper") {
                return F
            }
            var E = {
                width: F.outerWidth({
                    margin: true
                }),
                height: F.outerHeight({
                    margin: true
                }),
                "float": F.css("float")
            };
            F.wrap('<div id="fxWrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
            var I = F.parent();
            if (F.css("position") == "static") {
                I.css({
                    position: "relative"
                });
                F.css({
                    position: "relative"
                })
            } else {
                var H = F.css("top");
                if (isNaN(parseInt(H))) {
                    H = "auto"
                }
                var G = F.css("left");
                if (isNaN(parseInt(G))) {
                    G = "auto"
                }
                I.css({
                    position: F.css("position"),
                    top: H,
                    left: G,
                    zIndex: F.css("z-index")
                }).show();
                F.css({
                    position: "relative",
                    top: 0,
                    left: 0
                })
            }
            I.css(E);
            return I
        },
        removeWrapper: function (E) {
            if (E.parent().attr("id") == "fxWrapper") {
                return E.parent().replaceWith(E)
            }
            return E
        },
        setTransition: function (F, G, E, H) {
            H = H || {};
            C.each(G, function (J, I) {
                unit = F.cssUnit(I);
                if (unit[0] > 0) {
                    H[I] = unit[0] * E + unit[1]
                }
            });
            return H
        },
        animateClass: function (G, H, J, I) {
            var E = (typeof J == "function" ? J : (I ? I : null));
            var F = (typeof J == "object" ? J : null);
            return this.each(function () {
                var O = {};
                var M = C(this);
                var N = M.attr("style") || "";
                if (typeof N == "object") {
                    N = N.cssText
                }
                if (G.toggle) {
                    M.hasClass(G.toggle) ? G.remove = G.toggle : G.add = G.toggle
                }
                var K = C.extend({},
                (document.defaultView ? document.defaultView.getComputedStyle(this, null) : this.currentStyle));
                if (G.add) {
                    M.addClass(G.add)
                }
                if (G.remove) {
                    M.removeClass(G.remove)
                }
                var L = C.extend({},
                (document.defaultView ? document.defaultView.getComputedStyle(this, null) : this.currentStyle));
                if (G.add) {
                    M.removeClass(G.add)
                }
                if (G.remove) {
                    M.addClass(G.remove)
                }
                for (var P in L) {
                    if (typeof L[P] != "function" && L[P] && P.indexOf("Moz") == -1 && P.indexOf("length") == -1 && L[P] != K[P] && (P.match(/color/i) || (!P.match(/color/i) && !isNaN(parseInt(L[P], 10)))) && (K.position != "static" || (K.position == "static" && !P.match(/left|top|bottom|right/)))) {
                        O[P] = L[P]
                    }
                }
                M.animate(O, H, F, function () {
                    if (typeof C(this).attr("style") == "object") {
                        C(this).attr("style")["cssText"] = "";
                        C(this).attr("style")["cssText"] = N
                    } else {
                        C(this).attr("style", N)
                    }
                    if (G.add) {
                        C(this).addClass(G.add)
                    }
                    if (G.remove) {
                        C(this).removeClass(G.remove)
                    }
                    if (E) {
                        E.apply(this, arguments)
                    }
                })
            })
        }
    });
    C.fn.extend({
        _show: C.fn.show,
        _hide: C.fn.hide,
        __toggle: C.fn.toggle,
        _addClass: C.fn.addClass,
        _removeClass: C.fn.removeClass,
        _toggleClass: C.fn.toggleClass,
        effect: function (E, G, F, H) {
            return C.effects[E] ? C.effects[E].call(this, {
                method: E,
                options: G || {},
                duration: F,
                callback: H
            }) : null
        },
        show: function () {
            if (!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0]))) {
                return this._show.apply(this, arguments)
            } else {
                var E = arguments[1] || {};
                E.mode = "show";
                return this.effect.apply(this, [arguments[0], E, arguments[2] || E.duration, arguments[3] || E.callback])
            }
        },
        hide: function () {
            if (!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0]))) {
                return this._hide.apply(this, arguments)
            } else {
                var E = arguments[1] || {};
                E.mode = "hide";
                return this.effect.apply(this, [arguments[0], E, arguments[2] || E.duration, arguments[3] || E.callback])
            }
        },
        toggle: function () {
            if (!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])) || (arguments[0].constructor == Function)) {
                return this.__toggle.apply(this, arguments)
            } else {
                var E = arguments[1] || {};
                E.mode = "toggle";
                return this.effect.apply(this, [arguments[0], E, arguments[2] || E.duration, arguments[3] || E.callback])
            }
        },
        addClass: function (F, E, H, G) {
            return E ? C.effects.animateClass.apply(this, [{
                add: F
            },
            E, H, G]) : this._addClass(F)
        },
        removeClass: function (F, E, H, G) {
            return E ? C.effects.animateClass.apply(this, [{
                remove: F
            },
            E, H, G]) : this._removeClass(F)
        },
        toggleClass: function (F, E, H, G) {
            return E ? C.effects.animateClass.apply(this, [{
                toggle: F
            },
            E, H, G]) : this._toggleClass(F)
        },
        morph: function (E, G, F, I, H) {
            return C.effects.animateClass.apply(this, [{
                add: G,
                remove: E
            },
            F, I, H])
        },
        switchClass: function () {
            return this.morph.apply(this, arguments)
        },
        cssUnit: function (E) {
            var F = this.css(E),
            G = [];
            C.each(["em", "px", "%", "pt"], function (H, I) {
                if (F.indexOf(I) > 0) {
                    G = [parseFloat(F), I]
                }
            });
            return G
        }
    });
    jQuery.each(["backgroundColor", "borderBottomColor", "borderLeftColor", "borderRightColor", "borderTopColor", "color", "outlineColor"], function (F, E) {
        jQuery.fx.step[E] = function (G) {
            if (G.state == 0) {
                G.start = D(G.elem, E);
                G.end = B(G.end)
            }
            G.elem.style[E] = "rgb(" + [Math.max(Math.min(parseInt((G.pos * (G.end[0] - G.start[0])) + G.start[0]), 255), 0), Math.max(Math.min(parseInt((G.pos * (G.end[1] - G.start[1])) + G.start[1]), 255), 0), Math.max(Math.min(parseInt((G.pos * (G.end[2] - G.start[2])) + G.start[2]), 255), 0)].join(",") + ")"
        }
    });
    function B(F) {
        var E;
        if (F && F.constructor == Array && F.length == 3) {
            return F
        }
        if (E = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(F)) {
            return [parseInt(E[1]), parseInt(E[2]), parseInt(E[3])]
        }
        if (E = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(F)) {
            return [parseFloat(E[1]) * 2.55, parseFloat(E[2]) * 2.55, parseFloat(E[3]) * 2.55]
        }
        if (E = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(F)) {
            return [parseInt(E[1], 16), parseInt(E[2], 16), parseInt(E[3], 16)]
        }
        if (E = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(F)) {
            return [parseInt(E[1] + E[1], 16), parseInt(E[2] + E[2], 16), parseInt(E[3] + E[3], 16)]
        }
        if (E = /rgba\(0, 0, 0, 0\)/.exec(F)) {
            return A.transparent
        }
        return A[jQuery.trim(F).toLowerCase()]
    }
    function D(G, E) {
        var F;
        do {
            F = jQuery.curCSS(G, E);
            if (F != "" && F != "transparent" || jQuery.nodeName(G, "body")) {
                break
            }
            E = "backgroundColor"
        } while (G = G.parentNode);
        return B(F)
    }
    var A = {
        aqua: [0, 255, 255],
        azure: [240, 255, 255],
        beige: [245, 245, 220],
        black: [0, 0, 0],
        blue: [0, 0, 255],
        brown: [165, 42, 42],
        cyan: [0, 255, 255],
        darkblue: [0, 0, 139],
        darkcyan: [0, 139, 139],
        darkgrey: [169, 169, 169],
        darkgreen: [0, 100, 0],
        darkkhaki: [189, 183, 107],
        darkmagenta: [139, 0, 139],
        darkolivegreen: [85, 107, 47],
        darkorange: [255, 140, 0],
        darkorchid: [153, 50, 204],
        darkred: [139, 0, 0],
        darksalmon: [233, 150, 122],
        darkviolet: [148, 0, 211],
        fuchsia: [255, 0, 255],
        gold: [255, 215, 0],
        green: [0, 128, 0],
        indigo: [75, 0, 130],
        khaki: [240, 230, 140],
        lightblue: [173, 216, 230],
        lightcyan: [224, 255, 255],
        lightgreen: [144, 238, 144],
        lightgrey: [211, 211, 211],
        lightpink: [255, 182, 193],
        lightyellow: [255, 255, 224],
        lime: [0, 255, 0],
        magenta: [255, 0, 255],
        maroon: [128, 0, 0],
        navy: [0, 0, 128],
        olive: [128, 128, 0],
        orange: [255, 165, 0],
        pink: [255, 192, 203],
        purple: [128, 0, 128],
        violet: [128, 0, 128],
        red: [255, 0, 0],
        silver: [192, 192, 192],
        white: [255, 255, 255],
        yellow: [255, 255, 0],
        transparent: [255, 255, 255]
    };
    jQuery.easing.jswing = jQuery.easing.swing;
    jQuery.extend(jQuery.easing, {
        def: "easeOutQuad",
        swing: function (F, G, E, I, H) {
            return jQuery.easing[jQuery.easing.def](F, G, E, I, H)
        },
        easeInQuad: function (F, G, E, I, H) {
            return I * (G /= H) * G + E
        },
        easeOutQuad: function (F, G, E, I, H) {
            return -I * (G /= H) * (G - 2) + E
        },
        easeInOutQuad: function (F, G, E, I, H) {
            if ((G /= H / 2) < 1) {
                return I / 2 * G * G + E
            }
            return -I / 2 * ((--G) * (G - 2) - 1) + E
        },
        easeInCubic: function (F, G, E, I, H) {
            return I * (G /= H) * G * G + E
        },
        easeOutCubic: function (F, G, E, I, H) {
            return I * ((G = G / H - 1) * G * G + 1) + E
        },
        easeInOutCubic: function (F, G, E, I, H) {
            if ((G /= H / 2) < 1) {
                return I / 2 * G * G * G + E
            }
            return I / 2 * ((G -= 2) * G * G + 2) + E
        },
        easeInQuart: function (F, G, E, I, H) {
            return I * (G /= H) * G * G * G + E
        },
        easeOutQuart: function (F, G, E, I, H) {
            return -I * ((G = G / H - 1) * G * G * G - 1) + E
        },
        easeInOutQuart: function (F, G, E, I, H) {
            if ((G /= H / 2) < 1) {
                return I / 2 * G * G * G * G + E
            }
            return -I / 2 * ((G -= 2) * G * G * G - 2) + E
        },
        easeInQuint: function (F, G, E, I, H) {
            return I * (G /= H) * G * G * G * G + E
        },
        easeOutQuint: function (F, G, E, I, H) {
            return I * ((G = G / H - 1) * G * G * G * G + 1) + E
        },
        easeInOutQuint: function (F, G, E, I, H) {
            if ((G /= H / 2) < 1) {
                return I / 2 * G * G * G * G * G + E
            }
            return I / 2 * ((G -= 2) * G * G * G * G + 2) + E
        },
        easeInSine: function (F, G, E, I, H) {
            return -I * Math.cos(G / H * (Math.PI / 2)) + I + E
        },
        easeOutSine: function (F, G, E, I, H) {
            return I * Math.sin(G / H * (Math.PI / 2)) + E
        },
        easeInOutSine: function (F, G, E, I, H) {
            return -I / 2 * (Math.cos(Math.PI * G / H) - 1) + E
        },
        easeInExpo: function (F, G, E, I, H) {
            return (G == 0) ? E : I * Math.pow(2, 10 * (G / H - 1)) + E
        },
        easeOutExpo: function (F, G, E, I, H) {
            return (G == H) ? E + I : I * (-Math.pow(2, -10 * G / H) + 1) + E
        },
        easeInOutExpo: function (F, G, E, I, H) {
            if (G == 0) {
                return E
            }
            if (G == H) {
                return E + I
            }
            if ((G /= H / 2) < 1) {
                return I / 2 * Math.pow(2, 10 * (G - 1)) + E
            }
            return I / 2 * (-Math.pow(2, -10 * --G) + 2) + E
        },
        easeInCirc: function (F, G, E, I, H) {
            return -I * (Math.sqrt(1 - (G /= H) * G) - 1) + E
        },
        easeOutCirc: function (F, G, E, I, H) {
            return I * Math.sqrt(1 - (G = G / H - 1) * G) + E
        },
        easeInOutCirc: function (F, G, E, I, H) {
            if ((G /= H / 2) < 1) {
                return -I / 2 * (Math.sqrt(1 - G * G) - 1) + E
            }
            return I / 2 * (Math.sqrt(1 - (G -= 2) * G) + 1) + E
        },
        easeInElastic: function (F, H, E, L, K) {
            var I = 1.70158;
            var J = 0;
            var G = L;
            if (H == 0) {
                return E
            }
            if ((H /= K) == 1) {
                return E + L
            }
            if (!J) {
                J = K * 0.3
            }
            if (G < Math.abs(L)) {
                G = L;
                var I = J / 4
            } else {
                var I = J / (2 * Math.PI) * Math.asin(L / G)
            }
            return - (G * Math.pow(2, 10 * (H -= 1)) * Math.sin((H * K - I) * (2 * Math.PI) / J)) + E
        },
        easeOutElastic: function (F, H, E, L, K) {
            var I = 1.70158;
            var J = 0;
            var G = L;
            if (H == 0) {
                return E
            }
            if ((H /= K) == 1) {
                return E + L
            }
            if (!J) {
                J = K * 0.3
            }
            if (G < Math.abs(L)) {
                G = L;
                var I = J / 4
            } else {
                var I = J / (2 * Math.PI) * Math.asin(L / G)
            }
            return G * Math.pow(2, -10 * H) * Math.sin((H * K - I) * (2 * Math.PI) / J) + L + E
        },
        easeInOutElastic: function (F, H, E, L, K) {
            var I = 1.70158;
            var J = 0;
            var G = L;
            if (H == 0) {
                return E
            }
            if ((H /= K / 2) == 2) {
                return E + L
            }
            if (!J) {
                J = K * (0.3 * 1.5)
            }
            if (G < Math.abs(L)) {
                G = L;
                var I = J / 4
            } else {
                var I = J / (2 * Math.PI) * Math.asin(L / G)
            }
            if (H < 1) {
                return -0.5 * (G * Math.pow(2, 10 * (H -= 1)) * Math.sin((H * K - I) * (2 * Math.PI) / J)) + E
            }
            return G * Math.pow(2, -10 * (H -= 1)) * Math.sin((H * K - I) * (2 * Math.PI) / J) * 0.5 + L + E
        },
        easeInBack: function (F, G, E, J, I, H) {
            if (H == undefined) {
                H = 1.70158
            }
            return J * (G /= I) * G * ((H + 1) * G - H) + E
        },
        easeOutBack: function (F, G, E, J, I, H) {
            if (H == undefined) {
                H = 1.70158
            }
            return J * ((G = G / I - 1) * G * ((H + 1) * G + H) + 1) + E
        },
        easeInOutBack: function (F, G, E, J, I, H) {
            if (H == undefined) {
                H = 1.70158
            }
            if ((G /= I / 2) < 1) {
                return J / 2 * (G * G * (((H *= (1.525)) + 1) * G - H)) + E
            }
            return J / 2 * ((G -= 2) * G * (((H *= (1.525)) + 1) * G + H) + 2) + E
        },
        easeInBounce: function (F, G, E, I, H) {
            return I - jQuery.easing.easeOutBounce(F, H - G, 0, I, H) + E
        },
        easeOutBounce: function (F, G, E, I, H) {
            if ((G /= H) < (1 / 2.75)) {
                return I * (7.5625 * G * G) + E
            } else {
                if (G < (2 / 2.75)) {
                    return I * (7.5625 * (G -= (1.5 / 2.75)) * G + 0.75) + E
                } else {
                    if (G < (2.5 / 2.75)) {
                        return I * (7.5625 * (G -= (2.25 / 2.75)) * G + 0.9375) + E
                    } else {
                        return I * (7.5625 * (G -= (2.625 / 2.75)) * G + 0.984375) + E
                    }
                }
            }
        },
        easeInOutBounce: function (F, G, E, I, H) {
            if (G < H / 2) {
                return jQuery.easing.easeInBounce(F, G * 2, 0, I, H) * 0.5 + E
            }
            return jQuery.easing.easeOutBounce(F, G * 2 - H, 0, I, H) * 0.5 + I * 0.5 + E
        }
    })
})(jQuery);
function SemanticForm(B) {
    this._element = $(B);
    var A = $.browser.msie && jQuery.browser.version.substr(0, 1) == "6";
    if (A) {
        $("select", this._element).each(function (C, D) {
            el.wrap("div", {
                "class": "select-wrapper"
            })
        })
    }
    $("fieldset.optional", this._element).each(new Delegate(this, this._setupFieldset));
    $(".date", this._element).each(new Delegate(this, this._setDateField))
}
SemanticForm.prototype = {
    _element: null,
    _setupFieldset: function (C, A) {
        A = $(A);
        var D = $("legend", A);
        var B = $("#" + A.attr("rel"));
        if (B.length > 0) {
            B.parents(".field").addClass("hidden")
        }
        if (A.hasClass("default-collapsed")) {
            A.addClass("collapsed");
            this._setCheckbox(B, true)
        } else {
            A.addClass("expanded");
            this._setCheckbox(B, false)
        }
        D.click(new Delegate(this, function () {
            A.toggleClass("expanded");
            A.toggleClass("collapsed");
            this._setCheckbox(B, !$(B).attr("checked"))
        }));
        $(".default-collapsed .error-in-field", this._element).each(new Delegate(this, function (F, G) {
            var E = $(G).parents(".default-collapsed");
            if (E.hasClass("expanded")) {
                return
            }
            E.toggleClass("expanded");
            E.toggleClass("collapsed");
            var H = E.attr("rel");
            this._setCheckbox(H, false)
        }))
    },
    _setCheckbox: function (B, A) {
        $(B).attr("checked", A)
    },
    _setDateField: function (A, B) {
        $(B).datepicker({
            dateFormat: "dd/mm/yy",
            firstDay: 1
        })
    }
};