var Prototype = {
    Version: "1.6.0.3",
    Browser: {
        IE: !! (window.attachEvent && navigator.userAgent.indexOf("Opera") === -1),
        Opera: navigator.userAgent.indexOf("Opera") > -1,
        WebKit: navigator.userAgent.indexOf("AppleWebKit/") > -1,
        Gecko: navigator.userAgent.indexOf("Gecko") > -1 && navigator.userAgent.indexOf("KHTML") === -1,
        MobileSafari: !! navigator.userAgent.match(/Apple.*Mobile.*Safari/)
    },
    BrowserFeatures: {
        XPath: !! document.evaluate,
        SelectorsAPI: !! document.querySelector,
        ElementExtensions: !! window.HTMLElement,
        SpecificElementExtensions: document.createElement("div")["__proto__"] && document.createElement("div")["__proto__"] !== document.createElement("form")["__proto__"]
    },
    ScriptFragment: "<script[^>]*>([\\S\\s]*?)<\/script>",
    JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
    emptyFunction: function () {},
    K: function (a) {
        return a
    }
};
if (Prototype.Browser.MobileSafari) {
    Prototype.BrowserFeatures.SpecificElementExtensions = false
}
var Class = {
    create: function () {
        var e = null,
            d = $A(arguments);
        if (Object.isFunction(d[0])) {
            e = d.shift()
        }
        function a() {
            this.initialize.apply(this, arguments)
        }
        Object.extend(a, Class.Methods);
        a.superclass = e;
        a.subclasses = [];
        if (e) {
            var b = function () {};
            b.prototype = e.prototype;
            a.prototype = new b;
            e.subclasses.push(a)
        }
        for (var c = 0; c < d.length; c++) {
            a.addMethods(d[c])
        }
        if (!a.prototype.initialize) {
            a.prototype.initialize = Prototype.emptyFunction
        }
        a.prototype.constructor = a;
        return a
    }
};
Class.Methods = {
    addMethods: function (g) {
        var c = this.superclass && this.superclass.prototype;
        var b = Object.keys(g);
        if (!Object.keys({
            toString: true
        }).length) {
            b.push("toString", "valueOf")
        }
        for (var a = 0, d = b.length; a < d; a++) {
            var f = b[a],
                e = g[f];
            if (c && Object.isFunction(e) && e.argumentNames().first() == "$super") {
                var j = e;
                e = (function (k) {
                    return function () {
                        return c[k].apply(this, arguments)
                    }
                })(f).wrap(j);
                e.valueOf = j.valueOf.bind(j);
                e.toString = j.toString.bind(j)
            }
            this.prototype[f] = e
        }
        return this
    }
};
var Abstract = {};
Object.extend = function (a, c) {
    for (var b in c) {
        a[b] = c[b]
    }
    return a
};
Object.extend(Object, {
    inspect: function (a) {
        try {
            if (Object.isUndefined(a)) {
                return "undefined"
            }
            if (a === null) {
                return "null"
            }
            return a.inspect ? a.inspect() : String(a)
        } catch (b) {
            if (b instanceof RangeError) {
                return "..."
            }
            throw b
        }
    },
    toJSON: function (a) {
        var c = typeof a;
        switch (c) {
        case "undefined":
        case "function":
        case "unknown":
            return;
        case "boolean":
            return a.toString()
        }
        if (a === null) {
            return "null"
        }
        if (a.toJSON) {
            return a.toJSON()
        }
        if (Object.isElement(a)) {
            return
        }
        var b = [];
        for (var e in a) {
            var d = Object.toJSON(a[e]);
            if (!Object.isUndefined(d)) {
                b.push(e.toJSON() + ": " + d)
            }
        }
        return "{" + b.join(", ") + "}"
    },
    toQueryString: function (a) {
        return $H(a).toQueryString()
    },
    toHTML: function (a) {
        return a && a.toHTML ? a.toHTML() : String.interpret(a)
    },
    keys: function (a) {
        var b = [];
        for (var c in a) {
            b.push(c)
        }
        return b
    },
    values: function (b) {
        var a = [];
        for (var c in b) {
            a.push(b[c])
        }
        return a
    },
    clone: function (a) {
        return Object.extend({}, a)
    },
    isElement: function (a) {
        return !!(a && a.nodeType == 1)
    },
    isArray: function (a) {
        return a != null && typeof a == "object" && "splice" in a && "join" in a
    },
    isHash: function (a) {
        return a instanceof Hash
    },
    isFunction: function (a) {
        return typeof a == "function"
    },
    isString: function (a) {
        return typeof a == "string"
    },
    isNumber: function (a) {
        return typeof a == "number"
    },
    isUndefined: function (a) {
        return typeof a == "undefined"
    }
});
Object.extend(Function.prototype, {
    argumentNames: function () {
        var a = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g, "").split(",");
        return a.length == 1 && !a[0] ? [] : a
    },
    bind: function () {
        if (arguments.length < 2 && Object.isUndefined(arguments[0])) {
            return this
        }
        var a = this,
            c = $A(arguments),
            b = c.shift();
        return function () {
            return a.apply(b, c.concat($A(arguments)))
        }
    },
    bindAsEventListener: function () {
        var a = this,
            c = $A(arguments),
            b = c.shift();
        return function (d) {
            return a.apply(b, [d || window.event].concat(c))
        }
    },
    curry: function () {
        if (!arguments.length) {
            return this
        }
        var a = this,
            b = $A(arguments);
        return function () {
            return a.apply(this, b.concat($A(arguments)))
        }
    },
    delay: function () {
        var a = this,
            b = $A(arguments),
            c = b.shift() * 1000;
        return window.setTimeout(function () {
            return a.apply(a, b)
        }, c)
    },
    defer: function () {
        var a = [0.01].concat($A(arguments));
        return this.delay.apply(this, a)
    },
    wrap: function (b) {
        var a = this;
        return function () {
            return b.apply(this, [a.bind(this)].concat($A(arguments)))
        }
    },
    methodize: function () {
        if (this._methodized) {
            return this._methodized
        }
        var a = this;
        return this._methodized = function () {
            return a.apply(null, [this].concat($A(arguments)))
        }
    }
});
Date.prototype.toJSON = function () {
    return '"' + this.getUTCFullYear() + "-" + (this.getUTCMonth() + 1).toPaddedString(2) + "-" + this.getUTCDate().toPaddedString(2) + "T" + this.getUTCHours().toPaddedString(2) + ":" + this.getUTCMinutes().toPaddedString(2) + ":" + this.getUTCSeconds().toPaddedString(2) + 'Z"'
};
var Try = {
    these: function () {
        var c;
        for (var b = 0, d = arguments.length; b < d; b++) {
            var a = arguments[b];
            try {
                c = a();
                break
            } catch (f) {}
        }
        return c
    }
};
RegExp.prototype.match = RegExp.prototype.test;
RegExp.escape = function (a) {
    return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1")
};
var PeriodicalExecuter = Class.create({
    initialize: function (b, a) {
        this.callback = b;
        this.frequency = a;
        this.currentlyExecuting = false;
        this.registerCallback()
    },
    registerCallback: function () {
        this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000)
    },
    execute: function () {
        this.callback(this)
    },
    stop: function () {
        if (!this.timer) {
            return
        }
        clearInterval(this.timer);
        this.timer = null
    },
    onTimerEvent: function () {
        if (!this.currentlyExecuting) {
            try {
                this.currentlyExecuting = true;
                this.execute()
            } finally {
                this.currentlyExecuting = false
            }
        }
    }
});
Object.extend(String, {
    interpret: function (a) {
        return a == null ? "" : String(a)
    },
    specialChar: {
        "\b": "\\b",
        "\t": "\\t",
        "\n": "\\n",
        "\f": "\\f",
        "\r": "\\r",
        "\\": "\\\\"
    }
});
Object.extend(String.prototype, {
    gsub: function (e, c) {
        var a = "",
            d = this,
            b;
        c = arguments.callee.prepareReplacement(c);
        while (d.length > 0) {
            if (b = d.match(e)) {
                a += d.slice(0, b.index);
                a += String.interpret(c(b));
                d = d.slice(b.index + b[0].length)
            } else {
                a += d, d = ""
            }
        }
        return a
    },
    sub: function (c, a, b) {
        a = this.gsub.prepareReplacement(a);
        b = Object.isUndefined(b) ? 1 : b;
        return this.gsub(c, function (d) {
            if (--b < 0) {
                return d[0]
            }
            return a(d)
        })
    },
    scan: function (b, a) {
        this.gsub(b, a);
        return String(this)
    },
    truncate: function (b, a) {
        b = b || 30;
        a = Object.isUndefined(a) ? "..." : a;
        return this.length > b ? this.slice(0, b - a.length) + a : String(this)
    },
    strip: function () {
        return this.replace(/^\s+/, "").replace(/\s+$/, "")
    },
    stripTags: function () {
        return this.replace(/<\/?[^>]+>/gi, "")
    },
    stripScripts: function () {
        return this.replace(new RegExp(Prototype.ScriptFragment, "img"), "")
    },
    extractScripts: function () {
        var b = new RegExp(Prototype.ScriptFragment, "img");
        var a = new RegExp(Prototype.ScriptFragment, "im");
        return (this.match(b) || []).map(function (c) {
            return (c.match(a) || ["", ""])[1]
        })
    },
    evalScripts: function () {
        return this.extractScripts().map(function (script) {
            return eval(script)
        })
    },
    escapeHTML: function () {
        var a = arguments.callee;
        a.text.data = this;
        return a.div.innerHTML
    },
    unescapeHTML: function () {
        var a = new Element("div");
        a.innerHTML = this.stripTags();
        return a.childNodes[0] ? (a.childNodes.length > 1 ? $A(a.childNodes).inject("", function (b, c) {
            return b + c.nodeValue
        }) : a.childNodes[0].nodeValue) : ""
    },
    toQueryParams: function (b) {
        var a = this.strip().match(/([^?#]*)(#.*)?$/);
        if (!a) {
            return {}
        }
        return a[1].split(b || "&").inject({}, function (e, f) {
            if ((f = f.split("="))[0]) {
                var c = decodeURIComponent(f.shift());
                var d = f.length > 1 ? f.join("=") : f[0];
                if (d != undefined) {
                    d = decodeURIComponent(d)
                }
                if (c in e) {
                    if (!Object.isArray(e[c])) {
                        e[c] = [e[c]]
                    }
                    e[c].push(d)
                } else {
                    e[c] = d
                }
            }
            return e
        })
    },
    toArray: function () {
        return this.split("")
    },
    succ: function () {
        return this.slice(0, this.length - 1) + String.fromCharCode(this.charCodeAt(this.length - 1) + 1)
    },
    times: function (a) {
        return a < 1 ? "" : new Array(a + 1).join(this)
    },
    camelize: function () {
        var d = this.split("-"),
            a = d.length;
        if (a == 1) {
            return d[0]
        }
        var c = this.charAt(0) == "-" ? d[0].charAt(0).toUpperCase() + d[0].substring(1) : d[0];
        for (var b = 1; b < a; b++) {
            c += d[b].charAt(0).toUpperCase() + d[b].substring(1)
        }
        return c
    },
    capitalize: function () {
        return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase()
    },
    underscore: function () {
        return this.gsub(/::/, "/").gsub(/([A-Z]+)([A-Z][a-z])/, "#{1}_#{2}").gsub(/([a-z\d])([A-Z])/, "#{1}_#{2}").gsub(/-/, "_").toLowerCase()
    },
    dasherize: function () {
        return this.gsub(/_/, "-")
    },
    inspect: function (b) {
        var a = this.gsub(/[\x00-\x1f\\]/, function (c) {
            var d = String.specialChar[c[0]];
            return d ? d : "\\u00" + c[0].charCodeAt().toPaddedString(2, 16)
        });
        if (b) {
            return '"' + a.replace(/"/g, '\\"') + '"'
        }
        return "'" + a.replace(/'/g, "\\'") + "'"
    },
    toJSON: function () {
        return this.inspect(true)
    },
    unfilterJSON: function (a) {
        return this.sub(a || Prototype.JSONFilter, "#{1}")
    },
    isJSON: function () {
        var a = this;
        if (a.blank()) {
            return false
        }
        a = this.replace(/\\./g, "@").replace(/"[^"\\\n\r]*"/g, "");
        return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(a)
    },
    evalJSON: function (sanitize) {
        var json = this.unfilterJSON();
        try {
            if (!sanitize || json.isJSON()) {
                return eval("(" + json + ")")
            }
        } catch (e) {}
        throw new SyntaxError("Badly formed JSON string: " + this.inspect())
    },
    include: function (a) {
        return this.indexOf(a) > -1
    },
    startsWith: function (a) {
        return this.indexOf(a) === 0
    },
    endsWith: function (a) {
        var b = this.length - a.length;
        return b >= 0 && this.lastIndexOf(a) === b
    },
    empty: function () {
        return this == ""
    },
    blank: function () {
        return /^\s*$/.test(this)
    },
    interpolate: function (a, b) {
        return new Template(this, b).evaluate(a)
    }
});
if (Prototype.Browser.WebKit || Prototype.Browser.IE) {
    Object.extend(String.prototype, {
        escapeHTML: function () {
            return this.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")
        },
        unescapeHTML: function () {
            return this.stripTags().replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">")
        }
    })
}
String.prototype.gsub.prepareReplacement = function (b) {
    if (Object.isFunction(b)) {
        return b
    }
    var a = new Template(b);
    return function (c) {
        return a.evaluate(c)
    }
};
String.prototype.parseQuery = String.prototype.toQueryParams;
Object.extend(String.prototype.escapeHTML, {
    div: document.createElement("div"),
    text: document.createTextNode("")
});
String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);
var Template = Class.create({
    initialize: function (a, b) {
        this.template = a.toString();
        this.pattern = b || Template.Pattern
    },
    evaluate: function (a) {
        if (Object.isFunction(a.toTemplateReplacements)) {
            a = a.toTemplateReplacements()
        }
        return this.template.gsub(this.pattern, function (d) {
            if (a == null) {
                return ""
            }
            var f = d[1] || "";
            if (f == "\\") {
                return d[2]
            }
            var b = a,
                g = d[3];
            var e = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
            d = e.exec(g);
            if (d == null) {
                return f
            }
            while (d != null) {
                var c = d[1].startsWith("[") ? d[2].gsub("\\\\]", "]") : d[1];
                b = b[c];
                if (null == b || "" == d[3]) {
                    break
                }
                g = g.substring("[" == d[3] ? d[1].length : d[0].length);
                d = e.exec(g)
            }
            return f + String.interpret(b)
        })
    }
});
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
var $break = {};
var Enumerable = {
    each: function (c, b) {
        var a = 0;
        try {
            this._each(function (e) {
                c.call(b, e, a++)
            })
        } catch (d) {
            if (d != $break) {
                throw d
            }
        }
        return this
    },
    eachSlice: function (d, c, b) {
        var a = -d,
            e = [],
            f = this.toArray();
        if (d < 1) {
            return f
        }
        while ((a += d) < f.length) {
            e.push(f.slice(a, a + d))
        }
        return e.collect(c, b)
    },
    all: function (c, b) {
        c = c || Prototype.K;
        var a = true;
        this.each(function (e, d) {
            a = a && !! c.call(b, e, d);
            if (!a) {
                throw $break
            }
        });
        return a
    },
    any: function (c, b) {
        c = c || Prototype.K;
        var a = false;
        this.each(function (e, d) {
            if (a = !! c.call(b, e, d)) {
                throw $break
            }
        });
        return a
    },
    collect: function (c, b) {
        c = c || Prototype.K;
        var a = [];
        this.each(function (e, d) {
            a.push(c.call(b, e, d))
        });
        return a
    },
    detect: function (c, b) {
        var a;
        this.each(function (e, d) {
            if (c.call(b, e, d)) {
                a = e;
                throw $break
            }
        });
        return a
    },
    findAll: function (c, b) {
        var a = [];
        this.each(function (e, d) {
            if (c.call(b, e, d)) {
                a.push(e)
            }
        });
        return a
    },
    grep: function (d, c, b) {
        c = c || Prototype.K;
        var a = [];
        if (Object.isString(d)) {
            d = new RegExp(d)
        }
        this.each(function (f, e) {
            if (d.match(f)) {
                a.push(c.call(b, f, e))
            }
        });
        return a
    },
    include: function (a) {
        if (Object.isFunction(this.indexOf)) {
            if (this.indexOf(a) != -1) {
                return true
            }
        }
        var b = false;
        this.each(function (c) {
            if (c == a) {
                b = true;
                throw $break
            }
        });
        return b
    },
    inGroupsOf: function (b, a) {
        a = Object.isUndefined(a) ? null : a;
        return this.eachSlice(b, function (c) {
            while (c.length < b) {
                c.push(a)
            }
            return c
        })
    },
    inject: function (a, c, b) {
        this.each(function (e, d) {
            a = c.call(b, a, e, d)
        });
        return a
    },
    invoke: function (b) {
        var a = $A(arguments).slice(1);
        return this.map(function (c) {
            return c[b].apply(c, a)
        })
    },
    max: function (c, b) {
        c = c || Prototype.K;
        var a;
        this.each(function (e, d) {
            e = c.call(b, e, d);
            if (a == null || e >= a) {
                a = e
            }
        });
        return a
    },
    min: function (c, b) {
        c = c || Prototype.K;
        var a;
        this.each(function (e, d) {
            e = c.call(b, e, d);
            if (a == null || e < a) {
                a = e
            }
        });
        return a
    },
    partition: function (d, b) {
        d = d || Prototype.K;
        var c = [],
            a = [];
        this.each(function (f, e) {
            (d.call(b, f, e) ? c : a).push(f)
        });
        return [c, a]
    },
    pluck: function (b) {
        var a = [];
        this.each(function (c) {
            a.push(c[b])
        });
        return a
    },
    reject: function (c, b) {
        var a = [];
        this.each(function (e, d) {
            if (!c.call(b, e, d)) {
                a.push(e)
            }
        });
        return a
    },
    sortBy: function (b, a) {
        return this.map(function (d, c) {
            return {
                value: d,
                criteria: b.call(a, d, c)
            }
        }).sort(function (f, e) {
            var d = f.criteria,
                c = e.criteria;
            return d < c ? -1 : d > c ? 1 : 0
        }).pluck("value")
    },
    toArray: function () {
        return this.map()
    },
    zip: function () {
        var b = Prototype.K,
            a = $A(arguments);
        if (Object.isFunction(a.last())) {
            b = a.pop()
        }
        var c = [this].concat(a).map($A);
        return this.map(function (e, d) {
            return b(c.pluck(d))
        })
    },
    size: function () {
        return this.toArray().length
    },
    inspect: function () {
        return "#<Enumerable:" + this.toArray().inspect() + ">"
    }
};
Object.extend(Enumerable, {
    map: Enumerable.collect,
    find: Enumerable.detect,
    select: Enumerable.findAll,
    filter: Enumerable.findAll,
    member: Enumerable.include,
    entries: Enumerable.toArray,
    every: Enumerable.all,
    some: Enumerable.any
});

function $A(c) {
    if (!c) {
        return []
    }
    if (c.toArray) {
        return c.toArray()
    }
    var b = c.length || 0,
        a = new Array(b);
    while (b--) {
        a[b] = c[b]
    }
    return a
}
if (Prototype.Browser.WebKit) {
    $A = function (c) {
        if (!c) {
            return []
        }
        if (!(typeof c === "function" && typeof c.length === "number" && typeof c.item === "function") && c.toArray) {
            return c.toArray()
        }
        var b = c.length || 0,
            a = new Array(b);
        while (b--) {
            a[b] = c[b]
        }
        return a
    }
}
Array.from = $A;
Object.extend(Array.prototype, Enumerable);
if (!Array.prototype._reverse) {
    Array.prototype._reverse = Array.prototype.reverse
}
Object.extend(Array.prototype, {
    _each: function (b) {
        for (var a = 0, c = this.length; a < c; a++) {
            b(this[a])
        }
    },
    clear: function () {
        this.length = 0;
        return this
    },
    first: function () {
        return this[0]
    },
    last: function () {
        return this[this.length - 1]
    },
    compact: function () {
        return this.select(function (a) {
            return a != null
        })
    },
    flatten: function () {
        return this.inject([], function (b, a) {
            return b.concat(Object.isArray(a) ? a.flatten() : [a])
        })
    },
    without: function () {
        var a = $A(arguments);
        return this.select(function (b) {
            return !a.include(b)
        })
    },
    reverse: function (a) {
        return (a !== false ? this : this.toArray())._reverse()
    },
    reduce: function () {
        return this.length > 1 ? this : this[0]
    },
    uniq: function (a) {
        return this.inject([], function (d, c, b) {
            if (0 == b || (a ? d.last() != c : !d.include(c))) {
                d.push(c)
            }
            return d
        })
    },
    intersect: function (a) {
        return this.uniq().findAll(function (b) {
            return a.detect(function (c) {
                return b === c
            })
        })
    },
    clone: function () {
        return [].concat(this)
    },
    size: function () {
        return this.length
    },
    inspect: function () {
        return "[" + this.map(Object.inspect).join(", ") + "]"
    },
    toJSON: function () {
        var a = [];
        this.each(function (b) {
            var c = Object.toJSON(b);
            if (!Object.isUndefined(c)) {
                a.push(c)
            }
        });
        return "[" + a.join(", ") + "]"
    }
});
if (Object.isFunction(Array.prototype.forEach)) {
    Array.prototype._each = Array.prototype.forEach
}
if (!Array.prototype.indexOf) {
    Array.prototype.indexOf = function (c, a) {
        a || (a = 0);
        var b = this.length;
        if (a < 0) {
            a = b + a
        }
        for (; a < b; a++) {
            if (this[a] === c) {
                return a
            }
        }
        return -1
    }
}
if (!Array.prototype.lastIndexOf) {
    Array.prototype.lastIndexOf = function (b, a) {
        a = isNaN(a) ? this.length : (a < 0 ? this.length + a : a) + 1;
        var c = this.slice(0, a).reverse().indexOf(b);
        return (c < 0) ? c : a - c - 1
    }
}
Array.prototype.toArray = Array.prototype.clone;

function $w(a) {
    if (!Object.isString(a)) {
        return []
    }
    a = a.strip();
    return a ? a.split(/\s+/) : []
}
if (Prototype.Browser.Opera) {
    Array.prototype.concat = function () {
        var e = [];
        for (var b = 0, c = this.length; b < c; b++) {
            e.push(this[b])
        }
        for (var b = 0, c = arguments.length; b < c; b++) {
            if (Object.isArray(arguments[b])) {
                for (var a = 0, d = arguments[b].length; a < d; a++) {
                    e.push(arguments[b][a])
                }
            } else {
                e.push(arguments[b])
            }
        }
        return e
    }
}
Object.extend(Number.prototype, {
    toColorPart: function () {
        return this.toPaddedString(2, 16)
    },
    succ: function () {
        return this + 1
    },
    times: function (b, a) {
        $R(0, this, true).each(b, a);
        return this
    },
    toPaddedString: function (c, b) {
        var a = this.toString(b || 10);
        return "0".times(c - a.length) + a
    },
    toJSON: function () {
        return isFinite(this) ? this.toString() : "null"
    }
});
$w("abs round ceil floor").each(function (a) {
    Number.prototype[a] = Math[a].methodize()
});

function $H(a) {
    return new Hash(a)
}
var Hash = Class.create(Enumerable, (function () {
    function a(b, c) {
        if (Object.isUndefined(c)) {
            return b
        }
        return b + "=" + encodeURIComponent(String.interpret(c))
    }
    return {
        initialize: function (b) {
            this._object = Object.isHash(b) ? b.toObject() : Object.clone(b)
        },
        _each: function (c) {
            for (var b in this._object) {
                var d = this._object[b],
                    e = [b, d];
                e.key = b;
                e.value = d;
                c(e)
            }
        },
        set: function (b, c) {
            return this._object[b] = c
        },
        get: function (b) {
            if (this._object[b] !== Object.prototype[b]) {
                return this._object[b]
            }
        },
        unset: function (b) {
            var c = this._object[b];
            delete this._object[b];
            return c
        },
        toObject: function () {
            return Object.clone(this._object)
        },
        keys: function () {
            return this.pluck("key")
        },
        values: function () {
            return this.pluck("value")
        },
        index: function (c) {
            var b = this.detect(function (d) {
                return d.value === c
            });
            return b && b.key
        },
        merge: function (b) {
            return this.clone().update(b)
        },
        update: function (b) {
            return new Hash(b).inject(this, function (c, d) {
                c.set(d.key, d.value);
                return c
            })
        },
        toQueryString: function () {
            return this.inject([], function (d, e) {
                var c = encodeURIComponent(e.key),
                    b = e.value;
                if (b && typeof b == "object") {
                    if (Object.isArray(b)) {
                        return d.concat(b.map(a.curry(c)))
                    }
                } else {
                    d.push(a(c, b))
                }
                return d
            }).join("&")
        },
        inspect: function () {
            return "#<Hash:{" + this.map(function (b) {
                return b.map(Object.inspect).join(": ")
            }).join(", ") + "}>"
        },
        toJSON: function () {
            return Object.toJSON(this.toObject())
        },
        clone: function () {
            return new Hash(this)
        }
    }
})());
Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
Hash.from = $H;
var ObjectRange = Class.create(Enumerable, {
    initialize: function (c, a, b) {
        this.start = c;
        this.end = a;
        this.exclusive = b
    },
    _each: function (a) {
        var b = this.start;
        while (this.include(b)) {
            a(b);
            b = b.succ()
        }
    },
    include: function (a) {
        if (a < this.start) {
            return false
        }
        if (this.exclusive) {
            return a < this.end
        }
        return a <= this.end
    }
});
var $R = function (c, a, b) {
    return new ObjectRange(c, a, b)
};
var Ajax = {
    getTransport: function () {
        return Try.these(function () {
            return new XMLHttpRequest()
        }, function () {
            return new ActiveXObject("Msxml2.XMLHTTP")
        }, function () {
            return new ActiveXObject("Microsoft.XMLHTTP")
        }) || false
    },
    activeRequestCount: 0
};
Ajax.Responders = {
    responders: [],
    _each: function (a) {
        this.responders._each(a)
    },
    register: function (a) {
        if (!this.include(a)) {
            this.responders.push(a)
        }
    },
    unregister: function (a) {
        this.responders = this.responders.without(a)
    },
    dispatch: function (d, b, c, a) {
        this.each(function (f) {
            if (Object.isFunction(f[d])) {
                try {
                    f[d].apply(f, [b, c, a])
                } catch (g) {}
            }
        })
    }
};
Object.extend(Ajax.Responders, Enumerable);
Ajax.Responders.register({
    onCreate: function () {
        Ajax.activeRequestCount++
    },
    onComplete: function () {
        Ajax.activeRequestCount--
    }
});
Ajax.Base = Class.create({
    initialize: function (a) {
        this.options = {
            method: "post",
            asynchronous: true,
            contentType: "application/x-www-form-urlencoded",
            encoding: "UTF-8",
            parameters: "",
            evalJSON: true,
            evalJS: true
        };
        Object.extend(this.options, a || {});
        this.options.method = this.options.method.toLowerCase();
        if (Object.isString(this.options.parameters)) {
            this.options.parameters = this.options.parameters.toQueryParams()
        } else {
            if (Object.isHash(this.options.parameters)) {
                this.options.parameters = this.options.parameters.toObject()
            }
        }
    }
});
Ajax.Request = Class.create(Ajax.Base, {
    _complete: false,
    initialize: function ($super, b, a) {
        $super(a);
        this.transport = Ajax.getTransport();
        this.request(b)
    },
    request: function (b) {
        this.url = b;
        this.method = this.options.method;
        var d = Object.clone(this.options.parameters);
        if (!["get", "post"].include(this.method)) {
            d._method = this.method;
            this.method = "post"
        }
        this.parameters = d;
        if (d = Object.toQueryString(d)) {
            if (this.method == "get") {
                this.url += (this.url.include("?") ? "&" : "?") + d
            } else {
                if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
                    d += "&_="
                }
            }
        }
        try {
            var a = new Ajax.Response(this);
            if (this.options.onCreate) {
                this.options.onCreate(a)
            }
            Ajax.Responders.dispatch("onCreate", this, a);
            this.transport.open(this.method.toUpperCase(), this.url, this.options.asynchronous);
            if (this.options.asynchronous) {
                this.respondToReadyState.bind(this).defer(1)
            }
            this.transport.onreadystatechange = this.onStateChange.bind(this);
            this.setRequestHeaders();
            this.body = this.method == "post" ? (this.options.postBody || d) : null;
            this.transport.send(this.body);
            if (!this.options.asynchronous && this.transport.overrideMimeType) {
                this.onStateChange()
            }
        } catch (c) {
            this.dispatchException(c)
        }
    },
    onStateChange: function () {
        var a = this.transport.readyState;
        if (a > 1 && !((a == 4) && this._complete)) {
            this.respondToReadyState(this.transport.readyState)
        }
    },
    setRequestHeaders: function () {
        var e = {
            "X-Requested-With": "XMLHttpRequest",
            "X-Prototype-Version": Prototype.Version,
            Accept: "text/javascript, text/html, application/xml, text/xml, */*"
        };
        if (this.method == "post") {
            e["Content-type"] = this.options.contentType + (this.options.encoding ? "; charset=" + this.options.encoding : "");
            if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0, 2005])[1] < 2005) {
                e.Connection = "close"
            }
        }
        if (typeof this.options.requestHeaders == "object") {
            var c = this.options.requestHeaders;
            if (Object.isFunction(c.push)) {
                for (var b = 0, d = c.length; b < d; b += 2) {
                    e[c[b]] = c[b + 1]
                }
            } else {
                $H(c).each(function (f) {
                    e[f.key] = f.value
                })
            }
        }
        for (var a in e) {
            this.transport.setRequestHeader(a, e[a])
        }
    },
    success: function () {
        var a = this.getStatus();
        return !a || (a >= 200 && a < 300)
    },
    getStatus: function () {
        try {
            return this.transport.status || 0
        } catch (a) {
            return 0
        }
    },
    respondToReadyState: function (a) {
        var c = Ajax.Request.Events[a],
            b = new Ajax.Response(this);
        if (c == "Complete") {
            try {
                this._complete = true;
                (this.options["on" + b.status] || this.options["on" + (this.success() ? "Success" : "Failure")] || Prototype.emptyFunction)(b, b.headerJSON)
            } catch (d) {
                this.dispatchException(d)
            }
            var f = b.getHeader("Content-type");
            if (this.options.evalJS == "force" || (this.options.evalJS && this.isSameOrigin() && f && f.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) {
                this.evalResponse()
            }
        }
        try {
            (this.options["on" + c] || Prototype.emptyFunction)(b, b.headerJSON);
            Ajax.Responders.dispatch("on" + c, this, b, b.headerJSON)
        } catch (d) {
            this.dispatchException(d)
        }
        if (c == "Complete") {
            this.transport.onreadystatechange = Prototype.emptyFunction
        }
    },
    isSameOrigin: function () {
        var a = this.url.match(/^\s*https?:\/\/[^\/]*/);
        return !a || (a[0] == "#{protocol}//#{domain}#{port}".interpolate({
            protocol: location.protocol,
            domain: document.domain,
            port: location.port ? ":" + location.port : ""
        }))
    },
    getHeader: function (a) {
        try {
            return this.transport.getResponseHeader(a) || null
        } catch (b) {
            return null
        }
    },
    evalResponse: function () {
        try {
            return eval((this.transport.responseText || "").unfilterJSON())
        } catch (e) {
            this.dispatchException(e)
        }
    },
    dispatchException: function (a) {
        (this.options.onException || Prototype.emptyFunction)(this, a);
        Ajax.Responders.dispatch("onException", this, a)
    }
});
Ajax.Request.Events = ["Uninitialized", "Loading", "Loaded", "Interactive", "Complete"];
Ajax.Response = Class.create({
    initialize: function (c) {
        this.request = c;
        var d = this.transport = c.transport,
            a = this.readyState = d.readyState;
        if ((a > 2 && !Prototype.Browser.IE) || a == 4) {
            this.status = this.getStatus();
            this.statusText = this.getStatusText();
            this.responseText = String.interpret(d.responseText);
            this.headerJSON = this._getHeaderJSON()
        }
        if (a == 4) {
            var b = d.responseXML;
            this.responseXML = Object.isUndefined(b) ? null : b;
            this.responseJSON = this._getResponseJSON()
        }
    },
    status: 0,
    statusText: "",
    getStatus: Ajax.Request.prototype.getStatus,
    getStatusText: function () {
        try {
            return this.transport.statusText || ""
        } catch (a) {
            return ""
        }
    },
    getHeader: Ajax.Request.prototype.getHeader,
    getAllHeaders: function () {
        try {
            return this.getAllResponseHeaders()
        } catch (a) {
            return null
        }
    },
    getResponseHeader: function (a) {
        return this.transport.getResponseHeader(a)
    },
    getAllResponseHeaders: function () {
        return this.transport.getAllResponseHeaders()
    },
    _getHeaderJSON: function () {
        var a = this.getHeader("X-JSON");
        if (!a) {
            return null
        }
        a = decodeURIComponent(escape(a));
        try {
            return a.evalJSON(this.request.options.sanitizeJSON || !this.request.isSameOrigin())
        } catch (b) {
            this.request.dispatchException(b)
        }
    },
    _getResponseJSON: function () {
        var a = this.request.options;
        if (!a.evalJSON || (a.evalJSON != "force" && !(this.getHeader("Content-type") || "").include("application/json")) || this.responseText.blank()) {
            return null
        }
        try {
            return this.responseText.evalJSON(a.sanitizeJSON || !this.request.isSameOrigin())
        } catch (b) {
            this.request.dispatchException(b)
        }
    }
});
Ajax.Updater = Class.create(Ajax.Request, {
    initialize: function ($super, a, c, b) {
        this.container = {
            success: (a.success || a),
            failure: (a.failure || (a.success ? null : a))
        };
        b = Object.clone(b);
        var d = b.onComplete;
        b.onComplete = (function (e, f) {
            this.updateContent(e.responseText);
            if (Object.isFunction(d)) {
                d(e, f)
            }
        }).bind(this);
        $super(c, b)
    },
    updateContent: function (d) {
        var c = this.container[this.success() ? "success" : "failure"],
            a = this.options;
        if (!a.evalScripts) {
            d = d.stripScripts()
        }
        if (c = $(c)) {
            if (a.insertion) {
                if (Object.isString(a.insertion)) {
                    var b = {};
                    b[a.insertion] = d;
                    c.insert(b)
                } else {
                    a.insertion(c, d)
                }
            } else {
                c.update(d)
            }
        }
    }
});
Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
    initialize: function ($super, a, c, b) {
        $super(b);
        this.onComplete = this.options.onComplete;
        this.frequency = (this.options.frequency || 2);
        this.decay = (this.options.decay || 1);
        this.updater = {};
        this.container = a;
        this.url = c;
        this.start()
    },
    start: function () {
        this.options.onComplete = this.updateComplete.bind(this);
        this.onTimerEvent()
    },
    stop: function () {
        this.updater.options.onComplete = undefined;
        clearTimeout(this.timer);
        (this.onComplete || Prototype.emptyFunction).apply(this, arguments)
    },
    updateComplete: function (a) {
        if (this.options.decay) {
            this.decay = (a.responseText == this.lastText ? this.decay * this.options.decay : 1);
            this.lastText = a.responseText
        }
        this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency)
    },
    onTimerEvent: function () {
        this.updater = new Ajax.Updater(this.container, this.url, this.options)
    }
});

