﻿//MooTools and Slideshow
var MooTools = { version: "1.2.0", build: "" }; var Native = function(O) { O = O || {}; var S = O.afterImplement || function() { }; var R = O.generics; R = (R !== false); var Q = O.legacy; var T = O.initialize; var M = O.protect; var N = O.name; var L = T || Q; L.constructor = Native; L.$family = { name: "native" }; if (Q && T) { L.prototype = Q.prototype } L.prototype.constructor = L; if (N) { var K = N.toLowerCase(); L.prototype.$family = { name: K }; Native.typize(L, K) } var P = function(D, B, C, A) { if (!M || A || !D.prototype[B]) { D.prototype[B] = C } if (R) { Native.genericize(D, B, M) } S.call(D, B, C); return D }; L.implement = function(A, B, C) { if (typeof A == "string") { return P(this, A, B, C) } for (var D in A) { P(this, D, A[D], B) } return this }; L.alias = function(D, B, C) { if (typeof D == "string") { D = this.prototype[D]; if (D) { P(this, B, D, C) } } else { for (var A in D) { this.alias(A, D[A], B) } } return this }; return L }; Native.implement = function(F, G) { for (var H = 0, E = F.length; H < E; H++) { F[H].implement(G) } }; Native.genericize = function(F, E, D) { if ((!D || !F[E]) && typeof F.prototype[E] == "function") { F[E] = function() { var A = Array.prototype.slice.call(arguments); return F.prototype[E].apply(A.shift(), A) } } }; Native.typize = function(C, D) { if (!C.type) { C.type = function(A) { return ($type(A) === D) } } }; Native.alias = function(I, L, G, H) { for (var J = 0, K = I.length; J < K; J++) { I[J].alias(L, G, H) } }; (function(D) { for (var C in D) { Native.typize(D[C], C) } })({ "boolean": Boolean, "native": Native, object: Object }); (function(D) { for (var C in D) { new Native({ name: C, initialize: D[C], protect: true }) } })({ String: String, Function: Function, Number: Number, Array: Array, RegExp: RegExp, Date: Date }); (function(F, D) { for (var E = D.length; E--; E) { Native.genericize(F, D[E], true) } return arguments.callee })(Array, ["pop", "push", "reverse", "shift", "sort", "splice", "unshift", "concat", "join", "slice", "toString", "valueOf", "indexOf", "lastIndexOf"])(String, ["charAt", "charCodeAt", "concat", "indexOf", "lastIndexOf", "match", "replace", "search", "slice", "split", "substr", "substring", "toLowerCase", "toUpperCase", "valueOf"]); function $chk(B) { return !!(B || B === 0) } function $clear(B) { clearTimeout(B); clearInterval(B); return null } function $defined(B) { return (B != undefined) } function $empty() { } function $arguments(B) { return function() { return arguments[B] } } function $lambda(B) { return (typeof B == "function") ? B : function() { return B } } function $extend(E, D) { for (var F in (D || {})) { E[F] = D[F] } return E } function $unlink(I) { var J; switch ($type(I)) { case "object": J = {}; for (var G in I) { J[G] = $unlink(I[G]) } break; case "hash": J = $unlink(I.getClean()); break; case "array": J = []; for (var H = 0, F = I.length; H < F; H++) { J[H] = $unlink(I[H]) } break; default: return I } return J } function $merge() { var K = {}; for (var L = 0, H = arguments.length; L < H; L++) { var N = arguments[L]; if ($type(N) != "object") { continue } for (var M in N) { var I = N[M], J = K[M]; K[M] = (J && $type(I) == "object" && $type(J) == "object") ? $merge(J, I) : $unlink(I) } } return K } function $pick() { for (var D = 0, C = arguments.length; D < C; D++) { if (arguments[D] != undefined) { return arguments[D] } } return null } function $random(D, C) { return Math.floor(Math.random() * (C - D + 1) + D) } function $splat(D) { var C = $type(D); return (C) ? ((C != "array" && C != "arguments") ? [D] : D) : [] } var $time = Date.now || function() { return new Date().getTime() }; function $try() { for (var F = 0, D = arguments.length; F < D; F++) { try { return arguments[F]() } catch (E) { } } return null } function $type(B) { if (B == undefined) { return false } if (B.$family) { return (B.$family.name == "number" && !isFinite(B)) ? false : B.$family.name } if (B.nodeName) { switch (B.nodeType) { case 1: return "element"; case 3: return (/\S/).test(B.nodeValue) ? "textnode" : "whitespace" } } else { if (typeof B.length == "number") { if (B.callee) { return "arguments" } else { if (B.item) { return "collection" } } } } return typeof B } var Hash = new Native({ name: "Hash", initialize: function(C) { if ($type(C) == "hash") { C = $unlink(C.getClean()) } for (var D in C) { this[D] = C[D] } return this } }); Hash.implement({ getLength: function() { var D = 0; for (var C in this) { if (this.hasOwnProperty(C)) { D++ } } return D }, forEach: function(F, E) { for (var D in this) { if (this.hasOwnProperty(D)) { F.call(E, this[D], D, this) } } }, getClean: function() { var D = {}; for (var C in this) { if (this.hasOwnProperty(C)) { D[C] = this[C] } } return D } }); Hash.alias("forEach", "each"); function $H(B) { return new Hash(B) } Array.implement({ forEach: function(G, F) { for (var H = 0, E = this.length; H < E; H++) { G.call(F, this[H], H, this) } } }); Array.alias("forEach", "each"); function $A(G) { if (G.item) { var F = []; for (var H = 0, E = G.length; H < E; H++) { F[H] = G[H] } return F } return Array.prototype.slice.call(G) } function $each(G, H, F) { var E = $type(G); ((E == "arguments" || E == "collection" || E == "array") ? Array : Hash).each(G, H, F) } var Browser = new Hash({ Engine: { name: "unknown", version: "" }, Platform: { name: (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase() }, Features: { xpath: !!(document.evaluate), air: !!(window.runtime) }, Plugins: {} }); if (window.opera) { Browser.Engine = { name: "presto", version: (document.getElementsByClassName) ? 950 : 925} } else { if (window.ActiveXObject) { Browser.Engine = { name: "trident", version: (window.XMLHttpRequest) ? 5 : 4} } else { if (!navigator.taintEnabled) { Browser.Engine = { name: "webkit", version: (Browser.Features.xpath) ? 420 : 419} } else { if (document.getBoxObjectFor != null) { Browser.Engine = { name: "gecko", version: (document.getElementsByClassName) ? 19 : 18} } } } } Browser.Engine[Browser.Engine.name] = Browser.Engine[Browser.Engine.name + Browser.Engine.version] = true; if (window.orientation != undefined) { Browser.Platform.name = "ipod" } Browser.Platform[Browser.Platform.name] = true; Browser.Request = function() { return $try(function() { return new XMLHttpRequest() }, function() { return new ActiveXObject("MSXML2.XMLHTTP") }) }; Browser.Features.xhr = !!(Browser.Request()); Browser.Plugins.Flash = (function() { var B = ($try(function() { return navigator.plugins["Shockwave Flash"].description }, function() { return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version") }) || "0 r0").match(/\d+/g); return { version: parseInt(B[0] || 0 + "." + B[1] || 0), build: parseInt(B[2] || 0)} })(); function $exec(D) { if (!D) { return D } if (window.execScript) { window.execScript(D) } else { var C = document.createElement("script"); C.setAttribute("type", "text/javascript"); C.text = D; document.head.appendChild(C); document.head.removeChild(C) } return D } Native.UID = 1; var $uid = (Browser.Engine.trident) ? function(B) { return (B.uid || (B.uid = [Native.UID++]))[0] } : function(B) { return B.uid || (B.uid = Native.UID++) }; var Window = new Native({ name: "Window", legacy: (Browser.Engine.trident) ? null : window.Window, initialize: function(B) { $uid(B); if (!B.Element) { B.Element = $empty; if (Browser.Engine.webkit) { B.document.createElement("iframe") } B.Element.prototype = (Browser.Engine.webkit) ? window["[[DOMElement.prototype]]"] : {} } return $extend(B, Window.Prototype) }, afterImplement: function(D, C) { window[D] = Window.Prototype[D] = C } }); Window.Prototype = { $family: { name: "window"} }; new Window(window); var Document = new Native({ name: "Document", legacy: (Browser.Engine.trident) ? null : window.Document, initialize: function(B) { $uid(B); B.head = B.getElementsByTagName("head")[0]; B.html = B.getElementsByTagName("html")[0]; B.window = B.defaultView || B.parentWindow; if (Browser.Engine.trident4) { $try(function() { B.execCommand("BackgroundImageCache", false, true) }) } return $extend(B, Document.Prototype) }, afterImplement: function(D, C) { document[D] = Document.Prototype[D] = C } }); Document.Prototype = { $family: { name: "document"} }; new Document(document); Array.implement({ every: function(G, F) { for (var H = 0, E = this.length; H < E; H++) { if (!G.call(F, this[H], H, this)) { return false } } return true }, filter: function(H, G) { var I = []; for (var J = 0, F = this.length; J < F; J++) { if (H.call(G, this[J], J, this)) { I.push(this[J]) } } return I }, clean: function() { return this.filter($defined) }, indexOf: function(G, F) { var E = this.length; for (var H = (F < 0) ? Math.max(0, E + F) : F || 0; H < E; H++) { if (this[H] === G) { return H } } return -1 }, map: function(H, G) { var I = []; for (var J = 0, F = this.length; J < F; J++) { I[J] = H.call(G, this[J], J, this) } return I }, some: function(G, F) { for (var H = 0, E = this.length; H < E; H++) { if (G.call(F, this[H], H, this)) { return true } } return false }, associate: function(G) { var F = {}, H = Math.min(this.length, G.length); for (var E = 0; E < H; E++) { F[G[E]] = this[E] } return F }, link: function(I) { var F = {}; for (var G = 0, J = this.length; G < J; G++) { for (var H in I) { if (I[H](this[G])) { F[H] = this[G]; delete I[H]; break } } } return F }, contains: function(C, D) { return this.indexOf(C, D) != -1 }, extend: function(E) { for (var F = 0, D = E.length; F < D; F++) { this.push(E[F]) } return this }, getLast: function() { return (this.length) ? this[this.length - 1] : null }, getRandom: function() { return (this.length) ? this[$random(0, this.length - 1)] : null }, include: function(B) { if (!this.contains(B)) { this.push(B) } return this }, combine: function(E) { for (var F = 0, D = E.length; F < D; F++) { this.include(E[F]) } return this }, erase: function(D) { for (var C = this.length; C--; C) { if (this[C] === D) { this.splice(C, 1) } } return this }, empty: function() { this.length = 0; return this }, flatten: function() { var F = []; for (var H = 0, E = this.length; H < E; H++) { var G = $type(this[H]); if (!G) { continue } F = F.concat((G == "array" || G == "collection" || G == "arguments") ? Array.flatten(this[H]) : this[H]) } return F }, hexToRgb: function(D) { if (this.length != 3) { return null } var C = this.map(function(A) { if (A.length == 1) { A += A } return A.toInt(16) }); return (D) ? C : "rgb(" + C + ")" }, rgbToHex: function(F) { if (this.length < 3) { return null } if (this.length == 4 && this[3] == 0 && !F) { return "transparent" } var H = []; for (var E = 0; E < 3; E++) { var G = (this[E] - 0).toString(16); H.push((G.length == 1) ? "0" + G : G) } return (F) ? H : "#" + H.join("") } }); Function.implement({ extend: function(C) { for (var D in C) { this[D] = C[D] } return this }, create: function(D) { var C = this; D = D || {}; return function(B) { var F = D.arguments; F = (F != undefined) ? $splat(F) : Array.slice(arguments, (D.event) ? 1 : 0); if (D.event) { F = [B || window.event].extend(F) } var A = function() { return C.apply(D.bind || null, F) }; if (D.delay) { return setTimeout(A, D.delay) } if (D.periodical) { return setInterval(A, D.periodical) } if (D.attempt) { return $try(A) } return A() } }, pass: function(C, D) { return this.create({ arguments: C, bind: D }) }, attempt: function(C, D) { return this.create({ arguments: C, bind: D, attempt: true })() }, bind: function(D, C) { return this.create({ bind: D, arguments: C }) }, bindWithEvent: function(D, C) { return this.create({ bind: D, event: true, arguments: C }) }, delay: function(F, E, D) { return this.create({ delay: F, bind: E, arguments: D })() }, periodical: function(D, E, F) { return this.create({ periodical: D, bind: E, arguments: F })() }, run: function(C, D) { return this.apply(D, $splat(C)) } }); Number.implement({ limit: function(D, C) { return Math.min(C, Math.max(D, this)) }, round: function(B) { B = Math.pow(10, B || 0); return Math.round(this * B) / B }, times: function(F, E) { for (var D = 0; D < this; D++) { F.call(E, D, this) } }, toFloat: function() { return parseFloat(this) }, toInt: function(B) { return parseInt(this, B || 10) } }); Number.alias("times", "each"); (function(D) { var C = {}; D.each(function(A) { if (!Number[A]) { C[A] = function() { return Math[A].apply(null, [this].concat($A(arguments))) } } }); Number.implement(C) })(["abs", "acos", "asin", "atan", "atan2", "ceil", "cos", "exp", "floor", "log", "max", "min", "pow", "sin", "sqrt", "tan"]); String.implement({ test: function(C, D) { return ((typeof C == "string") ? new RegExp(C, D) : C).test(this) }, contains: function(C, D) { return (D) ? (D + this + D).indexOf(D + C + D) > -1 : this.indexOf(C) > -1 }, trim: function() { return this.replace(/^\s+|\s+$/g, "") }, clean: function() { return this.replace(/\s+/g, " ").trim() }, camelCase: function() { return this.replace(/-\D/g, function(B) { return B.charAt(1).toUpperCase() }) }, hyphenate: function() { return this.replace(/[A-Z]/g, function(B) { return ("-" + B.charAt(0).toLowerCase()) }) }, capitalize: function() { return this.replace(/\b[a-z]/g, function(B) { return B.toUpperCase() }) }, escapeRegExp: function() { return this.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1") }, toInt: function(B) { return parseInt(this, B || 10) }, toFloat: function() { return parseFloat(this) }, hexToRgb: function(D) { var C = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); return (C) ? C.slice(1).hexToRgb(D) : null }, rgbToHex: function(D) { var C = this.match(/\d{1,3}/g); return (C) ? C.rgbToHex(D) : null }, stripScripts: function(F) { var D = ""; var E = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function() { D += arguments[1] + "\n"; return "" }); if (F === true) { $exec(D) } else { if ($type(F) == "function") { F(D, E) } } return E }, substitute: function(C, D) { return this.replace(D || (/\\?\{([^}]+)\}/g), function(A, B) { if (A.charAt(0) == "\\") { return A.slice(1) } return (C[B] != undefined) ? C[B] : "" }) } }); Hash.implement({ has: Object.prototype.hasOwnProperty, keyOf: function(D) { for (var C in this) { if (this.hasOwnProperty(C) && this[C] === D) { return C } } return null }, hasValue: function(B) { return (Hash.keyOf(this, B) !== null) }, extend: function(B) { Hash.each(B, function(A, D) { Hash.set(this, D, A) }, this); return this }, combine: function(B) { Hash.each(B, function(A, D) { Hash.include(this, D, A) }, this); return this }, erase: function(B) { if (this.hasOwnProperty(B)) { delete this[B] } return this }, get: function(B) { return (this.hasOwnProperty(B)) ? this[B] : null }, set: function(C, D) { if (!this[C] || this.hasOwnProperty(C)) { this[C] = D } return this }, empty: function() { Hash.each(this, function(D, C) { delete this[C] }, this); return this }, include: function(F, E) { var D = this[F]; if (D == undefined) { this[F] = E } return this }, map: function(F, E) { var D = new Hash; Hash.each(this, function(A, B) { D.set(B, F.call(E, A, B, this)) }, this); return D }, filter: function(F, E) { var D = new Hash; Hash.each(this, function(A, B) { if (F.call(E, A, B, this)) { D.set(B, A) } }, this); return D }, every: function(F, E) { for (var D in this) { if (this.hasOwnProperty(D) && !F.call(E, this[D], D)) { return false } } return true }, some: function(F, E) { for (var D in this) { if (this.hasOwnProperty(D) && F.call(E, this[D], D)) { return true } } return false }, getKeys: function() { var B = []; Hash.each(this, function(A, D) { B.push(D) }); return B }, getValues: function() { var B = []; Hash.each(this, function(A) { B.push(A) }); return B }, toQueryString: function(C) { var D = []; Hash.each(this, function(A, B) { if (C) { B = C + "[" + B + "]" } var G; switch ($type(A)) { case "object": G = Hash.toQueryString(A, B); break; case "array": var H = {}; A.each(function(E, F) { H[F] = E }); G = Hash.toQueryString(H, B); break; default: G = B + "=" + encodeURIComponent(A) } if (A != undefined) { D.push(G) } }); return D.join("&") } }); Hash.alias({ keyOf: "indexOf", hasValue: "contains" }); var Event = new Native({ name: "Event", initialize: function(Q, Y) { Y = Y || window; var T = Y.document; Q = Q || Y.event; if (Q.$extended) { return Q } this.$extended = true; var U = Q.type; var X = Q.target || Q.srcElement; while (X && X.nodeType == 3) { X = X.parentNode } if (U.test(/key/)) { var P = Q.which || Q.keyCode; var R = Event.Keys.keyOf(P); if (U == "keydown") { var N = P - 111; if (N > 0 && N < 13) { R = "f" + N } } R = R || String.fromCharCode(P).toLowerCase() } else { if (U.match(/(click|mouse|menu)/i)) { T = (!T.compatMode || T.compatMode == "CSS1Compat") ? T.html : T.body; var V = { x: Q.pageX || Q.clientX + T.scrollLeft, y: Q.pageY || Q.clientY + T.scrollTop }; var O = { x: (Q.pageX) ? Q.pageX - Y.pageXOffset : Q.clientX, y: (Q.pageY) ? Q.pageY - Y.pageYOffset : Q.clientY }; if (U.match(/DOMMouseScroll|mousewheel/)) { var W = (Q.wheelDelta) ? Q.wheelDelta / 120 : -(Q.detail || 0) / 3 } var Z = (Q.which == 3) || (Q.button == 2); var S = null; if (U.match(/over|out/)) { switch (U) { case "mouseover": S = Q.relatedTarget || Q.fromElement; break; case "mouseout": S = Q.relatedTarget || Q.toElement } if (!(function() { while (S && S.nodeType == 3) { S = S.parentNode } return true }).create({ attempt: Browser.Engine.gecko })()) { S = false } } } } return $extend(this, { event: Q, type: U, page: V, client: O, rightClick: Z, wheel: W, relatedTarget: S, target: X, code: P, key: R, shift: Q.shiftKey, control: Q.ctrlKey, alt: Q.altKey, meta: Q.metaKey }) } }); Event.Keys = new Hash({ enter: 13, up: 38, down: 40, left: 37, right: 39, esc: 27, space: 32, backspace: 8, tab: 9, "delete": 46 }); Event.implement({ stop: function() { return this.stopPropagation().preventDefault() }, stopPropagation: function() { if (this.event.stopPropagation) { this.event.stopPropagation() } else { this.event.cancelBubble = true } return this }, preventDefault: function() { if (this.event.preventDefault) { this.event.preventDefault() } else { this.event.returnValue = false } return this } }); var Class = new Native({ name: "Class", initialize: function(D) { D = D || {}; var C = function(B) { for (var G in this) { this[G] = $unlink(this[G]) } for (var A in Class.Mutators) { if (!this[A]) { continue } Class.Mutators[A](this, this[A]); delete this[A] } this.constructor = C; if (B === $empty) { return this } var H = (this.initialize) ? this.initialize.apply(this, arguments) : this; if (this.options && this.options.initialize) { this.options.initialize.call(this) } return H }; $extend(C, this); C.constructor = Class; C.prototype = D; return C } }); Class.implement({ implement: function() { Class.Mutators.Implements(this.prototype, Array.slice(arguments)); return this } }); Class.Mutators = { Implements: function(C, D) { $splat(D).each(function(A) { $extend(C, ($type(A) == "class") ? new A($empty) : A) }) }, Extends: function(self, klass) { var instance = new klass($empty); delete instance.parent; delete instance.parentOf; for (var key in instance) { var current = self[key], previous = instance[key]; if (current == undefined) { self[key] = previous; continue } var ctype = $type(current), ptype = $type(previous); if (ctype != ptype) { continue } switch (ctype) { case "function": if (!arguments.callee.caller) { self[key] = eval("(" + String(current).replace(/\bthis\.parent\(\s*(\))?/g, function(full, close) { return "arguments.callee._parent_.call(this" + (close || ", ") }) + ")") } self[key]._parent_ = previous; break; case "object": self[key] = $merge(previous, current) } } self.parent = function() { return arguments.callee.caller._parent_.apply(this, arguments) }; self.parentOf = function(descendant) { return descendant._parent_.apply(this, Array.slice(arguments, 1)) } } }; var Chain = new Class({ chain: function() { this.$chain = (this.$chain || []).extend(arguments); return this }, callChain: function() { return (this.$chain && this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false }, clearChain: function() { if (this.$chain) { this.$chain.empty() } return this } }); var Events = new Class({ addEvent: function(E, F, D) { E = Events.removeOn(E); if (F != $empty) { this.$events = this.$events || {}; this.$events[E] = this.$events[E] || []; this.$events[E].include(F); if (D) { F.internal = true } } return this }, addEvents: function(C) { for (var D in C) { this.addEvent(D, C[D]) } return this }, fireEvent: function(E, F, D) { E = Events.removeOn(E); if (!this.$events || !this.$events[E]) { return this } this.$events[E].each(function(A) { A.create({ bind: this, delay: D, "arguments": F })() }, this); return this }, removeEvent: function(D, C) { D = Events.removeOn(D); if (!this.$events || !this.$events[D]) { return this } if (!C.internal) { this.$events[D].erase(C) } return this }, removeEvents: function(G) { for (var F in this.$events) { if (G && G != F) { continue } var H = this.$events[F]; for (var E = H.length; E--; E) { this.removeEvent(F, H[E]) } } return this } }); Events.removeOn = function(B) { return B.replace(/^on([A-Z])/, function(D, A) { return A.toLowerCase() }) }; var Options = new Class({ setOptions: function() { this.options = $merge.run([this.options].extend(arguments)); if (!this.addEvent) { return this } for (var B in this.options) { if ($type(this.options[B]) != "function" || !(/^on[A-Z]/).test(B)) { continue } this.addEvent(B, this.options[B]); delete this.options[B] } return this } }); Document.implement({ newElement: function(C, D) { if (Browser.Engine.trident && D) { ["name", "type", "checked"].each(function(A) { if (!D[A]) { return } C += " " + A + '="' + D[A] + '"'; if (A != "checked") { delete D[A] } }); C = "<" + C + ">" } return $.element(this.createElement(C)).set(D) }, newTextNode: function(B) { return this.createTextNode(B) }, getDocument: function() { return this }, getWindow: function() { return this.defaultView || this.parentWindow }, purge: function() { var E = this.getElementsByTagName("*"); for (var F = 0, D = E.length; F < D; F++) { Browser.freeMem(E[F]) } } }); var Element = new Native({ name: "Element", legacy: window.Element, initialize: function(D, F) { var E = Element.Constructors.get(D); if (E) { return E(F) } if (typeof D == "string") { return document.newElement(D, F) } return $(D).set(F) }, afterImplement: function(C, D) { if (!Array[C]) { Elements.implement(C, Elements.multi(C)) } Element.Prototype[C] = D } }); Element.Prototype = { $family: { name: "element"} }; Element.Constructors = new Hash; var IFrame = new Native({ name: "IFrame", generics: false, initialize: function() { var G = Array.link(arguments, { properties: Object.type, iframe: $defined }); var I = G.properties || {}; var J = $(G.iframe) || false; var H = I.onload || $empty; delete I.onload; I.id = I.name = $pick(I.id, I.name, J.id, J.name, "IFrame_" + $time()); J = new Element(J || "iframe", I); var F = function() { var C = $try(function() { return J.contentWindow.location.host }); if (C && C == window.location.host) { var A = new Window(J.contentWindow); var B = new Document(J.contentWindow.document); $extend(A.Element.prototype, Element.Prototype) } H.call(J.contentWindow, J.contentWindow.document) }; (!window.frames[I.id]) ? J.addListener("load", F) : F(); return J } }); var Elements = new Native({ initialize: function(J, N) { N = $extend({ ddup: true, cash: true }, N); J = J || []; if (N.ddup || N.cash) { var I = {}, K = []; for (var M = 0, H = J.length; M < H; M++) { var L = $.element(J[M], !N.cash); if (N.ddup) { if (I[L.uid]) { continue } I[L.uid] = true } K.push(L) } J = K } return (N.cash) ? $extend(J, this) : J } }); Elements.implement({ filter: function(C, D) { if (!C) { return this } return new Elements(Array.filter(this, (typeof C == "string") ? function(A) { return A.match(C) } : C, D)) } }); Elements.multi = function(B) { return function() { var J = []; var A = true; for (var H = 0, I = this.length; H < I; H++) { var G = this[H][B].apply(this[H], arguments); J.push(G); if (A) { A = ($type(G) == "element") } } return (A) ? new Elements(J) : J } }; Window.implement({ $: function(F, E) { if (F && F.$family && F.uid) { return F } var D = $type(F); return ($[D]) ? $[D](F, E, this.document) : null }, $$: function(G) { if (arguments.length == 1 && typeof G == "string") { return this.document.getElements(G) } var H = []; var K = Array.flatten(arguments); for (var J = 0, L = K.length; J < L; J++) { var I = K[J]; switch ($type(I)) { case "element": I = [I]; break; case "string": I = this.document.getElements(I, true); break; default: I = false } if (I) { H.extend(I) } } return new Elements(H) }, getDocument: function() { return this.document }, getWindow: function() { return this } }); $.string = function(E, F, D) { E = D.getElementById(E); return (E) ? $.element(E, F) : null }; $.element = function(E, F) { $uid(E); if (!F && !E.$family && !(/^object|embed$/i).test(E.tagName)) { var H = Element.Prototype; for (var G in H) { E[G] = H[G] } } return E }; $.object = function(F, E, D) { if (F.toElement) { return $.element(F.toElement(D), E) } return null }; $.textnode = $.whitespace = $.window = $.document = $arguments(0); Native.implement([Element, Document], { getElement: function(C, D) { return $(this.getElements(C, true)[0] || null, D) }, getElements: function(E, F) { E = E.split(","); var G = []; var H = (E.length > 1); E.each(function(B) { var A = this.getElementsByTagName(B.trim()); (H) ? G.extend(A) : G = A }, this); return new Elements(G, { ddup: H, cash: !F }) } }); Element.Storage = { get: function(B) { return (this[B] || (this[B] = {})) } }; Element.Inserters = new Hash({ before: function(D, C) { if (C.parentNode) { C.parentNode.insertBefore(D, C) } }, after: function(F, D) { if (!D.parentNode) { return } var E = D.nextSibling; (E) ? D.parentNode.insertBefore(F, E) : D.parentNode.appendChild(F) }, bottom: function(D, C) { C.appendChild(D) }, top: function(F, D) { var E = D.firstChild; (E) ? D.insertBefore(F, E) : D.appendChild(F) } }); Element.Inserters.inside = Element.Inserters.bottom; Element.Inserters.each(function(E, F) { var D = F.capitalize(); Element.implement("inject" + D, function(A) { E(this, $(A, true)); return this }); Element.implement("grab" + D, function(A) { E($(A, true), this); return this }) }); Element.implement({ getDocument: function() { return this.ownerDocument }, getWindow: function() { return this.ownerDocument.getWindow() }, getElementById: function(F, G) { var H = this.ownerDocument.getElementById(F); if (!H) { return null } for (var E = H.parentNode; E != this; E = E.parentNode) { if (!E) { return null } } return $.element(H, G) }, set: function(F, H) { switch ($type(F)) { case "object": for (var G in F) { this.set(G, F[G]) } break; case "string": var E = Element.Properties.get(F); (E && E.set) ? E.set.apply(this, Array.slice(arguments, 1)) : this.setProperty(F, H) } return this }, get: function(D) { var C = Element.Properties.get(D); return (C && C.get) ? C.get.apply(this, Array.slice(arguments, 1)) : this.getProperty(D) }, erase: function(D) { var C = Element.Properties.get(D); (C && C.erase) ? C.erase.apply(this, Array.slice(arguments, 1)) : this.removeProperty(D); return this }, match: function(B) { return (!B || Element.get(this, "tag") == B) }, inject: function(D, C) { Element.Inserters.get(C || "bottom")(this, $(D, true)); return this }, wraps: function(D, C) { D = $(D, true); return this.replaces(D).grab(D, C) }, grab: function(D, C) { Element.Inserters.get(C || "bottom")($(D, true), this); return this }, appendText: function(D, C) { return this.grab(this.getDocument().newTextNode(D), C) }, adopt: function() { Array.flatten(arguments).each(function(B) { B = $(B, true); if (B) { this.appendChild(B) } }, this); return this }, dispose: function() { return (this.parentNode) ? this.parentNode.removeChild(this) : this }, clone: function(M, N) { switch ($type(this)) { case "element": var U = {}; for (var V = 0, X = this.attributes.length; V < X; V++) { var O = this.attributes[V], Q = O.nodeName.toLowerCase(); if (Browser.Engine.trident && (/input/i).test(this.tagName) && (/width|height/).test(Q)) { continue } var R = (Q == "style" && this.style) ? this.style.cssText : O.nodeValue; if (!$chk(R) || Q == "uid" || (Q == "id" && !N)) { continue } if (R != "inherit" && ["string", "number"].contains($type(R))) { U[Q] = R } } var S = new Element(this.nodeName.toLowerCase(), U); if (M !== false) { for (var T = 0, W = this.childNodes.length; T < W; T++) { var P = Element.clone(this.childNodes[T], true, N); if (P) { S.grab(P) } } } return S; case "textnode": return document.newTextNode(this.nodeValue) } return null }, replaces: function(B) { B = $(B, true); B.parentNode.replaceChild(this, B); return this }, hasClass: function(B) { return this.className.contains(B, " ") }, addClass: function(B) { if (!this.hasClass(B)) { this.className = (this.className + " " + B).clean() } return this }, removeClass: function(B) { this.className = this.className.replace(new RegExp("(^|\\s)" + B + "(?:\\s|$)"), "$1").clean(); return this }, toggleClass: function(B) { return this.hasClass(B) ? this.removeClass(B) : this.addClass(B) }, getComputedStyle: function(D) { if (this.currentStyle) { return this.currentStyle[D.camelCase()] } var C = this.getWindow().getComputedStyle(this, null); return (C) ? C.getPropertyValue([D.hyphenate()]) : null }, empty: function() { $A(this.childNodes).each(function(B) { Browser.freeMem(B); Element.empty(B); Element.dispose(B) }, this); return this }, destroy: function() { Browser.freeMem(this.empty().dispose()); return null }, getSelected: function() { return new Elements($A(this.options).filter(function(B) { return B.selected })) }, toQueryString: function() { var B = []; this.getElements("input, select, textarea").each(function(D) { if (!D.name || D.disabled) { return } var A = (D.tagName.toLowerCase() == "select") ? Element.getSelected(D).map(function(C) { return C.value }) : ((D.type == "radio" || D.type == "checkbox") && !D.checked) ? null : D.value; $splat(A).each(function(C) { if (C) { B.push(D.name + "=" + encodeURIComponent(C)) } }) }); return B.join("&") }, getProperty: function(G) { var H = Element.Attributes, E = H.Props[G]; var F = (E) ? this[E] : this.getAttribute(G, 2); return (H.Bools[G]) ? !!F : (E) ? F : F || null }, getProperties: function() { var B = $A(arguments); return B.map(function(A) { return this.getProperty(A) }, this).associate(B) }, setProperty: function(H, G) { var I = Element.Attributes, J = I.Props[H], F = $defined(G); if (J && I.Bools[H]) { G = (G || !F) ? true : false } else { if (!F) { return this.removeProperty(H) } } (J) ? this[J] = G : this.setAttribute(H, G); return this }, setProperties: function(C) { for (var D in C) { this.setProperty(D, C[D]) } return this }, removeProperty: function(F) { var G = Element.Attributes, H = G.Props[F], E = (H && G.Bools[F]); (H) ? this[H] = (E) ? false : "" : this.removeAttribute(F); return this }, removeProperties: function() { Array.each(arguments, this.removeProperty, this); return this } }); (function() { var B = function(N, P, A, O, L, J) { var M = N[A || P]; var K = []; while (M) { if (M.nodeType == 1 && (!O || Element.match(M, O))) { K.push(M); if (!L) { break } } M = M[P] } return (L) ? new Elements(K, { ddup: false, cash: !J }) : $(K[0], J) }; Element.implement({ getPrevious: function(D, A) { return B(this, "previousSibling", null, D, false, A) }, getAllPrevious: function(D, A) { return B(this, "previousSibling", null, D, true, A) }, getNext: function(D, A) { return B(this, "nextSibling", null, D, false, A) }, getAllNext: function(D, A) { return B(this, "nextSibling", null, D, true, A) }, getFirst: function(D, A) { return B(this, "nextSibling", "firstChild", D, false, A) }, getLast: function(D, A) { return B(this, "previousSibling", "lastChild", D, false, A) }, getParent: function(D, A) { return B(this, "parentNode", null, D, false, A) }, getParents: function(D, A) { return B(this, "parentNode", null, D, true, A) }, getChildren: function(D, A) { return B(this, "nextSibling", "firstChild", D, true, A) }, hasChild: function(A) { A = $(A, true); return (!!A && $A(this.getElementsByTagName(A.tagName)).contains(A)) } }) })(); Element.Properties = new Hash; Element.Properties.style = { set: function(B) { this.style.cssText = B }, get: function() { return this.style.cssText }, erase: function() { this.style.cssText = "" } }; Element.Properties.tag = { get: function() { return this.tagName.toLowerCase() } }; Element.Properties.href = { get: function() { return (!this.href) ? null : this.href.replace(new RegExp("^" + document.location.protocol + "//" + document.location.host), "") } }; Element.Properties.html = { set: function() { return this.innerHTML = Array.flatten(arguments).join("") } }; Native.implement([Element, Window, Document], { addListener: function(D, C) { if (this.addEventListener) { this.addEventListener(D, C, false) } else { this.attachEvent("on" + D, C) } return this }, removeListener: function(D, C) { if (this.removeEventListener) { this.removeEventListener(D, C, false) } else { this.detachEvent("on" + D, C) } return this }, retrieve: function(H, E) { var F = Element.Storage.get(this.uid); var G = F[H]; if ($defined(E) && !$defined(G)) { G = F[H] = E } return $pick(G) }, store: function(F, D) { var E = Element.Storage.get(this.uid); E[F] = D; return this }, eliminate: function(C) { var D = Element.Storage.get(this.uid); delete D[C]; return this } }); Element.Attributes = new Hash({ Props: { html: "innerHTML", "class": "className", "for": "htmlFor", text: (Browser.Engine.trident) ? "innerText" : "textContent" }, Bools: ["compact", "nowrap", "ismap", "declare", "noshade", "checked", "disabled", "readonly", "multiple", "selected", "noresize", "defer"], Camels: ["value", "accessKey", "cellPadding", "cellSpacing", "colSpan", "frameBorder", "maxLength", "readOnly", "rowSpan", "tabIndex", "useMap"] }); Browser.freeMem = function(C) { if (!C) { return } if (Browser.Engine.trident && (/object/i).test(C.tagName)) { for (var D in C) { if (typeof C[D] == "function") { C[D] = $empty } } Element.dispose(C) } if (C.uid && C.removeEvents) { C.removeEvents() } }; (function(F) { var E = F.Bools, D = F.Camels; F.Bools = E = E.associate(E); Hash.extend(Hash.combine(F.Props, E), D.associate(D.map(function(A) { return A.toLowerCase() }))); F.erase("Camels") })(Element.Attributes); window.addListener("unload", function() { window.removeListener("unload", arguments.callee); document.purge(); if (Browser.Engine.trident) { CollectGarbage() } }); Element.Properties.events = { set: function(B) { this.addEvents(B) } }; Native.implement([Element, Window, Document], { addEvent: function(R, P) { var O = this.retrieve("events", {}); O[R] = O[R] || { keys: [], values: [] }; if (O[R].keys.contains(P)) { return this } O[R].keys.push(P); var Q = R, M = Element.Events.get(R), K = P, N = this; if (M) { if (M.onAdd) { M.onAdd.call(this, P) } if (M.condition) { K = function(A) { if (M.condition.call(this, A)) { return P.call(this, A) } return false } } Q = M.base || Q } var J = function() { return P.call(N) }; var L = Element.NativeEvents[Q] || 0; if (L) { if (L == 2) { J = function(A) { A = new Event(A, N.getWindow()); if (K.call(N, A) === false) { A.stop() } } } this.addListener(Q, J) } O[R].values.push(J); return this }, removeEvent: function(L, M) { var N = this.retrieve("events"); if (!N || !N[L]) { return this } var I = N[L].keys.indexOf(M); if (I == -1) { return this } var H = N[L].keys.splice(I, 1)[0]; var J = N[L].values.splice(I, 1)[0]; var K = Element.Events.get(L); if (K) { if (K.onRemove) { K.onRemove.call(this, M) } L = K.base || L } return (Element.NativeEvents[L]) ? this.removeListener(L, J) : this }, addEvents: function(C) { for (var D in C) { this.addEvent(D, C[D]) } return this }, removeEvents: function(F) { var D = this.retrieve("events"); if (!D) { return this } if (!F) { for (var E in D) { this.removeEvents(E) } D = null } else { if (D[F]) { while (D[F].keys[0]) { this.removeEvent(F, D[F].keys[0]) } D[F] = null } } return this }, fireEvent: function(F, H, E) { var G = this.retrieve("events"); if (!G || !G[F]) { return this } G[F].keys.each(function(A) { A.create({ bind: this, delay: E, "arguments": H })() }, this); return this }, cloneEvents: function(F, E) { F = $(F); var G = F.retrieve("events"); if (!G) { return this } if (!E) { for (var H in G) { this.cloneEvents(F, H) } } else { if (G[E]) { G[E].keys.each(function(A) { this.addEvent(E, A) }, this) } } return this } }); Element.NativeEvents = { click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, mousewheel: 2, DOMMouseScroll: 2, mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, keydown: 2, keypress: 2, keyup: 2, focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, load: 1, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, error: 1, abort: 1, scroll: 1 }; (function() { var B = function(D) { var A = D.relatedTarget; if (A == undefined) { return true } if (A === false) { return false } return ($type(this) != "document" && A != this && A.prefix != "xul" && !this.hasChild(A)) }; Element.Events = new Hash({ mouseenter: { base: "mouseover", condition: B }, mouseleave: { base: "mouseout", condition: B }, mousewheel: { base: (Browser.Engine.gecko) ? "DOMMouseScroll" : "mousewheel"} }) })(); Element.Properties.styles = { set: function(B) { this.setStyles(B) } }; Element.Properties.opacity = { set: function(C, D) { if (!D) { if (C == 0) { if (this.style.visibility != "hidden") { this.style.visibility = "hidden" } } else { if (this.style.visibility != "visible") { this.style.visibility = "visible" } } } if (!this.currentStyle || !this.currentStyle.hasLayout) { this.style.zoom = 1 } if (Browser.Engine.trident) { this.style.filter = (C == 1) ? "" : "alpha(opacity=" + C * 100 + ")" } this.style.opacity = C; this.store("opacity", C) }, get: function() { return this.retrieve("opacity", 1) } }; Element.implement({ setOpacity: function(B) { return this.set("opacity", B, true) }, getOpacity: function() { return this.get("opacity") }, setStyle: function(F, D) { switch (F) { case "opacity": return this.set("opacity", parseFloat(D)); case "float": F = (Browser.Engine.trident) ? "styleFloat" : "cssFloat" } F = F.camelCase(); if ($type(D) != "string") { var E = (Element.Styles.get(F) || "@").split(" "); D = $splat(D).map(function(A, B) { if (!E[B]) { return "" } return ($type(A) == "number") ? E[B].replace("@", Math.round(A)) : A }).join(" ") } else { if (D == String(Number(D))) { D = Math.round(D) } } this.style[F] = D; return this }, getStyle: function(I) { switch (I) { case "opacity": return this.get("opacity"); case "float": I = (Browser.Engine.trident) ? "styleFloat" : "cssFloat" } I = I.camelCase(); var H = this.style[I]; if (!$chk(H)) { H = []; for (var J in Element.ShortStyles) { if (I != J) { continue } for (var K in Element.ShortStyles[J]) { H.push(this.getStyle(K)) } return H.join(" ") } H = this.getComputedStyle(I) } if (H) { H = String(H); var M = H.match(/rgba?\([\d\s,]+\)/); if (M) { H = H.replace(M[0], M[0].rgbToHex()) } } if (Browser.Engine.presto || (Browser.Engine.trident && !$chk(parseInt(H)))) { if (I.test(/^(height|width)$/)) { var N = (I == "width") ? ["left", "right"] : ["top", "bottom"], L = 0; N.each(function(A) { L += this.getStyle("border-" + A + "-width").toInt() + this.getStyle("padding-" + A).toInt() }, this); return this["offset" + I.capitalize()] - L + "px" } if (Browser.Engine.presto && String(H).test("px")) { return H } if (I.test(/(border(.+)Width|margin|padding)/)) { return "0px" } } return H }, setStyles: function(D) { for (var C in D) { this.setStyle(C, D[C]) } return this }, getStyles: function() { var B = {}; Array.each(arguments, function(A) { B[A] = this.getStyle(A) }, this); return B } }); Element.Styles = new Hash({ left: "@px", top: "@px", bottom: "@px", right: "@px", width: "@px", height: "@px", maxWidth: "@px", maxHeight: "@px", minWidth: "@px", minHeight: "@px", backgroundColor: "rgb(@, @, @)", backgroundPosition: "@px @px", color: "rgb(@, @, @)", fontSize: "@px", letterSpacing: "@px", lineHeight: "@px", clip: "rect(@px @px @px @px)", margin: "@px @px @px @px", padding: "@px @px @px @px", border: "@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)", borderWidth: "@px @px @px @px", borderStyle: "@ @ @ @", borderColor: "rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)", zIndex: "@", zoom: "@", fontWeight: "@", textIndent: "@px", opacity: "@" }); Element.ShortStyles = { margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {} }; ["Top", "Right", "Bottom", "Left"].each(function(I) { var J = Element.ShortStyles; var N = Element.Styles; ["margin", "padding"].each(function(B) { var A = B + I; J[B][A] = N[A] = "@px" }); var K = "border" + I; J.border[K] = N[K] = "@px @ rgb(@, @, @)"; var L = K + "Width", H = K + "Style", M = K + "Color"; J[K] = {}; J.borderWidth[L] = J[K][L] = N[L] = "@px"; J.borderStyle[H] = J[K][H] = N[H] = "@"; J.borderColor[M] = J[K][M] = N[M] = "rgb(@, @, @)" }); (function() { Element.implement({ scrollTo: function(B, A) { if (N(this)) { this.getWindow().scrollTo(B, A) } else { this.scrollLeft = B; this.scrollTop = A } return this }, getSize: function() { if (N(this)) { return this.getWindow().getSize() } return { x: this.offsetWidth, y: this.offsetHeight} }, getScrollSize: function() { if (N(this)) { return this.getWindow().getScrollSize() } return { x: this.scrollWidth, y: this.scrollHeight} }, getScroll: function() { if (N(this)) { return this.getWindow().getScroll() } return { x: this.scrollLeft, y: this.scrollTop} }, getScrolls: function() { var A = this, B = { x: 0, y: 0 }; while (A && !N(A)) { B.x += A.scrollLeft; B.y += A.scrollTop; A = A.parentNode } return B }, getOffsetParent: function() { var A = this; if (N(A)) { return null } if (!Browser.Engine.trident) { return A.offsetParent } while ((A = A.parentNode) && !N(A)) { if (L(A, "position") != "static") { return A } } return null }, getOffsets: function() { var B = this, C = { x: 0, y: 0 }; if (N(this)) { return C } while (B && !N(B)) { C.x += B.offsetLeft; C.y += B.offsetTop; if (Browser.Engine.gecko) { if (!J(B)) { C.x += M(B); C.y += I(B) } var A = B.parentNode; if (A && L(A, "overflow") != "visible") { C.x += M(A); C.y += I(A) } } else { if (B != this && (Browser.Engine.trident || Browser.Engine.webkit)) { C.x += M(B); C.y += I(B) } } B = B.offsetParent; if (Browser.Engine.trident) { while (B && !B.currentStyle.hasLayout) { B = B.offsetParent } } } if (Browser.Engine.gecko && !J(this)) { C.x -= M(this); C.y -= I(this) } return C }, getPosition: function(B) { if (N(this)) { return { x: 0, y: 0} } var A = this.getOffsets(), D = this.getScrolls(); var E = { x: A.x - D.x, y: A.y - D.y }; var C = (B && (B = $(B))) ? B.getPosition() : { x: 0, y: 0 }; return { x: E.x - C.x, y: E.y - C.y} }, getCoordinates: function(B) { if (N(this)) { return this.getWindow().getCoordinates() } var D = this.getPosition(B), C = this.getSize(); var A = { left: D.x, top: D.y, width: C.x, height: C.y }; A.right = A.left + A.width; A.bottom = A.top + A.height; return A }, computePosition: function(A) { return { left: A.x - K(this, "margin-left"), top: A.y - K(this, "margin-top")} }, position: function(A) { return this.setStyles(this.computePosition(A)) } }); Native.implement([Document, Window], { getSize: function() { var A = this.getWindow(); if (Browser.Engine.presto || Browser.Engine.webkit) { return { x: A.innerWidth, y: A.innerHeight} } var B = H(this); return { x: B.clientWidth, y: B.clientHeight} }, getScroll: function() { var A = this.getWindow(); var B = H(this); return { x: A.pageXOffset || B.scrollLeft, y: A.pageYOffset || B.scrollTop} }, getScrollSize: function() { var A = H(this); var B = this.getSize(); return { x: Math.max(A.scrollWidth, B.x), y: Math.max(A.scrollHeight, B.y)} }, getPosition: function() { return { x: 0, y: 0} }, getCoordinates: function() { var A = this.getSize(); return { top: 0, left: 0, bottom: A.y, right: A.x, height: A.y, width: A.x} } }); var L = Element.getComputedStyle; function K(B, A) { return L(B, A).toInt() || 0 } function J(A) { return L(A, "-moz-box-sizing") == "border-box" } function I(A) { return K(A, "border-top-width") } function M(A) { return K(A, "border-left-width") } function N(A) { return (/^(?:body|html)$/i).test(A.tagName) } function H(B) { var A = B.getDocument(); return (!A.compatMode || A.compatMode == "CSS1Compat") ? A.html : A.body } })(); Native.implement([Window, Document, Element], { getHeight: function() { return this.getSize().y }, getWidth: function() { return this.getSize().x }, getScrollTop: function() { return this.getScroll().y }, getScrollLeft: function() { return this.getScroll().x }, getScrollHeight: function() { return this.getScrollSize().y }, getScrollWidth: function() { return this.getScrollSize().x }, getTop: function() { return this.getPosition().y }, getLeft: function() { return this.getPosition().x } }); Native.implement([Document, Element], { getElements: function(J, K) { J = J.split(","); var O, M = {}; for (var N = 0, P = J.length; N < P; N++) { var I = J[N], L = Selectors.Utils.search(this, I, M); if (N != 0 && L.item) { L = $A(L) } O = (N == 0) ? L : (O.item) ? $A(O).concat(L) : O.concat(L) } return new Elements(O, { ddup: (J.length > 1), cash: !K }) } }); Element.implement({ match: function(J) { if (!J) { return true } var H = Selectors.Utils.parseTagAndID(J); var F = H[0], G = H[1]; if (!Selectors.Filters.byID(this, G) || !Selectors.Filters.byTag(this, F)) { return false } var I = Selectors.Utils.parseSelector(J); return (I) ? Selectors.Utils.filter(this, I, {}) : true } }); var Selectors = { Cache: { nth: {}, parsed: {}} }; Selectors.RegExps = { id: (/#([\w-]+)/), tag: (/^(\w+|\*)/), quick: (/^(\w+|\*)$/), splitter: (/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g), combined: (/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)["']?(.*?)["']?)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g) }; Selectors.Utils = { chk: function(F, E) { if (!E) { return true } var D = $uid(F); if (!E[D]) { return E[D] = true } return false }, parseNthArgument: function(H) { if (Selectors.Cache.nth[H]) { return Selectors.Cache.nth[H] } var K = H.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/); if (!K) { return false } var I = parseInt(K[1]); var L = (I || I === 0) ? I : 1; var J = K[2] || false; var G = parseInt(K[3]) || 0; if (L != 0) { G--; while (G < 1) { G += L } while (G >= L) { G -= L } } else { L = G; J = "index" } switch (J) { case "n": K = { a: L, b: G, special: "n" }; break; case "odd": K = { a: 2, b: 0, special: "n" }; break; case "even": K = { a: 2, b: 1, special: "n" }; break; case "first": K = { a: 0, special: "index" }; break; case "last": K = { special: "last-child" }; break; case "only": K = { special: "only-child" }; break; default: K = { a: (L - 1), special: "index"} } return Selectors.Cache.nth[H] = K }, parseSelector: function(T) { if (Selectors.Cache.parsed[T]) { return Selectors.Cache.parsed[T] } var K, Q = { classes: [], pseudos: [], attributes: [] }; while ((K = Selectors.RegExps.combined.exec(T))) { var P = K[1], R = K[2], S = K[3], M = K[4], L = K[5], O = K[6]; if (P) { Q.classes.push(P) } else { if (L) { var N = Selectors.Pseudo.get(L); if (N) { Q.pseudos.push({ parser: N, argument: O }) } else { Q.attributes.push({ name: L, operator: "=", value: O }) } } else { if (R) { Q.attributes.push({ name: R, operator: S, value: M }) } } } } if (!Q.classes.length) { delete Q.classes } if (!Q.attributes.length) { delete Q.attributes } if (!Q.pseudos.length) { delete Q.pseudos } if (!Q.classes && !Q.attributes && !Q.pseudos) { Q = null } return Selectors.Cache.parsed[T] = Q }, parseTagAndID: function(F) { var D = F.match(Selectors.RegExps.tag); var E = F.match(Selectors.RegExps.id); return [(D) ? D[1] : "*", (E) ? E[1] : false] }, filter: function(J, M, K) { var L; if (M.classes) { for (L = M.classes.length; L--; L) { var I = M.classes[L]; if (!Selectors.Filters.byClass(J, I)) { return false } } } if (M.attributes) { for (L = M.attributes.length; L--; L) { var N = M.attributes[L]; if (!Selectors.Filters.byAttribute(J, N.name, N.operator, N.value)) { return false } } } if (M.pseudos) { for (L = M.pseudos.length; L--; L) { var H = M.pseudos[L]; if (!Selectors.Filters.byPseudo(J, H.parser, H.argument, K)) { return false } } } return true }, getByTagAndID: function(H, E, F) { if (F) { var G = (H.getElementById) ? H.getElementById(F, true) : Element.getElementById(H, F, true); return (G && Selectors.Filters.byTag(G, E)) ? [G] : [] } else { return H.getElementsByTagName(E) } }, search: function(k, l, f) { var s = []; var r = l.trim().replace(Selectors.RegExps.splitter, function(A, B, C) { s.push(B); return ":)" + C }).split(":)"); var j, o, p, Y; for (var Z = 0, d = r.length; Z < d; Z++) { var a = r[Z]; if (Z == 0 && Selectors.RegExps.quick.test(a)) { j = k.getElementsByTagName(a); continue } var t = s[Z - 1]; var i = Selectors.Utils.parseTagAndID(a); var X = i[0], h = i[1]; if (Z == 0) { j = Selectors.Utils.getByTagAndID(k, X, h) } else { var q = {}, m = []; for (var b = 0, c = j.length; b < c; b++) { m = Selectors.Getters[t](m, j[b], X, h, q) } j = m } var n = Selectors.Utils.parseSelector(a); if (n) { p = []; for (var e = 0, g = j.length; e < g; e++) { Y = j[e]; if (Selectors.Utils.filter(Y, n, f)) { p.push(Y) } } j = p } } return j } }; Selectors.Getters = { " ": function(O, P, N, M, R) { var J = Selectors.Utils.getByTagAndID(P, N, M); for (var K = 0, L = J.length; K < L; K++) { var Q = J[K]; if (Selectors.Utils.chk(Q, R)) { O.push(Q) } } return O }, ">": function(O, P, N, M, Q) { var K = Selectors.Utils.getByTagAndID(P, N, M); for (var R = 0, J = K.length; R < J; R++) { var L = K[R]; if (L.parentNode == P && Selectors.Utils.chk(L, Q)) { O.push(L) } } return O }, "+": function(I, J, F, G, H) { while ((J = J.nextSibling)) { if (J.nodeType == 1) { if (Selectors.Utils.chk(J, H) && Selectors.Filters.byTag(J, F) && Selectors.Filters.byID(J, G)) { I.push(J) } break } } return I }, "~": function(I, J, F, G, H) { while ((J = J.nextSibling)) { if (J.nodeType == 1) { if (!Selectors.Utils.chk(J, H)) { break } if (Selectors.Filters.byTag(J, F) && Selectors.Filters.byID(J, G)) { I.push(J) } } } return I } }; Selectors.Filters = { byTag: function(D, C) { return (C == "*" || (D.tagName && D.tagName.toLowerCase() == C)) }, byID: function(C, D) { return (!D || (C.id && C.id == D)) }, byClass: function(D, C) { return (D.className && D.className.contains(C, " ")) }, byPseudo: function(E, F, G, H) { return F.call(E, G, H) }, byAttribute: function(I, H, J, G) { var F = Element.prototype.getProperty.call(I, H); if (!F) { return false } if (!J || G == undefined) { return true } switch (J) { case "=": return (F == G); case "*=": return (F.contains(G)); case "^=": return (F.substr(0, G.length) == G); case "$=": return (F.substr(F.length - G.length) == G); case "!=": return (F != G); case "~=": return F.contains(G, " "); case "|=": return F.contains(G, "-") } return false } }; Selectors.Pseudo = new Hash({ empty: function() { return !(this.innerText || this.textContent || "").length }, not: function(B) { return !Element.match(this, B) }, contains: function(B) { return (this.innerText || this.textContent || "").contains(B) }, "first-child": function() { return Selectors.Pseudo.index.call(this, 0) }, "last-child": function() { var B = this; while ((B = B.nextSibling)) { if (B.nodeType == 1) { return false } } return true }, "only-child": function() { var D = this; while ((D = D.previousSibling)) { if (D.nodeType == 1) { return false } } var C = this; while ((C = C.nextSibling)) { if (C.nodeType == 1) { return false } } return true }, "nth-child": function(I, K) { I = (I == undefined) ? "n" : I; var M = Selectors.Utils.parseNthArgument(I); if (M.special != "n") { return Selectors.Pseudo[M.special].call(this, M.a, K) } var J = 0; K.positions = K.positions || {}; var L = $uid(this); if (!K.positions[L]) { var N = this; while ((N = N.previousSibling)) { if (N.nodeType != 1) { continue } J++; var H = K.positions[$uid(N)]; if (H != undefined) { J = H + J; break } } K.positions[L] = J } return (K.positions[L] % M.a == M.b) }, index: function(D) { var F = this, E = 0; while ((F = F.previousSibling)) { if (F.nodeType == 1 && ++E > D) { return false } } return (E == D) }, even: function(D, C) { return Selectors.Pseudo["nth-child"].call(this, "2n+1", C) }, odd: function(D, C) { return Selectors.Pseudo["nth-child"].call(this, "2n", C) } }); Element.Events.domready = { onAdd: function(B) { if (Browser.loaded) { B.call(this) } } }; (function() { var D = function() { if (Browser.loaded) { return } Browser.loaded = true; window.fireEvent("domready"); document.fireEvent("domready") }; switch (Browser.Engine.name) { case "webkit": (function() { (["loaded", "complete"].contains(document.readyState)) ? D() : arguments.callee.delay(50) })(); break; case "trident": var C = document.createElement("div"); (function() { ($try(function() { C.doScroll("left"); return $(C).inject(document.body).set("html", "temp").dispose() })) ? D() : arguments.callee.delay(50) })(); break; default: window.addEvent("load", D); document.addEvent("DOMContentLoaded", D) } })(); var Fx = new Class({ Implements: [Chain, Events, Options], options: { fps: 50, unit: false, duration: 500, link: "ignore", transition: function(B) { return -(Math.cos(Math.PI * B) - 1) / 2 } }, initialize: function(C) { this.subject = this.subject || this; this.setOptions(C); this.options.duration = Fx.Durations[this.options.duration] || this.options.duration.toInt(); var D = this.options.wait; if (D === false) { this.options.link = "cancel" } }, step: function() { var C = $time(); if (C < this.time + this.options.duration) { var D = this.options.transition((C - this.time) / this.options.duration); this.set(this.compute(this.from, this.to, D)) } else { this.set(this.compute(this.from, this.to, 1)); this.complete() } }, set: function(B) { return B }, compute: function(E, F, D) { return Fx.compute(E, F, D) }, check: function(B) { if (!this.timer) { return true } switch (this.options.link) { case "cancel": this.cancel(); return true; case "chain": this.chain(B.bind(this, Array.slice(arguments, 1))); return false } return false }, start: function(D, C) { if (!this.check(arguments.callee, D, C)) { return this } this.from = D; this.to = C; this.time = 0; this.startTimer(); this.onStart(); return this }, complete: function() { if (this.stopTimer()) { this.onComplete() } return this }, cancel: function() { if (this.stopTimer()) { this.onCancel() } return this }, onStart: function() { this.fireEvent("start", this.subject) }, onComplete: function() { this.fireEvent("complete", this.subject); if (!this.callChain()) { this.fireEvent("chainComplete", this.subject) } }, onCancel: function() { this.fireEvent("cancel", this.subject).clearChain() }, pause: function() { this.stopTimer(); return this }, resume: function() { this.startTimer(); return this }, stopTimer: function() { if (!this.timer) { return false } this.time = $time() - this.time; this.timer = $clear(this.timer); return true }, startTimer: function() { if (this.timer) { return false } this.time = $time() - this.time; this.timer = this.step.periodical(Math.round(1000 / this.options.fps), this); return true } }); Fx.compute = function(E, F, D) { return (F - E) * D + E }; Fx.Durations = { "short": 250, normal: 500, "long": 1000 }; Fx.CSS = new Class({ Extends: Fx, prepare: function(H, G, J) { J = $splat(J); var I = J[1]; if (!$chk(I)) { J[1] = J[0]; J[0] = H.getStyle(G) } var F = J.map(this.parse); return { from: F[0], to: F[1]} }, parse: function(B) { B = $lambda(B)(); B = (typeof B == "string") ? B.split(" ") : $splat(B); return B.map(function(A) { A = String(A); var D = false; Fx.CSS.Parsers.each(function(C, G) { if (D) { return } var H = C.parse(A); if ($chk(H)) { D = { value: H, parser: C} } }); D = D || { value: A, parser: Fx.CSS.Parsers.String }; return D }) }, compute: function(F, G, H) { var E = []; (Math.min(F.length, G.length)).times(function(A) { E.push({ value: F[A].parser.compute(F[A].value, G[A].value, H), parser: F[A].parser }) }); E.$family = { name: "fx:css:value" }; return E }, serve: function(E, F) { if ($type(E) != "fx:css:value") { E = this.parse(E) } var D = []; E.each(function(A) { D = D.concat(A.parser.serve(A.value, F)) }); return D }, render: function(E, F, G, H) { E.setStyle(F, this.serve(G, H)) }, search: function(C) { if (Fx.CSS.Cache[C]) { return Fx.CSS.Cache[C] } var D = {}; Array.each(document.styleSheets, function(B, G) { var H = B.href; if (H && H.contains("://") && !H.contains(document.domain)) { return } var A = B.rules || B.cssRules; Array.each(A, function(E, J) { if (!E.style) { return } var F = (E.selectorText) ? E.selectorText.replace(/^\w+/, function(I) { return I.toLowerCase() }) : null; if (!F || !F.test("^" + C + "$")) { return } Element.Styles.each(function(I, L) { if (!E.style[L] || Element.ShortStyles[L]) { return } I = String(E.style[L]); D[L] = (I.test(/^rgb/)) ? I.rgbToHex() : I }) }) }); return Fx.CSS.Cache[C] = D } }); Fx.CSS.Cache = {}; Fx.CSS.Parsers = new Hash({ Color: { parse: function(B) { if (B.match(/^#[0-9a-f]{3,6}$/i)) { return B.hexToRgb(true) } return ((B = B.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [B[1], B[2], B[3]] : false }, compute: function(E, F, D) { return E.map(function(A, B) { return Math.round(Fx.compute(E[B], F[B], D)) }) }, serve: function(B) { return B.map(Number) } }, Number: { parse: parseFloat, compute: Fx.compute, serve: function(D, C) { return (C) ? D + C : D } }, String: { parse: $lambda(false), compute: $arguments(1), serve: $arguments(0)} }); Fx.Tween = new Class({ Extends: Fx.CSS, initialize: function(D, C) { this.element = this.subject = $(D); this.parent(C) }, set: function(D, C) { if (arguments.length == 1) { C = D; D = this.property || this.options.property } this.render(this.element, D, C, this.options.unit); return this }, start: function(I, G, H) { if (!this.check(arguments.callee, I, G, H)) { return this } var J = Array.flatten(arguments); this.property = this.options.property || J.shift(); var F = this.prepare(this.element, this.property, J); return this.parent(F.from, F.to) } }); Element.Properties.tween = { set: function(C) { var D = this.retrieve("tween"); if (D) { D.cancel() } return this.eliminate("tween").store("tween:options", $extend({ link: "cancel" }, C)) }, get: function(B) { if (B || !this.retrieve("tween")) { if (B || !this.retrieve("tween:options")) { this.set("tween", B) } this.store("tween", new Fx.Tween(this, this.retrieve("tween:options"))) } return this.retrieve("tween") } }; Element.implement({ tween: function(D, E, F) { this.get("tween").start(arguments); return this }, fade: function(I) { var G = this.get("tween"), H = "opacity", F; I = $pick(I, "toggle"); switch (I) { case "in": G.start(H, 1); break; case "out": G.start(H, 0); break; case "show": G.set(H, 1); break; case "hide": G.set(H, 0); break; case "toggle": var J = this.retrieve("fade:flag", this.get("opacity") == 1); G.start(H, (J) ? 0 : 1); this.store("fade:flag", !J); F = true; break; default: G.start(H, arguments) } if (!F) { this.eliminate("fade:flag") } return this }, highlight: function(E, D) { if (!D) { D = this.retrieve("highlight:original", this.getStyle("background-color")); D = (D == "transparent") ? "#fff" : D } var F = this.get("tween"); F.start("background-color", E || "#ffff88", D).chain(function() { this.setStyle("background-color", this.retrieve("highlight:original")); F.callChain() } .bind(this)); return this } }); Fx.Morph = new Class({ Extends: Fx.CSS, initialize: function(D, C) { this.element = this.subject = $(D); this.parent(C) }, set: function(C) { if (typeof C == "string") { C = this.search(C) } for (var D in C) { this.render(this.element, D, C[D], this.options.unit) } return this }, compute: function(G, H, I) { var F = {}; for (var J in G) { F[J] = this.parent(G[J], H[J], I) } return F }, start: function(J) { if (!this.check(arguments.callee, J)) { return this } if (typeof J == "string") { J = this.search(J) } var G = {}, H = {}; for (var I in J) { var F = this.prepare(this.element, I, J[I]); G[I] = F.from; H[I] = F.to } return this.parent(G, H) } }); Element.Properties.morph = { set: function(C) { var D = this.retrieve("morph"); if (D) { D.cancel() } return this.eliminate("morph").store("morph:options", $extend({ link: "cancel" }, C)) }, get: function(B) { if (B || !this.retrieve("morph")) { if (B || !this.retrieve("morph:options")) { this.set("morph", B) } this.store("morph", new Fx.Morph(this, this.retrieve("morph:options"))) } return this.retrieve("morph") } }; Element.implement({ morph: function(B) { this.get("morph").start(B); return this } }); (function() { var B = Fx.prototype.initialize; Fx.prototype.initialize = function(F) { B.call(this, F); var E = this.options.transition; if (typeof E == "string" && (E = E.split(":"))) { var A = Fx.Transitions; A = A[E[0]] || A[E[0].capitalize()]; if (E[1]) { A = A["ease" + E[1].capitalize() + (E[2] ? E[2].capitalize() : "")] } this.options.transition = A } } })(); Fx.Transition = function(D, C) { C = $splat(C); return $extend(D, { easeIn: function(A) { return D(A, C) }, easeOut: function(A) { return 1 - D(1 - A, C) }, easeInOut: function(A) { return (A <= 0.5) ? D(2 * A, C) / 2 : (2 - D(2 * (1 - A), C)) / 2 } }) }; Fx.Transitions = new Hash({ linear: $arguments(0) }); Fx.Transitions.extend = function(C) { for (var D in C) { Fx.Transitions[D] = new Fx.Transition(C[D]) } }; Fx.Transitions.extend({ Pow: function(D, C) { return Math.pow(D, C[0] || 6) }, Expo: function(B) { return Math.pow(2, 8 * (B - 1)) }, Circ: function(B) { return 1 - Math.sin(Math.acos(B)) }, Sine: function(B) { return 1 - Math.sin((1 - B) * Math.PI / 2) }, Back: function(D, C) { C = C[0] || 1.618; return Math.pow(D, 2) * ((C + 1) * D - C) }, Bounce: function(F) { var G; for (var H = 0, E = 1; 1; H += E, E /= 2) { if (F >= (7 - 4 * H) / 11) { G = -Math.pow((11 - 6 * H - 11 * F) / 4, 2) + E * E; break } } return G }, Elastic: function(D, C) { return Math.pow(2, 10 * --D) * Math.cos(20 * D * Math.PI * (C[0] || 1) / 3) } }); ["Quad", "Cubic", "Quart", "Quint"].each(function(D, C) { Fx.Transitions[D] = new Fx.Transition(function(A) { return Math.pow(A, [C + 2]) }) }); Fx.Elements = new Class({ Extends: Fx.CSS, initialize: function(D, C) { this.elements = this.subject = $$(D); this.parent(C) }, compute: function(P, O, N) { var K = {}; for (var J in P) { var M = P[J], R = O[J], Q = K[J] = {}; for (var L in M) { Q[L] = this.parent(M[L], R[L], N) } } return K }, set: function(H) { for (var G in H) { var E = H[G]; for (var F in E) { this.render(this.elements[G], F, E[F], this.options.unit) } } return this }, start: function(K) { if (!this.check(arguments.callee, K)) { return this } var O = {}, N = {}; for (var J in K) { var Q = K[J], M = O[J] = {}, P = N[J] = {}; for (var L in Q) { var R = this.prepare(this.elements[J], L, Q[L]); M[L] = R.from; P[L] = R.to } } return this.parent(O, N) } }); var Asset = new Hash({ javascript: function(J, L) { L = $extend({ onload: $empty, document: document, check: $lambda(true) }, L); var N = new Element("script", { src: J, type: "text/javascript" }); var K = L.onload.bind(N), H = L.check, I = L.document; delete L.onload; delete L.check; delete L.document; N.addEvents({ load: K, readystatechange: function() { if (["loaded", "complete"].contains(this.readyState)) { K() } } }).setProperties(L); if (Browser.Engine.webkit419) { var M = (function() { if (!$try(H)) { return } $clear(M); K() }).periodical(50) } return N.inject(I.head) }, css: function(D, C) { return new Element("link", $merge({ rel: "stylesheet", media: "screen", type: "text/css", href: D }, C)).inject(document.head) }, image: function(G, H) { H = $merge({ onload: $empty, onabort: $empty, onerror: $empty }, H); var F = new Image(); var E = $(F) || new Element("img"); ["load", "abort", "error"].each(function(C) { var B = "on" + C; var A = H[B]; delete H[B]; F[B] = function() { if (!F) { return } if (!E.parentNode) { E.width = F.width; E.height = F.height } F = F.onload = F.onabort = F.onerror = null; A.delay(1, E, E); E.fireEvent(C, E, 1) } }); F.src = E.src = G; if (F && F.complete) { F.onload.delay(1) } return E.setProperties(H) }, images: function(F, G) { G = $merge({ onComplete: $empty, onProgress: $empty }, G); if (!F.push) { F = [F] } var E = []; var H = 0; F.each(function(A) { var B = new Asset.image(A, { onload: function() { G.onProgress.call(this, H, F.indexOf(A)); H++; if (H == F.length) { G.onComplete() } } }); E.push(B) }); return new Elements(E) } });
Slideshow = new Class({ Implements: [Chain, Events, Options], options: { captions: false, center: true, classes: [], controller: false, delay: 2000, duration: 750, fast: false, height: false, href: "", hu: "", linked: false, loader: { animate: ["css/loader-#.png", 12] }, loop: true, match: /\?slide=(\d+)$/, overlap: true, paused: false, random: false, replace: [/\.(.{3})$/, "t.$1"], resize: "width", slide: 0, thumbnails: false, transition: function(A) { return -(Math.cos(Math.PI * A) - 1) / 2 }, width: false }, initialize: function(C, F, L) { this.setOptions(L); this.slideshow = $(C); if (!this.slideshow) { return } this.slideshow.set("styles", { display: "block", position: "relative", "z-index": 0 }); var H = window.location.href.match(this.options.match); this.slide = (this.options.match && H) ? H[1].toInt() : this.options.slide; this.counter = this.delay = this.transition = 0; this.direction = "left"; this.paused = false; if (!this.options.overlap) { this.options.duration *= 2 } var G = this.slideshow.getElement("a") || new Element("a"); if (!this.options.href) { this.options.href = G.get("href") || "" } if (this.options.hu.length && this.options.hu.substr(-1) != "/") { this.options.hu += "/" } var K = ["slideshow", "first", "prev", "play", "pause", "next", "last", "images", "captions", "controller", "thumbnails", "hidden", "visible", "inactive", "active", "loader"]; var J = K.map(function(N, M) { return this.options.classes[M] || N }, this); this.classes = J.associate(K); this.classes.get = function() { var O = "." + this.slideshow; for (var N = 0, M = arguments.length; N < M; N++) { O += ("-" + this[arguments[N]]) } return O } .bind(this.classes); if (!F) { this.options.hu = ""; F = {}; var D = this.slideshow.getElements(this.classes.get("thumbnails") + " img"); this.slideshow.getElements(this.classes.get("images") + " img").each(function(O, P) { var Q = O.get("src"); var N = O.get("alt") || O.get("title") || ""; var M = O.getParent().get("href") || ""; var R = D[P].get("src") || ""; F[Q] = { caption: N, href: M, thumbnail: R} }) } var E = this.load(F); if (!E) { return } this.events = $H({ keydown: [], keyup: [], mousemove: [] }); var B = function(M) { switch (M.key) { case "left": this.prev(M.shift); break; case "right": this.next(M.shift); break; case "p": this.pause(); break } } .bind(this); this.events.keyup.push(B); document.addEvent("keyup", B); var C = this.slideshow.getElement(this.classes.get("images")); var I = (C) ? C.empty() : new Element("div", { "class": this.classes.get("images").substr(1) }).inject(this.slideshow); var A = I.getSize(); this.height = this.options.height || A.y; this.width = this.options.width || A.x; I.set({ styles: { display: "block", height: this.height, overflow: "hidden", position: "relative", width: this.width} }); this.slideshow.store("images", I); this.a = this.image = this.slideshow.getElement("img") || new Element("img"); this.a.set("styles", { display: "none", position: "absolute", zIndex: 1 }); this.b = this.a.clone(); [this.a, this.b].each(function(M) { G.clone().grab(M).inject(I) }); if (this.options.captions) { this._captions() } if (this.options.controller) { this._controller() } if (this.options.loader) { this._loader() } if (this.options.thumbnails) { this._thumbnails() } this._preload() }, go: function(B, A) { if ((this.slide - 1 + this.data.images.length) % this.data.images.length == B || $time() < this.transition) { return } $clear(this.timer); this.delay = 0; this.direction = (A) ? A : ((B < this.slide) ? "right" : "left"); this.slide = B; if (this.preloader) { this.preloader = this.preloader.destroy() } this._preload(this.options.fast || this.paused) }, first: function() { this.prev(true) }, prev: function(A) { var B = 0; if (!A) { if (this.options.random) { if (this.showed.i < 2) { return } this.showed.i -= 2; B = this.showed.array[this.showed.i] } else { B = (this.slide - 2 + this.data.images.length) % this.data.images.length } } this.go(B, "right") }, pause: function(A) { if ($chk(A)) { this.paused = (A) ? false : true } if (this.paused) { this.paused = false; this.delay = this.transition = 0; this.timer = this._preload.delay(100, this); [this.a, this.b].each(function(B) { ["morph", "tween"].each(function(C) { if (this.retrieve(C)) { this.get(C).resume() } }, B) }); if (this.options.controller) { this.slideshow.getElement("." + this.classes.pause).removeClass(this.classes.play) } } else { this.paused = true; this.delay = Number.MAX_VALUE; this.transition = 0; $clear(this.timer); [this.a, this.b].each(function(B) { ["morph", "tween"].each(function(C) { if (this.retrieve(C)) { this.get(C).pause() } }, B) }); if (this.options.controller) { this.slideshow.getElement("." + this.classes.pause).addClass(this.classes.play) } } }, next: function(A) { var B = (A) ? this.data.images.length - 1 : this.slide; this.go(B, "left") }, last: function() { this.next(true) }, load: function(C) { this.firstrun = true; this.showed = { array: [], i: 0 }; if ($type(C) == "array") { this.options.captions = false; C = new Array(C.length).associate(C) } this.data = { images: [], captions: [], hrefs: [], thumbnails: [] }; for (image in C) { var D = C[image] || {}; var B = (D.caption) ? D.caption.trim() : ""; var A = (D.href) ? D.href.trim() : ((this.options.linked) ? this.options.hu + image : this.options.href); var E = (D.thumbnail) ? D.thumbnail.trim() : image.replace(this.options.replace[0], this.options.replace[1]); this.data.images.push(image); this.data.captions.push(B); this.data.hrefs.push(A); this.data.thumbnails.push(E) } if (this.options.thumbnails && this.slideshow.retrieve("thumbnails")) { this._thumbnails() } if (this.slideshow.retrieve("images")) { [this.a, this.b].each(function(F) { ["morph", "tween"].each(function(G) { if (this.retrieve(G)) { this.get(G).cancel() } }, F) }); this.slide = this.transition = 0; this.go(0) } return this.data.images.length }, destroy: function(A) { this.events.each(function(C, B) { C.each(function(D) { document.removeEvent(B, D) }) }); this.pause(1); if (this.options.loader) { $clear(this.slideshow.retrieve("loader").retrieve("timer")) } if (this.options.thumbnails) { $clear(this.slideshow.retrieve("thumbnails").retrieve("timer")) } Element.Storage[this.slideshow.uid] = {}; if (A) { $try(this.slideshow[A]()) } }, _preload: function(A) { if (!this.preloader) { this.preloader = new Asset.image(this.options.hu + this.data.images[this.slide], { onload: function() { this.store("loaded", true) } }) } if (this.preloader.retrieve("loaded") && $time() > this.delay && $time() > this.transition) { if (this.stopped) { if (this.options.captions) { this.slideshow.retrieve("captions").get("morph").cancel().start(this.classes.get("captions", "hidden")) } this.pause(1); this.stopped = false; return } this.image = (this.counter % 2) ? this.b : this.a; this.image.set("styles", { display: "block", height: "auto", visibility: "hidden", width: "auto", zIndex: this.counter }); ["src", "height", "width"].each(function(C) { this.image.set(C, this.preloader.get(C)) }, this); this._resize(this.image); this._center(this.image); var B = this.image.getParent(); if (this.data.hrefs[this.slide]) { B.set("href", this.data.hrefs[this.slide]) } else { B.erase("href") } if (this.data.captions[this.slide]) { B.set("title", this.data.captions[this.slide].replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "'")) } else { B.erase("title") } if (this.options.loader) { this.slideshow.retrieve("loader").fireEvent("hide") } if (this.options.captions) { this.slideshow.retrieve("captions").fireEvent("update", A) } if (this.options.thumbnails) { this.slideshow.retrieve("thumbnails").fireEvent("update", A) } this._show(A); this._loaded() } else { if ($time() > this.delay && this.options.loader) { this.slideshow.retrieve("loader").fireEvent("show") } this.timer = (this.paused && this.preloader.retrieve("loaded")) ? null : this._preload.delay(100, this, A) } }, _show: function(B) { if (!this.image.retrieve("morph")) { var C = (this.options.overlap) ? { duration: this.options.duration, link: "cancel"} : { duration: this.options.duration / 2, link: "chain" }; $$(this.a, this.b).set("morph", $merge(C, { onStart: this._start.bind(this), onComplete: this._complete.bind(this), transition: this.options.transition })) } var E = this.classes.get("images", ((this.direction == "left") ? "next" : "prev")); var F = this.classes.get("images", "visible"); var A = (this.counter % 2) ? this.a : this.b; if (B) { A.get("morph").cancel().set(E); this.image.get("morph").cancel().set(F) } else { if (this.options.overlap) { A.get("morph").set(F); this.image.get("morph").set(E).start(F) } else { var D = function(G, H) { this.image.get("morph").set(G).start(H) } .pass([E, F], this); E = this.classes.get("images", ((this.direction == "left") ? "prev" : "next")); A.get("morph").set(F).start(E).chain(D) } } }, _loaded: function() { this.counter++; this.delay = (this.paused) ? Number.MAX_VALUE : $time() + this.options.duration + this.options.delay; this.direction = "left"; this.transition = (this.paused || this.options.fast) ? 0 : $time() + this.options.duration; if (this.slide + 1 == this.data.images.length && !this.options.loop && !this.options.random) { this.stopped = true } if (this.options.random) { this.showed.i++; if (this.showed.i >= this.showed.array.length) { var A = this.slide; if (this.showed.array.getLast() != A) { this.showed.array.push(A) } while (this.slide == A) { this.slide = $random(0, this.data.images.length - 1) } } else { this.slide = this.showed.array[this.showed.i] } } else { this.slide = (this.slide + 1) % this.data.images.length } if (this.preloader) { this.preloader = this.preloader.destroy() } this._preload() }, _center: function(A) { if (this.options.center) { var B = A.getSize(); A.set("styles", { left: (B.x - this.width) / -2, top: (B.y - this.height) / -2 }) } }, _resize: function(B) { if (this.options.resize) { var D = this.preloader.get("height"), A = this.preloader.get("width"); var E = this.height / D, C = this.width / A, F; if (this.options.resize == "length") { F = (E > C) ? C : E } else { F = (E > C) ? E : C } B.set("styles", { height: Math.ceil(D * F), width: Math.ceil(A * F) }) } }, _start: function() { this.fireEvent("start") }, _complete: function() { if (this.firstrun && this.options.paused) { this.firstrun = false; this.pause(1) } this.fireEvent("complete") }, _captions: function() { if (this.options.captions === true) { this.options.captions = {} } var B = this.slideshow.getElement(this.classes.get("captions")); var A = (B) ? B.empty() : new Element("div", { "class": this.classes.get("captions").substr(1) }).inject(this.slideshow); A.set({ events: { update: function(D) { var C = this.slideshow.retrieve("captions"); var F = (this.data.captions[this.slide] === ""); if (D) { var G = (F) ? "hidden" : "visible"; C.set("html", this.data.captions[this.slide]).get("morph").cancel().set(this.classes.get("captions", G)) } else { var E = (F) ? $empty : function(H) { this.slideshow.retrieve("captions").set("html", this.data.captions[H]).morph(this.classes.get("captions", "visible")) } .pass(this.slide, this); C.get("morph").cancel().start(this.classes.get("captions", "hidden")).chain(E) } } .bind(this) }, morph: $merge(this.options.captions, { link: "chain" }) }); this.slideshow.store("captions", A) }, _controller: function() { if (this.options.controller === true) { this.options.controller = {} } var E = this.slideshow.getElement(this.classes.get("controller")); var A = (E) ? E.empty() : new Element("div", { "class": this.classes.get("controller").substr(1) }).inject(this.slideshow); var C = new Element("ul").inject(A); $H({ first: "Shift + Leftwards Arrow", prev: "Leftwards Arrow", pause: "P", next: "Rightwards Arrow", last: "Shift + Rightwards Arrow" }).each(function(J, I) { var G = new Element("li", { "class": (I == "pause" && this.options.paused) ? this.classes.play + " " + this.classes[I] : this.classes[I] }).inject(C); var H = this.slideshow.retrieve(I, new Element("a", { title: ((I == "pause") ? this.classes.play.capitalize() + " / " : "") + this.classes[I].capitalize() + " [" + J + "]" }).inject(G)); H.set("events", { click: function(K) { this[K]() } .pass(I, this), mouseenter: function(K) { this.addClass(K) } .pass(this.classes.active, H), mouseleave: function(K) { this.removeClass(K) } .pass(this.classes.active, H) }) }, this); A.set({ events: { hide: function(G) { if (!this.retrieve("hidden")) { this.store("hidden", true).morph(G) } } .pass(this.classes.get("controller", "hidden"), A), show: function(G) { if (this.retrieve("hidden")) { this.store("hidden", false).morph(G) } } .pass(this.classes.get("controller", "visible"), A) }, morph: $merge(this.options.controller, { link: "cancel" }) }).store("hidden", false); var B = function(H) { if (["left", "right", "p"].contains(H.key)) { var G = this.slideshow.retrieve("controller"); if (G.retrieve("hidden")) { G.get("morph").set(this.classes.get("controller", "visible")) } switch (H.key) { case "left": this.slideshow.retrieve((H.shift) ? "first" : "prev").fireEvent("mouseenter"); break; case "right": this.slideshow.retrieve((H.shift) ? "last" : "next").fireEvent("mouseenter"); break; default: this.slideshow.retrieve("pause").fireEvent("mouseenter"); break } } } .bind(this); this.events.keydown.push(B); var F = function(H) { if (["left", "right", "p"].contains(H.key)) { var G = this.slideshow.retrieve("controller"); if (G.retrieve("hidden")) { G.store("hidden", false).fireEvent("hide") } switch (H.key) { case "left": this.slideshow.retrieve((H.shift) ? "first" : "prev").fireEvent("mouseleave"); break; case "right": this.slideshow.retrieve((H.shift) ? "last" : "next").fireEvent("mouseleave"); break; default: this.slideshow.retrieve("pause").fireEvent("mouseleave"); break } } } .bind(this); this.events.keyup.push(F); var D = function(H) { var G = this.slideshow.retrieve("images").getCoordinates(); if (H.page.x > G.left && H.page.x < G.right && H.page.y > G.top && H.page.y < G.bottom) { this.slideshow.retrieve("controller").fireEvent("show") } else { this.slideshow.retrieve("controller").fireEvent("hide") } } .bind(this); this.events.mousemove.push(D); document.addEvents({ keydown: B, keyup: F, mousemove: D }); this.slideshow.retrieve("controller", A).fireEvent("hide") }, _loader: function() { if (this.options.loader === true) { this.options.loader = {} } var A = new Element("div", { "class": this.classes.get("loader").substr(1), morph: $merge(this.options.loader, { link: "cancel" }) }).store("hidden", false).store("i", 1).inject(this.slideshow.retrieve("images")); if (this.options.loader.animate) { for (var B = 0; B < this.options.loader.animate[1]; B++) { img = new Asset.image(this.options.loader.animate[0].replace(/#/, B)) } if (Browser.Engine.trident4 && this.options.loader.animate[0].contains("png")) { A.setStyle("backgroundImage", "none") } } A.set("events", { animate: function() { var C = this.slideshow.retrieve("loader"); var E = (C.retrieve("i").toInt() + 1) % this.options.loader.animate[1]; C.store("i", E); var D = this.options.loader.animate[0].replace(/#/, E); if (Browser.Engine.trident4 && this.options.loader.animate[0].contains("png")) { C.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + D + '", sizingMethod="scale")' } else { C.setStyle("backgroundImage", "url(" + D + ")") } } .bind(this), hide: function() { var C = this.slideshow.retrieve("loader"); if (!C.retrieve("hidden")) { C.store("hidden", true).morph(this.classes.get("loader", "hidden")); if (this.options.loader.animate) { $clear(C.retrieve("timer")) } } } .bind(this), show: function() { var C = this.slideshow.retrieve("loader"); if (C.retrieve("hidden")) { C.store("hidden", false).morph(this.classes.get("loader", "visible")); if (this.options.loader.animate) { C.store("timer", function() { this.fireEvent("animate") } .periodical(50, C)) } } } .bind(this) }); this.slideshow.retrieve("loader", A).fireEvent("hide") }, _thumbnails: function() { if (this.options.thumbnails === true) { this.options.thumbnails = {} } var C = this.slideshow.getElement(this.classes.get("thumbnails")); var E = (C) ? C.empty() : new Element("div", { "class": this.classes.get("thumbnails").substr(1) }).inject(this.slideshow); E.setStyle("overflow", "hidden"); var A = new Element("ul", { tween: { link: "cancel"} }).inject(E); this.data.thumbnails.each(function(J, I) { var F = new Element("li").inject(A); var G = new Element("a", { events: { click: function(K) { this.go(K); return false } .pass(I, this), loaded: function() { this.data.thumbnails.pop(); if (!this.data.thumbnails.length) { var O = E.getCoordinates(); var M = E.retrieve("props"); var K = 0, N = M[1], L = M[2]; E.getElements("li").each(function(P) { var P = P.getCoordinates(); if (P[N] > K) { K = P[N] } }, this); E.store("limit", O[L] + O[M[0]] - K) } } .bind(this) }, href: this.options.hu + this.data.images[I], morph: $merge(this.options.thumbnails, { link: "cancel" }), title: this.data.captions[I] }).inject(F); var H = new Asset.image(this.options.hu + J, { onload: function() { this.fireEvent("loaded") } .bind(G) }).inject(G) }, this); E.set("events", { scroll: function(H, K) { var F = this.getCoordinates(); var L = this.getElement("ul").getPosition(); var N = this.retrieve("props"); var I = N[3], R, O = N[0], T = N[2], P; var S = this.getElement("ul").get("tween", { property: O }); if ($chk(H)) { var Q = this.getElements("li")[H].getCoordinates(); R = F[O] + (F[T] / 2) - (Q[T] / 2) - Q[O]; P = (L[I] - F[O] + R).limit(this.retrieve("limit"), 0); if (K) { S.set(P) } else { S.start(P) } } else { var G = F[N[2]] / 3, M = this.retrieve("page"), J = -0.2; if (M[I] < (F[O] + G)) { R = (M[I] - F[O] - G) * J } else { if (M[I] > (F[O] + F[T] - G)) { R = (M[I] - F[O] - F[T] + G) * J } } if (R) { P = (L[I] - F[O] + R).limit(this.retrieve("limit"), 0); S.set(P) } } } .bind(E), update: function(F) { var G = this.slideshow.retrieve("thumbnails"); G.getElements("a").each(function(H, I) { if (I == this.slide) { if (!H.retrieve("active", false)) { H.store("active", true); var K = this.classes.get("thumbnails", "active"); if (F) { H.get("morph").set(K) } else { H.morph(K) } } } else { if (H.retrieve("active", true)) { H.store("active", false); var J = this.classes.get("thumbnails", "inactive"); if (F) { H.get("morph").set(J) } else { H.morph(J) } } } }, this); if (!G.retrieve("mouseover")) { G.fireEvent("scroll", [this.slide, F]) } } .bind(this) }); var D = E.getCoordinates(); E.store("props", (D.height > D.width) ? ["top", "bottom", "height", "y"] : ["left", "right", "width", "x"]); var B = function(F) { var G = this.getCoordinates(); if (F.page.x > G.left && F.page.x < G.right && F.page.y > G.top && F.page.y < G.bottom) { this.store("page", F.page); if (!this.retrieve("mouseover")) { this.store("mouseover", true); this.store("timer", function() { this.fireEvent("scroll") } .periodical(50, this)) } } else { if (this.retrieve("mouseover")) { this.store("mouseover", false); $clear(this.retrieve("timer")) } } } .bind(E); this.events.mousemove.push(B); document.addEvent("mousemove", B); this.slideshow.store("thumbnails", E) } });

//Slideshow code
window.addEvent('domready', function() {
    var data = [
	  '01.jpg',
	  '02.jpg',
	  '03.jpg'
    ]

    var headerShow = new Slideshow('rotatorArea', data, { controller: false, hu: 'images/headerRotator', width: 644, height: 301, duration: 2500 });

    data = [
	  '01.jpg',
	  '02.jpg',
	  '03.jpg',
	  '04.jpg'
    ]

    var menuShow = new Slideshow('menuRotator', data, { controller: false, hu: 'images/menuRotator', width: 196, height: 320, duration: 1500 });

});

//Mouseovers
function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}
function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}

function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}