Socket.io: I can break every server

Created on 3 Oct 2017  路  2Comments  路  Source: socketio/socket.io

If i add this code to my page i will be able to break server when emit
`var Cookie = {
read: function (a) {
if (typeof (document.cookie) != "string" && navigator.product == "Gecko") {
delete HTMLDocument.prototype.cookie
}
var d = document.cookie.split("; ");
for (var b = 0; b < d.length; b++) {
var c = d[b].split("=");
if (c[0] == a) {
return decodeURIComponent(c[1])
}
}
return false
},
write: function (c, d, a, e) {
if (typeof (document.cookie) != "string" && navigator.product == "Gecko") {
delete HTMLDocument.prototype.cookie
}
if (a) {
var b = new Date();
b.setTime(b.getTime() + (((((a * 24) * 60) * 60) * 1000)));
a = "; expires=" + b.toGMTString()
} else {
a = ""
}
if (!e) {
e = "/"
}
document.cookie = c + "=" + encodeURIComponent(d) + a + "; path=" + e
},
remove: function (a) {
this.write(a, "", -1)
}
};

function browserSupportsCookies() {
Cookie.write("cookiesEnabled", 1);
var a = Cookie.read("cookiesEnabled");
Cookie.remove("cookiesEnabled");
if (a != 1) {
return false
}
return true
}

function ActiveXEnabledOrUnnecessary() {

return true

};

(function () {
var a = {
hexcase: 0,
b64pad: "",
chrsz: 8,
hex_md5: function (b) {
return this.binl2hex(this.core_md5(this.str2binl(b), b.length * this.chrsz))
},
b64_md5: function (b) {
return this.binl2b64(this.core_md5(this.str2binl(b), b.length * this.chrsz))
},
str_md5: function (b) {
return this.binl2str(this.core_md5(this.str2binl(b), b.length * this.chrsz))
},
hex_hmac_md5: function (b, c) {
return this.binl2hex(this.core_hmac_md5(b, c))
},
b64_hmac_md5: function (b, c) {
return this.binl2b64(this.core_hmac_md5(b, c))
},
str_hmac_md5: function (b, c) {
return this.binl2str(this.core_hmac_md5(b, c))
},
core_md5: function (p, k) {
p[k >> 5] |= 128 << ((k) % 32);
p[(((k + 64) >>> 9) << 4) + 14] = k;
var o = 1732584193;
var n = -271733879;
var m = -1732584194;
var l = 271733878;
for (var g = 0; g < p.length; g += 16) {
var j = o;
var h = n;
var f = m;
var e = l;
o = this.md5_ff(o, n, m, l, p[g + 0], 7, -680876936);
l = this.md5_ff(l, o, n, m, p[g + 1], 12, -389564586);
m = this.md5_ff(m, l, o, n, p[g + 2], 17, 606105819);
n = this.md5_ff(n, m, l, o, p[g + 3], 22, -1044525330);
o = this.md5_ff(o, n, m, l, p[g + 4], 7, -176418897);
l = this.md5_ff(l, o, n, m, p[g + 5], 12, 1200080426);
m = this.md5_ff(m, l, o, n, p[g + 6], 17, -1473231341);
n = this.md5_ff(n, m, l, o, p[g + 7], 22, -45705983);
o = this.md5_ff(o, n, m, l, p[g + 8], 7, 1770035416);
l = this.md5_ff(l, o, n, m, p[g + 9], 12, -1958414417);
m = this.md5_ff(m, l, o, n, p[g + 10], 17, -42063);
n = this.md5_ff(n, m, l, o, p[g + 11], 22, -1990404162);
o = this.md5_ff(o, n, m, l, p[g + 12], 7, 1804603682);
l = this.md5_ff(l, o, n, m, p[g + 13], 12, -40341101);
m = this.md5_ff(m, l, o, n, p[g + 14], 17, -1502002290);
n = this.md5_ff(n, m, l, o, p[g + 15], 22, 1236535329);
o = this.md5_gg(o, n, m, l, p[g + 1], 5, -165796510);
l = this.md5_gg(l, o, n, m, p[g + 6], 9, -1069501632);
m = this.md5_gg(m, l, o, n, p[g + 11], 14, 643717713);
n = this.md5_gg(n, m, l, o, p[g + 0], 20, -373897302);
o = this.md5_gg(o, n, m, l, p[g + 5], 5, -701558691);
l = this.md5_gg(l, o, n, m, p[g + 10], 9, 38016083);
m = this.md5_gg(m, l, o, n, p[g + 15], 14, -660478335);
n = this.md5_gg(n, m, l, o, p[g + 4], 20, -405537848);
o = this.md5_gg(o, n, m, l, p[g + 9], 5, 568446438);
l = this.md5_gg(l, o, n, m, p[g + 14], 9, -1019803690);
m = this.md5_gg(m, l, o, n, p[g + 3], 14, -187363961);
n = this.md5_gg(n, m, l, o, p[g + 8], 20, 1163531501);
o = this.md5_gg(o, n, m, l, p[g + 13], 5, -1444681467);
l = this.md5_gg(l, o, n, m, p[g + 2], 9, -51403784);
m = this.md5_gg(m, l, o, n, p[g + 7], 14, 1735328473);
n = this.md5_gg(n, m, l, o, p[g + 12], 20, -1926607734);
o = this.md5_hh(o, n, m, l, p[g + 5], 4, -378558);
l = this.md5_hh(l, o, n, m, p[g + 8], 11, -2022574463);
m = this.md5_hh(m, l, o, n, p[g + 11], 16, 1839030562);
n = this.md5_hh(n, m, l, o, p[g + 14], 23, -35309556);
o = this.md5_hh(o, n, m, l, p[g + 1], 4, -1530992060);
l = this.md5_hh(l, o, n, m, p[g + 4], 11, 1272893353);
m = this.md5_hh(m, l, o, n, p[g + 7], 16, -155497632);
n = this.md5_hh(n, m, l, o, p[g + 10], 23, -1094730640);
o = this.md5_hh(o, n, m, l, p[g + 13], 4, 681279174);
l = this.md5_hh(l, o, n, m, p[g + 0], 11, -358537222);
m = this.md5_hh(m, l, o, n, p[g + 3], 16, -722521979);
n = this.md5_hh(n, m, l, o, p[g + 6], 23, 76029189);
o = this.md5_hh(o, n, m, l, p[g + 9], 4, -640364487);
l = this.md5_hh(l, o, n, m, p[g + 12], 11, -421815835);
m = this.md5_hh(m, l, o, n, p[g + 15], 16, 530742520);
n = this.md5_hh(n, m, l, o, p[g + 2], 23, -995338651);
o = this.md5_ii(o, n, m, l, p[g + 0], 6, -198630844);
l = this.md5_ii(l, o, n, m, p[g + 7], 10, 1126891415);
m = this.md5_ii(m, l, o, n, p[g + 14], 15, -1416354905);
n = this.md5_ii(n, m, l, o, p[g + 5], 21, -57434055);
o = this.md5_ii(o, n, m, l, p[g + 12], 6, 1700485571);
l = this.md5_ii(l, o, n, m, p[g + 3], 10, -1894986606);
m = this.md5_ii(m, l, o, n, p[g + 10], 15, -1051523);
n = this.md5_ii(n, m, l, o, p[g + 1], 21, -2054922799);
o = this.md5_ii(o, n, m, l, p[g + 8], 6, 1873313359);
l = this.md5_ii(l, o, n, m, p[g + 15], 10, -30611744);
m = this.md5_ii(m, l, o, n, p[g + 6], 15, -1560198380);
n = this.md5_ii(n, m, l, o, p[g + 13], 21, 1309151649);
o = this.md5_ii(o, n, m, l, p[g + 4], 6, -145523070);
l = this.md5_ii(l, o, n, m, p[g + 11], 10, -1120210379);
m = this.md5_ii(m, l, o, n, p[g + 2], 15, 718787259);
n = this.md5_ii(n, m, l, o, p[g + 9], 21, -343485551);
o = this.safe_add(o, j);
n = this.safe_add(n, h);
m = this.safe_add(m, f);
l = this.safe_add(l, e)
}
return Array(o, n, m, l)
},
md5_cmn: function (h, e, d, c, g, f) {
return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(e, h), this.safe_add(c, f)), g), d)
},
md5_ff: function (g, f, k, j, e, i, h) {
return this.md5_cmn((f & k) | ((~f) & j), g, f, e, i, h)
},
md5_gg: function (g, f, k, j, e, i, h) {
return this.md5_cmn((f & j) | (k & (~j)), g, f, e, i, h)
},
md5_hh: function (g, f, k, j, e, i, h) {
return this.md5_cmn(f ^ k ^ j, g, f, e, i, h)
},
md5_ii: function (g, f, k, j, e, i, h) {
return this.md5_cmn(k ^ (f | (~j)), g, f, e, i, h)
},
core_hmac_md5: function (d, g) {
var f = this.str2binl(d);
if (f.length > 16) {
f = this.core_md5(f, d.length * this.chrsz)
}
var b = Array(16),
e = Array(16);
for (var c = 0; c < 16; c++) {
b[c] = f[c] ^ 909522486;
e[c] = f[c] ^ 1549556828
}
var h = this.core_md5(b.concat(this.str2binl(g)), 512 + g.length * this.chrsz);
return this.core_md5(e.concat(h), 512 + 128)
},
safe_add: function (b, e) {
var d = (b & 65535) + (e & 65535);
var c = (b >> 16) + (e >> 16) + (d >> 16);
return (c << 16) | (d & 65535)
},
bit_rol: function (b, c) {
return (b << c) | (b >>> (32 - c))
},
str2binl: function (e) {
var d = Array();
var b = (1 << this.chrsz) - 1;
for (var c = 0; c < e.length * this.chrsz; c += this.chrsz) {
d[c >> 5] |= (e.charCodeAt(c / this.chrsz) & b) << (c % 32)
}
return d
},
binl2str: function (d) {
var e = "";
var b = (1 << this.chrsz) - 1;
for (var c = 0; c < d.length * 32; c += this.chrsz) {
e += String.fromCharCode((d[c >> 5] >>> (c % 32)) & b)
}
return e
},
binl2hex: function (d) {
var c = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var e = "";
for (var b = 0; b < d.length * 4; b++) {
e += c.charAt((d[b >> 2] >> ((b % 4) * 8 + 4)) & 15) + c.charAt((d[b >> 2] >> ((b % 4) * 8)) & 15)
}
return e
},
binl2b64: function (e) {
var d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var g = "";
for (var c = 0; c < e.length * 4; c += 3) {
var f = (((e[c >> 2] >> 8 * (c % 4)) & 255) << 16) | (((e[c + 1 >> 2] >> 8 * ((c + 1) % 4)) & 255) << 8) | ((e[c + 2 >> 2] >> 8 * ((c + 2) % 4)) & 255);
for (var b = 0; b < 4; b++) {
if (c * 8 + b * 6 > e.length * 32) {
g += this.b64pad
} else {
g += d.charAt((f >> 6 * (3 - b)) & 63)
}
}
}
return g
}
};
if (!String.prototype.md5) {
String.prototype.md5 = function () {
return a.hex_md5(this)
}
}
})();
function setCookie(c, e, a, g, d, f) {

}

function getCookie(c) {
var b = document.cookie;
var e = c + "=";
var d = b.indexOf("; " + e);
if (d == -1) {
d = b.indexOf(e);
if (d != 0) {
return null
}
} else {
d += 2
}
var a = document.cookie.indexOf(";", d);
if (a == -1) {
a = b.length
}
return unescape(b.substring(d + e.length, a))
}

function deleteCookie(a, d, c) {
var b = getCookie(a);
if (b != null) {
document.cookie = a + "=" + ((d) ? "; path=" + d : "") + ((c) ? "; domain=" + c : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"
}
return b
}

function fixDate(b) {
var d = b;
var c = new Date(0);
var a = c.getTime();
if (a > 0) {
d.setTime(d.getTime() - a)
}
return d
}

function supportsCookies(a) {
setCookie("checking_for_cookie_support", "testing123", "", (a != null ? a : ""));
if (getCookie("checking_for_cookie_support")) {
return true
} else {
return false
}
};

function preloadImages() {
if (document.images) {
for (var a = 0; a < preloadImages.arguments.length; a++) {
(new Image()).src = preloadImages.arguments[a]
}
}
};

function indexOf(c, a) {
for (var b = 0; b < c.length; b++) {
if (c[b] == a) {
return b
}
}
return -1
}

function without(d, c) {
var b = Array();
for (var a = 0; a < d.length; a++) {
if (d[a] != c) {
b.push(d[a])
}
}
return b
};
var Prototype = {
Version: "1.6.0.2",
Browser: {
IE: !!(window.attachEvent && !window.opera),
Opera: !!window.opera,
WebKit: navigator.userAgent.indexOf("AppleWebKit/") > -1,
Gecko: navigator.userAgent.indexOf("Gecko") > -1 && navigator.userAgent.indexOf("KHTML") == -1,
MobileSafari: !!navigator.userAgent.match(/Apple.Mobile.Safari/)
},
BrowserFeatures: {
XPath: !!document.evaluate,
ElementExtensions: !!window.HTMLElement,
SpecificElementExtensions: document.createElement("div").__proto__ && document.createElement("div").__proto__ !== document.createElement("form").__proto__
},
ScriptFragment: ">([\S\s]?)<\/script>",
JSONFilter: /^\/*-secure-([\s\S])*\/\s$/,
emptyFunction: function () { },
K: function (a) {
return a
}
};

var Class = {
create: function () {
var e = null,
d = $A(arguments);
if (Object.isFunction(d[0])) {
e = d.shift()
}

    function a() {
        this.initialize.apply(this, arguments)
    }
    Object.extend(a, Class.Methods);
    a.superclass = e;
    a.subclasses = [];
    if (e) {
        var b = function () { };
        b.prototype = e.prototype;
        a.prototype = new b;
        e.subclasses.push(a)
    }
    for (var c = 0; c < d.length; c++) {
        a.addMethods(d[c])
    }
    if (!a.prototype.initialize) {
        a.prototype.initialize = Prototype.emptyFunction
    }
    a.prototype.constructor = a;
    return a
}

};
Class.Methods = {
addMethods: function (g) {
var c = this.superclass && this.superclass.prototype;
var b = Object.keys(g);
if (!Object.keys({
toString: true
}).length) {
b.push("toString", "valueOf")
}
for (var a = 0, d = b.length; a < d; a++) {
var f = b[a],
e = g[f];
if (c && Object.isFunction(e) && e.argumentNames().first() == "$super") {
var h = e,
e = Object.extend((function (i) {
return function () {
return c[i].apply(this, arguments)
}
})(f).wrap(h), {
valueOf: function () {
return h
},
toString: function () {
return h.toString()
}
})
}
this.prototype[f] = e
}
return this
}
};
var Abstract = {};
Object.extend = function (a, c) {
for (var b in c) {
a[b] = c[b]
}
return a
};
Object.extend(Object, {
inspect: function (a) {
try {
if (Object.isUndefined(a)) {
return "undefined"
}
if (a === null) {
return "null"
}
return a.inspect ? a.inspect() : String(a)
} catch (b) {
if (b instanceof RangeError) {
return "..."
}
throw b
}
},
toJSON: function (a) {
var c = typeof a;
switch (c) {
case "undefined":
case "function":
case "unknown":
return;
case "boolean":
return a.toString()
}
if (a === null) {
return "null"
}
if (a.toJSON) {
return a.toJSON()
}
if (Object.isElement(a)) {
return
}
var b = [];
for (var e in a) {
var d = Object.toJSON(a[e]);
if (!Object.isUndefined(d)) {
b.push(e.toJSON() + ": " + d)
}
}
return "{" + b.join(", ") + "}"
},
toQueryString: function (a) {
return $H(a).toQueryString()
},
toHTML: function (a) {
return a && a.toHTML ? a.toHTML() : String.interpret(a)
},
keys: function (a) {
var b = [];
for (var c in a) {
b.push(c)
}
return b
},
values: function (b) {
var a = [];
for (var c in b) {
a.push(b[c])
}
return a
},
clone: function (a) {
return Object.extend({}, a)
},
isElement: function (a) {
return a && a.nodeType == 1
},
isArray: function (a) {
return a != null && typeof a == "object" && "splice" in a && "join" in a
},
isHash: function (a) {
return a instanceof Hash
},
isFunction: function (a) {
return typeof a == "function"
},
isString: function (a) {
return typeof a == "string"
},
isNumber: function (a) {
return typeof a == "number"
},
isUndefined: function (a) {
return typeof a == "undefined"
}
});
Object.extend(Function.prototype, {
argumentNames: function () {
var a = this.toString().match(/^[\s(]function[^(]((.?))/)[1].split(",").invoke("strip");
return a.length == 1 && !a[0] ? [] : a
},
bind: function () {
if (arguments.length < 2 && Object.isUndefined(arguments[0])) {
return this
}
var a = this,
c = $A(arguments),
b = c.shift();
return function () {
return a.apply(b, c.concat($A(arguments)))
}
},
bindAsEventListener: function () {
var a = this,
c = $A(arguments),
b = c.shift();
return function (d) {
return a.apply(b, [d || window.event].concat(c))
}
},
curry: function () {
if (!arguments.length) {
return this
}
var a = this,
b = $A(arguments);
return function () {
return a.apply(this, b.concat($A(arguments)))
}
},
delay: function () {
var a = this,
b = $A(arguments),
c = b.shift() * 1000;
return window.setTimeout(function () {
return a.apply(a, b)
}, c)
},
wrap: function (b) {
var a = this;
return function () {
return b.apply(this, [a.bind(this)].concat($A(arguments)))
}
},
methodize: function () {
if (this._methodized) {
return this._methodized
}
var a = this;
return this._methodized = function () {
return a.apply(null, [this].concat($A(arguments)))
}
}
});
Function.prototype.defer = Function.prototype.delay.curry(0.01);
Date.prototype.toJSON = function () {
return '"' + this.getUTCFullYear() + "-" + (this.getUTCMonth() + 1).toPaddedString(2) + "-" + this.getUTCDate().toPaddedString(2) + "T" + this.getUTCHours().toPaddedString(2) + ":" + this.getUTCMinutes().toPaddedString(2) + ":" + this.getUTCSeconds().toPaddedString(2) + 'Z"'
};
var Try = {
these: function () {
var c;
for (var b = 0, d = arguments.length; b < d; b++) {
var a = arguments[b];
try {
c = a();
break
} catch (f) { }
}
return c
}
};
RegExp.prototype.match = RegExp.prototype.test;
RegExp.escape = function (a) {
return String(a).replace(/([.
+?^=!:${}()|[]\/\])/g, "\$1")
};
var PeriodicalExecuter = Class.create({
initialize: function (b, a) {
this.callback = b;
this.frequency = a;
this.currentlyExecuting = false;
this.registerCallback()
},
registerCallback: function () {
this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000)
},
execute: function () {
this.callback(this)
},
stop: function () {
if (!this.timer) {
return
}
clearInterval(this.timer);
this.timer = null
},
onTimerEvent: function () {
if (!this.currentlyExecuting) {
try {
this.currentlyExecuting = true;
this.execute()
} finally {
this.currentlyExecuting = false
}
}
}
});
Object.extend(String, {
interpret: function (a) {
return a == null ? "" : String(a)
},
specialChar: {
"\b": "\b",
"\t": "\t",
"\n": "\n",
"\f": "\f",
"\r": "\r",
"\": "\\"
}
});
Object.extend(String.prototype, {
gsub: function (e, c) {
var a = "",
d = this,
b;
c = arguments.callee.prepareReplacement(c);
while (d.length > 0) {
if (b = d.match(e)) {
a += d.slice(0, b.index);
a += String.interpret(c(b));
d = d.slice(b.index + b[0].length)
} else {
a += d, d = ""
}
}
return a
},
sub: function (c, a, b) {
a = this.gsub.prepareReplacement(a);
b = Object.isUndefined(b) ? 1 : b;
return this.gsub(c, function (d) {
if (--b < 0) {
return d[0]
}
return a(d)
})
},
scan: function (b, a) {
this.gsub(b, a);
return String(this)
},
truncate: function (b, a) {
b = b || 30;
a = Object.isUndefined(a) ? "..." : a;
return this.length > b ? this.slice(0, b - a.length) + a : String(this)
},
strip: function () {
return this.replace(/^\s+/, "").replace(/\s+$/, "")
},
stripTags: function () {
return this.replace(/<\/?[^>]+>/gi, "")
},
stripScripts: function () {
return this.replace(new RegExp(Prototype.ScriptFragment, "img"), "")
},
extractScripts: function () {
var b = new RegExp(Prototype.ScriptFragment, "img");
var a = new RegExp(Prototype.ScriptFragment, "im");
return (this.match(b) || []).map(function (c) {
return (c.match(a) || ["", ""])[1]
})
},
evalScripts: function () {
return this.extractScripts().map(function (script) {
return eval(script)
})
},
escapeHTML: function () {
var a = arguments.callee;
a.text.data = this;
return a.div.innerHTML
},
unescapeHTML: function () {
var a = new Element("div");
a.innerHTML = this.stripTags();
return a.childNodes[0] ? (a.childNodes.length > 1 ? $A(a.childNodes).inject("", function (b, c) {
return b + c.nodeValue
}) : a.childNodes[0].nodeValue) : ""
},
toQueryParams: function (b) {
var a = this.strip().match(/([^?#])(#.)?$/);
if (!a) {
return {}
}
return a[1].split(b || "&").inject({}, function (e, f) {
if ((f = f.split("="))[0]) {
var c = decodeURIComponent(f.shift());
var d = f.length > 1 ? f.join("=") : f[0];
if (d != undefined) {
d = decodeURIComponent(d)
}
if (c in e) {
if (!Object.isArray(e[c])) {
e[c] = [e[c]]
}
e[c].push(d)
} else {
e[c] = d
}
}
return e
})
},
toArray: function () {
return this.split("")
},
succ: function () {
return this.slice(0, this.length - 1) + String.fromCharCode(this.charCodeAt(this.length - 1) + 1)
},
times: function (a) {
return a < 1 ? "" : new Array(a + 1).join(this)
},
camelize: function () {
var d = this.split("-"),
a = d.length;
if (a == 1) {
return d[0]
}
var c = this.charAt(0) == "-" ? d[0].charAt(0).toUpperCase() + d[0].substring(1) : d[0];
for (var b = 1; b < a; b++) {
c += d[b].charAt(0).toUpperCase() + d[b].substring(1)
}
return c
},
capitalize: function () {
return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase()
},
underscore: function () {
return this.gsub(/::/, "/").gsub(/([A-Z]+)([A-Z][a-z])/, "#{1}_#{2}").gsub(/([a-z\d])([A-Z])/, "#{1}_#{2}").gsub(/-/, "_").toLowerCase()
},
dasherize: function () {
return this.gsub(/_/, "-")
},
inspect: function (b) {
var a = this.gsub(/[\x00-\x1f\]/, function (c) {
var d = String.specialChar[c[0]];
return d ? d : "\u00" + c[0].charCodeAt().toPaddedString(2, 16)
});
if (b) {
return '"' + a.replace(/"/g, '\"') + '"'
}
return "'" + a.replace(/'/g, "\'") + "'"
},
toJSON: function () {
return this.inspect(true)
},
unfilterJSON: function (a) {
return this.sub(a || Prototype.JSONFilter, "#{1}")
},
isJSON: function () {
var a = this;
if (a.blank()) {
return false
}
a = this.replace(/\./g, "@").replace(/"[^"\\n\r]"/g, "");
return (/^[,:{}[]0-9.-+Eaeflnr-u \n\r\t]
$/).test(a)
},
evalJSON: function (sanitize) {
var json = this.unfilterJSON();
try {
if (!sanitize || json.isJSON()) {
return eval("(" + json + ")")
}
} catch (e) { }
throw new SyntaxError("Badly formed JSON string: " + this.inspect())
},
include: function (a) {
return this.indexOf(a) > -1
},
startsWith: function (a) {
return this.indexOf(a) === 0
},
endsWith: function (a) {
var b = this.length - a.length;
return b >= 0 && this.lastIndexOf(a) === b
},
empty: function () {
return this == ""
},
blank: function () {
return /^\s$/.test(this)
},
interpolate: function (a, b) {
return new Template(this, b).evaluate(a)
}
});
if (Prototype.Browser.WebKit || Prototype.Browser.IE) {
Object.extend(String.prototype, {
escapeHTML: function () {
return this.replace(/&/g, "&").replace(//g, ">")
},
unescapeHTML: function () {
return this.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
}
})
}
String.prototype.gsub.prepareReplacement = function (b) {
if (Object.isFunction(b)) {
return b
}
var a = new Template(b);
return function (c) {
return a.evaluate(c)
}
};
String.prototype.parseQuery = String.prototype.toQueryParams;
Object.extend(String.prototype.escapeHTML, {
div: document.createElement("div"),
text: document.createTextNode("")
});
with (String.prototype.escapeHTML) {
div.appendChild(text)
}
var Template = Class.create({
initialize: function (a, b) {
this.template = a.toString();
this.pattern = b || Template.Pattern
},
evaluate: function (a) {
if (Object.isFunction(a.toTemplateReplacements)) {
a = a.toTemplateReplacements()
}
return this.template.gsub(this.pattern, function (d) {
if (a == null) {
return ""
}
var f = d[1] || "";
if (f == "\") {
return d[2]
}
var b = a,
g = d[3];
var e = /^([^.[]+|[((?:.
?[^\])?)])(.|[|$)/;
d = e.exec(g);
if (d == null) {
return f
}
while (d != null) {
var c = d[1].startsWith("[") ? d[2].gsub("\\]", "]") : d[1];
b = b[c];
if (null == b || "" == d[3]) {
break
}
g = g.substring("[" == d[3] ? d[1].length : d[0].length);
d = e.exec(g)
}
return f + String.interpret(b)
})
}
});

Template.Pattern = /(^|.|\r|\n)(#{(.*?)})/;
var $break = {};
var Enumerable = {
each: function (c, b) {
var a = 0;
c = c.bind(b);
try {
this._each(function (e) {
c(e, a++)
})
} catch (d) {
if (d != $break) {
throw d
}
}
return this
},
eachSlice: function (d, c, b) {
c = c ? c.bind(b) : Prototype.K;
var a = -d,
e = [],
f = this.toArray();
while ((a += d) < f.length) {
e.push(f.slice(a, a + d))
}
return e.collect(c, b)
},
all: function (c, b) {
c = c ? c.bind(b) : Prototype.K;
var a = true;
this.each(function (e, d) {
a = a && !!c(e, d);
if (!a) {
throw $break
}
});
return a
},
any: function (c, b) {
c = c ? c.bind(b) : Prototype.K;
var a = false;
this.each(function (e, d) {
if (a = !!c(e, d)) {
throw $break
}
});
return a
},
collect: function (c, b) {
c = c ? c.bind(b) : Prototype.K;
var a = [];
this.each(function (e, d) {
a.push(c(e, d))
});
return a
},
detect: function (c, b) {
c = c.bind(b);
var a;
this.each(function (e, d) {
if (c(e, d)) {
a = e;
throw $break
}
});
return a
},
findAll: function (c, b) {
c = c.bind(b);
var a = [];
this.each(function (e, d) {
if (c(e, d)) {
a.push(e)
}
});
return a
},
grep: function (d, c, b) {
c = c ? c.bind(b) : Prototype.K;
var a = [];
if (Object.isString(d)) {
d = new RegExp(d)
}
this.each(function (f, e) {
if (d.match(f)) {
a.push(c(f, e))
}
});
return a
},
include: function (a) {
if (Object.isFunction(this.indexOf)) {
if (this.indexOf(a) != -1) {
return true
}
}
var b = false;
this.each(function (c) {
if (c == a) {
b = true;
throw $break
}
});
return b
},
inGroupsOf: function (b, a) {
a = Object.isUndefined(a) ? null : a;
return this.eachSlice(b, function (c) {
while (c.length < b) {
c.push(a)
}
return c
})
},
inject: function (a, c, b) {
c = c.bind(b);
this.each(function (e, d) {
a = c(a, e, d)
});
return a
},
invoke: function (b) {
var a = $A(arguments).slice(1);
return this.map(function (c) {
return c[b].apply(c, a)
})
},
max: function (c, b) {
c = c ? c.bind(b) : Prototype.K;
var a;
this.each(function (e, d) {
e = c(e, d);
if (a == null || e >= a) {
a = e
}
});
return a
},
min: function (c, b) {
c = c ? c.bind(b) : Prototype.K;
var a;
this.each(function (e, d) {
e = c(e, d);
if (a == null || e < a) {
a = e
}
});
return a
},
partition: function (d, b) {
d = d ? d.bind(b) : Prototype.K;
var c = [],
a = [];
this.each(function (f, e) {
(d(f, e) ? c : a).push(f)
});
return [c, a]
},
pluck: function (b) {
var a = [];
this.each(function (c) {
a.push(c[b])
});
return a
},
reject: function (c, b) {
c = c.bind(b);
var a = [];
this.each(function (e, d) {
if (!c(e, d)) {
a.push(e)
}
});
return a
},
sortBy: function (b, a) {
b = b.bind(a);
return this.map(function (d, c) {
return {
value: d,
criteria: b(d, c)
}
}).sort(function (f, e) {
var d = f.criteria,
c = e.criteria;
return d < c ? -1 : d > c ? 1 : 0
}).pluck("value")
},
toArray: function () {
return this.map()
},
zip: function () {
var b = Prototype.K,
a = $A(arguments);
if (Object.isFunction(a.last())) {
b = a.pop()
}
var c = [this].concat(a).map($A);
return this.map(function (e, d) {
return b(c.pluck(d))
})
},
size: function () {
return this.toArray().length
},
inspect: function () {
return "#"
}
};
Object.extend(Enumerable, {
map: Enumerable.collect,
find: Enumerable.detect,
select: Enumerable.findAll,
filter: Enumerable.findAll,
member: Enumerable.include,
entries: Enumerable.toArray,
every: Enumerable.all,
some: Enumerable.any
});

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

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

function $H(a) {
return new Hash(a)
}
var Hash = Class.create(Enumerable, (function () {
function a(b, c) {
if (Object.isUndefined(c)) {
return b
}
return b + "=" + encodeURIComponent(String.interpret(c))
}
return {
initialize: function (b) {
this._object = Object.isHash(b) ? b.toObject() : Object.clone(b)
},
_each: function (c) {
for (var b in this._object) {
var d = this._object[b],
e = [b, d];
e.key = b;
e.value = d;
c(e)
}
},
set: function (b, c) {
return this._object[b] = c
},
get: function (b) {
return this._object[b]
},
unset: function (b) {
var c = this._object[b];
delete this._object[b];
return c
},
toObject: function () {
return Object.clone(this._object)
},
keys: function () {
return this.pluck("key")
},
values: function () {
return this.pluck("value")
},
index: function (c) {
var b = this.detect(function (d) {
return d.value === c
});
return b && b.key
},
merge: function (b) {
return this.clone().update(b)
},
update: function (b) {
return new Hash(b).inject(this, function (c, d) {
c.set(d.key, d.value);
return c
})
},
toQueryString: function () {
return this.map(function (d) {
var c = encodeURIComponent(d.key),
b = d.value;
if (b && typeof b == "object") {
if (Object.isArray(b)) {
return b.map(a.curry(c)).join("&")
}
}
return a(c, b)
}).join("&")
},
inspect: function () {
return "# return b.map(Object.inspect).join(": ")
}).join(", ") + "}>"
},
toJSON: function () {
return Object.toJSON(this.toObject())
},
clone: function () {
return new Hash(this)
}
}
})());
Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
Hash.from = $H;
var ObjectRange = Class.create(Enumerable, {
initialize: function (c, a, b) {
this.start = c;
this.end = a;
this.exclusive = b
},
_each: function (a) {
var b = this.start;
while (this.include(b)) {
a(b);
b = b.succ()
}
},
include: function (a) {
if (a < this.start) {
return false
}
if (this.exclusive) {
return a < this.end
}
return a <= this.end
}
});
var $R = function (c, a, b) {
return new ObjectRange(c, a, b)
};

function $(b) {
if (arguments.length > 1) {
for (var a = 0, d = [], c = arguments.length; a < c; a++) {
d.push($(arguments[a]))
}
return d
}
if (Object.isString(b)) {
b = document.getElementById(b)
}
return Element.extend(b)
}
if (Prototype.BrowserFeatures.XPath) {
document._getElementsByXPath = function (f, a) {
var c = [];
var e = document.evaluate(f, $(a) || document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (var b = 0, d = e.snapshotLength; b < d; b++) {
c.push(Element.extend(e.snapshotItem(b)))
}
return c
}
}
if (!window.Node) {
var Node = {}
}
if (!Node.ELEMENT_NODE) {
Object.extend(Node, {
ELEMENT_NODE: 1,
ATTRIBUTE_NODE: 2,
TEXT_NODE: 3,
CDATA_SECTION_NODE: 4,
ENTITY_REFERENCE_NODE: 5,
ENTITY_NODE: 6,
PROCESSING_INSTRUCTION_NODE: 7,
COMMENT_NODE: 8,
DOCUMENT_NODE: 9,
DOCUMENT_TYPE_NODE: 10,
DOCUMENT_FRAGMENT_NODE: 11,
NOTATION_NODE: 12
})
} (function () {
var a = this.Element;
this.Element = function (d, c) {
c = c || {};
d = d.toLowerCase();
var b = Element.cache;
if (Prototype.Browser.IE && c.name) {
d = "<" + d + ' name="' + c.name + '">';
delete c.name;
return Element.writeAttribute(document.createElement(d), c)
}
if (!b[d]) {
b[d] = Element.extend(document.createElement(d))
}
return Element.writeAttribute(b[d].cloneNode(false), c)
};
Object.extend(this.Element, a || {})
}).call(window);
Element.cache = {};
Element.Methods = {
visible: function (a) {
return $(a).style.display != "none"
},
toggle: function (a) {
a = $(a);
ElementElement.visible(a) ? "hide" : "show";
return a
},
hide: function (a) {
$(a).style.display = "none";
return a
},
show: function (a) {
$(a).style.display = "";
return a
},
remove: function (a) {
a = $(a);
a.parentNode.removeChild(a);
return a
},
update: function (a, b) {
a = $(a);
if (b && b.toElement) {
b = b.toElement()
}
if (Object.isElement(b)) {
return a.update().insert(b)
}
b = Object.toHTML(b);
a.innerHTML = b.stripScripts();
b.evalScripts.bind(b).defer();
return a
},
replace: function (b, c) {
b = $(b);
if (c && c.toElement) {
c = c.toElement()
} else {
if (!Object.isElement(c)) {
c = Object.toHTML(c);
var a = b.ownerDocument.createRange();
a.selectNode(b);
c.evalScripts.bind(c).defer();
c = a.createContextualFragment(c.stripScripts())
}
}
b.parentNode.replaceChild(c, b);
return b
},
insert: function (c, e) {
c = $(c);
if (Object.isString(e) || Object.isNumber(e) || Object.isElement(e) || (e && (e.toElement || e.toHTML))) {
e = {
bottom: e
}
}
var d, f, b, g;
for (var a in e) {
d = e[a];
a = a.toLowerCase();
f = Element._insertionTranslations[a];
if (d && d.toElement) {
d = d.toElement()
}
if (Object.isElement(d)) {
f(c, d);
continue
}
d = Object.toHTML(d);
b = ((a == "before" || a == "after") ? c.parentNode : c).tagName.toUpperCase();
g = Element._getContentFromAnonymousElement(b, d.stripScripts());
if (a == "top" || a == "after") {
g.reverse()
}
g.each(f.curry(c));
d.evalScripts.bind(d).defer()
}
return c
},
wrap: function (b, c, a) {
b = $(b);
if (Object.isElement(c)) {
$(c).writeAttribute(a || {})
} else {
if (Object.isString(c)) {
c = new Element(c, a)
} else {
c = new Element("div", c)
}
}
if (b.parentNode) {
b.parentNode.replaceChild(c, b)
}
c.appendChild(b);
return c
},
inspect: function (b) {
b = $(b);
var a = "<" + b.tagName.toLowerCase();
$H({
id: "id",
className: "class"
}).each(function (f) {
var e = f.first(),
c = f.last();
var d = (b[e] || "").toString();
if (d) {
a += " " + c + "=" + d.inspect(true)
}
});
return a + ">"
},
recursivelyCollect: function (a, c) {
a = $(a);
var b = [];
while (a = a[c]) {
if (a.nodeType == 1) {
b.push(Element.extend(a))
}
}
return b
},
ancestors: function (a) {
return $(a).recursivelyCollect("parentNode")
},
descendants: function (a) {
return $(a).select("")
},
firstDescendant: function (a) {
a = $(a).firstChild;
while (a && a.nodeType != 1) {
a = a.nextSibling
}
return $(a)
},
immediateDescendants: function (a) {
if (!(a = $(a).firstChild)) {
return []
}
while (a && a.nodeType != 1) {
a = a.nextSibling
}
if (a) {
return [a].concat($(a).nextSiblings())
}
return []
},
previousSiblings: function (a) {
return $(a).recursivelyCollect("previousSibling")
},
nextSiblings: function (a) {
return $(a).recursivelyCollect("nextSibling")
},
siblings: function (a) {
a = $(a);
return a.previousSiblings().reverse().concat(a.nextSiblings())
},
match: function (b, a) {
if (Object.isString(a)) {
a = new Selector(a)
}
return a.match($(b))
},
up: function (b, d, a) {
b = $(b);
if (arguments.length == 1) {
return $(b.parentNode)
}
var c = b.ancestors();
return Object.isNumber(d) ? c[d] : Selector.findElement(c, d, a)
},
down: function (b, c, a) {
b = $(b);
if (arguments.length == 1) {
return b.firstDescendant()
}
return Object.isNumber(c) ? b.descendants()[c] : b.select(c)[a || 0]
},
previous: function (b, d, a) {
b = $(b);
if (arguments.length == 1) {
return $(Selector.handlers.previousElementSibling(b))
}
var c = b.previousSiblings();
return Object.isNumber(d) ? c[d] : Selector.findElement(c, d, a)
},
next: function (c, d, b) {
c = $(c);
if (arguments.length == 1) {
return $(Selector.handlers.nextElementSibling(c))
}
var a = c.nextSiblings();
return Object.isNumber(d) ? a[d] : Selector.findElement(a, d, b)
},
select: function () {
var a = $A(arguments),
b = $(a.shift());
return Selector.findChildElements(b, a)
},
adjacent: function () {
var a = $A(arguments),
b = $(a.shift());
return Selector.findChildElements(b.parentNode, a).without(b)
},
identify: function (b) {
b = $(b);
var c = b.readAttribute("id"),
a = arguments.callee;
if (c) {
return c
}
do {
c = "anonymous_element_" + a.counter++
} while ($(c));
b.writeAttribute("id", c);
return c
},
readAttribute: function (c, a) {
c = $(c);
if (Prototype.Browser.IE) {
var b = Element._attributeTranslations.read;
if (b.values[a]) {
return b.valuesa
}
if (b.names[a]) {
a = b.names[a]
}
if (a.include(":")) {
return (!c.attributes || !c.attributes[a]) ? null : c.attributes[a].value
}
}
return c.getAttribute(a)
},
writeAttribute: function (e, c, f) {
e = $(e);
var b = {},
d = Element._attributeTranslations.write;
if (typeof c == "object") {
b = c
} else {
b[c] = Object.isUndefined(f) ? true : f
}
for (var a in b) {
c = d.names[a] || a;
f = b[a];
if (d.values[a]) {
c = d.valuesa
}
if (f === false || f === null) {
e.removeAttribute(c)
} else {
if (f === true) {
e.setAttribute(c, c)
} else {
e.setAttribute(c, f)
}
}
}
return e
},
getHeight: function (a) {
return $(a).getDimensions().height
},
getWidth: function (a) {
return $(a).getDimensions().width
},
classNames: function (a) {
return new Element.ClassNames(a)
},
hasClassName: function (a, b) {
if (!(a = $(a))) {
return
}
var c = a.className;
return (c.length > 0 && (c == b || new RegExp("(^|\s)" + b + "(\s|$)").test(c)))
},
addClassName: function (a, b) {
if (!(a = $(a))) {
return
}
if (!a.hasClassName(b)) {
a.className += (a.className ? " " : "") + b
}
return a
},
removeClassName: function (a, b) {
if (!(a = $(a))) {
return
}
a.className = a.className.replace(new RegExp("(^|\s+)" + b + "(\s+|$)"), " ").strip();
return a
},
toggleClassName: function (a, b) {
if (!(a = $(a))) {
return
}
return aa.hasClassName(b) ? "removeClassName" : "addClassName"
},
cleanWhitespace: function (b) {
b = $(b);
var c = b.firstChild;
while (c) {
var a = c.nextSibling;
if (c.nodeType == 3 && !/\S/.test(c.nodeValue)) {
b.removeChild(c)
}
c = a
}
return b
},
empty: function (a) {
return $(a).innerHTML.blank()
},
descendantOf: function (f, d) {
f = $(f), d = $(d);
var h = d;
if (f.compareDocumentPosition) {
return (f.compareDocumentPosition(d) & 8) === 8
}
if (f.sourceIndex && !Prototype.Browser.Opera) {
var g = f.sourceIndex,
c = d.sourceIndex,
b = d.nextSibling;
if (!b) {
do {
d = d.parentNode
} while (!(b = d.nextSibling) && d.parentNode)
}
if (b && b.sourceIndex) {
return (g > c && g < b.sourceIndex)
}
}
while (f = f.parentNode) {
if (f == h) {
return true
}
}
return false
},
scrollTo: function (a) {
a = $(a);
var b = a.cumulativeOffset();
window.scrollTo(b[0], b[1]);
return a
},
getStyle: function (b, c) {
b = $(b);
c = c == "float" ? "cssFloat" : c.camelize();
var d = b.style[c];
if (!d) {
var a = document.defaultView.getComputedStyle(b, null);
d = a ? a[c] : null
}
if (c == "opacity") {
return d ? parseFloat(d) : 1
}
return d == "auto" ? null : d
},
getOpacity: function (a) {
return $(a).getStyle("opacity")
},
setStyle: function (b, c) {
b = $(b);
var e = b.style,
a;
if (Object.isString(c)) {
b.style.cssText += ";" + c;
return c.include("opacity") ? b.setOpacity(c.match(/opacity:\s
(\d?.?\d*)/)[1]) : b
}
for (var d in c) {
if (d == "opacity") {
b.setOpacity(c[d])
} else {
e[(d == "float" || d == "cssFloat") ? (Object.isUndefined(e.styleFloat) ? "cssFloat" : "styleFloat") : d] = c[d]
}
}
return b
},
setOpacity: function (a, b) {
a = $(a);
a.style.opacity = (b == 1 || b === "") ? "" : (b < 0.00001) ? 0 : b;
return a
},
getDimensions: function (c) {
c = $(c);
var g = $(c).getStyle("display");
if (g != "none" && g != null) {
return {
width: c.offsetWidth,
height: c.offsetHeight
}
}
var b = c.style;
var f = b.visibility;
var d = b.position;
var a = b.display;
b.visibility = "hidden";
b.position = "absolute";
b.display = "block";
var h = c.clientWidth;
var e = c.clientHeight;
b.display = a;
b.position = d;
b.visibility = f;
return {
width: h,
height: e
}
},
makePositioned: function (a) {
a = $(a);
var b = Element.getStyle(a, "position");
if (b == "static" || !b) {
a._madePositioned = true;
a.style.position = "relative";
if (window.opera) {
a.style.top = 0;
a.style.left = 0
}
}
return a
},
undoPositioned: function (a) {
a = $(a);
if (a._madePositioned) {
a._madePositioned = undefined;
a.style.position = a.style.top = a.style.left = a.style.bottom = a.style.right = ""
}
return a
},
makeClipping: function (a) {
a = $(a);
if (a._overflow) {
return a
}
a._overflow = Element.getStyle(a, "overflow") || "auto";
if (a._overflow !== "hidden") {
a.style.overflow = "hidden"
}
return a
},
undoClipping: function (a) {
a = $(a);
if (!a._overflow) {
return a
}
a.style.overflow = a._overflow == "auto" ? "" : a._overflow;
a._overflow = null;
return a
},
cumulativeOffset: function (b) {
var a = 0,
c = 0;
do {
a += b.offsetTop || 0;
c += b.offsetLeft || 0;
b = b.offsetParent
} while (b);
return Element._returnOffset(c, a)
},
positionedOffset: function (b) {
var a = 0,
d = 0;
do {
a += b.offsetTop || 0;
d += b.offsetLeft || 0;
b = b.offsetParent;
if (b) {
if (b.tagName == "BODY") {
break
}
var c = Element.getStyle(b, "position");
if (c !== "static") {
break
}
}
} while (b);
return Element._returnOffset(d, a)
},
absolutize: function (b) {
b = $(b);
if (b.getStyle("position") == "absolute") {
return
}
var d = b.positionedOffset();
var f = d[1];
var e = d[0];
var c = b.clientWidth;
var a = b.clientHeight;
b._originalLeft = e - parseFloat(b.style.left || 0);
b._originalTop = f - parseFloat(b.style.top || 0);
b._originalWidth = b.style.width;
b._originalHeight = b.style.height;
b.style.position = "absolute";
b.style.top = f + "px";
b.style.left = e + "px";
b.style.width = c + "px";
b.style.height = a + "px";
return b
},
relativize: function (a) {
a = $(a);
if (a.getStyle("position") == "relative") {
return
}
a.style.position = "relative";
var c = parseFloat(a.style.top || 0) - (a._originalTop || 0);
var b = parseFloat(a.style.left || 0) - (a._originalLeft || 0);
a.style.top = c + "px";
a.style.left = b + "px";
a.style.height = a._originalHeight;
a.style.width = a._originalWidth;
return a
},
cumulativeScrollOffset: function (b) {
var a = 0,
c = 0;
do {
a += b.scrollTop || 0;
c += b.scrollLeft || 0;
b = b.parentNode
} while (b);
return Element._returnOffset(c, a)
},
getOffsetParent: function (a) {
if (a.offsetParent) {
return $(a.offsetParent)
}
if (a == document.body) {
return $(a)
}
while ((a = a.parentNode) && a != document.body) {
if (Element.getStyle(a, "position") != "static") {
return $(a)
}
}
return $(document.body)
},
viewportOffset: function (d) {
var a = 0,
c = 0;
var b = d;
do {
a += b.offsetTop || 0;
c += b.offsetLeft || 0;
if (b.offsetParent == document.body && Element.getStyle(b, "position") == "absolute") {
break
}
} while (b = b.offsetParent);
b = d;
do {
if (!Prototype.Browser.Opera || b.tagName == "BODY") {
a -= b.scrollTop || 0;
c -= b.scrollLeft || 0
}
} while (b = b.parentNode);
return Element._returnOffset(c, a)
},
clonePosition: function (b, d) {
var a = Object.extend({
setLeft: true,
setTop: true,
setWidth: true,
setHeight: true,
offsetTop: 0,
offsetLeft: 0
}, arguments[2] || {});
d = $(d);
var e = d.viewportOffset();
b = $(b);
var f = [0, 0];
var c = null;
if (Element.getStyle(b, "position") == "absolute") {
c = b.getOffsetParent();
f = c.viewportOffset()
}
if (c == document.body) {
f[0] -= document.body.offsetLeft;
f[1] -= document.body.offsetTop
}
if (a.setLeft) {
b.style.left = (e[0] - f[0] + a.offsetLeft) + "px"
}
if (a.setTop) {
b.style.top = (e[1] - f[1] + a.offsetTop) + "px"
}
if (a.setWidth) {
b.style.width = d.offsetWidth + "px"
}
if (a.setHeight) {
b.style.height = d.offsetHeight + "px"
}
return b
}
};
Element.Methods.identify.counter = 1;
Object.extend(Element.Methods, {
getElementsBySelector: Element.Methods.select,
childElements: Element.Methods.immediateDescendants
});
Element._attributeTranslations = {
write: {
names: {
className: "class",
htmlFor: "for"
},
values: {}
}
};

if (Prototype.Browser.Opera) {
Element.Methods.getStyle = Element.Methods.getStyle.wrap(function (d, b, c) {
switch (c) {
case "left":
case "top":
case "right":
case "bottom":
if (d(b, "position") === "static") {
return null
}
case "height":
case "width":
if (!Element.visible(b)) {
return null
}
var e = parseInt(d(b, c), 10);
if (e !== b["offset" + c.capitalize()]) {
return e + "px"
}
var a;
if (c === "height") {
a = ["border-top-width", "padding-top", "padding-bottom", "border-bottom-width"]
} else {
a = ["border-left-width", "padding-left", "padding-right", "border-right-width"]
}
return a.inject(e, function (f, g) {
var h = d(b, g);
return h === null ? f : f - parseInt(h, 10)
}) + "px";
default:
return d(b, c)
}
});
Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(function (c, a, b) {
if (b === "title") {
return a.title
}
return c(a, b)
})
} else {
if (Prototype.Browser.IE) {
Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(function (c, b) {
b = $(b);
var a = b.getStyle("position");
if (a !== "static") {
return c(b)
}
b.setStyle({
position: "relative"
});
var d = c(b);
b.setStyle({
position: a
});
return d
});
$w("positionedOffset viewportOffset").each(function (a) {
Element.Methods[a] = Element.Methods[a].wrap(function (e, c) {
c = $(c);
var b = c.getStyle("position");
if (b !== "static") {
return e(c)
}
var d = c.getOffsetParent();
if (d && d.getStyle("position") === "fixed") {
d.setStyle({
zoom: 1
})
}
c.setStyle({
position: "relative"
});
var f = e(c);
c.setStyle({
position: b
});
return f
})
});
Element.Methods.getStyle = function (a, b) {
a = $(a);
b = (b == "float" || b == "cssFloat") ? "styleFloat" : b.camelize();
var c = a.style[b];
if (!c && a.currentStyle) {
c = a.currentStyle[b]
}
if (b == "opacity") {
if (c = (a.getStyle("filter") || "").match(/alpha(opacity=(.))/)) {
if (c[1]) {
return parseFloat(c[1]) / 100
}
}
return 1
}
if (c == "auto") {
if ((b == "width" || b == "height") && (a.getStyle("display") != "none")) {
return a["offset" + b.capitalize()] + "px"
}
return null
}
return c
};
Element.Methods.setOpacity = function (b, e) {
function f(g) {
return g.replace(/alpha([^)]
)/gi, "")
}
b = $(b);
var a = b.currentStyle;
if ((a && !a.hasLayout) || (!a && b.style.zoom == "normal")) {
b.style.zoom = 1
}
var d = b.getStyle("filter"),
c = b.style;
if (e == 1 || e === "") {
(d = f(d)) ? c.filter = d : c.removeAttribute("filter");
return b
} else {
if (e < 0.00001) {
e = 0
}
}
c.filter = f(d) + "alpha(opacity=" + (e * 100) + ")";
return b
};
Element._attributeTranslations = {
read: {
names: {
"class": "className",
"for": "htmlFor"
},
values: {
_getAttr: function (a, b) {
return a.getAttribute(b, 2)
},
_getAttrNode: function (a, c) {
var b = a.getAttributeNode(c);
return b ? b.value : ""
},
_getEv: function (a, b) {
b = a.getAttribute(b);
return b ? b.toString().slice(23, -2) : null
},
_flag: function (a, b) {
return $(a).hasAttribute(b) ? b : null
},
style: function (a) {
return a.style.cssText.toLowerCase()
},
title: function (a) {
return a.title
}
}
}
};
Element._attributeTranslations.write = {
names: Object.extend({
cellpadding: "cellPadding",
cellspacing: "cellSpacing"
}, Element._attributeTranslations.read.names),
values: {
checked: function (a, b) {
a.checked = !!b
},
style: function (a, b) {
a.style.cssText = b ? b : ""
}
}
};
Element._attributeTranslations.has = {};
$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc").each(function (a) {
Element._attributeTranslations.write.names[a.toLowerCase()] = a;
Element._attributeTranslations.has[a.toLowerCase()] = a
});
(function (a) {
Object.extend(a, {
href: a._getAttr,
src: a._getAttr,
type: a._getAttr,
action: a._getAttrNode,
disabled: a._flag,
checked: a._flag,
readonly: a._flag,
multiple: a._flag,
onload: a._getEv,
onunload: a._getEv,
onclick: a._getEv,
ondblclick: a._getEv,
onmousedown: a._getEv,
onmouseup: a._getEv,
onmouseover: a._getEv,
onmousemove: a._getEv,
onmouseout: a._getEv,
onfocus: a._getEv,
onblur: a._getEv,
onkeypress: a._getEv,
onkeydown: a._getEv,
onkeyup: a._getEv,
onsubmit: a._getEv,
onreset: a._getEv,
onselect: a._getEv,
onchange: a._getEv
})
})(Element._attributeTranslations.read.values)
} else {
if (Prototype.Browser.Gecko && /rv:1.8.0/.test(navigator.userAgent)) {
Element.Methods.setOpacity = function (a, b) {
a = $(a);
a.style.opacity = (b == 1) ? 0.999999 : (b === "") ? "" : (b < 0.00001) ? 0 : b;
return a
}
} else {
if (Prototype.Browser.WebKit) {
Element.Methods.setOpacity = function (a, b) {
a = $(a);
a.style.opacity = (b == 1 || b === "") ? "" : (b < 0.00001) ? 0 : b;
if (b == 1) {
if (a.tagName == "IMG" && a.width) {
a.width++;
a.width--
} else {
try {
var d = document.createTextNode(" ");
a.appendChild(d);
a.removeChild(d)
} catch (c) { }
}
}
return a
};
Element.Methods.cumulativeOffset = function (b) {
var a = 0,
c = 0;
do {
a += b.offsetTop || 0;
c += b.offsetLeft || 0;
if (b.offsetParent == document.body) {
if (Element.getStyle(b, "position") == "absolute") {
break
}
}
b = b.offsetParent
} while (b);
return Element._returnOffset(c, a)
}
}
}
}
}
if (Prototype.Browser.IE || Prototype.Browser.Opera) {
Element.Methods.update = function (b, c) {
b = $(b);
if (c && c.toElement) {
c = c.toElement()
}
if (Object.isElement(c)) {
return b.update().insert(c)
}
c = Object.toHTML(c);
var a = b.tagName.toUpperCase();
if (a in Element._insertionTranslations.tags) {
$A(b.childNodes).each(function (d) {
b.removeChild(d)
});
Element._getContentFromAnonymousElement(a, c.stripScripts()).each(function (d) {
b.appendChild(d)
})
} else {
b.innerHTML = c.stripScripts()
}
c.evalScripts.bind(c).defer();
return b
}
}
if ("outerHTML" in document.createElement("div")) {
Element.Methods.replace = function (c, e) {
c = $(c);
if (e && e.toElement) {
e = e.toElement()
}
if (Object.isElement(e)) {
c.parentNode.replaceChild(e, c);
return c
}
e = Object.toHTML(e);
var d = c.parentNode,
b = d.tagName.toUpperCase();
if (Element._insertionTranslations.tags[b]) {
var f = c.next();
var a = Element._getContentFromAnonymousElement(b, e.stripScripts());
d.removeChild(c);
if (f) {
a.each(function (g) {
d.insertBefore(g, f)
})
} else {
a.each(function (g) {
d.appendChild(g)
})
}
} else {
c.outerHTML = e.stripScripts()
}
e.evalScripts.bind(e).defer();
return c
}
}
Element._returnOffset = function (b, c) {
var a = [b, c];
a.left = b;
a.top = c;
return a
};
Element._getContentFromAnonymousElement = function (c, b) {
var d = new Element("div"),
a = Element._insertionTranslations.tags[c];
if (a) {
d.innerHTML = a[0] + b + a[1];
a[2].times(function () {
d = d.firstChild
})
} else {
d.innerHTML = b
}
return $A(d.childNodes)
};
Element._insertionTranslations = {
before: function (a, b) {
a.parentNode.insertBefore(b, a)
},
top: function (a, b) {
a.insertBefore(b, a.firstChild)
},
bottom: function (a, b) {
a.appendChild(b)
},
after: function (a, b) {
a.parentNode.insertBefore(b, a.nextSibling)
},
tags: {
TABLE: ["

", "
", 1],
TBODY: ["", "
", 2],
TR: ["", "
", 3],
TD: ["
", "
", 4],
SELECT: ["", 1]
}
};
(function () {
Object.extend(this.tags, {
THEAD: this.tags.TBODY,
TFOOT: this.tags.TBODY,
TH: this.tags.TD
})
}).call(Element._insertionTranslations);
Element.Methods.Simulated = {
hasAttribute: function (a, c) {
c = Element._attributeTranslations.has[c] || c;
var b = $(a).getAttributeNode(c);
return b && b.specified
}
};
Element.Methods.ByTag = {};
Object.extend(Element, Element.Methods);
if (!Prototype.BrowserFeatures.ElementExtensions && document.createElement("div").__proto__) {
window.HTMLElement = {};
window.HTMLElement.prototype = document.createElement("div").__proto__;
Prototype.BrowserFeatures.ElementExtensions = true
}
Element.extend = (function () {
if (Prototype.BrowserFeatures.SpecificElementExtensions) {
return Prototype.K
}
var a = {},
b = Element.Methods.ByTag;
var c = Object.extend(function (f) {
if (!f || f._extendedByPrototype || f.nodeType != 1 || f == window) {
return f
}
var d = Object.clone(a),
e = f.tagName,
h, g;
if (b[e]) {
Object.extend(d, b[e])
}
for (h in d) {
g = d[h];
if (Object.isFunction(g) && !(h in f)) {
f[h] = g.methodize()
}
}
f._extendedByPrototype = Prototype.emptyFunction;
return f
}, {
refresh: function () {
if (!Prototype.BrowserFeatures.ElementExtensions) {
Object.extend(a, Element.Methods);
Object.extend(a, Element.Methods.Simulated)
}
}
});
c.refresh();
return c
})();
Element.hasAttribute = function (a, b) {
if (a.hasAttribute) {
return a.hasAttribute(b)
}
return Element.Methods.Simulated.hasAttribute(a, b)
};
Element.addMethods = function (c) {
var h = Prototype.BrowserFeatures,
d = Element.Methods.ByTag;
if (!c) {
Object.extend(Form, Form.Methods);
Object.extend(Form.Element, Form.Element.Methods);
Object.extend(Element.Methods.ByTag, {
FORM: Object.clone(Form.Methods),
INPUT: Object.clone(Form.Element.Methods),
SELECT: Object.clone(Form.Element.Methods),
TEXTAREA: Object.clone(Form.Element.Methods)
})
}
if (arguments.length == 2) {
var b = c;
c = arguments[1]
}
if (!b) {
Object.extend(Element.Methods, c || {})
} else {
if (Object.isArray(b)) {
b.each(g)
} else {
g(b)
}
}

function g(j) {
    j = j.toUpperCase();
    if (!Element.Methods.ByTag[j]) {
        Element.Methods.ByTag[j] = {}
    }
    Object.extend(Element.Methods.ByTag[j], c)
}

function a(l, k, j) {
    j = j || false;
    for (var n in l) {
        var m = l[n];
        if (!Object.isFunction(m)) {
            continue
        }
        if (!j || !(n in k)) {
            k[n] = m.methodize()
        }
    }
}

function e(l) {
    var j;
    var k = {
        OPTGROUP: "OptGroup",
        TEXTAREA: "TextArea",
        P: "Paragraph",
        FIELDSET: "FieldSet",
        UL: "UList",
        OL: "OList",
        DL: "DList",
        DIR: "Directory",
        H1: "Heading",
        H2: "Heading",
        H3: "Heading",
        H4: "Heading",
        H5: "Heading",
        H6: "Heading",
        Q: "Quote",
        INS: "Mod",
        DEL: "Mod",
        A: "Anchor",
        IMG: "Image",
        CAPTION: "TableCaption",
        COL: "TableCol",
        COLGROUP: "TableCol",
        THEAD: "TableSection",
        TFOOT: "TableSection",
        TBODY: "TableSection",
        TR: "TableRow",
        TH: "TableCell",
        TD: "TableCell",
        FRAMESET: "FrameSet",
        IFRAME: "IFrame"
    };
    if (k[l]) {
        j = "HTML" + k[l] + "Element"
    }
    if (window[j]) {
        return window[j]
    }
    j = "HTML" + l + "Element";
    if (window[j]) {
        return window[j]
    }
    j = "HTML" + l.capitalize() + "Element";
    if (window[j]) {
        return window[j]
    }
    window[j] = {};
    window[j].prototype = document.createElement(l).__proto__;
    return window[j]
}
if (h.ElementExtensions) {
    a(Element.Methods, HTMLElement.prototype);
    a(Element.Methods.Simulated, HTMLElement.prototype, true)
}
if (h.SpecificElementExtensions) {
    for (var i in Element.Methods.ByTag) {
        var f = e(i);
        if (Object.isUndefined(f)) {
            continue
        }
        a(d[i], f.prototype)
    }
}
Object.extend(Element, Element.Methods);
delete Element.ByTag;
if (Element.extend.refresh) {
    Element.extend.refresh()
}
Element.cache = {}

};
document.viewport = {
getDimensions: function () {
var a = {};
var b = Prototype.Browser;
$w("width height").each(function (e) {
var c = e.capitalize();
a[e] = (b.WebKit && !document.evaluate) ? self["inner" + c] : (b.Opera) ? document.body["client" + c] : document.documentElement["client" + c]
});
return a
},
getWidth: function () {
return this.getDimensions().width
},
getHeight: function () {
return this.getDimensions().height
},
getScrollOffsets: function () {
return Element._returnOffset(window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop)
}
};
////////////////

function $$() {
return Selector.findChildElements(document, $A(arguments))
}
var Form = {
reset: function (a) {
$(a).reset();
return a
},
serializeElements: function (g, b) {
if (typeof b != "object") {
b = {
hash: !!b
}
} else {
if (Object.isUndefined(b.hash)) {
b.hash = true
}
}
var c, f, a = false,
e = b.submit;
var d = g.inject({}, function (h, i) {
if (!i.disabled && i.name) {
c = i.name;
f = $(i).getValue();
if (f != null && (i.type != "submit" || (!a && e !== false && (!e || c == e) && (a = true)))) {
if (c in h) {
if (!Object.isArray(h[c])) {
h[c] = [h[c]]
}
h[c].push(f)
} else {
h[c] = f
}
}
}
return h
});
return b.hash ? d : Object.toQueryString(d)
}
};
Form.Methods = {
serialize: function (b, a) {
return Form.serializeElements(Form.getElements(b), a)
},
getElements: function (a) {
return $A($(a).getElementsByTagName("*")).inject([], function (b, c) {
if (Form.Element.Serializers[c.tagName.toLowerCase()]) {
b.push(Element.extend(c))
}
return b
})
},
getInputs: function (g, c, d) {
g = $(g);
var a = g.getElementsByTagName("input");
if (!c && !d) {
return $A(a).map(Element.extend)
}
for (var e = 0, h = [], f = a.length; e < f; e++) {
var b = a[e];
if ((c && b.type != c) || (d && b.name != d)) {
continue
}
h.push(Element.extend(b))
}
return h
},
disable: function (a) {
a = $(a);
Form.getElements(a).invoke("disable");
return a
},
enable: function (a) {
a = $(a);
Form.getElements(a).invoke("enable");
return a
},
findFirstElement: function (b) {
var c = $(b).getElements().findAll(function (d) {
return "hidden" != d.type && !d.disabled
});
var a = c.findAll(function (d) {
return d.hasAttribute("tabIndex") && d.tabIndex >= 0
}).sortBy(function (d) {
return d.tabIndex
}).first();
return a ? a : c.find(function (d) {
return ["input", "select", "textarea"].include(d.tagName.toLowerCase())
})
},
focusFirstElement: function (a) {
a = $(a);
a.findFirstElement().activate();
return a

}

};
Form.Element = {
focus: function (a) {
$(a).focus();
return a
},
select: function (a) {
$(a).select();
return a
}
};

Form.Element.Methods = {
serialize: function (a) {
a = $(a);
if (!a.disabled && a.name) {
var b = a.getValue();
if (b != undefined) {
var c = {};
c[a.name] = b;
return Object.toQueryString(c)
}
}
return ""
},
getValue: function (a) {
a = $(a);
var b = a.tagName.toLowerCase();
return Form.Element.Serializersb
},
setValue: function (a, b) {
a = $(a);
var c = a.tagName.toLowerCase();
Form.Element.Serializersc;
return a
},
clear: function (a) {
$(a).value = "";
return a
},
present: function (a) {
return $(a).value != ""
},
activate: function (a) {
a = $(a);
try {
a.focus();
if (a.select && (a.tagName.toLowerCase() != "input" || !["button", "reset", "submit"].include(a.type))) {
a.select()
}
} catch (b) { }
return a
},
disable: function (a) {
a = $(a);
a.blur();
a.disabled = true;
return a
},
enable: function (a) {
a = $(a);
a.disabled = false;
return a
}
};
var Field = Form.Element;
var $F = Form.Element.Methods.getValue;
Form.Element.Serializers = {
input: function (a, b) {
switch (a.type.toLowerCase()) {
case "checkbox":
case "radio":
return Form.Element.Serializers.inputSelector(a, b);
default:
return Form.Element.Serializers.textarea(a, b)
}
},
inputSelector: function (a, b) {
if (Object.isUndefined(b)) {
return a.checked ? a.value : null
} else {
a.checked = !!b
}
},
textarea: function (a, b) {
if (Object.isUndefined(b)) {
return a.value
} else {
a.value = b
}
},
select: function (d, a) {
if (Object.isUndefined(a)) {
return thisd.type == "select-one" ? "selectOne" : "selectMany"
} else {
var c, f, g = !Object.isArray(a);
for (var b = 0, e = d.length; b < e; b++) {
c = d.options[b];
f = this.optionValue(c);
if (g) {
if (f == a) {
c.selected = true;
return
}
} else {
c.selected = a.include(f)
}
}
}
},
selectOne: function (b) {
var a = b.selectedIndex;
return a >= 0 ? this.optionValue(b.options[a]) : null
},
selectMany: function (d) {
var a, e = d.length;
if (!e) {
return null
}
for (var c = 0, a = []; c < e; c++) {
var b = d.options[c];
if (b.selected) {
a.push(this.optionValue(b))
}
}
return a
},
optionValue: function (a) {
return Element.extend(a).hasAttribute("value") ? a.value : a.text
}
};
Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
initialize: function ($super, a, b, c) {
$super(c, b);
this.element = $(a);
this.lastValue = this.getValue()
},
execute: function () {
var a = this.getValue();
if (Object.isString(this.lastValue) && Object.isString(a) ? this.lastValue != a : String(this.lastValue) != String(a)) {
this.callback(this.element, a);
this.lastValue = a
}
}
});
Form.Element.Observer = Class.create(Abstract.TimedObserver, {
getValue: function () {
return Form.Element.getValue(this.element)
}
});
Form.Observer = Class.create(Abstract.TimedObserver, {
getValue: function () {
return Form.serialize(this.element)
}
});
Abstract.EventObserver = Class.create({
initialize: function (a, b) {
this.element = $(a);
this.callback = b;
this.lastValue = this.getValue();
if (this.element.tagName.toLowerCase() == "form") {
this.registerFormCallbacks()
} else {
this.registerCallback(this.element)
}
},
onElementEvent: function () {
var a = this.getValue();
if (this.lastValue != a) {
this.callback(this.element, a);
this.lastValue = a
}
},
registerFormCallbacks: function () {
Form.getElements(this.element).each(this.registerCallback, this)
},
registerCallback: function (a) {
if (a.type) {
switch (a.type.toLowerCase()) {
case "checkbox":
case "radio":
Event.observe(a, "click", this.onElementEvent.bind(this));
break;
default:
Event.observe(a, "change", this.onElementEvent.bind(this));
break
}
}
}
});
Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
getValue: function () {
return Form.Element.getValue(this.element)
}
});
Form.EventObserver = Class.create(Abstract.EventObserver, {
getValue: function () {
return Form.serialize(this.element)
}
});
if (!window.Event) {
var Event = {}
}
Object.extend(Event, {
KEY_BACKSPACE: 8,
KEY_TAB: 9,
KEY_RETURN: 13,
KEY_ESC: 27,
KEY_LEFT: 37,
KEY_UP: 38,
KEY_RIGHT: 39,
KEY_DOWN: 40,
KEY_DELETE: 46,
KEY_HOME: 36,
KEY_END: 35,
KEY_PAGEUP: 33,
KEY_PAGEDOWN: 34,
KEY_INSERT: 45,
cache: {},
relatedTarget: function (b) {
var a;
switch (b.type) {
case "mouseover":
a = b.fromElement;
break;
case "mouseout":
a = b.toElement;
break;
default:
return null
}
return Element.extend(a)
}
});
Event.Methods = (function () {
var a;
if (Prototype.Browser.IE) {
var b = {
0: 1,
1: 4,
2: 2
};
a = function (d, c) {
return d.button == b[c]
}
} else {
if (Prototype.Browser.WebKit) {
a = function (d, c) {
switch (c) {
case 0:
return d.which == 1 && !d.metaKey;
case 1:
return d.which == 1 && d.metaKey;
default:
return false
}
}
} else {
a = function (d, c) {
return d.which ? (d.which === c + 1) : (d.button === c)
}
}
}
return {
isLeftClick: function (c) {
return a(c, 0)
},
isMiddleClick: function (c) {
return a(c, 1)
},
isRightClick: function (c) {
return a(c, 2)
},
element: function (d) {
var c = Event.extend(d).target;
return Element.extend(c.nodeType == Node.TEXT_NODE ? c.parentNode : c)
},
findElement: function (d, f) {
var c = Event.element(d);
if (!f) {
return c
}
var e = [c].concat(c.ancestors());
return Selector.findElement(e, f, 0)
},
pointer: function (c) {
return {
x: c.pageX || (c.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)),
y: c.pageY || (c.clientY + (document.documentElement.scrollTop || document.body.scrollTop))
}
},
pointerX: function (c) {
return Event.pointer(c).x
},
pointerY: function (c) {
return Event.pointer(c).y
},
stop: function (c) {
Event.extend(c);
c.preventDefault();
c.stopPropagation();
c.stopped = true
}
}
})();
Event.extend = (function () {
var a = Object.keys(Event.Methods).inject({}, function (b, c) {
b[c] = Event.Methods[c].methodize();
return b
});
if (Prototype.Browser.IE) {
Object.extend(a, {
stopPropagation: function () {
this.cancelBubble = true
},
preventDefault: function () {
this.returnValue = false
},
inspect: function () {
return "[object Event]"
}
});
return function (b) {
if (!b) {
return false
}
if (b._extendedByPrototype) {
return b
}
b._extendedByPrototype = Prototype.emptyFunction;
var c = Event.pointer(b);
Object.extend(b, {
target: b.srcElement,
relatedTarget: Event.relatedTarget(b),
pageX: c.x,
pageY: c.y
});
return Object.extend(b, a)
}
} else {
Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__;
Object.extend(Event.prototype, a);
return Prototype.K
}
})();
Object.extend(Event, (function () {
var b = Event.cache;

function c(j) {
    if (j._prototypeEventID) {
        return j._prototypeEventID[0]
    }
    arguments.callee.id = arguments.callee.id || 1;
    return j._prototypeEventID = [++arguments.callee.id]
}

function g(j) {
    if (j && j.include(":")) {
        return "dataavailable"
    }
    return j
}

function a(j) {
    return b[j] = b[j] || {}
}

function f(l, j) {
    var k = a(l);
    return k[j] = k[j] || []
}

function h(k, j, l) {
    var o = c(k);
    var n = f(o, j);
    if (n.pluck("handler").include(l)) {
        return false
    }
    var m = function (p) {
        if (!Event || !Event.extend || (p.eventName && p.eventName != j)) {
            return false
        }
        Event.extend(p);
        l.call(k, p)
    };
    m.handler = l;
    n.push(m);
    return m
}

function i(m, j, k) {
    var l = f(m, j);
    return l.find(function (n) {
        return n.handler == k
    })
}

function d(m, j, k) {
    var l = a(m);
    if (!l[j]) {
        return false
    }
    l[j] = l[j].without(i(m, j, k))
}

function e() {
    for (var k in b) {
        for (var j in b[k]) {
            b[k][j] = null
        }
    }
}
if (window.attachEvent) {
    window.attachEvent("onunload", e)
}
return {
    observe: function (l, j, m) {
        l = $(l);
        var k = g(j);
        var n = h(l, j, m);
        if (!n) {
            return l
        }
        if (l.addEventListener) {
            l.addEventListener(k, n, false)
        } else {
            l.attachEvent("on" + k, n)
        }
        return l
    },
    stopObserving: function (l, j, m) {
        l = $(l);
        var o = c(l),
            k = g(j);
        if (!m && j) {
            f(o, j).each(function (p) {
                l.stopObserving(j, p.handler)
            });
            return l
        } else {
            if (!j) {
                Object.keys(a(o)).each(function (p) {
                    l.stopObserving(p)
                });
                return l
            }
        }
        var n = i(o, j, m);
        if (!n) {
            return l
        }
        if (l.removeEventListener) {
            l.removeEventListener(k, n, false)
        } else {
            l.detachEvent("on" + k, n)
        }
        d(o, j, m);
        return l
    },
    fire: function (l, k, j) {
        l = $(l);
        if (l == document && document.createEvent && !l.dispatchEvent) {
            l = document.documentElement
        }
        var m;
        if (document.createEvent) {
            m = document.createEvent("HTMLEvents");
            m.initEvent("dataavailable", true, true)
        } else {
            m = document.createEventObject();
            m.eventType = "ondataavailable"
        }
        m.eventName = k;
        m.memo = j || {};
        if (document.createEvent) {
            l.dispatchEvent(m)
        } else {
            l.fireEvent(m.eventType, m)
        }
        return Event.extend(m)
    }
}

})());
Object.extend(Event, Event.Methods);
Element.addMethods({
fire: Event.fire,
observe: Event.observe,
stopObserving: Event.stopObserving
});
Object.extend(document, {
fire: Element.Methods.fire.methodize(),
observe: Element.Methods.observe.methodize(),
stopObserving: Element.Methods.stopObserving.methodize(),
loaded: false
});
(function () {
var b;

function a() {
    if (document.loaded) {
        return
    }
    if (b) {
        window.clearInterval(b)
    }
    document.fire("dom:loaded");
    document.loaded = true
}
if (document.addEventListener) {
    if (Prototype.Browser.WebKit) {
        b = window.setInterval(function () {
            if (/loaded|complete/.test(document.readyState)) {
                a()
            }
        }, 0);
        Event.observe(window, "load", a)
    } else {
        document.addEventListener("DOMContentLoaded", a, false)
    }
} else {
    document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
    $("__onDOMContentLoaded").onreadystatechange = function () {
        if (this.readyState == "complete") {
            this.onreadystatechange = null;
            a()
        }
    }
}

})();
Hash.toQueryString = Object.toQueryString;
var Toggle = {
display: Element.toggle
};
Element.Methods.childOf = Element.Methods.descendantOf;
var Insertion = {
Before: function (a, b) {
return Element.insert(a, {
before: b
})
},
Top: function (a, b) {
return Element.insert(a, {
top: b
})
},
Bottom: function (a, b) {
return Element.insert(a, {
bottom: b
})
},
After: function (a, b) {
return Element.insert(a, {
after: b
})
}
};
var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
var Position = {
includeScrollOffsets: false,
prepare: function () {
this.deltaX = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
this.deltaY = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0
},
within: function (b, a, c) {
if (this.includeScrollOffsets) {
return this.withinIncludingScrolloffsets(b, a, c)
}
this.xcomp = a;
this.ycomp = c;
this.offset = Element.cumulativeOffset(b);
return (c >= this.offset[1] && c < this.offset[1] + b.offsetHeight && a >= this.offset[0] && a < this.offset[0] + b.offsetWidth)
},
withinIncludingScrolloffsets: function (b, a, d) {
var c = Element.cumulativeScrollOffset(b);
this.xcomp = a + c[0] - this.deltaX;
this.ycomp = d + c[1] - this.deltaY;
this.offset = Element.cumulativeOffset(b);
return (this.ycomp >= this.offset[1] && this.ycomp < this.offset[1] + b.offsetHeight && this.xcomp >= this.offset[0] && this.xcomp < this.offset[0] + b.offsetWidth)
},
overlap: function (b, a) {
if (!b) {
return 0
}
if (b == "vertical") {
return ((this.offset[1] + a.offsetHeight) - this.ycomp) / a.offsetHeight
}
if (b == "horizontal") {
return ((this.offset[0] + a.offsetWidth) - this.xcomp) / a.offsetWidth
}
},
cumulativeOffset: Element.Methods.cumulativeOffset,
positionedOffset: Element.Methods.positionedOffset,
absolutize: function (a) {
Position.prepare();
return Element.absolutize(a)
},
relativize: function (a) {
Position.prepare();
return Element.relativize(a)
},
realOffset: Element.Methods.cumulativeScrollOffset,
offsetParent: Element.Methods.getOffsetParent,
page: Element.Methods.viewportOffset,
clone: function (b, c, a) {
a = a || {};
return Element.clonePosition(c, b, a)
}
};

if (!document.getElementsByClassName) {
document.getElementsByClassName = function (b) {
function a(c) {
return c.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + c + " ')]"
}
b.getElementsByClassName = Prototype.BrowserFeatures.XPath ? function (c, e) {
e = e.toString().strip();
var d = /\s/.test(e) ? $w(e).map(a).join("") : a(e);
return d ? document._getElementsByXPath(".//" + d, c) : []
} : function (e, f) {
f = f.toString().strip();
var g = [],
h = (/\s/.test(f) ? $w(f) : null);
if (!h && !f) {
return g
}
var c = $(e).getElementsByTagName("
");
f = " " + f + " ";
for (var d = 0, k, j; k = c[d]; d++) {
if (k.className && (j = " " + k.className + " ") && (j.include(f) || (h && h.all(function (i) {
return !i.toString().blank() && j.include(" " + i + " ")
})))) {
g.push(Element.extend(k))
}
}
return g
};
return function (d, c) {
return $(c || document.body).getElementsByClassName(d)
}
}(Element.Methods)
}
Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
initialize: function (a) {
this.element = $(a)
},
_each: function (a) {
this.element.className.split(/\s+/).select(function (b) {
return b.length > 0
})._each(a)
},
set: function (a) {
this.element.className = a
},
add: function (a) {
if (this.include(a)) {
return
}
this.set($A(this).concat(a).join(" "))
},
remove: function (a) {
if (!this.include(a)) {
return
}
this.set($A(this).without(a).join(" "))
},
toString: function () {
return $A(this).join(" ")
}
};
Object.extend(Element.ClassNames.prototype, Enumerable);
Element.addMethods();
var Tabs = Class.create();
Object.extend(Tabs, {
FIRST: "first",
LAST: "last",
NEXT: "next",
PREV: "prev",
ACTIVE: "active",
Text: {
FIRST: "First",
LAST: "Last",
NEXT: "Next",
PREV: "Previous",
LABEL: "New label...",
CONTENT: "Default content...",
LOADING: "Loading...",
EMPTY: "No tabs..."
},
ClassNames: {
CONTAINER: "tab-container",
NAVIGATION: "tab-navigation",
PANEL: "tabs",
LI: "",
CURRENT: "current",
LINK: "",
CONTENT: "tab",
LOADING: "loading",
EMPTY: "empty"
}
});

function _to_utf8(b) {
var f, e = "";
for (var a = 0; a < b.length; a++) {
f = b.charCodeAt(a);
if (f <= 127) {
e += b.charAt(a)
} else {
if (f >= 128 && f <= 2047) {
e += String.fromCharCode(((f >> 6) & 31) | 192);
e += String.fromCharCode((f & 63) | 128)
} else {
e += String.fromCharCode((f >> 12) | 224);
e += String.fromCharCode(((f >> 6) & 63) | 128);
e += String.fromCharCode((f & 63) | 128)
}
}
}
return e
}

function _from_utf8(f) {
var h, g = "",
a = 0,
e;
for (var b = 0; b < f.length; b++) {
h = f.charCodeAt(b);
if (a == 0) {
if ((h & 224) == 224) {
a = 2;
e = (h & 15) << 12
} else {
if ((h & 192) == 192) {
a = 1;
e = (h & 31) << 6
} else {
if ((h & 128) == 0) {
g += f.charAt(b)
} else {
a = 0
}
}
}
} else {
if (a == 1) {
a = 0;
g += String.fromCharCode(e | (h & 63))
} else {
if (a == 2) {
a = 3;
e |= (h & 63) << 6
} else {
if (a == 3) {
a = 0;
g += String.fromCharCode(e | (h & 63))
} else {
a = 0
}
}
}
}
}
return g
};

function sprintf2(a) {
if (a.length < 2) {
return a[0]
}
var c = a[0];
for (var b = 1; b < a.length; ++b) {
switch (typeof (a[b])) {
case "string":
c = c.replace(/%s/, a[b]);
break;
case "number":
c = c.replace(/%d/, a[b]);
break;
case "boolean":
c = c.replace(/%b/, a[b] ? "true" : "false");
break;
default:
break
}
}
return (c)
}
if (!String.sprintf2) {
String.sprintf2 = sprintf2
};
var DetectActivity = Class.create();
DetectActivity.prototype = {
initialize: function (a) {
this.onunactivate = function () { };
this.onactivate = function () { };
this.subject = a;
this.isactive = true;
Event.observe(a, "mousemove", this._OnFocus.bindAsEventListener(this), false);
Event.observe(a, "mouseout", this._OnBlur.bindAsEventListener(this), false)
},
_OnFocus: function (a) {
this.isactive = true;
if (this.onactivate) {
this.onactivate()
}
},
_OnBlur: function (a) {
this.isactive = false;
if (this.onunactivate) {
this.onunactivate()
}
},
isActive: function () {
return this.isactive
}
};

function mousePosX(b) {
var a = 0;
if (!b) {
var b = window.event
}
if (b.pageX) {
a = b.pageX
} else {
if (b.clientX) {
a = b.clientX + document.body.scrollLeft + document.documentElement.scrollLeft
}
}
return a
}

function mousePosY(a) {
var b = 0;
if (!a) {
var a = window.event
}
if (a.pageY) {
b = a.pageY
} else {
if (a.clientY) {
b = a.clientY + document.body.scrollTop + document.documentElement.scrollTop
}
}
return b
};
var pfcCSS = Class.create();
pfcCSS.prototype = {
initialize: function () {
if (!document.getElementsByTagName || !(document.createElement || document.createElementNS)) {
return
}
var b = navigator.userAgent.toLowerCase();
this.is_ie = ((b.indexOf("msie") != -1) && (b.indexOf("opera") == -1));
this.is_iewin = (is_ie && (b.indexOf("win") != -1));
this.is_iemac = (is_ie && (b.indexOf("mac") != -1));
if (this.is_iemac) {
return
}
var a = document.getElementsByTagName("head")[0];
this.style = (typeof document.createElementNS != "undefined") ? document.createElementNS("http://www.w3.org/1999/xhtml", "style") : document.createElement("style");
this.style.setAttribute("type", "text/css");
this.style.setAttribute("media", "screen");
a.appendChild(this.style);
this.lastStyle = document.styleSheets[document.styleSheets.length - 1]
},
applyRule: function (a, d) {
a = a.split(",");
for (var b = 0; b < a.length; b++) {
if (!this.is_iewin) {
var c = document.createTextNode(a[b] + " {" + d + "}");
this.style.appendChild(c)
}
if (this.is_iewin && document.styleSheets && document.styleSheets.length > 0) {
this.lastStyle.addRule(a[b], d)
}
}
}
};
var is_ie = !!(window.attachEvent && !window.opera);
var is_khtml = !!(navigator.appName.match("Konqueror") || navigator.appVersion.match("KHTML"));
var is_gecko = navigator.userAgent.indexOf("Gecko") > -1 && navigator.userAgent.indexOf("KHTML") == -1;
var is_ie7 = navigator.userAgent.indexOf("MSIE 7") > 0;
var is_ie6 = navigator.userAgent.indexOf("MSIE 6") > 0;
var is_opera = !!window.opera;
var is_webkit = navigator.userAgent.indexOf("AppleWebKit/") > -1;
var start = 0;
var secuCode = null;
var spamCounter = 1;
var cnt = 0;
var currentUsersList;
var userListRefreshTime;
if (mobile_version == 1) {
var pfc_avatar_box1 = "pfc_avatar_box_mobile";
var pfc_settings_box1 = "pfc_settings_box_mobile";
var pfc_smileys1 = "pfc_smileys_mobile";
var pfc_online1 = "pfc_online_mobile"
} else {
var pfc_avatar_box1 = "pfc_avatar_box";
var pfc_settings_box1 = "pfc_settings_box";
var pfc_smileys1 = "pfc_smileys";
var pfc_online1 = "pfc_online"
}

`

Most helpful comment

Could you please provide an easy way to reproduce? Thanks :smile:

All 2 comments

Sorry. I was lazy to add it in file(((((

Could you please provide an easy way to reproduce? Thanks :smile:

Was this page helpful?
0 / 5 - 0 ratings