function $(b) {
    if (arguments.length > 1) {
        for (var a = 0, d = [], c = arguments.length; a < c; a++) {
            d.push($(arguments[a]))
        }
        return d
    }
    if (Object.isString(b)) {
        b = document.getElementById(b)
    }
    return Element.extend(b)
}
if (Prototype.BrowserFeatures.XPath) {
    document._getElementsByXPath = function (f, a) {
        var c = [];
        var e = document.evaluate(f, $(a) || document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
        for (var b = 0, d = e.snapshotLength; b < d; b++) {
            c.push(Element.extend(e.snapshotItem(b)))
        }
        return c
    }
}
if (!window.Node) {
    var Node = {}
}
if (!Node.ELEMENT_NODE) {
    Object.extend(Node, {
        ELEMENT_NODE: 1,
        ATTRIBUTE_NODE: 2,
        TEXT_NODE: 3,
        CDATA_SECTION_NODE: 4,
        ENTITY_REFERENCE_NODE: 5,
        ENTITY_NODE: 6,
        PROCESSING_INSTRUCTION_NODE: 7,
        COMMENT_NODE: 8,
        DOCUMENT_NODE: 9,
        DOCUMENT_TYPE_NODE: 10,
        DOCUMENT_FRAGMENT_NODE: 11,
        NOTATION_NODE: 12
    })
}(function () {
    var a = this.Element;
    this.Element = function (d, c) {
        c = c || {};
        d = d.toLowerCase();
        var b = Element.cache;
        if (Prototype.Browser.IE && c.name) {
            d = "<" + d + ' name="' + c.name + '">';
            delete c.name;
            return Element.writeAttribute(document.createElement(d), c)
        }
        if (!b[d]) {
            b[d] = Element.extend(document.createElement(d))
        }
        return Element.writeAttribute(b[d].cloneNode(false), c)
    };
    Object.extend(this.Element, a || {});
    if (a) {
        this.Element.prototype = a.prototype
    }
}).call(window);
Element.cache = {};
Element.Methods = {
    visible: function (a) {
        return $(a).style.display != "none"
    },
    toggle: function (a) {
        a = $(a);
        Element[Element.visible(a) ? "hide" : "show"](a);
        return a
    },
    hide: function (a) {
        a = $(a);
        a.style.display = "none";
        return a
    },
    show: function (a) {
        a = $(a);
        a.style.display = "";
        return a
    },
    remove: function (a) {
        a = $(a);
        a.parentNode.removeChild(a);
        return a
    },
    update: function (a, b) {
        a = $(a);
        if (b && b.toElement) {
            b = b.toElement()
        }
        if (Object.isElement(b)) {
            return a.update().insert(b)
        }
        b = Object.toHTML(b);
        a.innerHTML = b.stripScripts();
        b.evalScripts.bind(b).defer();
        return a
    },
    replace: function (b, c) {
        b = $(b);
        if (c && c.toElement) {
            c = c.toElement()
        } else {
            if (!Object.isElement(c)) {
                c = Object.toHTML(c);
                var a = b.ownerDocument.createRange();
                a.selectNode(b);
                c.evalScripts.bind(c).defer();
                c = a.createContextualFragment(c.stripScripts())
            }
        }
        b.parentNode.replaceChild(c, b);
        return b
    },
    insert: function (c, e) {
        c = $(c);
        if (Object.isString(e) || Object.isNumber(e) || Object.isElement(e) || (e && (e.toElement || e.toHTML))) {
            e = {
                bottom: e
            }
        }
        var d, f, b, g;
        for (var a in e) {
            d = e[a];
            a = a.toLowerCase();
            f = Element._insertionTranslations[a];
            if (d && d.toElement) {
                d = d.toElement()
            }
            if (Object.isElement(d)) {
                f(c, d);
                continue
            }
            d = Object.toHTML(d);
            b = ((a == "before" || a == "after") ? c.parentNode : c).tagName.toUpperCase();
            g = Element._getContentFromAnonymousElement(b, d.stripScripts());
            if (a == "top" || a == "after") {
                g.reverse()
            }
            g.each(f.curry(c));
            d.evalScripts.bind(d).defer()
        }
        return c
    },
    wrap: function (b, c, a) {
        b = $(b);
        if (Object.isElement(c)) {
            $(c).writeAttribute(a || {})
        } else {
            if (Object.isString(c)) {
                c = new Element(c, a)
            } else {
                c = new Element("div", c)
            }
        }
        if (b.parentNode) {
            b.parentNode.replaceChild(c, b)
        }
        c.appendChild(b);
        return c
    },
    inspect: function (b) {
        b = $(b);
        var a = "<" + b.tagName.toLowerCase();
        $H({
            id: "id",
            className: "class"
        }).each(function (f) {
            var e = f.first(),
                c = f.last();
            var d = (b[e] || "").toString();
            if (d) {
                a += " " + c + "=" + d.inspect(true)
            }
        });
        return a + ">"
    },
    recursivelyCollect: function (a, c) {
        a = $(a);
        var b = [];
        while (a = a[c]) {
            if (a.nodeType == 1) {
                b.push(Element.extend(a))
            }
        }
        return b
    },
    ancestors: function (a) {
        return $(a).recursivelyCollect("parentNode")
    },
    descendants: function (a) {
        return $(a).select("*")
    },
    firstDescendant: function (a) {
        a = $(a).firstChild;
        while (a && a.nodeType != 1) {
            a = a.nextSibling
        }
        return $(a)
    },
    immediateDescendants: function (a) {
        if (!(a = $(a).firstChild)) {
            return []
        }
        while (a && a.nodeType != 1) {
            a = a.nextSibling
        }
        if (a) {
            return [a].concat($(a).nextSiblings())
        }
        return []
    },
    previousSiblings: function (a) {
        return $(a).recursivelyCollect("previousSibling")
    },
    nextSiblings: function (a) {
        return $(a).recursivelyCollect("nextSibling")
    },
    siblings: function (a) {
        a = $(a);
        return a.previousSiblings().reverse().concat(a.nextSiblings())
    },
    match: function (b, a) {
        if (Object.isString(a)) {
            a = new Selector(a)
        }
        return a.match($(b))
    },
    up: function (b, d, a) {
        b = $(b);
        if (arguments.length == 1) {
            return $(b.parentNode)
        }
        var c = b.ancestors();
        return Object.isNumber(d) ? c[d] : Selector.findElement(c, d, a)
    },
    down: function (b, c, a) {
        b = $(b);
        if (arguments.length == 1) {
            return b.firstDescendant()
        }
        return Object.isNumber(c) ? b.descendants()[c] : Element.select(b, c)[a || 0]
    },
    previous: function (b, d, a) {
        b = $(b);
        if (arguments.length == 1) {
            return $(Selector.handlers.previousElementSibling(b))
        }
        var c = b.previousSiblings();
        return Object.isNumber(d) ? c[d] : Selector.findElement(c, d, a)
    },
    next: function (c, d, b) {
        c = $(c);
        if (arguments.length == 1) {
            return $(Selector.handlers.nextElementSibling(c))
        }
        var a = c.nextSiblings();
        return Object.isNumber(d) ? a[d] : Selector.findElement(a, d, b)
    },
    select: function () {
        var a = $A(arguments),
            b = $(a.shift());
        return Selector.findChildElements(b, a)
    },
    adjacent: function () {
        var a = $A(arguments),
            b = $(a.shift());
        return Selector.findChildElements(b.parentNode, a).without(b)
    },
    identify: function (b) {
        b = $(b);
        var c = b.readAttribute("id"),
            a = arguments.callee;
        if (c) {
            return c
        }
        do {
            c = "anonymous_element_" + a.counter++
        } while ($(c));
        b.writeAttribute("id", c);
        return c
    },
    readAttribute: function (c, a) {
        c = $(c);
        if (Prototype.Browser.IE) {
            var b = Element._attributeTranslations.read;
            if (b.values[a]) {
                return b.values[a](c, a)
            }
            if (b.names[a]) {
                a = b.names[a]
            }
            if (a.include(":")) {
                return (!c.attributes || !c.attributes[a]) ? null : c.attributes[a].value
            }
        }
        return c.getAttribute(a)
    },
    writeAttribute: function (e, c, f) {
        e = $(e);
        var b = {},
            d = Element._attributeTranslations.write;
        if (typeof c == "object") {
            b = c
        } else {
            b[c] = Object.isUndefined(f) ? true : f
        }
        for (var a in b) {
            c = d.names[a] || a;
            f = b[a];
            if (d.values[a]) {
                c = d.values[a](e, f)
            }
            if (f === false || f === null) {
                e.removeAttribute(c)
            } else {
                if (f === true) {
                    e.setAttribute(c, c)
                } else {
                    e.setAttribute(c, f)
                }
            }
        }
        return e
    },
    getHeight: function (a) {
        return $(a).getDimensions().height
    },
    getWidth: function (a) {
        return $(a).getDimensions().width
    },
    classNames: function (a) {
        return new Element.ClassNames(a)
    },
    hasClassName: function (a, b) {
        if (!(a = $(a))) {
            return
        }
        var c = a.className;
        return (c.length > 0 && (c == b || new RegExp("(^|\\s)" + b + "(\\s|$)").test(c)))
    },
    addClassName: function (a, b) {
        if (!(a = $(a))) {
            return
        }
        if (!a.hasClassName(b)) {
            a.className += (a.className ? " " : "") + b
        }
        return a
    },
    removeClassName: function (a, b) {
        if (!(a = $(a))) {
            return
        }
        a.className = a.className.replace(new RegExp("(^|\\s+)" + b + "(\\s+|$)"), " ").strip();
        return a
    },
    toggleClassName: function (a, b) {
        if (!(a = $(a))) {
            return
        }
        return a[a.hasClassName(b) ? "removeClassName" : "addClassName"](b)
    },
    cleanWhitespace: function (b) {
        b = $(b);
        var c = b.firstChild;
        while (c) {
            var a = c.nextSibling;
            if (c.nodeType == 3 && !/\S/.test(c.nodeValue)) {
                b.removeChild(c)
            }
            c = a
        }
        return b
    },
    empty: function (a) {
        return $(a).innerHTML.blank()
    },
    descendantOf: function (b, a) {
        b = $(b), a = $(a);
        if (b.compareDocumentPosition) {
            return (b.compareDocumentPosition(a) & 8) === 8
        }
        if (a.contains) {
            return a.contains(b) && a !== b
        }
        while (b = b.parentNode) {
            if (b == a) {
                return true
            }
        }
        return false
    },
    scrollTo: function (a) {
        a = $(a);
        var b = a.cumulativeOffset();
        window.scrollTo(b[0], b[1]);
        return a
    },
    getStyle: function (b, c) {
        b = $(b);
        c = c == "float" ? "cssFloat" : c.camelize();
        var d = b.style[c];
        if (!d || d == "auto") {
            var a = document.defaultView.getComputedStyle(b, null);
            d = a ? a[c] : null
        }
        if (c == "opacity") {
            return d ? parseFloat(d) : 1
        }
        return d == "auto" ? null : d
    },
    getOpacity: function (a) {
        return $(a).getStyle("opacity")
    },
    setStyle: function (b, c) {
        b = $(b);
        var e = b.style,
            a;
        if (Object.isString(c)) {
            b.style.cssText += ";" + c;
            return c.include("opacity") ? b.setOpacity(c.match(/opacity:\s*(\d?\.?\d*)/)[1]) : b
        }
        for (var d in c) {
            if (d == "opacity") {
                b.setOpacity(c[d])
            } else {
                e[(d == "float" || d == "cssFloat") ? (Object.isUndefined(e.styleFloat) ? "cssFloat" : "styleFloat") : d] = c[d]
            }
        }
        return b
    },
    setOpacity: function (a, b) {
        a = $(a);
        a.style.opacity = (b == 1 || b === "") ? "" : (b < 0.00001) ? 0 : b;
        return a
    },
    getDimensions: function (c) {
        c = $(c);
        var g = c.getStyle("display");
        if (g != "none" && g != null) {
            return {
                width: c.offsetWidth,
                height: c.offsetHeight
            }
        }
        var b = c.style;
        var f = b.visibility;
        var d = b.position;
        var a = b.display;
        b.visibility = "hidden";
        b.position = "absolute";
        b.display = "block";
        var j = c.clientWidth;
        var e = c.clientHeight;
        b.display = a;
        b.position = d;
        b.visibility = f;
        return {
            width: j,
            height: e
        }
    },
    makePositioned: function (a) {
        a = $(a);
        var b = Element.getStyle(a, "position");
        if (b == "static" || !b) {
            a._madePositioned = true;
            a.style.position = "relative";
            if (Prototype.Browser.Opera) {
                a.style.top = 0;
                a.style.left = 0
            }
        }
        return a
    },
    undoPositioned: function (a) {
        a = $(a);
        if (a._madePositioned) {
            a._madePositioned = undefined;
            a.style.position = a.style.top = a.style.left = a.style.bottom = a.style.right = ""
        }
        return a
    },
    makeClipping: function (a) {
        a = $(a);
        if (a._overflow) {
            return a
        }
        a._overflow = Element.getStyle(a, "overflow") || "auto";
        if (a._overflow !== "hidden") {
            a.style.overflow = "hidden"
        }
        return a
    },
    undoClipping: function (a) {
        a = $(a);
        if (!a._overflow) {
            return a
        }
        a.style.overflow = a._overflow == "auto" ? "" : a._overflow;
        a._overflow = null;
        return a
    },
    cumulativeOffset: function (b) {
        var a = 0,
            c = 0;
        do {
            a += b.offsetTop || 0;
            c += b.offsetLeft || 0;
            b = b.offsetParent
        } while (b);
        return Element._returnOffset(c, a)
    },
    positionedOffset: function (b) {
        var a = 0,
            d = 0;
        do {
            a += b.offsetTop || 0;
            d += b.offsetLeft || 0;
            b = b.offsetParent;
            if (b) {
                if (b.tagName.toUpperCase() == "BODY") {
                    break
                }
                var c = Element.getStyle(b, "position");
                if (c !== "static") {
                    break
                }
            }
        } while (b);
        return Element._returnOffset(d, a)
    },
    absolutize: function (b) {
        b = $(b);
        if (b.getStyle("position") == "absolute") {
            return b
        }
        var d = b.positionedOffset();
        var f = d[1];
        var e = d[0];
        var c = b.clientWidth;
        var a = b.clientHeight;
        b._originalLeft = e - parseFloat(b.style.left || 0);
        b._originalTop = f - parseFloat(b.style.top || 0);
        b._originalWidth = b.style.width;
        b._originalHeight = b.style.height;
        b.style.position = "absolute";
        b.style.top = f + "px";
        b.style.left = e + "px";
        b.style.width = c + "px";
        b.style.height = a + "px";
        return b
    },
    relativize: function (a) {
        a = $(a);
        if (a.getStyle("position") == "relative") {
            return a
        }
        a.style.position = "relative";
        var c = parseFloat(a.style.top || 0) - (a._originalTop || 0);
        var b = parseFloat(a.style.left || 0) - (a._originalLeft || 0);
        a.style.top = c + "px";
        a.style.left = b + "px";
        a.style.height = a._originalHeight;
        a.style.width = a._originalWidth;
        return a
    },
    cumulativeScrollOffset: function (b) {
        var a = 0,
            c = 0;
        do {
            a += b.scrollTop || 0;
            c += b.scrollLeft || 0;
            b = b.parentNode
        } while (b);
        return Element._returnOffset(c, a)
    },
    getOffsetParent: function (a) {
        if (a.offsetParent) {
            return $(a.offsetParent)
        }
        if (a == document.body) {
            return $(a)
        }
        while ((a = a.parentNode) && a != document.body) {
            if (Element.getStyle(a, "position") != "static") {
                return $(a)
            }
        }
        return $(document.body)
    },
    viewportOffset: function (d) {
        var a = 0,
            c = 0;
        var b = d;
        do {
            a += b.offsetTop || 0;
            c += b.offsetLeft || 0;
            if (b.offsetParent == document.body && Element.getStyle(b, "position") == "absolute") {
                break
            }
        } while (b = b.offsetParent);
        b = d;
        do {
            if (!Prototype.Browser.Opera || (b.tagName && (b.tagName.toUpperCase() == "BODY"))) {
                a -= b.scrollTop || 0;
                c -= b.scrollLeft || 0
            }
        } while (b = b.parentNode);
        return Element._returnOffset(c, a)
    },
    clonePosition: function (b, d) {
        var a = Object.extend({
            setLeft: true,
            setTop: true,
            setWidth: true,
            setHeight: true,
            offsetTop: 0,
            offsetLeft: 0
        }, arguments[2] || {});
        d = $(d);
        var e = d.viewportOffset();
        b = $(b);
        var f = [0, 0];
        var c = null;
        if (Element.getStyle(b, "position") == "absolute") {
            c = b.getOffsetParent();
            f = c.viewportOffset()
        }
        if (c == document.body) {
            f[0] -= document.body.offsetLeft;
            f[1] -= document.body.offsetTop
        }
        if (a.setLeft) {
            b.style.left = (e[0] - f[0] + a.offsetLeft) + "px"
        }
        if (a.setTop) {
            b.style.top = (e[1] - f[1] + a.offsetTop) + "px"
        }
        if (a.setWidth) {
            b.style.width = d.offsetWidth + "px"
        }
        if (a.setHeight) {
            b.style.height = d.offsetHeight + "px"
        }
        return b
    }
};
Element.Methods.identify.counter = 1;
Object.extend(Element.Methods, {
    getElementsBySelector: Element.Methods.select,
    childElements: Element.Methods.immediateDescendants
});
Element._attributeTranslations = {
    write: {
        names: {
            className: "class",
            htmlFor: "for"
        },
        values: {}
    }
};
if (Prototype.Browser.Opera) {
    Element.Methods.getStyle = Element.Methods.getStyle.wrap(function (d, b, c) {
        switch (c) {
        case "left":
        case "top":
        case "right":
        case "bottom":
            if (d(b, "position") === "static") {
                return null
            }
        case "height":
        case "width":
            if (!Element.visible(b)) {
                return null
            }
            var e = parseInt(d(b, c), 10);
            if (e !== b["offset" + c.capitalize()]) {
                return e + "px"
            }
            var a;
            if (c === "height") {
                a = ["border-top-width", "padding-top", "padding-bottom", "border-bottom-width"]
            } else {
                a = ["border-left-width", "padding-left", "padding-right", "border-right-width"]
            }
            return a.inject(e, function (f, g) {
                var j = d(b, g);
                return j === null ? f : f - parseInt(j, 10)
            }) + "px";
        default:
            return d(b, c)
        }
    });
    Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(function (c, a, b) {
        if (b === "title") {
            return a.title
        }
        return c(a, b)
    })
} else {
    if (Prototype.Browser.IE) {
        Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(function (c, b) {
            b = $(b);
            try {
                b.offsetParent
            } catch (f) {
                return $(document.body)
            }
            var a = b.getStyle("position");
            if (a !== "static") {
                return c(b)
            }
            b.setStyle({
                position: "relative"
            });
            var d = c(b);
            b.setStyle({
                position: a
            });
            return d
        });
        $w("positionedOffset viewportOffset").each(function (a) {
            Element.Methods[a] = Element.Methods[a].wrap(function (f, c) {
                c = $(c);
                try {
                    c.offsetParent
                } catch (j) {
                    return Element._returnOffset(0, 0)
                }
                var b = c.getStyle("position");
                if (b !== "static") {
                    return f(c)
                }
                var d = c.getOffsetParent();
                if (d && d.getStyle("position") === "fixed") {
                    d.setStyle({
                        zoom: 1
                    })
                }
                c.setStyle({
                    position: "relative"
                });
                var g = f(c);
                c.setStyle({
                    position: b
                });
                return g
            })
        });
        Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap(function (b, a) {
            try {
                a.offsetParent
            } catch (c) {
                return Element._returnOffset(0, 0)
            }
            return b(a)
        });
        Element.Methods.getStyle = function (a, b) {
            a = $(a);
            b = (b == "float" || b == "cssFloat") ? "styleFloat" : b.camelize();
            var c = a.style[b];
            if (!c && a.currentStyle) {
                c = a.currentStyle[b]
            }
            if (b == "opacity") {
                if (c = (a.getStyle("filter") || "").match(/alpha\(opacity=(.*)\)/)) {
                    if (c[1]) {
                        return parseFloat(c[1]) / 100
                    }
                }
                return 1
            }
            if (c == "auto") {
                if ((b == "width" || b == "height") && (a.getStyle("display") != "none")) {
                    return a["offset" + b.capitalize()] + "px"
                }
                return null
            }
            return c
        };
        Element.Methods.setOpacity = function (b, e) {
            function f(g) {
                return g.replace(/alpha\([^\)]*\)/gi, "")
            }
            b = $(b);
            var a = b.currentStyle;
            if ((a && !a.hasLayout) || (!a && b.style.zoom == "normal")) {
                b.style.zoom = 1
            }
            var d = b.getStyle("filter"),
                c = b.style;
            if (e == 1 || e === "") {
                (d = f(d)) ? c.filter = d : c.removeAttribute("filter");
                return b
            } else {
                if (e < 0.00001) {
                    e = 0
                }
            }
            c.filter = f(d) + "alpha(opacity=" + (e * 100) + ")";
            return b
        };
        Element._attributeTranslations = {
            read: {
                names: {
                    "class": "className",
                    "for": "htmlFor"
                },
                values: {
                    _getAttr: function (a, b) {
                        return a.getAttribute(b, 2)
                    },
                    _getAttrNode: function (a, c) {
                        var b = a.getAttributeNode(c);
                        return b ? b.value : ""
                    },
                    _getEv: function (a, b) {
                        b = a.getAttribute(b);
                        return b ? b.toString().slice(23, -2) : null
                    },
                    _flag: function (a, b) {
                        return $(a).hasAttribute(b) ? b : null
                    },
                    style: function (a) {
                        return a.style.cssText.toLowerCase()
                    },
                    title: function (a) {
                        return a.title
                    }
                }
            }
        };
        Element._attributeTranslations.write = {
            names: Object.extend({
                cellpadding: "cellPadding",
                cellspacing: "cellSpacing"
            }, Element._attributeTranslations.read.names),
            values: {
                checked: function (a, b) {
                    a.checked = !! b
                },
                style: function (a, b) {
                    a.style.cssText = b ? b : ""
                }
            }
        };
        Element._attributeTranslations.has = {};
        $w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function (a) {
            Element._attributeTranslations.write.names[a.toLowerCase()] = a;
            Element._attributeTranslations.has[a.toLowerCase()] = a
        });
        (function (a) {
            Object.extend(a, {
                href: a._getAttr,
                src: a._getAttr,
                type: a._getAttr,
                action: a._getAttrNode,
                disabled: a._flag,
                checked: a._flag,
                readonly: a._flag,
                multiple: a._flag,
                onload: a._getEv,
                onunload: a._getEv,
                onclick: a._getEv,
                ondblclick: a._getEv,
                onmousedown: a._getEv,
                onmouseup: a._getEv,
                onmouseover: a._getEv,
                onmousemove: a._getEv,
                onmouseout: a._getEv,
                onfocus: a._getEv,
                onblur: a._getEv,
                onkeypress: a._getEv,
                onkeydown: a._getEv,
                onkeyup: a._getEv,
                onsubmit: a._getEv,
                onreset: a._getEv,
                onselect: a._getEv,
                onchange: a._getEv
            })
        })(Element._attributeTranslations.read.values)
    } else {
        if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
            Element.Methods.setOpacity = function (a, b) {
                a = $(a);
                a.style.opacity = (b == 1) ? 0.999999 : (b === "") ? "" : (b < 0.00001) ? 0 : b;
                return a
            }
        } else {
            if (Prototype.Browser.WebKit) {
                Element.Methods.setOpacity = function (a, b) {
                    a = $(a);
                    a.style.opacity = (b == 1 || b === "") ? "" : (b < 0.00001) ? 0 : b;
                    if (b == 1) {
                        if (a.tagName.toUpperCase() == "IMG" && a.width) {
                            a.width++;
                            a.width--
                        } else {
                            try {
                                var d = document.createTextNode(" ");
                                a.appendChild(d);
                                a.removeChild(d)
                            } catch (c) {}
                        }
                    }
                    return a
                };
                Element.Methods.cumulativeOffset = function (b) {
                    var a = 0,
                        c = 0;
                    do {
                        a += b.offsetTop || 0;
                        c += b.offsetLeft || 0;
                        if (b.offsetParent == document.body) {
                            if (Element.getStyle(b, "position") == "absolute") {
                                break
                            }
                        }
                        b = b.offsetParent
                    } while (b);
                    return Element._returnOffset(c, a)
                }
            }
        }
    }
}
if (Prototype.Browser.IE || Prototype.Browser.Opera) {
    Element.Methods.update = function (b, c) {
        b = $(b);
        if (c && c.toElement) {
            c = c.toElement()
        }
        if (Object.isElement(c)) {
            return b.update().insert(c)
        }
        c = Object.toHTML(c);
        var a = b.tagName.toUpperCase();
        if (a in Element._insertionTranslations.tags) {
            $A(b.childNodes).each(function (d) {
                b.removeChild(d)
            });
            Element._getContentFromAnonymousElement(a, c.stripScripts()).each(function (d) {
                b.appendChild(d)
            })
        } else {
            b.innerHTML = c.stripScripts()
        }
        c.evalScripts.bind(c).defer();
        return b
    }
}
if ("outerHTML" in document.createElement("div")) {
    Element.Methods.replace = function (c, e) {
        c = $(c);
        if (e && e.toElement) {
            e = e.toElement()
        }
        if (Object.isElement(e)) {
            c.parentNode.replaceChild(e, c);
            return c
        }
        e = Object.toHTML(e);
        var d = c.parentNode,
            b = d.tagName.toUpperCase();
        if (Element._insertionTranslations.tags[b]) {
            var f = c.next();
            var a = Element._getContentFromAnonymousElement(b, e.stripScripts());
            d.removeChild(c);
            if (f) {
                a.each(function (g) {
                    d.insertBefore(g, f)
                })
            } else {
                a.each(function (g) {
                    d.appendChild(g)
                })
            }
        } else {
            c.outerHTML = e.stripScripts()
        }
        e.evalScripts.bind(e).defer();
        return c
    }
}
Element._returnOffset = function (b, c) {
    var a = [b, c];
    a.left = b;
    a.top = c;
    return a
};
Element._getContentFromAnonymousElement = function (c, b) {
    var d = new Element("div"),
        a = Element._insertionTranslations.tags[c];
    if (a) {
        d.innerHTML = a[0] + b + a[1];
        a[2].times(function () {
            d = d.firstChild
        })
    } else {
        d.innerHTML = b
    }
    return $A(d.childNodes)
};
Element._insertionTranslations = {
    before: function (a, b) {
        a.parentNode.insertBefore(b, a)
    },
    top: function (a, b) {
        a.insertBefore(b, a.firstChild)
    },
    bottom: function (a, b) {
        a.appendChild(b)
    },
    after: function (a, b) {
        a.parentNode.insertBefore(b, a.nextSibling)
    },
    tags: {
        TABLE: ["<table>", "</table>", 1],
        TBODY: ["<table><tbody>", "</tbody></table>", 2],
        TR: ["<table><tbody><tr>", "</tr></tbody></table>", 3],
        TD: ["<table><tbody><tr><td>", "</td></tr></tbody></table>", 4],
        SELECT: ["<select>", "</select>", 1]
    }
};
(function () {
    Object.extend(this.tags, {
        THEAD: this.tags.TBODY,
        TFOOT: this.tags.TBODY,
        TH: this.tags.TD
    })
}).call(Element._insertionTranslations);
Element.Methods.Simulated = {
    hasAttribute: function (a, c) {
        c = Element._attributeTranslations.has[c] || c;
        var b = $(a).getAttributeNode(c);
        return !!(b && b.specified)
    }
};
Element.Methods.ByTag = {};
Object.extend(Element, Element.Methods);
if (!Prototype.BrowserFeatures.ElementExtensions && document.createElement("div")["__proto__"]) {
    window.HTMLElement = {};
    window.HTMLElement.prototype = document.createElement("div")["__proto__"];
    Prototype.BrowserFeatures.ElementExtensions = true
}
Element.extend = (function () {
    if (Prototype.BrowserFeatures.SpecificElementExtensions) {
        return Prototype.K
    }
    var a = {},
        b = Element.Methods.ByTag;
    var c = Object.extend(function (f) {
        if (!f || f._extendedByPrototype || f.nodeType != 1 || f == window) {
            return f
        }
        var d = Object.clone(a),
            e = f.tagName.toUpperCase(),
            j, g;
        if (b[e]) {
            Object.extend(d, b[e])
        }
        for (j in d) {
            g = d[j];
            if (Object.isFunction(g) && !(j in f)) {
                f[j] = g.methodize()
            }
        }
        f._extendedByPrototype = Prototype.emptyFunction;
        return f
    }, {
        refresh: function () {
            if (!Prototype.BrowserFeatures.ElementExtensions) {
                Object.extend(a, Element.Methods);
                Object.extend(a, Element.Methods.Simulated)
            }
        }
    });
    c.refresh();
    return c
})();
Element.hasAttribute = function (a, b) {
    if (a.hasAttribute) {
        return a.hasAttribute(b)
    }
    return Element.Methods.Simulated.hasAttribute(a, b)
};
Element.addMethods = function (c) {
    var j = Prototype.BrowserFeatures,
        d = Element.Methods.ByTag;
    if (!c) {
        Object.extend(Form, Form.Methods);
        Object.extend(Form.Element, Form.Element.Methods);
        Object.extend(Element.Methods.ByTag, {
            FORM: Object.clone(Form.Methods),
            INPUT: Object.clone(Form.Element.Methods),
            SELECT: Object.clone(Form.Element.Methods),
            TEXTAREA: Object.clone(Form.Element.Methods)
        })
    }
    if (arguments.length == 2) {
        var b = c;
        c = arguments[1]
    }
    if (!b) {
        Object.extend(Element.Methods, c || {})
    } else {
        if (Object.isArray(b)) {
            b.each(g)
        } else {
            g(b)
        }
    }
    function g(l) {
        l = l.toUpperCase();
        if (!Element.Methods.ByTag[l]) {
            Element.Methods.ByTag[l] = {}
        }
        Object.extend(Element.Methods.ByTag[l], c)
    }
    function a(n, m, l) {
        l = l || false;
        for (var p in n) {
            var o = n[p];
            if (!Object.isFunction(o)) {
                continue
            }
            if (!l || !(p in m)) {
                m[p] = o.methodize()
            }
        }
    }
    function e(n) {
        var l;
        var m = {
            OPTGROUP: "OptGroup",
            TEXTAREA: "TextArea",
            P: "Paragraph",
            FIELDSET: "FieldSet",
            UL: "UList",
            OL: "OList",
            DL: "DList",
            DIR: "Directory",
            H1: "Heading",
            H2: "Heading",
            H3: "Heading",
            H4: "Heading",
            H5: "Heading",
            H6: "Heading",
            Q: "Quote",
            INS: "Mod",
            DEL: "Mod",
            A: "Anchor",
            IMG: "Image",
            CAPTION: "TableCaption",
            COL: "TableCol",
            COLGROUP: "TableCol",
            THEAD: "TableSection",
            TFOOT: "TableSection",
            TBODY: "TableSection",
            TR: "TableRow",
            TH: "TableCell",
            TD: "TableCell",
            FRAMESET: "FrameSet",
            IFRAME: "IFrame"
        };
        if (m[n]) {
            l = "HTML" + m[n] + "Element"
        }
        if (window[l]) {
            return window[l]
        }
        l = "HTML" + n + "Element";
        if (window[l]) {
            return window[l]
        }
        l = "HTML" + n.capitalize() + "Element";
        if (window[l]) {
            return window[l]
        }
        window[l] = {};
        window[l].prototype = document.createElement(n)["__proto__"];
        return window[l]
    }
    if (j.ElementExtensions) {
        a(Element.Methods, HTMLElement.prototype);
        a(Element.Methods.Simulated, HTMLElement.prototype, true)
    }
    if (j.SpecificElementExtensions) {
        for (var k in Element.Methods.ByTag) {
            var f = e(k);
            if (Object.isUndefined(f)) {
                continue
            }
            a(d[k], f.prototype)
        }
    }
    Object.extend(Element, Element.Methods);
    delete Element.ByTag;
    if (Element.extend.refresh) {
        Element.extend.refresh()
    }
    Element.cache = {}
};
document.viewport = {
    getDimensions: function () {
        var a = {},
            b = Prototype.Browser;
        $w("width height").each(function (e) {
            var c = e.capitalize();
            if (b.WebKit && !document.evaluate) {
                a[e] = self["inner" + c]
            } else {
                if (b.Opera && parseFloat(window.opera.version()) < 9.5) {
                    a[e] = document.body["client" + c]
                } else {
                    a[e] = document.documentElement["client" + c]
                }
            }
        });
        return a
    },
    getWidth: function () {
        return this.getDimensions().width
    },
    getHeight: function () {
        return this.getDimensions().height
    },
    getScrollOffsets: function () {
        return Element._returnOffset(window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop)
    }
};
var Selector = Class.create({
    initialize: function (a) {
        this.expression = a.strip();
        if (this.shouldUseSelectorsAPI()) {
            this.mode = "selectorsAPI"
        } else {
            if (this.shouldUseXPath()) {
                this.mode = "xpath";
                this.compileXPathMatcher()
            } else {
                this.mode = "normal";
                this.compileMatcher()
            }
        }
    },
    shouldUseXPath: function () {
        if (!Prototype.BrowserFeatures.XPath) {
            return false
        }
        var a = this.expression;
        if (Prototype.Browser.WebKit && (a.include("-of-type") || a.include(":empty"))) {
            return false
        }
        if ((/(\[[\w-]*?:|:checked)/).test(a)) {
            return false
        }
        return true
    },
    shouldUseSelectorsAPI: function () {
        if (!Prototype.BrowserFeatures.SelectorsAPI) {
            return false
        }
        if (!Selector._div) {
            Selector._div = new Element("div")
        }
        try {
            Selector._div.querySelector(this.expression)
        } catch (a) {
            return false
        }
        return true
    },
    compileMatcher: function () {
        var e = this.expression,
            ps = Selector.patterns,
            h = Selector.handlers,
            c = Selector.criteria,
            le, p, m;
        if (Selector._cache[e]) {
            this.matcher = Selector._cache[e];
            return
        }
        this.matcher = ["this.matcher = function(root) {", "var r = root, h = Selector.handlers, c = false, n;"];
        while (e && le != e && (/\S/).test(e)) {
            le = e;
            for (var i in ps) {
                p = ps[i];
                if (m = e.match(p)) {
                    this.matcher.push(Object.isFunction(c[i]) ? c[i](m) : new Template(c[i]).evaluate(m));
                    e = e.replace(m[0], "");
                    break
                }
            }
        }
        this.matcher.push("return h.unique(n);\n}");
        eval(this.matcher.join("\n"));
        Selector._cache[this.expression] = this.matcher
    },
    compileXPathMatcher: function () {
        var f = this.expression,
            g = Selector.patterns,
            b = Selector.xpath,
            d, a;
        if (Selector._cache[f]) {
            this.xpath = Selector._cache[f];
            return
        }
        this.matcher = [".//*"];
        while (f && d != f && (/\S/).test(f)) {
            d = f;
            for (var c in g) {
                if (a = f.match(g[c])) {
                    this.matcher.push(Object.isFunction(b[c]) ? b[c](a) : new Template(b[c]).evaluate(a));
                    f = f.replace(a[0], "");
                    break
                }
            }
        }
        this.xpath = this.matcher.join("");
        Selector._cache[this.expression] = this.xpath
    },
    findElements: function (a) {
        a = a || document;
        var c = this.expression,
            b;
        switch (this.mode) {
        case "selectorsAPI":
            if (a !== document) {
                var d = a.id,
                    f = $(a).identify();
                c = "#" + f + " " + c
            }
            b = $A(a.querySelectorAll(c)).map(Element.extend);
            a.id = d;
            return b;
        case "xpath":
            return document._getElementsByXPath(this.xpath, a);
        default:
            return this.matcher(a)
        }
    },
    match: function (k) {
        this.tokens = [];
        var q = this.expression,
            a = Selector.patterns,
            f = Selector.assertions;
        var b, d, g;
        while (q && b !== q && (/\S/).test(q)) {
            b = q;
            for (var l in a) {
                d = a[l];
                if (g = q.match(d)) {
                    if (f[l]) {
                        this.tokens.push([l, Object.clone(g)]);
                        q = q.replace(g[0], "")
                    } else {
                        return this.findElements(document).include(k)
                    }
                }
            }
        }
        var o = true,
            c, n;
        for (var l = 0, j; j = this.tokens[l]; l++) {
            c = j[0], n = j[1];
            if (!Selector.assertions[c](k, n)) {
                o = false;
                break
            }
        }
        return o
    },
    toString: function () {
        return this.expression
    },
    inspect: function () {
        return "#<Selector:" + this.expression.inspect() + ">"
    }
});
Object.extend(Selector, {
    _cache: {},
    xpath: {
        descendant: "//*",
        child: "/*",
        adjacent: "/following-sibling::*[1]",
        laterSibling: "/following-sibling::*",
        tagName: function (a) {
            if (a[1] == "*") {
                return ""
            }
            return "[local-name()='" + a[1].toLowerCase() + "' or local-name()='" + a[1].toUpperCase() + "']"
        },
        className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
        id: "[@id='#{1}']",
        attrPresence: function (a) {
            a[1] = a[1].toLowerCase();
            return new Template("[@#{1}]").evaluate(a)
        },
        attr: function (a) {
            a[1] = a[1].toLowerCase();
            a[3] = a[5] || a[6];
            return new Template(Selector.xpath.operators[a[2]]).evaluate(a)
        },
        pseudo: function (a) {
            var b = Selector.xpath.pseudos[a[1]];
            if (!b) {
                return ""
            }
            if (Object.isFunction(b)) {
                return b(a)
            }
            return new Template(Selector.xpath.pseudos[a[1]]).evaluate(a)
        },
        operators: {
            "=": "[@#{1}='#{3}']",
            "!=": "[@#{1}!='#{3}']",
            "^=": "[starts-with(@#{1}, '#{3}')]",
            "$=": "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
            "*=": "[contains(@#{1}, '#{3}')]",
            "~=": "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
            "|=": "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
        },
        pseudos: {
            "first-child": "[not(preceding-sibling::*)]",
            "last-child": "[not(following-sibling::*)]",
            "only-child": "[not(preceding-sibling::* or following-sibling::*)]",
            empty: "[count(*) = 0 and (count(text()) = 0)]",
            checked: "[@checked]",
            disabled: "[(@disabled) and (@type!='hidden')]",
            enabled: "[not(@disabled) and (@type!='hidden')]",
            not: function (b) {
                var k = b[6],
                    j = Selector.patterns,
                    a = Selector.xpath,
                    f, c;
                var g = [];
                while (k && f != k && (/\S/).test(k)) {
                    f = k;
                    for (var d in j) {
                        if (b = k.match(j[d])) {
                            c = Object.isFunction(a[d]) ? a[d](b) : new Template(a[d]).evaluate(b);
                            g.push("(" + c.substring(1, c.length - 1) + ")");
                            k = k.replace(b[0], "");
                            break
                        }
                    }
                }
                return "[not(" + g.join(" and ") + ")]"
            },
            "nth-child": function (a) {
                return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", a)
            },
            "nth-last-child": function (a) {
                return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", a)
            },
            "nth-of-type": function (a) {
                return Selector.xpath.pseudos.nth("position() ", a)
            },
            "nth-last-of-type": function (a) {
                return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", a)
            },
            "first-of-type": function (a) {
                a[6] = "1";
                return Selector.xpath.pseudos["nth-of-type"](a)
            },
            "last-of-type": function (a) {
                a[6] = "1";
                return Selector.xpath.pseudos["nth-last-of-type"](a)
            },
            "only-of-type": function (a) {
                var b = Selector.xpath.pseudos;
                return b["first-of-type"](a) + b["last-of-type"](a)
            },
            nth: function (g, e) {
                var j, k = e[6],
                    d;
                if (k == "even") {
                    k = "2n+0"
                }
                if (k == "odd") {
                    k = "2n+1"
                }
                if (j = k.match(/^(\d+)$/)) {
                    return "[" + g + "= " + j[1] + "]"
                }
                if (j = k.match(/^(-?\d*)?n(([+-])(\d+))?/)) {
                    if (j[1] == "-") {
                        j[1] = -1
                    }
                    var f = j[1] ? Number(j[1]) : 1;
                    var c = j[2] ? Number(j[2]) : 0;
                    d = "[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";
                    return new Template(d).evaluate({
                        fragment: g,
                        a: f,
                        b: c
                    })
                }
            }
        }
    },
    criteria: {
        tagName: 'n = h.tagName(n, r, "#{1}", c);      c = false;',
        className: 'n = h.className(n, r, "#{1}", c);    c = false;',
        id: 'n = h.id(n, r, "#{1}", c);           c = false;',
        attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
        attr: function (a) {
            a[3] = (a[5] || a[6]);
            return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(a)
        },
        pseudo: function (a) {
            if (a[6]) {
                a[6] = a[6].replace(/"/g, '\\"')
            }
            return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(a)
        },
        descendant: 'c = "descendant";',
        child: 'c = "child";',
        adjacent: 'c = "adjacent";',
        laterSibling: 'c = "laterSibling";'
    },
    patterns: {
        laterSibling: /^\s*~\s*/,
        child: /^\s*>\s*/,
        adjacent: /^\s*\+\s*/,
        descendant: /^\s/,
        tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
        id: /^#([\w\-\*]+)(\b|$)/,
        className: /^\.([\w\-\*]+)(\b|$)/,
        pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
        attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/,
        attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
    },
    assertions: {
        tagName: function (a, b) {
            return b[1].toUpperCase() == a.tagName.toUpperCase()
        },
        className: function (a, b) {
            return Element.hasClassName(a, b[1])
        },
        id: function (a, b) {
            return a.id === b[1]
        },
        attrPresence: function (a, b) {
            return Element.hasAttribute(a, b[1])
        },
        attr: function (b, c) {
            var a = Element.readAttribute(b, c[1]);
            return a && Selector.operators[c[2]](a, c[5] || c[6])
        }
    },
    handlers: {
        concat: function (d, c) {
            for (var e = 0, f; f = c[e]; e++) {
                d.push(f)
            }
            return d
        },
        mark: function (a) {
            var d = Prototype.emptyFunction;
            for (var b = 0, c; c = a[b]; b++) {
                c._countedByPrototype = d
            }
            return a
        },
        unmark: function (a) {
            for (var b = 0, c; c = a[b]; b++) {
                c._countedByPrototype = undefined
            }
            return a
        },
        index: function (a, d, g) {
            a._countedByPrototype = Prototype.emptyFunction;
            if (d) {
                for (var b = a.childNodes, e = b.length - 1, c = 1; e >= 0; e--) {
                    var f = b[e];
                    if (f.nodeType == 1 && (!g || f._countedByPrototype)) {
                        f.nodeIndex = c++
                    }
                }
            } else {
                for (var e = 0, c = 1, b = a.childNodes; f = b[e]; e++) {
                    if (f.nodeType == 1 && (!g || f._countedByPrototype)) {
                        f.nodeIndex = c++
                    }
                }
            }
        },
        unique: function (b) {
            if (b.length == 0) {
                return b
            }
            var d = [],
                e;
            for (var c = 0, a = b.length; c < a; c++) {
                if (!(e = b[c])._countedByPrototype) {
                    e._countedByPrototype = Prototype.emptyFunction;
                    d.push(Element.extend(e))
                }
            }
            return Selector.handlers.unmark(d)
        },
        descendant: function (a) {
            var d = Selector.handlers;
            for (var c = 0, b = [], e; e = a[c]; c++) {
                d.concat(b, e.getElementsByTagName("*"))
            }
            return b
        },
        child: function (a) {
            var e = Selector.handlers;
            for (var d = 0, c = [], f; f = a[d]; d++) {
                for (var b = 0, g; g = f.childNodes[b]; b++) {
                    if (g.nodeType == 1 && g.tagName != "!") {
                        c.push(g)
                    }
                }
            }
            return c
        },
        adjacent: function (a) {
            for (var c = 0, b = [], e; e = a[c]; c++) {
                var d = this.nextElementSibling(e);
                if (d) {
                    b.push(d)
                }
            }
            return b
        },
        laterSibling: function (a) {
            var d = Selector.handlers;
            for (var c = 0, b = [], e; e = a[c]; c++) {
                d.concat(b, Element.nextSiblings(e))
            }
            return b
        },
        nextElementSibling: function (a) {
            while (a = a.nextSibling) {
                if (a.nodeType == 1) {
                    return a
                }
            }
            return null
        },
        previousElementSibling: function (a) {
            while (a = a.previousSibling) {
                if (a.nodeType == 1) {
                    return a
                }
            }
            return null
        },
        tagName: function (a, j, c, b) {
            var k = c.toUpperCase();
            var e = [],
                g = Selector.handlers;
            if (a) {
                if (b) {
                    if (b == "descendant") {
                        for (var f = 0, d; d = a[f]; f++) {
                            g.concat(e, d.getElementsByTagName(c))
                        }
                        return e
                    } else {
                        a = this[b](a)
                    }
                    if (c == "*") {
                        return a
                    }
                }
                for (var f = 0, d; d = a[f]; f++) {
                    if (d.tagName.toUpperCase() === k) {
                        e.push(d)
                    }
                }
                return e
            } else {
                return j.getElementsByTagName(c)
            }
        },
        id: function (b, a, j, f) {
            var g = $(j),
                d = Selector.handlers;
            if (!g) {
                return []
            }
            if (!b && a == document) {
                return [g]
            }
            if (b) {
                if (f) {
                    if (f == "child") {
                        for (var c = 0, e; e = b[c]; c++) {
                            if (g.parentNode == e) {
                                return [g]
                            }
                        }
                    } else {
                        if (f == "descendant") {
                            for (var c = 0, e; e = b[c]; c++) {
                                if (Element.descendantOf(g, e)) {
                                    return [g]
                                }
                            }
                        } else {
                            if (f == "adjacent") {
                                for (var c = 0, e; e = b[c]; c++) {
                                    if (Selector.handlers.previousElementSibling(g) == e) {
                                        return [g]
                                    }
                                }
                            } else {
                                b = d[f](b)
                            }
                        }
                    }
                }
                for (var c = 0, e; e = b[c]; c++) {
                    if (e == g) {
                        return [g]
                    }
                }
                return []
            }
            return (g && Element.descendantOf(g, a)) ? [g] : []
        },
        className: function (b, a, c, d) {
            if (b && d) {
                b = this[d](b)
            }
            return Selector.handlers.byClassName(b, a, c)
        },
        byClassName: function (c, b, f) {
            if (!c) {
                c = Selector.handlers.descendant([b])
            }
            var j = " " + f + " ";
            for (var e = 0, d = [], g, a; g = c[e]; e++) {
                a = g.className;
                if (a.length == 0) {
                    continue
                }
                if (a == f || (" " + a + " ").include(j)) {
                    d.push(g)
                }
            }
            return d
        },
        attrPresence: function (c, b, a, g) {
            if (!c) {
                c = b.getElementsByTagName("*")
            }
            if (c && g) {
                c = this[g](c)
            }
            var e = [];
            for (var d = 0, f; f = c[d]; d++) {
                if (Element.hasAttribute(f, a)) {
                    e.push(f)
                }
            }
            return e
        },
        attr: function (a, k, j, l, c, b) {
            if (!a) {
                a = k.getElementsByTagName("*")
            }
            if (a && b) {
                a = this[b](a)
            }
            var m = Selector.operators[c],
                f = [];
            for (var e = 0, d; d = a[e]; e++) {
                var g = Element.readAttribute(d, j);
                if (g === null) {
                    continue
                }
                if (m(g, l)) {
                    f.push(d)
                }
            }
            return f
        },
        pseudo: function (b, c, e, a, d) {
            if (b && d) {
                b = this[d](b)
            }
            if (!b) {
                b = a.getElementsByTagName("*")
            }
            return Selector.pseudos[c](b, e, a)
        }
    },
    pseudos: {
        "first-child": function (b, f, a) {
            for (var d = 0, c = [], e; e = b[d]; d++) {
                if (Selector.handlers.previousElementSibling(e)) {
                    continue
                }
                c.push(e)
            }
            return c
        },
        "last-child": function (b, f, a) {
            for (var d = 0, c = [], e; e = b[d]; d++) {
                if (Selector.handlers.nextElementSibling(e)) {
                    continue
                }
                c.push(e)
            }
            return c
        },
        "only-child": function (b, g, a) {
            var e = Selector.handlers;
            for (var d = 0, c = [], f; f = b[d]; d++) {
                if (!e.previousElementSibling(f) && !e.nextElementSibling(f)) {
                    c.push(f)
                }
            }
            return c
        },
        "nth-child": function (b, c, a) {
            return Selector.pseudos.nth(b, c, a)
        },
        "nth-last-child": function (b, c, a) {
            return Selector.pseudos.nth(b, c, a, true)
        },
        "nth-of-type": function (b, c, a) {
            return Selector.pseudos.nth(b, c, a, false, true)
        },
        "nth-last-of-type": function (b, c, a) {
            return Selector.pseudos.nth(b, c, a, true, true)
        },
        "first-of-type": function (b, c, a) {
            return Selector.pseudos.nth(b, "1", a, false, true)
        },
        "last-of-type": function (b, c, a) {
            return Selector.pseudos.nth(b, "1", a, true, true)
        },
        "only-of-type": function (b, d, a) {
            var c = Selector.pseudos;
            return c["last-of-type"](c["first-of-type"](b, d, a), d, a)
        },
        getIndices: function (d, c, e) {
            if (d == 0) {
                return c > 0 ? [c] : []
            }
            return $R(1, e).inject([], function (a, b) {
                if (0 == (b - c) % d && (b - c) / d >= 0) {
                    a.push(b)
                }
                return a
            })
        },
        nth: function (c, s, u, r, e) {
            if (c.length == 0) {
                return []
            }
            if (s == "even") {
                s = "2n+0"
            }
            if (s == "odd") {
                s = "2n+1"
            }
            var q = Selector.handlers,
                p = [],
                d = [],
                g;
            q.mark(c);
            for (var o = 0, f; f = c[o]; o++) {
                if (!f.parentNode._countedByPrototype) {
                    q.index(f.parentNode, r, e);
                    d.push(f.parentNode)
                }
            }
            if (s.match(/^\d+$/)) {
                s = Number(s);
                for (var o = 0, f; f = c[o]; o++) {
                    if (f.nodeIndex == s) {
                        p.push(f)
                    }
                }
            } else {
                if (g = s.match(/^(-?\d*)?n(([+-])(\d+))?/)) {
                    if (g[1] == "-") {
                        g[1] = -1
                    }
                    var v = g[1] ? Number(g[1]) : 1;
                    var t = g[2] ? Number(g[2]) : 0;
                    var w = Selector.pseudos.getIndices(v, t, c.length);
                    for (var o = 0, f, k = w.length; f = c[o]; o++) {
                        for (var n = 0; n < k; n++) {
                            if (f.nodeIndex == w[n]) {
                                p.push(f)
                            }
                        }
                    }
                }
            }
            q.unmark(c);
            q.unmark(d);
            return p
        },
        empty: function (b, f, a) {
            for (var d = 0, c = [], e; e = b[d]; d++) {
                if (e.tagName == "!" || e.firstChild) {
                    continue
                }
                c.push(e)
            }
            return c
        },
        not: function (a, d, k) {
            var g = Selector.handlers,
                l, c;
            var j = new Selector(d).findElements(k);
            g.mark(j);
            for (var f = 0, e = [], b; b = a[f]; f++) {
                if (!b._countedByPrototype) {
                    e.push(b)
                }
            }
            g.unmark(j);
            return e
        },
        enabled: function (b, f, a) {
            for (var d = 0, c = [], e; e = b[d]; d++) {
                if (!e.disabled && (!e.type || e.type !== "hidden")) {
                    c.push(e)
                }
            }
            return c
        },
        disabled: function (b, f, a) {
            for (var d = 0, c = [], e; e = b[d]; d++) {
                if (e.disabled) {
                    c.push(e)
                }
            }
            return c
        },
        checked: function (b, f, a) {
            for (var d = 0, c = [], e; e = b[d]; d++) {
                if (e.checked) {
                    c.push(e)
                }
            }
            return c
        }
    },
    operators: {
        "=": function (b, a) {
            return b == a
        },
        "!=": function (b, a) {
            return b != a
        },
        "^=": function (b, a) {
            return b == a || b && b.startsWith(a)
        },
        "$=": function (b, a) {
            return b == a || b && b.endsWith(a)
        },
        "*=": function (b, a) {
            return b == a || b && b.include(a)
        },
        "$=": function (b, a) {
            return b.endsWith(a)
        },
        "*=": function (b, a) {
            return b.include(a)
        },
        "~=": function (b, a) {
            return (" " + b + " ").include(" " + a + " ")
        },
        "|=": function (b, a) {
            return ("-" + (b || "").toUpperCase() + "-").include("-" + (a || "").toUpperCase() + "-")
        }
    },
    split: function (b) {
        var a = [];
        b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function (c) {
            a.push(c[1].strip())
        });
        return a
    },
    matchElements: function (f, g) {
        var e = $$(g),
            d = Selector.handlers;
        d.mark(e);
        for (var c = 0, b = [], a; a = f[c]; c++) {
            if (a._countedByPrototype) {
                b.push(a)
            }
        }
        d.unmark(e);
        return b
    },
    findElement: function (b, c, a) {
        if (Object.isNumber(c)) {
            a = c;
            c = false
        }
        return Selector.matchElements(b, c || "*")[a || 0]
    },
    findChildElements: function (e, g) {
        g = Selector.split(g.join(","));
        var d = [],
            f = Selector.handlers;
        for (var c = 0, b = g.length, a; c < b; c++) {
            a = new Selector(g[c].strip());
            f.concat(d, a.findElements(e))
        }
        return (b > 1) ? f.unique(d) : d
    }
});
if (Prototype.Browser.IE) {
    Object.extend(Selector.handlers, {
        concat: function (d, c) {
            for (var e = 0, f; f = c[e]; e++) {
                if (f.tagName !== "!") {
                    d.push(f)
                }
            }
            return d
        },
        unmark: function (a) {
            for (var b = 0, c; c = a[b]; b++) {
                c.removeAttribute("_countedByPrototype")
            }
            return a
        }
    })
}
function $$() {
    return Selector.findChildElements(document, $A(arguments))
}
var Form = {
    reset: function (a) {
        $(a).reset();
        return a
    },
    serializeElements: function (g, b) {
        if (typeof b != "object") {
            b = {
                hash: !! b
            }
        } else {
            if (Object.isUndefined(b.hash)) {
                b.hash = true
            }
        }
        var c, f, a = false,
            e = b.submit;
        var d = g.inject({}, function (j, k) {
            if (!k.disabled && k.name) {
                c = k.name;
                f = $(k).getValue();
                if (f != null && k.type != "file" && (k.type != "submit" || (!a && e !== false && (!e || c == e) && (a = true)))) {
                    if (c in j) {
                        if (!Object.isArray(j[c])) {
                            j[c] = [j[c]]
                        }
                        j[c].push(f)
                    } else {
                        j[c] = f
                    }
                }
            }
            return j
        });
        return b.hash ? d : Object.toQueryString(d)
    }
};
Form.Methods = {
    serialize: function (b, a) {
        return Form.serializeElements(Form.getElements(b), a)
    },
    getElements: function (a) {
        return $A($(a).getElementsByTagName("*")).inject([], function (b, c) {
            if (Form.Element.Serializers[c.tagName.toLowerCase()]) {
                b.push(Element.extend(c))
            }
            return b
        })
    },
    getInputs: function (g, c, d) {
        g = $(g);
        var a = g.getElementsByTagName("input");
        if (!c && !d) {
            return $A(a).map(Element.extend)
        }
        for (var e = 0, j = [], f = a.length; e < f; e++) {
            var b = a[e];
            if ((c && b.type != c) || (d && b.name != d)) {
                continue
            }
            j.push(Element.extend(b))
        }
        return j
    },
    disable: function (a) {
        a = $(a);
        Form.getElements(a).invoke("disable");
        return a
    },
    enable: function (a) {
        a = $(a);
        Form.getElements(a).invoke("enable");
        return a
    },
    findFirstElement: function (b) {
        var c = $(b).getElements().findAll(function (d) {
            return "hidden" != d.type && !d.disabled
        });
        var a = c.findAll(function (d) {
            return d.hasAttribute("tabIndex") && d.tabIndex >= 0
        }).sortBy(function (d) {
            return d.tabIndex
        }).first();
        return a ? a : c.find(function (d) {
            return ["input", "select", "textarea"].include(d.tagName.toLowerCase())
        })
    },
    focusFirstElement: function (a) {
        a = $(a);
        a.findFirstElement().activate();
        return a
    },
    request: function (b, a) {
        b = $(b), a = Object.clone(a || {});
        var d = a.parameters,
            c = b.readAttribute("action") || "";
        if (c.blank()) {
            c = window.location.href
        }
        a.parameters = b.serialize(true);
        if (d) {
            if (Object.isString(d)) {
                d = d.toQueryParams()
            }
            Object.extend(a.parameters, d)
        }
        if (b.hasAttribute("method") && !a.method) {
            a.method = b.method
        }
        return new Ajax.Request(c, a)
    }
};
Form.Element = {
    focus: function (a) {
        $(a).focus();
        return a
    },
    select: function (a) {
        $(a).select();
        return a
    }
};
Form.Element.Methods = {
    serialize: function (a) {
        a = $(a);
        if (!a.disabled && a.name) {
            var b = a.getValue();
            if (b != undefined) {
                var c = {};
                c[a.name] = b;
                return Object.toQueryString(c)
            }
        }
        return ""
    },
    getValue: function (a) {
        a = $(a);
        var b = a.tagName.toLowerCase();
        return Form.Element.Serializers[b](a)
    },
    setValue: function (a, b) {
        a = $(a);
        var c = a.tagName.toLowerCase();
        Form.Element.Serializers[c](a, b);
        return a
    },
    clear: function (a) {
        $(a).value = "";
        return a
    },
    present: function (a) {
        return $(a).value != ""
    },
    activate: function (a) {
        a = $(a);
        try {
            a.focus();
            if (a.select && (a.tagName.toLowerCase() != "input" || !["button", "reset", "submit"].include(a.type))) {
                a.select()
            }
        } catch (b) {}
        return a
    },
    disable: function (a) {
        a = $(a);
        a.disabled = true;
        return a
    },
    enable: function (a) {
        a = $(a);
        a.disabled = false;
        return a
    }
};
var Field = Form.Element;
var $F = Form.Element.Methods.getValue;
Form.Element.Serializers = {
    input: function (a, b) {
        switch (a.type.toLowerCase()) {
        case "checkbox":
        case "radio":
            return Form.Element.Serializers.inputSelector(a, b);
        default:
            return Form.Element.Serializers.textarea(a, b)
        }
    },
    inputSelector: function (a, b) {
        if (Object.isUndefined(b)) {
            return a.checked ? a.value : null
        } else {
            a.checked = !! b
        }
    },
    textarea: function (a, b) {
        if (Object.isUndefined(b)) {
            return a.value
        } else {
            a.value = b
        }
    },
    select: function (c, f) {
        if (Object.isUndefined(f)) {
            return this[c.type == "select-one" ? "selectOne" : "selectMany"](c)
        } else {
            var b, d, g = !Object.isArray(f);
            for (var a = 0, e = c.length; a < e; a++) {
                b = c.options[a];
                d = this.optionValue(b);
                if (g) {
                    if (d == f) {
                        b.selected = true;
                        return
                    }
                } else {
                    b.selected = f.include(d)
                }
            }
        }
    },
    selectOne: function (b) {
        var a = b.selectedIndex;
        return a >= 0 ? this.optionValue(b.options[a]) : null
    },
    selectMany: function (d) {
        var a, e = d.length;
        if (!e) {
            return null
        }
        for (var c = 0, a = []; c < e; c++) {
            var b = d.options[c];
            if (b.selected) {
                a.push(this.optionValue(b))
            }
        }
        return a
    },
    optionValue: function (a) {
        return Element.extend(a).hasAttribute("value") ? a.value : a.text
    }
};
Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
    initialize: function ($super, a, b, c) {
        $super(c, b);
        this.element = $(a);
        this.lastValue = this.getValue()
    },
    execute: function () {
        var a = this.getValue();
        if (Object.isString(this.lastValue) && Object.isString(a) ? this.lastValue != a : String(this.lastValue) != String(a)) {
            this.callback(this.element, a);
            this.lastValue = a
        }
    }
});
Form.Element.Observer = Class.create(Abstract.TimedObserver, {
    getValue: function () {
        return Form.Element.getValue(this.element)
    }
});
Form.Observer = Class.create(Abstract.TimedObserver, {
    getValue: function () {
        return Form.serialize(this.element)
    }
});
Abstract.EventObserver = Class.create({
    initialize: function (a, b) {
        this.element = $(a);
        this.callback = b;
        this.lastValue = this.getValue();
        if (this.element.tagName.toLowerCase() == "form") {
            this.registerFormCallbacks()
        } else {
            this.registerCallback(this.element)
        }
    },
    onElementEvent: function () {
        var a = this.getValue();
        if (this.lastValue != a) {
            this.callback(this.element, a);
            this.lastValue = a
        }
    },
    registerFormCallbacks: function () {
        Form.getElements(this.element).each(this.registerCallback, this)
    },
    registerCallback: function (a) {
        if (a.type) {
            switch (a.type.toLowerCase()) {
            case "checkbox":
            case "radio":
                Event.observe(a, "click", this.onElementEvent.bind(this));
                break;
            default:
                Event.observe(a, "change", this.onElementEvent.bind(this));
                break
            }
        }
    }
});
Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
    getValue: function () {
        return Form.Element.getValue(this.element)
    }
});
Form.EventObserver = Class.create(Abstract.EventObserver, {
    getValue: function () {
        return Form.serialize(this.element)
    }
});
if (!window.Event) {
    var Event = {}
}
Object.extend(Event, {
    KEY_BACKSPACE: 8,
    KEY_TAB: 9,
    KEY_RETURN: 13,
    KEY_ESC: 27,
    KEY_LEFT: 37,
    KEY_UP: 38,
    KEY_RIGHT: 39,
    KEY_DOWN: 40,
    KEY_DELETE: 46,
    KEY_HOME: 36,
    KEY_END: 35,
    KEY_PAGEUP: 33,
    KEY_PAGEDOWN: 34,
    KEY_INSERT: 45,
    cache: {},
    relatedTarget: function (b) {
        var a;
        switch (b.type) {
        case "mouseover":
            a = b.fromElement;
            break;
        case "mouseout":
            a = b.toElement;
            break;
        default:
            return null
        }
        return Element.extend(a)
    }
});
Event.Methods = (function () {
    var a;
    if (Prototype.Browser.IE) {
        var b = {
            0: 1,
            1: 4,
            2: 2
        };
        a = function (d, c) {
            return d.button == b[c]
        }
    } else {
        if (Prototype.Browser.WebKit) {
            a = function (d, c) {
                switch (c) {
                case 0:
                    return d.which == 1 && !d.metaKey;
                case 1:
                    return d.which == 1 && d.metaKey;
                default:
                    return false
                }
            }
        } else {
            a = function (d, c) {
                return d.which ? (d.which === c + 1) : (d.button === c)
            }
        }
    }
    return {
        isLeftClick: function (c) {
            return a(c, 0)
        },
        isMiddleClick: function (c) {
            return a(c, 1)
        },
        isRightClick: function (c) {
            return a(c, 2)
        },
        element: function (e) {
            e = Event.extend(e);
            var d = e.target,
                c = e.type,
                f = e.currentTarget;
            if (f && f.tagName) {
                if (c === "load" || c === "error" || (c === "click" && f.tagName.toLowerCase() === "input" && f.type === "radio")) {
                    d = f
                }
            }
            if (d.nodeType == Node.TEXT_NODE) {
                d = d.parentNode
            }
            return Element.extend(d)
        },
        findElement: function (d, f) {
            var c = Event.element(d);
            if (!f) {
                return c
            }
            var e = [c].concat(c.ancestors());
            return Selector.findElement(e, f, 0)
        },
        pointer: function (e) {
            var d = document.documentElement,
                c = document.body || {
                    scrollLeft: 0,
                    scrollTop: 0
                };
            return {
                x: e.pageX || (e.clientX + (d.scrollLeft || c.scrollLeft) - (d.clientLeft || 0)),
                y: e.pageY || (e.clientY + (d.scrollTop || c.scrollTop) - (d.clientTop || 0))
            }
        },
        pointerX: function (c) {
            return Event.pointer(c).x
        },
        pointerY: function (c) {
            return Event.pointer(c).y
        },
        stop: function (c) {
            Event.extend(c);
            c.preventDefault();
            c.stopPropagation();
            c.stopped = true
        }
    }
})();
Event.extend = (function () {
    var a = Object.keys(Event.Methods).inject({}, function (b, c) {
        b[c] = Event.Methods[c].methodize();
        return b
    });
    if (Prototype.Browser.IE) {
        Object.extend(a, {
            stopPropagation: function () {
                this.cancelBubble = true
            },
            preventDefault: function () {
                this.returnValue = false
            },
            inspect: function () {
                return "[object Event]"
            }
        });
        return function (b) {
            if (!b) {
                return false
            }
            if (b._extendedByPrototype) {
                return b
            }
            b._extendedByPrototype = Prototype.emptyFunction;
            var c = Event.pointer(b);
            Object.extend(b, {
                target: b.srcElement,
                relatedTarget: Event.relatedTarget(b),
                pageX: c.x,
                pageY: c.y
            });
            return Object.extend(b, a)
        }
    } else {
        Event.prototype = Event.prototype || document.createEvent("HTMLEvents")["__proto__"];
        Object.extend(Event.prototype, a);
        return Prototype.K
    }
})();
Object.extend(Event, (function () {
    var b = Event.cache;

    function c(l) {
        if (l._prototypeEventID) {
            return l._prototypeEventID[0]
        }
        arguments.callee.id = arguments.callee.id || 1;
        return l._prototypeEventID = [++arguments.callee.id]
    }
    function g(l) {
        if (l && l.include(":")) {
            return "dataavailable"
        }
        return l
    }
    function a(l) {
        return b[l] = b[l] || {}
    }
    function f(n, l) {
        var m = a(n);
        return m[l] = m[l] || []
    }
    function j(m, l, n) {
        var q = c(m);
        var p = f(q, l);
        if (p.pluck("handler").include(n)) {
            return false
        }
        var o = function (r) {
            if (!Event || !Event.extend || (r.eventName && r.eventName != l)) {
                return false
            }
            Event.extend(r);
            n.call(m, r)
        };
        o.handler = n;
        p.push(o);
        return o
    }
    function k(o, l, m) {
        var n = f(o, l);
        return n.find(function (p) {
            return p.handler == m
        })
    }
    function d(o, l, m) {
        var n = a(o);
        if (!n[l]) {
            return false
        }
        n[l] = n[l].without(k(o, l, m))
    }
    function e() {
        for (var m in b) {
            for (var l in b[m]) {
                b[m][l] = null
            }
        }
    }
    if (window.attachEvent) {
        window.attachEvent("onunload", e)
    }
    if (Prototype.Browser.WebKit) {
        window.addEventListener("unload", Prototype.emptyFunction, false)
    }
    return {
        observe: function (n, l, o) {
            n = $(n);
            var m = g(l);
            var p = j(n, l, o);
            if (!p) {
                return n
            }
            if (n.addEventListener) {
                n.addEventListener(m, p, false)
            } else {
                n.attachEvent("on" + m, p)
            }
            return n
        },
        stopObserving: function (n, l, o) {
            n = $(n);
            var q = c(n),
                m = g(l);
            if (!o && l) {
                f(q, l).each(function (r) {
                    n.stopObserving(l, r.handler)
                });
                return n
            } else {
                if (!l) {
                    Object.keys(a(q)).each(function (r) {
                        n.stopObserving(r)
                    });
                    return n
                }
            }
            var p = k(q, l, o);
            if (!p) {
                return n
            }
            if (n.removeEventListener) {
                n.removeEventListener(m, p, false)
            } else {
                n.detachEvent("on" + m, p)
            }
            d(q, l, o);
            return n
        },
        fire: function (n, m, l) {
            n = $(n);
            if (n == document && document.createEvent && !n.dispatchEvent) {
                n = document.documentElement
            }
            var o;
            if (document.createEvent) {
                o = document.createEvent("HTMLEvents");
                o.initEvent("dataavailable", true, true)
            } else {
                o = document.createEventObject();
                o.eventType = "ondataavailable"
            }
            o.eventName = m;
            o.memo = l || {};
            if (document.createEvent) {
                n.dispatchEvent(o)
            } else {
                n.fireEvent(o.eventType, o)
            }
            return Event.extend(o)
        }
    }
})());
Object.extend(Event, Event.Methods);
Element.addMethods({
    fire: Event.fire,
    observe: Event.observe,
    stopObserving: Event.stopObserving
});
Object.extend(document, {
    fire: Element.Methods.fire.methodize(),
    observe: Element.Methods.observe.methodize(),
    stopObserving: Element.Methods.stopObserving.methodize(),
    loaded: false
});
(function () {
    var b;

    function a() {
        if (document.loaded) {
            return
        }
        if (b) {
            window.clearInterval(b)
        }
        document.fire("dom:loaded");
        document.loaded = true
    }
    if (document.addEventListener) {
        if (Prototype.Browser.WebKit) {
            b = window.setInterval(function () {
                if (/loaded|complete/.test(document.readyState)) {
                    a()
                }
            }, 0);
            Event.observe(window, "load", a)
        } else {
            document.addEventListener("DOMContentLoaded", a, false)
        }
    } else {
        document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
        $("__onDOMContentLoaded").onreadystatechange = function () {
            if (this.readyState == "complete") {
                this.onreadystatechange = null;
                a()
            }
        }
    }
})();
Hash.toQueryString = Object.toQueryString;
var Toggle = {
    display: Element.toggle
};
Element.Methods.childOf = Element.Methods.descendantOf;
var Insertion = {
    Before: function (a, b) {
        return Element.insert(a, {
            before: b
        })
    },
    Top: function (a, b) {
        return Element.insert(a, {
            top: b
        })
    },
    Bottom: function (a, b) {
        return Element.insert(a, {
            bottom: b
        })
    },
    After: function (a, b) {
        return Element.insert(a, {
            after: b
        })
    }
};
var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
var Position = {
    includeScrollOffsets: false,
    prepare: function () {
        this.deltaX = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
        this.deltaY = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0
    },
    within: function (b, a, c) {
        if (this.includeScrollOffsets) {
            return this.withinIncludingScrolloffsets(b, a, c)
        }
        this.xcomp = a;
        this.ycomp = c;
        this.offset = Element.cumulativeOffset(b);
        return (c >= this.offset[1] && c < this.offset[1] + b.offsetHeight && a >= this.offset[0] && a < this.offset[0] + b.offsetWidth)
    },
    withinIncludingScrolloffsets: function (b, a, d) {
        var c = Element.cumulativeScrollOffset(b);
        this.xcomp = a + c[0] - this.deltaX;
        this.ycomp = d + c[1] - this.deltaY;
        this.offset = Element.cumulativeOffset(b);
        return (this.ycomp >= this.offset[1] && this.ycomp < this.offset[1] + b.offsetHeight && this.xcomp >= this.offset[0] && this.xcomp < this.offset[0] + b.offsetWidth)
    },
    overlap: function (b, a) {
        if (!b) {
            return 0
        }
        if (b == "vertical") {
            return ((this.offset[1] + a.offsetHeight) - this.ycomp) / a.offsetHeight
        }
        if (b == "horizontal") {
            return ((this.offset[0] + a.offsetWidth) - this.xcomp) / a.offsetWidth
        }
    },
    cumulativeOffset: Element.Methods.cumulativeOffset,
    positionedOffset: Element.Methods.positionedOffset,
    absolutize: function (a) {
        Position.prepare();
        return Element.absolutize(a)
    },
    relativize: function (a) {
        Position.prepare();
        return Element.relativize(a)
    },
    realOffset: Element.Methods.cumulativeScrollOffset,
    offsetParent: Element.Methods.getOffsetParent,
    page: Element.Methods.viewportOffset,
    clone: function (b, c, a) {
        a = a || {};
        return Element.clonePosition(c, b, a)
    }
};
if (!document.getElementsByClassName) {
    document.getElementsByClassName = function (b) {
        function a(c) {
            return c.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + c + " ')]"
        }
        b.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
        function (c, e) {
            e = e.toString().strip();
            var d = /\s/.test(e) ? $w(e).map(a).join("") : a(e);
            return d ? document._getElementsByXPath(".//*" + d, c) : []
        } : function (e, f) {
            f = f.toString().strip();
            var g = [],
                j = (/\s/.test(f) ? $w(f) : null);
            if (!j && !f) {
                return g
            }
            var c = $(e).getElementsByTagName("*");
            f = " " + f + " ";
            for (var d = 0, l, k; l = c[d]; d++) {
                if (l.className && (k = " " + l.className + " ") && (k.include(f) || (j && j.all(function (m) {
                    return !m.toString().blank() && k.include(" " + m + " ")
                })))) {
                    g.push(Element.extend(l))
                }
            }
            return g
        };
        return function (d, c) {
            return $(c || document.body).getElementsByClassName(d)
        }
    }(Element.Methods)
}
Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
    initialize: function (a) {
        this.element = $(a)
    },
    _each: function (a) {
        this.element.className.split(/\s+/).select(function (b) {
            return b.length > 0
        })._each(a)
    },
    set: function (a) {
        this.element.className = a
    },
    add: function (a) {
        if (this.include(a)) {
            return
        }
        this.set($A(this).concat(a).join(" "))
    },
    remove: function (a) {
        if (!this.include(a)) {
            return
        }
        this.set($A(this).without(a).join(" "))
    },
    toString: function () {
        return $A(this).join(" ")
    }
};
Object.extend(Element.ClassNames.prototype, Enumerable);
Element.addMethods();
var Scriptaculous = {
    Version: "1.8.2",
    require: function (a) {
        document.write('<script type="text/javascript" src="' + a + '"><\/script>')
    },
    REQUIRED_PROTOTYPE: "1.6.0.3",
    load: function () {
        function a(c) {
            var d = c.replace(/_.*|\./g, "");
            d = parseInt(d + "0".times(4 - d.length));
            return c.indexOf("_") > -1 ? d - 1 : d
        }
        if ((typeof Prototype == "undefined") || (typeof Element == "undefined") || (typeof Element.Methods == "undefined") || (a(Prototype.Version) < a(Scriptaculous.REQUIRED_PROTOTYPE))) {
            throw ("script.aculo.us requires the Prototype JavaScript framework >= " + Scriptaculous.REQUIRED_PROTOTYPE)
        }
        var b = /scriptaculous\.js(\?.*)?$/;
        $$("head script[src]").findAll(function (c) {
            return c.src.match(b)
        }).each(function (d) {
            var e = d.src.replace(b, ""),
                c = d.src.match(/\?.*load=([a-z,]*)/);
            (c ? c[1] : "builder,effects,dragdrop,controls,slider,sound").split(",").each(function (f) {
                Scriptaculous.require(e + f + ".js")
            })
        })
    }
};
Scriptaculous.load();
var Builder = {
    NODEMAP: {
        AREA: "map",
        CAPTION: "table",
        COL: "table",
        COLGROUP: "table",
        LEGEND: "fieldset",
        OPTGROUP: "select",
        OPTION: "select",
        PARAM: "object",
        TBODY: "table",
        TD: "table",
        TFOOT: "table",
        TH: "table",
        THEAD: "table",
        TR: "table"
    },
    node: function (a) {
        a = a.toUpperCase();
        var g = this.NODEMAP[a] || "div";
        var b = document.createElement(g);
        try {
            b.innerHTML = "<" + a + "></" + a + ">"
        } catch (f) {}
        var d = b.firstChild || null;
        if (d && (d.tagName.toUpperCase() != a)) {
            d = d.getElementsByTagName(a)[0]
        }
        if (!d) {
            d = document.createElement(a)
        }
        if (!d) {
            return
        }
        if (arguments[1]) {
            if (this._isStringOrNumber(arguments[1]) || (arguments[1] instanceof Array) || arguments[1].tagName) {
                this._children(d, arguments[1])
            } else {
                var c = this._attributes(arguments[1]);
                if (c.length) {
                    try {
                        b.innerHTML = "<" + a + " " + c + "></" + a + ">"
                    } catch (f) {}
                    d = b.firstChild || null;
                    if (!d) {
                        d = document.createElement(a);
                        for (attr in arguments[1]) {
                            d[attr == "class" ? "className" : attr] = arguments[1][attr]
                        }
                    }
                    if (d.tagName.toUpperCase() != a) {
                        d = b.getElementsByTagName(a)[0]
                    }
                }
            }
        }
        if (arguments[2]) {
            this._children(d, arguments[2])
        }
        return $(d)
    },
    _text: function (a) {
        return document.createTextNode(a)
    },
    ATTR_MAP: {
        className: "class",
        htmlFor: "for"
    },
    _attributes: function (a) {
        var b = [];
        for (attribute in a) {
            b.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + '="' + a[attribute].toString().escapeHTML().gsub(/"/, "&quot;") + '"')
        }
        return b.join(" ")
    },
    _children: function (b, a) {
        if (a.tagName) {
            b.appendChild(a);
            return
        }
        if (typeof a == "object") {
            a.flatten().each(function (c) {
                if (typeof c == "object") {
                    b.appendChild(c)
                } else {
                    if (Builder._isStringOrNumber(c)) {
                        b.appendChild(Builder._text(c))
                    }
                }
            })
        } else {
            if (Builder._isStringOrNumber(a)) {
                b.appendChild(Builder._text(a))
            }
        }
    },
    _isStringOrNumber: function (a) {
        return (typeof a == "string" || typeof a == "number")
    },
    build: function (b) {
        var a = this.node("div");
        $(a).update(b.strip());
        return a.down()
    },
    dump: function (b) {
        if (typeof b != "object" && typeof b != "function") {
            b = window
        }
        var a = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
        a.each(function (c) {
            b[c] = function () {
                return Builder.node.apply(Builder, [c].concat($A(arguments)))
            }
        })
    }
};
String.prototype.parseColor = function () {
    var a = "#";
    if (this.slice(0, 4) == "rgb(") {
        var c = this.slice(4, this.length - 1).split(",");
        var b = 0;
        do {
            a += parseInt(c[b]).toColorPart()
        } while (++b < 3)
    } else {
        if (this.slice(0, 1) == "#") {
            if (this.length == 4) {
                for (var b = 1; b < 4; b++) {
                    a += (this.charAt(b) + this.charAt(b)).toLowerCase()
                }
            }
            if (this.length == 7) {
                a = this.toLowerCase()
            }
        }
    }
    return (a.length == 7 ? a : (arguments[0] || this))
};
Element.collectTextNodes = function (a) {
    return $A($(a).childNodes).collect(function (b) {
        return (b.nodeType == 3 ? b.nodeValue : (b.hasChildNodes() ? Element.collectTextNodes(b) : ""))
    }).flatten().join("")
};
Element.collectTextNodesIgnoreClass = function (a, b) {
    return $A($(a).childNodes).collect(function (c) {
        return (c.nodeType == 3 ? c.nodeValue : ((c.hasChildNodes() && !Element.hasClassName(c, b)) ? Element.collectTextNodesIgnoreClass(c, b) : ""))
    }).flatten().join("")
};
Element.setContentZoom = function (a, b) {
    a = $(a);
    a.setStyle({
        fontSize: (b / 100) + "em"
    });
    if (Prototype.Browser.WebKit) {
        window.scrollBy(0, 0)
    }
    return a
};
Element.getInlineOpacity = function (a) {
    return $(a).style.opacity || ""
};
Element.forceRerendering = function (a) {
    try {
        a = $(a);
        var c = document.createTextNode(" ");
        a.appendChild(c);
        a.removeChild(c)
    } catch (b) {}
};
var Effect = {
    _elementDoesNotExistError: {
        name: "ElementDoesNotExistError",
        message: "The specified DOM element does not exist, but is required for this effect to operate"
    },
    Transitions: {
        linear: Prototype.K,
        sinoidal: function (a) {
            return (-Math.cos(a * Math.PI) / 2) + 0.5
        },
        reverse: function (a) {
            return 1 - a
        },
        flicker: function (a) {
            var a = ((-Math.cos(a * Math.PI) / 4) + 0.75) + Math.random() / 4;
            return a > 1 ? 1 : a
        },
        wobble: function (a) {
            return (-Math.cos(a * Math.PI * (9 * a)) / 2) + 0.5
        },
        pulse: function (b, a) {
            return (-Math.cos((b * ((a || 5) - 0.5) * 2) * Math.PI) / 2) + 0.5
        },
        spring: function (a) {
            return 1 - (Math.cos(a * 4.5 * Math.PI) * Math.exp(-a * 6))
        },
        none: function (a) {
            return 0
        },
        full: function (a) {
            return 1
        }
    },
    DefaultOptions: {
        duration: 1,
        fps: 100,
        sync: false,
        from: 0,
        to: 1,
        delay: 0,
        queue: "parallel"
    },
    tagifyText: function (a) {
        var b = "position:relative";
        if (Prototype.Browser.IE) {
            b += ";zoom:1"
        }
        a = $(a);
        $A(a.childNodes).each(function (c) {
            if (c.nodeType == 3) {
                c.nodeValue.toArray().each(function (d) {
                    a.insertBefore(new Element("span", {
                        style: b
                    }).update(d == " " ? String.fromCharCode(160) : d), c)
                });
                Element.remove(c)
            }
        })
    },
    multiple: function (b, c) {
        var e;
        if (((typeof b == "object") || Object.isFunction(b)) && (b.length)) {
            e = b
        } else {
            e = $(b).childNodes
        }
        var a = Object.extend({
            speed: 0.1,
            delay: 0
        }, arguments[2] || {});
        var d = a.delay;
        $A(e).each(function (g, f) {
            new c(g, Object.extend(a, {
                delay: f * a.speed + d
            }))
        })
    },
    PAIRS: {
        slide: ["SlideDown", "SlideUp"],
        blind: ["BlindDown", "BlindUp"],
        appear: ["Appear", "Fade"]
    },
    toggle: function (b, c) {
        b = $(b);
        c = (c || "appear").toLowerCase();
        var a = Object.extend({
            queue: {
                position: "end",
                scope: (b.id || "global"),
                limit: 1
            }
        }, arguments[2] || {});
        Effect[b.visible() ? Effect.PAIRS[c][1] : Effect.PAIRS[c][0]](b, a)
    }
};
Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
Effect.ScopedQueue = Class.create(Enumerable, {
    initialize: function () {
        this.effects = [];
        this.interval = null
    },
    _each: function (a) {
        this.effects._each(a)
    },
    add: function (b) {
        var c = new Date().getTime();
        var a = Object.isString(b.options.queue) ? b.options.queue : b.options.queue.position;
        switch (a) {
        case "front":
            this.effects.findAll(function (d) {
                return d.state == "idle"
            }).each(function (d) {
                d.startOn += b.finishOn;
                d.finishOn += b.finishOn
            });
            break;
        case "with-last":
            c = this.effects.pluck("startOn").max() || c;
            break;
        case "end":
            c = this.effects.pluck("finishOn").max() || c;
            break
        }
        b.startOn += c;
        b.finishOn += c;
        if (!b.options.queue.limit || (this.effects.length < b.options.queue.limit)) {
            this.effects.push(b)
        }
        if (!this.interval) {
            this.interval = setInterval(this.loop.bind(this), 15)
        }
    },
    remove: function (a) {
        this.effects = this.effects.reject(function (b) {
            return b == a
        });
        if (this.effects.length == 0) {
            clearInterval(this.interval);
            this.interval = null
        }
    },
    loop: function () {
        var c = new Date().getTime();
        for (var b = 0, a = this.effects.length; b < a; b++) {
            this.effects[b] && this.effects[b].loop(c)
        }
    }
});
Effect.Queues = {
    instances: $H(),
    get: function (a) {
        if (!Object.isString(a)) {
            return a
        }
        return this.instances.get(a) || this.instances.set(a, new Effect.ScopedQueue())
    }
};
Effect.Queue = Effect.Queues.get("global");
Effect.Base = Class.create({
    position: null,
    start: function (a) {
        function b(d, c) {
            return ((d[c + "Internal"] ? "this.options." + c + "Internal(this);" : "") + (d[c] ? "this.options." + c + "(this);" : ""))
        }
        if (a && a.transition === false) {
            a.transition = Effect.Transitions.linear
        }
        this.options = Object.extend(Object.extend({}, Effect.DefaultOptions), a || {});
        this.currentFrame = 0;
        this.state = "idle";
        this.startOn = this.options.delay * 1000;
        this.finishOn = this.startOn + (this.options.duration * 1000);
        this.fromToDelta = this.options.to - this.options.from;
        this.totalTime = this.finishOn - this.startOn;
        this.totalFrames = this.options.fps * this.options.duration;
        this.render = (function () {
            function c(e, d) {
                if (e.options[d + "Internal"]) {
                    e.options[d + "Internal"](e)
                }
                if (e.options[d]) {
                    e.options[d](e)
                }
            }
            return function (d) {
                if (this.state === "idle") {
                    this.state = "running";
                    c(this, "beforeSetup");
                    if (this.setup) {
                        this.setup()
                    }
                    c(this, "afterSetup")
                }
                if (this.state === "running") {
                    d = (this.options.transition(d) * this.fromToDelta) + this.options.from;
                    this.position = d;
                    c(this, "beforeUpdate");
                    if (this.update) {
                        this.update(d)
                    }
                    c(this, "afterUpdate")
                }
            }
        })();
        this.event("beforeStart");
        if (!this.options.sync) {
            Effect.Queues.get(Object.isString(this.options.queue) ? "global" : this.options.queue.scope).add(this)
        }
    },
    loop: function (c) {
        if (c >= this.startOn) {
            if (c >= this.finishOn) {
                this.render(1);
                this.cancel();
                this.event("beforeFinish");
                if (this.finish) {
                    this.finish()
                }
                this.event("afterFinish");
                return
            }
            var b = (c - this.startOn) / this.totalTime,
                a = (b * this.totalFrames).round();
            if (a > this.currentFrame) {
                this.render(b);
                this.currentFrame = a
            }
        }
    },
    cancel: function () {
        if (!this.options.sync) {
            Effect.Queues.get(Object.isString(this.options.queue) ? "global" : this.options.queue.scope).remove(this)
        }
        this.state = "finished"
    },
    event: function (a) {
        if (this.options[a + "Internal"]) {
            this.options[a + "Internal"](this)
        }
        if (this.options[a]) {
            this.options[a](this)
        }
    },
    inspect: function () {
        var a = $H();
        for (property in this) {
            if (!Object.isFunction(this[property])) {
                a.set(property, this[property])
            }
        }
        return "#<Effect:" + a.inspect() + ",options:" + $H(this.options).inspect() + ">"
    }
});
Effect.Parallel = Class.create(Effect.Base, {
    initialize: function (a) {
        this.effects = a || [];
        this.start(arguments[1])
    },
    update: function (a) {
        this.effects.invoke("render", a)
    },
    finish: function (a) {
        this.effects.each(function (b) {
            b.render(1);
            b.cancel();
            b.event("beforeFinish");
            if (b.finish) {
                b.finish(a)
            }
            b.event("afterFinish")
        })
    }
});
Effect.Tween = Class.create(Effect.Base, {
    initialize: function (c, f, e) {
        c = Object.isString(c) ? $(c) : c;
        var b = $A(arguments),
            d = b.last(),
            a = b.length == 5 ? b[3] : null;
        this.method = Object.isFunction(d) ? d.bind(c) : Object.isFunction(c[d]) ? c[d].bind(c) : function (g) {
            c[d] = g
        };
        this.start(Object.extend({
            from: f,
            to: e
        }, a || {}))
    },
    update: function (a) {
        this.method(a)
    }
});
Effect.Event = Class.create(Effect.Base, {
    initialize: function () {
        this.start(Object.extend({
            duration: 0
        }, arguments[0] || {}))
    },
    update: Prototype.emptyFunction
});
Effect.Opacity = Class.create(Effect.Base, {
    initialize: function (b) {
        this.element = $(b);
        if (!this.element) {
            throw (Effect._elementDoesNotExistError)
        }
        if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) {
            this.element.setStyle({
                zoom: 1
            })
        }
        var a = Object.extend({
            from: this.element.getOpacity() || 0,
            to: 1
        }, arguments[1] || {});
        this.start(a)
    },
    update: function (a) {
        this.element.setOpacity(a)
    }
});
Effect.Move = Class.create(Effect.Base, {
    initialize: function (b) {
        this.element = $(b);
        if (!this.element) {
            throw (Effect._elementDoesNotExistError)
        }
        var a = Object.extend({
            x: 0,
            y: 0,
            mode: "relative"
        }, arguments[1] || {});
        this.start(a)
    },
    setup: function () {
        this.element.makePositioned();
        this.originalLeft = parseFloat(this.element.getStyle("left") || "0");
        this.originalTop = parseFloat(this.element.getStyle("top") || "0");
        if (this.options.mode == "absolute") {
            this.options.x = this.options.x - this.originalLeft;
            this.options.y = this.options.y - this.originalTop
        }
    },
    update: function (a) {
        this.element.setStyle({
            left: (this.options.x * a + this.originalLeft).round() + "px",
            top: (this.options.y * a + this.originalTop).round() + "px"
        })
    }
});
Effect.MoveBy = function (b, a, c) {
    return new Effect.Move(b, Object.extend({
        x: c,
        y: a
    }, arguments[3] || {}))
};
Effect.Scale = Class.create(Effect.Base, {
    initialize: function (b, c) {
        this.element = $(b);
        if (!this.element) {
            throw (Effect._elementDoesNotExistError)
        }
        var a = Object.extend({
            scaleX: true,
            scaleY: true,
            scaleContent: true,
            scaleFromCenter: false,
            scaleMode: "box",
            scaleFrom: 100,
            scaleTo: c
        }, arguments[2] || {});
        this.start(a)
    },
    setup: function () {
        this.restoreAfterFinish = this.options.restoreAfterFinish || false;
        this.elementPositioning = this.element.getStyle("position");
        this.originalStyle = {};
        ["top", "left", "width", "height", "fontSize"].each(function (b) {
            this.originalStyle[b] = this.element.style[b]
        }.bind(this));
        this.originalTop = this.element.offsetTop;
        this.originalLeft = this.element.offsetLeft;
        var a = this.element.getStyle("font-size") || "100%";
        ["em", "px", "%", "pt"].each(function (b) {
            if (a.indexOf(b) > 0) {
                this.fontSize = parseFloat(a);
                this.fontSizeType = b
            }
        }.bind(this));
        this.factor = (this.options.scaleTo - this.options.scaleFrom) / 100;
        this.dims = null;
        if (this.options.scaleMode == "box") {
            this.dims = [this.element.offsetHeight, this.element.offsetWidth]
        }
        if (/^content/.test(this.options.scaleMode)) {
            this.dims = [this.element.scrollHeight, this.element.scrollWidth]
        }
        if (!this.dims) {
            this.dims = [this.options.scaleMode.originalHeight, this.options.scaleMode.originalWidth]
        }
    },
    update: function (a) {
        var b = (this.options.scaleFrom / 100) + (this.factor * a);
        if (this.options.scaleContent && this.fontSize) {
            this.element.setStyle({
                fontSize: this.fontSize * b + this.fontSizeType
            })
        }
        this.setDimensions(this.dims[0] * b, this.dims[1] * b)
    },
    finish: function (a) {
        if (this.restoreAfterFinish) {
            this.element.setStyle(this.originalStyle)
        }
    },
    setDimensions: function (a, e) {
        var f = {};
        if (this.options.scaleX) {
            f.width = e.round() + "px"
        }
        if (this.options.scaleY) {
            f.height = a.round() + "px"
        }
        if (this.options.scaleFromCenter) {
            var c = (a - this.dims[0]) / 2;
            var b = (e - this.dims[1]) / 2;
            if (this.elementPositioning == "absolute") {
                if (this.options.scaleY) {
                    f.top = this.originalTop - c + "px"
                }
                if (this.options.scaleX) {
                    f.left = this.originalLeft - b + "px"
                }
            } else {
                if (this.options.scaleY) {
                    f.top = -c + "px"
                }
                if (this.options.scaleX) {
                    f.left = -b + "px"
                }
            }
        }
        this.element.setStyle(f)
    }
});
Effect.Highlight = Class.create(Effect.Base, {
    initialize: function (b) {
        this.element = $(b);
        if (!this.element) {
            throw (Effect._elementDoesNotExistError)
        }
        var a = Object.extend({
            startcolor: "#ffff99"
        }, arguments[1] || {});
        this.start(a)
    },
    setup: function () {
        if (this.element.getStyle("display") == "none") {
            this.cancel();
            return
        }
        this.oldStyle = {};
        if (!this.options.keepBackgroundImage) {
            this.oldStyle.backgroundImage = this.element.getStyle("background-image");
            this.element.setStyle({
                backgroundImage: "none"
            })
        }
        if (!this.options.endcolor) {
            this.options.endcolor = this.element.getStyle("background-color").parseColor("#ffffff")
        }
        if (!this.options.restorecolor) {
            this.options.restorecolor = this.element.getStyle("background-color")
        }
        this._base = $R(0, 2).map(function (a) {
            return parseInt(this.options.startcolor.slice(a * 2 + 1, a * 2 + 3), 16)
        }.bind(this));
        this._delta = $R(0, 2).map(function (a) {
            return parseInt(this.options.endcolor.slice(a * 2 + 1, a * 2 + 3), 16) - this._base[a]
        }.bind(this))
    },
    update: function (a) {
        this.element.setStyle({
            backgroundColor: $R(0, 2).inject("#", function (b, c, d) {
                return b + ((this._base[d] + (this._delta[d] * a)).round().toColorPart())
            }.bind(this))
        })
    },
    finish: function () {
        this.element.setStyle(Object.extend(this.oldStyle, {
            backgroundColor: this.options.restorecolor
        }))
    }
});
Effect.ScrollTo = function (c) {
    var b = arguments[1] || {},
        a = document.viewport.getScrollOffsets(),
        d = $(c).cumulativeOffset();
    if (b.offset) {
        d[1] += b.offset
    }
    return new Effect.Tween(null, a.top, d[1], b, function (e) {
        scrollTo(a.left, e.round())
    })
};
Effect.Fade = function (c) {
    c = $(c);
    var a = c.getInlineOpacity();
    var b = Object.extend({
        from: c.getOpacity() || 1,
        to: 0,
        afterFinishInternal: function (d) {
            if (d.options.to != 0) {
                return
            }
            d.element.hide().setStyle({
                opacity: a
            })
        }
    }, arguments[1] || {});
    return new Effect.Opacity(c, b)
};
Effect.Appear = function (b) {
    b = $(b);
    var a = Object.extend({
        from: (b.getStyle("display") == "none" ? 0 : b.getOpacity() || 0),
        to: 1,
        afterFinishInternal: function (c) {
            c.element.forceRerendering()
        },
        beforeSetup: function (c) {
            c.element.setOpacity(c.options.from).show()
        }
    }, arguments[1] || {});
    return new Effect.Opacity(b, a)
};
Effect.Puff = function (b) {
    b = $(b);
    var a = {
        opacity: b.getInlineOpacity(),
        position: b.getStyle("position"),
        top: b.style.top,
        left: b.style.left,
        width: b.style.width,
        height: b.style.height
    };
    return new Effect.Parallel([new Effect.Scale(b, 200, {
        sync: true,
        scaleFromCenter: true,
        scaleContent: true,
        restoreAfterFinish: true
    }), new Effect.Opacity(b, {
        sync: true,
        to: 0
    })], Object.extend({
        duration: 1,
        beforeSetupInternal: function (c) {
            Position.absolutize(c.effects[0].element)
        },
        afterFinishInternal: function (c) {
            c.effects[0].element.hide().setStyle(a)
        }
    }, arguments[1] || {}))
};
Effect.BlindUp = function (a) {
    a = $(a);
    a.makeClipping();
    return new Effect.Scale(a, 0, Object.extend({
        scaleContent: false,
        scaleX: false,
        restoreAfterFinish: true,
        afterFinishInternal: function (b) {
            b.element.hide().undoClipping()
        }
    }, arguments[1] || {}))
};
Effect.BlindDown = function (b) {
    b = $(b);
    var a = b.getDimensions();
    return new Effect.Scale(b, 100, Object.extend({
        scaleContent: false,
        scaleX: false,
        scaleFrom: 0,
        scaleMode: {
            originalHeight: a.height,
            originalWidth: a.width
        },
        restoreAfterFinish: true,
        afterSetup: function (c) {
            c.element.makeClipping().setStyle({
                height: "0px"
            }).show()
        },
        afterFinishInternal: function (c) {
            c.element.undoClipping()
        }
    }, arguments[1] || {}))
};
Effect.SwitchOff = function (b) {
    b = $(b);
    var a = b.getInlineOpacity();
    return new Effect.Appear(b, Object.extend({
        duration: 0.4,
        from: 0,
        transition: Effect.Transitions.flicker,
        afterFinishInternal: function (c) {
            new Effect.Scale(c.element, 1, {
                duration: 0.3,
                scaleFromCenter: true,
                scaleX: false,
                scaleContent: false,
                restoreAfterFinish: true,
                beforeSetup: function (d) {
                    d.element.makePositioned().makeClipping()
                },
                afterFinishInternal: function (d) {
                    d.element.hide().undoClipping().undoPositioned().setStyle({
                        opacity: a
                    })
                }
            })
        }
    }, arguments[1] || {}))
};
Effect.DropOut = function (b) {
    b = $(b);
    var a = {
        top: b.getStyle("top"),
        left: b.getStyle("left"),
        opacity: b.getInlineOpacity()
    };
    return new Effect.Parallel([new Effect.Move(b, {
        x: 0,
        y: 100,
        sync: true
    }), new Effect.Opacity(b, {
        sync: true,
        to: 0
    })], Object.extend({
        duration: 0.5,
        beforeSetup: function (c) {
            c.effects[0].element.makePositioned()
        },
        afterFinishInternal: function (c) {
            c.effects[0].element.hide().undoPositioned().setStyle(a)
        }
    }, arguments[1] || {}))
};
Effect.Shake = function (d) {
    d = $(d);
    var b = Object.extend({
        distance: 20,
        duration: 0.5
    }, arguments[1] || {});
    var e = parseFloat(b.distance);
    var c = parseFloat(b.duration) / 10;
    var a = {
        top: d.getStyle("top"),
        left: d.getStyle("left")
    };
    return new Effect.Move(d, {
        x: e,
        y: 0,
        duration: c,
        afterFinishInternal: function (f) {
            new Effect.Move(f.element, {
                x: -e * 2,
                y: 0,
                duration: c * 2,
                afterFinishInternal: function (g) {
                    new Effect.Move(g.element, {
                        x: e * 2,
                        y: 0,
                        duration: c * 2,
                        afterFinishInternal: function (j) {
                            new Effect.Move(j.element, {
                                x: -e * 2,
                                y: 0,
                                duration: c * 2,
                                afterFinishInternal: function (k) {
                                    new Effect.Move(k.element, {
                                        x: e * 2,
                                        y: 0,
                                        duration: c * 2,
                                        afterFinishInternal: function (l) {
                                            new Effect.Move(l.element, {
                                                x: -e,
                                                y: 0,
                                                duration: c,
                                                afterFinishInternal: function (m) {
                                                    m.element.undoPositioned().setStyle(a)
                                                }
                                            })
                                        }
                                    })
                                }
                            })
                        }
                    })
                }
            })
        }
    })
};
Effect.SlideDown = function (c) {
    c = $(c).cleanWhitespace();
    var a = c.down().getStyle("bottom");
    var b = c.getDimensions();
    return new Effect.Scale(c, 100, Object.extend({
        scaleContent: false,
        scaleX: false,
        scaleFrom: window.opera ? 0 : 1,
        scaleMode: {
            originalHeight: b.height,
            originalWidth: b.width
        },
        restoreAfterFinish: true,
        afterSetup: function (d) {
            d.element.makePositioned();
            d.element.down().makePositioned();
            if (window.opera) {
                d.element.setStyle({
                    top: ""
                })
            }
            d.element.makeClipping().setStyle({
                height: "0px"
            }).show()
        },
        afterUpdateInternal: function (d) {
            d.element.down().setStyle({
                bottom: (d.dims[0] - d.element.clientHeight) + "px"
            })
        },
        afterFinishInternal: function (d) {
            d.element.undoClipping().undoPositioned();
            d.element.down().undoPositioned().setStyle({
                bottom: a
            })
        }
    }, arguments[1] || {}))
};
Effect.SlideUp = function (c) {
    c = $(c).cleanWhitespace();
    var a = c.down().getStyle("bottom");
    var b = c.getDimensions();
    return new Effect.Scale(c, window.opera ? 0 : 1, Object.extend({
        scaleContent: false,
        scaleX: false,
        scaleMode: "box",
        scaleFrom: 100,
        scaleMode: {
            originalHeight: b.height,
            originalWidth: b.width
        },
        restoreAfterFinish: true,
        afterSetup: function (d) {
            d.element.makePositioned();
            d.element.down().makePositioned();
            if (window.opera) {
                d.element.setStyle({
                    top: ""
                })
            }
            d.element.makeClipping().show()
        },
        afterUpdateInternal: function (d) {
            d.element.down().setStyle({
                bottom: (d.dims[0] - d.element.clientHeight) + "px"
            })
        },
        afterFinishInternal: function (d) {
            d.element.hide().undoClipping().undoPositioned();
            d.element.down().undoPositioned().setStyle({
                bottom: a
            })
        }
    }, arguments[1] || {}))
};
Effect.Squish = function (a) {
    return new Effect.Scale(a, window.opera ? 1 : 0, {
        restoreAfterFinish: true,
        beforeSetup: function (b) {
            b.element.makeClipping()
        },
        afterFinishInternal: function (b) {
            b.element.hide().undoClipping()
        }
    })
};
Effect.Grow = function (c) {
    c = $(c);
    var b = Object.extend({
        direction: "center",
        moveTransition: Effect.Transitions.sinoidal,
        scaleTransition: Effect.Transitions.sinoidal,
        opacityTransition: Effect.Transitions.full
    }, arguments[1] || {});
    var a = {
        top: c.style.top,
        left: c.style.left,
        height: c.style.height,
        width: c.style.width,
        opacity: c.getInlineOpacity()
    };
    var g = c.getDimensions();
    var j, f;
    var e, d;
    switch (b.direction) {
    case "top-left":
        j = f = e = d = 0;
        break;
    case "top-right":
        j = g.width;
        f = d = 0;
        e = -g.width;
        break;
    case "bottom-left":
        j = e = 0;
        f = g.height;
        d = -g.height;
        break;
    case "bottom-right":
        j = g.width;
        f = g.height;
        e = -g.width;
        d = -g.height;
        break;
    case "center":
        j = g.width / 2;
        f = g.height / 2;
        e = -g.width / 2;
        d = -g.height / 2;
        break
    }
    return new Effect.Move(c, {
        x: j,
        y: f,
        duration: 0.01,
        beforeSetup: function (k) {
            k.element.hide().makeClipping().makePositioned()
        },
        afterFinishInternal: function (k) {
            new Effect.Parallel([new Effect.Opacity(k.element, {
                sync: true,
                to: 1,
                from: 0,
                transition: b.opacityTransition
            }), new Effect.Move(k.element, {
                x: e,
                y: d,
                sync: true,
                transition: b.moveTransition
            }), new Effect.Scale(k.element, 100, {
                scaleMode: {
                    originalHeight: g.height,
                    originalWidth: g.width
                },
                sync: true,
                scaleFrom: window.opera ? 1 : 0,
                transition: b.scaleTransition,
                restoreAfterFinish: true
            })], Object.extend({
                beforeSetup: function (l) {
                    l.effects[0].element.setStyle({
                        height: "0px"
                    }).show()
                },
                afterFinishInternal: function (l) {
                    l.effects[0].element.undoClipping().undoPositioned().setStyle(a)
                }
            }, b))
        }
    })
};
Effect.Shrink = function (c) {
    c = $(c);
    var b = Object.extend({
        direction: "center",
        moveTransition: Effect.Transitions.sinoidal,
        scaleTransition: Effect.Transitions.sinoidal,
        opacityTransition: Effect.Transitions.none
    }, arguments[1] || {});
    var a = {
        top: c.style.top,
        left: c.style.left,
        height: c.style.height,
        width: c.style.width,
        opacity: c.getInlineOpacity()
    };
    var f = c.getDimensions();
    var e, d;
    switch (b.direction) {
    case "top-left":
        e = d = 0;
        break;
    case "top-right":
        e = f.width;
        d = 0;
        break;
    case "bottom-left":
        e = 0;
        d = f.height;
        break;
    case "bottom-right":
        e = f.width;
        d = f.height;
        break;
    case "center":
        e = f.width / 2;
        d = f.height / 2;
        break
    }
    return new Effect.Parallel([new Effect.Opacity(c, {
        sync: true,
        to: 0,
        from: 1,
        transition: b.opacityTransition
    }), new Effect.Scale(c, window.opera ? 1 : 0, {
        sync: true,
        transition: b.scaleTransition,
        restoreAfterFinish: true
    }), new Effect.Move(c, {
        x: e,
        y: d,
        sync: true,
        transition: b.moveTransition
    })], Object.extend({
        beforeStartInternal: function (g) {
            g.effects[0].element.makePositioned().makeClipping()
        },
        afterFinishInternal: function (g) {
            g.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)
        }
    }, b))
};
Effect.Pulsate = function (c) {
    c = $(c);
    var b = arguments[1] || {},
        a = c.getInlineOpacity(),
        e = b.transition || Effect.Transitions.linear,
        d = function (f) {
            return 1 - e((-Math.cos((f * (b.pulses || 5) * 2) * Math.PI) / 2) + 0.5)
        };
    return new Effect.Opacity(c, Object.extend(Object.extend({
        duration: 2,
        from: 0,
        afterFinishInternal: function (f) {
            f.element.setStyle({
                opacity: a
            })
        }
    }, b), {
        transition: d
    }))
};
Effect.Fold = function (b) {
    b = $(b);
    var a = {
        top: b.style.top,
        left: b.style.left,
        width: b.style.width,
        height: b.style.height
    };
    b.makeClipping();
    return new Effect.Scale(b, 5, Object.extend({
        scaleContent: false,
        scaleX: false,
        afterFinishInternal: function (c) {
            new Effect.Scale(b, 1, {
                scaleContent: false,
                scaleY: false,
                afterFinishInternal: function (d) {
                    d.element.hide().undoClipping().setStyle(a)
                }
            })
        }
    }, arguments[1] || {}))
};
Effect.Morph = Class.create(Effect.Base, {
    initialize: function (c) {
        this.element = $(c);
        if (!this.element) {
            throw (Effect._elementDoesNotExistError)
        }
        var a = Object.extend({
            style: {}
        }, arguments[1] || {});
        if (!Object.isString(a.style)) {
            this.style = $H(a.style)
        } else {
            if (a.style.include(":")) {
                this.style = a.style.parseStyle()
            } else {
                this.element.addClassName(a.style);
                this.style = $H(this.element.getStyles());
                this.element.removeClassName(a.style);
                var b = this.element.getStyles();
                this.style = this.style.reject(function (d) {
                    return d.value == b[d.key]
                });
                a.afterFinishInternal = function (d) {
                    d.element.addClassName(d.options.style);
                    d.transforms.each(function (e) {
                        d.element.style[e.style] = ""
                    })
                }
            }
        }
        this.start(a)
    },
    setup: function () {
        function a(b) {
            if (!b || ["rgba(0, 0, 0, 0)", "transparent"].include(b)) {
                b = "#ffffff"
            }
            b = b.parseColor();
            return $R(0, 2).map(function (c) {
                return parseInt(b.slice(c * 2 + 1, c * 2 + 3), 16)
            })
        }
        this.transforms = this.style.map(function (g) {
            var f = g[0],
                e = g[1],
                d = null;
            if (e.parseColor("#zzzzzz") != "#zzzzzz") {
                e = e.parseColor();
                d = "color"
            } else {
                if (f == "opacity") {
                    e = parseFloat(e);
                    if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) {
                        this.element.setStyle({
                            zoom: 1
                        })
                    }
                } else {
                    if (Element.CSS_LENGTH.test(e)) {
                        var c = e.match(/^([\+\-]?[0-9\.]+)(.*)$/);
                        e = parseFloat(c[1]);
                        d = (c.length == 3) ? c[2] : null
                    }
                }
            }
            var b = this.element.getStyle(f);
            return {
                style: f.camelize(),
                originalValue: d == "color" ? a(b) : parseFloat(b || 0),
                targetValue: d == "color" ? a(e) : e,
                unit: d
            }
        }.bind(this)).reject(function (b) {
            return ((b.originalValue == b.targetValue) || (b.unit != "color" && (isNaN(b.originalValue) || isNaN(b.targetValue))))
        })
    },
    update: function (a) {
        var d = {},
            b, c = this.transforms.length;
        while (c--) {
            d[(b = this.transforms[c]).style] = b.unit == "color" ? "#" + (Math.round(b.originalValue[0] + (b.targetValue[0] - b.originalValue[0]) * a)).toColorPart() + (Math.round(b.originalValue[1] + (b.targetValue[1] - b.originalValue[1]) * a)).toColorPart() + (Math.round(b.originalValue[2] + (b.targetValue[2] - b.originalValue[2]) * a)).toColorPart() : (b.originalValue + (b.targetValue - b.originalValue) * a).toFixed(3) + (b.unit === null ? "" : b.unit)
        }
        this.element.setStyle(d, true)
    }
});
Effect.Transform = Class.create({
    initialize: function (a) {
        this.tracks = [];
        this.options = arguments[1] || {};
        this.addTracks(a)
    },
    addTracks: function (a) {
        a.each(function (b) {
            b = $H(b);
            var c = b.values().first();
            this.tracks.push($H({
                ids: b.keys().first(),
                effect: Effect.Morph,
                options: {
                    style: c
                }
            }))
        }.bind(this));
        return this
    },
    play: function () {
        return new Effect.Parallel(this.tracks.map(function (a) {
            var d = a.get("ids"),
                c = a.get("effect"),
                b = a.get("options");
            var e = [$(d) || $$(d)].flatten();
            return e.map(function (f) {
                return new c(f, Object.extend({
                    sync: true
                }, b))
            })
        }).flatten(), this.options)
    }
});
Element.CSS_PROPERTIES = $w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");
Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
String.__parseStyleElement = document.createElement("div");
String.prototype.parseStyle = function () {
    var b, a = $H();
    if (Prototype.Browser.WebKit) {
        b = new Element("div", {
            style: this
        }).style
    } else {
        String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
        b = String.__parseStyleElement.childNodes[0].style
    }
    Element.CSS_PROPERTIES.each(function (c) {
        if (b[c]) {
            a.set(c, b[c])
        }
    });
    if (Prototype.Browser.IE && this.include("opacity")) {
        a.set("opacity", this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])
    }
    return a
};
if (document.defaultView && document.defaultView.getComputedStyle) {
    Element.getStyles = function (b) {
        var a = document.defaultView.getComputedStyle($(b), null);
        return Element.CSS_PROPERTIES.inject({}, function (c, d) {
            c[d] = a[d];
            return c
        })
    }
} else {
    Element.getStyles = function (b) {
        b = $(b);
        var a = b.currentStyle,
            c;
        c = Element.CSS_PROPERTIES.inject({}, function (d, e) {
            d[e] = a[e];
            return d
        });
        if (!c.opacity) {
            c.opacity = b.getOpacity()
        }
        return c
    }
}
Effect.Methods = {
    morph: function (a, b) {
        a = $(a);
        new Effect.Morph(a, Object.extend({
            style: b
        }, arguments[2] || {}));
        return a
    },
    visualEffect: function (c, e, b) {
        c = $(c);
        var d = e.dasherize().camelize(),
            a = d.charAt(0).toUpperCase() + d.substring(1);
        new Effect[a](c, b);
        return c
    },
    highlight: function (b, a) {
        b = $(b);
        new Effect.Highlight(b, a);
        return b
    }
};
$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function (a) {
    Effect.Methods[a] = function (c, b) {
        c = $(c);
        Effect[a.charAt(0).toUpperCase() + a.substring(1)](c, b);
        return c
    }
});
$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function (a) {
    Effect.Methods[a] = Element[a]
});
Element.addMethods(Effect.Methods);
if (typeof Effect == "undefined") {
    throw ("controls.js requires including script.aculo.us' effects.js library")
}
var Autocompleter = {};
Autocompleter.Base = Class.create({
    baseInitialize: function (b, c, a) {
        b = $(b);
        this.element = b;
        this.update = $(c);
        this.hasFocus = false;
        this.changed = false;
        this.active = false;
        this.index = 0;
        this.entryCount = 0;
        this.oldElementValue = this.element.value;
        if (this.setOptions) {
            this.setOptions(a)
        } else {
            this.options = a || {}
        }
        this.options.paramName = this.options.paramName || this.element.name;
        this.options.tokens = this.options.tokens || [];
        this.options.frequency = this.options.frequency || 0.4;
        this.options.minChars = this.options.minChars || 1;
        this.options.onShow = this.options.onShow ||
        function (d, e) {
            if (!e.style.position || e.style.position == "absolute") {
                e.style.position = "absolute";
                Position.clone(d, e, {
                    setHeight: false,
                    offsetTop: d.offsetHeight
                })
            }
            Effect.Appear(e, {
                duration: 0.15
            })
        };
        this.options.onHide = this.options.onHide ||
        function (d, e) {
            new Effect.Fade(e, {
                duration: 0.15
            })
        };
        if (typeof(this.options.tokens) == "string") {
            this.options.tokens = new Array(this.options.tokens)
        }
        if (!this.options.tokens.include("\n")) {
            this.options.tokens.push("\n")
        }
        this.observer = null;
        this.element.setAttribute("autocomplete", "off");
        Element.hide(this.update);
        Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this));
        Event.observe(this.element, "keydown", this.onKeyPress.bindAsEventListener(this))
    },
    show: function () {
        if (Element.getStyle(this.update, "display") == "none") {
            this.options.onShow(this.element, this.update)
        }
        if (!this.iefix && (Prototype.Browser.IE) && (Element.getStyle(this.update, "position") == "absolute")) {
            new Insertion.After(this.update, '<iframe id="' + this.update.id + '_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
            this.iefix = $(this.update.id + "_iefix")
        }
        if (this.iefix) {
            setTimeout(this.fixIEOverlapping.bind(this), 50)
        }
    },
    fixIEOverlapping: function () {
        Position.clone(this.update, this.iefix, {
            setTop: (!this.update.style.height)
        });
        this.iefix.style.zIndex = 1;
        this.update.style.zIndex = 2;
        Element.show(this.iefix)
    },
    hide: function () {
        this.stopIndicator();
        if (Element.getStyle(this.update, "display") != "none") {
            this.options.onHide(this.element, this.update)
        }
        if (this.iefix) {
            Element.hide(this.iefix)
        }
    },
    startIndicator: function () {
        if (this.options.indicator) {
            Element.show(this.options.indicator)
        }
    },
    stopIndicator: function () {
        if (this.options.indicator) {
            Element.hide(this.options.indicator)
        }
    },
    onKeyPress: function (a) {
        if (this.active) {
            switch (a.keyCode) {
            case Event.KEY_TAB:
            case Event.KEY_RETURN:
                this.selectEntry();
                Event.stop(a);
            case Event.KEY_ESC:
                this.hide();
                this.active = false;
                Event.stop(a);
                return;
            case Event.KEY_LEFT:
            case Event.KEY_RIGHT:
                return;
            case Event.KEY_UP:
                this.markPrevious();
                this.render();
                Event.stop(a);
                return;
            case Event.KEY_DOWN:
                this.markNext();
                this.render();
                Event.stop(a);
                return
            }
        } else {
            if (a.keyCode == Event.KEY_TAB || a.keyCode == Event.KEY_RETURN || (Prototype.Browser.WebKit > 0 && a.keyCode == 0)) {
                return
            }
        }
        this.changed = true;
        this.hasFocus = true;
        if (this.observer) {
            clearTimeout(this.observer)
        }
        this.observer = setTimeout(this.onObserverEvent.bind(this), this.options.frequency * 1000)
    },
    activate: function () {
        this.changed = false;
        this.hasFocus = true;
        this.getUpdatedChoices()
    },
    onHover: function (b) {
        var a = Event.findElement(b, "LI");
        if (this.index != a.autocompleteIndex) {
            this.index = a.autocompleteIndex;
            this.render()
        }
        Event.stop(b)
    },
    onClick: function (b) {
        var a = Event.findElement(b, "LI");
        this.index = a.autocompleteIndex;
        this.selectEntry();
        this.hide()
    },
    onBlur: function (a) {
        setTimeout(this.hide.bind(this), 250);
        this.hasFocus = false;
        this.active = false
    },
    render: function () {
        if (this.entryCount > 0) {
            for (var a = 0; a < this.entryCount; a++) {
                this.index == a ? Element.addClassName(this.getEntry(a), "selected") : Element.removeClassName(this.getEntry(a), "selected")
            }
            if (this.hasFocus) {
                this.show();
                this.active = true
            }
        } else {
            this.active = false;
            this.hide()
        }
    },
    markPrevious: function () {
        if (this.index > 0) {
            this.index--
        } else {
            this.index = this.entryCount - 1
        }
        this.getEntry(this.index).scrollIntoView(true)
    },
    markNext: function () {
        if (this.index < this.entryCount - 1) {
            this.index++
        } else {
            this.index = 0
        }
        this.getEntry(this.index).scrollIntoView(false)
    },
    getEntry: function (a) {
        return this.update.firstChild.childNodes[a]
    },
    getCurrentEntry: function () {
        return this.getEntry(this.index)
    },
    selectEntry: function () {
        this.active = false;
        this.updateElement(this.getCurrentEntry())
    },
    updateElement: function (f) {
        if (this.options.updateElement) {
            this.options.updateElement(f);
            return
        }
        var d = "";
        if (this.options.select) {
            var a = $(f).select("." + this.options.select) || [];
            if (a.length > 0) {
                d = Element.collectTextNodes(a[0], this.options.select)
            }
        } else {
            d = Element.collectTextNodesIgnoreClass(f, "informal")
        }
        var c = this.getTokenBounds();
        if (c[0] != -1) {
            var e = this.element.value.substr(0, c[0]);
            var b = this.element.value.substr(c[0]).match(/^\s+/);
            if (b) {
                e += b[0]
            }
            this.element.value = e + d + this.element.value.substr(c[1])
        } else {
            this.element.value = d
        }
        this.oldElementValue = this.element.value;
        this.element.focus();
        if (this.options.afterUpdateElement) {
            this.options.afterUpdateElement(this.element, f)
        }
    },
    updateChoices: function (c) {
        if (!this.changed && this.hasFocus) {
            this.update.innerHTML = c;
            Element.cleanWhitespace(this.update);
            Element.cleanWhitespace(this.update.down());
            if (this.update.firstChild && this.update.down().childNodes) {
                this.entryCount = this.update.down().childNodes.length;
                for (var a = 0; a < this.entryCount; a++) {
                    var b = this.getEntry(a);
                    b.autocompleteIndex = a;
                    this.addObservers(b)
                }
            } else {
                this.entryCount = 0
            }
            this.stopIndicator();
            this.index = 0;
            if (this.entryCount == 1 && this.options.autoSelect) {
                this.selectEntry();
                this.hide()
            } else {
                this.render()
            }
        }
    },
    addObservers: function (a) {
        Event.observe(a, "mouseover", this.onHover.bindAsEventListener(this));
        Event.observe(a, "click", this.onClick.bindAsEventListener(this))
    },
    onObserverEvent: function () {
        this.changed = false;
        this.tokenBounds = null;
        if (this.getToken().length >= this.options.minChars) {
            this.getUpdatedChoices()
        } else {
            this.active = false;
            this.hide()
        }
        this.oldElementValue = this.element.value
    },
    getToken: function () {
        var a = this.getTokenBounds();
        return this.element.value.substring(a[0], a[1]).strip()
    },
    getTokenBounds: function () {
        if (null != this.tokenBounds) {
            return this.tokenBounds
        }
        var e = this.element.value;
        if (e.strip().empty()) {
            return [-1, 0]
        }
        var f = arguments.callee.getFirstDifferencePos(e, this.oldElementValue);
        var j = (f == this.oldElementValue.length ? 1 : 0);
        var d = -1,
            c = e.length;
        var g;
        for (var b = 0, a = this.options.tokens.length; b < a; ++b) {
            g = e.lastIndexOf(this.options.tokens[b], f + j - 1);
            if (g > d) {
                d = g
            }
            g = e.indexOf(this.options.tokens[b], f + j);
            if (-1 != g && g < c) {
                c = g
            }
        }
        return (this.tokenBounds = [d + 1, c])
    }
});
Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function (c, a) {
    var d = Math.min(c.length, a.length);
    for (var b = 0; b < d; ++b) {
        if (c[b] != a[b]) {
            return b
        }
    }
    return d
};
Ajax.Autocompleter = Class.create(Autocompleter.Base, {
    initialize: function (c, d, b, a) {
        this.baseInitialize(c, d, a);
        this.options.asynchronous = true;
        this.options.onComplete = this.onComplete.bind(this);
        this.options.defaultParams = this.options.parameters || null;
        this.url = b
    },
    getUpdatedChoices: function () {
        this.startIndicator();
        var a = encodeURIComponent(this.options.paramName) + "=" + encodeURIComponent(this.getToken());
        this.options.parameters = this.options.callback ? this.options.callback(this.element, a) : a;
        if (this.options.defaultParams) {
            this.options.parameters += "&" + this.options.defaultParams
        }
        new Ajax.Request(this.url, this.options)
    },
    onComplete: function (a) {
        this.updateChoices(a.responseText)
    }
});
Autocompleter.Local = Class.create(Autocompleter.Base, {
    initialize: function (b, d, c, a) {
        this.baseInitialize(b, d, a);
        this.options.array = c
    },
    getUpdatedChoices: function () {
        this.updateChoices(this.options.selector(this))
    },
    setOptions: function (a) {
        this.options = Object.extend({
            choices: 10,
            partialSearch: true,
            partialChars: 2,
            ignoreCase: true,
            fullSearch: false,
            selector: function (b) {
                var d = [];
                var c = [];
                var j = b.getToken();
                var g = 0;
                for (var e = 0; e < b.options.array.length && d.length < b.options.choices; e++) {
                    var f = b.options.array[e];
                    var k = b.options.ignoreCase ? f.toLowerCase().indexOf(j.toLowerCase()) : f.indexOf(j);
                    while (k != -1) {
                        if (k == 0 && f.length != j.length) {
                            d.push("<li><strong>" + f.substr(0, j.length) + "</strong>" + f.substr(j.length) + "</li>");
                            break
                        } else {
                            if (j.length >= b.options.partialChars && b.options.partialSearch && k != -1) {
                                if (b.options.fullSearch || /\s/.test(f.substr(k - 1, 1))) {
                                    c.push("<li>" + f.substr(0, k) + "<strong>" + f.substr(k, j.length) + "</strong>" + f.substr(k + j.length) + "</li>");
                                    break
                                }
                            }
                        }
                        k = b.options.ignoreCase ? f.toLowerCase().indexOf(j.toLowerCase(), k + 1) : f.indexOf(j, k + 1)
                    }
                }
                if (c.length) {
                    d = d.concat(c.slice(0, b.options.choices - d.length))
                }
                return "<ul>" + d.join("") + "</ul>"
            }
        }, a || {})
    }
});
Field.scrollFreeActivate = function (a) {
    setTimeout(function () {
        Field.activate(a)
    }, 1)
};
Ajax.InPlaceEditor = Class.create({
    initialize: function (c, b, a) {
        this.url = b;
        this.element = c = $(c);
        this.prepareOptions();
        this._controls = {};
        arguments.callee.dealWithDeprecatedOptions(a);
        Object.extend(this.options, a || {});
        if (!this.options.formId && this.element.id) {
            this.options.formId = this.element.id + "-inplaceeditor";
            if ($(this.options.formId)) {
                this.options.formId = ""
            }
        }
        if (this.options.externalControl) {
            this.options.externalControl = $(this.options.externalControl)
        }
        if (!this.options.externalControl) {
            this.options.externalControlOnly = false
        }
        this._originalBackground = this.element.getStyle("background-color") || "transparent";
        this.element.title = this.options.clickToEditText;
        this._boundCancelHandler = this.handleFormCancellation.bind(this);
        this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this);
        this._boundFailureHandler = this.handleAJAXFailure.bind(this);
        this._boundSubmitHandler = this.handleFormSubmission.bind(this);
        this._boundWrapperHandler = this.wrapUp.bind(this);
        this.registerListeners()
    },
    checkForEscapeOrReturn: function (a) {
        if (!this._editing || a.ctrlKey || a.altKey || a.shiftKey) {
            return
        }
        if (Event.KEY_ESC == a.keyCode) {
            this.handleFormCancellation(a)
        } else {
            if (Event.KEY_RETURN == a.keyCode) {
                this.handleFormSubmission(a)
            }
        }
    },
    createControl: function (g, c, b) {
        var e = this.options[g + "Control"];
        var f = this.options[g + "Text"];
        if ("button" == e) {
            var a = document.createElement("input");
            a.type = "submit";
            a.value = f;
            a.className = "editor_" + g + "_button";
            if ("cancel" == g) {
                a.onclick = this._boundCancelHandler
            }
            this._form.appendChild(a);
            this._controls[g] = a
        } else {
            if ("link" == e) {
                var d = document.createElement("a");
                d.href = "#";
                d.appendChild(document.createTextNode(f));
                d.onclick = "cancel" == g ? this._boundCancelHandler : this._boundSubmitHandler;
                d.className = "editor_" + g + "_link";
                if (b) {
                    d.className += " " + b
                }
                this._form.appendChild(d);
                this._controls[g] = d
            }
        }
    },
    createEditField: function () {
        var c = (this.options.loadTextURL ? this.options.loadingText : this.getText());
        var b;
        if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) {
            b = document.createElement("input");
            b.type = "text";
            var a = this.options.size || this.options.cols || 0;
            if (0 < a) {
                b.size = a
            }
        } else {
            b = document.createElement("textarea");
            b.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows);
            b.cols = this.options.cols || 40
        }
        b.name = this.options.paramName;
        b.value = c;
        b.className = "editor_field";
        if (this.options.submitOnBlur) {
            b.onblur = this._boundSubmitHandler
        }
        this._controls.editor = b;
        if (this.options.loadTextURL) {
            this.loadExternalText()
        }
        this._form.appendChild(this._controls.editor)
    },
    createForm: function () {
        var b = this;

        function a(d, e) {
            var c = b.options["text" + d + "Controls"];
            if (!c || e === false) {
                return
            }
            b._form.appendChild(document.createTextNode(c))
        }
        this._form = $(document.createElement("form"));
        this._form.id = this.options.formId;
        this._form.addClassName(this.options.formClassName);
        this._form.onsubmit = this._boundSubmitHandler;
        this.createEditField();
        if ("textarea" == this._controls.editor.tagName.toLowerCase()) {
            this._form.appendChild(document.createElement("br"))
        }
        if (this.options.onFormCustomization) {
            this.options.onFormCustomization(this, this._form)
        }
        a("Before", this.options.okControl || this.options.cancelControl);
        this.createControl("ok", this._boundSubmitHandler);
        a("Between", this.options.okControl && this.options.cancelControl);
        this.createControl("cancel", this._boundCancelHandler, "editor_cancel");
        a("After", this.options.okControl || this.options.cancelControl)
    },
    destroy: function () {
        if (this._oldInnerHTML) {
            this.element.innerHTML = this._oldInnerHTML
        }
        this.leaveEditMode();
        this.unregisterListeners()
    },
    enterEditMode: function (a) {
        if (this._saving || this._editing) {
            return
        }
        this._editing = true;
        this.triggerCallback("onEnterEditMode");
        if (this.options.externalControl) {
            this.options.externalControl.hide()
        }
        this.element.hide();
        this.createForm();
        this.element.parentNode.insertBefore(this._form, this.element);
        if (!this.options.loadTextURL) {
            this.postProcessEditField()
        }
        if (a) {
            Event.stop(a)
        }
    },
    enterHover: function (a) {
        if (this.options.hoverClassName) {
            this.element.addClassName(this.options.hoverClassName)
        }
        if (this._saving) {
            return
        }
        this.triggerCallback("onEnterHover")
    },
    getText: function () {
        return this.element.innerHTML.unescapeHTML()
    },
    handleAJAXFailure: function (a) {
        this.triggerCallback("onFailure", a);
        if (this._oldInnerHTML) {
            this.element.innerHTML = this._oldInnerHTML;
            this._oldInnerHTML = null
        }
    },
    handleFormCancellation: function (a) {
        this.wrapUp();
        if (a) {
            Event.stop(a)
        }
    },
    handleFormSubmission: function (d) {
        var b = this._form;
        var c = $F(this._controls.editor);
        this.prepareSubmission();
        var f = this.options.callback(b, c) || "";
        if (Object.isString(f)) {
            f = f.toQueryParams()
        }
        f.editorId = this.element.id;
        if (this.options.htmlResponse) {
            var a = Object.extend({
                evalScripts: true
            }, this.options.ajaxOptions);
            Object.extend(a, {
                parameters: f,
                onComplete: this._boundWrapperHandler,
                onFailure: this._boundFailureHandler
            });
            new Ajax.Updater({
                success: this.element
            }, this.url, a)
        } else {
            var a = Object.extend({
                method: "get"
            }, this.options.ajaxOptions);
            Object.extend(a, {
                parameters: f,
                onComplete: this._boundWrapperHandler,
                onFailure: this._boundFailureHandler
            });
            new Ajax.Request(this.url, a)
        }
        if (d) {
            Event.stop(d)
        }
    },
    leaveEditMode: function () {
        this.element.removeClassName(this.options.savingClassName);
        this.removeForm();
        this.leaveHover();
        this.element.style.backgroundColor = this._originalBackground;
        this.element.show();
        if (this.options.externalControl) {
            this.options.externalControl.show()
        }
        this._saving = false;
        this._editing = false;
        this._oldInnerHTML = null;
        this.triggerCallback("onLeaveEditMode")
    },
    leaveHover: function (a) {
        if (this.options.hoverClassName) {
            this.element.removeClassName(this.options.hoverClassName)
        }
        if (this._saving) {
            return
        }
        this.triggerCallback("onLeaveHover")
    },
    loadExternalText: function () {
        this._form.addClassName(this.options.loadingClassName);
        this._controls.editor.disabled = true;
        var a = Object.extend({
            method: "get"
        }, this.options.ajaxOptions);
        Object.extend(a, {
            parameters: "editorId=" + encodeURIComponent(this.element.id),
            onComplete: Prototype.emptyFunction,
            onSuccess: function (c) {
                this._form.removeClassName(this.options.loadingClassName);
                var b = c.responseText;
                if (this.options.stripLoadedTextTags) {
                    b = b.stripTags()
                }
                this._controls.editor.value = b;
                this._controls.editor.disabled = false;
                this.postProcessEditField()
            }.bind(this),
            onFailure: this._boundFailureHandler
        });
        new Ajax.Request(this.options.loadTextURL, a)
    },
    postProcessEditField: function () {
        var a = this.options.fieldPostCreation;
        if (a) {
            $(this._controls.editor)["focus" == a ? "focus" : "activate"]()
        }
    },
    prepareOptions: function () {
        this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions);
        Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks);
        [this._extraDefaultOptions].flatten().compact().each(function (a) {
            Object.extend(this.options, a)
        }.bind(this))
    },
    prepareSubmission: function () {
        this._saving = true;
        this.removeForm();
        this.leaveHover();
        this.showSaving()
    },
    registerListeners: function () {
        this._listeners = {};
        var a;
        $H(Ajax.InPlaceEditor.Listeners).each(function (b) {
            a = this[b.value].bind(this);
            this._listeners[b.key] = a;
            if (!this.options.externalControlOnly) {
                this.element.observe(b.key, a)
            }
            if (this.options.externalControl) {
                this.options.externalControl.observe(b.key, a)
            }
        }.bind(this))
    },
    removeForm: function () {
        if (!this._form) {
            return
        }
        this._form.remove();
        this._form = null;
        this._controls = {}
    },
    showSaving: function () {
        this._oldInnerHTML = this.element.innerHTML;
        this.element.innerHTML = this.options.savingText;
        this.element.addClassName(this.options.savingClassName);
        this.element.style.backgroundColor = this._originalBackground;
        this.element.show()
    },
    triggerCallback: function (b, a) {
        if ("function" == typeof this.options[b]) {
            this.options[b](this, a)
        }
    },
    unregisterListeners: function () {
        $H(this._listeners).each(function (a) {
            if (!this.options.externalControlOnly) {
                this.element.stopObserving(a.key, a.value)
            }
            if (this.options.externalControl) {
                this.options.externalControl.stopObserving(a.key, a.value)
            }
        }.bind(this))
    },
    wrapUp: function (a) {
        this.leaveEditMode();
        this._boundComplete(a, this.element)
    }
});
Object.extend(Ajax.InPlaceEditor.prototype, {
    dispose: Ajax.InPlaceEditor.prototype.destroy
});
Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
    initialize: function ($super, c, b, a) {
        this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions;
        $super(c, b, a)
    },
    createEditField: function () {
        var a = document.createElement("select");
        a.name = this.options.paramName;
        a.size = 1;
        this._controls.editor = a;
        this._collection = this.options.collection || [];
        if (this.options.loadCollectionURL) {
            this.loadCollection()
        } else {
            this.checkForExternalText()
        }
        this._form.appendChild(this._controls.editor)
    },
    loadCollection: function () {
        this._form.addClassName(this.options.loadingClassName);
        this.showLoadingText(this.options.loadingCollectionText);
        var options = Object.extend({
            method: "get"
        }, this.options.ajaxOptions);
        Object.extend(options, {
            parameters: "editorId=" + encodeURIComponent(this.element.id),
            onComplete: Prototype.emptyFunction,
            onSuccess: function (transport) {
                var js = transport.responseText.strip();
                if (!/^\[.*\]$/.test(js)) {
                    throw ("Server returned an invalid collection representation.")
                }
                this._collection = eval(js);
                this.checkForExternalText()
            }.bind(this),
            onFailure: this.onFailure
        });
        new Ajax.Request(this.options.loadCollectionURL, options)
    },
    showLoadingText: function (b) {
        this._controls.editor.disabled = true;
        var a = this._controls.editor.firstChild;
        if (!a) {
            a = document.createElement("option");
            a.value = "";
            this._controls.editor.appendChild(a);
            a.selected = true
        }
        a.update((b || "").stripScripts().stripTags())
    },
    checkForExternalText: function () {
        this._text = this.getText();
        if (this.options.loadTextURL) {
            this.loadExternalText()
        } else {
            this.buildOptionList()
        }
    },
    loadExternalText: function () {
        this.showLoadingText(this.options.loadingText);
        var a = Object.extend({
            method: "get"
        }, this.options.ajaxOptions);
        Object.extend(a, {
            parameters: "editorId=" + encodeURIComponent(this.element.id),
            onComplete: Prototype.emptyFunction,
            onSuccess: function (b) {
                this._text = b.responseText.strip();
                this.buildOptionList()
            }.bind(this),
            onFailure: this.onFailure
        });
        new Ajax.Request(this.options.loadTextURL, a)
    },
    buildOptionList: function () {
        this._form.removeClassName(this.options.loadingClassName);
        this._collection = this._collection.map(function (d) {
            return 2 === d.length ? d : [d, d].flatten()
        });
        var b = ("value" in this.options) ? this.options.value : this._text;
        var a = this._collection.any(function (d) {
            return d[0] == b
        }.bind(this));
        this._controls.editor.update("");
        var c;
        this._collection.each(function (e, d) {
            c = document.createElement("option");
            c.value = e[0];
            c.selected = a ? e[0] == b : 0 == d;
            c.appendChild(document.createTextNode(e[1]));
            this._controls.editor.appendChild(c)
        }.bind(this));
        this._controls.editor.disabled = false;
        Field.scrollFreeActivate(this._controls.editor)
    }
});
Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function (a) {
    if (!a) {
        return
    }
    function b(c, d) {
        if (c in a || d === undefined) {
            return
        }
        a[c] = d
    }
    b("cancelControl", (a.cancelLink ? "link" : (a.cancelButton ? "button" : a.cancelLink == a.cancelButton == false ? false : undefined)));
    b("okControl", (a.okLink ? "link" : (a.okButton ? "button" : a.okLink == a.okButton == false ? false : undefined)));
    b("highlightColor", a.highlightcolor);
    b("highlightEndColor", a.highlightendcolor)
};
Object.extend(Ajax.InPlaceEditor, {
    DefaultOptions: {
        ajaxOptions: {},
        autoRows: 3,
        cancelControl: "link",
        cancelText: "cancel",
        clickToEditText: "Click to edit",
        externalControl: null,
        externalControlOnly: false,
        fieldPostCreation: "activate",
        formClassName: "inplaceeditor-form",
        formId: null,
        highlightColor: "#ffff99",
        highlightEndColor: "#ffffff",
        hoverClassName: "",
        htmlResponse: true,
        loadingClassName: "inplaceeditor-loading",
        loadingText: "Loading...",
        okControl: "button",
        okText: "ok",
        paramName: "value",
        rows: 1,
        savingClassName: "inplaceeditor-saving",
        savingText: "Saving...",
        size: 0,
        stripLoadedTextTags: false,
        submitOnBlur: false,
        textAfterControls: "",
        textBeforeControls: "",
        textBetweenControls: ""
    },
    DefaultCallbacks: {
        callback: function (a) {
            return Form.serialize(a)
        },
        onComplete: function (b, a) {
            new Effect.Highlight(a, {
                startcolor: this.options.highlightColor,
                keepBackgroundImage: true
            })
        },
        onEnterEditMode: null,
        onEnterHover: function (a) {
            a.element.style.backgroundColor = a.options.highlightColor;
            if (a._effect) {
                a._effect.cancel()
            }
        },
        onFailure: function (b, a) {
            alert("Error communication with the server: " + b.responseText.stripTags())
        },
        onFormCustomization: null,
        onLeaveEditMode: null,
        onLeaveHover: function (a) {
            a._effect = new Effect.Highlight(a.element, {
                startcolor: a.options.highlightColor,
                endcolor: a.options.highlightEndColor,
                restorecolor: a._originalBackground,
                keepBackgroundImage: true
            })
        }
    },
    Listeners: {
        click: "enterEditMode",
        keydown: "checkForEscapeOrReturn",
        mouseover: "enterHover",
        mouseout: "leaveHover"
    }
});
Ajax.InPlaceCollectionEditor.DefaultOptions = {
    loadingCollectionText: "Loading options..."
};
Form.Element.DelayedObserver = Class.create({
    initialize: function (b, a, c) {
        this.delay = a || 0.5;
        this.element = $(b);
        this.callback = c;
        this.timer = null;
        this.lastValue = $F(this.element);
        Event.observe(this.element, "keyup", this.delayedListener.bindAsEventListener(this))
    },
    delayedListener: function (a) {
        if (this.lastValue == $F(this.element)) {
            return
        }
        if (this.timer) {
            clearTimeout(this.timer)
        }
        this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
        this.lastValue = $F(this.element)
    },
    onTimerEvent: function () {
        this.timer = null;
        this.callback(this.element, $F(this.element))
    }
});
if (!Control) {
    var Control = {}
}
Control.Slider = Class.create({
    initialize: function (d, a, b) {
        var c = this;
        if (Object.isArray(d)) {
            this.handles = d.collect(function (f) {
                return $(f)
            })
        } else {
            this.handles = [$(d)]
        }
        this.track = $(a);
        this.options = b || {};
        this.axis = this.options.axis || "horizontal";
        this.increment = this.options.increment || 1;
        this.step = parseInt(this.options.step || "1");
        this.range = this.options.range || $R(0, 1);
        this.value = 0;
        this.values = this.handles.map(function () {
            return 0
        });
        this.spans = this.options.spans ? this.options.spans.map(function (e) {
            return $(e)
        }) : false;
        this.options.startSpan = $(this.options.startSpan || null);
        this.options.endSpan = $(this.options.endSpan || null);
        this.restricted = this.options.restricted || false;
        this.maximum = this.options.maximum || this.range.end;
        this.minimum = this.options.minimum || this.range.start;
        this.alignX = parseInt(this.options.alignX || "0");
        this.alignY = parseInt(this.options.alignY || "0");
        this.trackLength = this.maximumOffset() - this.minimumOffset();
        this.handleLength = this.isVertical() ? (this.handles[0].offsetHeight != 0 ? this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/, "")) : (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : this.handles[0].style.width.replace(/px$/, ""));
        this.active = false;
        this.dragging = false;
        this.disabled = false;
        if (this.options.disabled) {
            this.setDisabled()
        }
        this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
        if (this.allowedValues) {
            this.minimum = this.allowedValues.min();
            this.maximum = this.allowedValues.max()
        }
        this.eventMouseDown = this.startDrag.bindAsEventListener(this);
        this.eventMouseUp = this.endDrag.bindAsEventListener(this);
        this.eventMouseMove = this.update.bindAsEventListener(this);
        this.handles.each(function (f, e) {
            e = c.handles.length - 1 - e;
            c.setValue(parseFloat((Object.isArray(c.options.sliderValue) ? c.options.sliderValue[e] : c.options.sliderValue) || c.range.start), e);
            f.makePositioned().observe("mousedown", c.eventMouseDown)
        });
        this.track.observe("mousedown", this.eventMouseDown);
        document.observe("mouseup", this.eventMouseUp);
        document.observe("mousemove", this.eventMouseMove);
        this.initialized = true
    },
    dispose: function () {
        var a = this;
        Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
        Event.stopObserving(document, "mouseup", this.eventMouseUp);
        Event.stopObserving(document, "mousemove", this.eventMouseMove);
        this.handles.each(function (b) {
            Event.stopObserving(b, "mousedown", a.eventMouseDown)
        })
    },
    setDisabled: function () {
        this.disabled = true
    },
    setEnabled: function () {
        this.disabled = false
    },
    getNearestValue: function (a) {
        if (this.allowedValues) {
            if (a >= this.allowedValues.max()) {
                return (this.allowedValues.max())
            }
            if (a <= this.allowedValues.min()) {
                return (this.allowedValues.min())
            }
            var c = Math.abs(this.allowedValues[0] - a);
            var b = this.allowedValues[0];
            this.allowedValues.each(function (d) {
                var e = Math.abs(d - a);
                if (e <= c) {
                    b = d;
                    c = e
                }
            });
            return b
        }
        if (a > this.range.end) {
            return this.range.end
        }
        if (a < this.range.start) {
            return this.range.start
        }
        return a
    },
    setValue: function (b, a) {
        if (!this.active) {
            this.activeHandleIdx = a || 0;
            this.activeHandle = this.handles[this.activeHandleIdx];
            this.updateStyles()
        }
        a = a || this.activeHandleIdx || 0;
        if (this.initialized && this.restricted) {
            if ((a > 0) && (b < this.values[a - 1])) {
                b = this.values[a - 1]
            }
            if ((a < (this.handles.length - 1)) && (b > this.values[a + 1])) {
                b = this.values[a + 1]
            }
        }
        b = this.getNearestValue(b);
        this.values[a] = b;
        this.value = this.values[0];
        this.handles[a].style[this.isVertical() ? "top" : "left"] = this.translateToPx(b);
        this.drawSpans();
        if (!this.dragging || !this.event) {
            this.updateFinished()
        }
    },
    setValueBy: function (b, a) {
        this.setValue(this.values[a || this.activeHandleIdx || 0] + b, a || this.activeHandleIdx || 0)
    },
    translateToPx: function (a) {
        return Math.round(((this.trackLength - this.handleLength) / (this.range.end - this.range.start)) * (a - this.range.start)) + "px"
    },
    translateToValue: function (a) {
        return ((a / (this.trackLength - this.handleLength) * (this.range.end - this.range.start)) + this.range.start)
    },
    getRange: function (b) {
        var a = this.values.sortBy(Prototype.K);
        b = b || 0;
        return $R(a[b], a[b + 1])
    },
    minimumOffset: function () {
        return (this.isVertical() ? this.alignY : this.alignX)
    },
    maximumOffset: function () {
        return (this.isVertical() ? (this.track.offsetHeight != 0 ? this.track.offsetHeight : this.track.style.height.replace(/px$/, "")) - this.alignY : (this.track.offsetWidth != 0 ? this.track.offsetWidth : this.track.style.width.replace(/px$/, "")) - this.alignX)
    },
    isVertical: function () {
        return (this.axis == "vertical")
    },
    drawSpans: function () {
        var a = this;
        if (this.spans) {
            $R(0, this.spans.length - 1).each(function (b) {
                a.setSpan(a.spans[b], a.getRange(b))
            })
        }
        if (this.options.startSpan) {
            this.setSpan(this.options.startSpan, $R(0, this.values.length > 1 ? this.getRange(0).min() : this.value))
        }
        if (this.options.endSpan) {
            this.setSpan(this.options.endSpan, $R(this.values.length > 1 ? this.getRange(this.spans.length - 1).max() : this.value, this.maximum))
        }
    },
    setSpan: function (b, a) {
        if (this.isVertical()) {
            b.style.top = this.translateToPx(a.start);
            b.style.height = this.translateToPx(a.end - a.start + this.range.start)
        } else {
            b.style.left = this.translateToPx(a.start);
            b.style.width = this.translateToPx(a.end - a.start + this.range.start)
        }
    },
    updateStyles: function () {
        this.handles.each(function (a) {
            Element.removeClassName(a, "selected")
        });
        Element.addClassName(this.activeHandle, "selected")
    },
    startDrag: function (c) {
        if (Event.isLeftClick(c)) {
            if (!this.disabled) {
                this.active = true;
                var d = Event.element(c);
                var e = [Event.pointerX(c), Event.pointerY(c)];
                var a = d;
                if (a == this.track) {
                    var b = Position.cumulativeOffset(this.track);
                    this.event = c;
                    this.setValue(this.translateToValue((this.isVertical() ? e[1] - b[1] : e[0] - b[0]) - (this.handleLength / 2)));
                    var b = Position.cumulativeOffset(this.activeHandle);
                    this.offsetX = (e[0] - b[0]);
                    this.offsetY = (e[1] - b[1])
                } else {
                    while ((this.handles.indexOf(d) == -1) && d.parentNode) {
                        d = d.parentNode
                    }
                    if (this.handles.indexOf(d) != -1) {
                        this.activeHandle = d;
                        this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
                        this.updateStyles();
                        var b = Position.cumulativeOffset(this.activeHandle);
                        this.offsetX = (e[0] - b[0]);
                        this.offsetY = (e[1] - b[1])
                    }
                }
            }
            Event.stop(c)
        }
    },
    update: function (a) {
        if (this.active) {
            if (!this.dragging) {
                this.dragging = true
            }
            this.draw(a);
            if (Prototype.Browser.WebKit) {
                window.scrollBy(0, 0)
            }
            Event.stop(a)
        }
    },
    draw: function (b) {
        var c = [Event.pointerX(b), Event.pointerY(b)];
        var a = Position.cumulativeOffset(this.track);
        c[0] -= this.offsetX + a[0];
        c[1] -= this.offsetY + a[1];
        this.event = b;
        this.setValue(this.translateToValue(this.isVertical() ? c[1] : c[0]));
        if (this.initialized && this.options.onSlide) {
            this.options.onSlide(this.values.length > 1 ? this.values : this.value, this)
        }
    },
    endDrag: function (a) {
        if (this.active && this.dragging) {
            this.finishDrag(a, true);
            Event.stop(a)
        }
        this.active = false;
        this.dragging = false
    },
    finishDrag: function (a, b) {
        this.active = false;
        this.dragging = false;
        this.updateFinished()
    },
    updateFinished: function () {
        if (this.initialized && this.options.onChange) {
            this.options.onChange(this.values.length > 1 ? this.values : this.value, this)
        }
        this.event = null
    }
});

