PageRenderTime 77ms CodeModel.GetById 37ms RepoModel.GetById 1ms app.codeStats 1ms

/Website/js/head.js

#
JavaScript | 4444 lines | 4421 code | 0 blank | 23 comment | 1228 complexity | b1d6ec79fffed808ef87f9f20bf6fbc7 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. theObjects = document.getElementsByTagName("object");for (var i = 0; i < theObjects.length; i++) {
  2. theObjects[i].outerHTML = theObjects[i].outerHTML;}
  3. /* Prototype JavaScript framework, version 1.6.0.1
  4. * (c) 2005-2007 Sam Stephenson
  5. *
  6. * Prototype is freely distributable under the terms of an MIT-style license.
  7. * For details, see the Prototype web site: http://www.prototypejs.org/
  8. *
  9. *--------------------------------------------------------------------------*/
  10. var Prototype = {
  11. Version: '1.6.0.1',
  12. Browser: {
  13. IE: !!(window.attachEvent && !window.opera),
  14. Opera: !!window.opera,
  15. WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
  16. Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
  17. MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
  18. },
  19. BrowserFeatures: {
  20. XPath: !!document.evaluate,
  21. ElementExtensions: !!window.HTMLElement,
  22. SpecificElementExtensions:
  23. document.createElement('div').__proto__ &&
  24. document.createElement('div').__proto__ !==
  25. document.createElement('form').__proto__
  26. },
  27. ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
  28. JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
  29. emptyFunction: function() { },
  30. K: function(x) { return x }
  31. };if (Prototype.Browser.MobileSafari)
  32. Prototype.BrowserFeatures.SpecificElementExtensions = false;/* Based on Alex Arnell's inheritance implementation. */
  33. var Class = {
  34. create: function() {
  35. var parent = null, properties = $A(arguments);if (Object.isFunction(properties[0]))
  36. parent = properties.shift();function klass() {
  37. this.initialize.apply(this, arguments);}
  38. Object.extend(klass, Class.Methods);klass.superclass = parent;klass.subclasses = [];if (parent) {
  39. var subclass = function() { };subclass.prototype = parent.prototype;klass.prototype = new subclass;parent.subclasses.push(klass);}
  40. for (var i = 0; i < properties.length; i++)
  41. klass.addMethods(properties[i]);if (!klass.prototype.initialize)
  42. klass.prototype.initialize = Prototype.emptyFunction;klass.prototype.constructor = klass;return klass;}
  43. };Class.Methods = {
  44. addMethods: function(source) {
  45. var ancestor = this.superclass && this.superclass.prototype;var properties = Object.keys(source);if (!Object.keys({ toString: true }).length)
  46. properties.push("toString", "valueOf");for (var i = 0, length = properties.length; i < length; i++) {
  47. var property = properties[i], value = source[property];if (ancestor && Object.isFunction(value) &&
  48. value.argumentNames().first() == "$super") {
  49. var method = value, value = Object.extend((function(m) {
  50. return function() { return ancestor[m].apply(this, arguments) };})(property).wrap(method), {
  51. valueOf: function() { return method },
  52. toString: function() { return method.toString() }
  53. });}
  54. this.prototype[property] = value;}
  55. return this;}
  56. };var Abstract = { };Object.extend = function(destination, source) {
  57. for (var property in source)
  58. destination[property] = source[property];return destination;};Object.extend(Object, {
  59. inspect: function(object) {
  60. try {
  61. if (Object.isUndefined(object)) return 'undefined';if (object === null) return 'null';return object.inspect ? object.inspect() : object.toString();} catch (e) {
  62. if (e instanceof RangeError) return '...';throw e;}
  63. },
  64. toJSON: function(object) {
  65. var type = typeof object;switch (type) {
  66. case 'undefined':
  67. case 'function':
  68. case 'unknown': return;case 'boolean': return object.toString();}
  69. if (object === null) return 'null';if (object.toJSON) return object.toJSON();if (Object.isElement(object)) return;var results = [];for (var property in object) {
  70. var value = Object.toJSON(object[property]);if (!Object.isUndefined(value))
  71. results.push(property.toJSON() + ': ' + value);}
  72. return '{' + results.join(', ') + '}';},
  73. toQueryString: function(object) {
  74. return $H(object).toQueryString();},
  75. toHTML: function(object) {
  76. return object && object.toHTML ? object.toHTML() : String.interpret(object);},
  77. keys: function(object) {
  78. var keys = [];for (var property in object)
  79. keys.push(property);return keys;},
  80. values: function(object) {
  81. var values = [];for (var property in object)
  82. values.push(object[property]);return values;},
  83. clone: function(object) {
  84. return Object.extend({ }, object);},
  85. isElement: function(object) {
  86. return object && object.nodeType == 1;},
  87. isArray: function(object) {
  88. return object && object.constructor === Array;},
  89. isHash: function(object) {
  90. return object instanceof Hash;},
  91. isFunction: function(object) {
  92. return typeof object == "function";},
  93. isString: function(object) {
  94. return typeof object == "string";},
  95. isNumber: function(object) {
  96. return typeof object == "number";},
  97. isUndefined: function(object) {
  98. return typeof object == "undefined";}
  99. });Object.extend(Function.prototype, {
  100. argumentNames: function() {
  101. var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");return names.length == 1 && !names[0] ? [] : names;},
  102. bind: function() {
  103. if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;var __method = this, args = $A(arguments), object = args.shift();return function() {
  104. return __method.apply(object, args.concat($A(arguments)));}
  105. },
  106. bindAsEventListener: function() {
  107. var __method = this, args = $A(arguments), object = args.shift();return function(event) {
  108. return __method.apply(object, [event || window.event].concat(args));}
  109. },
  110. curry: function() {
  111. if (!arguments.length) return this;var __method = this, args = $A(arguments);return function() {
  112. return __method.apply(this, args.concat($A(arguments)));}
  113. },
  114. delay: function() {
  115. var __method = this, args = $A(arguments), timeout = args.shift() * 1000;return window.setTimeout(function() {
  116. return __method.apply(__method, args);}, timeout);},
  117. wrap: function(wrapper) {
  118. var __method = this;return function() {
  119. return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));}
  120. },
  121. methodize: function() {
  122. if (this._methodized) return this._methodized;var __method = this;return this._methodized = function() {
  123. return __method.apply(null, [this].concat($A(arguments)));};}
  124. });Function.prototype.defer = Function.prototype.delay.curry(0.01);Date.prototype.toJSON = function() {
  125. return '"' + this.getUTCFullYear() + '-' +
  126. (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
  127. this.getUTCDate().toPaddedString(2) + 'T' +
  128. this.getUTCHours().toPaddedString(2) + ':' +
  129. this.getUTCMinutes().toPaddedString(2) + ':' +
  130. this.getUTCSeconds().toPaddedString(2) + 'Z"';};var Try = {
  131. these: function() {
  132. var returnValue;for (var i = 0, length = arguments.length; i < length; i++) {
  133. var lambda = arguments[i];try {
  134. returnValue = lambda();break;} catch (e) { }
  135. }
  136. return returnValue;}
  137. };RegExp.prototype.match = RegExp.prototype.test;RegExp.escape = function(str) {
  138. return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');};/*--------------------------------------------------------------------------*/
  139. var PeriodicalExecuter = Class.create({
  140. initialize: function(callback, frequency) {
  141. this.callback = callback;this.frequency = frequency;this.currentlyExecuting = false;this.registerCallback();},
  142. registerCallback: function() {
  143. this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);},
  144. execute: function() {
  145. this.callback(this);},
  146. stop: function() {
  147. if (!this.timer) return;clearInterval(this.timer);this.timer = null;},
  148. onTimerEvent: function() {
  149. if (!this.currentlyExecuting) {
  150. try {
  151. this.currentlyExecuting = true;this.execute();} finally {
  152. this.currentlyExecuting = false;}
  153. }
  154. }
  155. });Object.extend(String, {
  156. interpret: function(value) {
  157. return value == null ? '' : String(value);},
  158. specialChar: {
  159. '\b': '\\b',
  160. '\t': '\\t',
  161. '\n': '\\n',
  162. '\f': '\\f',
  163. '\r': '\\r',
  164. '\\': '\\\\'
  165. }
  166. });Object.extend(String.prototype, {
  167. gsub: function(pattern, replacement) {
  168. var result = '', source = this, match;replacement = arguments.callee.prepareReplacement(replacement);while (source.length > 0) {
  169. if (match = source.match(pattern)) {
  170. result += source.slice(0, match.index);result += String.interpret(replacement(match));source = source.slice(match.index + match[0].length);} else {
  171. result += source, source = '';}
  172. }
  173. return result;},
  174. sub: function(pattern, replacement, count) {
  175. replacement = this.gsub.prepareReplacement(replacement);count = Object.isUndefined(count) ? 1 : count;return this.gsub(pattern, function(match) {
  176. if (--count < 0) return match[0];return replacement(match);});},
  177. scan: function(pattern, iterator) {
  178. this.gsub(pattern, iterator);return String(this);},
  179. truncate: function(length, truncation) {
  180. length = length || 30;truncation = Object.isUndefined(truncation) ? '...' : truncation;return this.length > length ?
  181. this.slice(0, length - truncation.length) + truncation : String(this);},
  182. strip: function() {
  183. return this.replace(/^\s+/, '').replace(/\s+$/, '');},
  184. stripTags: function() {
  185. return this.replace(/<\/?[^>]+>/gi, '');},
  186. stripScripts: function() {
  187. return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');},
  188. extractScripts: function() {
  189. var matchAll = new RegExp(Prototype.ScriptFragment, 'img');var matchOne = new RegExp(Prototype.ScriptFragment, 'im');return (this.match(matchAll) || []).map(function(scriptTag) {
  190. return (scriptTag.match(matchOne) || ['', ''])[1];});},
  191. evalScripts: function() {
  192. return this.extractScripts().map(function(script) { return eval(script) });},
  193. escapeHTML: function() {
  194. var self = arguments.callee;self.text.data = this;return self.div.innerHTML;},
  195. unescapeHTML: function() {
  196. var div = new Element('div');div.innerHTML = this.stripTags();return div.childNodes[0] ? (div.childNodes.length > 1 ?
  197. $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
  198. div.childNodes[0].nodeValue) : '';},
  199. toQueryParams: function(separator) {
  200. var match = this.strip().match(/([^?#]*)(#.*)?$/);if (!match) return { };return match[1].split(separator || '&').inject({ }, function(hash, pair) {
  201. if ((pair = pair.split('='))[0]) {
  202. var key = decodeURIComponent(pair.shift());var value = pair.length > 1 ? pair.join('=') : pair[0];if (value != undefined) value = decodeURIComponent(value);if (key in hash) {
  203. if (!Object.isArray(hash[key])) hash[key] = [hash[key]];hash[key].push(value);}
  204. else hash[key] = value;}
  205. return hash;});},
  206. toArray: function() {
  207. return this.split('');},
  208. succ: function() {
  209. return this.slice(0, this.length - 1) +
  210. String.fromCharCode(this.charCodeAt(this.length - 1) + 1);},
  211. times: function(count) {
  212. return count < 1 ? '' : new Array(count + 1).join(this);},
  213. camelize: function() {
  214. var parts = this.split('-'), len = parts.length;if (len == 1) return parts[0];var camelized = this.charAt(0) == '-'
  215. ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
  216. : parts[0];for (var i = 1; i < len; i++)
  217. camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);return camelized;},
  218. capitalize: function() {
  219. return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();},
  220. underscore: function() {
  221. return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();},
  222. dasherize: function() {
  223. return this.gsub(/_/,'-');},
  224. inspect: function(useDoubleQuotes) {
  225. var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
  226. var character = String.specialChar[match[0]];return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);});if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';return "'" + escapedString.replace(/'/g, '\\\'') + "'";},
  227. toJSON: function() {
  228. return this.inspect(true);},
  229. unfilterJSON: function(filter) {
  230. return this.sub(filter || Prototype.JSONFilter, '#{1}');},
  231. isJSON: function() {
  232. var str = this;if (str.blank()) return false;str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);},
  233. evalJSON: function(sanitize) {
  234. var json = this.unfilterJSON();try {
  235. if (!sanitize || json.isJSON()) return eval('(' + json + ')');} catch (e) { }
  236. throw new SyntaxError('Badly formed JSON string: ' + this.inspect());},
  237. include: function(pattern) {
  238. return this.indexOf(pattern) > -1;},
  239. startsWith: function(pattern) {
  240. return this.indexOf(pattern) === 0;},
  241. endsWith: function(pattern) {
  242. var d = this.length - pattern.length;return d >= 0 && this.lastIndexOf(pattern) === d;},
  243. empty: function() {
  244. return this == '';},
  245. blank: function() {
  246. return /^\s*$/.test(this);},
  247. interpolate: function(object, pattern) {
  248. return new Template(this, pattern).evaluate(object);}
  249. });if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
  250. escapeHTML: function() {
  251. return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');},
  252. unescapeHTML: function() {
  253. return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');}
  254. });String.prototype.gsub.prepareReplacement = function(replacement) {
  255. if (Object.isFunction(replacement)) return replacement;var template = new Template(replacement);return function(match) { return template.evaluate(match) };};String.prototype.parseQuery = String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML, {
  256. div: document.createElement('div'),
  257. text: document.createTextNode('')
  258. });with (String.prototype.escapeHTML) div.appendChild(text);var Template = Class.create({
  259. initialize: function(template, pattern) {
  260. this.template = template.toString();this.pattern = pattern || Template.Pattern;},
  261. evaluate: function(object) {
  262. if (Object.isFunction(object.toTemplateReplacements))
  263. object = object.toTemplateReplacements();return this.template.gsub(this.pattern, function(match) {
  264. if (object == null) return '';var before = match[1] || '';if (before == '\\') return match[2];var ctx = object, expr = match[3];var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match = pattern.exec(expr);if (match == null) return before;while (match != null) {
  265. var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];ctx = ctx[comp];if (null == ctx || '' == match[3]) break;expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);match = pattern.exec(expr);}
  266. return before + String.interpret(ctx);}.bind(this));}
  267. });Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;var $break = { };var Enumerable = {
  268. each: function(iterator, context) {
  269. var index = 0;iterator = iterator.bind(context);try {
  270. this._each(function(value) {
  271. iterator(value, index++);});} catch (e) {
  272. if (e != $break) throw e;}
  273. return this;},
  274. eachSlice: function(number, iterator, context) {
  275. iterator = iterator ? iterator.bind(context) : Prototype.K;var index = -number, slices = [], array = this.toArray();while ((index += number) < array.length)
  276. slices.push(array.slice(index, index+number));return slices.collect(iterator, context);},
  277. all: function(iterator, context) {
  278. iterator = iterator ? iterator.bind(context) : Prototype.K;var result = true;this.each(function(value, index) {
  279. result = result && !!iterator(value, index);if (!result) throw $break;});return result;},
  280. any: function(iterator, context) {
  281. iterator = iterator ? iterator.bind(context) : Prototype.K;var result = false;this.each(function(value, index) {
  282. if (result = !!iterator(value, index))
  283. throw $break;});return result;},
  284. collect: function(iterator, context) {
  285. iterator = iterator ? iterator.bind(context) : Prototype.K;var results = [];this.each(function(value, index) {
  286. results.push(iterator(value, index));});return results;},
  287. detect: function(iterator, context) {
  288. iterator = iterator.bind(context);var result;this.each(function(value, index) {
  289. if (iterator(value, index)) {
  290. result = value;throw $break;}
  291. });return result;},
  292. findAll: function(iterator, context) {
  293. iterator = iterator.bind(context);var results = [];this.each(function(value, index) {
  294. if (iterator(value, index))
  295. results.push(value);});return results;},
  296. grep: function(filter, iterator, context) {
  297. iterator = iterator ? iterator.bind(context) : Prototype.K;var results = [];if (Object.isString(filter))
  298. filter = new RegExp(filter);this.each(function(value, index) {
  299. if (filter.match(value))
  300. results.push(iterator(value, index));});return results;},
  301. include: function(object) {
  302. if (Object.isFunction(this.indexOf))
  303. if (this.indexOf(object) != -1) return true;var found = false;this.each(function(value) {
  304. if (value == object) {
  305. found = true;throw $break;}
  306. });return found;},
  307. inGroupsOf: function(number, fillWith) {
  308. fillWith = Object.isUndefined(fillWith) ? null : fillWith;return this.eachSlice(number, function(slice) {
  309. while(slice.length < number) slice.push(fillWith);return slice;});},
  310. inject: function(memo, iterator, context) {
  311. iterator = iterator.bind(context);this.each(function(value, index) {
  312. memo = iterator(memo, value, index);});return memo;},
  313. invoke: function(method) {
  314. var args = $A(arguments).slice(1);return this.map(function(value) {
  315. return value[method].apply(value, args);});},
  316. max: function(iterator, context) {
  317. iterator = iterator ? iterator.bind(context) : Prototype.K;var result;this.each(function(value, index) {
  318. value = iterator(value, index);if (result == null || value >= result)
  319. result = value;});return result;},
  320. min: function(iterator, context) {
  321. iterator = iterator ? iterator.bind(context) : Prototype.K;var result;this.each(function(value, index) {
  322. value = iterator(value, index);if (result == null || value < result)
  323. result = value;});return result;},
  324. partition: function(iterator, context) {
  325. iterator = iterator ? iterator.bind(context) : Prototype.K;var trues = [], falses = [];this.each(function(value, index) {
  326. (iterator(value, index) ?
  327. trues : falses).push(value);});return [trues, falses];},
  328. pluck: function(property) {
  329. var results = [];this.each(function(value) {
  330. results.push(value[property]);});return results;},
  331. reject: function(iterator, context) {
  332. iterator = iterator.bind(context);var results = [];this.each(function(value, index) {
  333. if (!iterator(value, index))
  334. results.push(value);});return results;},
  335. sortBy: function(iterator, context) {
  336. iterator = iterator.bind(context);return this.map(function(value, index) {
  337. return {value: value, criteria: iterator(value, index)};}).sort(function(left, right) {
  338. var a = left.criteria, b = right.criteria;return a < b ? -1 : a > b ? 1 : 0;}).pluck('value');},
  339. toArray: function() {
  340. return this.map();},
  341. zip: function() {
  342. var iterator = Prototype.K, args = $A(arguments);if (Object.isFunction(args.last()))
  343. iterator = args.pop();var collections = [this].concat(args).map($A);return this.map(function(value, index) {
  344. return iterator(collections.pluck(index));});},
  345. size: function() {
  346. return this.toArray().length;},
  347. inspect: function() {
  348. return '#<Enumerable:' + this.toArray().inspect() + '>';}
  349. };Object.extend(Enumerable, {
  350. map: Enumerable.collect,
  351. find: Enumerable.detect,
  352. select: Enumerable.findAll,
  353. filter: Enumerable.findAll,
  354. member: Enumerable.include,
  355. entries: Enumerable.toArray,
  356. every: Enumerable.all,
  357. some: Enumerable.any
  358. });function $A(iterable) {
  359. if (!iterable) return [];if (iterable.toArray) return iterable.toArray();var length = iterable.length || 0, results = new Array(length);while (length--) results[length] = iterable[length];return results;}
  360. if (Prototype.Browser.WebKit) {
  361. function $A(iterable) {
  362. if (!iterable) return [];if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
  363. iterable.toArray) return iterable.toArray();var length = iterable.length || 0, results = new Array(length);while (length--) results[length] = iterable[length];return results;}
  364. }
  365. Array.from = $A;Object.extend(Array.prototype, Enumerable);if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;Object.extend(Array.prototype, {
  366. _each: function(iterator) {
  367. for (var i = 0, length = this.length; i < length; i++)
  368. iterator(this[i]);},
  369. clear: function() {
  370. this.length = 0;return this;},
  371. first: function() {
  372. return this[0];},
  373. last: function() {
  374. return this[this.length - 1];},
  375. compact: function() {
  376. return this.select(function(value) {
  377. return value != null;});},
  378. flatten: function() {
  379. return this.inject([], function(array, value) {
  380. return array.concat(Object.isArray(value) ?
  381. value.flatten() : [value]);});},
  382. without: function() {
  383. var values = $A(arguments);return this.select(function(value) {
  384. return !values.include(value);});},
  385. reverse: function(inline) {
  386. return (inline !== false ? this : this.toArray())._reverse();},
  387. reduce: function() {
  388. return this.length > 1 ? this : this[0];},
  389. uniq: function(sorted) {
  390. return this.inject([], function(array, value, index) {
  391. if (0 == index || (sorted ? array.last() != value : !array.include(value)))
  392. array.push(value);return array;});},
  393. intersect: function(array) {
  394. return this.uniq().findAll(function(item) {
  395. return array.detect(function(value) { return item === value });});},
  396. clone: function() {
  397. return [].concat(this);},
  398. size: function() {
  399. return this.length;},
  400. inspect: function() {
  401. return '[' + this.map(Object.inspect).join(', ') + ']';},
  402. toJSON: function() {
  403. var results = [];this.each(function(object) {
  404. var value = Object.toJSON(object);if (!Object.isUndefined(value)) results.push(value);});return '[' + results.join(', ') + ']';}
  405. });if (Object.isFunction(Array.prototype.forEach))
  406. Array.prototype._each = Array.prototype.forEach;if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
  407. i || (i = 0);var length = this.length;if (i < 0) i = length + i;for (; i < length; i++)
  408. if (this[i] === item) return i;return -1;};if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
  409. i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;var n = this.slice(0, i).reverse().indexOf(item);return (n < 0) ? n : i - n - 1;};Array.prototype.toArray = Array.prototype.clone;function $w(string) {
  410. if (!Object.isString(string)) return [];string = string.strip();return string ? string.split(/\s+/) : [];}
  411. if (Prototype.Browser.Opera){
  412. Array.prototype.concat = function() {
  413. var array = [];for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);for (var i = 0, length = arguments.length; i < length; i++) {
  414. if (Object.isArray(arguments[i])) {
  415. for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
  416. array.push(arguments[i][j]);} else {
  417. array.push(arguments[i]);}
  418. }
  419. return array;};}
  420. Object.extend(Number.prototype, {
  421. toColorPart: function() {
  422. return this.toPaddedString(2, 16);},
  423. succ: function() {
  424. return this + 1;},
  425. times: function(iterator) {
  426. $R(0, this, true).each(iterator);return this;},
  427. toPaddedString: function(length, radix) {
  428. var string = this.toString(radix || 10);return '0'.times(length - string.length) + string;},
  429. toJSON: function() {
  430. return isFinite(this) ? this.toString() : 'null';}
  431. });$w('abs round ceil floor').each(function(method){
  432. Number.prototype[method] = Math[method].methodize();});function $H(object) {
  433. return new Hash(object);};var Hash = Class.create(Enumerable, (function() {
  434. function toQueryPair(key, value) {
  435. if (Object.isUndefined(value)) return key;return key + '=' + encodeURIComponent(String.interpret(value));}
  436. return {
  437. initialize: function(object) {
  438. this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);},
  439. _each: function(iterator) {
  440. for (var key in this._object) {
  441. var value = this._object[key], pair = [key, value];pair.key = key;pair.value = value;iterator(pair);}
  442. },
  443. set: function(key, value) {
  444. return this._object[key] = value;},
  445. get: function(key) {
  446. return this._object[key];},
  447. unset: function(key) {
  448. var value = this._object[key];delete this._object[key];return value;},
  449. toObject: function() {
  450. return Object.clone(this._object);},
  451. keys: function() {
  452. return this.pluck('key');},
  453. values: function() {
  454. return this.pluck('value');},
  455. index: function(value) {
  456. var match = this.detect(function(pair) {
  457. return pair.value === value;});return match && match.key;},
  458. merge: function(object) {
  459. return this.clone().update(object);},
  460. update: function(object) {
  461. return new Hash(object).inject(this, function(result, pair) {
  462. result.set(pair.key, pair.value);return result;});},
  463. toQueryString: function() {
  464. return this.map(function(pair) {
  465. var key = encodeURIComponent(pair.key), values = pair.value;if (values && typeof values == 'object') {
  466. if (Object.isArray(values))
  467. return values.map(toQueryPair.curry(key)).join('&');}
  468. return toQueryPair(key, values);}).join('&');},
  469. inspect: function() {
  470. return '#<Hash:{' + this.map(function(pair) {
  471. return pair.map(Object.inspect).join(': ');}).join(', ') + '}>';},
  472. toJSON: function() {
  473. return Object.toJSON(this.toObject());},
  474. clone: function() {
  475. return new Hash(this);}
  476. }
  477. })());Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;Hash.from = $H;var ObjectRange = Class.create(Enumerable, {
  478. initialize: function(start, end, exclusive) {
  479. this.start = start;this.end = end;this.exclusive = exclusive;},
  480. _each: function(iterator) {
  481. var value = this.start;while (this.include(value)) {
  482. iterator(value);value = value.succ();}
  483. },
  484. include: function(value) {
  485. if (value < this.start)
  486. return false;if (this.exclusive)
  487. return value < this.end;return value <= this.end;}
  488. });var $R = function(start, end, exclusive) {
  489. return new ObjectRange(start, end, exclusive);};var Ajax = {
  490. getTransport: function() {
  491. return Try.these(
  492. function() {return new XMLHttpRequest()},
  493. function() {return new ActiveXObject('Msxml2.XMLHTTP')},
  494. function() {return new ActiveXObject('Microsoft.XMLHTTP')}
  495. ) || false;},
  496. activeRequestCount: 0
  497. };Ajax.Responders = {
  498. responders: [],
  499. _each: function(iterator) {
  500. this.responders._each(iterator);},
  501. register: function(responder) {
  502. if (!this.include(responder))
  503. this.responders.push(responder);},
  504. unregister: function(responder) {
  505. this.responders = this.responders.without(responder);},
  506. dispatch: function(callback, request, transport, json) {
  507. this.each(function(responder) {
  508. if (Object.isFunction(responder[callback])) {
  509. try {
  510. responder[callback].apply(responder, [request, transport, json]);} catch (e) { }
  511. }
  512. });}
  513. };Object.extend(Ajax.Responders, Enumerable);Ajax.Responders.register({
  514. onCreate: function() { Ajax.activeRequestCount++ },
  515. onComplete: function() { Ajax.activeRequestCount-- }
  516. });Ajax.Base = Class.create({
  517. initialize: function(options) {
  518. this.options = {
  519. method: 'post',
  520. asynchronous: true,
  521. contentType: 'application/x-www-form-urlencoded',
  522. encoding: 'UTF-8',
  523. parameters: '',
  524. evalJSON: true,
  525. evalJS: true
  526. };Object.extend(this.options, options || { });this.options.method = this.options.method.toLowerCase();if (Object.isString(this.options.parameters))
  527. this.options.parameters = this.options.parameters.toQueryParams();else if (Object.isHash(this.options.parameters))
  528. this.options.parameters = this.options.parameters.toObject();}
  529. });Ajax.Request = Class.create(Ajax.Base, {
  530. _complete: false,
  531. initialize: function($super, url, options) {
  532. $super(options);this.transport = Ajax.getTransport();this.request(url);},
  533. request: function(url) {
  534. this.url = url;this.method = this.options.method;var params = Object.clone(this.options.parameters);if (!['get', 'post'].include(this.method)) {
  535. params['_method'] = this.method;this.method = 'post';}
  536. this.parameters = params;if (params = Object.toQueryString(params)) {
  537. if (this.method == 'get')
  538. this.url += (this.url.include('?') ? '&' : '?') + params;else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
  539. params += '&_=';}
  540. try {
  541. var response = new Ajax.Response(this);if (this.options.onCreate) this.options.onCreate(response);Ajax.Responders.dispatch('onCreate', this, response);this.transport.open(this.method.toUpperCase(), this.url,
  542. this.options.asynchronous);if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);this.transport.onreadystatechange = this.onStateChange.bind(this);this.setRequestHeaders();this.body = this.method == 'post' ? (this.options.postBody || params) : null;this.transport.send(this.body);/* Force Firefox to handle ready state 4 for synchronous requests */
  543. if (!this.options.asynchronous && this.transport.overrideMimeType)
  544. this.onStateChange();}
  545. catch (e) {
  546. this.dispatchException(e);}
  547. },
  548. onStateChange: function() {
  549. var readyState = this.transport.readyState;if (readyState > 1 && !((readyState == 4) && this._complete))
  550. this.respondToReadyState(this.transport.readyState);},
  551. setRequestHeaders: function() {
  552. var headers = {
  553. 'X-Requested-With': 'XMLHttpRequest',
  554. 'X-Prototype-Version': Prototype.Version,
  555. 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
  556. };if (this.method == 'post') {
  557. headers['Content-type'] = this.options.contentType +
  558. (this.options.encoding ? '; charset=' + this.options.encoding : '');/* Force "Connection: close" for older Mozilla browsers to work
  559. * around a bug where XMLHttpRequest sends an incorrect
  560. * Content-length header. See Mozilla Bugzilla #246651.
  561. */
  562. if (this.transport.overrideMimeType &&
  563. (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
  564. headers['Connection'] = 'close';}
  565. if (typeof this.options.requestHeaders == 'object') {
  566. var extras = this.options.requestHeaders;if (Object.isFunction(extras.push))
  567. for (var i = 0, length = extras.length; i < length; i += 2)
  568. headers[extras[i]] = extras[i+1];else
  569. $H(extras).each(function(pair) { headers[pair.key] = pair.value });}
  570. for (var name in headers)
  571. this.transport.setRequestHeader(name, headers[name]);},
  572. success: function() {
  573. var status = this.getStatus();return !status || (status >= 200 && status < 300);},
  574. getStatus: function() {
  575. try {
  576. return this.transport.status || 0;} catch (e) { return 0 }
  577. },
  578. respondToReadyState: function(readyState) {
  579. var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);if (state == 'Complete') {
  580. try {
  581. this._complete = true;(this.options['on' + response.status]
  582. || this.options['on' + (this.success() ? 'Success' : 'Failure')]
  583. || Prototype.emptyFunction)(response, response.headerJSON);} catch (e) {
  584. this.dispatchException(e);}
  585. var contentType = response.getHeader('Content-type');if (this.options.evalJS == 'force'
  586. || (this.options.evalJS && contentType
  587. && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
  588. this.evalResponse();}
  589. try {
  590. (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);} catch (e) {
  591. this.dispatchException(e);}
  592. if (state == 'Complete') {
  593. this.transport.onreadystatechange = Prototype.emptyFunction;}
  594. },
  595. getHeader: function(name) {
  596. try {
  597. return this.transport.getResponseHeader(name) || null;} catch (e) { return null }
  598. },
  599. evalResponse: function() {
  600. try {
  601. return eval((this.transport.responseText || '').unfilterJSON());} catch (e) {
  602. this.dispatchException(e);}
  603. },
  604. dispatchException: function(exception) {
  605. (this.options.onException || Prototype.emptyFunction)(this, exception);Ajax.Responders.dispatch('onException', this, exception);}
  606. });Ajax.Request.Events =
  607. ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];Ajax.Response = Class.create({
  608. initialize: function(request){
  609. this.request = request;var transport = this.transport = request.transport,
  610. readyState = this.readyState = transport.readyState;if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
  611. this.status = this.getStatus();this.statusText = this.getStatusText();this.responseText = String.interpret(transport.responseText);this.headerJSON = this._getHeaderJSON();}
  612. if(readyState == 4) {
  613. var xml = transport.responseXML;this.responseXML = Object.isUndefined(xml) ? null : xml;this.responseJSON = this._getResponseJSON();}
  614. },
  615. status: 0,
  616. statusText: '',
  617. getStatus: Ajax.Request.prototype.getStatus,
  618. getStatusText: function() {
  619. try {
  620. return this.transport.statusText || '';} catch (e) { return '' }
  621. },
  622. getHeader: Ajax.Request.prototype.getHeader,
  623. getAllHeaders: function() {
  624. try {
  625. return this.getAllResponseHeaders();} catch (e) { return null }
  626. },
  627. getResponseHeader: function(name) {
  628. return this.transport.getResponseHeader(name);},
  629. getAllResponseHeaders: function() {
  630. return this.transport.getAllResponseHeaders();},
  631. _getHeaderJSON: function() {
  632. var json = this.getHeader('X-JSON');if (!json) return null;json = decodeURIComponent(escape(json));try {
  633. return json.evalJSON(this.request.options.sanitizeJSON);} catch (e) {
  634. this.request.dispatchException(e);}
  635. },
  636. _getResponseJSON: function() {
  637. var options = this.request.options;if (!options.evalJSON || (options.evalJSON != 'force' &&
  638. !(this.getHeader('Content-type') || '').include('application/json')) ||
  639. this.responseText.blank())
  640. return null;try {
  641. return this.responseText.evalJSON(options.sanitizeJSON);} catch (e) {
  642. this.request.dispatchException(e);}
  643. }
  644. });Ajax.Updater = Class.create(Ajax.Request, {
  645. initialize: function($super, container, url, options) {
  646. this.container = {
  647. success: (container.success || container),
  648. failure: (container.failure || (container.success ? null : container))
  649. };options = Object.clone(options);var onComplete = options.onComplete;options.onComplete = (function(response, json) {
  650. this.updateContent(response.responseText);if (Object.isFunction(onComplete)) onComplete(response, json);}).bind(this);$super(url, options);},
  651. updateContent: function(responseText) {
  652. var receiver = this.container[this.success() ? 'success' : 'failure'],
  653. options = this.options;if (!options.evalScripts) responseText = responseText.stripScripts();if (receiver = $(receiver)) {
  654. if (options.insertion) {
  655. if (Object.isString(options.insertion)) {
  656. var insertion = { }; insertion[options.insertion] = responseText;receiver.insert(insertion);}
  657. else options.insertion(receiver, responseText);}
  658. else receiver.update(responseText);}
  659. }
  660. });Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
  661. initialize: function($super, container, url, options) {
  662. $super(options);this.onComplete = this.options.onComplete;this.frequency = (this.options.frequency || 2);this.decay = (this.options.decay || 1);this.updater = { };this.container = container;this.url = url;this.start();},
  663. start: function() {
  664. this.options.onComplete = this.updateComplete.bind(this);this.onTimerEvent();},
  665. stop: function() {
  666. this.updater.options.onComplete = undefined;clearTimeout(this.timer);(this.onComplete || Prototype.emptyFunction).apply(this, arguments);},
  667. updateComplete: function(response) {
  668. if (this.options.decay) {
  669. this.decay = (response.responseText == this.lastText ?
  670. this.decay * this.options.decay : 1);this.lastText = response.responseText;}
  671. this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);},
  672. onTimerEvent: function() {
  673. this.updater = new Ajax.Updater(this.container, this.url, this.options);}
  674. });function $(element) {
  675. if (arguments.length > 1) {
  676. for (var i = 0, elements = [], length = arguments.length; i < length; i++)
  677. elements.push($(arguments[i]));return elements;}
  678. if (Object.isString(element))
  679. element = document.getElementById(element);return Element.extend(element);}
  680. if (Prototype.BrowserFeatures.XPath) {
  681. document._getElementsByXPath = function(expression, parentElement) {
  682. var results = [];var query = document.evaluate(expression, $(parentElement) || document,
  683. null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);for (var i = 0, length = query.snapshotLength; i < length; i++)
  684. results.push(Element.extend(query.snapshotItem(i)));return results;};}
  685. /*--------------------------------------------------------------------------*/
  686. if (!window.Node) var Node = { };if (!Node.ELEMENT_NODE) {
  687. Object.extend(Node, {
  688. ELEMENT_NODE: 1,
  689. ATTRIBUTE_NODE: 2,
  690. TEXT_NODE: 3,
  691. CDATA_SECTION_NODE: 4,
  692. ENTITY_REFERENCE_NODE: 5,
  693. ENTITY_NODE: 6,
  694. PROCESSING_INSTRUCTION_NODE: 7,
  695. COMMENT_NODE: 8,
  696. DOCUMENT_NODE: 9,
  697. DOCUMENT_TYPE_NODE: 10,
  698. DOCUMENT_FRAGMENT_NODE: 11,
  699. NOTATION_NODE: 12
  700. });}
  701. (function() {
  702. var element = this.Element;this.Element = function(tagName, attributes) {
  703. attributes = attributes || { };tagName = tagName.toLowerCase();var cache = Element.cache;if (Prototype.Browser.IE && attributes.name) {
  704. tagName = '<' + tagName + ' name="' + attributes.name + '">';delete attributes.name;return Element.writeAttribute(document.createElement(tagName), attributes);}
  705. if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);};Object.extend(this.Element, element || { });}).call(window);Element.cache = { };Element.Methods = {
  706. visible: function(element) {
  707. return $(element).style.display != 'none';},
  708. toggle: function(element) {
  709. element = $(element);Element[Element.visible(element) ? 'hide' : 'show'](element);return element;},
  710. hide: function(element) {
  711. $(element).style.display = 'none';return element;},
  712. show: function(element) {
  713. $(element).style.display = '';return element;},
  714. remove: function(element) {
  715. element = $(element);element.parentNode.removeChild(element);return element;},
  716. update: function(element, content) {
  717. element = $(element);if (content && content.toElement) content = content.toElement();if (Object.isElement(content)) return element.update().insert(content);content = Object.toHTML(content);element.innerHTML = content.stripScripts();content.evalScripts.bind(content).defer();return element;},
  718. replace: function(element, content) {
  719. element = $(element);if (content && content.toElement) content = content.toElement();else if (!Object.isElement(content)) {
  720. content = Object.toHTML(content);var range = element.ownerDocument.createRange();range.selectNode(element);content.evalScripts.bind(content).defer();content = range.createContextualFragment(content.stripScripts());}
  721. element.parentNode.replaceChild(content, element);return element;},
  722. insert: function(element, insertions) {
  723. element = $(element);if (Object.isString(insertions) || Object.isNumber(insertions) ||
  724. Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
  725. insertions = {bottom:insertions};var content, insert, tagName, childNodes;for (position in insertions) {
  726. content = insertions[position];position = position.toLowerCase();insert = Element._insertionTranslations[position];if (content && content.toElement) content = content.toElement();if (Object.isElement(content)) {
  727. insert(element, content);continue;}
  728. content = Object.toHTML(content);tagName = ((position == 'before' || position == 'after')
  729. ? element.parentNode : element).tagName.toUpperCase();childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());if (position == 'top' || position == 'after') childNodes.reverse();childNodes.each(insert.curry(element));content.evalScripts.bind(content).defer();}
  730. return element;},
  731. wrap: function(element, wrapper, attributes) {
  732. element = $(element);if (Object.isElement(wrapper))
  733. $(wrapper).writeAttribute(attributes || { });else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);else wrapper = new Element('div', wrapper);if (element.parentNode)
  734. element.parentNode.replaceChild(wrapper, element);wrapper.appendChild(element);return wrapper;},
  735. inspect: function(element) {
  736. element = $(element);var result = '<' + element.tagName.toLowerCase();$H({'id': 'id', 'className': 'class'}).each(function(pair) {
  737. var property = pair.first(), attribute = pair.last();var value = (element[property] || '').toString();if (value) result += ' ' + attribute + '=' + value.inspect(true);});return result + '>';},
  738. recursivelyCollect: function(element, property) {
  739. element = $(element);var elements = [];while (element = element[property])
  740. if (element.nodeType == 1)
  741. elements.push(Element.extend(element));return elements;},
  742. ancestors: function(element) {
  743. return $(element).recursivelyCollect('parentNode');},
  744. descendants: function(element) {
  745. return $(element).getElementsBySelector("*");},
  746. firstDescendant: function(element) {
  747. element = $(element).firstChild;while (element && element.nodeType != 1) element = element.nextSibling;return $(element);},
  748. immediateDescendants: function(element) {
  749. if (!(element = $(element).firstChild)) return [];while (element && element.nodeType != 1) element = element.nextSibling;if (element) return [element].concat($(element).nextSiblings());return [];},
  750. previousSiblings: function(element) {
  751. return $(element).recursivelyCollect('previousSibling');},
  752. nextSiblings: function(element) {
  753. return $(element).recursivelyCollect('nextSibling');},
  754. siblings: function(element) {
  755. element = $(element);return element.previousSiblings().reverse().concat(element.nextSiblings());},
  756. match: function(element, selector) {
  757. if (Object.isString(selector))
  758. selector = new Selector(selector);return selector.match($(element));},
  759. up: function(element, expression, index) {
  760. element = $(element);if (arguments.length == 1) return $(element.parentNode);var ancestors = element.ancestors();return Object.isNumber(expression) ? ancestors[expression] :
  761. Selector.findElement(ancestors, expression, index);},
  762. down: function(element, expression, index) {
  763. element = $(element);if (arguments.length == 1) return element.firstDescendant();return Object.isNumber(expression) ? element.descendants()[expression] :
  764. element.select(expression)[index || 0];},
  765. previous: function(element, expression, index) {
  766. element = $(element);if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));var previousSiblings = element.previousSiblings();return Object.isNumber(expression) ? previousSiblings[expression] :
  767. Selector.findElement(previousSiblings, expression, index);},
  768. next: function(element, expression, index) {
  769. element = $(element);if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));var nextSiblings = element.nextSiblings();return Object.isNumber(expression) ? nextSiblings[expression] :
  770. Selector.findElement(nextSiblings, expression, index);},
  771. select: function() {
  772. var args = $A(arguments), element = $(args.shift());return Selector.findChildElements(element, args);},
  773. adjacent: function() {
  774. var args = $A(arguments), element = $(args.shift());return Selector.findChildElements(element.parentNode, args).without(element);},
  775. identify: function(element) {
  776. element = $(element);var id = element.readAttribute('id'), self = arguments.callee;if (id) return id;do { id = 'anonymous_element_' + self.counter++ } while ($(id));element.writeAttribute('id', id);return id;},
  777. readAttribute: function(element, name) {
  778. element = $(element);if (Prototype.Browser.IE) {
  779. var t = Element._attributeTranslations.read;if (t.values[name]) return t.values[name](element, name);if (t.names[name]) name = t.names[name];if (name.include(':')) {
  780. return (!element.attributes || !element.attributes[name]) ? null :
  781. element.attributes[name].value;}
  782. }
  783. return element.getAttribute(name);},
  784. writeAttribute: function(element, name, value) {
  785. element = $(element);var attributes = { }, t = Element._attributeTranslations.write;if (typeof name == 'object') attributes = name;else attributes[name] = Object.isUndefined(value) ? true : value;for (var attr in attributes) {
  786. name = t.names[attr] || attr;value = attributes[attr];if (t.values[attr]) name = t.values[attr](element, value);if (value === false || value === null)
  787. element.removeAttribute(name);else if (value === true)
  788. element.setAttribute(name, name);else element.setAttribute(name, value);}
  789. return element;},
  790. getHeight: function(element) {
  791. return $(element).getDimensions().height;},
  792. getWidth: function(element) {
  793. return $(element).getDimensions().width;},
  794. classNames: function(element) {
  795. return new Element.ClassNames(element);},
  796. hasClassName: function(element, className) {
  797. if (!(element = $(element))) return;var elementClassName = element.className;return (elementClassName.length > 0 && (elementClassName == className ||
  798. new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));},
  799. addClassName: function(element, className) {
  800. if (!(element = $(element))) return;if (!element.hasClassName(className))
  801. element.className += (element.className ? ' ' : '') + className;return element;},
  802. removeClassName: function(element, className) {
  803. if (!(element = $(element))) return;element.className = element.className.replace(
  804. new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();return element;},
  805. toggleClassName: function(element, className) {
  806. if (!(element = $(element))) return;return element[element.hasClassName(className) ?
  807. 'removeClassName' : 'addClassName'](className);},
  808. cleanWhitespace: function(element) {
  809. element = $(element);var node = element.firstChild;while (node) {
  810. var nextNode = node.nextSibling;if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
  811. element.removeChild(node);node = nextNode;}
  812. return element;},
  813. empty: function(element) {
  814. return $(element).innerHTML.blank();},
  815. descendantOf: function(element, ancestor) {
  816. element = $(element), ancestor = $(ancestor);var originalAncestor = ancestor;if (element.compareDocumentPosition)
  817. return (element.compareDocumentPosition(ancestor) & 8) === 8;if (element.sourceIndex && !Prototype.Browser.Opera) {
  818. var e = element.sourceIndex, a = ancestor.sourceIndex,
  819. nextAncestor = ancestor.nextSibling;if (!nextAncestor) {
  820. do { ancestor = ancestor.parentNode; }
  821. while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode);}
  822. if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex);}
  823. while (element = element.parentNode)
  824. if (element == originalAncestor) return true;return false;},
  825. scrollTo: function(element) {
  826. element = $(element);var pos = element.cumulativeOffset();window.scrollTo(pos[0], pos[1]);return element;},
  827. getStyle: function(element, style) {
  828. element = $(element);style = style == 'float' ? 'cssFloat' : style.camelize();var value = element.style[style];if (!value) {
  829. var css = document.defaultView.getComputedStyle(element, null);value = css ? css[style] : null;}
  830. if (style == 'opacity') return value ? parseFloat(value) : 1.0;return value == 'auto' ? null : value;},
  831. getOpacity: function(element) {
  832. return $(element).getStyle('opacity');},
  833. setStyle: function(element, styles) {
  834. element = $(element);var elementStyle = element.style, match;if (Object.isString(styles)) {
  835. element.style.cssText += ';' + styles;return styles.include('opacity') ?
  836. element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;}
  837. for (var property in styles)
  838. if (property == 'opacity') element.setOpacity(styles[property]);else
  839. elementStyle[(property == 'float' || property == 'cssFloat') ?
  840. (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
  841. property] = styles[property];return element;},
  842. setOpacity: function(element, value) {
  843. element = $(element);element.style.opacity = (value == 1 || value === '') ? '' :
  844. (value < 0.00001) ? 0 : value;return element;},
  845. getDimensions: function(element) {
  846. element = $(element);var display = $(element).getStyle('display');if (display != 'none' && display != null) // Safari bug
  847. return {width: element.offsetWidth, height: element.offsetHeight};var els = element.style;var originalVisibility = els.visibility;var originalPosition = els.position;var originalDisplay = els.display;els.visibility = 'hidden';els.position = 'absolute';els.display = 'block';var originalWidth = element.clientWidth;var originalHeight = element.clientHeight;els.display = originalDisplay;els.position = originalPosition;els.visibility = originalVisibility;return {width: originalWidth, height: originalHeight};},
  848. makePositioned: function(element) {
  849. element = $(element);var pos = Element.getStyle(element, 'position');if (pos == 'static' || !pos) {
  850. element._madePositioned = true;element.style.position = 'relative';if (window.opera) {
  851. element.style.top = 0;element.style.left = 0;}
  852. }
  853. return element;},
  854. undoPositioned: function(element) {
  855. element = $(element);if (element._madePositioned) {
  856. element._madePositioned = undefined;element.style.position =
  857. element.style.top =
  858. element.style.left =
  859. element.style.bottom =
  860. element.style.right = '';}
  861. return element;},
  862. makeClipping: function(element) {
  863. element = $(element);if (element._overflow) return element;element._overflow = Element.getStyle(element, 'overflow') || 'auto';if (element._overflow !== 'hidden')
  864. element.style.overflow = 'hidden';return element;},
  865. undoClipping: function(element) {
  866. element = $(element);if (!element._overflow) return element;element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;element._overflow = null;return element;},
  867. cumulativeOffset: function(element) {
  868. var valueT = 0, valueL = 0;do {
  869. valueT += element.offsetTop || 0;valueL += element.offsetLeft || 0;element = element.offsetParent;} while (element);return Element._returnOffset(valueL, valueT);},
  870. positionedOffset: function(element) {
  871. var valueT = 0, valueL = 0;do {
  872. valueT += element.offsetTop || 0;valueL += element.offsetLeft || 0;element = element.offsetParent;if (element) {
  873. if (element.tagName == 'BODY') break;var p = Element.getStyle(element, 'position');if (p == 'relative' || p == 'absolute') break;}
  874. } while (element);return Element._returnOffset(valueL, valueT);},
  875. absolutize: function(element) {
  876. element = $(element);if (element.getStyle('position') == 'absolute') return;var offsets = element.positionedOffset();var top = offsets[1];var left = offsets[0];var width = element.clientWidth;var height = element.clientHeight;element._originalLeft = left - parseFloat(element.style.left || 0);element._originalTop = top - parseFloat(element.style.top || 0);element._originalWidth = element.style.width;element._originalHeight = element.style.height;element.style.position = 'absolute';element.style.top = top + 'px';e

Large files files are truncated, but you can click here to view the full file