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 window.addEventListener('unload', Prototype.emptyFunction, false); 5622 5623 5624 var _getDOMEventName = Prototype.K, 5625 translations = { mouseenter: "mouseover", mouseleave: "mouseout" }; 5626 5627 if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) { 5628 _getDOMEventName = function(eventName) { 5629 return (translations[eventName] || eventName); 5630 }; 5631 } 5632 5633 function observe(element, eventName, handler) { 5634 element = $(element); 5635 5636 var responder = _createResponder(element, eventName, handler); 5637 5638 if (!responder) return element; 5639 5640 if (eventName.include(':')) { 5641 if (element.addEventListener) 5642 element.addEventListener("dataavailable", responder, false); 5643 else { 5644 element.attachEvent("ondataavailable", responder); 5645 element.attachEvent("onlosecapture", responder); 5646 } 5647 } else { 5648 var actualEventName = _getDOMEventName(eventName); 5649 5650 if (element.addEventListener) 5651 element.addEventListener(actualEventName, responder, false); 5652 else 5653 element.attachEvent("on" + actualEventName, responder); 5654 } 5655 5656 return element; 5657 } 5658 5659 function stopObserving(element, eventName, handler) { 5660 element = $(element); 5661 5662 var registry = Element.retrieve(element, 'prototype_event_registry'); 5663 if (!registry) return element; 5664 5665 if (!eventName) { 5666 registry.each( function(pair) { 5667 var eventName = pair.key; 5668 stopObserving(element, eventName); 5669 }); 5670 return element; 5671 } 5672 5673 var responders = registry.get(eventName); 5674 if (!responders) return element; 5675 5676 if (!handler) { 5677 responders.each(function(r) { 5678 stopObserving(element, eventName, r.handler); 5679 }); 5680 return element; 5681 } 5682 5683 var i = responders.length, responder; 5684 while (i--) { 5685 if (responders[i].handler === handler) { 5686 responder = responders[i]; 5687 break; 5688 } 5689 } 5690 if (!responder) return element; 5691 5692 if (eventName.include(':')) { 5693 if (element.removeEventListener) 5694 element.removeEventListener("dataavailable", responder, false); 5695 else { 5696 element.detachEvent("ondataavailable", responder); 5697 element.detachEvent("onlosecapture", responder); 5698 } 5699 } else { 5700 var actualEventName = _getDOMEventName(eventName); 5701 if (element.removeEventListener) 5702 element.removeEventListener(actualEventName, responder, false); 5703 else 5704 element.detachEvent('on' + actualEventName, responder); 5705 } 5706 5707 registry.set(eventName, responders.without(responder)); 5708 5709 return element; 5710 } 5711 5712 function fire(element, eventName, memo, bubble) { 5713 element = $(element); 5714 5715 if (Object.isUndefined(bubble)) 5716 bubble = true; 5717 5718 if (element == document && document.createEvent && !element.dispatchEvent) 5719 element = document.documentElement; 5720 5721 var event; 5722 if (document.createEvent) { 5723 event = document.createEvent('HTMLEvents'); 5724 event.initEvent('dataavailable', bubble, true); 5725 } else { 5726 event = document.createEventObject(); 5727 event.eventType = bubble ? 'ondataavailable' : 'onlosecapture'; 5728 } 5729 5730 event.eventName = eventName; 5731 event.memo = memo || { }; 5732 5733 if (document.createEvent) 5734 element.dispatchEvent(event); 5735 else 5736 element.fireEvent(event.eventType, event); 5737 5738 return Event.extend(event); 5739 } 5740 5741 Event.Handler = Class.create({ 5742 initialize: function(element, eventName, selector, callback) { 5743 this.element = $(element); 5744 this.eventName = eventName; 5745 this.selector = selector; 5746 this.callback = callback; 5747 this.handler = this.handleEvent.bind(this); 5748 }, 5749 5750 start: function() { 5751 Event.observe(this.element, this.eventName, this.handler); 5752 return this; 5753 }, 5754 5755 stop: function() { 5756 Event.stopObserving(this.element, this.eventName, this.handler); 5757 return this; 5758 }, 5759 5760 handleEvent: function(event) { 5761 var element = Event.findElement(event, this.selector); 5762 if (element) this.callback.call(this.element, event, element); 5763 } 5764 }); 5765 5766 function on(element, eventName, selector, callback) { 5767 element = $(element); 5768 if (Object.isFunction(selector) && Object.isUndefined(callback)) { 5769 callback = selector, selector = null; 5770 } 5771 5772 return new Event.Handler(element, eventName, selector, callback).start(); 5773 } 5774 5775 Object.extend(Event, Event.Methods); 5776 5777 Object.extend(Event, { 5778 fire: fire, 5779 observe: observe, 5780 stopObserving: stopObserving, 5781 on: on 5782 }); 5783 5784 Element.addMethods({ 5785 fire: fire, 5786 5787 observe: observe, 5788 5789 stopObserving: stopObserving, 5790 5791 on: on 5792 }); 5793 5794 Object.extend(document, { 5795 fire: fire.methodize(), 5796 5797 observe: observe.methodize(), 5798 5799 stopObserving: stopObserving.methodize(), 5800 5801 on: on.methodize(), 5802 5803 loaded: false 5804 }); 5805 5806 if (window.Event) Object.extend(window.Event, Event); 5807 else window.Event = Event; 5808})(); 5809 5810(function() { 5811 /* Support for the DOMContentLoaded event is based on work by Dan Webb, 5812 Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */ 5813 5814 var timer; 5815 5816 function fireContentLoadedEvent() { 5817 if (document.loaded) return; 5818 if (timer) window.clearTimeout(timer); 5819 document.loaded = true; 5820 document.fire('dom:loaded'); 5821 } 5822 5823 function checkReadyState() { 5824 if (document.readyState === 'complete') { 5825 document.stopObserving('readystatechange', checkReadyState); 5826 fireContentLoadedEvent(); 5827 } 5828 } 5829 5830 function pollDoScroll() { 5831 try { document.documentElement.doScroll('left'); } 5832 catch(e) { 5833 timer = pollDoScroll.defer(); 5834 return; 5835 } 5836 fireContentLoadedEvent(); 5837 } 5838 5839 if (document.addEventListener) { 5840 document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false); 5841 } else { 5842 document.observe('readystatechange', checkReadyState); 5843 if (window == top) 5844 timer = pollDoScroll.defer(); 5845 } 5846 5847 Event.observe(window, 'load', fireContentLoadedEvent); 5848})(); 5849 5850Element.addMethods(); 5851 5852/*------------------------------- DEPRECATED -------------------------------*/ 5853 5854Hash.toQueryString = Object.toQueryString; 5855 5856var Toggle = { display: Element.toggle }; 5857 5858Element.Methods.childOf = Element.Methods.descendantOf; 5859 5860var Insertion = { 5861 Before: function(element, content) { 5862 return Element.insert(element, {before:content}); 5863 }, 5864 5865 Top: function(element, content) { 5866 return Element.insert(element, {top:content}); 5867 }, 5868 5869 Bottom: function(element, content) { 5870 return Element.insert(element, {bottom:content}); 5871 }, 5872 5873 After: function(element, content) { 5874 return Element.insert(element, {after:content}); 5875 } 5876}; 5877 5878var $continue = new Error('"throw $continue" is deprecated, use "return" instead'); 5879 5880var Position = { 5881 includeScrollOffsets: false, 5882 5883 prepare: function() { 5884 this.deltaX = window.pageXOffset 5885 || document.documentElement.scrollLeft 5886 || document.body.scrollLeft 5887 || 0; 5888 this.deltaY = window.pageYOffset 5889 || document.documentElement.scrollTop 5890 || document.body.scrollTop 5891 || 0; 5892 }, 5893 5894 within: function(element, x, y) { 5895 if (this.includeScrollOffsets) 5896 return this.withinIncludingScrolloffsets(element, x, y); 5897 this.xcomp = x; 5898 this.ycomp = y; 5899 this.offset = Element.cumulativeOffset(element); 5900 5901 return (y >= this.offset[1] && 5902 y < this.offset[1] + element.offsetHeight && 5903 x >= this.offset[0] && 5904 x < this.offset[0] + element.offsetWidth); 5905 }, 5906 5907 withinIncludingScrolloffsets: function(element, x, y) { 5908 var offsetcache = Element.cumulativeScrollOffset(element); 5909 5910 this.xcomp = x + offsetcache[0] - this.deltaX; 5911 this.ycomp = y + offsetcache[1] - this.deltaY; 5912 this.offset = Element.cumulativeOffset(element); 5913 5914 return (this.ycomp >= this.offset[1] && 5915 this.ycomp < this.offset[1] + element.offsetHeight && 5916 this.xcomp >= this.offset[0] && 5917 this.xcomp < this.offset[0] + element.offsetWidth); 5918 }, 5919 5920 overlap: function(mode, element) { 5921 if (!mode) return 0; 5922 if (mode == 'vertical') 5923 return ((this.offset[1] + element.offsetHeight) - this.ycomp) / 5924 element.offsetHeight; 5925 if (mode == 'horizontal') 5926 return ((this.offset[0] + element.offsetWidth) - this.xcomp) / 5927 element.offsetWidth; 5928 }, 5929 5930 5931 cumulativeOffset: Element.Methods.cumulativeOffset, 5932 5933 positionedOffset: Element.Methods.positionedOffset, 5934 5935 absolutize: function(element) { 5936 Position.prepare(); 5937 return Element.absolutize(element); 5938 }, 5939 5940 relativize: function(element) { 5941 Position.prepare(); 5942 return Element.relativize(element); 5943 }, 5944 5945 realOffset: Element.Methods.cumulativeScrollOffset, 5946 5947 offsetParent: Element.Methods.getOffsetParent, 5948 5949 page: Element.Methods.viewportOffset, 5950 5951 clone: function(source, target, options) { 5952 options = options || { }; 5953 return Element.clonePosition(target, source, options); 5954 } 5955}; 5956 5957/*--------------------------------------------------------------------------*/ 5958 5959if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){ 5960 function iter(name) { 5961 return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]"; 5962 } 5963 5964 instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ? 5965 function(element, className) {
5966 className = className.toString().strip(); 5967 var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className); 5968 return cond ? document._getElementsByXPath('.//*' + cond, element) : []; 5969 } : function(element, className) { 5970 className = className.toString().strip(); 5971 var elements = [], classNames = (/\s/.test(className) ? $w(className) : null); 5972 if (!classNames && !className) return elements; 5973 5974 var nodes = $(element).getElementsByTagName('*'); 5975 className = ' ' + className + ' '; 5976 5977 for (var i = 0, child, cn; child = nodes[i]; i++) { 5978 if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) || 5979 (classNames && classNames.all(function(name) { 5980 return !name.toString().blank() && cn.include(' ' + name + ' '); 5981 })))) 5982 elements.push(Element.extend(child)); 5983 } 5984 return elements; 5985 }; 5986 5987 return function(className, parentElement) { 5988 return $(parentElement || document.body).getElementsByClassName(className); 5989 }; 5990}(Element.Methods); 5991 5992/*--------------------------------------------------------------------------*/ 5993 5994Element.ClassNames = Class.create(); 5995Element.ClassNames.prototype = { 5996 initialize: function(element) { 5997 this.element = $(element); 5998 }, 5999 6000 _each: function(iterator) { 6001 this.element.className.split(/\s+/).select(function(name) { 6002 return name.length > 0; 6003 })._each(iterator); 6004 }, 6005 6006 set: function(className) { 6007 this.element.className = className; 6008 }, 6009 6010 add: function(classNameToAdd) { 6011 if (this.include(classNameToAdd)) return; 6012 this.set($A(this).concat(classNameToAdd).join(' ')); 6013 }, 6014 6015 remove: function(classNameToRemove) { 6016 if (!this.include(classNameToRemove)) return; 6017 this.set($A(this).without(classNameToRemove).join(' ')); 6018 }, 6019 6020 toString: function() { 6021 return $A(this).join(' '); 6022 } 6023}; 6024 6025Object.extend(Element.ClassNames.prototype, Enumerable); 6026 6027/*--------------------------------------------------------------------------*/ 6028 6029(function() { 6030 window.Selector = Class.create({ 6031 initialize: function(expression) { 6032 this.expression = expression.strip(); 6033 }, 6034 6035 findElements: function(rootElement) { 6036 return Prototype.Selector.select(this.expression, rootElement); 6037 }, 6038 6039 match: function(element) { 6040 return Prototype.Selector.match(element, this.expression); 6041 }, 6042 6043 toString: function() { 6044 return this.expression; 6045 }, 6046 6047 inspect: function() { 6048 return "#<Selector: " + this.expression + ">"; 6049 } 6050 }); 6051 6052 Object.extend(Selector, { 6053 matchElements: function(elements, expression) { 6054 var match = Prototype.Selector.match, 6055 results = []; 6056 6057 for (var i = 0, length = elements.length; i < length; i++) { 6058 var element = elements[i]; 6059 if (match(element, expression)) { 6060 results.push(Element.extend(element)); 6061 } 6062 } 6063 return results; 6064 }, 6065 6066 findElement: function(elements, expression, index) { 6067 index = index || 0; 6068 var matchIndex = 0, element; 6069 for (var i = 0, length = elements.length; i < length; i++) { 6070 element = elements[i]; 6071 if (Prototype.Selector.match(element, expression) && index === matchIndex++) { 6072 return Element.extend(element); 6073 } 6074 } 6075 }, 6076 6077 findChildElements: function(element, expressions) { 6078 var selector = expressions.toArray().join(', '); 6079 return Prototype.Selector.select(selector, element || document); 6080 } 6081 }); 6082})(); 6083 6084// Credit Card Validation Javascript 6085// copyright 12th May 2003, by Stephen Chapman, Felgall Pty Ltd 6086 6087// You have permission to copy and use this javascript provided that 6088// the content of the script is not changed in any way. 6089 6090function validateCreditCard(s) { 6091 // remove non-numerics 6092 var v = "0123456789"; 6093 var w = ""; 6094 for (i=0; i < s.length; i++) { 6095 x = s.charAt(i); 6096 if (v.indexOf(x,0) != -1) 6097 w += x; 6098 } 6099 // validate number 6100 j = w.length / 2; 6101 k = Math.floor(j); 6102 m = Math.ceil(j) - k; 6103 c = 0; 6104 for (i=0; i<k; i++) { 6105 a = w.charAt(i*2+m) * 2; 6106 c += a > 9 ? Math.floor(a/10 + a%10) : a; 6107 } 6108 for (i=0; i<k+m; i++) c += w.charAt(i*2+1-m) * 1; 6109 return (c%10 == 0); 6110} 6111 6112 6113/* 6114* Really easy field validation with Prototype 6115* http://tetlaw.id.au/view/javascript/really-easy-field-validation 6116* Andrew Tetlaw 6117* Version 1.5.4.1 (2007-01-05) 6118* 6119* Copyright (c) 2007 Andrew Tetlaw 6120* Permission is hereby granted, free of charge, to any person 6121* obtaining a copy of this software and associated documentation 6122* files (the "Software"), to deal in the Software without 6123* restriction, including without limitation the rights to use, copy, 6124* modify, merge, publish, distribute, sublicense, and/or sell copies 6125* of the Software, and to permit persons to whom the Software is 6126* furnished to do so, subject to the following conditions: 6127* 6128* The above copyright notice and this permission notice shall be 6129* included in all copies or substantial portions of the Software. 6130* 6131* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 6132* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 6133* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 6134* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 6135* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 6136* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 6137* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 6138* SOFTWARE. 6139* 6140*/ 6141var Validator = Class.create(); 6142 6143Validator.prototype = { 6144 initialize : function(className, error, test, options) { 6145 if(typeof test == 'function'){ 6146 this.options = $H(options); 6147 this._test = test; 6148 } else { 6149 this.options = $H(test); 6150 this._test = function(){return true}; 6151 } 6152 this.error = error || 'Validation failed.'; 6153 this.className = className; 6154 }, 6155 test : function(v, elm) { 6156 return (this._test(v,elm) && this.options.all(function(p){ 6157 return Validator.methods[p.key] ? Validator.methods[p.key](v,elm,p.value) : true; 6158 })); 6159 } 6160} 6161Validator.methods = { 6162 pattern : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || opt.test(v)}, 6163 minLength : function(v,elm,opt) {return v.length >= opt}, 6164 maxLength : function(v,elm,opt) {return v.length <= opt}, 6165 min : function(v,elm,opt) {return v >= parseFloat(opt)}, 6166 max : function(v,elm,opt) {return v <= parseFloat(opt)}, 6167 notOneOf : function(v,elm,opt) {return $A(opt).all(function(value) { 6168 return v != value; 6169 })}, 6170 oneOf : function(v,elm,opt) {return $A(opt).any(function(value) { 6171 return v == value; 6172 })}, 6173 is : function(v,elm,opt) {return v == opt}, 6174 isNot : function(v,elm,opt) {return v != opt}, 6175 equalToField : function(v,elm,opt) {return v == $F(opt)}, 6176 notEqualToField : function(v,elm,opt) {return v != $F(opt)}, 6177 include : function(v,elm,opt) {return $A(opt).all(function(value) { 6178 return Validation.get(value).test(v,elm); 6179 })} 6180} 6181 6182var Validation = Class.create(); 6183Validation.defaultOptions = { 6184 onSubmit : true, 6185 stopOnFirst : false, 6186 immediate : false, 6187 focusOnError : true, 6188 useTitles : false, 6189 addClassNameToContainer: false, 6190 containerClassName: '.input-box', 6191 onFormValidate : function(result, form) {}, 6192 onElementValidate : function(result, elm) {} 6193}; 6194 6195Validation.prototype = { 6196 initialize : function(form, options){ 6197 this.form = $(form); 6198 if (!this.form) { 6199 return; 6200 } 6201 this.options = Object.extend({ 6202 onSubmit : Validation.defaultOptions.onSubmit, 6203 stopOnFirst : Validation.defaultOptions.stopOnFirst, 6204 immediate : Validation.defaultOptions.immediate, 6205 focusOnError : Validation.defaultOptions.focusOnError, 6206 useTitles : Validation.defaultOptions.useTitles, 6207 onFormValidate : Validation.defaultOptions.onFormValidate, 6208 onElementValidate : Validation.defaultOptions.onElementValidate 6209 }, options || {}); 6210 if(this.options.onSubmit) Event.observe(this.form,'submit',this.onSubmit.bind(this),false); 6211 if(this.options.immediate) { 6212 Form.getElements(this.form).each(function(input) { // Thanks Mike! 6213 if (input.tagName.toLowerCase() == 'select') { 6214 Event.observe(input, 'blur', this.onChange.bindAsEventListener(this)); 6215 } 6216 if (input.type.toLowerCase() == 'radio' || input.type.toLowerCase() == 'checkbox') { 6217 Event.observe(input, 'click', this.onChange.bindAsEventListener(this)); 6218 } else { 6219 Event.observe(input, 'change', this.onChange.bindAsEventListener(this)); 6220 } 6221 }, this); 6222 } 6223 }, 6224 onChange : function (ev) { 6225 Validation.isOnChange = true; 6226 Validation.validate(Event.element(ev),{ 6227 useTitle : this.options.useTitles, 6228 onElementValidate : this.options.onElementValidate 6229 }); 6230 Validation.isOnChange = false;
6231 }, 6232 onSubmit : function(ev){ 6233 if(!this.validate()) Event.stop(ev); 6234 }, 6235 validate : function() { 6236 var result = false; 6237 var useTitles = this.options.useTitles; 6238 var callback = this.options.onElementValidate; 6239 try { 6240 if(this.options.stopOnFirst) { 6241 result = Form.getElements(this.form).all(function(elm) { 6242 if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) { 6243 return true; 6244 } 6245 return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); 6246 }, this); 6247 } else { 6248 result = Form.getElements(this.form).collect(function(elm) { 6249 if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) { 6250 return true; 6251 } 6252 return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); 6253 }, this).all(); 6254 } 6255 } catch (e) { 6256 } 6257 if(!result && this.options.focusOnError) { 6258 try{ 6259 Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first().focus() 6260 } 6261 catch(e){ 6262 } 6263 } 6264 this.options.onFormValidate(result, this.form); 6265 return result; 6266 }, 6267 reset : function() { 6268 Form.getElements(this.form).each(Validation.reset); 6269 }, 6270 isElementInForm : function(elm, form) { 6271 var domForm = elm.up('form'); 6272 if (domForm == form) { 6273 return true; 6274 } 6275 return false; 6276 } 6277} 6278 6279Object.extend(Validation, { 6280 validate : function(elm, options){ 6281 options = Object.extend({ 6282 useTitle : false, 6283 onElementValidate : function(result, elm) {} 6284 }, options || {}); 6285 elm = $(elm); 6286 6287 var cn = $w(elm.className); 6288 return result = cn.all(function(value) { 6289 var test = Validation.test(value,elm,options.useTitle); 6290 options.onElementValidate(test, elm); 6291 return test; 6292 }); 6293 }, 6294 insertAdvice : function(elm, advice){ 6295 var container = $(elm).up('.field-row'); 6296 if(container){ 6297 Element.insert(container, {after: advice}); 6298 } else if (elm.up('td.value')) { 6299 elm.up('td.value').insert({bottom: advice}); 6300 } else if (elm.advaiceContainer && $(elm.advaiceContainer)) { 6301 $(elm.advaiceContainer).update(advice); 6302 } 6303 else { 6304 switch (elm.type.toLowerCase()) { 6305 case 'checkbox': 6306 case 'radio': 6307 var p = elm.parentNode; 6308 if(p) { 6309 Element.insert(p, {'bottom': advice}); 6310 } else { 6311 Element.insert(elm, {'after': advice}); 6312 } 6313 break; 6314 default: 6315 Element.insert(elm, {'after': advice}); 6316 } 6317 } 6318 }, 6319 showAdvice : function(elm, advice, adviceName){ 6320 if(!elm.advices){ 6321 elm.advices = new Hash(); 6322 } 6323 else{ 6324 elm.advices.each(function(pair){ 6325 if (!advice || pair.value.id != advice.id) { 6326 // hide non-current advice after delay 6327 this.hideAdvice(elm, pair.value); 6328 } 6329 }.bind(this)); 6330 } 6331 elm.advices.set(adviceName, advice); 6332 if(typeof Effect == 'undefined') { 6333 advice.style.display = 'block'; 6334 } else { 6335 if(!advice._adviceAbsolutize) { 6336 new Effect.Appear(advice, {duration : 1 }); 6337 } else { 6338 Position.absolutize(advice); 6339 advice.show(); 6340 advice.setStyle({ 6341 'top':advice._adviceTop, 6342 'left': advice._adviceLeft, 6343 'width': advice._adviceWidth, 6344 'z-index': 1000 6345 }); 6346 advice.addClassName('advice-absolute'); 6347 } 6348 } 6349 }, 6350 hideAdvice : function(elm, advice){ 6351 if (advice != null) { 6352 new Effect.Fade(advice, {duration : 1, afterFinishInternal : function() {advice.hide();}}); 6353 } 6354 }, 6355 updateCallback : function(elm, status) { 6356 if (typeof elm.callbackFunction != 'undefined') { 6357 eval(elm.callbackFunction+'(\''+elm.id+'\',\''+status+'\')'); 6358 } 6359 }, 6360 ajaxError : function(elm, errorMsg) { 6361 var name = 'validate-ajax'; 6362 var advice = Validation.getAdvice(name, elm); 6363 if (advice == null) { 6364 advice = this.createAdvice(name, elm, false, errorMsg); 6365 } 6366 this.showAdvice(elm, advice, 'validate-ajax'); 6367 this.updateCallback(elm, 'failed'); 6368 6369 elm.addClassName('validation-failed'); 6370 elm.addClassName('validate-ajax'); 6371 if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') { 6372 var container = elm.up(Validation.defaultOptions.containerClassName); 6373 if (container && this.allowContainerClassName(elm)) { 6374 container.removeClassName('validation-passed'); 6375 container.addClassName('validation-error'); 6376 } 6377 } 6378 }, 6379 allowContainerClassName: function (elm) { 6380 if (elm.type == 'radio' || elm.type == 'checkbox') { 6381 return elm.hasClassName('change-container-classname'); 6382 } 6383 6384 return true; 6385 }, 6386 test : function(name, elm, useTitle) { 6387 var v = Validation.get(name); 6388 var prop = '__advice'+name.camelize(); 6389 try { 6390 if(Validation.isVisible(elm) && !v.test($F(elm), elm)) { 6391 //if(!elm[prop]) { 6392 var advice = Validation.getAdvice(name, elm); 6393 if (advice == null) { 6394 advice = this.createAdvice(name, elm, useTitle); 6395 } 6396 this.showAdvice(elm, advice, name); 6397 this.updateCallback(elm, 'failed'); 6398 //} 6399 elm[prop] = 1; 6400 if (!elm.advaiceContainer) { 6401 elm.removeClassName('validation-passed'); 6402 elm.addClassName('validation-failed'); 6403 } 6404 6405 if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') { 6406 var container = elm.up(Validation.defaultOptions.containerClassName); 6407 if (container && this.allowContainerClassName(elm)) { 6408 container.removeClassName('validation-passed'); 6409 container.addClassName('validation-error'); 6410 } 6411 } 6412 return false;
6413 } else { 6414 var advice = Validation.getAdvice(name, elm); 6415 this.hideAdvice(elm, advice); 6416 this.updateCallback(elm, 'passed'); 6417 elm[prop] = ''; 6418 elm.removeClassName('validation-failed'); 6419 elm.addClassName('validation-passed'); 6420 if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') { 6421 var container = elm.up(Validation.defaultOptions.containerClassName); 6422 if (container && !container.down('.validation-failed') && this.allowContainerClassName(elm)) { 6423 if (!Validation.get('IsEmpty').test(elm.value) || !this.isVisible(elm)) { 6424 container.addClassName('validation-passed'); 6425 } else { 6426 container.removeClassName('validation-passed'); 6427 } 6428 container.removeClassName('validation-error'); 6429 } 6430 } 6431 return true; 6432 } 6433 } catch(e) { 6434 throw(e) 6435 } 6436 }, 6437 isVisible : function(elm) { 6438 while(elm.tagName != 'BODY') { 6439 if(!$(elm).visible()) return false; 6440 elm = elm.parentNode; 6441 } 6442 return true; 6443 }, 6444 getAdvice : function(name, elm) { 6445 return $('advice-' + name + '-' + Validation.getElmID(elm)) || $('advice-' + Validation.getElmID(elm)); 6446 }, 6447 createAdvice : function(name, elm, useTitle, customError) { 6448 var v = Validation.get(name); 6449 var errorMsg = useTitle ? ((elm && elm.title) ? elm.title : v.error) : v.error; 6450 if (customError) { 6451 errorMsg = customError; 6452 } 6453 try { 6454 if (Translator){ 6455 errorMsg = Translator.translate(errorMsg); 6456 } 6457 } 6458 catch(e){} 6459 6460 advice = '<div class="validation-advice" id="advice-' + name + '-' + Validation.getElmID(elm) +'" style="display:none">' + errorMsg + '</div>' 6461 6462 6463 Validation.insertAdvice(elm, advice); 6464 advice = Validation.getAdvice(name, elm); 6465 if($(elm).hasClassName('absolute-advice')) { 6466 var dimensions = $(elm).getDimensions(); 6467 var originalPosition = Position.cumulativeOffset(elm); 6468 6469 advice._adviceTop = (originalPosition[1] + dimensions.height) + 'px'; 6470 advice._adviceLeft = (originalPosition[0]) + 'px'; 6471 advice._adviceWidth = (dimensions.width) + 'px'; 6472 advice._adviceAbsolutize = true; 6473 } 6474 return advice; 6475 }, 6476 getElmID : function(elm) { 6477 return elm.id ? elm.id : elm.name; 6478 }, 6479 reset : function(elm) { 6480 elm = $(elm); 6481 var cn = $w(elm.className); 6482 cn.each(function(value) { 6483 var prop = '__advice'+value.camelize(); 6484 if(elm[prop]) { 6485 var advice = Validation.getAdvice(value, elm); 6486 if (advice) { 6487 advice.hide(); 6488 } 6489 elm[prop] = ''; 6490 } 6491 elm.removeClassName('validation-failed'); 6492 elm.removeClassName('validation-passed'); 6493 if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') { 6494 var container = elm.up(Validation.defaultOptions.containerClassName); 6495 if (container) { 6496 container.removeClassName('validation-passed'); 6497 container.removeClassName('validation-error'); 6498 } 6499 } 6500 }); 6501 }, 6502 add : function(className, error, test, options) { 6503 var nv = {}; 6504 nv[className] = new Validator(className, error, test, options); 6505 Object.extend(Validation.methods, nv); 6506 }, 6507 addAllThese : function(validators) { 6508 var nv = {}; 6509 $A(validators).each(function(value) { 6510 nv[value[0]] = new Validator(value[0], value[1], value[2], (value.length > 3 ? value[3] : {})); 6511 }); 6512 Object.extend(Validation.methods, nv); 6513 }, 6514 get : function(name) { 6515 return Validation.methods[name] ? Validation.methods[name] : Validation.methods['_LikeNoIDIEverSaw_']; 6516 }, 6517 methods : { 6518 '_LikeNoIDIEverSaw_' : new Validator('_LikeNoIDIEverSaw_','',{}) 6519 } 6520}); 6521 6522Validation.add('IsEmpty', '', function(v) { 6523 return (v == '' || (v == null) || (v.length == 0) || /^\s+$/.test(v)); 6524}); 6525 6526Validation.addAllThese([ 6527 ['validate-no-html-tags', 'HTML tags are not allowed', function(v) { 6528 return !/<(\/)?\w+/.test(v); 6529 }], 6530 ['validate-select', 'Please select an option.', function(v) { 6531 return ((v != "none") && (v != null) && (v.length != 0)); 6532 }], 6533 ['required-entry', 'This is a required field.', function(v) { 6534 return !Validation.get('IsEmpty').test(v); 6535 }], 6536 ['validate-number', 'Please enter a valid number in this field.', function(v) { 6537 return Validation.get('IsEmpty').test(v) 6538 || (!isNaN(parseNumber(v)) && /^\s*-?\d*(\.\d*)?\s*$/.test(v)); 6539 }], 6540 ['validate-number-range', 'The value is not within the specified range.', function(v, elm) { 6541 if (Validation.get('IsEmpty').test(v)) { 6542 return true; 6543 } 6544 6545 var numValue = parseNumber(v); 6546 if (isNaN(numValue)) { 6547 return false;
6548 } 6549 6550 var reRange = /^number-range-(-?[\d.,]+)?-(-?[\d.,]+)?$/, 6551 result = true; 6552 6553 $w(elm.className).each(function(name) { 6554 var m = reRange.exec(name); 6555 if (m) { 6556 result = result 6557 && (m[1] == null || m[1] == '' || numValue >= parseNumber(m[1])) 6558 && (m[2] == null || m[2] == '' || numValue <= parseNumber(m[2])); 6559 } 6560 }); 6561 6562 return result; 6563 }], 6564 ['validate-digits', 'Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.', function(v) { 6565 return Validation.get('IsEmpty').test(v) || !/[^\d]/.test(v); 6566 }], 6567 ['validate-digits-range', 'The value is not within the specified range.', function(v, elm) { 6568 if (Validation.get('IsEmpty').test(v)) { 6569 return true; 6570 } 6571 6572 var numValue = parseNumber(v); 6573 if (isNaN(numValue)) { 6574 return false; 6575 } 6576 6577 var reRange = /^digits-range-(-?\d+)?-(-?\d+)?$/, 6578 result = true; 6579 6580 $w(elm.className).each(function(name) { 6581 var m = reRange.exec(name); 6582 if (m) { 6583 result = result 6584 && (m[1] == null || m[1] == '' || numValue >= parseNumber(m[1])) 6585 && (m[2] == null || m[2] == '' || numValue <= parseNumber(m[2])); 6586 } 6587 }); 6588 6589 return result; 6590 }], 6591 ['validate-alpha', 'Please use letters only (a-z or A-Z) in this field.', function (v) { 6592 return Validation.get('IsEmpty').test(v) || /^[a-zA-Z]+$/.test(v) 6593 }], 6594 ['validate-code', 'Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.', function (v) { 6595 return Validation.get('IsEmpty').test(v) || /^[a-z]+[a-z0-9_]+$/.test(v) 6596 }], 6597 ['validate-code-event', 'Please do not use "event" for an attribute code.', function (v) { 6598 return Validation.get('IsEmpty').test(v) || !/^(event)$/.test(v) 6599 }], 6600 ['validate-alphanum', 'Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.', function(v) { 6601 return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9]+$/.test(v) 6602 }], 6603 ['validate-alphanum-with-spaces', 'Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.', function(v) { 6604 return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9 ]+$/.test(v) 6605 }], 6606 ['validate-street', 'Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.', function(v) { 6607 return Validation.get('IsEmpty').test(v) || /^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(v) 6608 }], 6609 ['validate-phoneStrict', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) { 6610 return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v); 6611 }], 6612 ['validate-phoneLax', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) { 6613 return Validation.get('IsEmpty').test(v) || /^((\d[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(v); 6614 }], 6615 ['validate-fax', 'Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.', function(v) { 6616 return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v); 6617 }], 6618 ['validate-date', 'Please enter a valid date.', function(v) { 6619 var test = new Date(v); 6620 return Validation.get('IsEmpty').test(v) || !isNaN(test); 6621 }], 6622 ['validate-date-range', 'The From Date value should be less than or equal to the To Date value.', function(v, elm) { 6623 var m = /\bdate-range-(\w+)-(\w+)\b/.exec(elm.className); 6624 if (!m || m[2] == 'to' || Validation.get('IsEmpty').test(v)) { 6625 return true; 6626 } 6627 6628 var currentYear = new Date().getFullYear() + ''; 6629 var normalizedTime = function(v) { 6630 v = v.split(/[.\/]/); 6631 if (v[2] && v[2].length < 4) { 6632 v[2] = currentYear.substr(0, v[2].length) + v[2]; 6633 } 6634 return new Date(v.join('/')).getTime(); 6635 }; 6636 6637 var dependentElements = Element.select(elm.form, '.validate-date-range.date-range-' + m[1] + '-to'); 6638 return !dependentElements.length || Validation.get('IsEmpty').test(dependentElements[0].value) 6639 || normalizedTime(v) <= normalizedTime(dependentElements[0].value); 6640 }], 6641 ['validate-email', 'Please enter a valid email address. For example [email protected].', function (v) { 6642 //return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v) 6643 //return Validation.get('IsEmpty').test(v) || /^[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9][\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9\.]{1,30}[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9]@([a-z0-9_-]{1,30}\.){1,5}[a-z]{2,4}$/i.test(v) 6644 return Validation.get('IsEmpty').test(v) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(v) 6645 }], 6646 ['validate-emailSender', 'Please use only visible characters and spaces.', function (v) { 6647 return Validation.get('IsEmpty').test(v) || /^[\S ]+$/.test(v) 6648 }], 6649 ['validate-password', 'Please enter more characters or clean leading or trailing space
6649s.', function(v, elm) { 6650 var pass=v.strip(); /*strip leading and trailing spaces*/ 6651 var reMin = new RegExp(/^min-pass-length-[0-9]+$/); 6652 var minLength = 7; 6653 $w(elm.className).each(function(name, index) { 6654 if (name.match(reMin)) { 6655 minLength = name.split('-')[3]; 6656 } 6657 }); 6658 return (!(v.length > 0 && v.length < minLength) && v.length == pass.length); 6659 }], 6660 ['validate-admin-password', 'Please enter more characters. Password should contain both numeric and alphabetic characters.', function(v, elm) { 6661 var pass=v.strip(); 6662 if (0 == pass.length) { 6663 return true; 6664 } 6665 if (!(/[a-z]/i.test(v)) || !(/[0-9]/.test(v))) { 6666 return false; 6667 } 6668 var reMin = new RegExp(/^min-admin-pass-length-[0-9]+$/); 6669 var minLength = 7; 6670 $w(elm.className).each(function(name, index) { 6671 if (name.match(reMin)) { 6672 minLength = name.split('-')[4]; 6673 } 6674 }); 6675 return !(pass.length < minLength); 6676 }], 6677 ['validate-cpassword', 'Please make sure your passwords match.', function(v) { 6678 var conf = $('confirmation') ? $('confirmation') : $$('.validate-cpassword')[0]; 6679 var pass = false; 6680 if ($('password')) { 6681 pass = $('password'); 6682 } 6683 var passwordElements = $$('.validate-password'); 6684 for (var i = 0; i < passwordElements.size(); i++) { 6685 var passwordElement = passwordElements[i]; 6686 if (passwordElement.up('form').id == conf.up('form').id) { 6687 pass = passwordElement; 6688 } 6689 } 6690 if ($$('.validate-admin-password').size()) { 6691 pass = $$('.validate-admin-password')[0]; 6692 } 6693 return (pass.value == conf.value); 6694 }], 6695 ['validate-both-passwords', 'Please make sure your passwords match.', function(v, input) { 6696 var dependentInput = $(input.form[input.name == 'password' ? 'confirmation' : 'password']), 6697 isEqualValues = input.value == dependentInput.value; 6698 6699 if (isEqualValues && dependentInput.hasClassName('validation-failed')) { 6700 Validation.test(this.className, dependentInput); 6701 } 6702 6703 return dependentInput.value == '' || isEqualValues; 6704 }], 6705 ['validate-url', 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)', function (v) { 6706 v = (v || '').replace(/^\s+/, '').replace(/\s+$/, ''); 6707 return Validation.get('IsEmpty').test(v) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(v) 6708 }], 6709 ['validate-clean-url', 'Please enter a valid URL. For example http://www.example.com or www.example.com', function (v) { 6710 return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v) || /^(www)((\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v) 6711 }], 6712 ['validate-identifier', 'Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page".', function (v) { 6713 return Validation.get('IsEmpty').test(v) || /^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/.test(v) 6714 }], 6715 ['validate-xml-identifier', 'Please enter a valid XML-identifier. For example something_1, block5, id-4.', function (v) { 6716 return Validation.get('IsEmpty').test(v) || /^[A-Z][A-Z0-9_\/-]*$/i.test(v) 6717 }], 6718 ['validate-ssn', 'Please enter a valid social security number. For example 123-45-6789.', function(v) { 6719 return Validation.get('IsEmpty').test(v) || /^\d{3}-?\d{2}-?\d{4}$/.test(v); 6720 }], 6721 ['validate-zip', 'Please enter a valid zip code. For example 90602 or 90602-1234.', function(v) { 6722 return Validation.get('IsEmpty').test(v) || /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(v); 6723 }], 6724 ['validate-zip-international', 'Please enter a valid zip code.', function(v) { 6725 //return Validation.get('IsEmpty').test(v) || /(^[A-z0-9]{2,10}([\s]{0,1}|[\-]{0,1})[A-z0-9]{2,10}$)/.test(v); 6726 return true; 6727 }], 6728 ['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.', function(v) { 6729 if(Validation.get('IsEmpty').test(v)) return true; 6730 var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/; 6731 if(!regex.test(v)) return false;
6732 var d = new Date(v.replace(regex, '$2/$1/$3')); 6733 return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) && 6734 (parseInt(RegExp.$1, 10) == d.getDate()) && 6735 (parseInt(RegExp.$3, 10) == d.getFullYear() ); 6736 }], 6737 ['validate-currency-dollar', 'Please enter a valid $ amount. For example $100.00.', function(v) { 6738 // [$]1[##][,###]+[.##] 6739 // [$]1###+[.##] 6740 // [$]0.## 6741 // [$].## 6742 return Validation.get('IsEmpty').test(v) || /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v) 6743 }], 6744 ['validate-one-required', 'Please select one of the above options.', function (v,elm) { 6745 var p = elm.parentNode; 6746 var options = p.getElementsByTagName('INPUT'); 6747 return $A(options).any(function(elm) { 6748 return $F(elm); 6749 }); 6750 }], 6751 ['validate-one-required-by-name', 'Please select one of the options.', function (v,elm) { 6752 var inputs = $$('input[name="' + elm.name.replace(/([\\"])/g, '\\$1') + '"]'); 6753 6754 var error = 1; 6755 for(var i=0;i<inputs.length;i++) { 6756 if((inputs[i].type == 'checkbox' || inputs[i].type == 'radio') && inputs[i].checked == true) { 6757 error = 0; 6758 } 6759 6760 if(Validation.isOnChange && (inputs[i].type == 'checkbox' || inputs[i].type == 'radio')) { 6761 Validation.reset(inputs[i]); 6762 } 6763 } 6764 6765 if( error == 0 ) { 6766 return true; 6767 } else { 6768 return false; 6769 } 6770 }], 6771 ['validate-not-negative-number', 'Please enter a number 0 or greater in this field.', function(v) { 6772 if (Validation.get('IsEmpty').test(v)) { 6773 return true; 6774 } 6775 v = parseNumber(v); 6776 return !isNaN(v) && v >= 0; 6777 }], 6778 ['validate-zero-or-greater', 'Please enter a number 0 or greater in this field.', function(v) { 6779 return Validation.get('validate-not-negative-number').test(v); 6780 }], 6781 ['validate-greater-than-zero', 'Please enter a number greater than 0 in this field.', function(v) { 6782 if (Validation.get('IsEmpty').test(v)) { 6783 return true; 6784 } 6785 v = parseNumber(v); 6786 return !isNaN(v) && v > 0; 6787 }], 6788 6789 ['validate-special-price', 'The Special Price is active only when lower than the Actual Price.', function(v) { 6790 var priceInput = $('price'); 6791 var priceType = $('price_type'); 6792 var priceValue = parseFloat(v); 6793 6794 // Passed on non-related validators conditions (to not change order of validation) 6795 if( 6796 !priceInput 6797 || Validation.get('IsEmpty').test(v) 6798 || !Validation.get('validate-number').test(v) 6799 ) { 6800 return true; 6801 } 6802 if(priceType) { 6803 return (priceType && priceValue <= 99.99); 6804 } 6805 return priceValue < parseFloat($F(priceInput)); 6806 }], 6807 ['validate-state', 'Please select State/Province.', function(v) { 6808 return (v!=0 || v == ''); 6809 }], 6810 ['validate-new-password', 'Please enter more characters or clean leading or trailing spaces.', function(v, elm) { 6811 if (!Validation.get('validate-password').test(v, elm)) return false; 6812 if (Validation.get('IsEmpty').test(v) && v != '') return false; 6813 return true; 6814 }], 6815 ['validate-cc-number', 'Please enter a valid credit card number.', function(v, elm) { 6816 // remove non-numerics 6817 var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type'); 6818 if (ccTypeContainer && typeof Validation.creditCartTypes.get(ccTypeContainer.value) != 'undefined' 6819 && Validation.creditCartTypes.get(ccTypeContainer.value)[2] == false) { 6820 if (!Validation.get('IsEmpty').test(v) && Validation.get('validate-digits').test(v)) { 6821 return true; 6822 } else { 6823 return false;
6824 } 6825 } 6826 return validateCreditCard(v); 6827 }], 6828 ['validate-cc-type', 'Credit card number does not match credit card type.', function(v, elm) { 6829 // remove credit card number delimiters such as "-" and space 6830 elm.value = removeDelimiters(elm.value); 6831 v = removeDelimiters(v); 6832 6833 var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type'); 6834 if (!ccTypeContainer) { 6835 return true; 6836 } 6837 var ccType = ccTypeContainer.value; 6838 6839 if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') { 6840 return false; 6841 } 6842 6843 // Other card type or switch or solo card 6844 if (Validation.creditCartTypes.get(ccType)[0]==false) { 6845 return true; 6846 } 6847 6848 var validationFailure = false; 6849 Validation.creditCartTypes.each(function (pair) { 6850 if (pair.key == ccType) { 6851 if (pair.value[0] && !v.match(pair.value[0])) { 6852 validationFailure = true; 6853 } 6854 throw $break; 6855 } 6856 }); 6857 6858 if (validationFailure) { 6859 return false; 6860 } 6861 6862 if (ccTypeContainer.hasClassName('validation-failed') && Validation.isOnChange) { 6863 Validation.validate(ccTypeContainer); 6864 } 6865 6866 return true; 6867 }], 6868 ['validate-cc-type-select', 'Card type does not match credit card number.', function(v, elm) { 6869 var ccNumberContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_type')) + '_cc_number'); 6870 if (Validation.isOnChange && Validation.get('IsEmpty').test(ccNumberContainer.value)) { 6871 return true; 6872 } 6873 if (Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer)) { 6874 Validation.validate(ccNumberContainer); 6875 } 6876 return Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer); 6877 }], 6878 ['validate-cc-exp', 'Incorrect credit card expiration date.', function(v, elm) { 6879 var ccExpMonth = v; 6880 var ccExpYear = $(elm.id.substr(0,elm.id.indexOf('_expiration')) + '_expiration_yr').value; 6881 var currentTime = new Date(); 6882 var currentMonth = currentTime.getMonth() + 1; 6883 var currentYear = currentTime.getFullYear(); 6884 if (ccExpMonth < currentMonth && ccExpYear == currentYear) { 6885 return false; 6886 } 6887 return true; 6888 }], 6889 ['validate-cc-cvn', 'Please enter a valid credit card verification number.', function(v, elm) { 6890 var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_cid')) + '_cc_type'); 6891 if (!ccTypeContainer) { 6892 return true; 6893 } 6894 var ccType = ccTypeContainer.value; 6895 6896 if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') { 6897 return false; 6898 } 6899 6900 var re = Validation.creditCartTypes.get(ccType)[1]; 6901 6902 if (v.match(re)) { 6903 return true; 6904 } 6905 6906 return false; 6907 }], 6908 ['validate-ajax', '', function(v, elm) { return true; }], 6909 ['validate-data', 'Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.', function (v) { 6910 if(v != '' && v) { 6911 return /^[A-Za-z]+[A-Za-z0-9_]+$/.test(v); 6912 } 6913 return true; 6914 }], 6915 ['validate-css-length', 'Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%.', function (v) { 6916 if (v != '' && v) { 6917 return /^[0-9\.]+(px|pt|em|ex|%)?$/.test(v) && (!(/\..*\./.test(v))) && !(/\.$/.test(v)); 6918 } 6919 return true; 6920 }], 6921 ['validate-length', 'Text length does not satisfy specified text range.', function (v, elm) { 6922 var reMax = new RegExp(/^maximum-length-[0-9]+$/); 6923 var reMin = new RegExp(/^minimum-length-[0-9]+$/); 6924 var result = true; 6925 $w(elm.className).each(function(name, index) { 6926 if (name.match(reMax) && result) { 6927 var length = name.split('-')[2]; 6928 result = (v.length <= length); 6929 } 6930 if (name.match(reMin) && result && !Validation.get('IsEmpty').test(v)) { 6931 var length = name.split('-')[2]; 6932 result = (v.length >= length); 6933 } 6934 }); 6935 return result; 6936 }], 6937 ['validate-percents', 'Please enter a number lower than 100.', {max:100}], 6938 ['required-file', 'Please select a file', function(v, elm) { 6939 var result = !Validation.get('IsEmpty').test(v); 6940 if (result === false) { 6941 ovId = elm.id + '_value'; 6942 if ($(ovId)) { 6943 result = !Validation.get('IsEmpty').test($(ovId).value); 6944 } 6945 } 6946 return result; 6947 }], 6948 ['validate-cc-ukss', 'Please enter issue number or start date for switch/solo card type.', function(v,elm) { 6949 var endposition; 6950 6951 if (elm.id.match(/(.)+_cc_issue$/)) { 6952 endposition = elm.id.indexOf('_cc_issue'); 6953 } else if (elm.id.match(/(.)+_start_month$/)) { 6954 endposition = elm.id.indexOf('_start_month'); 6955 } else { 6956 endposition = elm.id.indexOf('_start_year'); 6957 } 6958 6959 var prefix = elm.id.substr(0,endposition); 6960 6961 var ccTypeContainer = $(prefix + '_cc_type'); 6962 6963 if (!ccTypeContainer) { 6964 return true; 6965 } 6966 var ccType = ccTypeContainer.value; 6967 6968 if(['SS','SM','SO'].indexOf(ccType) == -1){ 6969 return true; 6970 } 6971 6972 $(prefix + '_cc_issue').advaiceContainer 6973 = $(prefix + '_start_month').advaiceContainer 6974 = $(prefix + '_start_year').advaiceContainer 6975 = $(prefix + '_cc_type_ss_div').down('ul li.adv-container'); 6976 6977 var ccIssue = $(prefix + '_cc_issue').value; 6978 var ccSMonth = $(prefix + '_start_month').value; 6979 var ccSYear = $(prefix + '_start_year').value; 6980 6981 var ccStartDatePresent = (ccSMonth && ccSYear) ? true : false;
6982 6983 if (!ccStartDatePresent && !ccIssue){ 6984 return false; 6985 } 6986 return true; 6987 }] 6988]); 6989 6990function removeDelimiters (v) { 6991 v = v.replace(/\s/g, ''); 6992 v = v.replace(/\-/g, ''); 6993 return v; 6994} 6995 6996function parseNumber(v) 6997{ 6998 if (typeof v != 'string') { 6999 return parseFloat(v); 7000 } 7001 7002 var isDot = v.indexOf('.'); 7003 var isComa = v.indexOf(','); 7004 7005 if (isDot != -1 && isComa != -1) { 7006 if (isComa > isDot) { 7007 v = v.replace('.', '').replace(',', '.'); 7008 } 7009 else { 7010 v = v.replace(',', ''); 7011 } 7012 } 7013 else if (isComa != -1) { 7014 v = v.replace(',', '.'); 7015 } 7016 7017 return parseFloat(v); 7018} 7019 7020/** 7021 * Hash with credit card types which can be simply extended in payment modules 7022 * 0 - regexp for card number 7023 * 1 - regexp for cvn 7024 * 2 - check or not credit card number trough Luhn algorithm by 7025 * function validateCreditCard which you can find above in this file 7026 */ 7027Validation.creditCartTypes = $H({ 7028// 'SS': [new RegExp('^((6759[0-9]{12})|(5018|5020|5038|6304|6759|6761|6763[0-9]{12,19})|(49[013][1356][0-9]{12})|(6333[0-9]{12})|(6334[0-4]\d{11})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true], 7029 'SO': [new RegExp('^(6334[5-9]([0-9]{11}|[0-9]{13,14}))|(6767([0-9]{12}|[0-9]{14,15}))$'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true], 7030 'VI': [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true], 7031 'MC': [new RegExp('^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$'), new RegExp('^[0-9]{3}$'), true], 7032 'AE': [new RegExp('^3[47][0-9]{13}$'), new RegExp('^[0-9]{4}$'), true], 7033 'DI': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), new RegExp('^[0-9]{3}$'), true], 7034 'JCB': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), new RegExp('^[0-9]{3,4}$'), true], 7035 'DICL': [new RegExp('^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}|5[0-9]{14}))$'), new RegExp('^[0-9]{3}$'), true], 7036 'SM': [new RegExp('(^(5[0678])[0-9]{11,18}$)|(^(6[^05])[0-9]{11,18}$)|(^(601)[^1][0-9]{9,16}$)|(^(6011)[0-9]{9,11}$)|(^(6011)[0-9]{13,16}$)|(^(65)[0-9]{11,13}$)|(^(65)[0-9]{15,18}$)|(^(49030)[2-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49033)[5-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49110)[1-2]([0-9]{10}$|[0-9]{12,13}$))|(^(49117)[4-9]([0-9]{10}$|[0-9]{12,13}$))|(^(49118)[0-2]([0-9]{10}$|[0-9]{12,13}$))|(^(4936)([0-9]{12}$|[0-9]{14,15}$))'), new RegExp('^([0-9]{3}|[0-9]{4})?$'), true], 7037 'OT': [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false] 7038}); 7039 7040// script.aculo.us builder.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 7041 7042// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 7043// 7044// script.aculo.us is freely distributable under the terms of an MIT-style license. 7045// For details, see the script.aculo.us web site: http://script.aculo.us/ 7046 7047var Builder = { 7048 NODEMAP: { 7049 AREA: 'map', 7050 CAPTION: 'table', 7051 COL: 'table', 7052 COLGROUP: 'table', 7053 LEGEND: 'fieldset', 7054 OPTGROUP: 'select', 7055 OPTION: 'select', 7056 PARAM: 'object', 7057 TBODY: 'table', 7058 TD: 'table', 7059 TFOOT: 'table', 7060 TH: 'table', 7061 THEAD: 'table', 7062 TR: 'table' 7063 }, 7064 // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, 7065 // due to a Firefox bug 7066 node: function(elementName) { 7067 elementName = elementName.toUpperCase(); 7068 7069 // try innerHTML approach 7070 var parentTag = this.NODEMAP[elementName] || 'div'; 7071 var parentElement = document.createElement(parentTag); 7072 try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 7073 parentElement.innerHTML = "<" + elementName + "></" + elementName + ">"; 7074 } catch(e) {} 7075 var element = parentElement.firstChild || null; 7076 7077 // see if browser added wrapping tags 7078 if(element && (element.tagName.toUpperCase() != elementName)) 7079 element = element.getElementsByTagName(elementName)[0]; 7080 7081 // fallback to createElement approach 7082 if(!element) element = document.createElement(elementName); 7083 7084 // abort if nothing could be created 7085 if(!element) return; 7086 7087 // attributes (or text) 7088 if(arguments[1]) 7089 if(this._isStringOrNumber(arguments[1]) || 7090 (arguments[1] instanceof Array) || 7091 arguments[1].tagName) { 7092 this._children(element, arguments[1]); 7093 } else { 7094 var attrs = this._attributes(arguments[1]); 7095 if(attrs.length) { 7096 try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 7097 parentElement.innerHTML = "<" +elementName + " " + 7098 attrs + "></" + elementName + ">"; 7099 } catch(e) {} 7100 element = parentElement.firstChild || null; 7101 // workaround firefox 1.0.X bug 7102 if(!element) { 7103 element = document.createElement(elementName); 7104 for(attr in arguments[1]) 7105 element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; 7106 } 7107 if(element.tagName.toUpperCase() != elementName) 7108 element = parentElement.getElementsByTagName(elementName)[0]; 7109 } 7110 } 7111 7112 // text, or array of children 7113 if(arguments[2]) 7114 this._children(element, arguments[2]); 7115 7116 return $(element); 7117 }, 7118 _text: function(text) { 7119 return document.createTextNode(text); 7120 }, 7121 7122 ATTR_MAP: { 7123 'className': 'class', 7124 'htmlFor': 'for' 7125 }, 7126 7127 _attributes: function(attributes) { 7128 var attrs = []; 7129 for(attribute in attributes) 7130 attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + 7131 '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'"') + '"'); 7132 return attrs.join(" "); 7133 }, 7134 _children: function(element, children) { 7135 if(children.tagName) { 7136 element.appendChild(children); 7137 return; 7138 } 7139 if(typeof children=='object') { // array can hold nodes and text 7140 children.flatten().each( function(e) { 7141 if(typeof e=='object') 7142 element.appendChild(e); 7143 else 7144 if(Builder._isStringOrNumber(e)) 7145 element.appendChild(Builder._text(e)); 7146 }); 7147 } else 7148 if(Builder._isStringOrNumber(children)) 7149 element.appendChild(Builder._text(children)); 7150 }, 7151 _isStringOrNumber: function(param) {
7152 return(typeof param=='string' || typeof param=='number'); 7153 }, 7154 build: function(html) { 7155 var element = this.node('div'); 7156 $(element).update(html.strip()); 7157 return element.down(); 7158 }, 7159 dump: function(scope) { 7160 if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope 7161 7162 var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + 7163 "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + 7164 "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ 7165 "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ 7166 "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ 7167 "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); 7168 7169 tags.each( function(tag){ 7170 scope[tag] = function() { 7171 return Builder.node.apply(Builder, [tag].concat($A(arguments))); 7172 }; 7173 }); 7174 } 7175}; 7176// script.aculo.us effects.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 7177 7178// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 7179// Contributors: 7180// Justin Palmer (http://encytemedia.com/) 7181// Mark Pilgrim (http://diveintomark.org/) 7182// Martin Bialasinki 7183// 7184// script.aculo.us is freely distributable under the terms of an MIT-style license. 7185// For details, see the script.aculo.us web site: http://script.aculo.us/ 7186 7187// converts rgb() and #xxx to #xxxxxx format, 7188// returns self (or first argument) if not convertable 7189String.prototype.parseColor = function() { 7190 var color = '#'; 7191 if (this.slice(0,4) == 'rgb(') { 7192 var cols = this.slice(4,this.length-1).split(','); 7193 var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); 7194 } else { 7195 if (this.slice(0,1) == '#') { 7196 if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); 7197 if (this.length==7) color = this.toLowerCase(); 7198 } 7199 } 7200 return (color.length==7 ? color : (arguments[0] || this)); 7201}; 7202 7203/*--------------------------------------------------------------------------*/ 7204 7205Element.collectTextNodes = function(element) { 7206 return $A($(element).childNodes).collect( function(node) { 7207 return (node.nodeType==3 ? node.nodeValue : 7208 (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); 7209 }).flatten().join(''); 7210}; 7211 7212Element.collectTextNodesIgnoreClass = function(element, className) { 7213 return $A($(element).childNodes).collect( function(node) { 7214 return (node.nodeType==3 ? node.nodeValue : 7215 ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 7216 Element.collectTextNodesIgnoreClass(node, className) : '')); 7217 }).flatten().join(''); 7218}; 7219 7220Element.setContentZoom = function(element, percent) { 7221 element = $(element); 7222 element.setStyle({fontSize: (percent/100) + 'em'}); 7223 if (Prototype.Browser.WebKit) window.scrollBy(0,0); 7224 return element; 7225}; 7226 7227Element.getInlineOpacity = function(element){ 7228 return $(element).style.opacity || ''; 7229}; 7230 7231Element.forceRerendering = function(element) { 7232 try { 7233 element = $(element); 7234 var n = document.createTextNode(' '); 7235 element.appendChild(n); 7236 element.removeChild(n); 7237 } catch(e) { } 7238}; 7239 7240/*--------------------------------------------------------------------------*/ 7241 7242var Effect = { 7243 _elementDoesNotExistError: { 7244 name: 'ElementDoesNotExistError', 7245 message: 'The specified DOM element does not exist, but is required for this effect to operate' 7246 }, 7247 Transitions: { 7248 linear: Prototype.K, 7249 sinoidal: function(pos) { 7250 return (-Math.cos(pos*Math.PI)/2) + .5; 7251 }, 7252 reverse: function(pos) { 7253 return 1-pos; 7254 }, 7255 flicker: function(pos) { 7256 var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4; 7257 return pos > 1 ? 1 : pos; 7258 }, 7259 wobble: function(pos) { 7260 return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5; 7261 }, 7262 pulse: function(pos, pulses) { 7263 return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5; 7264 }, 7265 spring: function(pos) { 7266 return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); 7267 }, 7268 none: function(pos) { 7269 return 0; 7270 }, 7271 full: function(pos) { 7272 return 1; 7273 } 7274 }, 7275 DefaultOptions: { 7276 duration: 1.0, // seconds 7277 fps: 100, // 100= assume 66fps max. 7278 sync: false, // true for combining 7279 from: 0.0, 7280 to: 1.0, 7281 delay: 0.0, 7282 queue: 'parallel' 7283 }, 7284 tagifyText: function(element) { 7285 var tagifyStyle = 'position:relative'; 7286 if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; 7287 7288 element = $(element); 7289 $A(element.childNodes).each( function(child) { 7290 if (child.nodeType==3) {
7291 child.nodeValue.toArray().each( function(character) { 7292 element.insertBefore( 7293 new Element('span', {style: tagifyStyle}).update( 7294 character == ' ' ? String.fromCharCode(160) : character), 7295 child); 7296 }); 7297 Element.remove(child); 7298 } 7299 }); 7300 }, 7301 multiple: function(element, effect) { 7302 var elements; 7303 if (((typeof element == 'object') || 7304 Object.isFunction(element)) && 7305 (element.length)) 7306 elements = element; 7307 else 7308 elements = $(element).childNodes; 7309 7310 var options = Object.extend({ 7311 speed: 0.1, 7312 delay: 0.0 7313 }, arguments[2] || { }); 7314 var masterDelay = options.delay; 7315 7316 $A(elements).each( function(element, index) { 7317 new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); 7318 }); 7319 }, 7320 PAIRS: { 7321 'slide': ['SlideDown','SlideUp'], 7322 'blind': ['BlindDown','BlindUp'], 7323 'appear': ['Appear','Fade'] 7324 }, 7325 toggle: function(element, effect) { 7326 element = $(element); 7327 effect = (effect || 'appear').toLowerCase(); 7328 var options = Object.extend({ 7329 queue: { position:'end', scope:(element.id || 'global'), limit: 1 } 7330 }, arguments[2] || { }); 7331 Effect[element.visible() ? 7332 Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); 7333 } 7334}; 7335 7336Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; 7337 7338/* ------------- core effects ------------- */ 7339 7340Effect.ScopedQueue = Class.create(Enumerable, { 7341 initialize: function() { 7342 this.effects = []; 7343 this.interval = null; 7344 }, 7345 _each: function(iterator) { 7346 this.effects._each(iterator); 7347 }, 7348 add: function(effect) { 7349 var timestamp = new Date().getTime(); 7350 7351 var position = Object.isString(effect.options.queue) ? 7352 effect.options.queue : effect.options.queue.position; 7353 7354 switch(position) { 7355 case 'front': 7356 // move unstarted effects after this effect 7357 this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { 7358 e.startOn += effect.finishOn; 7359 e.finishOn += effect.finishOn; 7360 }); 7361 break; 7362 case 'with-last': 7363 timestamp = this.effects.pluck('startOn').max() || timestamp; 7364 break; 7365 case 'end': 7366 // start effect after last queued effect has finished 7367 timestamp = this.effects.pluck('finishOn').max() || timestamp; 7368 break; 7369 } 7370 7371 effect.startOn += timestamp; 7372 effect.finishOn += timestamp; 7373 7374 if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) 7375 this.effects.push(effect); 7376 7377 if (!this.interval) 7378 this.interval = setInterval(this.loop.bind(this), 15); 7379 }, 7380 remove: function(effect) { 7381 this.effects = this.effects.reject(function(e) { return e==effect }); 7382 if (this.effects.length == 0) { 7383 clearInterval(this.interval); 7384 this.interval = null; 7385 } 7386 }, 7387 loop: function() { 7388 var timePos = new Date().getTime(); 7389 for(var i=0, len=this.effects.length;i<len;i++) 7390 this.effects[i] && this.effects[i].loop(timePos); 7391 } 7392}); 7393 7394Effect.Queues = { 7395 instances: $H(), 7396 get: function(queueName) { 7397 if (!Object.isString(queueName)) return queueName; 7398 7399 return this.instances.get(queueName) || 7400 this.instances.set(queueName, new Effect.ScopedQueue()); 7401 } 7402}; 7403Effect.Queue = Effect.Queues.get('global'); 7404 7405Effect.Base = Class.create({ 7406 position: null, 7407 start: function(options) { 7408 function codeForEvent(options,eventName){ 7409 return ( 7410 (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') + 7411 (options[eventName] ? 'this.options.'+eventName+'(this);' : '') 7412 ); 7413 } 7414 if (options && options.transition === false) options.transition = Effect.Transitions.linear; 7415 this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { }); 7416 this.currentFrame = 0; 7417 this.state = 'idle'; 7418 this.startOn = this.options.delay*1000; 7419 this.finishOn = this.startOn+(this.options.duration*1000); 7420 this.fromToDelta = this.options.to-this.options.from; 7421 this.totalTime = this.finishOn-this.startOn; 7422 this.totalFrames = this.options.fps*this.options.duration; 7423 7424 this.render = (function() { 7425 function dispatch(effect, eventName) { 7426 if (effect.options[eventName + 'Internal']) 7427 effect.options[eventName + 'Internal'](effect); 7428 if (effect.options[eventName]) 7429 effect.options[eventName](effect); 7430 } 7431 7432 return function(pos) {
7433 if (this.state === "idle") { 7434 this.state = "running"; 7435 dispatch(this, 'beforeSetup'); 7436 if (this.setup) this.setup(); 7437 dispatch(this, 'afterSetup'); 7438 } 7439 if (this.state === "running") { 7440 pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from; 7441 this.position = pos; 7442 dispatch(this, 'beforeUpdate'); 7443 if (this.update) this.update(pos); 7444 dispatch(this, 'afterUpdate'); 7445 } 7446 }; 7447 })(); 7448 7449 this.event('beforeStart'); 7450 if (!this.options.sync) 7451 Effect.Queues.get(Object.isString(this.options.queue) ? 7452 'global' : this.options.queue.scope).add(this); 7453 }, 7454 loop: function(timePos) { 7455 if (timePos >= this.startOn) { 7456 if (timePos >= this.finishOn) { 7457 this.render(1.0); 7458 this.cancel(); 7459 this.event('beforeFinish'); 7460 if (this.finish) this.finish(); 7461 this.event('afterFinish'); 7462 return; 7463 } 7464 var pos = (timePos - this.startOn) / this.totalTime, 7465 frame = (pos * this.totalFrames).round(); 7466 if (frame > this.currentFrame) { 7467 this.render(pos); 7468 this.currentFrame = frame; 7469 } 7470 } 7471 }, 7472 cancel: function() { 7473 if (!this.options.sync) 7474 Effect.Queues.get(Object.isString(this.options.queue) ? 7475 'global' : this.options.queue.scope).remove(this); 7476 this.state = 'finished'; 7477 }, 7478 event: function(eventName) { 7479 if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); 7480 if (this.options[eventName]) this.options[eventName](this); 7481 }, 7482 inspect: function() { 7483 var data = $H(); 7484 for(property in this) 7485 if (!Object.isFunction(this[property])) data.set(property, this[property]); 7486 return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>'; 7487 } 7488}); 7489 7490Effect.Parallel = Class.create(Effect.Base, { 7491 initialize: function(effects) { 7492 this.effects = effects || []; 7493 this.start(arguments[1]); 7494 }, 7495 update: function(position) { 7496 this.effects.invoke('render', position); 7497 }, 7498 finish: function(position) { 7499 this.effects.each( function(effect) { 7500 effect.render(1.0); 7501 effect.cancel(); 7502 effect.event('beforeFinish'); 7503 if (effect.finish) effect.finish(position); 7504 effect.event('afterFinish'); 7505 }); 7506 } 7507}); 7508 7509Effect.Tween = Class.create(Effect.Base, { 7510 initialize: function(object, from, to) { 7511 object = Object.isString(object) ? $(object) : object; 7512 var args = $A(arguments), method = args.last(), 7513 options = args.length == 5 ? args[3] : null; 7514 this.method = Object.isFunction(method) ? method.bind(object) : 7515 Object.isFunction(object[method]) ? object[method].bind(object) : 7516 function(value) { object[method] = value }; 7517 this.start(Object.extend({ from: from, to: to }, options || { })); 7518 }, 7519 update: function(position) { 7520 this.method(position); 7521 } 7522}); 7523 7524Effect.Event = Class.create(Effect.Base, { 7525 initialize: function() { 7526 this.start(Object.extend({ duration: 0 }, arguments[0] || { })); 7527 }, 7528 update: Prototype.emptyFunction 7529}); 7530 7531Effect.Opacity = Class.create(Effect.Base, { 7532 initialize: function(element) { 7533 this.element = $(element); 7534 if (!this.element) throw(Effect._elementDoesNotExistError); 7535 // make this work on IE on elements without 'layout' 7536 if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) 7537 this.element.setStyle({zoom: 1}); 7538 var options = Object.extend({ 7539 from: this.element.getOpacity() || 0.0, 7540 to: 1.0 7541 }, arguments[1] || { }); 7542 this.start(options); 7543 }, 7544 update: function(position) { 7545 this.element.setOpacity(position); 7546 } 7547}); 7548 7549Effect.Move = Class.create(Effect.Base, { 7550 initialize: function(element) { 7551 this.element = $(element); 7552 if (!this.element) throw(Effect._elementDoesNotExistError); 7553 var options = Object.extend({ 7554 x: 0, 7555 y: 0, 7556 mode: 'relative' 7557 }, arguments[1] || { }); 7558 this.start(options); 7559 }, 7560 setup: function() { 7561 this.element.makePositioned(); 7562 this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); 7563 this.originalTop = parseFloat(this.element.getStyle('top') || '0'); 7564 if (this.options.mode == 'absolute') { 7565 this.options.x = this.options.x - this.originalLeft; 7566 this.options.y = this.options.y - this.originalTop; 7567 } 7568 }, 7569 update: function(position) { 7570 this.element.setStyle({ 7571 left: (this.options.x * position + this.originalLeft).round() + 'px', 7572 top: (this.options.y * position + this.originalTop).round() + 'px' 7573 }); 7574 } 7575}); 7576 7577// for backwards compatibility 7578Effect.MoveBy = function(element, toTop, toLeft) { 7579 return new Effect.Move(element,
7580 Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); 7581}; 7582 7583Effect.Scale = Class.create(Effect.Base, { 7584 initialize: function(element, percent) { 7585 this.element = $(element); 7586 if (!this.element) throw(Effect._elementDoesNotExistError); 7587 var options = Object.extend({ 7588 scaleX: true, 7589 scaleY: true, 7590 scaleContent: true, 7591 scaleFromCenter: false, 7592 scaleMode: 'box', // 'box' or 'contents' or { } with provided values 7593 scaleFrom: 100.0, 7594 scaleTo: percent 7595 }, arguments[2] || { }); 7596 this.start(options); 7597 }, 7598 setup: function() { 7599 this.restoreAfterFinish = this.options.restoreAfterFinish || false; 7600 this.elementPositioning = this.element.getStyle('position'); 7601 7602 this.originalStyle = { }; 7603 ['top','left','width','height','fontSize'].each( function(k) { 7604 this.originalStyle[k] = this.element.style[k]; 7605 }.bind(this)); 7606 7607 this.originalTop = this.element.offsetTop; 7608 this.originalLeft = this.element.offsetLeft; 7609 7610 var fontSize = this.element.getStyle('font-size') || '100%'; 7611 ['em','px','%','pt'].each( function(fontSizeType) { 7612 if (fontSize.indexOf(fontSizeType)>0) { 7613 this.fontSize = parseFloat(fontSize); 7614 this.fontSizeType = fontSizeType; 7615 } 7616 }.bind(this)); 7617 7618 this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; 7619 7620 this.dims = null; 7621 if (this.options.scaleMode=='box') 7622 this.dims = [this.element.offsetHeight, this.element.offsetWidth]; 7623 if (/^content/.test(this.options.scaleMode)) 7624 this.dims = [this.element.scrollHeight, this.element.scrollWidth]; 7625 if (!this.dims) 7626 this.dims = [this.options.scaleMode.originalHeight, 7627 this.options.scaleMode.originalWidth]; 7628 }, 7629 update: function(position) { 7630 var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); 7631 if (this.options.scaleContent && this.fontSize) 7632 this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); 7633 this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); 7634 }, 7635 finish: function(position) { 7636 if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); 7637 }, 7638 setDimensions: function(height, width) { 7639 var d = { }; 7640 if (this.options.scaleX) d.width = width.round() + 'px'; 7641 if (this.options.scaleY) d.height = height.round() + 'px'; 7642 if (this.options.scaleFromCenter) { 7643 var topd = (height - this.dims[0])/2; 7644 var leftd = (width - this.dims[1])/2; 7645 if (this.elementPositioning == 'absolute') { 7646 if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; 7647 if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; 7648 } else { 7649 if (this.options.scaleY) d.top = -topd + 'px'; 7650 if (this.options.scaleX) d.left = -leftd + 'px'; 7651 } 7652 } 7653 this.element.setStyle(d); 7654 } 7655}); 7656 7657Effect.Highlight = Class.create(Effect.Base, { 7658 initialize: function(element) { 7659 this.element = $(element); 7660 if (!this.element) throw(Effect._elementDoesNotExistError); 7661 var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); 7662 this.start(options); 7663 }, 7664 setup: function() { 7665 // Prevent executing on elements not in the layout flow 7666 if (this.element.getStyle('display')=='none') { this.cancel(); return; } 7667 // Disable background image during the effect 7668 this.oldStyle = { }; 7669 if (!this.options.keepBackgroundImage) { 7670 this.oldStyle.backgroundImage = this.element.getStyle('background-image'); 7671 this.element.setStyle({backgroundImage: 'none'}); 7672 } 7673 if (!this.options.endcolor) 7674 this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); 7675 if (!this.options.restorecolor) 7676 this.options.restorecolor = this.element.getStyle('background-color'); 7677 // init color calculations 7678 this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); 7679 this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); 7680 }, 7681 update: function(position) { 7682 this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ 7683 return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); 7684 }, 7685 finish: function() { 7686 this.element.setStyle(Object.extend(this.oldStyle, { 7687 backgroundColor: this.options.restorecolor 7688 })); 7689 } 7690}); 7691 7692Effect.ScrollTo = function(element) { 7693 var options = arguments[1] || { }, 7694 scrollOffsets = document.viewport.getScrollOffsets(), 7695 elementOffsets = $(element).cumulativeOffset(); 7696 7697 if (options.offset) elementOffsets[1] += options.offset; 7698 7699 return new Effect.Tween(null, 7700 scrollOffsets.top, 7701 elementOffsets[1], 7702 options, 7703 function(p){ scrollTo(scrollOffsets.left, p.round()); } 7704 ); 7705}; 7706 7707/* ------------- combination effects ------------- */ 7708 7709Effect.Fade = function(element) { 7710 element = $(element); 7711 var oldOpacity = element.getInlineOpacity(); 7712 var options = Object.extend({ 7713 from: element.getOpacity() || 1.0, 7714 to: 0.0, 7715 afterFinishInternal: function(effect) { 7716 if (effect.options.to!=0) return; 7717 effect.element.hide().setStyle({opacity: oldOpacity}); 7718 } 7719 }, arguments[1] || { }); 7720 return new Effect.Opacity(element,options); 7721}; 7722 7723Effect.Appear = function(element) { 7724 element = $(element); 7725 var options = Object.extend({ 7726 from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), 7727 to: 1.0, 7728 // force Safari to render floated elements properly 7729 afterFinishInternal: function(effect) { 7730 effect.element.forceRerendering(); 7731 }, 7732 beforeSetup: function(effect) { 7733 effect.element.setOpacity(effect.options.from).show(); 7734 }}, arguments[1] || { }); 7735 return new Effect.Opacity(element,options); 7736}; 7737 7738Effect.Puff = function(element) { 7739 element = $(element); 7740 var oldStyle = { 7741 opacity: element.getInlineOpacity(), 7742 position: element.getStyle('position'), 7743 top: element.style.top, 7744 left: element.style.left, 7745 width: element.style.width, 7746 height: element.style.height 7747 }; 7748 return new Effect.Parallel( 7749 [ new Effect.Scale(element, 200, 7750 { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 7751 new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 7752 Object.extend({ duration: 1.0, 7753 beforeSetupInternal: function(effect) { 7754 Position.absolutize(effect.effects[0].element); 7755 }, 7756 afterFinishInternal: function(effect) { 7757 effect.effects[0].element.hide().setStyle(oldStyle); } 7758 }, arguments[1] || { }) 7759 ); 7760}; 7761 7762Effect.BlindUp = function(element) { 7763 element = $(element); 7764 element.makeClipping(); 7765 return new Effect.Scale(element, 0, 7766 Object.extend({ scaleContent: false, 7767 scaleX: false, 7768 restoreAfterFinish: true, 7769 afterFinishInternal: function(effect) { 7770 effect.element.hide().undoClipping(); 7771 } 7772 }, arguments[1] || { }) 7773 ); 7774}; 7775 7776Effect.BlindDown = function(element) { 7777 element = $(element); 7778 var elementDimensions = element.getDimensions(); 7779 return new Effect.Scale(element, 100, Object.extend({ 7780 scaleContent: false, 7781 scaleX: false, 7782 scaleFrom: 0, 7783 scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 7784 restoreAfterFinish: true, 7785 afterSetup: function(effect) { 7786 effect.element.makeClipping().setStyle({height: '0px'}).show(); 7787 }, 7788 afterFinishInternal: function(effect) { 7789 effect.element.undoClipping(); 7790 } 7791 }, arguments[1] || { })); 7792}; 7793 7794Effect.SwitchOff = function(element) { 7795 element = $(element); 7796 var oldOpacity = element.getInlineOpacity(); 7797 return new Effect.Appear(element, Object.extend({ 7798 duration: 0.4, 7799 from: 0, 7800 transition: Effect.Transitions.flicker, 7801 afterFinishInternal: function(effect) { 7802 new Effect.Scale(effect.element, 1, { 7803 duration: 0.3, scaleFromCenter: true, 7804 scaleX: false, scaleContent: false, restoreAfterFinish: true, 7805 beforeSetup: function(effect) { 7806 effect.element.makePositioned().makeClipping(); 7807 }, 7808 afterFinishInternal: function(effect) { 7809 effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); 7810 } 7811 }); 7812 } 7813 }, arguments[1] || { })); 7814}; 7815 7816Effect.DropOut = function(element) { 7817 element = $(element); 7818 var oldStyle = { 7819 top: element.getStyle('top'), 7820 left: element.getStyle('left'), 7821 opacity: element.getInlineOpacity() }; 7822 return new Effect.Parallel( 7823 [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 7824 new Effect.Opacity(element, { sync: true, to: 0.0 }) ], 7825 Object.extend( 7826 { duration: 0.5, 7827 beforeSetup: function(effect) { 7828 effect.effects[0].element.makePositioned(); 7829 }, 7830 afterFinishInternal: function(effect) { 7831 effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); 7832 } 7833 }, arguments[1] || { })); 7834}; 7835 7836Effect.Shake = function(element) { 7837 element = $(element); 7838 var options = Object.extend({ 7839 distance: 20, 7840 duration: 0.5 7841 }, arguments[1] || {}); 7842 var distance = parseFloat(options.distance); 7843 var split = parseFloat(options.duration) / 10.0; 7844 var oldStyle = { 7845 top: element.getStyle('top'), 7846 left: element.getStyle('left') }; 7847 return new Effect.Move(element, 7848 { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { 7849 new Effect.Move(effect.element, 7850 { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7851 new Effect.Move(effect.element, 7852 { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7853 new Effect.Move(effect.element, 7854 { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7855 new Effect.Move(effect.element, 7856 { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7857 new Effect.Move(effect.element, 7858 { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { 7859 effect.element.undoPositioned().setStyle(oldStyle); 7860 }}); }}); }}); }}); }}); }}); 7861}; 7862 7863Effect.SlideDown = function(element) { 7864 element = $(element).cleanWhitespace(); 7865 // SlideDown need to have the content of the element wrapped in a container element with fixed height! 7866 var oldInnerBottom = element.down().getStyle('bottom'); 7867 var elementDimensions = element.getDimensions(); 7868 return new Effect.Scale(element, 100, Object.extend({ 7869 scaleContent: false, 7870 scaleX: false, 7871 scaleFrom: window.opera ? 0 : 1, 7872 scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 7873 restoreAfterFinish: true, 7874 afterSetup: function(effect) { 7875 effect.element.makePositioned(); 7876 effect.element.down().makePositioned(); 7877 if (window.opera) effect.element.setStyle({top: ''}); 7878 effect.element.makeClipping().setStyle({height: '0px'}).show(); 7879 }, 7880 afterUpdateInternal: function(effect) { 7881 effect.element.down().setStyle({bottom: 7882 (effect.dims[0] - effect.element.clientHeight) + 'px' }); 7883 }, 7884 afterFinishInternal: function(effect) { 7885 effect.element.undoClipping().undoPositioned(); 7886 effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } 7887 }, arguments[1] || { }) 7888 ); 7889}; 7890 7891Effect.SlideUp = function(element) { 7892 element = $(element).cleanWhitespace(); 7893 var oldInnerBottom = element.down().getStyle('bottom'); 7894 var elementDimensions = element.getDimensions(); 7895 return new Effect.Scale(element, window.opera ? 0 : 1, 7896 Object.extend({ scaleContent: false, 7897 scaleX: false, 7898 scaleMode: 'box', 7899 scaleFrom: 100, 7900 scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 7901 restoreAfterFinish: true, 7902 afterSetup: function(effect) { 7903 effect.element.makePositioned(); 7904 effect.element.down().makePositioned(); 7905 if (window.opera) effect.element.setStyle({top: ''}); 7906 effect.element.makeClipping().show(); 7907 }, 7908 afterUpdateInternal: function(effect) { 7909 effect.element.down().setStyle({bottom: 7910 (effect.dims[0] - effect.element.clientHeight) + 'px' }); 7911 }, 7912 afterFinishInternal: function(effect) { 7913 effect.element.hide().undoClipping().undoPositioned(); 7914 effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); 7915 } 7916 }, arguments[1] || { }) 7917 ); 7918}; 7919 7920// Bug in opera makes the TD containing this element expand for a instance after finish 7921Effect.Squish = function(element) { 7922 return new Effect.Scale(element, window.opera ? 1 : 0, { 7923 restoreAfterFinish: true, 7924 beforeSetup: function(effect) { 7925 effect.element.makeClipping(); 7926 }, 7927 afterFinishInternal: function(effect) { 7928 effect.element.hide().undoClipping(); 7929 } 7930 }); 7931}; 7932 7933Effect.Grow = function(element) { 7934 element = $(element); 7935 var options = Object.extend({ 7936 direction: 'center', 7937 moveTransition: Effect.Transitions.sinoidal, 7938 scaleTransition: Effect.Transitions.sinoidal, 7939 opacityTransition: Effect.Transitions.full 7940 }, arguments[1] || { }); 7941 var oldStyle = { 7942 top: element.style.top, 7943 left: element.style.left, 7944 height: element.style.height, 7945 width: element.style.width, 7946 opacity: element.getInlineOpacity() }; 7947 7948 var dims = element.getDimensions(); 7949 var initialMoveX, initialMoveY; 7950 var moveX, moveY; 7951 7952 switch (options.direction) { 7953 case 'top-left': 7954 initialMoveX = initialMoveY = moveX = moveY = 0; 7955 break; 7956 case 'top-right': 7957 initialMoveX = dims.width; 7958 initialMoveY = moveY = 0; 7959 moveX = -dims.width; 7960 break; 7961 case 'bottom-left': 7962 initialMoveX = moveX = 0; 7963 initialMoveY = dims.height; 7964 moveY = -dims.height; 7965 break; 7966 case 'bottom-right': 7967 initialMoveX = dims.width; 7968 initialMoveY = dims.height; 7969 moveX = -dims.width; 7970 moveY = -dims.height; 7971 break; 7972 case 'center': 7973 initialMoveX = dims.width / 2; 7974 initialMoveY = dims.height / 2; 7975 moveX = -dims.width / 2; 7976 moveY = -dims.height / 2; 7977 break; 7978 } 7979 7980 return new Effect.Move(element, { 7981 x: initialMoveX, 7982 y: initialMoveY, 7983 duration: 0.01, 7984 beforeSetup: function(effect) { 7985 effect.element.hide().makeClipping().makePositioned(); 7986 }, 7987 afterFinishInternal: function(effect) { 7988 new Effect.Parallel( 7989 [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), 7990 new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), 7991 new Effect.Scale(effect.element, 100, { 7992 scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 7993 sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) 7994 ], Object.extend({ 7995 beforeSetup: function(effect) { 7996 effect.effects[0].element.setStyle({height: '0px'}).show(); 7997 }, 7998 afterFinishInternal: function(effect) { 7999 effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 8000 } 8001 }, options) 8002 ); 8003 } 8004 }); 8005}; 8006 8007Effect.Shrink = function(element) { 8008 element = $(element); 8009 var options = Object.extend({ 8010 direction: 'center', 8011 moveTransition: Effect.Transitions.sinoidal, 8012 scaleTransition: Effect.Transitions.sinoidal, 8013 opacityTransition: Effect.Transitions.none 8014 }, arguments[1] || { }); 8015 var oldStyle = { 8016 top: element.style.top, 8017 left: element.style.left, 8018 height: element.style.height, 8019 width: element.style.width, 8020 opacity: element.getInlineOpacity() }; 8021 8022 var dims = element.getDimensions(); 8023 var moveX, moveY; 8024 8025 switch (options.direction) { 8026 case 'top-left': 8027 moveX = moveY = 0; 8028 break; 8029 case 'top-right': 8030 moveX = dims.width; 8031 moveY = 0; 8032 break; 8033 case 'bottom-left': 8034 moveX = 0; 8035 moveY = dims.height; 8036 break; 8037 case 'bottom-right': 8038 moveX = dims.width; 8039 moveY = dims.height; 8040 break; 8041 case 'center': 8042 moveX = dims.width / 2; 8043 moveY = dims.height / 2; 8044 break; 8045 } 8046 8047 return new Effect.Parallel( 8048 [ new Effect.Opacity(elemen
8048t, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), 8049 new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), 8050 new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) 8051 ], Object.extend({ 8052 beforeStartInternal: function(effect) { 8053 effect.effects[0].element.makePositioned().makeClipping(); 8054 }, 8055 afterFinishInternal: function(effect) { 8056 effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } 8057 }, options) 8058 ); 8059}; 8060 8061Effect.Pulsate = function(element) { 8062 element = $(element); 8063 var options = arguments[1] || { }, 8064 oldOpacity = element.getInlineOpacity(), 8065 transition = options.transition || Effect.Transitions.linear, 8066 reverser = function(pos){ 8067 return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5); 8068 }; 8069 8070 return new Effect.Opacity(element, 8071 Object.extend(Object.extend({ duration: 2.0, from: 0, 8072 afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } 8073 }, options), {transition: reverser})); 8074}; 8075 8076Effect.Fold = function(element) { 8077 element = $(element); 8078 var oldStyle = { 8079 top: element.style.top, 8080 left: element.style.left, 8081 width: element.style.width, 8082 height: element.style.height }; 8083 element.makeClipping(); 8084 return new Effect.Scale(element, 5, Object.extend({ 8085 scaleContent: false, 8086 scaleX: false, 8087 afterFinishInternal: function(effect) { 8088 new Effect.Scale(element, 1, { 8089 scaleContent: false, 8090 scaleY: false, 8091 afterFinishInternal: function(effect) { 8092 effect.element.hide().undoClipping().setStyle(oldStyle); 8093 } }); 8094 }}, arguments[1] || { })); 8095}; 8096 8097Effect.Morph = Class.create(Effect.Base, { 8098 initialize: function(element) { 8099 this.element = $(element); 8100 if (!this.element) throw(Effect._elementDoesNotExistError); 8101 var options = Object.extend({ 8102 style: { } 8103 }, arguments[1] || { }); 8104 8105 if (!Object.isString(options.style)) this.style = $H(options.style); 8106 else { 8107 if (options.style.include(':')) 8108 this.style = options.style.parseStyle(); 8109 else { 8110 this.element.addClassName(options.style); 8111 this.style = $H(this.element.getStyles()); 8112 this.element.removeClassName(options.style); 8113 var css = this.element.getStyles(); 8114 this.style = this.style.reject(function(style) { 8115 return style.value == css[style.key]; 8116 }); 8117 options.afterFinishInternal = function(effect) { 8118 effect.element.addClassName(effect.options.style); 8119 effect.transforms.each(function(transform) { 8120 effect.element.style[transform.style] = ''; 8121 }); 8122 }; 8123 } 8124 } 8125 this.start(options); 8126 }, 8127 8128 setup: function(){ 8129 function parseColor(color){ 8130 if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; 8131 color = color.parseColor(); 8132 return $R(0,2).map(function(i){ 8133 return parseInt( color.slice(i*2+1,i*2+3), 16 ); 8134 }); 8135 } 8136 this.transforms = this.style.map(function(pair){ 8137 var property = pair[0], value = pair[1], unit = null; 8138 8139 if (value.parseColor('#zzzzzz') != '#zzzzzz') { 8140 value = value.parseColor(); 8141 unit = 'color'; 8142 } else if (property == 'opacity') { 8143 value = parseFloat(value); 8144 if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) 8145 this.element.setStyle({zoom: 1}); 8146 } else if (Element.CSS_LENGTH.test(value)) { 8147 var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); 8148 value = parseFloat(components[1]); 8149 unit = (components.length == 3) ? components[2] : null; 8150 } 8151 8152 var originalValue = this.element.getStyle(property); 8153 return { 8154 style: property.camelize(), 8155 originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 8156 targetValue: unit=='color' ? parseColor(value) : value, 8157 unit: unit 8158 }; 8159 }.bind(this)).reject(function(transform){ 8160 return ( 8161 (transform.originalValue == transform.targetValue) || 8162 ( 8163 transform.unit != 'color' && 8164 (isNaN(transform.originalValue) || isNaN(transform.targetValue)) 8165 ) 8166 ); 8167 }); 8168 }, 8169 update: function(position) { 8170 var style = { }, transform, i = this.transforms.length; 8171 while(i--) 8172 style[(transform = this.transforms[i]).style] = 8173 transform.unit=='color' ? '#'+ 8174 (Math.round(transform.originalValue[0]+ 8175 (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + 8176 (Math.round(transform.originalValue[1]+ 8177 (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + 8178 (Math.round(transform.originalValue[2]+ 8179 (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : 8180 (transform.originalValue + 8181 (transform.targetValue - transform.originalValue) * position).toFixed(3) + 8182 (transform.unit === null ? '' : transform.unit); 8183 this.element.setStyle(style, true); 8184 } 8185}); 8186 8187Effect.Transform = Class.create({ 8188 initialize: function(tracks){ 8189 this.tracks = []; 8190 this.options = arguments[1] || { }; 8191 this.addTracks(tracks); 8192 }, 8193 addTracks: function(tracks){ 8194 tracks.each(function(track){ 8195 track = $H(track); 8196 var data = track.values().first(); 8197 this.tracks.push($H({ 8198 ids: track.keys().first(), 8199 effect: Effect.Morph, 8200 options: { style: data } 8201 })); 8202 }.bind(this)); 8203 return this; 8204 }, 8205 play: function(){ 8206 return new Effect.Parallel( 8207 this.tracks.map(function(track){ 8208 var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); 8209 var elements = [$(ids) || $$(ids)].flatten(); 8210 return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); 8211 }).flatten(), 8212 this.options 8213 ); 8214 } 8215}); 8216 8217Element.CSS_PROPERTIES = $w( 8218 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 8219 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + 8220 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + 8221 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + 8222 'fontSize fontWeight height left letterSpacing lineHeight ' + 8223 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ 8224 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + 8225 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + 8226 'right textIndent top width wordSpacing zIndex'); 8227 8228Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; 8229 8230String.__parseStyleElement = document.createElement('div'); 8231String.prototype.parseStyle = function(){ 8232 var style, styleRules = $H(); 8233 if (Prototype.Browser.WebKit) 8234 style = new Element('div',{style:this}).style; 8235 else { 8236 String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>'; 8237 style = String.__parseStyleElement.childNodes[0].style; 8238 } 8239 8240 Element.CSS_PROPERTIES.each(function(property){ 8241 if (style[property]) styleRules.set(property, style[property]); 8242 }); 8243 8244 if (Prototype.Browser.IE && this.include('opacity')) 8245 styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); 8246 8247 return styleRules; 8248}; 8249 8250if (document.defaultView && document.defaultView.getComputedStyle) { 8251 Element.getStyles = function(element) { 8252 var css = document.defaultView.getComputedStyle($(element), null); 8253 return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { 8254 styles[property] = css[property]; 8255 return styles; 8256 }); 8257 }; 8258} else { 8259 Element.getStyles = function(element) { 8260 element = $(element); 8261 var css = element.currentStyle, styles; 8262 styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) { 8263 results[property] = css[property]; 8264 return results; 8265 }); 8266 if (!styles.opacity) styles.opacity = element.getOpacity(); 8267 return styles; 8268 }; 8269} 8270 8271Effect.Methods = { 8272 morph: function(element, style) { 8273 element = $(element); 8274 new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); 8275 return element; 8276 }, 8277 visualEffect: function(element, effect, options) { 8278 element = $(element); 8279 var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); 8280 new Effect[klass](element, options); 8281 return element; 8282 }, 8283 highlight: function(element, options) { 8284 element = $(element); 8285 new Effect.Highlight(element, options); 8286 return element; 8287 } 8288}; 8289 8290$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ 8291 'pulsate shake puff squish switchOff dropOut').each( 8292 function(effect) { 8293 Effect.Methods[effect] = function(element, options){ 8294 element = $(element);
8295 Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); 8296 return element; 8297 }; 8298 } 8299); 8300 8301$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( 8302 function(f) { Effect.Methods[f] = Element[f]; } 8303); 8304 8305Element.addMethods(Effect.Methods); 8306// script.aculo.us dragdrop.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010 8307 8308// Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 8309// 8310// script.aculo.us is freely distributable under the terms of an MIT-style license. 8311// For details, see the script.aculo.us web site: http://script.aculo.us/ 8312 8313if(Object.isUndefined(Effect)) 8314 throw("dragdrop.js requires including script.aculo.us' effects.js library"); 8315 8316var Droppables = { 8317 drops: [], 8318 8319 remove: function(element) { 8320 this.drops = this.drops.reject(function(d) { return d.element==$(element) }); 8321 }, 8322 8323 add: function(element) { 8324 element = $(element); 8325 var options = Object.extend({ 8326 greedy: true, 8327 hoverclass: null, 8328 tree: false 8329 }, arguments[1] || { }); 8330
8331 // cache containers 8332 if(options.containment) { 8333 options._containers = []; 8334 var containment = options.containment; 8335 if(Object.isArray(containment)) { 8336 containment.each( function(c) { options._containers.push($(c)) }); 8337 } else { 8338 options._containers.push($(containment)); 8339 } 8340 } 8341 8342 if(options.accept) options.accept = [options.accept].flatten(); 8343 8344 Element.makePositioned(element); // fix IE 8345 options.element = element; 8346 8347 this.drops.push(options); 8348 }, 8349 8350 findDeepestChild: function(drops) { 8351 deepest = drops[0]; 8352 8353 for (i = 1; i < drops.length; ++i) 8354 if (Element.isParent(drops[i].element, deepest.element)) 8355 deepest = drops[i]; 8356 8357 return deepest; 8358 }, 8359 8360 isContained: function(element, drop) { 8361 var containmentNode; 8362 if(drop.tree) { 8363 containmentNode = element.treeNode; 8364 } else { 8365 containmentNode = element.parentNode; 8366 } 8367 return drop._containers.detect(function(c) { return containmentNode == c }); 8368 }, 8369 8370 isAffected: function(point, element, drop) { 8371 return ( 8372 (drop.element!=element) && 8373 ((!drop._containers) || 8374 this.isContained(element, drop)) && 8375 ((!drop.accept) || 8376 (Element.classNames(element).detect( 8377 function(v) { return drop.accept.include(v) } ) )) && 8378 Position.within(drop.element, point[0], point[1]) ); 8379 }, 8380 8381 deactivate: function(drop) { 8382 if(drop.hoverclass) 8383 Element.removeClassName(drop.element, drop.hoverclass); 8384 this.last_active = null; 8385 }, 8386 8387 activate: function(drop) { 8388 if(drop.hoverclass) 8389 Element.addClassName(drop.element, drop.hoverclass); 8390 this.last_active = drop; 8391 }, 8392 8393 show: function(point, element) { 8394 if(!this.drops.length) return; 8395 var drop, affected = []; 8396 8397 this.drops.each( function(drop) { 8398 if(Droppables.isAffected(point, element, drop)) 8399 affected.push(drop); 8400 }); 8401 8402 if(affected.length>0) 8403 drop = Droppables.findDeepestChild(affected); 8404 8405 if(this.last_active && this.last_active != drop) this.deactivate(this.last_active); 8406 if (drop) { 8407 Position.within(drop.element, point[0], point[1]); 8408 if(drop.onHover) 8409 drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); 8410 8411 if (drop != this.last_active) Droppables.activate(drop); 8412 } 8413 }, 8414 8415 fire: function(event, element) { 8416 if(!this.last_active) return; 8417 Position.prepare(); 8418 8419 if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) 8420 if (this.last_active.onDrop) { 8421 this.last_active.onDrop(element, this.last_active.element, event); 8422 return true; 8423 } 8424 }, 8425 8426 reset: function() { 8427 if(this.last_active) 8428 this.deactivate(this.last_active); 8429 } 8430}; 8431 8432var Draggables = { 8433 drags: [], 8434 observers: [], 8435 8436 register: function(draggable) { 8437 if(this.drags.length == 0) { 8438 this.eventMouseUp = this.endDrag.bindAsEventListener(this); 8439 this.eventMouseMove = this.updateDrag.bindAsEventListener(this); 8440 this.eventKeypress = this.keyPress.bindAsEventListener(this); 8441 8442 Event.observe(document, "mouseup", this.eventMouseUp); 8443 Event.observe(document, "mousemove", this.eventMouseMove); 8444 Event.observe(document, "keypress", this.eventKeypress); 8445 } 8446 this.drags.push(draggable); 8447 }, 8448 8449 unregister: function(draggable) { 8450 this.drags = this.drags.reject(function(d) { return d==draggable }); 8451 if(this.drags.length == 0) { 8452 Event.stopObserving(document, "mouseup", this.eventMouseUp); 8453 Event.stopObserving(document, "mousemove", this.eventMouseMove); 8454 Event.stopObserving(document, "keypress", this.eventKeypress); 8455 } 8456 }, 8457 8458 activate: function(draggable) { 8459 if(draggable.options.delay) { 8460 this._timeout = setTimeout(function() { 8461 Draggables._timeout = null; 8462 window.focus(); 8463 Draggables.activeDraggable = draggable; 8464 }.bind(this), draggable.options.delay); 8465 } else { 8466 window.focus(); // allows keypress events if window isn't currently focused, fails for Safari 8467 this.activeDraggable = draggable; 8468 } 8469 }, 8470 8471 deactivate: function() { 8472 this.activeDraggable = null; 8473 }, 8474 8475 updateDrag: function(event) { 8476 if(!this.activeDraggable) return; 8477 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 8478 // Mozilla-based browsers fire successive mousemove events with 8479 // the same coordinates, prevent needless redrawing (moz bug?) 8480 if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; 8481 this._lastPointer = pointer; 8482 8483 this.activeDraggable.updateDrag(event, pointer); 8484 }, 8485 8486 endDrag: function(event) { 8487 if(this._timeout) { 8488 clearTimeout(this._timeout); 8489 this._timeout = null; 8490 } 8491 if(!this.activeDraggable) return; 8492 this._lastPointer = null; 8493 this.activeDraggable.endDrag(event); 8494 this.activeDraggable = null; 8495 }, 8496 8497 keyPress: function(event) { 8498 if(this.activeDraggable) 8499 this.activeDraggable.keyPress(event); 8500 }, 8501 8502 addObserver: function(observer) { 8503 this.observers.push(observer); 8504 this._cacheObserverCallbacks(); 8505 }, 8506 8507 removeObserver: function(element) { // element instead of observer fixes mem leaks 8508 this.observers = this.observers.reject( function(o) { return o.element==element }); 8509 this._cacheObserverCallbacks(); 8510 }, 8511 8512 notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' 8513 if(this[eventName+'Count'] > 0) 8514 this.observers.each( function(o) { 8515 if(o[eventName]) o[eventName](eventName, draggable, event); 8516 });
8517 if(draggable.options[eventName]) draggable.options[eventName](draggable, event); 8518 }, 8519 8520 _cacheObserverCallbacks: function() { 8521 ['onStart','onEnd','onDrag'].each( function(eventName) { 8522 Draggables[eventName+'Count'] = Draggables.observers.select( 8523 function(o) { return o[eventName]; } 8524 ).length; 8525 }); 8526 } 8527}; 8528 8529/*--------------------------------------------------------------------------*/ 8530 8531var Draggable = Class.create({ 8532 initialize: function(element) { 8533 var defaults = { 8534 handle: false, 8535 reverteffect: function(element, top_offset, left_offset) { 8536 var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; 8537 new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, 8538 queue: {scope:'_draggable', position:'end'} 8539 }); 8540 }, 8541 endeffect: function(element) { 8542 var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; 8543 new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, 8544 queue: {scope:'_draggable', position:'end'}, 8545 afterFinish: function(){ 8546 Draggable._dragging[element] = false 8547 } 8548 }); 8549 }, 8550 zindex: 1000, 8551 revert: false, 8552 quiet: false, 8553 scroll: false, 8554 scrollSensitivity: 20, 8555 scrollSpeed: 15, 8556 snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } 8557 delay: 0 8558 }; 8559 8560 if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) 8561 Object.extend(defaults, { 8562 starteffect: function(element) { 8563 element._opacity = Element.getOpacity(element); 8564 Draggable._dragging[element] = true; 8565 new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); 8566 } 8567 }); 8568 8569 var options = Object.extend(defaults, arguments[1] || { }); 8570 8571 this.element = $(element); 8572 8573 if(options.handle && Object.isString(options.handle)) 8574 this.handle = this.element.down('.'+options.handle, 0); 8575 8576 if(!this.handle) this.handle = $(options.handle); 8577 if(!this.handle) this.handle = this.element; 8578 8579 if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { 8580 options.scroll = $(options.scroll); 8581 this._isScrollChild = Element.childOf(this.element, options.scroll); 8582 } 8583 8584 Element.makePositioned(this.element); // fix IE 8585 8586 this.options = options; 8587 this.dragging = false; 8588 8589 this.eventMouseDown = this.initDrag.bindAsEventListener(this); 8590 Event.observe(this.handle, "mousedown", this.eventMouseDown); 8591 8592 Draggables.register(this); 8593 }, 8594 8595 destroy: function() { 8596 Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); 8597 Draggables.unregister(this); 8598 }, 8599 8600 currentDelta: function() { 8601 return([ 8602 parseInt(Element.getStyle(this.element,'left') || '0'), 8603 parseInt(Element.getStyle(this.element,'top') || '0')]); 8604 }, 8605 8606 initDrag: function(event) { 8607 if(!Object.isUndefined(Draggable._dragging[this.element]) && 8608 Draggable._dragging[this.element]) return; 8609 if(Event.isLeftClick(event)) { 8610 // abort on form elements, fixes a Firefox issue 8611 var src = Event.element(event); 8612 if((tag_name = src.tagName.toUpperCase()) && ( 8613 tag_name=='INPUT' || 8614 tag_name=='SELECT' || 8615 tag_name=='OPTION' || 8616 tag_name=='BUTTON' || 8617 tag_name=='TEXTAREA')) return; 8618 8619 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 8620 var pos = this.element.cumulativeOffset(); 8621 this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); 8622 8623 Draggables.activate(this); 8624 Event.stop(event); 8625 } 8626 }, 8627 8628 startDrag: function(event) { 8629 this.dragging = true; 8630 if(!this.delta) 8631 this.delta = this.currentDelta(); 8632 8633 if(this.options.zindex) { 8634 this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); 8635 this.element.style.zIndex = this.options.zindex; 8636 } 8637 8638 if(this.options.ghosting) { 8639 this._clone = this.element.cloneNode(true); 8640 this._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); 8641 if (!this._originallyAbsolute) 8642 Position.absolutize(this.element); 8643 this.element.parentNode.insertBefore(this._clone, this.element); 8644 } 8645 8646 if(this.options.scroll) { 8647 if (this.options.scroll == window) { 8648 var where = this._getWindowScroll(this.options.scroll); 8649 this.originalScrollLeft = where.left; 8650 this.originalScrollTop = where.top; 8651 } else {
8652 this.originalScrollLeft = this.options.scroll.scrollLeft; 8653 this.originalScrollTop = this.options.scroll.scrollTop; 8654 } 8655 } 8656 8657 Draggables.notify('onStart', this, event); 8658 8659 if(this.options.starteffect) this.options.starteffect(this.element); 8660 }, 8661 8662 updateDrag: function(event, pointer) { 8663 if(!this.dragging) this.startDrag(event); 8664 8665 if(!this.options.quiet){ 8666 Position.prepare(); 8667 Droppables.show(pointer, this.element); 8668 } 8669 8670 Draggables.notify('onDrag', this, event); 8671 8672 this.draw(pointer); 8673 if(this.options.change) this.options.change(this); 8674 8675 if(this.options.scroll) { 8676 this.stopScrolling(); 8677 8678 var p; 8679 if (this.options.scroll == window) { 8680 with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } 8681 } else { 8682 p = Position.page(this.options.scroll).toArray(); 8683 p[0] += this.options.scroll.scrollLeft + Position.deltaX; 8684 p[1] += this.options.scroll.scrollTop + Position.deltaY; 8685 p.push(p[0]+this.options.scroll.offsetWidth); 8686 p.push(p[1]+this.options.scroll.offsetHeight); 8687 } 8688 var speed = [0,0]; 8689 if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); 8690 if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); 8691 if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); 8692 if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); 8693 this.startScrolling(speed); 8694 } 8695 8696 // fix AppleWebKit rendering 8697 if(Prototype.Browser.WebKit) window.scrollBy(0,0); 8698 8699 Event.stop(event); 8700 }, 8701 8702 finishDrag: function(event, success) { 8703 this.dragging = false; 8704 8705 if(this.options.quiet){ 8706 Position.prepare(); 8707 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 8708 Droppables.show(pointer, this.element); 8709 } 8710 8711 if(this.options.ghosting) { 8712 if (!this._originallyAbsolute) 8713 Position.relativize(this.element); 8714 delete this._originallyAbsolute; 8715 Element.remove(this._clone); 8716 this._clone = null; 8717 } 8718 8719 var dropped = false; 8720 if(success) { 8721 dropped = Droppables.fire(event, this.element); 8722 if (!dropped) dropped = false; 8723 } 8724 if(dropped && this.options.onDropped) this.options.onDropped(this.element); 8725 Draggables.notify('onEnd', this, event); 8726 8727 var revert = this.options.revert; 8728 if(revert && Object.isFunction(revert)) revert = revert(this.element); 8729 8730 var d = this.currentDelta(); 8731 if(revert && this.options.reverteffect) { 8732 if (dropped == 0 || revert != 'failure') 8733 this.options.reverteffect(this.element, 8734 d[1]-this.delta[1], d[0]-this.delta[0]); 8735 } else { 8736 this.delta = d; 8737 } 8738 8739 if(this.options.zindex) 8740 this.element.style.zIndex = this.originalZ; 8741 8742 if(this.options.endeffect) 8743 this.options.endeffect(this.element); 8744 8745 Draggables.deactivate(this); 8746 Droppables.reset(); 8747 }, 8748 8749 keyPress: function(event) { 8750 if(event.keyCode!=Event.KEY_ESC) return; 8751 this.finishDrag(event, false); 8752 Event.stop(event); 8753 }, 8754 8755 endDrag: function(event) { 8756 if(!this.dragging) return; 8757 this.stopScrolling(); 8758 this.finishDrag(event, true); 8759 Event.stop(event); 8760 }, 8761 8762 draw: function(point) { 8763 var pos = this.element.cumulativeOffset(); 8764 if(this.options.ghosting) { 8765 var r = Position.realOffset(this.element); 8766 pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; 8767 } 8768 8769 var d = this.currentDelta(); 8770 pos[0] -= d[0]; pos[1] -= d[1]; 8771 8772 if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { 8773 pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; 8774 pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; 8775 } 8776 8777 var p = [0,1].map(function(i){ 8778 return (point[i]-pos[i]-this.offset[i]) 8779 }.bind(this)); 8780 8781 if(this.options.snap) { 8782 if(Object.isFunction(this.options.snap)) { 8783 p = this.options.snap(p[0],p[1],this); 8784 } else { 8785 if(Object.isArray(this.options.snap)) { 8786 p = p.map( function(v, i) { 8787 return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this)); 8788 } else { 8789 p = p.map( function(v) { 8790 return (v/this.options.snap).round()*this.options.snap }.bind(this)); 8791 } 8792 }} 8793 8794 var style = this.element.style; 8795 if((!this.options.constraint) || (this.options.constraint=='horizontal')) 8796 style.left = p[0] + "px"; 8797 if((!this.options.constraint) || (this.options.constraint=='vertical')) 8798 style.top = p[1] + "px"; 8799 8800 if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering 8801 }, 8802 8803 stopScrolling: function() { 8804 if(this.scrollInterval) { 8805 clearInterval(this.scrollInterval); 8806 this.scrollInterval = null; 8807 Draggables._lastScrollPointer = null; 8808 } 8809 }, 8810 8811 startScrolling: function(speed) { 8812 if(!(speed[0] || speed[1])) return; 8813 this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; 8814 this.lastScrolled = new Date(); 8815 this.scrollInterval = setInterval(this.scroll.bind(this), 10); 8816 }, 8817 8818 scroll: function() { 8819 var current = new Date(); 8820 var delta = current - this.lastScrolled; 8821 this.lastScrolled = current; 8822 if(this.options.scroll == window) { 8823 with (this._getWindowScroll(this.options.scroll)) { 8824 if (this.scrollSpeed[0] || this.scrollSpeed[1]) { 8825 var d = delta / 1000;
8826 this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); 8827 } 8828 } 8829 } else { 8830 this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; 8831 this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; 8832 } 8833 8834 Position.prepare(); 8835 Droppables.show(Draggables._lastPointer, this.element); 8836 Draggables.notify('onDrag', this); 8837 if (this._isScrollChild) { 8838 Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); 8839 Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; 8840 Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; 8841 if (Draggables._lastScrollPointer[0] < 0) 8842 Draggables._lastScrollPointer[0] = 0; 8843 if (Draggables._lastScrollPointer[1] < 0) 8844 Draggables._lastScrollPointer[1] = 0; 8845 this.draw(Draggables._lastScrollPointer); 8846 } 8847 8848 if(this.options.change) this.options.change(this); 8849 }, 8850 8851 _getWindowScroll: function(w) { 8852 var T, L, W, H; 8853 with (w.document) { 8854 if (w.document.documentElement && documentElement.scrollTop) { 8855 T = documentElement.scrollTop; 8856 L = documentElement.scrollLeft; 8857 } else if (w.document.body) { 8858 T = body.scrollTop; 8859 L = body.scrollLeft; 8860 } 8861 if (w.innerWidth) { 8862 W = w.innerWidth; 8863 H = w.innerHeight; 8864 } else if (w.document.documentElement && documentElement.clientWidth) { 8865 W = documentElement.clientWidth; 8866 H = documentElement.clientHeight; 8867 } else { 8868 W = body.offsetWidth; 8869 H = body.offsetHeight; 8870 } 8871 } 8872 return { top: T, left: L, width: W, height: H }; 8873 } 8874}); 8875 8876Draggable._dragging = { }; 8877 8878/*--------------------------------------------------------------------------*/ 8879 8880var SortableObserver = Class.create({ 8881 initialize: function(element, observer) { 8882 this.element = $(element); 8883 this.observer = observer; 8884 this.lastValue = Sortable.serialize(this.element); 8885 }, 8886 8887 onStart: function() { 8888 this.lastValue = Sortable.serialize(this.element); 8889 }, 8890 8891 onEnd: function() { 8892 Sortable.unmark(); 8893 if(this.lastValue != Sortable.serialize(this.element)) 8894 this.observer(this.element) 8895 } 8896}); 8897 8898var Sortable = { 8899 SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, 8900 8901 sortables: { }, 8902 8903 _findRootElement: function(element) { 8904 while (element.tagName.toUpperCase() != "BODY") { 8905 if(element.id && Sortable.sortables[element.id]) return element; 8906 element = element.parentNode; 8907 } 8908 }, 8909 8910 options: function(element) { 8911 element = Sortable._findRootElement($(element)); 8912 if(!element) return; 8913 return Sortable.sortables[element.id]; 8914 }, 8915 8916 destroy: function(element){ 8917 element = $(element); 8918 var s = Sortable.sortables[element.id]; 8919 8920 if(s) { 8921 Draggables.removeObserver(s.element); 8922 s.droppables.each(function(d){ Droppables.remove(d) }); 8923 s.draggables.invoke('destroy'); 8924 8925 delete Sortable.sortables[s.element.id]; 8926 } 8927 }, 8928 8929 create: function(element) { 8930 element = $(element); 8931 var options = Object.extend({ 8932 element: element, 8933 tag: 'li', // assumes li children, override with tag: 'tagname' 8934 dropOnEmpty: false, 8935 tree: false, 8936 treeTag: 'ul', 8937 overlap: 'vertical', // one of 'vertical', 'horizontal' 8938 constraint: 'vertical', // one of 'vertical', 'horizontal', false 8939 containment: element, // also takes array of elements (or id's); or false 8940 handle: false, // or a CSS class 8941 only: false, 8942 delay: 0, 8943 hoverclass: null, 8944 ghosting: false, 8945 quiet: false, 8946 scroll: false, 8947 scrollSensitivity: 20, 8948 scrollSpeed: 15, 8949 format: this.SERIALIZE_RULE, 8950 8951 // these take arrays of elements or ids and can be 8952 // used for better initialization performance 8953 elements: false, 8954 handles: false, 8955 8956 onChange: Prototype.emptyFunction, 8957 onUpdate: Prototype.emptyFunction 8958 }, arguments[1] || { }); 8959 8960 // clear any old sortable with same element 8961 this.destroy(element); 8962 8963 // build options for the draggables 8964 var options_for_draggable = { 8965 revert: true, 8966 quiet: options.quiet, 8967 scroll: options.scroll, 8968 scrollSpeed: options.scrollSpeed,
8969 scrollSensitivity: options.scrollSensitivity, 8970 delay: options.delay, 8971 ghosting: options.ghosting, 8972 constraint: options.constraint, 8973 handle: options.handle }; 8974 8975 if(options.starteffect) 8976 options_for_draggable.starteffect = options.starteffect; 8977 8978 if(options.reverteffect) 8979 options_for_draggable.reverteffect = options.reverteffect; 8980 else 8981 if(options.ghosting) options_for_draggable.reverteffect = function(element) { 8982 element.style.top = 0; 8983 element.style.left = 0; 8984 }; 8985 8986 if(options.endeffect) 8987 options_for_draggable.endeffect = options.endeffect; 8988 8989 if(options.zindex) 8990 options_for_draggable.zindex = options.zindex; 8991 8992 // build options for the droppables 8993 var options_for_droppable = { 8994 overlap: options.overlap, 8995 containment: options.containment, 8996 tree: options.tree, 8997 hoverclass: options.hoverclass, 8998 onHover: Sortable.onHover 8999 }; 9000 9001 var options_for_tree = { 9002 onHover: Sortable.onEmptyHover, 9003 overlap: options.overlap, 9004 containment: options.containment, 9005 hoverclass: options.hoverclass 9006 }; 9007 9008 // fix for gecko engine 9009 Element.cleanWhitespace(element); 9010 9011 options.draggables = []; 9012 options.droppables = []; 9013 9014 // drop on empty handling 9015 if(options.dropOnEmpty || options.tree) { 9016 Droppables.add(element, options_for_tree); 9017 options.droppables.push(element); 9018 } 9019 9020 (options.elements || this.findElements(element, options) || []).each( function(e,i) { 9021 var handle = options.handles ? $(options.handles[i]) : 9022 (options.handle ? $(e).select('.' + options.handle)[0] : e); 9023 options.draggables.push( 9024 new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); 9025 Droppables.add(e, options_for_droppable); 9026 if(options.tree) e.treeNode = element; 9027 options.droppables.push(e); 9028 }); 9029 9030 if(options.tree) { 9031 (Sortable.findTreeElements(element, options) || []).each( function(e) { 9032 Droppables.add(e, options_for_tree); 9033 e.treeNode = element; 9034 options.droppables.push(e); 9035 }); 9036 } 9037 9038 // keep reference 9039 this.sortables[element.identify()] = options; 9040 9041 // for onupdate 9042 Draggables.addObserver(new SortableObserver(element, options.onUpdate)); 9043 9044 }, 9045 9046 // return all suitable-for-sortable elements in a guaranteed order 9047 findElements: function(element, options) { 9048 return Element.findChildren( 9049 element, options.only, options.tree ? true : false, options.tag); 9050 }, 9051 9052 findTreeElements: function(element, options) { 9053 return Element.findChildren( 9054 element, options.only, options.tree ? true : false, options.treeTag); 9055 }, 9056 9057 onHover: function(element, dropon, overlap) { 9058 if(Element.isParent(dropon, element)) return; 9059 9060 if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { 9061 return; 9062 } else if(overlap>0.5) { 9063 Sortable.mark(dropon, 'before'); 9064 if(dropon.previousSibling != element) { 9065 var oldParentNode = element.parentNode; 9066 element.style.visibility = "hidden"; // fix gecko rendering 9067 dropon.parentNode.insertBefore(element, dropon); 9068 if(dropon.parentNode!=oldParentNode) 9069 Sortable.options(oldParentNode).onChange(element); 9070 Sortable.options(dropon.parentNode).onChange(element); 9071 } 9072 } else { 9073 Sortable.mark(dropon, 'after'); 9074 var nextElement = dropon.nextSibling || null; 9075 if(nextElement != element) { 9076 var oldParentNode = element.parentNode; 9077 element.style.visibility = "hidden"; // fix gecko rendering 9078 dropon.parentNode.insertBefore(element, nextElement); 9079 if(dropon.parentNode!=oldParentNode) 9080 Sortable.options(oldParentNode).onChange(element); 9081 Sortable.options(dropon.parentNode).onChange(element); 9082 } 9083 } 9084 }, 9085 9086 onEmptyHover: function(element, dropon, overlap) { 9087 var oldParentNode = element.parentNode; 9088 var droponOptions = Sortable.options(dropon); 9089 9090 if(!Element.isParent(dropon, element)) { 9091 var index; 9092 9093 var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); 9094 var child = null; 9095 9096 if(children) { 9097 var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); 9098 9099 for (index = 0; index < children.length; index += 1) { 9100 if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { 9101 offset -= Element.offsetSize (children[index], droponOptions.overlap); 9102 } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { 9103 child = index + 1 < children.length ? children[index + 1] : null; 9104 break; 9105 } else { 9106 child = children[index]; 9107 break; 9108 } 9109 } 9110 } 9111 9112 dropon.insertBefore(element, child); 9113
9114 Sortable.options(oldParentNode).onChange(element); 9115 droponOptions.onChange(element); 9116 } 9117 }, 9118 9119 unmark: function() { 9120 if(Sortable._marker) Sortable._marker.hide(); 9121 }, 9122 9123 mark: function(dropon, position) { 9124 // mark on ghosting only 9125 var sortable = Sortable.options(dropon.parentNode); 9126 if(sortable && !sortable.ghosting) return; 9127 9128 if(!Sortable._marker) { 9129 Sortable._marker = 9130 ($('dropmarker') || Element.extend(document.createElement('DIV'))). 9131 hide().addClassName('dropmarker').setStyle({position:'absolute'}); 9132 document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); 9133 } 9134 var offsets = dropon.cumulativeOffset(); 9135 Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); 9136 9137 if(position=='after') 9138 if(sortable.overlap == 'horizontal') 9139 Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); 9140 else 9141 Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); 9142 9143 Sortable._marker.show(); 9144 }, 9145 9146 _tree: function(element, options, parent) { 9147 var children = Sortable.findElements(element, options) || []; 9148 9149 for (var i = 0; i < children.length; ++i) { 9150 var match = children[i].id.match(options.format); 9151 9152 if (!match) continue; 9153 9154 var child = { 9155 id: encodeURIComponent(match ? match[1] : null), 9156 element: element, 9157 parent: parent, 9158 children: [], 9159 position: parent.children.length, 9160 container: $(children[i]).down(options.treeTag) 9161 }; 9162 9163 /* Get the element containing the children and recurse over it */ 9164 if (child.container) 9165 this._tree(child.container, options, child); 9166 9167 parent.children.push (child); 9168 } 9169 9170 return parent; 9171 }, 9172 9173 tree: function(element) { 9174 element = $(element); 9175 var sortableOptions = this.options(element); 9176 var options = Object.extend({ 9177 tag: sortableOptions.tag, 9178 treeTag: sortableOptions.treeTag, 9179 only: sortableOptions.only, 9180 name: element.id, 9181 format: sortableOptions.format 9182 }, arguments[1] || { }); 9183 9184 var root = { 9185 id: null, 9186 parent: null, 9187 children: [], 9188 container: element, 9189 position: 0 9190 }; 9191 9192 return Sortable._tree(element, options, root); 9193 }, 9194 9195 /* Construct a [i] index for a particular node */ 9196 _constructIndex: function(node) { 9197 var index = ''; 9198 do { 9199 if (node.id) index = '[' + node.position + ']' + index; 9200 } while ((node = node.parent) != null); 9201 return index; 9202 }, 9203 9204 sequence: function(element) { 9205 element = $(element); 9206 var options = Object.extend(this.options(element), arguments[1] || { }); 9207 9208 return $(this.findElements(element, options) || []).map( function(item) { 9209 return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; 9210 }); 9211 }, 9212 9213 setSequence: function(element, new_sequence) { 9214 element = $(element); 9215 var options = Object.extend(this.options(element), arguments[2] || { }); 9216 9217 var nodeMap = { }; 9218 this.findElements(element, options).each( function(n) { 9219 if (n.id.match(options.format)) 9220 nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; 9221 n.parentNode.removeChild(n); 9222 }); 9223 9224 new_sequence.each(function(ident) { 9225 var n = nodeMap[ident]; 9226 if (n) { 9227 n[1].appendChild(n[0]); 9228 delete nodeMap[ident]; 9229 } 9230 }); 9231 }, 9232 9233 serialize: function(element) { 9234 element = $(element); 9235 var options = Object.extend(Sortable.options(element), arguments[1] || { }); 9236 var name = encodeURIComponent( 9237 (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); 9238 9239 if (options.tree) { 9240 return Sortable.tree(element, arguments[1]).children.map( function (item) { 9241 return [name + Sortable._constructIndex(item) + "[id]=" + 9242 encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); 9243 }).flatten().join('&'); 9244 } else { 9245 return Sortable.sequence(element, arguments[1]).map( function(item) { 9246 return name + "[]=" + encodeURIComponent(item); 9247 }).join('&'); 9248 } 9249 } 9250}; 9251 9252// Returns true if child is contained within element 9253Element.isParent = function(child, element) { 9254 if (!child.parentNode || child == element) return false;
9255 if (child.parentNode == element) return true; 9256 return Element.isParent(child.parentNode, element); 9257}; 9258 9259Element.findChildren = function(element, only, recursive, tagName) { 9260 if(!element.hasChildNodes()) return null; 9261 tagName = tagName.toUpperCase(); 9262 if(only) only = [only].flatten(); 9263 var elements = []; 9264 $A(element.childNodes).each( function(e) { 9265 if(e.tagName && e.tagName.toUpperCase()==tagName && 9266 (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) 9267 elements.push(e); 9268 if(recursive) { 9269 var grandchildren = Element.findChildren(e, only, recursive, tagName); 9270 if(grandchildren) elements.push(grandchildren); 9271 } 9272 }); 9273 9274 return (elements.length>0 ? elements.flatten() : []); 9275}; 9276 9277Element.offsetSize = function (element, type) { 9278 return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; 9279}; 9280// script.aculo.us controls.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 9281 9282// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 9283// (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan) 9284// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com) 9285// Contributors: 9286// Richard Livsey 9287// Rahul Bhargava 9288// Rob Wills 9289// 9290// script.aculo.us is freely distributable under the terms of an MIT-style license. 9291// For details, see the script.aculo.us web site: http://script.aculo.us/ 9292 9293// Autocompleter.Base handles all the autocompletion functionality 9294// that's independent of the data source for autocompletion. This 9295// includes drawing the autocompletion menu, observing keyboard 9296// and mouse events, and similar. 9297// 9298// Specific autocompleters need to provide, at the very least, 9299// a getUpdatedChoices function that will be invoked every time 9300// the text inside the monitored textbox changes. This method 9301// should get the text for which to provide autocompletion by 9302// invoking this.getToken(), NOT by directly accessing 9303// this.element.value. This is to allow incremental tokenized 9304// autocompletion. Specific auto-completion logic (AJAX, etc) 9305// belongs in getUpdatedChoices. 9306// 9307// Tokenized incremental autocompletion is enabled automatically 9308// when an autocompleter is instantiated with the 'tokens' option 9309// in the options parameter, e.g.: 9310// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); 9311// will incrementally autocomplete with a comma as the token. 9312// Additionally, ',' in the above example can be replaced with 9313// a token array, e.g. { tokens: [',', '\n'] } which 9314// enables autocompletion on multiple tokens. This is most 9315// useful when one of the tokens is \n (a newline), as it 9316// allows smart autocompletion after linebreaks. 9317 9318if(typeof Effect == 'undefined') 9319 throw("controls.js requires including script.aculo.us' effects.js library"); 9320 9321var Autocompleter = { }; 9322Autocompleter.Base = Class.create({ 9323 baseInitialize: function(element, update, options) { 9324 element = $(element); 9325 this.element = element; 9326 this.update = $(update); 9327 this.hasFocus = false; 9328 this.changed = false; 9329 this.active = false; 9330 this.index = 0; 9331 this.entryCount = 0; 9332 this.oldElementValue = this.element.value; 9333 9334 if(this.setOptions) 9335 this.setOptions(options); 9336 else 9337 this.options = options || { }; 9338 9339 this.options.paramName = this.options.paramName || this.element.name; 9340 this.options.tokens = this.options.tokens || []; 9341 this.options.frequency = this.options.frequency || 0.4; 9342 this.options.minChars = this.options.minChars || 1; 9343 this.options.onShow = this.options.onShow || 9344 function(element, update){ 9345 if(!update.style.position || update.style.position=='absolute') { 9346 update.style.position = 'absolute'; 9347 Position.clone(element, update, { 9348 setHeight: false, 9349 offsetTop: element.offsetHeight 9350 }); 9351 } 9352 Effect.Appear(update,{duration:0.15}); 9353 }; 9354 this.options.onHide = this.options.onHide || 9355 function(element, update){ new Effect.Fade(update,{duration:0.15}) }; 9356 9357 if(typeof(this.options.tokens) == 'string') 9358 this.options.tokens = new Array(this.options.tokens); 9359 // Force carriage returns as token delimiters anyway 9360 if (!this.options.tokens.include('\n')) 9361 this.options.tokens.push('\n'); 9362 9363 this.observer = null; 9364 9365 this.element.setAttribute('autocomplete','off'); 9366 9367 Element.hide(this.update); 9368 9369 Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); 9370 Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this)); 9371 }, 9372 9373 show: function() { 9374 if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); 9375 if(!this.iefix && 9376 (Prototype.Browser.IE) && 9377 (Element.getStyle(this.update, 'position')=='absolute')) { 9378 new Insertion.After(this.update, 9379 '<iframe id="' + this.update.id + '_iefix" '+ 9380 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' + 9381 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>'); 9382 this.iefix = $(this.update.id+'_iefix'); 9383 } 9384 if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); 9385 }, 9386 9387 fixIEOverlapping: function() { 9388 Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); 9389 this.iefix.style.zIndex = 1; 9390 this.update.style.zIndex = 2; 9391 Element.show(this.iefix); 9392 }, 9393 9394 hide: function() { 9395 this.stopIndicator(); 9396 if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); 9397 if(this.iefix) Element.hide(this.iefix); 9398 }, 9399 9400 startIndicator: function() { 9401 if(this.options.indicator) Element.show(this.options.indicator); 9402 }, 9403 9404 stopIndicator: function() { 9405 if(this.options.indicator) Element.hide(this.options.indicator); 9406 }, 9407 9408 onKeyPress: function(event) { 9409 if(this.active) 9410 switch(event.keyCode) { 9411 case Event.KEY_TAB: 9412 case Event.KEY_RETURN: 9413 this.selectEntry(); 9414 Event.stop(event); 9415 case Event.KEY_ESC: 9416 this.hide(); 9417 this.active = false;
9418 Event.stop(event); 9419 return; 9420 case Event.KEY_LEFT: 9421 case Event.KEY_RIGHT: 9422 return; 9423 case Event.KEY_UP: 9424 this.markPrevious(); 9425 this.render(); 9426 Event.stop(event); 9427 return; 9428 case Event.KEY_DOWN: 9429 this.markNext(); 9430 this.render(); 9431 Event.stop(event); 9432 return; 9433 } 9434 else 9435 if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || 9436 (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; 9437 9438 this.changed = true; 9439 this.hasFocus = true; 9440 9441 if(this.observer) clearTimeout(this.observer); 9442 this.observer = 9443 setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); 9444 }, 9445 9446 activate: function() { 9447 this.changed = false; 9448 this.hasFocus = true; 9449 this.getUpdatedChoices(); 9450 }, 9451 9452 onHover: function(event) { 9453 var element = Event.findElement(event, 'LI'); 9454 if(this.index != element.autocompleteIndex) 9455 { 9456 this.index = element.autocompleteIndex; 9457 this.render(); 9458 } 9459 Event.stop(event); 9460 }, 9461 9462 onClick: function(event) { 9463 var element = Event.findElement(event, 'LI'); 9464 this.index = element.autocompleteIndex; 9465 this.selectEntry(); 9466 this.hide(); 9467 }, 9468 9469 onBlur: function(event) { 9470 // needed to make click events working 9471 setTimeout(this.hide.bind(this), 250); 9472 this.hasFocus = false; 9473 this.active = false; 9474 }, 9475 9476 render: function() { 9477 if(this.entryCount > 0) { 9478 for (var i = 0; i < this.entryCount; i++) 9479 this.index==i ? 9480 Element.addClassName(this.getEntry(i),"selected") : 9481 Element.removeClassName(this.getEntry(i),"selected"); 9482 if(this.hasFocus) { 9483 this.show(); 9484 this.active = true; 9485 } 9486 } else { 9487 this.active = false; 9488 this.hide(); 9489 } 9490 }, 9491 9492 markPrevious: function() { 9493 if(this.index > 0) this.index--; 9494 else this.index = this.entryCount-1; 9495 //this.getEntry(this.index).scrollIntoView(true); useless 9496 }, 9497 9498 markNext: function() { 9499 if(this.index < this.entryCount-1) this.index++; 9500 else this.index = 0; 9501 this.getEntry(this.index).scrollIntoView(false); 9502 }, 9503 9504 getEntry: function(index) { 9505 return this.update.firstChild.childNodes[index]; 9506 }, 9507 9508 getCurrentEntry: function() { 9509 return this.getEntry(this.index); 9510 }, 9511 9512 selectEntry: function() { 9513 this.active = false; 9514 this.updateElement(this.getCurrentEntry()); 9515 }, 9516 9517 updateElement: function(selectedElement) { 9518 if (this.options.updateElement) { 9519 this.options.updateElement(selectedElement); 9520 return; 9521 } 9522 var value = ''; 9523 if (this.options.select) { 9524 var nodes = $(selectedElement).select('.' + this.options.select) || []; 9525 if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); 9526 } else 9527 value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); 9528 9529 var bounds = this.getTokenBounds(); 9530 if (bounds[0] != -1) { 9531 var newValue = this.element.value.substr(0, bounds[0]); 9532 var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/); 9533 if (whitespace) 9534 newValue += whitespace[0]; 9535 this.element.value = newValue + value + this.element.value.substr(bounds[1]); 9536 } else { 9537 this.element.value = value; 9538 } 9539 this.oldElementValue = this.element.value; 9540 this.element.focus(); 9541 9542 if (this.options.afterUpdateElement) 9543 this.options.afterUpdateElement(this.element, selectedElement); 9544 }, 9545 9546 updateChoices: function(choices) { 9547 if(!this.changed && this.hasFocus) { 9548 this.update.innerHTML = choices; 9549 Element.cleanWhitespace(this.update); 9550 Element.cleanWhitespace(this.update.down()); 9551 9552 if(this.update.firstChild && this.update.down().childNodes) { 9553 this.entryCount = 9554 this.update.down().childNodes.length; 9555 for (var i = 0; i < this.entryCount; i++) { 9556 var entry = this.getEntry(i); 9557 entry.autocompleteIndex = i; 9558 this.addObservers(entry); 9559 } 9560 } else { 9561 this.entryCount = 0; 9562 } 9563 9564 this.stopIndicator(); 9565 this.index = 0; 9566 9567 if(this.entryCount==1 && this.options.autoSelect) { 9568 this.selectEntry(); 9569 this.hide(); 9570 } else { 9571 this.render(); 9572 } 9573 } 9574 }, 9575 9576 addObservers: function(element) { 9577 Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); 9578 Event.observe(element, "click", this.onClick.bindAsEventListener(this)); 9579 }, 9580 9581 onObserverEvent: function() { 9582 this.changed = false;
9583 this.tokenBounds = null; 9584 if(this.getToken().length>=this.options.minChars) { 9585 this.getUpdatedChoices(); 9586 } else { 9587 this.active = false; 9588 this.hide(); 9589 } 9590 this.oldElementValue = this.element.value; 9591 }, 9592 9593 getToken: function() { 9594 var bounds = this.getTokenBounds(); 9595 return this.element.value.substring(bounds[0], bounds[1]).strip(); 9596 }, 9597 9598 getTokenBounds: function() { 9599 if (null != this.tokenBounds) return this.tokenBounds; 9600 var value = this.element.value; 9601 if (value.strip().empty()) return [-1, 0]; 9602 var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue); 9603 var offset = (diff == this.oldElementValue.length ? 1 : 0); 9604 var prevTokenPos = -1, nextTokenPos = value.length; 9605 var tp; 9606 for (var index = 0, l = this.options.tokens.length; index < l; ++index) { 9607 tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1); 9608 if (tp > prevTokenPos) prevTokenPos = tp; 9609 tp = value.indexOf(this.options.tokens[index], diff + offset); 9610 if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp; 9611 } 9612 return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); 9613 } 9614}); 9615 9616Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { 9617 var boundary = Math.min(newS.length, oldS.length); 9618 for (var index = 0; index < boundary; ++index) 9619 if (newS[index] != oldS[index]) 9620 return index; 9621 return boundary; 9622}; 9623 9624Ajax.Autocompleter = Class.create(Autocompleter.Base, { 9625 initialize: function(element, update, url, options) { 9626 this.baseInitialize(element, update, options); 9627 this.options.asynchronous = true; 9628 this.options.onComplete = this.onComplete.bind(this); 9629 this.options.defaultParams = this.options.parameters || null; 9630 this.url = url; 9631 }, 9632 9633 getUpdatedChoices: function() { 9634 this.startIndicator(); 9635 9636 var entry = encodeURIComponent(this.options.paramName) + '=' + 9637 encodeURIComponent(this.getToken()); 9638 9639 this.options.parameters = this.options.callback ? 9640 this.options.callback(this.element, entry) : entry; 9641 9642 if(this.options.defaultParams) 9643 this.options.parameters += '&' + this.options.defaultParams; 9644 9645 new Ajax.Request(this.url, this.options); 9646 }, 9647 9648 onComplete: function(request) { 9649 this.updateChoices(request.responseText); 9650 } 9651}); 9652 9653// The local array autocompleter. Used when you'd prefer to 9654// inject an array of autocompletion options into the page, rather 9655// than sending out Ajax queries, which can be quite slow sometimes. 9656// 9657// The constructor takes four parameters. The first two are, as usual, 9658// the id of the monitored textbox, and id of the autocompletion menu. 9659// The third is the array you want to autocomplete from, and the fourth 9660// is the options block. 9661// 9662// Extra local autocompletion options: 9663// - choices - How many autocompletion choices to offer 9664//
9665// - partialSearch - If false, the autocompleter will match entered 9666// text only at the beginning of strings in the 9667// autocomplete array. Defaults to true, which will 9668// match text at the beginning of any *word* in the 9669// strings in the autocomplete array. If you want to 9670// search anywhere in the string, additionally set 9671// the option fullSearch to true (default: off). 9672// 9673// - fullSsearch - Search anywhere in autocomplete array strings. 9674// 9675// - partialChars - How many characters to enter before triggering 9676// a partial match (unlike minChars, which defines 9677// how many characters are required to do any match 9678// at all). Defaults to 2. 9679// 9680// - ignoreCase - Whether to ignore case when autocompleting. 9681// Defaults to true. 9682// 9683// It's possible to pass in a custom function as the 'selector' 9684// option, if you prefer to write your own autocompletion logic. 9685// In that case, the other options above will not apply unless 9686// you support them. 9687 9688Autocompleter.Local = Class.create(Autocompleter.Base, { 9689 initialize: function(element, update, array, options) { 9690 this.baseInitialize(element, update, options); 9691 this.options.array = array; 9692 }, 9693 9694 getUpdatedChoices: function() { 9695 this.updateChoices(this.options.selector(this)); 9696 }, 9697 9698 setOptions: function(options) { 9699 this.options = Object.extend({ 9700 choices: 10, 9701 partialSearch: true, 9702 partialChars: 2, 9703 ignoreCase: true, 9704 fullSearch: false, 9705 selector: function(instance) { 9706 var ret = []; // Beginning matches 9707 var partial = []; // Inside matches 9708 var entry = instance.getToken(); 9709 var count = 0; 9710 9711 for (var i = 0; i < instance.options.array.length && 9712 ret.length < instance.options.choices ; i++) { 9713 9714 var elem = instance.options.array[i]; 9715 var foundPos = instance.options.ignoreCase ? 9716 elem.toLowerCase().indexOf(entry.toLowerCase()) : 9717 elem.indexOf(entry); 9718 9719 while (foundPos != -1) { 9720 if (foundPos == 0 && elem.length != entry.length) { 9721 ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" + 9722 elem.substr(entry.length) + "</li>"); 9723 break; 9724 } else if (entry.length >= instance.options.partialChars && 9725 instance.options.partialSearch && foundPos != -1) { 9726 if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { 9727 partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" + 9728 elem.substr(foundPos, entry.length) + "</strong>" + elem.substr( 9729 foundPos + entry.length) + "</li>"); 9730 break; 9731 } 9732 } 9733 9734 foundPos = instance.options.ignoreCase ? 9735 elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : 9736 elem.indexOf(entry, foundPos + 1); 9737 9738 } 9739 } 9740 if (partial.length) 9741 ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)); 9742 return "<ul>" + ret.join('') + "</ul>"; 9743 } 9744 }, options || { }); 9745 } 9746}); 9747 9748// AJAX in-place editor and collection editor 9749// Full rewrite by Christophe Porteneuve <[email protected]> (April 2007). 9750 9751// Use this if you notice weird scrolling problems on some browsers, 9752// the DOM might be a bit confused when this gets called so do this 9753// waits 1 ms (with setTimeout) until it does the activation 9754Field.scrollFreeActivate = function(field) { 9755 setTimeout(function() { 9756 Field.activate(field); 9757 }, 1); 9758}; 9759 9760Ajax.InPlaceEditor = Class.create({ 9761 initialize: function(element, url, options) { 9762 this.url = url; 9763 this.element = element = $(element); 9764 this.prepareOptions(); 9765 this._controls = { }; 9766 arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!! 9767 Object.extend(this.options, options || { });
9768 if (!this.options.formId && this.element.id) { 9769 this.options.formId = this.element.id + '-inplaceeditor'; 9770 if ($(this.options.formId)) 9771 this.options.formId = ''; 9772 } 9773 if (this.options.externalControl) 9774 this.options.externalControl = $(this.options.externalControl); 9775 if (!this.options.externalControl) 9776 this.options.externalControlOnly = false; 9777 this._originalBackground = this.element.getStyle('background-color') || 'transparent'; 9778 this.element.title = this.options.clickToEditText; 9779 this._boundCancelHandler = this.handleFormCancellation.bind(this); 9780 this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this); 9781 this._boundFailureHandler = this.handleAJAXFailure.bind(this); 9782 this._boundSubmitHandler = this.handleFormSubmission.bind(this); 9783 this._boundWrapperHandler = this.wrapUp.bind(this); 9784 this.registerListeners(); 9785 }, 9786 checkForEscapeOrReturn: function(e) { 9787 if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; 9788 if (Event.KEY_ESC == e.keyCode) 9789 this.handleFormCancellation(e); 9790 else if (Event.KEY_RETURN == e.keyCode) 9791 this.handleFormSubmission(e); 9792 }, 9793 createControl: function(mode, handler, extraClasses) { 9794 var control = this.options[mode + 'Control']; 9795 var text = this.options[mode + 'Text']; 9796 if ('button' == control) { 9797 var btn = document.createElement('input'); 9798 btn.type = 'submit'; 9799 btn.value = text; 9800 btn.className = 'editor_' + mode + '_button'; 9801 if ('cancel' == mode) 9802 btn.onclick = this._boundCancelHandler; 9803 this._form.appendChild(btn); 9804 this._controls[mode] = btn; 9805 } else if ('link' == control) { 9806 var link = document.createElement('a'); 9807 link.href = '#'; 9808 link.appendChild(document.createTextNode(text)); 9809 link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler; 9810 link.className = 'editor_' + mode + '_link'; 9811 if (extraClasses) 9812 link.className += ' ' + extraClasses; 9813 this._form.appendChild(link); 9814 this._controls[mode] = link; 9815 } 9816 }, 9817 createEditField: function() { 9818 var text = (this.options.loadTextURL ? this.options.loadingText : this.getText()); 9819 var fld; 9820 if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) { 9821 fld = document.createElement('input'); 9822 fld.type = 'text'; 9823 var size = this.options.size || this.options.cols || 0; 9824 if (0 < size) fld.size = size; 9825 } else { 9826 fld = document.createElement('textarea'); 9827 fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows); 9828 fld.cols = this.options.cols || 40; 9829 } 9830 fld.name = this.options.paramName; 9831 fld.value = text; // No HTML breaks conversion anymore 9832 fld.className = 'editor_field'; 9833 if (this.options.submitOnBlur) 9834 fld.onblur = this._boundSubmitHandler; 9835 this._controls.editor = fld; 9836 if (this.options.loadTextURL) 9837 this.loadExternalText(); 9838 this._form.appendChild(this._controls.editor); 9839 }, 9840 createForm: function() { 9841 var ipe = this; 9842 function addText(mode, condition) { 9843 var text = ipe.options['text' + mode + 'Controls']; 9844 if (!text || condition === false) return; 9845 ipe._form.appendChild(document.createTextNode(text)); 9846 }; 9847 this._form = $(document.createElement('form')); 9848 this._form.id = this.options.formId; 9849 this._form.addClassName(this.options.formClassName); 9850 this._form.onsubmit = this._boundSubmitHandler; 9851 this.createEditField(); 9852 if ('textarea' == this._controls.editor.tagName.toLowerCase()) 9853 this._form.appendChild(document.createElement('br')); 9854 if (this.options.onFormCustomization) 9855 this.options.onFormCustomization(this, this._form); 9856 addText('Before', this.options.okControl || this.options.cancelControl); 9857 this.createControl('ok', this._boundSubmitHandler); 9858 addText('Between', this.options.okControl && this.options.cancelControl); 9859 this.createControl('cancel', this._boundCancelHandler, 'editor_cancel'); 9860 addText('After', this.options.okControl || this.options.cancelControl); 9861 }, 9862 destroy: function() { 9863 if (this._oldInnerHTML) 9864 this.element.innerHTML = this._oldInnerHTML; 9865 this.leaveEditMode(); 9866 this.unregisterListeners(); 9867 }, 9868 enterEditMode: function(e) { 9869 if (this._saving || this._editing) return; 9870 this._editing = true; 9871 this.triggerCallback('onEnterEditMode'); 9872 if (this.options.externalControl) 9873 this.options.externalControl.hide(); 9874 this.element.hide(); 9875 this.createForm(); 9876 this.element.parentNode.insertBefore(this._form, this.element); 9877 if (!this.options.loadTextURL) 9878 this.postProcessEditField();
9879 if (e) Event.stop(e); 9880 }, 9881 enterHover: function(e) { 9882 if (this.options.hoverClassName) 9883 this.element.addClassName(this.options.hoverClassName); 9884 if (this._saving) return; 9885 this.triggerCallback('onEnterHover'); 9886 }, 9887 getText: function() { 9888 return this.element.innerHTML.unescapeHTML(); 9889 }, 9890 handleAJAXFailure: function(transport) { 9891 this.triggerCallback('onFailure', transport); 9892 if (this._oldInnerHTML) { 9893 this.element.innerHTML = this._oldInnerHTML; 9894 this._oldInnerHTML = null; 9895 } 9896 }, 9897 handleFormCancellation: function(e) { 9898 this.wrapUp(); 9899 if (e) Event.stop(e); 9900 }, 9901 handleFormSubmission: function(e) { 9902 var form = this._form; 9903 var value = $F(this._controls.editor); 9904 this.prepareSubmission(); 9905 var params = this.options.callback(form, value) || ''; 9906 if (Object.isString(params)) 9907 params = params.toQueryParams(); 9908 params.editorId = this.element.id; 9909 if (this.options.htmlResponse) { 9910 var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); 9911 Object.extend(options, { 9912 parameters: params, 9913 onComplete: this._boundWrapperHandler, 9914 onFailure: this._boundFailureHandler 9915 }); 9916 new Ajax.Updater({ success: this.element }, this.url, options); 9917 } else { 9918 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 9919 Object.extend(options, { 9920 parameters: params, 9921 onComplete: this._boundWrapperHandler, 9922 onFailure: this._boundFailureHandler 9923 }); 9924 new Ajax.Request(this.url, options); 9925 } 9926 if (e) Event.stop(e); 9927 }, 9928 leaveEditMode: function() { 9929 this.element.removeClassName(this.options.savingClassName); 9930 this.removeForm(); 9931 this.leaveHover(); 9932 this.element.style.backgroundColor = this._originalBackground; 9933 this.element.show(); 9934 if (this.options.externalControl) 9935 this.options.externalControl.show(); 9936 this._saving = false; 9937 this._editing = false; 9938 this._oldInnerHTML = null; 9939 this.triggerCallback('onLeaveEditMode'); 9940 }, 9941 leaveHover: function(e) { 9942 if (this.options.hoverClassName) 9943 this.element.removeClassName(this.options.hoverClassName); 9944 if (this._saving) return; 9945 this.triggerCallback('onLeaveHover'); 9946 }, 9947 loadExternalText: function() { 9948 this._form.addClassName(this.options.loadingClassName); 9949 this._controls.editor.disabled = true; 9950 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 9951 Object.extend(options, { 9952 parameters: 'editorId=' + encodeURIComponent(this.element.id), 9953 onComplete: Prototype.emptyFunction, 9954 onSuccess: function(transport) { 9955 this._form.removeClassName(this.options.loadingClassName); 9956 var text = transport.responseText; 9957 if (this.options.stripLoadedTextTags) 9958 text = text.stripTags(); 9959 this._controls.editor.value = text; 9960 this._controls.editor.disabled = false; 9961 this.postProcessEditField(); 9962 }.bind(this), 9963 onFailure: this._boundFailureHandler 9964 }); 9965 new Ajax.Request(this.options.loadTextURL, options); 9966 }, 9967 postProcessEditField: function() { 9968 var fpc = this.options.fieldPostCreation; 9969 if (fpc) 9970 $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate'](); 9971 }, 9972 prepareOptions: function() { 9973 this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions); 9974 Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks); 9975 [this._extraDefaultOptions].flatten().compact().each(function(defs) { 9976 Object.extend(this.options, defs); 9977 }.bind(this)); 9978 }, 9979 prepareSubmission: function() { 9980 this._saving = true; 9981 this.removeForm(); 9982 this.leaveHover(); 9983 this.showSaving(); 9984 }, 9985 registerListeners: function() { 9986 this._listeners = { }; 9987 var listener; 9988 $H(Ajax.InPlaceEditor.Listeners).each(function(pair) { 9989 listener = this[pair.value].bind(this); 9990 this._listeners[pair.key] = listener; 9991 if (!this.options.externalControlOnly) 9992 this.element.observe(pair.key, listener); 9993 if (this.options.externalControl) 9994 this.options.externalControl.observe(pair.key, listener); 9995 }.bind(this)); 9996 }, 9997 removeForm: function() { 9998 if (!this._form) return; 9999 this._form.remove(); 10000 this._form = null; 10001 this._controls = { }; 10002 }, 10003 showSaving: function() { 10004 this._oldInnerHTML = this.element.innerHTML; 10005 this.element.innerHTML = this.options.savingText; 10006 this.element.addClassName(this.options.savingClassName); 10007 this.element.style.backgroundColor = this._originalBackgroun
10007d; 10008 this.element.show(); 10009 }, 10010 triggerCallback: function(cbName, arg) { 10011 if ('function' == typeof this.options[cbName]) { 10012 this.options[cbName](this, arg); 10013 } 10014 }, 10015 unregisterListeners: function() { 10016 $H(this._listeners).each(function(pair) { 10017 if (!this.options.externalControlOnly) 10018 this.element.stopObserving(pair.key, pair.value); 10019 if (this.options.externalControl) 10020 this.options.externalControl.stopObserving(pair.key, pair.value); 10021 }.bind(this)); 10022 }, 10023 wrapUp: function(transport) { 10024 this.leaveEditMode(); 10025 // Can't use triggerCallback due to backward compatibility: requires 10026 // binding + direct element 10027 this._boundComplete(transport, this.element); 10028 } 10029}); 10030 10031Object.extend(Ajax.InPlaceEditor.prototype, { 10032 dispose: Ajax.InPlaceEditor.prototype.destroy 10033}); 10034 10035Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, { 10036 initialize: function($super, element, url, options) { 10037 this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; 10038 $super(element, url, options); 10039 }, 10040 10041 createEditField: function() { 10042 var list = document.createElement('select'); 10043 list.name = this.options.paramName; 10044 list.size = 1; 10045 this._controls.editor = list; 10046 this._collection = this.options.collection || []; 10047 if (this.options.loadCollectionURL) 10048 this.loadCollection(); 10049 else 10050 this.checkForExternalText(); 10051 this._form.appendChild(this._controls.editor); 10052 }, 10053 10054 loadCollection: function() { 10055 this._form.addClassName(this.options.loadingClassName); 10056 this.showLoadingText(this.options.loadingCollectionText); 10057 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 10058 Object.extend(options, { 10059 parameters: 'editorId=' + encodeURIComponent(this.element.id), 10060 onComplete: Prototype.emptyFunction, 10061 onSuccess: function(transport) { 10062 var js = transport.responseText.strip(); 10063 if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check 10064 throw('Server returned an invalid collection representation.'); 10065 this._collection = eval(js); 10066 this.checkForExternalText(); 10067 }.bind(this), 10068 onFailure: this.onFailure 10069 }); 10070 new Ajax.Request(this.options.loadCollectionURL, options); 10071 }, 10072 10073 showLoadingText: function(text) { 10074 this._controls.editor.disabled = true; 10075 var tempOption = this._controls.editor.firstChild; 10076 if (!tempOption) { 10077 tempOption = document.createElement('option'); 10078 tempOption.value = ''; 10079 this._controls.editor.appendChild(tempOption); 10080 tempOption.selected = true; 10081 } 10082 tempOption.update((text || '').stripScripts().stripTags()); 10083 }, 10084 10085 checkForExternalText: function() { 10086 this._text = this.getText(); 10087 if (this.options.loadTextURL) 10088 this.loadExternalText(); 10089 else 10090 this.buildOptionList(); 10091 }, 10092 10093 loadExternalText: function() { 10094 this.showLoadingText(this.options.loadingText); 10095 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 10096 Object.extend(options, { 10097 parameters: 'editorId=' + encodeURIComponent(this.element.id), 10098 onComplete: Prototype.emptyFunction, 10099 onSuccess: function(transport) { 10100 this._text = transport.responseText.strip(); 10101 this.buildOptionList(); 10102 }.bind(this), 10103 onFailure: this.onFailure 10104 }); 10105 new Ajax.Request(this.options.loadTextURL, options); 10106 }, 10107 10108 buildOptionList: function() { 10109 this._form.removeClassName(this.options.loadingClassName); 10110 this._collection = this._collection.map(function(entry) { 10111 return 2 === entry.length ? entry : [entry, entry].flatten(); 10112 }); 10113 var marker = ('value' in this.options) ? this.options.value : this._text; 10114 var textFound = this._collection.any(function(entry) { 10115 return entry[0] == marker; 10116 }.bind(this)); 10117 this._controls.editor.update(''); 10118 var option; 10119 this._collection.each(function(entry, index) { 10120 option = document.createElement('option'); 10121 option.value = entry[0]; 10122 option.selected = textFound ? entry[0] == marker : 0 == index; 10123 option.appendChild(document.createTextNode(entry[1])); 10124 this._controls.editor.appendChild(option); 10125 }.bind(this)); 10126 this._controls.editor.disabled = false;
10127 Field.scrollFreeActivate(this._controls.editor); 10128 } 10129}); 10130 10131//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! **** 10132//**** This only exists for a while, in order to let **** 10133//**** users adapt to the new API. Read up on the new **** 10134//**** API and convert your code to it ASAP! **** 10135 10136Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) { 10137 if (!options) return; 10138 function fallback(name, expr) { 10139 if (name in options || expr === undefined) return; 10140 options[name] = expr; 10141 }; 10142 fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' : 10143 options.cancelLink == options.cancelButton == false ? false : undefined))); 10144 fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' : 10145 options.okLink == options.okButton == false ? false : undefined))); 10146 fallback('highlightColor', options.highlightcolor); 10147 fallback('highlightEndColor', options.highlightendcolor); 10148}; 10149 10150Object.extend(Ajax.InPlaceEditor, { 10151 DefaultOptions: { 10152 ajaxOptions: { }, 10153 autoRows: 3, // Use when multi-line w/ rows == 1 10154 cancelControl: 'link', // 'link'|'button'|false 10155 cancelText: 'cancel', 10156 clickToEditText: 'Click to edit', 10157 externalControl: null, // id|elt 10158 externalControlOnly: false, 10159 fieldPostCreation: 'activate', // 'activate'|'focus'|false 10160 formClassName: 'inplaceeditor-form', 10161 formId: null, // id|elt 10162 highlightColor: '#ffff99', 10163 highlightEndColor: '#ffffff', 10164 hoverClassName: '', 10165 htmlResponse: true, 10166 loadingClassName: 'inplaceeditor-loading', 10167 loadingText: 'Loading...', 10168 okControl: 'button', // 'link'|'button'|false 10169 okText: 'ok', 10170 paramName: 'value', 10171 rows: 1, // If 1 and multi-line, uses autoRows 10172 savingClassName: 'inplaceeditor-saving', 10173 savingText: 'Saving...', 10174 size: 0, 10175 stripLoadedTextTags: false, 10176 submitOnBlur: false, 10177 textAfterControls: '', 10178 textBeforeControls: '', 10179 textBetweenControls: '' 10180 }, 10181 DefaultCallbacks: { 10182 callback: function(form) { 10183 return Form.serialize(form); 10184 }, 10185 onComplete: function(transport, element) { 10186 // For backward compatibility, this one is bound to the IPE, and passes 10187 // the element directly. It was too often customized, so we don't break it. 10188 new Effect.Highlight(element, { 10189 startcolor: this.options.highlightColor, keepBackgroundImage: true }); 10190 }, 10191 onEnterEditMode: null, 10192 onEnterHover: function(ipe) { 10193 ipe.element.style.backgroundColor = ipe.options.highlightColor; 10194 if (ipe._effect) 10195 ipe._effect.cancel(); 10196 }, 10197 onFailure: function(transport, ipe) { 10198 alert('Error communication with the server: ' + transport.responseText.stripTags()); 10199 }, 10200 onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. 10201 onLeaveEditMode: null, 10202 onLeaveHover: function(ipe) { 10203 ipe._effect = new Effect.Highlight(ipe.element, { 10204 startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, 10205 restorecolor: ipe._originalBackground, keepBackgroundImage: true 10206 }); 10207 } 10208 }, 10209 Listeners: { 10210 click: 'enterEditMode', 10211 keydown: 'checkForEscapeOrReturn', 10212 mouseover: 'enterHover', 10213 mouseout: 'leaveHover' 10214 } 10215}); 10216 10217Ajax.InPlaceCollectionEditor.DefaultOptions = { 10218 loadingCollectionText: 'Loading options...' 10219}; 10220 10221// Delayed observer, like Form.Element.Observer, 10222// but waits for delay after last key input 10223// Ideal for live-search fields 10224 10225Form.Element.DelayedObserver = Class.create({ 10226 initialize: function(element, delay, callback) { 10227 this.delay = delay || 0.5; 10228 this.element = $(element); 10229 this.callback = callback; 10230 this.timer = null; 10231 this.lastValue = $F(this.element); 10232 Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); 10233 }, 10234 delayedListener: function(event) { 10235 if(this.lastValue == $F(this.element)) return; 10236 if(this.timer) clearTimeout(this.timer); 10237 this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); 10238 this.lastValue = $F(this.element); 10239 },
10240 onTimerEvent: function() { 10241 this.timer = null; 10242 this.callback(this.element, $F(this.element)); 10243 } 10244}); 10245// script.aculo.us slider.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 10246 10247// Copyright (c) 2005-2008 Marty Haught, Thomas Fuchs 10248// 10249// script.aculo.us is freely distributable under the terms of an MIT-style license. 10250// For details, see the script.aculo.us web site: http://script.aculo.us/ 10251 10252if (!Control) var Control = { }; 10253 10254// options: 10255// axis: 'vertical', or 'horizontal' (default) 10256// 10257// callbacks: 10258// onChange(value) 10259// onSlide(value) 10260Control.Slider = Class.create({ 10261 initialize: function(handle, track, options) { 10262 var slider = this; 10263 10264 if (Object.isArray(handle)) { 10265 this.handles = handle.collect( function(e) { return $(e) }); 10266 } else { 10267 this.handles = [$(handle)]; 10268 } 10269 10270 this.track = $(track); 10271 this.options = options || { }; 10272 10273 this.axis = this.options.axis || 'horizontal'; 10274 this.increment = this.options.increment || 1; 10275 this.step = parseInt(this.options.step || '1'); 10276 this.range = this.options.range || $R(0,1); 10277 10278 this.value = 0; // assure backwards compat 10279 this.values = this.handles.map( function() { return 0 }); 10280 this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false; 10281 this.options.startSpan = $(this.options.startSpan || null); 10282 this.options.endSpan = $(this.options.endSpan || null); 10283 10284 this.restricted = this.options.restricted || false; 10285 10286 this.maximum = this.options.maximum || this.range.end; 10287 this.minimum = this.options.minimum || this.range.start; 10288 10289 // Will be used to align the handle onto the track, if necessary 10290 this.alignX = parseInt(this.options.alignX || '0'); 10291 this.alignY = parseInt(this.options.alignY || '0'); 10292 10293 this.trackLength = this.maximumOffset() - this.minimumOffset(); 10294 10295 this.handleLength = this.isVertical() ? 10296 (this.handles[0].offsetHeight != 0 ? 10297 this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : 10298 (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : 10299 this.handles[0].style.width.replace(/px$/,"")); 10300 10301 this.active = false; 10302 this.dragging = false; 10303 this.disabled = false; 10304 10305 if (this.options.disabled) this.setDisabled(); 10306 10307 // Allowed values array 10308 this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false; 10309 if (this.allowedValues) { 10310 this.minimum = this.allowedValues.min(); 10311 this.maximum = this.allowedValues.max(); 10312 } 10313 10314 this.eventMouseDown = this.startDrag.bindAsEventListener(this); 10315 this.eventMouseUp = this.endDrag.bindAsEventListener(this); 10316 this.eventMouseMove = this.update.bindAsEventListener(this); 10317 10318 // Initialize handles in reverse (make sure first handle is active) 10319 this.handles.each( function(h,i) { 10320 i = slider.handles.length-1-i; 10321 slider.setValue(parseFloat( 10322 (Object.isArray(slider.options.sliderValue) ? 10323 slider.options.sliderValue[i] : slider.options.sliderValue) || 10324 slider.range.start), i); 10325 h.makePositioned().observe("mousedown", slider.eventMouseDown); 10326 }); 10327 10328 this.track.observe("mousedown", this.eventMouseDown); 10329 document.observe("mouseup", this.eventMouseUp); 10330 $(this.track.parentNode.parentNode).observe("mousemove", this.eventMouseMove); 10331 10332 10333 this.initialized = true; 10334 }, 10335 dispose: function() { 10336 var slider = this; 10337 Event.stopObserving(this.track, "mousedown", this.eventMouseDown); 10338 Event.stopObserving(document, "mouseup", this.eventMouseUp); 10339 Event.stopObserving(this.track.parentNode.parentNode, "mousemove", this.eventMouseMove); 10340 this.handles.each( function(h) { 10341 Event.stopObserving(h, "mousedown", slider.eventMouseDown); 10342 }); 10343 }, 10344 setDisabled: function(){ 10345 this.disabled = true; 10346 this.track.parentNode.className = this.track.parentNode.className + ' disabled'; 10347 }, 10348 setEnabled: function(){ 10349 this.disabled = false; 10350 }, 10351 getNearestValue: function(value){ 10352 if (this.allowedValues){ 10353 if (value >= this.allowedValues.max()) return(this.allowedValues.max()); 10354 if (value <= this.allowedValues.min()) return(this.allowedValues.min()); 10355 10356 var offset = Math.abs(this.allowedValues[0] - value); 10357 var newValue = this.allowedValues[0]; 10358 this.allowedValues.each( function(v) { 10359 var currentOffset = Math.abs(v - value); 10360 if (currentOffset <= offset){ 10361 newValue = v; 10362 offset = currentOffset; 10363 } 10364 }); 10365 return newValue; 10366 } 10367 if (value > this.range.end) return this.range.end; 10368 if (value < this.range.start) return this.range.start; 10369 return value; 10370 }, 10371 setValue: function(sliderValue, handleIdx){ 10372 if (!this.active) { 10373 this.activeHandleIdx = handleIdx || 0; 10374 this.activeHandle = this.handles[this.activeHandleIdx]; 10375 this.updateStyles(); 10376 } 10377 handleIdx = handleIdx || this.activeHandleIdx || 0; 10378 if (this.initialized && this.restricted) { 10379 if ((handleIdx>0) && (sliderValue<this.values[handleIdx-1])) 10380 sliderValue = this.values[handleIdx-1]; 10381 if ((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1])) 10382 sliderValue = this.values[handleIdx+1]; 10383 } 10384 sliderValue = this.getNearestValue(sliderValue); 10385 this.values[handleIdx] = sliderValue; 10386 this.value = this.values[0]; // assure backwards compat 10387 10388 this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = 10389 this.translateToPx(sliderValue); 10390 10391 this.drawSpans(); 10392 if (!this.dragging || !this.event) this.updateFinished(); 10393 }, 10394 setValueBy: function(delta, handleIdx) { 10395 this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, 10396 handleIdx || this.activeHandleIdx || 0); 10397 }, 10398 translateToPx: function(value) { 10399 return Math.round( 10400 ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * 10401 (value - this.range.start)) + "px"; 10402 }, 10403 translateToValue: function(offset) { 10404 return ((offset/(this.trackLength-this.handleLength) * 10405 (this.range.end-this.range.start)) + this.range.start); 10406 }, 10407 getRange: function(range) { 10408 var v = this.values.sortBy(Prototype.K); 10409 range = range || 0; 10410 return $R(v[range],v[range+1]); 10411 }, 10412 minimumOffset: function(){ 10413 return(this.isVertical() ? this.alignY : this.alignX); 10414 }, 10415 maximumOffset: function(){ 10416 return(this.isVertical() ? 10417 (this.track.offsetHeight != 0 ? this.track.offsetHeight : 10418 this.track.style.height.replace(/px$/,"")) - this.alignY : 10419 (this.track.offsetWidth != 0 ? this.track.offsetWidth : 10420 this.track.style.width.replace(/px$/,"")) - this.alignX); 10421 }, 10422 isVertical: function(){ 10423 return (this.axis == 'vertical'); 10424 }, 10425 drawSpans: function() { 10426 var slider = this; 10427 if (this.spans) 10428 $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) }); 10429 if (this.options.startSpan) 10430 this.setSpan(this.options.startSpan, 10431 $R(0, this.values.length>1 ? this.getRange(0).min() : this.value )); 10432 if (this.options.endSpan) 10433 this.setSpan(this.options.endSpan, 10434 $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum)); 10435 }, 10436 setSpan: function(span, range) { 10437 if (this.isVertical()) { 10438 span.style.top = this.translateToPx(range.start); 10439 span.style.height = this.translateToPx(range.end - range.start + this.range.start); 10440 } else { 10441 span.style.left = this.translateToPx(range.start); 10442 span.style.width = this.translateToPx(range.end - range.start + this.range.start); 10443 } 10444 }, 10445 updateStyles: function() { 10446 this.handles.each( function(h){ Element.removeClassName(h, 'selected') }); 10447 Element.addClassName(this.activeHandle, 'selected'); 10448 }, 10449 startDrag: function(event) { 10450 if (Event.isLeftClick(event)) { 10451 if (!this.disabled){ 10452 this.active = true; 10453 10454 var handle = Event.element(event); 10455 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 10456 var track = handle; 10457 if (track==this.track) { 10458 var offsets = Position.cumulativeOffset(this.track); 10459 this.event = event; 10460 this.setValue(this.translateToValue( 10461 (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) 10462 )); 10463 var offsets = Position.cumulativeOffset(this.activeHandle); 10464 this.offsetX = (pointer[0] - offsets[0]); 10465 this.offsetY = (pointer[1] - offsets[1]); 10466 } else { 10467 // find the handle (prevents issues with Safari) 10468 while((this.handles.indexOf(handle) == -1) && handle.parentNode) 10469 handle = handle.parentNode; 10470 10471 if (this.handles.indexOf(handle)!=-1) { 10472 this.activeHandle = handle; 10473 this.activeHandleIdx = this.handles.indexOf(this.activeHandle); 10474 this.updateStyles(); 10475 10476 var offsets = Position.cumulativeOffset(this.activeHandle); 10477 this.offsetX = (pointer[0] - offsets[0]); 10478 this.offsetY = (pointer[1] - offsets[1]); 10479 } 10480 } 10481 } 10482 Event.stop(event); 10483 } 10484 }, 10485 update: function(event) { 10486 if (this.active) { 10487 if (!this.dragging) this.dragging = true; 10488 this.draw(event); 10489 if (Prototype.Browser.WebKit) window.scrollBy(0,0); 10490 Event.stop(event); 10491 } 10492 }, 10493 draw: function(event) { 10494 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 10495 var offsets = Position.cumulativeOffset(this.track); 10496 pointer[0] -= this.offsetX + offsets[0]; 10497 pointer[1] -= this.offsetY + offsets[1]; 10498 this.event = event; 10499 this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] )); 10500 if (this.initialized && this.options.onSlide) 10501 this.options.onSlide(this.values.length>1 ? this.values : this.value, this); 10502 }, 10503 endDrag: function(event) { 10504 if (this.active && this.dragging) { 10505 this.finishDrag(event, true); 10506 Event.stop(event); 10507 } 10508 this.active = false;
10509 this.dragging = false; 10510 }, 10511 finishDrag: function(event, success) { 10512 this.active = false; 10513 this.dragging = false; 10514 this.updateFinished(); 10515 }, 10516 updateFinished: function() { 10517 if (this.initialized && this.options.onChange) 10518 this.options.onChange(this.values.length>1 ? this.values : this.value, this); 10519 this.event = null; 10520 } 10521}); 10522/** 10523 * Magento 10524 * 10525 * NOTICE OF LICENSE 10526 * 10527 * This source file is subject to the Academic Free License (AFL 3.0) 10528 * that is bundled with this package in the file LICENSE_AFL.txt. 10529 * It is also available through the world-wide-web at this URL: 10530 * http://opensource.org/licenses/afl-3.0.php 10531 * If you did not receive a copy of the license and are unable to 10532 * obtain it through the world-wide-web, please send an email 10533 * to [email protected] so we can send you a copy immediately. 10534 * 10535 * DISCLAIMER 10536 * 10537 * Do not edit or add to this file if you wish to upgrade Magento to newer 10538 * versions in the future. If you wish to customize Magento for your 10539 * needs please refer to http://www.magento.com for more information. 10540 * 10541 * @category Varien 10542 * @package js 10543 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 10544 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 10545 */ 10546function popWin(url,win,para) { 10547 var win = window.open(url,win,para); 10548 win.focus(); 10549} 10550 10551function setLocation(url){ 10552 window.location.href = encodeURI(url); 10553} 10554 10555function setPLocation(url, setFocus){ 10556 if( setFocus ) { 10557 window.opener.focus(); 10558 } 10559 window.opener.location.href = encodeURI(url); 10560} 10561 10562/** 10563 * @deprecated 10564 */ 10565function setLanguageCode(code, fromCode){ 10566 //TODO: javascript cookies have different domain and path than php cookies 10567 var href = window.location.href; 10568 var after = '', dash; 10569 if (dash = href.match(/\#(.*)$/)) { 10570 href = href.replace(/\#(.*)$/, ''); 10571 after = dash[0]; 10572 } 10573 10574 if (href.match(/[?]/)) { 10575 var re = /([?&]store=)[a-z0-9_]*/; 10576 if (href.match(re)) { 10577 href = href.replace(re, '$1'+code); 10578 } else { 10579 href += '&store='+code; 10580 } 10581 10582 var re = /([?&]from_store=)[a-z0-9_]*/; 10583 if (href.match(re)) { 10584 href = href.replace(re, ''); 10585 } 10586 } else { 10587 href += '?store='+code; 10588 } 10589 if (typeof(fromCode) != 'undefined') { 10590 href += '&from_store='+fromCode; 10591 } 10592 href += after; 10593 10594 setLocation(href); 10595} 10596 10597/** 10598 * Add classes to specified elements. 10599 * Supported classes are: 'odd', 'even', 'first', 'last' 10600 * 10601 * @param elements - array of elements to be decorated 10602 * [@param decorateParams] - array of classes to be set. If omitted, all available will be used 10603 */ 10604function decorateGeneric(elements, decorateParams) 10605{ 10606 var allSupportedParams = ['odd', 'even', 'first', 'last']; 10607 var _decorateParams = {}; 10608 var total = elements.length; 10609 10610 if (total) { 10611 // determine params called 10612 if (typeof(decorateParams) == 'undefined') { 10613 decorateParams = allSupportedParams; 10614 } 10615 if (!decorateParams.length) { 10616 return; 10617 } 10618 for (var k in allSupportedParams) { 10619 _decorateParams[allSupportedParams[k]] = false; 10620 } 10621 for (var k in decorateParams) { 10622 _decorateParams[decorateParams[k]] = true; 10623 } 10624 10625 // decorate elements 10626 // elements[0].addClassName('first'); // will cause bug in IE (#5587) 10627 if (_decorateParams.first) { 10628 Element.addClassName(elements[0], 'first'); 10629 } 10630 if (_decorateParams.last) { 10631 Element.addClassName(elements[total-1], 'last'); 10632 } 10633 for (var i = 0; i < total; i++) { 10634 if ((i + 1) % 2 == 0) { 10635 if (_decorateParams.even) { 10636 Element.addClassName(elements[i], 'even'); 10637 } 10638 } 10639 else { 10640 if (_decorateParams.odd) { 10641 Element.addClassName(elements[i], 'odd'); 10642 } 10643 } 10644 } 10645 } 10646} 10647 10648/** 10649 * Decorate table rows and cells, tbody etc 10650 * @see decorateGeneric() 10651 */ 10652function decorateTable(table, options) { 10653 var table = $(table); 10654 if (table) { 10655 // set default options 10656 var _options = { 10657 'tbody' : false, 10658 'tbody tr' : ['odd', 'even', 'first', 'last'], 10659 'thead tr' : ['first', 'last'], 10660 'tfoot tr' : ['first', 'last'], 10661 'tr td' : ['last'] 10662 }; 10663 // overload options 10664 if (typeof(options) != 'undefined') { 10665 for (var k in options) { 10666 _options[k] = options[k]; 10667 } 10668 } 10669 // decorate 10670 if (_options['tbody']) { 10671 decorateGeneric(table.select('tbody'), _options['tbody']); 10672 } 10673 if (_options['tbody tr']) { 10674 decorateGeneric(table.select('tbody tr'), _options['tbody tr']); 10675 } 10676 if (_options['thead tr']) { 10677 decorateGeneric(table.select('thead tr'), _options['thead tr']); 10678 } 10679 if (_options['tfoot tr']) { 10680 decorateGeneric(table.select('tfoot tr'), _options['tfoot tr']); 10681 } 10682 if (_options['tr td']) { 10683 var allRows = table.select('tr'); 10684 if (allRows.length) { 10685 for (var i = 0; i < allRows.length; i++) { 10686 decorateGeneric(allRows[i].getElementsByTagName('TD'), _options['tr td']); 10687 } 10688 } 10689 } 10690 } 10691} 10692 10693/** 10694 * Set "odd", "even" and "last" CSS classes for list items 10695 * @see decorateGeneric() 10696 */ 10697function decorateList(list, nonRecursive) { 10698 if ($(list)) { 10699 if (typeof(nonRecursive) == 'undefined') { 10700 var items = $(list).select('li'); 10701 } 10702 else { 10703 var items = $(list).childElements(); 10704 } 10705 decorateGeneric(items, ['odd', 'even', 'last']); 10706 } 10707} 10708 10709/** 10710 * Set "odd", "even" and "last" CSS classes for list items 10711 * @see decorateGeneric() 10712 */ 10713function decorateDataList(list) { 10714 list = $(list); 10715 if (list) { 10716 decorateGeneric(list.select('dt'), ['odd', 'even', 'last']); 10717 decorateGeneric(list.select('dd'), ['odd', 'even', 'last']); 10718 } 10719} 10720 10721/** 10722 * Parse SID and produces the correct URL 10723 */ 10724function parseSidUrl(baseUrl, urlExt) { 10725 var sidPos = baseUrl.indexOf('/?SID='); 10726 var sid = ''; 10727 urlExt = (urlExt != undefined) ? urlExt : ''; 10728 10729 if(sidPos > -1) { 10730 sid = '?' + baseUrl.substring(sidPos + 2); 10731 baseUrl = baseUrl.substring(0, sidPos + 1); 10732 } 10733 10734 return baseUrl+urlExt+sid; 10735} 10736 10737/** 10738 * Formats currency using patern 10739 * format - JSON (pattern, decimal, decimalsDelimeter, groupsDelimeter) 10740 * showPlus - true (always show '+'or '-'), 10741 * false (never show '-' even if number is negative) 10742 * null (show '-' if number is negative) 10743 */ 10744 10745function formatCurrency(price, format, showPlus){ 10746 var precision = isNaN(format.precision = Math.abs(format.precision)) ? 2 : format.precision; 10747 var requiredPrecision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision; 10748 10749 //precision = (precision > requiredPrecision) ? precision : requiredPrecision; 10750 //for now we don't need this difference so precision is requiredPrecision 10751 precision = requiredPrecision; 10752 10753 var integerRequired = isNaN(format.integerRequired = Math.abs(format.integerRequired)) ? 1 : format.integerRequired; 10754 10755 var decimalSymbol = format.decimalSymbol == undefined ? "," : format.decimalSymbol; 10756 var groupSymbol = format.groupSymbol == undefined ? "." : format.groupSymbol; 10757 var groupLength = format.groupLength == undefined ? 3 : format.groupLength; 10758 10759 var s = ''; 10760 10761 if (showPlus == undefined || showPlus == true) { 10762 s = price < 0 ? "-" : ( showPlus ? "+" : ""); 10763 } else if (showPlus == false) { 10764 s = ''; 10765 } 10766 10767 var i = parseInt(price = Math.abs(+price || 0).toFixed(precision)) + ""; 10768 var pad = (i.length < integerRequired) ? (integerRequired - i.length) : 0; 10769 while (pad) { i = '0' + i; pad--; } 10770 j = (j = i.length) > groupLength ? j % groupLength : 0; 10771 re = new RegExp("(\\d{" + groupLength + "})(?=\\d)", "g"); 10772 10773 /** 10774 * replace(/-/, 0) is only for fixing Safari bug which appears 10775 * when Math.abs(0).toFixed() executed on "0" number. 10776 * Result is "0.-0" :( 10777 */ 10778 var r = (j ? i.substr(0, j) + groupSymbol : "") + i.substr(j).replace(re, "$1" + groupSymbol) + (precision ? decimalSymbol + Math.abs(price - i).toFixed(precision).replace(/-/, 0).slice(2) : ""); 10779 var pattern = ''; 10780 if (format.pattern.indexOf('{sign}') == -1) { 10781 pattern = s + format.pattern; 10782 } else { 10783 pattern = format.pattern.replace('{sign}', s); 10784 } 10785 10786 return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, ''); 10787}; 10788 10789function expandDetails(el, childClass) {
10790 if (Element.hasClassName(el,'show-details')) { 10791 $$(childClass).each(function(item){ 10792 item.hide(); 10793 }); 10794 Element.removeClassName(el,'show-details'); 10795 } 10796 else { 10797 $$(childClass).each(function(item){ 10798 item.show(); 10799 }); 10800 Element.addClassName(el,'show-details'); 10801 } 10802} 10803 10804// Version 1.0 10805var isIE = navigator.appVersion.match(/MSIE/) == "MSIE"; 10806 10807if (!window.Varien) 10808 var Varien = new Object(); 10809 10810Varien.showLoading = function(){ 10811 var loader = $('loading-process'); 10812 loader && loader.show(); 10813}; 10814Varien.hideLoading = function(){ 10815 var loader = $('loading-process'); 10816 loader && loader.hide(); 10817}; 10818Varien.GlobalHandlers = { 10819 onCreate: function() { 10820 Varien.showLoading(); 10821 }, 10822 10823 onComplete: function() { 10824 if(Ajax.activeRequestCount == 0) { 10825 Varien.hideLoading(); 10826 } 10827 } 10828}; 10829 10830Ajax.Responders.register(Varien.GlobalHandlers); 10831 10832/** 10833 * Quick Search form client model 10834 */ 10835Varien.searchForm = Class.create(); 10836Varien.searchForm.prototype = { 10837 initialize : function(form, field, emptyText){ 10838 this.form = $(form); 10839 this.field = $(field); 10840 this.emptyText = emptyText; 10841 10842 Event.observe(this.form, 'submit', this.submit.bind(this)); 10843 Event.observe(this.field, 'focus', this.focus.bind(this)); 10844 Event.observe(this.field, 'blur', this.blur.bind(this)); 10845 this.blur(); 10846 }, 10847 10848 submit : function(event){ 10849 if (this.field.value == this.emptyText || this.field.value == ''){ 10850 Event.stop(event); 10851 return false; 10852 } 10853 return true; 10854 }, 10855 10856 focus : function(event){ 10857 if(this.field.value==this.emptyText){ 10858 this.field.value=''; 10859 } 10860 10861 }, 10862 10863 blur : function(event){ 10864 if(this.field.value==''){ 10865 this.field.value=this.emptyText; 10866 } 10867 }, 10868 10869 initAutocomplete : function(url, destinationElement){ 10870 new Ajax.Autocompleter( 10871 this.field, 10872 destinationElement, 10873 url, 10874 { 10875 paramName: this.field.name, 10876 method: 'get', 10877 minChars: 2, 10878 updateElement: this._selectAutocompleteItem.bind(this), 10879 onShow : function(element, update) { 10880 if(!update.style.position || update.style.position=='absolute') { 10881 update.style.position = 'absolute'; 10882 Position.clone(element, update, { 10883 setHeight: false, 10884 offsetTop: element.offsetHeight 10885 }); 10886 }
10887 Effect.Appear(update,{duration:0}); 10888 } 10889 10890 } 10891 ); 10892 }, 10893 10894 _selectAutocompleteItem : function(element){ 10895 if(element.title){ 10896 this.field.value = element.title; 10897 } 10898 this.form.submit(); 10899 } 10900}; 10901 10902Varien.Tabs = Class.create(); 10903Varien.Tabs.prototype = { 10904 initialize: function(selector) { 10905 var self=this; 10906 $$(selector+' a').each(this.initTab.bind(this)); 10907 }, 10908 10909 initTab: function(el) { 10910 el.href = 'javascript:void(0)'; 10911 if ($(el.parentNode).hasClassName('active')) { 10912 this.showContent(el); 10913 } 10914 el.observe('click', this.showContent.bind(this, el)); 10915 }, 10916 10917 showContent: function(a) { 10918 var li = $(a.parentNode), ul = $(li.parentNode); 10919 ul.getElementsBySelector('li', 'ol').each(function(el){ 10920 var contents = $(el.id+'_contents'); 10921 if (el==li) { 10922 el.addClassName('active'); 10923 contents.show(); 10924 } else { 10925 el.removeClassName('active'); 10926 contents.hide(); 10927 } 10928 }); 10929 } 10930}; 10931 10932Varien.DateElement = Class.create(); 10933Varien.DateElement.prototype = { 10934 initialize: function(type, content, required, format) { 10935 if (type == 'id') { 10936 // id prefix 10937 this.day = $(content + 'day'); 10938 this.month = $(content + 'month'); 10939 this.year = $(content + 'year'); 10940 this.full = $(content + 'full'); 10941 this.advice = $(content + 'date-advice'); 10942 } else if (type == 'container') { 10943 // content must be container with data 10944 this.day = content.day; 10945 this.month = content.month; 10946 this.year = content.year; 10947 this.full = content.full; 10948 this.advice = content.advice; 10949 } else { 10950 return; 10951 } 10952 10953 this.required = required; 10954 this.format = format; 10955 10956 this.day.addClassName('validate-custom'); 10957 this.day.validate = this.validate.bind(this); 10958 this.month.addClassName('validate-custom'); 10959 this.month.validate = this.validate.bind(this); 10960 this.year.addClassName('validate-custom'); 10961 this.year.validate = this.validate.bind(this); 10962 10963 this.setDateRange(false, false); 10964 this.year.setAttribute('autocomplete','off'); 10965 10966 this.advice.hide(); 10967 10968 var date = new Date; 10969 this.curyear = date.getFullYear(); 10970 }, 10971 validate: function() { 10972 var error = false, 10973 day = parseInt(this.day.value, 10) || 0, 10974 month = parseInt(this.month.value, 10) || 0, 10975 year = parseInt(this.year.value, 10) || 0; 10976 if (this.day.value.strip().empty() 10977 && this.month.value.strip().empty() 10978 && this.year.value.strip().empty() 10979 ) { 10980 if (this.required) { 10981 error = 'This date is a required value.'; 10982 } else { 10983 this.full.value = ''; 10984 } 10985 } else if (!day || !month || !year) { 10986 error = 'Please enter a valid full date'; 10987 } else { 10988 var date = new Date, countDaysInMonth = 0, errorType = null; 10989 date.setYear(year);date.setMonth(month-1);date.setDate(32); 10990 countDaysInMonth = 32 - date.getDate(); 10991 if(!countDaysInMonth || countDaysInMonth>31) countDaysInMonth = 31; 10992 if(year < 1900) error = this.errorTextModifier(this.validateDataErrorText); 10993 10994 if (day<1 || day>countDaysInMonth) { 10995 errorType = 'day'; 10996 error = 'Please enter a valid day (1-%d).'; 10997 } else if (month<1 || month>12) { 10998 errorType = 'month'; 10999 error = 'Please enter a valid month (1-12).'; 11000 } else { 11001 if(day % 10 == day) this.day.value = '0'+day; 11002 if(month % 10 == month) this.month.value = '0'+month; 11003 this.full.value = this.format.replace(/%[mb]/i, this.month.value).replace(/%[de]/i, this.day.value).replace(/%y/i, this.year.value); 11004 var testFull = this.month.value + '/' + this.day.value + '/'+ this.year.value; 11005 var test = new Date(testFull); 11006 if (isNaN(test)) { 11007 error = 'Please enter a valid date.'; 11008 } else { 11009 this.setFullDate(test); 11010 } 11011 } 11012 var valueError = false;
11013 if (!error && !this.validateData()){//(year<1900 || year>curyear) { 11014 errorType = this.validateDataErrorType;//'year'; 11015 valueError = this.validateDataErrorText;//'Please enter a valid year (1900-%d).'; 11016 error = valueError; 11017 } 11018 } 11019 11020 if (error !== false) { 11021 try { 11022 error = Translator.translate(error); 11023 } 11024 catch (e) {} 11025 if (!valueError) { 11026 this.advice.innerHTML = error.replace('%d', countDaysInMonth); 11027 } else { 11028 this.advice.innerHTML = this.errorTextModifier(error); 11029 } 11030 this.advice.show(); 11031 return false; 11032 } 11033 11034 // fixing elements class 11035 this.day.removeClassName('validation-failed'); 11036 this.month.removeClassName('validation-failed'); 11037 this.year.removeClassName('validation-failed'); 11038 11039 this.advice.hide(); 11040 return true; 11041 }, 11042 validateData: function() { 11043 var year = this.fullDate.getFullYear(); 11044 return (year>=1900 && year<=this.curyear); 11045 }, 11046 validateDataErrorType: 'year', 11047 validateDataErrorText: 'Please enter a valid year (1900-%d).', 11048 errorTextModifier: function(text) { 11049 text = Translator.translate(text); 11050 return text.replace('%d', this.curyear); 11051 }, 11052 setDateRange: function(minDate, maxDate) { 11053 this.minDate = minDate; 11054 this.maxDate = maxDate; 11055 }, 11056 setFullDate: function(date) { 11057 this.fullDate = date; 11058 } 11059}; 11060 11061Varien.DOB = Class.create(); 11062Varien.DOB.prototype = { 11063 initialize: function(selector, required, format) { 11064 var el = $$(selector)[0]; 11065 var container = {}; 11066 container.day = Element.select(el, '.dob-day input')[0]; 11067 container.month = Element.select(el, '.dob-month input')[0]; 11068 container.year = Element.select(el, '.dob-year input')[0]; 11069 container.full = Element.select(el, '.dob-full input')[0]; 11070 container.advice = Element.select(el, '.validation-advice')[0]; 11071 11072 new Varien.DateElement('container', container, required, format); 11073 } 11074}; 11075 11076Varien.dateRangeDate = Class.create(); 11077Varien.dateRangeDate.prototype = Object.extend(new Varien.DateElement(), { 11078 validateData: function() { 11079 var validate = true; 11080 if (this.minDate || this.maxValue) { 11081 if (this.minDate) { 11082 this.minDate = new Date(this.minDate); 11083 this.minDate.setHours(0); 11084 if (isNaN(this.minDate)) { 11085 this.minDate = new Date('1/1/1900'); 11086 } 11087 validate = validate && (this.fullDate >= this.minDate); 11088 } 11089 if (this.maxDate) { 11090 this.maxDate = new Date(this.maxDate); 11091 this.minDate.setHours(0); 11092 if (isNaN(this.maxDate)) { 11093 this.maxDate = new Date(); 11094 } 11095 validate = validate && (this.fullDate <= this.maxDate); 11096 } 11097 if (this.maxDate && this.minDate) { 11098 this.validateDataErrorText = 'Please enter a valid date between %s and %s'; 11099 } else if (this.maxDate) { 11100 this.validateDataErrorText = 'Please enter a valid date less than or equal to %s'; 11101 } else if (this.minDate) { 11102 this.validateDataErrorText = 'Please enter a valid date equal to or greater than %s'; 11103 } else { 11104 this.validateDataErrorText = ''; 11105 } 11106 } 11107 return validate; 11108 }, 11109 validateDataErrorText: 'Date should be between %s and %s', 11110 errorTextModifier: function(text) { 11111 if (this.minDate) { 11112 text = text.sub('%s', this.dateFormat(this.minDate)); 11113 } 11114 if (this.maxDate) { 11115 text = text.sub('%s', this.dateFormat(this.maxDate)); 11116 } 11117 return text; 11118 }, 11119 dateFormat: function(date) { 11120 return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear(); 11121 } 11122}); 11123 11124Varien.FileElement = Class.create(); 11125Varien.FileElement.prototype = { 11126 initialize: function (id) { 11127 this.fileElement = $(id); 11128 this.hiddenElement = $(id + '_value'); 11129 11130 this.fileElement.observe('change', this.selectFile.bind(this)); 11131 }, 11132 selectFile: function(event) { 11133 this.hiddenElement.value = this.fileElement.getValue(); 11134 } 11135}; 11136 11137Validation.addAllThese([ 11138 ['validate-custom', ' ', function(v,elm) { 11139 return elm.validate(); 11140 }] 11141]); 11142 11143function truncateOptions() { 11144 $$('.truncated').each(function(element){ 11145 Event.observe(element, 'mouseover', function(){ 11146 if (element.down('div.truncated_full_value')) { 11147 element.down('div.truncated_full_value').addClassName('show'); 11148 } 11149 }); 11150 Event.observe(element, 'mouseout', function(){ 11151 if (element.down('div.truncated_full_value')) { 11152 element.down('div.truncated_full_value').removeClassName('show'); 11153 } 11154 }); 11155 11156 }); 11157} 11158Event.observe(window, 'load', function(){ 11159 truncateOptions(); 11160}); 11161 11162Element.addMethods({ 11163 getInnerText: function(element) 11164 { 11165 element = $(element); 11166 if(element.innerText && !Prototype.Browser.Opera) { 11167 return element.innerText; 11168 } 11169 return element.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g, ' ').strip(); 11170 } 11171}); 11172 11173/* 11174if (!("console" in window) || !("firebug" in console)) 11175{ 11176 var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", 11177 "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; 11178 11179 window.console = {}; 11180 for (var i = 0; i < names.length; ++i) 11181 window.console[names[i]] = function() {} 11182} 11183*/ 11184 11185/** 11186 * Executes event handler on the element. Works with event handlers attached by Prototype, 11187 * in a browser-agnostic fashion. 11188 * @param element The element object 11189 * @param event Event name, like 'change' 11190 * 11191 * @example fireEvent($('my-input', 'click')); 11192 */ 11193function fireEvent(element, event) { 11194 if (document.createEvent) { 11195 // dispatch for all browsers except IE before version 9 11196 var evt = document.createEvent("HTMLEvents"); 11197 evt.initEvent(event, true, true ); // event type, bubbling, cancelable 11198 return element.dispatchEvent(evt); 11199 } else { 11200 // dispatch for IE before version 9 11201 var evt = document.createEventObject(); 11202 return element.fireEvent('on' + event, evt); 11203 } 11204} 11205 11206/** 11207 * Returns more accurate results of floating-point modulo division 11208 * E.g.: 11209 * 0.6 % 0.2 = 0.19999999999999996 11210 * modulo(0.6, 0.2) = 0 11211 * 11212 * @param dividend 11213 * @param divisor 11214 */ 11215function modulo(dividend, divisor) 11216{ 11217 var epsilon = divisor / 10000; 11218 var remainder = dividend % divisor; 11219 11220 if (Math.abs(remainder - divisor) < epsilon || Math.abs(remainder) < epsilon) { 11221 remainder = 0; 11222 } 11223 11224 return remainder; 11225} 11226 11227/** 11228 * createContextualFragment is not supported in IE9. Adding its support. 11229 */ 11230if ((typeof Range != "undefined") && !Range.prototype.createContextualFragment) 11231{ 11232 Range.prototype.createContextualFragment = function(html) 11233 { 11234 var frag = document.createDocumentFragment(), 11235 div = document.createElement("div"); 11236 frag.appendChild(div); 11237 div.outerHTML = html; 11238 return frag; 11239 }; 11240} 11241 11242/** 11243 * Create form element. Set parameters into it and send 11244 * 11245 * @param url 11246 * @param parametersArray 11247 * @param method 11248 */ 11249Varien.formCreator = Class.create(); 11250Varien.formCreator.prototype = { 11251 initialize : function(url, parametersArray, method) { 11252 this.url = url; 11253 this.parametersArray = JSON.parse(parametersArray); 11254 this.method = method; 11255 this.form = ''; 11256 11257 this.createForm(); 11258 this.setFormData(); 11259 }, 11260 createForm : function() { 11261 this.form = new Element('form', { 'method': this.method, action: this.url }); 11262 }, 11263 setFormData : function () { 11264 for (var key in this.parametersArray) { 11265 Element.insert( 11266 this.form, 11267 new Element('input', { name: key, value: this.parametersArray[key], type: 'hidden' }) 11268 ); 11269 } 11270 } 11271}; 11272 11273function customFormSubmit(url, parametersArray, method) { 11274 var createdForm = new Varien.formCreator(url, parametersArray, method); 11275 Element.insert($$('body')[0], createdForm.form); 11276 createdForm.form.submit(); 11277} 11278 11279function customFormSubmitToParent(url, parametersArray, method) { 11280 new Ajax.Request(url, { 11281 method: method, 11282 parameters: JSON.parse(parametersArray), 11283 onSuccess: function (response) { 11284 var node = document.createElement('div'); 11285 node.innerHTML = response.responseText; 11286 var responseMessage = node.getElementsByClassName('messages')[0]; 11287 var pageTitle = window.document.body.getElementsByClassName('page-title')[0]; 11288 pageTitle.insertAdjacentHTML('afterend', responseMessage.outerHTML);
11289 window.opener.focus(); 11290 window.opener.location.href = response.transport.responseURL; 11291 } 11292 }); 11293} 11294 11295function buttonDisabler() { 11296 const buttons = document.querySelectorAll('button.save'); 11297 buttons.forEach(button => button.disabled = true); 11298} 11299 11300 11301/** 11302 * Magento 11303 * 11304 * NOTICE OF LICENSE 11305 * 11306 * This source file is subject to the Academic Free License (AFL 3.0) 11307 * that is bundled with this package in the file LICENSE_AFL.txt. 11308 * It is also available through the world-wide-web at this URL: 11309 * http://opensource.org/licenses/afl-3.0.php 11310 * If you did not receive a copy of the license and are unable to 11311 * obtain it through the world-wide-web, please send an email 11312 * to [email protected] so we can send you a copy immediately. 11313 * 11314 * DISCLAIMER 11315 * 11316 * Do not edit or add to this file if you wish to upgrade Magento to newer 11317 * versions in the future. If you wish to customize Magento for your 11318 * needs please refer to http://www.magento.com for more information. 11319 * 11320 * @category Varien 11321 * @package js 11322 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 11323 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11324 */ 11325VarienForm = Class.create(); 11326VarienForm.prototype = { 11327 initialize: function(formId, firstFieldFocus){ 11328 this.form = $(formId); 11329 if (!this.form) { 11330 return; 11331 } 11332 this.cache = $A(); 11333 this.currLoader = false;
11334 this.currDataIndex = false; 11335 this.validator = new Validation(this.form); 11336 this.elementFocus = this.elementOnFocus.bindAsEventListener(this); 11337 this.elementBlur = this.elementOnBlur.bindAsEventListener(this); 11338 this.childLoader = this.onChangeChildLoad.bindAsEventListener(this); 11339 this.highlightClass = 'highlight'; 11340 this.extraChildParams = ''; 11341 this.firstFieldFocus= firstFieldFocus || false; 11342 this.bindElements(); 11343 if(this.firstFieldFocus){ 11344 try{ 11345 Form.Element.focus(Form.findFirstElement(this.form)); 11346 } 11347 catch(e){} 11348 } 11349 }, 11350 11351 submit : function(url){ 11352 if(this.validator && this.validator.validate()){ 11353 this.form.submit(); 11354 } 11355 return false; 11356 }, 11357 11358 bindElements:function (){ 11359 var elements = Form.getElements(this.form); 11360 for (var row in elements) { 11361 if (elements[row].id) { 11362 Event.observe(elements[row],'focus',this.elementFocus); 11363 Event.observe(elements[row],'blur',this.elementBlur); 11364 } 11365 } 11366 }, 11367 11368 elementOnFocus: function(event){ 11369 var element = Event.findElement(event, 'fieldset'); 11370 if(element){ 11371 Element.addClassName(element, this.highlightClass); 11372 } 11373 }, 11374 11375 elementOnBlur: function(event){ 11376 var element = Event.findElement(event, 'fieldset'); 11377 if(element){ 11378 Element.removeClassName(element, this.highlightClass); 11379 } 11380 }, 11381 11382 setElementsRelation: function(parent, child, dataUrl, first){ 11383 if (parent=$(parent)) { 11384 // TODO: array of relation and caching 11385 if (!this.cache[parent.id]){ 11386 this.cache[parent.id] = $A(); 11387 this.cache[parent.id]['child'] = child; 11388 this.cache[parent.id]['dataUrl'] = dataUrl; 11389 this.cache[parent.id]['data'] = $A(); 11390 this.cache[parent.id]['first'] = first || false; 11391 } 11392 Event.observe(parent,'change',this.childLoader); 11393 } 11394 }, 11395 11396 onChangeChildLoad: function(event){ 11397 element = Event.element(event); 11398 this.elementChildLoad(element); 11399 }, 11400 11401 elementChildLoad: function(element, callback){ 11402 this.callback = callback || false; 11403 if (element.value) { 11404 this.currLoader = element.id; 11405 this.currDataIndex = element.value; 11406 if (this.cache[element.id]['data'][element.value]) { 11407 this.setDataToChild(this.cache[element.id]['data'][element.value]); 11408 } 11409 else{ 11410 new Ajax.Request(this.cache[this.currLoader]['dataUrl'],{ 11411 method: 'post', 11412 parameters: {"parent":element.value}, 11413 onComplete: this.reloadChildren.bind(this) 11414 }); 11415 } 11416 } 11417 }, 11418 11419 reloadChildren: function(transport){ 11420 var data = transport.responseJSON || transport.responseText.evalJSON(true) || {}; 11421 this.cache[this.currLoader]['data'][this.currDataIndex] = data; 11422 this.setDataToChild(data); 11423 }, 11424 11425 setDataToChild: function(data){ 11426 if (data.length) { 11427 var child = $(this.cache[this.currLoader]['child']); 11428 if (child){ 11429 var html = '<select name="'+child.name+'" id="'+child.id+'" class="'+child.className+'" title="'+child.title+'" '+this.extraChildParams+'>'; 11430 if(this.cache[this.currLoader]['first']){ 11431 html+= '<option value="">'+this.cache[this.currLoader]['first']+'</option>'; 11432 } 11433 for (var i in data){ 11434 if(data[i].value) { 11435 html+= '<option value="'+data[i].value+'"'; 11436 if(child.value && (child.value == data[i].value || child.value == data[i].label)){ 11437 html+= ' selected'; 11438 } 11439 html+='>'+data[i].label+'</option>'; 11440 } 11441 } 11442 html+= '</select>'; 11443 Element.insert(child, {before: html}); 11444 Element.remove(child); 11445 } 11446 } 11447 else{ 11448 var child = $(this.cache[this.currLoader]['child']); 11449 if (child){ 11450 var html = '<input type="text" name="'+child.name+'" id="'+child.id+'" class="'+child.className+'" title="'+child.title+'" '+this.extraChildParams+'>'; 11451 Element.insert(child, {before: html}); 11452 Element.remove(child); 11453 } 11454 } 11455 11456 this.bindElements(); 11457 if (this.callback) { 11458 this.callback(); 11459 } 11460 } 11461}; 11462 11463RegionUpdater = Class.create(); 11464RegionUpdater.prototype = { 11465 initialize: function (countryEl, regionTextEl, regionSelectEl, regions, disableAction, zipEl) 11466 { 11467 this.countryEl = $(countryEl); 11468 this.regionTextEl = $(regionTextEl); 11469 this.regionSelectEl = $(regionSelectEl); 11470 this.zipEl = $(zipEl); 11471 this.config = regions['config']; 11472 delete regions.config; 11473 this.regions = regions; 11474 11475 this.disableAction = (typeof disableAction=='undefined') ? 'hide' : disableAction; 11476 this.zipOptions = (typeof zipOptions=='undefined') ? false : zipOptions; 11477 11478 if (this.regionSelectEl.options.length<=1) { 11479 this.update(); 11480 } 11481 11482 Event.observe(this.countryEl, 'change', this.update.bind(this)); 11483 }, 11484
11485 _checkRegionRequired: function() 11486 { 11487 var label, wildCard; 11488 var elements = [this.regionTextEl, this.regionSelectEl]; 11489 var that = this; 11490 if (typeof this.config == 'undefined') { 11491 return; 11492 } 11493 var regionRequired = this.config.regions_required.indexOf(this.countryEl.value) >= 0; 11494 11495 elements.each(function(currentElement) { 11496 Validation.reset(currentElement); 11497 label = $$('label[for="' + currentElement.id + '"]')[0]; 11498 if (label) { 11499 wildCard = label.down('em') || label.down('span.required'); 11500 if (!that.config.show_all_regions) { 11501 if (regionRequired) { 11502 label.up().show(); 11503 } else { 11504 label.up().hide(); 11505 } 11506 } 11507 } 11508 11509 if (label && wildCard) { 11510 if (!regionRequired) { 11511 wildCard.hide(); 11512 if (label.hasClassName('required')) { 11513 label.removeClassName('required'); 11514 } 11515 } else if (regionRequired) { 11516 wildCard.show(); 11517 if (!label.hasClassName('required')) { 11518 label.addClassName('required'); 11519 } 11520 } 11521 } 11522 11523 if (!regionRequired) { 11524 if (currentElement.hasClassName('required-entry')) { 11525 currentElement.removeClassName('required-entry'); 11526 } 11527 if ('select' == currentElement.tagName.toLowerCase() && 11528 currentElement.hasClassName('validate-select')) { 11529 currentElement.removeClassName('validate-select'); 11530 } 11531 } else { 11532 if (!currentElement.hasClassName('required-entry')) { 11533 currentElement.addClassName('required-entry'); 11534 } 11535 if ('select' == currentElement.tagName.toLowerCase() && 11536 !currentElement.hasClassName('validate-select')) { 11537 currentElement.addClassName('validate-select'); 11538 } 11539 } 11540 }); 11541 }, 11542 11543 update: function() 11544 { 11545 if (this.regions[this.countryEl.value]) { 11546 var i, option, region, def; 11547 11548 def = this.regionSelectEl.getAttribute('defaultValue'); 11549 if (this.regionTextEl) { 11550 if (!def) { 11551 def = this.regionTextEl.value.toLowerCase(); 11552 } 11553 this.regionTextEl.value = ''; 11554 } 11555 11556 this.regionSelectEl.options.length = 1; 11557 for (regionId in this.regions[this.countryEl.value]) { 11558 region = this.regions[this.countryEl.value][regionId]; 11559 11560 option = document.createElement('OPTION'); 11561 option.value = regionId; 11562 option.text = region.name.stripTags(); 11563 option.title = region.name; 11564 11565 if (this.regionSelectEl.options.add) { 11566 this.regionSelectEl.options.add(option); 11567 } else { 11568 this.regionSelectEl.appendChild(option); 11569 } 11570 11571 if (regionId == def || (region.name && region.name.toLowerCase() == def) 11572 || (region.name && region.code.toLowerCase() == def) 11573 ) { 11574 this.regionSelectEl.value = regionId; 11575 } 11576 } 11577 this.sortSelect(); 11578 if (this.disableAction == 'hide') { 11579 if (this.regionTextEl) { 11580 this.regionTextEl.style.display = 'none'; 11581 } 11582 11583 this.regionSelectEl.style.display = ''; 11584 } else if (this.disableAction == 'disable') { 11585 if (this.regionTextEl) { 11586 this.regionTextEl.disabled = true; 11587 } 11588 this.regionSelectEl.disabled = false; 11589 } 11590 this.setMarkDisplay(this.regionSelectEl, true); 11591 } else { 11592 this.regionSelectEl.options.length = 1; 11593 this.sortSelect(); 11594 if (this.disableAction == 'hide') { 11595 if (this.regionTextEl) { 11596 this.regionTextEl.style.display = ''; 11597 } 11598 this.regionSelectEl.style.display = 'none'; 11599 Validation.reset(this.regionSelectEl); 11600 } else if (this.disableAction == 'disable') { 11601 if (this.regionTextEl) { 11602 this.regionTextEl.disabled = false;
11603 } 11604 this.regionSelectEl.disabled = true; 11605 } else if (this.disableAction == 'nullify') { 11606 this.regionSelectEl.options.length = 1; 11607 this.regionSelectEl.value = ''; 11608 this.regionSelectEl.selectedIndex = 0; 11609 this.lastCountryId = ''; 11610 } 11611 this.setMarkDisplay(this.regionSelectEl, false); 11612 } 11613 11614 this._checkRegionRequired(); 11615 // Make Zip and its label required/optional 11616 var zipUpdater = new ZipUpdater(this.countryEl.value, this.zipEl); 11617 zipUpdater.update(); 11618 }, 11619 11620 setMarkDisplay: function(elem, display){ 11621 elem = $(elem); 11622 var labelElement = elem.up(0).down('label > span.required') || 11623 elem.up(1).down('label > span.required') || 11624 elem.up(0).down('label.required > em') || 11625 elem.up(1).down('label.required > em'); 11626 if(labelElement) { 11627 inputElement = labelElement.up().next('input'); 11628 if (display) { 11629 labelElement.show(); 11630 if (inputElement) { 11631 inputElement.addClassName('required-entry'); 11632 } 11633 } else { 11634 labelElement.hide(); 11635 if (inputElement) { 11636 inputElement.removeClassName('required-entry'); 11637 } 11638 } 11639 } 11640 }, 11641 sortSelect : function () { 11642 var elem = this.regionSelectEl; 11643 var tmpArray = new Array(); 11644 var currentVal = $(elem).value; 11645 for (var i = 0; i < $(elem).options.length; i++) { 11646 if (i == 0) { 11647 continue; 11648 } 11649 tmpArray[i-1] = new Array(); 11650 tmpArray[i-1][0] = $(elem).options[i].text; 11651 tmpArray[i-1][1] = $(elem).options[i].value; 11652 } 11653 tmpArray.sort(); 11654 for (var i = 1; i <= tmpArray.length; i++) { 11655 var op = new Option(tmpArray[i-1][0], tmpArray[i-1][1]); 11656 $(elem).options[i] = op; 11657 } 11658 $(elem).value = currentVal; 11659 return; 11660 } 11661}; 11662 11663ZipUpdater = Class.create(); 11664ZipUpdater.prototype = { 11665 initialize: function(country, zipElement) 11666 { 11667 this.country = country; 11668 this.zipElement = $(zipElement); 11669 }, 11670 11671 update: function() 11672 { 11673 // Country ISO 2-letter codes must be pre-defined 11674 if (typeof optionalZipCountries == 'undefined') { 11675 return false; 11676 } 11677 11678 // Ajax-request and normal content load compatibility 11679 if (this.zipElement != undefined) { 11680 Validation.reset(this.zipElement); 11681 this._setPostcodeOptional(); 11682 } else { 11683 Event.observe(window, "load", this._setPostcodeOptional.bind(this)); 11684 } 11685 }, 11686 11687 _setPostcodeOptional: function() 11688 { 11689 this.zipElement = $(this.zipElement); 11690 if (this.zipElement == undefined) { 11691 return false; 11692 } 11693 11694 // find label 11695 var label = $$('label[for="' + this.zipElement.id + '"]')[0]; 11696 if (label != undefined) { 11697 var wildCard = label.down('em') || label.down('span.required'); 11698 } 11699 11700 // Make Zip and its label required/optional 11701 if (optionalZipCountries.indexOf(this.country) != -1) { 11702 while (this.zipElement.hasClassName('required-entry')) { 11703 this.zipElement.removeClassName('required-entry'); 11704 } 11705 if (wildCard != undefined) { 11706 wildCard.hide(); 11707 } 11708 } else { 11709 this.zipElement.addClassName('required-entry'); 11710 if (wildCard != undefined) { 11711 wildCard.show(); 11712 } 11713 } 11714 } 11715}; 11716 11717/** 11718 * Magento 11719 * 11720 * NOTICE OF LICENSE 11721 * 11722 * This source file is subject to the Academic Free License (AFL 3.0) 11723 * that is bundled with this package in the file LICENSE_AFL.txt. 11724 * It is also available through the world-wide-web at this URL: 11725 * http://opensource.org/licenses/afl-3.0.php 11726 * If you did not receive a copy of the license and are unable to 11727 * obtain it through the world-wide-web, please send an email 11728 * to [email protected] so we can send you a copy immediately. 11729 * 11730 * DISCLAIMER 11731 * 11732 * Do not edit or add to this file if you wish to upgrade Magento to newer 11733 * versions in the future. If you wish to customize Magento for your 11734 * needs please refer to http://www.magento.com for more information. 11735 * 11736 * @category Mage 11737 * @package js 11738 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 11739 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11740 */ 11741 11742var Translate = Class.create(); 11743Translate.prototype = { 11744 initialize: function(data){ 11745 this.data = $H(data); 11746 }, 11747 11748 translate : function(){ 11749 var args = arguments; 11750 var text = arguments[0]; 11751 11752 if(this.data.get(text)){ 11753 return this.data.get(text); 11754 } 11755 return text; 11756 }, 11757 add : function() { 11758 if (arguments.length > 1) { 11759 this.data.set(arguments[0], arguments[1]); 11760 } else if (typeof arguments[0] =='object') { 11761 $H(arguments[0]).each(function (pair){ 11762 this.data.set(pair.key, pair.value); 11763 }.bind(this)); 11764 } 11765 } 11766}; 11767 11768/** 11769 * Magento 11770 * 11771 * NOTICE OF LICENSE 11772 * 11773 * This source file is subject to the Academic Free License (AFL 3.0)
11774 * that is bundled with this package in the file LICENSE_AFL.txt. 11775 * It is also available through the world-wide-web at this URL: 11776 * http://opensource.org/licenses/afl-3.0.php 11777 * If you did not receive a copy of the license and are unable to 11778 * obtain it through the world-wide-web, please send an email 11779 * to [email protected] so we can send you a copy immediately. 11780 * 11781 * DISCLAIMER 11782 * 11783 * Do not edit or add to this file if you wish to upgrade Magento to newer 11784 * versions in the future. If you wish to customize Magento for your 11785 * needs please refer to http://www.magento.com for more information. 11786 * 11787 * @category Mage 11788 * @package js 11789 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 11790 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11791 */ 11792// old school cookie functions grabbed off the web 11793 11794if (!window.Mage) var Mage = {}; 11795 11796Mage.Cookies = {}; 11797Mage.Cookies.expires = null; 11798Mage.Cookies.path = '/'; 11799Mage.Cookies.domain = null; 11800Mage.Cookies.secure = false; 11801Mage.Cookies.set = function(name, value){ 11802 var argv = arguments; 11803 var argc = arguments.length; 11804 var expires = (argc > 2) ? argv[2] : Mage.Cookies.expires; 11805 var path = (argc > 3) ? argv[3] : Mage.Cookies.path; 11806 var domain = (argc > 4) ? argv[4] : Mage.Cookies.domain; 11807 var secure = (argc > 5) ? argv[5] : Mage.Cookies.secure; 11808 document.cookie = name + "=" + escape (value) + 11809 ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 11810 ((path == null) ? "" : ("; path=" + path)) + 11811 ((domain == null) ? "" : ("; domain=" + domain)) + 11812 ((secure == true) ? "; secure" : ""); 11813}; 11814 11815Mage.Cookies.get = function(name){ 11816 var arg = name + "="; 11817 var alen = arg.length; 11818 var clen = document.cookie.length; 11819 var i = 0; 11820 var j = 0; 11821 while(i < clen){ 11822 j = i + alen; 11823 if (document.cookie.substring(i, j) == arg) 11824 return Mage.Cookies.getCookieVal(j); 11825 i = document.cookie.indexOf(" ", i) + 1; 11826 if(i == 0) 11827 break; 11828 } 11829 return null; 11830}; 11831 11832Mage.Cookies.clear = function(name) { 11833 if(Mage.Cookies.get(name)){ 11834 document.cookie = name + "=" + 11835 "; expires=Thu, 01-Jan-70 00:00:01 GMT"; 11836 } 11837}; 11838 11839Mage.Cookies.getCookieVal = function(offset){ 11840 var endstr = document.cookie.indexOf(";", offset); 11841 if(endstr == -1){ 11842 endstr = document.cookie.length; 11843 } 11844 return unescape(document.cookie.substring(offset, endstr)); 11845}; 11846 11847var awAfptcPopup = Class.create(); 11848awAfptcPopup.prototype = { 11849 initialize: function(config) { 11850 this.config = config; 11851 }, 11852 init: function() { 11853 var options = { 11854 parameters : {}, 11855 method: 'get', 11856 onSuccess: this.onSuccess(this) 11857 }; 11858 this.onSuccess = this.onSuccess.bindAsEventListener(this); 11859 new Ajax.Request(this.config.requestUrl, options); 11860 }, 11861 onSuccess: function(object) { 11862 return function(transport) { 11863 try { 11864 eval("var json = " + transport.responseText + " || {}"); 11865 } catch(e) { 11866 console.log(e); 11867 return; 11868 } 11869 $(object.config.el).update(json.content); 11870 $(object.config.decline).observe('click', object._observeDeclineAction.bind(object)); 11871 $(object.config.overlay).observe('click', object._observeDeclineAction.bind(object)); 11872 object.align(); 11873 }; 11874 }, 11875 align: function() { 11876 var el = $(this.config.el); 11877 el.setStyle({ 11878 top: document.viewport.getHeight() / 2 - el.getHeight() / 2 + 'px', 11879 left: document.viewport.getWidth() / 2 - el.getWidth() / 2 + 'px' 11880 }); 11881 11882 Event.observe(window, 'resize', function() { this.resizeBlock(el) }.bind(this)); 11883 11884 Effect.Appear(el, {duration: 0.4}); 11885 $(this.config.overlay).show(); 11886 }, 11887 collectPos: function(el) { 11888 var x, y; 11889 var elWidth = el.getWidth(); 11890 var docWidth = document.viewport.getWidth(); 11891 x = docWidth/2 - elWidth/2; 11892 var elHeight = el.getHeight(); 11893 var docHeight = document.viewport.getHeight(); 11894 y = docHeight/2 - elHeight/2; 11895 11896 return [x, y]; 11897 }, 11898 resizeBlock: function(el) { 11899 11900 el.setStyle({ 11901 height: 'auto', width: 'auto' 11902 }); 11903 var xy = this.collectPos(el); 11904 11905 if (xy[0] < 50) { 11906 xy[0] = 50; 11907 el.setStyle({ 11908 width: (document.viewport.getWidth() - 100) + 'px' 11909 }); 11910 } 11911 if (xy[1] < 50) { 11912 xy[1] = 50; 11913 el.setStyle({ 11914 height: (document.viewport.getHeight() - 100) + 'px' 11915 }); 11916 } 11917 el.setStyle({ 'left': xy[0] + 'px', 'top': xy[1] + 'px'}); 11918 }, 11919 _observeDeclineAction: function() { 11920 if(this.config.declineCheck 11921 && $(this.config.declineCheck) 11922 && $(this.config.declineCheck).checked 11923 && $(this.config.cookie) 11924 ) { 11925 var date = new Date(); 11926 date.setTime(date.getTime() + this.config.cookieLifetime); 11927 Mage.Cookies.set($(this.config.cookie).value, true, date); 11928 } 11929 try {
11930 Effect.Fade($(this.config.el), {duration: 0.4}); 11931 Effect.Fade($(this.config.overlay), {duration: 0.4}); 11932 } catch(e) { 11933 console.log(e); 11934 return; 11935 } 11936 } 11937}; 11938var acpUpdateEvent = (function(type, bubbles, cancelable) { 11939 var _event; 11940 try { 11941 _event = new Event(type, { 11942 detail: {}, 11943 bubbles: bubbles, 11944 cancelable: cancelable 11945 } 11946 ); 11947 } catch (e) { 11948 // Compatibility with IE 11949 _event = document.createEvent('Event'); 11950 _event.initEvent(type, bubbles, cancelable); 11951 } 11952 return _event; 11953})('aw_ajaxcartpro_cart_update', true, true); 11954 11955var AW_AjaxCartProConfig = { 11956 actionsObservers: {}, 11957 targetsToUpdate: {}, 11958 data: {}, 11959 11960 addUpdater: function(updater) { 11961 this.targetsToUpdate[updater.name] = updater; 11962 }, 11963 addObserver: function(observer) { 11964 this.actionsObservers[observer.name] = observer; 11965 }, 11966 addSystemData: function(data) { 11967 if (typeof(data.custom) != 'undefined') { 11968 this.addUpdaterData(data.custom); 11969 } 11970 Object.extend(this.data, data); 11971 }, 11972 addUpdaterData: function(customData) { 11973 for (var item in customData) { 11974 if (this.targetsToUpdate[item]) { 11975 this.targetsToUpdate[item].selectors = customData[item].selectors || null; 11976 this.targetsToUpdate[item].parentSelector = customData[item].parentSelector || null; 11977 } 11978 } 11979 } 11980}; 11981 11982var AW_AjaxCartPro = { 11983 11984 config: AW_AjaxCartProConfig, 11985 11986 init: function(config) { 11987 this.connector = AW_AjaxCartProConnector; 11988 this.ui = AW_AjaxCartProUI; 11989 11990 this.config.addSystemData(config); 11991 this.startObservers(); 11992 }, 11993 11994 registerUpdater: function(updater) { 11995 this.config.addUpdater(updater); 11996 }, 11997 11998 registerObserver: function(observer) { 11999 this.config.addObserver(observer); 12000 }, 12001 12002 startObservers: function(name) { 12003 var me = this; 12004 if (Object.isString(name)) { 12005 var observer = this.config.actionsObservers[name]; 12006 if (observer) { 12007 observer.run(); 12008 } 12009 } else { 12010 if (typeof(this.config.actionsObservers) == 'object') { 12011 Object.keys(this.config.actionsObservers).each(function(k){ 12012 me.config.actionsObservers[k].run(); 12013 }); 12014 } 12015 } 12016 }, 12017 12018 stopObservers: function(name) { 12019 var me = this; 12020 if (Object.isString(name)) { 12021 var observer = this.config.actionsObservers[name]; 12022 if (observer) { 12023 observer.stop(); 12024 } 12025 } else { 12026 if (typeof(this.config.actionsObservers) == 'object') { 12027 Object.keys(this.config.actionsObservers).each(function(k){ 12028 me.config.actionsObservers[k].stop(); 12029 }); 12030 } 12031 } 12032 }, 12033 12034 callUpdaters: function(blocks) { 12035 var me = this; 12036 var blocks = blocks || {}; 12037 var isSuccessUpdate = true; 12038 12039 this.ui.beforeUpdate(me.msg); 12040 Object.keys(blocks).each(function(k){ 12041 if (!isSuccessUpdate || blocks[k] === null) { 12042 return; 12043 } 12044 var result = true; 12045 try { 12046 result = me.config.targetsToUpdate[k].update(blocks[k]); 12047 } catch(e) { 12048 result = false;
12049 if (window.console) { 12050 console.log(e.name); 12051 } 12052 } 12053 isSuccessUpdate = isSuccessUpdate && result; 12054 }); 12055 this.ui.afterUpdate(me.msg); 12056 delete me.msg; 12057 return isSuccessUpdate; 12058 }, 12059 12060 fire: function(url, parameters, observer) { 12061 var me = this; 12062 this.ui.observer = observer; 12063 this.ui.beforeFire(); 12064 12065 var parameters = parameters || {}; 12066 parameters['block[]'] = []; 12067 Object.keys(me.config.targetsToUpdate).each(function(k){ 12068 if (me.config.targetsToUpdate[k].updateOnActionRequest) { 12069 parameters['block[]'].push(k); 12070 } 12071 }); 12072 window.Mindbox_handler.fire_cart_update(); 12073 this.connector.sendRequest(url, parameters, 12074 function(response) { 12075 var isResponseHasBlock = Object.values(response.block).without(null).length > 0; 12076 if (isResponseHasBlock) { 12077 var isSuccessUpdate = me.callUpdaters(response.block); 12078 if (!isSuccessUpdate) { 12079 document.location.reload(); 12080 return; 12081 } 12082 me.stopObservers(); 12083 me.startObservers(); 12084 return; 12085 } 12086 if (response.redirect_to) { 12087 me.msg = response.msg; 12088 me.fire(response.redirect_to, parameters, observer); 12089 return; 12090 } 12091 me.update(function(json){ 12092 document.location.reload(); 12093 }, { 12094 actionData: Object.toJSON(response.action_data) 12095 }); 12096 }, 12097 function(json){ 12098 observer.fireOriginal(url, parameters); 12099 } 12100 ); 12101 }, 12102 12103 update: function(failureFn, additionalParams) { 12104 var me = this; 12105 failureFn = failureFn || function(){}; 12106 12107 var url = document.location.pathname + document.location.search; 12108 var parameters = additionalParams; 12109 parameters['block[]'] = []; 12110 Object.keys(me.config.targetsToUpdate).each(function(k){ 12111 if (me.config.targetsToUpdate[k].updateOnUpdateRequest) { 12112 parameters['block[]'].push(k); 12113 } 12114 }); 12115 this.connector.sendRequest(url, parameters, 12116 function(json) { 12117 if (json.redirect_to) { 12118 document.location.href = json.redirect_to; 12119 return; 12120 } 12121 var isSuccessUpdate = me.callUpdaters(json.block); 12122 if (!isSuccessUpdate) { 12123 failureFn(json); 12124 return; 12125 } 12126 me.stopObservers(); 12127 me.startObservers(); 12128 me.ui.afterFire(parameters); 12129 document.dispatchEvent(acpUpdateEvent); 12130 }, 12131 failureFn 12132 ); 12133 } 12134}; 12135 12136var AW_AjaxCartProConnector = { 12137 12138 defaultParameters: { 12139 awacp: 1, 12140 no_cache: 1 //parameter is required for Magento EE FPC compatibility 12141 }, 12142 12143 sendRequest: function(url, parameters, success, failure) { 12144 var me = this; 12145 var parameters = parameters || {}; 12146 var failure = failure || function(){}; 12147 var success = success || function(){}; 12148 12149 url = url.replace('https://','http://'); 12150 if (window.location.protocol == 'https'){ 12151 url = url.replace('http://','https://'); 12152 } 12153 12154 Object.extend(parameters, this.defaultParameters); 12155 var options = { 12156 parameters : parameters, 12157 method: 'get', //method must be GET for implement 'no_cache' parameter 12158 onSuccess: this.onSuccessFn(success, failure), 12159 onFailure: this.onFailureFn(success, failure) 12160 }; 12161 //cross domain request possible fix 12162 url = url.replace(/http[^:]*:/, document.location.protocol); 12163 new Ajax.Request(url, options); 12164 }, 12165 12166 onSuccessFn: function(success, failure) { 12167 return function(transport) { 12168 try { 12169 eval("var json = " + transport.responseText + " || {}"); 12170 } catch(e) { 12171 failure({}); 12172 return; 12173 } 12174 if (!json.success) { 12175 failure(json); 12176 return; 12177 } 12178 success(json); 12179 }; 12180 }, 12181 12182 onFailureFn: function(success, failure) { 12183 return function(transport) { 12184 failure(json); 12185 }; 12186 } 12187}; 12188 12189var AW_AjaxCartProUI = { 12190 12191 observer: null, 12192 blocks: {}, 12193 12194 config: AW_AjaxCartProConfig.data, 12195 12196 hideCls: 'ajaxcartpro-box-hide', 12197 showCls: 'ajaxcartpro-box-show', 12198 12199 overlayCssSelector: '#acp-overlay', 12200 12201 beforeFire: function() { 12202 return this._call('beforeFire', arguments); 12203 }, 12204 12205 afterFire: function() { 12206 return this._call('afterFire', arguments); 12207 }, 12208 12209 beforeUpdate: function(msg) { 12210 return this._call('beforeUpdate', arguments); 12211 }, 12212 12213 afterUpdate: function() { 12214 return this._call('afterUpdate', arguments); 12215 }, 12216 12217 registerBlock: function(block) { 12218 var block = block || {}; 12219 if (!block.name) { 12220 return; 12221 } 12222 this.blocks[block.name] = block; 12223 }, 12224 12225 showBlock: function(el) { 12226 el = this._initEl(el); 12227 if (!el) { 12228 return false;
12229 } 12230 this._resizeBlock(el); 12231 var me = this; 12232 el.onWindowResizeHandler = function(e) { 12233 me._resizeBlock(el); 12234 }; 12235 Event.observe(window, 'resize', el.onWindowResizeHandler); 12236 Event.observe(window, 'scroll', el.onWindowResizeHandler); 12237 this._show(el); 12238 var overlay = $$(this.overlayCssSelector)[0]; 12239 overlay.observe('click', this._clickOnOverlay.bind(this)); 12240 this._show(overlay); 12241 return true; 12242 }, 12243 12244 hideBlock: function(el) { 12245 el = this._initEl(el); 12246 if (!el) { 12247 return false; 12248 } 12249 12250 el.setStyle({ 12251 height: 'auto', width: 'auto' 12252 }); 12253 12254 var me = this; 12255 var activeBlocks = 0; 12256 Object.keys(me.blocks).each(function(blockName){ 12257 var block = me.blocks[blockName]; 12258 if (block.enabled === true) { 12259 activeBlocks++; 12260 } 12261 }); 12262 if (activeBlocks === 0) { 12263 var overlay = $$(this.overlayCssSelector)[0]; 12264 overlay.stopObserving('click', this._clickOnOverlay.bind(this)); 12265 this._hide(overlay); 12266 } 12267 this._hide(el); 12268 if (typeof(el.onWindowResizeHandler) === 'function') { 12269 Event.stopObserving(window, 'resize', el.onWindowResizeHandler); 12270 Event.stopObserving(window, 'scroll', el.onWindowResizeHandler); 12271 delete el.onWindowResizeHandler; 12272 } 12273 return true; 12274 }, 12275 12276 _clickOnOverlay: function(e) { 12277 $$('.aw-acp-continue').each(function(el){ 12278 if (!el.click) { 12279 //safary for windows compatibility 12280 if ( document.createEvent ) { 12281 var evt = document.createEvent('MouseEvents'); 12282 evt.initEvent('click', true, false); 12283 el.dispatchEvent(evt); 12284 } else if( document.createEventObject ) { 12285 el.fireEvent('onclick') ; 12286 } else if (typeof node.onclick == 'function' ) { 12287 el.onclick(); 12288 } 12289 } else { 12290 el.click(); 12291 } 12292 }); 12293 }, 12294 12295 _call: function(fnName, args) { 12296 var me = this; 12297 Object.keys(me.blocks).each(function(blockName){ 12298 if (me.observer.uiBlocks.indexOf(blockName) === -1) { 12299 return; 12300 } 12301 var block = me.blocks[blockName]; 12302 if (typeof(block[fnName]) == 'function') { 12303 block[fnName](args); 12304 } 12305 }); 12306 12307 var isSuccessCall = true; 12308 Object.keys(me.blocks).each(function(blockName){ 12309 if (!isSuccessCall) { 12310 return; 12311 } 12312 var block = me.blocks[blockName]; 12313 if (block.enabled === true) { 12314 isSuccessCall = isSuccessCall && me.showBlock(block.cssSelector); 12315 } else { 12316 isSuccessCall = isSuccessCall && me.hideBlock(block.cssSelector); 12317 } 12318 }); 12319 return isSuccessCall; 12320 }, 12321 12322 _show: function(el) { 12323 el.removeClassName(this.hideCls); 12324 el.addClassName(this.showCls); 12325 }, 12326 12327 _hide: function(el) { 12328 el.removeClassName(this.showCls); 12329 el.addClassName(this.hideCls); 12330 }, 12331 12332 _initEl: function(el) { 12333 if (Object.isString(el)) { 12334 el = $$(el); 12335 if (el.length > 0) { 12336 el = el[0]; 12337 } else { 12338 return false; 12339 } 12340 } 12341 el = $(el); 12342 if (!el) { 12343 return false; 12344 } 12345 return el; 12346 }, 12347 12348 _collectPos: function(el, horPos, verPos) { 12349 var x, y; 12350 var elWidth = el.getWidth(); 12351 var docWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 12352 12353 switch(horPos) { 12354 case 'center': 12355 x = docWidth/2 - elWidth/2; 12356 break; 12357 case 'left': 12358 x = 50; 12359 break; 12360 case 'right': 12361 x = docWidth - elWidth; 12362 break; 12363 default: 12364 //error 12365 } 12366 12367 var elHeight = el.getHeight(); 12368 var docHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 12369 12370 switch(verPos) { 12371 case 'top': 12372 y = 50; 12373 break; 12374 case 'center': 12375 y = docHeight/2 - elHeight/2; 12376 break; 12377 case 'bottom': 12378 y = docHeight - elHeight; 12379 break; 12380 default: 12381 //error 12382 } 12383 return [x, y]; 12384 }, 12385 12386 _resizeBlock: function(el) { 12387 el.setStyle({ 12388 height: 'auto', width: 'auto' 12389 }); 12390 var docWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 12391 var docHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 12392 var xy = this._collectPos(el, 'center', this.config.dialogsVAlign); 12393 if (xy[0] < 15) { 12394 xy[0] = 15; 12395 el.setStyle({ 12396 width: (docWidth - 30) + 'px' 12397 }); 12398 } 12399 if (xy[1] < 15) { 12400 xy[1] = 15; 12401 el.setStyle({ 12402 height: (docHeight - 30) + 'px' 12403 }); 12404 } 12405 12406 var left = xy[0]; 12407 var top = xy[1]; 12408 var isIOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false ); 12409 if (isIOS) { 12410 el.setStyle({'position': 'absolute'}); 12411 left += window.pageXOffset?window.pageXOffset:0; 12412 top += window.pageYOffset?window.pageYOffset:0; 12413 } 12414 el.setStyle({ 12415 'left': left + 'px', 12416 'top': top + 'px' 12417 }); 12418 } 12419}; 12420 12421 12422var AW_AjaxCartProObserver = Class.create(); 12423AW_AjaxCartProObserver.prototype = { 12424 name: null, 12425 12426 uiBlocks: [], 12427 12428 initialize: function(name) { 12429 this.name = name; 12430 }, 12431 12432 run: function() { 12433 return null; 12434 }, 12435 12436 stop: function() { 12437 return null; 12438 }, 12439 12440 fireOriginal: function(url, parameters) { 12441 document.location.href = url; 12442 return null; 12443 }, 12444 12445 fireCustom: function(url, parameters) { 12446 var parameters = parameters || {}; 12447 AW_AjaxCartPro.fire(url, parameters, this); 12448 } 12449}; 12450
12451var AW_AjaxCartProUpdater = Class.create(); 12452AW_AjaxCartProUpdater.prototype = { 12453 config: AW_AjaxCartProConfig.data, 12454 selectors: null, 12455 parentSelector: null, 12456 name: null, 12457 12458 initialize: function(name, selectors, parentSelector) { 12459 this.name = name; 12460 this.selectors = selectors || null; 12461 this.parentSelector = parentSelector || null; 12462 }, 12463 12464 beforeUpdate: function(html) { 12465 return null; 12466 }, 12467 12468 afterUpdate: function(html) { 12469 return null; 12470 }, 12471 12472 update: function(html) { 12473 this.beforeUpdate(html); 12474 12475 var me = this; 12476 var selectors = this.selectors; 12477 if (selectors === null) { 12478 selectors = this._getRootSelectors(html); 12479 } 12480 var storage = new Element('div'); 12481 storage.innerHTML = html; 12482 if (storage.childElements().length != selectors.length && storage.childElements().length > 0) { 12483 return false; 12484 } 12485 if (!this._checkSelectorsOnUnique(selectors)) { 12486 return false; 12487 } 12488 12489 selectors.each(function(cssSelector){ 12490 var part = storage.select(cssSelector)[0]; 12491 var target = null; 12492 me._getSelectorsToTarget(cssSelector).each(function(selector){ 12493 if (target !== null) { 12494 return; 12495 } 12496 if ($$(selector).length > 0) { 12497 target = $$(selector)[0]; 12498 } 12499 }); 12500 if (!target) { 12501 return; 12502 } 12503 if (!part) { 12504 target.parentNode.removeChild(target); 12505 return; 12506 } 12507 target.parentNode.replaceChild(part, target); 12508 }); 12509 delete storage; 12510 12511 this._evalScripts(html); 12512 12513 this.afterUpdate(html, selectors); 12514 return true; 12515 }, 12516 12517 _getRootSelectors: function(html) { 12518 var div = new Element('div'); 12519 div.innerHTML = html; 12520 var selectors = []; 12521 div.childElements().each(function(el){ 12522 selectors.push(this._getCssSelectorsByElement(el)); 12523 }, this); 12524 delete div; 12525 return selectors; 12526 }, 12527 12528 _checkSelectorsOnUnique: function(selectors) { 12529 var isUnique = true; 12530 selectors.each(function(cssSelector){ 12531 var possibleSelectors = this._getSelectorsToTarget(cssSelector); 12532 var selectorToCheck = null; 12533 possibleSelectors.each(function(selector){ 12534 if (selectorToCheck !== null) { 12535 return; 12536 } 12537 if ($$(selector) > 0) { 12538 selectorToCheck = $$(selector)[0]; 12539 } 12540 }); 12541 if ($$(selectorToCheck).length > 1) { 12542 isUnique = false; 12543 } 12544 }, this); 12545 return isUnique; 12546 }, 12547 12548 _getSelectorsToTarget: function(selector) { 12549 var selectors = []; 12550 if (this.parentSelector !== null) { 12551 this.parentSelector.each(function(parent){ 12552 var selectorToTarget = parent + ' ' + selector; 12553 selectors.push(selectorToTarget); 12554 }); 12555 } else { 12556 selectors.push(selector); 12557 } 12558 return selectors; 12559 }, 12560 12561 _getCssSelectorsByElement: function(element) { 12562 element = $(element); 12563 var cssSelector = element.tagName.toLowerCase(); 12564 $H({'id': 'id', 'className': 'class'}).each(function(pair) { 12565 var property = pair.first(), 12566 attribute = pair.last(), 12567 value = (element[property] || '').toString(); 12568 if (value) { 12569 if (attribute === 'id') { 12570 cssSelector += '#' + value; 12571 } else { 12572 value = value.split(' ').join('.'); 12573 cssSelector += '.' + value; 12574 } 12575 } 12576 }); 12577 return cssSelector; 12578 }, 12579 12580 _evalScripts: function(html) { 12581 var scripts = html.extractScripts(); 12582 scripts.each(function(script){ 12583 try { 12584 //FIX CDATA comment 12585 script = script.replace('//<![CDATA[', '').replace('//]]>', ''); 12586 script = script.replace('/*<![CDATA[*/', '').replace('/*]]>*/', ''); 12587 eval(script.replace(/var /gi, "")); 12588 } catch(e){ 12589 if(window.console) { 12590 console.log(e.message); 12591 } 12592 } 12593 }); 12594 } 12595}; 12596 12597 12598 12599var AW_AjaxCartProUIBlocks = [ 12600 { 12601 cssSelector: '#ajaxcartpro-progress', 12602 name: 'progress', 12603 enabled: false, 12604 beforeFire: function(args){ 12605 //hide messages blocks 12606 $$('.messages').each(function(el){ 12607 el.hide(); 12608 }); 12609 if (!this.getEnabled()) { 12610 return; 12611 } 12612 this.enabled = true; 12613 }, 12614 afterFire: function(args){}, 12615 beforeUpdate: function(args){}, 12616 afterUpdate: function(args){ 12617 this.enabled = false;
12618 }, 12619 getEnabled: function() { 12620 return AW_AjaxCartPro.config.data.useProgress; 12621 } 12622 }, 12623 { 12624 name: 'add_confirmation', 12625 cssSelector: '#ajaxcartpro-add-confirm', 12626 enabled: false, 12627 beforeFire: function(args){ 12628 this.enabled = false; 12629 }, 12630 afterFire: function(args){ 12631 eval("var actionDataAsJson = " + args[0].actionData); 12632 actionDataAsJson = actionDataAsJson || {}; 12633 var isConfirmationEnabled = AW_AjaxCartPro.config.data.addProductConfirmationEnabled; 12634 if ("confirmation_enabled" in actionDataAsJson) { 12635 isConfirmationEnabled = actionDataAsJson.confirmation_enabled; 12636 } 12637 if (!isConfirmationEnabled) { 12638 return; 12639 } 12640 this.enabled = true; 12641 this._cntBtnInit(actionDataAsJson); 12642 }, 12643 beforeUpdate: function(args){}, 12644 afterUpdate: function(args){}, 12645 12646 _cntBtnInit: function(actionDataAsJson) { 12647 var cntBtn = $$(this.cssSelector)[0].select('.aw-acp-continue')[0]; 12648 if (!cntBtn) { 12649 cntBtn = new Element('div'); 12650 cntBtn.addClassName('aw-acp-continue'); 12651 cntBtn.setStyle({ 12652 'display': 'none' 12653 }); 12654 $$(this.cssSelector)[0].appendChild(cntBtn); 12655 } 12656 cntBtn.stopObserving('click', this._cntBtnOnClick.bind(this)); 12657 cntBtn.observe('click', this._cntBtnOnClick.bind(this)); 12658 12659 var counter = AW_AjaxCartPro.config.data.addProductCounterBeginFrom; 12660 if ("counter_begin_from" in actionDataAsJson) { 12661 counter = actionDataAsJson.counter_begin_from; 12662 } 12663 if (counter > 0) { 12664 this._initCounterForBtn(cntBtn, counter); 12665 } 12666 }, 12667 12668 _cntBtnOnClick: function(event) { 12669 this.enabled = false; 12670 AW_AjaxCartProUI.hideBlock(this.cssSelector); 12671 event.stop(); 12672 }, 12673 12674 _initCounterForBtn: function(cntBtn, counter) { 12675 var originalTxt = cntBtn.innerHTML; 12676 cntBtn.innerHTML = originalTxt + ' (' + counter + ')'; 12677 var intId = setInterval(function(){ 12678 counter--; 12679 if (counter === 0) { 12680 if (!cntBtn.click) { 12681 //safary for windows compatibility 12682 if ( document.createEvent ) { 12683 var evt = document.createEvent('MouseEvents'); 12684 evt.initEvent('click', true, false); 12685 cntBtn.dispatchEvent(evt); 12686 } else if( document.createEventObject ) { 12687 cntBtn.fireEvent('onclick') ; 12688 } else if (typeof node.onclick == 'function' ) { 12689 cntBtn.onclick(); 12690 } 12691 } else { 12692 cntBtn.click(); 12693 } 12694 } 12695 cntBtn.innerHTML = originalTxt + ' (' + counter + ')'; 12696 }, 1000); 12697 var clearIntervalFn = function(e){ 12698 clearInterval(intId); 12699 cntBtn.stopObserving('click', this.bind(this)); 12700 }; 12701 cntBtn.observe('click', clearIntervalFn.bind(clearIntervalFn)); 12702 } 12703 }, 12704 { 12705 name: 'remove_confirmation', 12706 cssSelector: '#ajaxcartpro-remove-confirm', 12707 enabled: false, 12708 beforeFire: function(args){ 12709 this.enabled = false; 12710 }, 12711 afterFire: function(args){ 12712 eval("var actionDataAsJson = " + args[0].actionData); 12713 actionDataAsJson = actionDataAsJson || {}; 12714 var isConfirmationEnabled = AW_AjaxCartPro.config.data.removeProductConfirmationEnabled; 12715 if ("confirmation_enabled" in actionDataAsJson) { 12716 isConfirmationEnabled = actionDataAsJson.confirmation_enabled; 12717 } 12718 if (!isConfirmationEnabled) { 12719 return; 12720 } 12721 this.enabled = true; 12722 this._cntBtnInit(actionDataAsJson); 12723 }, 12724 beforeUpdate: function(args){}, 12725 afterUpdate: function(args){}, 12726 12727 _cntBtnInit: function(actionDataAsJson) { 12728 var cntBtn = $$(this.cssSelector)[0].select('.aw-acp-continue')[0]; 12729 if (!cntBtn) { 12730 cntBtn = new Element('div'); 12731 cntBtn.addClassName('aw-acp-continue'); 12732 cntBtn.setStyle({ 12733 'display': 'none' 12734 }); 12735 $$(this.cssSelector)[0].appendChild(cntBtn); 12736 } 12737 cntBtn.stopObserving('click', this._cntBtnOnClick.bind(this)); 12738 cntBtn.observe('click', this._cntBtnOnClick.bind(this)); 12739 12740 var counter = AW_AjaxCartPro.config.data.removeProductCounterBeginFrom; 12741 if ("counter_begin_from" in actionDataAsJson) { 12742 counter = actionDataAsJson.counter_begin_from; 12743 } 12744 if (counter > 0) { 12745 this._initCounterForBtn(cntBtn, counter); 12746 } 12747 }, 12748 12749 _cntBtnOnClick: function(event) { 12750 this.enabled = false;
12751 AW_AjaxCartProUI.hideBlock(this.cssSelector); 12752 event.stop(); 12753 }, 12754 12755 _initCounterForBtn: function(cntBtn, counter) { 12756 var originalTxt = cntBtn.innerHTML; 12757 cntBtn.innerHTML = originalTxt + ' (' + counter + ')'; 12758 var intId = setInterval(function(){ 12759 counter--; 12760 if (counter === 0) { 12761 if (!cntBtn.click) { 12762 //safary for windows compatibility 12763 if ( document.createEvent ) { 12764 var evt = document.createEvent('MouseEvents'); 12765 evt.initEvent('click', true, false); 12766 cntBtn.dispatchEvent(evt); 12767 } else if( document.createEventObject ) { 12768 cntBtn.fireEvent('onclick') ; 12769 } else if (typeof node.onclick == 'function' ) { 12770 cntBtn.onclick(); 12771 } 12772 } else { 12773 cntBtn.click(); 12774 } 12775 } 12776 cntBtn.innerHTML = originalTxt + ' (' + counter + ')'; 12777 }, 1000); 12778 var clearIntervalFn = function(e){ 12779 clearInterval(intId); 12780 cntBtn.stopObserving('click', this.bind(this)); 12781 }; 12782 cntBtn.observe('click', clearIntervalFn.bind(clearIntervalFn)); 12783 } 12784 }, 12785 { 12786 name: 'options', 12787 rootCssSelector: '#acp-configurable-block', 12788 cssSelector: '#acp-product-options', 12789 enabled: false, 12790 beforeFire: function(args){}, 12791 afterFire: function(args){}, 12792 beforeUpdate: function(args){}, 12793 afterUpdate: function(args){ 12794 var el = $$(this.cssSelector); 12795 if (el.length === 1) { 12796 this.enabled = true; 12797 var msg = args[0]; 12798 this._addMsgBlock(msg); 12799 this._appearGroupedBlock(); 12800 this._appearGiftBlock(); 12801 this._appearAWGiftBlock(); 12802 this._cancelBtnInit(); 12803 this._addToCartBtnInit(); 12804 } 12805 }, 12806 12807 _addMsgBlock: function(msg) { 12808 if (!msg || !msg.length || msg.length < 1) { 12809 return; 12810 } 12811 var msgBlock = $$('.acp-msg-block')[0]; 12812 msgBlock.addClassName('messages'); 12813 AW_AjaxCartProUI._show(msgBlock); 12814 msgBlock.appendChild(new Element('li')); 12815 msgBlock = msgBlock.select('li')[0]; 12816 msgBlock.innerHTML = ''; 12817 var typeCount = {'error':0,'warning':0,'notice':0}; 12818 msg.each(function(message){ 12819 switch(message.type) { 12820 case 'error': 12821 typeCount.error++; 12822 break; 12823 case 'warning': 12824 typeCount.warning++; 12825 break; 12826 case 'notice': 12827 typeCount.notice++; 12828 break; 12829 default: 12830 } 12831 }); 12832 var type = 'notice'; 12833 if (typeCount.warning > 0) { 12834 type = 'warning'; 12835 } 12836 if (typeCount.error > 0) { 12837 type = 'error'; 12838 } 12839 switch(type) { 12840 case 'error': 12841 msgBlock.addClassName('error-msg'); 12842 msgBlock.removeClassName('notice-msg'); 12843 msgBlock.removeClassName('warning-msg'); 12844 break; 12845 case 'warning': 12846 msgBlock.addClassName('warning-msg'); 12847 msgBlock.removeClassName('error-msg'); 12848 msgBlock.removeClassName('notice-msg'); 12849 break; 12850 case 'notice': 12851 msgBlock.addClassName('notice-msg'); 12852 msgBlock.removeClassName('error-msg'); 12853 msgBlock.removeClassName('warning-msg'); 12854 break; 12855 default: 12856 AW_AjaxCartProUI._hide(msgBlock); 12857 } 12858 msg.each(function(message){ 12859 msgBlock.innerHTML += message.text + '<br />'; 12860 }); 12861 }, 12862 12863 _appearGroupedBlock: function() { 12864 var possibleSelectors = ['div.grouped-items-table-wrapper', 'table.grouped-items-table', 'table#super-product-table']; 12865 var groupedBlock = null; 12866 possibleSelectors.each(function(selector){ 12867 if (groupedBlock !== null) { 12868 return; 12869 } 12870 groupedBlock = $('acp-product-type-data').select(selector); 12871 if (groupedBlock.length === 0) { 12872 groupedBlock = null; 12873 return; 12874 } 12875 groupedBlock = groupedBlock[0]; 12876 }); 12877 AW_AjaxCartProUI._show($('acp-product-type-data')); 12878 $('acp-product-type-data').childElements().each(function(el){ 12879 if (el === groupedBlock || el.tagName.toLocaleLowerCase() === 'script') { 12880 return; 12881 } 12882 AW_AjaxCartProUI._hide(el); 12883 }); 12884 return null; 12885 }, 12886 12887 _appearGiftBlock: function() { 12888 var giftBlock = $('acp-product-type-data').select('.giftcard-send-form'); 12889 if (giftBlock.length === 0) { 12890 return; 12891 } 12892 giftBlock = giftBlock[0]; 12893 AW_AjaxCartProUI._show($('acp-product-type-data')); 12894 AW_AjaxCartProUI._show(giftBlock.up()); 12895 giftBlock.up().childElements().each(function(el){ 12896 if (el === giftBlock || el.tagName.toLocaleLowerCase() === 'script') { 12897 return; 12898 } 12899 AW_AjaxCartProUI._hide(el); 12900 }); 12901 return null; 12902 }, 12903 12904 _appearAWGiftBlock: function() { 12905 var giftBlock = $('acp-product-type-data').select('.aw-gc-form'); 12906 if (giftBlock.length === 0) { 12907 giftBlock = $('acp-product-type-data').select('.aw-gc-form-enterprise'); 12908 if (giftBlock.length === 0) { 12909 return; 12910 } 12911 } 12912 giftBlock = giftBlock[0]; 12913 AW_AjaxCartProUI._show($('acp-product-type-data')); 12914 AW_AjaxCartProUI._show(giftBlock); 12915 return null; 12916 }, 12917 12918 _cancelBtnInit: function() { 12919 var cancelBtn = $$(this.cssSelector)[0].select('.aw-acp-continue')[0]; 12920 cancelBtn.stopObserving('click', this._cancelBtnOnClick.bind(this)); 12921 cancelBtn.observe('click', this._cancelBtnOnClick.bind(this)); 12922 }, 12923 12924 _cancelBtnOnClick: function(event) { 12925 this._hideBlock(); 12926 event.stop(); 12927 }, 12928 12929 _addToCartBtnInit: function() { 12930 var addToCartButton = $$(this.cssSelector)[0].select('.aw-acp-checkout')[0]; 12931 addToCartButton.stopObserving('click', this._addToCartBtnOnClick.bind(this)); 12932 addToCartButton.observe('click', this._addToCartBtnOnClick.bind(this)); 12933 }, 12934 12935 _addToCartBtnOnClick: function(event) { 12936 if(productAddToCartFormAcp.validator && productAddToCartFormAcp.validator.validate()){ 12937 productAddToCartFormAcp.form.submit(); 12938 this._hideBlock(); 12939 } 12940 event.stop(); 12941 }, 12942 12943 _hideBlock: function() { 12944 this.enabled = false;
12945 AW_AjaxCartProUI.hideBlock(this.cssSelector); 12946 $$(this.rootCssSelector)[0].down().remove(); 12947 } 12948 } 12949]; 12950 12951 12952AW_AjaxCartProUIBlocks.each(function(block){ 12953 AW_AjaxCartProUI.registerBlock(block); 12954}); 12955 12956 12957 12958 12959 12960 12961var AW_AjaxCartProUpdaterObject = new AW_AjaxCartProUpdater('cart', ['.col-main', '#main']); 12962Object.extend(AW_AjaxCartProUpdaterObject, { 12963 updateOnUpdateRequest: true, 12964 updateOnActionRequest: false, 12965 12966 beforeUpdate: function(html){ 12967 return null; 12968 }, 12969 12970 update: function(html) { 12971 this.beforeUpdate(html); 12972 var selector = this._getTargetSelector(); 12973 if (selector === null) { 12974 return false; 12975 } 12976 $$(selector)[0].innerHTML = html; 12977 this._evalScripts(html); 12978 this.afterUpdate(html, [selector]); 12979 return true; 12980 }, 12981 12982 afterUpdate: function(html, selectors){ 12983 var me = this; 12984 selectors.each(function(selector){ 12985 me._effect(selector); 12986 }); 12987 return null; 12988 }, 12989 12990 _getTargetSelector: function() { 12991 var targetSelector = null; 12992 this.selectors.each(function(selector){ 12993 if (targetSelector !== null) { 12994 return; 12995 } 12996 if ($$(selector).length > 0) { 12997 targetSelector = selector; 12998 } 12999 }); 13000 return targetSelector; 13001 }, 13002 13003 _effect: function(obj) { 13004 var el = $$(obj)[0]; 13005 switch(this.config.cartAnimation) { 13006 case 'opacity': 13007 el.hide(); 13008 new Effect.Appear(el); 13009 break; 13010 case 'grow': 13011 el.hide(); 13012 new Effect.BlindDown(el); 13013 break; 13014 case 'blink': 13015 new Effect.Pulsate(el); 13016 break; 13017 default: 13018 } 13019 } 13020}); 13021AW_AjaxCartPro.registerUpdater(AW_AjaxCartProUpdaterObject); 13022delete AW_AjaxCartProUpdaterObject; 13023var AW_AjaxCartProUpdaterObject = new AW_AjaxCartProUpdater('topLinks', null, ['.header .quick-access>', '.toplinks-bar']); 13024Object.extend(AW_AjaxCartProUpdaterObject, { 13025 updateOnUpdateRequest: true, 13026 updateOnActionRequest: false, 13027 13028 beforeUpdate: function(html){ 13029 return null; 13030 }, 13031 afterUpdate: function(html, selectors){ 13032 return null; 13033 } 13034}); 13035AW_AjaxCartPro.registerUpdater(AW_AjaxCartProUpdaterObject); 13036delete AW_AjaxCartProUpdaterObject; 13037var AW_AjaxCartProUpdaterObject = new AW_AjaxCartProUpdater( 13038 'skipLinks', 13039 ['#mini-cart'], 13040 ['#mini-cart-wrapper-mobile'] 13041); 13042Object.extend(AW_AjaxCartProUpdaterObject, { 13043 updateOnUpdateRequest: true, 13044 updateOnActionRequest: false, 13045 13046 beforeUpdate: function(html){ 13047 return null; 13048 }, 13049 afterUpdate: function(html, selectors){ 13050 $j('#header-cart').on('click', '.skip-link-close', function (e) { 13051 var parent = $j(this).parents('.skip-content'); 13052 var link = parent.siblings('.skip-link'); 13053 13054 parent.removeClass('skip-active'); 13055 link.removeClass('skip-active'); 13056 13057 e.preventDefault(); 13058 }); 13059 jQuery('#mini-cart').removeClass('dropdown'); 13060 13061 return null; 13062 } 13063}); 13064AW_AjaxCartPro.registerUpdater(AW_AjaxCartProUpdaterObject); 13065delete AW_AjaxCartProUpdaterObject; 13066 13067 13068var AW_AjaxCartProUpdaterObject = new AW_AjaxCartProUpdater('options', ['#acp-configurable-block']); 13069Object.extend(AW_AjaxCartProUpdaterObject, { 13070 updateOnUpdateRequest: false, 13071 updateOnActionRequest: true, 13072 13073 beforeUpdate: function(html){ 13074 var el = $$(this.selectors[0])[0]; 13075 if (el && el.down()) { 13076 el.down().remove(); 13077 } 13078 return null; 13079 }, 13080 update: function(html) { 13081 this.beforeUpdate(html); 13082 var el = new Element('div'); 13083 el.innerHTML = html; 13084 $$(this.selectors[0])[0].appendChild(el.down()); 13085 this._evalScripts(html); 13086 this.afterUpdate(html, this.selectors); 13087 return true; 13088 }, 13089 afterUpdate: function(html, selectors){ 13090 return null; 13091 } 13092}); 13093AW_AjaxCartPro.registerUpdater(AW_AjaxCartProUpdaterObject);
13094delete AW_AjaxCartProUpdaterObject; 13095var AW_AjaxCartProUpdaterObject = new AW_AjaxCartProUpdater('wishlist', ['.my-account']); 13096Object.extend(AW_AjaxCartProUpdaterObject, { 13097 updateOnUpdateRequest: true, 13098 updateOnActionRequest: false, 13099 13100 beforeUpdate: function(html){ 13101 return null; 13102 }, 13103 13104 update: function(html) { 13105 this.beforeUpdate(html); 13106 var selector = this.selectors[0]; 13107 $$(selector)[0].innerHTML = html; 13108 this._evalScripts(html); 13109 this._evalEnterpriseWishlistScripts(); 13110 this.afterUpdate(html, this.selectors); 13111 return true; 13112 }, 13113 13114 afterUpdate: function(html, selectors){ 13115 return null; 13116 }, 13117 13118 _evalEnterpriseWishlistScripts: function() { 13119 if (typeof(Enterprise) === "undefined" || typeof(Enterprise.Wishlist) === "undefined") { 13120 return null; 13121 } 13122 //copy-paste from skin/../js/scripts.js for compatibility with Magento EE Multiple Wishlists 13123 $('wishlist-view-form').select('.split-button').each(function(node) { 13124 if (!$(node).hasClassName('split-button-created')) { 13125 new Enterprise.Widget.SplitButton(node); 13126 } 13127 }); 13128 //copy-paste from skin/../js/enterprise/wishlist.js for compatibility with Magento EE Multiple Wishlists 13129 $$('#wishlist-table div.description').each(function(el) { Enterprise.textOverflow(el); }); 13130 return null; 13131 } 13132}); 13133AW_AjaxCartPro.registerUpdater(AW_AjaxCartProUpdaterObject); 13134delete AW_AjaxCartProUpdaterObject; 13135var AW_AjaxCartProUpdaterObject = new AW_AjaxCartProUpdater('miniWishlist', ['.block-wishlist']); 13136Object.extend(AW_AjaxCartProUpdaterObject, { 13137 updateOnUpdateRequest: true, 13138 updateOnActionRequest: false, 13139 13140 beforeUpdate: function(html){ 13141 return null; 13142 }, 13143 afterUpdate: function(html, selectors){ 13144 return null; 13145 } 13146}); 13147AW_AjaxCartPro.registerUpdater(AW_AjaxCartProUpdaterObject); 13148delete AW_AjaxCartProUpdaterObject; 13149var AW_AjaxCartProUpdaterObject = new AW_AjaxCartProUpdater('addProductConfirmation'); 13150Object.extend(AW_AjaxCartProUpdaterObject, { 13151 updateOnUpdateRequest: true, 13152 updateOnActionRequest: false, 13153 13154 beforeUpdate: function(html){ 13155 return null; 13156 }, 13157 afterUpdate: function(html, selectors){ 13158 return null; 13159 } 13160}); 13161AW_AjaxCartPro.registerUpdater(AW_AjaxCartProUpdaterObject); 13162delete AW_AjaxCartProUpdaterObject; 13163var AW_AjaxCartProUpdaterObject = new AW_AjaxCartProUpdater('removeProductConfirmation'); 13164Object.extend(AW_AjaxCartProUpdaterObject, { 13165 updateOnUpdateRequest: true, 13166 updateOnActionRequest: false, 13167 13168 beforeUpdate: function(html){ 13169 return null; 13170 }, 13171 afterUpdate: function(html, selectors){ 13172 return null; 13173 } 13174}); 13175AW_AjaxCartPro.registerUpdater(AW_AjaxCartProUpdaterObject); 13176delete AW_AjaxCartProUpdaterObject; 13177var AW_AjaxCartProObserverObject = new AW_AjaxCartProObserver('clickOnButtonInCartPageForm'); 13178Object.extend(AW_AjaxCartProObserverObject, { 13179 13180 uiBlocks: ['progress'], 13181 13182 _stopFns: [], 13183 13184 run: function() { 13185 var me = this; 13186 var forms = this._getForms(); 13187 forms.each(function(form){ 13188 form.select('button[type=submit]').each(function(btn){ 13189 var fn = me._observeFn.bind(btn); 13190 btn.observe('click', fn); 13191 me._stopFns.push(function(){ 13192 btn.stopObserving('click', fn); 13193 }); 13194 }) 13195 }); 13196 }, 13197 13198 stop: function() { 13199 this._stopFns.each(function(fn){ 13200 fn(); 13201 }); 13202 this._stopFns = []; 13203 }, 13204 13205 fireOriginal: function(url, parameters) { 13206 this.stop(); 13207 if (this.lastClickedBtn) { 13208 this.lastClickedBtn.click(); 13209 } 13210 }, 13211 13212 _observeFn: function(event) { 13213 var me = AW_AjaxCartPro.config.actionsObservers.clickOnButtonInCartPageForm; 13214 var targetObj = this; 13215 if (!targetObj) { 13216 return; 13217 } 13218 13219 var action = targetObj.form.readAttribute('action') || ''; 13220 var params = targetObj.form.serialize(true); 13221 if (typeof($(targetObj).getValue) === 'function') { 13222 params[targetObj.getAttribute('name')] = $(targetObj).getValue(); 13223 } 13224 me.lastClickedBtn = targetObj; 13225 me.fireCustom(action, params); 13226 event.stop(); 13227 }, 13228 13229 _getForms: function() { 13230 if (typeof(this.forms) !== 'undefined') { 13231 return this.forms; 13232 } 13233 13234 var me = this; 13235 this.forms = []; 13236 $$('form').each(function(form){ 13237 if (form.action.indexOf('checkout/cart/updatePost') !== -1) { 13238 me.forms.push(form); 13239 } 13240 }); 13241 me._stopFns.push(function(){ 13242 delete me.forms; 13243 }); 13244 return this.forms; 13245 } 13246}); 13247AW_AjaxCartPro.registerObserver(AW_AjaxCartProObserverObject); 13248delete AW_AjaxCartProObserverObject; 13249var AW_AjaxCartProObserverObject = new AW_AjaxCartProObserver('clickOnAddToCartInCategoryList'); 13250Object.extend(AW_AjaxCartProObserverObject, { 13251 13252 uiBlocks: ['progress', 'options', 'add_confirmation'], 13253 13254 _oldSetLocation: null, 13255 13256 run: function() { 13257 this._oldSetLocation = setLocation; 13258 setLocation = this._observeFn.bind(this); 13259 }, 13260 13261 stop: function() { 13262 setLocation = this._oldSetLocation; 13263 }, 13264 13265 fireOriginal: function(url, parameters) { 13266 this._oldSetLocation(url); 13267 }, 13268 13269 _observeFn: function(url) { 13270 var mageVersion = AW_AjaxCartProConfig.data.mageVersion.split('.'); 13271 var is14XAndLess = (mageVersion[0] < 2 && mageVersion[1] < 5); 13272 var is18X = (mageVersion[0] === "1" && mageVersion[1] === "8"); 13273 var is113X = (mageVersion[0] === "1" && mageVersion[1] === "13"); 13274 var is19X = (mageVersion[0] === "1" && mageVersion[1] === "9"); 13275 var is114X = (mageVersion[0] === "1" && mageVersion[1] === "14"); 13276 if ( 13277 (url.indexOf('.html') !== -1 && url.indexOf('.html?') === -1 && (is18X || is113X)) || 13278 (url.indexOf('catalog/product/view/id') !== -1 && (is18X || is113X)) || 13279 (url.indexOf('.html') !== -1 && url.indexOf('.html?') === -1 && (is19X || is114X)) || 13280 (url.indexOf('catalog/product/view/id') !== -1 && (is19X || is114X)) || 13281 (url.indexOf('options=cart') !== -1) || 13282 (url.indexOf('checkout/cart/add') !== -1) || 13283 (url.indexOf('wishlist/index/cart') !== -1 && !is14XAndLess) 13284 ) { 13285 if (url.indexOf('checkout/cart/add') !== -1 && AW_AjaxCartProConfig.data.popupForAllProducts) { 13286 this.fireCustom(url, {'awacp-show-popup': 1}); 13287 } else { 13288 this.fireCustom(url); 13289 } 13290 } 13291 else { 13292 this.fireOriginal(url); 13293 } 13294 } 13295}); 13296AW_AjaxCartPro.registerObserver(AW_AjaxCartProObserverObject); 13297delete AW_AjaxCartProObserverObject; 13298 13299var AW_AjaxCartProObserverObject = new AW_AjaxCartProObserver('clickOnAddToCartInOptionsPopup'); 13300Object.extend(AW_AjaxCartProObserverObject, { 13301 13302 uiBlocks: ['progress', 'options', 'add_confirmation'], 13303 13304 _oldSubmitFn: null, 13305 13306 run: function() { 13307 var targetObj = this._getTargetObj(); 13308 if (!targetObj) { 13309 return null; 13310 } 13311 this._oldSubmitFn = targetObj.form.submit; 13312 targetObj.form.submit = this._observeFn.bind(this); 13313 return null; 13314 }, 13315 13316 stop: function() { 13317 var targetObj = this._getTargetObj(); 13318 if (!targetObj) { 13319 return; 13320 } 13321 targetObj.form.submit = this._oldSubmitFn; 13322 }, 13323 13324 fireOriginal: function(url, parameters) { 13325 var targetObj = this._getTargetObj(); 13326 if (!targetObj) { 13327 return; 13328 } 13329 this.stop(); 13330 targetObj.submit(); 13331 }, 13332 13333 _observeFn: function() { 13334 var targetObj = this._getTargetObj(); 13335 if (!targetObj) { 13336 return; 13337 } 13338 var action = targetObj.form.readAttribute('action') || ''; 13339 var params = targetObj.form.serialize(true); 13340 this.fireCustom(action, params); 13341 }, 13342 13343 _getTargetObj: function() { 13344 var targetObj = false;
13345 if (typeof(productAddToCartFormAcp) != 'undefined') { 13346 targetObj = productAddToCartFormAcp; 13347 } 13348 if (!targetObj) { 13349 return false; 13350 } 13351 return targetObj; 13352 } 13353}); 13354AW_AjaxCartPro.registerObserver(AW_AjaxCartProObserverObject); 13355delete AW_AjaxCartProObserverObject; 13356var AW_AjaxCartProObserverObject = new AW_AjaxCartProObserver('clickOnAddToCartInProductPage'); 13357Object.extend(AW_AjaxCartProObserverObject, { 13358 13359 uiBlocks: ['progress', 'options', 'add_confirmation'], 13360 13361 _oldSubmitFn: null, 13362 13363 run: function() { 13364 var targetObj = this._getTargetObj(); 13365 if (!targetObj) { 13366 return null; 13367 } 13368 this._oldSubmitFn = targetObj.form.submit; 13369 targetObj.form.submit = this._observeFn.bind(this); 13370 //HACK for EE 13371 targetObj.form.select('button').each(function(btn){ 13372 btn.removeAttribute('disabled') 13373 }); 13374 return null; 13375 }, 13376 13377 stop: function() { 13378 var targetObj = this._getTargetObj(); 13379 if (!targetObj) { 13380 return; 13381 } 13382 targetObj.form.submit = this._oldSubmitFn; 13383 }, 13384 13385 fireOriginal: function(url, parameters) { 13386 var targetObj = this._getTargetObj(); 13387 if (!targetObj) { 13388 return; 13389 } 13390 this.stop(); 13391 targetObj.submit(); 13392 }, 13393 13394 _observeFn: function() { 13395 var targetObj = this._getTargetObj(); 13396 if (!targetObj) { 13397 return; 13398 } 13399 if ( 13400 targetObj.form.action.indexOf('wishlist/index/add') !== -1 || 13401 targetObj.form.action.indexOf('wishlist/index/updateItemOptions') !== -1 || 13402 targetObj.form.action.indexOf('checkout/cart/updateItemOptions') !== -1 || 13403 (targetObj.form.return_url && targetObj.form.return_url.value.indexOf('/express/start') !== -1) 13404 ) { 13405 this.stop(); 13406 targetObj.form.submit(); 13407 this.run(); 13408 return; 13409 } 13410 var action = targetObj.form.readAttribute('action') || ''; 13411 var params = targetObj.form.serialize(true); 13412 Object.extend(params, { awacp_from_product_page : 1 }); 13413 this.fireCustom(action, params); 13414 }, 13415 13416 _getTargetObj: function() { 13417 var targetObj = false; 13418 if (typeof(productAddToCartFormOld) != 'undefined') { 13419 targetObj = productAddToCartFormOld; 13420 } else if (typeof(productAddToCartForm) != 'undefined') { 13421 targetObj = productAddToCartForm; 13422 } 13423 if (!targetObj) { 13424 return false; 13425 } 13426 return targetObj; 13427 } 13428}); 13429AW_AjaxCartPro.registerObserver(AW_AjaxCartProObserverObject); 13430delete AW_AjaxCartProObserverObject; 13431 13432var AW_AjaxCartProObserverObject = new AW_AjaxCartProObserver('clickOnDeleteFromCart'); 13433Object.extend(AW_AjaxCartProObserverObject, { 13434 13435 uiBlocks: ['progress', 'remove_confirmation'], 13436 13437 _stopFns: [], 13438 13439 run: function() { 13440 var me = this; 13441 var links = this._getLinks(); 13442 links.each(function(link){ 13443 var fn = me._observeFn.bind(link); 13444 link.observe('click', fn); 13445 link._onclick = link.onclick; 13446 link.onclick = function(e){}; 13447 link.removeAttribute('onclick'); 13448 me._stopFns.push(function(){ 13449 link.stopObserving('click', fn); 13450 link.onclick = link._onclick; 13451 link._onclick = function(e){}; 13452 }); 13453 }); 13454 }, 13455 13456 stop: function() { 13457 this._stopFns.each(function(fn){ 13458 fn(); 13459 }); 13460 this._stopFns = []; 13461 }, 13462 13463 fireOriginal: function(url, parameters) { 13464 this.stop(); 13465 document.location.href = url; 13466 }, 13467 13468 _observeFn: function(event) { 13469 var me = AW_AjaxCartPro.config.actionsObservers.clickOnDeleteFromCart; 13470 var link = this; 13471 if (link._onclick) { 13472 if (!link._onclick()) { 13473 event.stop(); 13474 return; 13475 } 13476 } 13477 var url = link.getAttribute('href'); 13478 me.fireCustom(url); 13479 event.stop(); 13480 }, 13481 13482 _getLinks: function() { 13483 if (typeof(this.links) !== 'undefined') { 13484 return this.links; 13485 } 13486 13487 var me = this; 13488 this.links = []; 13489 $$('a').each(function(l){ 13490 if (l.href.indexOf('checkout/cart/delete') !== -1) { 13491 me.links.push(l); 13492 } 13493 }); 13494 me._stopFns.push(function(){ 13495 delete me.links; 13496 }); 13497 return this.links; 13498 } 13499}); 13500AW_AjaxCartPro.registerObserver(AW_AjaxCartProObserverObject); 13501delete AW_AjaxCartProObserverObject; 13502var AW_AjaxCartProObserverObject = new AW_AjaxCartProObserver('clickOnAddToCartInMiniWishlist'); 13503Object.extend(AW_AjaxCartProObserverObject, { 13504 13505 uiBlocks: ['progress', 'options', 'add_confirmation'], 13506 13507 _stopFns: [], 13508 13509 run: function() { 13510 var me = this; 13511 var links = this._getLinks(); 13512 links.each(function(link){ 13513 var fn = me._observeFn.bind(me); 13514 link.observe('click', fn); 13515 me._stopFns.push(function(){ 13516 link.stopObserving('click', fn); 13517 }); 13518 }); 13519 }, 13520 13521 stop: function() { 13522 this._stopFns.each(function(fn){ 13523 fn(); 13524 }); 13525 this._stopFns = []; 13526 }, 13527 13528 fireOriginal: function(url, parameters) { 13529 this.stop(); 13530 document.location.href = url; 13531 }, 13532 13533 _observeFn: function(event) { 13534 var url = $(event.target).getAttribute('href'); 13535 this.fireCustom(url); 13536 event.stop(); 13537 }, 13538 13539 _getLinks: function() { 13540 var mageVersion = AW_AjaxCartProConfig.data.mageVersion.split('.'); 13541 if (mageVersion[0] < 2 && mageVersion[1] < 5) { 13542 return []; 13543 } 13544 13545 if (typeof(this.links) !== 'undefined') { 13546 return this.links; 13547 } 13548 13549 var me = this; 13550 this.links = []; 13551 $$('a').each(function(l){ 13552 if (l.href.indexOf('wishlist/index/cart') !== -1) { 13553 me.links.push(l); 13554 } 13555 }); 13556 me._stopFns.push(function(){ 13557 delete me.links; 13558 }); 13559 return this.links; 13560 } 13561}); 13562AW_AjaxCartPro.registerObserver(AW_AjaxCartProObserverObject); 13563delete AW_AjaxCartProObserverObject; 13564/** 13565 * Magento 13566 * 13567 * NOTICE OF LICENSE 13568 * 13569 * This source file is subject to the Academic Free License (AFL 3.0)
13570 * that is bundled with this package in the file LICENSE_AFL.txt. 13571 * It is also available through the world-wide-web at this URL: 13572 * http://opensource.org/licenses/afl-3.0.php 13573 * If you did not receive a copy of the license and are unable to 13574 * obtain it through the world-wide-web, please send an email 13575 * to [email protected] so we can send you a copy immediately. 13576 * 13577 * DISCLAIMER 13578 * 13579 * Do not edit or add to this file if you wish to upgrade Magento to newer 13580 * versions in the future. If you wish to customize Magento for your 13581 * needs please refer to http://www.magento.com for more information. 13582 * 13583 * @category Varien 13584 * @package js 13585 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 13586 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 13587 */ 13588if(typeof Product=='undefined') { 13589 var Product = {}; 13590} 13591 13592/********************* IMAGE ZOOMER ***********************/ 13593 13594Product.Zoom = Class.create(); 13595/** 13596 * Image zoom control 13597 * 13598 * @author Magento Core Team <[email protected]> 13599 */ 13600Product.Zoom.prototype = { 13601 initialize: function(imageEl, trackEl, handleEl, zoomInEl, zoomOutEl, hintEl){ 13602 this.containerEl = $(imageEl).parentNode; 13603 this.imageEl = $(imageEl); 13604 this.handleEl = $(handleEl); 13605 this.trackEl = $(trackEl); 13606 this.hintEl = $(hintEl); 13607 13608 this.containerDim = Element.getDimensions(this.containerEl); 13609 this.imageDim = Element.getDimensions(this.imageEl); 13610 13611 this.imageDim.ratio = this.imageDim.width/this.imageDim.height; 13612 13613 this.floorZoom = 1; 13614 13615 if (this.imageDim.width > this.imageDim.height) { 13616 this.ceilingZoom = this.imageDim.width / this.containerDim.width; 13617 } else { 13618 this.ceilingZoom = this.imageDim.height / this.containerDim.height; 13619 } 13620 13621 if (this.imageDim.width <= this.containerDim.width 13622 && this.imageDim.height <= this.containerDim.height) { 13623 this.trackEl.up().hide(); 13624 this.hintEl.hide(); 13625 this.containerEl.removeClassName('product-image-zoom'); 13626 return; 13627 } 13628 13629 this.imageX = 0; 13630 this.imageY = 0; 13631 this.imageZoom = 1; 13632 13633 this.sliderSpeed = 0; 13634 this.sliderAccel = 0; 13635 this.zoomBtnPressed = false; 13636 13637 this.showFull = false; 13638 13639 this.selects = document.getElementsByTagName('select'); 13640 13641 this.draggable = new Draggable(imageEl, { 13642 starteffect:false, 13643 reverteffect:false, 13644 endeffect:false, 13645 snap:this.contain.bind(this) 13646 }); 13647 13648 this.slider = new Control.Slider(handleEl, trackEl, { 13649 axis:'horizontal', 13650 minimum:0, 13651 maximum:Element.getDimensions(this.trackEl).width, 13652 alignX:0, 13653 increment:1, 13654 sliderValue:0, 13655 onSlide:this.scale.bind(this), 13656 onChange:this.scale.bind(this) 13657 }); 13658 13659 this.scale(0); 13660 13661 Event.observe(this.imageEl, 'dblclick', this.toggleFull.bind(this)); 13662 13663 Event.observe($(zoomInEl), 'mousedown', this.startZoomIn.bind(this)); 13664 Event.observe($(zoomInEl), 'mouseup', this.stopZooming.bind(this)); 13665 Event.observe($(zoomInEl), 'mouseout', this.stopZooming.bind(this)); 13666 13667 Event.observe($(zoomOutEl), 'mousedown', this.startZoomOut.bind(this)); 13668 Event.observe($(zoomOutEl), 'mouseup', this.stopZooming.bind(this)); 13669 Event.observe($(zoomOutEl), 'mouseout', this.stopZooming.bind(this)); 13670 }, 13671 13672 toggleFull: function () { 13673 this.showFull = !this.showFull; 13674 13675 //Hide selects for IE6 only 13676 if (typeof document.body.style.maxHeight == "undefined") { 13677 for (i=0; i<this.selects.length; i++) { 13678 this.selects[i].style.visibility = this.showFull ? 'hidden' : 'visible'; 13679 } 13680 } 13681 val_scale = !this.showFull ? this.slider.value : 1; 13682 this.scale(val_scale); 13683 13684 this.trackEl.style.visibility = this.showFull ? 'hidden' : 'visible';
13685 this.containerEl.style.overflow = this.showFull ? 'visible' : 'hidden'; 13686 this.containerEl.style.zIndex = this.showFull ? '1000' : '9'; 13687 13688 return this; 13689 }, 13690 13691 scale: function (v) { 13692 var centerX = (this.containerDim.width*(1-this.imageZoom)/2-this.imageX)/this.imageZoom; 13693 var centerY = (this.containerDim.height*(1-this.imageZoom)/2-this.imageY)/this.imageZoom; 13694 var overSize = (this.imageDim.width > this.containerDim.width || this.imageDim.height > this.containerDim.height); 13695 13696 this.imageZoom = this.floorZoom+(v*(this.ceilingZoom-this.floorZoom)); 13697 13698 if (overSize) { 13699 if (this.imageDim.width > this.imageDim.height) { 13700 this.imageEl.style.width = (this.imageZoom*this.containerDim.width)+'px'; 13701 } else { 13702 this.imageEl.style.height = (this.imageZoom*this.containerDim.height)+'px'; 13703 } 13704 if (this.containerDim.ratio) { 13705 if (this.imageDim.width > this.imageDim.height) { 13706 this.imageEl.style.height = (this.imageZoom*this.containerDim.width*this.containerDim.ratio)+'px'; // for safari 13707 } else { 13708 this.imageEl.style.width = (this.imageZoom*this.containerDim.height*this.containerDim.ratio)+'px'; // for safari 13709 } 13710 } 13711 } else { 13712 this.slider.setDisabled(); 13713 } 13714 13715 this.imageX = this.containerDim.width*(1-this.imageZoom)/2-centerX*this.imageZoom; 13716 this.imageY = this.containerDim.height*(1-this.imageZoom)/2-centerY*this.imageZoom; 13717 13718 this.contain(this.imageX, this.imageY, this.draggable); 13719 13720 return true; 13721 }, 13722 13723 startZoomIn: function() 13724 { 13725 if (!this.slider.disabled) { 13726 this.zoomBtnPressed = true; 13727 this.sliderAccel = .002; 13728 this.periodicalZoom(); 13729 this.zoomer = new PeriodicalExecuter(this.periodicalZoom.bind(this), .05); 13730 } 13731 return this; 13732 }, 13733 13734 startZoomOut: function() 13735 { 13736 if (!this.slider.disabled) { 13737 this.zoomBtnPressed = true; 13738 this.sliderAccel = -.002; 13739 this.periodicalZoom(); 13740 this.zoomer = new PeriodicalExecuter(this.periodicalZoom.bind(this), .05); 13741 } 13742 return this; 13743 }, 13744 13745 stopZooming: function() 13746 { 13747 if (!this.zoomer || this.sliderSpeed==0) { 13748 return; 13749 } 13750 this.zoomBtnPressed = false; 13751 this.sliderAccel = 0; 13752 }, 13753 13754 periodicalZoom: function() 13755 { 13756 if (!this.zoomer) { 13757 return this; 13758 } 13759 13760 if (this.zoomBtnPressed) { 13761 this.sliderSpeed += this.sliderAccel; 13762 } else { 13763 this.sliderSpeed /= 1.5; 13764 if (Math.abs(this.sliderSpeed)<.001) { 13765 this.sliderSpeed = 0; 13766 this.zoomer.stop(); 13767 this.zoomer = null; 13768 } 13769 } 13770 this.slider.value += this.sliderSpeed; 13771 13772 this.slider.setValue(this.slider.value); 13773 this.scale(this.slider.value); 13774 13775 return this; 13776 }, 13777 13778 contain: function (x,y,draggable) { 13779 13780 var dim = Element.getDimensions(draggable.element); 13781 13782 var xMin = 0, xMax = this.containerDim.width-dim.width; 13783 var yMin = 0, yMax = this.containerDim.height-dim.height; 13784 13785 x = x>xMin ? xMin : x; 13786 x = x<xMax ? xMax : x; 13787 y = y>yMin ? yMin : y; 13788 y = y<yMax ? yMax : y; 13789 13790 if (this.containerDim.width > dim.width) { 13791 x = (this.containerDim.width/2) - (dim.width/2); 13792 } 13793 13794 if (this.containerDim.height > dim.height) { 13795 y = (this.containerDim.height/2) - (dim.height/2); 13796 } 13797 13798 this.imageX = x; 13799 this.imageY = y; 13800 13801 this.imageEl.style.left = this.imageX+'px'; 13802 this.imageEl.style.top = this.imageY+'px'; 13803 13804 return [x,y]; 13805 } 13806}; 13807 13808/**************************** CONFIGURABLE PRODUCT **************************/ 13809Product.Config = Class.create(); 13810Product.Config.prototype = { 13811 initialize: function(config){ 13812 this.config = config; 13813 this.taxConfig = this.config.taxConfig; 13814 this.settings = $$('.super-attribute-select'); 13815 this.state = new Hash(); 13816 this.priceTemplate = new Template(this.config.template); 13817 this.prices = config.prices; 13818 13819 this.settings.each(function(element){ 13820 Event.observe(element, 'change', this.configure.bind(this)); 13821 }.bind(this)); 13822 13823 // fill state 13824 this.settings.each(function(element){
13825 var attributeId = element.id.replace(/[a-z]*/, ''); 13826 if(attributeId && this.config.attributes[attributeId]) { 13827 element.config = this.config.attributes[attributeId]; 13828 element.attributeId = attributeId; 13829 this.state[attributeId] = false; 13830 } 13831 }.bind(this)); 13832 13833 // Init settings dropdown 13834 var childSettings = []; 13835 for(var i=this.settings.length-1;i>=0;i--){ 13836 var prevSetting = this.settings[i-1] ? this.settings[i-1] : false; 13837 var nextSetting = this.settings[i+1] ? this.settings[i+1] : false; 13838 if(i==0){ 13839 this.fillSelect(this.settings[i]); 13840 } 13841 else { 13842 this.settings[i].disabled=true; 13843 } 13844 $(this.settings[i]).childSettings = childSettings.clone(); 13845 $(this.settings[i]).prevSetting = prevSetting; 13846 $(this.settings[i]).nextSetting = nextSetting; 13847 childSettings.push(this.settings[i]); 13848 } 13849 13850 // Set default values - from config and overwrite them by url values 13851 if (config.defaultValues) { 13852 this.values = config.defaultValues; 13853 } 13854 13855 var separatorIndex = window.location.href.indexOf('#'); 13856 if (separatorIndex != -1) { 13857 var paramsStr = window.location.href.substr(separatorIndex+1); 13858 var urlValues = paramsStr.toQueryParams(); 13859 if (!this.values) { 13860 this.values = {}; 13861 } 13862 for (var i in urlValues) { 13863 this.values[i] = urlValues[i]; 13864 } 13865 } 13866 13867 this.configureForValues(); 13868 document.observe("dom:loaded", this.configureForValues.bind(this)); 13869 }, 13870 13871 configureForValues: function () { 13872 if (this.values) { 13873 this.settings.each(function(element){ 13874 var attributeId = element.attributeId; 13875 element.value = (typeof(this.values[attributeId]) == 'undefined')? '' : this.values[attributeId]; 13876 this.configureElement(element); 13877 }.bind(this)); 13878 } 13879 }, 13880 13881 configure: function(event){ 13882 var element = Event.element(event); 13883 this.configureElement(element); 13884 }, 13885 13886 configureElement : function(element) { 13887 this.reloadOptionLabels(element); 13888 if(element.value){ 13889 this.state[element.config.id] = element.value; 13890 if(element.nextSetting){ 13891 element.nextSetting.disabled = false; 13892 this.fillSelect(element.nextSetting); 13893 this.resetChildren(element.nextSetting); 13894 } 13895 } 13896 else { 13897 this.resetChildren(element); 13898 } 13899 this.reloadPrice(); 13900// Calculator.updatePrice(); 13901 }, 13902 13903 reloadOptionLabels: function(element){ 13904 var selectedPrice; 13905 if(element.options[element.selectedIndex].config){ 13906 selectedPrice = parseFloat(element.options[element.selectedIndex].config.price); 13907 } 13908 else{ 13909 selectedPrice = 0; 13910 } 13911 for(var i=0;i<element.options.length;i++){ 13912 if(element.options[i].config){ 13913 element.options[i].text = this.getOptionLabel(element.options[i].config, element.options[i].config.price-selectedPrice); 13914 } 13915 } 13916 }, 13917 13918 resetChildren : function(element){ 13919 if(element.childSettings) { 13920 for(var i=0;i<element.childSettings.length;i++){ 13921 element.childSettings[i].selectedIndex = 0; 13922 element.childSettings[i].disabled = true; 13923 if(element.config){ 13924 this.state[element.config.id] = false; 13925 } 13926 } 13927 } 13928 }, 13929 13930 fillSelect: function(element){ 13931 var attributeId = element.id.replace(/[a-z]*/, ''); 13932 var options = this.getAttributeOptions(attributeId); 13933 this.clearSelect(element); 13934 element.options[0] = new Option('', ''); 13935 element.options[0].innerHTML = this.config.chooseText; 13936 13937 var prevConfig = false; 13938 if(element.prevSetting){ 13939 prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex]; 13940 } 13941 13942 if(options) { 13943 var index = 1; 13944 for(var i=0;i<options.length;i++){ 13945 var allowedProducts = []; 13946 if(prevConfig) { 13947 for(var j=0;j<options[i].products.length;j++){ 13948 if(prevConfig.config.allowedProducts 13949 && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){ 13950 allowedProducts.push(options[i].products[j]); 13951 } 13952 } 13953 } else { 13954 allowedProducts = options[i].products.clone(); 13955 } 13956 13957 if(allowedProducts.size()>0){ 13958 options[i].allowedProducts = allowedProducts; 13959 element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id); 13960 element.options[index].config = options[i]; 13961 index++; 13962 } 13963 } 13964 } 13965 }, 13966 13967 getOptionLabel: function(option, price){ 13968 var price = parseFloat(price); 13969 if (this.taxConfig.includeTax) { 13970 var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax; 13971 var excl = price - tax; 13972 var incl = excl*(1+(this.taxConfig.currentTax/100)); 13973 } else { 13974 var tax = price * (this.taxConfig.currentTax / 100); 13975 var excl = price; 13976 var incl = excl + tax; 13977 } 13978 13979 if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) { 13980 price = incl; 13981 } else { 13982 price = excl; 13983 } 13984 13985 var str = option.label; 13986 if(price){ 13987 if (this.taxConfig.showBothPrices) { 13988 str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')'; 13989 } else { 13990 str+= ' ' + this.formatPrice(price, true); 13991 } 13992 } 13993 return str; 13994 }, 13995 13996 formatPrice: function(price, showSign){ 13997 var str = ''; 13998 price = parseFloat(price); 13999 if(showSign){ 14000 if(price<0){ 14001 str+= '-'; 14002 price = -price; 14003 } 14004 else{ 14005 str+= '+'; 14006 } 14007 } 14008 14009 var roundedPrice = (Math.round(price*100)/100).toString(); 14010 14011 if (this.prices && this.prices[roundedPrice]) { 14012 str+= this.prices[roundedPrice]; 14013 } 14014 else { 14015 str+= this.priceTemplate.evaluate({price:price.toFixed(2)}); 14016 } 14017 return str; 14018 }, 14019 14020 clearSelect: function(element){ 14021 for(var i=element.options.length-1;i>=0;i--){ 14022 element.remove(i); 14023 } 14024 }, 14025 14026 getAttributeOptions: function(attributeId){ 14027 if(this.config.attributes[attributeId]){ 14028 return this.config.attributes[attributeId].options; 14029 } 14030 }, 14031 14032 reloadPrice: function(){ 14033 var price = 0; 14034 var oldPrice = 0; 14035 for(var i=this.settings.length-1;i>=0;i--){ 14036 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 14037 if(selected.config){ 14038 price += parseFloat(selected.config.price); 14039 oldPrice += parseFloat(selected.config.oldPrice); 14040 } 14041 } 14042 14043 optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice}); 14044 optionsPrice.reload(); 14045 14046 return price; 14047 14048 if($('product-price-'+this.config.productId)){ 14049 $('product-price-'+this.config.productId).innerHTML = price; 14050 } 14051 this.reloadOldPrice(); 14052 }, 14053 14054 reloadOldPrice: function(){ 14055 if ($('old-price-'+this.config.productId)) { 14056 14057 var price = parseFloat(this.config.oldPrice); 14058 for(var i=this.settings.length-1;i>=0;i--){ 14059 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 14060 if(selected.config){ 14061 var parsedOldPrice = parseFloat(selected.config.oldPrice); 14062 price += isNaN(parsedOldPrice) ? 0 : parsedOldPrice; 14063 } 14064 } 14065 if (price < 0) 14066 price = 0; 14067 price = this.formatPrice(price); 14068 14069 if($('old-price-'+this.config.productId)){ 14070 $('old-price-'+this.config.productId).innerHTML = price; 14071 } 14072 14073 } 14074 } 14075}; 14076 14077 14078/**************************** SUPER PRODUCTS ********************************/ 14079 14080Product.Super = {}; 14081Product.Super.Configurable = Class.create(); 14082 14083Product.Super.Configurable.prototype = { 14084 initialize: function(container, observeCss, updateUrl, updatePriceUrl, priceContainerId) { 14085 this.container = $(container); 14086 this.observeCss = observeCss; 14087 this.updateUrl = updateUrl; 14088 this.updatePriceUrl = updatePriceUrl; 14089 this.priceContainerId = priceContainerId; 14090 this.registerObservers(); 14091 }, 14092 registerObservers: function() { 14093 var elements = this.container.getElementsByClassName(this.observeCss); 14094 elements.each(function(element){ 14095 Event.observe(element, 'change', this.update.bindAsEventListener(this)); 14096 }.bind(this)); 14097 return this; 14098 }, 14099 update: function(event) { 14100 var elements = this.container.getElementsByClassName(this.observeCss); 14101 var parameters = Form.serializeElements(elements, true); 14102 14103 new Ajax.Updater(this.container, this.updateUrl + '?ajax=1', { 14104 parameters:parameters, 14105 onComplete:this.registerObservers.bind(this) 14106 }); 14107 var priceContainer = $(this.priceContainerId); 14108 if(priceContainer) { 14109 new Ajax.Updater(priceContainer, this.updatePriceUrl + '?ajax=1', { 14110 parameters:parameters 14111 }); 14112 } 14113 } 14114}; 14115 14116Product.ACPconfigurable = Class.create(); 14117Product.ACPconfigurable.prototype = { 14118 config : {}, 14119 initialize : function(config){ 14120 this.config = config; 14121 this.taxConfig = this.config.taxConfig; 14122 this.settings = $$('.super-attribute-select-acp'); 14123 this.state = new Hash(); 14124 this.priceTemplate = new Template(this.config.template); 14125 this.prices = config.prices; 14126 14127 this.settings.each(function(element){ 14128 Event.observe(element, 'change', this.configure.bind(this)) 14129 }.bind(this)); 14130 14131 // fill state 14132 this.settings.each(function(element){
14133 var attributeId = element.id.replace(/[a-z]*/, ''); 14134 if(attributeId && this.config.attributes[attributeId]) { 14135 element.config = this.config.attributes[attributeId]; 14136 element.attributeId = attributeId; 14137 this.state[attributeId] = false; 14138 } 14139 }.bind(this)); 14140 14141 // Init settings dropdown 14142 var childSettings = []; 14143 for(var i=this.settings.length-1;i>=0;i--){ 14144 var prevSetting = this.settings[i-1] ? this.settings[i-1] : false; 14145 var nextSetting = this.settings[i+1] ? this.settings[i+1] : false; 14146 if(i==0){ 14147 this.fillSelect(this.settings[i]) 14148 } 14149 else { 14150 this.settings[i].disabled=true; 14151 } 14152 $(this.settings[i]).childSettings = childSettings.clone(); 14153 $(this.settings[i]).prevSetting = prevSetting; 14154 $(this.settings[i]).nextSetting = nextSetting; 14155 childSettings.push(this.settings[i]); 14156 } 14157 14158 // try retireve options from url 14159 var separatorIndex = window.location.href.indexOf('#'); 14160 if (separatorIndex!=-1) { 14161 var paramsStr = window.location.href.substr(separatorIndex+1); 14162 this.values = paramsStr.toQueryParams(); 14163 this.settings.each(function(element){ 14164 var attributeId = element.attributeId; 14165 element.value = (typeof(this.values[attributeId]) == 'undefined')? '' : this.values[attributeId]; 14166 this.configureElement(element); 14167 }.bind(this)); 14168 } 14169 }, 14170 fillSelect: function(element){ 14171 var attributeId = element.id.replace(/[a-z]*/, ''); 14172 var options = this.getAttributeOptions(attributeId); 14173 this.clearSelect(element); 14174 element.options[0] = new Option(this.config.chooseText, ''); 14175 14176 var prevConfig = false; 14177 if(element.prevSetting){ 14178 prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex]; 14179 } 14180 14181 if(options) { 14182 var index = 1; 14183 for(var i=0;i<options.length;i++){ 14184 var allowedProducts = []; 14185 if(prevConfig) { 14186 for(var j=0;j<options[i].products.length;j++){ 14187 if(prevConfig.config.allowedProducts 14188 && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){ 14189 allowedProducts.push(options[i].products[j]); 14190 } 14191 } 14192 } else { 14193 allowedProducts = options[i].products.clone(); 14194 } 14195 14196 if(allowedProducts.size()>0){ 14197 options[i].allowedProducts = allowedProducts; 14198 element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id); 14199 element.options[index].config = options[i]; 14200 index++; 14201 } 14202 } 14203 } 14204 }, 14205 configure: function(event){ 14206 var element = Event.element(event); 14207 this.configureElement(element); 14208 }, 14209 configureElement : function(element) { 14210 this.reloadOptionLabels(element); 14211 if(element.value){ 14212 this.state[element.config.id] = element.value; 14213 if(element.nextSetting){ 14214 element.nextSetting.disabled = false; 14215 this.fillSelect(element.nextSetting); 14216 this.resetChildren(element.nextSetting); 14217 } 14218 } 14219 else { 14220 this.resetChildren(element); 14221 } 14222 this.reloadPrice(); 14223 // Calculator.updatePrice(); 14224 }, 14225 getAttributeOptions: function(attributeId){ 14226 if(this.config.attributes[attributeId]){ 14227 return this.config.attributes[attributeId].options; 14228 } 14229 }, 14230 clearSelect: function(element){ 14231 for(var i=element.options.length-1;i>=0;i--){ 14232 element.remove(i); 14233 } 14234 }, 14235 getOptionLabel: function(option, price){ 14236 var price = parseFloat(price); 14237 if (this.taxConfig.includeTax) { 14238 var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax; 14239 var excl = price - tax; 14240 var incl = excl*(1+(this.taxConfig.currentTax/100)); 14241 } else { 14242 var tax = price * (this.taxConfig.currentTax / 100); 14243 var excl = price; 14244 var incl = excl + tax; 14245 } 14246 14247 if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) { 14248 price = incl; 14249 } else { 14250 price = excl; 14251 } 14252 14253 var str = option.label; 14254 if(price){ 14255 if (this.taxConfig.showBothPrices) { 14256 str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')'; 14257 } else { 14258 str+= ' ' + this.formatPrice(price, true); 14259 } 14260 } 14261 return str; 14262 }, 14263 formatPrice: function(price, showSign){ 14264 var str = ''; 14265 price = parseFloat(price); 14266 if(showSign){ 14267 if(price<0){ 14268 str+= '-'; 14269 price = -price; 14270 } 14271 else{ 14272 str+= '+'; 14273 } 14274 } 14275 14276 var roundedPrice = (Math.round(price*100)/100).toString(); 14277 14278 if (this.prices && this.prices[roundedPrice]) { 14279 str+= this.prices[roundedPrice]; 14280 } 14281 else { 14282 str+= this.priceTemplate.evaluate({ 14283 price:price.toFixed(2) 14284 }); 14285 } 14286 return str; 14287 }, 14288 reloadPrice : function(){ 14289 var price = 0; 14290 for(var i=this.settings.length-1;i>=0;i--){ 14291 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 14292 if(selected.config){ 14293 price += parseFloat(selected.config.price); 14294 } 14295 } 14296 14297 optionsPrice.changePrice('configAcp', price); 14298 optionsPrice.reload(); 14299 14300 return price; 14301 }, 14302 reloadOptionLabels: function(element){ 14303 var selectedPrice; 14304 if(element.options[element.selectedIndex].config){ 14305 selectedPrice = parseFloat(element.options[element.selectedIndex].config.price) 14306 } 14307 else{ 14308 selectedPrice = 0; 14309 } 14310 for(var i=0;i<element.options.length;i++){ 14311 if(element.options[i].config){ 14312 element.options[i].text = this.getOptionLabel(element.options[i].config, element.options[i].config.price-selectedPrice); 14313 } 14314 } 14315 }, 14316 14317 resetChildren : function(element){ 14318 if(element.childSettings) { 14319 for(var i=0;i<element.childSettings.length;i++){ 14320 element.childSettings[i].selectedIndex = 0; 14321 element.childSettings[i].disabled = true; 14322 if(element.config){ 14323 this.state[element.config.id] = false;
14324 } 14325 } 14326 } 14327 }, 14328 reloadOldPrice: function(){ 14329 if ($('old-price-'+this.config.productId)) { 14330 14331 var price = parseFloat(this.config.oldPrice); 14332 for(var i=this.settings.length-1;i>=0;i--){ 14333 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 14334 if(selected.config){ 14335 price+= parseFloat(selected.config.price); 14336 } 14337 } 14338 if (price < 0) 14339 price = 0; 14340 price = this.formatPrice(price); 14341 14342 if($('old-price-'+this.config.productId)){ 14343 $('old-price-'+this.config.productId).innerHTML = price; 14344 } 14345 14346 } 14347 } 14348}; 14349 14350Product.DownloadableAcp = Class.create(); 14351Product.DownloadableAcp.prototype = { 14352 config : {}, 14353 initialize : function(config){ 14354 this.config = config; 14355 this.reloadPrice(); 14356 }, 14357 reloadPrice : function(){ 14358 var price = 0; 14359 var configNew = this.config; 14360 $$('.product-downloadable-link-acp').each(function(elm){ 14361 if (configNew[elm.value] && elm.checked) { 14362 price += parseFloat(configNew[elm.value]); 14363 } 14364 }); 14365 try { 14366 var _displayZeroPrice = optionsPrice.displayZeroPrice; 14367 optionsPrice.displayZeroPrice = false; 14368 optionsPrice.changePrice('downloadableAcp', price); 14369 optionsPrice.reload(); 14370 optionsPrice.displayZeroPrice = _displayZeroPrice; 14371 } catch (e) { 14372 14373 } 14374 } 14375}; 14376 14377function validateDownloadableCallback(elmId, result) { 14378 var container = $('downloadable-links-list'); 14379 if (result == 'failed') { 14380 container.removeClassName('validation-passed'); 14381 container.addClassName('validation-failed'); 14382 } else { 14383 container.removeClassName('validation-failed'); 14384 container.addClassName('validation-passed'); 14385 } 14386} 14387
vendor: 97,163 bytes, lines 14388-14392
14388/*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license */ 14389!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(!l.ownFirst)for(b in a)return k.call(a,b);for(b in a);return void 0===b||k.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(h)return h.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=e.call(arguments,2),d=function(){return a.apply(b||this,c.concat(e.call(arguments)))},d.guid=a.guid=a.guid||n.guid++,d):void 0},now:function(){return+new Date},support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=la(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=ma(b);function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}if(f=d.getElementById(e[2]),f&&f.parentNode){if(f.id!==e[2])return A.find(a);this.length=1,this[0]=f}return this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||(e=n.uniqueSort(e)),D.test(a)&&(e=e.reverse())),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=!0,c||j.disable(),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.addEventListener?(d.removeEventListener("DOMContentLoaded",K),a.removeEventListener("load",K)):(d.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(d.addEventListener||"load"===a.event.type||"complete"===d.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll)a.setTimeout(n.ready);else if(d.addEventListener)d.addEventListener("DOMContentLoaded",K),a.addEventListener("load",K);else{d.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&d.documentElement}catch(e){}c&&c.doScroll&&!function f(){if(!n.isReady){try{c.doScroll("left")}catch(b){return a.setTimeout(f,50)}J(),n.ready()}}()}return I.promise(b)},n.ready.promise();var L;for(L in n(l))break;l.ownFirst="0"===L,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c,e;c=d.getElementsByTagName("body")[0],c&&c.style&&(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",l.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(e))}),function(){var a=d.createElement("div");l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}a=null}();var M=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b},N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0; 14390}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(M(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),"object"!=typeof b&&"function"!=typeof b||(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f}}function S(a,b,c){if(M(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}}),function(){var a;l.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,e;return c=d.getElementsByTagName("body")[0],c&&c.style?(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(d.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(e),a):void 0}}();var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),V=["Top","Right","Bottom","Left"],W=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function X(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&U.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var Y=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)Y(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},Z=/^(?:checkbox|radio)$/i,$=/<([\w:-]+)/,_=/^$|\/(?:java|ecma)script/i,aa=/^\s+/,ba="abbr|article|aside|audio|bdi|canvas|data|datalist|details|dialog|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|picture|progress|section|summary|template|time|video";function ca(a){var b=ba.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}!function(){var a=d.createElement("div"),b=d.createDocumentFragment(),c=d.createElement("input");a.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",l.leadingWhitespace=3===a.firstChild.nodeType,l.tbody=!a.getElementsByTagName("tbody").length,l.htmlSerialize=!!a.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==d.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,b.appendChild(c),l.appendChecked=c.checked,a.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!a.cloneNode(!0).lastChild.defaultValue,b.appendChild(a),c=d.createElement("input"),c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),a.appendChild(c),l.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!!a.addEventListener,a[n.expando]=1,l.attributes=!a.getAttribute(n.expando)}();var da={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]};da.optgroup=da.option,da.tbody=da.tfoot=da.colgroup=da.caption=da.thead,da.th=da.td;function ea(a,b){var c,d,e=0,f="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,ea(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function fa(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}var ga=/<|&#?\w+;/,ha=/<tbody/i;function ia(a){Z.test(a.type)&&(a.defaultChecked=a.checked)}function ja(a,b,c,d,e){for(var f,g,h,i,j,k,m,o=a.length,p=ca(b),q=[],r=0;o>r;r++)if(g=a[r],g||0===g)if("object"===n.type(g))n.merge(q,g.nodeType?[g]:g);else if(ga.test(g)){i=i||p.appendChild(b.createElement("div")),j=($.exec(g)||["",""])[1].toLowerCase(),m=da[j]||da._default,i.innerHTML=m[1]+n.htmlPrefilter(g)+m[2],f=m[0];while(f--)i=i.lastChild;if(!l.leadingWhitespace&&aa.test(g)&&q.push(b.createTextNode(aa.exec(g)[0])),!l.tbody){g="table"!==j||ha.test(g)?"<table>"!==m[1]||ha.test(g)?0:i:i.firstChild,f=g&&g.childNodes.length;while(f--)n.nodeName(k=g.childNodes[f],"tbody")&&!k.childNodes.length&&g.removeChild(k)}n.merge(q,i.childNodes),i.textContent="";while(i.firstChild)i.removeChild(i.firstChild);i=p.lastChild}else q.push(b.createTextNode(g));i&&p.removeChild(i),l.appendChecked||n.grep(ea(q,"input"),ia),r=0;while(g=q[r++])if(d&&n.inArray(g,d)>-1)e&&e.push(g);else if(h=n.contains(g.ownerDocument,g),i=ea(p.appendChild(g),"script"),h&&fa(i),c){f=0;while(g=i[f++])_.test(g.type||"")&&c.push(g)}return i=null,p}!function(){var b,c,e=d.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b]=c in a)||(e.setAttribute(c,"t"),l[b]=e.attributes[c].expando===!1);e=null}();var ka=/^(?:input|select|textarea)$/i,la=/^key/,ma=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,na=/^(?:focusinfocus|focusoutblur)$/,oa=/^([^.]*)(?:\.(.+)|)/;function pa(){return!0}function qa(){return!1}function ra(){try{return d.activeElement}catch(a){}}function sa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)sa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=qa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return"undefined"==typeof n||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(G)||[""],h=b.length;while(h--)f=oa.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=oa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(i=m=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!na.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),h=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),l=n.event.special[q]||{},f||!l.trigger||l.trigger.apply(e,c)!==!1)){if(!f&&!l.noBubble&&!n.isWindow(e)){for(j=l.delegateType||q,na.test(j+q)||(i=i.parentNode);i;i=i.parentNode)p.push(i),m=i;m===(e.ownerDocument||d)&&p.push(m.defaultView||m.parentWindow||a)}o=0;while((i=p[o++])&&!b.isPropagationStopped())b.type=o>1?j:l.bindType||q,g=(n._data(i,"events")||{})[b.type]&&n._data(i,"handle"),g&&g.apply(i,c),g=h&&i[h],g&&g.apply&&M(i)&&(b.result=g.apply(i,c),b.result===!1&&b.preventDefault());if(b.type=q,!f&&!b.isDefaultPrevented()&&(!l._default||l._default.apply(p.pop(),c)===!1)&&M(e)&&h&&e[q]&&!n.isWindow(e)){m=e[h],m&&(e[h]=null),n.event.triggered=q;try{e[q]()}catch(s){}n.event.triggered=void 0,m&&(e[h]=m)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ma.test(f)?this.mouseHooks:la.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=g.srcElement||d),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,h.filter?h.filter(a,g):a},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button,h=b.fromElement;return null==a.pageX&&null!=b.clientX&&(e=a.target.ownerDocument||d,f=e.documentElement,c=e.body,a.pageX=b.clientX+(f&&f.scrollLeft||c&&c.scrollLeft||0)-(f&&f.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(f&&f.scrollTop||c&&c.scrollTop||0)-(f&&f.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&h&&(a.relatedTarget=h===a.target?b.toElement:h),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ra()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ra()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return n.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b),d.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=d.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)}:function(a,b,c){var d="on"+b;a.detachEvent&&("undefined"==typeof a[d]&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?pa:qa):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:qa,isPropagationStopped:qa,isImmediatePropagationStopped:qa,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=pa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=pa,a&&!this.isSimulated&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=pa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submit||(n.event.special.submit={setup:function(){return n.nodeName(this,"form")?!1:void n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?n.prop(b,"form"):void 0;c&&!n._data(c,"submit")&&(n.event.add(c,"submit._submit",function(a){a._submitBubble=!0}),n._data(c,"submit",!0))})},postDispatch:function(a){a._submitBubble&&(delete a._submitBubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a))},teardown:function(){return n.nodeName(this,"form")?!1:void n.event.remove(this,"._submit")}}),l.change||(n.event.special.change={setup:function(){return ka.test(this.nodeName)?("checkbox"!==this.type&&"radio"!==this.type||(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._justChanged=!0)}),n.event.add(this,"click._change",function(a){this._justChanged&&!a.isTrigger&&(this._justChanged=!1),n.event.simulate("change",this,a)})),!1):void n.event.add(this,"beforeactivate._change",function(a){var b=a.target;ka.test(b.nodeName)&&!n._data(b,"change")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a)}),n._data(b,"change",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return n.event.remove(this,"._change"),!ka.test(this.nodeName)}}),l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d){return sa(this,a,b,c,d)},one:function(a,b,c,d){return sa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=qa),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ta=/ jQuery\d+="(?:null|\d+)"/g,ua=new RegExp("<(?:"+ba+")[\\s/>]","i"),va=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,wa=/<script|<style|<link/i,xa=/checked\s*(?:[^=]|=\s*.checked.)/i,ya=/^true\/(.*)/,za=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Aa=ca(d),Ba=Aa.appendChild(d.createElement("div"));function Ca(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function Da(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function Ea(a){var b=ya.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Ga(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(Da(b).text=a.text,Ea(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Z.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}}function Ha(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&xa.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(o&&(k=ja(b,a[0].ownerDocument,!1,a,d),e=k.firstChild,1===k.childNodes.length&&(k=e),e||d)){for(i=n.map(ea(k,"script"),Da),h=i.length;o>m;m++)g=k,m!==p&&(g=n.clone(g,!0,!0),h&&n.merge(i,ea(g,"script"))),c.call(a[m],g,m);if(h)for(j=i[i.length-1].ownerDocument,n.map(i,Ea),m=0;h>m;m++)g=i[m],_.test(g.type||"")&&!n._data(g,"globalEval")&&n.contains(j,g)&&(g.src?n._evalUrl&&n._evalUrl(g.src):n.globalEval((g.text||g.textContent||g.innerHTML||"").replace(za,"")));k=e=null}return a}function Ia(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(ea(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&fa(ea(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(va,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!ua.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(Ba.innerHTML=a.outerHTML,Ba.removeChild(f=Ba.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=ea(f),h=ea(a),g=0;null!=(e=h[g]);++g)d[g]&&Ga(e,d[g]);if(b)if(c)for(h=h||ea(a),d=d||ea(f),g=0;null!=(e=h[g]);g++)Fa(e,d[g]);else Fa(a,f);return d=ea(f,"script"),d.length>0&&fa(d,!i&&ea(a,"script")),d=h=e=null,f},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.attributes,m=n.event.special;null!=(d=a[h]);h++)if((b||M(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k||"undefined"==typeof d.removeAttribute?d[i]=void 0:d.removeAttribute(i),c.push(f))}}}),n.fn.extend({domManip:Ha,detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return Y(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||d).createTextNode(a))},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(ea(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return Y(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(ta,""):void 0;if("string"==typeof a&&!wa.test(a)&&(l.htmlSerialize||!ua.test(a))&&(l.leadingWhitespace||!aa.test(a))&&!da[($.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ea(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(ea(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],f=n(a),h=f.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(f[d])[b](c),g.apply(e,c.get());return this.pushStack(e)}});var Ja,Ka={HTML:"block",BODY:"block"};function La(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function Ma(a){var b=d,c=Ka[a];return c||(c=La(a,b),"none"!==c&&c||(Ja=(Ja||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ja[0].contentWindow||Ja[0].contentDocument).document,b.write(),b.close(),c=La(a,b),Ja.detach()),Ka[a]=c),c}var Na=/^margin/,Oa=new RegExp("^("+T+")(?!px)[a-z%]+$","i"),Pa=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},Qa=d.documentElement;!function(){var b,c,e,f,g,h,i=d.createElement("div"),j=d.createElement("div");if(j.style){j.style.cssText="float:left;opacity:.5",l.opacity="0.5"===j.style.opacity,l.cssFloat=!!j.style.cssFloat,j.style.backgroundClip="content-box",j.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===j.style.backgroundClip,i=d.createElement("div"),i.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",j.innerHTML="",i.appendChild(j),l.boxSizing=""===j.style.boxSizing||""===j.style.MozBoxSizing||""===j.style.WebkitBoxSizing,n.extend(l,{reliableHiddenOffsets:function(){return null==b&&k(),f},boxSizingReliable:function(){return null==b&&k(),e},pixelMarginRight:function(){return null==b&&k(),c},pixelPosition:function(){return null==b&&k(),b},reliableMarginRight:function(){return null==b&&k(),g},reliableMarginLeft:function(){return null==b&&k(),h}});function k(){var k,l,m=d.documentElement;m.appendChild(i),j.style.cssText="-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",b=e=h=!1,c=g=!0,a.getComputedStyle&&(l=a.getComputedStyle(j),b="1%"!==(l||{}).top,h="2px"===(l||{}).marginLeft,e="4px"===(l||{width:"4px"}).width,j.style.marginRight="50%",c="4px"===(l||{marginRight:"4px"}).marginRight,k=j.appendChild(d.createElement("div")),k.style.cssText=j.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",k.style.marginRight=k.style.width="0",j.style.width="1px",g=!parseFloat((a.getComputedStyle(k)||{}).marginRight),j.removeChild(k)),j.style.display="none",f=0===j.getClientRects().length,f&&(j.style.display="",j.innerHTML="<table><tr><td></td><td>t</td></tr></table>",j.childNodes[0].style.borderCollapse="separate",k=j.getElementsByTagName("td"),k[0].style.cssText="margin:0;border:0;padding:0;display:none",f=0===k[0].offsetHeight,f&&(k[0].style.display="",k[1].style.display="none",f=0===k[0].offsetHeight)),m.removeChild(i)}}}();var Ra,Sa,Ta=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ra=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Sa=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Oa.test(g)&&Na.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f),void 0===g?g:g+""}):Qa.currentStyle&&(Ra=function(a){return a.currentStyle},Sa=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Oa.test(g)&&!Ta.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Ua(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Va=/alpha\([^)]*\)/i,Wa=/opacity\s*=\s*([^)]*)/i,Xa=/^(none|table(?!-c[ea]).+)/,Ya=new RegExp("^("+T+")(.*)$","i"),Za={position:"absolute",visibility:"hidden",display:"block"},$a={letterSpacing:"0",fontWeight:"400"},_a=["Webkit","O","Moz","ms"],ab=d.createElement("div").style;function bb(a){if(a in ab)return a;var b=a.charAt(0).toUpperCase()+a.slice(1),c=_a.length;while(c--)if(a=_a[c]+b,a in ab)return a}function cb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&W(d)&&(f[g]=n._data(d,"olddisplay",Ma(d.nodeName)))):(e=W(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function db(a,b,c){var d=Ya.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function eb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+V[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+V[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+V[f]+"Width",!0,e))):(g+=n.css(a,"padding"+V[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+V[f]+"Width",!0,e)));return g}function fb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ra(a),g=l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Sa(a,b,f),(0>e||null==e)&&(e=a.style[b]),Oa.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+eb(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Sa(a,"opacity");return""===c?"1":c}}}},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:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=bb(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=U.exec(c))&&e[1]&&(c=X(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=bb(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Sa(a,b,d)),"normal"===f&&b in $a&&(f=$a[b]),""===c||c?(e=parseFloat(f),c===!0||isFinite(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Xa.test(n.css(a,"display"))&&0===a.offsetWidth?Pa(a,Za,function(){return fb(a,b,d)}):fb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ra(a);return db(a,c,d?eb(a,b,d,l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Wa.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Va,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Va.test(f)?f.replace(Va,e):f+" "+e)}}),n.cssHooks.marginRight=Ua(l.reliableMarginRight,function(a,b){return b?Pa(a,{display:"inline-block"},Sa,[a,"marginRight"]):void 0}),n.cssHooks.marginLeft=Ua(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Sa(a,"marginLeft"))||(n.contains(a.ownerDocument,a)?a.getBoundingClientRect().left-Pa(a,{ 14391marginLeft:0},function(){return a.getBoundingClientRect().left}):0))+"px":void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+V[d]+b]=f[d]||f[d-2]||f[0];return e}},Na.test(a)||(n.cssHooks[a+b].set=db)}),n.fn.extend({css:function(a,b){return Y(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ra(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return cb(this,!0)},hide:function(){return cb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){W(this)?n(this).show():n(this).hide()})}});function gb(a,b,c,d,e){return new gb.prototype.init(a,b,c,d,e)}n.Tween=gb,gb.prototype={constructor:gb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=gb.propHooks[this.prop];return a&&a.get?a.get(this):gb.propHooks._default.get(this)},run:function(a){var b,c=gb.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):gb.propHooks._default.set(this),this}},gb.prototype.init.prototype=gb.prototype,gb.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},gb.propHooks.scrollTop=gb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=gb.prototype.init,n.fx.step={};var hb,ib,jb=/^(?:toggle|show|hide)$/,kb=/queueHooks$/;function lb(){return a.setTimeout(function(){hb=void 0}),hb=n.now()}function mb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=V[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function nb(a,b,c){for(var d,e=(qb.tweeners[b]||[]).concat(qb.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ob(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&W(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k="none"===j?n._data(a,"olddisplay")||Ma(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==Ma(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],jb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(o))"inline"===("none"===j?Ma(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=nb(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function pb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function qb(a,b,c){var d,e,f=0,g=qb.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=hb||lb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:hb||lb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(pb(k,j.opts.specialEasing);g>f;f++)if(d=qb.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,nb,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(qb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return X(c.elem,a,U.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++)c=a[d],qb.tweeners[c]=qb.tweeners[c]||[],qb.tweeners[c].unshift(b)},prefilters:[ob],prefilter:function(a,b){b?qb.prefilters.unshift(a):qb.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(W).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=qb(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&kb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(mb(b,!0),a,d,e)}}),n.each({slideDown:mb("show"),slideUp:mb("hide"),slideToggle:mb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(hb=n.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||n.fx.stop(),hb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){ib||(ib=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(ib),ib=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a,b=d.createElement("input"),c=d.createElement("div"),e=d.createElement("select"),f=e.appendChild(d.createElement("option"));c=d.createElement("div"),c.setAttribute("className","t"),c.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],b.setAttribute("type","checkbox"),c.appendChild(b),a=c.getElementsByTagName("a")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==c.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=f.selected,l.enctype=!!d.createElement("form").enctype,e.disabled=!0,l.optDisabled=!f.disabled,b=d.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value}();var rb=/\r/g,sb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(sb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>-1)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var tb,ub,vb=n.expr.attrHandle,wb=/^(?:checked|selected)$/i,xb=l.getSetAttribute,yb=l.input;n.fn.extend({attr:function(a,b){return Y(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ub:tb)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)?yb&&xb||!wb.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(xb?c:d)}}),ub={set:function(a,b,c){return b===!1?n.removeAttr(a,c):yb&&xb||!wb.test(c)?a.setAttribute(!xb&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=vb[b]||n.find.attr;yb&&xb||!wb.test(b)?vb[b]=function(a,b,d){var e,f;return d||(f=vb[b],vb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,vb[b]=f),e}:vb[b]=function(a,b,c){return c?void 0:a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),yb&&xb||(n.attrHooks.value={set:function(a,b,c){return n.nodeName(a,"input")?void(a.defaultValue=b):tb&&tb.set(a,b,c)}}),xb||(tb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},vb.id=vb.name=vb.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:tb.set},n.attrHooks.contenteditable={set:function(a,b,c){tb.set(a,""===b?!1:b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var zb=/^(?:input|select|textarea|button|object)$/i,Ab=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return Y(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):zb.test(a.nodeName)||Ab.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var Bb=/[\t\r\n\f]/g;function Cb(a){return n.attr(a,"class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,Cb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=Cb(c),d=1===c.nodeType&&(" "+e+" ").replace(Bb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&n.attr(c,"class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,Cb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=Cb(c),d=1===c.nodeType&&(" "+e+" ").replace(Bb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&n.attr(c,"class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,Cb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=Cb(this),b&&n._data(this,"__className__",b),n.attr(this,"class",b||a===!1?"":n._data(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+Cb(c)+" ").replace(Bb," ").indexOf(b)>-1)return!0;return!1}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Db=a.location,Eb=n.now(),Fb=/\?/,Gb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(Gb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new a.DOMParser,c=d.parseFromString(b,"text/xml")):(c=new a.ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var Hb=/#.*$/,Ib=/([?&])_=[^&]*/,Jb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Kb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Lb=/^(?:GET|HEAD)$/,Mb=/^\/\//,Nb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ob={},Pb={},Qb="*/".concat("*"),Rb=Db.href,Sb=Nb.exec(Rb.toLowerCase())||[];function Tb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Ub(a,b,c,d){var e={},f=a===Pb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Vb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&n.extend(!0,a,c),a}function Wb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Xb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Rb,type:"GET",isLocal:Kb.test(Sb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Qb,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":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Vb(Vb(a,n.ajaxSettings),b):Vb(n.ajaxSettings,a)},ajaxPrefilter:Tb(Ob),ajaxTransport:Tb(Pb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var d,e,f,g,h,i,j,k,l=n.ajaxSetup({},c),m=l.context||l,o=l.context&&(m.nodeType||m.jquery)?n(m):n.event,p=n.Deferred(),q=n.Callbacks("once memory"),r=l.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!k){k={};while(b=Jb.exec(g))k[b[1].toLowerCase()]=b[2]}b=k[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(l.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>u)for(b in a)r[b]=[r[b],a[b]];else w.always(a[w.status]);return this},abort:function(a){var b=a||v;return j&&j.abort(b),y(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,l.url=((b||l.url||Rb)+"").replace(Hb,"").replace(Mb,Sb[1]+"//"),l.type=c.method||c.type||l.method||l.type,l.dataTypes=n.trim(l.dataType||"*").toLowerCase().match(G)||[""],null==l.crossDomain&&(d=Nb.exec(l.url.toLowerCase()),l.crossDomain=!(!d||d[1]===Sb[1]&&d[2]===Sb[2]&&(d[3]||("http:"===d[1]?"80":"443"))===(Sb[3]||("http:"===Sb[1]?"80":"443")))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=n.param(l.data,l.traditional)),Ub(Ob,l,c,w),2===u)return w;i=n.event&&l.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!Lb.test(l.type),f=l.url,l.hasContent||(l.data&&(f=l.url+=(Fb.test(f)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=Ib.test(f)?f.replace(Ib,"$1_="+Eb++):f+(Fb.test(f)?"&":"?")+"_="+Eb++)),l.ifModified&&(n.lastModified[f]&&w.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&w.setRequestHeader("If-None-Match",n.etag[f])),(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+Qb+"; q=0.01":""):l.accepts["*"]);for(e in l.headers)w.setRequestHeader(e,l.headers[e]);if(l.beforeSend&&(l.beforeSend.call(m,w,l)===!1||2===u))return w.abort();v="abort";for(e in{success:1,error:1,complete:1})w[e](l[e]);if(j=Ub(Pb,l,c,w)){if(w.readyState=1,i&&o.trigger("ajaxSend",[w,l]),2===u)return w;l.async&&l.timeout>0&&(h=a.setTimeout(function(){w.abort("timeout")},l.timeout));try{u=1,j.send(s,y)}catch(x){if(!(2>u))throw x;y(-1,x)}}else y(-1,"No Transport");function y(b,c,d,e){var k,s,t,v,x,y=c;2!==u&&(u=2,h&&a.clearTimeout(h),j=void 0,g=e||"",w.readyState=b>0?4:0,k=b>=200&&300>b||304===b,d&&(v=Wb(l,w,d)),v=Xb(l,v,w,k),k?(l.ifModified&&(x=w.getResponseHeader("Last-Modified"),x&&(n.lastModified[f]=x),x=w.getResponseHeader("etag"),x&&(n.etag[f]=x)),204===b||"HEAD"===l.type?y="nocontent":304===b?y="notmodified":(y=v.state,s=v.data,t=v.error,k=!t)):(t=y,!b&&y||(y="error",0>b&&(b=0))),w.status=b,w.statusText=(c||y)+"",k?p.resolveWith(m,[s,y,w]):p.rejectWith(m,[w,y,t]),w.statusCode(r),r=void 0,i&&o.trigger(k?"ajaxSuccess":"ajaxError",[w,l,k?s:t]),q.fireWith(m,[w,y]),i&&(o.trigger("ajaxComplete",[w,l]),--n.active||n.event.trigger("ajaxStop")))}return w},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a))return this.each(function(b){n(this).wrapAll(a.call(this,b))});if(this[0]){var b=n(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}});function Yb(a){return a.style&&a.style.display||n.css(a,"display")}function Zb(a){if(!n.contains(a.ownerDocument||d,a))return!0;while(a&&1===a.nodeType){if("none"===Yb(a)||"hidden"===a.type)return!0;a=a.parentNode}return!1}n.expr.filters.hidden=function(a){return l.reliableHiddenOffsets()?a.offsetWidth<=0&&a.offsetHeight<=0&&!a.getClientRects().length:Zb(a)},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var $b=/%20/g,_b=/\[\]$/,ac=/\r?\n/g,bc=/^(?:submit|button|image|reset|file)$/i,cc=/^(?:input|select|textarea|keygen)/i;function dc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||_b.test(a)?d(a,e):dc(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)dc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)dc(c,a[c],b,e);return d.join("&").replace($b,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&cc.test(this.nodeName)&&!bc.test(a)&&(this.checked||!Z.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(ac,"\r\n")}}):{name:b.name,value:c.replace(ac,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return this.isLocal?ic():d.documentMode>8?hc():/^(get|post|head|put|delete|options)$/i.test(this.type)&&hc()||ic()}:hc;var ec=0,fc={},gc=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in fc)fc[a](void 0,!0)}),l.cors=!!gc&&"withCredentials"in gc,gc=l.ajax=!!gc,gc&&n.ajaxTransport(function(b){if(!b.crossDomain||l.cors){var c;return{send:function(d,e){var f,g=b.xhr(),h=++ec;if(g.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(f in b.xhrFields)g[f]=b.xhrFields[f];b.mimeType&&g.overrideMimeType&&g.overrideMimeType(b.mimeType),b.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest");for(f in d)void 0!==d[f]&&g.setRequestHeader(f,d[f]+"");g.send(b.hasContent&&b.data||null),c=function(a,d){var f,i,j;if(c&&(d||4===g.readyState))if(delete fc[h],c=void 0,g.onreadystatechange=n.noop,d)4!==g.readyState&&g.abort();else{j={},f=g.status,"string"==typeof g.responseText&&(j.text=g.responseText);try{i=g.statusText}catch(k){i=""}f||!b.isLocal||b.crossDomain?1223===f&&(f=204):f=j.text?200:404}j&&e(f,i,j,g.getAllResponseHeaders())},b.async?4===g.readyState?a.setTimeout(c):g.onreadystatechange=fc[h]=c:c()},abort:function(){c&&c(void 0,!0)}}}});function hc(){try{return new a.XMLHttpRequest}catch(b){}}function ic(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=d.head||n("head")[0]||d.documentElement;return{send:function(e,f){b=d.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||f(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var jc=[],kc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=jc.pop()||n.expando+"_"+Eb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(kc.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&kc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(kc,"$1"+e):b.jsonp!==!1&&(b.url+=(Fb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,jc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ja([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var lc=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&lc)return lc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h,a.length)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function mc(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?("undefined"!=typeof e.getBoundingClientRect&&(d=e.getBoundingClientRect()),c=mc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Qa})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return Y(this,function(a,d,e){var f=mc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ua(l.pixelPosition,function(a,c){return c?(c=Sa(a,b),Oa.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({ 14392padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return Y(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var nc=a.jQuery,oc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=oc),b&&a.jQuery===n&&(a.jQuery=nc),n},b||(a.jQuery=a.$=n),n});
14393
vendor: 253,669 bytes, lines 14394-14406
14394/*! jQuery UI - v1.12.1 - 2016-09-14 14395* http://jqueryui.com 14396* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js 14397* Copyright jQuery Foundation and other contributors; Licensed MIT */ 14398 14399(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}function i(t){for(var e,i;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}function s(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=n(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",i,function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",i,o)}function o(){t.datepicker._isDisabledDatepicker(m.inline?m.dpDiv.parent()[0]:m.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function a(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}function r(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.ui=t.ui||{},t.ui.version="1.12.1";var h=0,l=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},h=e.split(".")[0];e=e.split(".")[1];var l=h+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][l.toLowerCase()]=function(e){return!!t.data(e,l)},t[h]=t[h]||{},n=t[h][e],o=t[h][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:h,widgetName:e,widgetFullName:l}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,s,n=l.call(arguments,1),o=0,a=n.length;a>o;o++)for(i in n[o])s=n[o][i],n[o].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=l.call(arguments,1),r=this;return o?this.length||"instance"!==n?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(r=o,!1):o?t.isFunction(o[n])&&"_"!==n.charAt(0)?(i=o[n].apply(o,a),i!==o&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+n+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+n+"'")}):r=void 0:(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),r}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=h++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType,o=!s&&!n;return{element:i,isWindow:s,isDocument:n,offset:o?t(e).offset():{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return d.apply(this,arguments);n=t.extend({},n);var u,p,f,g,m,_,v=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split(" "),k={};return _=s(v),v[0].preventDefault&&(n.at="left top"),p=_.width,f=_.height,g=_.offset,m=t.extend({},g),t.each(["my","at"],function(){var t,e,i=(n[this]||"").split(" ");1===i.length&&(i=r.test(i[0])?i.concat(["center"]):h.test(i[0])?["center"].concat(i):["center","center"]),i[0]=r.test(i[0])?i[0]:"center",i[1]=h.test(i[1])?i[1]:"center",t=l.exec(i[0]),e=l.exec(i[1]),k[this]=[t?t[0]:0,e?e[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?m.left+=p:"center"===n.at[0]&&(m.left+=p/2),"bottom"===n.at[1]?m.top+=f:"center"===n.at[1]&&(m.top+=f/2),u=e(k.at,p,f),m.left+=u[0],m.top+=u[1],this.each(function(){var s,r,h=t(this),l=h.outerWidth(),c=h.outerHeight(),d=i(this,"marginLeft"),_=i(this,"marginTop"),x=l+d+i(this,"marginRight")+y.width,C=c+_+i(this,"marginBottom")+y.height,D=t.extend({},m),I=e(k.my,h.outerWidth(),h.outerHeight());"right"===n.my[0]?D.left-=l:"center"===n.my[0]&&(D.left-=l/2),"bottom"===n.my[1]?D.top-=c:"center"===n.my[1]&&(D.top-=c/2),D.left+=I[0],D.top+=I[1],s={marginLeft:d,marginTop:_},t.each(["left","top"],function(e,i){t.ui.position[w[e]]&&t.ui.position[w[e]][i](D,{targetWidth:p,targetHeight:f,elemWidth:l,elemHeight:c,collisionPosition:s,collisionWidth:x,collisionHeight:C,offset:[u[0]+I[0],u[1]+I[1]],my:n.my,at:n.at,within:b,elem:h})}),n.using&&(r=function(t){var e=g.left-D.left,i=e+p-l,s=g.top-D.top,r=s+f-c,u={target:{element:v,left:g.left,top:g.top,width:p,height:f},element:{element:h,left:D.left,top:D.top,width:l,height:c},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-h,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}});var c="ui-effects-",u="ui-effects-style",d="ui-effects-animated",p=t;t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,o){var a,r=o.re.exec(i),h=r&&o.parse(r),l=o.space||"rgba";return h?(a=s[l](h),s[c[l].cache]=a[c[l].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("<p>")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,a,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,h],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),o=c[n],a=0===this.alpha()?l("transparent"):this,r=a[o.cache]||o.to(a._rgba),h=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],l=s[o],c=u[n.type]||{};null!==l&&(null===a?h[o]=l:(c.mod&&(l-a>c.mod/2?a+=c.mod:a-l>c.mod/2&&(a-=c.mod)),h[o]=i((l-a)*e+a,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),h=Math.min(s,n,o),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-o)/l+360:n===r?60*(o-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[a]&&(this[a]=h(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[a]=d,n):l(d)},f(o,function(e,i){l.fn[e]||(l.fn[e]=function(n){var o,a=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=l(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(p),function(){function e(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function i(e,i){var s,o,a={};for(s in i)o=i[s],e[s]!==o&&(n[s]||(t.fx.step[s]||!isNaN(parseFloat(o)))&&(a[s]=o));return a}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(p.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(n,o,a,r){var h=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",l=h.children?a.find("*").addBack():a;l=l.map(function(){var i=t(this);return{el:i,start:e(this)}}),o=function(){t.each(s,function(t,e){n[e]&&a[e+"Class"](n[e])})},o(),l=l.map(function(){return this.end=e(this.el[0]),this.diff=i(this.start,this.end),this}),a.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,n,o,a){return"boolean"==typeof s||void 0===s?n?t.effects.animateClass.call(this,s?{add:i}:{remove:i},n,o,a):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,n,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function e(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function i(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}function s(t,e){var i=e.outerWidth(),s=e.outerHeight(),n=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,o=n.exec(t)||["",0,i,s,0];return{top:parseFloat(o[1])||0,right:"auto"===o[2]?i:parseFloat(o[2]),bottom:"auto"===o[3]?s:parseFloat(o[3]),left:parseFloat(o[4])||0}}t.expr&&t.expr.filters&&t.expr.filters.animated&&(t.expr.filters.animated=function(e){return function(i){return!!t(i).data(d)||e(i)}}(t.expr.filters.animated)),t.uiBackCompat!==!1&&t.extend(t.effects,{save:function(t,e){for(var i=0,s=e.length;s>i;i++)null!==e[i]&&t.data(c+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;n>s;s++)null!==e[s]&&(i=t.data(c+e[s]),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).trigger("focus"),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).trigger("focus")),e}}),t.extend(t.effects,{version:"1.12.1",define:function(e,i,s){return s||(s=i,i="effect"),t.effects.effect[e]=s,t.effects.effect[e].mode=i,s},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,n="vertical"!==i?(e||100)/100:1;return{height:t.height()*n,width:t.width()*s,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();e>1&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(u,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(u)||"",t.removeData(u)},mode:function(t,e){var i=t.is(":hidden");return"toggle"===e&&(e=i?"show":"hide"),(i?"hide"===e:"show"===e)&&(e="none"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(e){var i,s=e.css("position"),n=e.position();return e.css({marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()),/^(static|relative)/.test(s)&&(s="absolute",i=t("<"+e[0].nodeName+">").insertAfter(e).css({display:/^(inline|ruby)/.test(e.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight"),"float":e.css("float")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).addClass("ui-effects-placeholder"),e.data(c+"placeholder",i)),e.css({position:s,left:n.left,top:n.top}),i},removePlaceholder:function(t){var e=c+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(e){t.effects.restoreStyle(e),t.effects.removePlaceholder(e)},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function i(e){function i(){r.removeData(d),t.effects.cleanUp(r),"hide"===s.mode&&r.hide(),a()}function a(){t.isFunction(h)&&h.call(r[0]),t.isFunction(e)&&e()}var r=t(this);s.mode=c.shift(),t.uiBackCompat===!1||o?"none"===s.mode?(r[l](),a()):n.call(r[0],s,i):(r.is(":hidden")?"hide"===l:"show"===l)?(r[l](),a()):n.call(r[0],s,a)}var s=e.apply(this,arguments),n=t.effects.effect[s.effect],o=n.mode,a=s.queue,r=a||"fx",h=s.complete,l=s.mode,c=[],u=function(e){var i=t(this),s=t.effects.mode(i,l)||o;i.data(d,!0),c.push(s),o&&("show"===s||s===o&&"hide"===s)&&i.show(),o&&"none"===s||t.effects.saveStyle(i),t.isFunction(e)&&e()};return t.fx.off||!n?l?this[l](s.duration,h):this.each(function(){h&&h.call(this)}):a===!1?this.each(u).each(i):this.queue(r,u).queue(r,i)},show:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="show",this.effect.call(this,n) 14400}}(t.fn.show),hide:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(t.fn.hide),toggle:function(t){return function(s){if(i(s)||"boolean"==typeof s)return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):s(this.css("clip"),this)},transfer:function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,h=o?a.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>").appendTo("body").addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),t.isFunction(i)&&i()})}}),t.fx.step.clip=function(e){e.clipInit||(e.start=t(e.elem).cssClip(),"string"==typeof e.end&&(e.end=s(e.end,e.elem)),e.clipInit=!0),t(e.elem).cssClip({top:e.pos*(e.end.top-e.start.top)+e.start.top,right:e.pos*(e.end.right-e.start.right)+e.start.right,bottom:e.pos*(e.end.bottom-e.start.bottom)+e.start.bottom,left:e.pos*(e.end.left-e.start.left)+e.start.left})}}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}();var f=t.effects;t.effects.define("blind","hide",function(e,i){var s={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},n=t(this),o=e.direction||"up",a=n.cssClip(),r={clip:t.extend({},a)},h=t.effects.createPlaceholder(n);r.clip[s[o][0]]=r.clip[s[o][1]],"show"===e.mode&&(n.cssClip(r.clip),h&&h.css(t.effects.clipToBox(r)),r.clip=a),h&&h.animate(t.effects.clipToBox(r),e.duration,e.easing),n.animate(r,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("bounce",function(e,i){var s,n,o,a=t(this),r=e.mode,h="hide"===r,l="show"===r,c=e.direction||"up",u=e.distance,d=e.times||5,p=2*d+(l||h?1:0),f=e.duration/p,g=e.easing,m="up"===c||"down"===c?"top":"left",_="up"===c||"left"===c,v=0,b=a.queue().length;for(t.effects.createPlaceholder(a),o=a.css(m),u||(u=a["top"===m?"outerHeight":"outerWidth"]()/3),l&&(n={opacity:1},n[m]=o,a.css("opacity",0).css(m,_?2*-u:2*u).animate(n,f,g)),h&&(u/=Math.pow(2,d-1)),n={},n[m]=o;d>v;v++)s={},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g).animate(n,f,g),u=h?2*u:u/2;h&&(s={opacity:0},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g)),a.queue(i),t.effects.unshift(a,b,p+1)}),t.effects.define("clip","hide",function(e,i){var s,n={},o=t(this),a=e.direction||"vertical",r="both"===a,h=r||"horizontal"===a,l=r||"vertical"===a;s=o.cssClip(),n.clip={top:l?(s.bottom-s.top)/2:s.top,right:h?(s.right-s.left)/2:s.right,bottom:l?(s.bottom-s.top)/2:s.bottom,left:h?(s.right-s.left)/2:s.left},t.effects.createPlaceholder(o),"show"===e.mode&&(o.cssClip(n.clip),n.clip=s),o.animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("drop","hide",function(e,i){var s,n=t(this),o=e.mode,a="show"===o,r=e.direction||"left",h="up"===r||"down"===r?"top":"left",l="up"===r||"left"===r?"-=":"+=",c="+="===l?"-=":"+=",u={opacity:0};t.effects.createPlaceholder(n),s=e.distance||n["top"===h?"outerHeight":"outerWidth"](!0)/2,u[h]=l+s,a&&(n.css(u),u[h]=c+s,u.opacity=1),n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("explode","hide",function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),i()}var o,a,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=e.mode,g="show"===f,m=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/d),v=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(h=m.top+o*v,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*_,l=a-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-a*_,top:-o*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:r+(g?l*_:0),top:h+(g?c*v:0),opacity:g?0:1}).animate({left:r+(g?0:l*_),top:h+(g?0:c*v),opacity:g?1:0},e.duration||500,e.easing,s)}),t.effects.define("fade","toggle",function(e,i){var s="show"===e.mode;t(this).css("opacity",s?0:1).animate({opacity:s?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("fold","hide",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=e.size||15,h=/([0-9]+)%/.exec(r),l=!!e.horizFirst,c=l?["right","bottom"]:["bottom","right"],u=e.duration/2,d=t.effects.createPlaceholder(s),p=s.cssClip(),f={clip:t.extend({},p)},g={clip:t.extend({},p)},m=[p[c[0]],p[c[1]]],_=s.queue().length;h&&(r=parseInt(h[1],10)/100*m[a?0:1]),f.clip[c[0]]=r,g.clip[c[0]]=r,g.clip[c[1]]=0,o&&(s.cssClip(g.clip),d&&d.css(t.effects.clipToBox(g)),g.clip=p),s.queue(function(i){d&&d.animate(t.effects.clipToBox(f),u,e.easing).animate(t.effects.clipToBox(g),u,e.easing),i()}).animate(f,u,e.easing).animate(g,u,e.easing).queue(i),t.effects.unshift(s,_,4)}),t.effects.define("highlight","show",function(e,i){var s=t(this),n={backgroundColor:s.css("backgroundColor")};"hide"===e.mode&&(n.opacity=0),t.effects.saveStyle(s),s.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("size",function(e,i){var s,n,o,a=t(this),r=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],l=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=e.mode,u="effect"!==c,d=e.scale||"both",p=e.origin||["middle","center"],f=a.css("position"),g=a.position(),m=t.effects.scaledDimensions(a),_=e.from||m,v=e.to||t.effects.scaledDimensions(a,0);t.effects.createPlaceholder(a),"show"===c&&(o=_,_=v,v=o),n={from:{y:_.height/m.height,x:_.width/m.width},to:{y:v.height/m.height,x:v.width/m.width}},("box"===d||"both"===d)&&(n.from.y!==n.to.y&&(_=t.effects.setTransition(a,h,n.from.y,_),v=t.effects.setTransition(a,h,n.to.y,v)),n.from.x!==n.to.x&&(_=t.effects.setTransition(a,l,n.from.x,_),v=t.effects.setTransition(a,l,n.to.x,v))),("content"===d||"both"===d)&&n.from.y!==n.to.y&&(_=t.effects.setTransition(a,r,n.from.y,_),v=t.effects.setTransition(a,r,n.to.y,v)),p&&(s=t.effects.getBaseline(p,m),_.top=(m.outerHeight-_.outerHeight)*s.y+g.top,_.left=(m.outerWidth-_.outerWidth)*s.x+g.left,v.top=(m.outerHeight-v.outerHeight)*s.y+g.top,v.left=(m.outerWidth-v.outerWidth)*s.x+g.left),a.css(_),("content"===d||"both"===d)&&(h=h.concat(["marginTop","marginBottom"]).concat(r),l=l.concat(["marginLeft","marginRight"]),a.find("*[width]").each(function(){var i=t(this),s=t.effects.scaledDimensions(i),o={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},a={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x};n.from.y!==n.to.y&&(o=t.effects.setTransition(i,h,n.from.y,o),a=t.effects.setTransition(i,h,n.to.y,a)),n.from.x!==n.to.x&&(o=t.effects.setTransition(i,l,n.from.x,o),a=t.effects.setTransition(i,l,n.to.x,a)),u&&t.effects.saveStyle(i),i.css(o),i.animate(a,e.duration,e.easing,function(){u&&t.effects.restoreStyle(i)})})),a.animate(v,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){var e=a.offset();0===v.opacity&&a.css("opacity",_.opacity),u||(a.css("position","static"===f?"relative":f).offset(e),t.effects.saveStyle(a)),i()}})}),t.effects.define("scale",function(e,i){var s=t(this),n=e.mode,o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"effect"!==n?0:100),a=t.extend(!0,{from:t.effects.scaledDimensions(s),to:t.effects.scaledDimensions(s,o,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(a.from.opacity=1,a.to.opacity=0),t.effects.effect.size.call(this,a,i)}),t.effects.define("puff","hide",function(e,i){var s=t.extend(!0,{},e,{fade:!0,percent:parseInt(e.percent,10)||150});t.effects.effect.scale.call(this,s,i)}),t.effects.define("pulsate","show",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=o||a,h=2*(e.times||5)+(r?1:0),l=e.duration/h,c=0,u=1,d=s.queue().length;for((o||!s.is(":visible"))&&(s.css("opacity",0).show(),c=1);h>u;u++)s.animate({opacity:c},l,e.easing),c=1-c;s.animate({opacity:c},l,e.easing),s.queue(i),t.effects.unshift(s,d,h+1)}),t.effects.define("shake",function(e,i){var s=1,n=t(this),o=e.direction||"left",a=e.distance||20,r=e.times||3,h=2*r+1,l=Math.round(e.duration/h),c="up"===o||"down"===o?"top":"left",u="up"===o||"left"===o,d={},p={},f={},g=n.queue().length;for(t.effects.createPlaceholder(n),d[c]=(u?"-=":"+=")+a,p[c]=(u?"+=":"-=")+2*a,f[c]=(u?"-=":"+=")+2*a,n.animate(d,l,e.easing);r>s;s++)n.animate(p,l,e.easing).animate(f,l,e.easing);n.animate(p,l,e.easing).animate(d,l/2,e.easing).queue(i),t.effects.unshift(n,g,h+1)}),t.effects.define("slide","show",function(e,i){var s,n,o=t(this),a={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},r=e.mode,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u=e.distance||o["top"===l?"outerHeight":"outerWidth"](!0),d={};t.effects.createPlaceholder(o),s=o.cssClip(),n=o.position()[l],d[l]=(c?-1:1)*u+n,d.clip=o.cssClip(),d.clip[a[h][1]]=d.clip[a[h][0]],"show"===r&&(o.cssClip(d.clip),o.css(l,d[l]),d.clip=s,d[l]=n),o.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:i})});var f;t.uiBackCompat!==!1&&(f=t.effects.define("transfer",function(e,i){t(this).transfer(e,i)})),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t("<span>"),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void 0)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],h=r&&n.collapsible,l=h?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:h?t():a,newPanel:l};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,u)===!1||(n.active=h?!1:this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,h=t.css("box-sizing"),l=t.length&&(!e.length||t.index()<e.index()),c=this.options.animate||{},u=l&&c.down||c,d=function(){a._toggleComplete(i)};return"number"==typeof u&&(o=u),"string"==typeof u&&(n=u),n=n||u.easing||c.easing,o=o||u.duration||c.duration,e.length?t.length?(s=t.show().outerHeight(),e.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(this.showProps,{duration:o,easing:n,complete:d,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==a.options.heightStyle&&(i.now=Math.round(s-e.outerHeight()-r),r=0)}}),void 0):e.animate(this.hideProps,o,n,d):t.animate(this.showProps,o,n,d)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,h=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=h.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("<span>").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=h.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(t.trim(t(this).children(".ui-menu-item-wrapper").text()))})}}),t.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n; 14401this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<div>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete;var g=/ui-corner-([a-z]){2,6}/g;t.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var e=this,i=[];t.each(this.options.items,function(s,n){var o,a={};return n?"controlgroupLabel"===s?(o=e.element.find(n),o.each(function(){var e=t(this);e.children(".ui-controlgroup-label-contents").length||e.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),e._addClass(o,null,"ui-widget ui-widget-content ui-state-default"),i=i.concat(o.get()),void 0):(t.fn[s]&&(a=e["_"+s+"Options"]?e["_"+s+"Options"]("middle"):{classes:{}},e.element.find(n).each(function(){var n=t(this),o=n[s]("instance"),r=t.widget.extend({},a);if("button"!==s||!n.parent(".ui-spinner").length){o||(o=n[s]()[s]("instance")),o&&(r.classes=e._resolveClassesValues(r.classes,o)),n[s](r);var h=n[s]("widget");t.data(h[0],"ui-controlgroup-data",o?o:n[s]("instance")),i.push(h[0])}})),void 0):void 0}),this.childWidgets=t(t.unique(i)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var i=t(this),s=i.data("ui-controlgroup-data");s&&s[e]&&s[e]()})},_updateCornerClass:function(t,e){var i="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all",s=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,i),this._addClass(t,null,s)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){var e=this._buildSimpleOptions(t,"ui-spinner");return e.classes["ui-spinner-up"]="",e.classes["ui-spinner-down"]="",e},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e?"auto":!1,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(e,i){var s={};return t.each(e,function(n){var o=i.options.classes[n]||"";o=t.trim(o.replace(g,"")),s[n]=(o+" "+e[n]).replace(/\s+/g," ")}),s},_setOption:function(t,e){return"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"===t?(this._callChildMethod(e?"disable":"enable"),void 0):(this.refresh(),void 0)},refresh:function(){var e,i=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),e=this.childWidgets,this.options.onlyVisible&&(e=e.filter(":visible")),e.length&&(t.each(["first","last"],function(t,s){var n=e[s]().data("ui-controlgroup-data");if(n&&i["_"+n.widgetName+"Options"]){var o=i["_"+n.widgetName+"Options"](1===e.length?"only":s);o.classes=i._resolveClassesValues(o.classes,n),n.element[n.widgetName](o)}else i._updateCornerClass(e[s](),s)}),this._callChildMethod("refresh"))}}),t.widget("ui.checkboxradio",[t.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i,s=this,n=this._super()||{};return this._readType(),i=this.element.labels(),this.label=t(i[i.length-1]),this.label.length||t.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){s.originalLabel+=3===this.nodeType?t(this).text():this.outerHTML}),this.originalLabel&&(n.label=this.originalLabel),e=this.element[0].disabled,null!=e&&(n.disabled=e),n},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||t.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e,i=this.element[0].name,s="input[name='"+t.ui.escapeSelector(i)+"']";return i?(e=this.form.length?t(this.form[0].elements).filter(s):t(s).filter(function(){return 0===t(this).form().length}),e.not(this.element)):t([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=t(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){return"label"!==t||e?(this._super(t,e),"disabled"===t?(this._toggleClass(this.label,null,"ui-state-disabled",e),this.element[0].disabled=e,void 0):(this.refresh(),void 0)):void 0},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=t("<span>"),this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),this.iconSpace&&(t=t.not(this.iconSpace[0])),t.remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]),t.ui.checkboxradio,t.widget("ui.button",{version:"1.12.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),t=this.element[0].disabled,null!=t&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(e){e.keyCode===t.ui.keyCode.SPACE&&(e.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(e,i){var s="iconPosition"!==e,n=s?this.options.iconPosition:i,o="top"===n||"bottom"===n;this.icon?s&&this._removeClass(this.icon,null,this.options.icon):(this.icon=t("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),s&&this._addClass(this.icon,null,i),this._attachIcon(n),o?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(n))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=void 0===t.showLabel?this.options.showLabel:t.showLabel,i=void 0===t.icon?this.options.icon:t.icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),this.element[0].disabled=e,e&&this.element.blur())},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),t.uiBackCompat!==!1&&(t.widget("ui.button",t.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){return"text"===t?(this._super("showLabel",e),void 0):("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments),void 0)}}),t.fn.button=function(e){return function(){return!this.length||this.length&&"INPUT"!==this[0].tagName||this.length&&"INPUT"===this[0].tagName&&"checkbox"!==this.attr("type")&&"radio"!==this.attr("type")?e.apply(this,arguments):(t.ui.checkboxradio||t.error("Checkboxradio widget missing"),0===arguments.length?this.checkboxradio({icon:!1}):this.checkboxradio.apply(this,arguments))}}(t.fn.button),t.fn.buttonset=function(){return t.ui.controlgroup||t.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),t.ui.button,t.extend(t.ui,{datepicker:{version:"1.12.1"}});var m;t.extend(s.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return a(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var s=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(i),t.data(e,"datepicker",i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.off("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.on("focus",this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.on("click",function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,o){var r,h,l,c,u,d=this._dialogInst;return d||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+r+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),t("body").append(this._dialogInput),d=this._dialogInst=this._newInst(this._dialogInput,!1),d.settings={},t.data(this._dialogInput[0],"datepicker",d)),a(d.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(d,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+c,l/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),d.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",d),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),m===n&&(m=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,o,r,h,l=this._getInst(e);return 2===arguments.length&&"string"==typeof i?"defaults"===i?t.extend({},t.datepicker._defaults):l?"all"===i?t.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),o=this._getDateDatepicker(e,!0),r=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),a(l.settings,n),null!==r&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,r)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),l),this._autoSize(l),this._setDate(l,o),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);return t.datepicker._get(n,"constrainInput")?(i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var s,n,o,r,h,l,c;s=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==s&&(t.datepicker._curInst.dpDiv.stop(!0,!0),s&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(s,"beforeShow"),o=n?n.apply(e,[e,s]):{},o!==!1&&(a(s.settings,o),s.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(s),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),r=!1,t(e).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),h={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,s.dpDiv.empty(),s.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(s),h=t.datepicker._checkOffset(s,h,r),s.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),s.inline||(l=t.datepicker._get(s,"showAnim"),c=t.datepicker._get(s,"duration"),s.dpDiv.css("z-index",i(t(e))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[l]?s.dpDiv.show(l,t.datepicker._get(s,"showOptions"),c):s.dpDiv[l||"show"](l?c:null),t.datepicker._shouldFocusInput(s)&&s.input.trigger("focus"),t.datepicker._curInst=s)) 14402}},_updateDatepicker:function(e){this.maxRows=4,m=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),n=s[1],a=17,r=e.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+o>l&&l>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;!a||e&&a!==t.data(e,"datepicker")||this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(a,"onClose"),o&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).val(n))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,o,a,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n="y"===t?s:1,o=RegExp("^\\d{"+n+","+s+"}"),a=i.substring(h).match(o);if(!a)throw"Missing number at position "+h;return h+=a[0].length,parseInt(a[0],10)},k=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(o=e[0],h+=s.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+h},x=function(){if(i.charAt(h)!==e.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;e.length>n;n++)if(b)"'"!==e.charAt(n)||y("'")?x():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":k("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=k("M",p,f);break;case"y":g=w("y");break;case"@":r=new Date(w("@")),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?x():b=!0;break;default:x()}if(i.length>h&&(a=i.substr(h),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=g?0:-100)),v>-1)for(m=1,_=v;;){if(o=this._getDaysInMonth(g,m-1),o>=_)break;m++,_-=o}if(r=this._daylightSavingAdjust(new Date(g,m-1,_)),r.getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=h("y")?e.getFullYear():(10>e.getFullYear()%100?"0":"")+e.getFullYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}l=h.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).on(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,_,v,b,y,w,k,x,C,D,I,T,P,M,S,H,z,O,A,N,W,E,F,L,R=new Date,B=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),Y=this._get(t,"isRTL"),j=this._get(t,"showButtonPanel"),q=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),$=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],G=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),Q=this._getMinMaxDate(t,"min"),J=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),J)for(e=this._daylightSavingAdjust(new Date(J.getFullYear(),J.getMonth()-U[0]*U[1]+1,J.getDate())),e=Q&&Q>e?Q:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-$,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":q?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+$,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":q?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:B,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",l=j?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(Y?"":h)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),_=this._get(t,"showOtherMonths"),v=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),I=" ui-corner-all",T="",X){if(T+="<div class='ui-datepicker-group",U[1]>1)switch(C){case 0:T+=" ui-datepicker-group-first",I=" ui-corner-"+(Y?"right":"left");break;case U[1]-1:T+=" ui-datepicker-group-last",I=" ui-corner-"+(Y?"left":"right");break;default:T+=" ui-datepicker-group-middle",I=""}T+="'>"}for(T+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===k?Y?o:s:"")+(/all|right/.test(I)&&0===k?Y?s:o:"")+this._generateMonthYearHeader(t,Z,te,Q,J,k>0||C>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",P=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)M=(w+c)%7,P+="<th scope='col'"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[M]+"'>"+p[M]+"</span></th>";for(T+=P+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),H=(this._getFirstDayOfMonth(te,Z)-c+7)%7,z=Math.ceil((H+S)/7),O=X?this.maxRows>z?this.maxRows:z:z,this.maxRows=O,A=this._daylightSavingAdjust(new Date(te,Z,1-H)),N=0;O>N;N++){for(T+="<tr>",W=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(A)+"</td>":"",w=0;7>w;w++)E=m?m.apply(t.input?t.input[0]:null,[A]):[!0,""],F=A.getMonth()!==Z,L=F&&!v||!E[0]||Q&&Q>A||J&&A>J,W+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(A.getTime()===D.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===A.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!_?"":" "+E[1]+(A.getTime()===G.getTime()?" "+this._currentClass:"")+(A.getTime()===B.getTime()?" ui-datepicker-today":""))+"'"+(F&&!_||!E[2]?"":" title='"+E[2].replace(/'/g,"'")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+A.getMonth()+"' data-year='"+A.getFullYear()+"'")+">"+(F&&!_?" ":L?"<span class='ui-state-default'>"+A.getDate()+"</span>":"<a class='ui-state-default"+(A.getTime()===B.getTime()?" ui-state-highlight":"")+(A.getTime()===G.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+A.getDate()+"</a>")+"</td>",A.setDate(A.getDate()+1),A=this._daylightSavingAdjust(A);T+=W+"</tr>"}Z++,Z>11&&(Z=0,te++),T+="</tbody></table>"+(X?"</div>"+(U[0]>0&&C===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=T}y+=x}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!h||c>=s.getMonth())&&(!l||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(v||(b+=y+(!o&&m&&_?"":" ")),!t.yearshtml)if(t.yearshtml="",o||!_)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),v&&(b+=(!o&&m&&_?"":" ")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).on("mousedown",t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new s,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.12.1",t.datepicker,t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var _=!1;t(document).on("mouseup",function(){_=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!_){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),_=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,_=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blurActiveElement(e),this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("<div>").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())} 14403},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),h=t.pageX,l=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,h=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(h=this.originalPageX),"x"===a.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY<n.scrollSensitivity?a.scrollTop=o=a.scrollTop+n.scrollSpeed:e.pageY-s.overflowOffset.top<n.scrollSensitivity&&(a.scrollTop=o=a.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+a.offsetWidth-e.pageX<n.scrollSensitivity?a.scrollLeft=o=a.scrollLeft+n.scrollSpeed:e.pageX-s.overflowOffset.left<n.scrollSensitivity&&(a.scrollLeft=o=a.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(e.pageY-t(r).scrollTop()<n.scrollSensitivity?o=t(r).scrollTop(t(r).scrollTop()-n.scrollSpeed):t(window).height()-(e.pageY-t(r).scrollTop())<n.scrollSensitivity&&(o=t(r).scrollTop(t(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(e.pageX-t(r).scrollLeft()<n.scrollSensitivity?o=t(r).scrollLeft(t(r).scrollLeft()-n.scrollSpeed):t(window).width()-(e.pageX-t(r).scrollLeft())<n.scrollSensitivity&&(o=t(r).scrollLeft(t(r).scrollLeft()+n.scrollSpeed)))),o!==!1&&t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(s,e)}}),t.ui.plugin.add("draggable","snap",{start:function(e,i,s){var n=s.options;s.snapElements=[],t(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var e=t(this),i=e.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:i.top,left:i.left})})},drag:function(e,i,s){var n,o,a,r,h,l,c,u,d,p,f=s.options,g=f.snapTolerance,m=i.offset.left,_=m+s.helperProportions.width,v=i.offset.top,b=v+s.helperProportions.height;for(d=s.snapElements.length-1;d>=0;d--)h=s.snapElements[d].left-s.margins.left,l=h+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,h-g>_||m>l+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(h-_),r=g>=Math.abs(l-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(h-m),r=g>=Math.abs(l-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("<div>"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),g&&(p-=l),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.dialog",{version:"1.12.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog 14404},disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&this._trigger("beforeClose",e)!==!1&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||t.ui.safeBlur(t.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+t(this).css("z-index")}).get(),o=Math.max.apply(null,n);return o>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",o+1),s=!0),s&&!i&&this._trigger("focus",e),s},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=t(t.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var t=this._focusedElement;t||(t=this.element.find("[autofocus]")),t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).trigger("focus")},_keepFocus:function(e){function i(){var e=t.ui.safeActiveElement(this.document[0]),i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),void 0;if(e.keyCode===t.ui.keyCode.TAB&&!e.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(this._delay(function(){n.trigger("focus")}),e.preventDefault()):(this._delay(function(){s.trigger("focus")}),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=t("<button type='button'></button>").button({label:t("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(e,"ui-dialog-title"),this._title(e),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html(" ")},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this._removeClass(this.uiDialog,"ui-dialog-buttons"),void 0):(t.each(i,function(i,s){var n,o;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,o={icon:s.icon,iconPosition:s.iconPosition,showLabel:s.showLabel,icons:s.icons,text:s.text},delete s.click,delete s.icon,delete s.iconPosition,delete s.showLabel,delete s.icons,"boolean"==typeof s.text&&delete s.text,t("<button></button>",s).button(o).appendTo(e.uiButtonSet).on("click",function(){n.apply(e.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){i._addClass(t(this),"ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,o){var a=o.offset.left-i.document.scrollLeft(),r=o.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(a>=0?"+":"")+a+" "+"top"+(r>=0?"+":"")+r,of:i.window},i._removeClass(t(this),"ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(o))}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var i=this,s=this.options,n=s.resizable,o=this.uiDialog.css("position"),a="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:a,start:function(s,n){i._addClass(t(this),"ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,o){var a=i.uiDialog.offset(),r=a.left-i.document.scrollLeft(),h=a.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},i._removeClass(t(this),"ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(o))}}).css("position",o)},_trackFocus:function(){this._on(this.widget(),{focusin:function(e){this._makeFocusTarget(),this._focusedElement=t(e.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var e=this._trackingInstances(),i=t.inArray(this,e);-1!==i&&e.splice(i,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||(t=[],this.document.data("ui-dialog-instances",t)),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(e){var i=this,s=!1,n={};t.each(e,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,i){var s,n,o=this.uiDialog;"disabled"!==e&&(this._super(e,i),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:t("<a>").text(""+this.options.closeText).html()}),"draggable"===e&&(s=o.is(":data(ui-draggable)"),s&&!i&&o.draggable("destroy"),!s&&i&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(n=o.is(":data(ui-resizable)"),n&&!i&&o.resizable("destroy"),n&&"string"==typeof i&&o.resizable("option","handles",i),n||i===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=!0;this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(t){e||this._allowInteraction(t)||(t.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=t("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var t=this.document.data("ui-dialog-overlays")-1;t?this.document.data("ui-dialog-overlays",t):(this._off(this.document,"focusin"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null}}}),t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}}),t.ui.dialog,t.widget("ui.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(s)?s:function(t){return t.is(s)},this.proportions=function(){return arguments.length?(e=arguments[0],void 0):e?e:e={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this._addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;t.length>e;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e)},_setOption:function(e,i){if("accept"===e)this.accept=t.isFunction(i)?i:function(t){return t.is(i)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(e,i)},_activate:function(e){var i=t.ui.ddmanager.current;this._addActiveClass(),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this._removeActiveClass(),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._addHoverClass(),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeHoverClass(),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=t(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&v(s,t.extend(i,{offset:i.element.offset()}),i.options.tolerance,e)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var v=t.ui.intersect=function(){function t(t,e,i){return t>=e&&e+i>t}return function(e,i,s,n){if(!i.offset)return!1;var o=(e.positionAbs||e.position.absolute).left+e.margins.left,a=(e.positionAbs||e.position.absolute).top+e.margins.top,r=o+e.helperProportions.width,h=a+e.helperProportions.height,l=i.offset.left,c=i.offset.top,u=l+i.proportions().width,d=c+i.proportions().height;switch(s){case"fit":return o>=l&&u>=r&&a>=c&&d>=h;case"intersect":return o+e.helperProportions.width/2>l&&u>r-e.helperProportions.width/2&&a+e.helperProportions.height/2>c&&d>h-e.helperProportions.height/2;case"pointer":return t(n.pageY,c,i.proportions().height)&&t(n.pageX,l,i.proportions().width);case"touch":return(a>=c&&d>=a||h>=c&&d>=h||c>a&&h>d)&&(o>=l&&u>=o||r>=l&&u>=r||l>o&&r>u);default:return!1}}}();t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&v(e,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").on("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=v(e,this,this.options.tolerance,i),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t(this).droppable("instance").options.scope===n}),o.length&&(s=t(o[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}},t.uiBackCompat!==!1&&t.widget("ui.droppable",t.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}}),t.ui.droppable,t.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=t("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){return void 0===t?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),void 0)},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).width(i.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,e===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}}),t.widget("ui.selectable",t.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e.elementPos=t(e.element[0]).offset(),e.selectees=t(e.options.filter,e.element[0]),e._addClass(e.selectees,"ui-selectee"),e.selectees.each(function(){var i=t(this),s=i.offset(),n={left:s.left-e.elementPos.left,top:s.top-e.elementPos.top};t.data(this,"selectable-item",{element:this,$element:i,left:n.left,top:n.top,right:n.left+i.outerWidth(),bottom:n.top+i.outerHeight(),startselected:!1,selected:i.hasClass("ui-selected"),selecting:i.hasClass("ui-selecting"),unselecting:i.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=t("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.elementPos=t(this.element[0]).offset(),this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(i._removeClass(s.$element,"ui-selected"),s.selected=!1,i._addClass(s.$element,"ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),i._removeClass(n.$element,s?"ui-unselecting":"ui-selected")._addClass(n.$element,s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,h=e.pageY;return o>r&&(i=r,r=o,o=i),a>h&&(i=h,h=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:h-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),l=!1,c={};i&&i.element!==s.element[0]&&(c.left=i.left+s.elementPos.left,c.right=i.right+s.elementPos.left,c.top=i.top+s.elementPos.top,c.bottom=i.bottom+s.elementPos.top,"touch"===n.tolerance?l=!(c.left>r||o>c.right||c.top>h||a>c.bottom):"fit"===n.tolerance&&(l=c.left>o&&r>c.right&&c.top>a&&h>c.bottom),l?(i.selected&&(s._removeClass(i.$element,"ui-selected"),i.selected=!1),i.unselecting&&(s._removeClass(i.$element,"ui-unselecting"),i.unselecting=!1),i.selecting||(s._addClass(i.$element,"ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,s._addClass(i.$element,"ui-selected"),i.selected=!0):(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,i.startselected&&(s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(s._removeClass(i.$element,"ui-selected"),i.selected=!1,s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-selecting")._addClass(s.$element,"ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),t.widget("ui.selectmenu",[t.ui.formResetMixin,{version:"1.12.1",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=t()},_drawButton:function(){var e,i=this,s=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.focus(),t.preventDefault()}}),this.element.hide(),this.button=t("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),e=t("<span>").appendTo(this.button),this._addClass(e,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(s).appendTo(this.button),this.options.width!==!1&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){i._rendered||i._refreshMenu()})},_drawMenu:function(){var e=this;this.menu=t("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=t("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,i){t.preventDefault(),e._setSelection(),e._select(i.item.data("ui-selectmenu-item"),t)},focus:function(t,i){var s=i.item.data("ui-selectmenu-item");null!=e.focusIndex&&s.index!==e.focusIndex&&(e._trigger("focus",t,{item:s}),e.isOpen||e._select(s,t)),e.focusIndex=s.index,e.button.attr("aria-activedescendant",e.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t,e=this.element.find("option");this.menu.empty(),this._parseOptions(e),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,e.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(t.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(e){var i=t("<span>");return this._setText(i,e.label),this._addClass(i,"ui-selectmenu-text"),i},_renderMenu:function(e,i){var s=this,n="";t.each(i,function(i,o){var a;o.optgroup!==n&&(a=t("<li>",{text:o.optgroup}),s._addClass(a,"ui-selectmenu-optgroup","ui-menu-divider"+(o.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),a.appendTo(e),n=o.optgroup),s._renderItemData(e,o)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(e,i){var s=t("<li>"),n=t("<div>",{title:i.element.attr("title")});return i.disabled&&this._addClass(s,null,"ui-state-disabled"),this._setText(n,i.label),s.append(n).appendTo(e)},_setText:function(t,e){e?t.text(e):t.html(" ")},_move:function(t,e){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),n+=":not(.ui-state-disabled)"),s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](n).eq(-1):i[t+"All"](n).eq(0),s.length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?(t=window.getSelection(),t.removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(e){this.isOpen&&(t(e.target).closest(".ui-selectmenu-menu, #"+t.ui.escapeSelector(this.ids.button)).length||this.close(e))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection(),t.rangeCount&&(this.range=t.getRangeAt(0))):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(e){var i=!0;switch(e.keyCode){case t.ui.keyCode.TAB:case t.ui.keyCode.ESCAPE:this.close(e),i=!1;break;case t.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(e);break;case t.ui.keyCode.UP:e.altKey?this._toggle(e):this._move("prev",e);break;case t.ui.keyCode.DOWN:e.altKey?this._toggle(e):this._move("next",e);break;case t.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(e):this._toggle(e);break;case t.ui.keyCode.LEFT:this._move("prev",e);break;case t.ui.keyCode.RIGHT:this._move("next",e);break;case t.ui.keyCode.HOME:case t.ui.keyCode.PAGE_UP:this._move("first",e);break;case t.ui.keyCode.END:case t.ui.keyCode.PAGE_DOWN:this._move("last",e);break;default:this.menu.trigger(e),i=!1}i&&e.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){var e=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":e,"aria-activedescendant":e}),this.menu.attr("aria-activedescendant",e)},_setOption:function(t,e){if("icons"===t){var i=this.button.find("span.ui-icon");this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)}this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;return t===!1?(this.button.css("width",""),void 0):(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t),void 0)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(e){var i=this,s=[];e.each(function(e,n){s.push(i._parseOption(t(n),e))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),t.widget("ui.slider",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1 14405},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle"),o="<span tabindex='0'></span>",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=t("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),("min"===e.range||"max"===e.range)&&this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,h,l,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,this._addClass(o,null,"ui-state-active"),o.trigger("focus"),h=o.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-h.left-o.width()/2,top:e.pageY-h.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n,o=this.value(),a=this.values();this._hasMultipleValues()&&(n=this.values(e?0:1),o=this.values(e),2===this.options.values.length&&this.options.range===!0&&(i=0===e?Math.min(n,i):Math.max(n,i)),a[e]=i),i!==o&&(s=this._trigger("slide",t,this._uiHash(e,i,a)),s!==!1&&(this._hasMultipleValues()?this.values(e,i):this.value(i)))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this._hasMultipleValues()?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),this._super(e,i),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(i),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=n-1;s>=0;s--)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this._hasMultipleValues()){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step,s=Math.round((t-e)/i)*i;t=s+e,t>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,c={};this._hasMultipleValues()?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),c["horizontal"===h.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[l?"animate":"css"](c,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:100-i+"%"},r.animate),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:100-i+"%"},r.animate))},_handleEvents:{keydown:function(e){var i,s,n,o,a=t(e.target).data("ui-slider-handle-index");switch(e.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(e.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(t(e.target),null,"ui-state-active"),i=this._start(e,a),i===!1))return}switch(o=this.options.step,s=n=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case t.ui.keyCode.HOME:n=this._valueMin();break;case t.ui.keyCode.END:n=this._valueMax();break;case t.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-o)}this._slide(e,a,n)},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),this._removeClass(t(e.target),null,"ui-state-active"))}}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(e.pageY-this.document.scrollTop()<a.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-a.scrollSpeed):this.window.height()-(e.pageY-this.document.scrollTop())<a.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+a.scrollSpeed)),e.pageX-this.document.scrollLeft()<a.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-a.scrollSpeed):this.window.width()-(e.pageX-this.document.scrollLeft())<a.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+a.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],h=[],l=this._connectWith();if(l&&e)for(s=l.length-1;s>=0;s--)for(o=t(l[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&h.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(h.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),c.push({item:h,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("<tr>",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t("<td> </td>",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,h,l,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[a],l=!1,e[u]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(e[u]-h)&&(n=Math.abs(e[u]-h),o=this.items[s],this.direction=l?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter; 14406this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.widget("ui.spinner",{version:"1.12.1",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e=this._super(),i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);null!=n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var e=this.element[0]===t.ui.safeActiveElement(this.document[0]);e||(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===t.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&this.uiSpinner.height()>0&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i,s,n;return"culture"===t||"numberFormat"===t?(i=this._parse(this.element.val()),this.options[t]=e,this.element.val(this._format(i)),void 0):(("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(s=this.buttons.first().find(".ui-icon"),this._removeClass(s,null,this.options.icons.up),this._addClass(s,null,e.up),n=this.buttons.last().find(".ui-icon"),this._removeClass(n,null,this.options.icons.down),this._addClass(n,null,e.down)),this._super(t,e),void 0)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:r(function(t){this._super(t)}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null===t?!1:t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:r(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:r(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:r(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:r(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(r(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),t.uiBackCompat!==!1&&t.widget("ui.spinner",t.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}}),t.ui.spinner,t.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var t=/#.*$/;return function(e){var i,s;i=e.href.replace(t,""),s=location.href.replace(t,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return e.hash.length>1&&i===s}}(),_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===e&&(s&&this.tabs.each(function(i,n){return t(n).attr("aria-controls")===s?(e=i,!1):void 0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return e.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case t.ui.keyCode.ENTER:return e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void 0)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),h=t(s).closest("li"),l=h.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=h.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;i!==!1&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(i!==!0){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},h=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),h(n,e)},1)}).fail(function(t,e){setTimeout(function(){h(t,e)},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs,t.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))},_removeDescribedBy:function(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=t("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=t([])},_setOption:function(e,i){var s=this;this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s.element[0],e.close(n,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var e=t(this);return e.is("[title]")?e.data("ui-tooltip-title",e.attr("title")).removeAttr("title"):void 0}))},_enable:function(){this.disabledTitles.each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))}),this.disabledTitles=t([])},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(e,s),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s||s.nodeType||s.jquery?this._open(e,t,s):(i=s.call(t[0],function(i){n._delay(function(){t.data("ui-tooltip-open")&&(e&&(e.type=o),this._open(e,t,i))})}),i&&this._open(e,t,i),void 0)},_open:function(e,i,s){function n(t){l.of=t,a.is(":hidden")||a.position(l)}var o,a,r,h,l=t.extend({},this.options.position);if(s){if(o=this._find(i))return o.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(e&&"mouseover"===e.type?i.attr("title",""):i.removeAttr("title")),o=this._tooltip(i),a=o.tooltip,this._addDescribedBy(i,a.attr("id")),a.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),h=t("<div>").html(a.find(".ui-tooltip-content").html()),h.removeAttr("name").find("[name]").removeAttr("name"),h.removeAttr("id").find("[id]").removeAttr("id"),h.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:n}),n(e)):a.position(t.extend({of:i},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){a.is(":visible")&&(n(l.of),clearInterval(r))},t.fx.interval)),this._trigger("open",e,{tooltip:a})}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);return o?(i=o.tooltip,o.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),o.closing=!0,this._trigger("close",e,{tooltip:i}),o.hiding||(o.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(e){var i=t("<div>").attr("role","tooltip"),s=t("<div>").appendTo(i),n=i.uniqueId().attr("id");return this._addClass(s,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(e)),this.tooltips[n]={element:e,tooltip:i}},_find:function(t){var e=t.data("ui-tooltip-id");return e?this.tooltips[e]:null},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){var e=t.closest(".ui-front, dialog");return e.length||(e=this.document[0].body),e},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur"),o=s.element;n.target=n.currentTarget=o[0],e.close(n,!0),t("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),t.uiBackCompat!==!1&&t.widget("ui.tooltip",t.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),t.ui.tooltip});
14406 14407/** 14408 * Magento 14409 * 14410 * NOTICE OF LICENSE 14411 * 14412 * This source file is subject to the Academic Free License (AFL 3.0) 14413 * that is bundled with this package in the file LICENSE_AFL.txt. 14414 * It is also available through the world-wide-web at this URL: 14415 * http://opensource.org/licenses/afl-3.0.php 14416 * If you did not receive a copy of the license and are unable to 14417 * obtain it through the world-wide-web, please send an email 14418 * to [email protected] so we can send you a copy immediately. 14419 * 14420 * DISCLAIMER 14421 * 14422 * Do not edit or add to this file if you wish to upgrade Magento to newer 14423 * versions in the future. If you wish to customize Magento for your 14424 * needs please refer to http://www.magento.com for more information. 14425 * 14426 * @category Mage 14427 * @package js 14428 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 14429 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 14430 */ 14431 14432// Avoid PrototypeJS conflicts, assign jQuery to $j instead of $ 14433var $j = jQuery.noConflict(); 14434 14435/** 14436 * Function inits overlay dialog 14437 * 14438 * @return void 14439 */ 14440function initPopup() { 14441 if (jQuery('#dialog').is(':data(dialog)')) { 14442 jQuery('#dialog').dialog('destroy').html(''); 14443 } 14444 14445 jQuery('#dialog').dialog({ 14446 modal: true, 14447 autoOpen: false, 14448 show: {effect: 'fade', duration: 600}, 14449 hide: {effect: 'fade', duration: 400}, 14450 overlay: { 14451 background: '#ffffff', 14452 opacity: '0.5' 14453 } 14454 }); 14455} 14456 14457 14458function in2clicks(product_id, qty) { 14459 initPopup(); 14460 /* if (product_id == void(0)) 14461 { 14462 product_id = []; 14463 jQuery('#shopping-cart-table .price-box .regular-price').each(function(){ 14464 product_id.push( jQuery(this).attr('id').replace('product-price-', '') ); 14465 }); 14466 }*/ 14467 14468 jQuery.ajax({ 14469 url: BASE_URL + 'index.php/mmclick/index/popup/', 14470// dataType: 'json', 14471 type: 'POST', 14472 data: { product: product_id, qty:qty }, 14473 success: function(outputData) { 14474 jQuery('#dialog').dialog('option', 'title', outputData.response_overlay_title); 14475 jQuery('#dialog').html(outputData.response_overlay_html); 14476 jQuery('#dialog').dialog("option", "width", 380); 14477 jQuery('#dialog').dialog('option', 'resizable', false); 14478 jQuery('#dialog').dialog('open'); 14479 }, 14480 error: function(errorData) { 14481// setLocation(BASE_URL); 14482 } 14483 }); 14484 return false; 14485} 14486 14487function in2ClicksRequest() { 14488 jQuery('#errorCustomerName').hide(); 14489 jQuery('#errorCustomerPhone').hide(); 14490 var name = jQuery('#customer_name').val(); 14491 var phone = jQuery('#customer_phone').val(); 14492 14493 if (name == '' || phone == '') { 14494 if (name == '') { 14495 jQuery('#errorCustomerName').show(); 14496 } 14497 14498 if (phone == '') { 14499 jQuery('#errorCustomerPhone').show(); 14500 } 14501 14502 return false; 14503 } 14504 14505 jQuery.ajax({ 14506 url: BASE_URL + 'index.php/mmclick/index/request/', 14507 dataType: 'json', 14508 type: 'POST', 14509 data: jQuery('#in2clickform').serialize(), 14510 success: function(outputData) { 14511 jQuery('.in2clicks').html(outputData.response_overlay_html); 14512 }, 14513 error: function(errorData) { 14514 setLocation(BASE_URL); 14515 } 14516 }); 14517 return false; 14518} 14519//flag - we already updated Product.Config 14520var extendProductConfigformatPriceTrigged = false; 14521//calling this function will update Product.Config to our formatPrice 14522 14523function extendProductConfigformatPrice() { 14524 if (typeof(Product) != "undefined") { 14525 if (!extendProductConfigformatPriceTrigged) { 14526 extendProductConfigformatPriceTrigged = true; 14527 14528 Product.Config.prototype = Object.extend(Product.Config.prototype, { 14529 formatPrice:function (price, showSign) { 14530 var str = ''; 14531 price = parseFloat(price); 14532 if (showSign) { 14533 if (price < 0) { 14534 str += '-'; 14535 price = -price; 14536 } 14537 else { 14538 str += '+'; 14539 } 14540 } 14541 14542 var roundedPrice = (Math.round(price * 100) / 100).toString(); 14543 14544 if (this.prices && this.prices[roundedPrice]) { 14545 str += this.prices[roundedPrice]; 14546 } else { 14547 precision = 2; 14548 if (typeof(etCurrencyManagerJsConfig) != "undefined") { 14549 if (typeof(etCurrencyManagerJsConfig.precision) != "undefined") { 14550 precision = etCurrencyManagerJsConfig.precision; 14551 } 14552 } 14553 if (typeof(optionsPrice) != "undefined") { 14554 if (typeof(optionsPrice.priceFormat) != "undefined") { 14555 precision = optionsPrice.priceFormat.requiredPrecision; 14556 } 14557 } 14558 if (typeof(etCurrencyManagerJsConfig) != "undefined") { 14559 if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") { 14560 if (etCurrencyManagerJsConfig.cutzerodecimal != 0) { 14561 if (price - Math.round(price) == 0) { 14562 precision = 0; 14563 } 14564 } 14565 } 14566 } 14567 14568 if (typeof(etCurrencyManagerJsConfig) != "undefined") { 14569 if (typeof(etCurrencyManagerJsConfig.min_decimal_count) != "undefined") { 14570 if (etCurrencyManagerJsConfig.min_decimal_count < precision) { 14571 for (var testPrecision = etCurrencyManagerJsConfig.min_decimal_count; 14572 testPrecision < precision; testPrecision++) { 14573 //abs for 0.00199999999 or 1.1000000000001 fix 14574 if (Math.abs(Math.round(price * Math.pow(10, testPrecision)) 14575 - price * Math.pow(10, testPrecision)) < 0.0000001) { 14576 precision = testPrecision; 14577 break; 14578 } 14579 } 14580 } 14581 } 14582 } 14583 14584 14585 if (precision > 0) { 14586 str += this.priceTemplate.evaluate({price:price.toFixed(precision)}); 14587 } 14588 else { 14589 price = price.toFixed(0); 14590 if (typeof(etCurrencyManagerJsConfig) != "undefined") { 14591 if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") { 14592 if (etCurrencyManagerJsConfig.cutzerodecimal != 0) { 14593 if (typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix
14593) != "undefined") { 14594 if (etCurrencyManagerJsConfig.cutzerodecimal_suffix.length > 0) { 14595 price = price + "" + etCurrencyManagerJsConfig.cutzerodecimal_suffix; 14596 } 14597 } 14598 } 14599 } 14600 } 14601 str += this.priceTemplate.evaluate({price:price}); 14602 } 14603 } 14604 return str; 14605 } 14606 }); 14607 14608 if (etCurrencyManagerJsConfig.cutzerodecimal > 0) { 14609 Product.OptionsPrice.prototype = Object.extend(Product.OptionsPrice.prototype, {formatPrice:function (price) { 14610 var tmpPriceFormat = Object.clone(this.priceFormat); 14611 if (price - parseInt(price) == 0) { 14612 tmpPriceFormat.precision = 0; 14613 tmpPriceFormat.requiredPrecision = 0; 14614 } 14615 if (tmpPriceFormat.precision < 0) { 14616 tmpPriceFormat.precision = 0; 14617 } 14618 if (tmpPriceFormat.requiredPrecision < 0) { 14619 tmpPriceFormat.requiredPrecision = 0; 14620 } 14621 var price2return = formatCurrency(price, tmpPriceFormat); 14622 return price2return; 14623 }}); 14624 } 14625 } 14626 } 14627} 14628 14629try { 14630 extendProductConfigformatPrice(); 14631} catch (e) { 14632 extendProductConfigformatPriceTrigged = false; 14633} 14634 14635try { 14636 14637 originalFormatCurrency = window.formatCurrency; 14638 14639 window.formatCurrency = function (price, originalFormat, showPlus) { 14640 var format = Object.clone(originalFormat); 14641 14642 //zeroSymbol 14643 //JS round fix 14644 price = Math.round(price * Math.pow(10, format.precision)) / Math.pow(10, format.precision); 14645 if (price - Math.round(price) != 0) { 14646 if (Math.abs(price - Math.round(price)) < 0.00000001) { 14647 price = 0; 14648 } 14649 } 14650 if (typeof(etCurrencyManagerJsConfig) != "undefined") { 14651 if (price == 0) { 14652 if (typeof(etCurrencyManagerJsConfig.zerotext) != "undefined") { 14653 return etCurrencyManagerJsConfig.zerotext; 14654 } 14655 } 14656 } 14657 //cut zero decimal 14658 if (price - Math.round(price) == 0) { 14659 if (typeof(etCurrencyManagerJsConfig) != "undefined") { 14660 if (typeof(etCurrencyManagerJsConfig.cutzerodecimal) != "undefined") { 14661 if (etCurrencyManagerJsConfig.cutzerodecimal != 0) { 14662 format.precision = 0; 14663 format.requiredPrecision = 0; 14664 14665 var for_replace = originalFormatCurrency(price, format, showPlus); 14666 format.pattern = "%s"; 14667 var replaced_part = originalFormatCurrency(price, format, showPlus); 14668 format.pattern = originalFormat.pattern; 14669 if (typeof(etCurrencyManagerJsConfig.cutzerodecimal_suffix) != "undefined") { 14670 if (etCurrencyManagerJsConfig.cutzerodecimal_suffix.length > 0) { 14671 return for_replace.replace(replaced_part, replaced_part + "" 14672 + etCurrencyManagerJsConfig.cutzerodecimal_suffix); 14673 } 14674 } 14675 } 14676 } 14677 } 14678 } 14679 14680 if (typeof(etCurrencyManagerJsConfig) != "undefined") { 14681 if (typeof(etCurrencyManagerJsConfig.min_decimal_count) != "undefined") { 14682 if (etCurrencyManagerJsConfig.min_decimal_count < format.precision) { 14683 for (var testPrecision = etCurrencyManagerJsConfig.min_decimal_count; 14684 testPrecision < format.precision; testPrecision++) { 14685 //abs for 0.00199999999 or 1.1000000000001 fix 14686 if (Math.abs(Math.round(price * Math.pow(10, testPrecision)) 14687 - price * Math.pow(10, testPrecision)) < 0.0000001) { 14688 format.precision = testPrecision; 14689 format.requiredPrecision = testPrecision; 14690 break; 14691 } 14692 } 14693 } 14694 } 14695 } 14696 14697 14698 return formatCurrencyET(price, format, showPlus); 14699 //if(format.precision<0)format.precision=0; 14700 //if(format.requiredPrecision<0)format.requiredPrecision=0; 14701 /*return originalFormatCurrency(price, format, showPlus);*/ 14702 14703 14704 }; 14705 14706 14707 function formatCurrencyET(price, format, showPlus) { 14708 var precision = isNaN(format.precision = (format.precision)) ? 2 : format.precision; 14709 var requiredPrecision = isNaN(format.requiredPrecision = (format.requiredPrecision)) ? 2 : format.requiredPrecision; 14710 14711 //precision = (precision > requiredPrecision) ? precision : requiredPrecision; 14712 //for now we don't need this difference so precision is requiredPrecision 14713 precision = requiredPrecision; 14714 14715 var integerRequired = isNaN(format.integerRequired = Math.abs(format.integerRequired)) ? 1 : format.integerRequired; 14716 14717 var decimalSymbol = format.decimalSymbol == undefined ? "," : format.decimalSymbol; 14718 var groupSymbol = format.groupSymbol == undefined ? "." : format.groupSymbol; 14719 var groupLength = format.groupLength == undefined ? 3 : format.groupLength; 14720 14721 var s = ''; 14722 14723 if (showPlus == undefined || showPlus == true) { 14724 s = price < 0 ? "-" : ( showPlus ? "+" : ""); 14725 } else if (showPlus == false) { 14726 s = ''; 14727 } 14728 14729 /** 14730 * replace(/-/, 0) is only for fixing Safari, Chrome, IE bug which appears 14731 * when Math.abs(0).toFixed() executed on "0" number. 14732 * Result is "0.-0" :( 14733 */ 14734 if (precision < 0) { 14735 precision = 0; 14736 } 14737 14738 var i = parseInt(price = Math.abs(+price || 0).toFixed(precision)) + ""; 14739 var pad = (i.length < integerRequired) ? (integerRequired - i.length) : 0; 14740 while (pad) { 14741 i = '0' + i; 14742 pad--; 14743 } 14744 j = (j = i.length) > groupLength ? j % groupLength : 0; 14745 re = new RegExp("(\\d{" + groupLength + "})(?=\\d)", "g"); 14746 14747 var r = (j ? i.substr(0, j) + groupSymbol : "") + i.substr(j).replace(re, "$1" + groupSymbol) + (precision ? decimalSymbol + Math.abs(price - i).toFixed(precision).replace(/-/, 0).slice(2) : "") 14748 var pattern = ''; 14749 if (format.pattern.indexOf('{sign}') == -1) { 14750 pattern = s + format.pattern; 14751 } else { 14752 pattern = format.pattern.replace('{sign}', s); 14753 } 14754 14755 return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, ''); 14756 } 14757 14758 14759} 14760catch (e) { 14761 //do nothing 14762} 14763 14764 14765
vendor: 13,647 bytes, lines 14766-14792
14766"function"!==typeof Object.create&&(Object.create=function(f){function g(){}g.prototype=f;return new g}); 14767(function(f,g,k){var l={init:function(a,b){this.$elem=f(b);this.options=f.extend({},f.fn.owlCarousel.options,this.$elem.data(),a);this.userOptions=a;this.loadContent()},loadContent:function(){function a(a){var d,e="";if("function"===typeof b.options.jsonSuccess)b.options.jsonSuccess.apply(this,[a]);else{for(d in a.owl)a.owl.hasOwnProperty(d)&&(e+=a.owl[d].item);b.$elem.html(e)}b.logIn()}var b=this,e;"function"===typeof b.options.beforeInit&&b.options.beforeInit.apply(this,[b.$elem]);"string"===typeof b.options.jsonPath? 14768(e=b.options.jsonPath,f.getJSON(e,a)):b.logIn()},logIn:function(){this.$elem.data("owl-originalStyles",this.$elem.attr("style"));this.$elem.data("owl-originalClasses",this.$elem.attr("class"));this.$elem.css({opacity:0});this.orignalItems=this.options.items;this.checkBrowser();this.wrapperWidth=0;this.checkVisible=null;this.setVars()},setVars:function(){if(0===this.$elem.children().length)return!1;this.baseClass();this.eventTypes();this.$userItems=this.$elem.children();this.itemsAmount=this.$userItems.length; 14769this.wrapItems();this.$owlItems=this.$elem.find(".owl-item");this.$owlWrapper=this.$elem.find(".owl-wrapper");this.playDirection="next";this.prevItem=0;this.prevArr=[0];this.currentItem=0;this.customEvents();this.onStartup()},onStartup:function(){this.updateItems();this.calculateAll();this.buildControls();this.updateControls();this.response();this.moveEvents();this.stopOnHover();this.owlStatus();!1!==this.options.transitionStyle&&this.transitionTypes(this.options.transitionStyle);!0===this.options.autoPlay&& 14770(this.options.autoPlay=5E3);this.play();this.$elem.find(".owl-wrapper").css("display","block");this.$elem.is(":visible")?this.$elem.css("opacity",1):this.watchVisibility();this.onstartup=!1;this.eachMoveUpdate();"function"===typeof this.options.afterInit&&this.options.afterInit.apply(this,[this.$elem])},eachMoveUpdate:function(){!0===this.options.lazyLoad&&this.lazyLoad();!0===this.options.autoHeight&&this.autoHeight();this.onVisibleItems();"function"===typeof this.options.afterAction&&this.options.afterAction.apply(this, 14771[this.$elem])},updateVars:function(){"function"===typeof this.options.beforeUpdate&&this.options.beforeUpdate.apply(this,[this.$elem]);this.watchVisibility();this.updateItems();this.calculateAll();this.updatePosition();this.updateControls();this.eachMoveUpdate();"function"===typeof this.options.afterUpdate&&this.options.afterUpdate.apply(this,[this.$elem])},reload:function(){var a=this;g.setTimeout(function(){a.updateVars()},0)},watchVisibility:function(){var a=this;if(!1===a.$elem.is(":visible"))a.$elem.css({opacity:0}), 14772g.clearInterval(a.autoPlayInterval),g.clearInterval(a.checkVisible);else return!1;a.checkVisible=g.setInterval(function(){a.$elem.is(":visible")&&(a.reload(),a.$elem.animate({opacity:1},200),g.clearInterval(a.checkVisible))},500)},wrapItems:function(){this.$userItems.wrapAll('<div class="owl-wrapper">').wrap('<div class="owl-item"></div>');this.$elem.find(".owl-wrapper").wrap('<div class="owl-wrapper-outer">');this.wrapperOuter=this.$elem.find(".owl-wrapper-outer");this.$elem.css("display","block")}, 14773baseClass:function(){var a=this.$elem.hasClass(this.options.baseClass),b=this.$elem.hasClass(this.options.theme);a||this.$elem.addClass(this.options.baseClass);b||this.$elem.addClass(this.options.theme)},updateItems:function(){var a,b;if(!1===this.options.responsive)return!1;if(!0===this.options.singleItem)return this.options.items=this.orignalItems=1,this.options.itemsCustom=!1,this.options.itemsDesktop=!1,this.options.itemsDesktopSmall=!1,this.options.itemsTablet=!1,this.options.itemsTabletSmall= 14774!1,this.options.itemsMobile=!1;a=f(this.options.responsiveBaseWidth).width();a>(this.options.itemsDesktop[0]||this.orignalItems)&&(this.options.items=this.orignalItems);if(!1!==this.options.itemsCustom)for(this.options.itemsCustom.sort(function(a,b){return a[0]-b[0]}),b=0;b<this.options.itemsCustom.length;b+=1)this.options.itemsCustom[b][0]<=a&&(this.options.items=this.options.itemsCustom[b][1]);else a<=this.options.itemsDesktop[0]&&!1!==this.options.itemsDesktop&&(this.options.items=this.options.itemsDesktop[1]), 14775a<=this.options.itemsDesktopSmall[0]&&!1!==this.options.itemsDesktopSmall&&(this.options.items=this.options.itemsDesktopSmall[1]),a<=this.options.itemsTablet[0]&&!1!==this.options.itemsTablet&&(this.options.items=this.options.itemsTablet[1]),a<=this.options.itemsTabletSmall[0]&&!1!==this.options.itemsTabletSmall&&(this.options.items=this.options.itemsTabletSmall[1]),a<=this.options.itemsMobile[0]&&!1!==this.options.itemsMobile&&(this.options.items=this.options.itemsMobile[1]);this.options.items>this.itemsAmount&& 14776!0===this.options.itemsScaleUp&&(this.options.items=this.itemsAmount)},response:function(){var a=this,b,e;if(!0!==a.options.responsive)return!1;e=f(g).width();a.resizer=function(){f(g).width()!==e&&(!1!==a.options.autoPlay&&g.clearInterval(a.autoPlayInterval),g.clearTimeout(b),b=g.setTimeout(function(){e=f(g).width();a.updateVars()},a.options.responsiveRefreshRate))};f(g).resize(a.resizer)},updatePosition:function(){this.jumpTo(this.currentItem);!1!==this.options.autoPlay&&this.checkAp()},appendItemsSizes:function(){var a= 14777this,b=0,e=a.itemsAmount-a.options.items;a.$owlItems.each(function(c){var d=f(this);d.css({width:a.itemWidth}).data("owl-item",Number(c));if(0===c%a.options.items||c===e)c>e||(b+=1);d.data("owl-roundPages",b)})},appendWrapperSizes:function(){this.$owlWrapper.css({width:this.$owlItems.length*this.itemWidth*2,left:0});this.appendItemsSizes()},calculateAll:function(){this.calculateWidth();this.appendWrapperSizes();this.loops();this.max()},calculateWidth:function(){this.itemWidth=Math.round(this.$elem.width()/ 14778this.options.items)},max:function(){var a=-1*(this.itemsAmount*this.itemWidth-this.options.items*this.itemWidth);this.options.items>this.itemsAmount?this.maximumPixels=a=this.maximumItem=0:(this.maximumItem=this.itemsAmount-this.options.items,this.maximumPixels=a);return a},min:function(){return 0},loops:function(){var a=0,b=0,e,c;this.positionsInArray=[0];this.pagesInArray=[];for(e=0;e<this.itemsAmount;e+=1)b+=this.itemWidth,this.positionsInArray.push(-b),!0===this.options.scrollPerPage&&(c=f(this.$owlItems[e]), 14779c=c.data("owl-roundPages"),c!==a&&(this.pagesInArray[a]=this.positionsInArray[e],a=c))},buildControls:function(){if(!0===this.options.navigation||!0===this.options.pagination)this.owlControls=f('<div class="owl-controls"/>').toggleClass("clickable",!this.browser.isTouch).appendTo(this.$elem);!0===this.options.pagination&&this.buildPagination();!0===this.options.navigation&&this.buildButtons()},buildButtons:function(){var a=this,b=f('<div class="owl-buttons"/>');a.owlControls.append(b);a.buttonPrev= 14780f("<div/>",{"class":"owl-prev",html:a.options.navigationText[0]||""});a.buttonNext=f("<div/>",{"class":"owl-next",html:a.options.navigationText[1]||""});b.append(a.buttonPrev).append(a.buttonNext);b.on("touchstart.owlControls mousedown.owlControls",'div[class^="owl"]',function(a){a.preventDefault()});b.on("touchend.owlControls mouseup.owlControls",'div[class^="owl"]',function(b){b.preventDefault();f(this).hasClass("owl-next")?a.next():a.prev()})},buildPagination:function(){var a=this;a.paginationWrapper= 14781f('<div class="owl-pagination"/>');a.owlControls.append(a.paginationWrapper);a.paginationWrapper.on("touchend.owlControls mouseup.owlControls",".owl-page",function(b){b.preventDefault();Number(f(this).data("owl-page"))!==a.currentItem&&a.goTo(Number(f(this).data("owl-page")),!0)})},updatePagination:function(){var a,b,e,c,d,g;if(!1===this.options.pagination)return!1;this.paginationWrapper.html("");a=0;b=this.itemsAmount-this.itemsAmount%this.options.items;for(c=0;c<this.itemsAmount;c+=1)0===c%this.options.items&& 14782(a+=1,b===c&&(e=this.itemsAmount-this.options.items),d=f("<div/>",{"class":"owl-page"}),g=f("<span></span>",{text:!0===this.options.paginationNumbers?a:"","class":!0===this.options.paginationNumbers?"owl-numbers":""}),d.append(g),d.data("owl-page",b===c?e:c),d.data("owl-roundPages",a),this.paginationWrapper.append(d));this.checkPagination()},checkPagination:function(){var a=this;if(!1===a.options.pagination)return!1;a.paginationWrapper.find(".owl-page").each(function(){f(this).data("owl-roundPages")=== 14783f(a.$owlItems[a.currentItem]).data("owl-roundPages")&&(a.paginationWrapper.find(".owl-page").removeClass("active"),f(this).addClass("active"))})},checkNavigation:function(){if(!1===this.options.navigation)return!1;!1===this.options.rewindNav&&(0===this.currentItem&&0===this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.addClass("disabled")):0===this.currentItem&&0!==this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.removeClass("disabled")):this.currentItem=== 14784this.maximumItem?(this.buttonPrev.removeClass("disabled"),this.buttonNext.addClass("disabled")):0!==this.currentItem&&this.currentItem!==this.maximumItem&&(this.buttonPrev.removeClass("disabled"),this.buttonNext.removeClass("disabled")))},updateControls:function(){this.updatePagination();this.checkNavigation();this.owlControls&&(this.options.items>=this.itemsAmount?this.owlControls.hide():this.owlControls.show())},destroyControls:function(){this.owlControls&&this.owlControls.remove()},next:function(a){if(this.isTransition)return!1; 14785this.currentItem+=!0===this.options.scrollPerPage?this.options.items:1;if(this.currentItem>this.maximumItem+(!0===this.options.scrollPerPage?this.options.items-1:0))if(!0===this.options.rewindNav)this.currentItem=0,a="rewind";else return this.currentItem=this.maximumItem,!1;this.goTo(this.currentItem,a)},prev:function(a){if(this.isTransition)return!1;this.currentItem=!0===this.options.scrollPerPage&&0<this.currentItem&&this.currentItem<this.options.items?0:this.currentItem-(!0===this.options.scrollPerPage? 14786this.options.items:1);if(0>this.currentItem)if(!0===this.options.rewindNav)this.currentItem=this.maximumItem,a="rewind";else return this.currentItem=0,!1;this.goTo(this.currentItem,a)},goTo:function(a,b,e){var c=this;if(c.isTransition)return!1;"function"===typeof c.options.beforeMove&&c.options.beforeMove.apply(this,[c.$elem]);a>=c.maximumItem?a=c.maximumItem:0>=a&&(a=0);c.currentItem=c.owl.currentItem=a;if(!1!==c.options.transitionStyle&&"drag"!==e&&1===c.options.items&&!0===c.browser.support3d)return c.swapSpeed(0), 14787!0===c.browser.support3d?c.transition3d(c.positionsInArray[a]):c.css2slide(c.positionsInArray[a],1),c.afterGo(),c.singleItemTransition(),!1;a=c.positionsInArray[a];!0===c.browser.support3d?(c.isCss3Finish=!1,!0===b?(c.swapSpeed("paginationSpeed"),g.setTimeout(function(){c.isCss3Finish=!0},c.options.paginationSpeed)):"rewind"===b?(c.swapSpeed(c.options.rewindSpeed),g.setTimeout(function(){c.isCss3Finish=!0},c.options.rewindSpeed)):(c.swapSpeed("slideSpeed"),g.setTimeout(function(){c.isCss3Finish=!0}, 14788c.options.slideSpeed)),c.transition3d(a)):!0===b?c.css2slide(a,c.options.paginationSpeed):"rewind"===b?c.css2slide(a,c.options.rewindSpeed):c.css2slide(a,c.options.slideSpeed);c.afterGo()},jumpTo:function(a){"function"===typeof this.options.beforeMove&&this.options.beforeMove.apply(this,[this.$elem]);a>=this.maximumItem||-1===a?a=this.maximumItem:0>=a&&(a=0);this.swapSpeed(0);!0===this.browser.support3d?this.transition3d(this.positionsInArray[a]):this.css2slide(this.positionsInArray[a],1);this.currentItem= 14789this.owl.currentItem=a;this.afterGo()},afterGo:function(){this.prevArr.push(this.currentItem);this.prevItem=this.owl.prevItem=this.prevArr[this.prevArr.length-2];this.prevArr.shift(0);this.prevItem!==this.currentItem&&(this.checkPagination(),this.checkNavigation(),this.eachMoveUpdate(),!1!==this.options.autoPlay&&this.checkAp());"function"===typeof this.options.afterMove&&this.prevItem!==this.currentItem&&this.options.afterMove.apply(this,[this.$elem])},stop:function(){this.apStatus="stop";g.clearInterval(this.autoPlayInterval)}, 14790checkAp:function(){"stop"!==this.apStatus&&this.play()},play:function(){var a=this;a.apStatus="play";if(!1===a.options.autoPlay)return!1;g.clearInterval(a.autoPlayInterval);a.autoPlayInterval=g.setInterval(function(){a.next(!0)},a.options.autoPlay)},swapSpeed:function(a){"slideSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.slideSpeed)):"paginationSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.paginationSpeed)):"string"!==typeof a&&this.$owlWrapper.css(this.addCssSpeed(a))}, 14791addCssSpeed:function(a){return{"-webkit-transition":"all "+a+"ms ease","-moz-transition":"all "+a+"ms ease","-o-transition":"all "+a+"ms ease",transition:"all "+a+"ms ease"}},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"",transition:""}},doTranslate:function(a){return{"-webkit-transform":"translate3d("+a+"px, 0px, 0px)","-moz-transform":"translate3d("+a+"px, 0px, 0px)","-o-transform":"translate3d("+a+"px, 0px, 0px)","-ms-transform":"translate3d("+ 14792a+"px, 0px, 0px)",transform:"translate3d("+a+"px, 0px,0px)"}},transition3d:function(a){this.$owlWrapper.css(this.doTranslate(a))},css2move:function(a){this.$owlWrapper.css({left:a})},css2slide:function(a,b){var e=this;e.isCssFinish=!1;e.$owlWrapper.stop(!0,!0).animate({left:a},{duration:b||e.options.slideSpeed,complete:function(){e.isCssFinish=!0}})},checkBrowser:function(){var a=k.createElement("div");a.style.cssText=" -moz-transform:translate3d(0px, 0px, 0px); -ms-transform:translate3d(0px, 0px, 0px); -o-transform:translate3d(0px, 0px, 0px); -webkit-transform:translate3d(0px, 0px, 0px); transform:translate3d(0px, 0px, 0px)";
14793var a=a.style.cssText.match(/translate3d\(0px, 0px, 0px\)/g),a=null!==a&&1<=a.length&&2>=a.length,b=/MSIE ([0-9]+)/.exec(navigator.userAgent);null!==b&&10>=b[1]?10==b[1]?a=!0:10>b[1]&&(a=!1):(b=/Trident.*rv[ :]*([0-9]+)/.exec(navigator.userAgent),null!==b&&11<=b[1]&&(a=!0));
vendor: 11,543 bytes, lines 14793-14842
14793this.browser={support3d:a,isTouch:"ontouchstart"in g||g.navigator.msMaxTouchPoints}},moveEvents:function(){if(!1!==this.options.mouseDrag||!1!==this.options.touchDrag)this.gestures(),this.disabledEvents()},eventTypes:function(){var a= 14794["s","e","x"];this.ev_types={};!0===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl mousedown.owl","touchmove.owl mousemove.owl","touchend.owl touchcancel.owl mouseup.owl"]:!1===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl","touchmove.owl","touchend.owl touchcancel.owl"]:!0===this.options.mouseDrag&&!1===this.options.touchDrag&&(a=["mousedown.owl","mousemove.owl","mouseup.owl"]);this.ev_types.start=a[0];this.ev_types.move=a[1];this.ev_types.end=a[2]}, 14795disabledEvents:function(){this.$elem.on("dragstart.owl",function(a){a.preventDefault()});this.$elem.on("mousedown.disableTextSelect",function(a){return f(a.target).is("input, textarea, select, option")})},gestures:function(){function a(a){if(void 0!==a.touches)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(void 0===a.touches){if(void 0!==a.pageX)return{x:a.pageX,y:a.pageY};if(void 0===a.pageX)return{x:a.clientX,y:a.clientY}}}function b(a){"on"===a?(f(k).on(d.ev_types.move,e),f(k).on(d.ev_types.end, 14796c)):"off"===a&&(f(k).off(d.ev_types.move),f(k).off(d.ev_types.end))}function e(b){b=b.originalEvent||b||g.event;d.newPosX=a(b).x-h.offsetX;d.newPosY=a(b).y-h.offsetY;d.newRelativeX=d.newPosX-h.relativePos;"function"===typeof d.options.startDragging&&!0!==h.dragging&&0!==d.newRelativeX&&(h.dragging=!0,d.options.startDragging.apply(d,[d.$elem]));(8<d.newRelativeX||-8>d.newRelativeX)&&!0===d.browser.isTouch&&(void 0!==b.preventDefault?b.preventDefault():b.returnValue=!1,h.sliding=!0);(10<d.newPosY|| 14797-10>d.newPosY)&&!1===h.sliding&&f(k).off("touchmove.owl");d.newPosX=Math.max(Math.min(d.newPosX,d.newRelativeX/5),d.maximumPixels+d.newRelativeX/5);!0===d.browser.support3d?d.transition3d(d.newPosX):d.css2move(d.newPosX)}function c(a){a=a.originalEvent||a||g.event;var c;a.target=a.target||a.srcElement;h.dragging=!1;!0!==d.browser.isTouch&&d.$owlWrapper.removeClass("grabbing");d.dragDirection=0>d.newRelativeX?d.owl.dragDirection="left":d.owl.dragDirection="right";0!==d.newRelativeX&&(c=d.getNewPosition(), 14798d.goTo(c,!1,"drag"),h.targetElement===a.target&&!0!==d.browser.isTouch&&(f(a.target).on("click.disable",function(a){a.stopImmediatePropagation();a.stopPropagation();a.preventDefault();f(a.target).off("click.disable")}),a=f._data(a.target,"events").click,c=a.pop(),a.splice(0,0,c)));b("off")}var d=this,h={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};d.isCssFinish=!0;d.$elem.on(d.ev_types.start,".owl-wrapper", 14799function(c){c=c.originalEvent||c||g.event;var e;if(3===c.which)return!1;if(!(d.itemsAmount<=d.options.items)){if(!1===d.isCssFinish&&!d.options.dragBeforeAnimFinish||!1===d.isCss3Finish&&!d.options.dragBeforeAnimFinish)return!1;!1!==d.options.autoPlay&&g.clearInterval(d.autoPlayInterval);!0===d.browser.isTouch||d.$owlWrapper.hasClass("grabbing")||d.$owlWrapper.addClass("grabbing");d.newPosX=0;d.newRelativeX=0;f(this).css(d.removeTransition());e=f(this).position();h.relativePos=e.left;h.offsetX=a(c).x- 14800e.left;h.offsetY=a(c).y-e.top;b("on");h.sliding=!1;h.targetElement=c.target||c.srcElement}})},getNewPosition:function(){var a=this.closestItem();a>this.maximumItem?a=this.currentItem=this.maximumItem:0<=this.newPosX&&(this.currentItem=a=0);return a},closestItem:function(){var a=this,b=!0===a.options.scrollPerPage?a.pagesInArray:a.positionsInArray,e=a.newPosX,c=null;f.each(b,function(d,g){e-a.itemWidth/20>b[d+1]&&e-a.itemWidth/20<g&&"left"===a.moveDirection()?(c=g,a.currentItem=!0===a.options.scrollPerPage? 14801f.inArray(c,a.positionsInArray):d):e+a.itemWidth/20<g&&e+a.itemWidth/20>(b[d+1]||b[d]-a.itemWidth)&&"right"===a.moveDirection()&&(!0===a.options.scrollPerPage?(c=b[d+1]||b[b.length-1],a.currentItem=f.inArray(c,a.positionsInArray)):(c=b[d+1],a.currentItem=d+1))});return a.currentItem},moveDirection:function(){var a;0>this.newRelativeX?(a="right",this.playDirection="next"):(a="left",this.playDirection="prev");return a},customEvents:function(){var a=this;a.$elem.on("owl.next",function(){a.next()});a.$elem.on("owl.prev", 14802function(){a.prev()});a.$elem.on("owl.play",function(b,e){a.options.autoPlay=e;a.play();a.hoverStatus="play"});a.$elem.on("owl.stop",function(){a.stop();a.hoverStatus="stop"});a.$elem.on("owl.goTo",function(b,e){a.goTo(e)});a.$elem.on("owl.jumpTo",function(b,e){a.jumpTo(e)})},stopOnHover:function(){var a=this;!0===a.options.stopOnHover&&!0!==a.browser.isTouch&&!1!==a.options.autoPlay&&(a.$elem.on("mouseover",function(){a.stop()}),a.$elem.on("mouseout",function(){"stop"!==a.hoverStatus&&a.play()}))}, 14803lazyLoad:function(){var a,b,e,c,d;if(!1===this.options.lazyLoad)return!1;for(a=0;a<this.itemsAmount;a+=1)b=f(this.$owlItems[a]),"loaded"!==b.data("owl-loaded")&&(e=b.data("owl-item"),c=b.find(".lazyOwl"),"string"!==typeof c.data("src")?b.data("owl-loaded","loaded"):(void 0===b.data("owl-loaded")&&(c.hide(),b.addClass("loading").data("owl-loaded","checked")),(d=!0===this.options.lazyFollow?e>=this.currentItem:!0)&&e<this.currentItem+this.options.items&&c.length&&this.lazyPreload(b,c)))},lazyPreload:function(a, 14804b){function e(){a.data("owl-loaded","loaded").removeClass("loading");b.removeAttr("data-src");"fade"===d.options.lazyEffect?b.fadeIn(400):b.show();"function"===typeof d.options.afterLazyLoad&&d.options.afterLazyLoad.apply(this,[d.$elem])}function c(){f+=1;d.completeImg(b.get(0))||!0===k?e():100>=f?g.setTimeout(c,100):e()}var d=this,f=0,k;"DIV"===b.prop("tagName")?(b.css("background-image","url("+b.data("src")+")"),k=!0):b[0].src=b.data("src");c()},autoHeight:function(){function a(){var a=f(e.$owlItems[e.currentItem]).height(); 14805e.wrapperOuter.css("height",a+"px");e.wrapperOuter.hasClass("autoHeight")||g.setTimeout(function(){e.wrapperOuter.addClass("autoHeight")},0)}function b(){d+=1;e.completeImg(c.get(0))?a():100>=d?g.setTimeout(b,100):e.wrapperOuter.css("height","")}var e=this,c=f(e.$owlItems[e.currentItem]).find("img"),d;void 0!==c.get(0)?(d=0,b()):a()},completeImg:function(a){return!a.complete||"undefined"!==typeof a.naturalWidth&&0===a.naturalWidth?!1:!0},onVisibleItems:function(){var a;!0===this.options.addClassActive&& 14806this.$owlItems.removeClass("active");this.visibleItems=[];for(a=this.currentItem;a<this.currentItem+this.options.items;a+=1)this.visibleItems.push(a),!0===this.options.addClassActive&&f(this.$owlItems[a]).addClass("active");this.owl.visibleItems=this.visibleItems},transitionTypes:function(a){this.outClass="owl-"+a+"-out";this.inClass="owl-"+a+"-in"},singleItemTransition:function(){var a=this,b=a.outClass,e=a.inClass,c=a.$owlItems.eq(a.currentItem),d=a.$owlItems.eq(a.prevItem),f=Math.abs(a.positionsInArray[a.currentItem])+ 14807a.positionsInArray[a.prevItem],g=Math.abs(a.positionsInArray[a.currentItem])+a.itemWidth/2;a.isTransition=!0;a.$owlWrapper.addClass("owl-origin").css({"-webkit-transform-origin":g+"px","-moz-perspective-origin":g+"px","perspective-origin":g+"px"});d.css({position:"relative",left:f+"px"}).addClass(b).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend",function(){a.endPrev=!0;d.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(d,b)});c.addClass(e).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend", 14808function(){a.endCurrent=!0;c.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(c,e)})},clearTransStyle:function(a,b){a.css({position:"",left:""}).removeClass(b);this.endPrev&&this.endCurrent&&(this.$owlWrapper.removeClass("owl-origin"),this.isTransition=this.endCurrent=this.endPrev=!1)},owlStatus:function(){this.owl={userOptions:this.userOptions,baseElement:this.$elem,userItems:this.$userItems,owlItems:this.$owlItems,currentItem:this.currentItem,prevItem:this.prevItem, 14809visibleItems:this.visibleItems,isTouch:this.browser.isTouch,browser:this.browser,dragDirection:this.dragDirection}},clearEvents:function(){this.$elem.off(".owl owl mousedown.disableTextSelect");f(k).off(".owl owl");f(g).off("resize",this.resizer)},unWrap:function(){0!==this.$elem.children().length&&(this.$owlWrapper.unwrap(),this.$userItems.unwrap().unwrap(),this.owlControls&&this.owlControls.remove());this.clearEvents();this.$elem.attr("style",this.$elem.data("owl-originalStyles")||"").attr("class", 14810this.$elem.data("owl-originalClasses"))},destroy:function(){this.stop();g.clearInterval(this.checkVisible);this.unWrap();this.$elem.removeData()},reinit:function(a){a=f.extend({},this.userOptions,a);this.unWrap();this.init(a,this.$elem)},addItem:function(a,b){var e;if(!a)return!1;if(0===this.$elem.children().length)return this.$elem.append(a),this.setVars(),!1;this.unWrap();e=void 0===b||-1===b?-1:b;e>=this.$userItems.length||-1===e?this.$userItems.eq(-1).after(a):this.$userItems.eq(e).before(a); 14811this.setVars()},removeItem:function(a){if(0===this.$elem.children().length)return!1;a=void 0===a||-1===a?-1:a;this.unWrap();this.$userItems.eq(a).remove();this.setVars()}};f.fn.owlCarousel=function(a){return this.each(function(){if(!0===f(this).data("owl-init"))return!1;f(this).data("owl-init",!0);var b=Object.create(l);b.init(a,this);f.data(this,"owlCarousel",b)})};f.fn.owlCarousel.options={items:5,itemsCustom:!1,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:!1, 14812itemsMobile:[479,1],singleItem:!1,itemsScaleUp:!1,slideSpeed:200,paginationSpeed:800,rewindSpeed:1E3,autoPlay:!1,stopOnHover:!1,navigation:!1,navigationText:["prev","next"],rewindNav:!0,scrollPerPage:!1,pagination:!0,paginationNumbers:!1,responsive:!0,responsiveRefreshRate:200,responsiveBaseWidth:g,baseClass:"owl-carousel",theme:"owl-theme",lazyLoad:!1,lazyFollow:!0,lazyEffect:"fade",autoHeight:!1,jsonPath:!1,jsonSuccess:!1,dragBeforeAnimFinish:!0,mouseDrag:!0,touchDrag:!0,addClassActive:!1,transitionStyle:!1, 14813beforeUpdate:!1,afterUpdate:!1,beforeInit:!1,afterInit:!1,beforeMove:!1,afterMove:!1,afterAction:!1,startDragging:!1,afterLazyLoad:!1}})(jQuery,window,document); 14814/* 14815 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 14816 * 14817 * Uses the built in easing capabilities added In jQuery 1.1 14818 * to offer multiple easing options 14819 * 14820 * TERMS OF USE - jQuery Easing 14821 * 14822 * Open source under the BSD License. 14823 * 14824 * Copyright © 2008 George McGinley Smith 14825 * All rights reserved. 14826 * 14827 * Redistribution and use in source and binary forms, with or without modification, 14828 * are permitted provided that the following conditions are met: 14829 * 14830 * Redistributions of source code must retain the above copyright notice, this list of 14831 * conditions and the following disclaimer. 14832 * Redistributions in binary form must reproduce the above copyright notice, this list 14833 * of conditions and the following disclaimer in the documentation and/or other materials 14834 * provided with the distribution. 14835 * 14836 * Neither the name of the author nor the names of contributors may be used to endorse 14837 * or promote products derived from this software without specific prior written permission. 14838 * 14839 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 14840 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 14841 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 14842 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,091 bytes, lines 14843-14988
14843 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14844 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 14845 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 14846 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 14847 * OF THE POSSIBILITY OF SUCH DAMAGE. 14848 * 14849*/ 14850 14851// t: current time, b: begInnIng value, c: change In value, d: duration 14852jQuery.easing['jswing'] = jQuery.easing['swing']; 14853 14854jQuery.extend( jQuery.easing, 14855{ 14856 def: 'easeOutQuad', 14857 swing: function (x, t, b, c, d) { 14858 //alert(jQuery.easing.default); 14859 return jQuery.easing[jQuery.easing.def](x, t, b, c, d); 14860 }, 14861 easeInQuad: function (x, t, b, c, d) { 14862 return c*(t/=d)*t + b; 14863 }, 14864 easeOutQuad: function (x, t, b, c, d) { 14865 return -c *(t/=d)*(t-2) + b; 14866 }, 14867 easeInOutQuad: function (x, t, b, c, d) { 14868 if ((t/=d/2) < 1) return c/2*t*t + b; 14869 return -c/2 * ((--t)*(t-2) - 1) + b; 14870 }, 14871 easeInCubic: function (x, t, b, c, d) { 14872 return c*(t/=d)*t*t + b; 14873 }, 14874 easeOutCubic: function (x, t, b, c, d) { 14875 return c*((t=t/d-1)*t*t + 1) + b; 14876 }, 14877 easeInOutCubic: function (x, t, b, c, d) { 14878 if ((t/=d/2) < 1) return c/2*t*t*t + b; 14879 return c/2*((t-=2)*t*t + 2) + b; 14880 }, 14881 easeInQuart: function (x, t, b, c, d) { 14882 return c*(t/=d)*t*t*t + b; 14883 }, 14884 easeOutQuart: function (x, t, b, c, d) { 14885 return -c * ((t=t/d-1)*t*t*t - 1) + b; 14886 }, 14887 easeInOutQuart: function (x, t, b, c, d) { 14888 if ((t/=d/2) < 1) return c/2*t*t*t*t + b; 14889 return -c/2 * ((t-=2)*t*t*t - 2) + b; 14890 }, 14891 easeInQuint: function (x, t, b, c, d) { 14892 return c*(t/=d)*t*t*t*t + b; 14893 }, 14894 easeOutQuint: function (x, t, b, c, d) { 14895 return c*((t=t/d-1)*t*t*t*t + 1) + b; 14896 }, 14897 easeInOutQuint: function (x, t, b, c, d) { 14898 if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; 14899 return c/2*((t-=2)*t*t*t*t + 2) + b; 14900 }, 14901 easeInSine: function (x, t, b, c, d) { 14902 return -c * Math.cos(t/d * (Math.PI/2)) + c + b; 14903 }, 14904 easeOutSine: function (x, t, b, c, d) { 14905 return c * Math.sin(t/d * (Math.PI/2)) + b; 14906 }, 14907 easeInOutSine: function (x, t, b, c, d) { 14908 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; 14909 }, 14910 easeInExpo: function (x, t, b, c, d) { 14911 return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; 14912 }, 14913 easeOutExpo: function (x, t, b, c, d) { 14914 return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; 14915 }, 14916 easeInOutExpo: function (x, t, b, c, d) { 14917 if (t==0) return b; 14918 if (t==d) return b+c; 14919 if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; 14920 return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; 14921 }, 14922 easeInCirc: function (x, t, b, c, d) { 14923 return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; 14924 }, 14925 easeOutCirc: function (x, t, b, c, d) { 14926 return c * Math.sqrt(1 - (t=t/d-1)*t) + b; 14927 }, 14928 easeInOutCirc: function (x, t, b, c, d) { 14929 if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; 14930 return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; 14931 }, 14932 easeInElastic: function (x, t, b, c, d) { 14933 var s=1.70158;var p=0;var a=c; 14934 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 14935 if (a < Math.abs(c)) { a=c; var s=p/4; } 14936 else var s = p/(2*Math.PI) * Math.asin (c/a); 14937 return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 14938 }, 14939 easeOutElastic: function (x, t, b, c, d) { 14940 var s=1.70158;var p=0;var a=c; 14941 if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; 14942 if (a < Math.abs(c)) { a=c; var s=p/4; } 14943 else var s = p/(2*Math.PI) * Math.asin (c/a); 14944 return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; 14945 }, 14946 easeInOutElastic: function (x, t, b, c, d) { 14947 var s=1.70158;var p=0;var a=c; 14948 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); 14949 if (a < Math.abs(c)) { a=c; var s=p/4; } 14950 else var s = p/(2*Math.PI) * Math.asin (c/a); 14951 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; 14952 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; 14953 }, 14954 easeInBack: function (x, t, b, c, d, s) { 14955 if (s == undefined) s = 1.70158; 14956 return c*(t/=d)*t*((s+1)*t - s) + b; 14957 }, 14958 easeOutBack: function (x, t, b, c, d, s) { 14959 if (s == undefined) s = 1.70158; 14960 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 14961 }, 14962 easeInOutBack: function (x, t, b, c, d, s) { 14963 if (s == undefined) s = 1.70158; 14964 if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 14965 return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 14966 }, 14967 easeInBounce: function (x, t, b, c, d) { 14968 return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; 14969 }, 14970 easeOutBounce: function (x, t, b, c, d) { 14971 if ((t/=d) < (1/2.75)) { 14972 return c*(7.5625*t*t) + b; 14973 } else if (t < (2/2.75)) { 14974 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; 14975 } else if (t < (2.5/2.75)) { 14976 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; 14977 } else { 14978 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; 14979 } 14980 }, 14981 easeInOutBounce: function (x, t, b, c, d) { 14982 if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; 14983 return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; 14984 } 14985}); 14986 14987/* 14988 *
14989 * TERMS OF USE - EASING EQUATIONS 14990 * 14991 * Open source under the BSD License. 14992 * 14993 * Copyright © 2001 Robert Penner 14994 * All rights reserved. 14995 * 14996 * Redistribution and use in source and binary forms, with or without modification, 14997 * are permitted provided that the following conditions are met: 14998 * 14999 * Redistributions of source code must retain the above copyright notice, this list of 15000 * conditions and the following disclaimer. 15001 * Redistributions in binary form must reproduce the above copyright notice, this list 15002 * of conditions and the following disclaimer in the documentation and/or other materials 15003 * provided with the distribution. 15004 * 15005 * Neither the name of the author nor the names of contributors may be used to endorse 15006 * or promote products derived from this software without specific prior written permission. 15007 * 15008 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 15009 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15010 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 15011 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 15012 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 15013 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 15014 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 15015 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 15016 * OF THE POSSIBILITY OF SUCH DAMAGE. 15017 * 15018 */ 15019/** 15020 * @author Infortis. Based on script by Jan Jarfalk (http://www.unwrongest.com) 15021 * @copyright Copyright (c) 2014 Infortis 15022 */ 15023(function(b){b.fn.extend({accordion:function(n,p,q){return this.each(function(){function g(c,s,g){var f=b(c),e=f.parent(h),m=f.siblings(d);_speed=!0===g?0:t;e.siblings().removeClass(k).children(d).slideUp(_speed,function(){var a=e.offset().top,c=b(window).scrollTop();a<c&&b("html, body").animate({scrollTop:a},400,"easeOutCubic")});if(0<m.length)m[s||l](_speed,function(){"block"===m.css("display")?f.parentsUntil(a,h).addClass(k):e.removeClass(k);f.parentsUntil(a,d).show()});else f.parentsUntil(a,h).addClass(k), 15024f.parentsUntil(a,d).show()}var a=b(this),k="item-active",l="slideToggle",t=200,h="li",d="ul, div",r="ul, li>div",e=".opener";"undefined"!==typeof n&&(r=d=n);"undefined"!==typeof p&&(e=p);"undefined"!==typeof q&&(h=q);if(a.data("accordiated"))return!1;a.data("accordiated",!0);a.find(r).hide();a.on("click",e,function(){g(this,l)});a.activateCurrent=function(){var c=a.find(h+".current")[0];if(c){var d=b(c).children(e)[0];d?g(d,l,!0):(c=b(c).children("*")[0])&&g(c,l,!0)}};a.activateCurrent()})}})})(jQuery); 15025jQuery(function(b){b(".accordion").accordion()}); 15026/** 15027 * Atwix 15028 * 15029 * NOTICE OF LICENSE 15030 * 15031 * This source file is subject to the Open Software License (OSL 3.0) 15032 * that is bundled with this package in the file LICENSE.txt. 15033 * It is also available through the world-wide-web at this URL: 15034 * http://opensource.org/licenses/osl-3.0.php 15035 * If you did not receive a copy of the license and are unable to 15036 * obtain it through the world-wide-web, please send an email 15037 * to [email protected] so we can send you a copy immediately. 15038 15039 * @category Atwix Mod 15040 * @package Atwix_Tweaks 15041 * @author Atwix Core Team 15042 * @copyright Copyright (c) 2014 Atwix (http://www.atwix.com) 15043 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 15044 */ 15045 15046jQuery(document).ready(function($j){ 15047 $j('.accordion-wrap .accordion-title').click(function(){ 15048 if($j(this).parent('.accordion-wrap').hasClass('opened')) { 15049 //do close actions 15050 $j(this).parent('.accordion-wrap').children('.accordion-text').slideUp(); 15051 $j(this).parent('.accordion-wrap').removeClass('opened'); 15052 } else { 15053 //do open actions 15054 $j('.accordion-wrap.opened').each(function(){ 15055 $j(this).children('.accordion-text').slideUp(); 15056 $j(this).removeClass('opened'); 15057 }); 15058 $j(this).parent('.accordion-wrap').children('.accordion-text').slideDown(); 15059 $j(this).parent('.accordion-wrap').addClass('opened'); 15060 } 15061 }) 15062}); 15063 15064 15065(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,v=e.reduce,h=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,j=i.bind,w=function(n){return n instanceof w?n:this instanceof w?(this._wrapped=n,void 0):new w(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=w),exports._=w):n._=w,w.VERSION="1.4.3";var A=w.each=w.forEach=function(n,t,e){if(null!=n)if(s&&n.forEac
15065h===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(w.has(n,a)&&t.call(e,n[a],a,n)===r)return};w.map=w.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e[e.length]=t.call(r,n,u,i)}),e)};var O="Reduce of empty array with no initial value";w.reduce=w.foldl=w.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduce===v)return e&&(t=w.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},w.reduceRight=w.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduceRight===h)return e&&(t=w.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=w.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},w.find=w.detect=function(n,t,r){var e;return E(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},w.filter=w.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&(e[e.length]=n)}),e)},w.reject=function(n,t,r){return w.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},w.every=w.all=function(n,t,e){t||(t=w.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var E=w.some=w.any=function(n,t,e){t||(t=w.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};w.contains=w.include=function(n,t){return null==n?!1:y&&n.indexOf===y?-1!=n.indexOf(t):E(n,function(n){return n===t})},w.invoke=function(n,t){var r=o.call(arguments,2);return w.map(n,function(n){return(w.isFunction(t)?t:n[t]).apply(n,r)})},w.pluck=function(n,t){return w.map(n,function(n){return n[t]})},w.where=function(n,t){return w.isEmpty(t)?[]:w.filter(n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},w.max=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.max.apply(Math,n);if(!t&&w.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>=e.computed&&(e={value:n,computed:a})}),e.value},w.min=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.min.apply(Math,n);if(!t&&w.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;e.computed>a&&(e={value:n,computed:a})}),e.value},w.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=w.random(r++),e[r-1]=e[t],e[t]=n}),e};var F=function(n){return w.isFunction(n)?n:function(t){return t[n]}};w.sortBy=function(n,t,r){var e=F(t);return w.pluck(w.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||void 0===r)return 1;if(e>r||void 0===e)return-1}return n.index<t.index?-1:1}),"value")};var k=function(n,t,r,e){var u={},i=F(t||w.identity);return A(n,function(t,a){var o=i.call(r,t,a,n);e(u,o,t)}),u};w.groupBy=function(n,t,r){return k(n,t,r,function(n,t,r){(w.has(n,t)?n[t]:n[t]=[]).push(r)})},w.countBy=function(n,t,r){return k(n,t,r,function(n,t){w.has(n,t)||(n[t]=0),n[t]++})},w.sortedIndex=function(n,t,r,e){r=null==r?w.identity:F(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;u>r.call(e,n[o])?i=o+1:a=o}return i},w.toArray=function(n){return n?w.isArray(n)?o.call(n):n.length===+n.length?w.map(n,w.identity):w.values(n):[]},w.size=function(n){return null==n?0:n.length===+n.length?n.length:w.keys(n).length},w.first=w.head=w.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},w.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},w.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},w.rest=w.tail=w.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},w.compact=function(n){return w.filter(n,w.identity)};var R=function(n,t,r){return A(n,function(n){w.isArray(n)?t?a.apply(r,n):R(n,t,r):r.push(n)}),r};w.flatten=function(n,t){return R(n,t,[])}
15065,w.without=function(n){return w.difference(n,o.call(arguments,1))},w.uniq=w.unique=function(n,t,r,e){w.isFunction(t)&&(e=r,r=t,t=!1);var u=r?w.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:w.contains(a,r))||(a.push(r),i.push(n[e]))}),i},w.union=function(){return w.uniq(c.apply(e,arguments))},w.intersection=function(n){var t=o.call(arguments,1);return w.filter(w.uniq(n),function(n){return w.every(t,function(t){return w.indexOf(t,n)>=0})})},w.difference=function(n){var t=c.apply(e,o.call(arguments,1));return w.filter(n,function(n){return!w.contains(t,n)})},w.zip=function(){for(var n=o.call(arguments),t=w.max(w.pluck(n,"length")),r=Array(t),e=0;t>e;e++)r[e]=w.pluck(n,""+e);return r},w.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},w.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=w.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},w.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},w.range=function(n,t,r){1>=arguments.length&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=Array(e);e>u;)i[u++]=n,n+=r;return i};var I=function(){};w.bind=function(n,t){var r,e;if(n.bind===j&&j)return j.apply(n,o.call(arguments,1));if(!w.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));I.prototype=n.prototype;var u=new I;I.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},w.bindAll=function(n){var t=o.call(arguments,1);return 0==t.length&&(t=w.functions(n)),A(t,function(t){n[t]=w.bind(n[t],n)}),n},w.memoize=function(n,t){var r={};return t||(t=w.identity),function(){var e=t.apply(this,arguments);return w.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},w.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},w.defer=function(n){return w.delay.apply(w,[n,1].concat(o.call(arguments,1)))},w.throttle=function(n,t){var r,e,u,i,a=0,o=function(){a=new Date,u=null,i=n.apply(r,e)};return function(){var c=new Date,l=t-(c-a);return r=this,e=arguments,0>=l?(clearTimeout(u),u=null,a=c,i=n.apply(r,e)):u||(u=setTimeout(o,l)),i}},w.debounce=function(n,t,r){var e,u;return function(){var i=this,a=arguments,o=function(){e=null,r||(u=n.apply(i,a))},c=r&&!e;return clearTimeout(e),e=setTimeout(o,t),c&&(u=n.apply(i,a)),u}},w.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},w.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},w.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},w.after=function(n,t){return 0>=n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},w.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)w.has(n,r)&&(t[t.length]=r);return t},w.values=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push(n[r]);return t},w.pairs=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push([r,n[r]]);return t},w.invert=function(n){var t={};for(var r in n)w.has(n,r)&&(t[n[r]]=r);return t},w.functions=w.methods=function(n){var t=[];for(var r in n)w.isFunction(n[r])&&t.push(r);return t.sort()},w.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},w.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},w.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)w.contains(r,u)||(t[u]=n[u]);return t},w.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)null==n[r]&&(n[r]=t[r])}),n},w.clone=function(n){return w.isObject(n)?w.isArray(n)?n.slice():w.extend({},n):n},w.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof w&&(n=n._wrapped),t instanceof w&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==t+"";case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;
15065case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;r.push(n),e.push(t);var a=0,o=!0;if("[object Array]"==u){if(a=n.length,o=a==t.length)for(;a--&&(o=S(n[a],t[a],r,e)););}else{var c=n.constructor,f=t.constructor;if(c!==f&&!(w.isFunction(c)&&c instanceof c&&w.isFunction(f)&&f instanceof f))return!1;for(var s in n)if(w.has(n,s)&&(a++,!(o=w.has(t,s)&&S(n[s],t[s],r,e))))break;if(o){for(s in t)if(w.has(t,s)&&!a--)break;o=!a}}return r.pop(),e.pop(),o};w.isEqual=function(n,t){return S(n,t,[],[])},w.isEmpty=function(n){if(null==n)return!0;if(w.isArray(n)||w.isString(n))return 0===n.length;for(var t in n)if(w.has(n,t))return!1;return!0},w.isElement=function(n){return!(!n||1!==n.nodeType)},w.isArray=x||function(n){return"[object Array]"==l.call(n)},w.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){w["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),w.isArguments(arguments)||(w.isArguments=function(n){return!(!n||!w.has(n,"callee"))}),w.isFunction=function(n){return"function"==typeof n},w.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},w.isNaN=function(n){return w.isNumber(n)&&n!=+n},w.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},w.isNull=function(n){return null===n},w.isUndefined=function(n){return void 0===n},w.has=function(n,t){return f.call(n,t)},w.noConflict=function(){return n._=t,this},w.identity=function(n){return n},w.times=function(n,t,r){for(var e=Array(n),u=0;n>u;u++)e[u]=t.call(r,u);return e},w.random=function(n,t){return null==t&&(t=n,n=0),n+(0|Math.random()*(t-n+1))};var T={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};T.unescape=w.invert(T.escape);var M={escape:RegExp("["+w.keys(T.escape).join("")+"]","g"),unescape:RegExp("("+w.keys(T.unescape).join("|")+")","g")};w.each(["escape","unescape"],function(n){w[n]=function(t){return null==t?"":(""+t).replace(M[n],function(t){return T[n][t]})}}),w.result=function(n,t){if(null==n)return null;var r=n[t];return w.isFunction(r)?r.call(n):r},w.mixin=function(n){A(w.functions(n),function(t){var r=w[t]=n[t];w.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(w,n))}})};var N=0;w.uniqueId=function(n){var t=++N;return n?n+t:t},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;w.template=function(n,t,r){r=w.defaults({},r,w.templateSettings);var e=RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,a,o){return i+=n.slice(u,o).replace(D,function(n){return"\\"+B[n]}),r&&(i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(i+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),a&&(i+="';\n"+a+"\n__p+='"),u=o+t.length,t}),i+="';\n",r.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var a=Function(r.variable||"obj","_",i)}catch(o){throw o.source=i,o}if(t)return a(t,w);var c=function(n){return a.call(this,n,w)};return c.source="function("+(r.variable||"obj")+"){\n"+i+"}",c},w.chain=function(n){return w(n).chain()};var z=function(n){return this._chain?w(n).chain():n};w.mixin(w),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];w.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];w.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),w.extend(w.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this); 15066// Backbone.js 0.9.2 15067 15068// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. 15069// Backbone may be freely distributed under the MIT license. 15070// For all details and documentation: 15071// http://backbonejs.org 15072 15073(function(){ 15074 15075 // Initial Setup 15076 // ------------- 15077 15078 // Save a reference to the global object (`window` in the browser, `global` 15079 // on the server). 15080 var root = this; 15081 15082 // Save the previous value of the `Backbone` variable, so that it can be 15083 // restored later on, if `noConflict` is used. 15084 var previousBackbone = root.Backbone; 15085 15086 // Create a local reference to slice/splice. 15087 var slice = Array.prototype.slice; 15088 var splice = Array.prototype.splice; 15089 15090 // The top-level namespace. All public Backbone classes and modules will 15091 // be attached to this. Exported for both CommonJS and the browser. 15092 var Backbone; 15093 if (typeof exports !== 'undefined') { 15094 Backbone = exports; 15095 } else { 15096 Backbone = root.Backbone = {}; 15097 } 15098 15099 // Current version of the library. Keep in sync with `package.json`. 15100 Backbone.VERSION = '0.9.2'; 15101 15102 // Require Underscore, if we're on the server, and it's not already present. 15103 var _ = root._; 15104 if (!_ && (typeof require !== 'undefined')) _ = require('underscore'); 15105 15106 // For Backbone's purposes, jQuery, Zepto, or Ender owns the `$` variable. 15107 var $ = root.jQuery || root.Zepto || root.ender; 15108 15109 // Set the JavaScript library that will be used for DOM manipulation and 15110 // Ajax calls (a.k.a. the `$` variable). By default Backbone will use: jQuery, 15111 // Zepto, or Ender; but the `setDomLibrary()` method lets you inject an 15112 // alternate JavaScript library (or a mock library for testing your views 15113 // outside of a browser). 15114 Backbone.setDomLibrary = function(lib) { 15115 $ = lib; 15116 }; 15117 15118 // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable 15119 // to its previous owner. Returns a reference to this Backbone object.
15120 Backbone.noConflict = function() { 15121 root.Backbone = previousBackbone; 15122 return this; 15123 }; 15124 15125 // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option 15126 // will fake `"PUT"` and `"DELETE"` requests via the `_method` parameter and 15127 // set a `X-Http-Method-Override` header. 15128 Backbone.emulateHTTP = false; 15129 15130 // Turn on `emulateJSON` to support legacy servers that can't deal with direct 15131 // `application/json` requests ... will encode the body as 15132 // `application/x-www-form-urlencoded` instead and will send the model in a 15133 // form param named `model`. 15134 Backbone.emulateJSON = false; 15135 15136 // Backbone.Events 15137 // ----------------- 15138 15139 // Regular expression used to split event strings 15140 var eventSplitter = /\s+/; 15141 15142 // A module that can be mixed in to *any object* in order to provide it with 15143 // custom events. You may bind with `on` or remove with `off` callback functions 15144 // to an event; trigger`-ing an event fires all callbacks in succession. 15145 // 15146 // var object = {}; 15147 // _.extend(object, Backbone.Events); 15148 // object.on('expand', function(){ alert('expanded'); }); 15149 // object.trigger('expand'); 15150 // 15151 var Events = Backbone.Events = { 15152 15153 // Bind one or more space separated events, `events`, to a `callback` 15154 // function. Passing `"all"` will bind the callback to all events fired. 15155 on: function(events, callback, context) { 15156 15157 var calls, event, node, tail, list; 15158 if (!callback) return this; 15159 events = events.split(eventSplitter); 15160 calls = this._callbacks || (this._callbacks = {}); 15161 15162 // Create an immutable callback list, allowing traversal during 15163 // modification. The tail is an empty object that will always be used 15164 // as the next node. 15165 while (event = events.shift()) { 15166 list = calls[event]; 15167 node = list ? list.tail : {}; 15168 node.next = tail = {}; 15169 node.context = context; 15170 node.callback = callback; 15171 calls[event] = {tail: tail, next: list ? list.next : node}; 15172 } 15173 15174 return this; 15175 }, 15176 15177 // Remove one or many callbacks. If `context` is null, removes all callbacks 15178 // with that function. If `callback` is null, removes all callbacks for the 15179 // event. If `events` is null, removes all bound callbacks for all events. 15180 off: function(events, callback, context) { 15181 var event, calls, node, tail, cb, ctx; 15182 15183 // No events, or removing *all* events. 15184 if (!(calls = this._callbacks)) return; 15185 if (!(events || callback || context)) { 15186 delete this._callbacks; 15187 return this; 15188 } 15189 15190 // Loop through the listed events and contexts, splicing them out of the 15191 // linked list of callbacks if appropriate. 15192 events = events ? events.split(eventSplitter) : _.keys(calls); 15193 while (event = events.shift()) { 15194 node = calls[event]; 15195 delete calls[event]; 15196 if (!node || !(callback || context)) continue; 15197 // Create a new list, omitting the indicated callbacks. 15198 tail = node.tail; 15199 while ((node = node.next) !== tail) { 15200 cb = node.callback; 15201 ctx = node.context; 15202 if ((callback && cb !== callback) || (context && ctx !== context)) { 15203 this.on(event, cb, ctx); 15204 } 15205 } 15206 } 15207 15208 return this; 15209 }, 15210 15211 // Trigger one or many events, firing all bound callbacks. Callbacks are 15212 // passed the same arguments as `trigger` is, apart from the event name 15213 // (unless you're listening on `"all"`, which will cause your callback to 15214 // receive the true name of the event as the first argument). 15215 trigger: function(events) { 15216 var event, node, calls, tail, args, all, rest; 15217 if (!(calls = this._callbacks)) return this; 15218 all = calls.all; 15219 events = events.split(eventSplitter); 15220 rest = slice.call(arguments, 1); 15221 15222 // For each event, walk through the linked list of callbacks twice, 15223 // first to trigger the event, then to trigger any `"all"` callbacks. 15224 while (event = events.shift()) { 15225 if (node = calls[event]) { 15226 tail = node.tail; 15227 while ((node = node.next) !== tail) { 15228 node.callback.apply(node.context || this, rest); 15229 } 15230 } 15231 if (node = all) { 15232 tail = node.tail; 15233 args = [event].concat(rest); 15234 while ((node = node.next) !== tail) { 15235 node.callback.apply(node.context || this, args); 15236 } 15237 } 15238 } 15239 15240 return this; 15241 } 15242 15243 }; 15244 15245 // Aliases for backwards compatibility. 15246 Events.bind = Events.on; 15247 Events.unbind = Events.off; 15248 15249 // Backbone.Model 15250 // -------------- 15251 15252 // Create a new model, with defined attributes. A client id (`cid`) 15253 // is automatically generated and assigned for you. 15254 var Model = Backbone.Model = function(attributes, options) { 15255 var defaults; 15256 attributes || (attributes = {}); 15257 if (options && options.parse) attributes = this.parse(attributes); 15258 if (defaults = getValue(this, 'defaults')) { 15259 attributes = _.extend({}, defaults, attributes); 15260 } 15261 if (options && options.collection) this.collection = options.collection; 15262 this.attributes = {}; 15263 this._escapedAttributes = {}; 15264 this.cid = _.uniqueId('c'); 15265 this.changed = {}; 15266 this._silent = {}; 15267 this._pending = {}; 15268 this.set(attributes, {silent: true}); 15269 // Reset change tracking. 15270 this.changed = {}; 15271 this._silent = {}; 15272 this._pending = {}; 15273 this._previousAttributes = _.clone(this.attributes); 15274 this.initialize.apply(this, arguments); 15275 }; 15276 15277 // Attach all inheritable methods to the Model prototype. 15278 _.extend(Model.prototype, Events, { 15279 15280 // A hash of attributes whose current and previous value differ. 15281 changed: null, 15282 15283 // A hash of attributes that have silently changed since the last time 15284 // `change` was called. Will become pending attributes on the next call. 15285 _silent: null, 15286 15287 // A hash of attributes that have changed since the last `'change'` event 15288 // began. 15289 _pending: null, 15290 15291 // The default name for the JSON `id` attribute is `"id"`. MongoDB and 15292 // CouchDB users may want to set this to `"_id"`. 15293 idAttribute: 'id', 15294 15295 // Initialize is an empty function by default. Override it with your own 15296 // initialization logic. 15297 initialize: function(){}, 15298 15299 // Return a copy of the model's `attributes` object. 15300 toJSON: function(options) { 15301 return _.clone(this.attributes); 15302 }, 15303 15304 // Get the value of an attribute. 15305 get: function(attr) { 15306 return this.attributes[attr]; 15307 }, 15308 15309 // Get the HTML-escaped value of an attribute. 15310 escape: function(attr) { 15311 var html; 15312 if (html = this._escapedAttributes[attr]) return html; 15313 var val = this.get(attr); 15314 return this._escapedAttributes[attr] = _.escape(val == null ? '' : '' + val); 15315 }, 15316 15317 // Returns `true` if the attribute contains a value that is not null 15318 // or undefined. 15319 has: function(attr) { 15320 return this.get(attr) != null; 15321 }, 15322 15323 // Set a hash of model attributes on the object, firing `"change"` unless 15324 // you choose to silence it. 15325 set: function(key, value, options) { 15326 var attrs, attr, val; 15327 15328 // Handle both 15329 if (_.isObject(key) || key == null) { 15330 attrs = key; 15331 options = value; 15332 } else { 15333 attrs = {}; 15334 attrs[key] = value; 15335 } 15336 15337 // Extract attributes and options.
15338 options || (options = {}); 15339 if (!attrs) return this; 15340 if (attrs instanceof Model) attrs = attrs.attributes; 15341 if (options.unset) for (attr in attrs) attrs[attr] = void 0; 15342 15343 // Run validation. 15344 if (!this._validate(attrs, options)) return false; 15345 15346 // Check for changes of `id`. 15347 if (this.idAttribute in attrs) this.id = attrs[this.idAttribute]; 15348 15349 var changes = options.changes = {}; 15350 var now = this.attributes; 15351 var escaped = this._escapedAttributes; 15352 var prev = this._previousAttributes || {}; 15353 15354 // For each `set` attribute... 15355 for (attr in attrs) { 15356 val = attrs[attr]; 15357 15358 // If the new and current value differ, record the change. 15359 if (!_.isEqual(now[attr], val) || (options.unset && _.has(now, attr))) { 15360 delete escaped[attr]; 15361 (options.silent ? this._silent : changes)[attr] = true; 15362 } 15363 15364 // Update or delete the current value. 15365 options.unset ? delete now[attr] : now[attr] = val; 15366 15367 // If the new and previous value differ, record the change. If not, 15368 // then remove changes for this attribute. 15369 if (!_.isEqual(prev[attr], val) || (_.has(now, attr) != _.has(prev, attr))) { 15370 this.changed[attr] = val; 15371 if (!options.silent) this._pending[attr] = true; 15372 } else { 15373 delete this.changed[attr]; 15374 delete this._pending[attr]; 15375 } 15376 } 15377 15378 // Fire the `"change"` events. 15379 if (!options.silent) this.change(options); 15380 return this; 15381 }, 15382 15383 // Remove an attribute from the model, firing `"change"` unless you choose 15384 // to silence it. `unset` is a noop if the attribute doesn't exist. 15385 unset: function(attr, options) { 15386 (options || (options = {})).unset = true; 15387 return this.set(attr, null, options); 15388 }, 15389 15390 // Clear all attributes on the model, firing `"change"` unless you choose 15391 // to silence it. 15392 clear: function(options) { 15393 (options || (options = {})).unset = true; 15394 return this.set(_.clone(this.attributes), options); 15395 }, 15396 15397 // Fetch the model from the server. If the server's representation of the 15398 // model differs from its current attributes, they will be overriden, 15399 // triggering a `"change"` event. 15400 fetch: function(options) { 15401 options = options ? _.clone(options) : {}; 15402 var model = this; 15403 var success = options.success; 15404 options.success = function(resp, status, xhr) { 15405 if (!model.set(model.parse(resp, xhr), options)) return false; 15406 if (success) success(model, resp); 15407 }; 15408 options.error = Backbone.wrapError(options.error, model, options); 15409 return (this.sync || Backbone.sync).call(this, 'read', this, options); 15410 }, 15411 15412 // Set a hash of model attributes, and sync the model to the server. 15413 // If the server returns an attributes hash that differs, the model's 15414 // state will be `set` again. 15415 save: function(key, value, options) { 15416 var attrs, current; 15417 15418 // Handle both `("key", value)` and `({key: value})` -style calls. 15419 if (_.isObject(key) || key == null) { 15420 attrs = key; 15421 options = value; 15422 } else { 15423 attrs = {}; 15424 attrs[key] = value; 15425 } 15426 options = options ? _.clone(options) : {}; 15427 15428 // If we're "wait"-ing to set changed attributes, validate early. 15429 if (options.wait) { 15430 if (!this._validate(attrs, options)) return false; 15431 current = _.clone(this.attributes); 15432 } 15433 15434 // Regular saves `set` attributes before persisting to the server. 15435 var silentOptions = _.extend({}, options, {silent: true}); 15436 if (attrs && !this.set(attrs, options.wait ? silentOptions : options)) { 15437 return false; 15438 } 15439 15440 // After a successful server-side save, the client is (optionally) 15441 // updated with the server-side state. 15442 var model = this; 15443 var success = options.success; 15444 options.success = function(resp, status, xhr) { 15445 var serverAttrs = model.parse(resp, xhr); 15446 if (options.wait) { 15447 delete options.wait; 15448 serverAttrs = _.extend(attrs || {}, serverAttrs); 15449 } 15450 if (!model.set(serverAttrs, options)) return false;
15451 if (success) { 15452 success(model, resp); 15453 } else { 15454 model.trigger('sync', model, resp, options); 15455 } 15456 }; 15457 15458 // Finish configuring and sending the Ajax request. 15459 options.error = Backbone.wrapError(options.error, model, options); 15460 var method = this.isNew() ? 'create' : 'update'; 15461 var xhr = (this.sync || Backbone.sync).call(this, method, this, options); 15462 if (options.wait) this.set(current, silentOptions); 15463 return xhr; 15464 }, 15465 15466 // Destroy this model on the server if it was already persisted. 15467 // Optimistically removes the model from its collection, if it has one. 15468 // If `wait: true` is passed, waits for the server to respond before removal. 15469 destroy: function(options) { 15470 options = options ? _.clone(options) : {}; 15471 var model = this; 15472 var success = options.success; 15473 15474 var triggerDestroy = function() { 15475 model.trigger('destroy', model, model.collection, options); 15476 }; 15477 15478 if (this.isNew()) { 15479 triggerDestroy(); 15480 return false; 15481 } 15482 15483 options.success = function(resp) { 15484 if (options.wait) triggerDestroy(); 15485 if (success) { 15486 success(model, resp); 15487 } else { 15488 model.trigger('sync', model, resp, options); 15489 } 15490 }; 15491 15492 options.error = Backbone.wrapError(options.error, model, options); 15493 var xhr = (this.sync || Backbone.sync).call(this, 'delete', this, options); 15494 if (!options.wait) triggerDestroy(); 15495 return xhr; 15496 }, 15497 15498 // Default URL for the model's representation on the server -- if you're 15499 // using Backbone's restful methods, override this to change the endpoint 15500 // that will be called. 15501 url: function() { 15502 var base = getValue(this, 'urlRoot') || getValue(this.collection, 'url') || urlError(); 15503 if (this.isNew()) return base; 15504 return base + (base.charAt(base.length - 1) == '/' ? '' : '/') + encodeURIComponent(this.id); 15505 }, 15506 15507 // **parse** converts a response into the hash of attributes to be `set` on 15508 // the model. The default implementation is just to pass the response along. 15509 parse: function(resp, xhr) { 15510 return resp; 15511 }, 15512 15513 // Create a new model with identical attributes to this one. 15514 clone: function() { 15515 return new this.constructor(this.attributes); 15516 }, 15517 15518 // A model is new if it has never been saved to the server, and lacks an id. 15519 isNew: function() { 15520 return this.id == null; 15521 }, 15522 15523 // Call this method to manually fire a `"change"` event for this model and 15524 // a `"change:attribute"` event for each changed attribute. 15525 // Calling this will cause all objects observing the model to update. 15526 change: function(options) { 15527 options || (options = {}); 15528 var changing = this._changing; 15529 this._changing = true; 15530 15531 // Silent changes become pending changes. 15532 for (var attr in this._silent) this._pending[attr] = true; 15533 15534 // Silent changes are triggered. 15535 var changes = _.extend({}, options.changes, this._silent); 15536 this._silent = {}; 15537 for (var attr in changes) { 15538 this.trigger('change:' + attr, this, this.get(attr), options); 15539 } 15540 if (changing) return this; 15541 15542 // Continue firing `"change"` events while there are pending changes. 15543 while (!_.isEmpty(this._pending)) { 15544 this._pending = {}; 15545 this.trigger('change', this, options); 15546 // Pending and silent changes still remain. 15547 for (var attr in this.changed) { 15548 if (this._pending[attr] || this._silent[attr]) continue; 15549 delete this.changed[attr]; 15550 } 15551 this._previousAttributes = _.clone(this.attributes); 15552 } 15553 15554 this._changing = false; 15555 return this; 15556 }, 15557 15558 // Determine if the model has changed since the last `"change"` event. 15559 // If you specify an attribute name, determine if that attribute has changed. 15560 hasChanged: function(attr) { 15561 if (!arguments.length) return !_.isEmpty(this.changed); 15562 return _.has(this.changed, attr); 15563 }, 15564
15565 // Return an object containing all the attributes that have changed, or 15566 // false if there are no changed attributes. Useful for determining what 15567 // parts of a view need to be updated and/or what attributes need to be 15568 // persisted to the server. Unset attributes will be set to undefined. 15569 // You can also pass an attributes object to diff against the model, 15570 // determining if there *would be* a change. 15571 changedAttributes: function(diff) { 15572 if (!diff) return this.hasChanged() ? _.clone(this.changed) : false; 15573 var val, changed = false, old = this._previousAttributes; 15574 for (var attr in diff) { 15575 if (_.isEqual(old[attr], (val = diff[attr]))) continue; 15576 (changed || (changed = {}))[attr] = val; 15577 } 15578 return changed; 15579 }, 15580 15581 // Get the previous value of an attribute, recorded at the time the last 15582 // `"change"` event was fired. 15583 previous: function(attr) { 15584 if (!arguments.length || !this._previousAttributes) return null; 15585 return this._previousAttributes[attr]; 15586 }, 15587 15588 // Get all of the attributes of the model at the time of the previous 15589 // `"change"` event. 15590 previousAttributes: function() { 15591 return _.clone(this._previousAttributes); 15592 }, 15593 15594 // Check if the model is currently in a valid state. It's only possible to 15595 // get into an *invalid* state if you're using silent changes. 15596 isValid: function() { 15597 return !this.validate(this.attributes); 15598 }, 15599 15600 // Run validation against the next complete set of model attributes, 15601 // returning `true` if all is well. If a specific `error` callback has 15602 // been passed, call that instead of firing the general `"error"` event. 15603 _validate: function(attrs, options) { 15604 if (options.silent || !this.validate) return true; 15605 attrs = _.extend({}, this.attributes, attrs); 15606 var error = this.validate(attrs, options); 15607 if (!error) return true; 15608 if (options && options.error) { 15609 options.error(this, error, options); 15610 } else { 15611 this.trigger('error', this, error, options); 15612 } 15613 return false; 15614 } 15615 15616 }); 15617 15618 // Backbone.Collection 15619 // ------------------- 15620 15621 // Provides a standard collection class for our sets of models, ordered 15622 // or unordered. If a `comparator` is specified, the Collection will maintain 15623 // its models in sort order, as they're added and removed. 15624 var Collection = Backbone.Collection = function(models, options) { 15625 options || (options = {}); 15626 if (options.model) this.model = options.model; 15627 if (options.comparator) this.comparator = options.comparator; 15628 this._reset(); 15629 this.initialize.apply(this, arguments); 15630 if (models) this.reset(models, {silent: true, parse: options.parse}); 15631 }; 15632 15633 // Define the Collection's inheritable methods. 15634 _.extend(Collection.prototype, Events, { 15635 15636 // The default model for a collection is just a **Backbone.Model**. 15637 // This should be overridden in most cases. 15638 model: Model, 15639 15640 // Initialize is an empty function by default. Override it with your own 15641 // initialization logic. 15642 initialize: function(){}, 15643 15644 // The JSON representation of a Collection is an array of the 15645 // models' attributes. 15646 toJSON: function(options) { 15647 return this.map(function(model){ return model.toJSON(options); }); 15648 }, 15649 15650 // Add a model, or list of models to the set. Pass **silent** to avoid 15651 // firing the `add` event for every new model. 15652 add: function(models, options) { 15653 var i, index, length, model, cid, id, cids = {}, ids = {}, dups = []; 15654 options || (options = {}); 15655 models = _.isArray(models) ? models.slice() : [models]; 15656 15657 // Begin by turning bare objects into model references, and preventing 15658 // invalid models or duplicate models from being added. 15659 for (i = 0, length = models.length; i < length; i++) { 15660 if (!(model = models[i] = this._prepareModel(models[i], options))) { 15661 throw new Error("Can't add an invalid model to a collection"); 15662 } 15663 cid = model.cid; 15664 id = model.id; 15665 if (cids[cid] || this._byCid[cid] || ((id != null) && (ids[id] || this._byId[id]))) { 15666 dups.push(i); 15667 continue; 15668 } 15669 cids[cid] = ids[id] = model; 15670 } 15671 15672 // Remove duplicates. 15673 i = dups.length; 15674 while (i--) { 15675 models.splice(dups[i], 1); 15676 } 15677 15678 // Listen to added models' events, and index models for lookup by 15679 // `id` and by `cid`. 15680 for (i = 0, length = models.length; i < length; i++) { 15681 (model = models[i]).on('all', this._onModelEvent, this); 15682 this._byCid[model.cid] = model; 15683 if (model.id != null) this._byId[model.id] = model; 15684 } 15685 15686 // Insert models into the collection, re-sorting if needed, and triggering 15687 // `add` events unless silenced. 15688 this.length += length; 15689 index = options.at != null ? options.at : this.models.length; 15690 splice.apply(this.models, [index, 0].concat(models)); 15691 if (this.comparator) this.sort({silent: true}); 15692 if (options.silent) return this; 15693 for (i = 0, length = this.models.length; i < length; i++) { 15694 if (!cids[(model = this.models[i]).cid]) continue; 15695 options.index = i; 15696 model.trigger('add', model, this, options); 15697 } 15698 return this; 15699 }, 15700 15701 // Remove a model, or a list of models from the set. Pass silent to avoid 15702 // firing the `remove` event for every model removed. 15703 remove: function(models, options) { 15704 var i, l, index, model;
15705 options || (options = {}); 15706 models = _.isArray(models) ? models.slice() : [models]; 15707 for (i = 0, l = models.length; i < l; i++) { 15708 model = this.getByCid(models[i]) || this.get(models[i]); 15709 if (!model) continue; 15710 delete this._byId[model.id]; 15711 delete this._byCid[model.cid]; 15712 index = this.indexOf(model); 15713 this.models.splice(index, 1); 15714 this.length--; 15715 if (!options.silent) { 15716 options.index = index; 15717 model.trigger('remove', model, this, options); 15718 } 15719 this._removeReference(model); 15720 } 15721 return this; 15722 }, 15723 15724 // Add a model to the end of the collection. 15725 push: function(model, options) { 15726 model = this._prepareModel(model, options); 15727 this.add(model, options); 15728 return model; 15729 }, 15730 15731 // Remove a model from the end of the collection. 15732 pop: function(options) { 15733 var model = this.at(this.length - 1); 15734 this.remove(model, options); 15735 return model; 15736 }, 15737 15738 // Add a model to the beginning of the collection. 15739 unshift: function(model, options) { 15740 model = this._prepareModel(model, options); 15741 this.add(model, _.extend({at: 0}, options)); 15742 return model; 15743 }, 15744 15745 // Remove a model from the beginning of the collection. 15746 shift: function(options) { 15747 var model = this.at(0); 15748 this.remove(model, options); 15749 return model; 15750 }, 15751 15752 // Get a model from the set by id. 15753 get: function(id) { 15754 if (id == null) return void 0; 15755 return this._byId[id.id != null ? id.id : id]; 15756 }, 15757 15758 // Get a model from the set by client id. 15759 getByCid: function(cid) { 15760 return cid && this._byCid[cid.cid || cid]; 15761 }, 15762 15763 // Get the model at the given index. 15764 at: function(index) { 15765 return this.models[index]; 15766 }, 15767 15768 // Return models with matching attributes. Useful for simple cases of `filter`. 15769 where: function(attrs) { 15770 if (_.isEmpty(attrs)) return []; 15771 return this.filter(function(model) { 15772 for (var key in attrs) { 15773 if (attrs[key] !== model.get(key)) return false; 15774 } 15775 return true; 15776 }); 15777 }, 15778 15779 // Force the collection to re-sort itself. You don't need to call this under 15780 // normal circumstances, as the set will maintain sort order as each item 15781 // is added. 15782 sort: function(options) { 15783 options || (options = {}); 15784 if (!this.comparator) throw new Error('Cannot sort a set without a comparator'); 15785 var boundComparator = _.bind(this.comparator, this); 15786 if (this.comparator.length == 1) { 15787 this.models = this.sortBy(boundComparator); 15788 } else { 15789 this.models.sort(boundComparator); 15790 } 15791 if (!options.silent) this.trigger('reset', this, options); 15792 return this; 15793 }, 15794 15795 // Pluck an attribute from each model in the collection. 15796 pluck: function(attr) { 15797 return _.map(this.models, function(model){ return model.get(attr); }); 15798 }, 15799 15800 // When you have more items than you want to add or remove individually, 15801 // you can reset the entire set with a new list of models, without firing 15802 // any `add` or `remove` events. Fires `reset` when finished. 15803 reset: function(models, options) { 15804 models || (models = []); 15805 options || (options = {}); 15806 for (var i = 0, l = this.models.length; i < l; i++) { 15807 this._removeReference(this.models[i]); 15808 } 15809 this._reset(); 15810 this.add(models, _.extend({silent: true}, options)); 15811 if (!options.silent) this.trigger('reset', this, options); 15812 return this; 15813 }, 15814 15815 // Fetch the default set of models for this collection, resetting the 15816 // collection when they arrive. If `add: true` is passed, appends the 15817 // models to the collection instead of resetting. 15818 fetch: function(options) { 15819 options = options ? _.clone(options) : {}; 15820 if (options.parse === undefined) options.parse = true; 15821 var collection = this; 15822 var success = options.success; 15823 options.success = function(resp, status, xhr) { 15824 collection[options.add ? 'add' : 'reset'](collection.parse(resp, xhr), options); 15825 if (success) success(collection, resp); 15826 }; 15827 options.error = Backbone.wrapError(options.error, collection, options); 15828 return (this.sync || Backbone.sync).call(this, 'read', this, options); 15829 }, 15830 15831 // Create a new instance of a model in this collection. Add the model to the 15832 // collection immediately, unless `wait: true` is passed, in which case we 15833 // wait for the server to agree. 15834 create: function(model, options) { 15835 var coll = this; 15836 options = options ? _.clone(options) : {}; 15837 model = this._prepareModel(model, options); 15838 if (!model) return false;
15839 if (!options.wait) coll.add(model, options); 15840 var success = options.success; 15841 options.success = function(nextModel, resp, xhr) { 15842 if (options.wait) coll.add(nextModel, options); 15843 if (success) { 15844 success(nextModel, resp); 15845 } else { 15846 nextModel.trigger('sync', model, resp, options); 15847 } 15848 }; 15849 model.save(null, options); 15850 return model; 15851 }, 15852 15853 // **parse** converts a response into a list of models to be added to the 15854 // collection. The default implementation is just to pass it through. 15855 parse: function(resp, xhr) { 15856 return resp; 15857 }, 15858 15859 // Proxy to _'s chain. Can't be proxied the same way the rest of the 15860 // underscore methods are proxied because it relies on the underscore 15861 // constructor. 15862 chain: function () { 15863 return _(this.models).chain(); 15864 }, 15865 15866 // Reset all internal state. Called when the collection is reset. 15867 _reset: function(options) { 15868 this.length = 0; 15869 this.models = []; 15870 this._byId = {}; 15871 this._byCid = {}; 15872 }, 15873 15874 // Prepare a model or hash of attributes to be added to this collection. 15875 _prepareModel: function(model, options) { 15876 options || (options = {}); 15877 if (!(model instanceof Model)) { 15878 var attrs = model; 15879 options.collection = this; 15880 model = new this.model(attrs, options); 15881 if (!model._validate(model.attributes, options)) model = false; 15882 } else if (!model.collection) { 15883 model.collection = this; 15884 } 15885 return model; 15886 }, 15887 15888 // Internal method to remove a model's ties to a collection. 15889 _removeReference: function(model) { 15890 if (this == model.collection) { 15891 delete model.collection; 15892 } 15893 model.off('all', this._onModelEvent, this); 15894 }, 15895 15896 // Internal method called every time a model in the set fires an event. 15897 // Sets need to update their indexes when models change ids. All other 15898 // events simply proxy through. "add" and "remove" events that originate 15899 // in other collections are ignored. 15900 _onModelEvent: function(event, model, collection, options) { 15901 if ((event == 'add' || event == 'remove') && collection != this) return; 15902 if (event == 'destroy') { 15903 this.remove(model, options); 15904 } 15905 if (model && event === 'change:' + model.idAttribute) { 15906 delete this._byId[model.previous(model.idAttribute)]; 15907 this._byId[model.id] = model; 15908 } 15909 this.trigger.apply(this, arguments); 15910 } 15911 15912 }); 15913 15914 // Underscore methods that we want to implement on the Collection. 15915 var methods = ['forEach', 'each', 'map', 'reduce', 'reduceRight', 'find', 15916 'detect', 'filter', 'select', 'reject', 'every', 'all', 'some', 'any', 15917 'include', 'contains', 'invoke', 'max', 'min', 'sortBy', 'sortedIndex', 15918 'toArray', 'size', 'first', 'initial', 'rest', 'last', 'without', 'indexOf', 15919 'shuffle', 'lastIndexOf', 'isEmpty', 'groupBy']; 15920 15921 // Mix in each Underscore method as a proxy to `Collection#models`. 15922 _.each(methods, function(method) { 15923 Collection.prototype[method] = function() { 15924 return _[method].apply(_, [this.models].concat(_.toArray(arguments))); 15925 }; 15926 }); 15927 15928 // Backbone.Router 15929 // ------------------- 15930 15931 // Routers map faux-URLs to actions, and fire events when routes are 15932 // matched. Creating a new one sets its `routes` hash, if not set statically. 15933 var Router = Backbone.Router = function(options) { 15934 options || (options = {}); 15935 if (options.routes) this.routes = options.routes; 15936 this._bindRoutes(); 15937 this.initialize.apply(this, arguments); 15938 }; 15939 15940 // Cached regular expressions for matching named param parts and splatted 15941 // parts of route strings. 15942 var namedParam = /:\w+/g; 15943 var splatParam = /\*\w+/g; 15944 var escapeRegExp = /[-[\]{}()+?.,\\^$|#\s]/g; 15945 15946 // Set up all inheritable **Backbone.Router** properties and methods. 15947 _.extend(Router.prototype, Events, { 15948 15949 // Initialize is an empty function by default. Override it with your own 15950 // initialization logic. 15951 initialize: function(){}, 15952 15953 // Manually bind a single named route to a callback. For example: 15954 // 15955 // this.route('search/:query/p:num', 'search', function(query, num) { 15956 // ... 15957 // }); 15958 // 15959 route: function(route, name, callback) { 15960 Backbone.history || (Backbone.history = new History); 15961 if (!_.isRegExp(route)) route = this._routeToRegExp(route); 15962 if (!callback) callback = this[name]; 15963 Backbone.history.route(route, _.bind(function(fragment) { 15964 var args = this._extractParameters(route, fragment); 15965 callback && callback.apply(this, args);
15966 this.trigger.apply(this, ['route:' + name].concat(args)); 15967 Backbone.history.trigger('route', this, name, args); 15968 }, this)); 15969 return this; 15970 }, 15971 15972 // Simple proxy to `Backbone.history` to save a fragment into the history. 15973 navigate: function(fragment, options) { 15974 Backbone.history.navigate(fragment, options); 15975 }, 15976 15977 // Bind all defined routes to `Backbone.history`. We have to reverse the 15978 // order of the routes here to support behavior where the most general 15979 // routes can be defined at the bottom of the route map. 15980 _bindRoutes: function() { 15981 if (!this.routes) return; 15982 var routes = []; 15983 for (var route in this.routes) { 15984 routes.unshift([route, this.routes[route]]); 15985 } 15986 for (var i = 0, l = routes.length; i < l; i++) { 15987 this.route(routes[i][0], routes[i][1], this[routes[i][1]]); 15988 } 15989 }, 15990 15991 // Convert a route string into a regular expression, suitable for matching 15992 // against the current location hash. 15993 _routeToRegExp: function(route) { 15994 route = route.replace(escapeRegExp, '\\$&') 15995 .replace(namedParam, '([^\/]+)') 15996 .replace(splatParam, '(.*?)'); 15997 return new RegExp('^' + route + '$'); 15998 }, 15999 16000 // Given a route, and a URL fragment that it matches, return the array of 16001 // extracted parameters. 16002 _extractParameters: function(route, fragment) { 16003 return route.exec(fragment).slice(1); 16004 } 16005 16006 }); 16007 16008 // Backbone.History 16009 // ---------------- 16010 16011 // Handles cross-browser history management, based on URL fragments. If the 16012 // browser does not support `onhashchange`, falls back to polling. 16013 var History = Backbone.History = function() { 16014 this.handlers = []; 16015 _.bindAll(this, 'checkUrl'); 16016 }; 16017 16018 // Cached regex for cleaning leading hashes and slashes . 16019 var routeStripper = /^[#\/]/; 16020 16021 // Cached regex for detecting MSIE. 16022 var isExplorer = /msie [\w.]+/; 16023 16024 // Has the history handling already been started? 16025 History.started = false; 16026 16027 // Set up all inheritable **Backbone.History** properties and methods. 16028 _.extend(History.prototype, Events, { 16029 16030 // The default interval to poll for hash changes, if necessary, is 16031 // twenty times a second. 16032 interval: 50, 16033 16034 // Gets the true hash value. Cannot use location.hash directly due to bug 16035 // in Firefox where location.hash will always be decoded. 16036 getHash: function(windowOverride) { 16037 var loc = windowOverride ? windowOverride.location : window.location; 16038 var match = loc.href.match(/#(.*)$/); 16039 return match ? match[1] : ''; 16040 }, 16041 16042 // Get the cross-browser normalized URL fragment, either from the URL, 16043 // the hash, or the override. 16044 getFragment: function(fragment, forcePushState) { 16045 if (fragment == null) { 16046 if (this._hasPushState || forcePushState) { 16047 fragment = window.location.pathname; 16048 var search = window.location.search; 16049 if (search) fragment += search; 16050 } else { 16051 fragment = this.getHash(); 16052 } 16053 } 16054 if (!fragment.indexOf(this.options.root)) fragment = fragment.substr(this.options.root.length); 16055 return fragment.replace(routeStripper, ''); 16056 }, 16057 16058 // Start the hash change handling, returning `true` if the current URL matches 16059 // an existing route, and `false` otherwise. 16060 start: function(options) { 16061 if (History.started) throw new Error("Backbone.history has already been started"); 16062 History.started = true; 16063 16064 // Figure out the initial configuration. Do we need an iframe? 16065 // Is pushState desired ... is it available? 16066 this.options = _.extend({}, {root: '/'}, this.options, options); 16067 this._wantsHashChange = this.options.hashChange !== false; 16068 this._wantsPushState = !!this.options.pushState; 16069 this._hasPushState = !!(this.options.pushState && window.history && window.history.pushState); 16070 var fragment = this.getFragment(); 16071 var docMode = document.documentMode; 16072 var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7)); 16073 16074 if (oldIE) { 16075 this.iframe = $('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow; 16076 this.navigate(fragment); 16077 } 16078 16079 // Depending on whether we're using pushState or hashes, and whether 16080 // 'onhashchange' is supported, determine how we check the URL state. 16081 if (this._hasPushState) { 16082 $(window).bind('popstate', this.checkUrl); 16083 } else if (this._wantsHashChange && ('onhashchange' in window) && !oldIE) { 16084 $(window).bind('hashchange', this.checkUrl); 16085 } else if (this._wantsHashChange) { 16086 this._checkUrlInterval = setInterval(this.checkUrl, this.interval); 16087 } 16088 16089 // Determine if we need to change the base url, for a pushState link 16090 // opened by a non-pushState browser. 16091 this.fragment = fragment; 16092 var loc = window.location; 16093 var atRoot = loc.pathname == this.options.root; 16094 16095 // If we've started off with a route from a `pushState`-enabled browser, 16096 // but we're currently in a browser that doesn't support it... 16097 if (this._wantsHashChange && this._wantsPushState && !this._hasPushState && !atRoot) { 16098 this.fragment = this.getFragment(null, true); 16099 window.location.replace(this.options.root + '#' + this.fragment); 16100 // Return immediately as browser will do redirect to new url 16101 return true; 16102 16103 // Or if we've started out with a hash-based route, but we're currently 16104 // in a browser where it could be `pushState`-based instead... 16105 } else if (this._wantsPushState && this._hasPushState && atRoot && loc.hash) { 16106 this.fragment = this.getHash().replace(routeStripper, ''); 16107 window.history.replaceState({}, document.title, loc.protocol + '//' + loc.host + this.options.root + this.fragment); 16108 } 16109 16110 if (!this.options.silent) { 16111 return this.loadUrl(); 16112 } 16113 }, 16114 16115 // Disable Backbone.history, perhaps temporarily. Not useful in a real app, 16116 // but possibly useful for unit testing Routers. 16117 stop: function() { 16118 $(window).unbind('popstate', this.checkUrl).unbind('hashchange', this.checkUrl); 16119 clearInterval(this._checkUrlInterval); 16120 History.started = false;
16121 }, 16122 16123 // Add a route to be tested when the fragment changes. Routes added later 16124 // may override previous routes. 16125 route: function(route, callback) { 16126 this.handlers.unshift({route: route, callback: callback}); 16127 }, 16128 16129 // Checks the current URL to see if it has changed, and if it has, 16130 // calls `loadUrl`, normalizing across the hidden iframe. 16131 checkUrl: function(e) { 16132 var current = this.getFragment(); 16133 if (current == this.fragment && this.iframe) current = this.getFragment(this.getHash(this.iframe)); 16134 if (current == this.fragment) return false; 16135 if (this.iframe) this.navigate(current); 16136 this.loadUrl() || this.loadUrl(this.getHash()); 16137 }, 16138 16139 // Attempt to load the current URL fragment. If a route succeeds with a 16140 // match, returns `true`. If no defined routes matches the fragment, 16141 // returns `false`. 16142 loadUrl: function(fragmentOverride) { 16143 var fragment = this.fragment = this.getFragment(fragmentOverride); 16144 var matched = _.any(this.handlers, function(handler) { 16145 if (handler.route.test(fragment)) { 16146 handler.callback(fragment); 16147 return true; 16148 } 16149 }); 16150 return matched; 16151 }, 16152 16153 // Save a fragment into the hash history, or replace the URL state if the 16154 // 'replace' option is passed. You are responsible for properly URL-encoding 16155 // the fragment in advance. 16156 // 16157 // The options object can contain `trigger: true` if you wish to have the 16158 // route callback be fired (not usually desirable), or `replace: true`, if 16159 // you wish to modify the current URL without adding an entry to the history. 16160 navigate: function(fragment, options) { 16161 if (!History.started) return false; 16162 if (!options || options === true) options = {trigger: options}; 16163 var frag = (fragment || '').replace(routeStripper, ''); 16164 if (this.fragment == frag) return; 16165 16166 // If pushState is available, we use it to set the fragment as a real URL. 16167 if (this._hasPushState) { 16168 if (frag.indexOf(this.options.root) != 0) frag = this.options.root + frag; 16169 this.fragment = frag; 16170 window.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, frag); 16171 16172 // If hash changes haven't been explicitly disabled, update the hash 16173 // fragment to store history. 16174 } else if (this._wantsHashChange) { 16175 this.fragment = frag; 16176 this._updateHash(window.location, frag, options.replace); 16177 if (this.iframe && (frag != this.getFragment(this.getHash(this.iframe)))) { 16178 // Opening and closing the iframe tricks IE7 and earlier to push a history entry on hash-tag change. 16179 // When replace is true, we don't want this. 16180 if(!options.replace) this.iframe.document.open().close(); 16181 this._updateHash(this.iframe.location, frag, options.replace); 16182 } 16183 16184 // If you've told us that you explicitly don't want fallback hashchange- 16185 // based history, then `navigate` becomes a page refresh. 16186 } else { 16187 window.location.assign(this.options.root + fragment); 16188 } 16189 if (options.trigger) this.loadUrl(fragment); 16190 }, 16191 16192 // Update the hash location, either replacing the current entry, or adding 16193 // a new one to the browser history. 16194 _updateHash: function(location, fragment, replace) { 16195 if (replace) { 16196 location.replace(location.toString().replace(/(javascript:|#).*$/, '') + '#' + fragment); 16197 } else { 16198 location.hash = fragment; 16199 } 16200 } 16201 }); 16202 16203 // Backbone.View 16204 // ------------- 16205 16206 // Creating a Backbone.View creates its initial element outside of the DOM, 16207 // if an existing element is not provided... 16208 var View = Backbone.View = function(options) { 16209 this.cid = _.uniqueId('view'); 16210 this._configure(options || {}); 16211 this._ensureElement(); 16212 this.initialize.apply(this, arguments); 16213 this.delegateEvents(); 16214 }; 16215 16216 // Cached regex to split keys for `delegate`. 16217 var delegateEventSplitter = /^(\S+)\s*(.*)$/; 16218 16219 // List of view options to be merged as properties. 16220 var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName']; 16221 16222 // Set up all inheritable **Backbone.View** properties and methods. 16223 _.extend(View.prototype, Events, { 16224 16225 // The default `tagName` of a View's element is `"div"`. 16226 tagName: 'div', 16227 16228 // jQuery delegate for element lookup, scoped to DOM elements within the 16229 // current view. This should be prefered to global lookups where possible. 16230 $: function(selector) { 16231 return this.$el.find(selector); 16232 }, 16233 16234 // Initialize is an empty function by default. Override it with your own 16235 // initialization logic. 16236 initialize: function(){}, 16237 16238 // **render** is the core function that your view should override, in order 16239 // to populate its element (`this.el`), with the appropriate HTML. The 16240 // convention is for **render** to always return `this`. 16241 render: function() { 16242 return this; 16243 }, 16244 16245 // Remove this view from the DOM. Note that the view isn't present in the 16246 // DOM by default, so calling this method may be a no-op. 16247 remove: function() { 16248 this.$el.remove(); 16249 return this; 16250 }, 16251 16252 // For small amounts of DOM Elements, where a full-blown template isn't 16253 // needed, use **make** to manufacture elements, one at a time. 16254 // 16255 // var el = this.make('li', {'class': 'row'}, this.model.escape('title')); 16256 // 16257 make: function(tagName, attributes, content) { 16258 var el = document.createElement(tagName); 16259 if (attributes) $(el).attr(attributes); 16260 if (content) $(el).html(content); 16261 return el; 16262 }, 16263 16264 // Change the view's element (`this.el` property), including event 16265 // re-delegation. 16266 setElement: function(element, delegate) { 16267 if (this.$el) this.undelegateEvents(); 16268 this.$el = (element instanceof $) ? element : $(element); 16269 this.el = this.$el[0]; 16270 if (delegate !== false) this.delegateEvents(); 16271 return this; 16272 }, 16273 16274 // Set callbacks, where `this.events` is a hash of 16275 // 16276 // *{"event selector": "callback"}* 16277 // 16278 // { 16279 // 'mousedown .title': 'edit', 16280 // 'click .button': 'save' 16281 // 'click .open': function(e) { ... } 16282 // } 16283 // 16284 // pairs. Callbacks will be bound to the view, with `this` set properly. 16285 // Uses event delegation for efficiency. 16286 // Omitting the selector binds the event to `this.el`. 16287 // This only works for delegate-able events: not `focus`, `blur`, and 16288 // not `change`, `submit`, and `reset` in Internet Explorer. 16289 delegateEvents: function(events) { 16290 if (!(events || (events = getValue(this, 'events')))) return; 16291 this.undelegateEvents(); 16292 for (var key in events) { 16293 var method = events[key]; 16294 if (!_.isFunction(method)) method = this[events[key]];
16295 if (!method) throw new Error('Method "' + events[key] + '" does not exist'); 16296 var match = key.match(delegateEventSplitter); 16297 var eventName = match[1], selector = match[2]; 16298 method = _.bind(method, this); 16299 eventName += '.delegateEvents' + this.cid; 16300 if (selector === '') { 16301 this.$el.bind(eventName, method); 16302 } else { 16303 this.$el.delegate(selector, eventName, method); 16304 } 16305 } 16306 }, 16307 16308 // Clears all callbacks previously bound to the view with `delegateEvents`. 16309 // You usually don't need to use this, but may wish to if you have multiple 16310 // Backbone views attached to the same DOM element. 16311 undelegateEvents: function() { 16312 this.$el.unbind('.delegateEvents' + this.cid); 16313 }, 16314 16315 // Performs the initial configuration of a View with a set of options. 16316 // Keys with special meaning *(model, collection, id, className)*, are 16317 // attached directly to the view. 16318 _configure: function(options) { 16319 if (this.options) options = _.extend({}, this.options, options); 16320 for (var i = 0, l = viewOptions.length; i < l; i++) { 16321 var attr = viewOptions[i]; 16322 if (options[attr]) this[attr] = options[attr]; 16323 } 16324 this.options = options; 16325 }, 16326 16327 // Ensure that the View has a DOM element to render into. 16328 // If `this.el` is a string, pass it through `$()`, take the first 16329 // matching element, and re-assign it to `el`. Otherwise, create 16330 // an element from the `id`, `className` and `tagName` properties. 16331 _ensureElement: function() { 16332 if (!this.el) { 16333 var attrs = getValue(this, 'attributes') || {}; 16334 if (this.id) attrs.id = this.id; 16335 if (this.className) attrs['class'] = this.className; 16336 this.setElement(this.make(this.tagName, attrs), false); 16337 } else { 16338 this.setElement(this.el, false); 16339 } 16340 } 16341 16342 }); 16343 16344 // The self-propagating extend function that Backbone classes use. 16345 var extend = function (protoProps, classProps) { 16346 var child = inherits(this, protoProps, classProps); 16347 child.extend = this.extend; 16348 return child; 16349 }; 16350 16351 // Set up inheritance for the model, collection, and view. 16352 Model.extend = Collection.extend = Router.extend = View.extend = extend; 16353 16354 // Backbone.sync 16355 // ------------- 16356 16357 // Map from CRUD to HTTP for our default `Backbone.sync` implementation. 16358 var methodMap = { 16359 'create': 'POST', 16360 'update': 'PUT', 16361 'delete': 'DELETE', 16362 'read': 'GET' 16363 }; 16364 16365 // Override this function to change the manner in which Backbone persists 16366 // models to the server. You will be passed the type of request, and the 16367 // model in question. By default, makes a RESTful Ajax request 16368 // to the model's `url()`. Some possible customizations could be: 16369 // 16370 // * Use `setTimeout` to batch rapid-fire updates into a single request. 16371 // * Send up the models as XML instead of JSON. 16372 // * Persist models via WebSockets instead of Ajax. 16373 // 16374 // Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests 16375 // as `POST`, with a `_method` parameter containing the true HTTP method, 16376 // as well as all requests with the body as `application/x-www-form-urlencoded` 16377 // instead of `application/json` with the model in a param named `model`. 16378 // Useful when interfacing with server-side languages like **PHP** that make 16379 // it difficult to read the body of `PUT` requests. 16380 Backbone.sync = function(method, model, options) { 16381 var type = methodMap[method]; 16382 16383 // Default options, unless specified. 16384 options || (options = {}); 16385 16386 // Default JSON-request options. 16387 var params = {type: type, dataType: 'json'}; 16388 16389 // Ensure that we have a URL. 16390 if (!options.url) { 16391 params.url = getValue(model, 'url') || urlError(); 16392 } 16393 16394 // Ensure that we have the appropriate request data. 16395 if (!options.data && model && (method == 'create' || method == 'update')) { 16396 params.contentType = 'application/json'; 16397 params.data = JSON.stringify(model.toJSON()); 16398 } 16399 16400 // For older servers, emulate JSON by encoding the request into an HTML-form. 16401 if (Backbone.emulateJSON) { 16402 params.contentType = 'application/x-www-form-urlencoded'; 16403 params.data = params.data ? {model: params.data} : {}; 16404 } 16405 16406 // For older servers, emulate HTTP by mimicking the HTTP method with `_method` 16407 // And an `X-HTTP-Method-Override` header. 16408 if (Backbone.emulateHTTP) { 16409 if (type === 'PUT' || type === 'DELETE') { 16410 if (Backbone.emulateJSON) params.data._method = type; 16411 params.type = 'POST'; 16412 params.beforeSend = function(xhr) { 16413 xhr.setRequestHeader('X-HTTP-Method-Override', type); 16414 }; 16415 } 16416 } 16417 16418 // Don't process data on a non-GET request. 16419 if (params.type !== 'GET' && !Backbone.emulateJSON) { 16420 params.processData = false;
16421 } 16422 16423 // Make the request, allowing the user to override any Ajax options. 16424 return $.ajax(_.extend(params, options)); 16425 }; 16426 16427 // Wrap an optional error callback with a fallback error event. 16428 Backbone.wrapError = function(onError, originalModel, options) { 16429 return function(model, resp) { 16430 resp = model === originalModel ? resp : model; 16431 if (onError) { 16432 onError(originalModel, resp, options); 16433 } else { 16434 originalModel.trigger('error', originalModel, resp, options); 16435 } 16436 }; 16437 }; 16438 16439 // Helpers 16440 // ------- 16441 16442 // Shared empty constructor function to aid in prototype-chain creation. 16443 var ctor = function(){}; 16444 16445 // Helper function to correctly set up the prototype chain, for subclasses. 16446 // Similar to `goog.inherits`, but uses a hash of prototype properties and 16447 // class properties to be extended. 16448 var inherits = function(parent, protoProps, staticProps) { 16449 var child; 16450 16451 // The constructor function for the new subclass is either defined by you 16452 // (the "constructor" property in your `extend` definition), or defaulted 16453 // by us to simply call the parent's constructor. 16454 if (protoProps && protoProps.hasOwnProperty('constructor')) { 16455 child = protoProps.constructor; 16456 } else { 16457 child = function(){ parent.apply(this, arguments); }; 16458 } 16459 16460 // Inherit class (static) properties from parent. 16461 _.extend(child, parent); 16462 16463 // Set the prototype chain to inherit from `parent`, without calling 16464 // `parent`'s constructor function. 16465 ctor.prototype = parent.prototype; 16466 child.prototype = new ctor(); 16467 16468 // Add prototype properties (instance properties) to the subclass, 16469 // if supplied.
16470 if (protoProps) _.extend(child.prototype, protoProps); 16471 16472 // Add static properties to the constructor function, if supplied. 16473 if (staticProps) _.extend(child, staticProps); 16474 16475 // Correctly set child's `prototype.constructor`. 16476 child.prototype.constructor = child; 16477 16478 // Set a convenience property in case the parent's prototype is needed later. 16479 child.__super__ = parent.prototype; 16480 16481 return child; 16482 }; 16483 16484 // Helper function to get a value from a Backbone object as a property 16485 // or as a function. 16486 var getValue = function(object, prop) { 16487 if (!(object && object[prop])) return null; 16488 return _.isFunction(object[prop]) ? object[prop]() : object[prop]; 16489 }; 16490 16491 // Throw an error when a URL is needed, and none is supplied. 16492 var urlError = function() { 16493 throw new Error('A "url" property or function must be specified'); 16494 }; 16495 16496}).call(this); 16497 16498jQuery.noConflict(); 16499jQuery(function($) { 16500 16501SearchAutocompleteForm = Backbone.View.extend({ 16502 events : { 16503 'focus .UI-SEARCH' : 'focus', 16504 'blur .UI-SEARCH' : 'blur', 16505 'submit' : 'submit' 16506 }, 16507 16508 initialize: function() { 16509 var self = this; 16510 _.bindAll(self); 16511 }, 16512 16513 init: function(el) { 16514 var self = this; 16515 self.setElement(el); 16516 16517 self.$field = $('.UI-SEARCH', self.$el); 16518 self.emptyText = self.$el.attr('data-tip'); 16519 16520 self.blur(); 16521 }, 16522 16523 submit: function(e) { 16524 var self = this; 16525 16526 if (self.$field.val() == self.emptyText || self.$field.val() == '') { 16527 e.stopPropagation(); 16528 return false; 16529 } 16530 var query = self.$field.val(); 16531 query = query.replace(/<\/?[^>]+>/gi, ''); 16532 self.$field.val(query); 16533 16534 return true; 16535 }, 16536 16537 focus: function() { 16538 var self = this; 16539 16540 if(self.$field.val() == self.emptyText){ 16541 self.$field.val(''); 16542 } 16543 }, 16544 16545 blur: function() { 16546 var self = this; 16547 16548 if(self.$field.val() == ''){ 16549 self.$field.val(self.emptyText); 16550 } 16551 } 16552 16553}); 16554 16555$(function() { 16556 _.each($('.UI-SEARCHAUTOCOMPLETE'), function (el) { 16557 var form = new SearchAutocompleteForm(); 16558 form.init(el); 16559 }); 16560}); 16561 16562}); 16563jQuery.noConflict(); 16564jQuery(function ($) { 16565 16566 var uiSearchautocompleteHide = true; 16567 $(window).on('touchend', function(e) { 16568 uiSearchautocompleteHide = true; 16569 if (!$(e.target).closest('.UI-SEARCHAUTOCOMPLETE').length) { 16570 $('#search').blur(); 16571 } 16572 uiSearchautocompleteHide = false;
16573 }); 16574 16575 SearchAutocomplete = Backbone.View.extend({ 16576 url: null, 16577 result: null, 16578 suggest: null, 16579 query: null, 16580 delay: 100, 16581 hideDelay: 1000, 16582 store: 1, 16583 queryMinChars: 3, 16584 shown: false, 16585 16586 events: { 16587 'keydown .UI-SEARCH': 'onKeydown', 16588 'keyup .UI-SEARCH': 'onKeyup', 16589 'blur .UI-SEARCH': 'onBlur', 16590 'focus .UI-SEARCH': 'onFocus', 16591 'change .UI-CATEGORY': 'onChangeCategory' 16592 }, 16593 16594 initialize: function () { 16595 var self = this; 16596 _.bindAll(self); 16597 }, 16598 16599 init: function (el) { 16600 var self = this; 16601 16602 self.setElement(el); 16603 16604 self.url = self.$el.attr('data-url'); 16605 self.delay = self.$el.attr('data-delay'); 16606 self.hideDelay = self.$el.attr('data-hide-delay'); 16607 self.queryMinChars = self.$el.attr('data-minchars'); 16608 self.$listenField = $('.UI-SEARCH', self.$el); 16609 self.$suggestField = $('.UI-SEARCH-SUGGEST', self.$el); 16610 self.$placeholder = $('.UI-PLACEHOLDER', self.$el); 16611 self.$loader = $('.UI-LOADER', self.$el); 16612 self.$category = $('.UI-CATEGORY', self.$el);
16613 self.$categoryText = $('.UI-CATEGORY-TEXT', self.$el); 16614 self.result = ''; 16615 self.query = self.$listenField.val(); 16616 16617 self.baseWidth = $('.UI-NAV-INPUT').width(); 16618 16619 self.onChangeCategory(); 16620 }, 16621 16622 onChangeCategory: function () { 16623 var self = this; 16624 var text = $('option:selected', self.$category).text(); 16625 16626 if (self.$categoryText.length) { 16627 self.$categoryText.html(text); 16628 var width = self.$categoryText.width(); 16629 16630 if (width < 0) { 16631 width = 20; 16632 } 16633 $('.UI-NAV-INPUT').css('padding-left', width + 35); 16634 $('.UI-CATEGORY').css('width', width + 35); 16635 // $('.UI-NAV-INPUT').css('width', self.baseWidth -(self.$categoryText.width() + 35)); 16636 } 16637 16638 self.result = ''; 16639 }, 16640 16641 onKeydown: function (e) { 16642 var self = this; 16643 e.stopPropagation(); 16644 16645 if (!self.shown) { 16646 return; 16647 } 16648 16649 switch (e.keyCode) { 16650 16651 case 9: // tab 16652 case 27: // escape 16653 e.preventDefault(); 16654 break; 16655 16656 case 38: // up arrow 16657 e.preventDefault(); 16658 self.prev(); 16659 break; 16660 16661 case 40: // down arrow 16662 e.preventDefault(); 16663 self.next(); 16664 break; 16665 } 16666 }, 16667 16668 onKeyup: function (e) { 16669 var self = this; 16670 e.stopPropagation(); 16671 e.preventDefault(); 16672 16673 switch (e.keyCode) { 16674 case 40: // down arrow 16675 case 38: // up arrow 16676 break; 16677 16678 case 27: // escape 16679 self.hide(); 16680 break; 16681 16682 default: 16683 var q = self.$listenField.val(); 16684 window.setTimeout(function () { 16685 if (q == self.$listenField.val() && self.$listenField.val() != self.query) { 16686 self.lookup(); 16687 } 16688 }, self.delay); 16689 16690 self.$placeholder.html(self.result); 16691 self.highlighter(self.$placeholder); 16692 } 16693 }, 16694 16695 onBlur: function (e) { 16696 var self = this; 16697 16698 if (uiSearchautocompleteHide) { 16699 // setTimeout(function () { 16700 // self.select(); 16701 // }, 300); 16702 } 16703 }, 16704 16705 onFocus: function (e) { 16706 var self = this; 16707 16708 if (self.query.length >= self.queryMinChars) { 16709 if (self.result == '') { 16710 self.lookup(); 16711 } else { 16712 self.show(); 16713 } 16714 } 16715 }, 16716 16717 mouseover: function (e) { 16718 var self = this; 16719 16720 $('.active', self.$placeholder).removeClass('active'); 16721 16722 $(e.currentTarget).addClass('active'); 16723 }, 16724 16725 mouseout: function (e) { 16726 $(e.currentTarget).removeClass('active'); 16727 }, 16728 16729 click: function (e) { 16730 var self = this; 16731 if (!$(e.target).attr('href')) { 16732 e.stopPropagation(); 16733 e.preventDefault(); 16734 16735 self.select(); 16736 } 16737 }, 16738 16739 next: function (e) { 16740 var self = this; 16741 var next; 16742 16743 var $active = $('.active', self.$placeholder); 16744 $active.removeClass('active'); 16745 16746 if ($active.length === 0) { 16747 next = $($('li', self.$placeholder).get(0)); 16748 } else { 16749 next = $active.next(); 16750 } 16751 16752 if (next) { 16753 next.addClass('active'); 16754 } 16755 }, 16756 16757 prev: function (e) { 16758 var self = this; 16759 var prev; 16760 16761 var active = $('.active', self.$placeholder); 16762 active.removeClass('active'); 16763 16764 if (active.length === 0) { 16765 prev = $($('li', self.$placeholder).get($('li', self.$placeholder).length - 1)); 16766 } else { 16767 prev = active.prev(); 16768 } 16769 16770 if (prev) { 16771 prev.addClass('active'); 16772 } 16773 }, 16774 16775 select: function () { 16776 var self = this; 16777 16778 if ($('.active', self.$placeholder).length) { 16779 var val = $('.active', self.$placeholder).attr('data-url'); 16780 window.location.href = val; 16781 } 16782 16783 return this.hide(); 16784 }, 16785 16786 lookup: function () { 16787 var self = this; 16788 16789 self.query = self.$listenField.val(); 16790 if (self.query.length >= self.queryMinChars) { 16791 self.process(self.query); 16792 } else { 16793 self.hide(); 16794 } 16795 }, 16796 16797 process: function (query) { 16798 var ts = new Date().getTime(); 16799 var self = this; 16800 16801 query = query.replace(/<\/?[^>]+>/gi, ''); 16802 16803 var separator = (self.url.indexOf('?') > 0) ? '&' : '?'; 16804 var cat = ''; 16805 16806 if (self.$category.val() !== undefined) { 16807 cat = '&' + self.$category.attr('name') + '=' + self.$category.val(); 16808 } 16809 16810 $.ajax({ 16811 url: self.url + separator + 'q=' + encodeURIComponent(query) + cat, 16812 dataType: 'json', 16813 type: 'GET', 16814 beforeSend: function () { 16815 clearTimeout(self.processTimer); 16816 self.processTimer = setTimeout(function () { 16817 self.$loader.show(); 16818 }, 250); 16819 }, 16820 success: function (response) { 16821 clearTimeout(self.processTimer); 16822 self.$loader.hide(); 16823 16824 if (response.query.toLowerCase().trim() === self.$listenField.val().toLowerCase().trim()) { 16825 if (response.items.length) { 16826 self.show(response.items); 16827 } else { 16828 self.hide(); 16829 } 16830 } 16831 16832 if (Object.keys(response.profiler).length) { 16833 console.table(response.profiler); 16834 } 16835 16836 if(!uiSearchautocompleteHide && self.hideDelay > 0){ 16837 setTimeout(function () { 16838 //document.activeElement.blur(); 16839 }, self.hideDelay); 16840 } 16841 } 16842 }); 16843 }, 16844 16845 show: function (html) { 16846 var self = this; 16847 16848 if (html == -undefined) { 16849 if (self.result === '') { 16850 return; 16851 } 16852 } else { 16853 self.result = html; 16854 self.$placeholder.html(html); 16855 self.highlighter(self.$placeholder); 16856 } 16857 16858 self.$placeholder.show(); 16859 self.$el.addClass('active'); 16860 self.shown = true; 16861 16862 $('li', self.$placeholder).each(function (key, el) { 16863 var $el = $(el); 16864 $el.on('mouseover', self.mouseover); 16865 $el.on('mouseout', self.mouseout); 16866 // $el.on('click', self.click); 16867 }); 16868 16869 return this; 16870 }, 16871 16872 hide: function () { 16873 var self = this; 16874 16875 self.$placeholder.hide(); 16876 self.$el.removeClass('active'); 16877 self.shown = false;
16878 16879 return this; 16880 }, 16881 16882 highlighter: function (item) { 16883 var self = this; 16884 16885 $('.highlight', item).each(function (key, el) { 16886 var $el = $(el); 16887 var arQuery = self.$listenField.val().split(' '); 16888 var html = $el.text(); 16889 16890 arQuery.each(function (word) { 16891 if ($.trim(word)) { 16892 word = word.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&'); 16893 if ("strong".indexOf(word.toLowerCase()) == -1) { 16894 html = html.replace(new RegExp('(' + word + '(?![^<>]*>))', 'ig'), function ($1, match) { 16895 return '<strong>' + match + '</strong>'; 16896 }); 16897 } 16898 } 16899 }); 16900 16901 $el.html(html); 16902 }); 16903 } 16904 }); 16905 16906 $(function () { 16907 _.each($('.UI-SEARCHAUTOCOMPLETE'), function (el) { 16908 var autocomplete = new SearchAutocomplete(); 16909 autocomplete.init(el); 16910 }); 16911 }); 16912 16913}); 16914 16915/** 16916 * Astrio Co. 16917 * 16918 * NOTICE OF LICENSE 16919 * 16920 * This source file is subject to the Open Software License (OSL 3.0). 16921 * It is available through the world-wide-web at this URL: 16922 * http://opensource.org/licenses/osl-3.0.php 16923 * If you are unable to obtain it through the world-wide-web, please send 16924 * an email to [email protected] so we can send you a copy immediately. 16925 * 16926 * @category Astrio 16927 * @package Astrio_Custom 16928 * @copyright Copyright (c) 2010-2016 Astrio Co. (http://astrio.net) 16929 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 16930 */ 16931 16932(function() { 16933 16934 String.prototype.toQueryParams = function(separator) { 16935 16936 var match = this.strip().match(/([^?#]*)(#.*)?$/); 16937 if (!match || match[1] == this.toString()) return { }; 16938 16939 return match[1].split(separator || '&').inject({ }, function(hash, pair) { 16940 if ((pair = pair.split('='))[0]) { 16941 var key = decodeURIComponent(pair.shift()), 16942 value = pair.length > 1 ? pair.join('=') : pair[0]; 16943 16944 if (value != undefined) { 16945 value = value.gsub('+', ' '); 16946 value = decodeURIComponent(value); 16947 } 16948 16949 if (key in hash) { 16950 if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; 16951 hash[key].push(value); 16952 } 16953 else hash[key] = value; 16954 } 16955 return hash; 16956 }); 16957 }; 16958 16959})(); 16960 16961var jqAdvSlider = jqBackToTop = jqSmartCatalog = jQuery.noConflict(); 16962/** 16963 * Magento 16964 * 16965 * NOTICE OF LICENSE 16966 * 16967 * This source file is subject to the Academic Free License (AFL 3.0) 16968 * that is bundled with this package in the file LICENSE_AFL.txt. 16969 * It is also available through the world-wide-web at this URL: 16970 * http://opensource.org/licenses/afl-3.0.php 16971 * If you did not receive a copy of the license and are unable to 16972 * obtain it through the world-wide-web, please send an email 16973 * to [email protected] so we can send you a copy immediately. 16974 * 16975 * DISCLAIMER 16976 * 16977 * Do not edit or add to this file if you wish to upgrade Magento to newer 16978 * versions in the future. If you wish to customize Magento for your 16979 * needs please refer to http://www.magento.com for more information. 16980 * 16981 * @category Mage 16982 * @package js 16983 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 16984 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 16985 */ 16986var Captcha = Class.create(); 16987Captcha.prototype = { 16988 initialize: function(url, formId){ 16989 this.url = url; 16990 this.formId = formId; 16991 }, 16992 refresh: function(elem) { 16993 formId = this.formId; 16994 if (elem) Element.addClassName(elem, 'refreshing'); 16995 new Ajax.Request(this.url, { 16996 onSuccess: function (response) { 16997 if (response.responseText.isJSON()) { 16998 var json = response.responseText.evalJSON(); 16999 if (!json.error && json.imgSrc) { 17000 $(formId).writeAttribute('src', json.imgSrc); 17001 if (elem) Element.removeClassName(elem, 'refreshing'); 17002 } else { 17003 if (elem) Element.removeClassName(elem, 'refreshing'); 17004 } 17005 } 17006 }, 17007 method: 'post', 17008 parameters: { 17009 'formId' : this.formId 17010 } 17011 }); 17012 } 17013}; 17014 17015document.observe('billing-request:completed', function(event) { 17016 if (typeof window.checkout != 'undefined') { 17017 if (window.checkout.method == 'guest' && $('guest_checkout')){ 17018 $('guest_checkout').captcha.refresh(); 17019 } 17020 if (window.checkout.method == 'register' && $('register_during_checkout')){ 17021 $('register_during_checkout').captcha.refresh(); 17022 } 17023 } 17024}); 17025 17026 17027document.observe('login:setMethod', function(event) { 17028 var switchCaptchaElement = function(shown, hidden) { 17029 var inputPrefix = 'captcha-input-box-', imagePrefix = 'captcha-image-box-'; 17030 if ($(inputPrefix + hidden)) { 17031 $(inputPrefix + hidden).hide(); 17032 $(imagePrefix + hidden).hide(); 17033 } 17034 if ($(inputPrefix + shown)) { 17035 $(inputPrefix + shown).show(); 17036 $(imagePrefix + shown).show(); 17037 } 17038 }; 17039 17040 switch (event.memo.method) { 17041 case 'guest': 17042 switchCaptchaElement('guest_checkout', 'register_during_checkout'); 17043 break; 17044 case 'register': 17045 switchCaptchaElement('register_during_checkout', 'guest_checkout'); 17046 break; 17047 } 17048}); 17049 17050/** 17051 * Magento 17052 * 17053 * NOTICE OF LICENSE 17054 * 17055 * This source file is subject to the Academic Free License (AFL 3.0)
17056 * that is bundled with this package in the file LICENSE_AFL.txt. 17057 * It is also available through the world-wide-web at this URL: 17058 * http://opensource.org/licenses/afl-3.0.php 17059 * If you did not receive a copy of the license and are unable to 17060 * obtain it through the world-wide-web, please send an email 17061 * to [email protected] so we can send you a copy immediately. 17062 * 17063 * DISCLAIMER 17064 * 17065 * Do not edit or add to this file if you wish to upgrade Magento to newer 17066 * versions in the future. If you wish to customize Magento for your 17067 * needs please refer to http://www.magento.com for more information. 17068 * 17069 * @category design 17070 * @package base_default 17071 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 17072 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 17073 */ 17074if(typeof Product=='undefined') { 17075 var Product = {}; 17076} 17077/**************************** BUNDLE PRODUCT **************************/ 17078Product.Bundle = Class.create(); 17079Product.Bundle.prototype = { 17080 initialize: function(config){ 17081 this.config = config; 17082 17083 // Set preconfigured values for correct price base calculation 17084 if (config.defaultValues) { 17085 for (var option in config.defaultValues) { 17086 if (this.config['options'][option].isMulti) { 17087 var selected = new Array(); 17088 for (var i = 0; i < config.defaultValues[option].length; i++) { 17089 selected.push(config.defaultValues[option][i]); 17090 } 17091 this.config.selected[option] = selected; 17092 } else { 17093 this.config.selected[option] = new Array(config.defaultValues[option] + ""); 17094 } 17095 } 17096 } 17097 17098 this.reloadPrice(); 17099 }, 17100 changeSelection: function(selection){ 17101 var parts = selection.id.split('-'); 17102 if (this.config['options'][parts[2]].isMulti) { 17103 selected = new Array(); 17104 if (selection.tagName == 'SELECT') { 17105 for (var i = 0; i < selection.options.length; i++) { 17106 if (selection.options[i].selected && selection.options[i].value != '') { 17107 selected.push(selection.options[i].value); 17108 } 17109 } 17110 } else if (selection.tagName == 'INPUT') { 17111 selector = parts[0]+'-'+parts[1]+'-'+parts[2]; 17112 selections = $$('.'+selector); 17113 for (var i = 0; i < selections.length; i++) { 17114 if (selections[i].checked && selections[i].value != '') { 17115 selected.push(selections[i].value); 17116 } 17117 } 17118 } 17119 this.config.selected[parts[2]] = selected; 17120 } else { 17121 if (selection.value != '') { 17122 this.config.selected[parts[2]] = new Array(selection.value); 17123 } else { 17124 this.config.selected[parts[2]] = new Array(); 17125 } 17126 this.populateQty(parts[2], selection.value); 17127 var tierPriceElement = $('bundle-option-' + parts[2] + '-tier-prices'), 17128 tierPriceHtml = ''; 17129 if (selection.value != '' && this.config.options[parts[2]].selections[selection.value].customQty == 1) { 17130 tierPriceHtml = this.config.options[parts[2]].selections[selection.value].tierPriceHtml; 17131 } 17132 tierPriceElement.update(tierPriceHtml); 17133 } 17134 this.reloadPrice(); 17135 }, 17136 17137 reloadPrice: function() { 17138 var calculatedPrice = 0; 17139 var dispositionPrice = 0; 17140 var includeTaxPrice = 0; 17141 17142 for (var option in this.config.selected) { 17143 if (this.config.options[option]) { 17144 for (var i=0; i < this.config.selected[option].length; i++) { 17145 var prices = this.selectionPrice(option, this.config.selected[option][i]); 17146 calculatedPrice += Number(prices[0]); 17147 dispositionPrice += Number(prices[1]); 17148 includeTaxPrice += Number(prices[2]); 17149 } 17150 } 17151 } 17152 17153 //Tax is calculated in a different way for the the TOTAL BASED method 17154 //We round the taxes at the end. Hence we do the same for consistency 17155 //This variable is set in the bundle.phtml 17156 if (taxCalcMethod == CACL_TOTAL_BASE) { 17157 var calculatedPriceFormatted = calculatedPrice.toFixed(10); 17158 var includeTaxPriceFormatted = includeTaxPrice.toFixed(10); 17159 var tax = includeTaxPriceFormatted - calculatedPriceFormatted; 17160 calculatedPrice = includeTaxPrice - Math.round(tax * 100) / 100; 17161 } 17162
17163 //make sure that the prices are all rounded to two digits 17164 //this is needed when tax calculation is based on total for dynamic 17165 //price bundle product. For fixed price bundle product, the rounding 17166 //needs to be done after option price is added to base price 17167 if (this.config.priceType == '0') { 17168 calculatedPrice = Math.round(calculatedPrice*100)/100; 17169 dispositionPrice = Math.round(dispositionPrice*100)/100; 17170 includeTaxPrice = Math.round(includeTaxPrice*100)/100; 17171 17172 } 17173 17174 var event = $(document).fire('bundle:reload-price', { 17175 price: calculatedPrice, 17176 priceInclTax: includeTaxPrice, 17177 dispositionPrice: dispositionPrice, 17178 bundle: this 17179 }); 17180 if (!event.noReloadPrice) { 17181 optionsPrice.specialTaxPrice = 'true'; 17182 optionsPrice.changePrice('bundle', calculatedPrice); 17183 optionsPrice.changePrice('nontaxable', dispositionPrice); 17184 optionsPrice.changePrice('priceInclTax', includeTaxPrice); 17185 optionsPrice.reload(); 17186 } 17187 17188 return calculatedPrice; 17189 }, 17190 17191 selectionPrice: function(optionId, selectionId) { 17192 if (selectionId == '' || selectionId == 'none' || typeof(this.config.options[optionId].selections[selectionId]) == 'undefined') { 17193 return 0; 17194 } 17195 var qty = null; 17196 var tierPriceInclTax, tierPriceExclTax; 17197 if (this.config.options[optionId].selections[selectionId].customQty == 1 && !this.config['options'][optionId].isMulti) { 17198 if ($('bundle-option-' + optionId + '-qty-input')) { 17199 qty = $('bundle-option-' + optionId + '-qty-input').value; 17200 } else { 17201 qty = 1; 17202 } 17203 } else { 17204 qty = this.config.options[optionId].selections[selectionId].qty; 17205 } 17206 if (this.config.priceType == '0') { 17207 price = this.config.options[optionId].selections[selectionId].price; 17208 tierPrice = this.config.options[optionId].selections[selectionId].tierPrice; 17209 17210 for (var i=0; i < tierPrice.length; i++) { 17211 if (Number(tierPrice[i].price_qty) <= qty && Number(tierPrice[i].price) <= price) { 17212 price = tierPrice[i].price; 17213 tierPriceInclTax = tierPrice[i].priceInclTax; 17214 tierPriceExclTax = tierPrice[i].priceExclTax; 17215 } 17216 } 17217 } else { 17218 selection = this.config.options[optionId].selections[selectionId]; 17219 if (selection.priceType == '0') { 17220 price = selection.priceValue; 17221 } else { 17222 price = (this.config.basePrice*selection.priceValue)/100; 17223 } 17224 } 17225 //price += this.config.options[optionId].selections[selectionId].plusDisposition; 17226 //price -= this.config.options[optionId].selections[selectionId].minusDisposition; 17227 //return price*qty; 17228 var disposition = this.config.options[optionId].selections[selectionId].plusDisposition + 17229 this.config.options[optionId].selections[selectionId].minusDisposition; 17230 17231 if (this.config.specialPrice) { 17232 newPrice = (price*this.config.specialPrice)/100; 17233 price = Math.min(newPrice, price); 17234 } 17235 17236 selection = this.config.options[optionId].selections[selectionId]; 17237 if (tierPriceInclTax !== undefined && tierPriceExclTax !== undefined) { 17238 priceInclTax = tierPriceInclTax; 17239 price = tierPriceExclTax; 17240 } else if (selection.priceInclTax !== undefined) { 17241 priceInclTax = selection.priceInclTax; 17242 price = selection.priceExclTax !== undefined ? selection.priceExclTax : selection.price; 17243 } else { 17244 priceInclTax = price; 17245 } 17246 17247 if (this.config.priceType == '1' || taxCalcMethod == CACL_TOTAL_BASE) { 17248 var result = new Array(price*qty, disposition*qty, priceInclTax*qty); 17249 return result; 17250 } 17251 else if (taxCalcMethod == CACL_UNIT_BASE) { 17252 price = (Math.round(price*100)/100).toString(); 17253 disposition = (Math.round(disposition*100)/100).toString(); 17254 priceInclTax = (Math.round(priceInclTax*100)/100).toString(); 17255 var result = new Array(price*qty, disposition*qty, priceInclTax*qty); 17256 return result; 17257 } else { //taxCalcMethod == CACL_ROW_BASE) 17258 price = (Math.round(price*qty*100)/100).toString(); 17259 disposition = (Math.round(disposition*qty*100)/100).toString(); 17260 priceInclTax = (Math.round(priceInclTax*qty*100)/100).toString(); 17261 var result = new Array(price, disposition, priceInclTax); 17262 return result; 17263 } 17264 }, 17265 17266 populateQty: function(optionId, selectionId){ 17267 if (selectionId == '' || selectionId == 'none') { 17268 this.showQtyInput(optionId, '0', false); 17269 return; 17270 } 17271 if (this.config.options[optionId].selections[selectionId].customQty == 1) { 17272 this.showQtyInput(optionId, this.config.options[optionId].selections[selectionId].qty, true); 17273 } else { 17274 this.showQtyInput(optionId, this.config.options[optionId].selections[selectionId].qty, false); 17275 } 17276 }, 17277 17278 showQtyInput: function(optionId, value, canEdit) { 17279 elem = $('bundle-option-' + optionId + '-qty-input'); 17280 elem.value = value; 17281 elem.disabled = !canEdit; 17282 if (canEdit) { 17283 elem.removeClassName('qty-disabled'); 17284 } else { 17285 elem.addClassName('qty-disabled'); 17286 } 17287 }, 17288 17289 changeOptionQty: function (element, event) { 17290 var checkQty = true; 17291 if (typeof(event) != 'undefined') { 17292 if (event.keyCode == 8 || event.keyCode == 46) { 17293 checkQty = false;
17294 } 17295 } 17296 if (checkQty && (Number(element.value) == 0 || isNaN(Number(element.value)))) { 17297 element.value = 1; 17298 } 17299 parts = element.id.split('-'); 17300 optionId = parts[2]; 17301 if (!this.config['options'][optionId].isMulti) { 17302 selectionId = this.config.selected[optionId][0]; 17303 this.config.options[optionId].selections[selectionId].qty = element.value*1; 17304 this.reloadPrice(); 17305 } 17306 }, 17307 17308 validationCallback: function (elmId, result){ 17309 if (elmId == undefined || $(elmId) == undefined) { 17310 return; 17311 } 17312 var container = $(elmId).up('ul.options-list'); 17313 if (typeof container != 'undefined') { 17314 if (result == 'failed') { 17315 container.removeClassName('validation-passed'); 17316 container.addClassName('validation-failed'); 17317 } else { 17318 container.removeClassName('validation-failed'); 17319 container.addClassName('validation-passed'); 17320 } 17321 } 17322 } 17323}; 17324 17325let YandexGoalsBind={bindButtons:()=>{jQuery(".btn-cart").on("click",()=>{yaCounter50843519.reachGoal("product-add-to-cart-button")}),jQuery(".btn-remove").on("click",()=>{yaCounter50843519.reachGoal("product-remove-from-cart-button")})},bindPages:()=>{jQuery(document).on("checkout-page-loaded",()=>{yaCounter50843519.reachGoal("checkout-page-loaded")}),jQuery(document).on("order-placed",()=>{yaCounter50843519.reachGoal("order-placed")})}};document.addEventListener("yacounter50843519inited",()=>{YandexGoalsBind.bindButtons(),YandexGoalsBind.bindPages(),jQuery(document).on("checkout-items-refreshed",()=>{YandexGoalsBind.bindButtons()})});
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.