function setNameInitialValue(initial) {
$("newSearch_advanced_nameInitial").value = initial;
$("newSearch_filterStatus_advanced_nameInitial").checked = true;
cliquearBoton();
}
function toggleAvailabilityHotelSearch(b, a) {
    if (document.getElementById(b).style.display == "block") {
        document.getElementById(b).style.display = "none";
        document.getElementById(a).style.display = "block"
    }
    return false
}
function showStreetViewComponent(a) {
    if (document.getElementById(a).style.display == "none") {
        document.getElementById(a).style.display = "block"
    }
}
function toggleLocationCategory(a, b) {
    if (document.getElementById(b).style.display == "block") {
        document.getElementById(b).style.display = "none";
        a.style.listStyleImage = "url(/images/common/ico_mas.gif)"
    } else {
        document.getElementById(b).style.display = "block";
        a.style.listStyleImage = "url(/images/common/ico_menos.gif)"
    }
    return false
}
function toggleSectionById(a, b) {
    if (document.getElementById(b).style.display == "none") {
        a.style.background = "transparent url(/images/common/ico-arrow-180.gif) no-repeat scroll left center"
    } else {
        a.style.background = "transparent url(/images/common/ico-arrow.gif) no-repeat scroll left center"
    }
    Effect.toggle(b, "blind");
    return false
}
function toggleCitiesInStateSearchAlsoView(b, a) {
    if (document.getElementById(b).style.display == "block") {
        document.getElementById(b).style.display = "none";
        document.getElementById(a).style.display = "block"
    }
    return false
}
function DesplegarCategoria(a) {
    if (document.getElementById("cat_" + a).style.display == "block") {
        document.getElementById("cat_" + a).style.display = "none"
    } else {
        document.getElementById("cat_" + a).style.display = "block"
    }
}
function nextSection(next) {
    var letters = $("reservation[card_number][section" + eval(next - 1) + "]").value.length;
    if (letters == 4) {
        $("reservation[card_number][section" + next + "]").focus()
    }
}
function nextCardField(a) {
    var b = $("reservation[card_number][section" + a + "]").value.length;
    if (b == 4) {
        $("reservation_card_owner").focus()
    }
}
function appendLightboxLoadingText() {}
function removeLightboxLoadingText() {}
function beforeAjaxSearch(a) {
    appendLightboxLoadingText();
    window.location.hash = a
}
function afterAjaxSearch() {
    removeLightboxLoadingText();
    $$("select", "object", "embed").each(function (a) {
        a.style.visibility = "visible"
    });
    $("lightbox").hide();
    $("overlay").hide()
    window.location.href="#centercol";
}
function beforeFilterSearch() {
    appendLightboxLoadingText()
}
function afterFilterSearch() {
    removeLightboxLoadingText();
    $$("select", "object", "embed").each(function (a) {
        a.style.visibility = "visible"
    });
    $("lightbox").hide();
    $("overlay").hide();
    $("indicador_carga").style.visibility = "hidden"
}
function afterFilterRemove(b, a) {
    removeLightboxLoadingText();
    $$("select", "object", "embed").each(function (c) {
        c.style.visibility = "visible"
    });
    updateSearchFilters(b, a);
    $("lightbox").hide();
    $("overlay").hide();
    $("indicador_carga").style.visibility = "hidden"
}
function updateSearchFilters(d, c) {
    if ($("newSearch_advanced_" + c) != null) {
        $("newSearch_advanced_" + c).value = "";
        $("newSearch_advanced_" + c).selectedIndex = "-1"
    }
    var e = document.getElementsByName(d + "[advanced][" + c + "][]");
    var a = e.length;
    var b;
    for (b = 0; b < a; b++) {
        e[b].checked = false
    }
    $("newSearch_filterStatus_advanced_" + c).checked = false;
    $("indicador_carga").style.visibility = "hidden"
}
function afterFilterPriceRemove(b, a) {
    removeLightboxLoadingText();
    $$("select", "object", "embed").each(function (c) {
        c.style.visibility = "visible"
    });
    $("newSearch_availability_" + a).value = "";
    $("newSearch_availability_" + a).selectedIndex = "-1";
    $("newSearch_filterStatus_availability_" + a).checked = false;
    $("lightbox").hide();
    $("overlay").hide();
    $("indicador_carga").style.visibility = "hidden"
}
function beforeFilterPriceSearch() {
    $("overlay").show();
    $("lightbox").show()
}
function showAvailabilityMoreRooms(b, c, a) {
    b.parentNode.style.display = "none";
    $(c).style.display = "block";
    $(a).style.display = "none";
    return false
}
function updateCurrencies() {
    var a = 1;

    if ($("current_page")) {
        a = $("current_page").value
    }
    if ($("updating_prices_message")) {
        $("updating_prices_message").show()
    }
    if ($("selected_currency_id")) {
        var b = $("selected_currency_id").value;

        var c = new Ajax.Updater("advanced_search_hotel_result", "search/doAdvancedSearch/formName/newSearch/divId/advanced_search_hotel_result/selected_currency_id/" + b + "/page/" + a, {
            asynchronous: true,
            evalScripts: true,
            method: "GET",
            onComplete: function (e, d) {
                $("updating_prices_message").hide()
            }
        })
    }
    return false
}

