MooTools.More = { version: "1.2.4.2", build: "bd5a93c0913cce25917c48cbdacde568e15e02ef" }; (function () { var d = { language: "en-US", languages: { "en-US": {} }, cascades: ["en-US"] }; var c; MooTools.lang = new Events(); $extend(MooTools.lang, { setLanguage: function (a) { if (!d.languages[a]) { return this } d.language = a; this.load(); this.fireEvent("langChange", a); return this }, load: function () { var a = this.cascade(this.getCurrentLanguage()); c = {}; $each(a, function (b, f) { c[f] = this.lambda(b) }, this) }, getCurrentLanguage: function () { return d.language }, addLanguage: function (a) { d.languages[a] = d.languages[a] || {}; return this }, cascade: function (a) { var f = (d.languages[a] || {}).cascades || []; f.combine(d.cascades); f.erase(a).push(a); var b = f.map(function (e) { return d.languages[e] }, this); return $merge.apply(this, b) }, lambda: function (a) { (a || {}).get = function (b, f) { return $lambda(a[b]).apply(this, $splat(f)) }; return a }, get: function (a, b, f) { if (c && c[a]) { return (b ? c[a].get(b, f) : c[a]) } }, set: function (b, a, f) { this.addLanguage(b); langData = d.languages[b]; if (!langData[a]) { langData[a] = {} } $extend(langData[a], f); if (b == this.getCurrentLanguage()) { this.load(); this.fireEvent("langChange", b) } return this }, list: function () { return Hash.getKeys(d.languages) } }) })(); (function () { var f = this; var d = function () { if (f.console && console.log) { try { console.log.apply(console, arguments) } catch (a) { console.log(Array.slice(arguments)) } } else { Log.logged.push(arguments) } return this }; var e = function () { this.logged.push(arguments); return this }; this.Log = new Class({ logged: [], log: e, resetLog: function () { this.logged.empty(); return this }, enableLog: function () { this.log = d; this.logged.each(function (a) { this.log.apply(this, a) }, this); return this.resetLog() }, disableLog: function () { this.log = e; return this } }); Log.extend(new Log).enableLog(); Log.logger = function () { return this.log.apply(this, arguments) } })(); var Depender = { options: { loadedSources: [], loadedScripts: ["Core", "Browser", "Array", "String", "Function", "Number", "Hash", "Element", "Event", "Element.Event", "Class", "DomReady", "Class.Extras", "Request", "JSON", "Request.JSON", "More", "Depender", "Log"], useScriptInjection: true }, loaded: [], sources: {}, libs: {}, include: function (c) { this.log("include: ", c); this.mapLoaded = false; var d = function (a) { this.libs = $merge(this.libs, a); $each(this.libs, function (f, b) { if (f.scripts) { this.loadSource(b, f.scripts) } }, this) } .bind(this); if ($type(c) == "string") { this.log("fetching libs ", c); this.request(c, d) } else { d(c) } return this }, required: [], require: function (c) { var d = function () { var a = this.calculateDependencies(c.scripts); if (c.sources) { c.sources.each(function (b) { a.combine(this.libs[b].files) }, this) } if (c.serial) { a.combine(this.getLoadedScripts()) } c.scripts = a; this.required.push(c); this.fireEvent("require", c); this.loadScripts(c.scripts) }; if (this.mapLoaded) { d.call(this) } else { this.addEvent("mapLoaded", function () { d.call(this); this.removeEvent("mapLoaded", arguments.callee) }) } return this }, cleanDoubleSlash: function (c) { if (!c) { return c } var d = ""; if (c.test(/^http:\/\//)) { d = "http://"; c = c.substring(7, c.length) } c = c.replace(/\/\//g, "/"); return d + c }, request: function (d, c) { new Request.JSON({ url: d, secure: false, onSuccess: c }).send() }, loadSource: function (c, d) { if (this.libs[c].files) { this.dataLoaded(); return } this.log("loading source: ", d); this.request(this.cleanDoubleSlash(d + "/scripts.json"), function (a) { this.log("loaded source: ", d); this.libs[c].files = a; this.dataLoaded() } .bind(this)) }, dataLoaded: function () { var b = true; $each(this.libs, function (d, a) { if (!this.libs[a].files) { b = false } }, this); if (b) { this.mapTree(); this.mapLoaded = true; this.calculateLoaded(); this.lastLoaded = this.getLoadedScripts().getLength(); this.fireEvent("mapLoaded") } }, calculateLoaded: function () { var b = function (a) { this.scriptsState[a] = true } .bind(this); if (this.options.loadedScripts) { this.options.loadedScripts.each(b) } if (this.options.loadedSources) { this.options.loadedSources.each(function (a) { $each(this.libs[a].files, function (d) { $each(d, function (c, f) { b(f) }, this) }, this) }, this) } }, deps: {}, pathMap: {}, mapTree: function () { $each(this.libs, function (c, d) { $each(c.files, function (b, a) { $each(b, function (i, j) { var h = d + ":" + a + ":" + j; if (this.deps[h]) { return } this.deps[h] = i.deps; this.pathMap[j] = h }, this) }, this) }, this) }, getDepsForScript: function (b) { return this.deps[this.pathMap[b]] || [] }, calculateDependencies: function (d) { var c = []; $splat(d).each(function (b) { if (b == "None" || !b) { return } var a = this.getDepsForScript(b); if (!a) { if (window.console && console.warn) { console.warn("dependencies not mapped: script: %o, map: %o, :deps: %o", b, this.pathMap, this.deps) } } else { a.each(function (f) { if (f == b || f == "None" || !f) { return } if (!c.contains(f)) { c.combine(this.calculateDependencies(f)) } c.include(f) }, this) } c.include(b) }, this); return c }, getPath: function (g) { try { var h = this.pathMap[g].split(":"); var i = this.libs[h[0]]; var e = (i.path || i.scripts) + "/"; h.shift(); return this.cleanDoubleSlash(e + h.join("/") + ".js") } catch (j) { return g } }, loadScripts: function (b) { b = b.filter(function (a) { if (!this.scriptsState[a] && a != "None") { this.scriptsState[a] = false; return true } }, this); if (b.length) { b.each(function (a) { this.loadScript(a) }, this) } else { this.check() } }, toLoad: [], loadScript: function (f) { if (this.scriptsState[f] && this.toLoad.length) { this.loadScript(this.toLoad.shift()); return } else { if (this.loading) { this.toLoad.push(f); return } } var h = function () { this.loading = false; this.scriptLoaded(f); if (this.toLoad.length) { this.loadScript(this.toLoad.shift()) } } .bind(this); var i = function () { this.log("could not load: ", g) } .bind(this); this.loading = true; var g = this.getPath(f); if (this.options.useScriptInjection) { this.log("injecting script: ", g); var j = function () { this.log("loaded script: ", g); h() } .bind(this); new Element("script", { src: g + (this.options.noCache ? "?noCache=" + new Date().getTime() : ""), events: { load: j, readystatechange: function () { if (["loaded", "complete"].contains(this.readyState)) { j() } }, error: i} }).inject(this.options.target || document.head) } else { this.log("requesting script: ", g); new Request({ url: g, noCache: this.options.noCache, onComplete: function (a) { this.log("loaded script: ", g); $exec(a); h() } .bind(this), onFailure: i, onException: i }).send() } }, scriptsState: $H(), getLoadedScripts: function () { return this.scriptsState.filter(function (b) { return b }) }, scriptLoaded: function (f) { this.log("loaded script: ", f); this.scriptsState[f] = true; this.check(); var e = this.getLoadedScripts(); var g = e.getLength(); var h = this.scriptsState.getLength(); this.fireEvent("scriptLoaded", { script: f, totalLoaded: (g / h * 100).round(), currentLoaded: ((g - this.lastLoaded) / (h - this.lastLoaded) * 100).round(), loaded: e }); if (g == h) { this.lastLoaded = g } }, lastLoaded: 0, check: function () { var b = []; this.required.each(function (d) { var a = []; d.scripts.each(function (c) { if (this.scriptsState[c]) { a.push(c) } }, this); if (d.onStep) { d.onStep({ percent: a.length / d.scripts.length * 100, scripts: a }) } if (d.scripts.length != a.length) { return } d.callback(); this.required.erase(d); this.fireEvent("requirementLoaded", [a, d]) }, this) } }; $extend(Depender, new Events); $extend(Depender, new Options); $extend(Depender, new Log); Depender._setOptions = Depender.setOptions; Depender.setOptions = function () { Depender._setOptions.apply(Depender, arguments); if (this.options.log) { Depender.enableLog() } return this }; Class.refactor = function (c, d) { $each(d, function (a, b) { var f = c.prototype[b]; if (f && (f = f._origin) && typeof a == "function") { c.implement(b, function () { var h = this.previous; this.previous = f; var e = a.apply(this, arguments); this.previous = h; return e }) } else { c.implement(b, a) } }); return c }; Class.Mutators.Binds = function (b) { return b }; Class.Mutators.initialize = function (b) { return function () { $splat(this.Binds).each(function (a) { var d = this[a]; if (d) { this[a] = d.bind(this) } }, this); return b.apply(this, arguments) } }; Class.Occlude = new Class({ occlude: function (f, d) { d = document.id(d || this.element); var e = d.retrieve(f || this.property); if (e && !$defined(this.occluded)) { return this.occluded = e } this.occluded = false; d.store(f || this.property, this); return this.occluded } }); (function () { var b = { wait: function (a) { return this.chain(function () { this.callChain.delay($pick(a, 500), this) } .bind(this)) } }; Chain.implement(b); if (window.Fx) { Fx.implement(b); ["Css", "Tween", "Elements"].each(function (a) { if (Fx[a]) { Fx[a].implement(b) } }) } Element.implement({ chains: function (a) { $splat($pick(a, ["tween", "morph", "reveal"])).each(function (d) { d = this.get(d); if (!d) { return } d.setOptions({ link: "chain" }) }, this); return this }, pauseFx: function (d, a) { this.chains(a).get($pick(a, "tween")).wait(d); return this } }) })(); Array.implement({ min: function () { return Math.min.apply(null, this) }, max: function () { return Math.max.apply(null, this) }, average: function () { return this.length ? this.sum() / this.length : 0 }, sum: function () { var d = 0, c = this.length; if (c) { do { d += this[--c] } while (c) } return d }, unique: function () { return [].combine(this) } }); (function () { var v = this.Date; if (!v.now) { v.now = $time } v.Methods = { ms: "Milliseconds", year: "FullYear", min: "Minutes", mo: "Month", sec: "Seconds", hr: "Hours" }; ["Date", "Day", "FullYear", "Hours", "Milliseconds", "Minutes", "Month", "Seconds", "Time", "TimezoneOffset", "Week", "Timezone", "GMTOffset", "DayOfYear", "LastMonth", "LastDayOfMonth", "UTCDate", "UTCDay", "UTCFullYear", "AMPM", "Ordinal", "UTCHours", "UTCMilliseconds", "UTCMinutes", "UTCMonth", "UTCSeconds"].each(function (a) { v.Methods[a.toLowerCase()] = a }); var A = function (a, b) { return new Array(b - String(a).length + 1).join("0") + a }; v.implement({ set: function (a, c) { switch ($type(a)) { case "object": for (var b in a) { this.set(b, a[b]) } break; case "string": a = a.toLowerCase(); var d = v.Methods; if (d[a]) { this["set" + d[a]](c) } } return this }, get: function (a) { a = a.toLowerCase(); var b = v.Methods; if (b[a]) { return this["get" + b[a]]() } return null }, clone: function () { return new v(this.get("time")) }, increment: function (c, a) { c = c || "day"; a = $pick(a, 1); switch (c) { case "year": return this.increment("month", a * 12); case "month": var b = this.get("date"); this.set("date", 1).set("mo", this.get("mo") + a); return this.set("date", b.min(this.get("lastdayofmonth"))); case "week": return this.increment("day", a * 7); case "day": return this.set("date", this.get("date") + a) } if (!v.units[c]) { throw new Error(c + " is not a supported interval") } return this.set("time", this.get("time") + a * v.units[c]()) }, decrement: function (b, a) { return this.increment(b, -1 * $pick(a, 1)) }, isLeapYear: function () { return v.isLeapYear(this.get("year")) }, clearTime: function () { return this.set({ hr: 0, min: 0, sec: 0, ms: 0 }) }, diff: function (a, b) { if ($type(a) == "string") { a = v.parse(a) } return ((a - this) / v.units[b || "day"](3, 3)).toInt() }, getLastDayOfMonth: function () { return v.daysInMonth(this.get("mo"), this.get("year")) }, getDayOfYear: function () { return (v.UTC(this.get("year"), this.get("mo"), this.get("date") + 1) - v.UTC(this.get("year"), 0, 1)) / v.units.day() }, getWeek: function () { return (this.get("dayofyear") / 7).ceil() }, getOrdinal: function (a) { return v.getMsg("ordinal", a || this.get("date")) }, getTimezone: function () { return this.toString().replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/, "$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3") }, getGMTOffset: function () { var a = this.get("timezoneOffset"); return ((a > 0) ? "-" : "+") + A((a.abs() / 60).floor(), 2) + A(a % 60, 2) }, setAMPM: function (b) { b = b.toUpperCase(); var a = this.get("hr"); if (a > 11 && b == "AM") { return this.decrement("hour", 12) } else { if (a < 12 && b == "PM") { return this.increment("hour", 12) } } return this }, getAMPM: function () { return (this.get("hr") < 12) ? "AM" : "PM" }, parse: function (a) { this.set("time", v.parse(a)); return this }, isValid: function (a) { return !!(a || this).valueOf() }, format: function (b) { if (!this.isValid()) { return "invalid date" } b = b || "%x %X"; b = t[b.toLowerCase()] || b; var a = this; return b.replace(/%([a-z%])/gi, function (c, d) { switch (d) { case "a": return v.getMsg("days")[a.get("day")].substr(0, 3); case "A": return v.getMsg("days")[a.get("day")]; case "b": return v.getMsg("months")[a.get("month")].substr(0, 3); case "B": return v.getMsg("months")[a.get("month")]; case "c": return a.toString(); case "d": return A(a.get("date"), 2); case "H": return A(a.get("hr"), 2); case "I": return ((a.get("hr") % 12) || 12); case "j": return A(a.get("dayofyear"), 3); case "m": return A((a.get("mo") + 1), 2); case "M": return A(a.get("min"), 2); case "o": return a.get("ordinal"); case "p": return v.getMsg(a.get("ampm")); case "S": return A(a.get("seconds"), 2); case "U": return A(a.get("week"), 2); case "w": return a.get("day"); case "x": return a.format(v.getMsg("shortDate")); case "X": return a.format(v.getMsg("shortTime")); case "y": return a.get("year").toString().substr(2); case "Y": return a.get("year"); case "T": return a.get("GMTOffset"); case "Z": return a.get("Timezone") } return d }) }, toISOString: function () { return this.format("iso8601") } }); v.alias("toISOString", "toJSON"); v.alias("diff", "compare"); v.alias("format", "strftime"); var t = { db: "%Y-%m-%d %H:%M:%S", compact: "%Y%m%dT%H%M%S", iso8601: "%Y-%m-%dT%H:%M:%S%T", rfc822: "%a, %d %b %Y %H:%M:%S %Z", "short": "%d %b %H:%M", "long": "%B %d, %Y %H:%M" }; var x = []; var z = v.parse; var q = function (c, a, d) { var e = -1; var b = v.getMsg(c + "s"); switch ($type(a)) { case "object": e = b[a.get(c)]; break; case "number": e = b[month - 1]; if (!e) { throw new Error("Invalid " + c + " index: " + index) } break; case "string": var f = b.filter(function (g) { return this.test(g) }, new RegExp("^" + a, "i")); if (!f.length) { throw new Error("Invalid " + c + " string") } if (f.length > 1) { throw new Error("Ambiguous " + c) } e = f[0] } return (d) ? b.indexOf(e) : e }; v.extend({ getMsg: function (a, b) { return MooTools.lang.get("Date", a, b) }, units: { ms: $lambda(1), second: $lambda(1000), minute: $lambda(60000), hour: $lambda(3600000), day: $lambda(86400000), week: $lambda(608400000), month: function (b, c) { var a = new v; return v.daysInMonth($pick(b, a.get("mo")), $pick(c, a.get("year"))) * 86400000 }, year: function (a) { a = a || new v().get("year"); return v.isLeapYear(a) ? 31622400000 : 31536000000 } }, daysInMonth: function (a, b) { return [31, v.isLeapYear(b) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][a] }, isLeapYear: function (a) { return ((a % 4 === 0) && (a % 100 !== 0)) || (a % 400 === 0) }, parse: function (a) { var b = $type(a); if (b == "number") { return new v(a) } if (b != "string") { return a } a = a.clean(); if (!a.length) { return null } var c; x.some(function (d) { var e = d.re.exec(a); return (e) ? (c = d.handler(e)) : false }); return c || new v(z(a)) }, parseDay: function (b, a) { return q("day", b, a) }, parseMonth: function (a, b) { return q("month", a, b) }, parseUTC: function (b) { var c = new v(b); var a = v.UTC(c.get("year"), c.get("mo"), c.get("date"), c.get("hr"), c.get("min"), c.get("sec")); return new v(a) }, orderIndex: function (a) { return v.getMsg("dateOrder").indexOf(a) + 1 }, defineFormat: function (b, a) { t[b] = a }, defineFormats: function (b) { for (var a in b) { v.defineFormat(a, b[a]) } }, parsePatterns: x, defineParser: function (a) { x.push((a.re && a.handler) ? a : s(a)) }, defineParsers: function () { Array.flatten(arguments).each(v.defineParser) }, define2DigitYearStart: function (a) { w = a % 100; r = a - w } }); var r = 1900; var w = 70; var u = function (a) { return new RegExp("(?:" + v.getMsg(a).map(function (b) { return b.substr(0, 3) }).join("|") + ")[a-z]*") }; var D = function (a) { switch (a) { case "x": return ((v.orderIndex("month") == 1) ? "%m[.-/]%d" : "%d[.-/]%m") + "([.-/]%y)?"; case "X": return "%H([.:]%M)?([.:]%S([.:]%s)?)? ?%p? ?%T?" } return null }; var p = { d: /[0-2]?[0-9]|3[01]/, H: /[01]?[0-9]|2[0-3]/, I: /0?[1-9]|1[0-2]/, M: /[0-5]?\d/, s: /\d+/, o: /[a-z]*/, p: /[ap]\.?m\.?/, y: /\d{2}|\d{4}/, Y: /\d{4}/, T: /Z|[+-]\d{2}(?::?\d{2})?/ }; p.m = p.I; p.S = p.M; var B; var C = function (a) { B = a; p.a = p.A = u("days"); p.b = p.B = u("months"); x.each(function (b, c) { if (b.format) { x[c] = s(b.format) } }) }; var s = function (a) { if (!B) { return { format: a} } var c = []; var b = (a.source || a).replace(/%([a-z])/gi, function (d, e) { return D(e) || d }).replace(/\((?!\?)/g, "(?:").replace(/ (?!\?|\*)/g, ",? ").replace(/%([a-z%])/gi, function (e, f) { var d = p[f]; if (!d) { return f } c.push(f); return "(" + d.source + ")" }).replace(/\[a-z\]/gi, "[a-z\\u00c0-\\uffff]"); return { format: a, re: new RegExp("^" + b + "$", "i"), handler: function (d) { d = d.slice(1).associate(c); var f = new v().clearTime(); if ("d" in d) { y.call(f, "d", 1) } if ("m" in d) { y.call(f, "m", 1) } for (var e in d) { y.call(f, e, d[e]) } return f } } }; var y = function (c, b) { if (!b) { return this } switch (c) { case "a": case "A": return this.set("day", v.parseDay(b, true)); case "b": case "B": return this.set("mo", v.parseMonth(b, true)); case "d": return this.set("date", b); case "H": case "I": return this.set("hr", b); case "m": return this.set("mo", b - 1); case "M": return this.set("min", b); case "p": return this.set("ampm", b.replace(/\./g, "")); case "S": return this.set("sec", b); case "s": return this.set("ms", ("0." + b) * 1000); case "w": return this.set("day", b); case "Y": return this.set("year", b); case "y": b = +b; if (b < 100) { b += r + (b < w ? 100 : 0) } return this.set("year", b); case "T": if (b == "Z") { b = "+00" } var a = b.match(/([+-])(\d{2}):?(\d{2})?/); a = (a[1] + "1") * (a[2] * 60 + (+a[3] || 0)) + this.getTimezoneOffset(); return this.set("time", this - a * 60000) } return this }; v.defineParsers("%Y([-./]%m([-./]%d((T| )%X)?)?)?", "%Y%m%d(T%H(%M%S?)?)?", "%x( %X)?", "%d%o( %b( %Y)?)?( %X)?", "%b( %d%o)?( %Y)?( %X)?", "%Y %b( %d%o( %X)?)?", "%o %b %d %X %T %Y"); MooTools.lang.addEvent("langChange", function (a) { if (MooTools.lang.get("Date")) { C(a) } }).fireEvent("langChange", MooTools.lang.getCurrentLanguage()) })(); Date.implement({ timeDiffInWords: function (b) { return Date.distanceOfTimeInWords(this, b || new Date) }, timeDiff: function (j, h) { if (j == null) { j = new Date } var k = ((j - this) / 1000).toInt(); if (!k) { return "0s" } var i = { s: 60, m: 60, h: 24, d: 365, y: 0 }; var l, m = []; for (var n in i) { if (!k) { break } if ((l = i[n])) { m.unshift((k % l) + n); k = (k / l).toInt() } else { m.unshift(k + n) } } return m.join(h || ":") } }); Date.alias("timeDiffInWords", "timeAgoInWords"); Date.extend({ distanceOfTimeInWords: function (c, d) { return Date.getTimePhrase(((d - c) / 1000).toInt()) }, getTimePhrase: function (i) { var k = (i < 0) ? "Until" : "Ago"; if (i < 0) { i *= -1 } var g = { minute: 60, hour: 60, day: 24, week: 7, month: 52 / 12, year: 12, eon: Infinity }; var j = "lessThanMinute"; for (var l in g) { var h = g[l]; if (i < 1.5 * h) { if (i > 0.75 * h) { j = l } break } i /= h; j = l + "s" } return Date.getMsg(j + k).substitute({ delta: i.round() }) } }); Date.defineParsers({ re: /^(?:tod|tom|yes)/i, handler: function (d) { var c = new Date().clearTime(); switch (d[0]) { case "tom": return c.increment(); case "yes": return c.decrement(); default: return c } } }, { re: /^(next|last) ([a-z]+)$/i, handler: function (i) { var h = new Date().clearTime(); var d = h.getDay(); var j = Date.parseDay(i[2], true); var g = j - d; if (j <= d) { g += 7 } if (i[1] == "last") { g -= 7 } return h.set("date", h.getDate() + g) } }); Hash.implement({ getFromPath: function (d) { var c = this.getClean(); d.replace(/\[([^\]]+)\]|\.([^.[]+)|[^[.]+/g, function (b) { if (!c) { return null } var a = arguments[2] || arguments[1] || arguments[0]; c = (a in c) ? c[a] : null; return b }); return c }, cleanValues: function (b) { b = b || $defined; this.each(function (d, a) { if (!b(d)) { this.erase(a) } }, this); return this }, run: function () { var b = arguments; this.each(function (d, a) { if ($type(d) == "function") { d.run(b) } }) } }); (function () { var e = ["À", "à", "Á", "á", "Â", "â", "Ã", "ã", "Ä", "ä", "Å", "å", "Ă", "ă", "Ą", "ą", "Ć", "ć", "Č", "č", "Ç", "ç", "Ď", "ď", "Đ", "đ", "È", "è", "É", "é", "Ê", "ê", "Ë", "ë", "Ě", "ě", "Ę", "ę", "Ğ", "ğ", "Ì", "ì", "Í", "í", "Î", "î", "Ï", "ï", "Ĺ", "ĺ", "Ľ", "ľ", "Ł", "ł", "Ñ", "ñ", "Ň", "ň", "Ń", "ń", "Ò", "ò", "Ó", "ó", "Ô", "ô", "Õ", "õ", "Ö", "ö", "Ø", "ø", "ő", "Ř", "ř", "Ŕ", "ŕ", "Š", "š", "Ş", "ş", "Ś", "ś", "Ť", "ť", "Ť", "ť", "Ţ", "ţ", "Ù", "ù", "Ú", "ú", "Û", "û", "Ü", "ü", "Ů", "ů", "Ÿ", "ÿ", "ý", "Ý", "Ž", "ž", "Ź", "ź", "Ż", "ż", "Þ", "þ", "Ð", "ð", "ß", "Œ", "œ", "Æ", "æ", "µ"]; var f = ["A", "a", "A", "a", "A", "a", "A", "a", "Ae", "ae", "A", "a", "A", "a", "A", "a", "C", "c", "C", "c", "C", "c", "D", "d", "D", "d", "E", "e", "E", "e", "E", "e", "E", "e", "E", "e", "E", "e", "G", "g", "I", "i", "I", "i", "I", "i", "I", "i", "L", "l", "L", "l", "L", "l", "N", "n", "N", "n", "N", "n", "O", "o", "O", "o", "O", "o", "O", "o", "Oe", "oe", "O", "o", "o", "R", "r", "R", "r", "S", "s", "S", "s", "S", "s", "T", "t", "T", "t", "T", "t", "U", "u", "U", "u", "U", "u", "Ue", "ue", "U", "u", "Y", "y", "Y", "y", "Z", "z", "Z", "z", "Z", "z", "TH", "th", "DH", "dh", "ss", "OE", "oe", "AE", "ae", "u"]; var g = { "[\xa0\u2002\u2003\u2009]": " ", "\xb7": "*", "[\u2018\u2019]": "'", "[\u201c\u201d]": '"', "\u2026": "...", "\u2013": "-", "\u2014": "--", "\uFFFD": "&raquo;" }; var h = function (c, b) { c = c || ""; var a = b ? "<" + c + "[^>]*>([\\s\\S]*?)</" + c + ">" : "</?" + c + "([^>]+)?>"; reg = new RegExp(a, "gi"); return reg }; String.implement({ standardize: function () { var a = this; e.each(function (b, c) { a = a.replace(new RegExp(b, "g"), f[c]) }); return a }, repeat: function (a) { return new Array(a + 1).join(this) }, pad: function (c, a, d) { if (this.length >= c) { return this } var b = (a == null ? " " : "" + a).repeat(c - this.length).substr(0, c - this.length); if (!d || d == "right") { return this + b } if (d == "left") { return b + this } return b.substr(0, (b.length / 2).floor()) + this + b.substr(0, (b.length / 2).ceil()) }, getTags: function (b, a) { return this.match(h(b, a)) || [] }, stripTags: function (b, a) { return this.replace(h(b, a), "") }, tidy: function () { var a = this.toString(); $each(g, function (b, c) { a = a.replace(new RegExp(c, "g"), b) }); return a } }) })(); String.implement({ parseQueryString: function () { var c = this.split(/[&;]/), d = {}; if (c.length) { c.each(function (a) { var j = a.indexOf("="), i = j < 0 ? [""] : a.substr(0, j).match(/[^\]\[]+/g), h = decodeURIComponent(a.substr(j + 1)), b = d; i.each(function (f, g) { var e = b[f]; if (g < i.length - 1) { b = b[f] = e || {} } else { if ($type(e) == "array") { e.push(h) } else { b[f] = $defined(e) ? [e, h] : h } } }) }) } return d }, cleanQueryString: function (b) { return this.split("&").filter(function (f) { var a = f.indexOf("="), h = a < 0 ? "" : f.substr(0, a), g = f.substr(a + 1); return b ? b.run([h, g]) : $chk(g) }).join("&") } }); var URI = new Class({ Implements: Options, options: {}, regex: /^(?:(\w+):)?(?:\/\/(?:(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/, parts: ["scheme", "user", "password", "host", "port", "directory", "file", "query", "fragment"], schemes: { http: 80, https: 443, ftp: 21, rtsp: 554, mms: 1755, file: 0 }, initialize: function (d, e) { this.setOptions(e); var f = this.options.base || URI.base; if (!d) { d = f } if (d && d.parsed) { this.parsed = $unlink(d.parsed) } else { this.set("value", d.href || d.toString(), f ? new URI(f) : false) } }, parse: function (f, d) { var e = f.match(this.regex); if (!e) { return false } e.shift(); return this.merge(e.associate(this.parts), d) }, merge: function (c, d) { if ((!c || !c.scheme) && (!d || !d.scheme)) { return false } if (d) { this.parts.every(function (a) { if (c[a]) { return false } c[a] = d[a] || ""; return true }) } c.port = c.port || this.schemes[c.scheme.toLowerCase()]; c.directory = c.directory ? this.parseDirectory(c.directory, d ? d.directory : "") : "/"; return c }, parseDirectory: function (d, f) { d = (d.substr(0, 1) == "/" ? "" : (f || "/")) + d; if (!d.test(URI.regs.directoryDot)) { return d } var e = []; d.replace(URI.regs.endSlash, "").split("/").each(function (a) { if (a == ".." && e.length > 0) { e.pop() } else { if (a != ".") { e.push(a) } } }); return e.join("/") + "/" }, combine: function (b) { return b.value || b.scheme + "://" + (b.user ? b.user + (b.password ? ":" + b.password : "") + "@" : "") + (b.host || "") + (b.port && b.port != this.schemes[b.scheme] ? ":" + b.port : "") + (b.directory || "/") + (b.file || "") + (b.query ? "?" + b.query : "") + (b.fragment ? "#" + b.fragment : "") }, set: function (e, g, h) { if (e == "value") { var f = g.match(URI.regs.scheme); if (f) { f = f[1] } if (f && !$defined(this.schemes[f.toLowerCase()])) { this.parsed = { scheme: f, value: g} } else { this.parsed = this.parse(g, (h || this).parsed) || (f ? { scheme: f, value: g} : { value: g }) } } else { if (e == "data") { this.setData(g) } else { this.parsed[e] = g } } return this }, get: function (d, c) { switch (d) { case "value": return this.combine(this.parsed, c ? c.parsed : false); case "data": return this.getData() } return this.parsed[d] || "" }, go: function () { document.location.href = this.toString() }, toURI: function () { return this }, getData: function (h, e) { var f = this.get(e || "query"); if (!$chk(f)) { return h ? null : {} } var g = f.parseQueryString(); return h ? g[h] : g }, setData: function (e, f, d) { if (typeof e == "string") { e = this.getData(); e[arguments[0]] = arguments[1] } else { if (f) { e = $merge(this.getData(), e) } } return this.set(d || "query", Hash.toQueryString(e)) }, clearData: function (b) { return this.set(b || "query", "") } }); URI.prototype.toString = URI.prototype.valueOf = function () { return this.get("value") }; URI.regs = { endSlash: /\/$/, scheme: /^(\w+):/, directoryDot: /\.\/|\.$/ }; URI.base = new URI(document.getElements("base[href]", true).getLast(), { base: document.location }); String.implement({ toURI: function (b) { return new URI(this, b) } }); URI = Class.refactor(URI, { combine: function (m, n) { if (!n || m.scheme != n.scheme || m.host != n.host || m.port != n.port) { return this.previous.apply(this, arguments) } var j = m.file + (m.query ? "?" + m.query : "") + (m.fragment ? "#" + m.fragment : ""); if (!n.directory) { return (m.directory || (m.file ? "" : "./")) + j } var o = n.directory.split("/"), p = m.directory.split("/"), l = "", k; var i = 0; for (k = 0; k < o.length && k < p.length && o[k] == p[k]; k++) { } for (i = 0; i < o.length - k - 1; i++) { l += "../" } for (i = k; i < p.length - 1; i++) { l += p[i] + "/" } return (l || (m.file ? "" : "./")) + j }, toAbsolute: function (b) { b = new URI(b); if (b) { b.set("directory", "").set("file", "") } return this.toRelative(b) }, toRelative: function (b) { return this.get("value", new URI(b)) } }); Element.implement({ tidy: function () { this.set("value", this.get("value").tidy()) }, getTextInRange: function (c, d) { return this.get("value").substring(c, d) }, getSelectedText: function () { if (this.setSelectionRange) { return this.getTextInRange(this.getSelectionStart(), this.getSelectionEnd()) } return document.selection.createRange().text }, getSelectedRange: function () { if ($defined(this.selectionStart)) { return { start: this.selectionStart, end: this.selectionEnd} } var h = { start: 0, end: 0 }; var g = this.getDocument().selection.createRange(); if (!g || g.parentElement() != this) { return h } var j = g.duplicate(); if (this.type == "text") { h.start = 0 - j.moveStart("character", -100000); h.end = h.start + g.text.length } else { var f = this.get("value"); var i = f.length; j.moveToElementText(this); j.setEndPoint("StartToEnd", g); if (j.text.length) { i -= f.match(/[\n\r]*$/)[0].length } h.end = i - j.text.length; j.setEndPoint("StartToStart", g); h.start = i - j.text.length } return h }, getSelectionStart: function () { return this.getSelectedRange().start }, getSelectionEnd: function () { return this.getSelectedRange().end }, setCaretPosition: function (b) { if (b == "end") { b = this.get("value").length } this.selectRange(b, b); return this }, getCaretPosition: function () { return this.getSelectedRange().start }, selectRange: function (h, g) { if (this.setSelectionRange) { this.focus(); this.setSelectionRange(h, g) } else { var j = this.get("value"); var i = j.substr(h, g - h).replace(/\r/g, "").length; h = j.substr(0, h).replace(/\r/g, "").length; var f = this.createTextRange(); f.collapse(true); f.moveEnd("character", h + i); f.moveStart("character", h); f.select() } return this }, insertAtCursor: function (e, f) { var g = this.getSelectedRange(); var h = this.get("value"); this.set("value", h.substring(0, g.start) + e + h.substring(g.end, h.length)); if ($pick(f, true)) { this.selectRange(g.start, g.start + e.length) } else { this.setCaretPosition(g.start + e.length) } return this }, insertAroundCursor: function (h, i) { h = $extend({ before: "", defaultMiddle: "", after: "" }, h); var n = this.getSelectedText() || h.defaultMiddle; var j = this.getSelectedRange(); var k = this.get("value"); if (j.start == j.end) { this.set("value", k.substring(0, j.start) + h.before + n + h.after + k.substring(j.end, k.length)); this.selectRange(j.start + h.before.length, j.end + h.before.length + n.length) } else { var m = k.substring(j.start, j.end); this.set("value", k.substring(0, j.start) + h.before + m + h.after + k.substring(j.end, k.length)); var l = j.start + h.before.length; if ($pick(i, true)) { this.selectRange(l, l + m.length) } else { this.setCaretPosition(l + k.length) } } return this } }); Elements.from = function (h, i) { if ($pick(i, true)) { h = h.stripScripts() } var f, j = h.match(/^\s*<(t[dhr]|tbody|tfoot|thead)/i); if (j) { f = new Element("table"); var g = j[1].toLowerCase(); if (["td", "th", "tr"].contains(g)) { f = new Element("tbody").inject(f); if (g != "tr") { f = new Element("tr").inject(f) } } } return (f || new Element("div")).set("html", h).getChildren() }; (function () { var k = /(.*?):relay\(([^)]+)\)$/, l = /[+>~\s]/, i = function (b) { var a = b.match(k); return !a ? { event: b} : { event: a[1], selector: a[2]} }, g = function (a, f) { var c = a.target; if (l.test(f = f.trim())) { var d = this.getElements(f); for (var e = d.length; e--; ) { var b = d[e]; if (c == b || b.hasChild(c)) { return b } } } else { for (; c && c != this; c = c.parentNode) { if (Element.match(c, f)) { return document.id(c) } } } return null }; var h = Element.prototype.addEvent, j = Element.prototype.removeEvent; Element.implement({ addEvent: function (b, c) { var a = i(b); if (a.selector) { var d = this.retrieve("$moo:delegateMonitors", {}); if (!d[b]) { var e = function (f) { var n = g.call(this, f, a.selector); if (n) { this.fireEvent(b, [f, n], 0, n) } } .bind(this); d[b] = e; h.call(this, a.event, e) } } return h.apply(this, arguments) }, removeEvent: function (b, c) { var a = i(b); if (a.selector) { var d = this.retrieve("events"); if (!d || !d[b] || (c && !d[b].keys.contains(c))) { return this } if (c) { j.apply(this, [b, c]) } else { j.apply(this, b) } d = this.retrieve("events"); if (d && d[b] && d[b].length == 0) { var e = this.retrieve("$moo:delegateMonitors", {}); j.apply(this, [a.event, e[b]]); delete e[b] } return this } return j.apply(this, arguments) }, fireEvent: function (b, d, e, a) { var c = this.retrieve("events"); if (!c || !c[b]) { return this } c[b].keys.each(function (f) { f.create({ bind: a || this, delay: e, arguments: d })() }, this); return this } }) })(); Element.implement({ measure: function (l) { var j = function (a) { return !!(!a || a.offsetHeight || a.offsetWidth) }; if (j(this)) { return l.apply(this) } var m = this.getParent(), k = [], h = []; while (!j(m) && m != document.body) { h.push(m.expose()); m = m.getParent() } var n = this.expose(); var i = l.apply(this); n(); h.each(function (a) { a() }); return i }, expose: function () { if (this.getStyle("display") != "none") { return $empty } var b = this.style.cssText; this.setStyles({ display: "block", position: "absolute", visibility: "hidden" }); return function () { this.style.cssText = b } .bind(this) }, getDimensions: function (g) { g = $merge({ computeSize: false }, g); var h = {}; var i = function (a, b) { return (b.computeSize) ? a.getComputedSize(b) : a.getSize() }; var e = this.getParent("body"); if (e && this.getStyle("display") == "none") { h = this.measure(function () { return i(this, g) }) } else { if (e) { try { h = i(this, g) } catch (j) { } } else { h = { x: 0, y: 0} } } return $chk(h.x) ? $extend(h, { width: h.x, height: h.y }) : $extend(h, { x: h.width, y: h.height }) }, getComputedSize: function (g) { g = $merge({ styles: ["padding", "border"], plains: { height: ["top", "bottom"], width: ["left", "right"] }, mode: "both" }, g); var j = { width: 0, height: 0 }; switch (g.mode) { case "vertical": delete j.width; delete g.plains.width; break; case "horizontal": delete j.height; delete g.plains.height; break } var f = []; $each(g.plains, function (a, b) { a.each(function (c) { g.styles.each(function (d) { f.push((d == "border") ? d + "-" + c + "-width" : d + "-" + c) }) }) }); var h = {}; f.each(function (a) { h[a] = this.getComputedStyle(a) }, this); var i = []; $each(g.plains, function (b, c) { var a = c.capitalize(); j["total" + a] = j["computed" + a] = 0; b.each(function (d) { j["computed" + d.capitalize()] = 0; f.each(function (e, l) { if (e.test(d)) { h[e] = h[e].toInt() || 0; j["total" + a] = j["total" + a] + h[e]; j["computed" + d.capitalize()] = j["computed" + d.capitalize()] + h[e] } if (e.test(d) && c != e && (e.test("border") || e.test("padding")) && !i.contains(e)) { i.push(e); j["computed" + a] = j["computed" + a] - h[e] } }) }) }); ["Width", "Height"].each(function (a) { var b = a.toLowerCase(); if (!$chk(j[b])) { return } j[b] = j[b] + this["offset" + a] + j["computed" + a]; j["total" + a] = j[b] + j["total" + a]; delete j["computed" + a] }, this); return $extend(h, j) } }); (function () { var b = false; window.addEvent("domready", function () { var a = new Element("div").setStyles({ position: "fixed", top: 0, right: 0 }).inject(document.body); b = (a.offsetTop === 0); a.dispose() }); Element.implement({ pin: function (m) { if (this.getStyle("display") == "none") { return null } var k, a = window.getScroll(); if (m !== false) { k = this.getPosition(); if (!this.retrieve("pinned")) { var i = { top: k.y - a.y, left: k.x - a.x }; if (b) { this.setStyle("position", "fixed").setStyles(i) } else { this.store("pinnedByJS", true); this.setStyles({ position: "absolute", top: k.y, left: k.x }).addClass("isPinned"); this.store("scrollFixer", (function () { if (this.retrieve("pinned")) { var c = window.getScroll() } this.setStyles({ top: i.top.toInt() + c.y, left: i.left.toInt() + c.x }) }).bind(this)); window.addEvent("scroll", this.retrieve("scrollFixer")) } this.store("pinned", true) } } else { var j; if (!Browser.Engine.trident) { var l = this.getParent(); j = (l.getComputedStyle("position") != "static" ? l : l.getOffsetParent()) } k = this.getPosition(j); this.store("pinned", false); var n; if (b && !this.retrieve("pinnedByJS")) { n = { top: k.y + a.y, left: k.x + a.x} } else { this.store("pinnedByJS", false); window.removeEvent("scroll", this.retrieve("scrollFixer")); n = { top: k.y, left: k.x} } this.setStyles($merge(n, { position: "absolute" })).removeClass("isPinned") } return this }, unpin: function () { return this.pin(false) }, togglepin: function () { this.pin(!this.retrieve("pinned")) } }) })(); (function () { var b = Element.prototype.position; Element.implement({ position: function (F) { if (F && ($defined(F.x) || $defined(F.y))) { return b ? b.apply(this, arguments) : this } $each(F || {}, function (c, d) { if (!$defined(c)) { delete F[d] } }); F = $merge({ relativeTo: document.body, position: { x: "center", y: "center" }, edge: false, offset: { x: 0, y: 0 }, returnPos: false, relFixedPosition: false, ignoreMargins: false, ignoreScroll: false, allowNegative: false }, F); var u = { x: 0, y: 0 }, H = false; var K = this.measure(function () { return document.id(this.getOffsetParent()) }); if (K && K != this.getDocument().body) { u = K.measure(function () { return this.getPosition() }); H = K != document.id(F.relativeTo); F.offset.x = F.offset.x - u.x; F.offset.y = F.offset.y - u.y } var a = function (d) { if ($type(d) != "string") { return d } d = d.toLowerCase(); var c = {}; if (d.test("left")) { c.x = "left" } else { if (d.test("right")) { c.x = "right" } else { c.x = "center" } } if (d.test("upper") || d.test("top")) { c.y = "top" } else { if (d.test("bottom")) { c.y = "bottom" } else { c.y = "center" } } return c }; F.edge = a(F.edge); F.position = a(F.position); if (!F.edge) { if (F.position.x == "center" && F.position.y == "center") { F.edge = { x: "center", y: "center"} } else { F.edge = { x: "left", y: "top"} } } this.setStyle("position", "absolute"); var G = document.id(F.relativeTo) || document.body, J = G == document.body ? window.getScroll() : G.getPosition(), z = J.y, E = J.x; var I = G.getScrolls(); z += I.y; E += I.x; var y = this.getDimensions({ computeSize: true, styles: ["padding", "border", "margin"] }); var C = {}, x = F.offset.y, v = F.offset.x, B = window.getSize(); switch (F.position.x) { case "left": C.x = E + v; break; case "right": C.x = E + v + G.offsetWidth; break; default: C.x = E + ((G == document.body ? B.x : G.offsetWidth) / 2) + v; break } switch (F.position.y) { case "top": C.y = z + x; break; case "bottom": C.y = z + x + G.offsetHeight; break; default: C.y = z + ((G == document.body ? B.y : G.offsetHeight) / 2) + x; break } if (F.edge) { var L = {}; switch (F.edge.x) { case "left": L.x = 0; break; case "right": L.x = -y.x - y.computedRight - y.computedLeft; break; default: L.x = -(y.totalWidth / 2); break } switch (F.edge.y) { case "top": L.y = 0; break; case "bottom": L.y = -y.y - y.computedTop - y.computedBottom; break; default: L.y = -(y.totalHeight / 2); break } C.x += L.x; C.y += L.y } C = { left: ((C.x >= 0 || H || F.allowNegative) ? C.x : 0).toInt(), top: ((C.y >= 0 || H || F.allowNegative) ? C.y : 0).toInt() }; var D = { left: "x", top: "y" }; ["minimum", "maximum"].each(function (c) { ["left", "top"].each(function (e) { var d = F[c] ? F[c][D[e]] : null; if (d != null && C[e] < d) { C[e] = d } }) }); if (G.getStyle("position") == "fixed" || F.relFixedPosition) { var A = window.getScroll(); C.top += A.y; C.left += A.x } if (F.ignoreScroll) { var w = G.getScroll(); C.top -= w.y; C.left -= w.x } if (F.ignoreMargins) { C.left += (F.edge.x == "right" ? y["margin-right"] : F.edge.x == "center" ? -y["margin-left"] + ((y["margin-right"] + y["margin-left"]) / 2) : -y["margin-left"]); C.top += (F.edge.y == "bottom" ? y["margin-bottom"] : F.edge.y == "center" ? -y["margin-top"] + ((y["margin-bottom"] + y["margin-top"]) / 2) : -y["margin-top"]) } C.left = Math.ceil(C.left); C.top = Math.ceil(C.top); if (F.returnPos) { return C } else { this.setStyles(C) } return this } }) })(); Element.implement({ isDisplayed: function () { return this.getStyle("display") != "none" }, isVisible: function () { var d = this.offsetWidth, c = this.offsetHeight; return (d == 0 && c == 0) ? false : (d > 0 && c > 0) ? true : this.isDisplayed() }, toggle: function () { return this[this.isDisplayed() ? "hide" : "show"]() }, hide: function () { var c; try { if ((c = this.getStyle("display")) == "none") { c = null } } catch (d) { } return this.store("originalDisplay", c || "block").setStyle("display", "none") }, show: function (b) { return this.setStyle("display", b || this.retrieve("originalDisplay") || "block") }, swapClass: function (d, c) { return this.removeClass(d).addClass(c) } }); if (!window.Form) { window.Form = {} } (function () { Form.Request = new Class({ Binds: ["onSubmit", "onFormValidate"], Implements: [Options, Events, Class.Occlude], options: { requestOptions: { evalScripts: true, useSpinner: true, emulation: false, link: "ignore" }, extraData: {}, resetForm: true }, property: "form.request", initialize: function (d, f, e) { this.element = document.id(d); if (this.occlude()) { return this.occluded } this.update = document.id(f); this.setOptions(e); this.makeRequest(); if (this.options.resetForm) { this.request.addEvent("success", function () { $try(function () { this.element.reset() } .bind(this)); if (window.OverText) { OverText.update() } } .bind(this)) } this.attach() }, toElement: function () { return this.element }, makeRequest: function () { this.request = new Request.HTML($merge({ url: this.element.get("action"), update: this.update, emulation: false, spinnerTarget: this.element, method: this.element.get("method") || "post" }, this.options.requestOptions)).addEvents({ success: function (c, d) { ["success", "complete"].each(function (a) { this.fireEvent(a, [this.update, c, d]) }, this) } .bind(this), failure: function (b) { this.fireEvent("failure", b) } .bind(this), exception: function () { this.fireEvent("failure", xhr) } .bind(this) }) }, attach: function (d) { d = $pick(d, true); method = d ? "addEvent" : "removeEvent"; var c = this.element.retrieve("validator"); if (c) { c[method]("onFormValidate", this.onFormValidate) } if (!c || !d) { this.element[method]("submit", this.onSubmit) } }, detach: function () { this.attach(false) }, enable: function () { this.attach() }, disable: function () { this.detach() }, onFormValidate: function (d, e, f) { if (d || !fv.options.stopOnFailure) { if (f && f.stop) { f.stop() } this.send() } }, onSubmit: function (b) { if (this.element.retrieve("validator")) { this.detach(); this.addFormEvent(); return } b.stop(); this.send() }, send: function () { var c = this.element.toQueryString().trim(); var d = $H(this.options.extraData).toQueryString(); if (c) { c += "&" + d } else { c = d } this.fireEvent("send", [this.element, c]); this.request.send({ data: c }); return this } }); Element.Properties.formRequest = { set: function () { var e = Array.link(arguments, { options: Object.type, update: Element.type, updateId: String.type }); var f = e.update || e.updateId; var d = this.retrieve("form.request"); if (f) { if (d) { d.update = document.id(f) } this.store("form.request:update", f) } if (e.options) { if (d) { d.setOptions(e.options) } this.store("form.request:options", e.options) } return this }, get: function () { var d = Array.link(arguments, { options: Object.type, update: Element.type, updateId: String.type }); var c = d.update || d.updateId; if (d.options || c || !this.retrieve("form.request")) { if (d.options || !this.retrieve("form.request:options")) { this.set("form.request", d.options) } if (c) { this.set("form.request", c) } this.store("form.request", new Form.Request(this, this.retrieve("form.request:update"), this.retrieve("form.request:options"))) } return this.retrieve("form.request") } }; Element.implement({ formUpdate: function (c, d) { this.get("form.request", c, d).send(); return this } }) })(); Form.Request.Append = new Class({ Extends: Form.Request, options: { useReveal: true, revealOptions: {}, inject: "bottom" }, makeRequest: function () { this.request = new Request.HTML($merge({ url: this.element.get("action"), method: this.element.get("method") || "post", spinnerTarget: this.element }, this.options.requestOptions, { evalScripts: false })).addEvents({ success: function (h, j, k, i) { var n; var m = Elements.from(k); if (m.length == 1) { n = m[0] } else { n = new Element("div", { styles: { display: "none"} }).adopt(m) } n.inject(this.update, this.options.inject); if (this.options.requestOptions.evalScripts) { $exec(i) } this.fireEvent("beforeEffect", n); var l = function () { this.fireEvent("success", [n, this.update, h, j, k, i]) } .bind(this); if (this.options.useReveal) { n.get("reveal", this.options.revealOptions).chain(l); n.reveal() } else { l() } } .bind(this), failure: function (b) { this.fireEvent("failure", b) } .bind(this) }) } }); if (!window.Form) { window.Form = {} } var InputValidator = new Class({ Implements: [Options], options: { errorMsg: "Validation failed.", test: function (b) { return true } }, initialize: function (c, d) { this.setOptions(d); this.className = c }, test: function (c, d) { if (document.id(c)) { return this.options.test(document.id(c), d || this.getProps(c)) } else { return false } }, getError: function (f, e) { var d = this.options.errorMsg; if ($type(d) == "function") { d = d(document.id(f), e || this.getProps(f)) } return d }, getProps: function (b) { if (!document.id(b)) { return {} } return b.get("validatorProps") } }); Element.Properties.validatorProps = { set: function (b) { return this.eliminate("validatorProps").store("validatorProps", b) }, get: function (e) { if (e) { this.set(e) } if (this.retrieve("validatorProps")) { return this.retrieve("validatorProps") } if (this.getProperty("validatorProps")) { try { this.store("validatorProps", JSON.decode(this.getProperty("validatorProps"))) } catch (f) { return {} } } else { var d = this.get("class").split(" ").filter(function (a) { return a.test(":") }); if (!d.length) { this.store("validatorProps", {}) } else { e = {}; d.each(function (c) { var b = c.split(":"); if (b[1]) { try { e[b[0]] = JSON.decode(b[1]) } catch (a) { } } }); this.store("validatorProps", e) } } return this.retrieve("validatorProps") } }; Form.Validator = new Class({ Implements: [Options, Events], Binds: ["onSubmit"], options: { fieldSelectors: "input, select, textarea", ignoreHidden: true, ignoreDisabled: true, useTitles: false, evaluateOnSubmit: true, evaluateFieldsOnBlur: true, evaluateFieldsOnChange: true, serial: true, stopOnFailure: true, warningPrefix: function () { return Form.Validator.getMsg("warningPrefix") || "Warning: " }, errorPrefix: function () { return Form.Validator.getMsg("errorPrefix") || "Error: " } }, initialize: function (c, d) { this.setOptions(d); this.element = document.id(c); this.element.store("validator", this); this.warningPrefix = $lambda(this.options.warningPrefix)(); this.errorPrefix = $lambda(this.options.errorPrefix)(); if (this.options.evaluateOnSubmit) { this.element.addEvent("submit", this.onSubmit) } if (this.options.evaluateFieldsOnBlur || this.options.evaluateFieldsOnChange) { this.watchFields(this.getFields()) } }, toElement: function () { return this.element }, getFields: function () { return (this.fields = this.element.getElements(this.options.fieldSelectors)) }, watchFields: function (b) { b.each(function (a) { if (this.options.evaluateFieldsOnBlur) { a.addEvent("blur", this.validationMonitor.pass([a, false], this)) } if (this.options.evaluateFieldsOnChange) { a.addEvent("change", this.validationMonitor.pass([a, true], this)) } }, this) }, validationMonitor: function () { $clear(this.timer); this.timer = this.validateField.delay(50, this, arguments) }, onSubmit: function (b) { if (!this.validate(b) && b) { b.preventDefault() } else { this.reset() } }, reset: function () { this.getFields().each(this.resetField, this); return this }, validate: function (c) { var d = this.getFields().map(function (a) { return this.validateField(a, true) }, this).every(function (a) { return a }); this.fireEvent("formValidate", [d, this.element, c]); if (this.options.stopOnFailure && !d && c) { c.preventDefault() } return d }, validateField: function (j, r) { if (this.paused) { return true } j = document.id(j); var o = !j.hasClass("validation-failed"); var m, k; if (this.options.serial && !r) { m = this.element.getElement(".validation-failed"); k = this.element.getElement(".warning") } if (j && (!m || r || j.hasClass("validation-failed") || (m && !this.options.serial))) { var p = j.className.split(" ").some(function (a) { return this.getValidator(a) }, this); var l = []; j.className.split(" ").each(function (a) { if (a && !this.test(a, j)) { l.include(a) } }, this); o = l.length === 0; if (p && !j.hasClass("warnOnly")) { if (o) { j.addClass("validation-passed").removeClass("validation-failed"); this.fireEvent("elementPass", j) } else { j.addClass("validation-failed").removeClass("validation-passed"); this.fireEvent("elementFail", [j, l]) } } if (!k) { var n = j.className.split(" ").some(function (a) { if (a.test("^warn-") || j.hasClass("warnOnly")) { return this.getValidator(a.replace(/^warn-/, "")) } else { return null } }, this); j.removeClass("warning"); var q = j.className.split(" ").map(function (a) { if (a.test("^warn-") || j.hasClass("warnOnly")) { return this.test(a.replace(/^warn-/, ""), j, true) } else { return null } }, this) } } return o }, test: function (f, i, h) { i = document.id(i); if ((this.options.ignoreHidden && !i.isVisible()) || (this.options.ignoreDisabled && i.get("disabled"))) { return true } var g = this.getValidator(f); if (i.hasClass("ignoreValidation")) { return true } h = $pick(h, false); if (i.hasClass("warnOnly")) { h = true } var j = g ? g.test(i) : true; if (g && i.isVisible()) { this.fireEvent("elementValidate", [j, i, f, h]) } if (h) { return true } return j }, resetField: function (b) { b = document.id(b); if (b) { b.className.split(" ").each(function (a) { if (a.test("^warn-")) { a = a.replace(/^warn-/, "") } b.removeClass("validation-failed"); b.removeClass("warning"); b.removeClass("validation-passed") }, this) } return this }, stop: function () { this.paused = true; return this }, start: function () { this.paused = false; return this }, ignoreField: function (d, c) { d = document.id(d); if (d) { this.enforceField(d); if (c) { d.addClass("warnOnly") } else { d.addClass("ignoreValidation") } } return this }, enforceField: function (b) { b = document.id(b); if (b) { b.removeClass("warnOnly").removeClass("ignoreValidation") } return this } }); Form.Validator.getMsg = function (b) { return MooTools.lang.get("Form.Validator", b) }; Form.Validator.adders = { validators: {}, add: function (c, d) { this.validators[c] = new InputValidator(c, d); if (!this.initialize) { this.implement({ validators: this.validators }) } }, addAllThese: function (b) { $A(b).each(function (a) { this.add(a[0], a[1]) }, this) }, getValidator: function (b) { return this.validators[b.split(":")[0]] } }; $extend(Form.Validator, Form.Validator.adders); Form.Validator.implement(Form.Validator.adders); Form.Validator.add("IsEmpty", { errorMsg: false, test: function (b) { if (b.type == "select-one" || b.type == "select") { return !(b.selectedIndex >= 0 && b.options[b.selectedIndex].value != "") } else { return ((b.get("value") == null) || (b.get("value").length == 0)) } } }); Form.Validator.addAllThese([["required", { errorMsg: function () { return Form.Validator.getMsg("required") }, test: function (b) { return !Form.Validator.getValidator("IsEmpty").test(b) } }], ["minLength", { errorMsg: function (d, c) { if ($type(c.minLength)) { return Form.Validator.getMsg("minLength").substitute({ minLength: c.minLength, length: d.get("value").length }) } else { return "" } }, test: function (d, c) { if ($type(c.minLength)) { return (d.get("value").length >= $pick(c.minLength, 0)) } else { return true } } }], ["maxLength", { errorMsg: function (d, c) { if ($type(c.maxLength)) { return Form.Validator.getMsg("maxLength").substitute({ maxLength: c.maxLength, length: d.get("value").length }) } else { return "" } }, test: function (d, c) { return (d.get("value").length <= $pick(c.maxLength, 10000)) } }], ["validate-integer", { errorMsg: Form.Validator.getMsg.pass("integer"), test: function (b) { return Form.Validator.getValidator("IsEmpty").test(b) || (/^(-?[1-9]\d*|0)$/).test(b.get("value")) } }], ["validate-numeric", { errorMsg: Form.Validator.getMsg.pass("numeric"), test: function (b) { return Form.Validator.getValidator("IsEmpty").test(b) || (/^-?(?:0$0(?=\d*\.)|[1-9]|0)\d*(\.\d+)?$/).test(b.get("value")) } }], ["validate-digits", { errorMsg: Form.Validator.getMsg.pass("digits"), test: function (b) { return Form.Validator.getValidator("IsEmpty").test(b) || (/^[\d() .:\-\+#]+$/.test(b.get("value"))) } }], ["validate-alpha", { errorMsg: Form.Validator.getMsg.pass("alpha"), test: function (b) { return Form.Validator.getValidator("IsEmpty").test(b) || (/^[a-zA-Z]+$/).test(b.get("value")) } }], ["validate-alphanum", { errorMsg: Form.Validator.getMsg.pass("alphanum"), test: function (b) { return Form.Validator.getValidator("IsEmpty").test(b) || !(/\W/).test(b.get("value")) } }], ["validate-date", { errorMsg: function (e, d) { if (Date.parse) { var f = d.dateFormat || "%x"; return Form.Validator.getMsg("dateSuchAs").substitute({ date: new Date().format(f) }) } else { return Form.Validator.getMsg("dateInFormatMDY") } }, test: function (h, d) { if (Form.Validator.getValidator("IsEmpty").test(h)) { return true } var i; if (Date.parse) { var j = d.dateFormat || "%x"; i = Date.parse(h.get("value")); var k = i.format(j); if (k != "invalid date") { h.set("value", k) } return !isNaN(i) } else { var l = /^(\d{2})\/(\d{2})\/(\d{4})$/; if (!l.test(h.get("value"))) { return false } i = new Date(h.get("value").replace(l, "$1/$2/$3")); return (parseInt(RegExp.$1, 10) == (1 + i.getMonth())) && (parseInt(RegExp.$2, 10) == i.getDate()) && (parseInt(RegExp.$3, 10) == i.getFullYear()) } } }], ["validate-email", { errorMsg: Form.Validator.getMsg.pass("email"), test: function (b) { return Form.Validator.getValidator("IsEmpty").test(b) || (/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i).test(b.get("value")) } }], ["validate-url", { errorMsg: Form.Validator.getMsg.pass("url"), test: function (b) { return Form.Validator.getValidator("IsEmpty").test(b) || (/^(https?|ftp|rmtp|mms):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i).test(b.get("value")) } }], ["validate-currency-dollar", { errorMsg: Form.Validator.getMsg.pass("currencyDollar"), test: function (b) { return Form.Validator.getValidator("IsEmpty").test(b) || (/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/).test(b.get("value")) } }], ["validate-one-required", { errorMsg: Form.Validator.getMsg.pass("oneRequired"), test: function (e, d) { var f = document.id(d["validate-one-required"]) || e.getParent(); return f.getElements("input").some(function (a) { if (["checkbox", "radio"].contains(a.get("type"))) { return a.get("checked") } return a.get("value") }) } }]]); Element.Properties.validator = { set: function (d) { var c = this.retrieve("validator"); if (c) { c.setOptions(d) } return this.store("validator:options") }, get: function (b) { if (b || !this.retrieve("validator")) { if (b || !this.retrieve("validator:options")) { this.set("validator", b) } this.store("validator", new Form.Validator(this, this.retrieve("validator:options"))) } return this.retrieve("validator") } }; Element.implement({ validate: function (b) { this.set("validator", b); return this.get("validator", b).validate() } }); var FormValidator = Form.Validator; Form.Validator.Inline = new Class({ Extends: Form.Validator, options: { scrollToErrorsOnSubmit: true, scrollFxOptions: { transition: "quad:out", offset: { y: -20}} }, initialize: function (c, d) { this.parent(c, d); this.addEvent("onElementValidate", function (b, i, j, a) { var k = this.getValidator(j); if (!b && k.getError(i)) { if (a) { i.addClass("warning") } var l = this.makeAdvice(j, i, k.getError(i), a); this.insertAdvice(l, i); this.showAdvice(j, i) } else { this.hideAdvice(j, i) } }) }, makeAdvice: function (m, k, n, j) { var l = (j) ? this.warningPrefix : this.errorPrefix; l += (this.options.useTitles) ? k.title || n : n; var i = (j) ? "warning-advice" : "validation-advice"; var h = this.getAdvice(m, k); if (h) { h = h.set("html", l) } else { h = new Element("div", { html: l, styles: { display: "none" }, id: "advice-" + m + "-" + this.getFieldId(k) }).addClass(i) } k.store("advice-" + m, h); return h }, getFieldId: function (b) { return b.id ? b.id : b.id = "input_" + b.name }, showAdvice: function (d, f) { var e = this.getAdvice(d, f); if (e && !f.retrieve(this.getPropName(d)) && (e.getStyle("display") == "none" || e.getStyle("visiblity") == "hidden" || e.getStyle("opacity") == 0)) { f.store(this.getPropName(d), true); if (e.reveal) { e.reveal() } else { e.setStyle("display", "block") } } }, hideAdvice: function (d, f) { var e = this.getAdvice(d, f); if (e && f.retrieve(this.getPropName(d))) { f.store(this.getPropName(d), false); if (e.dissolve) { e.dissolve() } else { e.setStyle("display", "none") } } }, getPropName: function (b) { return "advice" + b }, resetField: function (b) { b = document.id(b); if (!b) { return this } this.parent(b); b.className.split(" ").each(function (a) { this.hideAdvice(a, b) }, this); return this }, getAllAdviceMessages: function (g, h) { var e = []; if (g.hasClass("ignoreValidation") && !h) { return e } var f = g.className.split(" ").some(function (a) { var c = a.test("^warn-") || g.hasClass("warnOnly"); if (c) { a = a.replace(/^warn-/, "") } var b = this.getValidator(a); if (!b) { return } e.push({ message: b.getError(g), warnOnly: c, passed: b.test(), validator: b }) }, this); return e }, getAdvice: function (d, c) { return c.retrieve("advice-" + d) }, insertAdvice: function (e, f) { var d = f.get("validatorProps"); if (!d.msgPos || !document.id(d.msgPos)) { if (f.type.toLowerCase() == "radio") { f.getParent().adopt(e) } else { e.inject(document.id(f), "after") } } else { document.id(d.msgPos).grab(e) } }, validateField: function (i, j) { var h = this.parent(i, j); if (this.options.scrollToErrorsOnSubmit && !h) { var g = document.id(this).getElement(".validation-failed"); var l = document.id(this).getParent(); while (l != document.body && l.getScrollSize().y == l.getSize().y) { l = l.getParent() } var k = l.retrieve("fvScroller"); if (!k && window.Fx && Fx.Scroll) { k = new Fx.Scroll(l, this.options.scrollFxOptions); l.store("fvScroller", k) } if (g) { if (k) { k.toElement(g) } else { l.scrollTo(l.getScroll().x, g.getPosition(l).y - 20) } } } return h } }); Form.Validator.addAllThese([["validate-enforce-oncheck", { test: function (e, d) { if (e.checked) { var f = e.getParent("form").retrieve("validator"); if (!f) { return true } (d.toEnforce || document.id(d.enforceChildrenOf).getElements("input, select, textarea")).map(function (a) { f.enforceField(a) }) } return true } }], ["validate-ignore-oncheck", { test: function (e, d) { if (e.checked) { var f = e.getParent("form").retrieve("validator"); if (!f) { return true } (d.toIgnore || document.id(d.ignoreChildrenOf).getElements("input, select, textarea")).each(function (a) { f.ignoreField(a); f.resetField(a) }) } return true } }], ["validate-nospace", { errorMsg: function () { return Form.Validator.getMsg("noSpace") }, test: function (d, c) { return !d.get("value").test(/\s/) } }], ["validate-toggle-oncheck", { test: function (e, h) { var g = e.getParent("form").retrieve("validator"); if (!g) { return true } var f = h.toToggle || document.id(h.toToggleChildrenOf).getElements("input, select, textarea"); if (!e.checked) { f.each(function (a) { g.ignoreField(a); g.resetField(a) }) } else { f.each(function (a) { g.enforceField(a) }) } return true } }], ["validate-reqchk-bynode", { errorMsg: function () { return Form.Validator.getMsg("reqChkByNode") }, test: function (d, c) { return (document.id(c.nodeId).getElements(c.selector || "input[type=checkbox], input[type=radio]")).some(function (a) { return a.checked }) } }], ["validate-required-check", { errorMsg: function (d, c) { return c.useTitle ? d.get("title") : Form.Validator.getMsg("requiredChk") }, test: function (d, c) { return !!d.checked } }], ["validate-reqchk-byname", { errorMsg: function (d, c) { return Form.Validator.getMsg("reqChkByName").substitute({ label: c.label || d.get("type") }) }, test: function (f, i) { var j = i.groupName || f.get("name"); var g = $$(document.getElementsByName(j)).some(function (a, b) { return a.checked }); var h = f.getParent("form").retrieve("validator"); if (g && h) { h.resetField(f) } return g } }], ["validate-match", { errorMsg: function (d, c) { return Form.Validator.getMsg("match").substitute({ matchName: c.matchName || document.id(c.matchInput).get("name") }) }, test: function (e, h) { var g = e.get("value"); var f = document.id(h.matchInput) && document.id(h.matchInput).get("value"); return g && f ? g == f : true } }], ["validate-after-date", { errorMsg: function (d, c) { return Form.Validator.getMsg("afterDate").substitute({ label: c.afterLabel || (c.afterElement ? Form.Validator.getMsg("startDate") : Form.Validator.getMsg("currentDate")) }) }, test: function (e, h) { var g = document.id(h.afterElement) ? Date.parse(document.id(h.afterElement).get("value")) : new Date(); var f = Date.parse(e.get("value")); return f && g ? f >= g : true } }], ["validate-before-date", { errorMsg: function (d, c) { return Form.Validator.getMsg("beforeDate").substitute({ label: c.beforeLabel || (c.beforeElement ? Form.Validator.getMsg("endDate") : Form.Validator.getMsg("currentDate")) }) }, test: function (e, h) { var g = Date.parse(e.get("value")); var f = document.id(h.beforeElement) ? Date.parse(document.id(h.beforeElement).get("value")) : new Date(); return f && g ? f >= g : true } }], ["validate-custom-required", { errorMsg: function () { return Form.Validator.getMsg("required") }, test: function (d, c) { return d.get("value") != c.emptyValue } }], ["validate-same-month", { errorMsg: function (f, e) { var h = document.id(e.sameMonthAs) && document.id(e.sameMonthAs).get("value"); var g = f.get("value"); if (g != "") { return Form.Validator.getMsg(h ? "sameMonth" : "startMonth") } }, test: function (f, e) { var g = Date.parse(f.get("value")); var h = Date.parse(document.id(e.sameMonthAs) && document.id(e.sameMonthAs).get("value")); return g && h ? g.format("%B") == h.format("%B") : true } }], ["validate-cc-num", { errorMsg: function (d) { var c = d.get("value").ccNum.replace(/[^0-9]/g, ""); return Form.Validator.getMsg("creditcard").substitute({ length: c.length }) }, test: function (n) { if (Form.Validator.getValidator("IsEmpty").test(n)) { return true } var j = n.get("value"); j = j.replace(/[^0-9]/g, ""); var i = false; if (j.test(/^4[0-9]{12}([0-9]{3})?$/)) { i = "Visa" } else { if (j.test(/^5[1-5]([0-9]{14})$/)) { i = "Master Card" } else { if (j.test(/^3[47][0-9]{13}$/)) { i = "American Express" } else { if (j.test(/^6011[0-9]{12}$/)) { i = "Discover" } } } } if (i) { var m = 0; var l = 0; for (var h = j.length - 1; h >= 0; --h) { l = j.charAt(h).toInt(); if (l == 0) { continue } if ((j.length - h) % 2 == 0) { l += l } if (l > 9) { l = l.toString().charAt(0).toInt() + l.toString().charAt(1).toInt() } m += l } if ((m % 10) == 0) { return true } } var k = ""; while (j != "") { k += " " + j.substr(0, 4); j = j.substr(4) } n.getParent("form").retrieve("validator").ignoreField(n); n.set("value", k.clean()); n.getParent("form").retrieve("validator").enforceField(n); return false } }]]); var OverText = new Class({ Implements: [Options, Events, Class.Occlude], Binds: ["reposition", "assert", "focus", "hide"], options: { element: "label", positionOptions: { position: "upperLeft", edge: "upperLeft", offset: { x: 4, y: 2} }, poll: false, pollInterval: 250, wrap: false }, property: "OverText", initialize: function (c, d) { this.element = document.id(c); if (this.occlude()) { return this.occluded } this.setOptions(d); this.attach(this.element); OverText.instances.push(this); if (this.options.poll) { this.poll() } return this }, toElement: function () { return this.element }, attach: function () { var b = this.options.textOverride || this.element.get("alt") || this.element.get("title"); if (!b) { return } this.text = new Element(this.options.element, { "class": "overTxtLabel", styles: { lineHeight: "normal", position: "absolute", cursor: "text" }, html: b, events: { click: this.hide.pass(this.options.element == "label", this)} }).inject(this.element, "after"); if (this.options.element == "label") { if (!this.element.get("id")) { this.element.set("id", "input_" + new Date().getTime()) } this.text.set("for", this.element.get("id")) } if (this.options.wrap) { this.textHolder = new Element("div", { styles: { lineHeight: "normal", position: "relative" }, "class": "overTxtWrapper" }).adopt(this.text).inject(this.element, "before") } this.element.addEvents({ focus: this.focus, blur: this.assert, change: this.assert }).store("OverTextDiv", this.text); window.addEvent("resize", this.reposition.bind(this)); this.assert(true); this.reposition() }, wrap: function () { if (this.options.element == "label") { if (!this.element.get("id")) { this.element.set("id", "input_" + new Date().getTime()) } this.text.set("for", this.element.get("id")) } }, startPolling: function () { this.pollingPaused = false; return this.poll() }, poll: function (d) { if (this.poller && !d) { return this } var c = function () { if (!this.pollingPaused) { this.assert(true) } } .bind(this); if (d) { $clear(this.poller) } else { this.poller = c.periodical(this.options.pollInterval, this) } return this }, stopPolling: function () { this.pollingPaused = true; return this.poll(true) }, focus: function () { if (this.text && (!this.text.isDisplayed() || this.element.get("disabled"))) { return } this.hide() }, hide: function (f, e) { if (this.text && (this.text.isDisplayed() && (!this.element.get("disabled") || e))) { this.text.hide(); this.fireEvent("textHide", [this.text, this.element]); this.pollingPaused = true; try { if (!f) { this.element.fireEvent("focus") } this.element.focus() } catch (d) { } } return this }, show: function () { if (this.text && !this.text.isDisplayed()) { this.text.show(); this.reposition(); this.fireEvent("textShow", [this.text, this.element]); this.pollingPaused = false } return this }, assert: function (b) { this[this.test() ? "show" : "hide"](b) }, test: function () { var b = this.element.get("value"); return !b }, reposition: function () { this.assert(true); if (!this.element.isVisible()) { return this.stopPolling().hide() } if (this.text && this.test()) { this.text.position($merge(this.options.positionOptions, { relativeTo: this.element })) } return this } }); OverText.instances = []; $extend(OverText, { each: function (b) { return OverText.instances.map(function (d, a) { if (d.element && d.text) { return b.apply(OverText, [d, a]) } return null }) }, update: function () { return OverText.each(function (b) { return b.reposition() }) }, hideAll: function () { return OverText.each(function (b) { return b.hide(true, true) }) }, showAll: function () { return OverText.each(function (b) { return b.show() }) } }); if (window.Fx && Fx.Reveal) { Fx.Reveal.implement({ hideInputs: Browser.Engine.trident ? "select, input, textarea, object, embed, .overTxtLabel" : false }) } Fx.Elements = new Class({ Extends: Fx.CSS, initialize: function (c, d) { this.elements = this.subject = $$(c); this.parent(d) }, compute: function (l, k, i) { var p = {}; for (var o in l) { var r = l[o], n = k[o], m = p[o] = {}; for (var q in r) { m[q] = this.parent(r[q], n[q], i) } } return p }, set: function (e) { for (var h in e) { var f = e[h]; for (var g in f) { this.render(this.elements[h], g, f[g], this.options.unit) } } return this }, start: function (p) { if (!this.check(p)) { return this } var k = {}, i = {}; for (var o in p) { var m = p[o], r = k[o] = {}, l = i[o] = {}; for (var q in m) { var n = this.prepare(this.elements[o], q, m[q]); r[q] = n.from; l[q] = n.to } } return this.parent(k, i) } }); var Accordion = Fx.Accordion = new Class({ Extends: Fx.Elements, options: { display: 0, show: false, height: true, width: false, opacity: true, alwaysHide: false, trigger: "click", initialDisplayFx: true, returnHeightToAuto: true }, initialize: function () { var f = Array.link(arguments, { container: Element.type, options: Object.type, togglers: $defined, elements: $defined }); this.parent(f.elements, f.options); this.togglers = $$(f.togglers); this.container = document.id(f.container); this.previous = -1; this.internalChain = new Chain(); if (this.options.alwaysHide) { this.options.wait = true } if ($chk(this.options.show)) { this.options.display = false; this.previous = this.options.show } if (this.options.start) { this.options.display = false; this.options.show = false } this.effects = {}; if (this.options.opacity) { this.effects.opacity = "fullOpacity" } if (this.options.width) { this.effects.width = this.options.fixedWidth ? "fullWidth" : "offsetWidth" } if (this.options.height) { this.effects.height = this.options.fixedHeight ? "fullHeight" : "scrollHeight" } for (var d = 0, e = this.togglers.length; d < e; d++) { this.addSection(this.togglers[d], this.elements[d]) } this.elements.each(function (b, c) { if (this.options.show === c) { this.fireEvent("active", [this.togglers[c], b]) } else { for (var a in this.effects) { b.setStyle(a, 0) } } }, this); if ($chk(this.options.display)) { this.display(this.options.display, this.options.initialDisplayFx) } this.addEvent("complete", this.internalChain.callChain.bind(this.internalChain)) }, addSection: function (j, l) { j = document.id(j); l = document.id(l); var i = this.togglers.contains(j); this.togglers.include(j); this.elements.include(l); var h = this.togglers.indexOf(j); var g = this.display.bind(this, h); j.store("accordion:display", g); j.addEvent(this.options.trigger, g); if (this.options.height) { l.setStyles({ "padding-top": 0, "border-top": "none", "padding-bottom": 0, "border-bottom": "none" }) } if (this.options.width) { l.setStyles({ "padding-left": 0, "border-left": "none", "padding-right": 0, "border-right": "none" }) } l.fullOpacity = 1; if (this.options.fixedWidth) { l.fullWidth = this.options.fixedWidth } if (this.options.fixedHeight) { l.fullHeight = this.options.fixedHeight } l.setStyle("overflow", "hidden"); if (!i) { for (var k in this.effects) { l.setStyle(k, 0) } } return this }, detach: function () { this.togglers.each(function (b) { b.removeEvent(this.options.trigger, b.retrieve("accordion:display")) }, this) }, display: function (g, f) { if (!this.check(g, f)) { return this } f = $pick(f, true); if (this.options.returnHeightToAuto) { var i = this.elements[this.previous]; if (i && !this.selfHidden) { for (var j in this.effects) { i.setStyle(j, i[this.effects[j]]) } } } g = ($type(g) == "element") ? this.elements.indexOf(g) : g; if ((this.timer && this.options.wait) || (g === this.previous && !this.options.alwaysHide)) { return this } this.previous = g; var h = {}; this.elements.each(function (b, c) { h[c] = {}; var d; if (c != g) { d = true } else { if (this.options.alwaysHide && ((b.offsetHeight > 0 && this.options.height) || b.offsetWidth > 0 && this.options.width)) { d = true; this.selfHidden = true } } this.fireEvent(d ? "background" : "active", [this.togglers[c], b]); for (var a in this.effects) { h[c][a] = d ? 0 : b[this.effects[a]] } }, this); this.internalChain.chain(function () { if (this.options.returnHeightToAuto && !this.selfHidden) { var a = this.elements[g]; if (a) { a.setStyle("height", "auto") } } } .bind(this)); return f ? this.start(h) : this.set(h) } }); Fx.Move = new Class({ Extends: Fx.Morph, options: { relativeTo: document.body, position: "center", edge: false, offset: { x: 0, y: 0} }, start: function (b) { return this.parent(this.element.position($merge(this.options, b, { returnPos: true }))) } }); Element.Properties.move = { set: function (d) { var c = this.retrieve("move"); if (c) { c.cancel() } return this.eliminate("move").store("move:options", $extend({ link: "cancel" }, d)) }, get: function (b) { if (b || !this.retrieve("move")) { if (b || !this.retrieve("move:options")) { this.set("move", b) } this.store("move", new Fx.Move(this, this.retrieve("move:options"))) } return this.retrieve("move") } }; Element.implement({ move: function (b) { this.get("move").start(b); return this } }); Fx.Reveal = new Class({ Extends: Fx.Morph, options: { link: "cancel", styles: ["padding", "border", "margin"], transitionOpacity: !Browser.Engine.trident4, mode: "vertical", display: "block", hideInputs: Browser.Engine.trident ? "select, input, textarea, object, embed" : false }, dissolve: function () { try { if (!this.hiding && !this.showing) { if (this.element.getStyle("display") != "none") { this.hiding = true; this.showing = false; this.hidden = true; this.cssText = this.element.style.cssText; var g = this.element.getComputedSize({ styles: this.options.styles, mode: this.options.mode }); this.element.setStyle("display", "block"); if (this.options.transitionOpacity) { g.opacity = 1 } var e = {}; $each(g, function (a, b) { e[b] = [a, 0] }, this); this.element.setStyle("overflow", "hidden"); var f = this.options.hideInputs ? this.element.getElements(this.options.hideInputs) : null; this.$chain.unshift(function () { if (this.hidden) { this.hiding = false; $each(g, function (a, b) { g[b] = a }, this); this.element.style.cssText = this.cssText; this.element.setStyle("display", "none"); if (f) { f.setStyle("visibility", "visible") } } this.fireEvent("hide", this.element); this.callChain() } .bind(this)); if (f) { f.setStyle("visibility", "hidden") } this.start(e) } else { this.callChain.delay(10, this); this.fireEvent("complete", this.element); this.fireEvent("hide", this.element) } } else { if (this.options.link == "chain") { this.chain(this.dissolve.bind(this)) } else { if (this.options.link == "cancel" && !this.hiding) { this.cancel(); this.dissolve() } } } } catch (h) { this.hiding = false; this.element.setStyle("display", "none"); this.callChain.delay(10, this); this.fireEvent("complete", this.element); this.fireEvent("hide", this.element) } return this }, reveal: function () { try { if (!this.showing && !this.hiding) { if (this.element.getStyle("display") == "none" || this.element.getStyle("visiblity") == "hidden" || this.element.getStyle("opacity") == 0) { this.showing = true; this.hiding = this.hidden = false; var g; this.cssText = this.element.style.cssText; this.element.measure(function () { g = this.element.getComputedSize({ styles: this.options.styles, mode: this.options.mode }) } .bind(this)); $each(g, function (a, b) { g[b] = a }); if ($chk(this.options.heightOverride)) { g.height = this.options.heightOverride.toInt() } if ($chk(this.options.widthOverride)) { g.width = this.options.widthOverride.toInt() } if (this.options.transitionOpacity) { this.element.setStyle("opacity", 0); g.opacity = 1 } var e = { height: 0, display: this.options.display }; $each(g, function (a, b) { e[b] = 0 }); this.element.setStyles($merge(e, { overflow: "hidden" })); var f = this.options.hideInputs ? this.element.getElements(this.options.hideInputs) : null; if (f) { f.setStyle("visibility", "hidden") } this.start(g); this.$chain.unshift(function () { this.element.style.cssText = this.cssText; this.element.setStyle("display", this.options.display); if (!this.hidden) { this.showing = false } if (f) { f.setStyle("visibility", "visible") } this.callChain(); this.fireEvent("show", this.element) } .bind(this)) } else { this.callChain(); this.fireEvent("complete", this.element); this.fireEvent("show", this.element) } } else { if (this.options.link == "chain") { this.chain(this.reveal.bind(this)) } else { if (this.options.link == "cancel" && !this.showing) { this.cancel(); this.reveal() } } } } catch (h) { this.element.setStyles({ display: this.options.display, visiblity: "visible", opacity: 1 }); this.showing = false; this.callChain.delay(10, this); this.fireEvent("complete", this.element); this.fireEvent("show", this.element) } return this }, toggle: function () { if (this.element.getStyle("display") == "none" || this.element.getStyle("visiblity") == "hidden" || this.element.getStyle("opacity") == 0) { this.reveal() } else { this.dissolve() } return this }, cancel: function () { this.parent.apply(this, arguments); this.element.style.cssText = this.cssText; this.hidding = false; this.showing = false } }); Element.Properties.reveal = { set: function (d) { var c = this.retrieve("reveal"); if (c) { c.cancel() } return this.eliminate("reveal").store("reveal:options", d) }, get: function (b) { if (b || !this.retrieve("reveal")) { if (b || !this.retrieve("reveal:options")) { this.set("reveal", b) } this.store("reveal", new Fx.Reveal(this, this.retrieve("reveal:options"))) } return this.retrieve("reveal") } }; Element.Properties.dissolve = Element.Properties.reveal; Element.implement({ reveal: function (b) { this.get("reveal", b).reveal(); return this }, dissolve: function (b) { this.get("reveal", b).dissolve(); return this }, nix: function () { var b = Array.link(arguments, { destroy: Boolean.type, options: Object.type }); this.get("reveal", b.options).dissolve().chain(function () { this[b.destroy ? "destroy" : "dispose"]() } .bind(this)); return this }, wink: function () { var c = Array.link(arguments, { duration: Number.type, options: Object.type }); var d = this.get("reveal", c.options); d.reveal().chain(function () { (function () { d.dissolve() }).delay(c.duration || 2000) }) } }); Fx.Scroll = new Class({ Extends: Fx, options: { offset: { x: 0, y: 0 }, wheelStops: true }, initialize: function (e, f) { this.element = this.subject = document.id(e); this.parent(f); var g = this.cancel.bind(this, false); if ($type(this.element) != "element") { this.element = document.id(this.element.getDocument().body) } var h = this.element; if (this.options.wheelStops) { this.addEvent("start", function () { h.addEvent("mousewheel", g) }, true); this.addEvent("complete", function () { h.removeEvent("mousewheel", g) }, true) } }, set: function () { var b = Array.flatten(arguments); if (Browser.Engine.gecko) { b = [Math.round(b[0]), Math.round(b[1])] } this.element.scrollTo(b[0], b[1]) }, compute: function (f, d, e) { return [0, 1].map(function (a) { return Fx.compute(f[a], d[a], e) }) }, start: function (n, j) { if (!this.check(n, j)) { return this } var l = this.element.getScrollSize(), h = this.element.getScroll(), m = { x: n, y: j }; for (var k in m) { var i = l[k]; if ($chk(m[k])) { m[k] = ($type(m[k]) == "number") ? m[k] : i } else { m[k] = h[k] } m[k] += this.options.offset[k] } return this.parent([h.x, h.y], [m.x, m.y]) }, toTop: function () { return this.start(false, 0) }, toLeft: function () { return this.start(0, false) }, toRight: function () { return this.start("right", false) }, toBottom: function () { return this.start(false, "bottom") }, toElement: function (c) { var d = document.id(c).getPosition(this.element); return this.start(d.x, d.y) }, scrollIntoView: function (p, n, o) { n = n ? $splat(n) : ["x", "y"]; var k = {}; p = document.id(p); var m = p.getPosition(this.element); var j = p.getSize(); var l = this.element.getScroll(); var r = this.element.getSize(); var q = { x: m.x + j.x, y: m.y + j.y }; ["x", "y"].each(function (a) { if (n.contains(a)) { if (q[a] > l[a] + r[a]) { k[a] = q[a] - r[a] } if (m[a] < l[a]) { k[a] = m[a] } } if (k[a] == null) { k[a] = l[a] } if (o && o[a]) { k[a] = k[a] + o[a] } }, this); if (k.x != l.x || k.y != l.y) { this.start(k.x, k.y) } return this }, scrollToCenter: function (p, n, o) { n = n ? $splat(n) : ["x", "y"]; p = $(p); var k = {}, m = p.getPosition(this.element), j = p.getSize(), l = this.element.getScroll(), r = this.element.getSize(), q = { x: m.x + j.x, y: m.y + j.y }; ["x", "y"].each(function (a) { if (n.contains(a)) { k[a] = m[a] - (r[a] - j[a]) / 2 } if (k[a] == null) { k[a] = l[a] } if (o && o[a]) { k[a] = k[a] + o[a] } }, this); if (k.x != l.x || k.y != l.y) { this.start(k.x, k.y) } return this } }); Fx.Slide = new Class({ Extends: Fx, options: { mode: "vertical", hideOverflow: true }, initialize: function (e, f) { this.addEvent("complete", function () { this.open = (this.wrapper["offset" + this.layout.capitalize()] != 0); if (this.open && Browser.Engine.webkit419) { this.element.dispose().inject(this.wrapper) } }, true); this.element = this.subject = document.id(e); this.parent(f); var g = this.element.retrieve("wrapper"); var h = this.element.getStyles("margin", "position", "overflow"); if (this.options.hideOverflow) { h = $extend(h, { overflow: "hidden" }) } this.wrapper = g || new Element("div", { styles: h }).wraps(this.element); this.element.store("wrapper", this.wrapper).setStyle("margin", 0); this.now = []; this.open = true }, vertical: function () { this.margin = "margin-top"; this.layout = "height"; this.offset = this.element.offsetHeight }, horizontal: function () { this.margin = "margin-left"; this.layout = "width"; this.offset = this.element.offsetWidth }, set: function (b) { this.element.setStyle(this.margin, b[0]); this.wrapper.setStyle(this.layout, b[1]); return this }, compute: function (f, d, e) { return [0, 1].map(function (a) { return Fx.compute(f[a], d[a], e) }) }, start: function (h, l) { if (!this.check(h, l)) { return this } this[l || this.options.mode](); var m = this.element.getStyle(this.margin).toInt(); var n = this.wrapper.getStyle(this.layout).toInt(); var i = [[m, n], [0, this.offset]]; var j = [[m, n], [-this.offset, 0]]; var k; switch (h) { case "in": k = i; break; case "out": k = j; break; case "toggle": k = (n == 0) ? i : j } return this.parent(k[0], k[1]) }, slideIn: function (b) { return this.start("in", b) }, slideOut: function (b) { return this.start("out", b) }, hide: function (b) { this[b || this.options.mode](); this.open = false; return this.set([-this.offset, 0]) }, show: function (b) { this[b || this.options.mode](); this.open = true; return this.set([0, this.offset]) }, toggle: function (b) { return this.start("toggle", b) } }); Element.Properties.slide = { set: function (c) { var d = this.retrieve("slide"); if (d) { d.cancel() } return this.eliminate("slide").store("slide:options", $extend({ link: "cancel" }, c)) }, get: function (b) { if (b || !this.retrieve("slide")) { if (b || !this.retrieve("slide:options")) { this.set("slide", b) } this.store("slide", new Fx.Slide(this, this.retrieve("slide:options"))) } return this.retrieve("slide") } }; Element.implement({ slide: function (i, h) { i = i || "toggle"; var f = this.get("slide"), g; switch (i) { case "hide": f.hide(h); break; case "show": f.show(h); break; case "toggle": var j = this.retrieve("slide:flag", f.open); f[j ? "slideOut" : "slideIn"](h); this.store("slide:flag", !j); g = true; break; default: f.start(i, h) } if (!g) { this.eliminate("slide:flag") } return this } }); var SmoothScroll = Fx.SmoothScroll = new Class({ Extends: Fx.Scroll, initialize: function (e, h) { h = h || document; this.doc = h.getDocument(); var g = h.getWindow(); this.parent(this.doc, e); this.links = $$(this.options.links || this.doc.links); var f = g.location.href.match(/^[^#]*/)[0] + "#"; this.links.each(function (a) { if (a.href.indexOf(f) != 0) { return } var b = a.href.substr(f.length); if (b) { this.useLink(a, b) } }, this); if (!Browser.Engine.webkit419) { this.addEvent("complete", function () { g.location.hash = this.anchor }, true) } }, useLink: function (f, e) { var d; f.addEvent("click", function (a) { if (d !== false && !d) { d = document.id(e) || this.doc.getElement("a[name=" + e + "]") } if (d) { a.preventDefault(); this.anchor = e; this.toElement(d).chain(function () { this.fireEvent("scrolledTo", [f, d]) } .bind(this)); f.blur() } } .bind(this)) } }); Fx.Sort = new Class({ Extends: Fx.Elements, options: { mode: "vertical" }, initialize: function (c, d) { this.parent(c, d); this.elements.each(function (a) { if (a.getStyle("position") == "static") { a.setStyle("position", "relative") } }); this.setDefaultOrder() }, setDefaultOrder: function () { this.currentOrder = this.elements.map(function (c, d) { return d }) }, sort: function (n) { if ($type(n) != "array") { return false } var j = 0, r = 0, p = {}, k = {}, o = this.options.mode == "vertical"; var m = this.elements.map(function (a, d) { var b = a.getComputedSize({ styles: ["border", "padding", "margin"] }); var f; if (o) { f = { top: j, margin: b["margin-top"], height: b.totalHeight }; j += f.height - b["margin-top"] } else { f = { left: r, margin: b["margin-left"], width: b.totalWidth }; r += f.width } var c = o ? "top" : "left"; k[d] = {}; var e = a.getStyle(c).toInt(); k[d][c] = e || 0; return f }, this); this.set(k); n = n.map(function (a) { return a.toInt() }); if (n.length != this.elements.length) { this.currentOrder.each(function (a) { if (!n.contains(a)) { n.push(a) } }); if (n.length > this.elements.length) { n.splice(this.elements.length - 1, n.length - this.elements.length) } } var q = j = r = 0; n.each(function (a, c) { var b = {}; if (o) { b.top = j - m[a].top - q; j += m[a].height } else { b.left = r - m[a].left; r += m[a].width } q = q + m[a].margin; p[a] = b }, this); var l = {}; $A(n).sort().each(function (a) { l[a] = p[a] }); this.start(l); this.currentOrder = n; return this }, rearrangeDOM: function (e) { e = e || this.currentOrder; var d = this.elements[0].getParent(); var f = []; this.elements.setStyle("opacity", 0); e.each(function (a) { f.push(this.elements[a].inject(d).setStyles({ top: 0, left: 0 })) }, this); this.elements.setStyle("opacity", 1); this.elements = $$(f); this.setDefaultOrder(); return this }, getDefaultOrder: function () { return this.elements.map(function (c, d) { return d }) }, forward: function () { return this.sort(this.getDefaultOrder()) }, backward: function () { return this.sort(this.getDefaultOrder().reverse()) }, reverse: function () { return this.sort(this.currentOrder.reverse()) }, sortByElements: function (b) { return this.sort(b.map(function (a) { return this.elements.indexOf(a) }, this)) }, swap: function (f, d) { if ($type(f) == "element") { f = this.elements.indexOf(f) } if ($type(d) == "element") { d = this.elements.indexOf(d) } var e = $A(this.currentOrder); e[this.currentOrder.indexOf(f)] = d; e[this.currentOrder.indexOf(d)] = f; return this.sort(e) } }); var Drag = new Class({ Implements: [Events, Options], options: { snap: 6, unit: "px", grid: false, style: true, limit: false, handle: false, invert: false, preventDefault: false, stopPropagation: false, modifiers: { x: "left", y: "top"} }, initialize: function () { var c = Array.link(arguments, { options: Object.type, element: $defined }); this.element = document.id(c.element); this.document = this.element.getDocument(); this.setOptions(c.options || {}); var d = $type(this.options.handle); this.handles = ((d == "array" || d == "collection") ? $$(this.options.handle) : document.id(this.options.handle)) || this.element; this.mouse = { now: {}, pos: {} }; this.value = { start: {}, now: {} }; this.selection = (Browser.Engine.trident) ? "selectstart" : "mousedown"; this.bound = { start: this.start.bind(this), check: this.check.bind(this), drag: this.drag.bind(this), stop: this.stop.bind(this), cancel: this.cancel.bind(this), eventStop: $lambda(false) }; this.attach() }, attach: function () { this.handles.addEvent("mousedown", this.bound.start); return this }, detach: function () { this.handles.removeEvent("mousedown", this.bound.start); return this }, start: function (h) { if (h.rightClick) { return } if (this.options.preventDefault) { h.preventDefault() } if (this.options.stopPropagation) { h.stopPropagation() } this.mouse.start = h.page; this.fireEvent("beforeStart", this.element); var f = this.options.limit; this.limit = { x: [], y: [] }; for (var g in this.options.modifiers) { if (!this.options.modifiers[g]) { continue } if (this.options.style) { this.value.now[g] = this.element.getStyle(this.options.modifiers[g]).toInt() } else { this.value.now[g] = this.element[this.options.modifiers[g]] } if (this.options.invert) { this.value.now[g] *= -1 } this.mouse.pos[g] = h.page[g] - this.value.now[g]; if (f && f[g]) { for (var e = 2; e--; e) { if ($chk(f[g][e])) { this.limit[g][e] = $lambda(f[g][e])() } } } } if ($type(this.options.grid) == "number") { this.options.grid = { x: this.options.grid, y: this.options.grid} } this.document.addEvents({ mousemove: this.bound.check, mouseup: this.bound.cancel }); this.document.addEvent(this.selection, this.bound.eventStop) }, check: function (d) { if (this.options.preventDefault) { d.preventDefault() } var c = Math.round(Math.sqrt(Math.pow(d.page.x - this.mouse.start.x, 2) + Math.pow(d.page.y - this.mouse.start.y, 2))); if (c > this.options.snap) { this.cancel(); this.document.addEvents({ mousemove: this.bound.drag, mouseup: this.bound.stop }); this.fireEvent("start", [this.element, d]).fireEvent("snap", this.element) } }, drag: function (d) { if (this.options.preventDefault) { d.preventDefault() } this.mouse.now = d.page; for (var c in this.options.modifiers) { if (!this.options.modifiers[c]) { continue } this.value.now[c] = this.mouse.now[c] - this.mouse.pos[c]; if (this.options.invert) { this.value.now[c] *= -1 } if (this.options.limit && this.limit[c]) { if ($chk(this.limit[c][1]) && (this.value.now[c] > this.limit[c][1])) { this.value.now[c] = this.limit[c][1] } else { if ($chk(this.limit[c][0]) && (this.value.now[c] < this.limit[c][0])) { this.value.now[c] = this.limit[c][0] } } } if (this.options.grid[c]) { this.value.now[c] -= ((this.value.now[c] - (this.limit[c][0] || 0)) % this.options.grid[c]) } if (this.options.style) { this.element.setStyle(this.options.modifiers[c], this.value.now[c] + this.options.unit) } else { this.element[this.options.modifiers[c]] = this.value.now[c] } } this.fireEvent("drag", [this.element, d]) }, cancel: function (b) { this.document.removeEvent("mousemove", this.bound.check); this.document.removeEvent("mouseup", this.bound.cancel); if (b) { this.document.removeEvent(this.selection, this.bound.eventStop); this.fireEvent("cancel", this.element) } }, stop: function (b) { this.document.removeEvent(this.selection, this.bound.eventStop); this.document.removeEvent("mousemove", this.bound.drag); this.document.removeEvent("mouseup", this.bound.stop); if (b) { this.fireEvent("complete", [this.element, b]) } } }); Element.implement({ makeResizable: function (d) { var c = new Drag(this, $merge({ modifiers: { x: "width", y: "height"} }, d)); this.store("resizer", c); return c.addEvent("drag", function () { this.fireEvent("resize", c) } .bind(this)) } }); Drag.Move = new Class({ Extends: Drag, options: { droppables: [], container: false, precalculate: false, includeMargins: true, checkDroppables: true }, initialize: function (d, e) { this.parent(d, e); d = this.element; this.droppables = $$(this.options.droppables); this.container = document.id(this.options.container); if (this.container && $type(this.container) != "element") { this.container = document.id(this.container.getDocument().body) } var f = d.getStyles("left", "right", "position"); if (f.left == "auto" || f.top == "auto") { d.setPosition(d.getPosition(d.getOffsetParent())) } if (f.position == "static") { d.setStyle("position", "absolute") } this.addEvent("start", this.checkDroppables, true); this.overed = null }, start: function (b) { if (this.container) { this.options.limit = this.calculateLimit() } if (this.options.precalculate) { this.positions = this.droppables.map(function (a) { return a.getCoordinates() }) } this.parent(b) }, calculateLimit: function () { var y = this.element.getOffsetParent(), v = this.container.getCoordinates(y), w = {}, z = {}, A = {}, t = {}, r = {}; ["top", "right", "bottom", "left"].each(function (a) { w[a] = this.container.getStyle("border-" + a).toInt(); A[a] = this.element.getStyle("border-" + a).toInt(); z[a] = this.element.getStyle("margin-" + a).toInt(); t[a] = this.container.getStyle("margin-" + a).toInt(); r[a] = y.getStyle("padding-" + a).toInt() }, this); var x = this.element.offsetWidth + z.left + z.right, o = this.element.offsetHeight + z.top + z.bottom, u = 0, s = 0, p = v.right - w.right - x, B = v.bottom - w.bottom - o; if (this.options.includeMargins) { u += z.left; s += z.top } else { p += z.right; B += z.bottom } if (this.element.getStyle("position") == "relative") { var q = this.element.getCoordinates(y); q.left -= this.element.getStyle("left").toInt(); q.top -= this.element.getStyle("top").toInt(); u += w.left - q.left; s += w.top - q.top; p += z.left - q.left; B += z.top - q.top; if (this.container != y) { u += t.left + r.left; s += (Browser.Engine.trident4 ? 0 : t.top) + r.top } } else { u -= z.left; s -= z.top; if (this.container == y) { p -= w.left; B -= w.top } else { u += v.left + w.left; s += v.top + w.top } } return { x: [u, p], y: [s, B]} }, checkAgainst: function (f, d) { f = (this.positions) ? this.positions[d] : f.getCoordinates(); var e = this.mouse.now; return (e.x > f.left && e.x < f.right && e.y < f.bottom && e.y > f.top) }, checkDroppables: function () { var b = this.droppables.filter(this.checkAgainst, this).getLast(); if (this.overed != b) { if (this.overed) { this.fireEvent("leave", [this.element, this.overed]) } if (b) { this.fireEvent("enter", [this.element, b]) } this.overed = b } }, drag: function (b) { this.parent(b); if (this.options.checkDroppables && this.droppables.length) { this.checkDroppables() } }, stop: function (b) { this.checkDroppables(); this.fireEvent("drop", [this.element, this.overed, b]); this.overed = null; return this.parent(b) } }); Element.implement({ makeDraggable: function (d) { var c = new Drag.Move(this, d); this.store("dragger", c); return c } }); var Slider = new Class({ Implements: [Events, Options], Binds: ["clickedElement", "draggedKnob", "scrolledElement"], options: { onTick: function (b) { if (this.options.snap) { b = this.toPosition(this.step) } this.knob.setStyle(this.property, b) }, initialStep: 0, snap: false, offset: 0, range: false, wheel: false, steps: 100, mode: "horizontal" }, initialize: function (k, i, l) { this.setOptions(l); this.element = document.id(k); this.knob = document.id(i); this.previousChange = this.previousEnd = this.step = -1; var j, h = {}, m = { x: false, y: false }; switch (this.options.mode) { case "vertical": this.axis = "y"; this.property = "top"; j = "offsetHeight"; break; case "horizontal": this.axis = "x"; this.property = "left"; j = "offsetWidth" } this.full = this.element.measure(function () { this.half = this.knob[j] / 2; return this.element[j] - this.knob[j] + (this.options.offset * 2) } .bind(this)); this.min = $chk(this.options.range[0]) ? this.options.range[0] : 0; this.max = $chk(this.options.range[1]) ? this.options.range[1] : this.options.steps; this.range = this.max - this.min; this.steps = this.options.steps || this.full; this.stepSize = Math.abs(this.range) / this.steps; this.stepWidth = this.stepSize * this.full / Math.abs(this.range); this.knob.setStyle("position", "relative").setStyle(this.property, this.options.initialStep ? this.toPosition(this.options.initialStep) : -this.options.offset); m[this.axis] = this.property; h[this.axis] = [-this.options.offset, this.full - this.options.offset]; var n = { snap: 0, limit: h, modifiers: m, onDrag: this.draggedKnob, onStart: this.draggedKnob, onBeforeStart: (function () { this.isDragging = true }).bind(this), onCancel: function () { this.isDragging = false } .bind(this), onComplete: function () { this.isDragging = false; this.draggedKnob(); this.end() } .bind(this) }; if (this.options.snap) { n.grid = Math.ceil(this.stepWidth); n.limit[this.axis][1] = this.full } this.drag = new Drag(this.knob, n); this.attach() }, attach: function () { this.element.addEvent("mousedown", this.clickedElement); if (this.options.wheel) { this.element.addEvent("mousewheel", this.scrolledElement) } this.drag.attach(); return this }, detach: function () { this.element.removeEvent("mousedown", this.clickedElement); this.element.removeEvent("mousewheel", this.scrolledElement); this.drag.detach(); return this }, set: function (b) { if (!((this.range > 0) ^ (b < this.min))) { b = this.min } if (!((this.range > 0) ^ (b > this.max))) { b = this.max } this.step = Math.round(b); this.checkStep(); this.fireEvent("tick", this.toPosition(this.step)); this.end(); return this }, clickedElement: function (f) { if (this.isDragging || f.target == this.knob) { return } var d = this.range < 0 ? -1 : 1; var e = f.page[this.axis] - this.element.getPosition()[this.axis] - this.half; e = e.limit(-this.options.offset, this.full - this.options.offset); this.step = Math.round(this.min + d * this.toStep(e)); this.checkStep(); this.fireEvent("tick", e); this.end() }, scrolledElement: function (d) { var c = (this.options.mode == "horizontal") ? (d.wheel < 0) : (d.wheel > 0); this.set(c ? this.step - this.stepSize : this.step + this.stepSize); d.stop() }, draggedKnob: function () { var c = this.range < 0 ? -1 : 1; var d = this.drag.value.now[this.axis]; d = d.limit(-this.options.offset, this.full - this.options.offset); this.step = Math.round(this.min + c * this.toStep(d)); this.checkStep() }, checkStep: function () { if (this.previousChange != this.step) { this.previousChange = this.step; this.fireEvent("change", this.step) } }, end: function () { if (this.previousEnd !== this.step) { this.previousEnd = this.step; this.fireEvent("complete", this.step + "") } }, toStep: function (d) { var c = (d + this.options.offset) * this.stepSize / this.full * this.steps; return this.options.steps ? Math.round(c -= c % this.stepSize) : c }, toPosition: function (b) { return (this.full * Math.abs(this.min - b)) / (this.steps * this.stepSize) - this.options.offset } }); var Sortables = new Class({ Implements: [Events, Options], options: { snap: 4, opacity: 1, clone: false, revert: false, handle: false, constrain: false }, initialize: function (d, c) { this.setOptions(c); this.elements = []; this.lists = []; this.idle = true; this.addLists($$(document.id(d) || d)); if (!this.options.clone) { this.options.revert = false } if (this.options.revert) { this.effect = new Fx.Morph(null, $merge({ duration: 250, link: "cancel" }, this.options.revert)) } }, attach: function () { this.addLists(this.lists); return this }, detach: function () { this.lists = this.removeLists(this.lists); return this }, addItems: function () { Array.flatten(arguments).each(function (d) { this.elements.push(d); var c = d.retrieve("sortables:start", this.start.bindWithEvent(this, d)); (this.options.handle ? d.getElement(this.options.handle) || d : d).addEvent("mousedown", c) }, this); return this }, addLists: function () { Array.flatten(arguments).each(function (b) { this.lists.push(b); this.addItems(b.getChildren()) }, this); return this }, removeItems: function () { return $$(Array.flatten(arguments).map(function (d) { this.elements.erase(d); var c = d.retrieve("sortables:start"); (this.options.handle ? d.getElement(this.options.handle) || d : d).removeEvent("mousedown", c); return d }, this)) }, removeLists: function () { return $$(Array.flatten(arguments).map(function (b) { this.lists.erase(b); this.removeItems(b.getChildren()); return b }, this)) }, getClone: function (c, d) { if (!this.options.clone) { return new Element("div").inject(document.body) } if ($type(this.options.clone) == "function") { return this.options.clone.call(this, c, d, this.list) } return d.clone(true).setStyles({ margin: "0px", position: "absolute", visibility: "hidden", width: d.getStyle("width") }).inject(this.list).setPosition(d.getPosition(d.getOffsetParent())) }, getDroppables: function () { var b = this.list.getChildren(); if (!this.options.constrain) { b = this.lists.concat(b).erase(this.list) } return b.erase(this.clone).erase(this.element) }, insert: function (f, d) { var e = "inside"; if (this.lists.contains(d)) { this.list = d; this.drag.droppables = this.getDroppables() } else { e = this.element.getAllPrevious().contains(d) ? "before" : "after" } this.element.inject(d, e); this.fireEvent("sort", [this.element, this.clone]) }, start: function (c, d) { if (!this.idle) { return } this.idle = false; this.element = d; this.opacity = d.get("opacity"); this.list = d.getParent(); this.clone = this.getClone(c, d); this.drag = new Drag.Move(this.clone, { snap: this.options.snap, container: this.options.constrain && this.element.getParent(), droppables: this.getDroppables(), onSnap: function () { c.stop(); this.clone.setStyle("visibility", "visible"); this.element.set("opacity", this.options.opacity || 0); this.fireEvent("start", [this.element, this.clone]) } .bind(this), onEnter: this.insert.bind(this), onCancel: this.reset.bind(this), onComplete: this.end.bind(this) }); this.clone.inject(this.element, "before"); this.drag.start(c) }, end: function () { this.drag.detach(); this.element.set("opacity", this.opacity); if (this.effect) { var d = this.element.getStyles("width", "height"); var c = this.clone.computePosition(this.element.getPosition(this.clone.offsetParent)); this.effect.element = this.clone; this.effect.start({ top: c.top, left: c.left, width: d.width, height: d.height, opacity: 0.25 }).chain(this.reset.bind(this)) } else { this.reset() } }, reset: function () { this.idle = true; this.clone.destroy(); this.fireEvent("complete", this.element) }, serialize: function () { var f = Array.link(arguments, { modifier: Function.type, index: $defined }); var d = this.lists.map(function (a) { return a.getChildren().map(f.modifier || function (b) { return b.get("id") }, this) }, this); var e = f.index; if (this.lists.length == 1) { e = 0 } return $chk(e) && e >= 0 && e < this.lists.length ? d[e] : d } }); Request.JSONP = new Class({ Implements: [Chain, Events, Options, Log], options: { url: "", data: {}, retries: 0, timeout: 0, link: "ignore", callbackKey: "callback", injectScript: document.head }, initialize: function (b) { this.setOptions(b); if (this.options.log) { this.enableLog() } this.running = false; this.requests = 0; this.triesRemaining = [] }, check: function () { if (!this.running) { return true } switch (this.options.link) { case "cancel": this.cancel(); return true; case "chain": this.chain(this.caller.bind(this, arguments)); return false } return false }, send: function (j) { if (!$chk(arguments[1]) && !this.check(j)) { return this } var h = $type(j), g = this.options, f = $chk(arguments[1]) ? arguments[1] : this.requests++; if (h == "string" || h == "element") { j = { data: j} } j = $extend({ data: g.data, url: g.url }, j); if (!$chk(this.triesRemaining[f])) { this.triesRemaining[f] = this.options.retries } var i = this.triesRemaining[f]; (function () { var a = this.getScript(j); this.log("JSONP retrieving script with url: " + a.get("src")); this.fireEvent("request", a); this.running = true; (function () { if (i) { this.triesRemaining[f] = i - 1; if (a) { a.destroy(); this.send(j, f).fireEvent("retry", this.triesRemaining[f]) } } else { if (a && this.options.timeout) { a.destroy(); this.cancel().fireEvent("failure") } } }).delay(this.options.timeout, this) }).delay(Browser.Engine.trident ? 50 : 0, this); return this }, cancel: function () { if (!this.running) { return this } this.running = false; this.fireEvent("cancel"); return this }, getScript: function (j) { var f = Request.JSONP.counter, i; Request.JSONP.counter++; switch ($type(j.data)) { case "element": i = document.id(j.data).toQueryString(); break; case "object": case "hash": i = Hash.toQueryString(j.data) } var h = j.url + (j.url.test("\\?") ? "&" : "?") + (j.callbackKey || this.options.callbackKey) + "=Request.JSONP.request_map.request_" + f + (i ? "&" + i : ""); if (h.length > 2083) { this.log("JSONP " + h + " will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs") } var g = new Element("script", { type: "text/javascript", src: h }); Request.JSONP.request_map["request_" + f] = function (a) { this.success(a, g) } .bind(this); return g.inject(this.options.injectScript) }, success: function (c, d) { if (d) { d.destroy() } this.running = false; this.log("JSONP successfully retrieved: ", c); this.fireEvent("complete", [c]).fireEvent("success", [c]).callChain() } }); Request.JSONP.counter = 0; Request.JSONP.request_map = {}; Request.Queue = new Class({ Implements: [Options, Events], Binds: ["attach", "request", "complete", "cancel", "success", "failure", "exception"], options: { stopOnFailure: true, autoAdvance: true, concurrent: 1, requests: {} }, initialize: function (d) { if (d) { var c = d.requests; delete d.requests } this.setOptions(d); this.requests = new Hash; this.queue = []; this.reqBinders = {}; if (c) { this.addRequests(c) } }, addRequest: function (d, c) { this.requests.set(d, c); this.attach(d, c); return this }, addRequests: function (b) { $each(b, function (d, a) { this.addRequest(a, d) }, this); return this }, getName: function (b) { return this.requests.keyOf(b) }, attach: function (d, c) { if (c._groupSend) { return this } ["request", "complete", "cancel", "success", "failure", "exception"].each(function (a) { if (!this.reqBinders[d]) { this.reqBinders[d] = {} } this.reqBinders[d][a] = function () { this["on" + a.capitalize()].apply(this, [d, c].extend(arguments)) } .bind(this); c.addEvent(a, this.reqBinders[d][a]) }, this); c._groupSend = c.send; c.send = function (a) { this.send(d, a); return c } .bind(this); return this }, removeRequest: function (c) { var d = $type(c) == "object" ? this.getName(c) : c; if (!d && $type(d) != "string") { return this } c = this.requests.get(d); if (!c) { return this } ["request", "complete", "cancel", "success", "failure", "exception"].each(function (a) { c.removeEvent(a, this.reqBinders[d][a]) }, this); c.send = c._groupSend; delete c._groupSend; return this }, getRunning: function () { return this.requests.filter(function (b) { return b.running }) }, isRunning: function () { return !!(this.getRunning().getKeys().length) }, send: function (d, e) { var f = function () { this.requests.get(d)._groupSend(e); this.queue.erase(f) } .bind(this); f.name = d; if (this.getRunning().getKeys().length >= this.options.concurrent || (this.error && this.options.stopOnFailure)) { this.queue.push(f) } else { f() } return this }, hasNext: function (b) { return (!b) ? !!this.queue.length : !!this.queue.filter(function (a) { return a.name == b }).length }, resume: function () { this.error = false; (this.options.concurrent - this.getRunning().getKeys().length).times(this.runNext, this); return this }, runNext: function (d) { if (!this.queue.length) { return this } if (!d) { this.queue[0]() } else { var c; this.queue.each(function (a) { if (!c && a.name == d) { c = true; a() } }) } return this }, runAll: function () { this.queue.each(function (b) { b() }); return this }, clear: function (b) { if (!b) { this.queue.empty() } else { this.queue = this.queue.map(function (a) { if (a.name != b) { return a } else { return false } }).filter(function (a) { return a }) } return this }, cancel: function (b) { this.requests.get(b).cancel(); return this }, onRequest: function () { this.fireEvent("request", arguments) }, onComplete: function () { this.fireEvent("complete", arguments); if (!this.queue.length) { this.fireEvent("end") } }, onCancel: function () { if (this.options.autoAdvance && !this.error) { this.runNext() } this.fireEvent("cancel", arguments) }, onSuccess: function () { if (this.options.autoAdvance && !this.error) { this.runNext() } this.fireEvent("success", arguments) }, onFailure: function () { this.error = true; if (!this.options.stopOnFailure && this.options.autoAdvance) { this.runNext() } this.fireEvent("failure", arguments) }, onException: function () { this.error = true; if (!this.options.stopOnFailure && this.options.autoAdvance) { this.runNext() } this.fireEvent("exception", arguments) } }); Request.implement({ options: { initialDelay: 5000, delay: 5000, limit: 60000 }, startTimer: function (c) { var d = function () { if (!this.running) { this.send({ data: c }) } }; this.timer = d.delay(this.options.initialDelay, this); this.lastDelay = this.options.initialDelay; this.completeCheck = function (a) { $clear(this.timer); this.lastDelay = (a) ? this.options.delay : (this.lastDelay + this.options.delay).min(this.options.limit); this.timer = d.delay(this.lastDelay, this) }; return this.addEvent("complete", this.completeCheck) }, stopTimer: function () { $clear(this.timer); return this.removeEvent("complete", this.completeCheck) } }); var Asset = { javascript: function (k, m) { m = $extend({ onload: $empty, document: document, check: $lambda(true) }, m); var h = new Element("script", { src: k, type: "text/javascript" }); var l = m.onload.bind(h), i = m.check, j = m.document; delete m.onload; delete m.check; delete m.document; h.addEvents({ load: l, readystatechange: function () { if (["loaded", "complete"].contains(this.readyState)) { l() } } }).set(m); if (Browser.Engine.webkit419) { var n = (function () { if (!$try(i)) { return } $clear(n); l() }).periodical(50) } return h.inject(j.head) }, css: function (c, d) { return new Element("link", $merge({ rel: "stylesheet", media: "screen", type: "text/css", href: c }, d)).inject(document.head) }, image: function (h, e) { e = $merge({ onload: $empty, onabort: $empty, onerror: $empty }, e); var g = new Image(); var f = document.id(g) || new Element("img"); ["load", "abort", "error"].each(function (c) { var b = "on" + c; var a = e[b]; delete e[b]; g[b] = function () { if (!g) { return } if (!f.parentNode) { f.width = g.width; f.height = g.height } g = g.onload = g.onabort = g.onerror = null; a.delay(1, f, f); f.fireEvent(c, f, 1) } }); g.src = f.src = h; if (g && g.complete) { g.onload.delay(1) } return f.set(e) }, images: function (g, h) { h = $merge({ onComplete: $empty, onProgress: $empty, onError: $empty, properties: {} }, h); g = $splat(g); var f = []; var e = 0; return new Elements(g.map(function (a) { return Asset.image(a, $extend(h.properties, { onload: function () { h.onProgress.call(this, e, g.indexOf(a)); e++; if (e == g.length) { h.onComplete() } }, onerror: function () { h.onError.call(this, e, g.indexOf(a)); e++; if (e == g.length) { h.onComplete() } } })) })) } }; var Color = new Native({ initialize: function (d, f) { if (arguments.length >= 3) { f = "rgb"; d = Array.slice(arguments, 0, 3) } else { if (typeof d == "string") { if (d.match(/rgb/)) { d = d.rgbToHex().hexToRgb(true) } else { if (d.match(/hsb/)) { d = d.hsbToRgb() } else { d = d.hexToRgb(true) } } } } f = f || "rgb"; switch (f) { case "hsb": var e = d; d = d.hsbToRgb(); d.hsb = e; break; case "hex": d = d.hexToRgb(true); break } d.rgb = d.slice(0, 3); d.hsb = d.hsb || d.rgbToHsb(); d.hex = d.rgbToHex(); return $extend(d, this) } }); Color.implement({ mix: function () { var e = Array.slice(arguments); var f = ($type(e.getLast()) == "number") ? e.pop() : 50; var d = this.slice(); e.each(function (b) { b = new Color(b); for (var a = 0; a < 3; a++) { d[a] = Math.round((d[a] / 100 * (100 - f)) + (b[a] / 100 * f)) } }); return new Color(d, "rgb") }, invert: function () { return new Color(this.map(function (b) { return 255 - b })) }, setHue: function (b) { return new Color([b, this.hsb[1], this.hsb[2]], "hsb") }, setSaturation: function (b) { return new Color([this.hsb[0], b, this.hsb[2]], "hsb") }, setBrightness: function (b) { return new Color([this.hsb[0], this.hsb[1], b], "hsb") } }); var $RGB = function (e, f, b) { return new Color([e, f, b], "rgb") }; var $HSB = function (e, f, b) { return new Color([e, f, b], "hsb") }; var $HEX = function (b) { return new Color(b, "hex") }; Array.implement({ rgbToHsb: function () { var w = this[0], v = this[1], o = this[2], r = 0; var p = Math.max(w, v, o), t = Math.min(w, v, o); var n = p - t; var q = p / 255, s = (p != 0) ? n / p : 0; if (s != 0) { var u = (p - w) / n; var x = (p - v) / n; var m = (p - o) / n; if (w == p) { r = m - x } else { if (v == p) { r = 2 + u - m } else { r = 4 + x - u } } r /= 6; if (r < 0) { r++ } } return [Math.round(r * 360), Math.round(s * 100), Math.round(q * 100)] }, hsbToRgb: function () { var l = Math.round(this[2] / 100 * 255); if (this[1] == 0) { return [l, l, l] } else { var h = this[0] % 360; var j = h % 60; var i = Math.round((this[2] * (100 - this[1])) / 10000 * 255); var k = Math.round((this[2] * (6000 - this[1] * j)) / 600000 * 255); var f = Math.round((this[2] * (6000 - this[1] * (60 - j))) / 600000 * 255); switch (Math.floor(h / 60)) { case 0: return [l, f, i]; case 1: return [k, l, i]; case 2: return [i, l, f]; case 3: return [i, k, l]; case 4: return [f, i, l]; case 5: return [l, i, k] } } return false } }); String.implement({ rgbToHsb: function () { var b = this.match(/\d{1,3}/g); return (b) ? b.rgbToHsb() : null }, hsbToRgb: function () { var b = this.match(/\d{1,3}/g); return (b) ? b.hsbToRgb() : null } }); var Group = new Class({ initialize: function () { this.instances = Array.flatten(arguments); this.events = {}; this.checker = {} }, addEvent: function (c, d) { this.checker[c] = this.checker[c] || {}; this.events[c] = this.events[c] || []; if (this.events[c].contains(d)) { return false } else { this.events[c].push(d) } this.instances.each(function (b, a) { b.addEvent(c, this.check.bind(this, [c, b, a])) }, this); return this }, check: function (h, f, e) { this.checker[h][e] = true; var g = this.instances.every(function (a, b) { return this.checker[h][b] || false }, this); if (!g) { return } this.checker[h] = {}; this.events[h].each(function (a) { a.call(this, this.instances, f) }, this) } }); Hash.Cookie = new Class({ Extends: Cookie, options: { autoSave: true }, initialize: function (c, d) { this.parent(c, d); this.load() }, save: function () { var b = JSON.encode(this.hash); if (!b || b.length > 4096) { return false } if (b == "{}") { this.dispose() } else { this.write(b) } return true }, load: function () { this.hash = new Hash(JSON.decode(this.read(), true)); return this } }); Hash.each(Hash.prototype, function (c, d) { if (typeof c == "function") { Hash.Cookie.implement(d, function () { var a = c.apply(this.hash, arguments); if (this.options.autoSave) { this.save() } return a }) } }); var IframeShim = new Class({ Implements: [Options, Events, Class.Occlude], options: { className: "iframeShim", src: 'javascript:false;document.write("");', display: false, zIndex: null, margin: 0, offset: { x: 0, y: 0 }, browsers: (Browser.Engine.trident4 || (Browser.Engine.gecko && !Browser.Engine.gecko19 && Browser.Platform.mac)) }, property: "IframeShim", initialize: function (c, d) { this.element = document.id(c); if (this.occlude()) { return this.occluded } this.setOptions(d); this.makeShim(); return this }, makeShim: function () { if (this.options.browsers) { var f = this.element.getStyle("zIndex").toInt(); if (!f) { f = 1; var d = this.element.getStyle("position"); if (d == "static" || !d) { this.element.setStyle("position", "relative") } this.element.setStyle("zIndex", f) } f = ($chk(this.options.zIndex) && f > this.options.zIndex) ? this.options.zIndex : f - 1; if (f < 0) { f = 1 } this.shim = new Element("iframe", { src: this.options.src, scrolling: "no", frameborder: 0, styles: { zIndex: f, position: "absolute", border: "none", filter: "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" }, "class": this.options.className }).store("IframeShim", this); var e = (function () { this.shim.inject(this.element, "after"); this[this.options.display ? "show" : "hide"](); this.fireEvent("inject") }).bind(this); if (IframeShim.ready) { window.addEvent("load", e) } else { e() } } else { this.position = this.hide = this.show = this.dispose = $lambda(this) } }, position: function () { if (!IframeShim.ready || !this.shim) { return this } var b = this.element.measure(function () { return this.getSize() }); if (this.options.margin != undefined) { b.x = b.x - (this.options.margin * 2); b.y = b.y - (this.options.margin * 2); this.options.offset.x += this.options.margin; this.options.offset.y += this.options.margin } this.shim.set({ width: b.x, height: b.y }).position({ relativeTo: this.element, offset: this.options.offset }); return this }, hide: function () { if (this.shim) { this.shim.setStyle("display", "none") } return this }, show: function () { if (this.shim) { this.shim.setStyle("display", "block") } return this.position() }, dispose: function () { if (this.shim) { this.shim.dispose() } return this }, destroy: function () { if (this.shim) { this.shim.destroy() } return this } }); window.addEvent("load", function () { IframeShim.ready = true }); var HtmlTable = new Class({ Implements: [Options, Events, Class.Occlude], options: { properties: { cellpadding: 0, cellspacing: 0, border: 0 }, rows: [], headers: [], footers: [] }, property: "HtmlTable", initialize: function () { var b = Array.link(arguments, { options: Object.type, table: Element.type }); this.setOptions(b.options); this.element = b.table || new Element("table", this.options.properties); if (this.occlude()) { return this.occluded } this.build() }, build: function () { this.element.store("HtmlTable", this); this.body = document.id(this.element.tBodies[0]) || new Element("tbody").inject(this.element); $$(this.body.rows); if (this.options.headers.length) { this.setHeaders(this.options.headers) } else { this.thead = document.id(this.element.tHead) } if (this.thead) { this.head = document.id(this.thead.rows[0]) } if (this.options.footers.length) { this.setFooters(this.options.footers) } this.tfoot = document.id(this.element.tFoot); if (this.tfoot) { this.foot = document.id(this.thead.rows[0]) } this.options.rows.each(function (b) { this.push(b) }, this); ["adopt", "inject", "wraps", "grab", "replaces", "dispose"].each(function (b) { this[b] = this.element[b].bind(this.element) }, this) }, toElement: function () { return this.element }, empty: function () { this.body.empty(); return this }, setHeaders: function (b) { this.thead = (document.id(this.element.tHead) || new Element("thead").inject(this.element, "top")).empty(); this.push(b, this.thead, "th"); this.head = document.id(this.thead.rows[0]); return this }, setFooters: function (b) { this.tfoot = (document.id(this.element.tFoot) || new Element("tfoot").inject(this.element, "top")).empty(); this.push(b, this.tfoot); this.foot = document.id(this.thead.rows[0]); return this }, push: function (g, h, f) { var e = g.map(function (b) { var a = new Element(f || "td", b.properties), c = b.content || b || "", d = document.id(c); if (d) { a.adopt(d) } else { a.set("html", c) } return a }); return { tr: new Element("tr").inject(h || this.body).adopt(e), tds: e} } }); HtmlTable = Class.refactor(HtmlTable, { options: { classZebra: "table-tr-odd", zebra: true }, initialize: function () { this.previous.apply(this, arguments); if (this.occluded) { return this.occluded } if (this.options.zebra) { this.updateZebras() } }, updateZebras: function () { Array.each(this.body.rows, this.zebra, this) }, zebra: function (c, d) { return c[((d % 2) ? "remove" : "add") + "Class"](this.options.classZebra) }, push: function () { var b = this.previous.apply(this, arguments); if (this.options.zebra) { this.updateZebras() } return b } }); HtmlTable = Class.refactor(HtmlTable, { options: { sortIndex: 0, sortReverse: false, parsers: [], defaultParser: "string", classSortable: "table-sortable", classHeadSort: "table-th-sort", classHeadSortRev: "table-th-sort-rev", classNoSort: "table-th-nosort", classGroupHead: "table-tr-group-head", classGroup: "table-tr-group", classCellSort: "table-td-sort", classSortSpan: "table-th-sort-span", sortable: false }, initialize: function () { this.previous.apply(this, arguments); if (this.occluded) { return this.occluded } this.sorted = { index: null, dir: 1 }; this.bound = { headClick: this.headClick.bind(this) }; this.sortSpans = new Elements(); if (this.options.sortable) { this.enableSort(); if (this.options.sortIndex != null) { this.sort(this.options.sortIndex, this.options.sortReverse) } } }, attachSorts: function (b) { this.element[$pick(b, true) ? "addEvent" : "removeEvent"]("click:relay(th)", this.bound.headClick) }, setHeaders: function () { this.previous.apply(this, arguments); if (this.sortEnabled) { this.detectParsers() } }, detectParsers: function (f) { if (!this.head) { return } var e = this.options.parsers, d = this.body.rows; this.parsers = $$(this.head.cells).map(function (j, i) { if (!f && (j.hasClass(this.options.classNoSort) || j.retrieve("htmltable-sort"))) { return j.retrieve("htmltable-sort") } var b = new Element("span", { html: "&#160;", "class": this.options.classSortSpan }).inject(j, "top"); this.sortSpans.push(b); var a = e[i], c; switch ($type(a)) { case "function": a = { convert: a }; c = true; break; case "string": a = a; c = true; break } if (!c) { HtmlTable.Parsers.some(function (r) { var h = r.match; if (!h) { return false } if (Browser.Engine.trident) { return false } for (var g = 0, p = d.length; g < p; g++) { var q = d[g].cells[i].get("html").clean(); if (q && h.test(q)) { a = r; return true } } }) } if (!a) { a = this.options.defaultParser } j.store("htmltable-parser", a); return a }, this) }, headClick: function (f, d) { if (!this.head) { return } var e = Array.indexOf(this.head.cells, d); this.sort(e); return false }, sort: function (E, C, z) { if (!this.head) { return } z = !!(z); var A = this.options.classCellSort; var x = this.options.classGroup, i = this.options.classGroupHead; if (!z) { if (E != null) { if (this.sorted.index == E) { this.sorted.reverse = !(this.sorted.reverse) } else { if (this.sorted.index != null) { this.sorted.reverse = false; this.head.cells[this.sorted.index].removeClass(this.options.classHeadSort).removeClass(this.options.classHeadSortRev) } else { this.sorted.reverse = true } this.sorted.index = E } } else { E = this.sorted.index } if (C != null) { this.sorted.reverse = C } var G = document.id(this.head.cells[E]); if (G) { G.addClass(this.options.classHeadSort); if (this.sorted.reverse) { G.addClass(this.options.classHeadSortRev) } else { G.removeClass(this.options.classHeadSortRev) } } this.body.getElements("td").removeClass(this.options.classCellSort) } var H = this.parsers[E]; if ($type(H) == "string") { H = HtmlTable.Parsers.get(H) } if (!H) { return } if (!Browser.Engine.trident) { var I = this.body.getParent(); this.body.dispose() } var j = Array.map(this.body.rows, function (a, c) { var b = H.convert.call(document.id(a.cells[E])); return { position: c, value: b, toString: function () { return b.toString() } } }, this); j.reverse(true); j.sort(function (a, b) { if (a.value === b.value) { return 0 } return a.value > b.value ? 1 : -1 }); if (!this.sorted.reverse) { j.reverse(true) } var w = j.length, B = this.body; var y, u, J, D; while (w) { var v = j[--w]; u = v.position; var F = B.rows[u]; if (F.disabled) { continue } if (!z) { if (D === v.value) { F.removeClass(i).addClass(x) } else { D = v.value; F.removeClass(x).addClass(i) } if (this.zebra) { this.zebra(F, w) } F.cells[E].addClass(A) } B.appendChild(F); for (y = 0; y < w; y++) { if (j[y].position > u) { j[y].position-- } } } j = null; if (I) { I.grab(B) } return this.fireEvent("sort", [B, E]) }, reSort: function () { if (this.sortEnabled) { this.sort.call(this, this.sorted.index, this.sorted.reverse) } return this }, enableSort: function () { this.element.addClass(this.options.classSortable); this.attachSorts(true); this.detectParsers(); this.sortEnabled = true; return this }, disableSort: function () { this.element.remove(this.options.classSortable); this.attachSorts(false); this.sortSpans.each(function (b) { b.destroy() }); this.sortSpans.empty(); this.sortEnabled = false; return this } }); HtmlTable.Parsers = new Hash({ date: { match: /^\d{2}[-\/ ]\d{2}[-\/ ]\d{2,4}$/, convert: function () { return Date.parse(this.get("text").format("db")) }, type: "date" }, "input-checked": { match: / type="(radio|checkbox)" /, convert: function () { return this.getElement("input").checked } }, "input-value": { match: /<input/, convert: function () { return this.getElement("input").value } }, number: { match: /^\d+[^\d.,]*$/, convert: function () { return this.get("text").toInt() }, number: true }, numberLax: { match: /^[^\d]+\d+$/, convert: function () { return this.get("text").replace(/[^-?^0-9]/, "").toInt() }, number: true }, "float": { match: /^[\d]+\.[\d]+/, convert: function () { return this.get("text").replace(/[^-?^\d.]/, "").toFloat() }, number: true }, floatLax: { match: /^[^\d]+[\d]+\.[\d]+$/, convert: function () { return this.get("text").replace(/[^-?^\d.]/, "") }, number: true }, string: { match: null, convert: function () { return this.get("text") } }, title: { match: null, convert: function () { return this.title } } }); HtmlTable = Class.refactor(HtmlTable, { options: { useKeyboard: true, classRowSelected: "table-tr-selected", classRowHovered: "table-tr-hovered", classSelectable: "table-selectable", allowMultiSelect: true, selectable: false }, initialize: function () { this.previous.apply(this, arguments); if (this.occluded) { return this.occluded } this.selectedRows = new Elements(); this.bound = { mouseleave: this.mouseleave.bind(this), focusRow: this.focusRow.bind(this) }; if (this.options.selectable) { this.enableSelect() } }, enableSelect: function () { this.selectEnabled = true; this.attachSelects(); this.element.addClass(this.options.classSelectable) }, disableSelect: function () { this.selectEnabled = false; this.attach(false); this.element.removeClass(this.options.classSelectable) }, attachSelects: function (d) { d = $pick(d, true); var c = d ? "addEvents" : "removeEvents"; this.element[c]({ mouseleave: this.bound.mouseleave }); this.body[c]({ "click:relay(tr)": this.bound.focusRow }); if (this.options.useKeyboard || this.keyboard) { if (!this.keyboard) { this.keyboard = new Keyboard({ events: { down: function (a) { a.preventDefault(); this.shiftFocus(1) } .bind(this), up: function (a) { a.preventDefault(); this.shiftFocus(-1) } .bind(this), enter: function (a) { a.preventDefault(); if (this.hover) { this.focusRow(this.hover) } } .bind(this) }, active: true }) } this.keyboard[d ? "activate" : "deactivate"]() } this.updateSelects() }, mouseleave: function () { if (this.hover) { this.leaveRow(this.hover) } }, focus: function () { if (this.keyboard) { this.keyboard.activate() } }, blur: function () { if (this.keyboard) { this.keyboard.deactivate() } }, push: function () { var b = this.previous.apply(this, arguments); this.updateSelects(); return b }, updateSelects: function () { Array.each(this.body.rows, function (d) { var c = d.retrieve("binders"); if ((c && this.selectEnabled) || (!c && !this.selectEnabled)) { return } if (!c) { c = { mouseenter: this.enterRow.bind(this, [d]), mouseleave: this.leaveRow.bind(this, [d]) }; d.store("binders", c).addEvents(c) } else { d.removeEvents(c) } }, this) }, enterRow: function (b) { if (this.hover) { this.hover = this.leaveRow(this.hover) } this.hover = b.addClass(this.options.classRowHovered) }, shiftFocus: function (d) { if (!this.hover) { return this.enterRow(this.body.rows[0]) } var c = Array.indexOf(this.body.rows, this.hover) + d; if (c < 0) { c = 0 } if (c >= this.body.rows.length) { c = this.body.rows.length - 1 } if (this.hover == this.body.rows[c]) { return this } this.enterRow(this.body.rows[c]) }, leaveRow: function (b) { b.removeClass(this.options.classRowHovered) }, focusRow: function () { var c = arguments[1] || arguments[0]; if (!this.body.getChildren().contains(c)) { return } var d = function (a) { this.selectedRows.erase(a); a.removeClass(this.options.classRowSelected); this.fireEvent("rowUnfocus", [a, this.selectedRows]) } .bind(this); if (!this.options.allowMultiSelect) { this.selectedRows.each(d) } if (!this.selectedRows.contains(c)) { this.selectedRows.push(c); c.addClass(this.options.classRowSelected); this.fireEvent("rowFocus", [c, this.selectedRows]) } else { d(c) } return false }, selectAll: function (b) { b = $pick(b, true); if (!this.options.allowMultiSelect && b) { return } if (!b) { this.selectedRows.removeClass(this.options.classRowSelected).empty() } else { this.selectedRows.combine(this.body.rows).addClass(this.options.classRowSelected) } return this }, selectNone: function () { return this.selectAll(false) } }); (function () { var g = {}; var f = ["shift", "control", "alt", "meta"]; var i = /^(?:shift|control|ctrl|alt|meta)$/; var h = function (b, c) { b = b.toLowerCase().replace(/^(keyup|keydown):/, function (m, n) { c = n; return "" }); if (!g[b]) { var d = "", a = {}; b.split("+").each(function (l) { if (i.test(l)) { a[l] = true } else { d = l } }); a.control = a.control || a.ctrl; var e = ""; f.each(function (l) { if (a[l]) { e += l + "+" } }); g[b] = e + d } return c + ":" + g[b] }; this.Keyboard = new Class({ Extends: Events, Implements: [Options, Log], options: { defaultEventType: "keydown", active: false, events: {} }, initialize: function (a) { this.setOptions(a); if (Keyboard.manager) { Keyboard.manager.manage(this) } this.setup() }, setup: function () { this.addEvents(this.options.events); if (this.options.active) { this.activate() } }, handle: function (a, b) { if (!this.active || a.preventKeyboardPropagation) { return } var c = !!this.manager; if (c && this.activeKB) { this.activeKB.handle(a, b); if (a.preventKeyboardPropagation) { return } } this.fireEvent(b, a); if (!c && this.activeKB) { this.activeKB.handle(a, b) } }, addEvent: function (a, b, c) { return this.parent(h(a, this.options.defaultEventType), b, c) }, removeEvent: function (a, b) { return this.parent(h(a, this.options.defaultEventType), b) }, activate: function () { this.active = true; return this.enable() }, deactivate: function () { this.active = false; return this.fireEvent("deactivate") }, toggleActive: function () { return this[this.active ? "deactivate" : "activate"]() }, enable: function (a) { if (a) { if (a != this.activeKB) { this.previous = this.activeKB } this.activeKB = a.fireEvent("activate") } else { if (this.manager) { this.manager.enable(this) } } return this }, relenquish: function () { if (this.previous) { this.enable(this.previous) } }, manage: function (a) { if (a.manager) { a.manager.drop(a) } this.instances.push(a); a.manager = this; if (!this.activeKB) { this.enable(a) } else { this._disable(a) } }, _disable: function (a) { if (this.activeKB == a) { this.activeKB = null } }, drop: function (a) { this._disable(a); this.instances.erase(a) }, instances: [], trace: function () { this.enableLog(); var a = this; this.log("the following items have focus: "); while (a) { this.log(document.id(a.widget) || a.widget || a, "active: " + this.active); a = a.activeKB } } }); Keyboard.stop = function (a) { a.preventKeyboardPropagation = true }; Keyboard.manager = new this.Keyboard({ active: true }); Keyboard.trace = function () { Keyboard.manager.trace() }; var j = function (a) { var b = ""; f.each(function (c) { if (a[c]) { b += c + "+" } }); Keyboard.manager.handle(a, a.type + ":" + b + a.key) }; document.addEvents({ keyup: j, keydown: j }); Event.Keys.extend({ pageup: 33, pagedown: 34, end: 35, home: 36, capslock: 20, numlock: 144, scrolllock: 145 }) })(); var Mask = new Class({ Implements: [Options, Events], Binds: ["resize"], options: { style: {}, "class": "mask", maskMargins: false, useIframeShim: true }, initialize: function (c, d) { this.target = document.id(c) || document.body; this.target.store("mask", this); this.setOptions(d); this.render(); this.inject() }, render: function () { this.element = new Element("div", { "class": this.options["class"], id: this.options.id || "mask-" + $time(), styles: $merge(this.options.style, { display: "none" }), events: { click: function () { this.fireEvent("click"); if (this.options.hideOnClick) { this.hide() } } .bind(this)} }); this.hidden = true }, toElement: function () { return this.element }, inject: function (c, d) { d = d || this.options.inject ? this.options.inject.where : "" || this.target == document.body ? "inside" : "after"; c = c || this.options.inject ? this.options.inject.target : "" || this.target; this.element.inject(c, d); if (this.options.useIframeShim) { this.shim = new IframeShim(this.element); this.addEvents({ show: this.shim.show.bind(this.shim), hide: this.shim.hide.bind(this.shim), destroy: this.shim.destroy.bind(this.shim) }) } }, position: function () { this.resize(this.options.width, this.options.height); this.element.position({ relativeTo: this.target, position: "topLeft", ignoreMargins: !this.options.maskMargins, ignoreScroll: this.target == document.body }); return this }, resize: function (g, h) { var f = { styles: ["padding", "border"] }; if (this.options.maskMargins) { f.styles.push("margin") } var i = this.target.getComputedSize(f); if (this.target == document.body) { var j = window.getSize(); if (i.totalHeight < j.y) { i.totalHeight = j.y } if (i.totalWidth < j.x) { i.totalWidth = j.x } } this.element.setStyles({ width: $pick(g, i.totalWidth, i.x), height: $pick(h, i.totalHeight, i.y) }); return this }, show: function () { if (!this.hidden) { return this } this.target.addEvent("resize", this.resize); if (this.target != document.body) { document.id(document.body).addEvent("resize", this.resize) } this.position(); this.showMask.apply(this, arguments); return this }, showMask: function () { this.element.setStyle("display", "block"); this.hidden = false; this.fireEvent("show") }, hide: function () { if (this.hidden) { return this } this.target.removeEvent("resize", this.resize); this.hideMask.apply(this, arguments); if (this.options.destroyOnHide) { return this.destroy() } return this }, hideMask: function () { this.element.setStyle("display", "none"); this.hidden = true; this.fireEvent("hide") }, toggle: function () { this[this.hidden ? "show" : "hide"]() }, destroy: function () { this.hide(); this.element.destroy(); this.fireEvent("destroy"); this.target.eliminate("mask") } }); Element.Properties.mask = { set: function (c) { var d = this.retrieve("mask"); return this.eliminate("mask").store("mask:options", c) }, get: function (b) { if (b || !this.retrieve("mask")) { if (this.retrieve("mask")) { this.retrieve("mask").destroy() } if (b || !this.retrieve("mask:options")) { this.set("mask", b) } this.store("mask", new Mask(this, this.retrieve("mask:options"))) } return this.retrieve("mask") } }; Element.implement({ mask: function (b) { this.get("mask", b).show(); return this }, unmask: function () { this.get("mask").hide(); return this } }); var Scroller = new Class({ Implements: [Events, Options], options: { area: 20, velocity: 1, onChange: function (d, c) { this.element.scrollTo(d, c) }, fps: 50 }, initialize: function (c, d) { this.setOptions(d); this.element = document.id(c); this.listener = ($type(this.element) != "element") ? document.id(this.element.getDocument().body) : this.element; this.timer = null; this.bound = { attach: this.attach.bind(this), detach: this.detach.bind(this), getCoords: this.getCoords.bind(this)} }, start: function () { this.listener.addEvents({ mouseover: this.bound.attach, mouseout: this.bound.detach }) }, stop: function () { this.listener.removeEvents({ mouseover: this.bound.attach, mouseout: this.bound.detach }); this.detach(); this.timer = $clear(this.timer) }, attach: function () { this.listener.addEvent("mousemove", this.bound.getCoords) }, detach: function () { this.listener.removeEvent("mousemove", this.bound.getCoords); this.timer = $clear(this.timer) }, getCoords: function (b) { this.page = (this.listener.get("tag") == "body") ? b.client : b.page; if (!this.timer) { this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this) } }, scroll: function () { var g = this.element.getSize(), h = this.element.getScroll(), i = this.element.getOffsets(), l = this.element.getScrollSize(), j = { x: 0, y: 0 }; for (var k in this.page) { if (this.page[k] < (this.options.area + i[k]) && h[k] != 0) { j[k] = (this.page[k] - this.options.area - i[k]) * this.options.velocity } else { if (this.page[k] + this.options.area > (g[k] + i[k]) && h[k] + g[k] != l[k]) { j[k] = (this.page[k] - g[k] + this.options.area - i[k]) * this.options.velocity } } } if (j.y || j.x) { this.fireEvent("change", [h.x + j.x, h.y + j.y]) } } }); (function () { var b = function (d, a) { return (d) ? ($type(d) == "function" ? d(a) : a.get(d)) : "" }; this.Tips = new Class({ Implements: [Events, Options], options: { onShow: function () { this.tip.setStyle("display", "block") }, onHide: function () { this.tip.setStyle("display", "none") }, title: "title", text: function (a) { return a.get("rel") || a.get("href") }, showDelay: 100, hideDelay: 100, className: "tip-wrap", offset: { x: 16, y: 16 }, fixed: false }, initialize: function () { var a = Array.link(arguments, { options: Object.type, elements: $defined }); this.setOptions(a.options); document.id(this); if (a.elements) { this.attach(a.elements) } }, toElement: function () { if (this.tip) { return this.tip } this.container = new Element("div", { "class": "tip" }); return this.tip = new Element("div", { "class": this.options.className, styles: { position: "absolute", top: 0, left: 0} }).adopt(new Element("div", { "class": "tip-top" }), this.container, new Element("div", { "class": "tip-bottom" })).inject(document.body) }, attach: function (a) { $$(a).each(function (i) { var g = b(this.options.title, i), h = b(this.options.text, i); i.erase("title").store("tip:native", g).retrieve("tip:title", g); i.retrieve("tip:text", h); this.fireEvent("attach", [i]); var j = ["enter", "leave"]; if (!this.options.fixed) { j.push("move") } j.each(function (c) { var d = i.retrieve("tip:" + c); if (!d) { d = this["element" + c.capitalize()].bindWithEvent(this, i) } i.store("tip:" + c, d).addEvent("mouse" + c, d) }, this) }, this); return this }, detach: function (a) { $$(a).each(function (e) { ["enter", "leave", "move"].each(function (c) { e.removeEvent("mouse" + c, e.retrieve("tip:" + c)).eliminate("tip:" + c) }); this.fireEvent("detach", [e]); if (this.options.title == "title") { var f = e.retrieve("tip:native"); if (f) { e.set("title", f) } } }, this); return this }, elementEnter: function (d, a) { this.container.empty(); ["title", "text"].each(function (c) { var f = a.retrieve("tip:" + c); if (f) { this.fill(new Element("div", { "class": "tip-" + c }).inject(this.container), f) } }, this); $clear(this.timer); this.timer = this.show.delay(this.options.showDelay, this, a); this.position((this.options.fixed) ? { page: a.getPosition()} : d) }, elementLeave: function (d, a) { $clear(this.timer); this.timer = this.hide.delay(this.options.hideDelay, this, a); this.fireForParent(d, a) }, fireForParent: function (d, a) { if (!a) { return } parentNode = a.getParent(); if (parentNode == document.body) { return } if (parentNode.retrieve("tip:enter")) { parentNode.fireEvent("mouseenter", d) } else { this.fireForParent(parentNode, d) } }, elementMove: function (d, a) { this.position(d) }, position: function (l) { var n = window.getSize(), a = window.getScroll(), k = { x: this.tip.offsetWidth, y: this.tip.offsetHeight }, m = { x: "left", y: "top" }, j = {}; for (var i in m) { j[m[i]] = l.page[i] + this.options.offset[i]; if ((j[m[i]] + k[i] - a[i]) > n[i]) { j[m[i]] = l.page[i] - this.options.offset[i] - k[i] } } this.tip.setStyles(j) }, fill: function (a, d) { if (typeof d == "string") { a.set("html", d) } else { a.adopt(d) } }, show: function (a) { this.fireEvent("show", [this.tip, a]) }, hide: function (a) { this.fireEvent("hide", [this.tip, a]) } }) })(); var Spinner = new Class({ Extends: Mask, options: { "class": "spinner", containerPosition: {}, content: { "class": "spinner-content" }, messageContainer: { "class": "spinner-msg" }, img: { "class": "spinner-img" }, fxOptions: { link: "chain"} }, initialize: function () { this.parent.apply(this, arguments); this.target.store("spinner", this); var b = function () { this.active = false } .bind(this); this.addEvents({ hide: b, show: b }) }, render: function () { this.parent(); this.element.set("id", this.options.id || "spinner-" + $time()); this.content = document.id(this.options.content) || new Element("div", this.options.content); this.content.inject(this.element); if (this.options.message) { this.msg = document.id(this.options.message) || new Element("p", this.options.messageContainer).appendText(this.options.message); this.msg.inject(this.content) } if (this.options.img) { this.img = document.id(this.options.img) || new Element("div", this.options.img); this.img.inject(this.content) } this.element.set("tween", this.options.fxOptions) }, show: function (b) { if (this.active) { return this.chain(this.show.bind(this)) } if (!this.hidden) { this.callChain.delay(20, this); return this } this.active = true; return this.parent(b) }, showMask: function (d) { var c = function () { this.content.position($merge({ relativeTo: this.element }, this.options.containerPosition)) } .bind(this); if (d) { this.parent(); c() } else { this.element.setStyles({ display: "block", opacity: 0 }).tween("opacity", this.options.style.opacity || 0.9); c(); this.hidden = false; this.fireEvent("show"); this.callChain() } }, hide: function (b) { if (this.active) { return this.chain(this.hide.bind(this)) } if (this.hidden) { this.callChain.delay(20, this); return this } this.active = true; return this.parent(b) }, hideMask: function (b) { if (b) { return this.parent() } this.element.tween("opacity", 0).get("tween").chain(function () { this.element.setStyle("display", "none"); this.hidden = true; this.fireEvent("hide"); this.callChain() } .bind(this)) }, destroy: function () { this.content.destroy(); this.parent(); this.target.eliminate("spinner") } }); Spinner.implement(new Chain); if (window.Request) { Request = Class.refactor(Request, { options: { useSpinner: false, spinnerOptions: {}, spinnerTarget: false }, initialize: function (d) { this._send = this.send; this.send = function (a) { if (this.spinner) { this.spinner.chain(this._send.bind(this, a)).show() } else { this._send(a) } return this }; this.previous(d); var c = document.id(this.options.spinnerTarget) || document.id(this.options.update); if (this.options.useSpinner && c) { this.spinner = c.get("spinner", this.options.spinnerOptions); ["onComplete", "onException", "onCancel"].each(function (a) { this.addEvent(a, this.spinner.hide.bind(this.spinner)) }, this) } }, getSpinner: function () { return this.spinner } }) } Element.Properties.spinner = { set: function (d) { var c = this.retrieve("spinner"); return this.eliminate("spinner").store("spinner:options", d) }, get: function (b) { if (b || !this.retrieve("spinner")) { if (this.retrieve("spinner")) { this.retrieve("spinner").destroy() } if (b || !this.retrieve("spinner:options")) { this.set("spinner", b) } new Spinner(this, this.retrieve("spinner:options")) } return this.retrieve("spinner") } }; Element.implement({ spin: function (b) { this.get("spinner", b).show(); return this }, unspin: function () { var b = Array.link(arguments, { options: Object.type, callback: Function.type }); this.get("spinner", b.options).hide(b.callback); return this } }); MooTools.lang.set("en-US", "Date", { months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dateOrder: ["month", "date", "year"], shortDate: "%m/%d/%Y", shortTime: "%I:%M%p", AM: "AM", PM: "PM", ordinal: function (b) { return (b > 3 && b < 21) ? "th" : ["th", "st", "nd", "rd", "th"][Math.min(b % 10, 4)] }, lessThanMinuteAgo: "less than a minute ago", minuteAgo: "about a minute ago", minutesAgo: "{delta} minutes ago", hourAgo: "about an hour ago", hoursAgo: "about {delta} hours ago", dayAgo: "1 day ago", daysAgo: "{delta} days ago", weekAgo: "1 week ago", weeksAgo: "{delta} weeks ago", monthAgo: "1 month ago", monthsAgo: "{delta} months ago", yearAgo: "1 year ago", yearsAgo: "{delta} years ago", lessThanMinuteUntil: "less than a minute from now", minuteUntil: "about a minute from now", minutesUntil: "{delta} minutes from now", hourUntil: "about an hour from now", hoursUntil: "about {delta} hours from now", dayUntil: "1 day from now", daysUntil: "{delta} days from now", weekUntil: "1 week from now", weeksUntil: "{delta} weeks from now", monthUntil: "1 month from now", monthsUntil: "{delta} months from now", yearUntil: "1 year from now", yearsUntil: "{delta} years from now" }); MooTools.lang.set("en-US", "Form.Validator", { required: "This field is required.", minLength: "Please enter at least {minLength} characters (you entered {length} characters).", maxLength: "Please enter no more than {maxLength} characters (you entered {length} characters).", integer: "Please enter an integer in this field. Numbers with decimals (e.g. 1.25) are not permitted.", numeric: 'Please enter only numeric values in this field (i.e. "1" or "1.1" or "-1" or "-1.1").', digits: "Please use numbers and punctuation only in this field (for example, a phone number with dashes or dots is permitted).", alpha: "Please use letters only (a-z) with in this field. No spaces or other characters are allowed.", alphanum: "Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.", dateSuchAs: "Please enter a valid date such as {date}", dateInFormatMDY: 'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")', email: 'Please enter a valid email address. For example "fred@domain.com".', url: "Please enter a valid URL such as http://www.google.com.", currencyDollar: "Please enter a valid $ amount. For example $100.00 .", oneRequired: "Please enter something for at least one of these inputs.", errorPrefix: "Error: ", warningPrefix: "Warning: ", noSpace: "There can be no spaces in this input.", reqChkByNode: "No items are selected.", requiredChk: "This field is required.", reqChkByName: "Please select a {label}.", match: "This field needs to match the {matchName} field", startDate: "the start date", endDate: "the end date", currendDate: "the current date", afterDate: "The date should be the same or after {label}.", beforeDate: "The date should be the same or before {label}.", startMonth: "Please select a start month", sameMonth: "These two dates must be in the same month - you must change one or the other.", creditcard: "The credit card number entered is invalid. Please check the number and try again. {length} digits entered." });
