1/* Prototype JavaScript framework, version 1.7 2 * (c) 2005-2010 Sam Stephenson 3 * 4 * Prototype is freely distributable under the terms of an MIT-style license. 5 * For details, see the Prototype web site: http://www.prototypejs.org/ 6 * 7 *--------------------------------------------------------------------------*/ 8 9var Prototype = { 10 11 Version: '1.7', 12 13 Browser: (function(){ 14 var ua = navigator.userAgent; 15 var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]'; 16 return { 17 IE: !!window.attachEvent && !isOpera, 18 Opera: isOpera, 19 WebKit: ua.indexOf('AppleWebKit/') > -1, 20 Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1, 21 MobileSafari: /Apple.*Mobile/.test(ua) 22 } 23 })(), 24 25 BrowserFeatures: { 26 XPath: !!document.evaluate, 27 28 SelectorsAPI: !!document.querySelector, 29 30 ElementExtensions: (function() { 31 var constructor = window.Element || window.HTMLElement; 32 return !!(constructor && constructor.prototype); 33 })(), 34 SpecificElementExtensions: (function() { 35 if (typeof window.HTMLDivElement !== 'undefined') 36 return true; 37 38 var div = document.createElement('div'), 39 form = document.createElement('form'), 40 isSupported = false; 41 42 if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) { 43 isSupported = true; 44 } 45 46 div = form = null; 47 48 return isSupported; 49 })() 50 }, 51 52 ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>', 53 JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, 54 55 emptyFunction: function() { }, 56 57 K: function(x) { return x } 58}; 59 60if (Prototype.Browser.MobileSafari) 61 Prototype.BrowserFeatures.SpecificElementExtensions = false; 62 63 64var Abstract = { }; 65 66 67var Try = { 68 these: function() { 69 var returnValue; 70 71 for (var i = 0, length = arguments.length; i < length; i++) { 72 var lambda = arguments[i]; 73 try { 74 returnValue = lambda(); 75 break; 76 } catch (e) { } 77 } 78 79 return returnValue; 80 } 81}; 82 83/* Based on Alex Arnell's inheritance implementation. */ 84 85var Class = (function() { 86 87 var IS_DONTENUM_BUGGY = (function(){ 88 for (var p in { toString: 1 }) { 89 if (p === 'toString') return false; 90 } 91 return true; 92 })(); 93 94 function subclass() {}; 95 function create() { 96 var parent = null, properties = $A(arguments); 97 if (Object.isFunction(properties[0])) 98 parent = properties.shift(); 99 100 function klass() { 101 this.initialize.apply(this, arguments); 102 } 103 104 Object.extend(klass, Class.Methods); 105 klass.superclass = parent; 106 klass.subclasses = []; 107 108 if (parent) { 109 subclass.prototype = parent.prototype; 110 klass.prototype = new subclass; 111 parent.subclasses.push(klass); 112 } 113 114 for (var i = 0, length = properties.length; i < length; i++) 115 klass.addMethods(properties[i]); 116 117 if (!klass.prototype.initialize) 118 klass.prototype.initialize = Prototype.emptyFunction; 119 120 klass.prototype.constructor = klass; 121 return klass; 122 } 123 124 function addMethods(source) { 125 var ancestor = this.superclass && this.superclass.prototype, 126 properties = Object.keys(source); 127 128 if (IS_DONTENUM_BUGGY) { 129 if (source.toString != Object.prototype.toString) 130 properties.push("toString"); 131 if (source.valueOf != Object.prototype.valueOf) 132 properties.push("valueOf"); 133 } 134 135 for (var i = 0, length = properties.length; i < length; i++) { 136 var property = properties[i], value = source[property]; 137 if (ancestor && Object.isFunction(value) && 138 value.argumentNames()[0] == "$super") { 139 var method = value; 140 value = (function(m) { 141 return function() { return ancestor[m].apply(this, arguments); }; 142 })(property).wrap(method); 143 144 value.valueOf = method.valueOf.bind(method); 145 value.toString = method.toString.bind(method); 146 } 147 this.prototype[property] = value; 148 } 149 150 return this; 151 } 152 153 return { 154 create: create, 155 Methods: { 156 addMethods: addMethods 157 } 158 }; 159})(); 160(function() { 161 162 var _toString = Object.prototype.toString, 163 NULL_TYPE = 'Null', 164 UNDEFINED_TYPE = 'Undefined', 165 BOOLEAN_TYPE = 'Boolean', 166 NUMBER_TYPE = 'Number', 167 STRING_TYPE = 'String', 168 OBJECT_TYPE = 'Object', 169 FUNCTION_CLASS = '[object Function]', 170 BOOLEAN_CLASS = '[object Boolean]', 171 NUMBER_CLASS = '[object Number]', 172 STRING_CLASS = '[object String]', 173 ARRAY_CLASS = '[object Array]', 174 DATE_CLASS = '[object Date]', 175 NATIVE_JSON_STRINGIFY_SUPPORT = window.JSON && 176 typeof JSON.stringify === 'function' && 177 JSON.stringify(0) === '0' && 178 typeof JSON.stringify(Prototype.K) === 'undefined'; 179 180 function Type(o) { 181 switch(o) { 182 case null: return NULL_TYPE; 183 case (void 0): return UNDEFINED_TYPE; 184 } 185 var type = typeof o; 186 switch(type) { 187 case 'boolean': return BOOLEAN_TYPE; 188 case 'number': return NUMBER_TYPE; 189 case 'string': return STRING_TYPE; 190 } 191 return OBJECT_TYPE; 192 } 193 194 function extend(destination, source) { 195 for (var property in source) 196 destination[property] = source[property]; 197 return destination; 198 } 199 200 function inspect(object) { 201 try { 202 if (isUndefined(object)) return 'undefined'; 203 if (object === null) return 'null';
204 return object.inspect ? object.inspect() : String(object); 205 } catch (e) { 206 if (e instanceof RangeError) return '...'; 207 throw e; 208 } 209 } 210 211 function toJSON(value) { 212 return Str('', { '': value }, []); 213 } 214 215 function Str(key, holder, stack) { 216 var value = holder[key], 217 type = typeof value; 218 219 if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') { 220 value = value.toJSON(key); 221 } 222 223 var _class = _toString.call(value); 224 225 switch (_class) { 226 case NUMBER_CLASS: 227 case BOOLEAN_CLASS: 228 case STRING_CLASS: 229 value = value.valueOf(); 230 } 231 232 switch (value) { 233 case null: return 'null'; 234 case true: return 'true'; 235 case false: return 'false'; 236 } 237 238 type = typeof value; 239 switch (type) { 240 case 'string': 241 return value.inspect(true); 242 case 'number': 243 return isFinite(value) ? String(value) : 'null'; 244 case 'object': 245 246 for (var i = 0, length = stack.length; i < length; i++) { 247 if (stack[i] === value) { throw new TypeError(); } 248 } 249 stack.push(value); 250 251 var partial = []; 252 if (_class === ARRAY_CLASS) { 253 for (var i = 0, length = value.length; i < length; i++) { 254 var str = Str(i, value, stack); 255 partial.push(typeof str === 'undefined' ? 'null' : str); 256 } 257 partial = '[' + partial.join(',') + ']'; 258 } else { 259 var keys = Object.keys(value); 260 for (var i = 0, length = keys.length; i < length; i++) { 261 var key = keys[i], str = Str(key, value, stack); 262 if (typeof str !== "undefined") { 263 partial.push(key.inspect(true)+ ':' + str); 264 } 265 } 266 partial = '{' + partial.join(',') + '}'; 267 } 268 stack.pop(); 269 return partial; 270 } 271 } 272 273 function stringify(object) { 274 return JSON.stringify(object); 275 } 276 277 function toQueryString(object) { 278 return $H(object).toQueryString(); 279 } 280 281 function toHTML(object) { 282 return object && object.toHTML ? object.toHTML() : String.interpret(object); 283 } 284 285 function keys(object) { 286 if (Type(object) !== OBJECT_TYPE) { throw new TypeError(); } 287 var results = []; 288 for (var property in object) { 289 if (object.hasOwnProperty(property)) { 290 results.push(property); 291 } 292 } 293 return results; 294 } 295 296 function values(object) { 297 var results = []; 298 for (var property in object) 299 results.push(object[property]); 300 return results; 301 } 302 303 function clone(object) { 304 return extend({ }, object); 305 } 306 307 function isElement(object) { 308 return !!(object && object.nodeType == 1); 309 } 310 311 function isArray(object) { 312 return _toString.call(object) === ARRAY_CLASS; 313 } 314 315 var hasNativeIsArray = (typeof Array.isArray == 'function') 316 && Array.isArray([]) && !Array.isArray({}); 317 318 if (hasNativeIsArray) { 319 isArray = Array.isArray; 320 } 321 322 function isHash(object) { 323 return object instanceof Hash; 324 } 325 326 function isFunction(object) { 327 return _toString.call(object) === FUNCTION_CLASS; 328 } 329 330 function isString(object) { 331 return _toString.call(object) === STRING_CLASS; 332 } 333 334 function isNumber(object) { 335 return _toString.call(object) === NUMBER_CLASS; 336 } 337 338 function isDate(object) { 339 return _toString.call(object) === DATE_CLASS; 340 } 341 342 function isUndefined(object) { 343 return typeof object === "undefined"; 344 } 345 346 extend(Object, { 347 extend: extend, 348 inspect: inspect, 349 toJSON: NATIVE_JSON_STRINGIFY_SUPPORT ? stringify : toJSON, 350 toQueryString: toQueryString, 351 toHTML: toHTML, 352 keys: Object.keys || keys, 353 values: values, 354 clone: clone, 355 isElement: isElement, 356 isArray: isArray, 357 isHash: isHash, 358 isFunction: isFunction, 359 isString: isString, 360 isNumber: isNumber, 361 isDate: isDate, 362 isUndefined: isUndefined 363 }); 364})(); 365Object.extend(Function.prototype, (function() { 366 var slice = Array.prototype.slice; 367 368 function update(array, args) { 369 var arrayLength = array.length, length = args.length; 370 while (length--) array[arrayLength + length] = args[length]; 371 return array; 372 } 373 374 function merge(array, args) { 375 array = slice.call(array, 0); 376 return update(array, args); 377 } 378 379 function argumentNames() {
380 var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1] 381 .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '') 382 .replace(/\s+/g, '').split(','); 383 return names.length == 1 && !names[0] ? [] : names; 384 } 385 386 function bind(context) { 387 if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this; 388 var __method = this, args = slice.call(arguments, 1); 389 return function() { 390 var a = merge(args, arguments); 391 return __method.apply(context, a); 392 } 393 } 394 395 function bindAsEventListener(context) { 396 var __method = this, args = slice.call(arguments, 1); 397 return function(event) { 398 var a = update([event || window.event], args); 399 return __method.apply(context, a); 400 } 401 } 402 403 function curry() { 404 if (!arguments.length) return this; 405 var __method = this, args = slice.call(arguments, 0); 406 return function() { 407 var a = merge(args, arguments); 408 return __method.apply(this, a); 409 } 410 } 411 412 function delay(timeout) { 413 var __method = this, args = slice.call(arguments, 1); 414 timeout = timeout * 1000; 415 return window.setTimeout(function() { 416 return __method.apply(__method, args); 417 }, timeout); 418 } 419 420 function defer() { 421 var args = update([0.01], arguments); 422 return this.delay.apply(this, args); 423 } 424 425 function wrap(wrapper) { 426 var __method = this; 427 return function() { 428 var a = update([__method.bind(this)], arguments); 429 return wrapper.apply(this, a); 430 } 431 } 432 433 function methodize() { 434 if (this._methodized) return this._methodized; 435 var __method = this; 436 return this._methodized = function() { 437 var a = update([this], arguments); 438 return __method.apply(null, a); 439 }; 440 } 441 442 return { 443 argumentNames: argumentNames, 444 bind: bind, 445 bindAsEventListener: bindAsEventListener, 446 curry: curry, 447 delay: delay, 448 defer: defer, 449 wrap: wrap, 450 methodize: methodize 451 } 452})()); 453 454 455 456(function(proto) { 457 458 459 function toISOString() { 460 return this.getUTCFullYear() + '-' + 461 (this.getUTCMonth() + 1).toPaddedString(2) + '-' + 462 this.getUTCDate().toPaddedString(2) + 'T' + 463 this.getUTCHours().toPaddedString(2) + ':' + 464 this.getUTCMinutes().toPaddedString(2) + ':' + 465 this.getUTCSeconds().toPaddedString(2) + 'Z'; 466 } 467 468 469 function toJSON() { 470 return this.toISOString(); 471 } 472 473 if (!proto.toISOString) proto.toISOString = toISOString; 474 if (!proto.toJSON) proto.toJSON = toJSON; 475 476})(Date.prototype); 477 478 479RegExp.prototype.match = RegExp.prototype.test; 480 481RegExp.escape = function(str) { 482 return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); 483}; 484var PeriodicalExecuter = Class.create({ 485 initialize: function(callback, frequency) { 486 this.callback = callback; 487 this.frequency = frequency; 488 this.currentlyExecuting = false; 489 490 this.registerCallback(); 491 }, 492 493 registerCallback: function() { 494 this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); 495 }, 496 497 execute: function() { 498 this.callback(this); 499 }, 500 501 stop: function() { 502 if (!this.timer) return; 503 clearInterval(this.timer); 504 this.timer = null; 505 }, 506 507 onTimerEvent: function() { 508 if (!this.currentlyExecuting) { 509 try { 510 this.currentlyExecuting = true; 511 this.execute(); 512 this.currentlyExecuting = false; 513 } catch(e) { 514 this.currentlyExecuting = false; 515 throw e; 516 } 517 } 518 } 519}); 520Object.extend(String, { 521 interpret: function(value) { 522 return value == null ? '' : String(value); 523 }, 524 specialChar: { 525 '\b': '\\b', 526 '\t': '\\t', 527 '\n': '\\n', 528 '\f': '\\f', 529 '\r': '\\r', 530 '\\': '\\\\' 531 } 532}); 533 534Object.extend(String.prototype, (function() { 535 var NATIVE_JSON_PARSE_SUPPORT = window.JSON && 536 typeof JSON.parse === 'function' && 537 JSON.parse('{"test": true}').test; 538 539 function prepareReplacement(replacement) { 540 if (Object.isFunction(replacement)) return replacement; 541 var template = new Template(replacement); 542 return function(match) { return template.evaluate(match) }; 543 } 544 545 function gsub(pattern, replacement) { 546 var result = '', source = this, match; 547 replacement = prepareReplacement(replacement); 548 549 if (Object.isString(pattern)) 550 pattern = RegExp.escape(pattern); 551 552 if (!(pattern.length || pattern.source)) { 553 replacement = replacement(''); 554 return replacement + source.split('').join(replacement) + replacement; 555 } 556 557 while (source.length > 0) { 558 if (match = source.match(pattern)) { 559 result += source.slice(0, match.index); 560 result += String.interpret(replacement(match)); 561 source = source.slice(match.index + match[0].length); 562 } else { 563 result += source, source = ''; 564 } 565 } 566 return result; 567 } 568 569 function sub(pattern, replacement, count) { 570 replacement = prepareReplacement(replacement); 571 count = Object.isUndefined(count) ? 1 : count; 572 573 return this.gsub(pattern, function(match) { 574 if (--count < 0) return match[0]; 575 return replacement(match); 576 }); 577 } 578 579 function scan(pattern, iterator) { 580 this.gsub(pattern, iterator); 581 return String(this); 582 } 583 584 function truncate(length, truncation) { 585 length = length || 30; 586 truncation = Object.isUndefined(truncation) ? '...' : truncation; 587 return this.length > length ? 588 this.slice(0, length - truncation.length) + truncation : String(this); 589 } 590 591 function strip() { 592 return this.replace(/^\s+/, '').replace(/\s+$/, ''); 593 } 594 595 function stripTags() { 596 return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, ''); 597 } 598 599 function stripScripts() { 600 return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); 601 } 602 603 function extractScripts() { 604 var matchAll = new RegExp(Prototype.ScriptFragment, 'img'), 605 matchOne = new RegExp(Prototype.ScriptFragment, 'im'); 606 return (this.match(matchAll) || []).map(function(scriptTag) { 607 return (scriptTag.match(matchOne) || ['', ''])[1]; 608 }); 609 } 610 611 function evalScripts() { 612 return this.extractScripts().map(function(script) { return eval(script) }); 613 } 614 615 function escapeHTML() { 616 return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); 617 } 618 619 function unescapeHTML() { 620 return this.stripTags().replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&'); 621 } 622 623 624 function toQueryParams(separator) { 625 var match = this.strip().match(/([^?#]*)(#.*)?$/); 626 if (!match) return { }; 627 628 return match[1].split(separator || '&').inject({ }, function(hash, pair) { 629 if ((pair = pair.split('='))[0]) { 630 var key = decodeURIComponent(pair.shift()), 631 value = pair.length > 1 ? pair.join('=') : pair[0]; 632 633 if (value != undefined) value = decodeURIComponent(value); 634 635 if (key in hash) { 636 if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; 637 hash[key].push(value); 638 } 639 else hash[key] = value; 640 } 641 return hash; 642 }); 643 } 644 645 function toArray() { 646 return this.split(''); 647 } 648 649 function succ() { 650 return this.slice(0, this.length - 1) + 651 String.fromCharCode(this.charCodeAt(this.length - 1) + 1); 652 } 653 654 function times(count) { 655 return count < 1 ? '' : new Array(count + 1).join(this); 656 } 657 658 function camelize() { 659 return this.replace(/-+(.)?/g, function(match, chr) { 660 return chr ? chr.toUpperCase() : ''; 661 }); 662 } 663 664 function capitalize() { 665 return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); 666 } 667 668 function underscore() { 669 return this.replace(/::/g, '/') 670 .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') 671 .replace(/([a-z\d])([A-Z])/g, '$1_$2') 672 .replace(/-/g, '_') 673 .toLowerCase(); 674 } 675 676 function dasherize() { 677 return this.replace(/_/g, '-'); 678 } 679 680 function inspect(useDoubleQuotes) { 681 var escapedString = this.replace(/[\x00-\x1f\\]/g, function(ch
681aracter) { 682 if (character in String.specialChar) { 683 return String.specialChar[character]; 684 } 685 return '\\u00' + character.charCodeAt().toPaddedString(2, 16); 686 }); 687 if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; 688 return "'" + escapedString.replace(/'/g, '\\\'') + "'"; 689 } 690 691 function unfilterJSON(filter) { 692 return this.replace(filter || Prototype.JSONFilter, '$1'); 693 } 694 695 function isJSON() { 696 var str = this; 697 if (str.blank()) return false; 698 str = str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'); 699 str = str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'); 700 str = str.replace(/(?:^|:|,)(?:\s*\[)+/g, ''); 701 return (/^[\],:{}\s]*$/).test(str); 702 } 703 704 function evalJSON(sanitize) { 705 var json = this.unfilterJSON(), 706 cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; 707 if (cx.test(json)) { 708 json = json.replace(cx, function (a) { 709 return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 710 }); 711 } 712 try { 713 if (!sanitize || json.isJSON()) return eval('(' + json + ')'); 714 } catch (e) { } 715 throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); 716 } 717 718 function parseJSON() { 719 var json = this.unfilterJSON(); 720 return JSON.parse(json); 721 } 722 723 function include(pattern) { 724 return this.indexOf(pattern) > -1; 725 } 726 727 function startsWith(pattern) { 728 return this.lastIndexOf(pattern, 0) === 0; 729 } 730 731 function endsWith(pattern) { 732 var d = this.length - pattern.length; 733 return d >= 0 && this.indexOf(pattern, d) === d; 734 } 735 736 function empty() { 737 return this == ''; 738 } 739 740 function blank() { 741 return /^\s*$/.test(this); 742 } 743 744 function interpolate(object, pattern) { 745 return new Template(this, pattern).evaluate(object); 746 } 747 748 return { 749 gsub: gsub, 750 sub: sub, 751 scan: scan, 752 truncate: truncate, 753 strip: String.prototype.trim || strip, 754 stripTags: stripTags, 755 stripScripts: stripScripts, 756 extractScripts: extractScripts, 757 evalScripts: evalScripts, 758 escapeHTML: escapeHTML, 759 unescapeHTML: unescapeHTML, 760 toQueryParams: toQueryParams, 761 parseQuery: toQueryParams, 762 toArray: toArray, 763 succ: succ, 764 times: times, 765 camelize: camelize, 766 capitalize: capitalize, 767 underscore: underscore, 768 dasherize: dasherize, 769 inspect: inspect, 770 unfilterJSON: unfilterJSON, 771 isJSON: isJSON, 772 evalJSON: NATIVE_JSON_PARSE_SUPPORT ? parseJSON : evalJSON, 773 include: include, 774 startsWith: startsWith, 775 endsWith: endsWith, 776 empty: empty, 777 blank: blank, 778 interpolate: interpolate 779 }; 780})()); 781 782var Template = Class.create({ 783 initialize: function(template, pattern) { 784 this.template = template.toString(); 785 this.pattern = pattern || Template.Pattern; 786 }, 787 788 evaluate: function(object) { 789 if (object && Object.isFunction(object.toTemplateReplacements)) 790 object = object.toTemplateReplacements(); 791 792 return this.template.gsub(this.pattern, function(match) { 793 if (object == null) return (match[1] + ''); 794 795 var before = match[1] || ''; 796 if (before == '\\') return match[2]; 797 798 var ctx = object, expr = match[3], 799 pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; 800 801 match = pattern.exec(expr); 802 if (match == null) return before; 803 804 while (match != null) { 805 var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1]; 806 ctx = ctx[comp]; 807 if (null == ctx || '' == match[3]) break; 808 expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); 809 match = pattern.exec(expr); 810 } 811 812 return before + String.interpret(ctx); 813 }); 814 } 815}); 816Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; 817 818var $break = { }; 819 820var Enumerable = (function() { 821 function each(iterator, context) { 822 var index = 0; 823 try { 824 this._each(function(value) { 825 iterator.call(context, value, index++); 826 }); 827 } catch (e) { 828 if (e != $break) throw e; 829 } 830 return this; 831 } 832 833 function eachSlice(number, iterator, context) {
834 var index = -number, slices = [], array = this.toArray(); 835 if (number < 1) return array; 836 while ((index += number) < array.length) 837 slices.push(array.slice(index, index+number)); 838 return slices.collect(iterator, context); 839 } 840 841 function all(iterator, context) { 842 iterator = iterator || Prototype.K; 843 var result = true; 844 this.each(function(value, index) { 845 result = result && !!iterator.call(context, value, index); 846 if (!result) throw $break; 847 }); 848 return result; 849 } 850 851 function any(iterator, context) { 852 iterator = iterator || Prototype.K; 853 var result = false; 854 this.each(function(value, index) { 855 if (result = !!iterator.call(context, value, index)) 856 throw $break; 857 }); 858 return result; 859 } 860 861 function collect(iterator, context) { 862 iterator = iterator || Prototype.K; 863 var results = []; 864 this.each(function(value, index) { 865 results.push(iterator.call(context, value, index)); 866 }); 867 return results; 868 } 869 870 function detect(iterator, context) { 871 var result; 872 this.each(function(value, index) { 873 if (iterator.call(context, value, index)) { 874 result = value; 875 throw $break; 876 } 877 }); 878 return result; 879 } 880 881 function findAll(iterator, context) { 882 var results = []; 883 this.each(function(value, index) { 884 if (iterator.call(context, value, index)) 885 results.push(value); 886 }); 887 return results; 888 } 889 890 function grep(filter, iterator, context) { 891 iterator = iterator || Prototype.K; 892 var results = []; 893 894 if (Object.isString(filter)) 895 filter = new RegExp(RegExp.escape(filter)); 896 897 this.each(function(value, index) { 898 if (filter.match(value)) 899 results.push(iterator.call(context, value, index)); 900 }); 901 return results; 902 } 903 904 function include(object) { 905 if (Object.isFunction(this.indexOf)) 906 if (this.indexOf(object) != -1) return true; 907 908 var found = false; 909 this.each(function(value) { 910 if (value == object) { 911 found = true; 912 throw $break; 913 } 914 }); 915 return found; 916 } 917 918 function inGroupsOf(number, fillWith) { 919 fillWith = Object.isUndefined(fillWith) ? null : fillWith; 920 return this.eachSlice(number, function(slice) { 921 while(slice.length < number) slice.push(fillWith); 922 return slice; 923 }); 924 } 925 926 function inject(memo, iterator, context) { 927 this.each(function(value, index) { 928 memo = iterator.call(context, memo, value, index); 929 }); 930 return memo; 931 } 932 933 function invoke(method) { 934 var args = $A(arguments).slice(1); 935 return this.map(function(value) { 936 return value[method].apply(value, args); 937 }); 938 } 939 940 function max(iterator, context) { 941 iterator = iterator || Prototype.K; 942 var result; 943 this.each(function(value, index) { 944 value = iterator.call(context, value, index); 945 if (result == null || value >= result) 946 result = value; 947 }); 948 return result; 949 } 950 951 function min(iterator, context) { 952 iterator = iterator || Prototype.K; 953 var result; 954 this.each(function(value, index) { 955 value = iterator.call(context, value, index); 956 if (result == null || value < result) 957 result = value; 958 }); 959 return result; 960 } 961 962 function partition(iterator, context) { 963 iterator = iterator || Prototype.K; 964 var trues = [], falses = []; 965 this.each(function(value, index) { 966 (iterator.call(context, value, index) ? 967 trues : falses).push(value); 968 }); 969 return [trues, falses]; 970 } 971 972 function pluck(property) { 973 var results = []; 974 this.each(function(value) { 975 results.push(value[property]); 976 }); 977 return results; 978 } 979 980 function reject(iterator, context) { 981 var results = []; 982 this.each(function(value, index) { 983 if (!iterator.call(context, value, index)) 984 results.push(value); 985 }); 986 return results; 987 } 988 989 function sortBy(iterator, context) { 990 return this.map(function(value, index) { 991 return { 992 value: value, 993 criteria: iterator.call(context, value, index) 994 }; 995 }).sort(function(left, right) { 996 var a = left.criteria, b = right.criteria; 997 return a < b ? -1 : a > b ? 1 : 0; 998 }).pluck('value'); 999 } 1000 1001 function toArray() { 1002 return this.map(); 1003 } 1004 1005 function zip() { 1006 var iterator = Prototype.K, args = $A(arguments); 1007 if (Object.isFunction(args.last())) 1008 iterator = args.pop(); 1009 1010 var collections = [this].concat(args).map($A); 1011 return this.map(function(value, index) { 1012 return iterator(collections.pluck(index)); 1013 }); 1014 } 1015 1016 function size() { 1017 return this.toArray().length; 1018 } 1019 1020 function inspect() { 1021 return '#<Enumerable:' + this.toArray().inspect() + '>'; 1022 } 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 return { 1033 each: each, 1034 eachSlice: eachSlice, 1035 all: all, 1036 every: all, 1037 any: any, 1038 some: any, 1039 collect: collect, 1040 map: collect, 1041 detect: detect, 1042 findAll: findAll, 1043 select: findAll, 1044 filter: findAll, 1045 grep: grep, 1046 include: include, 1047 member: include, 1048 inGroupsOf: inGroupsOf, 1049 inject: inject, 1050 invoke: invoke, 1051 max: max, 1052 min: min, 1053 partition: partition, 1054 pluck: pluck, 1055 reject: reject, 1056 sortBy: sortBy, 1057 toArray: toArray, 1058 entries: toArray, 1059 zip: zip, 1060 size: size, 1061 inspect: inspect, 1062 find: detect
1063 }; 1064})(); 1065 1066function $A(iterable) { 1067 if (!iterable) return []; 1068 if ('toArray' in Object(iterable)) return iterable.toArray(); 1069 var length = iterable.length || 0, results = new Array(length); 1070 while (length--) results[length] = iterable[length]; 1071 return results; 1072} 1073 1074 1075function $w(string) { 1076 if (!Object.isString(string)) return []; 1077 string = string.strip(); 1078 return string ? string.split(/\s+/) : []; 1079} 1080 1081Array.from = $A; 1082 1083 1084(function() { 1085 var arrayProto = Array.prototype, 1086 slice = arrayProto.slice, 1087 _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available 1088 1089 function each(iterator, context) { 1090 for (var i = 0, length = this.length >>> 0; i < length; i++) { 1091 if (i in this) iterator.call(context, this[i], i, this); 1092 } 1093 } 1094 if (!_each) _each = each; 1095 1096 function clear() { 1097 this.length = 0; 1098 return this; 1099 } 1100 1101 function first() { 1102 return this[0]; 1103 } 1104 1105 function last() { 1106 return this[this.length - 1]; 1107 } 1108 1109 function compact() { 1110 return this.select(function(value) { 1111 return value != null; 1112 }); 1113 } 1114 1115 function flatten() { 1116 return this.inject([], function(array, value) { 1117 if (Object.isArray(value)) 1118 return array.concat(value.flatten()); 1119 array.push(value); 1120 return array; 1121 }); 1122 } 1123 1124 function without() { 1125 var values = slice.call(arguments, 0); 1126 return this.select(function(value) { 1127 return !values.include(value); 1128 }); 1129 } 1130 1131 function reverse(inline) { 1132 return (inline === false ? this.toArray() : this)._reverse(); 1133 } 1134 1135 function uniq(sorted) { 1136 return this.inject([], function(array, value, index) { 1137 if (0 == index || (sorted ? array.last() != value : !array.include(value))) 1138 array.push(value); 1139 return array; 1140 }); 1141 } 1142 1143 function intersect(array) { 1144 return this.uniq().findAll(function(item) { 1145 return array.detect(function(value) { return item === value }); 1146 }); 1147 } 1148 1149 1150 function clone() { 1151 return slice.call(this, 0); 1152 } 1153 1154 function size() { 1155 return this.length; 1156 } 1157 1158 function inspect() { 1159 return '[' + this.map(Object.inspect).join(', ') + ']'; 1160 } 1161 1162 function indexOf(item, i) { 1163 i || (i = 0); 1164 var length = this.length; 1165 if (i < 0) i = length + i; 1166 for (; i < length; i++) 1167 if (this[i] === item) return i; 1168 return -1; 1169 } 1170 1171 function lastIndexOf(item, i) { 1172 i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; 1173 var n = this.slice(0, i).reverse().indexOf(item); 1174 return (n < 0) ? n : i - n - 1; 1175 } 1176 1177 function concat() { 1178 var array = slice.call(this, 0), item; 1179 for (var i = 0, length = arguments.length; i < length; i++) { 1180 item = arguments[i]; 1181 if (Object.isArray(item) && !('callee' in item)) { 1182 for (var j = 0, arrayLength = item.length; j < arrayLength; j++) 1183 array.push(item[j]); 1184 } else { 1185 array.push(item); 1186 } 1187 } 1188 return array; 1189 } 1190 1191 Object.extend(arrayProto, Enumerable); 1192 1193 if (!arrayProto._reverse) 1194 arrayProto._reverse = arrayProto.reverse; 1195 1196 Object.extend(arrayProto, { 1197 _each: _each, 1198 clear: clear, 1199 first: first, 1200 last: last, 1201 compact: compact, 1202 flatten: flatten, 1203 without: without, 1204 reverse: reverse, 1205 uniq: uniq, 1206 intersect: intersect, 1207 clone: clone, 1208 toArray: clone, 1209 size: size, 1210 inspect: inspect 1211 }); 1212 1213 var CONCAT_ARGUMENTS_BUGGY = (function() { 1214 return [].concat(arguments)[0][0] !== 1; 1215 })(1,2) 1216 1217 if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat; 1218 1219 if (!arrayProto.indexOf) arrayProto.indexOf = indexOf; 1220 if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf; 1221})(); 1222function $H(object) { 1223 return new Hash(object); 1224}; 1225 1226var Hash = Class.create(Enumerable, (function() { 1227 function initialize(object) { 1228 this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); 1229 } 1230 1231 1232 function _each(iterator) { 1233 for (var key in this._object) { 1234 var value = this._object[key], pair = [key, value]; 1235 pair.key = key; 1236 pair.value = value; 1237 iterator(pair); 1238 } 1239 } 1240 1241 function set(key, value) { 1242 return this._object[key] = value; 1243 } 1244 1245 function get(key) { 1246 if (this._object[key] !== Object.prototype[key]) 1247 return this._object[key]; 1248 } 1249 1250 function unset(key) { 1251 var value = this._object[key]; 1252 delete this._object[key]; 1253 return value; 1254 } 1255 1256 function toObject() { 1257 return Object.clone(this._object); 1258 } 1259 1260 1261 1262 function keys() { 1263 return this.pluck('key'); 1264 } 1265 1266 function values() { 1267 return this.pluck('value'); 1268 } 1269 1270 function index(value) { 1271 var match = this.detect(function(pair) { 1272 return pair.value === value; 1273 }); 1274 return match && match.key; 1275 } 1276 1277 function merge(object) { 1278 return this.clone().update(object); 1279 } 1280 1281 function update(object) { 1282 return new Hash(object).inject(this, function(result, pair) { 1283 result.set(pair.key, pair.value); 1284 return result; 1285 }); 1286 } 1287 1288 function toQueryPair(key, value) { 1289 if (Object.isUndefined(value)) return key; 1290 return key + '=' + encodeURIComponent(String.interpret(value)); 1291 } 1292 1293 function toQueryString() { 1294 return this.inject([], function(results, pair) { 1295 var key = encodeURIComponent(pair.key), values = pair.value; 1296 1297 if (values && typeof values == 'object') { 1298 if (Object.isArray(values)) { 1299 var queryValues = []; 1300 for (var i = 0, len = values.length, value; i < len; i++) { 1301 value = values[i]; 1302 queryValues.push(toQueryPair(key, value)); 1303 } 1304 return results.concat(queryValues); 1305 } 1306 } else results.push(toQueryPair(key, values)); 1307 return results; 1308 }).join('&'); 1309 } 1310 1311 function inspect() { 1312 return '#<Hash:{' + this.map(function(pair) { 1313 return pair.map(Object.inspect).join(': '); 1314 }).join(', ') + '}>'; 1315 } 1316 1317 function clone() { 1318 return new Hash(this); 1319 } 1320 1321 return { 1322 initialize: initialize, 1323 _each: _each, 1324 set: set, 1325 get: get, 1326 unset: unset, 1327 toObject: toObject, 1328 toTemplateReplacements: toObject, 1329 keys: keys, 1330 values: values, 1331 index: index, 1332 merge: merge, 1333 update: update, 1334 toQueryString: toQueryString, 1335 inspect: inspect, 1336 toJSON: toObject, 1337 clone: clone 1338 }; 1339})()); 1340 1341Hash.from = $H; 1342Object.extend(Number.prototype, (function() { 1343 function toColorPart() { 1344 return this.toPaddedString(2, 16); 1345 } 1346 1347 function succ() { 1348 return this + 1; 1349 } 1350 1351 function times(iterator, context) { 1352 $R(0, this, true).each(iterator, context); 1353 return this; 1354 } 1355 1356 function toPaddedString(length, radix) { 1357 var string = this.toString(radix || 10); 1358 return '0'.times(length - string.length) + string; 1359 } 1360 1361 function abs() { 1362 return Math.abs(this); 1363 } 1364 1365 function round() { 1366 return Math.round(this); 1367 } 1368 1369 function ceil() { 1370 return Math.ceil(this); 1371 } 1372 1373 function floor() { 1374 return Math.floor(this); 1375 } 1376 1377 return { 1378 toColorPart: toColorPart, 1379 succ: succ, 1380 times: times, 1381 toPaddedString: toPaddedString, 1382 abs: abs, 1383 round: round, 1384 ceil: ceil, 1385 floor: floor 1386 }; 1387})()); 1388 1389function $R(start, end, exclusive) { 1390 return new ObjectRange(start, end, exclusive); 1391} 1392 1393var ObjectRange = Class.create(Enumerable, (function() { 1394 function initialize(start, end, exclusive) { 1395 this.start = start; 1396 this.end = end; 1397 this.exclusive = exclusive; 1398 } 1399 1400 function _each(iterator) { 1401 var value = this.start; 1402 while (this.include(value)) { 1403 iterator(value); 1404 value = value.succ(); 1405 } 1406 } 1407 1408 function include(value) { 1409 if (value < this.start) 1410 return false;
1411 if (this.exclusive) 1412 return value < this.end; 1413 return value <= this.end; 1414 } 1415 1416 return { 1417 initialize: initialize, 1418 _each: _each, 1419 include: include 1420 }; 1421})()); 1422 1423 1424 1425var Ajax = { 1426 getTransport: function() { 1427 return Try.these( 1428 function() {return new XMLHttpRequest()}, 1429 function() {return new ActiveXObject('Msxml2.XMLHTTP')}, 1430 function() {return new ActiveXObject('Microsoft.XMLHTTP')} 1431 ) || false; 1432 }, 1433 1434 activeRequestCount: 0 1435}; 1436 1437Ajax.Responders = { 1438 responders: [], 1439 1440 _each: function(iterator) { 1441 this.responders._each(iterator); 1442 }, 1443 1444 register: function(responder) { 1445 if (!this.include(responder)) 1446 this.responders.push(responder); 1447 }, 1448 1449 unregister: function(responder) { 1450 this.responders = this.responders.without(responder); 1451 }, 1452 1453 dispatch: function(callback, request, transport, json) { 1454 this.each(function(responder) { 1455 if (Object.isFunction(responder[callback])) { 1456 try { 1457 responder[callback].apply(responder, [request, transport, json]); 1458 } catch (e) { } 1459 } 1460 }); 1461 } 1462}; 1463 1464Object.extend(Ajax.Responders, Enumerable); 1465 1466Ajax.Responders.register({ 1467 onCreate: function() { Ajax.activeRequestCount++ },
1468 onComplete: function() { Ajax.activeRequestCount-- } 1469}); 1470Ajax.Base = Class.create({ 1471 initialize: function(options) { 1472 this.options = { 1473 method: 'post', 1474 asynchronous: true, 1475 contentType: 'application/x-www-form-urlencoded', 1476 encoding: 'UTF-8', 1477 parameters: '', 1478 evalJSON: true, 1479 evalJS: true 1480 }; 1481 Object.extend(this.options, options || { }); 1482 1483 this.options.method = this.options.method.toLowerCase(); 1484 1485 if (Object.isHash(this.options.parameters)) 1486 this.options.parameters = this.options.parameters.toObject(); 1487 } 1488}); 1489Ajax.Request = Class.create(Ajax.Base, { 1490 _complete: false, 1491 1492 initialize: function($super, url, options) { 1493 $super(options); 1494 this.transport = Ajax.getTransport(); 1495 this.request(url); 1496 }, 1497 1498 request: function(url) { 1499 this.url = url; 1500 this.method = this.options.method; 1501 var params = Object.isString(this.options.parameters) ? 1502 this.options.parameters : 1503 Object.toQueryString(this.options.parameters); 1504 1505 if (!['get', 'post'].include(this.method)) { 1506 params += (params ? '&' : '') + "_method=" + this.method; 1507 this.method = 'post'; 1508 } 1509 1510 if (params && this.method === 'get') { 1511 this.url += (this.url.include('?') ? '&' : '?') + params; 1512 } 1513 1514 this.parameters = params.toQueryParams(); 1515 1516 try { 1517 var response = new Ajax.Response(this); 1518 if (this.options.onCreate) this.options.onCreate(response); 1519 Ajax.Responders.dispatch('onCreate', this, response); 1520 1521 this.transport.open(this.method.toUpperCase(), this.url, 1522 this.options.asynchronous); 1523 1524 if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); 1525 1526 this.transport.onreadystatechange = this.onStateChange.bind(this); 1527 this.setRequestHeaders(); 1528 1529 this.body = this.method == 'post' ? (this.options.postBody || params) : null; 1530 this.transport.send(this.body); 1531 1532 /* Force Firefox to handle ready state 4 for synchronous requests */ 1533 if (!this.options.asynchronous && this.transport.overrideMimeType) 1534 this.onStateChange(); 1535 1536 } 1537 catch (e) { 1538 this.dispatchException(e); 1539 } 1540 }, 1541 1542 onStateChange: function() { 1543 var readyState = this.transport.readyState; 1544 if (readyState > 1 && !((readyState == 4) && this._complete)) 1545 this.respondToReadyState(this.transport.readyState); 1546 }, 1547 1548 setRequestHeaders: function() { 1549 var headers = { 1550 'X-Requested-With': 'XMLHttpRequest', 1551 'X-Prototype-Version': Prototype.Version, 1552 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' 1553 }; 1554 1555 if (this.method == 'post') { 1556 headers['Content-type'] = this.options.contentType + 1557 (this.options.encoding ? '; charset=' + this.options.encoding : ''); 1558 1559 /* Force "Connection: close" for older Mozilla browsers to work 1560 * around a bug where XMLHttpRequest sends an incorrect 1561 * Content-length header. See Mozilla Bugzilla #246651. 1562 */ 1563 if (this.transport.overrideMimeType && 1564 (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) 1565 headers['Connection'] = 'close'; 1566 } 1567 1568 if (typeof this.options.requestHeaders == 'object') { 1569 var extras = this.options.requestHeaders; 1570 1571 if (Object.isFunction(extras.push)) 1572 for (var i = 0, length = extras.length; i < length; i += 2) 1573 headers[extras[i]] = extras[i+1]; 1574 else 1575 $H(extras).each(function(pair) { headers[pair.key] = pair.value }); 1576 } 1577 1578 for (var name in headers) 1579 this.transport.setRequestHeader(name, headers[name]); 1580 }, 1581 1582 success: function() { 1583 var status = this.getStatus(); 1584 return !status || (status >= 200 && status < 300) || status == 304; 1585 }, 1586 1587 getStatus: function() { 1588 try { 1589 if (this.transport.status === 1223) return 204; 1590 return this.transport.status || 0; 1591 } catch (e) { return 0 } 1592 }, 1593 1594 respondToReadyState: function(readyState) { 1595 var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); 1596 1597 if (state == 'Complete') {
1598 try { 1599 this._complete = true; 1600 (this.options['on' + response.status] 1601 || this.options['on' + (this.success() ? 'Success' : 'Failure')] 1602 || Prototype.emptyFunction)(response, response.headerJSON); 1603 } catch (e) { 1604 this.dispatchException(e); 1605 } 1606 1607 var contentType = response.getHeader('Content-type'); 1608 if (this.options.evalJS == 'force' 1609 || (this.options.evalJS && this.isSameOrigin() && contentType 1610 && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) 1611 this.evalResponse(); 1612 } 1613 1614 try { 1615 (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); 1616 Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); 1617 } catch (e) { 1618 this.dispatchException(e); 1619 } 1620 1621 if (state == 'Complete') { 1622 this.transport.onreadystatechange = Prototype.emptyFunction; 1623 } 1624 }, 1625 1626 isSameOrigin: function() { 1627 var m = this.url.match(/^\s*https?:\/\/[^\/]*/); 1628 return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({ 1629 protocol: location.protocol, 1630 domain: document.domain, 1631 port: location.port ? ':' + location.port : '' 1632 })); 1633 }, 1634 1635 getHeader: function(name) { 1636 try { 1637 return this.transport.getResponseHeader(name) || null; 1638 } catch (e) { return null; } 1639 }, 1640 1641 evalResponse: function() { 1642 try { 1643 return eval((this.transport.responseText || '').unfilterJSON()); 1644 } catch (e) { 1645 this.dispatchException(e); 1646 } 1647 }, 1648 1649 dispatchException: function(exception) { 1650 (this.options.onException || Prototype.emptyFunction)(this, exception); 1651 Ajax.Responders.dispatch('onException', this, exception); 1652 } 1653}); 1654 1655Ajax.Request.Events = 1656 ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; 1657 1658 1659 1660 1661 1662 1663 1664 1665Ajax.Response = Class.create({ 1666 initialize: function(request){ 1667 this.request = request; 1668 var transport = this.transport = request.transport, 1669 readyState = this.readyState = transport.readyState; 1670 1671 if ((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { 1672 this.status = this.getStatus(); 1673 this.statusText = this.getStatusText(); 1674 this.responseText = String.interpret(transport.responseText); 1675 this.headerJSON = this._getHeaderJSON(); 1676 } 1677 1678 if (readyState == 4) { 1679 var xml = transport.responseXML; 1680 this.responseXML = Object.isUndefined(xml) ? null : xml; 1681 this.responseJSON = this._getResponseJSON(); 1682 } 1683 }, 1684 1685 status: 0, 1686 1687 statusText: '', 1688 1689 getStatus: Ajax.Request.prototype.getStatus, 1690 1691 getStatusText: function() { 1692 try { 1693 return this.transport.statusText || ''; 1694 } catch (e) { return '' } 1695 }, 1696 1697 getHeader: Ajax.Request.prototype.getHeader, 1698 1699 getAllHeaders: function() { 1700 try { 1701 return this.getAllResponseHeaders(); 1702 } catch (e) { return null } 1703 }, 1704 1705 getResponseHeader: function(name) { 1706 return this.transport.getResponseHeader(name); 1707 }, 1708 1709 getAllResponseHeaders: function() { 1710 return this.transport.getAllResponseHeaders(); 1711 }, 1712 1713 _getHeaderJSON: function() { 1714 var json = this.getHeader('X-JSON'); 1715 if (!json) return null; 1716 json = decodeURIComponent(escape(json)); 1717 try { 1718 return json.evalJSON(this.request.options.sanitizeJSON || 1719 !this.request.isSameOrigin()); 1720 } catch (e) { 1721 this.request.dispatchException(e); 1722 } 1723 }, 1724 1725 _getResponseJSON: function() { 1726 var options = this.request.options; 1727 if (!options.evalJSON || (options.evalJSON != 'force' && 1728 !(this.getHeader('Content-type') || '').include('application/json')) || 1729 this.responseText.blank()) 1730 return null; 1731 try { 1732 return this.responseText.evalJSON(options.sanitizeJSON || 1733 !this.request.isSameOrigin()); 1734 } catch (e) { 1735 this.request.dispatchException(e); 1736 } 1737 } 1738}); 1739 1740Ajax.Updater = Class.create(Ajax.Request, { 1741 initialize: function($super, container, url, options) { 1742 this.container = { 1743 success: (container.success || container), 1744 failure: (container.failure || (container.success ? null : container)) 1745 }; 1746 1747 options = Object.clone(options); 1748 var onComplete = options.onComplete; 1749 options.onComplete = (function(response, json) { 1750 this.updateContent(response.responseText); 1751 if (Object.isFunction(onComplete)) onComplete(response, json); 1752 }).bind(this); 1753 1754 $super(url, options); 1755 }, 1756 1757 updateContent: function(responseText) { 1758 var receiver = this.container[this.success() ? 'success' : 'failure'], 1759 options = this.options; 1760 1761 if (!options.evalScripts) responseText = responseText.stripScripts(); 1762 1763 if (receiver = $(receiver)) { 1764 if (options.insertion) { 1765 if (Object.isString(options.insertion)) { 1766 var insertion = { }; insertion[options.insertion] = responseText; 1767 receiver.insert(insertion); 1768 } 1769 else options.insertion(receiver, responseText); 1770 } 1771 else receiver.update(responseText); 1772 } 1773 } 1774}); 1775
1776Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { 1777 initialize: function($super, container, url, options) { 1778 $super(options); 1779 this.onComplete = this.options.onComplete; 1780 1781 this.frequency = (this.options.frequency || 2); 1782 this.decay = (this.options.decay || 1); 1783 1784 this.updater = { }; 1785 this.container = container; 1786 this.url = url; 1787 1788 this.start(); 1789 }, 1790 1791 start: function() { 1792 this.options.onComplete = this.updateComplete.bind(this); 1793 this.onTimerEvent(); 1794 }, 1795 1796 stop: function() { 1797 this.updater.options.onComplete = undefined; 1798 clearTimeout(this.timer); 1799 (this.onComplete || Prototype.emptyFunction).apply(this, arguments); 1800 }, 1801 1802 updateComplete: function(response) { 1803 if (this.options.decay) { 1804 this.decay = (response.responseText == this.lastText ? 1805 this.decay * this.options.decay : 1); 1806 1807 this.lastText = response.responseText; 1808 } 1809 this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); 1810 }, 1811 1812 onTimerEvent: function() { 1813 this.updater = new Ajax.Updater(this.container, this.url, this.options); 1814 } 1815}); 1816 1817 1818function $(element) { 1819 if (arguments.length > 1) { 1820 for (var i = 0, elements = [], length = arguments.length; i < length; i++) 1821 elements.push($(arguments[i])); 1822 return elements; 1823 } 1824 if (Object.isString(element)) 1825 element = document.getElementById(element); 1826 return Element.extend(element); 1827} 1828 1829if (Prototype.BrowserFeatures.XPath) { 1830 document._getElementsByXPath = function(expression, parentElement) { 1831 var results = []; 1832 var query = document.evaluate(expression, $(parentElement) || document, 1833 null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 1834 for (var i = 0, length = query.snapshotLength; i < length; i++) 1835 results.push(Element.extend(query.snapshotItem(i))); 1836 return results; 1837 }; 1838} 1839 1840/*--------------------------------------------------------------------------*/ 1841 1842if (!Node) var Node = { }; 1843 1844if (!Node.ELEMENT_NODE) { 1845 Object.extend(Node, { 1846 ELEMENT_NODE: 1, 1847 ATTRIBUTE_NODE: 2, 1848 TEXT_NODE: 3, 1849 CDATA_SECTION_NODE: 4, 1850 ENTITY_REFERENCE_NODE: 5, 1851 ENTITY_NODE: 6, 1852 PROCESSING_INSTRUCTION_NODE: 7, 1853 COMMENT_NODE: 8, 1854 DOCUMENT_NODE: 9, 1855 DOCUMENT_TYPE_NODE: 10, 1856 DOCUMENT_FRAGMENT_NODE: 11, 1857 NOTATION_NODE: 12 1858 }); 1859} 1860 1861 1862 1863(function(global) { 1864 function shouldUseCache(tagName, attributes) { 1865 if (tagName === 'select') return false; 1866 if ('type' in attributes) return false; 1867 return true; 1868 } 1869 1870 var HAS_EXTENDED_CREATE_ELEMENT_SYNTAX = (function(){ 1871 try { 1872 var el = document.createElement('<input name="x">'); 1873 return el.tagName.toLowerCase() === 'input' && el.name === 'x'; 1874 } 1875 catch(err) { 1876 return false; 1877 } 1878 })(); 1879 1880 var element = global.Element; 1881 1882 global.Element = function(tagName, attributes) { 1883 attributes = attributes || { }; 1884 tagName = tagName.toLowerCase(); 1885 var cache = Element.cache; 1886 1887 if (HAS_EXTENDED_CREATE_ELEMENT_SYNTAX && attributes.name) { 1888 tagName = '<' + tagName + ' name="' + attributes.name + '">'; 1889 delete attributes.name; 1890 return Element.writeAttribute(document.createElement(tagName), attributes); 1891 } 1892 1893 if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName)); 1894 1895 var node = shouldUseCache(tagName, attributes) ? 1896 cache[tagName].cloneNode(false) : document.createElement(tagName); 1897 1898 return Element.writeAttribute(node, attributes); 1899 }; 1900 1901 Object.extend(global.Element, element || { }); 1902 if (element) global.Element.prototype = element.prototype; 1903 1904})(this); 1905 1906Element.idCounter = 1; 1907Element.cache = { }; 1908 1909Element._purgeElement = function(element) { 1910 var uid = element._prototypeUID; 1911 if (uid) { 1912 Element.stopObserving(element); 1913 element._prototypeUID = void 0; 1914 delete Element.Storage[uid]; 1915 } 1916} 1917 1918Element.Methods = { 1919 visible: function(element) { 1920 return $(element).style.display != 'none'; 1921 }, 1922 1923 toggle: function(element) { 1924 element = $(element); 1925 Element[Element.visible(element) ? 'hide' : 'show'](element); 1926 return element; 1927 }, 1928 1929 hide: function(element) { 1930 element = $(element); 1931 element.style.display = 'none'; 1932 return element; 1933 }, 1934 1935 show: function(element) { 1936 element = $(element); 1937 element.style.display = ''; 1938 return element; 1939 }, 1940 1941 remove: function(element) { 1942 element = $(element); 1943 element.parentNode.removeChild(element); 1944 return element; 1945 }, 1946 1947 update: (function(){ 1948 1949 var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){ 1950 var el = document.createElement("select"), 1951 isBuggy = true; 1952 el.innerHTML = "<option value=\"test\">test</option>"; 1953 if (el.options && el.options[0]) { 1954 isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION"; 1955 } 1956 el = null; 1957 return isBuggy; 1958 })(); 1959 1960 var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){
1961 try { 1962 var el = document.createElement("table"); 1963 if (el && el.tBodies) { 1964 el.innerHTML = "<tbody><tr><td>test</td></tr></tbody>"; 1965 var isBuggy = typeof el.tBodies[0] == "undefined"; 1966 el = null; 1967 return isBuggy; 1968 } 1969 } catch (e) { 1970 return true; 1971 } 1972 })(); 1973 1974 var LINK_ELEMENT_INNERHTML_BUGGY = (function() { 1975 try { 1976 var el = document.createElement('div'); 1977 el.innerHTML = "<link>"; 1978 var isBuggy = (el.childNodes.length === 0); 1979 el = null; 1980 return isBuggy; 1981 } catch(e) { 1982 return true; 1983 } 1984 })(); 1985 1986 var ANY_INNERHTML_BUGGY = SELECT_ELEMENT_INNERHTML_BUGGY || 1987 TABLE_ELEMENT_INNERHTML_BUGGY || LINK_ELEMENT_INNERHTML_BUGGY; 1988 1989 var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () { 1990 var s = document.createElement("script"), 1991 isBuggy = false; 1992 try { 1993 s.appendChild(document.createTextNode("")); 1994 isBuggy = !s.firstChild || 1995 s.firstChild && s.firstChild.nodeType !== 3; 1996 } catch (e) { 1997 isBuggy = true; 1998 } 1999 s = null; 2000 return isBuggy; 2001 })(); 2002 2003 2004 function update(element, content) { 2005 element = $(element); 2006 var purgeElement = Element._purgeElement; 2007 2008 var descendants = element.getElementsByTagName('*'), 2009 i = descendants.length; 2010 while (i--) purgeElement(descendants[i]); 2011 2012 if (content && content.toElement) 2013 content = content.toElement(); 2014 2015 if (Object.isElement(content)) 2016 return element.update().insert(content); 2017 2018 content = Object.toHTML(content); 2019 2020 var tagName = element.tagName.toUpperCase(); 2021 2022 if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) { 2023 element.text = content; 2024 return element; 2025 } 2026 2027 if (ANY_INNERHTML_BUGGY) { 2028 if (tagName in Element._insertionTranslations.tags) { 2029 while (element.firstChild) { 2030 element.removeChild(element.firstChild); 2031 } 2032 Element._getContentFromAnonymousElement(tagName, content.stripScripts()) 2033 .each(function(node) { 2034 element.appendChild(node) 2035 }); 2036 } else if (LINK_ELEMENT_INNERHTML_BUGGY && Object.isString(content) && content.indexOf('<link') > -1) { 2037 while (element.firstChild) { 2038 element.removeChild(element.firstChild); 2039 } 2040 var nodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts(), true); 2041 nodes.each(function(node) { element.appendChild(node) }); 2042 } 2043 else { 2044 element.innerHTML = content.stripScripts(); 2045 } 2046 } 2047 else { 2048 element.innerHTML = content.stripScripts(); 2049 } 2050 2051 content.evalScripts.bind(content).defer(); 2052 return element; 2053 } 2054 2055 return update; 2056 })(), 2057 2058 replace: function(element, content) { 2059 element = $(element); 2060 if (content && content.toElement) content = content.toElement(); 2061 else if (!Object.isElement(content)) { 2062 content = Object.toHTML(content); 2063 var range = element.ownerDocument.createRange(); 2064 range.selectNode(element); 2065 content.evalScripts.bind(content).defer(); 2066 content = range.createContextualFragment(content.stripScripts()); 2067 } 2068 element.parentNode.replaceChild(content, element); 2069 return element; 2070 }, 2071 2072 insert: function(element, insertions) { 2073 element = $(element); 2074 2075 if (Object.isString(insertions) || Object.isNumber(insertions) || 2076 Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) 2077 insertions = {bottom:insertions}; 2078 2079 var content, insert, tagName, childNodes; 2080 2081 for (var position in insertions) { 2082 content = insertions[position]; 2083 position = position.toLowerCase(); 2084 insert = Element._insertionTranslations[position]; 2085 2086 if (content && content.toElement) content = content.toElement(); 2087 if (Object.isElement(content)) { 2088 insert(element, content); 2089 continue; 2090 } 2091 2092 content = Object.toHTML(content); 2093 2094 tagName = ((position == 'before' || position == 'after') 2095 ? element.parentNode : element).tagName.toUpperCase(); 2096 2097 childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); 2098 2099 if (position == 'top' || position == 'after') childNodes.reverse(); 2100 childNodes.each(insert.curry(element)); 2101 2102 content.evalScripts.bind(content).defer(); 2103 } 2104 2105 return element; 2106 }, 2107 2108 wrap: function(element, wrapper, attributes) { 2109 element = $(element); 2110 if (Object.isElement(wrapper)) 2111 $(wrapper).writeAttribute(attributes || { }); 2112 else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes); 2113 else wrapper = new Element('div', wrapper); 2114 if (element.parentNode) 2115 element.parentNode.replaceChild(wrapper, element); 2116 wrapper.appendChild(element); 2117 return wrapper; 2118 }, 2119 2120 inspect: function(element) { 2121 element = $(element); 2122 var result = '<' + element.tagName.toLowerCase(); 2123 $H({'id': 'id', 'className': 'class'}).each(function(pair) { 2124 var property = pair.first(), 2125 attribute = pair.last(), 2126 value = (element[property] || '').toString(); 2127 if (value) result += ' ' + attribute + '=' + value.inspect(true); 2128 }); 2129 return result + '>'; 2130 }, 2131 2132 recursivelyCollect: function(element, property, maximumLength) { 2133 element = $(element); 2134 maximumLength = maximumLength || -1; 2135 var elements = []; 2136 2137 while (element = element[property]) { 2138 if (element.nodeType == 1) 2139 elements.push(Element.extend(element)); 2140 if (elements.length == maximumLength) 2141 break; 2142 } 2143 2144 return elements; 2145 }, 2146 2147 ancestors: function(element) { 2148 return Element.recursivelyCollect(element, 'parentNode'); 2149 }, 2150 2151 descendants: function(element) { 2152 return Element.select(element, "*"); 2153 }, 2154 2155 firstDescendant: function(element) { 2156 element = $(element).firstChild; 2157 while (element && element.nodeType != 1) element = element.nextSibling; 2158 return $(element); 2159 }, 2160 2161 immediateDescendants: function(element) { 2162 var results = [], child = $(element).firstChild; 2163 while (child) { 2164 if (child.nodeType === 1) { 2165 results.push(Element.extend(child)); 2166 } 2167 child = child.nextSibling; 2168 } 2169 return results; 2170 }, 2171 2172 previousSiblings: function(element, maximumLength) { 2173 return Element.recursivelyCollect(element, 'previousSibling'); 2174 }, 2175 2176 nextSiblings: function(element) { 2177 return Element.recursivelyCollect(element, 'nextSibling'); 2178 }, 2179 2180 siblings: function(element) { 2181 element = $(element); 2182 return Element.previousSiblings(element).reverse() 2183 .concat(Element.nextSiblings(element)); 2184 }, 2185 2186 match: function(element, selector) { 2187 element = $(element); 2188 if (Object.isString(selector)) 2189 return Prototype.Selector.match(element, selector); 2190 return selector.match(element); 2191 }, 2192 2193 up: function(element, expression, index) { 2194 element = $(element); 2195 if (arguments.length == 1) return $(element.parentNode); 2196 var ancestors = Element.ancestors(element); 2197 return Object.isNumber(expression) ? ancestors[expression] : 2198 Prototype.Selector.find(ancestors, expression, index); 2199 }, 2200 2201 down: function(element, expression, index) { 2202 element = $(element); 2203 if (arguments.length == 1) return Element.firstDescendant(element); 2204 return Object.isNumber(expression) ? Element.descendants(element)[expression] : 2205 Element.select(element, expression)[index || 0]; 2206 }, 2207 2208 previous: function(element, expression, index) { 2209 element = $(element); 2210 if (Object.isNumber(expression)) index = expression, expression = false;
2211 if (!Object.isNumber(index)) index = 0; 2212 2213 if (expression) { 2214 return Prototype.Selector.find(element.previousSiblings(), expression, index); 2215 } else { 2216 return element.recursivelyCollect("previousSibling", index + 1)[index]; 2217 } 2218 }, 2219 2220 next: function(element, expression, index) { 2221 element = $(element); 2222 if (Object.isNumber(expression)) index = expression, expression = false; 2223 if (!Object.isNumber(index)) index = 0; 2224 2225 if (expression) { 2226 return Prototype.Selector.find(element.nextSiblings(), expression, index); 2227 } else { 2228 var maximumLength = Object.isNumber(index) ? index + 1 : 1; 2229 return element.recursivelyCollect("nextSibling", index + 1)[index]; 2230 } 2231 }, 2232 2233 2234 select: function(element) { 2235 element = $(element); 2236 var expressions = Array.prototype.slice.call(arguments, 1).join(', '); 2237 return Prototype.Selector.select(expressions, element); 2238 }, 2239 2240 adjacent: function(element) { 2241 element = $(element); 2242 var expressions = Array.prototype.slice.call(arguments, 1).join(', '); 2243 return Prototype.Selector.select(expressions, element.parentNode).without(element); 2244 }, 2245 2246 identify: function(element) { 2247 element = $(element); 2248 var id = Element.readAttribute(element, 'id'); 2249 if (id) return id; 2250 do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id)); 2251 Element.writeAttribute(element, 'id', id); 2252 return id; 2253 }, 2254 2255 readAttribute: function(element, name) { 2256 element = $(element); 2257 if (Prototype.Browser.IE) { 2258 var t = Element._attributeTranslations.read; 2259 if (t.values[name]) return t.values[name](element, name); 2260 if (t.names[name]) name = t.names[name]; 2261 if (name.include(':')) { 2262 return (!element.attributes || !element.attributes[name]) ? null : 2263 element.attributes[name].value; 2264 } 2265 } 2266 return element.getAttribute(name); 2267 }, 2268 2269 writeAttribute: function(element, name, value) { 2270 element = $(element); 2271 var attributes = { }, t = Element._attributeTranslations.write; 2272 2273 if (typeof name == 'object') attributes = name; 2274 else attributes[name] = Object.isUndefined(value) ? true : value; 2275 2276 for (var attr in attributes) { 2277 name = t.names[attr] || attr; 2278 value = attributes[attr]; 2279 if (t.values[attr]) name = t.values[attr](element, value); 2280 if (value === false || value === null) 2281 element.removeAttribute(name); 2282 else if (value === true) 2283 element.setAttribute(name, name); 2284 else element.setAttribute(name, value); 2285 } 2286 return element; 2287 }, 2288 2289 getHeight: function(element) { 2290 return Element.getDimensions(element).height; 2291 }, 2292 2293 getWidth: function(element) { 2294 return Element.getDimensions(element).width; 2295 }, 2296 2297 classNames: function(element) { 2298 return new Element.ClassNames(element); 2299 }, 2300 2301 hasClassName: function(element, className) { 2302 if (!(element = $(element))) return; 2303 var elementClassName = element.className; 2304 return (elementClassName.length > 0 && (elementClassName == className || 2305 new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); 2306 }, 2307 2308 addClassName: function(element, className) { 2309 if (!(element = $(element))) return; 2310 if (!Element.hasClassName(element, className)) 2311 element.className += (element.className ? ' ' : '') + className; 2312 return element; 2313 }, 2314 2315 removeClassName: function(element, className) { 2316 if (!(element = $(element))) return; 2317 element.className = element.className.replace( 2318 new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); 2319 return element; 2320 }, 2321 2322 toggleClassName: function(element, className) { 2323 if (!(element = $(element))) return; 2324 return Element[Element.hasClassName(element, className) ? 2325 'removeClassName' : 'addClassName'](element, className); 2326 }, 2327 2328 cleanWhitespace: function(element) { 2329 element = $(element); 2330 var node = element.firstChild; 2331 while (node) { 2332 var nextNode = node.nextSibling; 2333 if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) 2334 element.removeChild(node); 2335 node = nextNode; 2336 } 2337 return element; 2338 }, 2339 2340 empty: function(element) { 2341 return $(element).innerHTML.blank(); 2342 }, 2343 2344 descendantOf: function(element, ancestor) { 2345 element = $(element), ancestor = $(ancestor); 2346 2347 if (element.compareDocumentPosition) 2348 return (element.compareDocumentPosition(ancestor) & 8) === 8; 2349 2350 if (ancestor.contains) 2351 return ancestor.contains(element) && ancestor !== element; 2352 2353 while (element = element.parentNode) 2354 if (element == ancestor) return true; 2355 2356 return false;
2357 }, 2358 2359 scrollTo: function(element) { 2360 element = $(element); 2361 var pos = Element.cumulativeOffset(element); 2362 window.scrollTo(pos[0], pos[1]); 2363 return element; 2364 }, 2365 2366 getStyle: function(element, style) { 2367 element = $(element); 2368 style = style == 'float' ? 'cssFloat' : style.camelize(); 2369 var value = element.style[style]; 2370 if (!value || value == 'auto') { 2371 var css = document.defaultView.getComputedStyle(element, null); 2372 value = css ? css[style] : null; 2373 } 2374 if (style == 'opacity') return value ? parseFloat(value) : 1.0; 2375 return value == 'auto' ? null : value; 2376 }, 2377 2378 getOpacity: function(element) { 2379 return $(element).getStyle('opacity'); 2380 }, 2381 2382 setStyle: function(element, styles) { 2383 element = $(element); 2384 var elementStyle = element.style, match; 2385 if (Object.isString(styles)) { 2386 element.style.cssText += ';' + styles; 2387 return styles.include('opacity') ? 2388 element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element; 2389 } 2390 for (var property in styles) 2391 if (property == 'opacity') element.setOpacity(styles[property]); 2392 else 2393 elementStyle[(property == 'float' || property == 'cssFloat') ? 2394 (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') : 2395 property] = styles[property]; 2396 2397 return element; 2398 }, 2399 2400 setOpacity: function(element, value) { 2401 element = $(element); 2402 element.style.opacity = (value == 1 || value === '') ? '' : 2403 (value < 0.00001) ? 0 : value; 2404 return element; 2405 }, 2406 2407 makePositioned: function(element) { 2408 element = $(element); 2409 var pos = Element.getStyle(element, 'position'); 2410 if (pos == 'static' || !pos) { 2411 element._madePositioned = true; 2412 element.style.position = 'relative'; 2413 if (Prototype.Browser.Opera) { 2414 element.style.top = 0; 2415 element.style.left = 0; 2416 } 2417 } 2418 return element; 2419 }, 2420 2421 undoPositioned: function(element) { 2422 element = $(element); 2423 if (element._madePositioned) { 2424 element._madePositioned = undefined; 2425 element.style.position = 2426 element.style.top = 2427 element.style.left = 2428 element.style.bottom = 2429 element.style.right = ''; 2430 } 2431 return element; 2432 }, 2433 2434 makeClipping: function(element) { 2435 element = $(element); 2436 if (element._overflow) return element; 2437 element._overflow = Element.getStyle(element, 'overflow') || 'auto'; 2438 if (element._overflow !== 'hidden') 2439 element.style.overflow = 'hidden'; 2440 return element; 2441 }, 2442 2443 undoClipping: function(element) { 2444 element = $(element); 2445 if (!element._overflow) return element; 2446 element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; 2447 element._overflow = null; 2448 return element; 2449 }, 2450 2451 clonePosition: function(element, source) { 2452 var options = Object.extend({ 2453 setLeft: true, 2454 setTop: true, 2455 setWidth: true, 2456 setHeight: true, 2457 offsetTop: 0, 2458 offsetLeft: 0 2459 }, arguments[2] || { }); 2460 2461 source = $(source); 2462 var p = Element.viewportOffset(source), delta = [0, 0], parent = null; 2463 2464 element = $(element); 2465 2466 if (Element.getStyle(element, 'position') == 'absolute') { 2467 parent = Element.getOffsetParent(element); 2468 delta = Element.viewportOffset(parent); 2469 } 2470 2471 if (parent == document.body) { 2472 delta[0] -= document.body.offsetLeft; 2473 delta[1] -= document.body.offsetTop; 2474 } 2475 2476 if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; 2477 if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; 2478 if (options.setWidth) element.style.width = source.offsetWidth + 'px'; 2479 if (options.setHeight) element.style.height = source.offsetHeight + 'px'; 2480 return element; 2481 } 2482}; 2483 2484Object.extend(Element.Methods, { 2485 getElementsBySelector: Element.Methods.select, 2486 2487 childElements: Element.Methods.immediateDescendants 2488}); 2489 2490Element._attributeTranslations = { 2491 write: { 2492 names: { 2493 className: 'class', 2494 htmlFor: 'for' 2495 }, 2496 values: { } 2497 } 2498}; 2499 2500if (Prototype.Browser.Opera) { 2501 Element.Methods.getStyle = Element.Methods.getStyle.wrap( 2502 function(proceed, element, style) { 2503 switch (style) { 2504 case 'height': case 'width': 2505 if (!Element.visible(element)) return null; 2506 2507 var dim = parseInt(proceed(element, style), 10); 2508 2509 if (dim !== element['offset' + style.capitalize()]) 2510 return dim + 'px'; 2511 2512 var properties; 2513 if (style === 'height') { 2514 properties = ['border-top-width', 'padding-top', 2515 'padding-bottom', 'border-bottom-width']; 2516 } 2517 else { 2518 properties = ['border-left-width', 'padding-left', 2519 'padding-right', 'border-right-width']; 2520 } 2521 return properties.inject(dim, function(memo, property) { 2522 var val = proceed(element, property); 2523 return val === null ? memo : memo - parseInt(val, 10); 2524 }) + 'px'; 2525 default: return proceed(element, style); 2526 } 2527 } 2528 ); 2529 2530 Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( 2531 function(proceed, element, attribute) { 2532 if (attribute === 'title') return element.title; 2533 return proceed(element, attribute); 2534 } 2535 ); 2536} 2537 2538else if (Prototype.Browser.IE) { 2539 Element.Methods.getStyle = function(element, style) { 2540 element = $(element); 2541 style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); 2542 var value = element.style[style]; 2543 if (!value && element.currentStyle) value = element.currentStyle[style]; 2544 2545 if (style == 'opacity') { 2546 if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) 2547 if (value[1]) return parseFloat(value[1]) / 100; 2548 return 1.0; 2549 } 2550 2551 if (value == 'auto') { 2552 if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) 2553 return element['offset' + style.capitalize()] + 'px'; 2554 return null; 2555 } 2556 return value; 2557 }; 2558 2559 Element.Methods.setOpacity = function(element, value) { 2560 function stripAlpha(filter){ 2561 return filter.replace(/alpha\([^\)]*\)/gi,''); 2562 } 2563 element = $(element); 2564 var currentStyle = element.currentStyle; 2565 if ((currentStyle && !currentStyle.hasLayout) || 2566 (!currentStyle && element.style.zoom == 'normal')) 2567 element.style.zoom = 1; 2568 2569 var filter = element.getStyle('filter'), style = element.style; 2570 if (value == 1 || value === '') { 2571 (filter = stripAlpha(filter)) ?
2572 style.filter = filter : style.removeAttribute('filter'); 2573 return element; 2574 } else if (value < 0.00001) value = 0; 2575 style.filter = stripAlpha(filter) + 2576 'alpha(opacity=' + (value * 100) + ')'; 2577 return element; 2578 }; 2579 2580 Element._attributeTranslations = (function(){ 2581 2582 var classProp = 'className', 2583 forProp = 'for', 2584 el = document.createElement('div'); 2585 2586 el.setAttribute(classProp, 'x'); 2587 2588 if (el.className !== 'x') { 2589 el.setAttribute('class', 'x'); 2590 if (el.className === 'x') { 2591 classProp = 'class'; 2592 } 2593 } 2594 el = null; 2595 2596 el = document.createElement('label'); 2597 el.setAttribute(forProp, 'x'); 2598 if (el.htmlFor !== 'x') { 2599 el.setAttribute('htmlFor', 'x'); 2600 if (el.htmlFor === 'x') { 2601 forProp = 'htmlFor'; 2602 } 2603 } 2604 el = null; 2605 2606 return { 2607 read: { 2608 names: { 2609 'class': classProp, 2610 'className': classProp, 2611 'for': forProp, 2612 'htmlFor': forProp 2613 }, 2614 values: { 2615 _getAttr: function(element, attribute) { 2616 return element.getAttribute(attribute); 2617 }, 2618 _getAttr2: function(element, attribute) { 2619 return element.getAttribute(attribute, 2); 2620 }, 2621 _getAttrNode: function(element, attribute) { 2622 var node = element.getAttributeNode(attribute); 2623 return node ? node.value : ""; 2624 }, 2625 _getEv: (function(){ 2626 2627 var el = document.createElement('div'), f; 2628 el.onclick = Prototype.emptyFunction; 2629 var value = el.getAttribute('onclick'); 2630 2631 if (String(value).indexOf('{') > -1) { 2632 f = function(element, attribute) { 2633 attribute = element.getAttribute(attribute); 2634 if (!attribute) return null; 2635 attribute = attribute.toString(); 2636 attribute = attribute.split('{')[1]; 2637 attribute = attribute.split('}')[0]; 2638 return attribute.strip(); 2639 }; 2640 } 2641 else if (value === '') { 2642 f = function(element, attribute) { 2643 attribute = element.getAttribute(attribute); 2644 if (!attribute) return null; 2645 return attribute.strip(); 2646 }; 2647 } 2648 el = null; 2649 return f; 2650 })(), 2651 _flag: function(element, attribute) { 2652 return $(element).hasAttribute(attribute) ? attribute : null; 2653 }, 2654 style: function(element) { 2655 return element.style.cssText.toLowerCase(); 2656 }, 2657 title: function(element) { 2658 return element.title; 2659 } 2660 } 2661 } 2662 } 2663 })(); 2664 2665 Element._attributeTranslations.write = { 2666 names: Object.extend({ 2667 cellpadding: 'cellPadding', 2668 cellspacing: 'cellSpacing' 2669 }, Element._attributeTranslations.read.names), 2670 values: { 2671 checked: function(element, value) { 2672 element.checked = !!value; 2673 }, 2674 2675 style: function(element, value) { 2676 element.style.cssText = value ? value : ''; 2677 } 2678 } 2679 }; 2680 2681 Element._attributeTranslations.has = {}; 2682 2683 $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + 2684 'encType maxLength readOnly longDesc frameBorder').each(function(attr) { 2685 Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; 2686 Element._attributeTranslations.has[attr.toLowerCase()] = attr; 2687 }); 2688 2689 (function(v) { 2690 Object.extend(v, { 2691 href: v._getAttr2, 2692 src: v._getAttr2, 2693 type: v._getAttr, 2694 action: v._getAttrNode, 2695 disabled: v._flag, 2696 checked: v._flag, 2697 readonly: v._flag, 2698 multiple: v._flag, 2699 onload: v._getEv, 2700 onunload: v._getEv, 2701 onclick: v._getEv, 2702 ondblclick: v._getEv, 2703 onmousedown: v._getEv, 2704 onmouseup: v._getEv, 2705 onmouseover: v._getEv, 2706 onmousemove: v._getEv, 2707 onmouseout: v._getEv, 2708 onfocus: v._getEv, 2709 onblur: v._getEv, 2710 onkeypress: v._getEv, 2711 onkeydown: v._getEv, 2712 onkeyup: v._getEv, 2713 onsubmit: v._getEv,
2714 onreset: v._getEv, 2715 onselect: v._getEv, 2716 onchange: v._getEv 2717 }); 2718 })(Element._attributeTranslations.read.values); 2719 2720 if (Prototype.BrowserFeatures.ElementExtensions) { 2721 (function() { 2722 function _descendants(element) { 2723 var nodes = element.getElementsByTagName('*'), results = []; 2724 for (var i = 0, node; node = nodes[i]; i++) 2725 if (node.tagName !== "!") // Filter out comment nodes. 2726 results.push(node); 2727 return results; 2728 } 2729 2730 Element.Methods.down = function(element, expression, index) { 2731 element = $(element); 2732 if (arguments.length == 1) return element.firstDescendant(); 2733 return Object.isNumber(expression) ? _descendants(element)[expression] : 2734 Element.select(element, expression)[index || 0]; 2735 } 2736 })(); 2737 } 2738 2739} 2740 2741else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { 2742 Element.Methods.setOpacity = function(element, value) { 2743 element = $(element); 2744 element.style.opacity = (value == 1) ? 0.999999 : 2745 (value === '') ? '' : (value < 0.00001) ? 0 : value; 2746 return element; 2747 }; 2748} 2749 2750else if (Prototype.Browser.WebKit) { 2751 Element.Methods.setOpacity = function(element, value) { 2752 element = $(element); 2753 element.style.opacity = (value == 1 || value === '') ? '' : 2754 (value < 0.00001) ? 0 : value; 2755 2756 if (value == 1) 2757 if (element.tagName.toUpperCase() == 'IMG' && element.width) { 2758 element.width++; element.width--; 2759 } else try { 2760 var n = document.createTextNode(' '); 2761 element.appendChild(n); 2762 element.removeChild(n); 2763 } catch (e) { } 2764 2765 return element; 2766 }; 2767} 2768 2769if ('outerHTML' in document.documentElement) { 2770 Element.Methods.replace = function(element, content) { 2771 element = $(element); 2772 2773 if (content && content.toElement) content = content.toElement(); 2774 if (Object.isElement(content)) { 2775 element.parentNode.replaceChild(content, element); 2776 return element; 2777 } 2778 2779 content = Object.toHTML(content); 2780 var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); 2781 2782 if (Element._insertionTranslations.tags[tagName]) { 2783 var nextSibling = element.next(), 2784 fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); 2785 parent.removeChild(element); 2786 if (nextSibling) 2787 fragments.each(function(node) { parent.insertBefore(node, nextSibling) }); 2788 else 2789 fragments.each(function(node) { parent.appendChild(node) }); 2790 } 2791 else element.outerHTML = content.stripScripts(); 2792 2793 content.evalScripts.bind(content).defer(); 2794 return element; 2795 }; 2796} 2797 2798Element._returnOffset = function(l, t) { 2799 var result = [l, t]; 2800 result.left = l; 2801 result.top = t; 2802 return result; 2803}; 2804 2805Element._getContentFromAnonymousElement = function(tagName, html, force) { 2806 var div = new Element('div'), 2807 t = Element._insertionTranslations.tags[tagName]; 2808 2809 var workaround = false; 2810 if (t) workaround = true; 2811 else if (force) { 2812 workaround = true; 2813 t = ['', '', 0]; 2814 } 2815 2816 if (workaround) { 2817 div.innerHTML = ' ' + t[0] + html + t[1]; 2818 div.removeChild(div.firstChild); 2819 for (var i = t[2]; i--; ) { 2820 div = div.firstChild; 2821 } 2822 } 2823 else { 2824 div.innerHTML = html; 2825 } 2826 return $A(div.childNodes); 2827}; 2828 2829Element._insertionTranslations = { 2830 before: function(element, node) { 2831 element.parentNode.insertBefore(node, element); 2832 }, 2833 top: function(element, node) { 2834 element.insertBefore(node, element.firstChild); 2835 }, 2836 bottom: function(element, node) { 2837 element.appendChild(node); 2838 }, 2839 after: function(element, node) { 2840 element.parentNode.insertBefore(node, element.nextSibling); 2841 }, 2842 tags: { 2843 TABLE: ['<table>', '</table>', 1], 2844 TBODY: ['<table><tbody>', '</tbody></table>', 2], 2845 TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3], 2846 TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4], 2847 SELECT: ['<select>', '</select>', 1] 2848 } 2849}; 2850 2851(function() { 2852 var tags = Element._insertionTranslations.tags; 2853 Object.extend(tags, { 2854 THEAD: tags.TBODY, 2855 TFOOT: tags.TBODY, 2856 TH: tags.TD 2857 }); 2858})(); 2859 2860Element.Methods.Simulated = { 2861 hasAttribute: function(element, attribute) { 2862 attribute = Element._attributeTranslations.has[attribute] || attribute; 2863 var node = $(element).getAttributeNode(attribute); 2864 return !!(node && node.specified); 2865 } 2866}; 2867 2868Element.Methods.ByTag = { }; 2869 2870Object.extend(Element, Element.Methods); 2871 2872(function(div) { 2873 2874 if (!Prototype.BrowserFeatures.ElementExtensions && div['__proto__']) { 2875 window.HTMLElement = { }; 2876 window.HTMLElement.prototype = div['__proto__']; 2877 Prototype.BrowserFeatures.ElementExtensions = true; 2878 } 2879 2880 div = null; 2881 2882})(document.createElement('div')); 2883 2884Element.extend = (function() { 2885 2886 function checkDeficiency(tagName) { 2887 if (typeof window.Element != 'undefined') { 2888 var proto = window.Element.prototype; 2889 if (proto) { 2890 var id = '_' + (Math.random()+'').slice(2), 2891 el = document.createElement(tagName); 2892 proto[id] = 'x'; 2893 var isBuggy = (el[id] !== 'x'); 2894 delete proto[id]; 2895 el = null; 2896 return isBuggy; 2897 } 2898 } 2899 return false;
2900 } 2901 2902 function extendElementWith(element, methods) { 2903 for (var property in methods) { 2904 var value = methods[property]; 2905 if (Object.isFunction(value) && !(property in element)) 2906 element[property] = value.methodize(); 2907 } 2908 } 2909 2910 var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object'); 2911 2912 if (Prototype.BrowserFeatures.SpecificElementExtensions) { 2913 if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) { 2914 return function(element) { 2915 if (element && typeof element._extendedByPrototype == 'undefined') { 2916 var t = element.tagName; 2917 if (t && (/^(?:object|applet|embed)$/i.test(t))) { 2918 extendElementWith(element, Element.Methods); 2919 extendElementWith(element, Element.Methods.Simulated); 2920 extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]); 2921 } 2922 } 2923 return element; 2924 } 2925 } 2926 return Prototype.K; 2927 } 2928 2929 var Methods = { }, ByTag = Element.Methods.ByTag; 2930 2931 var extend = Object.extend(function(element) { 2932 if (!element || typeof element._extendedByPrototype != 'undefined' || 2933 element.nodeType != 1 || element == window) return element; 2934 2935 var methods = Object.clone(Methods), 2936 tagName = element.tagName.toUpperCase(); 2937 2938 if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); 2939 2940 extendElementWith(element, methods); 2941 2942 element._extendedByPrototype = Prototype.emptyFunction; 2943 return element; 2944 2945 }, { 2946 refresh: function() { 2947 if (!Prototype.BrowserFeatures.ElementExtensions) { 2948 Object.extend(Methods, Element.Methods); 2949 Object.extend(Methods, Element.Methods.Simulated); 2950 } 2951 } 2952 }); 2953 2954 extend.refresh(); 2955 return extend; 2956})(); 2957 2958if (document.documentElement.hasAttribute) { 2959 Element.hasAttribute = function(element, attribute) { 2960 return element.hasAttribute(attribute); 2961 }; 2962} 2963else { 2964 Element.hasAttribute = Element.Methods.Simulated.hasAttribute; 2965} 2966 2967Element.addMethods = function(methods) { 2968 var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; 2969 2970 if (!methods) { 2971 Object.extend(Form, Form.Methods); 2972 Object.extend(Form.Element, Form.Element.Methods); 2973 Object.extend(Element.Methods.ByTag, { 2974 "FORM": Object.clone(Form.Methods), 2975 "INPUT": Object.clone(Form.Element.Methods), 2976 "SELECT": Object.clone(Form.Element.Methods), 2977 "TEXTAREA": Object.clone(Form.Element.Methods), 2978 "BUTTON": Object.clone(Form.Element.Methods) 2979 }); 2980 } 2981 2982 if (arguments.length == 2) { 2983 var tagName = methods; 2984 methods = arguments[1]; 2985 } 2986 2987 if (!tagName) Object.extend(Element.Methods, methods || { }); 2988 else { 2989 if (Object.isArray(tagName)) tagName.each(extend); 2990 else extend(tagName); 2991 } 2992 2993 function extend(tagName) { 2994 tagName = tagName.toUpperCase(); 2995 if (!Element.Methods.ByTag[tagName]) 2996 Element.Methods.ByTag[tagName] = { }; 2997 Object.extend(Element.Methods.ByTag[tagName], methods); 2998 } 2999 3000 function copy(methods, destination, onlyIfAbsent) { 3001 onlyIfAbsent = onlyIfAbsent || false; 3002 for (var property in methods) { 3003 var value = methods[property]; 3004 if (!Object.isFunction(value)) continue; 3005 if (!onlyIfAbsent || !(property in destination)) 3006 destination[property] = value.methodize(); 3007 } 3008 } 3009 3010 function findDOMClass(tagName) { 3011 var klass; 3012 var trans = { 3013 "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", 3014 "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", 3015 "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", 3016 "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", 3017 "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": 3018 "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": 3019 "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": 3020 "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": 3021 "FrameSet", "IFRAME": "IFrame" 3022 }; 3023 if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; 3024 if (window[klass]) return window[klass]; 3025 klass = 'HTML' + tagName + 'Element'; 3026 if (window[klass]) return window[klass];
3027 klass = 'HTML' + tagName.capitalize() + 'Element'; 3028 if (window[klass]) return window[klass]; 3029 3030 var element = document.createElement(tagName), 3031 proto = element['__proto__'] || element.constructor.prototype; 3032 3033 element = null; 3034 return proto; 3035 } 3036 3037 var elementPrototype = window.HTMLElement ? HTMLElement.prototype : 3038 Element.prototype; 3039 3040 if (F.ElementExtensions) { 3041 copy(Element.Methods, elementPrototype); 3042 copy(Element.Methods.Simulated, elementPrototype, true); 3043 } 3044 3045 if (F.SpecificElementExtensions) { 3046 for (var tag in Element.Methods.ByTag) { 3047 var klass = findDOMClass(tag); 3048 if (Object.isUndefined(klass)) continue; 3049 copy(T[tag], klass.prototype); 3050 } 3051 } 3052 3053 Object.extend(Element, Element.Methods); 3054 delete Element.ByTag; 3055 3056 if (Element.extend.refresh) Element.extend.refresh(); 3057 Element.cache = { }; 3058}; 3059 3060 3061document.viewport = { 3062 3063 getDimensions: function() { 3064 return { width: this.getWidth(), height: this.getHeight() }; 3065 }, 3066 3067 getScrollOffsets: function() { 3068 return Element._returnOffset( 3069 window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, 3070 window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); 3071 } 3072}; 3073 3074(function(viewport) { 3075 var B = Prototype.Browser, doc = document, element, property = {}; 3076 3077 function getRootElement() { 3078 if (B.WebKit && !doc.evaluate) 3079 return document; 3080 3081 if (B.Opera && window.parseFloat(window.opera.version()) < 9.5) 3082 return document.body; 3083 3084 return document.documentElement; 3085 } 3086 3087 function define(D) { 3088 if (!element) element = getRootElement(); 3089 3090 property[D] = 'client' + D; 3091 3092 viewport['get' + D] = function() { return element[property[D]] }; 3093 return viewport['get' + D](); 3094 } 3095 3096 viewport.getWidth = define.curry('Width'); 3097 3098 viewport.getHeight = define.curry('Height'); 3099})(document.viewport); 3100 3101 3102Element.Storage = { 3103 UID: 1 3104}; 3105 3106Element.addMethods({ 3107 getStorage: function(element) { 3108 if (!(element = $(element))) return; 3109 3110 var uid; 3111 if (element === window) { 3112 uid = 0; 3113 } else { 3114 if (typeof element._prototypeUID === "undefined") 3115 element._prototypeUID = Element.Storage.UID++; 3116 uid = element._prototypeUID; 3117 } 3118 3119 if (!Element.Storage[uid]) 3120 Element.Storage[uid] = $H(); 3121 3122 return Element.Storage[uid]; 3123 }, 3124 3125 store: function(element, key, value) { 3126 if (!(element = $(element))) return; 3127 3128 if (arguments.length === 2) { 3129 Element.getStorage(element).update(key); 3130 } else { 3131 Element.getStorage(element).set(key, value); 3132 } 3133 3134 return element; 3135 }, 3136 3137 retrieve: function(element, key, defaultValue) { 3138 if (!(element = $(element))) return; 3139 var hash = Element.getStorage(element), value = hash.get(key); 3140 3141 if (Object.isUndefined(value)) { 3142 hash.set(key, defaultValue); 3143 value = defaultValue; 3144 } 3145 3146 return value; 3147 }, 3148 3149 clone: function(element, deep) { 3150 if (!(element = $(element))) return; 3151 var clone = element.cloneNode(deep); 3152 clone._prototypeUID = void 0; 3153 if (deep) { 3154 var descendants = Element.select(clone, '*'), 3155 i = descendants.length; 3156 while (i--) { 3157 descendants[i]._prototypeUID = void 0; 3158 } 3159 } 3160 return Element.extend(clone); 3161 }, 3162 3163 purge: function(element) { 3164 if (!(element = $(element))) return; 3165 var purgeElement = Element._purgeElement; 3166 3167 purgeElement(element); 3168 3169 var descendants = element.getElementsByTagName('*'), 3170 i = descendants.length; 3171 3172 while (i--) purgeElement(descendants[i]); 3173 3174 return null; 3175 } 3176}); 3177 3178(function() { 3179 3180 function toDecimal(pctString) { 3181 var match = pctString.match(/^(\d+)%?$/i); 3182 if (!match) return null; 3183 return (Number(match[1]) / 100); 3184 } 3185 3186 function getPixelValue(value, property, context) { 3187 var element = null; 3188 if (Object.isElement(value)) { 3189 element = value; 3190 value = element.getStyle(property); 3191 } 3192 3193 if (value === null) { 3194 return null; 3195 } 3196 3197 if ((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(value)) { 3198 return window.parseFloat(value); 3199 } 3200 3201 var isPercentage = value.include('%'), isViewport = (context === document.viewport); 3202 3203 if (/\d/.test(value) && element && element.runtimeStyle && !(isPercentage && isViewport)) { 3204 var style = element.style.left, rStyle = element.runtimeStyle.left; 3205 element.runtimeStyle.left = element.currentStyle.left; 3206 element.style.left = value || 0; 3207 value = element.style.pixelLeft; 3208 element.style.left = style; 3209 element.runtimeStyle.left = rStyle; 3210 3211 return value; 3212 } 3213 3214 if (element && isPercentage) { 3215 context = context || element.parentNode; 3216 var decimal = toDecimal(value); 3217 var whole = null; 3218 var position = element.getStyle('position'); 3219 3220 var isHorizontal = property.include('left') || property.include('right') || 3221 property.include('width'); 3222 3223 var isVertical = property.include('top') || property.include('bottom') || 3224 property.include('height'); 3225 3226 if (context === document.viewport) { 3227 if (isHorizontal) { 3228 whole = document.viewport.getWidth(); 3229 } else if (isVertical) { 3230 whole = document.viewport.getHeight(); 3231 } 3232 } else { 3233 if (isHorizontal) { 3234 whole = $(context).measure('width'); 3235 } else if (isVertical) { 3236 whole = $(context).measure('height'); 3237 } 3238 } 3239 3240 return (whole === null) ? 0 : whole * decimal; 3241 } 3242 3243 return 0; 3244 } 3245 3246 function toCSSPixels(number) { 3247 if (Object.isString(number) && number.endsWith('px')) { 3248 return number; 3249 } 3250 return number + 'px'; 3251 } 3252 3253 function isDisplayed(element) { 3254 var originalElement = element; 3255 while (element && element.parentNode) { 3256 var display = element.getStyle('display'); 3257 if (display === 'none') { 3258 return false;
3259 } 3260 element = $(element.parentNode); 3261 } 3262 return true; 3263 } 3264 3265 var hasLayout = Prototype.K; 3266 if ('currentStyle' in document.documentElement) { 3267 hasLayout = function(element) { 3268 if (!element.currentStyle.hasLayout) { 3269 element.style.zoom = 1; 3270 } 3271 return element; 3272 }; 3273 } 3274 3275 function cssNameFor(key) { 3276 if (key.include('border')) key = key + '-width'; 3277 return key.camelize(); 3278 } 3279 3280 Element.Layout = Class.create(Hash, { 3281 initialize: function($super, element, preCompute) { 3282 $super(); 3283 this.element = $(element); 3284 3285 Element.Layout.PROPERTIES.each( function(property) { 3286 this._set(property, null); 3287 }, this); 3288 3289 if (preCompute) { 3290 this._preComputing = true; 3291 this._begin(); 3292 Element.Layout.PROPERTIES.each( this._compute, this ); 3293 this._end(); 3294 this._preComputing = false; 3295 } 3296 }, 3297 3298 _set: function(property, value) { 3299 return Hash.prototype.set.call(this, property, value); 3300 }, 3301 3302 set: function(property, value) { 3303 throw "Properties of Element.Layout are read-only."; 3304 }, 3305 3306 get: function($super, property) { 3307 var value = $super(property); 3308 return value === null ? this._compute(property) : value; 3309 }, 3310 3311 _begin: function() { 3312 if (this._prepared) return; 3313 3314 var element = this.element; 3315 if (isDisplayed(element)) { 3316 this._prepared = true; 3317 return; 3318 } 3319 3320 var originalStyles = { 3321 position: element.style.position || '', 3322 width: element.style.width || '', 3323 visibility: element.style.visibility || '', 3324 display: element.style.display || '' 3325 }; 3326 3327 element.store('prototype_original_styles', originalStyles); 3328 3329 var position = element.getStyle('position'), 3330 width = element.getStyle('width'); 3331 3332 if (width === "0px" || width === null) { 3333 element.style.display = 'block'; 3334 width = element.getStyle('width'); 3335 } 3336 3337 var context = (position === 'fixed') ? document.viewport : 3338 element.parentNode; 3339 3340 element.setStyle({ 3341 position: 'absolute', 3342 visibility: 'hidden', 3343 display: 'block' 3344 }); 3345 3346 var positionedWidth = element.getStyle('width'); 3347 3348 var newWidth; 3349 if (width && (positionedWidth === width)) { 3350 newWidth = getPixelValue(element, 'width', context); 3351 } else if (position === 'absolute' || position === 'fixed') { 3352 newWidth = getPixelValue(element, 'width', context); 3353 } else { 3354 var parent = element.parentNode, pLayout = $(parent).getLayout(); 3355 3356 newWidth = pLayout.get('width') - 3357 this.get('margin-left') - 3358 this.get('border-left') - 3359 this.get('padding-left') - 3360 this.get('padding-right') - 3361 this.get('border-right') - 3362 this.get('margin-right'); 3363 } 3364 3365 element.setStyle({ width: newWidth + 'px' }); 3366 3367 this._prepared = true; 3368 }, 3369 3370 _end: function() { 3371 var element = this.element; 3372 var originalStyles = element.retrieve('prototype_original_styles'); 3373 element.store('prototype_original_styles', null); 3374 element.setStyle(originalStyles); 3375 this._prepared = false; 3376 }, 3377 3378 _compute: function(property) { 3379 var COMPUTATIONS = Element.Layout.COMPUTATIONS; 3380 if (!(property in COMPUTATIONS)) { 3381 throw "Property not found."; 3382 } 3383 3384 return this._set(property, COMPUTATIONS[property].call(this, this.element)); 3385 }, 3386 3387 toObject: function() { 3388 var args = $A(arguments); 3389 var keys = (args.length === 0) ? Element.Layout.PROPERTIES : 3390 args.join(' ').split(' '); 3391 var obj = {}; 3392 keys.each( function(key) { 3393 if (!Element.Layout.PROPERTIES.include(key)) return; 3394 var value = this.get(key); 3395 if (value != null) obj[key] = value; 3396 }, this); 3397 return obj; 3398 }, 3399 3400 toHash: function() { 3401 var obj = this.toObject.apply(this, arguments); 3402 return new Hash(obj); 3403 }, 3404 3405 toCSS: function() { 3406 var args = $A(arguments); 3407 var keys = (args.length === 0) ? Element.Layout.PROPERTIES : 3408 args.join(' ').split(' '); 3409 var css = {}; 3410 3411 keys.each( function(key) { 3412 if (!Element.Layout.PROPERTIES.include(key)) return; 3413 if (Element.Layout.COMPOSITE_PROPERTIES.include(key)) return; 3414 3415 var value = this.get(key);
3416 if (value != null) css[cssNameFor(key)] = value + 'px'; 3417 }, this); 3418 return css; 3419 }, 3420 3421 inspect: function() { 3422 return "#<Element.Layout>"; 3423 } 3424 }); 3425 3426 Object.extend(Element.Layout, { 3427 PROPERTIES: $w('height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height'), 3428 3429 COMPOSITE_PROPERTIES: $w('padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height'), 3430 3431 COMPUTATIONS: { 3432 'height': function(element) { 3433 if (!this._preComputing) this._begin(); 3434 3435 var bHeight = this.get('border-box-height'); 3436 if (bHeight <= 0) { 3437 if (!this._preComputing) this._end(); 3438 return 0; 3439 } 3440 3441 var bTop = this.get('border-top'), 3442 bBottom = this.get('border-bottom'); 3443 3444 var pTop = this.get('padding-top'), 3445 pBottom = this.get('padding-bottom'); 3446 3447 if (!this._preComputing) this._end(); 3448 3449 return bHeight - bTop - bBottom - pTop - pBottom; 3450 }, 3451 3452 'width': function(element) { 3453 if (!this._preComputing) this._begin(); 3454 3455 var bWidth = this.get('border-box-width'); 3456 if (bWidth <= 0) { 3457 if (!this._preComputing) this._end(); 3458 return 0; 3459 } 3460 3461 var bLeft = this.get('border-left'), 3462 bRight = this.get('border-right'); 3463 3464 var pLeft = this.get('padding-left'), 3465 pRight = this.get('padding-right'); 3466 3467 if (!this._preComputing) this._end(); 3468 3469 return bWidth - bLeft - bRight - pLeft - pRight; 3470 }, 3471 3472 'padding-box-height': function(element) { 3473 var height = this.get('height'), 3474 pTop = this.get('padding-top'), 3475 pBottom = this.get('padding-bottom'); 3476 3477 return height + pTop + pBottom; 3478 }, 3479 3480 'padding-box-width': function(element) { 3481 var width = this.get('width'), 3482 pLeft = this.get('padding-left'), 3483 pRight = this.get('padding-right'); 3484 3485 return width + pLeft + pRight; 3486 }, 3487 3488 'border-box-height': function(element) { 3489 if (!this._preComputing) this._begin(); 3490 var height = element.offsetHeight; 3491 if (!this._preComputing) this._end(); 3492 return height; 3493 }, 3494 3495 'border-box-width': function(element) { 3496 if (!this._preComputing) this._begin(); 3497 var width = element.offsetWidth; 3498 if (!this._preComputing) this._end(); 3499 return width; 3500 }, 3501 3502 'margin-box-height': function(element) { 3503 var bHeight = this.get('border-box-height'), 3504 mTop = this.get('margin-top'), 3505 mBottom = this.get('margin-bottom'); 3506 3507 if (bHeight <= 0) return 0; 3508 3509 return bHeight + mTop + mBottom; 3510 }, 3511 3512 'margin-box-width': function(element) { 3513 var bWidth = this.get('border-box-width'), 3514 mLeft = this.get('margin-left'), 3515 mRight = this.get('margin-right'); 3516 3517 if (bWidth <= 0) return 0; 3518 3519 return bWidth + mLeft + mRight; 3520 }, 3521 3522 'top': function(element) { 3523 var offset = element.positionedOffset(); 3524 return offset.top; 3525 }, 3526 3527 'bottom': function(element) { 3528 var offset = element.positionedOffset(), 3529 parent = element.getOffsetParent(), 3530 pHeight = parent.measure('height'); 3531 3532 var mHeight = this.get('border-box-height'); 3533 3534 return pHeight - mHeight - offset.top; 3535 }, 3536 3537 'left': function(element) { 3538 var offset = element.positionedOffset(); 3539 return offset.left; 3540 }, 3541 3542 'right': function(element) { 3543 var offset = element.positionedOffset(), 3544 parent = element.getOffsetParent(), 3545 pWidth = parent.measure('width'); 3546 3547 var mWidth = this.get('border-box-width'); 3548 3549 return pWidth - mWidth - offset.left; 3550 }, 3551 3552 'padding-top': function(element) { 3553 return getPixelValue(element, 'paddingTop'); 3554 }, 3555 3556 'padding-bottom': function(element) { 3557 return getPixelValue(element, 'paddingBottom'); 3558 }, 3559 3560 'padding-left': function(element) { 3561 return getPixelValue(element, 'paddingLeft'); 3562 }, 3563 3564 'padding-right': function(element) { 3565 return getPixelValue(element, 'paddingRight'); 3566 }, 3567 3568 'border-top': function(element) { 3569 return getPixelValue(element, 'borderTopWidth'); 3570 }, 3571 3572 'border-bottom': function(element) { 3573 return getPixelValue(element, 'borderBottomWidth'); 3574 }, 3575 3576 'border-left': function(element) { 3577 return getPixelValue(element, 'borderLeftWidth'); 3578 }, 3579 3580 'border-right': function(element) { 3581 return getPixelValue(element, 'borderRightWidth'); 3582 }, 3583 3584 'margin-top': function(element) { 3585 return getPixelValue(element, 'marginTop'); 3586 }, 3587 3588 'margin-bottom': function(element) { 3589 return getPixelValue(element, 'marginBottom'); 3590 }, 3591 3592 'margin-left': function(element) { 3593 return getPixelValue(element, 'marginLeft'); 3594 }, 3595 3596 'margin-right': function(element) { 3597 return getPixelValue(element, 'marginRight'); 3598 } 3599 } 3600 }); 3601 3602 if ('getBoundingClientRect' in document.documentElement) { 3603 Object.extend(Element.Layout.COMPUTATIONS, { 3604 'right': function(element) { 3605 var parent = hasLayout(element.getOffsetParent()); 3606 var rect = element.getBoundingClientRect(), 3607 pRect = parent.getBoundingClientRect(); 3608 3609 return (pRect.right - rect.right).round(); 3610 }, 3611 3612 'bottom': function(element) { 3613 var parent = hasLayout(element.getOffsetParent()); 3614 var rect = element.getBoundingClientRect(), 3615 pRect = parent.getBoundingClientRect(); 3616 3617 return (pRect.bottom - rect.bottom).round(); 3618 } 3619 }); 3620 } 3621 3622 Element.Offset = Class.create({ 3623 initialize: function(left, top) { 3624 this.left = left.round(); 3625 this.top = top.round(); 3626 3627 this[0] = this.left; 3628 this[1] = this.top; 3629 }, 3630 3631 relativeTo: function(offset) { 3632 return new Element.Offset( 3633 this.left - offset.left, 3634 this.top - offset.top 3635 ); 3636 }, 3637 3638 inspect: function() { 3639 return "#<Element.Offset left: #{left} top: #{top}>".interpolate(this); 3640 }, 3641 3642 toString: function() { 3643 return "[#{left}, #{top}]".interpolate(this); 3644 }, 3645 3646 toArray: function() { 3647 return [this.left, this.top]; 3648 } 3649 }); 3650 3651 function getLayout(element, preCompute) { 3652 return new Element.Layout(element, preCompute); 3653 } 3654 3655 function measure(element, property) { 3656 return $(element).getLayout().get(property); 3657 } 3658 3659 function getDimensions(element) { 3660 element = $(element); 3661 var display = Element.getStyle(element, 'display'); 3662 3663 if (display && display !== 'none') { 3664 return { width: element.offsetWidth, height: element.offsetHeight }; 3665 } 3666 3667 var style = element.style; 3668 var originalStyles = { 3669 visibility: style.visibility, 3670 position: style.position, 3671 display: style.display 3672 }; 3673 3674 var newStyles = { 3675 visibility: 'hidden', 3676 display: 'block' 3677 }; 3678 3679 if (originalStyles.position !== 'fixed') 3680 newStyles.position = 'absolute'; 3681 3682 Element.setStyle(element, newStyles); 3683 3684 var dimensions = { 3685 width: element.offsetWidth, 3686 height: element.offsetHeight 3687 }; 3688 3689 Element.setStyle(element, originalStyles); 3690 3691 return dimensions; 3692 } 3693 3694 function getOffsetParent(element) { 3695 element = $(element); 3696 3697 if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element)) 3698 return $(document.body); 3699
3700 var isInline = (Element.getStyle(element, 'display') === 'inline'); 3701 if (!isInline && element.offsetParent) return $(element.offsetParent); 3702 3703 while ((element = element.parentNode) && element !== document.body) { 3704 if (Element.getStyle(element, 'position') !== 'static') { 3705 return isHtml(element) ? $(document.body) : $(element); 3706 } 3707 } 3708 3709 return $(document.body); 3710 } 3711 3712 3713 function cumulativeOffset(element) { 3714 element = $(element); 3715 var valueT = 0, valueL = 0; 3716 if (element.parentNode) { 3717 do { 3718 valueT += element.offsetTop || 0; 3719 valueL += element.offsetLeft || 0; 3720 element = element.offsetParent; 3721 } while (element); 3722 } 3723 return new Element.Offset(valueL, valueT); 3724 } 3725 3726 function positionedOffset(element) { 3727 element = $(element); 3728 3729 var layout = element.getLayout(); 3730 3731 var valueT = 0, valueL = 0; 3732 do { 3733 valueT += element.offsetTop || 0; 3734 valueL += element.offsetLeft || 0; 3735 element = element.offsetParent; 3736 if (element) { 3737 if (isBody(element)) break; 3738 var p = Element.getStyle(element, 'position'); 3739 if (p !== 'static') break; 3740 } 3741 } while (element); 3742 3743 valueL -= layout.get('margin-top'); 3744 valueT -= layout.get('margin-left'); 3745 3746 return new Element.Offset(valueL, valueT); 3747 } 3748 3749 function cumulativeScrollOffset(element) { 3750 var valueT = 0, valueL = 0; 3751 do { 3752 valueT += element.scrollTop || 0; 3753 valueL += element.scrollLeft || 0; 3754 element = element.parentNode; 3755 } while (element); 3756 return new Element.Offset(valueL, valueT); 3757 } 3758 3759 function viewportOffset(forElement) { 3760 element = $(element); 3761 var valueT = 0, valueL = 0, docBody = document.body; 3762 3763 var element = forElement; 3764 do { 3765 valueT += element.offsetTop || 0; 3766 valueL += element.offsetLeft || 0; 3767 if (element.offsetParent == docBody && 3768 Element.getStyle(element, 'position') == 'absolute') break; 3769 } while (element = element.offsetParent); 3770 3771 element = forElement; 3772 do { 3773 if (element != docBody) { 3774 valueT -= element.scrollTop || 0; 3775 valueL -= element.scrollLeft || 0; 3776 } 3777 } while (element = element.parentNode); 3778 return new Element.Offset(valueL, valueT); 3779 } 3780 3781 function absolutize(element) { 3782 element = $(element); 3783 3784 if (Element.getStyle(element, 'position') === 'absolute') { 3785 return element; 3786 } 3787 3788 var offsetParent = getOffsetParent(element); 3789 var eOffset = element.viewportOffset(), 3790 pOffset = offsetParent.viewportOffset(); 3791 3792 var offset = eOffset.relativeTo(pOffset); 3793 var layout = element.getLayout(); 3794 3795 element.store('prototype_absolutize_original_styles', { 3796 left: element.getStyle('left'), 3797 top: element.getStyle('top'), 3798 width: element.getStyle('width'), 3799 height: element.getStyle('height') 3800 }); 3801 3802 element.setStyle({ 3803 position: 'absolute', 3804 top: offset.top + 'px', 3805 left: offset.left + 'px', 3806 width: layout.get('width') + 'px', 3807 height: layout.get('height') + 'px' 3808 }); 3809 3810 return element; 3811 } 3812 3813 function relativize(element) { 3814 element = $(element); 3815 if (Element.getStyle(element, 'position') === 'relative') { 3816 return element; 3817 } 3818 3819 var originalStyles = 3820 element.retrieve('prototype_absolutize_original_styles'); 3821 3822 if (originalStyles) element.setStyle(originalStyles); 3823 return element; 3824 } 3825 3826 if (Prototype.Browser.IE) { 3827 getOffsetParent = getOffsetParent.wrap( 3828 function(proceed, element) { 3829 element = $(element); 3830 3831 if (isDocument(element) || isDetached(element) || isBody(element) || isHtml(element)) 3832 return $(document.body); 3833 3834 var position = element.getStyle('position'); 3835 if (position !== 'static') return proceed(element); 3836 3837 element.setStyle({ position: 'relative' }); 3838 var value = proceed(element); 3839 element.setStyle({ position: position }); 3840 return value; 3841 } 3842 ); 3843 3844 positionedOffset = positionedOffset.wrap(function(proceed, element) { 3845 element = $(element); 3846 if (!element.parentNode) return new Element.Offset(0, 0); 3847 var position = element.getStyle('position'); 3848 if (position !== 'static') return proceed(element); 3849 3850 var offsetParent = element.getOffsetParent(); 3851 if (offsetParent && offsetParent.getStyle('position') === 'fixed') 3852 hasLayout(offsetParent); 3853 3854 element.setStyle({ position: 'relative' }); 3855 var value = proceed(element); 3856 element.setStyle({ position: position }); 3857 return value; 3858 }); 3859 } else if (Prototype.Browser.Webkit) { 3860 cumulativeOffset = function(element) { 3861 element = $(element); 3862 var valueT = 0, valueL = 0; 3863 do { 3864 valueT += element.offsetTop || 0; 3865 valueL += element.offsetLeft || 0; 3866 if (element.offsetParent == document.body) 3867 if (Element.getStyle(element, 'position') == 'absolute') break; 3868 3869 element = element.offsetParent; 3870 } while (element); 3871 3872 return new Element.Offset(valueL, valueT); 3873 }; 3874 } 3875 3876 3877 Element.addMethods({ 3878 getLayout: getLayout, 3879 measure: measure, 3880 getDimensions: getDimensions, 3881 getOffsetParent: getOffsetParent, 3882 cumulativeOffset: cumulativeOffset, 3883 positionedOffset: positionedOffset, 3884 cumulativeScrollOffset: cumulativeScrollOffset, 3885 viewportOffset: viewportOffset, 3886 absolutize: absolutize, 3887 relativize: relativize 3888 }); 3889 3890 function isBody(element) { 3891 return element.nodeName.toUpperCase() === 'BODY'; 3892 } 3893 3894 function isHtml(element) { 3895 return element.nodeName.toUpperCase() === 'HTML'; 3896 } 3897 3898 function isDocument(element) { 3899 return element.nodeType === Node.DOCUMENT_NODE; 3900 } 3901 3902 function isDetached(element) { 3903 return element !== document.body && 3904 !Element.descendantOf(element, document.body); 3905 } 3906 3907 if ('getBoundingClientRect' in document.documentElement) { 3908 Element.addMethods({ 3909 viewportOffset: function(element) { 3910 element = $(element); 3911 if (isDetached(element)) return new Element.Offset(0, 0); 3912 3913 var rect = element.getBoundingClientRect(), 3914 docEl = document.documentElement; 3915 return new Element.Offset(rect.left - docEl.clientLeft, 3916 rect.top - docEl.clientTop); 3917 } 3918 }); 3919 } 3920})(); 3921window.$$ = function() { 3922 var expression = $A(arguments).join(', '); 3923 return Prototype.Selector.select(expression, document); 3924}; 3925 3926Prototype.Selector = (function() { 3927 3928 function select() { 3929 throw new Error('Method "Prototype.Selector.select" must be defined.'); 3930 } 3931 3932 function match() { 3933 throw new Error('Method "Prototype.Selector.match" must be defined.'); 3934 } 3935 3936 function find(elements, expression, index) { 3937 index = index || 0; 3938 var match = Prototype.Selector.match, length = elements.length, matchIndex = 0, i; 3939 3940 for (i = 0; i < length; i++) { 3941 if (match(elements[i], expression) && index == matchIndex++) { 3942 return Element.extend(elements[i]); 3943 } 3944 } 3945 } 3946 3947 function extendElements(elements) { 3948 for (var i = 0, length = elements.length; i < length; i++) { 3949 Element.extend(elements[i]); 3950 } 3951 return elements; 3952 } 3953 3954 3955 var K = Prototype.K; 3956 3957 return { 3958 select: select, 3959 match: match, 3960 find: find, 3961 extendElements: (Element.extend === K) ? K : extendElements, 3962 extendElement: Element.extend 3963 }; 3964})(); 3965Prototype._original_property = window.Sizzle; 3966/*! 3967 * Sizzle CSS Selector Engine - v1.0 3968 * Copyright 2009, The Dojo Foundation 3969 * Released under the MIT, BSD, and GPL Licenses. 3970 * More information: http://sizzlejs.com/ 3971 */ 3972(function(){ 3973 3974var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, 3975 done = 0, 3976 toString = Object.prototype.toString, 3977 hasDuplicate = false, 3978 baseHasDuplicate = true; 3979 3980[0, 0].sort(function(){ 3981 baseHasDuplicate = false;
vendor: 5,874 bytes, lines 3982-4238
3982 return 0; 3983}); 3984 3985var Sizzle = function(selector, context, results, seed) { 3986 results = results || []; 3987 var origContext = context = context || document; 3988 3989 if ( context.nodeType !== 1 && context.nodeType !== 9 ) { 3990 return []; 3991 } 3992 3993 if ( !selector || typeof selector !== "string" ) { 3994 return results; 3995 } 3996 3997 var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context), 3998 soFar = selector; 3999 4000 while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { 4001 soFar = m[3]; 4002 4003 parts.push( m[1] ); 4004 4005 if ( m[2] ) { 4006 extra = m[3]; 4007 break; 4008 } 4009 } 4010 4011 if ( parts.length > 1 && origPOS.exec( selector ) ) { 4012 if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { 4013 set = posProcess( parts[0] + parts[1], context ); 4014 } else { 4015 set = Expr.relative[ parts[0] ] ? 4016 [ context ] : 4017 Sizzle( parts.shift(), context ); 4018 4019 while ( parts.length ) { 4020 selector = parts.shift(); 4021 4022 if ( Expr.relative[ selector ] ) 4023 selector += parts.shift(); 4024 4025 set = posProcess( selector, set ); 4026 } 4027 } 4028 } else { 4029 if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && 4030 Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { 4031 var ret = Sizzle.find( parts.shift(), context, contextXML ); 4032 context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; 4033 } 4034 4035 if ( context ) { 4036 var ret = seed ? 4037 { expr: parts.pop(), set: makeArray(seed) } : 4038 Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); 4039 set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; 4040 4041 if ( parts.length > 0 ) { 4042 checkSet = makeArray(set); 4043 } else { 4044 prune = false; 4045 } 4046 4047 while ( parts.length ) { 4048 var cur = parts.pop(), pop = cur; 4049 4050 if ( !Expr.relative[ cur ] ) { 4051 cur = ""; 4052 } else { 4053 pop = parts.pop(); 4054 } 4055 4056 if ( pop == null ) { 4057 pop = context; 4058 } 4059 4060 Expr.relative[ cur ]( checkSet, pop, contextXML ); 4061 } 4062 } else { 4063 checkSet = parts = []; 4064 } 4065 } 4066 4067 if ( !checkSet ) { 4068 checkSet = set; 4069 } 4070 4071 if ( !checkSet ) { 4072 throw "Syntax error, unrecognized expression: " + (cur || selector); 4073 } 4074 4075 if ( toString.call(checkSet) === "[object Array]" ) { 4076 if ( !prune ) { 4077 results.push.apply( results, checkSet ); 4078 } else if ( context && context.nodeType === 1 ) { 4079 for ( var i = 0; checkSet[i] != null; i++ ) { 4080 if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { 4081 results.push( set[i] ); 4082 } 4083 } 4084 } else { 4085 for ( var i = 0; checkSet[i] != null; i++ ) { 4086 if ( checkSet[i] && checkSet[i].nodeType === 1 ) { 4087 results.push( set[i] ); 4088 } 4089 } 4090 } 4091 } else { 4092 makeArray( checkSet, results ); 4093 } 4094 4095 if ( extra ) { 4096 Sizzle( extra, origContext, results, seed ); 4097 Sizzle.uniqueSort( results ); 4098 } 4099 4100 return results; 4101}; 4102 4103Sizzle.uniqueSort = function(results){ 4104 if ( sortOrder ) { 4105 hasDuplicate = baseHasDuplicate; 4106 results.sort(sortOrder); 4107 4108 if ( hasDuplicate ) { 4109 for ( var i = 1; i < results.length; i++ ) { 4110 if ( results[i] === results[i-1] ) { 4111 results.splice(i--, 1); 4112 } 4113 } 4114 } 4115 } 4116 4117 return results; 4118}; 4119 4120Sizzle.matches = function(expr, set){ 4121 return Sizzle(expr, null, null, set); 4122}; 4123 4124Sizzle.find = function(expr, context, isXML){ 4125 var set, match; 4126 4127 if ( !expr ) { 4128 return []; 4129 } 4130 4131 for ( var i = 0, l = Expr.order.length; i < l; i++ ) { 4132 var type = Expr.order[i], match; 4133 4134 if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { 4135 var left = match[1]; 4136 match.splice(1,1); 4137 4138 if ( left.substr( left.length - 1 ) !== "\\" ) { 4139 match[1] = (match[1] || "").replace(/\\/g, ""); 4140 set = Expr.find[ type ]( match, context, isXML ); 4141 if ( set != null ) { 4142 expr = expr.replace( Expr.match[ type ], "" ); 4143 break; 4144 } 4145 } 4146 } 4147 } 4148 4149 if ( !set ) { 4150 set = context.getElementsByTagName("*"); 4151 } 4152 4153 return {set: set, expr: expr}; 4154}; 4155 4156Sizzle.filter = function(expr, set, inplace, not){ 4157 var old = expr, result = [], curLoop = set, match, anyFound, 4158 isXMLFilter = set && set[0] && isXML(set[0]); 4159 4160 while ( expr && set.length ) { 4161 for ( var type in Expr.filter ) { 4162 if ( (match = Expr.match[ type ].exec( expr )) != null ) { 4163 var filter = Expr.filter[ type ], found, item; 4164 anyFound = false; 4165 4166 if ( curLoop == result ) { 4167 result = []; 4168 } 4169 4170 if ( Expr.preFilter[ type ] ) { 4171 match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); 4172 4173 if ( !match ) { 4174 anyFound = found = true; 4175 } else if ( match === true ) { 4176 continue; 4177 } 4178 } 4179 4180 if ( match ) { 4181 for ( var i = 0; (item = curLoop[i]) != null; i++ ) { 4182 if ( item ) { 4183 found = filter( item, match, i, curLoop ); 4184 var pass = not ^ !!found; 4185 4186 if ( inplace && found != null ) { 4187 if ( pass ) { 4188 anyFound = true; 4189 } else { 4190 curLoop[i] = false; 4191 } 4192 } else if ( pass ) { 4193 result.push( item ); 4194 anyFound = true; 4195 } 4196 } 4197 } 4198 } 4199 4200 if ( found !== undefined ) { 4201 if ( !inplace ) { 4202 curLoop = result; 4203 } 4204 4205 expr = expr.replace( Expr.match[ type ], "" ); 4206 4207 if ( !anyFound ) { 4208 return []; 4209 } 4210 4211 break; 4212 } 4213 } 4214 } 4215 4216 if ( expr == old ) { 4217 if ( anyFound == null ) { 4218 throw "Syntax error, unrecognized expression: " + expr; 4219 } else { 4220 break; 4221 } 4222 } 4223 4224 old = expr; 4225 } 4226 4227 return curLoop; 4228}; 4229 4230var Expr = Sizzle.selectors = { 4231 order: [ "ID", "NAME", "TAG" ], 4232 match: { 4233 ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, 4234 CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, 4235 NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, 4236 ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, 4237 TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, 4238 CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
4239 POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, 4240 PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ 4241 }, 4242 leftMatch: {}, 4243 attrMap: { 4244 "class": "className", 4245 "for": "htmlFor" 4246 }, 4247 attrHandle: { 4248 href: function(elem){ 4249 return elem.getAttribute("href"); 4250 } 4251 }, 4252 relative: { 4253 "+": function(checkSet, part, isXML){ 4254 var isPartStr = typeof part === "string", 4255 isTag = isPartStr && !/\W/.test(part), 4256 isPartStrNotTag = isPartStr && !isTag; 4257 4258 if ( isTag && !isXML ) { 4259 part = part.toUpperCase(); 4260 } 4261 4262 for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { 4263 if ( (elem = checkSet[i]) ) { 4264 while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} 4265 4266 checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? 4267 elem || false : 4268 elem === part; 4269 } 4270 } 4271 4272 if ( isPartStrNotTag ) { 4273 Sizzle.filter( part, checkSet, true ); 4274 } 4275 }, 4276 ">": function(checkSet, part, isXML){ 4277 var isPartStr = typeof part === "string"; 4278 4279 if ( isPartStr && !/\W/.test(part) ) { 4280 part = isXML ? part : part.toUpperCase(); 4281 4282 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 4283 var elem = checkSet[i]; 4284 if ( elem ) { 4285 var parent = elem.parentNode; 4286 checkSet[i] = parent.nodeName === part ? parent : false; 4287 } 4288 } 4289 } else { 4290 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 4291 var elem = checkSet[i]; 4292 if ( elem ) { 4293 checkSet[i] = isPartStr ? 4294 elem.parentNode : 4295 elem.parentNode === part; 4296 } 4297 } 4298 4299 if ( isPartStr ) { 4300 Sizzle.filter( part, checkSet, true ); 4301 } 4302 } 4303 }, 4304 "": function(checkSet, part, isXML){ 4305 var doneName = done++, checkFn = dirCheck; 4306 4307 if ( !/\W/.test(part) ) { 4308 var nodeCheck = part = isXML ? part : part.toUpperCase(); 4309 checkFn = dirNodeCheck; 4310 } 4311 4312 checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); 4313 }, 4314 "~": function(checkSet, part, isXML){ 4315 var doneName = done++, checkFn = dirCheck; 4316 4317 if ( typeof part === "string" && !/\W/.test(part) ) { 4318 var nodeCheck = part = isXML ? part : part.toUpperCase(); 4319 checkFn = dirNodeCheck; 4320 } 4321 4322 checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); 4323 } 4324 }, 4325 find: { 4326 ID: function(match, context, isXML){ 4327 if ( typeof context.getElementById !== "undefined" && !isXML ) { 4328 var m = context.getElementById(match[1]); 4329 return m ? [m] : []; 4330 } 4331 }, 4332 NAME: function(match, context, isXML){ 4333 if ( typeof context.getElementsByName !== "undefined" ) { 4334 var ret = [], results = context.getElementsByName(match[1]); 4335 4336 for ( var i = 0, l = results.length; i < l; i++ ) { 4337 if ( results[i].getAttribute("name") === match[1] ) { 4338 ret.push( results[i] ); 4339 } 4340 } 4341 4342 return ret.length === 0 ? null : ret; 4343 } 4344 }, 4345 TAG: function(match, context){ 4346 return context.getElementsByTagName(match[1]); 4347 } 4348 }, 4349 preFilter: { 4350 CLASS: function(match, curLoop, inplace, result, not, isXML){ 4351 match = " " + match[1].replace(/\\/g, "") + " "; 4352 4353 if ( isXML ) { 4354 return match; 4355 } 4356 4357 for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { 4358 if ( elem ) { 4359 if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { 4360 if ( !inplace ) 4361 result.push( elem ); 4362 } else if ( inplace ) { 4363 curLoop[i] = false; 4364 } 4365 } 4366 } 4367 4368 return false; 4369 }, 4370 ID: function(match){ 4371 return match[1].replace(/\\/g, ""); 4372 }, 4373 TAG: function(match, curLoop){ 4374 for ( var i = 0; curLoop[i] === false; i++ ){} 4375 return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); 4376 }, 4377 CHILD: function(match){ 4378 if ( match[1] == "nth" ) { 4379 var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( 4380 match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || 4381 !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); 4382 4383 match[2] = (test[1] + (test[2] || 1)) - 0; 4384 match[3] = test[3] - 0; 4385 } 4386 4387 match[0] = done++; 4388 4389 return match; 4390 }, 4391 ATTR: function(match, curLoop, inplace, result, not, isXML){ 4392 var name = match[1].replace(/\\/g, ""); 4393 4394 if ( !isXML && Expr.attrMap[name] ) { 4395 match[1] = Expr.attrMap[name]; 4396 } 4397 4398 if ( match[2] === "~=" ) { 4399 match[4] = " " + match[4] + " "; 4400 } 4401 4402 return match; 4403 }, 4404 PSEUDO: function(match, curLoop, inplace, result, not){
vendor: 10,081 bytes, lines 4405-4815
4405 if ( match[1] === "not" ) { 4406 if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { 4407 match[3] = Sizzle(match[3], null, null, curLoop); 4408 } else { 4409 var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); 4410 if ( !inplace ) { 4411 result.push.apply( result, ret ); 4412 } 4413 return false; 4414 } 4415 } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { 4416 return true; 4417 } 4418 4419 return match; 4420 }, 4421 POS: function(match){ 4422 match.unshift( true ); 4423 return match; 4424 } 4425 }, 4426 filters: { 4427 enabled: function(elem){ 4428 return elem.disabled === false && elem.type !== "hidden"; 4429 }, 4430 disabled: function(elem){ 4431 return elem.disabled === true; 4432 }, 4433 checked: function(elem){ 4434 return elem.checked === true; 4435 }, 4436 selected: function(elem){ 4437 elem.parentNode.selectedIndex; 4438 return elem.selected === true; 4439 }, 4440 parent: function(elem){ 4441 return !!elem.firstChild; 4442 }, 4443 empty: function(elem){ 4444 return !elem.firstChild; 4445 }, 4446 has: function(elem, i, match){ 4447 return !!Sizzle( match[3], elem ).length; 4448 }, 4449 header: function(elem){ 4450 return /h\d/i.test( elem.nodeName ); 4451 }, 4452 text: function(elem){ 4453 return "text" === elem.type; 4454 }, 4455 radio: function(elem){ 4456 return "radio" === elem.type; 4457 }, 4458 checkbox: function(elem){ 4459 return "checkbox" === elem.type; 4460 }, 4461 file: function(elem){ 4462 return "file" === elem.type; 4463 }, 4464 password: function(elem){ 4465 return "password" === elem.type; 4466 }, 4467 submit: function(elem){ 4468 return "submit" === elem.type; 4469 }, 4470 image: function(elem){ 4471 return "image" === elem.type; 4472 }, 4473 reset: function(elem){ 4474 return "reset" === elem.type; 4475 }, 4476 button: function(elem){ 4477 return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; 4478 }, 4479 input: function(elem){ 4480 return /input|select|textarea|button/i.test(elem.nodeName); 4481 } 4482 }, 4483 setFilters: { 4484 first: function(elem, i){ 4485 return i === 0; 4486 }, 4487 last: function(elem, i, match, array){ 4488 return i === array.length - 1; 4489 }, 4490 even: function(elem, i){ 4491 return i % 2 === 0; 4492 }, 4493 odd: function(elem, i){ 4494 return i % 2 === 1; 4495 }, 4496 lt: function(elem, i, match){ 4497 return i < match[3] - 0; 4498 }, 4499 gt: function(elem, i, match){ 4500 return i > match[3] - 0; 4501 }, 4502 nth: function(elem, i, match){ 4503 return match[3] - 0 == i; 4504 }, 4505 eq: function(elem, i, match){ 4506 return match[3] - 0 == i; 4507 } 4508 }, 4509 filter: { 4510 PSEUDO: function(elem, match, i, array){ 4511 var name = match[1], filter = Expr.filters[ name ]; 4512 4513 if ( filter ) { 4514 return filter( elem, i, match, array ); 4515 } else if ( name === "contains" ) { 4516 return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; 4517 } else if ( name === "not" ) { 4518 var not = match[3]; 4519 4520 for ( var i = 0, l = not.length; i < l; i++ ) { 4521 if ( not[i] === elem ) { 4522 return false; 4523 } 4524 } 4525 4526 return true; 4527 } 4528 }, 4529 CHILD: function(elem, match){ 4530 var type = match[1], node = elem; 4531 switch (type) { 4532 case 'only': 4533 case 'first': 4534 while ( (node = node.previousSibling) ) { 4535 if ( node.nodeType === 1 ) return false; 4536 } 4537 if ( type == 'first') return true; 4538 node = elem; 4539 case 'last': 4540 while ( (node = node.nextSibling) ) { 4541 if ( node.nodeType === 1 ) return false; 4542 } 4543 return true; 4544 case 'nth': 4545 var first = match[2], last = match[3]; 4546 4547 if ( first == 1 && last == 0 ) { 4548 return true; 4549 } 4550 4551 var doneName = match[0], 4552 parent = elem.parentNode; 4553 4554 if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { 4555 var count = 0; 4556 for ( node = parent.firstChild; node; node = node.nextSibling ) { 4557 if ( node.nodeType === 1 ) { 4558 node.nodeIndex = ++count; 4559 } 4560 } 4561 parent.sizcache = doneName; 4562 } 4563 4564 var diff = elem.nodeIndex - last; 4565 if ( first == 0 ) { 4566 return diff == 0; 4567 } else { 4568 return ( diff % first == 0 && diff / first >= 0 ); 4569 } 4570 } 4571 }, 4572 ID: function(elem, match){ 4573 return elem.nodeType === 1 && elem.getAttribute("id") === match; 4574 }, 4575 TAG: function(elem, match){ 4576 return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; 4577 }, 4578 CLASS: function(elem, match){ 4579 return (" " + (elem.className || elem.getAttribute("class")) + " ") 4580 .indexOf( match ) > -1; 4581 }, 4582 ATTR: function(elem, match){ 4583 var name = match[1], 4584 result = Expr.attrHandle[ name ] ? 4585 Expr.attrHandle[ name ]( elem ) : 4586 elem[ name ] != null ? 4587 elem[ name ] : 4588 elem.getAttribute( name ), 4589 value = result + "", 4590 type = match[2], 4591 check = match[4]; 4592 4593 return result == null ? 4594 type === "!=" : 4595 type === "=" ? 4596 value === check : 4597 type === "*=" ? 4598 value.indexOf(check) >= 0 : 4599 type === "~=" ? 4600 (" " + value + " ").indexOf(check) >= 0 : 4601 !check ? 4602 value && result !== false : 4603 type === "!=" ? 4604 value != check : 4605 type === "^=" ? 4606 value.indexOf(check) === 0 : 4607 type === "$=" ? 4608 value.substr(value.length - check.length) === check : 4609 type === "|=" ? 4610 value === check || value.substr(0, check.length + 1) === check + "-" : 4611 false; 4612 }, 4613 POS: function(elem, match, i, array){ 4614 var name = match[2], filter = Expr.setFilters[ name ]; 4615 4616 if ( filter ) { 4617 return filter( elem, i, match, array ); 4618 } 4619 } 4620 } 4621}; 4622 4623var origPOS = Expr.match.POS; 4624 4625for ( var type in Expr.match ) { 4626 Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); 4627 Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source ); 4628} 4629 4630var makeArray = function(array, results) { 4631 array = Array.prototype.slice.call( array, 0 ); 4632 4633 if ( results ) { 4634 results.push.apply( results, array ); 4635 return results; 4636 } 4637 4638 return array; 4639}; 4640 4641try { 4642 Array.prototype.slice.call( document.documentElement.childNodes, 0 ); 4643 4644} catch(e){ 4645 makeArray = function(array, results) { 4646 var ret = results || []; 4647 4648 if ( toString.call(array) === "[object Array]" ) { 4649 Array.prototype.push.apply( ret, array ); 4650 } else { 4651 if ( typeof array.length === "number" ) { 4652 for ( var i = 0, l = array.length; i < l; i++ ) { 4653 ret.push( array[i] ); 4654 } 4655 } else { 4656 for ( var i = 0; array[i]; i++ ) { 4657 ret.push( array[i] ); 4658 } 4659 } 4660 } 4661 4662 return ret; 4663 }; 4664} 4665 4666var sortOrder; 4667 4668if ( document.documentElement.compareDocumentPosition ) { 4669 sortOrder = function( a, b ) { 4670 if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { 4671 if ( a == b ) { 4672 hasDuplicate = true; 4673 } 4674 return 0; 4675 } 4676 4677 var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; 4678 if ( ret === 0 ) { 4679 hasDuplicate = true; 4680 } 4681 return ret; 4682 }; 4683} else if ( "sourceIndex" in document.documentElement ) { 4684 sortOrder = function( a, b ) { 4685 if ( !a.sourceIndex || !b.sourceIndex ) { 4686 if ( a == b ) { 4687 hasDuplicate = true; 4688 } 4689 return 0; 4690 } 4691 4692 var ret = a.sourceIndex - b.sourceIndex; 4693 if ( ret === 0 ) { 4694 hasDuplicate = true; 4695 } 4696 return ret; 4697 }; 4698} else if ( document.createRange ) { 4699 sortOrder = function( a, b ) { 4700 if ( !a.ownerDocument || !b.ownerDocument ) { 4701 if ( a == b ) { 4702 hasDuplicate = true; 4703 } 4704 return 0; 4705 } 4706 4707 var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); 4708 aRange.setStart(a, 0); 4709 aRange.setEnd(a, 0); 4710 bRange.setStart(b, 0); 4711 bRange.setEnd(b, 0); 4712 var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); 4713 if ( ret === 0 ) { 4714 hasDuplicate = true; 4715 } 4716 return ret; 4717 }; 4718} 4719 4720(function(){ 4721 var form = document.createElement("div"), 4722 id = "script" + (new Date).getTime(); 4723 form.innerHTML = "<a name='" + id + "'/>"; 4724 4725 var root = document.documentElement; 4726 root.insertBefore( form, root.firstChild ); 4727 4728 if ( !!document.getElementById( id ) ) { 4729 Expr.find.ID = function(match, context, isXML){ 4730 if ( typeof context.getElementById !== "undefined" && !isXML ) { 4731 var m = context.getElementById(match[1]); 4732 return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; 4733 } 4734 }; 4735 4736 Expr.filter.ID = function(elem, match){ 4737 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); 4738 return elem.nodeType === 1 && node && node.nodeValue === match; 4739 }; 4740 } 4741 4742 root.removeChild( form ); 4743 root = form = null; // release memory in IE 4744})(); 4745 4746(function(){ 4747 4748 var div = document.createElement("div"); 4749 div.appendChild( document.createComment("") ); 4750 4751 if ( div.getElementsByTagName("*").length > 0 ) { 4752 Expr.find.TAG = function(match, context){ 4753 var results = context.getElementsByTagName(match[1]); 4754 4755 if ( match[1] === "*" ) { 4756 var tmp = []; 4757 4758 for ( var i = 0; results[i]; i++ ) { 4759 if ( results[i].nodeType === 1 ) { 4760 tmp.push( results[i] ); 4761 } 4762 } 4763 4764 results = tmp; 4765 } 4766 4767 return results; 4768 }; 4769 } 4770 4771 div.innerHTML = "<a href='#'></a>"; 4772 if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && 4773 div.firstChild.getAttribute("href") !== "#" ) { 4774 Expr.attrHandle.href = function(elem){ 4775 return elem.getAttribute("href", 2); 4776 }; 4777 } 4778 4779 div = null; // release memory in IE 4780})(); 4781 4782if ( document.querySelectorAll ) (function(){ 4783 var oldSizzle = Sizzle, div = document.createElement("div"); 4784 div.innerHTML = "<p class='TEST'></p>"; 4785 4786 if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { 4787 return; 4788 } 4789 4790 Sizzle = function(query, context, extra, seed){ 4791 context = context || document; 4792 4793 if ( !seed && context.nodeType === 9 && !isXML(context) ) { 4794 try { 4795 return makeArray( context.querySelectorAll(query), extra ); 4796 } catch(e){} 4797 } 4798 4799 return oldSizzle(query, context, extra, seed); 4800 }; 4801 4802 for ( var prop in oldSizzle ) { 4803 Sizzle[ prop ] = oldSizzle[ prop ]; 4804 } 4805 4806 div = null; // release memory in IE 4807})(); 4808 4809if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ 4810 var div = document.createElement("div"); 4811 div.innerHTML = "<div class='test e'></div><div class='test'></div>"; 4812 4813 if ( div.getElementsByClassName("e").length === 0 ) 4814 return; 4815
4816 div.lastChild.className = "e"; 4817 4818 if ( div.getElementsByClassName("e").length === 1 ) 4819 return; 4820 4821 Expr.order.splice(1, 0, "CLASS"); 4822 Expr.find.CLASS = function(match, context, isXML) { 4823 if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { 4824 return context.getElementsByClassName(match[1]); 4825 } 4826 }; 4827 4828 div = null; // release memory in IE 4829})(); 4830 4831function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { 4832 var sibDir = dir == "previousSibling" && !isXML; 4833 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 4834 var elem = checkSet[i]; 4835 if ( elem ) { 4836 if ( sibDir && elem.nodeType === 1 ){ 4837 elem.sizcache = doneName; 4838 elem.sizset = i; 4839 } 4840 elem = elem[dir]; 4841 var match = false; 4842 4843 while ( elem ) { 4844 if ( elem.sizcache === doneName ) { 4845 match = checkSet[elem.sizset]; 4846 break; 4847 } 4848 4849 if ( elem.nodeType === 1 && !isXML ){ 4850 elem.sizcache = doneName; 4851 elem.sizset = i; 4852 } 4853 4854 if ( elem.nodeName === cur ) { 4855 match = elem; 4856 break; 4857 } 4858 4859 elem = elem[dir]; 4860 } 4861 4862 checkSet[i] = match; 4863 } 4864 } 4865} 4866 4867function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { 4868 var sibDir = dir == "previousSibling" && !isXML; 4869 for ( var i = 0, l = checkSet.length; i < l; i++ ) { 4870 var elem = checkSet[i]; 4871 if ( elem ) { 4872 if ( sibDir && elem.nodeType === 1 ) { 4873 elem.sizcache = doneName; 4874 elem.sizset = i; 4875 } 4876 elem = elem[dir]; 4877 var match = false; 4878 4879 while ( elem ) { 4880 if ( elem.sizcache === doneName ) { 4881 match = checkSet[elem.sizset]; 4882 break; 4883 } 4884 4885 if ( elem.nodeType === 1 ) { 4886 if ( !isXML ) { 4887 elem.sizcache = doneName; 4888 elem.sizset = i; 4889 } 4890 if ( typeof cur !== "string" ) { 4891 if ( elem === cur ) { 4892 match = true; 4893 break; 4894 } 4895 4896 } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { 4897 match = elem; 4898 break; 4899 } 4900 } 4901 4902 elem = elem[dir]; 4903 } 4904 4905 checkSet[i] = match; 4906 } 4907 } 4908} 4909 4910var contains = document.compareDocumentPosition ? function(a, b){ 4911 return a.compareDocumentPosition(b) & 16; 4912} : function(a, b){ 4913 return a !== b && (a.contains ? a.contains(b) : true); 4914}; 4915 4916var isXML = function(elem){ 4917 return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || 4918 !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML"; 4919}; 4920 4921var posProcess = function(selector, context){ 4922 var tmpSet = [], later = "", match, 4923 root = context.nodeType ? [context] : context; 4924 4925 while ( (match = Expr.match.PSEUDO.exec( selector )) ) { 4926 later += match[0]; 4927 selector = selector.replace( Expr.match.PSEUDO, "" ); 4928 } 4929 4930 selector = Expr.relative[selector] ? selector + "*" : selector; 4931 4932 for ( var i = 0, l = root.length; i < l; i++ ) { 4933 Sizzle( selector, root[i], tmpSet ); 4934 } 4935 4936 return Sizzle.filter( later, tmpSet ); 4937}; 4938 4939 4940window.Sizzle = Sizzle; 4941 4942})(); 4943 4944;(function(engine) { 4945 var extendElements = Prototype.Selector.extendElements; 4946 4947 function select(selector, scope) { 4948 return extendElements(engine(selector, scope || document)); 4949 } 4950 4951 function match(element, selector) { 4952 return engine.matches(selector, [element]).length == 1; 4953 } 4954 4955 Prototype.Selector.engine = engine; 4956 Prototype.Selector.select = select; 4957 Prototype.Selector.match = match; 4958})(Sizzle); 4959 4960window.Sizzle = Prototype._original_property; 4961delete Prototype._original_property; 4962 4963var Form = { 4964 reset: function(form) { 4965 form = $(form); 4966 form.reset(); 4967 return form; 4968 }, 4969 4970 serializeElements: function(elements, options) { 4971 if (typeof options != 'object') options = { hash: !!options }; 4972 else if (Object.isUndefined(options.hash)) options.hash = true; 4973 var key, value, submitted = false, submit = options.submit, accumulator, initial; 4974 4975 if (options.hash) { 4976 initial = {}; 4977 accumulator = function(result, key, value) { 4978 if (key in result) { 4979 if (!Object.isArray(result[key])) result[key] = [result[key]]; 4980 result[key].push(value); 4981 } else result[key] = value; 4982 return result; 4983 }; 4984 } else { 4985 initial = ''; 4986 accumulator = function(result, key, value) { 4987 return result + (result ? '&' : '') + encodeURIComponent(key) + '=' + encodeURIComponent(value); 4988 } 4989 } 4990 4991 return elements.inject(initial, function(result, element) { 4992 if (!element.disabled && element.name) { 4993 key = element.name; value = $(element).getValue(); 4994 if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted && 4995 submit !== false && (!submit || key == submit) && (submitted = true)))) { 4996 result = accumulator(result, key, value); 4997 } 4998 } 4999 return result; 5000 }); 5001 } 5002}; 5003 5004Form.Methods = { 5005 serialize: function(form, options) { 5006 return Form.serializeElements(Form.getElements(form), options); 5007 }, 5008 5009 getElements: function(form) { 5010 var elements = $(form).getElementsByTagName('*'), 5011 element, 5012 arr = [ ], 5013 serializers = Form.Element.Serializers; 5014 for (var i = 0; element = elements[i]; i++) { 5015 arr.push(element); 5016 } 5017 return arr.inject([], function(elements, child) { 5018 if (serializers[child.tagName.toLowerCase()]) 5019 elements.push(Element.extend(child)); 5020 return elements; 5021 }) 5022 }, 5023 5024 getInputs: function(form, typeName, name) { 5025 form = $(form); 5026 var inputs = form.getElementsByTagName('input'); 5027 5028 if (!typeName && !name) return $A(inputs).map(Element.extend); 5029
5030 for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { 5031 var input = inputs[i]; 5032 if ((typeName && input.type != typeName) || (name && input.name != name)) 5033 continue; 5034 matchingInputs.push(Element.extend(input)); 5035 } 5036 5037 return matchingInputs; 5038 }, 5039 5040 disable: function(form) { 5041 form = $(form); 5042 Form.getElements(form).invoke('disable'); 5043 return form; 5044 }, 5045 5046 enable: function(form) { 5047 form = $(form); 5048 Form.getElements(form).invoke('enable'); 5049 return form; 5050 }, 5051 5052 findFirstElement: function(form) { 5053 var elements = $(form).getElements().findAll(function(element) { 5054 return 'hidden' != element.type && !element.disabled; 5055 }); 5056 var firstByIndex = elements.findAll(function(element) { 5057 return element.hasAttribute('tabIndex') && element.tabIndex >= 0; 5058 }).sortBy(function(element) { return element.tabIndex }).first(); 5059 5060 return firstByIndex ? firstByIndex : elements.find(function(element) { 5061 return /^(?:input|select|textarea)$/i.test(element.tagName); 5062 }); 5063 }, 5064 5065 focusFirstElement: function(form) { 5066 form = $(form); 5067 var element = form.findFirstElement(); 5068 if (element) element.activate(); 5069 return form; 5070 }, 5071 5072 request: function(form, options) { 5073 form = $(form), options = Object.clone(options || { }); 5074 5075 var params = options.parameters, action = form.readAttribute('action') || ''; 5076 if (action.blank()) action = window.location.href; 5077 options.parameters = form.serialize(true); 5078 5079 if (params) { 5080 if (Object.isString(params)) params = params.toQueryParams(); 5081 Object.extend(options.parameters, params); 5082 } 5083 5084 if (form.hasAttribute('method') && !options.method) 5085 options.method = form.method; 5086 5087 return new Ajax.Request(action, options); 5088 } 5089}; 5090 5091/*--------------------------------------------------------------------------*/ 5092 5093 5094Form.Element = { 5095 focus: function(element) { 5096 $(element).focus(); 5097 return element; 5098 }, 5099 5100 select: function(element) { 5101 $(element).select(); 5102 return element; 5103 } 5104}; 5105 5106Form.Element.Methods = { 5107 5108 serialize: function(element) { 5109 element = $(element); 5110 if (!element.disabled && element.name) { 5111 var value = element.getValue(); 5112 if (value != undefined) { 5113 var pair = { }; 5114 pair[element.name] = value; 5115 return Object.toQueryString(pair); 5116 } 5117 } 5118 return ''; 5119 }, 5120 5121 getValue: function(element) { 5122 element = $(element); 5123 var method = element.tagName.toLowerCase(); 5124 return Form.Element.Serializers[method](element); 5125 }, 5126 5127 setValue: function(element, value) { 5128 element = $(element); 5129 var method = element.tagName.toLowerCase(); 5130 Form.Element.Serializers[method](element, value); 5131 return element; 5132 }, 5133 5134 clear: function(element) { 5135 $(element).value = ''; 5136 return element; 5137 }, 5138 5139 present: function(element) { 5140 return $(element).value != ''; 5141 }, 5142 5143 activate: function(element) { 5144 element = $(element); 5145 try { 5146 element.focus(); 5147 if (element.select && (element.tagName.toLowerCase() != 'input' || 5148 !(/^(?:button|reset|submit)$/i.test(element.type)))) 5149 element.select(); 5150 } catch (e) { } 5151 return element; 5152 }, 5153 5154 disable: function(element) { 5155 element = $(element); 5156 element.disabled = true; 5157 return element; 5158 }, 5159 5160 enable: function(element) { 5161 element = $(element); 5162 element.disabled = false; 5163 return element; 5164 } 5165}; 5166 5167/*--------------------------------------------------------------------------*/ 5168 5169var Field = Form.Element; 5170 5171var $F = Form.Element.Methods.getValue; 5172 5173/*--------------------------------------------------------------------------*/ 5174 5175Form.Element.Serializers = (function() { 5176 function input(element, value) { 5177 switch (element.type.toLowerCase()) { 5178 case 'checkbox': 5179 case 'radio': 5180 return inputSelector(element, value); 5181 default: 5182 return valueSelector(element, value); 5183 } 5184 } 5185 5186 function inputSelector(element, value) { 5187 if (Object.isUndefined(value)) 5188 return element.checked ? element.value : null; 5189 else element.checked = !!value; 5190 } 5191 5192 function valueSelector(element, value) { 5193 if (Object.isUndefined(value)) return element.value; 5194 else element.value = value; 5195 } 5196 5197 function select(element, value) { 5198 if (Object.isUndefined(value)) 5199 return (element.type === 'select-one' ? selectOne : selectMany)(element); 5200 5201 var opt, currentValue, single = !Object.isArray(value); 5202 for (var i = 0, length = element.length; i < length; i++) { 5203 opt = element.options[i]; 5204 currentValue = this.optionValue(opt); 5205 if (single) { 5206 if (currentValue == value) { 5207 opt.selected = true; 5208 return; 5209 } 5210 } 5211 else opt.selected = value.include(currentValue); 5212 } 5213 } 5214 5215 function selectOne(element) { 5216 var index = element.selectedIndex; 5217 return index >= 0 ? optionValue(element.options[index]) : null; 5218 } 5219 5220 function selectMany(element) { 5221 var values, length = element.length; 5222 if (!length) return null; 5223 5224 for (var i = 0, values = []; i < length; i++) { 5225 var opt = element.options[i]; 5226 if (opt.selected) values.push(optionValue(opt)); 5227 } 5228 return values; 5229 } 5230 5231 function optionValue(opt) { 5232 return Element.hasAttribute(opt, 'value') ? opt.value : opt.text; 5233 } 5234 5235 return { 5236 input: input, 5237 inputSelector: inputSelector, 5238 textarea: valueSelector, 5239 select: select, 5240 selectOne: selectOne, 5241 selectMany: selectMany, 5242 optionValue: optionValue, 5243 button: valueSelector 5244 }; 5245})(); 5246 5247/*--------------------------------------------------------------------------*/ 5248 5249 5250Abstract.TimedObserver = Class.create(PeriodicalExecuter, { 5251 initialize: function($super, element, frequency, callback) { 5252 $super(callback, frequency); 5253 this.element = $(element); 5254 this.lastValue = this.getValue(); 5255 }, 5256 5257 execute: function() { 5258 var value = this.getValue(); 5259 if (Object.isString(this.lastValue) && Object.isString(value) ? 5260 this.lastValue != value : String(this.lastValue) != String(value)) { 5261 this.callback(this.element, value); 5262 this.lastValue = value; 5263 } 5264 } 5265}); 5266 5267Form.Element.Observer = Class.create(Abstract.TimedObserver, { 5268 getValue: function() { 5269 return Form.Element.getValue(this.element); 5270 } 5271}); 5272 5273Form.Observer = Class.create(Abstract.TimedObserver, { 5274 getValue: function() { 5275 return Form.serialize(this.element); 5276 } 5277}); 5278 5279/*--------------------------------------------------------------------------*/ 5280 5281Abstract.EventObserver = Class.create({ 5282 initialize: function(element, callback) { 5283 this.element = $(element); 5284 this.callback = callback; 5285 5286 this.lastValue = this.getValue(); 5287 if (this.element.tagName.toLowerCase() == 'form') 5288 this.registerFormCallbacks(); 5289 else 5290 this.registerCallback(this.element); 5291 }, 5292 5293 onElementEvent: function() { 5294 var value = this.getValue(); 5295 if (this.lastValue != value) { 5296 this.callback(this.element, value); 5297 this.lastValue = value; 5298 } 5299 }, 5300 5301 registerFormCallbacks: function() { 5302 Form.getElements(this.element).each(this.registerCallback, this); 5303 }, 5304 5305 registerCallback: function(element) { 5306 if (element.type) { 5307 switch (element.type.toLowerCase()) { 5308 case 'checkbox': 5309 case 'radio': 5310 Event.observe(element, 'click', this.onElementEvent.bind(this)); 5311 break; 5312 default: 5313 Event.observe(element, 'change', this.onElementEvent.bind(this)); 5314 break; 5315 } 5316 } 5317 } 5318}); 5319 5320Form.Element.EventObserver = Class.create(Abstract.EventObserver, { 5321 getValue: function() { 5322 return Form.Element.getValue(this.element); 5323 } 5324}); 5325 5326Form.EventObserver = Class.create(Abstract.EventObserver, { 5327 getValue: function() { 5328 return Form.serialize(this.element); 5329 } 5330}); 5331(function() { 5332 5333 var Event = { 5334 KEY_BACKSPACE: 8, 5335 KEY_TAB: 9, 5336 KEY_RETURN: 13, 5337 KEY_ESC: 27, 5338 KEY_LEFT: 37, 5339 KEY_UP: 38, 5340 KEY_RIGHT: 39, 5341 KEY_DOWN: 40, 5342 KEY_DELETE: 46, 5343 KEY_HOME: 36, 5344 KEY_END: 35, 5345 KEY_PAGEUP: 33, 5346 KEY_PAGEDOWN: 34, 5347 KEY_INSERT: 45, 5348 5349 cache: {} 5350 }; 5351 5352 var docEl = document.documentElement; 5353 var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl 5354 && 'onmouseleave' in docEl; 5355 5356 5357 5358 var isIELegacyEvent = function(event) { return false; }; 5359 5360 if (window.attachEvent) { 5361 if (window.addEventListener) { 5362 isIELegacyEvent = function(event) { 5363 return !(event instanceof window.Event); 5364 }; 5365 } else { 5366 isIELegacyEvent = function(event) { return true; }; 5367 } 5368 } 5369 5370 var _isButton; 5371 5372 function _isButtonForDOMEvents(event, code) { 5373 return event.which ? (event.which === code + 1) : (event.button === code); 5374 } 5375 5376 var legacyButtonMap = { 0: 1, 1: 4, 2: 2 }; 5377 function _isButtonForLegacyEvents(event, code) { 5378 return event.button === legacyButtonMap[code]; 5379 } 5380 5381 function _isButtonForWebKit(event, code) { 5382 switch (code) { 5383 case 0: return event.which == 1 && !event.metaKey; 5384 case 1: return event.which == 2 || (event.which == 1 && event.metaKey); 5385 case 2: return event.which == 3; 5386 default: return false;
5387 } 5388 } 5389 5390 if (window.attachEvent) { 5391 if (!window.addEventListener) { 5392 _isButton = _isButtonForLegacyEvents; 5393 } else { 5394 _isButton = function(event, code) { 5395 return isIELegacyEvent(event) ? _isButtonForLegacyEvents(event, code) : 5396 _isButtonForDOMEvents(event, code); 5397 } 5398 } 5399 } else if (Prototype.Browser.WebKit) { 5400 _isButton = _isButtonForWebKit; 5401 } else { 5402 _isButton = _isButtonForDOMEvents; 5403 } 5404 5405 function isLeftClick(event) { return _isButton(event, 0) } 5406 5407 function isMiddleClick(event) { return _isButton(event, 1) } 5408 5409 function isRightClick(event) { return _isButton(event, 2) } 5410 5411 function element(event) { 5412 event = Event.extend(event); 5413 5414 var node = event.target, type = event.type, 5415 currentTarget = event.currentTarget; 5416 5417 if (currentTarget && currentTarget.tagName) { 5418 if (type === 'load' || type === 'error' || 5419 (type === 'click' && currentTarget.tagName.toLowerCase() === 'input' 5420 && currentTarget.type === 'radio')) 5421 node = currentTarget; 5422 } 5423 5424 if (node.nodeType == Node.TEXT_NODE) 5425 node = node.parentNode; 5426 5427 return Element.extend(node); 5428 } 5429 5430 function findElement(event, expression) { 5431 var element = Event.element(event); 5432 5433 if (!expression) return element; 5434 while (element) { 5435 if (Object.isElement(element) && Prototype.Selector.match(element, expression)) { 5436 return Element.extend(element); 5437 } 5438 element = element.parentNode; 5439 } 5440 } 5441 5442 function pointer(event) { 5443 return { x: pointerX(event), y: pointerY(event) }; 5444 } 5445 5446 function pointerX(event) { 5447 var docElement = document.documentElement, 5448 body = document.body || { scrollLeft: 0 }; 5449 5450 return event.pageX || (event.clientX + 5451 (docElement.scrollLeft || body.scrollLeft) - 5452 (docElement.clientLeft || 0)); 5453 } 5454 5455 function pointerY(event) { 5456 var docElement = document.documentElement, 5457 body = document.body || { scrollTop: 0 }; 5458 5459 return event.pageY || (event.clientY + 5460 (docElement.scrollTop || body.scrollTop) - 5461 (docElement.clientTop || 0)); 5462 } 5463 5464 5465 function stop(event) { 5466 Event.extend(event); 5467 event.preventDefault(); 5468 event.stopPropagation(); 5469 5470 event.stopped = true; 5471 } 5472 5473 5474 Event.Methods = { 5475 isLeftClick: isLeftClick, 5476 isMiddleClick: isMiddleClick, 5477 isRightClick: isRightClick, 5478 5479 element: element, 5480 findElement: findElement, 5481 5482 pointer: pointer, 5483 pointerX: pointerX, 5484 pointerY: pointerY, 5485 5486 stop: stop 5487 }; 5488 5489 var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { 5490 m[name] = Event.Methods[name].methodize(); 5491 return m; 5492 }); 5493 5494 if (window.attachEvent) { 5495 function _relatedTarget(event) { 5496 var element; 5497 switch (event.type) { 5498 case 'mouseover': 5499 case 'mouseenter': 5500 element = event.fromElement; 5501 break; 5502 case 'mouseout': 5503 case 'mouseleave': 5504 element = event.toElement; 5505 break; 5506 default: 5507 return null; 5508 } 5509 return Element.extend(element); 5510 } 5511 5512 var additionalMethods = { 5513 stopPropagation: function() { this.cancelBubble = true }, 5514 preventDefault: function() { this.returnValue = false }, 5515 inspect: function() { return '[object Event]' } 5516 }; 5517 5518 Event.extend = function(event, element) { 5519 if (!event) return false; 5520 5521 if (!isIELegacyEvent(event)) return event; 5522 5523 if (event._extendedByPrototype) return event; 5524 event._extendedByPrototype = Prototype.emptyFunction; 5525 5526 var pointer = Event.pointer(event); 5527 5528 Object.extend(event, { 5529 target: event.srcElement || element, 5530 relatedTarget: _relatedTarget(event), 5531 pageX: pointer.x, 5532 pageY: pointer.y 5533 }); 5534 5535 Object.extend(event, methods); 5536 Object.extend(event, additionalMethods); 5537 5538 return event; 5539 }; 5540 } else { 5541 Event.extend = Prototype.K; 5542 } 5543 5544 if (window.addEventListener) { 5545 Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__; 5546 Object.extend(Event.prototype, methods); 5547 } 5548 5549 function _createResponder(element, eventName, handler) { 5550 var registry = Element.retrieve(element, 'prototype_event_registry'); 5551 5552 if (Object.isUndefined(registry)) { 5553 CACHE.push(element); 5554 registry = Element.retrieve(element, 'prototype_event_registry', $H()); 5555 } 5556 5557 var respondersForEvent = registry.get(eventName); 5558 if (Object.isUndefined(respondersForEvent)) { 5559 respondersForEvent = []; 5560 registry.set(eventName, respondersForEvent); 5561 } 5562 5563 if (respondersForEvent.pluck('handler').include(handler)) return false;
5564 5565 var responder; 5566 if (eventName.include(":")) { 5567 responder = function(event) { 5568 if (Object.isUndefined(event.eventName)) 5569 return false; 5570 5571 if (event.eventName !== eventName) 5572 return false; 5573 5574 Event.extend(event, element); 5575 handler.call(element, event); 5576 }; 5577 } else { 5578 if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED && 5579 (eventName === "mouseenter" || eventName === "mouseleave")) { 5580 if (eventName === "mouseenter" || eventName === "mouseleave") { 5581 responder = function(event) { 5582 Event.extend(event, element); 5583 5584 var parent = event.relatedTarget; 5585 while (parent && parent !== element) { 5586 try { parent = parent.parentNode; } 5587 catch(e) { parent = element; } 5588 } 5589 5590 if (parent === element) return; 5591 5592 handler.call(element, event); 5593 }; 5594 } 5595 } else { 5596 responder = function(event) { 5597 Event.extend(event, element); 5598 handler.call(element, event); 5599 }; 5600 } 5601 } 5602 5603 responder.handler = handler; 5604 respondersForEvent.push(responder); 5605 return responder; 5606 } 5607 5608 function _destroyCache() { 5609 for (var i = 0, length = CACHE.length; i < length; i++) { 5610 Event.stopObserving(CACHE[i]); 5611 CACHE[i] = null; 5612 } 5613 } 5614 5615 var CACHE = []; 5616 5617 if (Prototype.Browser.IE) 5618 window.attachEvent('onunload', _destroyCache); 5619 5620 if (Prototype.Browser.WebKit){ 5621 //Alterado por Matheus - Alterado o evento de unload para pagehide, pois é o indicado pelo pagespeed para a utilização do bfcache 5622 window.addEventListener('pagehide', Prototype.emptyFunction, false); 5623 //Original 5624 //window.addEventListener('unload', Prototype.emptyFunction, false); 5625 } 5626 5627 5628 var _getDOMEventName = Prototype.K, 5629 translations = { mouseenter: "mouseover", mouseleave: "mouseout" }; 5630 5631 if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) { 5632 _getDOMEventName = function(eventName) { 5633 return (translations[eventName] || eventName); 5634 }; 5635 } 5636 5637 function observe(element, eventName, handler) { 5638 element = $(element); 5639 5640 var responder = _createResponder(element, eventName, handler); 5641 5642 if (!responder) return element; 5643 5644 if (eventName.include(':')) { 5645 if (element.addEventListener) 5646 element.addEventListener("dataavailable", responder, false); 5647 else { 5648 element.attachEvent("ondataavailable", responder); 5649 element.attachEvent("onlosecapture", responder); 5650 } 5651 } else { 5652 var actualEventName = _getDOMEventName(eventName); 5653 5654 if (element.addEventListener) 5655 element.addEventListener(actualEventName, responder, false); 5656 else 5657 element.attachEvent("on" + actualEventName, responder); 5658 } 5659 5660 return element; 5661 } 5662 5663 function stopObserving(element, eventName, handler) { 5664 element = $(element); 5665 5666 var registry = Element.retrieve(element, 'prototype_event_registry'); 5667 if (!registry) return element; 5668 5669 if (!eventName) { 5670 registry.each( function(pair) { 5671 var eventName = pair.key; 5672 stopObserving(element, eventName); 5673 }); 5674 return element; 5675 } 5676 5677 var responders = registry.get(eventName); 5678 if (!responders) return element; 5679 5680 if (!handler) { 5681 responders.each(function(r) { 5682 stopObserving(element, eventName, r.handler); 5683 }); 5684 return element; 5685 } 5686 5687 var i = responders.length, responder; 5688 while (i--) { 5689 if (responders[i].handler === handler) { 5690 responder = responders[i]; 5691 break; 5692 } 5693 } 5694 if (!responder) return element; 5695 5696 if (eventName.include(':')) { 5697 if (element.removeEventListener) 5698 element.removeEventListener("dataavailable", responder, false); 5699 else { 5700 element.detachEvent("ondataavailable", responder); 5701 element.detachEvent("onlosecapture", responder); 5702 } 5703 } else { 5704 var actualEventName = _getDOMEventName(eventName); 5705 if (element.removeEventListener) 5706 element.removeEventListener(actualEventName, responder, false); 5707 else 5708 element.detachEvent('on' + actualEventName, responder); 5709 } 5710 5711 registry.set(eventName, responders.without(responder)); 5712 5713 return element; 5714 } 5715 5716 function fire(element, eventName, memo, bubble) { 5717 element = $(element); 5718 5719 if (Object.isUndefined(bubble)) 5720 bubble = true; 5721 5722 if (element == document && document.createEvent && !element.dispatchEvent) 5723 element = document.documentElement; 5724 5725 var event; 5726 if (document.createEvent) { 5727 event = document.createEvent('HTMLEvents'); 5728 event.initEvent('dataavailable', bubble, true); 5729 } else { 5730 event = document.createEventObject(); 5731 event.eventType = bubble ? 'ondataavailable' : 'onlosecapture'; 5732 } 5733 5734 event.eventName = eventName; 5735 event.memo = memo || { }; 5736 5737 if (document.createEvent) 5738 element.dispatchEvent(event); 5739 else 5740 element.fireEvent(event.eventType, event); 5741 5742 return Event.extend(event); 5743 } 5744 5745 Event.Handler = Class.create({ 5746 initialize: function(element, eventName, selector, callback) { 5747 this.element = $(element); 5748 this.eventName = eventName; 5749 this.selector = selector; 5750 this.callback = callback; 5751 this.handler = this.handleEvent.bind(this); 5752 }, 5753 5754 start: function() { 5755 Event.observe(this.element, this.eventName, this.handler); 5756 return this; 5757 }, 5758 5759 stop: function() { 5760 Event.stopObserving(this.element, this.eventName, this.handler); 5761 return this; 5762 }, 5763 5764 handleEvent: function(event) { 5765 var element = Event.findElement(event, this.selector); 5766 if (element) this.callback.call(this.element, event, element); 5767 } 5768 }); 5769 5770 function on(element, eventName, selector, callback) { 5771 element = $(element); 5772 if (Object.isFunction(selector) && Object.isUndefined(callback)) { 5773 callback = selector, selector = null; 5774 } 5775 5776 return new Event.Handler(element, eventName, selector, callback).start(); 5777 } 5778 5779 Object.extend(Event, Event.Methods); 5780 5781 Object.extend(Event, { 5782 fire: fire, 5783 observe: observe, 5784 stopObserving: stopObserving, 5785 on: on 5786 }); 5787 5788 Element.addMethods({ 5789 fire: fire, 5790 5791 observe: observe, 5792 5793 stopObserving: stopObserving, 5794 5795 on: on 5796 }); 5797 5798 Object.extend(document, { 5799 fire: fire.methodize(), 5800 5801 observe: observe.methodize(), 5802 5803 stopObserving: stopObserving.methodize(), 5804 5805 on: on.methodize(), 5806 5807 loaded: false 5808 }); 5809 5810 if (window.Event) Object.extend(window.Event, Event); 5811 else window.Event = Event; 5812})(); 5813 5814(function() { 5815 /* Support for the DOMContentLoaded event is based on work by Dan Webb, 5816 Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */ 5817 5818 var timer; 5819 5820 function fireContentLoadedEvent() { 5821 if (document.loaded) return; 5822 if (timer) window.clearTimeout(timer); 5823 document.loaded = true; 5824 document.fire('dom:loaded'); 5825 } 5826 5827 function checkReadyState() { 5828 if (document.readyState === 'complete') { 5829 document.stopObserving('readystatechange', checkReadyState); 5830 fireContentLoadedEvent(); 5831 } 5832 } 5833 5834 function pollDoScroll() { 5835 try { document.documentElement.doScroll('left'); } 5836 catch(e) { 5837 timer = pollDoScroll.defer(); 5838 return; 5839 } 5840 fireContentLoadedEvent(); 5841 } 5842 5843 if (document.addEventListener) { 5844 document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false); 5845 } else { 5846 document.observe('readystatechange', checkReadyState); 5847 if (window == top) 5848 timer = pollDoScroll.defer(); 5849 } 5850 5851 Event.observe(window, 'load', fireContentLoadedEvent); 5852})(); 5853 5854Element.addMethods(); 5855 5856/*------------------------------- DEPRECATED -------------------------------*/ 5857 5858Hash.toQueryString = Object.toQueryString; 5859 5860var Toggle = { display: Element.toggle }; 5861 5862Element.Methods.childOf = Element.Methods.descendantOf; 5863 5864var Insertion = { 5865 Before: function(element, content) { 5866 return Element.insert(element, {before:content}); 5867 }, 5868 5869 Top: function(element, content) { 5870 return Element.insert(element, {top:content}); 5871 }, 5872 5873 Bottom: function(element, content) { 5874 return Element.insert(element, {bottom:content}); 5875 }, 5876 5877 After: function(element, content) { 5878 return Element.insert(element, {after:content}); 5879 } 5880}; 5881 5882var $continue = new Error('"throw $continue" is deprecated, use "return" instead'); 5883 5884var Position = { 5885 includeScrollOffsets: false, 5886 5887 prepare: function() { 5888 this.deltaX = window.pageXOffset 5889 || document.documentElement.scrollLeft 5890 || document.body.scrollLeft 5891 || 0; 5892 this.deltaY = window.pageYOffset 5893 || document.documentElement.scrollTop 5894 || document.body.scrollTop 5895 || 0; 5896 }, 5897 5898 within: function(element, x, y) { 5899 if (this.includeScrollOffsets) 5900 return this.withinIncludingScrolloffsets(element, x, y); 5901 this.xcomp = x; 5902 this.ycomp = y; 5903 this.offset = Element.cumulativeOffset(element); 5904 5905 return (y >= this.offset[1] && 5906 y < this.offset[1] + element.offsetHeight && 5907 x >= this.offset[0] && 5908 x < this.offset[0] + element.offsetWidth); 5909 }, 5910 5911 withinIncludingScrolloffsets: function(element, x, y) { 5912 var offsetcache = Element.cumulativeScrollOffset(element); 5913 5914 this.xcomp = x + offsetcache[0] - this.deltaX; 5915 this.ycomp = y + offsetcache[1] - this.deltaY; 5916 this.offset = Element.cumulativeOffset(element); 5917 5918 return (this.ycomp >= this.offset[1] && 5919 this.ycomp < this.offset[1] + element.offsetHeight && 5920 this.xcomp >= this.offset[0] && 5921 this.xcomp < this.offset[0] + element.offsetWidth); 5922 }, 5923 5924 overlap: function(mode, element) { 5925 if (!mode) return 0; 5926 if (mode == 'vertical') 5927 return ((this.offset[1] + element.offsetHeight) - this.ycomp) / 5928 element.offsetHeight; 5929 if (mode == 'horizontal') 5930 return ((this.offset[0] + element.offsetWidth) - this.xcomp) / 5931 element.offsetWidth; 5932 }, 5933 5934 5935 cumulativeOffset: Element.Methods.cumulativeOffset, 5936 5937 positionedOffset: Element.Methods.positionedOffset, 5938 5939 absolutize: function(element) { 5940 Position.prepare(); 5941 return Element.absolutize(element); 5942 }, 5943 5944 relativize: function(element) { 5945 Position.prepare(); 5946 return Element.relativize(element); 5947 }, 5948 5949 realOffset: Element.Methods.cumulativeScrollOffset, 5950 5951 offsetParent: Element.Methods.getOffsetParent, 5952 5953 page: Element.Methods.viewportOffset, 5954 5955 clone: function(source, target, options) { 5956 options = options || { }; 5957 return Element.clonePosition(target, source, options); 5958 } 5959}; 5960 5961/*--------------------------------------------------------------------------*/ 5962 5963if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){ 5964 function iter(name) { 5965 return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]"; 5966 } 5967 5968 instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ? 5969 function(element, className) {
5970 className = className.toString().strip(); 5971 var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className); 5972 return cond ? document._getElementsByXPath('.//*' + cond, element) : []; 5973 } : function(element, className) { 5974 className = className.toString().strip(); 5975 var elements = [], classNames = (/\s/.test(className) ? $w(className) : null); 5976 if (!classNames && !className) return elements; 5977 5978 var nodes = $(element).getElementsByTagName('*'); 5979 className = ' ' + className + ' '; 5980 5981 for (var i = 0, child, cn; child = nodes[i]; i++) { 5982 if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) || 5983 (classNames && classNames.all(function(name) { 5984 return !name.toString().blank() && cn.include(' ' + name + ' '); 5985 })))) 5986 elements.push(Element.extend(child)); 5987 } 5988 return elements; 5989 }; 5990 5991 return function(className, parentElement) { 5992 return $(parentElement || document.body).getElementsByClassName(className); 5993 }; 5994}(Element.Methods); 5995 5996/*--------------------------------------------------------------------------*/ 5997 5998Element.ClassNames = Class.create(); 5999Element.ClassNames.prototype = { 6000 initialize: function(element) { 6001 this.element = $(element); 6002 }, 6003 6004 _each: function(iterator) { 6005 this.element.className.split(/\s+/).select(function(name) { 6006 return name.length > 0; 6007 })._each(iterator); 6008 }, 6009 6010 set: function(className) { 6011 this.element.className = className; 6012 }, 6013 6014 add: function(classNameToAdd) { 6015 if (this.include(classNameToAdd)) return; 6016 this.set($A(this).concat(classNameToAdd).join(' ')); 6017 }, 6018 6019 remove: function(classNameToRemove) { 6020 if (!this.include(classNameToRemove)) return; 6021 this.set($A(this).without(classNameToRemove).join(' ')); 6022 }, 6023 6024 toString: function() { 6025 return $A(this).join(' '); 6026 } 6027}; 6028 6029Object.extend(Element.ClassNames.prototype, Enumerable); 6030 6031/*--------------------------------------------------------------------------*/ 6032 6033(function() { 6034 window.Selector = Class.create({ 6035 initialize: function(expression) { 6036 this.expression = expression.strip(); 6037 }, 6038 6039 findElements: function(rootElement) { 6040 return Prototype.Selector.select(this.expression, rootElement); 6041 }, 6042 6043 match: function(element) { 6044 return Prototype.Selector.match(element, this.expression); 6045 }, 6046 6047 toString: function() { 6048 return this.expression; 6049 }, 6050 6051 inspect: function() { 6052 return "#<Selector: " + this.expression + ">"; 6053 } 6054 }); 6055 6056 Object.extend(Selector, { 6057 matchElements: function(elements, expression) { 6058 var match = Prototype.Selector.match, 6059 results = []; 6060 6061 for (var i = 0, length = elements.length; i < length; i++) { 6062 var element = elements[i]; 6063 if (match(element, expression)) { 6064 results.push(Element.extend(element)); 6065 } 6066 } 6067 return results; 6068 }, 6069 6070 findElement: function(elements, expression, index) { 6071 index = index || 0; 6072 var matchIndex = 0, element; 6073 for (var i = 0, length = elements.length; i < length; i++) { 6074 element = elements[i]; 6075 if (Prototype.Selector.match(element, expression) && index === matchIndex++) { 6076 return Element.extend(element); 6077 } 6078 } 6079 }, 6080 6081 findChildElements: function(element, expressions) { 6082 var selector = expressions.toArray().join(', '); 6083 return Prototype.Selector.select(selector, element || document); 6084 } 6085 }); 6086})(); 6087
vendor: 86,927 bytes, lines 6088-6089
6088/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */ 6089!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:n.sort,splice:n.splice},w.extend=w.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||g(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],a!==(r=e[t])&&(l&&r&&(w.isPlainObject(r)||(i=Array.isArray(r)))?(i?(i=!1,o=n&&Array.isArray(n)?n:[]):o=n&&w.isPlainObject(n)?n:{},a[t]=w.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},w.extend({expando:"jQuery"+("3.3.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==c.call(e))&&(!(t=i(e))||"function"==typeof(n=f.call(t,"constructor")&&t.constructor)&&p.call(n)===d)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e){m(e)},each:function(e,t){var n,r=0;if(C(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(C(Object(e))?w.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:u.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;o<a;o++)(r=!t(e[o],o))!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(C(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&s.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&s.push(i);return a.apply([],s)},guid:1,support:h}),"function"==typeof Symbol&&(w.fn[Symbol.iterator]=n[Symbol.iterator]),w.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function C(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!g(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},P="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",I="\\["+M+"*("+R+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+M+"*\\]",W=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|.*)\\)|)",$=new RegExp(M+"+","g"),B=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),F=new RegExp("^"+M+"*,"+M+"*"),_=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="<a id='"+b+"'></a><select id='"+b+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:he(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:he(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=fe(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pe(t);function ye(){}ye.prototype=r.filters=r.pseudos,r.setFilters=new ye,a=oe.tokenize=function(e,t){var n,i,o,a,s,u,l,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=r.preFilter;while(s){n&&!(i=F.exec(s))||(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),n=!1,(i=_.exec(s))&&(n=i.shift(),o.push({value:n,type:i[0].replace(B," ")}),s=s.slice(n.length));for(a in r.filter)!(i=V[a].exec(s))||l[a]&&!(i=l[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),s=s.slice(n.length));if(!n)break}return t?s.length:s?oe.error(e):k(e,u).slice(0)};function ve(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function me(e,t,n){var r=t.dir,i=t.next,o=i||r,a=n&&"parentNode"===o,s=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||a)return e(t,n,i);return!1}:function(t,n,u){var l,c,f,p=[T,s];if(u){while(t=t[r])if((1===t.nodeType||a)&&e(t,n,u))return!0}else while(t=t[r])if(1===t.nodeType||a)if(f=t[b]||(t[b]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[o])&&l[0]===T&&l[1]===s)return p[2]=l[2];if(c[o]=p,p[2]=e(t,n,u))return!0}return!1}}function xe(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r<i;r++)oe(e,t[r],n);return n}function we(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Te(e,t,n,r,i,o){return r&&!r[b]&&(r=Te(r)),i&&!i[b]&&(i=Te(i,o)),se(function(o,a,s,u){var l,c,f,p=[],d=[],h=a.length,g=o||be(t||"*",s.nodeType?[s]:s,[]),y=!e||!o&&t?g:we(g,p,e,s,u),v=n?i||(o?e:h||r)?[]:a:y;if(n&&n(y,v,s,u),r){l=we(v,d),r(l,[],s,u),c=l.length;while(c--)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f))}if(o){if(i||e){if(i){l=[],c=v.length;while(c--)(f=v[c])&&l.push(y[c]=f);i(null,v=[],l,u)}c=v.length;while(c--)(f=v[c])&&(l=i?O(o,f):p[c])>-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u<o;u++)if(n=r.relative[e[u].type])p=[me(xe(p),n)];else{if((n=r.filter[e[u].type].apply(null,e[u].matches))[b]){for(i=++u;i<o;i++)if(r.relative[e[i].type])break;return Te(u>1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u<i&&Ce(e.slice(u,i)),i<o&&Ce(e=e.slice(i)),i<o&&ve(e))}p.push(n)}return xe(p)}function Ee(e,t){var n=t.length>0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t<r;t++)if(w.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)w.find(e,i[t],n);return r>1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(w.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&w(e);if(!D.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s<o.length)!1===o[s].apply(n[0],n[1])&&e.stopOnFalse&&(s=o.length,n=!1)}e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function t(n){w.each(n,function(n,r){g(r)?e.unique&&l.has(r)||o.push(r):r&&r.length&&"string"!==x(r)&&t(r)})}(arguments),n&&!t&&u()),this},remove:function(){return w.each(arguments,function(e,t){var n;while((n=w.inArray(t,o,n))>-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t<o)){if((e=r.apply(s,u))===n.promise())throw new TypeError("Thenable self-resolution");l=e&&("object"==typeof e||"function"==typeof e)&&e.then,g(l)?i?l.call(e,a(o,n,I,i),a(o,n,W,i)):(o++,l.call(e,a(o,n,I,i),a(o,n,W,i),a(o,n,I,n.notifyWith))):(r!==I&&(s=void 0,u=[e]),(i||n.resolveWith)(s,u))}},c=i?l:function(){try{l()}catch(e){w.Deferred.exceptionHook&&w.Deferred.exceptionHook(e,c.stackTrace),t+1>=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},X=/^-ms-/,U=/-([a-z])/g;function V(e,t){return t.toUpperCase()}function G(e){return e.replace(X,"ms-").replace(U,V)}var Y=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function Q(){this.expando=w.expando+Q.uid++}Q.uid=1,Q.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Y(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[G(t)]=n;else for(r in t)i[G(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][G(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(G):(t=G(t))in r?[t]:t.match(M)||[]).length;while(n--)delete r[t[n]]}(void 0===t||w.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!w.isEmptyObject(t)}};var J=new Q,K=new Q,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ee=/[A-Z]/g;function te(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Z.test(e)?JSON.parse(e):e)}function ne(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ee,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=te(n)}catch(e){}K.set(e,t,n)}else n=void 0;return n}w.extend({hasData:function(e){return K.hasData(e)||J.hasData(e)},data:function(e,t,n){return K.access(e,t,n)},removeData:function(e,t){K.remove(e,t)},_data:function(e,t,n){return J.access(e,t,n)},_removeData:function(e,t){J.remove(e,t)}}),w.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=K.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){n=a.length;while(n--)a[n]&&0===(r=a[n].name).indexOf("data-")&&(r=G(r.slice(5)),ne(o,r,i[r]));J.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof e?this.each(function(){K.set(this,e)}):z(this,function(t){var n;if(o&&void 0===t){if(void 0!==(n=K.get(o,e)))return n;if(void 0!==(n=ne(o,e)))return n}else this.each(function(){K.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?w.queue(this[0],e):void 0===t?this:this.each(function(){var n=w.queue(this,e,t);w._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&w.dequeue(this,e)})},dequeue:function(e){return this.each(function(){w.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=w.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=J.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var re=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ie=new RegExp("^(?:([+-])=|)("+re+")([a-z%]*)$","i"),oe=["Top","Right","Bottom","Left"],ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&w.contains(e.ownerDocument,e)&&"none"===w.css(e,"display")},se=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i};function ue(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return w.css(e,t,"")},u=s(),l=n&&n[3]||(w.cssNumber[t]?"":"px"),c=(w.cssNumber[t]||"px"!==l&&+u)&&ie.exec(w.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)w.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,w.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var le={};function ce(e){var t,n=e.ownerDocument,r=e.nodeName,i=le[r];return i||(t=n.body.appendChild(n.createElement(r)),i=w.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),le[r]=i,i)}function fe(e,t){for(var n,r,i=[],o=0,a=e.length;o<a;o++)(r=e[o]).style&&(n=r.style.display,t?("none"===n&&(i[o]=J.get(r,"display")||null,i[o]||(r.style.display="")),""===r.style.display&&ae(r)&&(i[o]=ce(r))):"none"!==n&&(i[o]="none",J.set(r,"display",n)));for(o=0;o<a;o++)null!=i[o]&&(e[o].style.display=i[o]);return e}w.fn.extend({show:function(){return fe(this,!0)},hide:function(){return fe(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?w(this).show():w(this).hide()})}});var pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n<r;n++)J.set(e[n],"globalEval",!t||J.get(t[n],"globalEval"))}var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))w.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+w.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;w.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&w.inArray(o,r)>-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n<arguments.length;n++)u[n]=arguments[n];if(t.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,t)){s=w.event.handlers.call(this,t,l),n=0;while((o=s[n++])&&!t.isPropagationStopped()){t.currentTarget=o.elem,r=0;while((a=o.handlers[r++])&&!t.isImmediatePropagationStopped())t.rnamespace&&!t.rnamespace.test(a.namespace)||(t.handleObj=a,t.data=a.data,void 0!==(i=((w.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u))&&!1===(t.result=i)&&(t.preventDefault(),t.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,t),t.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?w(i,this).index(l)>-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(w.Event.prototype,e,{enumerable:!0,configurable:!0,get:g(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[w.expando]?e:new w.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==Se()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===Se()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&N(this,"input"))return this.click(),!1},_default:function(e){return N(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},w.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},w.Event=function(e,t){if(!(this instanceof w.Event))return new w.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ee:ke,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&w.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[w.expando]=!0},w.Event.prototype={constructor:w.Event,isDefaultPrevented:ke,isPropagationStopped:ke,isImmediatePropagationStopped:ke,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ee,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ee,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ee,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},w.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&we.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Te.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},w.event.addProp),w.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){w.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return i&&(i===r||w.contains(r,i))||(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),w.fn.extend({on:function(e,t,n,r){return De(this,e,t,n,r)},one:function(e,t,n,r){return De(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,w(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=ke),this.each(function(){w.event.remove(this,e,n,t)})}});var Ne=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/<script|<style|<link/i,je=/checked\s*(?:[^=]|=\s*.checked.)/i,qe=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n<r;n++)w.event.add(t,i,l[i][n])}K.hasData(e)&&(s=K.access(e),u=w.extend({},s),K.set(t,u))}}function Me(e,t){var n=t.nodeName.toLowerCase();"input"===n&&pe.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Re(e,t,n,r){t=a.apply([],t);var i,o,s,u,l,c,f=0,p=e.length,d=p-1,y=t[0],v=g(y);if(v||p>1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f<p;f++)l=i,f!==d&&(l=w.clone(l,!0,!0),u&&w.merge(s,ye(l,"script"))),n.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,w.map(s,Oe),f=0;f<u;f++)l=s[f],he.test(l.type||"")&&!J.access(l,"globalEval")&&w.contains(c,l)&&(l.src&&"module"!==(l.type||"").toLowerCase()?w._evalUrl&&w._evalUrl(l.src):m(l.textContent.replace(qe,""),c,l))}return e}function Ie(e,t,n){for(var r,i=t?w.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||w.cleanData(ye(r)),r.parentNode&&(n&&w.contains(r.ownerDocument,r)&&ve(ye(r,"script")),r.parentNode.removeChild(r));return e}w.extend({htmlPrefilter:function(e){return e.replace(Ne,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r<i;r++)Me(o[r],a[r]);if(t)if(n)for(o=o||ye(e),a=a||ye(s),r=0,i=o.length;r<i;r++)Pe(o[r],a[r]);else Pe(e,s);return(a=ye(s,"script")).length>0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(w.cleanData(ye(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Re(this,arguments,function(t){var n=this.parentNode;w.inArray(this,e)<0&&(w.cleanData(ye(this)),n&&n.replaceChild(t,this))},e)}}),w.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){w.fn[e]=function(e){for(var n,r=[],i=w(e),o=i.length-1,a=0;a<=o;a++)n=a===o?this:this.clone(!0),w(i[a])[t](n),s.apply(r,n.get());return this.pushStack(r)}});var We=new RegExp("^("+re+")(?!px)[a-z%]+$","i"),$e=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},Be=new RegExp(oe.join("|"),"i");!function(){function t(){if(c){l.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",c.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",be.appendChild(l).appendChild(c);var t=e.getComputedStyle(c);i="1%"!==t.top,u=12===n(t.marginLeft),c.style.right="60%",s=36===n(t.right),o=36===n(t.width),c.style.position="absolute",a=36===c.offsetWidth||"absolute",be.removeChild(l),c=null}}function n(e){return Math.round(parseFloat(e))}var i,o,a,s,u,l=r.createElement("div"),c=r.createElement("div");c.style&&(c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",h.clearCloneStyle="content-box"===c.style.backgroundClip,w.extend(h,{boxSizingReliable:function(){return t(),o},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),u},scrollboxSize:function(){return t(),a}}))}();function Fe(e,t,n){var r,i,o,a,s=e.style;return(n=n||$e(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||w.contains(e.ownerDocument,e)||(a=w.style(e,t)),!h.pixelBoxStyles()&&We.test(a)&&Be.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function _e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}var ze=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ue={position:"absolute",visibility:"hidden",display:"block"},Ve={letterSpacing:"0",fontWeight:"400"},Ge=["Webkit","Moz","ms"],Ye=r.createElement("div").style;function Qe(e){if(e in Ye)return e;var t=e[0].toUpperCase()+e.slice(1),n=Ge.length;while(n--)if((e=Ge[n]+t)in Ye)return e}function Je(e){var t=w.cssProps[e];return t||(t=w.cssProps[e]=Qe(e)||e),t}function Ke(e,t,n){var r=ie.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ze(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=w.css(e,n+oe[a],!0,i)),r?("content"===n&&(u-=w.css(e,"padding"+oe[a],!0,i)),"margin"!==n&&(u-=w.css(e,"border"+oe[a]+"Width",!0,i))):(u+=w.css(e,"padding"+oe[a],!0,i),"padding"!==n?u+=w.css(e,"border"+oe[a]+"Width",!0,i):s+=w.css(e,"border"+oe[a]+"Width",!0,i));return!r&&o>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a<i;a++)o[t[a]]=w.css(e,t[a],!1,r);return o}return void 0!==n?w.style(e,t,n):w.css(e,t)},e,t,arguments.length>1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ct(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),y=J.get(e,"fxshow");n.queue||(null==(a=w._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,w.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(i=t[r],it.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!y||void 0===y[r])continue;g=!0}d[r]=y&&y[r]||w.style(e,r)}if((u=!w.isEmptyObject(t))||!w.isEmptyObject(d)){f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=y&&y.display)&&(l=J.get(e,"display")),"none"===(c=w.css(e,"display"))&&(l?c=l:(fe([e],!0),l=e.style.display||l,c=w.css(e,"display"),fe([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===w.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in d)u||(y?"hidden"in y&&(g=y.hidden):y=J.access(e,"fxshow",{display:l}),o&&(y.hidden=!g),g&&fe([e],!0),p.done(function(){g||fe([e]),J.remove(e,"fxshow");for(r in d)w.style(e,r,d[r])})),u=lt(g?y[r]:0,r,p),r in y||(y[r]=u.start,g&&(u.end=u.start,u.start=0))}}function ft(e,t){var n,r,i,o,a;for(n in e)if(r=G(n),i=t[r],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=w.cssHooks[r])&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function pt(e,t,n){var r,i,o=0,a=pt.prefilters.length,s=w.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=nt||st(),n=Math.max(0,l.startTime+l.duration-t),r=1-(n/l.duration||0),o=0,a=l.tweens.length;o<a;o++)l.tweens[o].run(r);return s.notifyWith(e,[l,r,n]),r<1&&a?n:(a||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:w.extend({},t),opts:w.extend(!0,{specialEasing:{},easing:w.easing._default},n),originalProperties:t,originalOptions:n,startTime:nt||st(),duration:n.duration,tweens:[],createTween:function(t,n){var r=w.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(ft(c,l.opts.specialEasing);o<a;o++)if(r=pt.prefilters[o].call(l,e,c,l.opts))return g(r.stop)&&(w._queueHooks(l.elem,l.opts.queue).stop=r.stop.bind(r)),r;return w.map(c,lt,l),g(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),w.fx.timer(w.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}w.Animation=w.extend(pt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return ue(n.elem,e,ie.exec(t),n),n}]},tweener:function(e,t){g(e)?(t=e,e=["*"]):e=e.match(M);for(var n,r=0,i=e.length;r<i;r++)n=e[r],pt.tweeners[n]=pt.tweeners[n]||[],pt.tweeners[n].unshift(t)},prefilters:[ct],prefilter:function(e,t){t?pt.prefilters.unshift(e):pt.prefilters.push(e)}}),w.speed=function(e,t,n){var r=e&&"object"==typeof e?w.extend({},e):{complete:n||!n&&t||g(e)&&e,duration:e,easing:n&&t||t&&!g(t)&&t};return w.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in w.fx.speeds?r.duration=w.fx.speeds[r.duration]:r.duration=w.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){g(r.old)&&r.old.call(this),r.queue&&w.dequeue(this,r.queue)},r},w.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=w.isEmptyObject(e),o=w.speed(t,n,r),a=function(){var t=pt(this,w.extend({},e),o);(i||J.get(this,"finish"))&&t.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&!1!==e&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=w.timers,a=J.get(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&ot.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));!t&&n||w.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,n=J.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=w.timers,a=r?r.length:0;for(n.finish=!0,w.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),w.each(["toggle","show","hide"],function(e,t){var n=w.fn[t];w.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ut(t,!0),e,r,i)}}),w.each({slideDown:ut("show"),slideUp:ut("hide"),slideToggle:ut("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){w.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),w.timers=[],w.fx.tick=function(){var e,t=0,n=w.timers;for(nt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||w.fx.stop(),nt=void 0},w.fx.timer=function(e){w.timers.push(e),w.fx.start()},w.fx.interval=13,w.fx.start=function(){rt||(rt=!0,at())},w.fx.stop=function(){rt=null},w.fx.speeds={slow:600,fast:200,_default:400},w.fn.delay=function(t,n){return t=w.fx?w.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var i=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(i)}})},function(){var e=r.createElement("input"),t=r.createElement("select").appendChild(r.createElement("option"));e.type="checkbox",h.checkOn=""!==e.value,h.optSelected=t.selected,(e=r.createElement("input")).value="t",e.type="radio",h.radioValue="t"===e.value}();var dt,ht=w.expr.attrHandle;w.fn.extend({attr:function(e,t){return z(this,w.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!N(n.parentNode,"optgroup"))){if(t=w(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=w.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=w.inArray(w.valHooks.option.get(r),o)>-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),r.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Yt=[],Qt=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Yt.pop()||w.expando+"_"+Et++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=!1!==t.jsonp&&(Qt.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Qt.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Qt,"$1"+i):!1!==t.jsonp&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||w.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?w(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,Yt.push(i)),a&&g(o)&&o(a[0]),a=o=void 0}),"script"}),h.createHTMLDocument=function(){var e=r.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),w.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var i,o,a;return t||(h.createHTMLDocument?((i=(t=r.implementation.createHTMLDocument("")).createElement("base")).href=r.location.href,t.head.appendChild(i)):t=r),o=A.exec(e),a=!n&&[],o?[t.createElement(o[1])]:(o=xe([e],t,a),a&&a.length&&w(a).remove(),w.merge([],o.childNodes))},w.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=vt(e.slice(s)),e=e.slice(0,s)),g(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&w.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?w("<div>").append(w.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.expr.pseudos.animated=function(e){return w.grep(w.timers,function(t){return e===t.elem}).length},w.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=w.css(e,"position"),f=w(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=w.css(e,"top"),u=w.css(e,"left"),(l=("absolute"===c||"fixed"===c)&&(o+u).indexOf("auto")>-1)?(a=(r=f.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),g(t)&&(t=t.call(e,n,w.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},w.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){w.offset.setOffset(this,e,t)});var t,n,r=this[0];if(r)return r.getClientRects().length?(t=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:t.top+n.pageYOffset,left:t.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===w.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===w.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),i.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-w.css(r,"marginTop",!0),left:t.left-i.left-w.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===w.css(e,"position"))e=e.offsetParent;return e||be})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;w.fn[e]=function(r){return z(this,function(e,r,i){var o;if(y(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===i)return o?o[t]:e[r];o?o.scrollTo(n?o.pageXOffset:i,n?i:o.pageYOffset):e[r]=i},e,r,arguments.length)}}),w.each(["top","left"],function(e,t){w.cssHooks[t]=_e(h.pixelPosition,function(e,n){if(n)return n=Fe(e,t),We.test(n)?w(e).position()[t]+"px":n})}),w.each({Height:"height",Width:"width"},function(e,t){w.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){w.fn[r]=function(i,o){var a=arguments.length&&(n||"boolean"!=typeof i),s=n||(!0===i||!0===o?"margin":"border");return z(this,function(t,n,i){var o;return y(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===i?w.css(t,n,s):w.style(t,n,i,s)},t,a?i:void 0,a)}})}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),w.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),g(e))return r=o.call(arguments,2),i=function(){return e.apply(t||this,r.concat(o.call(arguments)))},i.guid=e.guid=e.guid||w.guid++,i},w.holdReady=function(e){e?w.readyWait++:w.ready(!0)},w.isArray=Array.isArray,w.parseJSON=JSON.parse,w.nodeName=N,w.isFunction=g,w.isWindow=y,w.camelCase=G,w.type=x,w.now=Date.now,w.isNumeric=function(e){var t=w.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},"function"==typeof define&&define.amd&&define("jquery",[],function(){return w});var Jt=e.jQuery,Kt=e.$;return w.noConflict=function(t){return e.$===w&&(e.$=Kt),t&&e.jQuery===w&&(e.jQuery=Jt),w},t||(e.jQuery=e.$=w),w});
6090/** 6091 * Magento 6092 * 6093 * NOTICE OF LICENSE 6094 * 6095 * This source file is subject to the Academic Free License (AFL 3.0) 6096 * that is bundled with this package in the file LICENSE_AFL.txt. 6097 * It is also available through the world-wide-web at this URL: 6098 * http://opensource.org/licenses/afl-3.0.php 6099 * If you did not receive a copy of the license and are unable to 6100 * obtain it through the world-wide-web, please send an email 6101 * to [email protected] so we can send you a copy immediately. 6102 * 6103 * DISCLAIMER 6104 * 6105 * Do not edit or add to this file if you wish to upgrade Magento to newer 6106 * versions in the future. If you wish to customize Magento for your 6107 * needs please refer to http://www.magento.com for more information. 6108 * 6109 * @category Mage 6110 * @package js 6111 * @copyright Copyright (c) 2006-2018 Magento, Inc. (http://www.magento.com) 6112 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 6113 */ 6114 6115// Avoid PrototypeJS conflicts, assign jQuery to $j instead of $ 6116var $j = jQuery.noConflict(); 6117 6118/** 6119 * Magento 6120 * 6121 * NOTICE OF LICENSE 6122 * 6123 * This source file is subject to the Academic Free License (AFL 3.0) 6124 * that is bundled with this package in the file LICENSE_AFL.txt. 6125 * It is also available through the world-wide-web at this URL: 6126 * http://opensource.org/licenses/afl-3.0.php 6127 * If you did not receive a copy of the license and are unable to 6128 * obtain it through the world-wide-web, please send an email 6129 * to [email protected] so we can send you a copy immediately. 6130 * 6131 * DISCLAIMER 6132 * 6133 * Do not edit or add to this file if you wish to upgrade Magento to newer 6134 * versions in the future. If you wish to customize Magento for your 6135 * needs please refer to http://www.magento.com for more information. 6136 * 6137 * @category Mage 6138 * @package js 6139 * @copyright Copyright (c) 2006-2018 Magento, Inc. (http://www.magento.com) 6140 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 6141 */ 6142// old school cookie functions grabbed off the web 6143 6144if (!window.Mage) var Mage = {}; 6145 6146Mage.Cookies = {}; 6147Mage.Cookies.expires = null; 6148Mage.Cookies.path = '/'; 6149Mage.Cookies.domain = null; 6150Mage.Cookies.secure = false; 6151Mage.Cookies.set = function(name, value){ 6152 var argv = arguments; 6153 var argc = arguments.length; 6154 var expires = (argc > 2) ? argv[2] : Mage.Cookies.expires; 6155 var path = (argc > 3) ? argv[3] : Mage.Cookies.path; 6156 var domain = (argc > 4) ? argv[4] : Mage.Cookies.domain; 6157 var secure = (argc > 5) ? argv[5] : Mage.Cookies.secure; 6158 document.cookie = name + "=" + escape (value) + 6159 ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 6160 ((path == null) ? "" : ("; path=" + path)) + 6161 ((domain == null) ? "" : ("; domain=" + domain)) + 6162 ((secure == true) ? "; secure" : ""); 6163}; 6164 6165Mage.Cookies.get = function(name){ 6166 var arg = name + "="; 6167 var alen = arg.length; 6168 var clen = document.cookie.length; 6169 var i = 0; 6170 var j = 0; 6171 while(i < clen){ 6172 j = i + alen; 6173 if (document.cookie.substring(i, j) == arg) 6174 return Mage.Cookies.getCookieVal(j); 6175 i = document.cookie.indexOf(" ", i) + 1; 6176 if(i == 0) 6177 break; 6178 } 6179 return null; 6180}; 6181 6182Mage.Cookies.clear = function(name) { 6183 if(Mage.Cookies.get(name)){ 6184 document.cookie = name + "=" + 6185 "; expires=Thu, 01-Jan-70 00:00:01 GMT"; 6186 } 6187}; 6188 6189Mage.Cookies.getCookieVal = function(offset){ 6190 var endstr = document.cookie.indexOf(";", offset); 6191 if(endstr == -1){ 6192 endstr = document.cookie.length; 6193 } 6194 return unescape(document.cookie.substring(offset, endstr)); 6195}; 6196 6197/* https://github.com/puleos/object-hash */
vendor: 34,778 bytes, lines 6197-6198
6197 6198!function(e){var t;"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):("undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.objectHash=e())}(function(){return function r(o,i,u){function s(n,e){if(!i[n]){if(!o[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(a)return a(n,!0);throw new Error("Cannot find module '"+n+"'")}e=i[n]={exports:{}};o[n][0].call(e.exports,function(e){var t=o[n][1][e];return s(t||e)},e,e.exports,r,o,i,u)}return i[n].exports}for(var a="function"==typeof require&&require,e=0;e<u.length;e++)s(u[e]);return s}({1:[function(w,b,m){!function(e,n,s,c,d,h,p,g,y){"use strict";var r=w("crypto");function t(e,t){t=u(e,t);var n;return void 0===(n="passthrough"!==t.algorithm?r.createHash(t.algorithm):new l).write&&(n.write=n.update,n.end=n.update),f(t,n).dispatch(e),n.update||n.end(""),n.digest?n.digest("buffer"===t.encoding?void 0:t.encoding):(e=n.read(),"buffer"!==t.encoding?e.toString(t.encoding):e)}(m=b.exports=t).sha1=function(e){return t(e)},m.keys=function(e){return t(e,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},m.MD5=function(e){return t(e,{algorithm:"md5",encoding:"hex"})},m.keysMD5=function(e){return t(e,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var o=r.getHashes?r.getHashes().slice():["sha1","md5"],i=(o.push("passthrough"),["buffer","hex","binary","base64"]);function u(e,t){var n={};if(n.algorithm=(t=t||{}).algorithm||"sha1",n.encoding=t.encoding||"hex",n.excludeValues=!!t.excludeValues,n.algorithm=n.algorithm.toLowerCase(),n.encoding=n.encoding.toLowerCase(),n.ignoreUnknown=!0===t.ignoreUnknown,n.respectType=!1!==t.respectType,n.respectFunctionNames=!1!==t.respectFunctionNames,n.respectFunctionProperties=!1!==t.respectFunctionProperties,n.unorderedArrays=!0===t.unorderedArrays,n.unorderedSets=!1!==t.unorderedSets,n.unorderedObjects=!1!==t.unorderedObjects,n.replacer=t.replacer||void 0,n.excludeKeys=t.excludeKeys||void 0,void 0===e)throw new Error("Object argument required.");for(var r=0;r<o.length;++r)o[r].toLowerCase()===n.algorithm.toLowerCase()&&(n.algorithm=o[r]);if(-1===o.indexOf(n.algorithm))throw new Error('Algorithm "'+n.algorithm+'" not supported. supported values: '+o.join(", "));if(-1===i.indexOf(n.encoding)&&"passthrough"!==n.algorithm)throw new Error('Encoding "'+n.encoding+'" not supported. supported values: '+i.join(", "));return n}function a(e){if("function"==typeof e)return null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(e))}function f(o,t,i){i=i||[];function u(e){return t.update?t.update(e,"utf8"):t.write(e,"utf8")}return{dispatch:function(e){return this["_"+(null===(e=o.replacer?o.replacer(e):e)?"null":typeof e)](e)},_object:function(t){var n,e=Object.prototype.toString.call(t),r=/\[object (.*)\]/i.exec(e);r=(r=r?r[1]:"unknown:["+e+"]").toLowerCase();if(0<=(e=i.indexOf(t)))return this.dispatch("[CIRCULAR:"+e+"]");if(i.push(t),void 0!==s&&s.isBuffer&&s.isBuffer(t))return u("buffer:"),u(t);if("object"===r||"function"===r||"asyncfunction"===r)return e=Object.keys(t),o.unorderedObjects&&(e=e.sort()),!1===o.respectType||a(t)||e.splice(0,0,"prototype","__proto__","constructor"),o.excludeKeys&&(e=e.filter(function(e){return!o.excludeKeys(e)})),u("object:"+e.length+":"),n=this,e.forEach(function(e){n.dispatch(e),u(":"),o.excludeValues||n.dispatch(t[e]),u(",")});if(!this["_"+r]){if(o.ignoreUnknown)return u("["+r+"]");throw new Error('Unknown object type "'+r+'"')}this["_"+r](t)},_array:function(e,t){t=void 0!==t?t:!1!==o.unorderedArrays;var n=this;if(u("array:"+e.length+":"),!t||e.length<=1)return e.forEach(function(e){return n.dispatch(e)});var r=[],t=e.map(function(e){var t=new l,n=i.slice();return f(o,t,n).dispatch(e),r=r.concat(n.slice(i.length)),t.read().toString()});return i=i.concat(r),t.sort(),this._array(t,!1)},_date:function(e){return u("date:"+e.toJSON())},_symbol:function(e){return u("symbol:"+e.toString())},_error:function(e){return u("error:"+e.toString())},_boolean:function(e){return u("bool:"+e.toString())},_string:function(e){u("string:"+e.length+":"),u(e.toString())},_function:function(e){u("fn:"),a(e)?this.dispatch("[native]"):this.dispatch(e.toString()),!1!==o.respectFunctionNames&&this.dispatch("function-name:"+String(e.name)),o.respectFunctionProperties&&this._object(e)},_number:function(e){return u("number:"+e.toString())},_xml:function(e){return u("xml:"+e.toString())},_null:function(){return u("Null")},_undefined:function(){return u("Undefined")},_regexp:function(e){return u("regex:"+e.toString())},_uint8array:function(e){return u("uint8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint8clampedarray:function(e){return u("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(e))},_int8array:function(e){return u("int8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint16array:function(e){return u("uint16array:"),this.dispatch(Array.prototype.slice.call(e))},_int16array:function(e){return u("int16array:"),this.dispatch(Array.prototype.slice.call(e))},_uint32array:function(e){return u("uint32array:"),this.dispatch(Array.prototype.slice.call(e))},_int32array:function(e){return u("int32array:"),this.dispatch(Array.prototype.slice.call(e))},_float32array:function(e){return u("float32array:"),this.dispatch(Array.prototype.slice.call(e))},_float64array:function(e){return u("float64array:"),this.dispatch(Array.prototype.slice.call(e))},_arraybuffer:function(e){return u("arraybuffer:"),this.dispatch(new Uint8Array(e))},_url:function(e){return u("url:"+e.toString())},_map:function(e){u("map:");e=Array.from(e);return this._array(e,!1!==o.unorderedSets)},_set:function(e){u("set:");e=Array.from(e);return this._array(e,!1!==o.unorderedSets)},_file:function(e){return u("file:"),this.dispatch([e.name,e.size,e.type,e.lastModfied])},_blob:function(){if(o.ignoreUnknown)return u("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return u("domwindow")},_bigint:function(e){return u("bigint:"+e.toString())},_process:function(){return u("process")},_timer:function(){return u("timer")},_pipe:function(){return u("pipe")},_tcp:function(){return u("tcp")},_udp:function(){return u("udp")},_tty:function(){return u("tty")},_statwatcher:function(){return u("statwatcher")},_securecontext:function(){return u("securecontext")},_connection:function(){return u("connection")},_zlib:function(){return u("zlib")},_context:function(){return u("context")},_nodescript:function(){return u("nodescript")},_httpparser:function(){return u("httpparser")},_dataview:function(){return u("dataview")},_signal:function(){return u("signal")},_fsevent:function(){return u("fsevent")},_tlswrap:function(){return u("tlswrap")}}}function l(){return{buf:"",write:function(e){this.buf+=e},end:function(e){this.buf+=e},read:function(){return this.buf}}}m.writeToStream=function(e,t,n){return void 0===n&&(n=t,t={}),f(t=u(e,t),n).dispatch(e)}}.call(this,w("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},w("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(e,t,f){!function(e,t,n,r,o,i,u,s,a){!function(e){"use strict";var a="undefined"!=typeof Uint8Array?Uint8Array:Array,t="+".charCodeAt(0),n="/".charCodeAt(0),r="0".charCodeAt(0),o="a".charCodeAt(0),i="A".charCodeAt(0),u="-".charCodeAt(0),s="_".charCodeAt(0);function f(e){e=e.charCodeAt(0);return e===t||e===u?62:e===n||e===s?63:e<r?-1:e<r+10?e-r+26+26:e<i+26?e-i:e<o+26?e-o+26:void 0}e.toByteArray=function(e){var t,n;if(0<e.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.length,r="="===e.charAt(r-2)?2:"="===e.charAt(r-1)?1:0,o=new a(3*e.length/4-r),i=0<r?e.length-4:e.length,u=0;function s(e){o[u++]=e}for(t=0;t<i;t+=4,0)s((16711680&(n=f(e.charAt(t))<<18|f(e.charAt(t+1))<<12|f(e.charAt(t+2))<<6|f(e.charAt(t+3))))>>16),s((65280&n)>>8),s(255&n);return 2==r?s(255&(n=f(e.charAt(t))<<2|f(e.charAt(t+1))>>4)):1==r&&(s((n=f(e.charAt(t))<<10|f(e.charAt(t+1))<<4|f(e.charAt(t+2))>>2)>>8&255),s(255&n)),o},e.fromByteArray=function(e){var t,n,r,o,i=e.length%3,u="";function s(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-i;t<r;t+=3)n=(e[t]<<16)+(e[t+1]<<8)+e[t+2],u+=s((o=n)>>18&63)+s(o>>12&63)+s(o>>6&63)+s(63&o);switch(i){case 1:u=(u+=s((n=e[e.length-1])>>2))+s(n<<4&63)+"==";break;case 2:u=(u=(u+=s((n=(e[e.length-2]<<8)+e[e.length-1])>>10))+s(n>>4&63))+s(n<<2&63)+"="}return u}}(void 0===f?this.base64js={}:f)}.call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(O,e,H){!function(e,n,f,r,h,p,g,y,w){var a=O("base64-js"),i=O("ieee754");function f(e,t,n){if(!(this instanceof f))return new f(e,t,n);var r,o,i,u,s=typeof e;if("base64"===t&&"string"==s)for(e=(u=e).trim?u.trim():u.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==s)r=j(e);else if("string"==s)r=f.byteLength(e,t);else{if("object"!=s)throw new Error("First argument needs to be a number, array or string.");r=j(e.length)}if(f._useTypedArrays?o=f._augment(new Uint8Array(r)):((o=this).length=r,o._isBuffer=!0),f._useTypedArrays&&"number"==typeof e.byteLength)o._set(e);else if(C(u=e)||f.isBuffer(u)||u&&"object"==typeof u&&"number"==typeof u.length)for(i=0;i<r;i++)f.isBuffer(e)?o[i]=e.readUInt8(i):o[i]=e[i];else if("string"==s)o.write(e,0,t);else if("number"==s&&!f._useTypedArrays&&!n)for(i=0;i<r;i++)o[i]=0;return o}function b(e,t,n,r){return f._charsWritten=c(function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function m(e,t,n,r){return f._charsWritten=c(function(e){for(var t,n,r=[],o=0;o<e.length;o++)n=e.charCodeAt(o),t=n>>8,n=n%256,r.push(n),r.push(t);return r}(t),e,n,r)}function v(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;o++)r+=String.fromCharCode(e[o]);return r}function o(e,t,n,r){r||(d("boolean"==typeof n,"missing or invalid endian"),d(null!=t,"missing offset"),d(t+1<e.length,"Trying to read beyond buffer length"));var o,r=e.length;if(!(r<=t))return n?(o=e[t],t+1<r&&(o|=e[t+1]<<8)):(o=e[t]<<8,t+1<r&&(o|=e[t+1])),o}function u(e,t,n,r){r||(d("boolean"==typeof n,"missing or invalid endian"),d(null!=t,"missing offset"),d(t+3<e.length,"Trying to read beyond buffer length"));var o,r=e.length;if(!(r<=t))return n?(t+2<r&&(o=e[t+2]<<16),t+1<r&&(o|=e[t+1]<<8),o|=e[t],t+3<r&&(o+=e[t+3]<<24>>>0)):(t+1<r&&(o=e[t+1]<<16),t+2<r&&(o|=e[t+2]<<8),t+3<r&&(o|=e[t+3]),o+=e[t]<<24>>>0),o}function _(e,t,n,r){if(r||(d("boolean"==typeof n,"missing or invalid endian"),d(null!=t,"missing offset"),d(t+1<e.length,"Trying to read beyond buffer length")),!(e.length<=t))return r=o(e,t,n,!0),32768&r?-1*(65535-r+1):r}function E(e,t,n,r){if(r||(d("boolean"==typeof n,"missing or invalid endian"),d(null!=t,"missing offset"),d(t+3<e.length,"Trying to read beyond buffer length")),!(e.length<=t))return r=u(e,t,n,!0),2147483648&r?-1*(4294967295-r+1):r}function I(e,t,n,r){return r||(d("boolean"==typeof n,"missing or invalid endian"),d(t+3<e.length,"Trying to read beyond buffer length")),i.read(e,t,n,23,4)}function A(e,t,n,r){return r||(d("boolean"==typeof n,"missing or invalid endian"),d(t+7<e.length,"Trying to read beyond buffer length")),i.read(e,t,n,52,8)}function s(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+1<e.length,"trying to write beyond buffer length"),Y(t,65535));o=e.length;if(!(o<=n))for(var i=0,u=Math.min(o-n,2);i<u;i++)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function l(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+3<e.length,"trying to write beyond buffer length"),Y(t,4294967295));o=e.length;if(!(o<=n))for(var i=0,u=Math.min(o-n,4);i<u;i++)e[n+i]=t>>>8*(r?i:3-i)&255}function B(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+1<e.length,"Trying to write beyond buffer length"),F(t,32767,-32768)),e.length<=n||s(e,0<=t?t:65535+t+1,n,r,o)}function L(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+3<e.length,"Trying to write beyond buffer length"),F(t,2147483647,-2147483648)),e.length<=n||l(e,0<=t?t:4294967295+t+1,n,r,o)}function U(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+3<e.length,"Trying to write beyond buffer length"),D(t,34028234663852886e22,-34028234663852886e22)),e.length<=n||i.write(e,t,n,r,23,4)}function x(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+7<e.length,"Trying to write beyond buffer length"),D(t,17976931348623157e292,-17976931348623157e292)),e.length<=n||i.write(e,t,n,r,52,8)}H.Buffer=f,H.SlowBuffer=f,H.INSPECT_MAX_BYTES=50,f.poolSize=8192,f._useTypedArrays=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray}catch(e){return!1}}(),f.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.isBuffer=function(e){return!(null==e||!e._isBuffer)},f.byteLength=function(e,t){var n;switch(e+="",t||"utf8"){case"hex":n=e.length/2;break;case"utf8":case"utf-8":n=T(e).length;break;case"ascii":case"binary":case"raw":n=e.length;break;case"base64":n=M(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;default:throw new Error("Unknown encoding")}return n},f.concat=function(e,t){if(d(C(e),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===e.length)return new f(0);if(1===e.length)return e[0];if("number"!=typeof t)for(o=t=0;o<e.length;o++)t+=e[o].length;for(var n=new f(t),r=0,o=0;o<e.length;o++){var i=e[o];i.copy(n,r),r+=i.length}return n},f.prototype.write=function(e,t,n,r){isFinite(t)?isFinite(n)||(r=n,n=void 0):(a=r,r=t,t=n,n=a),t=Number(t)||0;var o,i,u,s,a=this.length-t;switch((!n||a<(n=Number(n)))&&(n=a),r=String(r||"utf8").toLowerCase()){case"hex":o=function(e,t,n,r){n=Number(n)||0;var o=e.length-n;(!r||o<(r=Number(r)))&&(r=o),d((o=t.length)%2==0,"Invalid hex string"),o/2<r&&(r=o/2);for(var i=0;i<r;i++){var u=parseInt(t.substr(2*i,2),16);d(!isNaN(u),"Invalid hex string"),e[n+i]=u}return f._charsWritten=2*i,i}(this,e,t,n);break;case"utf8":case"utf-8":i=this,u=t,s=n,o=f._charsWritten=c(T(e),i,u,s);break;case"ascii":case"binary":o=b(this,e,t,n);break;case"base64":i=this,u=t,s=n,o=f._charsWritten=c(M(e),i,u,s);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":o=m(this,e,t,n);break;default:throw new Error("Unknown encoding")}return o},f.prototype.toString=function(e,t,n){var r,o,i,u,s=this;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,(n=void 0!==n?Number(n):s.length)===t)return"";switch(e){case"hex":r=function(e,t,n){var r=e.length;(!t||t<0)&&(t=0);(!n||n<0||r<n)&&(n=r);for(var o="",i=t;i<n;i++)o+=k(e[i]);return o}(s,t,n);break;case"utf8":case"utf-8":r=function(e,t,n){var r="",o="";n=Math.min(e.length,n);for(var i=t;i<n;i++)e[i]<=127?(r+=N(o)+String.fromCharCode(e[i]),o=""):o+="%"+e[i].toString(16);return r+N(o)}(s,t,n);break;case"ascii":case"binary":r=v(s,t,n);break;case"base64":o=s,u=n,r=0===(i=t)&&u===o.length?a.fromByteArray(o):a.fromByteArray(o.slice(i,u));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=function(e,t,n){for(var r=e.slice(t,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}(s,t,n);break;default:throw new Error("Unknown encoding")}return r},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},f.prototype.copy=function(e,t,n,r){if(t=t||0,(r=r||0===r?r:this.length)!==(n=n||0)&&0!==e.length&&0!==this.length){d(n<=r,"sourceEnd < sourceStart"),d(0<=t&&t<e.length,"targetStart out of bounds"),d(0<=n&&n<this.length,"sourceStart out of bounds"),d(0<=r&&r<=this.length,"sourceEnd out of bounds"),r>this.length&&(r=this.length);var o=(r=e.length-t<r-n?e.length-t+n:r)-n;if(o<100||!f._useTypedArrays)for(var i=0;i<o;i++)e[i+t]=this[i+n];else e._set(this.subarray(n,n+o),t)}},f.prototype.slice=function(e,t){var n=this.length;if(e=S(e,n,0),t=S(t,n,n),f._useTypedArrays)return f._augment(this.subarray(e,t));for(var r=t-e,o=new f(r,void 0,!0),i=0;i<r;i++)o[i]=this[i+e];return o},f.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},f.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},f.prototype.readUInt8=function(e,t){if(t||(d(null!=e,"missing offset"),d(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return this[e]},f.prototype.readUInt16LE=function(e,t){return o(this,e,!0,t)},f.prototype.readUInt16BE=function(e,t){return o(this,e,!1,t)},f.prototype.readUInt32LE=function(e,t){return u(this,e,!0,t)},f.prototype.readUInt32BE=function(e,t){return u(this,e,!1,t)},f.prototype.readInt8=function(e,t){if(t||(d(null!=e,"missing offset"),d(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){return _(this,e,!0,t)},f.prototype.readInt16BE=function(e,t){return _(this,e,!1,t)},f.prototype.readInt32LE=function(e,t){return E(this,e,!0,t)},f.prototype.readInt32BE=function(e,t){return E(this,e,!1,t)},f.prototype.readFloatLE=function(e,t){return I(this,e,!0,t)},f.prototype.readFloatBE=function(e,t){return I(this,e,!1,t)},f.prototype.readDoubleLE=function(e,t){return A(this,e,!0,t)},f.prototype.readDoubleBE=function(e,t){return A(this,e,!1,t)},f.prototype.writeUInt8=function(e,t,n){n||(d(null!=e,"missing value"),d(null!=t,"missing offset"),d(t<this.length,"trying to write beyond buffer length"),Y(e,255)),t>=this.length||(this[t]=e)},f.prototype.writeUInt16LE=function(e,t,n){s(this,e,t,!0,n)},f.prototype.writeUInt16BE=function(e,t,n){s(this,e,t,!1,n)},f.prototype.writeUInt32LE=function(e,t,n){l(this,e,t,!0,n)},f.prototype.writeUInt32BE=function(e,t,n){l(this,e,t,!1,n)},f.prototype.writeInt8=function(e,t,n){n||(d(null!=e,"missing value"),d(null!=t,"missing offset"),d(t<this.length,"Trying to write beyond buffer length"),F(e,127,-128)),t>=this.length||(0<=e?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},f.prototype.writeInt16LE=function(e,t,n){B(this,e,t,!0,n)},f.prototype.writeInt16BE=function(e,t,n){B(this,e,t,!1,n)},f.prototype.writeInt32LE=function(e,t,n){L(this,e,t,!0,n)},f.prototype.writeInt32BE=function(e,t,n){L(this,e,t,!1,n)},f.prototype.writeFloatLE=function(e,t,n){U(this,e,t,!0,n)},f.prototype.writeFloatBE=function(e,t,n){U(this,e,t,!1,n)},f.prototype.writeDoubleLE=function(e,t,n){x(this,e,t,!0,n)},f.prototype.writeDoubleBE=function(e,t,n){x(this,e,t,!1,n)},f.prototype.fill=function(e,t,n){if(t=t||0,n=n||this.length,d("number"==typeof(e="string"==typeof(e=e||0)?e.charCodeAt(0):e)&&!isNaN(e),"value is not a number"),d(t<=n,"end < start"),n!==t&&0!==this.length){d(0<=t&&t<this.length,"start out of bounds"),d(0<=n&&n<=this.length,"end out of bounds");for(var r=t;r<n;r++)this[r]=e}},f.prototype.inspect=function(){for(var e=[],t=this.length,n=0;n<t;n++)if(e[n]=k(this[n]),n===H.INSPECT_MAX_BYTES){e[n+1]="...";break}return"<Buffer "+e.join(" ")+">"},f.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(f._useTypedArrays)return new f(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;t<n;t+=1)e[t]=this[t];return e.buffer};var t=f.prototype;function S(e,t,n){return"number"!=typeof e?n:t<=(e=~~e)?t:0<=e||0<=(e+=t)?e:0}function j(e){return(e=~~Math.ceil(+e))<0?0:e}function C(e){return(Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)})(e)}function k(e){return e<16?"0"+e.toString(16):e.toString(16)}function T(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<=127)t.push(e.charCodeAt(n));else for(var o=n,i=(55296<=r&&r<=57343&&n++,encodeURIComponent(e.slice(o,n+1)).substr(1).split("%")),u=0;u<i.length;u++)t.push(parseInt(i[u],16))}return t}function M(e){return a.toByteArray(e)}function c(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function N(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function Y(e,t){d("number"==typeof e,"cannot write a non-number as a number"),d(0<=e,"specified a negative value for writing an unsigned value"),d(e<=t,"value is larger than maximum value for type"),d(Math.floor(e)===e,"value has a fractional component")}function F(e,t,n){d("number"==typeof e,"cannot write a non-number as a number"),d(e<=t,"value larger than maximum allowed value"),d(n<=e,"value smaller than minimum allowed value"),d(Math.floor(e)===e,"value has a fractional component")}function D(e,t,n){d("number"==typeof e,"cannot write a non-number as a number"),d(e<=t,"value larger than maximum allowed value"),d(n<=e,"value smaller than minimum allowed value")}function d(e,t){if(!e)throw new Error(t||"Failed assertion")}f._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=t.get,e.set=t.set,e.write=t.write,e.toString=t.toString,e.toLocaleString=t.toString,e.toJSON=t.toJSON,e.copy=t.copy,e.slice=t.slice,e.readUInt8=t.readUInt8,e.readUInt16LE=t.readUInt16LE,e.readUInt16BE=t.readUInt16BE,e.readUInt32LE=t.readUInt32LE,e.readUInt32BE=t.readUInt32BE,e.readInt8=t.readInt8,e.readInt16LE=t.readInt16LE,e.readInt16BE=t.readInt16BE,e.readInt32LE=t.readInt32LE,e.readInt32BE=t.readInt32BE,e.readFloatLE=t.readFloatLE,e.readFloatBE=t.readFloatBE,e.readDoubleLE=t.readDoubleLE,e.readDoubleBE=t.readDoubleBE,e.writeUInt8=t.writeUInt8,e.writeUInt16LE=t.writeUInt16LE,e.writeUInt16BE=t.writeUInt16BE,e.writeUInt32LE=t.writeUInt32LE,e.writeUInt32BE=t.writeUInt32BE,e.writeInt8=t.writeInt8,e.writeInt16LE=t.writeInt16LE,e.writeInt16BE=t.writeInt16BE,e.writeInt32LE=t.writeInt32LE,e.writeInt32BE=t.writeInt32BE,e.writeFloatLE=t.writeFloatLE,e.writeFloatBE=t.writeFloatBE,e.writeDoubleLE=t.writeDoubleLE,e.writeDoubleBE=t.writeDoubleBE,e.fill=t.fill,e.inspect=t.inspect,e.toArrayBuffer=t.toArrayBuffer,e}}.call(this,O("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},O("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(c,d,e){!function(e,t,a,n,r,o,i,u,s){var a=c("buffer").Buffer,f=4,l=new a(f);l.fill(0);d.exports={hash:function(e,t,n,r){for(var o=t(function(e,t){e.length%f!=0&&(n=e.length+(f-e.length%f),e=a.concat([e,l],n));for(var n,r=[],o=t?e.readInt32BE:e.readInt32LE,i=0;i<e.length;i+=f)r.push(o.call(e,i));return r}(e=a.isBuffer(e)?e:new a(e),r),8*e.length),t=r,i=new a(n),u=t?i.writeInt32BE:i.writeInt32LE,s=0;s<o.length;s++)u.call(i,o[s],4*s,!0);return i}}}.call(this,c("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},c("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(v,e,_){!function(l,c,u,d,h,p,g,y,w){var u=v("buffer").Buffer,e=v("./sha"),t=v("./sha256"),n=v("./rng"),b={sha1:e,sha256:t,md5:v("./md5")},s=64,a=new u(s);function r(e,n){var r=b[e=e||"sha1"],o=[];return r||i("algorithm:",e,"is not yet supported"),{update:function(e){return u.isBuffer(e)||(e=new u(e)),o.push(e),e.length,this},digest:function(e){var t=u.concat(o),t=n?function(e,t,n){u.isBuffer(t)||(t=new u(t)),u.isBuffer(n)||(n=new u(n)),t.length>s?t=e(t):t.length<s&&(t=u.concat([t,a],s));for(var r=new u(s),o=new u(s),i=0;i<s;i++)r[i]=54^t[i],o[i]=92^t[i];return n=e(u.concat([r,n])),e(u.concat([o,n]))}(r,n,t):r(t);return o=null,e?t.toString(e):t}}}function i(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}a.fill(0),_.createHash=function(e){return r(e)},_.createHmac=r,_.randomBytes=function(e,t){if(!t||!t.call)return new u(n(e));try{t.call(this,void 0,new u(n(e)))}catch(e){t(e)}};var o,f=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],m=function(e){_[e]=function(){i("sorry,",e,"is not implemented yet")}};for(o in f)m(f[o],o)}.call(this,v("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},v("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(w,b,e){!function(e,r,o,i,u,a,f,l,y){var t=w("./helpers");function n(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,u=0;u<e.length;u+=16){var s=n,a=r,f=o,l=i,n=c(n,r,o,i,e[u+0],7,-680876936),i=c(i,n,r,o,e[u+1],12,-389564586),o=c(o,i,n,r,e[u+2],17,606105819),r=c(r,o,i,n,e[u+3],22,-1044525330);n=c(n,r,o,i,e[u+4],7,-176418897),i=c(i,n,r,o,e[u+5],12,1200080426),o=c(o,i,n,r,e[u+6],17,-1473231341),r=c(r,o,i,n,e[u+7],22,-45705983),n=c(n,r,o,i,e[u+8],7,1770035416),i=c(i,n,r,o,e[u+9],12,-1958414417),o=c(o,i,n,r,e[u+10],17,-42063),r=c(r,o,i,n,e[u+11],22,-1990404162),n=c(n,r,o,i,e[u+12],7,1804603682),i=c(i,n,r,o,e[u+13],12,-40341101),o=c(o,i,n,r,e[u+14],17,-1502002290),n=d(n,r=c(r,o,i,n,e[u+15],22,1236535329),o,i,e[u+1],5,-165796510),i=d(i,n,r,o,e[u+6],9,-1069501632),o=d(o,i,n,r,e[u+11],14,643717713),r=d(r,o,i,n,e[u+0],20,-373897302),n=d(n,r,o,i,e[u+5],5,-701558691),i=d(i,n,r,o,e[u+10],9,38016083),o=d(o,i,n,r,e[u+15],14,-660478335),r=d(r,o,i,n,e[u+4],20,-405537848),n=d(n,r,o,i,e[u+9],5,568446438),i=d(i,n,r,o,e[u+14],9,-1019803690),o=d(o,i,n,r,e[u+3],14,-187363961),r=d(r,o,i,n,e[u+8],20,1163531501),n=d(n,r,o,i,e[u+13],5,-1444681467),i=d(i,n,r,o,e[u+2],9,-51403784),o=d(o,i,n,r,e[u+7],14,1735328473),n=h(n,r=d(r,o,i,n,e[u+12],20,-1926607734),o,i,e[u+5],4,-378558),i=h(i,n,r,o,e[u+8],11,-2022574463),o=h(o,i,n,r,e[u+11],16,1839030562),r=h(r,o,i,n,e[u+14],23,-35309556),n=h(n,r,o,i,e[u+1],4,-1530992060),i=h(i,n,r,o,e[u+4],11,1272893353),o=h(o,i,n,r,e[u+7],16,-155497632),r=h(r,o,i,n,e[u+10],23,-1094730640),n=h(n,r,o,i,e[u+13],4,681279174),i=h(i,n,r,o,e[u+0],11,-358537222),o=h(o,i,n,r,e[u+3],16,-722521979),r=h(r,o,i,n,e[u+6],23,76029189),n=h(n,r,o,i,e[u+9],4,-640364487),i=h(i,n,r,o,e[u+12],11,-421815835),o=h(o,i,n,r,e[u+15],16,530742520),n=p(n,r=h(r,o,i,n,e[u+2],23,-995338651),o,i,e[u+0],6,-198630844),i=p(i,n,r,o,e[u+7],10,1126891415),o=p(o,i,n,r,e[u+14],15,-1416354905),r=p(r,o,i,n,e[u+5],21,-57434055),n=p(n,r,o,i,e[u+12],6,1700485571),i=p(i,n,r,o,e[u+3],10,-1894986606),o=p(o,i,n,r,e[u+10],15,-1051523),r=p(r,o,i,n,e[u+1],21,-2054922799),n=p(n,r,o,i,e[u+8],6,1873313359),i=p(i,n,r,o,e[u+15],10,-30611744),o=p(o,i,n,r,e[u+6],15,-1560198380),r=p(r,o,i,n,e[u+13],21,1309151649),n=p(n,r,o,i,e[u+4],6,-145523070),i=p(i,n,r,o,e[u+11],10,-1120210379),o=p(o,i,n,r,e[u+2],15,718787259),r=p(r,o,i,n,e[u+9],21,-343485551),n=g(n,s),r=g(r,a),o=g(o,f),i=g(i,l)}return Array(n,r,o,i)}function s(e,t,n,r,o,i){return g((t=g(g(t,e),g(r,i)))<<o|t>>>32-o,n)}function c(e,t,n,r,o,i,u){return s(t&n|~t&r,e,t,o,i,u)}function d(e,t,n,r,o,i,u){return s(t&r|n&~r,e,t,o,i,u)}function h(e,t,n,r,o,i,u){return s(t^n^r,e,t,o,i,u)}function p(e,t,n,r,o,i,u){return s(n^(t|~r),e,t,o,i,u)}function g(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}b.exports=function(e){return t.hash(e,n,16)}}.call(this,w("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},w("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e,l,t){!function(e,t,n,r,o,i,u,s,f){var a;l.exports=a||function(e){for(var t,n=new Array(e),r=0;r<e;r++)0==(3&r)&&(t=4294967296*Math.random()),n[r]=t>>>((3&r)<<3)&255;return n}}.call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(c,d,e){!function(e,t,n,r,o,s,a,f,l){var i=c("./helpers");function u(l,c){l[c>>5]|=128<<24-c%32,l[15+(c+64>>9<<4)]=c;for(var e,t,n,r=Array(80),o=1732584193,i=-271733879,u=-1732584194,s=271733878,d=-1009589776,h=0;h<l.length;h+=16){for(var p=o,g=i,y=u,w=s,b=d,a=0;a<80;a++){r[a]=a<16?l[h+a]:v(r[a-3]^r[a-8]^r[a-14]^r[a-16],1);var f=m(m(v(o,5),(f=i,t=u,n=s,(e=a)<20?f&t|~f&n:!(e<40)&&e<60?f&t|f&n|t&n:f^t^n)),m(m(d,r[a]),(e=a)<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514)),d=s,s=u,u=v(i,30),i=o,o=f}o=m(o,p),i=m(i,g),u=m(u,y),s=m(s,w),d=m(d,b)}return Array(o,i,u,s,d)}function m(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function v(e,t){return e<<t|e>>>32-t}d.exports=function(e){return i.hash(e,u,20,!0)}}.call(this,c("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},c("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(c,d,e){!function(e,t,n,r,u,s,a,f,l){function b(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,l){var c,d=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),t=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),n=new Array(64);e[l>>5]|=128<<24-l%32,e[15+(l+64>>9<<4)]=l;for(var r,o,h=0;h<e.length;h+=16){for(var i=t[0],u=t[1],s=t[2],p=t[3],a=t[4],g=t[5],y=t[6],w=t[7],f=0;f<64;f++)n[f]=f<16?e[f+h]:b(b(b((o=n[f-2],m(o,17)^m(o,19)^v(o,10)),n[f-7]),(o=n[f-15],m(o,7)^m(o,18)^v(o,3))),n[f-16]),c=b(b(b(b(w,m(o=a,6)^m(o,11)^m(o,25)),a&g^~a&y),d[f]),n[f]),r=b(m(r=i,2)^m(r,13)^m(r,22),i&u^i&s^u&s),w=y,y=g,g=a,a=b(p,c),p=s,s=u,u=i,i=b(c,r);t[0]=b(i,t[0]),t[1]=b(u,t[1]),t[2]=b(s,t[2]),t[3]=b(p,t[3]),t[4]=b(a,t[4]),t[5]=b(g,t[5]),t[6]=b(y,t[6]),t[7]=b(w,t[7])}return t}var i=c("./helpers"),m=function(e,t){return e>>>t|e<<32-t},v=function(e,t){return e>>>t};d.exports=function(e){return i.hash(e,o,32,!0)}}.call(this,c("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},c("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e,t,f){!function(e,t,n,r,o,i,u,s,a){f.read=function(e,t,n,r,o){var i,u,l=8*o-r-1,c=(1<<l)-1,d=c>>1,s=-7,a=n?o-1:0,f=n?-1:1,o=e[t+a];for(a+=f,i=o&(1<<-s)-1,o>>=-s,s+=l;0<s;i=256*i+e[t+a],a+=f,s-=8);for(u=i&(1<<-s)-1,i>>=-s,s+=r;0<s;u=256*u+e[t+a],a+=f,s-=8);if(0===i)i=1-d;else{if(i===c)return u?NaN:1/0*(o?-1:1);u+=Math.pow(2,r),i-=d}return(o?-1:1)*u*Math.pow(2,i-r)},f.write=function(e,t,l,n,r,c){var o,i,u=8*c-r-1,s=(1<<u)-1,a=s>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:c-1,h=n?1:-1,c=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,o=s):(o=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-o))<1&&(o--,n*=2),2<=(t+=1<=o+a?d/n:d*Math.pow(2,1-a))*n&&(o++,n/=2),s<=o+a?(i=0,o=s):1<=o+a?(i=(t*n-1)*Math.pow(2,r),o+=a):(i=t*Math.pow(2,a-1)*Math.pow(2,r),o=0));8<=r;e[l+f]=255&i,f+=h,i/=256,r-=8);for(o=o<<r|i,u+=r;0<u;e[l+f]=255&o,f+=h,o/=256,u-=8);e[l+f-h]|=128*c}}.call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e,h,t){!function(e,t,n,r,o,f,l,c,d){var i,u,s;function a(){}(e=h.exports={}).nextTick=(u="undefined"!=typeof window&&window.setImmediate,s="undefined"!=typeof window&&window.postMessage&&window.addEventListener,u?function(e){return window.setImmediate(e)}:s?(i=[],window.addEventListener("message",function(e){var t=e.source;t!==window&&null!==t||"process-tick"!==e.data||(e.stopPropagation(),0<i.length&&i.shift()())},!0),function(e){i.push(e),window.postMessage("process-tick","*")}):function(e){setTimeout(e,0)}),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.on=a,e.addListener=a,e.once=a,e.off=a,e.removeListener=a,e.removeAllListeners=a,e.emit=a,e.binding=function(e){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(e){throw new Error("process.chdir is not supported")}}.call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)});
6199/** 6200 * Apptha 6201 * 6202 * NOTICE OF LICENSE 6203 * 6204 * This source file is subject to the EULA 6205 * that is bundled with this package in the file LICENSE.txt. 6206 * It is also available through the world-wide-web at this URL: 6207 * http://www.apptha.com/LICENSE.txt 6208 * 6209 * ============================================================== 6210 * MAGENTO EDITION USAGE NOTICE 6211 * ============================================================== 6212 * This package designed for Magento COMMUNITY edition 6213 * Apptha does not guarantee correct work of this extension 6214 * on any other Magento edition except Magento COMMUNITY edition. 6215 * Apptha does not provide extension support in case of 6216 * incorrect edition usage. 6217 * ============================================================== 6218 * 6219 * @category Apptha 6220 * @package Apptha_Marketplace 6221 * @version 1.9.0 6222 * @author Apptha Team <[email protected]> 6223 * @copyright Copyright (c) 2015 Apptha. (http://www.apptha.com) 6224 * @license http://www.apptha.com/LICENSE.txt 6225 * 6226 */ 6227/*global window */ 6228/* added the social login links into default login links */ 6229document.observe("dom:loaded", function() { 6230 6231 var i; 6232 try { 6233 /* Get all href links */ 6234 var links = document.links; 6235 6236 for (i = 0; i < links.length; i++) { 6237 /* login links */ 6238 if (links[i].href.search('/customer/account/login/') != -1) { 6239 //links[i].href = 'javascript:apptha_sociallogin();'; 6240 } 6241 if (links[i].href.search('/customer/account/login//') != -1) { 6242 //links[i].href = 'javascript:apptha_sociallogin();'; 6243 } 6244 /* wishlist link */ 6245 if (links[i].href.search('/wishlist/') != -1) { 6246 //links[i].href = 'javascript:apptha_sociallogin();'; 6247 } 6248 /* product tags */ 6249 if (links[i].href.search('/tag/') != -1) { 6250 //links[i].href = 'javascript:apptha_sociallogin();'; 6251 } 6252 /* my account link */ 6253 if (links[i].href.search('/customer/account/') != -1) { 6254 //links[i].href = 'javascript:apptha_sociallogin();'; 6255 } 6256 /* seller login */ 6257 if (links[i].href.search('/marketplace/seller/login/') != -1) { 6258 //links[i].href = 'javascript:apptha_sociallogin(1);'; 6259 } 6260 /* seller registration */ 6261 if (links[i].href.search('/marketplace/seller/create/') != -1) { 6262 //links[i].href = 'javascript:apptha_sociallogin(1,2);'; 6263 } 6264 6265 /* background fade element. */ 6266 if ($('bg_fade') == null) { 6267 var screen = new Element('div', {'id': 'bg_fade'}); 6268 document.body.appendChild(screen); 6269 } 6270 } 6271 6272 /* 6273 * bind in checkout field. 6274 */ 6275 if (document.getElementById("checkout-step-login")) 6276 { 6277 $$('.col-2 .buttons-set').each(function(e) { 6278 //e.insert({bottom: '<div id="multilogin"> <button type="button" class="button" style="" onclick="javascript:apptha_sociallogin();" title="Social Login" name="headerboxLink1" id="headerboxLink1"><span><span>Social Login</span></span></button></div>'}); 6279 }); 6280 } 6281 Event.observe('bg_fade', 'click', function() { 6282 6283 apptha_socialloginclose(); 6284 6285 }); 6286 6287 } 6288 6289 catch (exception) 6290 { 6291 alert(exception); 6292 } 6293}); 6294 6295/* Apptha sociallogin login operation ajax part */ 6296function doSociallogin(form_id, postUrl, formSuccess, progress_image) { 6297 new Ajax.Updater( 6298 {success: formSuccess}, postUrl, { 6299 method: 'post', 6300 asynchronous: true, 6301 evalScripts: false, 6302 onComplete: function(transport, json) { 6303 6304 Element.hide(formSuccess); 6305 var pattern_url = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/; 6306 var url_value = pattern_url.test(transport.responseText); 6307 if (url_value == true) 6308 { 6309 Form.reset(form_id); 6310 window.location.href = transport.responseText; 6311 } else { 6312 6313 Element.show(formSuccess); 6314 6315 var d = document.getElementById("forget_password_error"); 6316 d.classList.remove("error"); 6317 d.classList.add("success"); 6318 var captchas; 6319 if(transport.responseText=="Incorrect CAPTCHA"){ 6320 var d = document.getElementById("forget_password_error"); 6321 d.classList.remove("success"); 6322 d.classList.add("error"); 6323 captchas=document.getElementById('captcha-reload'); 6324 captchas.onclick(); 6325 } 6326 if(transport.responseText=="There is no account associated with this email-id."){ 6327 var d = document.getElementById("forget_password_error"); 6328 d.classList.remove("success"); 6329 d.classList.add("error"); 6330 6331 } 6332 6333 6334 } 6335 6336 Element.hide(progress_image); 6337 }, 6338 onLoading: function(request, json) { 6339 Element.show(progress_image); 6340 }, 6341 parameters: $(form_id).serialize(true), 6342 } 6343 ); 6344} 6345 6346 6347/* Apptha social login pop-up function */ 6348 6349function apptha_sociallogin(data,register) 6350{ 6351 6352 if($('captcha-reload') != undefined){ 6353 var captcha=document.getElementById('captcha-reload'); 6354 captcha.onclick(); 6355 }
6356 /* Background fade is visible */ 6357 $('bg_fade').setStyle({visibility: 'visible', opacity: 0}); 6358 new Effect.Opacity('bg_fade', {duration: .2, from: 0, to: 0.4}); 6359 6360 if (typeof window.innerHeight != 'undefined' && register==2) { 6361 var newpostop = Math.round(document.body.offsetTop + ((window.innerHeight - $('header_logo_Div').getHeight())) / 3); 6362 var newposleft = Math.round(document.body.offsetLeft + ((window.innerWidth - $('header_logo_Div').getWidth())) / 2); 6363 $('header_logo_Div').setStyle({top: newpostop + 'px', left: newposleft + 'px'}); 6364 } 6365 else if(typeof window.innerHeight != 'undefined'){ 6366 document.getElementById('header_logo_Div').style.top = Math.round(document.body.offsetTop + ((window.innerHeight - document.getElementById('header_logo_Div').getHeight())) / 2) + 'px'; 6367 document.getElementById('header_logo_Div').style.left = Math.round(document.body.offsetLeft + ((window.innerWidth - document.getElementById('header_logo_Div').getWidth())) / 2) + 'px'; 6368 } 6369 else { 6370 document.getElementById('header_logo_Div').style.top = Math.round(document.body.offsetTop + ((document.documentElement.offsetHeight - document.getElementById('header_logo_Div').getHeight())) / 2) + 'px'; 6371 document.getElementById('header_logo_Div').style.left = Math.round(document.body.offsetLeft + ((document.documentElement.offsetWidth - document.getElementById('header_logo_Div').getWidth())) / 2) + 'px'; 6372 } 6373 if(data == 1){ 6374 $('seller_login').setStyle({display: 'block'}); 6375 $('customer_login').setStyle({display: 'none'}); 6376 }else{ 6377 $('seller_login').setStyle({display: 'none'}); 6378 $('customer_login').setStyle({display: 'block'}); 6379 } 6380 $('header_logo_Div').setStyle({display: 'block'}); 6381 /* Checking seller or customer login/registration */ 6382 document.getElementById('main_hidden').value = data; 6383 document.getElementById('login_hidden').value = data; 6384 document.getElementById('register_hidden').value = data; 6385 document.getElementById('twitter_hidden').value = data; 6386 if(register==2){ 6387 $('register_block').setStyle({display: 'block'}); 6388 $('login_block').hide(); 6389 $('forget_password_div').hide(); 6390 6391 } 6392 6393} 6394 6395function apptha_socialloginclose() { 6396 6397 $('header_logo_Div').setStyle({display: 'none'}); 6398 6399 $('register_block').setStyle({display: 'none'}); 6400 $('login_block').setStyle({display: 'block'}); 6401 $('forget_password_div').setStyle({display: 'none'}); 6402 $('twitter_block').setStyle({display: 'none'}); 6403 /* Background fade */ 6404 $('bg_fade').setStyle({visibility: 'hidden', opacity: 0}); 6405 new Effect.Opacity('bg_fade', {duration: .2, from: 0.4, to: 0}); 6406 apptha_clearall(); 6407 6408 6409} 6410 6411function apptha_clearall() { 6412 var data = $('main_hidden').value; 6413 /* Clear the pop-error message and validation messages */ 6414 $$('.popup_error_msg').each(function(msg) { 6415 msg.innerHTML = ''; 6416 }); 6417 $('register_error').setStyle({display: 'none'}); 6418 $$('#socialpopup_main_div input').each(function(c) { 6419 $(c).setValue(''); 6420 $(c).removeClassName('validation-failed'); 6421 $('login_hidden').value = data; 6422 $('register_hidden').value = data; 6423 $('twitter_hidden').value = data; 6424 }); 6425 $('formSuccess').setStyle({display: 'none'}); 6426 $('form_login').reset(); 6427 $('login_hidden').value = data; 6428 $$('.validation-advice').each(function(msg) { 6429 msg.setStyle({display: 'none'}); 6430 }); 6431 6432} 6433 6434/* Show / hide forms as user clicks */ 6435function show_hide_socialforms(frmid) { 6436 var data = $('main_hidden').value; 6437 if (frmid == "1") { 6438 /* login form */ 6439 $('register_block').hide(); 6440 $('forget_password_div').hide(); 6441 $('form_login').reset(); 6442 $('login_block').show(); 6443 $('twitter_block').hide(); 6444 $('login_hidden').value = data; 6445 if (typeof window.innerHeight != 'undefined') { 6446 var newpostop = Math.round(document.body.offsetTop + ((window.innerHeight - $('header_logo_Div').getHeight())) / 2); 6447 var newposleft = Math.round(document.body.offsetLeft + ((window.innerWidth - $('header_logo_Div').getWidth())) / 2); 6448 $('header_logo_Div').setStyle({top: newpostop + 'px', left: newposleft + 'px'}); 6449 6450 } else { 6451 var newpostop = Math.round(document.body.offsetTop + ((document.documentElement.offsetHeight - $('header_logo_Div').getHeight())) / 2); 6452 var newposleft = Math.round(document.body.offsetLeft + ((document.documentElement.offsetWidth - $('header_logo_Div').getWidth())) / 2); 6453 $('header_logo_Div').setStyle({top: newpostop + 'px', left: newposleft + 'px'}); 6454 6455 } 6456 var captchass=document.getElementById('captcha-image-box-user_login'). getElementsByTagName('img')[0]; 6457 captchass.onclick(); 6458 return false;
6459 6460 } else if (frmid == "2") { 6461 /* Create Account form */ 6462 $('login_block').hide(); 6463 $('forget_password_div').hide(); 6464 $('register_block').show(); 6465 $('twitter_block').hide(); 6466 apptha_clearall(); 6467 if (typeof window.innerHeight != 'undefined') { 6468 var newpostop = Math.round(document.body.offsetTop + ((window.innerHeight - $('header_logo_Div').getHeight())) / 2); 6469 var newposleft = Math.round(document.body.offsetLeft + ((window.innerWidth - $('header_logo_Div').getWidth())) / 2); 6470 $('header_logo_Div').setStyle({top: newpostop + 'px', left: newposleft + 'px'}); 6471 6472 } else { 6473 var newpostop = Math.round(document.body.offsetTop + ((document.documentElement.offsetHeight - $('header_logo_Div').getHeight())) / 2); 6474 var newposleft = Math.round(document.body.offsetLeft + ((document.documentElement.offsetWidth - $('header_logo_Div').getWidth())) / 2); 6475 $('header_logo_Div').setStyle({top: newpostop + 'px', left: newposleft + 'px'}); 6476 6477 } 6478 6479 var captchass=document.getElementById('captcha-image-box-user_create'). getElementsByTagName('img')[0]; 6480 captchass.onclick(); 6481 return false; 6482 6483 } else if (frmid == "3") { 6484 6485 if (typeof window.innerHeight != 'undefined') { 6486 var newpostop = Math.round(document.body.offsetTop + ((window.innerHeight - $('header_logo_Div').getHeight())) / 2); 6487 var newposleft = Math.round(document.body.offsetLeft + ((window.innerWidth - $('header_logo_Div').getWidth())) / 2); 6488 $('header_logo_Div').setStyle({top: 10 + 'px', left: newposleft + 'px'}); 6489 6490 } else { 6491 var newpostop = Math.round(document.body.offsetTop + ((document.documentElement.offsetHeight - $('header_logo_Div').getHeight())) / 2); 6492 var newposleft = Math.round(document.body.offsetLeft + ((document.documentElement.offsetWidth - $('header_logo_Div').getWidth())) / 2); 6493 $('header_logo_Div').setStyle({top: 10 + 'px', left: newposleft + 'px'}); 6494 6495 } 6496 /* Forget password form */ 6497 Effect.toggle('forget_password_div', 'slide', {delay: 0.1}); 6498 $('register_block').hide(); 6499 6500 $('twitter_block').hide(); 6501 $('forget_password').setValue(''); 6502 $('forget_password_error').innerHTML = ''; 6503 var captchass=document.getElementById('captcha-image-box-user_forgotpassword'). getElementsByTagName('img')[0]; 6504 captchass.onclick(); 6505 return false; 6506 } else if (frmid == "4") { 6507 /* Twitter password form */ 6508 $('twitter_block').show(); 6509 $('register_block').hide(); 6510 $('login_block').hide(); 6511 $('forget_password_div').hide(); 6512 $('twitter_hidden').setValue = data; 6513 return false; 6514 } 6515} 6516// Copyright (c) 2006 Sébastien Gruhier (http://xilinus.com, http://itseb.com) 6517// 6518// Permission is hereby granted, free of charge, to any person obtaining 6519// a copy of this software and associated documentation files (the 6520// "Software"), to deal in the Software without restriction, including 6521// without limitation the rights to use, copy, modify, merge, publish, 6522// distribute, sublicense, and/or sell copies of the Software, and to 6523// permit persons to whom the Software is furnished to do so, subject to 6524// the following conditions: 6525// 6526// The above copyright notice and this permission notice shall be 6527// included in all copies or substantial portions of the Software. 6528// 6529// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 6530// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 6531// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 6532// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 6533// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 6534// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 6535// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 6536// 6537// VERSION 1.3 6538 6539var Window = Class.create(); 6540 6541Window.keepMultiModalWindow = false;
6542Window.hasEffectLib = (typeof Effect != 'undefined'); 6543Window.resizeEffectDuration = 0.4; 6544 6545Window.prototype = { 6546 // Constructor 6547 // Available parameters : className, blurClassName, title, minWidth, minHeight, maxWidth, maxHeight, width, height, top, left, bottom, right, resizable, zIndex, opacity, recenterAuto, wiredDrag 6548 // hideEffect, showEffect, showEffectOptions, hideEffectOptions, effectOptions, url, draggable, closable, minimizable, maximizable, parent, onload 6549 // add all callbacks (if you do not use an observer) 6550 // onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocus onBlur onBeforeShow onShow onHide onMinimize onMaximize onClose 6551 6552 initialize: function() { 6553 var id; 6554 var optionIndex = 0; 6555 // For backward compatibility like win= new Window("id", {...}) instead of win = new Window({id: "id", ...}) 6556 if (arguments.length > 0) { 6557 if (typeof arguments[0] == "string" ) { 6558 id = arguments[0]; 6559 optionIndex = 1; 6560 } 6561 else 6562 id = arguments[0] ? arguments[0].id : null; 6563 } 6564 6565 // Generate unique ID if not specified 6566 if (!id) 6567 id = "window_" + new Date().getTime(); 6568 6569 if ($(id)) 6570 alert("Window " + id + " is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor"); 6571 6572 this.options = Object.extend({ 6573 className: "dialog", 6574 windowClassName: null, 6575 blurClassName: null, 6576 minWidth: 100, 6577 minHeight: 20, 6578 resizable: true, 6579 closable: true, 6580 minimizable: true, 6581 maximizable: true, 6582 draggable: true, 6583 userData: null, 6584 showEffect: (Window.hasEffectLib ? Effect.Appear : Element.show), 6585 hideEffect: (Window.hasEffectLib ? Effect.Fade : Element.hide), 6586 showEffectOptions: {}, 6587 hideEffectOptions: {}, 6588 effectOptions: null, 6589 parent: document.body, 6590 title: " ", 6591 url: null, 6592 onload: Prototype.emptyFunction, 6593 width: 200, 6594 height: 300, 6595 opacity: 1, 6596 recenterAuto: true, 6597 wiredDrag: false, 6598 closeOnEsc: true, 6599 closeCallback: null, 6600 destroyOnClose: false, 6601 gridX: 1, 6602 gridY: 1 6603 }, arguments[optionIndex] || {}); 6604 if (this.options.blurClassName) 6605 this.options.focusClassName = this.options.className; 6606 6607 if (typeof this.options.top == "undefined" && typeof this.options.bottom == "undefined") 6608 this.options.top = this._round(Math.random()*500, this.options.gridY); 6609 if (typeof this.options.left == "undefined" && typeof this.options.right == "undefined") 6610 this.options.left = this._round(Math.random()*500, this.options.gridX); 6611 6612 if (this.options.effectOptions) { 6613 Object.extend(this.options.hideEffectOptions, this.options.effectOptions); 6614 Object.extend(this.options.showEffectOptions, this.options.effectOptions); 6615 if (this.options.showEffect == Element.Appear) 6616 this.options.showEffectOptions.to = this.options.opacity; 6617 } 6618 if (Window.hasEffectLib) { 6619 if (this.options.showEffect == Effect.Appear) 6620 this.options.showEffectOptions.to = this.options.opacity; 6621 6622 if (this.options.hideEffect == Effect.Fade) 6623 this.options.hideEffectOptions.from = this.options.opacity; 6624 } 6625 if (this.options.hideEffect == Element.hide) 6626 this.options.hideEffect = function(){ Element.hide(this.element); if (this.options.destroyOnClose) this.destroy(); }.bind(this) 6627 6628 if (this.options.parent != document.body) 6629 this.options.parent = $(this.options.parent); 6630 6631 this.element = this._createWindow(id); 6632 this.element.win = this; 6633 6634 // Bind event listener 6635 this.eventMouseDown = this._initDrag.bindAsEventListener(this); 6636 this.eventMouseUp = this._endDrag.bindAsEventListener(this); 6637 this.eventMouseMove = this._updateDrag.bindAsEventListener(this); 6638 this.eventOnLoad = this._getWindowBorderSize.bindAsEventListener(this); 6639 this.eventMouseDownContent = this.toFront.bindAsEventListener(this); 6640 this.eventResize = this._recenter.bindAsEventListener(this); 6641 this.eventKeyUp = this._keyUp.bindAsEventListener(this); 6642
6643 this.topbar = $(this.element.id + "_top"); 6644 this.bottombar = $(this.element.id + "_bottom"); 6645 this.content = $(this.element.id + "_content"); 6646 6647 Event.observe(this.topbar, "mousedown", this.eventMouseDown); 6648 Event.observe(this.bottombar, "mousedown", this.eventMouseDown); 6649 Event.observe(this.content, "mousedown", this.eventMouseDownContent); 6650 Event.observe(window, "load", this.eventOnLoad); 6651 Event.observe(window, "resize", this.eventResize); 6652 Event.observe(window, "scroll", this.eventResize); 6653 Event.observe(document, "keyup", this.eventKeyUp); 6654 Event.observe(this.options.parent, "scroll", this.eventResize); 6655 6656 if (this.options.draggable) { 6657 var that = this; 6658 [this.topbar, this.topbar.up().previous(), this.topbar.up().next()].each(function(element) { 6659 element.observe("mousedown", that.eventMouseDown); 6660 element.addClassName("top_draggable"); 6661 }); 6662 [this.bottombar.up(), this.bottombar.up().previous(), this.bottombar.up().next()].each(function(element) { 6663 element.observe("mousedown", that.eventMouseDown); 6664 element.addClassName("bottom_draggable"); 6665 }); 6666 6667 } 6668 6669 if (this.options.resizable) { 6670 this.sizer = $(this.element.id + "_sizer"); 6671 Event.observe(this.sizer, "mousedown", this.eventMouseDown); 6672 } 6673 6674 this.useLeft = null; 6675 this.useTop = null; 6676 if (typeof this.options.left != "undefined") { 6677 this.element.setStyle({left: parseFloat(this.options.left) + 'px'}); 6678 this.useLeft = true; 6679 } 6680 else { 6681 this.element.setStyle({right: parseFloat(this.options.right) + 'px'}); 6682 this.useLeft = false; 6683 } 6684 6685 if (typeof this.options.top != "undefined") { 6686 this.element.setStyle({top: parseFloat(this.options.top) + 'px'}); 6687 this.useTop = true; 6688 } 6689 else { 6690 this.element.setStyle({bottom: parseFloat(this.options.bottom) + 'px'}); 6691 this.useTop = false; 6692 } 6693 6694 this.storedLocation = null; 6695 6696 this.setOpacity(this.options.opacity); 6697 if (this.options.zIndex) 6698 this.setZIndex(this.options.zIndex) 6699 6700 if (this.options.destroyOnClose) 6701 this.setDestroyOnClose(true); 6702 6703 this._getWindowBorderSize(); 6704 this.width = this.options.width; 6705 this.height = this.options.height; 6706 this.visible = false; 6707 6708 this.constraint = false; 6709 this.constraintPad = {top: 0, left:0, bottom:0, right:0}; 6710 6711 if (this.width && this.height) 6712 this.setSize(this.options.width, this.options.height); 6713 this.setTitle(this.options.title) 6714 Windows.register(this); 6715 }, 6716 6717 // Destructor 6718 destroy: function() { 6719 this._notify("onDestroy"); 6720 Event.stopObserving(this.topbar, "mousedown", this.eventMouseDown); 6721 Event.stopObserving(this.bottombar, "mousedown", this.eventMouseDown); 6722 Event.stopObserving(this.content, "mousedown", this.eventMouseDownContent); 6723 6724 Event.stopObserving(window, "load", this.eventOnLoad); 6725 Event.stopObserving(window, "resize", this.eventResize); 6726 Event.stopObserving(window, "scroll", this.eventResize); 6727 6728 Event.stopObserving(this.content, "load", this.options.onload); 6729 Event.stopObserving(document, "keyup", this.eventKeyUp); 6730 6731 if (this._oldParent) { 6732 var content = this.getContent(); 6733 var originalContent = null; 6734 for(var i = 0; i < content.childNodes.length; i++) { 6735 originalContent = content.childNodes[i]; 6736 if (originalContent.nodeType == 1) 6737 break; 6738 originalContent = null; 6739 } 6740 if (originalContent) 6741 this._oldParent.appendChild(originalContent); 6742 this._oldParent = null; 6743 } 6744 6745 if (this.sizer) 6746 Event.stopObserving(this.sizer, "mousedown", this.eventMouseDown); 6747 6748 if (this.options.url) 6749 this.content.src = null 6750 6751 if(this.iefix) 6752 Element.remove(this.iefix); 6753 6754 Element.remove(this.element); 6755 Windows.unregister(this); 6756 }, 6757 6758 // Sets close callback, if it sets, it should return true to be able to close the window. 6759 setCloseCallback: function(callback) { 6760 this.options.closeCallback = callback; 6761 }, 6762
6763 // Gets window content 6764 getContent: function () { 6765 return this.content; 6766 }, 6767 6768 // Sets the content with an element id 6769 setContent: function(id, autoresize, autoposition) { 6770 var element = $(id); 6771 if (null == element) throw "Unable to find element '" + id + "' in DOM"; 6772 this._oldParent = element.parentNode; 6773 6774 var d = null; 6775 var p = null; 6776 6777 if (autoresize) 6778 d = Element.getDimensions(element); 6779 if (autoposition) 6780 p = Position.cumulativeOffset(element); 6781 6782 var content = this.getContent(); 6783 // Clear HTML (and even iframe) 6784 this.setHTMLContent(""); 6785 content = this.getContent(); 6786 6787 content.appendChild(element); 6788 element.show(); 6789 if (autoresize) 6790 this.setSize(d.width, d.height); 6791 if (autoposition) 6792 this.setLocation(p[1] - this.heightN, p[0] - this.widthW); 6793 }, 6794 6795 setHTMLContent: function(html) { 6796 // It was an url (iframe), recreate a div content instead of iframe content 6797 if (this.options.url) { 6798 this.content.src = null; 6799 this.options.url = null; 6800 6801 var content ="<div id=\"" + this.getId() + "_content\" class=\"" + this.options.className + "_content\"> </div>"; 6802 $(this.getId() +"_table_content").innerHTML = content; 6803 6804 this.content = $(this.element.id + "_content"); 6805 } 6806 6807 this.getContent().innerHTML = html; 6808 }, 6809 6810 setAjaxContent: function(url, options, showCentered, showModal) { 6811 this.showFunction = showCentered ? "showCenter" : "show"; 6812 this.showModal = showModal || false; 6813 6814 options = options || {}; 6815 6816 // Clear HTML (and even iframe) 6817 this.setHTMLContent(""); 6818 6819 this.onComplete = options.onComplete; 6820 if (! this._onCompleteHandler) 6821 this._onCompleteHandler = this._setAjaxContent.bind(this); 6822 options.onComplete = this._onCompleteHandler; 6823 6824 new Ajax.Request(url, options); 6825 options.onComplete = this.onComplete; 6826 }, 6827 6828 _setAjaxContent: function(originalRequest) { 6829 Element.update(this.getContent(), originalRequest.responseText); 6830 if (this.onComplete) 6831 this.onComplete(originalRequest); 6832 this.onComplete = null; 6833 this[this.showFunction](this.showModal) 6834 }, 6835 6836 setURL: function(url) { 6837 // Not an url content, change div to iframe 6838 if (this.options.url) 6839 this.content.src = null; 6840 this.options.url = url; 6841 var content= "<iframe frameborder='0' name='" + this.getId() + "_content' id='" + this.getId() + "_content' src='" + url + "' width='" + this.width + "' height='" + this.height + "'> </iframe>"; 6842 $(this.getId() +"_table_content").innerHTML = content; 6843 6844 this.content = $(this.element.id + "_content"); 6845 }, 6846 6847 getURL: function() { 6848 return this.options.url ? this.options.url : null; 6849 }, 6850 6851 refresh: function() { 6852 if (this.options.url) 6853 $(this.element.getAttribute('id') + '_content').src = this.options.url; 6854 }, 6855 6856 // Stores position/size in a cookie, by default named with window id 6857 setCookie: function(name, expires, path, domain, secure) { 6858 name = name || this.element.id; 6859 this.cookie = [name, expires, path, domain, secure]; 6860 6861 // Get cookie 6862 var value = WindowUtilities.getCookie(name) 6863 // If exists 6864 if (value) { 6865 var values = value.split(','); 6866 var x = values[0].split(':'); 6867 var y = values[1].split(':'); 6868 6869 var w = parseFloat(values[2]), h = parseFloat(values[3]); 6870 var mini = values[4]; 6871 var maxi = values[5]; 6872 6873 this.setSize(w, h); 6874 if (mini == "true") 6875 this.doMinimize = true; // Minimize will be done at onload window event 6876 else if (maxi == "true") 6877 this.doMaximize = true; // Maximize will be done at onload window event 6878 6879 this.useLeft = x[0] == "l"; 6880 this.useTop = y[0] == "t"; 6881 6882 this.element.setStyle(this.useLeft ? {left: x[1]} : {right: x[1]}); 6883 this.element.setStyle(this.useTop ? {top: y[1]} : {bottom: y[1]}); 6884 } 6885 }, 6886 6887 // Gets window ID 6888 getId: function() { 6889 return this.element.id; 6890 }, 6891 6892 // Detroys itself when closing 6893 setDestroyOnClose: function() { 6894 this.options.destroyOnClose = true; 6895 }, 6896
6897 setConstraint: function(bool, padding) { 6898 this.constraint = bool; 6899 this.constraintPad = Object.extend(this.constraintPad, padding || {}); 6900 // Reset location to apply constraint 6901 if (this.useTop && this.useLeft) 6902 this.setLocation(parseFloat(this.element.style.top), parseFloat(this.element.style.left)); 6903 }, 6904 6905 // initDrag event 6906 6907 _initDrag: function(event) { 6908 // No resize on minimized window 6909 if (Event.element(event) == this.sizer && this.isMinimized()) 6910 return; 6911 6912 // No move on maximzed window 6913 if (Event.element(event) != this.sizer && this.isMaximized()) 6914 return; 6915 6916 if (Prototype.Browser.IE && this.heightN == 0) 6917 this._getWindowBorderSize(); 6918 6919 // Get pointer X,Y 6920 this.pointer = [this._round(Event.pointerX(event), this.options.gridX), this._round(Event.pointerY(event), this.options.gridY)]; 6921 if (this.options.wiredDrag) 6922 this.currentDrag = this._createWiredElement(); 6923 else 6924 this.currentDrag = this.element; 6925 6926 // Resize 6927 if (Event.element(event) == this.sizer) { 6928 this.doResize = true; 6929 this.widthOrg = this.width; 6930 this.heightOrg = this.height; 6931 this.bottomOrg = parseFloat(this.element.getStyle('bottom')); 6932 this.rightOrg = parseFloat(this.element.getStyle('right')); 6933 this._notify("onStartResize"); 6934 } 6935 else { 6936 this.doResize = false; 6937 6938 // Check if click on close button, 6939 var closeButton = $(this.getId() + '_close'); 6940 if (closeButton && Position.within(closeButton, this.pointer[0], this.pointer[1])) { 6941 this.currentDrag = null; 6942 return; 6943 } 6944 6945 this.toFront(); 6946 6947 if (! this.options.draggable) 6948 return; 6949 this._notify("onStartMove"); 6950 } 6951 // Register global event to capture mouseUp and mouseMove 6952 Event.observe(document, "mouseup", this.eventMouseUp, false); 6953 Event.observe(document, "mousemove", this.eventMouseMove, false); 6954 6955 // Add an invisible div to keep catching mouse event over iframes 6956 WindowUtilities.disableScreen('__invisible__', '__invisible__', this.overlayOpacity); 6957 6958 // Stop selection while dragging 6959 document.body.ondrag = function () { return false; }; 6960 document.body.onselectstart = function () { return false; }; 6961 6962 this.currentDrag.show(); 6963 Event.stop(event); 6964 }, 6965 6966 _round: function(val, round) { 6967 return round == 1 ? val : val = Math.floor(val / round) * round; 6968 }, 6969 6970 // updateDrag event 6971 _updateDrag: function(event) { 6972 var pointer = [this._round(Event.pointerX(event), this.options.gridX), this._round(Event.pointerY(event), this.options.gridY)]; 6973 var dx = pointer[0] - this.pointer[0]; 6974 var dy = pointer[1] - this.pointer[1]; 6975
6976 // Resize case, update width/height 6977 if (this.doResize) { 6978 var w = this.widthOrg + dx; 6979 var h = this.heightOrg + dy; 6980 6981 dx = this.width - this.widthOrg 6982 dy = this.height - this.heightOrg 6983 6984 // Check if it's a right position, update it to keep upper-left corner at the same position 6985 if (this.useLeft) 6986 w = this._updateWidthConstraint(w) 6987 else 6988 this.currentDrag.setStyle({right: (this.rightOrg -dx) + 'px'}); 6989 // Check if it's a bottom position, update it to keep upper-left corner at the same position 6990 if (this.useTop) 6991 h = this._updateHeightConstraint(h) 6992 else 6993 this.currentDrag.setStyle({bottom: (this.bottomOrg -dy) + 'px'}); 6994 6995 this.setSize(w , h); 6996 this._notify("onResize"); 6997 } 6998 // Move case, update top/left 6999 else { 7000 this.pointer = pointer; 7001 7002 if (this.useLeft) { 7003 var left = parseFloat(this.currentDrag.getStyle('left')) + dx; 7004 var newLeft = this._updateLeftConstraint(left); 7005 // Keep mouse pointer correct 7006 this.pointer[0] += newLeft-left; 7007 this.currentDrag.setStyle({left: newLeft + 'px'}); 7008 } 7009 else 7010 this.currentDrag.setStyle({right: parseFloat(this.currentDrag.getStyle('right')) - dx + 'px'}); 7011 7012 if (this.useTop) { 7013 var top = parseFloat(this.currentDrag.getStyle('top')) + dy; 7014 var newTop = this._updateTopConstraint(top); 7015 // Keep mouse pointer correct 7016 this.pointer[1] += newTop - top; 7017 this.currentDrag.setStyle({top: newTop + 'px'}); 7018 } 7019 else 7020 this.currentDrag.setStyle({bottom: parseFloat(this.currentDrag.getStyle('bottom')) - dy + 'px'}); 7021 7022 this._notify("onMove"); 7023 } 7024 if (this.iefix) 7025 this._fixIEOverlapping(); 7026 7027 this._removeStoreLocation(); 7028 Event.stop(event); 7029 }, 7030 7031 // endDrag callback 7032 _endDrag: function(event) { 7033 // Remove temporary div over iframes 7034 WindowUtilities.enableScreen('__invisible__'); 7035 7036 if (this.doResize) 7037 this._notify("onEndResize"); 7038 else 7039 this._notify("onEndMove"); 7040 7041 // Release event observing 7042 Event.stopObserving(document, "mouseup", this.eventMouseUp,false); 7043 Event.stopObserving(document, "mousemove", this.eventMouseMove, false); 7044 7045 Event.stop(event); 7046 7047 this._hideWiredElement(); 7048 7049 // Store new location/size if need be 7050 this._saveCookie() 7051 7052 // Restore selection 7053 document.body.ondrag = null; 7054 document.body.onselectstart = null; 7055 }, 7056 7057 _updateLeftConstraint: function(left) { 7058 if (this.constraint && this.useLeft && this.useTop) { 7059 var width = this.options.parent == document.body ? WindowUtilities.getPageSize().windowWidth : this.options.parent.getDimensions().width; 7060 7061 if (left < this.constraintPad.left) 7062 left = this.constraintPad.left; 7063 if (left + this.width + this.widthE + this.widthW > width - this.constraintPad.right) 7064 left = width - this.constraintPad.right - this.width - this.widthE - this.widthW; 7065 } 7066 return left; 7067 }, 7068 7069 _updateTopConstraint: function(top) { 7070 if (this.constraint && this.useLeft && this.useTop) { 7071 var height = this.options.parent == document.body ? WindowUtilities.getPageSize().windowHeight : this.options.parent.getDimensions().height; 7072 7073 var h = this.height + this.heightN + this.heightS; 7074 7075 if (top < this.constraintPad.top) 7076 top = this.constraintPad.top; 7077 if (top + h > height - this.constraintPad.bottom) 7078 top = height - this.constraintPad.bottom - h; 7079 } 7080 return top; 7081 }, 7082 7083 _updateWidthConstraint: function(w) { 7084 if (this.constraint && this.useLeft && this.useTop) { 7085 var width = this.options.parent == document.body ? WindowUtilities.getPageSize().windowWidth : this.options.parent.getDimensions().width; 7086 var left = parseFloat(this.element.getStyle("left")); 7087 7088 if (left + w + this.widthE + this.widthW > width - this.constraintPad.right) 7089 w = width - this.constraintPad.right - left - this.widthE - this.widthW; 7090 } 7091 return w; 7092 }, 7093
7094 _updateHeightConstraint: function(h) { 7095 if (this.constraint && this.useLeft && this.useTop) { 7096 var height = this.options.parent == document.body ? WindowUtilities.getPageSize().windowHeight : this.options.parent.getDimensions().height; 7097 var top = parseFloat(this.element.getStyle("top")); 7098 7099 if (top + h + this.heightN + this.heightS > height - this.constraintPad.bottom) 7100 h = height - this.constraintPad.bottom - top - this.heightN - this.heightS; 7101 } 7102 return h; 7103 }, 7104 7105 7106 // Creates HTML window code 7107 _createWindow: function(id) { 7108 var className = this.options.className; 7109 var win = document.createElement("div"); 7110 win.setAttribute('id', id); 7111 win.className = "dialog"; 7112 if (this.options.windowClassName) { 7113 win.className += ' ' + this.options.windowClassName; 7114 } 7115 7116 var content; 7117 if (this.options.url) 7118 content= "<iframe frameborder=\"0\" name=\"" + id + "_content\" id=\"" + id + "_content\" src=\"" + this.options.url + "\"> </iframe>"; 7119 else 7120 content ="<div id=\"" + id + "_content\" class=\"" +className + "_content\"> </div>"; 7121 7122 var closeDiv = this.options.closable ? "<div class='"+ className +"_close' id='"+ id +"_close' onclick='Windows.close(\""+ id +"\", event)'> </div>" : ""; 7123 var minDiv = this.options.minimizable ? "<div class='"+ className + "_minimize' id='"+ id +"_minimize' onclick='Windows.minimize(\""+ id +"\", event)'> </div>" : ""; 7124 var maxDiv = this.options.maximizable ? "<div class='"+ className + "_maximize' id='"+ id +"_maximize' onclick='Windows.maximize(\""+ id +"\", event)'> </div>" : ""; 7125 var seAttributes = this.options.resizable ? "class='" + className + "_sizer' id='" + id + "_sizer'" : "class='" + className + "_se'"; 7126 var blank = "../themes/default/blank.gif"; 7127 7128 win.innerHTML = closeDiv + minDiv + maxDiv + "\ 7129 <a href='#' id='"+ id +"_focus_anchor'><!-- --></a>\ 7130 <table id='"+ id +"_row1' class=\"top table_window\">\ 7131 <tr>\ 7132 <td class='"+ className +"_nw'></td>\ 7133 <td class='"+ className +"_n'><div id='"+ id +"_top' class='"+ className +"_title title_window'>"+ this.options.title +"</div></td>\ 7134 <td class='"+ className +"_ne'></td>\ 7135 </tr>\ 7136 </table>\ 7137 <table id='"+ id +"_row2' class=\"mid table_window\">\ 7138 <tr>\ 7139 <td class='"+ className +"_w'></td>\ 7140 <td id='"+ id +"_table_content' class='"+ className +"_content' valign='top'>" + content + "</td>\ 7141 <td class='"+ className +"_e'></td>\ 7142 </tr>\ 7143 </table>\ 7144 <table id='"+ id +"_row3' class=\"bot table_window\">\ 7145 <tr>\ 7146 <td class='"+ className +"_sw'></td>\ 7147 <td class='"+ className +"_s'><div id='"+ id +"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>\ 7148 <td " + seAttributes + "></td>\ 7149 </tr>\ 7150 </table>\ 7151 "; 7152 Element.hide(win); 7153 this.options.parent.insertBefore(win, this.options.parent.firstChild); 7154 Event.observe($(id + "_content"), "load", this.options.onload); 7155 return win; 7156 }, 7157 7158 7159 changeClassName: function(newClassName) { 7160 var className = this.options.className; 7161 var id = this.getId(); 7162 $A(["_close", "_minimize", "_maximize", "_sizer", "_content"]).each(function(value) { this._toggleClassName($(id + value), className + value, newClassName + value) }.bind(this)); 7163 this._toggleClassName($(id + "_top"), className + "_title", newClassName + "_title"); 7164 $$("#" + id + " td").each(function(td) {td.className = td.className.sub(className,newClassName); }); 7165 this.options.className = newClassName; 7166 }, 7167 7168 _toggleClassName: function(element, oldClassName, newClassName) { 7169 if (element) { 7170 element.removeClassName(oldClassName); 7171 element.addClassName(newClassName); 7172 } 7173 }, 7174 7175 // Sets window location 7176 setLocation: function(top, left) { 7177 top = this._updateTopConstraint(top); 7178 left = this._updateLeftConstraint(left); 7179 7180 var e = this.currentDrag || this.element; 7181 e.setStyle({top: top + 'px'}); 7182 e.setStyle({left: left + 'px'}); 7183 7184 this.useLeft = true; 7185 this.useTop = true; 7186 }, 7187 7188 getLocation: function() { 7189 var location = {}; 7190 if (this.useTop) 7191 location = Object.extend(location, {top: this.element.getStyle("top")}); 7192 else 7193 location = Object.extend(location, {bottom: this.element.getStyle("bottom")}); 7194 if (this.useLeft) 7195 location = Object.extend(location, {left: this.element.getStyle("left")}); 7196 else 7197 location = Object.extend(location, {right: this.element.getStyle("right")}); 7198 7199 return location; 7200 }, 7201
7202 // Gets window size 7203 getSize: function() { 7204 return {width: this.width, height: this.height}; 7205 }, 7206 7207 // Sets window size 7208 setSize: function(width, height, useEffect) { 7209 width = parseFloat(width); 7210 height = parseFloat(height); 7211 7212 // Check min and max size 7213 if (!this.minimized && width < this.options.minWidth) 7214 width = this.options.minWidth; 7215 7216 if (!this.minimized && height < this.options.minHeight) 7217 height = this.options.minHeight; 7218 7219 if (this.options. maxHeight && height > this.options. maxHeight) 7220 height = this.options. maxHeight; 7221 7222 if (this.options. maxWidth && width > this.options. maxWidth) 7223 width = this.options. maxWidth; 7224 7225 7226 if (this.useTop && this.useLeft && Window.hasEffectLib && Effect.ResizeWindow && useEffect) { 7227 new Effect.ResizeWindow(this, null, null, width, height, {duration: Window.resizeEffectDuration}); 7228 } else { 7229 this.width = width; 7230 this.height = height; 7231 var e = this.currentDrag ? this.currentDrag : this.element; 7232 7233 e.setStyle({width: width + this.widthW + this.widthE + "px"}) 7234 e.setStyle({height: height + this.heightN + this.heightS + "px"}) 7235 7236 // Update content size 7237 if (!this.currentDrag || this.currentDrag == this.element) { 7238 var content = $(this.element.id + '_content'); 7239 content.setStyle({height: height + 'px'}); 7240 content.setStyle({width: width + 'px'}); 7241 } 7242 } 7243 }, 7244 7245 updateHeight: function() { 7246 this.setSize(this.width, this.content.scrollHeight, true); 7247 }, 7248 7249 updateWidth: function() { 7250 this.setSize(this.content.scrollWidth, this.height, true); 7251 }, 7252 7253 // Brings window to front 7254 toFront: function() { 7255 if (this.element.style.zIndex < Windows.maxZIndex) 7256 this.setZIndex(Windows.maxZIndex + 1); 7257 if (this.iefix) 7258 this._fixIEOverlapping(); 7259 }, 7260 7261 getBounds: function(insideOnly) { 7262 if (! this.width || !this.height || !this.visible) 7263 this.computeBounds(); 7264 var w = this.width; 7265 var h = this.height; 7266 7267 if (!insideOnly) { 7268 w += this.widthW + this.widthE; 7269 h += this.heightN + this.heightS; 7270 } 7271 var bounds = Object.extend(this.getLocation(), {width: w + "px", height: h + "px"}); 7272 return bounds; 7273 }, 7274 7275 computeBounds: function() { 7276 if (! this.width || !this.height) { 7277 var size = WindowUtilities._computeSize(this.content.innerHTML, this.content.id, this.width, this.height, 0, this.options.className) 7278 if (this.height) 7279 this.width = size + 5 7280 else 7281 this.height = size + 5 7282 } 7283 7284 this.setSize(this.width, this.height); 7285 if (this.centered) 7286 this._center(this.centerTop, this.centerLeft); 7287 }, 7288 7289 // Displays window modal state or not 7290 show: function(modal) { 7291 this.visible = true; 7292 if (modal) { 7293 // Hack for Safari !! 7294 if (typeof this.overlayOpacity == "undefined") { 7295 var that = this; 7296 setTimeout(function() {that.show(modal)}, 10); 7297 return; 7298 } 7299 Windows.addModalWindow(this); 7300 7301 this.modal = true; 7302 this.setZIndex(Windows.maxZIndex + 1); 7303 Windows.unsetOverflow(this); 7304 } 7305 else 7306 if (!this.element.style.zIndex) 7307 this.setZIndex(Windows.maxZIndex + 1); 7308 7309 // To restore overflow if need be 7310 if (this.oldStyle) 7311 this.getContent().setStyle({overflow: this.oldStyle}); 7312 7313 this.computeBounds(); 7314 7315 this._notify("onBeforeShow"); 7316 if (this.options.showEffect != Element.show && this.options.showEffectOptions) 7317 this.options.showEffect(this.element, this.options.showEffectOptions); 7318 else 7319 this.options.showEffect(this.element); 7320 7321 this._checkIEOverlapping(); 7322 WindowUtilities.focusedWindow = this 7323 this._notify("onShow"); 7324 $(this.element.id + '_focus_anchor').focus(); 7325 }, 7326 7327 // Displays window modal state or not at the center of the page 7328 showCenter: function(modal, top, left) { 7329 this.centered = true; 7330 this.centerTop = top; 7331 this.centerLeft = left; 7332 7333 this.show(modal); 7334 }, 7335 7336 isVisible: function() { 7337 return this.visible; 7338 }, 7339
7340 _center: function(top, left) { 7341 var windowScroll = WindowUtilities.getWindowScroll(this.options.parent); 7342 var pageSize = WindowUtilities.getPageSize(this.options.parent); 7343 if (typeof top == "undefined") 7344 top = (pageSize.windowHeight - (this.height + this.heightN + this.heightS))/2; 7345 top += windowScroll.top 7346 7347 if (typeof left == "undefined") 7348 left = (pageSize.windowWidth - (this.width + this.widthW + this.widthE))/2; 7349 left += windowScroll.left 7350 this.setLocation(top, left); 7351 this.toFront(); 7352 }, 7353 7354 _recenter: function(event) { 7355 if (this.centered) { 7356 var pageSize = WindowUtilities.getPageSize(this.options.parent); 7357 var windowScroll = WindowUtilities.getWindowScroll(this.options.parent); 7358 7359 // Check for this stupid IE that sends dumb events 7360 if (this.pageSize && this.pageSize.windowWidth == pageSize.windowWidth && this.pageSize.windowHeight == pageSize.windowHeight && 7361 this.windowScroll.left == windowScroll.left && this.windowScroll.top == windowScroll.top) 7362 return; 7363 this.pageSize = pageSize; 7364 this.windowScroll = windowScroll; 7365 // set height of Overlay to take up whole page and show 7366 if ($('overlay_modal')) 7367 $('overlay_modal').setStyle({height: (pageSize.pageHeight + 'px')}); 7368 7369 if (this.options.recenterAuto) 7370 this._center(this.centerTop, this.centerLeft); 7371 } 7372 }, 7373 7374 // Hides window 7375 hide: function() { 7376 this.visible = false; 7377 if (this.modal) { 7378 Windows.removeModalWindow(this); 7379 Windows.resetOverflow(); 7380 } 7381 // To avoid bug on scrolling bar 7382 this.oldStyle = this.getContent().getStyle('overflow') || "auto" 7383 this.getContent().setStyle({overflow: "hidden"}); 7384 7385 this.options.hideEffect(this.element, this.options.hideEffectOptions); 7386 7387 if(this.iefix) 7388 this.iefix.hide(); 7389 7390 if (!this.doNotNotifyHide) 7391 this._notify("onHide"); 7392 }, 7393 7394 close: function() { 7395 // Asks closeCallback if exists 7396 if (this.visible) { 7397 if (this.options.closeCallback && ! this.options.closeCallback(this)) 7398 return; 7399 7400 if (this.options.destroyOnClose) { 7401 var destroyFunc = this.destroy.bind(this); 7402 if (this.options.hideEffectOptions.afterFinish) { 7403 var func = this.options.hideEffectOptions.afterFinish; 7404 this.options.hideEffectOptions.afterFinish = function() {func();destroyFunc() } 7405 } 7406 else 7407 this.options.hideEffectOptions.afterFinish = function() {destroyFunc() } 7408 } 7409 Windows.updateFocusedWindow(); 7410 7411 this.doNotNotifyHide = true; 7412 this.hide(); 7413 this.doNotNotifyHide = false;
7414 this._notify("onClose"); 7415 } 7416 }, 7417 7418 minimize: function() { 7419 if (this.resizing) 7420 return; 7421 7422 var r2 = $(this.getId() + "_row2"); 7423 7424 if (!this.minimized) { 7425 this.minimized = true; 7426 7427 var dh = r2.getDimensions().height; 7428 this.r2Height = dh; 7429 var h = this.element.getHeight() - dh; 7430 7431 if (this.useLeft && this.useTop && Window.hasEffectLib && Effect.ResizeWindow) { 7432 new Effect.ResizeWindow(this, null, null, null, this.height -dh, {duration: Window.resizeEffectDuration}); 7433 } else { 7434 this.height -= dh; 7435 this.element.setStyle({height: h + "px"}); 7436 r2.hide(); 7437 } 7438 7439 if (! this.useTop) { 7440 var bottom = parseFloat(this.element.getStyle('bottom')); 7441 this.element.setStyle({bottom: (bottom + dh) + 'px'}); 7442 } 7443 } 7444 else { 7445 this.minimized = false; 7446 7447 var dh = this.r2Height; 7448 this.r2Height = null; 7449 if (this.useLeft && this.useTop && Window.hasEffectLib && Effect.ResizeWindow) { 7450 new Effect.ResizeWindow(this, null, null, null, this.height + dh, {duration: Window.resizeEffectDuration}); 7451 } 7452 else { 7453 var h = this.element.getHeight() + dh; 7454 this.height += dh; 7455 this.element.setStyle({height: h + "px"}) 7456 r2.show(); 7457 } 7458 if (! this.useTop) { 7459 var bottom = parseFloat(this.element.getStyle('bottom')); 7460 this.element.setStyle({bottom: (bottom - dh) + 'px'}); 7461 } 7462 this.toFront(); 7463 } 7464 this._notify("onMinimize"); 7465 7466 // Store new location/size if need be 7467 this._saveCookie() 7468 }, 7469 7470 maximize: function() { 7471 if (this.isMinimized() || this.resizing) 7472 return; 7473 7474 if (Prototype.Browser.IE && this.heightN == 0) 7475 this._getWindowBorderSize(); 7476 7477 if (this.storedLocation != null) { 7478 this._restoreLocation(); 7479 if(this.iefix) 7480 this.iefix.hide(); 7481 } 7482 else { 7483 this._storeLocation(); 7484 Windows.unsetOverflow(this); 7485 7486 var windowScroll = WindowUtilities.getWindowScroll(this.options.parent); 7487 var pageSize = WindowUtilities.getPageSize(this.options.parent); 7488 var left = windowScroll.left; 7489 var top = windowScroll.top; 7490 7491 if (this.options.parent != document.body) { 7492 windowScroll = {top:0, left:0, bottom:0, right:0}; 7493 var dim = this.options.parent.getDimensions(); 7494 pageSize.windowWidth = dim.width; 7495 pageSize.windowHeight = dim.height; 7496 top = 0; 7497 left = 0; 7498 } 7499 7500 if (this.constraint) { 7501 pageSize.windowWidth -= Math.max(0, this.constraintPad.left) + Math.max(0, this.constraintPad.right); 7502 pageSize.windowHeight -= Math.max(0, this.constraintPad.top) + Math.max(0, this.constraintPad.bottom); 7503 left += Math.max(0, this.constraintPad.left); 7504 top += Math.max(0, this.constraintPad.top); 7505 } 7506 7507 var width = pageSize.windowWidth - this.widthW - this.widthE; 7508 var height= pageSize.windowHeight - this.heightN - this.heightS; 7509 7510 if (this.useLeft && this.useTop && Window.hasEffectLib && Effect.ResizeWindow) { 7511 new Effect.ResizeWindow(this, top, left, width, height, {duration: Window.resizeEffectDuration}); 7512 } 7513 else { 7514 this.setSize(width, height); 7515 this.element.setStyle(this.useLeft ? {left: left} : {right: left}); 7516 this.element.setStyle(this.useTop ? {top: top} : {bottom: top}); 7517 } 7518 7519 this.toFront(); 7520 if (this.iefix) 7521 this._fixIEOverlapping(); 7522 } 7523 this._notify("onMaximize"); 7524 7525 // Store new location/size if need be 7526 this._saveCookie() 7527 }, 7528 7529 isMinimized: function() { 7530 return this.minimized; 7531 }, 7532 7533 isMaximized: function() { 7534 return (this.storedLocation != null); 7535 }, 7536 7537 setOpacity: function(opacity) { 7538 if (Element.setOpacity) 7539 Element.setOpacity(this.element, opacity); 7540 }, 7541 7542 setZIndex: function(zindex) { 7543 this.element.setStyle({zIndex: zindex}); 7544 Windows.updateZindex(zindex, this); 7545 }, 7546 7547 setTitle: function(newTitle) { 7548 if (!newTitle || newTitle == "") 7549 newTitle = " "; 7550
7551 Element.update(this.element.id + '_top', newTitle); 7552 }, 7553 7554 getTitle: function() { 7555 return $(this.element.id + '_top').innerHTML; 7556 }, 7557 7558 setStatusBar: function(element) { 7559 var statusBar = $(this.getId() + "_bottom"); 7560 7561 if (typeof(element) == "object") { 7562 if (this.bottombar.firstChild) 7563 this.bottombar.replaceChild(element, this.bottombar.firstChild); 7564 else 7565 this.bottombar.appendChild(element); 7566 } 7567 else 7568 this.bottombar.innerHTML = element; 7569 }, 7570 7571 _checkIEOverlapping: function() { 7572 if(!this.iefix && (navigator.appVersion.indexOf('MSIE')>0) && (navigator.userAgent.indexOf('Opera')<0) && (this.element.getStyle('position')=='absolute')) { 7573 new Insertion.After(this.element.id, '<iframe id="' + this.element.id + '_iefix" '+ 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' + 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>'); 7574 this.iefix = $(this.element.id+'_iefix'); 7575 } 7576 if(this.iefix) 7577 setTimeout(this._fixIEOverlapping.bind(this), 50); 7578 }, 7579 7580 _fixIEOverlapping: function() { 7581 Position.clone(this.element, this.iefix); 7582 this.iefix.style.zIndex = this.element.style.zIndex - 1; 7583 this.iefix.show(); 7584 }, 7585 7586 _keyUp: function(event) { 7587 if (27 == event.keyCode && this.options.closeOnEsc) { 7588 this.close(); 7589 } 7590 }, 7591 7592 _getWindowBorderSize: function(event) { 7593 // Hack to get real window border size!! 7594 var div = this._createHiddenDiv(this.options.className + "_n") 7595 this.heightN = Element.getDimensions(div).height; 7596 div.parentNode.removeChild(div) 7597 7598 var div = this._createHiddenDiv(this.options.className + "_s") 7599 this.heightS = Element.getDimensions(div).height; 7600 div.parentNode.removeChild(div) 7601 7602 var div = this._createHiddenDiv(this.options.className + "_e") 7603 this.widthE = Element.getDimensions(div).width; 7604 div.parentNode.removeChild(div) 7605 7606 var div = this._createHiddenDiv(this.options.className + "_w") 7607 this.widthW = Element.getDimensions(div).width; 7608 div.parentNode.removeChild(div); 7609 7610 var div = document.createElement("div"); 7611 div.className = "overlay_" + this.options.className ; 7612 document.body.appendChild(div); 7613 //alert("no timeout:\nopacity: " + div.getStyle("opacity") + "\nwidth: " + document.defaultView.getComputedStyle(div, null).width); 7614 var that = this; 7615 7616 // Workaround for Safari!! 7617 setTimeout(function() {that.overlayOpacity = ($(div).getStyle("opacity")); div.parentNode.removeChild(div);}, 10); 7618 7619 // Workaround for IE!! 7620 if (Prototype.Browser.IE) { 7621 this.heightS = $(this.getId() +"_row3").getDimensions().height; 7622 this.heightN = $(this.getId() +"_row1").getDimensions().height; 7623 } 7624 7625 // Safari size fix 7626 if (Prototype.Browser.WebKit && Prototype.Browser.WebKitVersion < 420) 7627 this.setSize(this.width, this.height); 7628 if (this.doMaximize) 7629 this.maximize(); 7630 if (this.doMinimize) 7631 this.minimize(); 7632 }, 7633 7634 _createHiddenDiv: function(className) { 7635 var objBody = document.body; 7636 var win = document.createElement("div"); 7637 win.setAttribute('id', this.element.id+ "_tmp"); 7638 win.className = className; 7639 win.style.display = 'none'; 7640 win.innerHTML = ''; 7641 objBody.insertBefore(win, objBody.firstChild); 7642 return win; 7643 }, 7644 7645 _storeLocation: function() { 7646 if (this.storedLocation == null) { 7647 this.storedLocation = {useTop: this.useTop, useLeft: this.useLeft, 7648 top: this.element.getStyle('top'), bottom: this.element.getStyle('bottom'), 7649 left: this.element.getStyle('left'), right: this.element.getStyle('right'), 7650 width: this.width, height: this.height }; 7651 } 7652 }, 7653 7654 _restoreLocation: function() { 7655 if (this.storedLocation != null) { 7656 this.useLeft = this.storedLocation.useLeft; 7657 this.useTop = this.storedLocation.useTop; 7658 7659 if (this.useLeft && this.useTop && Window.hasEffectLib && Effect.ResizeWindow) 7660 new Effect.ResizeWindow(this, this.storedLocation.top, this.storedLocation.left, this.storedLocation.width, this.storedLocation.height, {duration: Window.resizeEffectDuration}); 7661 else { 7662 this.element.setStyle(this.useLeft ? {left: this.storedLocation.left} : {right: this.storedLocation.right}); 7663 this.element.setStyle(this.useTop ? {top: this.storedLocation.top} : {bottom: this.storedLocation.bottom}); 7664 this.setSize(this.storedLocation.width, this.storedLocation.height); 7665 } 7666 7667 Windows.resetOverflow(); 7668 this._removeStoreLocation(); 7669 } 7670 }, 7671 7672 _removeStoreLocation: function() { 7673 this.storedLocation = null; 7674 }, 7675
7676 _saveCookie: function() { 7677 if (this.cookie) { 7678 var value = ""; 7679 if (this.useLeft) 7680 value += "l:" + (this.storedLocation ? this.storedLocation.left : this.element.getStyle('left')) 7681 else 7682 value += "r:" + (this.storedLocation ? this.storedLocation.right : this.element.getStyle('right')) 7683 if (this.useTop) 7684 value += ",t:" + (this.storedLocation ? this.storedLocation.top : this.element.getStyle('top')) 7685 else 7686 value += ",b:" + (this.storedLocation ? this.storedLocation.bottom :this.element.getStyle('bottom')) 7687 7688 value += "," + (this.storedLocation ? this.storedLocation.width : this.width); 7689 value += "," + (this.storedLocation ? this.storedLocation.height : this.height); 7690 value += "," + this.isMinimized(); 7691 value += "," + this.isMaximized(); 7692 WindowUtilities.setCookie(value, this.cookie) 7693 } 7694 }, 7695 7696 _createWiredElement: function() { 7697 if (! this.wiredElement) { 7698 if (Prototype.Browser.IE) 7699 this._getWindowBorderSize(); 7700 var div = document.createElement("div"); 7701 div.className = "wired_frame " + this.options.className + "_wired_frame"; 7702 7703 div.style.position = 'absolute'; 7704 this.options.parent.insertBefore(div, this.options.parent.firstChild); 7705 this.wiredElement = $(div); 7706 } 7707 if (this.useLeft) 7708 this.wiredElement.setStyle({left: this.element.getStyle('left')}); 7709 else 7710 this.wiredElement.setStyle({right: this.element.getStyle('right')}); 7711 7712 if (this.useTop) 7713 this.wiredElement.setStyle({top: this.element.getStyle('top')}); 7714 else 7715 this.wiredElement.setStyle({bottom: this.element.getStyle('bottom')}); 7716 7717 var dim = this.element.getDimensions(); 7718 this.wiredElement.setStyle({width: dim.width + "px", height: dim.height +"px"}); 7719 7720 this.wiredElement.setStyle({zIndex: Windows.maxZIndex+30}); 7721 return this.wiredElement; 7722 }, 7723 7724 _hideWiredElement: function() { 7725 if (! this.wiredElement || ! this.currentDrag) 7726 return; 7727 if (this.currentDrag == this.element) 7728 this.currentDrag = null; 7729 else { 7730 if (this.useLeft) 7731 this.element.setStyle({left: this.currentDrag.getStyle('left')}); 7732 else 7733 this.element.setStyle({right: this.currentDrag.getStyle('right')}); 7734 7735 if (this.useTop) 7736 this.element.setStyle({top: this.currentDrag.getStyle('top')}); 7737 else 7738 this.element.setStyle({bottom: this.currentDrag.getStyle('bottom')}); 7739 7740 this.currentDrag.hide(); 7741 this.currentDrag = null; 7742 if (this.doResize) 7743 this.setSize(this.width, this.height); 7744 } 7745 }, 7746 7747 _notify: function(eventName) { 7748 if (this.options[eventName]) 7749 this.options[eventName](this); 7750 else 7751 Windows.notify(eventName, this); 7752 } 7753}; 7754 7755// Windows containers, register all page windows 7756var Windows = { 7757 windows: [], 7758 modalWindows: [], 7759 observers: [], 7760 focusedWindow: null, 7761 maxZIndex: 0, 7762 overlayShowEffectOptions: {duration: 0.5}, 7763 overlayHideEffectOptions: {duration: 0.5}, 7764 7765 addObserver: function(observer) { 7766 this.removeObserver(observer); 7767 this.observers.push(observer); 7768 }, 7769
7770 removeObserver: function(observer) { 7771 this.observers = this.observers.reject( function(o) { return o==observer }); 7772 }, 7773 7774 // onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocus onBlur onBeforeShow onShow onHide onMinimize onMaximize onClose 7775 notify: function(eventName, win) { 7776 this.observers.each( function(o) {if(o[eventName]) o[eventName](eventName, win);}); 7777 }, 7778 7779 // Gets window from its id 7780 getWindow: function(id) { 7781 return this.windows.detect(function(d) { return d.getId() ==id }); 7782 }, 7783 7784 // Gets the last focused window 7785 getFocusedWindow: function() { 7786 return this.focusedWindow; 7787 }, 7788 7789 updateFocusedWindow: function() { 7790 this.focusedWindow = this.windows.length >=2 ? this.windows[this.windows.length-2] : null; 7791 }, 7792 7793 // Registers a new window (called by Windows constructor) 7794 register: function(win) { 7795 this.windows.push(win); 7796 }, 7797 7798 // Add a modal window in the stack 7799 addModalWindow: function(win) { 7800 // Disable screen if first modal window 7801 if (this.modalWindows.length == 0) { 7802 WindowUtilities.disableScreen(win.options.className, 'overlay_modal', win.overlayOpacity, win.getId(), win.options.parent); 7803 } 7804 else { 7805 // Move overlay over all windows 7806 if (Window.keepMultiModalWindow) { 7807 $('overlay_modal').style.zIndex = Windows.maxZIndex + 1; 7808 Windows.maxZIndex += 1; 7809 WindowUtilities._hideSelect(this.modalWindows.last().getId()); 7810 } 7811 // Hide current modal window 7812 else 7813 this.modalWindows.last().element.hide(); 7814 // Fucking IE select issue 7815 WindowUtilities._showSelect(win.getId()); 7816 } 7817 this.modalWindows.push(win); 7818 }, 7819 7820 removeModalWindow: function(win) { 7821 this.modalWindows.pop(); 7822 7823 // No more modal windows 7824 if (this.modalWindows.length == 0) 7825 WindowUtilities.enableScreen(); 7826 else { 7827 if (Window.keepMultiModalWindow) { 7828 this.modalWindows.last().toFront(); 7829 WindowUtilities._showSelect(this.modalWindows.last().getId()); 7830 } 7831 else 7832 this.modalWindows.last().element.show(); 7833 } 7834 }, 7835 7836 // Registers a new window (called by Windows constructor) 7837 register: function(win) { 7838 this.windows.push(win); 7839 }, 7840 7841 // Unregisters a window (called by Windows destructor) 7842 unregister: function(win) { 7843 this.windows = this.windows.reject(function(d) { return d==win }); 7844 }, 7845 7846 // Closes all windows 7847 closeAll: function() { 7848 this.windows.each( function(w) {Windows.close(w.getId())} ); 7849 }, 7850 7851 closeAllModalWindows: function() { 7852 WindowUtilities.enableScreen(); 7853 this.modalWindows.each( function(win) {if (win) win.close()}); 7854 }, 7855 7856 // Minimizes a window with its id 7857 minimize: function(id, event) { 7858 var win = this.getWindow(id) 7859 if (win && win.visible) 7860 win.minimize(); 7861 Event.stop(event); 7862 }, 7863 7864 // Maximizes a window with its id 7865 maximize: function(id, event) { 7866 var win = this.getWindow(id) 7867 if (win && win.visible) 7868 win.maximize(); 7869 Event.stop(event); 7870 }, 7871 7872 // Closes a window with its id 7873 close: function(id, event) { 7874 var win = this.getWindow(id); 7875 if (win) 7876 win.close(); 7877 if (event) 7878 Event.stop(event); 7879 }, 7880 7881 blur: function(id) { 7882 var win = this.getWindow(id); 7883 if (!win) 7884 return; 7885 if (win.options.blurClassName) 7886 win.changeClassName(win.options.blurClassName); 7887 if (this.focusedWindow == win) 7888 this.focusedWindow = null; 7889 win._notify("onBlur"); 7890 }, 7891 7892 focus: function(id) { 7893 var win = this.getWindow(id); 7894 if (!win) 7895 return; 7896 if (this.focusedWindow) 7897 this.blur(this.focusedWindow.getId()) 7898 7899 if (win.options.focusClassName) 7900 win.changeClassName(win.options.focusClassName); 7901 this.focusedWindow = win; 7902 win._notify("onFocus"); 7903 }, 7904 7905 unsetOverflow: function(except) { 7906 this.windows.each(function(d) { d.oldOverflow = d.getContent().getStyle("overflow") || "auto" ; d.getContent().setStyle({overflow: "hidden"}) }); 7907 if (except && except.oldOverflow) 7908 except.getContent().setStyle({overflow: except.oldOverflow}); 7909 }, 7910 7911 resetOverflow: function() { 7912 this.windows.each(function(d) { if (d.oldOverflow) d.getContent().setStyle({overflow: d.oldOverflow}) }); 7913 }, 7914 7915 updateZindex: function(zindex, win) { 7916 if (zindex > this.maxZIndex) { 7917 this.maxZIndex = zindex; 7918 if (this.focusedWindow) 7919 this.blur(this.focusedWindow.getId()) 7920 } 7921 this.focusedWindow = win; 7922 if (this.focusedWindow) 7923 this.focus(this.focusedWindow.getId()) 7924 } 7925}; 7926 7927var Dialog = { 7928 dialogId: null,
7929 onCompleteFunc: null, 7930 callFunc: null, 7931 parameters: null, 7932 7933 confirm: function(content, parameters) { 7934 // Get Ajax return before 7935 if (content && typeof content != "string") { 7936 Dialog._runAjaxRequest(content, parameters, Dialog.confirm); 7937 return 7938 } 7939 content = content || ""; 7940 7941 parameters = parameters || {}; 7942 var okLabel = parameters.okLabel ? parameters.okLabel : "Ok"; 7943 var cancelLabel = parameters.cancelLabel ? parameters.cancelLabel : "Cancel"; 7944 7945 // Backward compatibility 7946 parameters = Object.extend(parameters, parameters.windowParameters || {}); 7947 parameters.windowParameters = parameters.windowParameters || {}; 7948 7949 parameters.className = parameters.className || "alert"; 7950 7951 var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'" 7952 var cancelButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " cancel_button'" 7953/* var content = "\ 7954 <div class='" + parameters.className + "_message'>" + content + "</div>\ 7955 <div class='" + parameters.className + "_buttons'>\ 7956 <input type='button' value='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "/>\ 7957 <input type='button' value='" + cancelLabel + "' onclick='Dialog.cancelCallback()' " + cancelButtonClass + "/>\ 7958 </div>\ 7959 "; */ 7960 var content = "\ 7961 <div class='" + parameters.className + "_message'>" + content + "</div>\ 7962 <div class='" + parameters.className + "_buttons'>\ 7963 <button type='button' title='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "><span><span><span>" + okLabel + "</span></span></span></button>\ 7964 <button type='button' title='" + cancelLabel + "' onclick='Dialog.cancelCallback()' " + cancelButtonClass + "><span><span><span>" + cancelLabel + "</span></span></span></button>\ 7965 </div>\ 7966 "; 7967 return this._openDialog(content, parameters) 7968 }, 7969 7970 alert: function(content, parameters) { 7971 // Get Ajax return before 7972 if (content && typeof content != "string") { 7973 Dialog._runAjaxRequest(content, parameters, Dialog.alert); 7974 return 7975 } 7976 content = content || ""; 7977 7978 parameters = parameters || {}; 7979 var okLabel = parameters.okLabel ? parameters.okLabel : "Ok"; 7980 7981 // Backward compatibility 7982 parameters = Object.extend(parameters, parameters.windowParameters || {}); 7983 parameters.windowParameters = parameters.windowParameters || {}; 7984 7985 parameters.className = parameters.className || "alert"; 7986 7987 var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'" 7988/* var content = "\ 7989 <div class='" + parameters.className + "_message'>" + content + "</div>\ 7990 <div class='" + parameters.className + "_buttons'>\ 7991 <input type='button' value='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "/>\ 7992 </div>"; */ 7993 var content = "\ 7994 <div class='" + parameters.className + "_message'>" + content + "</div>\ 7995 <div class='" + parameters.className + "_buttons'>\ 7996 <button type='button' title='" + okLabel + "' onclick='Dialog.okCallback()' " + okButtonClass + "><span><span><span>" + okLabel + "</span></span></span></button>\ 7997 </div>"; 7998 return this._openDialog(content, parameters) 7999 }, 8000 8001 info: function(content, parameters) { 8002 // Get Ajax return before 8003 if (content && typeof content != "string") { 8004 Dialog._runAjaxRequest(content, parameters, Dialog.info); 8005 return 8006 } 8007 content = content || ""; 8008 8009 // Backward compatibility 8010 parameters = parameters || {}; 8011 parameters = Object.extend(parameters, parameters.windowParameters || {}); 8012 parameters.windowParameters = parameters.windowParameters || {}; 8013 8014 parameters.className = parameters.className || "alert"; 8015 8016 var content = "<div id='modal_dialog_message' class='" + parameters.className + "_message'>" + content + "</div>"; 8017 if (parameters.showProgress) 8018 content += "<div id='modal_dialog_progress' class='" + parameters.className + "_progress'> </div>"; 8019 8020 parameters.ok = null; 8021 parameters.cancel = null; 8022 8023 return this._openDialog(content, parameters) 8024 }, 8025 8026 setInfoMessage: function(message) { 8027 $('modal_dialog_message').update(message); 8028 }, 8029
8030 closeInfo: function() { 8031 Windows.close(this.dialogId); 8032 }, 8033 8034 _openDialog: function(content, parameters) { 8035 var className = parameters.className; 8036 8037 if (! parameters.height && ! parameters.width) { 8038 parameters.width = WindowUtilities.getPageSize(parameters.options.parent || document.body).pageWidth / 2; 8039 } 8040 if (parameters.id) 8041 this.dialogId = parameters.id; 8042 else { 8043 var t = new Date(); 8044 this.dialogId = 'modal_dialog_' + t.getTime(); 8045 parameters.id = this.dialogId; 8046 } 8047 8048 // compute height or width if need be 8049 if (! parameters.height || ! parameters.width) { 8050 var size = WindowUtilities._computeSize(content, this.dialogId, parameters.width, parameters.height, 5, className) 8051 if (parameters.height) 8052 parameters.width = size + 5 8053 else 8054 parameters.height = size + 5 8055 } 8056 parameters.effectOptions = parameters.effectOptions ; 8057 parameters.resizable = parameters.resizable || false; 8058 parameters.minimizable = parameters.minimizable || false; 8059 parameters.maximizable = parameters.maximizable || false; 8060 parameters.draggable = parameters.draggable || false; 8061 parameters.closable = parameters.closable || false; 8062 8063 var win = new Window(parameters); 8064 win.getContent().innerHTML = content; 8065 8066 win.showCenter(true, parameters.top, parameters.left); 8067 win.setDestroyOnClose(); 8068 8069 win.cancelCallback = parameters.onCancel || parameters.cancel; 8070 win.okCallback = parameters.onOk || parameters.ok; 8071 8072 return win; 8073 }, 8074 8075 _getAjaxContent: function(originalRequest) { 8076 Dialog.callFunc(originalRequest.responseText, Dialog.parameters) 8077 }, 8078 8079 _runAjaxRequest: function(message, parameters, callFunc) { 8080 if (message.options == null) 8081 message.options = {} 8082 Dialog.onCompleteFunc = message.options.onComplete; 8083 Dialog.parameters = parameters; 8084 Dialog.callFunc = callFunc; 8085 8086 message.options.onComplete = Dialog._getAjaxContent; 8087 new Ajax.Request(message.url, message.options); 8088 }, 8089 8090 okCallback: function() { 8091 var win = Windows.focusedWindow; 8092 if (!win.okCallback || win.okCallback(win)) { 8093 // Remove onclick on button 8094 $$("#" + win.getId()+" input").each(function(element) {element.onclick=null;}) 8095 win.close(); 8096 } 8097 }, 8098 8099 cancelCallback: function() { 8100 var win = Windows.focusedWindow; 8101 // Remove onclick on button 8102 $$("#" + win.getId()+" input").each(function(element) {element.onclick=null}) 8103 win.close(); 8104 if (win.cancelCallback) 8105 win.cancelCallback(win); 8106 } 8107}; 8108/* 8109 Based on Lightbox JS: Fullsize Image Overlays 8110 by Lokesh Dhakar - http://www.huddletogether.com 8111 8112 For more information on this script, visit: 8113 http://huddletogether.com/projects/lightbox/ 8114 8115 Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/ 8116 (basically, do anything you want, just leave my name and link) 8117*/ 8118 8119if (Prototype.Browser.WebKit) { 8120 var array = navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/)); 8121 Prototype.Browser.WebKitVersion = parseFloat(array[1]); 8122} 8123 8124var WindowUtilities = { 8125 // From dragdrop.js 8126 getWindowScroll: function(parent) { 8127 var T, L, W, H; 8128 parent = parent || document.body; 8129 if (parent != document.body) { 8130 T = parent.scrollTop; 8131 L = parent.scrollLeft; 8132 W = parent.scrollWidth; 8133 H = parent.scrollHeight; 8134 } 8135 else { 8136 var w = window; 8137 with (w.document) { 8138 if (w.document.documentElement && documentElement.scrollTop) { 8139 T = documentElement.scrollTop; 8140 L = documentElement.scrollLeft; 8141 } else if (w.document.body) { 8142 T = body.scrollTop; 8143 L = body.scrollLeft; 8144 } 8145 if (w.innerWidth) { 8146 W = w.innerWidth; 8147 H = w.innerHeight; 8148 } else if (w.document.documentElement && documentElement.clientWidth) { 8149 W = documentElement.clientWidth; 8150 H = documentElement.clientHeight; 8151 } else { 8152 W = body.offsetWidth; 8153 H = body.offsetHeight 8154 } 8155 } 8156 } 8157 return { top: T, left: L, width: W, height: H }; 8158 }, 8159 // 8160 // getPageSize() 8161 // Returns array with page width, height and window width, height 8162 // Core code from - quirksmode.org 8163 // Edit for Firefox by pHaez 8164 // 8165 getPageSize: function(parent){ 8166 parent = parent || document.body; 8167 var windowWidth, windowHeight; 8168 var pageHeight, pageWidth; 8169 if (parent != document.body) { 8170 windowWidth = parent.getWidth(); 8171 windowHeight = parent.getHeight(); 8172 pageWidth = parent.scrollWidth; 8173 pageHeight = parent.scrollHeight; 8174 } 8175 else { 8176 var xScroll, yScroll; 8177 8178 if (window.innerHeight && window.scrollMaxY) { 8179 xScroll = document.body.scrollWidth; 8180 yScroll = window.innerHeight + window.scrollMaxY; 8181 } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac 8182 xScroll = document.body.scrollWidth; 8183 yScroll = document.body.scrollHeight; 8184 } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari 8185 xScroll = document.body.offsetWidth; 8186 yScroll = document.body.offsetHeight; 8187 } 8188 8189
8190 if (self.innerHeight) { // all except Explorer 8191 windowWidth = document.documentElement.clientWidth;//self.innerWidth; 8192 windowHeight = self.innerHeight; 8193 } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode 8194 windowWidth = document.documentElement.clientWidth; 8195 windowHeight = document.documentElement.clientHeight; 8196 } else if (document.body) { // other Explorers 8197 windowWidth = document.body.clientWidth; 8198 windowHeight = document.body.clientHeight; 8199 } 8200 8201 // for small pages with total height less then height of the viewport 8202 if(yScroll < windowHeight){ 8203 pageHeight = windowHeight; 8204 } else { 8205 pageHeight = yScroll; 8206 } 8207 8208 // for small pages with total width less then width of the viewport 8209 if(xScroll < windowWidth){ 8210 pageWidth = windowWidth; 8211 } else { 8212 pageWidth = xScroll; 8213 } 8214 } 8215 return {pageWidth: pageWidth ,pageHeight: pageHeight , windowWidth: windowWidth, windowHeight: windowHeight}; 8216 }, 8217 8218 disableScreen: function(className, overlayId, overlayOpacity, contentId, parent) { 8219 WindowUtilities.initLightbox(overlayId, className, function() {this._disableScreen(className, overlayId, overlayOpacity, contentId)}.bind(this), parent || document.body); 8220 }, 8221 8222 _disableScreen: function(className, overlayId, overlayOpacity, contentId) { 8223 // prep objects 8224 var objOverlay = $(overlayId); 8225 8226 var pageSize = WindowUtilities.getPageSize(objOverlay.parentNode); 8227 8228 // Hide select boxes as they will 'peek' through the image in IE, store old value 8229 if (contentId && Prototype.Browser.IE) { 8230 WindowUtilities._hideSelect(); 8231 WindowUtilities._showSelect(contentId); 8232 } 8233 8234 // set height of Overlay to take up whole page and show 8235 objOverlay.style.height = (pageSize.pageHeight + 'px'); 8236 objOverlay.style.display = 'none'; 8237 if (overlayId == "overlay_modal" && Window.hasEffectLib && Windows.overlayShowEffectOptions) { 8238 objOverlay.overlayOpacity = overlayOpacity; 8239 new Effect.Appear(objOverlay, Object.extend({from: 0, to: overlayOpacity}, Windows.overlayShowEffectOptions)); 8240 } 8241 else 8242 objOverlay.style.display = "block"; 8243 }, 8244 8245 enableScreen: function(id) { 8246 id = id || 'overlay_modal'; 8247 var objOverlay = $(id); 8248 if (objOverlay) { 8249 // hide lightbox and overlay 8250 if (id == "overlay_modal" && Window.hasEffectLib && Windows.overlayHideEffectOptions) 8251 new Effect.Fade(objOverlay, Object.extend({from: objOverlay.overlayOpacity, to:0}, Windows.overlayHideEffectOptions)); 8252 else { 8253 objOverlay.style.display = 'none'; 8254 objOverlay.parentNode.removeChild(objOverlay); 8255 } 8256 8257 // make select boxes visible using old value 8258 if (id != "__invisible__") 8259 WindowUtilities._showSelect(); 8260 } 8261 }, 8262 8263 _hideSelect: function(id) { 8264 if (Prototype.Browser.IE) { 8265 id = id == null ? "" : "#" + id + " "; 8266 $$(id + 'select').each(function(element) { 8267 if (! WindowUtilities.isDefined(element.oldVisibility)) { 8268 element.oldVisibility = element.style.visibility ? element.style.visibility : "visible"; 8269 element.style.visibility = "hidden"; 8270 } 8271 }); 8272 } 8273 }, 8274 8275 _showSelect: function(id) { 8276 if (Prototype.Browser.IE) { 8277 id = id == null ? "" : "#" + id + " "; 8278 $$(id + 'select').each(function(element) { 8279 if (WindowUtilities.isDefined(element.oldVisibility)) { 8280 // Why?? Ask IE 8281 try { 8282 element.style.visibility = element.oldVisibility; 8283 } catch(e) { 8284 element.style.visibility = "visible"; 8285 } 8286 element.oldVisibility = null; 8287 } 8288 else { 8289 if (element.style.visibility) 8290 element.style.visibility = "visible"; 8291 } 8292 }); 8293 } 8294 }, 8295 8296 isDefined: function(object) { 8297 return typeof(object) != "undefined" && object != null; 8298 }, 8299 8300 // initLightbox() 8301 // Function runs on window load, going through link tags looking for rel="lightbox". 8302 // These links receive onclick events that enable the lightbox display for their targets. 8303 // The function also inserts html markup at the top of the page which will be used as a 8304 // container for the overlay pattern and the inline image. 8305 initLightbox: function(id, className, doneHandler, parent) { 8306 // Already done, just update zIndex 8307 if ($(id)) { 8308 Element.setStyle(id, {zIndex: Windows.maxZIndex + 1}); 8309 Windows.maxZIndex++; 8310 doneHandler(); 8311 } 8312 // create overlay div and hardcode some functional styles (aesthetic styles are in CSS file) 8313 else { 8314 var objOverlay = document.createElement("div"); 8315 objOverlay.setAttribute('id', id); 8316 objOverlay.className = "overlay_" + className 8317 objOverlay.style.display = 'none'; 8318 objOverlay.style.position = 'absolute'; 8319 objOverlay.style.top = '0'; 8320 objOverlay.style.left = '0'; 8321 objOverlay.style.zIndex = Windows.maxZIndex + 1; 8322 Windows.maxZIndex++; 8323 objOverlay.style.width = '100%'; 8324 parent.insertBefore(objOverlay, parent.firstChild); 8325 if (Prototype.Browser.WebKit && id == "overlay_modal") { 8326 setTimeout(function() {doneHandler()}, 10); 8327 } 8328 else 8329 doneHandler(); 8330 } 8331 }, 8332
8333 setCookie: function(value, parameters) { 8334 document.cookie= parameters[0] + "=" + escape(value) + 8335 ((parameters[1]) ? "; expires=" + parameters[1].toGMTString() : "") + 8336 ((parameters[2]) ? "; path=" + parameters[2] : "") + 8337 ((parameters[3]) ? "; domain=" + parameters[3] : "") + 8338 ((parameters[4]) ? "; secure" : ""); 8339 }, 8340 8341 getCookie: function(name) { 8342 var dc = document.cookie; 8343 var prefix = name + "="; 8344 var begin = dc.indexOf("; " + prefix); 8345 if (begin == -1) { 8346 begin = dc.indexOf(prefix); 8347 if (begin != 0) return null; 8348 } else { 8349 begin += 2; 8350 } 8351 var end = document.cookie.indexOf(";", begin); 8352 if (end == -1) { 8353 end = dc.length; 8354 } 8355 return unescape(dc.substring(begin + prefix.length, end)); 8356 }, 8357 8358 _computeSize: function(content, id, width, height, margin, className) { 8359 var objBody = document.body; 8360 var tmpObj = document.createElement("div"); 8361 tmpObj.setAttribute('id', id); 8362 tmpObj.className = className + "_content"; 8363 8364 if (height) 8365 tmpObj.style.height = height + "px" 8366 else 8367 tmpObj.style.width = width + "px" 8368 8369 tmpObj.style.position = 'absolute'; 8370 tmpObj.style.top = '0'; 8371 tmpObj.style.left = '0'; 8372 tmpObj.style.display = 'none'; 8373 8374 tmpObj.innerHTML = content; 8375 objBody.insertBefore(tmpObj, objBody.firstChild); 8376 8377 var size; 8378 if (height) 8379 size = $(tmpObj).getDimensions().width + margin; 8380 else 8381 size = $(tmpObj).getDimensions().height + margin; 8382 objBody.removeChild(tmpObj); 8383 return size; 8384 } 8385}; 8386 8387// jQuery Mask Plugin v1.7.7 8388// github.com/igorescobar/jQuery-Mask-Plugin 8389(function(f){"function"===typeof define&&define.amd?define(["jquery"],f):f(window.jQuery||window.Zepto)})(function(f){var A=function(a,d,b){var h=this,m,p;a=f(a);d="function"===typeof d?d(a.val(),void 0,a,b):d;var c={getCaret:function(){try{var e,l=0,c=a.get(0),g=document.selection,d=c.selectionStart;if(g&&!~navigator.appVersion.indexOf("MSIE 10"))e=g.createRange(),e.moveStart("character",a.is("input")?-a.val().length:-a.text().length),l=e.text.length;else if(d||"0"===d)l=d;return l}catch(b){}},setCaret:function(e){try{if(a.is(":focus")){var l, 8390c=a.get(0);c.setSelectionRange?c.setSelectionRange(e,e):c.createTextRange&&(l=c.createTextRange(),l.collapse(!0),l.moveEnd("character",e),l.moveStart("character",e),l.select())}}catch(g){}},events:function(){a.on("keydown.mask",function(){m=c.val()}).on("keyup.mask",c.behaviour).on("paste.mask drop.mask",function(){setTimeout(function(){a.keydown().keyup()},100)}).on("change.mask",function(){a.data("changed",!0)}).on("blur.mask",function(){m===a.val()||a.data("changed")||a.trigger("change");a.data("changed", 8391!1)}).on("focusout.mask",function(){b.clearIfNotMatch&&!p.test(c.val())&&c.val("")})},getRegexMask:function(){for(var e=[],a,c,g,b,k=0;k<d.length;k++)(a=h.translation[d[k]])?(c=a.pattern.toString().replace(/.{1}$|^.{1}/g,""),g=a.optional,(a=a.recursive)?(e.push(d[k]),b={digit:d[k],pattern:c}):e.push(g||a?c+"?":c)):e.push(d[k].replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"));e=e.join("");b&&(e=e.replace(new RegExp("("+b.digit+"(.*"+b.digit+")?)"),"($1)?").replace(new RegExp(b.digit,"g"),b.pattern));return new RegExp(e)}, 8392destroyEvents:function(){a.off("keydown keyup paste drop change blur focusout DOMNodeInserted ".split(" ").join(".mask ")).removeData("changeCalled")},val:function(e){var c=a.is("input");return 0<arguments.length?c?a.val(e):a.text(e):c?a.val():a.text()},getMCharsBeforeCount:function(e,a){for(var c=0,b=0,f=d.length;b<f&&b<e;b++)h.translation[d.charAt(b)]||(e=a?e+1:e,c++);return c},caretPos:function(e,a,b,g){return h.translation[d.charAt(Math.min(e-1,d.length-1))]?Math.min(e+b-a-g,b):c.caretPos(e+1, 8393a,b,g)},behaviour:function(a){a=a||window.event;var b=a.keyCode||a.which;if(-1===f.inArray(b,h.byPassKeys)){var d=c.getCaret(),g=c.val(),t=g.length,k=d<t,m=c.getMasked(),n=m.length,p=c.getMCharsBeforeCount(n-1)-c.getMCharsBeforeCount(t-1);m!==g&&c.val(m);!k||65===b&&a.ctrlKey||(8!==b&&46!==b&&(d=c.caretPos(d,t,n,p)),c.setCaret(d));return c.callbacks(a)}},getMasked:function(a){var l=[],f=c.val(),g=0,m=d.length,k=0,p=f.length,n=1,u="push",r=-1,q,v;b.reverse?(u="unshift",n=-1,q=0,g=m-1,k=p-1,v=function(){return-1< 8394g&&-1<k}
8394):(q=m-1,v=function(){return g<m&&k<p});for(;v();){var w=d.charAt(g),x=f.charAt(k),s=h.translation[w];if(s)x.match(s.pattern)?(l[u](x),s.recursive&&(-1===r?r=g:g===q&&(g=r-n),q===r&&(g-=n)),g+=n):s.optional&&(g+=n,k-=n),k+=n;else{if(!a)l[u](w);x===w&&(k+=n);g+=n}}a=d.charAt(q);m!==p+1||h.translation[a]||l.push(a);return l.join("")},callbacks:function(e){var f=c.val(),h=f!==m;if(!0===h&&"function"===typeof b.onChange)b.onChange(f,e,a,b);if(!0===h&&"function"===typeof b.onKeyPress)b.onKeyPress(f, 8395e,a,b);if("function"===typeof b.onComplete&&f.length===d.length)b.onComplete(f,e,a,b)}};h.mask=d;h.options=b;h.remove=function(){var b;c.destroyEvents();c.val(h.getCleanVal()).removeAttr("maxlength");b=c.getCaret();c.setCaret(b-c.getMCharsBeforeCount(b));return a};h.getCleanVal=function(){return c.getMasked(!0)};h.init=function(){b=b||{};h.byPassKeys=[9,16,17,18,36,37,38,39,40,91];h.translation={0:{pattern:/\d/},9:{pattern:/\d/,optional:!0},"#":{pattern:/\d/,recursive:!0},A:{pattern:/[a-zA-Z0-9]/}, 8396S:{pattern:/[a-zA-Z]/}};h.translation=f.extend({},h.translation,b.translation);h=f.extend(!0,{},h,b);p=c.getRegexMask();!1!==b.maxlength&&a.attr("maxlength",d.length);b.placeholder&&a.attr("placeholder",b.placeholder);a.attr("autocomplete","off");c.destroyEvents();c.events();var e=c.getCaret();c.val(c.getMasked());c.setCaret(e+c.getMCharsBeforeCount(e,!0))}()},y={},z=function(){var a=f(this),d={};a.attr("data-mask-reverse")&&(d.reverse=!0);"false"===a.attr("data-mask-maxlength")&&(d.maxlength=!1); 8397a.attr("data-mask-clearifnotmatch")&&(d.clearIfNotMatch=!0);a.mask(a.attr("data-mask"),d)};f.fn.mask=function(a,d){var b=this.selector,h=function(){var b=f(this).data("mask"),h=JSON.stringify;if("object"!==typeof b||h(b.options)!==h(d)||b.mask!==a)return f(this).data("mask",new A(this,a,d))};this.each(h);b&&!y[b]&&(y[b]=!0,setTimeout(function(){f(document).on("DOMNodeInserted.mask",b,h)},500))};f.fn.unmask=function(){try{return this.each(function(){f(this).data("mask").remove().removeData("mask")})}catch(a){}}; 8398f.fn.cleanVal=function(){return this.data("mask").getCleanVal()};f("*[data-mask]").each(z);f(document).on("DOMNodeInserted.mask","*[data-mask]",z)}); 8399 8400/* 8401* TypeWatch 3 8402* 8403* Examples/Docs: github.com/dennyferra/TypeWatch 8404* 8405* Dual licensed under the MIT and GPL licenses: 8406* http://www.opensource.org/licenses/mit-license.php 8407* http://www.gnu.org/licenses/gpl.html 8408*/ 8409 8410!function(root, factory) { 8411 if (typeof define === 'function' && define.amd) { 8412 define(['jquery'], factory); 8413 } else if (typeof exports === 'object') { 8414 factory(require('jquery')); 8415 } else { 8416 factory(root.jQuery); 8417 } 8418}(this, function($) { 8419 'use strict'; 8420 $.fn.typeWatch = function(o) { 8421 // The default input types that are supported 8422 var _supportedInputTypes = 8423 ['TEXT', 'TEXTAREA', 'PASSWORD', 'TEL', 'SEARCH', 'URL', 'EMAIL', 'DATETIME', 'DATE', 'MONTH', 'WEEK', 'TIME', 'DATETIME-LOCAL', 'NUMBER', 'RANGE', 'DIV']; 8424 8425 // Options 8426 var options = $.extend({ 8427 wait: 750, 8428 callback: function() { }, 8429 highlight: true, 8430 captureLength: 2, 8431 allowSubmit: false, 8432 inputTypes: _supportedInputTypes 8433 }, o); 8434 8435 function checkElement(timer, override) { 8436 var value = timer.type === 'DIV' 8437 ? jQuery(timer.el).html() 8438 : jQuery(timer.el).val(); 8439 8440 // If has capture length and has changed value 8441 // Or override and has capture length or allowSubmit option is true 8442 // Or capture length is zero and changed value 8443 if ((value.length >= options.captureLength /*&& value != timer.text*/) 8444 || (override && (value.length >= options.captureLength || options.allowSubmit)) 8445 || (value.length == 0 && timer.text)) 8446 { 8447 timer.text = value; 8448 timer.cb.call(timer.el, value); 8449 } 8450 }; 8451 8452 function watchElement(elem) { 8453 var elementType = (elem.type || elem.nodeName).toUpperCase(); 8454 if (jQuery.inArray(elementType, options.inputTypes) >= 0) { 8455 // Allocate timer element 8456 var timer = { 8457 timer: null, 8458 text: (elementType === 'DIV') ? jQuery(elem).html() : jQuery(elem).val(), 8459 cb: options.callback, 8460 el: elem, 8461 type: elementType, 8462 wait: options.wait 8463 }; 8464 8465 // Set focus action (highlight) 8466 if (options.highlight && elementType !== 'DIV') 8467 jQuery(elem).focus(function() { this.select(); }); 8468 8469 // Key watcher / clear and reset the timer 8470 var startWatch = function(evt) { 8471 var timerWait = timer.wait; 8472 var overrideBool = false;
8473 var evtElementType = elementType; 8474 8475 // If enter key is pressed and not a TEXTAREA or DIV 8476 if (typeof evt.keyCode != 'undefined' && evt.keyCode == 13 8477 && evtElementType !== 'TEXTAREA' && elementType !== 'DIV') 8478 { 8479 console.log('OVERRIDE'); 8480 timerWait = 1; 8481 overrideBool = true; 8482 } 8483 8484 var timerCallbackFx = function() { 8485 checkElement(timer, overrideBool) 8486 } 8487 8488 // Clear timer 8489 clearTimeout(timer.timer); 8490 timer.timer = setTimeout(timerCallbackFx, timerWait); 8491 }; 8492 8493 jQuery(elem).on('keydown paste cut input', startWatch); 8494 } 8495 }; 8496 8497 // Watch each element 8498 return this.each(function() { 8499 watchElement(this); 8500 }); 8501 }; 8502}); 8503/* Font Face Observer v2.0.13 - é Bram Stein. License: BSD-3-Clause */(function(){function l(a,b){document.addEventListener?a.addEventListener("scroll",b,!1):a.attachEvent("scroll",b)}function m(a){document.body?a():document.addEventListener?document.addEventListener("DOMContentLoaded",function c(){document.removeEventListener("DOMContentLoaded",c);a()}):document.attachEvent("onreadystatechange",function k(){if("interactive"==document.readyState||"complete"==document.readyState)document.detachEvent("onreadystatechange",k),a()})};function r(a){this.a=document.createElement("div");this.a.setAttribute("aria-hidden","true");this.a.appendChild(document.createTextNode(a));this.b=document.createElement("span");this.c=document.createElement("span");this.h=document.createElement("span");this.f=document.createElement("span");this.g=-1;this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;"; 8504this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;";this.b.appendChild(this.h);this.c.appendChild(this.f);this.a.appendChild(this.b);this.a.appendChild(this.c)} 8505function t(a,b){a.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+b+";"}function y(a){var b=a.a.offsetWidth,c=b+100;a.f.style.width=c+"px";a.c.scrollLeft=c;a.b.scrollLeft=a.b.scrollWidth+100;return a.g!==b?(a.g=b,!0):!1}function z(a,b){function c(){var a=k;y(a)&&a.a.parentNode&&b(a.g)}var k=a;l(a.b,c);l(a.c,c);y(a)};function A(a,b){var c=b||{};this.family=a;this.style=c.style||"normal";this.weight=c.weight||"normal";this.stretch=c.stretch||"normal"}var B=null,C=null,E=null,F=null;function G(){if(null===C)if(J()&&/Apple/.test(window.navigator.vendor)){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent);C=!!a&&603>parseInt(a[1],10)}else C=!1;return C}function J(){null===F&&(F=!!document.fonts);return F} 8506function K(){if(null===E){var a=document.createElement("div");try{a.style.font="condensed 100px sans-serif"}catch(b){}E=""!==a.style.font}return E}function L(a,b){return[a.style,a.weight,K()?a.stretch:"","100px",b].join(" ")} 8507A.prototype.load=function(a,b){var c=this,k=a||"BESbswy",q=0,D=b||3E3,H=(new Date).getTime();return new Promise(function(a,b){if(J()&&!G()){var M=new Promise(function(a,b){function e(){(new Date).getTime()-H>=D?b():document.fonts.load(L(c,'"'+c.family+'"'),k).then(function(c){1<=c.length?a():setTimeout(e,25)},function(){b()})}e()}),N=new Promise(function(a,c){q=setTimeout(c,D)});Promise.race([N,M]).then(function(){clearTimeout(q);a(c)},function(){b(c)})}else m(function(){function u(){var b;if(b=-1!= 8508f&&-1!=g||-1!=f&&-1!=h||-1!=g&&-1!=h)(b=f!=g&&f!=h&&g!=h)||(null===B&&(b=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),B=!!b&&(536>parseInt(b[1],10)||536===parseInt(b[1],10)&&11>=parseInt(b[2],10))),b=B&&(f==v&&g==v&&h==v||f==w&&g==w&&h==w||f==x&&g==x&&h==x)),b=!b;b&&(d.parentNode&&d.parentNode.removeChild(d),clearTimeout(q),a(c))}function I(){if((new Date).getTime()-H>=D)d.parentNode&&d.parentNode.removeChild(d),b(c);else{var a=document.hidden;if(!0===a||void 0===a)f=e.a.offsetWidth, 8509g=n.a.offsetWidth,h=p.a.offsetWidth,u();q=setTimeout(I,50)}}var e=new r(k),n=new r(k),p=new r(k),f=-1,g=-1,h=-1,v=-1,w=-1,x=-1,d=document.createElement("div");d.dir="ltr";
vendor: 531 bytes, lines 8509-8510
8509t(e,L(c,"sans-serif"));t(n,L(c,"serif"));t(p,L(c,"monospace"));d.appendChild(e.a);d.appendChild(n.a);d.appendChild(p.a);document.body.appendChild(d);v=e.a.offsetWidth;w=n.a.offsetWidth;x=p.a.offsetWidth;I();z(e,function(a){f=a;u()});t(e,L(c,'"'+c.family+'",sans-serif'));z(n,function(a){g=a;u()});t(n,L(c,'"'+c.family+'",serif')); 8510z(p,function(a){h=a;u()});t(p,L(c,'"'+c.family+'",monospace'))})})};"object"===typeof module?module.exports=A:(window.FontFaceObserver=A,window.FontFaceObserver.prototype.load=A.prototype.load);}());
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.