function updateSort() {

    var a = 1;

    if ($("current_page")) {
        a = $("current_page").value
    }
    if ($("updating_prices_message")) {
        $("updating_prices_message").show()
    }
    if ($("selected_orden_id")) {
        var b = $("selected_orden_id").value;

        var c = new Ajax.Updater("advanced_search_hotel_result", "search/doAdvancedSearch/formName/newSearch/divId/advanced_search_hotel_result/sort/" +b+ "/reutilizarFiltros/1/", {
            asynchronous: true,
            evalScripts: true,
            method: "POST",
            onComplete: function (e, d) {
                $("updating_prices_message").hide()
            }
        })
    }
    return false
}

function daysOfMonth(anho,mes){
 var dias_febrero;
 var dias_febrero

 if ((((anho%4)==0) && ((anho%100)!=0)) && ((anho%400)==0)) {
        dias_febrero = 29;
    }  else {
        dias_febrero = 28;
    }

    switch(mes) {
       case 1: return 31; break;
       case 2: return dias_febrero; break;
       case 3: return 31; break;
       case 4: return 30; break;
       case 5: return 31; break;
       case 6: return 30; break;
       case 7: return 31; break;
       case 8: return 31; break;
       case 9: return 30; break;
       case 10: return 31; break;
       case 11: return 30; break;
       case 12: return 31; break;
       default: alert('Mes no encontrado');
    }
}

function monthsOfYear(){
  var months = new Array(
    	'enero',
    	'febrero',
    	'marzo',
    	'abril',
    	'mayo',
    	'junio',
    	'julio',
    	'agosto',
    	'septiembre',
    	'octubre',
    	'noviembre',
    	'diciembre'
  );
  return months;
}

function daysOfWeek(lang){

	var dias;

	switch(lang){

		case 'es':
			dias = new Array(
					'Dom',
					'Lun',
					'Mar',
					'Mié',
					'Jue',
					'Vie',
					'Sáb'
			);
			break;

		case 'en':
			dias = new Array(
					'Sun',
					'Mon',
					'Tue',
					'Wed',
					'Thu',
					'Fri',
					'Sat'
			);
			break;

		default:
			dias = new Array(
					'Dom',
					'Lun',
					'Mar',
					'Mié',
					'Jue',
					'Vie',
					'Sáb'
			);
	}

	return dias;
}

function getDaysOfMonthOptions(month,year,lang){

    Days = new Array();
    daysNames = daysOfWeek(lang);
    daysPerMonth = daysOfMonth(year,month);

    day = 0;
    for(day; day < daysPerMonth; day++)
    {
    	date = new Date(year,month-1,day+1);
    	Days[day] = daysNames[date.getDay()]+' '+parseInt(day+1,10);
    }

    return Days;
}

function onMonthChange(selectDayId,selectMonthId, from){

	var day = new Date();
	var selectMonthElement = document.getElementById(selectMonthId);
	var index = selectMonthElement.selectedIndex;
	var selectedMonth = selectMonthElement.options[index].value;
	var fSlashIndex = selectedMonth.indexOf('/');
	var month = parseInt(selectedMonth.substring(fSlashIndex+1),10);
	var year = parseInt(selectedMonth.substring(0,fSlashIndex),10);

	//TODO Nico: HACER ALGO CON EL LANG!
	lang = 'es';

	var selectDayElementValue = document.getElementById(selectDayId).value - 1;
	var selectDayElement = document.getElementById(selectDayId);
	selectDayElement.length=0;
	var DaysOpts = getDaysOfMonthOptions(month,year,lang);
	var i = 0;
	var to = DaysOpts.length;

	if ( from !== undefined ){
		var i;
		if(from == 'last'){
			i = 0;
		}
		else{
			i = parseInt(document.getElementById(from).value);
		}

		to = DaysOpts.length;

		if(i == to){
			i = 0;
			selectDayElementValue = 0;
		}
	}

	var selected = true;
	var j = 0;
	for(i ; i < to; i++){
		if(i == selectDayElementValue){
			selected = true;
		}
		else{
			selected = false;
		}

		selectDayElement.options[j]=new Option(DaysOpts[i], i+1, selected, selected);
		j++;
	}

}

function updateDate(id,idDay,idYearM){

	date = document.getElementById(id).value;
	fidx = date.indexOf('/');
	dayU = parseInt(date.substring(0,fidx),10);
	lidx = date.lastIndexOf('/');
	monthU = parseInt(date.substring(fidx+1,lidx),10);
	yearU = date.substring(lidx+1);
	yearMonth = yearU+'/'+monthU;

	document.getElementById(idYearM).value = yearMonth;
	onMonthChange(idDay,idYearM);
	document.getElementById(idDay).value = dayU;
}

function updateEstancia(formName) {

	if (formName == null) {
	    var formName = 'buscarDisponibilidad';
	}

	var estancia = formName + '_estancia';

	inDateDay        = formName + "_availability_in_date_day",
	inDateYearMonth  = formName + "_availability_in_date_year_month",
	outDateDay       = formName + "_availability_out_date_day",
	outDateYearMonth = formName + "_availability_out_date_year_month"

	daySelectedIdx = $(inDateDay).selectedIndex;
	dayIn = parseInt($(inDateDay).options[daySelectedIdx].value,10);

	YMSelectedIdx = $(inDateYearMonth).selectedIndex;
	YearMonthIn = $(inDateYearMonth).options[YMSelectedIdx].value;

	fSlashIndex = YearMonthIn.indexOf('/');
	monthInWithOutfSlash = parseInt(YearMonthIn.substring(fSlashIndex+1),10);
	yearInWithOutfSlash = parseInt(YearMonthIn.substring(0,fSlashIndex),10);

	daySelectedIdx = $(outDateDay).selectedIndex;
	dayOut = parseInt($(outDateDay).options[daySelectedIdx].value,10);

	YMSelectedIdx = $(outDateYearMonth).selectedIndex;
	YearMonthOut = $(outDateYearMonth).options[YMSelectedIdx].value;

	fSlashIndex = YearMonthOut.indexOf('/');
	monthOutWithOutfSlash = parseInt(YearMonthOut.substring(fSlashIndex+1),10);
	yearOutWithOutfSlash = parseInt(YearMonthOut.substring(0,fSlashIndex),10);

	date1 = new Date(yearInWithOutfSlash,monthInWithOutfSlash-1,dayIn);
	date2 = new Date(yearOutWithOutfSlash,monthOutWithOutfSlash-1,dayOut);

	diff  = new Date();

	var text = "";
	timeDiff = date2.getTime() - date1.getTime();
	if(timeDiff < 0){
		days = 0;
		text += days + " "+nightText+"s";
	}
	else{
		days = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
		text += days + " "+nightText;
		if (days > 1)
			text += "s";
	}

	document.getElementById(estancia).innerHTML = text;

	outDate = formName + "_availability_out";
	$(outDate).value = dayOut +'/'+monthOutWithOutfSlash+'/'+yearOutWithOutfSlash;
}

function updateAvailabilityIn(formName) {

	if (formName == null){
	    formName = 'buscarDisponibilidad';
	}

	inDateDay        = formName + "_availability_in_date_day",
	inDateYearMonth  = formName + "_availability_in_date_year_month",
	outDateDay       = formName + "_availability_out_date_day",
	outDateYearMonth = formName + "_availability_out_date_year_month"

	dayIn = parseInt($(inDateDay).value,10);
	YearMonthIn = $(inDateYearMonth).value;

	fSlashIndex = YearMonthIn.indexOf('/');
	monthWithOutfSlash = parseInt(YearMonthIn.substring(fSlashIndex+1),10);
	yearWithOutfSlash = parseInt(YearMonthIn.substring(0,fSlashIndex),10);

	dateIn = new Date(yearWithOutfSlash,monthWithOutfSlash,dayIn);

	if(((dayIn + 1) > daysOfMonth(yearWithOutfSlash,monthWithOutfSlash)) && (monthWithOutfSlash != 12))	{
		$(outDateYearMonth).value = yearWithOutfSlash+'/'+(monthWithOutfSlash+1);
		//onMonthChange(outDateDay,outDateYearMonth, inDateDay);
		onMonthChange(outDateDay,outDateYearMonth, 'last');
		$(outDateDay).value = 1;

	}
	else if(((dayIn + 1) > daysOfMonth(yearWithOutfSlash,monthWithOutfSlash)) && (monthWithOutfSlash == 12))	{
		$(outDateYearMonth).value = yearWithOutfSlash+1+'/'+1;
		onMonthChange(outDateDay,outDateYearMonth, inDateDay);
		$(outDateDay).value = 1;
	}
	else{
		$(outDateYearMonth).value = yearWithOutfSlash+'/'+monthWithOutfSlash;
		onMonthChange(outDateDay,outDateYearMonth, inDateDay);
		$(outDateDay).value = dayIn+1;
	}

	inDate = formName + "_availability_in";
	$(inDate).value = dayIn +'/'+monthWithOutfSlash+'/'+yearWithOutfSlash;

	updateEstancia(formName);
}

function isValidDate(dateStr) {
  // Que la fecha sea DD/MM/YYYY o DD/MM/YY
  var datePat = /^(\d{1,2})(\/)(\d{1,2})\\2(\d{4})$/;

  // Chequeo formato
  var matchArray = dateStr.match(datePat);
  if (matchArray == null) {
    return false;
  }

  // Parseo
  month = matchArray[3];
  day = matchArray[1];
  year = matchArray[4];

  // Chequeo rangos
  if (month < 1 || month > 12) {
    return false;
  }
  if (day < 1 || day > 31) {
    return false;
  }
  if ((month==4 || month==6 || month==9 || month==11) && day==31) {
    return false;
  }
  if (month == 2) {
    var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
    if (day>29 || (day==29 && !isleap)) {
      return false;
     }
  }
  return true;
}

function parseDate(dateStr) {
  var datePat = /^(\d{1,2})(\/)(\d{1,2})\\2(\d{4})$/;
  var matchArray = dateStr.match(datePat);

  // Tener en cuenta que el mes en JS comienza por 0
  month = matchArray[3];
  month--;

  day = matchArray[1];
  year = matchArray[4];

  return new Date(year, month, day);
}

/*
function daysOfMonth(b, a) {
    var c;
    var c;
    if ((((b % 4) == 0) && ((b % 100) != 0)) && ((b % 400) == 0)) {
        c = 29
    } else {
        c = 28
    }

    switch (a) {
    case 1:
        return 31;
        break;
    case 2:
        return c;
        break;
    case 3:
        return 31;
        break;
    case 4:
        return 30;
        break;
    case 5:
        return 31;
        break;
    case 6:
        return 30;
        break;
    case 7:
        return 31;
        break;
    case 8:
        return 31;
        break;
    case 9:
        return 30;
        break;
    case 10:
        return 31;
        break;
    case 11:
        return 30;
        break;
    case 12:
        return 31;
        break;
    default:
        alert("Mes no encontrado")
    }
}
function monthsOfYear() {
    var a = new Array("enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre");
    return a
}
function daysOfWeek(b) {
    var a;
    switch (b) {
    case "es":
        a = new Array("Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb");
        break;
    case "en":
        a = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
        break;
    default:
        a = new Array("Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb")
    }
    return a
}
function getDaysOfMonthOptions(b, a, c) {
    Days = new Array();
    daysNames = daysOfWeek(c);
    daysPerMonth = daysOfMonth(a, b);
    day = 0;
    alert("dias del mes "+daysPerMonth);
    for (day; day < daysPerMonth; day++) {
        date = new Date(a, b - 1, day + 1);
        Days[day] = daysNames[date.getDay()] + " " + parseInt(day + 1, 10)
    }
    return Days
}
function onMonthChange(m, c) {
    var l = new Date();
    var a = document.getElementById(c);
    var g = a.selectedIndex;
    alert("no se que es: "+a.options[g].value)
    var d = a.options[g].value;
    var b = d.indexOf("/");
    var j = parseInt(d.substring(b + 1), 10);
    var k = parseInt(d.substring(0, b), 10);
    lang = "es";
    alert("el mes es: "+j+" el mes por el !=: "+l.getMonth());

        var o = document.getElementById(m);
        o.length = 0;
        alert("mes: "+j+" año: "+k+" lenguaje: "+lang);
        var n = getDaysOfMonthOptions(j, k, lang);
        alert("dato que devuelve "+n);
        var f = 0;
        var e = true;
        for (f; f < n.length; f++) {
            if (f > 0) {
                e = false
            }
            o.options[f] = new Option(n[f], f + 1, e, false)
        }

}
function updateDate(c, b, a) {
    date = document.getElementById(c).value;
    fidx = date.indexOf("/");
    dayU = parseInt(date.substring(0, fidx), 10);
    lidx = date.lastIndexOf("/");
    monthU = parseInt(date.substring(fidx + 1, lidx), 10);
    yearU = date.substring(lidx + 1);
    yearMonth = yearU + "/" + monthU;
    document.getElementById(a).value = yearMonth;
    onMonthChange(b, a);
    document.getElementById(b).value = dayU
}
function updateEstancia(a) {
    if (a == null) {
        var a = "buscarDisponibilidad"
    }
    var c = a + "_estancia";
    inDateDay = a + "_availability_in_date_day", inDateYearMonth = a + "_availability_in_date_year_month", outDateDay = a + "_availability_out_date_day", outDateYearMonth = a + "_availability_out_date_year_month";
    daySelectedIdx = $(inDateDay).selectedIndex;
    dayIn = parseInt($(inDateDay).options[daySelectedIdx].value, 10);
    YMSelectedIdx = $(inDateYearMonth).selectedIndex;
    YearMonthIn = $(inDateYearMonth).options[YMSelectedIdx].value;
    fSlashIndex = YearMonthIn.indexOf("/");
    monthInWithOutfSlash = parseInt(YearMonthIn.substring(fSlashIndex + 1), 10);
    yearInWithOutfSlash = parseInt(YearMonthIn.substring(0, fSlashIndex), 10);
    daySelectedIdx = $(outDateDay).selectedIndex;
    dayOut = parseInt($(outDateDay).options[daySelectedIdx].value, 10);
    YMSelectedIdx = $(outDateYearMonth).selectedIndex;
    YearMonthOut = $(outDateYearMonth).options[YMSelectedIdx].value;
    fSlashIndex = YearMonthOut.indexOf("/");
    monthOutWithOutfSlash = parseInt(YearMonthOut.substring(fSlashIndex + 1), 10);
    yearOutWithOutfSlash = parseInt(YearMonthOut.substring(0, fSlashIndex), 10);
    date1 = new Date(yearInWithOutfSlash, monthInWithOutfSlash - 1, dayIn);
    date2 = new Date(yearOutWithOutfSlash, monthOutWithOutfSlash - 1, dayOut);
    diff = new Date();
    var b = "";
    timeDiff = date2.getTime() - date1.getTime();
    if (timeDiff < 0) {
        days = 0;
        b += days + " " + nightText + "s"
    } else {
        days = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
        b += days + " " + nightText;
        if (days > 1) {
            b += "s"
        }
    }
    document.getElementById(c).innerHTML = b;
    outDate = a + "_availability_out";
    $(outDate).value = dayOut + "/" + monthOutWithOutfSlash + "/" + yearOutWithOutfSlash
}
function updateAvailabilityIn(a) {

    if (a == null) {
        a = "buscarDisponibilidad"
    }
    inDateDay = a + "_availability_in_date_day", inDateYearMonth = a + "_availability_in_date_year_month", outDateDay = a + "_availability_out_date_day", outDateYearMonth = a + "_availability_out_date_year_month";

    dayIn = parseInt($(inDateDay).value, 10);
    dayIn = "10";
    YearMonthIn = $(inDateYearMonth).value;
    fSlashIndex = YearMonthIn.indexOf("/");
    monthWithOutfSlash = parseInt(YearMonthIn.substring(fSlashIndex + 1), 10);
    yearWithOutfSlash = parseInt(YearMonthIn.substring(0, fSlashIndex), 10);
    dateIn = new Date(yearWithOutfSlash, monthWithOutfSlash, dayIn);
    if (((dayIn + 1) > daysOfMonth(yearWithOutfSlash, monthWithOutfSlash)) && (monthWithOutfSlash != 12)) {
        $(outDateYearMonth).value = yearWithOutfSlash + "/" + (monthWithOutfSlash + 1);
        onMonthChange(outDateDay, outDateYearMonth);
        $(outDateDay).value = 1
    } else {
        if (((dayIn + 1) > daysOfMonth(yearWithOutfSlash, monthWithOutfSlash)) && (monthWithOutfSlash == 12)) {
            $(outDateYearMonth).value = yearWithOutfSlash + 1 + "/" + 1;
            onMonthChange(outDateDay, outDateYearMonth);
            $(outDateDay).value = 1
        } else {
            $(outDateYearMonth).value = yearWithOutfSlash + "/" + monthWithOutfSlash;
            onMonthChange(outDateDay, outDateYearMonth);
            $(outDateDay).value = dayIn + 1
        }
    }
    inDate = a + "_availability_in";
    $(inDate).value = dayIn + "/" + monthWithOutfSlash + "/" + yearWithOutfSlash;
    updateEstancia(a)
}
function isValidDate(a) {
 alert("vemos que pasa por aca!!!");
    var d = /^(\d{1,2})(\/)(\d{1,2})\\2(\d{4})$/;
    var c = a.match(d);
    if (c == null) {
        return false
    }
    month = c[3];
    day = c[1];
    year = c[4];
    if (month < 1 || month > 12) {
        return false
    }
    if (day < 1 || day > 31) {
        return false
    }
    if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) {
        return false
    }
    if (month == 2) {
        var b = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
        if (day > 29 || (day == 29 && !b)) {
            return false
        }
    }
    return true
}
function parseDate(a) {
    var c = /^(\d{1,2})(\/)(\d{1,2})\\2(\d{4})$/;
    var b = a.match(c);
    month = b[3];
    month--;
    day = b[1];
    year = b[4];
    return new Date(year, month, day)
}*/


function showImageInGallery(b) {
    var a = new Slideshow(b - 1);
    a.setPhoto(b - 1);
    soundManager.play("select");
    return false
}
function showMapContinent(a) {
    $("mapamundi").src = "/images/continents/continent_" + a + ".png"
}
function showCountriesInContinent(a) {
    $$(".box_continent_content").each(function (b) {
        b.style.display = "none"
    });
    $("countries_" + a).style.display = "block";
    return false
}
function changeImg(f, e) {
    var c = $(f);
    var b = c.src;
    var d = b.lastIndexOf("-");
    var a = b.substring(0, d);
    if (e == false) {
        a += "-inactivo.gif"
    } else {
        a += "-activo.gif"
    }
    c.src = a
}
function submitPressed(a) {
    a.disabled = true;
    $("button_pressed_indicator").style.display = "block";
    a.form.submit()
}
var Behaviour = {
    list: new Array,
    register: function (a) {
        Behaviour.list.push(a)
    },
    start: function () {
        Behaviour.addLoadEvent(function () {
            Behaviour.apply()
        })
    },
    apply: function () {
        for (h = 0; sheet = Behaviour.list[h]; h++) {
            for (selector in sheet) {
                list = document.getElementsBySelector(selector);
                if (!list) {
                    continue
                }
                for (i = 0; element = list[i]; i++) {
                    sheet[selector](element)
                }
            }
        }
    },
    addLoadEvent: function (a) {
        var b = window.onload;
        if (typeof window.onload != "function") {
            window.onload = a
        } else {
            window.onload = function () {
                b();
                a()
            }
        }
    }
};
Behaviour.start();

function getAllChildren(a) {
    return a.all ? a.all : a.getElementsByTagName("*")
}
document.getElementsBySelector = function (u) {
    if (!document.getElementsByTagName) {
        return new Array()
    }
    var o = u.split(" ");
    var f = new Array(document);
    for (var w = 0; w < o.length; w++) {
        token = o[w].replace(/^\s+/, "").replace(/\s+$/, "");
        if (token.indexOf("#") > -1) {
            var r = token.split("#");
            var d = r[0];
            var q = r[1];
            var b = document.getElementById(q);
            if (d && b.nodeName.toLowerCase() != d) {
                return new Array()
            }
            f = new Array(b);
            continue
        }
        if (token.indexOf(".") > -1) {
            var r = token.split(".");
            var d = r[0];
            var c = r[1];
            if (!d) {
                d = "*"
            }
            var l = new Array;
            var g = 0;
            for (var x = 0; x < f.length; x++) {
                var m;
                if (d == "*") {
                    m = getAllChildren(f[x])
                } else {
                    m = f[x].getElementsByTagName(d)
                }
                for (var t = 0; t < m.length; t++) {
                    l[g++] = m[t]
                }
            }
            f = new Array;
            var p = 0;
            for (var s = 0; s < l.length; s++) {
                if (l[s].className && l[s].className.match(new RegExp("\\b" + c + "\\b"))) {
                    f[p++] = l[s]
                }
            }
            continue
        }
        if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
            var d = RegExp.$1;
            var v = RegExp.$2;
            var a = RegExp.$3;
            var n = RegExp.$4;
            if (!d) {
                d = "*"
            }
            var l = new Array;
            var g = 0;
            for (var x = 0; x < f.length; x++) {
                var m;
                if (d == "*") {
                    m = getAllChildren(f[x])
                } else {
                    m = f[x].getElementsByTagName(d)
                }
                for (var t = 0; t < m.length; t++) {
                    l[g++] = m[t]
                }
            }
            f = new Array;
            var p = 0;
            var e;
            switch (a) {
            case "=":
                e = function (j) {
                    return (j.getAttribute(v) == n)
                };
                break;
            case "~":
                e = function (j) {
                    return (j.getAttribute(v).match(new RegExp("\\b" + n + "\\b")))
                };
                break;
            case "|":
                e = function (j) {
                    return (j.getAttribute(v).match(new RegExp("^" + n + "-?")))
                };
                break;
            case "^":
                e = function (j) {
                    return (j.getAttribute(v).indexOf(n) == 0)
                };
                break;
            case "$":
                e = function (j) {
                    return (j.getAttribute(v).lastIndexOf(n) == j.getAttribute(v).length - n.length)
                };
                break;
            case "*":
                e = function (j) {
                    return (j.getAttribute(v).indexOf(n) > -1)
                };
                break;
            default:
                e = function (j) {
                    return j.getAttribute(v)
                }
            }
            f = new Array;
            var p = 0;
            for (var s = 0; s < l.length; s++) {
                if (e(l[s])) {
                    f[p++] = l[s]
                }
            }
            continue
        }
        if (!f[0]) {
            return
        }
        d = token;
        var l = new Array;
        var g = 0;
        for (var x = 0; x < f.length; x++) {
            var m = f[x].getElementsByTagName(d);
            for (var t = 0; t < m.length; t++) {
                l[g++] = m[t]
            }
        }
        f = l
    }
    return f
};
var thisURL = document.location.href;
var splitURL = thisURL.split("#");
var photoId = splitURL[1] - 1;
var photoId = (!photoId || photoId < 0) ? 0 : photoId;
var borderSize = 0;
Object.extend(Element, {
    getWidth: function (a) {
        a = $(a);
        return a.offsetWidth
    },
    setWidth: function (b, a) {
        b = $(b);
        b.style.width = a + "px"
    },
    setHeight: function (a, b) {
        a = $(a);
        a.style.height = b + "px"
    },
    setSrc: function (a, b) {
        a = $(a);
        a.src = b
    },
    setHref: function (b, a) {
        b = $(b);
        b.href = a
    },
    setInnerHTML: function (a, b) {
        a = $(a);
        a.innerHTML = b
    }
});
var Slideshow = Class.create();
Slideshow.prototype = {
    initialize: function (a) {
        this.photoId = a;
        this.photo = "Photo";
        this.photoBox = "Container";
        this.prevLink = "PrevLink";
        this.nextLink = "NextLink";
        this.captionBox = "CaptionContainer";
        this.caption = "Caption";
        this.counter = "Counter";
        this.loader = "Loading"
    },
    getCurrentSize: function () {
        this.wCur = Element.getWidth(this.photoBox) - borderSize;
        this.hCur = Element.getHeight(this.photoBox) - borderSize
    },
    getNewSize: function () {
        this.wNew = photoArray[photoId][1];
        this.hNew = photoArray[photoId][2]
    },
    getScaleFactor: function () {
        this.getCurrentSize();
        this.getNewSize();
        this.xScale = (this.wNew / this.wCur) * 100;
        this.yScale = (this.hNew / this.hCur) * 100
    },
    setNewPhotoParams: function () {
        Element.setSrc(this.photo, photoDir + photoArray[photoId][0]);
        Element.setHref(this.prevLink, "#" + (photoId + 1));
        Element.setHref(this.nextLink, "#" + (photoId + 1))
    },
    setPhotoCaption: function () {
        Element.setInnerHTML(this.caption, photoArray[photoId][3]);
        Element.setInnerHTML(this.counter, ((photoId + 1) + "/" + photoNum))
    },
    resizePhotoBox: function () {
        this.getScaleFactor();
        new Effect.Scale(this.photoBox, this.yScale, {
            scaleX: false,
            duration: 0.3,
            queue: "front"
        });
        new Effect.Scale(this.photoBox, this.xScale, {
            scaleY: false,
            delay: 0.5,
            duration: 0.3
        });
        Element.setWidth(this.captionBox, this.wNew - (-borderSize))
    },
    showPhoto: function () {
        new Effect.Fade(this.loader, {
            delay: 0.5,
            duration: 0.3
        });
        new Effect.Appear(this.photo, {
            duration: 0.5,
            queue: "end",
            afterFinish: function () {
                Element.show("CaptionContainer");
                Element.show("PrevLink");
                Element.show("NextLink")
            }
        })
    },
    nextPhoto: function () {
        (photoId == (photoArray.length - 1)) ? photoId = 0 : photoId++;
        this.initSwap()
    },
    prevPhoto: function () {
        (photoId == 0) ? photoId = photoArray.length - 1 : photoId--;
        this.initSwap()
    },
    setPhoto: function (a) {
        photoId = a;
        this.initSwap()
    },
    initSwap: function () {
        Element.show(this.loader);
        Element.hide(this.photo);
        Element.hide(this.captionBox);
        Element.hide(this.prevLink);
        Element.hide(this.nextLink);
        this.setNewPhotoParams();
        this.resizePhotoBox();
        this.setPhotoCaption()
    }
};
var myrules = {
    "#Photo": function (a) {
        a.onload = function () {
            var b = new Slideshow(photoId);
            b.showPhoto()
        }
    },
    "#PrevLink": function (a) {
        a.onmouseover = function () {
            soundManager.play("beep")
        };
        a.onclick = function () {
            var b = new Slideshow(photoId);
            b.prevPhoto();
            soundManager.play("select")
        }
    },
    "#NextLink": function (a) {
        a.onmouseover = function () {
            soundManager.play("beep")
        };
        a.onclick = function () {
            var b = new Slideshow(photoId);
            b.nextPhoto();
            soundManager.play("select")
        }
    },
    a: function (a) {
        a.onfocus = function () {
            this.blur()
        }
    }
};
LightboxOptions = Object.extend({
    fileLoadingImage: "/images/lightbox/loading.gif",
    fileBottomNavCloseImage: "/images/lightbox/closelabel.gif",
    overlayOpacity: 0.8,
    animate: true,
    resizeSpeed: 7,
    borderSize: 10,
    labelImage: "Image",
    labelOf: "of"
}, window.LightboxOptions || {});
var Lightbox = Class.create();
Lightbox.prototype = {
    imageArray: [],
    activeImage: undefined,
    initialize: function () {
        this.updateImageList();
        this.keyboardAction = this.keyboardAction.bindAsEventListener(this);
        if (LightboxOptions.resizeSpeed > 10) {
            LightboxOptions.resizeSpeed = 10
        }
        if (LightboxOptions.resizeSpeed < 1) {
            LightboxOptions.resizeSpeed = 1
        }
        this.resizeDuration = LightboxOptions.animate ? ((11 - LightboxOptions.resizeSpeed) * 0.15) : 0;
        this.overlayDuration = LightboxOptions.animate ? 0.2 : 0;
        var b = (LightboxOptions.animate ? 250 : 1) + "px";
        var a = $$("body")[0];
        a.appendChild(Builder.node("div", {
            id: "overlay"
        }));
        a.appendChild(Builder.node("div", {
            id: "lightbox"
        }, [Builder.node("div", {
            id: "outerImageContainer"
        }, Builder.node("div", {
            id: "imageContainer"
        }, [Builder.node("img", {
            id: "lightboxImage"
        }), Builder.node("div", {
            id: "hoverNav"
        }, [Builder.node("a", {
            id: "prevLink",
            href: "#"
        }), Builder.node("a", {
            id: "nextLink",
            href: "#"
        })]), Builder.node("div", {
            id: "loading"
        }, [Builder.node("a", {
            id: "loadingLink",
            href: "#"
        }, Builder.node("img", {
            src: LightboxOptions.fileLoadingImage
        })), Builder.node("p", {
            id: "loadingText"
        }, "Actualizando resultados...")])])), Builder.node("div", {
            id: "imageDataContainer"
        }, Builder.node("div", {
            id: "imageData"
        }, [Builder.node("div", {
            id: "imageDetails"
        }, [Builder.node("span", {
            id: "caption"
        }), Builder.node("span", {
            id: "numberDisplay"
        })]), Builder.node("div", {
            id: "bottomNav"
        }, Builder.node("a", {
            id: "bottomNavClose",
            href: "#"
        }, Builder.node("img", {
            src: LightboxOptions.fileBottomNavCloseImage
        })))]))]));
        $("overlay").hide().observe("click", (function () {
            this.end()
        }).bind(this));
        $("lightbox").hide().observe("click", (function (d) {
            if (d.element().id == "lightbox") {
                this.end()
            }
        }).bind(this));
        $("outerImageContainer").setStyle({
            width: b,
            height: b
        });
        $("prevLink").observe("click", (function (d) {
            d.stop();
            this.changeImage(this.activeImage - 1)
        }).bindAsEventListener(this));
        $("nextLink").observe("click", (function (d) {
            d.stop();
            this.changeImage(this.activeImage + 1)
        }).bindAsEventListener(this));
        $("loadingLink").observe("click", (function (d) {
            d.stop();
            this.end()
        }).bind(this));
        $("bottomNavClose").observe("click", (function (d) {
            d.stop();
            this.end()
        }).bind(this));
        var c = this;
        (function () {
            var d = "overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose";
            $w(d).each(function (e) {
                c[e] = $(e)
            })
        }).defer()
    },
    updateImageList: function () {
        this.updateImageList = Prototype.emptyFunction;
        document.observe("click", (function (a) {
            var b = a.findElement("a[rel^=lightbox]") || a.findElement("area[rel^=lightbox]") || a.findElement("input[rel^=lightbox]");
            if (b) {
                this.start(b)
            }
        }).bind(this))
    },
    start: function (f) {
        $$("select", "object", "embed").each(function (g) {
            g.style.visibility = "hidden"
        });
        var c = this.getPageSize();
        $("overlay").setStyle({
            width: c[0] + "px",
            height: c[1] + "px"
        });
        new Effect.Appear(this.overlay, {
            duration: this.overlayDuration,
            from: 0,
            to: LightboxOptions.overlayOpacity
        });
        this.imageArray = [];
        var b = 0;
        var a = document.viewport.getScrollOffsets();
        var e = a[1] + (document.viewport.getHeight() / 10);
        var d = a[0];
        this.lightbox.setStyle({
            top: e + "px",
            left: d + "px"
        }).show();
        this.changeImage(b)
    },
    changeImage: function (b) {
        this.activeImage = b;
        if (LightboxOptions.animate) {
            this.loading.show()
        }
        this.lightboxImage.hide();
        this.hoverNav.hide();
        this.prevLink.hide();
        this.nextLink.hide();
        this.imageDataContainer.setStyle({
            opacity: 0.0001
        });
        this.numberDisplay.hide();
        var a = new Image()
    },
    resizeImageContainer: function (e, f) {
        var j = this.outerImageContainer.getWidth();
        var c = this.outerImageContainer.getHeight();
        var g = (e + LightboxOptions.borderSize * 2);
        var l = (f + LightboxOptions.borderSize * 2);
        var m = (g / j) * 100;
        var b = (l / c) * 100;
        var k = j - g;
        var a = c - l;
        if (a != 0) {
            new Effect.Scale(this.outerImageContainer, b, {
                scaleX: false,
                duration: this.resizeDuration,
                queue: "front"
            })
        }
        if (k != 0) {
            new Effect.Scale(this.outerImageContainer, m, {
                scaleY: false,
                duration: this.resizeDuration,
                delay: this.resizeDuration
            })
        }
        var d = 0;
        if ((a == 0) && (k == 0)) {
            d = 100;
            if (Prototype.Browser.IE) {
                d = 250
            }
        }(function () {
            this.prevLink.setStyle({
                height: f + "px"
            });
            this.nextLink.setStyle({
                height: f + "px"
            });
            this.imageDataContainer.setStyle({
                width: g + "px"
            });
            this.showImage()
        }).bind(this).delay(d / 1000)
    },
    showImage: function () {
        this.loading.hide();
        new Effect.Appear(this.lightboxImage, {
            duration: this.resizeDuration,
            queue: "end",
            afterFinish: (function () {
                this.updateDetails()
            }).bind(this)
        });
        this.preloadNeighborImages()
    },
    updateDetails: function () {
        if (this.imageArray[this.activeImage][1] != "") {
            this.caption.update(this.imageArray[this.activeImage][1]).show()
        }
        if (this.imageArray.length > 1) {
            this.numberDisplay.update(LightboxOptions.labelImage + " " + (this.activeImage + 1) + " " + LightboxOptions.labelOf + "  " + this.imageArray.length).show()
        }
        new Effect.Parallel([new Effect.SlideDown(this.imageDataContainer, {
            sync: true,
            duration: this.resizeDuration,
            from: 0,
            to: 1
        }), new Effect.Appear(this.imageDataContainer, {
            sync: true,
            duration: this.resizeDuration
        })], {
            duration: this.resizeDuration,
            afterFinish: (function () {
                var a = this.getPageSize();
                this.overlay.setStyle({
                    height: a[1] + "px"
                });
                this.updateNav()
            }).bind(this)
        })
    },
    updateNav: function () {
        this.hoverNav.show();
        if (this.activeImage > 0) {
            this.prevLink.show()
        }
        if (this.activeImage < (this.imageArray.length - 1)) {
            this.nextLink.show()
        }
        this.enableKeyboardNav()
    },
    enableKeyboardNav: function () {
        document.observe("keydown", this.keyboardAction)
    },
    disableKeyboardNav: function () {
        document.stopObserving("keydown", this.keyboardAction)
    },
    keyboardAction: function (d) {
        var a = d.keyCode;
        var b;
        if (d.DOM_VK_ESCAPE) {
            b = d.DOM_VK_ESCAPE
        } else {
            b = 27
        }
        var c = String.fromCharCode(a).toLowerCase();
        if (c.match(/x|o|c/) || (a == b)) {
            this.end()
        } else {
            if ((c == "p") || (a == 37)) {
                if (this.activeImage != 0) {
                    this.disableKeyboardNav();
                    this.changeImage(this.activeImage - 1)
                }
            } else {
                if ((c == "n") || (a == 39)) {
                    if (this.activeImage != (this.imageArray.length - 1)) {
                        this.disableKeyboardNav();
                        this.changeImage(this.activeImage + 1)
                    }
                }
            }
        }
    },
    preloadNeighborImages: function () {
        var a, b;
        if (this.imageArray.length > this.activeImage + 1) {
            a = new Image();
            a.src = this.imageArray[this.activeImage + 1][0]
        }
        if (this.activeImage > 0) {
            b = new Image();
            b.src = this.imageArray[this.activeImage - 1][0]
        }
    },
    end: function () {
        this.disableKeyboardNav();
        this.lightbox.hide();
        new Effect.Fade(this.overlay, {
            duration: this.overlayDuration
        });
        $$("select", "object", "embed").each(function (a) {
            a.style.visibility = "visible"
        })
    },
    getPageSize: function () {
        var c, a;
        if (window.innerHeight && window.scrollMaxY) {
            c = window.innerWidth + window.scrollMaxX;
            a = window.innerHeight + window.scrollMaxY
        } else {
            if (document.body.scrollHeight > document.body.offsetHeight) {
                c = document.body.scrollWidth;
                a = document.body.scrollHeight
            } else {
                c = document.body.offsetWidth;
                a = document.body.offsetHeight
            }
        }
        var b, d;
        if (self.innerHeight) {
            if (document.documentElement.clientWidth) {
                b = document.documentElement.clientWidth
            } else {
                b = self.innerWidth
            }
            d = self.innerHeight
        } else {
            if (document.documentElement && document.documentElement.clientHeight) {
                b = document.documentElement.clientWidth;
                d = document.documentElement.clientHeight
            } else {
                if (document.body) {
                    b = document.body.clientWidth;
                    d = document.body.clientHeight
                }
            }
        }
        if (a < d) {
            pageHeight = d
        } else {
            pageHeight = a
        }
        if (c < b) {
            pageWidth = c
        } else {
            pageWidth = b
        }
        return [pageWidth, pageHeight]
    }
};
document.observe("dom:loaded", function () {
    lightbox = new Lightbox()
});
var isIE = navigator.appName.toLowerCase().indexOf("internet explorer") + 1;
var isMac = navigator.appVersion.toLowerCase().indexOf("mac") + 1;

function SoundManager(container) {
    var self = this;
    this.movies = [];
    this.container = container;
    this.unsupported = 0;
    this.defaultName = "default";
    this.FlashObject = function (url) {
        var me = this;
        this.o = null;
        this.loaded = false;
        this.isLoaded = function () {
            if (me.loaded) {
                return true
            }
            if (!me.o) {
                return false
            }
            me.loaded = ((typeof(me.o.readyState) != "undefined" && me.o.readyState == 4) || (typeof(me.o.PercentLoaded) != "undefined" && me.o.PercentLoaded() == 100));
            return me.loaded
        };
        this.mC = document.createElement("div");
        this.mC.className = "movieContainer";
        with(this.mC.style) {
            position = "absolute";
            left = "-256px";
            width = "64px";
            height = "64px"
        }
        var html = ['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"><param name="movie" value="' + url + '"><param name="quality" value="high"></object>', '<embed src="' + url + '" width="1" height="1" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>'];
        if (navigator.appName.toLowerCase().indexOf("microsoft") + 1) {
            this.mC.innerHTML = html[0];
            this.o = this.mC.getElementsByTagName("object")[0]
        } else {
            this.mC.innerHTML = html[1];
            this.o = this.mC.getElementsByTagName("embed")[0]
        }
        document.getElementsByTagName("div")[0].appendChild(this.mC)
    };
    this.addMovie = function (movieName, url) {
        self.movies[movieName] = new self.FlashObject(url)
    };
    this.checkMovie = function (movieName) {
        movieName = movieName || self.defaultName;
        if (!self.movies[movieName]) {
            self.errorHandler("checkMovie", "Exception: Could not find movie", arguments);
            return false
        } else {
            return (self.movies[movieName].isLoaded()) ? self.movies[movieName] : false
        }
    };
    this.errorHandler = function (methodName, message, oArguments, e) {
        writeDebug('<div class="error">soundManager.' + methodName + "(" + self.getArgs(oArguments) + "): " + message + (e ? " (" + e.name + " - " + (e.message || e.description || "no description") : "") + "." + (e ? ")" : "") + "</div>")
    };
    this.play = function (soundID, loopCount, noDebug, movieName) {
        if (self.unsupported) {
            return false
        }
        movie = self.checkMovie(movieName);
        if (!movie) {
            return false
        }
        if (typeof(movie.o.TCallLabel) != "undefined") {
            try {
                self.setVariable(soundID, "loopCount", loopCount || 1, movie);
                movie.o.TCallLabel("/" + soundID, "start");
                if (!noDebug) {
                    writeDebug("soundManager.play(" + self.getArgs(arguments) + ")")
                }
            } catch (e) {
                self.errorHandler("play", "Failed: Flash unsupported / undefined sound ID (check XML)", arguments, e)
            }
        }
    };
    this.stop = function (soundID, movieName) {
        if (self.unsupported) {
            return false
        }
        movie = self.checkMovie(movieName);
        if (!movie) {
            return false
        }
        try {
            movie.o.TCallLabel("/" + soundID, "stop");
            writeDebug("soundManager.stop(" + self.getArgs(arguments) + ")")
        } catch (e) {
            self.errorHandler("stop", "Failed: Flash unsupported / undefined sound ID (check XML)", arguments, e)
        }
    };
    this.getArgs = function (params) {
        var x = params ? params.length : 0;
        if (!x) {
            return ""
        }
        var result = "";
        for (var i = 0; i < x; i++) {
            result += (i && i < x ? ", " : "") + (params[i].toString().toLowerCase().indexOf("object") + 1 ? typeof(params[i]) : params[i])
        }
        return result
    };
    this.setVariable = function (soundID, property, value, oMovie) {
        if (!oMovie) {
            return false
        }
        try {
            oMovie.o.SetVariable("/" + soundID + ":" + property, value)
        } catch (e) {
            self.errorHandler("setVariable", "Failed", arguments, e)
        }
    };
    this.setVariableExec = function (soundID, fromMethodName, oMovie) {
        try {
            oMovie.o.TCallLabel("/" + soundID, "setVariable")
        } catch (e) {
            self.errorHandler(fromMethodName || "undefined", "Failed", arguments, e)
        }
    };
    this.callMethodExec = function (soundID, fromMethodName, oMovie) {
        try {
            oMovie.o.TCallLabel("/" + soundID, "callMethod")
        } catch (e) {
            self.errorHandler(fromMethodName || "undefined", "Failed", arguments, e)
        }
    };
    this.callMethod = function (soundID, methodName, methodParam, movieName) {
        movie = self.checkMovie(movieName || self.defaultName);
        if (!movie) {
            return false
        }
        self.setVariable(soundID, "jsProperty", methodName, movie);
        self.setVariable(soundID, "jsPropertyValue", methodParam, movie);
        self.callMethodExec(soundID, methodName, movie)
    };
    this.setPan = function (soundID, pan, movieName) {
        self.callMethod(soundID, "setPan", pan, movieName)
    };
    this.setVolume = function (soundID, volume, movieName) {
        self.callMethod(soundID, "setVolume", volume, movieName)
    };
    if (isIE && isMac) {
        this.unsupported = 1
    }
    if (!this.unsupported) {
        this.addMovie(this.defaultName, "soundcontroller.swf")
    }
}
function SoundManagerNull() {
    this.movies = [];
    this.container = null;
    this.unsupported = 1;
    this.FlashObject = function (a) {};
    this.addMovie = function (b, a) {};
    this.play = function (b, a) {
        return false
    };
    this.defaultName = "default"
}
function writeDebug(c) {
    var b = document.getElementById("debugContainer");
    if (!b) {
        return false
    }
    var a = document.createElement("div");
    a.innerHTML = c;
    b.appendChild(a)
}
var soundManager = null;

function soundManagerInit() {
    soundManager = new SoundManager()
}
Calendar = function (d, c, f, a) {
    this.activeDiv = null;
    this.currentDateEl = null;
    this.getDateStatus = null;
    this.getDateToolTip = null;
    this.getDateText = null;
    this.timeout = null;
    this.onSelected = f || null;
    this.onClose = a || null;
    this.dragging = false;
    this.hidden = false;
    this.minYear = 1970;
    this.maxYear = 2050;
    this.dateFormat = Calendar._TT.DEF_DATE_FORMAT;
    this.ttDateFormat = Calendar._TT.TT_DATE_FORMAT;
    this.isPopup = true;
    this.weekNumbers = true;
    this.firstDayOfWeek = typeof d == "number" ? d : Calendar._FD;
    this.showsOtherMonths = false;
    this.dateStr = c;
    this.ar_days = null;
    this.showsTime = false;
    this.time24 = true;
    this.yearStep = 2;
    this.hiliteToday = true;
    this.multiple = null;
    this.table = null;
    this.element = null;
    this.tbody = null;
    this.firstdayname = null;
    this.monthsCombo = null;
    this.yearsCombo = null;
    this.hilitedMonth = null;
    this.activeMonth = null;
    this.hilitedYear = null;
    this.activeYear = null;
    this.dateClicked = false;
    if (typeof Calendar._SDN == "undefined") {
        if (typeof Calendar._SDN_len == "undefined") {
            Calendar._SDN_len = 3
        }
        var b = new Array();
        for (var e = 8; e > 0;) {
            b[--e] = Calendar._DN[e].substr(0, Calendar._SDN_len)
        }
        Calendar._SDN = b;
        if (typeof Calendar._SMN_len == "undefined") {
            Calendar._SMN_len = 3
        }
        b = new Array();
        for (var e = 12; e > 0;) {
            b[--e] = Calendar._MN[e].substr(0, Calendar._SMN_len)
        }
        Calendar._SMN = b
    }
};
Calendar._C = null;
Calendar.is_ie = (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent));
Calendar.is_ie5 = (Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent));
Calendar.is_opera = /opera/i.test(navigator.userAgent);
Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
Calendar.getAbsolutePos = function (e) {
    var a = 0,
        d = 0;
    var c = /^div$/i.test(e.tagName);
    if (c && e.scrollLeft) {
        a = e.scrollLeft
    }
    if (c && e.scrollTop) {
        d = e.scrollTop
    }
    var f = {
        x: e.offsetLeft - a,
        y: e.offsetTop - d
    };
    if (e.offsetParent) {
        var b = this.getAbsolutePos(e.offsetParent);
        f.x += b.x;
        f.y += b.y
    }
    return f
};
Calendar.isRelated = function (c, a) {
    var d = a.relatedTarget;
    if (!d) {
        var b = a.type;
        if (b == "mouseover") {
            d = a.fromElement
        } else {
            if (b == "mouseout") {
                d = a.toElement
            }
        }
    }
    while (d) {
        if (d == c) {
            return true
        }
        d = d.parentNode
    }
    return false
};
Calendar.removeClass = function (e, d) {
    if (!(e && e.className)) {
        return
    }
    var a = e.className.split(" ");
    var b = new Array();
    for (var c = a.length; c > 0;) {
        if (a[--c] != d) {
            b[b.length] = a[c]
        }
    }
    e.className = b.join(" ")
};
Calendar.addClass = function (b, a) {
    Calendar.removeClass(b, a);
    b.className += " " + a
};
Calendar.getElement = function (a) {
    var b = Calendar.is_ie ? window.event.srcElement : a.currentTarget;
    while (b.nodeType != 1 || /^div$/i.test(b.tagName)) {
        b = b.parentNode
    }
    return b
};
Calendar.getTargetElement = function (a) {
    var b = Calendar.is_ie ? window.event.srcElement : a.target;
    while (b.nodeType != 1) {
        b = b.parentNode
    }
    return b
};
Calendar.stopEvent = function (a) {
    a || (a = window.event);
    if (Calendar.is_ie) {
        a.cancelBubble = true;
        a.returnValue = false
    } else {
        a.preventDefault();
        a.stopPropagation()
    }
    return false
};
Calendar.addEvent = function (a, c, b) {
    if (a.attachEvent) {
        a.attachEvent("on" + c, b)
    } else {
        if (a.addEventListener) {
            a.addEventListener(c, b, true)
        } else {
            a["on" + c] = b
        }
    }
};
Calendar.removeEvent = function (a, c, b) {
    if (a.detachEvent) {
        a.detachEvent("on" + c, b)
    } else {
        if (a.removeEventListener) {
            a.removeEventListener(c, b, true)
        } else {
            a["on" + c] = null
        }
    }
};
Calendar.createElement = function (c, b) {
    var a = null;
    if (document.createElementNS) {
        a = document.createElementNS("http://www.w3.org/1999/xhtml", c)
    } else {
        a = document.createElement(c)
    }
    if (typeof b != "undefined") {
        b.appendChild(a)
    }
    return a
};
Calendar._add_evs = function (el) {
    with(Calendar) {
        addEvent(el, "mouseover", dayMouseOver);
        addEvent(el, "mousedown", dayMouseDown);
        addEvent(el, "mouseout", dayMouseOut);
        if (is_ie) {
            addEvent(el, "dblclick", dayMouseDblClick);
            el.setAttribute("unselectable", true)
        }
    }
};
Calendar.findMonth = function (a) {
    if (typeof a.month != "undefined") {
        return a
    } else {
        if (typeof a.parentNode.month != "undefined") {
            return a.parentNode
        }
    }
    return null
};
Calendar.findYear = function (a) {
    if (typeof a.year != "undefined") {
        return a
    } else {
        if (typeof a.parentNode.year != "undefined") {
            return a.parentNode
        }
    }
    return null
};
Calendar.showMonthsCombo = function () {
    var e = Calendar._C;
    if (!e) {
        return false
    }
    var e = e;
    var f = e.activeDiv;
    var d = e.monthsCombo;
    if (e.hilitedMonth) {
        Calendar.removeClass(e.hilitedMonth, "hilite")
    }
    if (e.activeMonth) {
        Calendar.removeClass(e.activeMonth, "active")
    }
    var c = e.monthsCombo.getElementsByTagName("div")[e.date.getMonth()];
    Calendar.addClass(c, "active");
    e.activeMonth = c;
    var b = d.style;
    b.display = "block";
    if (f.navtype < 0) {
        b.left = f.offsetLeft + "px"
    } else {
        var a = d.offsetWidth;
        if (typeof a == "undefined") {
            a = 50
        }
        b.left = (f.offsetLeft + f.offsetWidth - a) + "px"
    }
    b.top = (f.offsetTop + f.offsetHeight) + "px"
};
Calendar.showYearsCombo = function (d) {
    var a = Calendar._C;
    if (!a) {
        return false
    }
    var a = a;
    var c = a.activeDiv;
    var f = a.yearsCombo;
    if (a.hilitedYear) {
        Calendar.removeClass(a.hilitedYear, "hilite")
    }
    if (a.activeYear) {
        Calendar.removeClass(a.activeYear, "active")
    }
    a.activeYear = null;
    var b = a.date.getFullYear() + (d ? 1 : -1);
    var k = f.firstChild;
    var j = false;
    for (var e = 12; e > 0; --e) {
        if (b >= a.minYear && b <= a.maxYear) {
            k.innerHTML = b;
            k.year = b;
            k.style.display = "block";
            j = true
        } else {
            k.style.display = "none"
        }
        k = k.nextSibling;
        b += d ? a.yearStep : -a.yearStep
    }
    if (j) {
        var l = f.style;
        l.display = "block";
        if (c.navtype < 0) {
            l.left = c.offsetLeft + "px"
        } else {
            var g = f.offsetWidth;
            if (typeof g == "undefined") {
                g = 50
            }
            l.left = (c.offsetLeft + c.offsetWidth - g) + "px"
        }
        l.top = (c.offsetTop + c.offsetHeight) + "px"
    }
};
Calendar.tableMouseUp = function (ev) {
    var cal = Calendar._C;
    if (!cal) {
        return false
    }
    if (cal.timeout) {
        clearTimeout(cal.timeout)
    }
    var el = cal.activeDiv;
    if (!el) {
        return false
    }
    var target = Calendar.getTargetElement(ev);
    ev || (ev = window.event);
    Calendar.removeClass(el, "active");
    if (target == el || target.parentNode == el) {
        Calendar.cellClick(el, ev)
    }
    var mon = Calendar.findMonth(target);
    var date = null;
    if (mon) {
        date = new Date(cal.date);
        if (mon.month != date.getMonth()) {
            date.setMonth(mon.month);
            cal.setDate(date);
            cal.dateClicked = false;
            cal.callHandler()
        }
    } else {
        var year = Calendar.findYear(target);
        if (year) {
            date = new Date(cal.date);
            if (year.year != date.getFullYear()) {
                date.setFullYear(year.year);
                cal.setDate(date);
                cal.dateClicked = false;
                cal.callHandler()
            }
        }
    }
    with(Calendar) {
        removeEvent(document, "mouseup", tableMouseUp);
        removeEvent(document, "mouseover", tableMouseOver);
        removeEvent(document, "mousemove", tableMouseOver);
        cal._hideCombos();
        _C = null;
        return stopEvent(ev)
    }
};
Calendar.tableMouseOver = function (o) {
    var a = Calendar._C;
    if (!a) {
        return
    }
    var c = a.activeDiv;
    var k = Calendar.getTargetElement(o);
    if (k == c || k.parentNode == c) {
        Calendar.addClass(c, "hilite active");
        Calendar.addClass(c.parentNode, "rowhilite")
    } else {
        if (typeof c.navtype == "undefined" || (c.navtype != 50 && (c.navtype == 0 || Math.abs(c.navtype) > 2))) {
            Calendar.removeClass(c, "active")
        }
        Calendar.removeClass(c, "hilite");
        Calendar.removeClass(c.parentNode, "rowhilite")
    }
    o || (o = window.event);
    if (c.navtype == 50 && k != c) {
        var n = Calendar.getAbsolutePos(c);
        var q = c.offsetWidth;
        var p = o.clientX;
        var r;
        var m = true;
        if (p > n.x + q) {
            r = p - n.x - q;
            m = false
        } else {
            r = n.x - p
        }
        if (r < 0) {
            r = 0
        }
        var f = c._range;
        var j = c._current;
        var g = Math.floor(r / 10) % f.length;
        for (var e = f.length; --e >= 0;) {
            if (f[e] == j) {
                break
            }
        }
        while (g-- > 0) {
            if (m) {
                if (--e < 0) {
                    e = f.length - 1
                }
            } else {
                if (++e >= f.length) {
                    e = 0
                }
            }
        }
        var b = f[e];
        c.innerHTML = b;
        a.onUpdateTime()
    }
    var d = Calendar.findMonth(k);
    if (d) {
        if (d.month != a.date.getMonth()) {
            if (a.hilitedMonth) {
                Calendar.removeClass(a.hilitedMonth, "hilite")
            }
            Calendar.addClass(d, "hilite");
            a.hilitedMonth = d
        } else {
            if (a.hilitedMonth) {
                Calendar.removeClass(a.hilitedMonth, "hilite")
            }
        }
    } else {
        if (a.hilitedMonth) {
            Calendar.removeClass(a.hilitedMonth, "hilite")
        }
        var l = Calendar.findYear(k);
        if (l) {
            if (l.year != a.date.getFullYear()) {
                if (a.hilitedYear) {
                    Calendar.removeClass(a.hilitedYear, "hilite")
                }
                Calendar.addClass(l, "hilite");
                a.hilitedYear = l
            } else {
                if (a.hilitedYear) {
                    Calendar.removeClass(a.hilitedYear, "hilite")
                }
            }
        } else {
            if (a.hilitedYear) {
                Calendar.removeClass(a.hilitedYear, "hilite")
            }
        }
    }
    return Calendar.stopEvent(o)
};
Calendar.tableMouseDown = function (a) {
    if (Calendar.getTargetElement(a) == Calendar.getElement(a)) {
        return Calendar.stopEvent(a)
    }
};
Calendar.calDragIt = function (b) {
    var c = Calendar._C;
    if (!(c && c.dragging)) {
        return false
    }
    var e;
    var d;
    if (Calendar.is_ie) {
        d = window.event.clientY + document.body.scrollTop;
        e = window.event.clientX + document.body.scrollLeft
    } else {
        e = b.pageX;
        d = b.pageY
    }
    c.hideShowCovered();
    var a = c.element.style;
    a.left = (e - c.xOffs) + "px";
    a.top = (d - c.yOffs) + "px";
    return Calendar.stopEvent(b)
};
Calendar.calDragEnd = function (ev) {
    var cal = Calendar._C;
    if (!cal) {
        return false
    }
    cal.dragging = false;
    with(Calendar) {
        removeEvent(document, "mousemove", calDragIt);
        removeEvent(document, "mouseup", calDragEnd);
        tableMouseUp(ev)
    }
    cal.hideShowCovered()
};
Calendar.dayMouseDown = function (ev) {
    var el = Calendar.getElement(ev);
    if (el.disabled) {
        return false
    }
    var cal = el.calendar;
    cal.activeDiv = el;
    Calendar._C = cal;
    if (el.navtype != 300) {
        with(Calendar) {
            if (el.navtype == 50) {
                el._current = el.innerHTML;
                addEvent(document, "mousemove", tableMouseOver)
            } else {
                addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver)
            }
            addClass(el, "hilite active");
            addEvent(document, "mouseup", tableMouseUp)
        }
    } else {
        if (cal.isPopup) {
            cal._dragStart(ev)
        }
    }
    if (el.navtype == -1 || el.navtype == 1) {
        if (cal.timeout) {
            clearTimeout(cal.timeout)
        }
        cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250)
    } else {
        if (el.navtype == -2 || el.navtype == 2) {
            if (cal.timeout) {
                clearTimeout(cal.timeout)
            }
            cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250)
        } else {
            cal.timeout = null
        }
    }
    return Calendar.stopEvent(ev)
};
Calendar.dayMouseDblClick = function (a) {
    Calendar.cellClick(Calendar.getElement(a), a || window.event);
    if (Calendar.is_ie) {
        document.selection.empty()
    }
};
Calendar.dayMouseOver = function (b) {
    var a = Calendar.getElement(b);
    if (Calendar.isRelated(a, b) || Calendar._C || a.disabled) {
        return false
    }
    if (a.ttip) {
        if (a.ttip.substr(0, 1) == "_") {
            a.ttip = a.caldate.print(a.calendar.ttDateFormat) + a.ttip.substr(1)
        }
        a.calendar.tooltips.innerHTML = a.ttip
    }
    if (a.navtype != 300) {
        Calendar.addClass(a, "hilite");
        if (a.caldate) {
            Calendar.addClass(a.parentNode, "rowhilite");
            var c = a.calendar;
            if (c && c.getDateToolTip) {
                var e = a.caldate;
                window.status = e;
                a.title = c.getDateToolTip(e, e.getFullYear(), e.getMonth(), e.getDate())
            }
        }
    }
    return Calendar.stopEvent(b)
};
Calendar.dayMouseOut = function (ev) {
    with(Calendar) {
        var el = getElement(ev);
        if (isRelated(el, ev) || _C || el.disabled) {
            return false
        }
        removeClass(el, "hilite");
        if (el.caldate) {
            removeClass(el.parentNode, "rowhilite")
        }
        if (el.calendar) {
            el.calendar.tooltips.innerHTML = _TT.SEL_DATE
        }
    }
};
Calendar.cellClick = function (e, p) {
    var c = e.calendar;
    var j = false;
    var m = false;
    var f = null;
    if (typeof e.navtype == "undefined") {
        if (c.currentDateEl) {
            Calendar.removeClass(c.currentDateEl, "selected");
            Calendar.addClass(e, "selected");
            j = (c.currentDateEl == e);
            if (!j) {
                c.currentDateEl = e
            }
        }
        c.date.setDateOnly(e.caldate);
        f = c.date;
        var b = !(c.dateClicked = !e.otherMonth);
        if (!b && !c.currentDateEl && c.multiple) {
            c._toggleMultipleDate(new Date(f))
        } else {
            m = !e.disabled
        }
        if (b) {
            c._init(c.firstDayOfWeek, f)
        }
    } else {
        if (e.navtype == 200) {
            Calendar.removeClass(e, "hilite");
            c.callCloseHandler();
            return
        }
        f = new Date(c.date);
        if (e.navtype == 0) {
            f.setDateOnly(new Date())
        }
        c.dateClicked = false;
        var o = f.getFullYear();
        var g = f.getMonth();

        function a(s) {
            var t = f.getDate();
            var r = f.getMonthDays(s);
            if (t > r) {
                f.setDate(r)
            }
            f.setMonth(s)
        }
        switch (e.navtype) {
        case 400:
            Calendar.removeClass(e, "hilite");
            var q = Calendar._TT.ABOUT;
            if (typeof q != "undefined") {
                q += c.showsTime ? Calendar._TT.ABOUT_TIME : ""
            } else {
                q = 'Help and about box text is not translated into this language.\nIf you know this language and you feel generous please update\nthe corresponding file in "lang" subdir to match calendar-en.js\nand send it back to <mihai_bazon@yahoo.com> to get it into the distribution  ;-)\n\nThank you!\nhttp://dynarch.com/mishoo/calendar.epl\n'
            }
            alert(q);
            return;
        case -2:
            if (o > c.minYear) {
                f.setFullYear(o - 1)
            }
            break;
        case -1:
            if (g > 0) {
                a(g - 1)
            } else {
                if (o-- > c.minYear) {
                    f.setFullYear(o);
                    a(11)
                }
            }
            break;
        case 1:
            if (g < 11) {
                a(g + 1)
            } else {
                if (o < c.maxYear) {
                    f.setFullYear(o + 1);
                    a(0)
                }
            }
            break;
        case 2:
            if (o < c.maxYear) {
                f.setFullYear(o + 1)
            }
            break;
        case 100:
            c.setFirstDayOfWeek(e.fdow);
            return;
        case 50:
            var l = e._range;
            var n = e.innerHTML;
            for (var k = l.length; --k >= 0;) {
                if (l[k] == n) {
                    break
                }
            }
            if (p && p.shiftKey) {
                if (--k < 0) {
                    k = l.length - 1
                }
            } else {
                if (++k >= l.length) {
                    k = 0
                }
            }
            var d = l[k];
            e.innerHTML = d;
            c.onUpdateTime();
            return;
        case 0:
            if ((typeof c.getDateStatus == "function") && c.getDateStatus(f, f.getFullYear(), f.getMonth(), f.getDate())) {
                return false
            }
            break
        }
        if (!f.equalsTo(c.date)) {
            c.setDate(f);
            m = true
        } else {
            if (e.navtype == 0) {
                m = j = true
            }
        }
    }
    if (m) {
        p && c.callHandler()
    }
    if (j) {
        Calendar.removeClass(e, "hilite");
        p && c.callCloseHandler()
    }
};
Calendar.prototype.create = function (o) {
    var n = null;
    if (!o) {
        n = document.getElementsByTagName("body")[0];
        this.isPopup = true
    } else {
        n = o;
        this.isPopup = false
    }
    this.date = this.dateStr ? new Date(this.dateStr) : new Date();
    var r = Calendar.createElement("table");
    this.table = r;
    r.cellSpacing = 0;
    r.cellPadding = 0;
    r.calendar = this;
    Calendar.addEvent(r, "mousedown", Calendar.tableMouseDown);
    var a = Calendar.createElement("div");
    this.element = a;
    a.className = "calendar";
    if (this.isPopup) {
        a.style.position = "absolute";
        a.style.display = "none"
    }
    a.appendChild(r);
    var l = Calendar.createElement("thead", r);
    var p = null;
    var s = null;
    var b = this;
    var e = function (u, t, j) {
        p = Calendar.createElement("td", s);
        p.colSpan = t;
        p.className = "button";
        if (j != 0 && Math.abs(j) <= 2) {
            p.className += " nav"
        }
        Calendar._add_evs(p);
        p.calendar = b;
        p.navtype = j;
        p.innerHTML = "<div unselectable='on'>" + u + "</div>";
        return p
    };
    s = Calendar.createElement("tr", l);
    var c = 7;
    (this.isPopup) && --c;
    (this.weekNumbers) && ++c;
    this.title = e("", c, 300);
    this.title.className = "title";
    if (this.isPopup) {
        this.title.ttip = "";
        this.title.style.cursor = "move";
        e("&#x00d7;", 1, 200).ttip = ""
    }
    s = Calendar.createElement("tr", l);
    s.className = "headrow";
    this._nav_pm = e("", 1, -1);
    this._nav_pm.ttip = "";
    this._nav_pm.className += " izq";
    this._nav_now = e(Calendar._TT.TODAY, this.weekNumbers ? 6 : 5, 0);
    this._nav_now.ttip = "";
    this._nav_nm = e("", 1, 1);
    this._nav_nm.ttip = "";
    this._nav_nm.className += " der";
    s = Calendar.createElement("tr", l);
    s.className = "daynames";
    if (this.weekNumbers) {
        p = Calendar.createElement("td", s);
        p.className = "name wn";
        p.innerHTML = Calendar._TT.WK
    }
    for (var k = 7; k > 0; --k) {
        p = Calendar.createElement("td", s);
        if (!k) {
            p.navtype = 100;
            p.calendar = this;
            Calendar._add_evs(p)
        }
    }
    this.firstdayname = (this.weekNumbers) ? s.firstChild.nextSibling : s.firstChild;
    this._displayWeekdays();
    var g = Calendar.createElement("tbody", r);
    this.tbody = g;
    for (k = 6; k > 0; --k) {
        s = Calendar.createElement("tr", g);
        if (this.weekNumbers) {
            p = Calendar.createElement("td", s)
        }
        for (var f = 7; f > 0; --f) {
            p = Calendar.createElement("td", s);
            p.calendar = this;
            Calendar._add_evs(p)
        }
    }
    if (this.showsTime) {
        s = Calendar.createElement("tr", g);
        s.className = "time";
        p = Calendar.createElement("td", s);
        p.className = "time";
        p.colSpan = 2;
        p.innerHTML = Calendar._TT.TIME || "&nbsp;";
        p = Calendar.createElement("td", s);
        p.className = "time";
        p.colSpan = this.weekNumbers ? 4 : 3;
        (function () {
            function v(E, G, F, H) {
                var C = Calendar.createElement("span", p);
                C.className = E;
                C.innerHTML = G;
                C.calendar = b;
                C.ttip = "";
                C.navtype = 50;
                C._range = [];
                if (typeof F != "number") {
                    C._range = F
                } else {
                    for (var D = F; D <= H; ++D) {
                        var B;
                        if (D < 10 && H >= 10) {
                            B = "0" + D
                        } else {
                            B = "" + D
                        }
                        C._range[C._range.length] = B
                    }
                }
                Calendar._add_evs(C);
                return C
            }
            var z = b.date.getHours();
            var j = b.date.getMinutes();
            var A = !b.time24;
            var t = (z > 12);
            if (A && t) {
                z -= 12
            }
            var x = v("hour", z, A ? 1 : 0, A ? 12 : 23);
            var w = Calendar.createElement("span", p);
            w.innerHTML = ":";
            w.className = "colon";
            var u = v("minute", j, 0, 59);
            var y = null;
            p = Calendar.createElement("td", s);
            p.className = "time";
            p.colSpan = 2;
            if (A) {
                y = v("ampm", t ? "pm" : "am", ["am", "pm"])
            } else {
                p.innerHTML = "&nbsp;"
            }
            b.onSetTime = function () {
                var C, B = this.date.getHours(),
                    D = this.date.getMinutes();
                if (A) {
                    C = (B >= 12);
                    if (C) {
                        B -= 12
                    }
                    if (B == 0) {
                        B = 12
                    }
                    y.innerHTML = C ? "pm" : "am"
                }
                x.innerHTML = (B < 10) ? ("0" + B) : B;
                u.innerHTML = (D < 10) ? ("0" + D) : D
            };
            b.onUpdateTime = function () {
                var C = this.date;
                var D = parseInt(x.innerHTML, 10);
                if (A) {
                    if (/pm/i.test(y.innerHTML) && D < 12) {
                        D += 12
                    } else {
                        if (/am/i.test(y.innerHTML) && D == 12) {
                            D = 0
                        }
                    }
                }
                var E = C.getDate();
                var B = C.getMonth();
                var F = C.getFullYear();
                C.setHours(D);
                C.setMinutes(parseInt(u.innerHTML, 10));
                C.setFullYear(F);
                C.setMonth(B);
                C.setDate(E);
                this.dateClicked = false;
                this.callHandler()
            }
        })()
    } else {
        this.onSetTime = this.onUpdateTime = function () {}
    }
    var m = Calendar.createElement("tfoot", r);
    s = Calendar.createElement("tr", m);
    s.className = "footrow";
    p = e(Calendar._TT.SEL_DATE, this.weekNumbers ? 8 : 7, 300);
    p.className = "ttip";
    if (this.isPopup) {
        p.ttip = "";
        p.style.cursor = "move"
    }
    this.tooltips = p;
    a = Calendar.createElement("div", this.element);
    this.monthsCombo = a;
    a.className = "combo";
    for (k = 0; k < Calendar._MN.length; ++k) {
        var d = Calendar.createElement("div");
        d.className = Calendar.is_ie ? "label-IEfix" : "label";
        d.month = k;
        d.innerHTML = Calendar._SMN[k];
        a.appendChild(d)
    }
    a = Calendar.createElement("div", this.element);
    this.yearsCombo = a;
    a.className = "combo";
    for (k = 12; k > 0; --k) {
        var q = Calendar.createElement("div");
        q.className = Calendar.is_ie ? "label-IEfix" : "label";
        a.appendChild(q)
    }
    this._init(this.firstDayOfWeek, this.date);
    n.appendChild(this.element)
};
Calendar._keyEvent = function (m) {
    var a = window._dynarch_popupCalendar;
    if (!a || a.multiple) {
        return false
    }(Calendar.is_ie) && (m = window.event);
    var k = (Calendar.is_ie || m.type == "keypress"),
        n = m.keyCode;
    if (m.ctrlKey) {
        switch (n) {
        case 37:
            k && Calendar.cellClick(a._nav_pm);
            break;
        case 38:
            k && Calendar.cellClick(a._nav_py);
            break;
        case 39:
            k && Calendar.cellClick(a._nav_nm);
            break;
        case 40:
            k && Calendar.cellClick(a._nav_ny);
            break;
        default:
            return false
        }
    } else {
        switch (n) {
        case 32:
            Calendar.cellClick(a._nav_now);
            break;
        case 27:
            k && a.callCloseHandler();
            break;
        case 37:
        case 38:
        case 39:
        case 40:
            if (k) {
                var e, o, l, g, c, d;
                e = n == 37 || n == 38;
                d = (n == 37 || n == 39) ? 1 : 7;

                function b() {
                    c = a.currentDateEl;
                    var q = c.pos;
                    o = q & 15;
                    l = q >> 4;
                    g = a.ar_days[l][o]
                }
                b();

                function f() {
                    var p = new Date(a.date);
                    p.setDate(p.getDate() - d);
                    a.setDate(p)
                }
                function j() {
                    var p = new Date(a.date);
                    p.setDate(p.getDate() + d);
                    a.setDate(p)
                }
                while (1) {
                    switch (n) {
                    case 37:
                        if (--o >= 0) {
                            g = a.ar_days[l][o]
                        } else {
                            o = 6;
                            n = 38;
                            continue
                        }
                        break;
                    case 38:
                        if (--l >= 0) {
                            g = a.ar_days[l][o]
                        } else {
                            f();
                            b()
                        }
                        break;
                    case 39:
                        if (++o < 7) {
                            g = a.ar_days[l][o]
                        } else {
                            o = 0;
                            n = 40;
                            continue
                        }
                        break;
                    case 40:
                        if (++l < a.ar_days.length) {
                            g = a.ar_days[l][o]
                        } else {
                            j();
                            b()
                        }
                        break
                    }
                    break
                }
                if (g) {
                    if (!g.disabled) {
                        Calendar.cellClick(g)
                    } else {
                        if (e) {
                            f()
                        } else {
                            j()
                        }
                    }
                }
            }
            break;
        case 13:
            if (k) {
                Calendar.cellClick(a.currentDateEl, m)
            }
            break;
        default:
            return false
        }
    }
    return Calendar.stopEvent(m)
};
Calendar.prototype._init = function (n, x) {
    var w = new Date(),
        r = w.getFullYear(),
        z = w.getMonth(),
        b = w.getDate();
    this.table.style.visibility = "hidden";
    var k = x.getFullYear();
    if (k < this.minYear) {
        k = this.minYear;
        x.setFullYear(k)
    } else {
        if (k > this.maxYear) {
            k = this.maxYear;
            x.setFullYear(k)
        }
    }
    this.firstDayOfWeek = n;
    this.date = new Date(x);
    var y = x.getMonth();
    var B = x.getDate();
    var A = x.getMonthDays();
    x.setDate(1);
    var s = (x.getDay() - this.firstDayOfWeek) % 7;
    if (s < 0) {
        s += 7
    }
    x.setDate(-s);
    x.setDate(x.getDate() + 1);
    var e = this.tbody.firstChild;
    var l = Calendar._SMN[y];
    var p = this.ar_days = new Array();
    var o = Calendar._TT.WEEKEND;
    var d = this.multiple ? (this.datesCells = {}) : null;
    for (var u = 0; u < 6; ++u, e = e.nextSibling) {
        var a = e.firstChild;
        if (this.weekNumbers) {
            a.className = "day wn";
            a.innerHTML = x.getWeekNumber();
            a = a.nextSibling
        }
        e.className = "daysrow";
        var v = false,
            f, c = p[u] = [];
        for (var t = 0; t < 7; ++t, a = a.nextSibling, x.setDate(f + 1)) {
            f = x.getDate();
            var g = x.getDay();
            a.className = "day";
            a.pos = u << 4 | t;
            c[t] = a;
            var m = (x.getMonth() == y);
            if (!m) {
                if (this.showsOtherMonths) {
                    a.className += " othermonth";
                    a.otherMonth = true
                } else {
                    a.className = "emptycell";
                    a.innerHTML = "&nbsp;";
                    a.disabled = true;
                    continue
                }
            } else {
                a.otherMonth = false;
                v = true
            }
            a.disabled = false;
            a.innerHTML = this.getDateText ? this.getDateText(x, f) : f;
            if (d) {
                d[x.print("%Y%m%d")] = a
            }
            if (this.getDateStatus) {
                var q = this.getDateStatus(x, k, y, f);
                if (q === true) {
                    a.className += " disabled";
                    a.disabled = true
                } else {
                    if (/disabled/i.test(q)) {
                        a.disabled = true
                    }
                    a.className += " " + q
                }
            }
            if (!a.disabled) {
                a.caldate = new Date(x);
                a.ttip = "";
                if (!this.multiple && m && f == B && this.hiliteToday) {
                    a.className += " selected";
                    this.currentDateEl = a
                }
                if (x.getFullYear() == r && x.getMonth() == z && f == b) {
                    a.className += " today";
                    a.ttip += ""
                }
                if (o.indexOf(g.toString()) != -1) {
                    a.className += a.otherMonth ? " oweekend" : " weekend";
                    if (t == 6) {
                        a.className += " dom"
                    }
                }
            }
        }
        if (!(v || this.showsOtherMonths)) {
            e.className = "emptyrow"
        }
    }
    this.title.innerHTML = Calendar._MN[y] + ", " + k;
    this.onSetTime();
    this.table.style.visibility = "visible";
    this._initMultipleDates()
};
Calendar.prototype._initMultipleDates = function () {
    if (this.multiple) {
        for (var b in this.multiple) {
            var a = this.datesCells[b];
            var c = this.multiple[b];
            if (!c) {
                continue
            }
            if (a) {
                a.className += " selected"
            }
        }
    }
};
Calendar.prototype._toggleMultipleDate = function (b) {
    if (this.multiple) {
        var c = b.print("%Y%m%d");
        var a = this.datesCells[c];
        if (a) {
            var e = this.multiple[c];
            if (!e) {
                Calendar.addClass(a, "selected");
                this.multiple[c] = b
            } else {
                Calendar.removeClass(a, "selected");
                delete this.multiple[c]
            }
        }
    }
};
Calendar.prototype.setDateToolTipHandler = function (a) {
    this.getDateToolTip = a
};
Calendar.prototype.setDate = function (a) {
    if (!a.equalsTo(this.date)) {
        this._init(this.firstDayOfWeek, a)
    }
};
Calendar.prototype.refresh = function () {
    this._init(this.firstDayOfWeek, this.date)
};
Calendar.prototype.setFirstDayOfWeek = function (a) {
    this._init(a, this.date);
    this._displayWeekdays()
};
Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (a) {
    this.getDateStatus = a
};
Calendar.prototype.setRange = function (b, c) {
    this.minYear = b;
    this.maxYear = c
};
Calendar.prototype.callHandler = function () {
    if (this.onSelected) {
        this.onSelected(this, this.date.print(this.dateFormat))
    }
};
Calendar.prototype.callCloseHandler = function () {
    if (this.onClose) {
        this.onClose(this)
    }
    this.hideShowCovered()
};
Calendar.prototype.destroy = function () {
    var a = this.element.parentNode;
    a.removeChild(this.element);
    Calendar._C = null;
    window._dynarch_popupCalendar = null
};
Calendar.prototype.reparent = function (b) {
    var a = this.element;
    a.parentNode.removeChild(a);
    b.appendChild(a)
};
Calendar._checkCalendar = function (b) {
    var c = window._dynarch_popupCalendar;
    if (!c) {
        return false
    }
    var a = Calendar.is_ie ? Calendar.getElement(b) : Calendar.getTargetElement(b);
    for (; a != null && a != c.element; a = a.parentNode) {}
    if (a == null) {
        window._dynarch_popupCalendar.callCloseHandler();
        return Calendar.stopEvent(b)
    }
};
Calendar.prototype.show = function () {
    var e = this.table.getElementsByTagName("tr");
    for (var d = e.length; d > 0;) {
        var f = e[--d];
        Calendar.removeClass(f, "rowhilite");
        var c = f.getElementsByTagName("td");
        for (var b = c.length; b > 0;) {
            var a = c[--b];
            Calendar.removeClass(a, "hilite");
            Calendar.removeClass(a, "active")
        }
    }
    this.element.style.display = "block";
    this.hidden = false;
    if (this.isPopup) {
        window._dynarch_popupCalendar = this;
        Calendar.addEvent(document, "keydown", Calendar._keyEvent);
        Calendar.addEvent(document, "keypress", Calendar._keyEvent);
        Calendar.addEvent(document, "mousedown", Calendar._checkCalendar)
    }
    this.hideShowCovered()
};
Calendar.prototype.hide = function () {
    if (this.isPopup) {
        Calendar.removeEvent(document, "keydown", Calendar._keyEvent);
        Calendar.removeEvent(document, "keypress", Calendar._keyEvent);
        Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar)
    }
    this.element.style.display = "none";
    this.hidden = true;
    this.hideShowCovered()
};
Calendar.prototype.showAt = function (a, c) {
    var b = this.element.style;
    b.left = a + "px";
    b.top = c + "px";
    this.show()
};
Calendar.prototype.showAtElement = function (c, d) {
    var a = this;
    var e = Calendar.getAbsolutePos(c);
    if (!d || typeof d != "string") {
        this.showAt(e.x, e.y + c.offsetHeight);
        return true
    }
    function b(k) {
        if (k.x < 0) {
            k.x = 0
        }
        if (k.y < 0) {
            k.y = 0
        }
        var l = document.createElement("div");
        var j = l.style;
        j.position = "absolute";
        j.right = j.bottom = j.width = j.height = "0px";
        document.body.appendChild(l);
        var g = Calendar.getAbsolutePos(l);
        document.body.removeChild(l);
        if (document.body.scrollLeft) {
            g.x += document.body.scrollLeft
        }
        g.x += window.scrollX;
        if (document.body.scrollTop) {
            g.y += document.body.scrollTop
        }
        g.y += window.scrollY;
        var f = k.x + k.width - g.x;
        if (f > 0) {
            k.x -= f
        }
        f = k.y + k.height - g.y;
        if (f > 0) {
            k.y -= f
        }
    }
    this.element.style.display = "block";
    Calendar.continuation_for_the_fucking_khtml_browser = function () {
        var f = a.element.offsetWidth;
        var j = a.element.offsetHeight;
        a.element.style.display = "none";
        var g = d.substr(0, 1);
        var k = "l";
        if (d.length > 1) {
            k = d.substr(1, 1)
        }
        switch (g) {
        case "T":
            e.y -= j;
            break;
        case "B":
            e.y += c.offsetHeight;
            break;
        case "C":
            e.y += (c.offsetHeight - j) / 2;
            break;
        case "t":
            e.y += c.offsetHeight - j;
            break;
        case "b":
            break
        }
        switch (k) {
        case "L":
            e.x -= f;
            break;
        case "R":
            e.x += c.offsetWidth;
            break;
        case "C":
            e.x += (c.offsetWidth - f) / 2;
            break;
        case "l":
            e.x += c.offsetWidth - f;
            break;
        case "r":
            break
        }
        e.width = f;
        e.height = j + 40;
        a.monthsCombo.style.display = "none";
        b(e);
        a.showAt(e.x, e.y)
    };
    if (Calendar.is_khtml) {
        setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10)
    } else {
        Calendar.continuation_for_the_fucking_khtml_browser()
    }
};
Calendar.prototype.setDateFormat = function (a) {
    this.dateFormat = a
};
Calendar.prototype.setTtDateFormat = function (a) {
    this.ttDateFormat = a
};
Calendar.prototype.parseDate = function (b, a) {
    if (!a) {
        a = this.dateFormat
    }
    this.setDate(Date.parseDate(b, a))
};
Calendar.prototype.hideShowCovered = function () {
    if (!Calendar.is_ie && !Calendar.is_opera) {
        return
    }
    function b(p) {
        var k = p.style.visibility;
        if (!k) {
            if (document.defaultView && typeof(document.defaultView.getComputedStyle) == "function") {
                if (!Calendar.is_khtml) {
                    k = document.defaultView.getComputedStyle(p, "").getPropertyValue("visibility")
                } else {
                    k = ""
                }
            } else {
                if (p.currentStyle) {
                    k = p.currentStyle.visibility
                } else {
                    k = ""
                }
            }
        }
        return k
    }
    var t = new Array("applet", "iframe", "select");
    var c = this.element;
    var a = Calendar.getAbsolutePos(c);
    var f = a.x;
    var d = c.offsetWidth + f;
    var s = a.y;
    var r = c.offsetHeight + s;
    for (var j = t.length; j > 0;) {
        var g = document.getElementsByTagName(t[--j]);
        var e = null;
        for (var m = g.length; m > 0;) {
            e = g[--m];
            a = Calendar.getAbsolutePos(e);
            var q = a.x;
            var o = e.offsetWidth + q;
            var n = a.y;
            var l = e.offsetHeight + n;
            if (this.hidden || (q > d) || (o < f) || (n > r) || (l < s)) {
                if (!e.__msh_save_visibility) {
                    e.__msh_save_visibility = b(e)
                }
                e.style.visibility = e.__msh_save_visibility
            } else {
                if (!e.__msh_save_visibility) {
                    e.__msh_save_visibility = b(e)
                }
                e.style.visibility = "hidden"
            }
        }
    }
};
Calendar.prototype._displayWeekdays = function () {
    var b = this.firstDayOfWeek;
    var a = this.firstdayname;
    var d = Calendar._TT.WEEKEND;
    for (var c = 0; c < 7; ++c) {
        a.className = "day name";
        var e = (c + b) % 7;
        if (c) {
            a.ttip = "";
            a.navtype = 100;
            a.calendar = this;
            a.fdow = e;
            Calendar._add_evs(a)
        }
        if (d.indexOf(e.toString()) != -1) {
            Calendar.addClass(a, "weekend");
            if (c == 6) {
                Calendar.addClass(a, "dom")
            }
        }
        a.innerHTML = Calendar._SDN[(c + b) % 7];
        a = a.nextSibling
    }
};
Calendar.prototype._hideCombos = function () {
    this.monthsCombo.style.display = "none";
    this.yearsCombo.style.display = "none"
};
Calendar.prototype._dragStart = function (ev) {
    if (this.dragging) {
        return
    }
    this.dragging = true;
    var posX;
    var posY;
    if (Calendar.is_ie) {
        posY = window.event.clientY + document.body.scrollTop;
        posX = window.event.clientX + document.body.scrollLeft
    } else {
        posY = ev.clientY + window.scrollY;
        posX = ev.clientX + window.scrollX
    }
    var st = this.element.style;
    this.xOffs = posX - parseInt(st.left);
    this.yOffs = posY - parseInt(st.top);
    with(Calendar) {
        addEvent(document, "mousemove", calDragIt);
        addEvent(document, "mouseup", calDragEnd)
    }
};
Date._MD = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
Date.SECOND = 1000;
Date.MINUTE = 60 * Date.SECOND;
Date.HOUR = 60 * Date.MINUTE;
Date.DAY = 24 * Date.HOUR;
Date.WEEK = 7 * Date.DAY;
Date.parseDate = function (n, c) {
    var o = new Date();
    var p = 0;
    var e = -1;
    var l = 0;
    var r = n.split(/\W+/);
    var q = c.match(/%./g);
    var k = 0,
        g = 0;
    var s = 0;
    var f = 0;
    for (k = 0; k < r.length; ++k) {
        if (!r[k]) {
            continue
        }
        switch (q[k]) {
        case "%d":
        case "%e":
            l = parseInt(r[k], 10);
            break;
        case "%m":
            e = parseInt(r[k], 10) - 1;
            break;
        case "%Y":
        case "%y":
            p = parseInt(r[k], 10);
            (p < 100) && (p += (p > 29) ? 1900 : 2000);
            break;
        case "%b":
        case "%B":
            for (g = 0; g < 12; ++g) {
                if (Calendar._MN[g].substr(0, r[k].length).toLowerCase() == r[k].toLowerCase()) {
                    e = g;
                    break
                }
            }
            break;
        case "%H":
        case "%I":
        case "%k":
        case "%l":
            s = parseInt(r[k], 10);
            break;
        case "%P":
        case "%p":
            if (/pm/i.test(r[k]) && s < 12) {
                s += 12
            } else {
                if (/am/i.test(r[k]) && s >= 12) {
                    s -= 12
                }
            }
            break;
        case "%M":
            f = parseInt(r[k], 10);
            break
        }
    }
    if (isNaN(p)) {
        p = o.getFullYear()
    }
    if (isNaN(e)) {
        e = o.getMonth()
    }
    if (isNaN(l)) {
        l = o.getDate()
    }
    if (isNaN(s)) {
        s = o.getHours()
    }
    if (isNaN(f)) {
        f = o.getMinutes()
    }
    if (p != 0 && e != -1 && l != 0) {
        return new Date(p, e, l, s, f, 0)
    }
    p = 0;
    e = -1;
    l = 0;
    for (k = 0; k < r.length; ++k) {
        if (r[k].search(/[a-zA-Z]+/) != -1) {
            var u = -1;
            for (g = 0; g < 12; ++g) {
                if (Calendar._MN[g].substr(0, r[k].length).toLowerCase() == r[k].toLowerCase()) {
                    u = g;
                    break
                }
            }
            if (u != -1) {
                if (e != -1) {
                    l = e + 1
                }
                e = u
            }
        } else {
            if (parseInt(r[k], 10) <= 12 && e == -1) {
                e = r[k] - 1
            } else {
                if (parseInt(r[k], 10) > 31 && p == 0) {
                    p = parseInt(r[k], 10);
                    (p < 100) && (p += (p > 29) ? 1900 : 2000)
                } else {
                    if (l == 0) {
                        l = r[k]
                    }
                }
            }
        }
    }
    if (p == 0) {
        p = o.getFullYear()
    }
    if (e != -1 && l != 0) {
        return new Date(p, e, l, s, f, 0)
    }
    return o
};
Date.prototype.getMonthDays = function (b) {
    var a = this.getFullYear();
    if (typeof b == "undefined") {
        b = this.getMonth()
    }
    if (((0 == (a % 4)) && ((0 != (a % 100)) || (0 == (a % 400)))) && b == 1) {
        return 29
    } else {
        return Date._MD[b]
    }
};
Date.prototype.getDayOfYear = function () {
    var a = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
    var c = new Date(this.getFullYear(), 0, 0, 0, 0, 0);
    var b = a - c;
    return Math.floor(b / Date.DAY)
};
Date.prototype.getWeekNumber = function () {
    var c = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
    var b = c.getDay();
    c.setDate(c.getDate() - (b + 6) % 7 + 3);
    var a = c.valueOf();
    c.setMonth(0);
    c.setDate(4);
    return Math.round((a - c.valueOf()) / (7 * 86400000)) + 1
};
Date.prototype.equalsTo = function (a) {
    return ((this.getFullYear() == a.getFullYear()) && (this.getMonth() == a.getMonth()) && (this.getDate() == a.getDate()) && (this.getHours() == a.getHours()) && (this.getMinutes() == a.getMinutes()))
};
Date.prototype.setDateOnly = function (a) {
    var b = new Date(a);
    this.setDate(1);
    this.setFullYear(b.getFullYear());
    this.setMonth(b.getMonth());
    this.setDate(b.getDate())
};
Date.prototype.print = function (n) {
    var b = this.getMonth();
    var l = this.getDate();
    var o = this.getFullYear();
    var q = this.getWeekNumber();
    var r = this.getDay();
    var x = {};
    var t = this.getHours();
    var c = (t >= 12);
    var j = (c) ? (t - 12) : t;
    var v = this.getDayOfYear();
    if (j == 0) {
        j = 12
    }
    var e = this.getMinutes();
    var k = this.getSeconds();
    x["%a"] = Calendar._SDN[r];
    x["%A"] = Calendar._DN[r];
    x["%b"] = Calendar._SMN[b];
    x["%B"] = Calendar._MN[b];
    x["%C"] = 1 + Math.floor(o / 100);
    x["%d"] = (l < 10) ? ("0" + l) : l;
    x["%e"] = l;
    x["%H"] = (t < 10) ? ("0" + t) : t;
    x["%I"] = (j < 10) ? ("0" + j) : j;
    x["%j"] = (v < 100) ? ((v < 10) ? ("00" + v) : ("0" + v)) : v;
    x["%k"] = t;
    x["%l"] = j;
    x["%m"] = (b < 9) ? ("0" + (1 + b)) : (1 + b);
    x["%M"] = (e < 10) ? ("0" + e) : e;
    x["%n"] = "\n";
    x["%p"] = c ? "PM" : "AM";
    x["%P"] = c ? "pm" : "am";
    x["%s"] = Math.floor(this.getTime() / 1000);
    x["%S"] = (k < 10) ? ("0" + k) : k;
    x["%t"] = "\t";
    x["%U"] = x["%W"] = x["%V"] = (q < 10) ? ("0" + q) : q;
    x["%u"] = r + 1;
    x["%w"] = r;
    x["%y"] = ("" + o).substr(2, 2);
    x["%Y"] = o;
    x["%%"] = "%";
    var u = /%./g;
    if (!Calendar.is_ie5 && !Calendar.is_khtml) {
        n = n.replace(u, function (a) {
            return x[a]
        });
        return n
    }
    var p = n.match(u);
    for (var g = 0; g < p.length; g++) {
        var f = x[p[g]];
        if (f) {
            u = new RegExp(p[g], "g");
            n = n.replace(u, f)
        }
    }
    return n
};
Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
Date.prototype.setFullYear = function (b) {
    var a = new Date(this);
    a.__msh_oldSetFullYear(b);
    if (a.getMonth() != this.getMonth()) {
        this.setDate(28)
    }
    this.__msh_oldSetFullYear(b)
};
window._dynarch_popupCalendar = null;
Calendar.setup = function (g) {
    function f(j, k) {
        if (typeof g[j] == "undefined") {
            g[j] = k
        }
    }
    f("inputField", null);
    f("displayArea", null);
    f("button", null);
    f("eventName", "click");
    f("ifFormat", "%Y/%m/%d");
    f("daFormat", "%Y/%m/%d");
    f("singleClick", true);
    f("disableFunc", null);
    f("dateStatusFunc", g.disableFunc);
    f("dateTooltipFunc", null);
    f("dateText", null);
    f("firstDay", null);
    f("align", "Br");
    f("range", [0, 2999]);
    f("weekNumbers", false);
    f("flat", null);
    f("flatCallback", null);
    f("onSelect", null);
    f("onClose", null);
    f("onUpdate", null);
    f("date", null);
    f("showsTime", false);
    f("timeFormat", "24");
    f("electric", true);
    f("step", 2);
    f("position", null);
    f("cache", false);
    f("showOthers", false);
    f("multiple", null);
    var c = ["inputField", "displayArea", "button"];
    for (var b in c) {
        if (typeof g[c[b]] == "string") {
            g[c[b]] = document.getElementById(g[c[b]])
        }
    }
    if (!(g.flat || g.multiple || g.inputField || g.displayArea || g.button)) {
        alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");
        return false
    }
    function a(k) {
        var j = k.params;
        var l = (k.dateClicked || j.electric);
        if (l && j.inputField) {
            j.inputField.value = k.date.print(j.ifFormat);
            if (typeof j.inputField.onchange == "function") {
                j.inputField.onchange()
            }
        }
        if (l && j.displayArea) {
            j.displayArea.innerHTML = k.date.print(j.daFormat)
        }
        if (l && typeof j.onUpdate == "function") {
            j.onUpdate(k)
        }
        if (l && j.flat) {
            if (typeof j.flatCallback == "function") {
                j.flatCallback(k)
            }
        }
        if (l && j.singleClick && k.dateClicked) {
            k.callCloseHandler()
        }
    }
    if (g.flat != null) {
        if (typeof g.flat == "string") {
            g.flat = document.getElementById(g.flat)
        }
        if (!g.flat) {
            alert("Calendar.setup:\n  Flat specified but can't find parent.");
            return false
        }
        var e = new Calendar(g.firstDay, g.date, g.onSelect || a);
        e.setDateToolTipHandler(g.dateTooltipFunc);
        e.showsOtherMonths = g.showOthers;
        e.showsTime = g.showsTime;
        e.time24 = (g.timeFormat == "24");
        e.params = g;
        e.weekNumbers = g.weekNumbers;
        e.setRange(g.range[0], g.range[1]);
        e.setDateStatusHandler(g.dateStatusFunc);
        e.getDateText = g.dateText;
        if (g.ifFormat) {
            e.setDateFormat(g.ifFormat)
        }
        if (g.inputField && typeof g.inputField.value == "string") {
            e.parseDate(g.inputField.value)
        }
        e.create(g.flat);
        e.show();
        return false
    }
    var d = g.button || g.displayArea || g.inputField;
    d["on" + g.eventName] = function () {
        var j = g.inputField || g.displayArea;
        var l = g.inputField ? g.ifFormat : g.daFormat;
        var p = false;
        var n = window.calendar;
        if (j) {
            g.date = Date.parseDate(j.value || j.innerHTML, l)
        }
        if (!(n && g.cache)) {
            window.calendar = n = new Calendar(g.firstDay, g.date, g.onSelect || a, g.onClose ||
            function (q) {
                q.hide()
            });
            n.setDateToolTipHandler(g.dateTooltipFunc);
            n.showsTime = g.showsTime;
            n.time24 = (g.timeFormat == "24");
            n.weekNumbers = g.weekNumbers;
            p = true
        } else {
            if (g.date) {
                n.setDate(g.date)
            }
            n.hide()
        }
        if (g.multiple) {
            n.multiple = {};
            for (var k = g.multiple.length; --k >= 0;) {
                var o = g.multiple[k];
                var m = o.print("%Y%m%d");
                n.multiple[m] = o
            }
        }
        n.showsOtherMonths = g.showOthers;
        n.yearStep = g.step;
        n.setRange(g.range[0], g.range[1]);
        n.params = g;
        n.setDateStatusHandler(g.dateStatusFunc);
        n.getDateText = g.dateText;
        n.setDateFormat(l);
        if (p) {
            n.create()
        }
        n.refresh();
        if (!g.position) {
            n.showAtElement(g.button || g.displayArea || g.inputField, g.align)
        } else {
            n.showAt(g.position[0], g.position[1])
        }
        return false
    };
    return e
};
Calendar._DN = new Array("Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado", "Domingo");
Calendar._SDN = new Array("Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb", "Dom");
Calendar._FD = 1;
Calendar._MN = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
Calendar._SMN = new Array("Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic");
Calendar._TT = {};
Calendar._TT.INFO = "Acerca del calendario";
Calendar._TT.ABOUT = "Selector DHTML de Fecha/Hora\n(c) dynarch.com 2002-2005 / Author: Mihai Bazon\nPara conseguir la última versión visite: http://www.dynarch.com/projects/calendar/\nDistribuido bajo licencia GNU LGPL. Visite http://gnu.org/licenses/lgpl.html para más detalles.\n\nSelecci�n de fecha:\n- Use los botones \xab, \xbb para seleccionar el a�o\n- Use los botones " + String.fromCharCode(8249) + ", " + String.fromCharCode(8250) + " para seleccionar el mes\n- Mantenga pulsado el rat�n en cualquiera de estos botones para una selecci�n r�pida.";
Calendar._TT.ABOUT_TIME = "\n\nSelección de hora:\n- Pulse en cualquiera de las partes de la hora para incrementarla\n- o pulse las mayúsculas mientras hace clic para decrementarla\n- o haga clic y arrastre el ratón para una selección más rápida.";
Calendar._TT.PREV_YEAR = "Año anterior (mantener para menú)";
Calendar._TT.PREV_MONTH = "Mes anterior (mantener para menú)";
Calendar._TT.GO_TODAY = "Ir a hoy";
Calendar._TT.NEXT_MONTH = "Mes siguiente (mantener para men�)";
Calendar._TT.NEXT_YEAR = "A�o siguiente (mantener para men�)";
Calendar._TT.SEL_DATE = "Seleccionar fecha";
Calendar._TT.DRAG_TO_MOVE = "Arrastrar para mover";
Calendar._TT.PART_TODAY = " (hoy)";
Calendar._TT.DAY_FIRST = "Hacer %s primer d�a de la semana";
Calendar._TT.WEEKEND = "0,6";
Calendar._TT.CLOSE = "Cerrar";
Calendar._TT.TODAY = "Hoy";
Calendar._TT.TIME_PART = "(May�scula-)Clic o arrastre para cambiar valor";
Calendar._TT.DEF_DATE_FORMAT = "%d/%m/%Y";
Calendar._TT.TT_DATE_FORMAT = "%A, %e de %B de %Y";
Calendar._TT.WK = "sem";
Calendar._TT.TIME = "Hora:";
