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){
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 Varien 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
11742/** 11743 * @classDescription simple Navigation with replacing old handlers 11744 * @param {String} id id of ul element with navigation lists 11745 * @param {Object} settings object with settings 11746 */ 11747var mainNav = function() { 11748 11749 var main = { 11750 obj_nav : $(arguments[0]) || $("nav"), 11751 11752 settings : { 11753 show_delay : 0, 11754 hide_delay : 0, 11755 _ie6 : /MSIE 6.+Win/.test(navigator.userAgent), 11756 _ie7 : /MSIE 7.+Win/.test(navigator.userAgent) 11757 }, 11758 11759 init : function(obj, level) { 11760 obj.lists = obj.childElements(); 11761 obj.lists.each(function(el,ind){ 11762 main.handlNavElement(el); 11763 if((main.settings._ie6 || main.settings._ie7) && level){ 11764 main.ieFixZIndex(el, ind, obj.lists.size()); 11765 } 11766 }); 11767 if(main.settings._ie6 && !level){ 11768 document.execCommand("BackgroundImageCache", false, true); 11769 } 11770 }, 11771 11772 handlNavElement : function(list) { 11773 if(list !== undefined){ 11774 list.onmouseover = function(){ 11775 main.fireNavEvent(this,true); 11776 }; 11777 list.onmouseout = function(){ 11778 main.fireNavEvent(this,false); 11779 }; 11780 if(list.down("ul")){ 11781 main.init(list.down("ul"), true); 11782 } 11783 } 11784 }, 11785 11786 ieFixZIndex : function(el, i, l) { 11787 if(el.tagName.toString().toLowerCase().indexOf("iframe") == -1){ 11788 el.style.zIndex = l - i; 11789 } else { 11790 el.onmouseover = "null"; 11791 el.onmouseout = "null"; 11792 } 11793 }, 11794 11795 fireNavEvent : function(elm,ev) { 11796 if(ev){ 11797 elm.addClassName("over"); 11798 elm.down("a").addClassName("over"); 11799 if (elm.childElements()[1]) { 11800 main.show(elm.childElements()[1]); 11801 } 11802 } else { 11803 elm.removeClassName("over"); 11804 elm.down("a").removeClassName("over"); 11805 if (elm.childElements()[1]) { 11806 main.hide(elm.childElements()[1]); 11807 } 11808 } 11809 }, 11810 11811 show : function (sub_elm) { 11812 if (sub_elm.hide_time_id) { 11813 clearTimeout(sub_elm.hide_time_id); 11814 } 11815 sub_elm.show_time_id = setTimeout(function() { 11816 if (!sub_elm.hasClassName("shown-sub")) { 11817 sub_elm.addClassName("shown-sub"); 11818 } 11819 }, main.settings.show_delay); 11820 }, 11821 11822 hide : function (sub_elm) { 11823 if (sub_elm.show_time_id) { 11824 clearTimeout(sub_elm.show_time_id); 11825 } 11826 sub_elm.hide_time_id = setTimeout(function(){ 11827 if (sub_elm.hasClassName("shown-sub")) { 11828 sub_elm.removeClassName("shown-sub"); 11829 } 11830 }, main.settings.hide_delay); 11831 } 11832 11833 }; 11834 if (arguments[1]) { 11835 main.settings = Object.extend(main.settings, arguments[1]); 11836 } 11837 if (main.obj_nav) { 11838 main.init(main.obj_nav, false); 11839 } 11840}; 11841 11842document.observe("dom:loaded", function() { 11843 //run navigation without delays and with default id="#nav" 11844 //mainNav(); 11845 11846 //run navigation with delays 11847 mainNav("nav", {"show_delay":"100","hide_delay":"100"}); 11848}); 11849 11850/** 11851 * Magento 11852 * 11853 * NOTICE OF LICENSE 11854 * 11855 * This source file is subject to the Academic Free License (AFL 3.0) 11856 * that is bundled with this package in the file LICENSE_AFL.txt. 11857 * It is also available through the world-wide-web at this URL: 11858 * http://opensource.org/licenses/afl-3.0.php 11859 * If you did not receive a copy of the license and are unable to 11860 * obtain it through the world-wide-web, please send an email 11861 * to [email protected] so we can send you a copy immediately. 11862 * 11863 * DISCLAIMER 11864 * 11865 * Do not edit or add to this file if you wish to upgrade Magento to newer 11866 * versions in the future. If you wish to customize Magento for your 11867 * needs please refer to http://www.magento.com for more information. 11868 * 11869 * @category Mage 11870 * @package js 11871 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 11872 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11873 */ 11874 11875var Translate = Class.create(); 11876Translate.prototype = { 11877 initialize: function(data){ 11878 this.data = $H(data); 11879 }, 11880 11881 translate : function(){ 11882 var args = arguments; 11883 var text = arguments[0]; 11884 11885 if(this.data.get(text)){ 11886 return this.data.get(text); 11887 } 11888 return text; 11889 }, 11890 add : function() { 11891 if (arguments.length > 1) { 11892 this.data.set(arguments[0], arguments[1]); 11893 } else if (typeof arguments[0] =='object') { 11894 $H(arguments[0]).each(function (pair){ 11895 this.data.set(pair.key, pair.value); 11896 }.bind(this)); 11897 } 11898 } 11899}; 11900 11901/** 11902 * Magento 11903 * 11904 * NOTICE OF LICENSE 11905 * 11906 * This source file is subject to the Academic Free License (AFL 3.0)
11907 * that is bundled with this package in the file LICENSE_AFL.txt. 11908 * It is also available through the world-wide-web at this URL: 11909 * http://opensource.org/licenses/afl-3.0.php 11910 * If you did not receive a copy of the license and are unable to 11911 * obtain it through the world-wide-web, please send an email 11912 * to [email protected] so we can send you a copy immediately. 11913 * 11914 * DISCLAIMER 11915 * 11916 * Do not edit or add to this file if you wish to upgrade Magento to newer 11917 * versions in the future. If you wish to customize Magento for your 11918 * needs please refer to http://www.magento.com for more information. 11919 * 11920 * @category Mage 11921 * @package js 11922 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 11923 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11924 */ 11925// old school cookie functions grabbed off the web 11926 11927if (!window.Mage) var Mage = {}; 11928 11929Mage.Cookies = {}; 11930Mage.Cookies.expires = null; 11931Mage.Cookies.path = '/'; 11932Mage.Cookies.domain = null; 11933Mage.Cookies.secure = false; 11934Mage.Cookies.set = function(name, value){ 11935 var argv = arguments; 11936 var argc = arguments.length; 11937 var expires = (argc > 2) ? argv[2] : Mage.Cookies.expires; 11938 var path = (argc > 3) ? argv[3] : Mage.Cookies.path; 11939 var domain = (argc > 4) ? argv[4] : Mage.Cookies.domain; 11940 var secure = (argc > 5) ? argv[5] : Mage.Cookies.secure; 11941 document.cookie = name + "=" + escape (value) + 11942 ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 11943 ((path == null) ? "" : ("; path=" + path)) + 11944 ((domain == null) ? "" : ("; domain=" + domain)) + 11945 ((secure == true) ? "; secure" : ""); 11946}; 11947 11948Mage.Cookies.get = function(name){ 11949 var arg = name + "="; 11950 var alen = arg.length; 11951 var clen = document.cookie.length; 11952 var i = 0; 11953 var j = 0; 11954 while(i < clen){ 11955 j = i + alen; 11956 if (document.cookie.substring(i, j) == arg) 11957 return Mage.Cookies.getCookieVal(j); 11958 i = document.cookie.indexOf(" ", i) + 1; 11959 if(i == 0) 11960 break; 11961 } 11962 return null; 11963}; 11964 11965Mage.Cookies.clear = function(name) { 11966 if(Mage.Cookies.get(name)){ 11967 document.cookie = name + "=" + 11968 "; expires=Thu, 01-Jan-70 00:00:01 GMT"; 11969 } 11970}; 11971 11972Mage.Cookies.getCookieVal = function(offset){ 11973 var endstr = document.cookie.indexOf(";", offset); 11974 if(endstr == -1){ 11975 endstr = document.cookie.length; 11976 } 11977 return unescape(document.cookie.substring(offset, endstr)); 11978}; 11979 11980/** 11981 * Magento 11982 * 11983 * NOTICE OF LICENSE 11984 * 11985 * This source file is subject to the Academic Free License (AFL 3.0) 11986 * that is bundled with this package in the file LICENSE_AFL.txt. 11987 * It is also available through the world-wide-web at this URL: 11988 * http://opensource.org/licenses/afl-3.0.php 11989 * If you did not receive a copy of the license and are unable to 11990 * obtain it through the world-wide-web, please send an email 11991 * to [email protected] so we can send you a copy immediately. 11992 * 11993 * DISCLAIMER 11994 * 11995 * Do not edit or add to this file if you wish to upgrade Magento to newer 11996 * versions in the future. If you wish to customize Magento for your 11997 * needs please refer to http://www.magento.com for more information. 11998 * 11999 * @category Varien 12000 * @package js 12001 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 12002 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 12003 */ 12004if(typeof Product=='undefined') { 12005 var Product = {}; 12006} 12007 12008/********************* IMAGE ZOOMER ***********************/ 12009 12010Product.Zoom = Class.create(); 12011/** 12012 * Image zoom control 12013 * 12014 * @author Magento Core Team <[email protected]> 12015 */ 12016Product.Zoom.prototype = { 12017 initialize: function(imageEl, trackEl, handleEl, zoomInEl, zoomOutEl, hintEl){ 12018 this.containerEl = $(imageEl).parentNode; 12019 this.imageEl = $(imageEl); 12020 this.handleEl = $(handleEl); 12021 this.trackEl = $(trackEl); 12022 this.hintEl = $(hintEl); 12023 12024 this.containerDim = Element.getDimensions(this.containerEl); 12025 this.imageDim = Element.getDimensions(this.imageEl); 12026 12027 this.imageDim.ratio = this.imageDim.width/this.imageDim.height; 12028 12029 this.floorZoom = 1; 12030 12031 if (this.imageDim.width > this.imageDim.height) { 12032 this.ceilingZoom = this.imageDim.width / this.containerDim.width; 12033 } else { 12034 this.ceilingZoom = this.imageDim.height / this.containerDim.height; 12035 } 12036 12037 if (this.imageDim.width <= this.containerDim.width 12038 && this.imageDim.height <= this.containerDim.height) { 12039 this.trackEl.up().hide(); 12040 this.hintEl.hide(); 12041 this.containerEl.removeClassName('product-image-zoom'); 12042 return; 12043 } 12044 12045 this.imageX = 0; 12046 this.imageY = 0; 12047 this.imageZoom = 1; 12048 12049 this.sliderSpeed = 0; 12050 this.sliderAccel = 0; 12051 this.zoomBtnPressed = false;
12052 12053 this.showFull = false; 12054 12055 this.selects = document.getElementsByTagName('select'); 12056 12057 this.draggable = new Draggable(imageEl, { 12058 starteffect:false, 12059 reverteffect:false, 12060 endeffect:false, 12061 snap:this.contain.bind(this) 12062 }); 12063 12064 this.slider = new Control.Slider(handleEl, trackEl, { 12065 axis:'horizontal', 12066 minimum:0, 12067 maximum:Element.getDimensions(this.trackEl).width, 12068 alignX:0, 12069 increment:1, 12070 sliderValue:0, 12071 onSlide:this.scale.bind(this), 12072 onChange:this.scale.bind(this) 12073 }); 12074 12075 this.scale(0); 12076 12077 Event.observe(this.imageEl, 'dblclick', this.toggleFull.bind(this)); 12078 12079 Event.observe($(zoomInEl), 'mousedown', this.startZoomIn.bind(this)); 12080 Event.observe($(zoomInEl), 'mouseup', this.stopZooming.bind(this)); 12081 Event.observe($(zoomInEl), 'mouseout', this.stopZooming.bind(this)); 12082 12083 Event.observe($(zoomOutEl), 'mousedown', this.startZoomOut.bind(this)); 12084 Event.observe($(zoomOutEl), 'mouseup', this.stopZooming.bind(this)); 12085 Event.observe($(zoomOutEl), 'mouseout', this.stopZooming.bind(this)); 12086 }, 12087 12088 toggleFull: function () { 12089 this.showFull = !this.showFull; 12090 12091 //Hide selects for IE6 only 12092 if (typeof document.body.style.maxHeight == "undefined") { 12093 for (i=0; i<this.selects.length; i++) { 12094 this.selects[i].style.visibility = this.showFull ? 'hidden' : 'visible'; 12095 } 12096 } 12097 val_scale = !this.showFull ? this.slider.value : 1; 12098 this.scale(val_scale); 12099 12100 this.trackEl.style.visibility = this.showFull ? 'hidden' : 'visible'; 12101 this.containerEl.style.overflow = this.showFull ? 'visible' : 'hidden'; 12102 this.containerEl.style.zIndex = this.showFull ? '1000' : '9'; 12103 12104 return this; 12105 }, 12106 12107 scale: function (v) { 12108 var centerX = (this.containerDim.width*(1-this.imageZoom)/2-this.imageX)/this.imageZoom; 12109 var centerY = (this.containerDim.height*(1-this.imageZoom)/2-this.imageY)/this.imageZoom; 12110 var overSize = (this.imageDim.width > this.containerDim.width || this.imageDim.height > this.containerDim.height); 12111 12112 this.imageZoom = this.floorZoom+(v*(this.ceilingZoom-this.floorZoom)); 12113 12114 if (overSize) { 12115 if (this.imageDim.width > this.imageDim.height) { 12116 this.imageEl.style.width = (this.imageZoom*this.containerDim.width)+'px'; 12117 } else { 12118 this.imageEl.style.height = (this.imageZoom*this.containerDim.height)+'px'; 12119 } 12120 if (this.containerDim.ratio) { 12121 if (this.imageDim.width > this.imageDim.height) { 12122 this.imageEl.style.height = (this.imageZoom*this.containerDim.width*this.containerDim.ratio)+'px'; // for safari 12123 } else { 12124 this.imageEl.style.width = (this.imageZoom*this.containerDim.height*this.containerDim.ratio)+'px'; // for safari 12125 } 12126 } 12127 } else { 12128 this.slider.setDisabled(); 12129 } 12130 12131 this.imageX = this.containerDim.width*(1-this.imageZoom)/2-centerX*this.imageZoom; 12132 this.imageY = this.containerDim.height*(1-this.imageZoom)/2-centerY*this.imageZoom; 12133 12134 this.contain(this.imageX, this.imageY, this.draggable); 12135 12136 return true; 12137 }, 12138 12139 startZoomIn: function() 12140 { 12141 if (!this.slider.disabled) { 12142 this.zoomBtnPressed = true; 12143 this.sliderAccel = .002; 12144 this.periodicalZoom(); 12145 this.zoomer = new PeriodicalExecuter(this.periodicalZoom.bind(this), .05); 12146 } 12147 return this; 12148 }, 12149 12150 startZoomOut: function() 12151 { 12152 if (!this.slider.disabled) { 12153 this.zoomBtnPressed = true; 12154 this.sliderAccel = -.002; 12155 this.periodicalZoom(); 12156 this.zoomer = new PeriodicalExecuter(this.periodicalZoom.bind(this), .05); 12157 } 12158 return this; 12159 }, 12160 12161 stopZooming: function() 12162 { 12163 if (!this.zoomer || this.sliderSpeed==0) { 12164 return; 12165 } 12166 this.zoomBtnPressed = false;
12167 this.sliderAccel = 0; 12168 }, 12169 12170 periodicalZoom: function() 12171 { 12172 if (!this.zoomer) { 12173 return this; 12174 } 12175 12176 if (this.zoomBtnPressed) { 12177 this.sliderSpeed += this.sliderAccel; 12178 } else { 12179 this.sliderSpeed /= 1.5; 12180 if (Math.abs(this.sliderSpeed)<.001) { 12181 this.sliderSpeed = 0; 12182 this.zoomer.stop(); 12183 this.zoomer = null; 12184 } 12185 } 12186 this.slider.value += this.sliderSpeed; 12187 12188 this.slider.setValue(this.slider.value); 12189 this.scale(this.slider.value); 12190 12191 return this; 12192 }, 12193 12194 contain: function (x,y,draggable) { 12195 12196 var dim = Element.getDimensions(draggable.element); 12197 12198 var xMin = 0, xMax = this.containerDim.width-dim.width; 12199 var yMin = 0, yMax = this.containerDim.height-dim.height; 12200 12201 x = x>xMin ? xMin : x; 12202 x = x<xMax ? xMax : x; 12203 y = y>yMin ? yMin : y; 12204 y = y<yMax ? yMax : y; 12205 12206 if (this.containerDim.width > dim.width) { 12207 x = (this.containerDim.width/2) - (dim.width/2); 12208 } 12209 12210 if (this.containerDim.height > dim.height) { 12211 y = (this.containerDim.height/2) - (dim.height/2); 12212 } 12213 12214 this.imageX = x; 12215 this.imageY = y; 12216 12217 this.imageEl.style.left = this.imageX+'px'; 12218 this.imageEl.style.top = this.imageY+'px'; 12219 12220 return [x,y]; 12221 } 12222}; 12223 12224/**************************** CONFIGURABLE PRODUCT **************************/ 12225Product.Config = Class.create(); 12226Product.Config.prototype = { 12227 initialize: function(config){ 12228 this.config = config; 12229 this.taxConfig = this.config.taxConfig; 12230 this.settings = $$('.super-attribute-select'); 12231 this.state = new Hash(); 12232 this.priceTemplate = new Template(this.config.template); 12233 this.prices = config.prices; 12234 12235 this.settings.each(function(element){ 12236 Event.observe(element, 'change', this.configure.bind(this)); 12237 }.bind(this)); 12238 12239 // fill state 12240 this.settings.each(function(element){ 12241 var attributeId = element.id.replace(/[a-z]*/, ''); 12242 if(attributeId && this.config.attributes[attributeId]) { 12243 element.config = this.config.attributes[attributeId]; 12244 element.attributeId = attributeId; 12245 this.state[attributeId] = false; 12246 } 12247 }.bind(this)); 12248 12249 // Init settings dropdown 12250 var childSettings = []; 12251 for(var i=this.settings.length-1;i>=0;i--){ 12252 var prevSetting = this.settings[i-1] ? this.settings[i-1] : false; 12253 var nextSetting = this.settings[i+1] ? this.settings[i+1] : false; 12254 if(i==0){ 12255 this.fillSelect(this.settings[i]); 12256 } 12257 else { 12258 this.settings[i].disabled=true; 12259 } 12260 $(this.settings[i]).childSettings = childSettings.clone(); 12261 $(this.settings[i]).prevSetting = prevSetting; 12262 $(this.settings[i]).nextSetting = nextSetting; 12263 childSettings.push(this.settings[i]); 12264 } 12265 12266 // Set default values - from config and overwrite them by url values 12267 if (config.defaultValues) { 12268 this.values = config.defaultValues; 12269 } 12270 12271 var separatorIndex = window.location.href.indexOf('#'); 12272 if (separatorIndex != -1) { 12273 var paramsStr = window.location.href.substr(separatorIndex+1); 12274 var urlValues = paramsStr.toQueryParams(); 12275 if (!this.values) { 12276 this.values = {}; 12277 } 12278 for (var i in urlValues) { 12279 this.values[i] = urlValues[i]; 12280 } 12281 } 12282 12283 this.configureForValues(); 12284 document.observe("dom:loaded", this.configureForValues.bind(this)); 12285 }, 12286 12287 configureForValues: function () { 12288 if (this.values) { 12289 this.settings.each(function(element){ 12290 var attributeId = element.attributeId; 12291 element.value = (typeof(this.values[attributeId]) == 'undefined')? '' : this.values[attributeId]; 12292 this.configureElement(element); 12293 }.bind(this)); 12294 } 12295 }, 12296 12297 configure: function(event){ 12298 var element = Event.element(event); 12299 this.configureElement(element); 12300 }, 12301 12302 configureElement : function(element) { 12303 this.reloadOptionLabels(element); 12304 if(element.value){ 12305 this.state[element.config.id] = element.value; 12306 if(element.nextSetting){ 12307 element.nextSetting.disabled = false;
12308 this.fillSelect(element.nextSetting); 12309 this.resetChildren(element.nextSetting); 12310 } 12311 } 12312 else { 12313 this.resetChildren(element); 12314 } 12315 this.reloadPrice(); 12316// Calculator.updatePrice(); 12317 }, 12318 12319 reloadOptionLabels: function(element){ 12320 var selectedPrice; 12321 if(element.options[element.selectedIndex].config){ 12322 selectedPrice = parseFloat(element.options[element.selectedIndex].config.price); 12323 } 12324 else{ 12325 selectedPrice = 0; 12326 } 12327 for(var i=0;i<element.options.length;i++){ 12328 if(element.options[i].config){ 12329 element.options[i].text = this.getOptionLabel(element.options[i].config, element.options[i].config.price-selectedPrice); 12330 } 12331 } 12332 }, 12333 12334 resetChildren : function(element){ 12335 if(element.childSettings) { 12336 for(var i=0;i<element.childSettings.length;i++){ 12337 element.childSettings[i].selectedIndex = 0; 12338 element.childSettings[i].disabled = true; 12339 if(element.config){ 12340 this.state[element.config.id] = false; 12341 } 12342 } 12343 } 12344 }, 12345 12346 fillSelect: function(element){ 12347 var attributeId = element.id.replace(/[a-z]*/, ''); 12348 var options = this.getAttributeOptions(attributeId); 12349 this.clearSelect(element); 12350 element.options[0] = new Option('', ''); 12351 element.options[0].innerHTML = this.config.chooseText; 12352 12353 var prevConfig = false; 12354 if(element.prevSetting){ 12355 prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex]; 12356 } 12357 12358 if(options) { 12359 var index = 1; 12360 for(var i=0;i<options.length;i++){ 12361 var allowedProducts = []; 12362 if(prevConfig) { 12363 for(var j=0;j<options[i].products.length;j++){ 12364 if(prevConfig.config.allowedProducts 12365 && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){ 12366 allowedProducts.push(options[i].products[j]); 12367 } 12368 } 12369 } else { 12370 allowedProducts = options[i].products.clone(); 12371 } 12372 12373 if(allowedProducts.size()>0){ 12374 options[i].allowedProducts = allowedProducts; 12375 element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id); 12376 element.options[index].config = options[i]; 12377 index++; 12378 } 12379 } 12380 } 12381 }, 12382 12383 getOptionLabel: function(option, price){ 12384 var price = parseFloat(price); 12385 if (this.taxConfig.includeTax) { 12386 var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax; 12387 var excl = price - tax; 12388 var incl = excl*(1+(this.taxConfig.currentTax/100)); 12389 } else { 12390 var tax = price * (this.taxConfig.currentTax / 100); 12391 var excl = price; 12392 var incl = excl + tax; 12393 } 12394 12395 if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) { 12396 price = incl; 12397 } else { 12398 price = excl; 12399 } 12400 12401 var str = option.label; 12402 if(price){ 12403 if (this.taxConfig.showBothPrices) { 12404 str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')'; 12405 } else { 12406 str+= ' ' + this.formatPrice(price, true); 12407 } 12408 } 12409 return str; 12410 }, 12411 12412 formatPrice: function(price, showSign){ 12413 var str = ''; 12414 price = parseFloat(price); 12415 if(showSign){ 12416 if(price<0){ 12417 str+= '-'; 12418 price = -price; 12419 } 12420 else{ 12421 str+= '+'; 12422 } 12423 } 12424 12425 var roundedPrice = (Math.round(price*100)/100).toString(); 12426 12427 if (this.prices && this.prices[roundedPrice]) { 12428 str+= this.prices[roundedPrice]; 12429 } 12430 else { 12431 str+= this.priceTemplate.evaluate({price:price.toFixed(2)}); 12432 } 12433 return str; 12434 }, 12435 12436 clearSelect: function(element){ 12437 for(var i=element.options.length-1;i>=0;i--){ 12438 element.remove(i); 12439 } 12440 }, 12441 12442 getAttributeOptions: function(attributeId){ 12443 if(this.config.attributes[attributeId]){ 12444 return this.config.attributes[attributeId].options; 12445 } 12446 }, 12447 12448 reloadPrice: function(){ 12449 var price = 0; 12450 var oldPrice = 0; 12451 for(var i=this.settings.length-1;i>=0;i--){ 12452 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 12453 if(selected.config){ 12454 price += parseFloat(selected.config.price); 12455 oldPrice += parseFloat(selected.config.oldPrice); 12456 } 12457 } 12458 12459 optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice}); 12460 optionsPrice.reload(); 12461 12462 return price; 12463 12464 if($('product-price-'+this.config.productId)){ 12465 $('product-price-'+this.config.productId).innerHTML = price; 12466 } 12467 this.reloadOldPrice(); 12468 }, 12469 12470 reloadOldPrice: function(){ 12471 if ($('old-price-'+this.config.productId)) { 12472 12473 var price = parseFloat(this.config.oldPrice); 12474 for(var i=this.settings.length-1;i>=0;i--){ 12475 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 12476 if(selected.config){ 12477 var parsedOldPrice = parseFloat(selected.config.oldPrice); 12478 price += isNaN(parsedOldPrice) ? 0 : parsedOldPrice; 12479 } 12480 } 12481 if (price < 0) 12482 price = 0; 12483 price = this.formatPrice(price); 12484 12485 if($('old-price-'+this.config.productId)){ 12486 $('old-price-'+this.config.productId).innerHTML = price; 12487 } 12488 12489 } 12490 } 12491}; 12492 12493 12494/**************************** SUPER PRODUCTS ********************************/ 12495 12496Product.Super = {}; 12497Product.Super.Configurable = Class.create(); 12498 12499Product.Super.Configurable.prototype = { 12500 initialize: function(container, observeCss, updateUrl, updatePriceUrl, priceContainerId) { 12501 this.container = $(container); 12502 this.observeCss = observeCss; 12503 this.updateUrl = updateUrl; 12504 this.updatePriceUrl = updatePriceUrl; 12505 this.priceContainerId = priceContainerId; 12506 this.registerObservers(); 12507 }, 12508 registerObservers: function() { 12509 var elements = this.container.getElementsByClassName(this.observeCss); 12510 elements.each(function(element){ 12511 Event.observe(element, 'change', this.update.bindAsEventListener(this)); 12512 }.bind(this)); 12513 return this; 12514 }, 12515 update: function(event) { 12516 var elements = this.container.getElementsByClassName(this.observeCss); 12517 var parameters = Form.serializeElements(elements, true); 12518 12519 new Ajax.Updater(this.container, this.updateUrl + '?ajax=1', { 12520 parameters:parameters, 12521 onComplete:this.registerObservers.bind(this) 12522 }); 12523 var priceContainer = $(this.priceContainerId); 12524 if(priceContainer) { 12525 new Ajax.Updater(priceContainer, this.updatePriceUrl + '?ajax=1', { 12526 parameters:parameters 12527 }); 12528 } 12529 } 12530}; 12531 12532/** 12533* @author Amasty Team 12534* @copyright Copyright (c) 2008-2013 Amasty (http://www.amasty.com) 12535* @package Amasty_Xsearch 12536*/ 12537 12538var Xsearch = Class.create({ 12539 timer: null, 12540 delay: 500, 12541 options: {}, 12542 currentItem: null, 12543 searchInput: null, 12544 clear: function(){ 12545 if ($$('[id=am_search_container]').length > 0) 12546 $$('[id=am_search_container]').each(function(el){ 12547 el.remove(); 12548 }) 12549 }, 12550 initialize: function(options) { 12551 this.options = options; 12552 12553 if (this.options.delay !== undefined){ 12554 this.delay = this.options.delay; 12555 } 12556 12557 if ($$('input#search').length > 0){ 12558 var _caller = this; 12559 var searchInput = $$('input#search')[0]; 12560 12561 this.searchInput = searchInput; 12562 12563 if (!searchInput.getAttribute("placeholder")){ 12564 searchInput.observe('click', function(){ 12565 if (!searchInput.getAttribute('firstClick')){ 12566 searchInput.value = ''; 12567 searchInput.setAttribute('firstClick', 1) 12568 } 12569 }); 12570 } 12571 12572 searchInput.observe('keyup', function(event){ 12573 if ([37, 38, 39, 40, 9, 13].indexOf(event.keyCode) !== -1) // arrow keys, tab, enter 12574 return; 12575 12576 if (this.value.length >= _caller.options.minChars){ 12577 var q = this.value; 12578 12579 if (_caller.timer != null){ 12580 clearTimeout(_caller.timer); 12581 } 12582 12583 _caller.timer = setTimeout(function(){ 12584 _caller.search.call(_caller, q); 12585 }, _caller.delay) 12586 } 12587 12588 }); 12589 searchInput.observe('keydown', function(event){ 12590 if ($('am_search_popup')) 12591 { 12592 if ([38, 40, 9].indexOf(event.keyCode) !== -1) 12593 { 12594 if (this.currentItem == null) 12595 { 12596 this.currentItem = 0; 12597 } 12598 else 12599 { 12600 var totalItems = $$('#am_search_popup .am_element').length; 12601 12602 switch (event.keyCode) 12603 { 12604 case 38: 12605 this.currentItem = (this.currentItem + totalItems - 1) % totalItems; 12606 break; 12607 case 40: 12608 case 9: 12609 this.currentItem = (this.currentItem + 1) % totalItems; 12610 break; 12611 } 12612 } 12613 12614 $$('#am_search_popup .am_element').each(function(element, i){ 12615 if (i == this.currentItem) 12616 element.addClassName('active'); 12617 else 12618 element.removeClassName('active'); 12619 }.bind(this)); 12620 event.stop(); 12621 } 12622 else if (event.keyCode == 13) 12623 { 12624 if (typeof this.currentItem == 'number') 12625 { 12626 var location = $('am_search_popup').down('a', this.currentItem).readAttribute('href'); 12627 window.location.href = location; 12628 12629 event.stop(); 12630 } 12631 } 12632 } 12633 }.bind(this)); 12634// $$('input#search')[0].observe('blur', function(){ 12635// clear(); 12636// }) 12637 } 12638 12639 document.observe('click', function(){ 12640 _caller.clear(); 12641 }); 12642 }, 12643 loading: function(b){ 12644 if (b) 12645 $('search').addClassName('loading') 12646 else 12647 $('search').removeClassName('loading') 12648 }, 12649 search: function(q){ 12650 12651 12652 var _caller = this; 12653 _caller.loading(true); 12654 new Ajax.Request(_caller.options.url, { 12655 method:'get', 12656 requestHeaders: {Accept: 'application/json'}, 12657 parameters: {q: q}, 12658 onSuccess: function(response) { 12659 _caller.clear(); 12660 12661 var json = response.responseText.evalJSON(true) 12662 12663 _caller.loading(false); 12664 12665 if (json.items.length > 0){ 12666 12667 _caller.showPopup(json, q); 12668 } 12669 12670// debugger; 12671 } 12672 }); 12673 12674 }, 12675 hightlight: function(data, text){ 12676 12677 12678 var words = text.trim().split(' '); 12679 12680 var reg = new RegExp('(' +words.join('|') + ')', "ig") 12681 if (data) 12682 data = data.replace(reg, "<span class=amhighlight>$1</span>") 12683 12684 return data; 12685 12686 }, 12687 showPopup: function(data, text){ 12688 this.currentItem = null; 12689 var container = new Element('div'); 12690 12691 container.id = 'am_search_container'; 12692 12693 var mainContainer = new Element('div'); 12694 mainContainer.id = 'am_search_popup'; 12695 mainContainer.addClassName('am_search_popup') 12696 12697// mainContainer.setStyle({ 12698// 'width': this.options.popupWidth + 'px' 12699// }); 12700 12701 var innerContainer = new Element('div'); 12702 12703 innerContainer.addClassName('am_search_popup_inner') 12704 12705 var triangleContainer = new Element('div'); 12706 triangleContainer.addClassName('am_search_popup_triangle') 12707 12708 for (var order in data.items){ 12709 12710 var item = data.items[order]; 12711 if (typeof(item) == 'object'){ 12712 var element = new Element('div'); 12713 12714 element.addClassName('am_element'); 12715 12716 var elementWrapper = new Element('div'); 12717 12718 var link = new Element('a'); 12719 12720 link.setAttribute('href', item.url); 12721 12722 12723 var containerImage = new Element('div'); 12724 containerImage.addClassName('am_image') 12725 12726 var image = new Element('img'); 12727 image.setAttribute('src', item.image) 12728 12729 containerImage.appendChild(image); 12730 12731 element.appendChild(elementWrapper) 12732 elementWrapper.appendChild(containerImage); 12733 12734 12735 var rightColumn = ['<div class=am_right>'] 12736 rightColumn.push('<div class=am_title>', this.hightlight(item.name, text), '</div>'); 12737 if (item.reviews != ''){ 12738 rightColumn.push('<div class=amreviews>', item.reviews, '</div>'); 12739 } 12740 rightColumn.push(this.hightlight(item.description, text));
12741 rightColumn.push('<table class=price_footer><tr><td class="price_cell">', item.price); 12742 rightColumn.push( '</td><td>', item.add_to_cart); 12743 rightColumn.push('</td></tr></table>') 12744 12745 elementWrapper.innerHTML += rightColumn.join(''); 12746 12747 link.appendChild(element) 12748 12749 innerContainer.appendChild(link); 12750 } 12751 12752 } 12753 12754 if (data.bottomHtml){ 12755 var bottomHtml = new Element('div'); 12756 bottomHtml.innerHTML = data.bottomHtml; 12757 innerContainer.appendChild(bottomHtml); 12758 } 12759 12760 12761 12762 mainContainer.appendChild(innerContainer); 12763 12764 container.appendChild(triangleContainer); 12765 container.appendChild(mainContainer); 12766 12767 var miniForm = this.searchInput.up("[id=search_mini_form]"); 12768 12769 if (miniForm) 12770 miniForm.appendChild(container);; 12771 12772 $('search_mini_form').appendChild(container); 12773 12774// this.initEvents(mainContainer); 12775 this.resizePopup(); 12776 12777 }, 12778 12779 resizePopup: function(){ 12780 var max = 0; 12781 $$('#search_mini_form .price_cell').each(function(el){ 12782 max = el.getWidth() > max ? el.getWidth() : max; 12783 }); 12784 12785 $$('#search_mini_form .price_cell').each(function(el){ 12786 el.setStyle({'width': max + 'px'}); 12787 }) 12788 }, 12789 initEvents: function(container){ 12790 var maxDelay = 500; 12791 var delay = 0; 12792 var iterations = []; 12793 12794 function clear(){ 12795 for(var ind in iterations){ 12796 var iteration = iterations[ind]; 12797 if (typeof(iteration) == 'function'){ 12798 window.clearTimeout(iteration); 12799 } 12800 } 12801 iterations = []; 12802 delay = 0; 12803 } 12804 12805 container.observe('mouseover', function(event) { 12806 12807 clear(); 12808 12809 }); 12810 12811 12812 12813 container.observe('mouseout', function(event) { 12814 12815 var target = Event.element(event); 12816 12817 if (target == container){ 12818 function iteration(){ 12819 delay += 100; 12820 12821 if (delay >= maxDelay){ 12822 clear(); 12823 container.remove(); 12824 12825 12826 } else { 12827 var handler = window.setTimeout(function(){ 12828 iteration(); 12829 }, 100); 12830 12831 iterations.push(handler); 12832 } 12833 } 12834 12835 iteration(); 12836 } 12837 12838 12839 }); 12840 } 12841}); 12842 12843/** 12844 * Magento 12845 * 12846 * NOTICE OF LICENSE 12847 * 12848 * This source file is subject to the Academic Free License (AFL 3.0) 12849 * that is bundled with this package in the file LICENSE_AFL.txt. 12850 * It is also available through the world-wide-web at this URL: 12851 * http://opensource.org/licenses/afl-3.0.php 12852 * If you did not receive a copy of the license and are unable to 12853 * obtain it through the world-wide-web, please send an email 12854 * to [email protected] so we can send you a copy immediately. 12855 * 12856 * DISCLAIMER 12857 * 12858 * Do not edit or add to this file if you wish to upgrade Magento to newer 12859 * versions in the future. If you wish to customize Magento for your 12860 * needs please refer to http://www.magento.com for more information. 12861 * 12862 * @category Varien 12863 * @package js 12864 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 12865 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 12866 */ 12867if (typeof Product == 'undefined') { 12868 var Product = {}; 12869} 12870 12871/**************************** CONFIGURABLE PRODUCT **************************/ 12872Product.Config = Class.create(); 12873Product.Config.prototype = { 12874 initialize: function(config){ 12875 this.config = config; 12876 this.taxConfig = this.config.taxConfig; 12877 if (config.containerId) { 12878 this.settings = $$('#' + config.containerId + ' ' + '.super-attribute-select'); 12879 } else { 12880 this.settings = $$('.super-attribute-select'); 12881 } 12882 this.state = new Hash(); 12883 this.priceTemplate = new Template(this.config.template); 12884 this.prices = config.prices; 12885 12886 // Set default values from config 12887 if (config.defaultValues) { 12888 this.values = config.defaultValues; 12889 } 12890 12891 // Overwrite defaults by url 12892 var separatorIndex = window.location.href.indexOf('#'); 12893 if (separatorIndex != -1) { 12894 var paramsStr = window.location.href.substr(separatorIndex+1); 12895 var urlValues = paramsStr.toQueryParams(); 12896 if (!this.values) { 12897 this.values = {}; 12898 } 12899 for (var i in urlValues) { 12900 this.values[i] = urlValues[i]; 12901 } 12902 } 12903
12904 // Overwrite defaults by inputs values if needed 12905 if (config.inputsInitialized) { 12906 this.values = {}; 12907 this.settings.each(function(element) { 12908 if (element.value) { 12909 var attributeId = element.id.replace(/[a-z]*/, ''); 12910 this.values[attributeId] = element.value; 12911 } 12912 }.bind(this)); 12913 } 12914 12915 // Put events to check select reloads 12916 this.settings.each(function(element){ 12917 Event.observe(element, 'change', this.configure.bind(this)); 12918 }.bind(this)); 12919 12920 // fill state 12921 this.settings.each(function(element){ 12922 var attributeId = element.id.replace(/[a-z]*/, ''); 12923 if(attributeId && this.config.attributes[attributeId]) { 12924 element.config = this.config.attributes[attributeId]; 12925 element.attributeId = attributeId; 12926 this.state[attributeId] = false; 12927 } 12928 }.bind(this)); 12929 12930 // Init settings dropdown 12931 var childSettings = []; 12932 for(var i=this.settings.length-1;i>=0;i--){ 12933 var prevSetting = this.settings[i-1] ? this.settings[i-1] : false; 12934 var nextSetting = this.settings[i+1] ? this.settings[i+1] : false; 12935 if (i == 0){ 12936 this.fillSelect(this.settings[i]); 12937 } else { 12938 this.settings[i].disabled = true; 12939 } 12940 $(this.settings[i]).childSettings = childSettings.clone(); 12941 $(this.settings[i]).prevSetting = prevSetting; 12942 $(this.settings[i]).nextSetting = nextSetting; 12943 childSettings.push(this.settings[i]); 12944 } 12945 12946 // Set values to inputs 12947 this.configureForValues(); 12948 document.observe("dom:loaded", this.configureForValues.bind(this)); 12949 }, 12950 12951 configureForValues: function () { 12952 if (this.values) { 12953 this.settings.each(function(element){ 12954 var attributeId = element.attributeId; 12955 element.value = (typeof(this.values[attributeId]) == 'undefined')? '' : this.values[attributeId]; 12956 this.configureElement(element); 12957 }.bind(this)); 12958 } 12959 }, 12960 12961 configure: function(event){ 12962 var element = Event.element(event); 12963 this.configureElement(element); 12964 }, 12965 12966 configureElement : function(element) { 12967 this.reloadOptionLabels(element); 12968 if(element.value){ 12969 this.state[element.config.id] = element.value; 12970 if(element.nextSetting){ 12971 element.nextSetting.disabled = false; 12972 this.fillSelect(element.nextSetting); 12973 this.resetChildren(element.nextSetting); 12974 } 12975 } 12976 else { 12977 this.resetChildren(element); 12978 } 12979 this.reloadPrice(); 12980 }, 12981 12982 reloadOptionLabels: function(element){ 12983 var selectedPrice; 12984 if(element.options[element.selectedIndex].config && !this.config.stablePrices){ 12985 selectedPrice = parseFloat(element.options[element.selectedIndex].config.price); 12986 } 12987 else{ 12988 selectedPrice = 0; 12989 } 12990 for(var i=0;i<element.options.length;i++){ 12991 if(element.options[i].config){ 12992 element.options[i].text = this.getOptionLabel(element.options[i].config, element.options[i].config.price-selectedPrice); 12993 } 12994 } 12995 }, 12996 12997 resetChildren : function(element){ 12998 if(element.childSettings) { 12999 for(var i=0;i<element.childSettings.length;i++){ 13000 element.childSettings[i].selectedIndex = 0; 13001 element.childSettings[i].disabled = true; 13002 if(element.config){ 13003 this.state[element.config.id] = false; 13004 } 13005 } 13006 } 13007 }, 13008 13009 fillSelect: function(element){ 13010 var attributeId = element.id.replace(/[a-z]*/, ''); 13011 var options = this.getAttributeOptions(attributeId); 13012 this.clearSelect(element); 13013 element.options[0] = new Option('', ''); 13014 element.options[0].innerHTML = this.config.chooseText; 13015 13016 var prevConfig = false;
13017 if(element.prevSetting){ 13018 prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex]; 13019 } 13020 13021 if(options) { 13022 var index = 1; 13023 for(var i=0;i<options.length;i++){ 13024 var allowedProducts = []; 13025 if(prevConfig) { 13026 for(var j=0;j<options[i].products.length;j++){ 13027 if(prevConfig.config.allowedProducts 13028 && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){ 13029 allowedProducts.push(options[i].products[j]); 13030 } 13031 } 13032 } else { 13033 allowedProducts = options[i].products.clone(); 13034 } 13035 13036 if(allowedProducts.size()>0){ 13037 options[i].allowedProducts = allowedProducts; 13038 element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id); 13039 if (typeof options[i].price != 'undefined') { 13040 element.options[index].setAttribute('price', options[i].price); 13041 } 13042 element.options[index].config = options[i]; 13043 index++; 13044 } 13045 } 13046 } 13047 }, 13048 13049 getOptionLabel: function(option, price){ 13050 var price = parseFloat(price); 13051 if (this.taxConfig.includeTax) { 13052 var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax; 13053 var excl = price - tax; 13054 var incl = excl*(1+(this.taxConfig.currentTax/100)); 13055 } else { 13056 var tax = price * (this.taxConfig.currentTax / 100); 13057 var excl = price; 13058 var incl = excl + tax; 13059 } 13060 13061 if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) { 13062 price = incl; 13063 } else { 13064 price = excl; 13065 } 13066 13067 var str = option.label; 13068 if(price){ 13069 if (this.taxConfig.showBothPrices) { 13070 str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')'; 13071 } else { 13072 str+= ' ' + this.formatPrice(price, true); 13073 } 13074 } 13075 return str; 13076 }, 13077 13078 formatPrice: function(price, showSign){ 13079 var str = ''; 13080 price = parseFloat(price); 13081 if(showSign){ 13082 if(price<0){ 13083 str+= '-'; 13084 price = -price; 13085 } 13086 else{ 13087 str+= '+'; 13088 } 13089 } 13090 13091 var roundedPrice = (Math.round(price*100)/100).toString(); 13092 13093 if (this.prices && this.prices[roundedPrice]) { 13094 str+= this.prices[roundedPrice]; 13095 } 13096 else { 13097 str+= this.priceTemplate.evaluate({price:price.toFixed(2)}); 13098 } 13099 return str; 13100 }, 13101 13102 clearSelect: function(element){ 13103 for(var i=element.options.length-1;i>=0;i--){ 13104 element.remove(i); 13105 } 13106 }, 13107 13108 getAttributeOptions: function(attributeId){ 13109 if(this.config.attributes[attributeId]){ 13110 return this.config.attributes[attributeId].options; 13111 } 13112 }, 13113 13114 reloadPrice: function(){ 13115 if (this.config.disablePriceReload) { 13116 return; 13117 } 13118 var price = 0; 13119 var oldPrice = 0; 13120 for(var i=this.settings.length-1;i>=0;i--){ 13121 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 13122 if(selected.config){ 13123 price += parseFloat(selected.config.price); 13124 oldPrice += parseFloat(selected.config.oldPrice); 13125 } 13126 } 13127 13128 optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice}); 13129 optionsPrice.reload(); 13130 13131 return price; 13132 13133 if($('product-price-'+this.config.productId)){ 13134 $('product-price-'+this.config.productId).innerHTML = price; 13135 } 13136 this.reloadOldPrice(); 13137 }, 13138 13139 reloadOldPrice: function(){ 13140 if (this.config.disablePriceReload) { 13141 return; 13142 } 13143 if ($('old-price-'+this.config.productId)) { 13144 13145 var price = parseFloat(this.config.oldPrice); 13146 for(var i=this.settings.length-1;i>=0;i--){ 13147 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 13148 if(selected.config){ 13149 price+= parseFloat(selected.config.price); 13150 } 13151 } 13152 if (price < 0) 13153 price = 0; 13154 price = this.formatPrice(price); 13155 13156 if($('old-price-'+this.config.productId)){ 13157 $('old-price-'+this.config.productId).innerHTML = price; 13158 } 13159 13160 } 13161 } 13162}; 13163 13164var optionFileUpload = { 13165 productForm : $('product_addtocart_form'), 13166 formAction : '', 13167 formElements : {}, 13168 upload : function(element){ 13169 this.formElements = this.productForm.select('input', 'select', 'textarea', 'button'); 13170 this.removeRequire(element.readAttribute('id').sub('option_', '')); 13171 13172 template = '<iframe id="upload_target" name="upload_target" style="width:0; height:0; border:0;"><\/iframe>'; 13173 13174 Element.insert($('option_'+element.readAttribute('id').sub('option_', '')+'_uploaded_file'), {after: template}); 13175 13176 this.formAction = this.productForm.action; 13177 13178 //var baseUrl = '<?php echo $this->getUrl('*/product/upload') ?>'; 13179 var urlExt = 'option_id/'+element.readAttribute('id').sub('option_', ''); 13180 13181 this.productForm.action = parseSidUrl(baseUrl, urlExt); 13182 this.productForm.target = 'upload_target'; 13183 this.productForm.submit(); 13184 this.productForm.target = ''; 13185 this.productForm.action = this.formAction; 13186 }, 13187 removeRequire : function(skipElementId){ 13188 for(var i=0; i<this.formElements.length; i++){ 13189 if (this.formElements[i].readAttribute('id') != 'option_'+skipElementId+'_file' && this.formElements[i].type != 'button') { 13190 this.formElements[i].disabled='disabled'; 13191 } 13192 } 13193 }, 13194 addRequire : function(skipElementId){ 13195 for(var i=0; i<this.formElements.length; i++){ 13196 if (this.formElements[i].readAttribute('name') != 'options_'+skipElementId+'_file' && this.formElements[i].type != 'button') { 13197 this.formElements[i].disabled=''; 13198 } 13199 } 13200 }, 13201 uploadCallback : function(data){ 13202 this.addRequire(data.optionId); 13203 $('upload_target').remove(); 13204 13205 if (data.error) { 13206 13207 } else { 13208 $('option_'+data.optionId+'_uploaded_file').value = data.fileName; 13209 $('option_'+data.optionId+'_file').value = ''; 13210 $('option_'+data.optionId+'_file').hide(); 13211 $('option_'+data.optionId+'').hide(); 13212 template = '<div id="option_'+data.optionId+'_file_box"><a href="#"><img src="var/options/'+data.fileName+'" alt=""><\/a><a href="#" onclick="optionFileUpload.removeFile('+data.optionId+')" title="Remove file" \/>Remove file<\/a>'; 13213 13214 Element.insert($('option_'+data.optionId+'_uploaded_file'), {after: template}); 13215 } 13216 }, 13217 removeFile : function(optionId) 13218 { 13219 $('option_'+optionId+'_uploaded_file').value= ''; 13220 $('option_'+optionId+'_file').show(); 13221 $('option_'+optionId+'').show(); 13222 13223 $('option_'+optionId+'_file_box').remove(); 13224 } 13225 } 13226 var optionTextCounter = { 13227 count : function(field,cntfield,maxlimit){ 13228 if (field.value.length > maxlimit){ 13229 field.value = field.value.substring(0, maxlimit); 13230 } else { 13231 cntfield.innerHTML = maxlimit - field.value.length; 13232 } 13233 } 13234 } 13235 13236 Product.Options = Class.create(); 13237 Product.Options.prototype = { 13238 initialize : function(config) { 13239 this.config = config; 13240 this.reloadPrice(); 13241 document.observe("dom:loaded", this.reloadPrice.bind(this)); 13242 }, 13243 reloadPrice : function() { 13244 var config = this.config; 13245 var skipIds = []; 13246 $$('body .product-custom-option').each(function(element){ 13247 var optionId = 0; 13248 element.name.sub(/[0-9]+/, function(match){ 13249 optionId = parseInt(match[0], 10); 13250 }); 13251 if (config[optionId]) { 13252 var configOptions = config[optionId]; 13253 var curConfig = {price: 0}; 13254 if (element.type == 'checkbox' || element.type == 'radio') { 13255 if (element.checked) { 13256 if (typeof configOptions[element.getValue()] != 'undefined') { 13257 curConfig = configOptions[element.getValue()]; 13258 } 13259 } 13260 } else if(element.hasClassName('datetime-picker') && !skipIds.include(optionId)) { 13261 dateSelected = true; 13262 $$('.product-custom-option[id^="options_' + optionId + '"]').each(function(dt){ 13263 if (dt.getValue() == '') { 13264 dateSelected = false;
13265 } 13266 }); 13267 if (dateSelected) { 13268 curConfig = configOptions; 13269 skipIds[optionId] = optionId; 13270 } 13271 } else if(element.type == 'select-one' || element.type == 'select-multiple') { 13272 if ('options' in element) { 13273 $A(element.options).each(function(selectOption){ 13274 if ('selected' in selectOption && selectOption.selected) { 13275 if (typeof(configOptions[selectOption.value]) != 'undefined') { 13276 curConfig = configOptions[selectOption.value]; 13277 } 13278 } 13279 }); 13280 } 13281 } else { 13282 if (element.getValue().strip() != '') { 13283 curConfig = configOptions; 13284 } 13285 } 13286 if(element.type == 'select-multiple' && ('options' in element)) { 13287 $A(element.options).each(function(selectOption) { 13288 if (('selected' in selectOption) && typeof(configOptions[selectOption.value]) != 'undefined') { 13289 if (selectOption.selected) { 13290 curConfig = configOptions[selectOption.value]; 13291 } else { 13292 curConfig = {price: 0}; 13293 } 13294 optionsPrice.addCustomPrices(optionId + '-' + selectOption.value, curConfig); 13295 optionsPrice.reload(); 13296 } 13297 }); 13298 } else { 13299 optionsPrice.addCustomPrices(element.id || optionId, curConfig); 13300 optionsPrice.reload(); 13301 } 13302 } 13303 }); 13304 } 13305 } 13306 function validateOptionsCallback(elmId, result) { 13307 var container = $(elmId).up('ul.options-list'); 13308 if (result == 'failed') { 13309 container.removeClassName('validation-passed'); 13310 container.addClassName('validation-failed'); 13311 } else { 13312 container.removeClassName('validation-failed'); 13313 container.addClassName('validation-passed'); 13314 } 13315 } 13316 13317 function validateDownloadableCallback(elmId, result) { 13318 var container = $('downloadable-links-list'); 13319 if (result == 'failed') { 13320 container.removeClassName('validation-passed'); 13321 container.addClassName('validation-failed'); 13322 } else { 13323 container.removeClassName('validation-failed'); 13324 container.addClassName('validation-passed'); 13325 } 13326 } 13327AmAjax = Class.create(); 13328AmAjax.prototype = 13329{ 13330 options : null, 13331 nimiCartClass : 'a.top-link-cart', 13332 url : null, 13333 updateUrl : null, 13334 srcImageProgress : null, 13335 isProductView : 0, 13336 typeLoading : 0, 13337 enMinicart : 0, 13338 productId : 0, 13339 top_cart_selector: '.header-minicart', 13340 13341 initialize : function(options) { 13342 this.url = options['send_url']; 13343 this.updateUrl = options['update_url']; 13344 this.enMinicart = options['enable_minicart']; 13345 this.typeLoading = options['type_loading']; 13346 this.options = options; 13347 this.srcImageProgress = options['src_image_progress']; 13348 this.isProductView = options['is_product_view']; 13349 this.currentCategory = options['current_category']; 13350 this.productId = options['product_id']; 13351 this.top_cart_selector = options['top_cart_selector']; 13352 this.nimiCartClass = this.top_cart_selector; 13353 }, 13354 13355 updateCart : function() { 13356 if(jQuery('.main-container .block-cart', window.parent.document).length){ 13357 var url = this.url.replace(this.url.substring(this.url.length-6, this.url.length), 'cart');// replace ajax to cart 13358 new Ajax.Updater(jQuery('.main-container .block-cart', window.parent.document)[0], url, { 13359 method: 'post' 13360 }); 13361 } 13362 if(jQuery(this.top_cart_selector, window.parent.document).length){ 13363 var url = this.url.replace(this.url.substring(this.url.length-6, this.url.length), 'mcart');// replace ajax to mincart 13364 new Ajax.Request(url, { 13365 method: 'post', 13366 onSuccess: function(transport) { 13367 if(transport.responseText) { 13368 var response = transport.responseText; 13369 if('.header-minicart' == this.top_cart_selector){ 13370 jQuery(this.top_cart_selector, window.parent.document).html(response); 13371 } 13372 else{ 13373 jQuery(this.top_cart_selector, window.parent.document)[0].outerHTML = response; 13374 } 13375if(AmAjaxObj.enMinicart === "1"){ 13376 AmAjaxObj.createMinicart() 13377 } 13378 AmAjaxObj.external(); 13379 13380 } 13381 }.bind(this) 13382 }); 13383 } 13384 }, 13385 13386 13387 updateLinc : function(count) { 13388 var element = jQuery('a.top-link-cart', window.parent.document)[0]; 13389 if(element) { 13390 var pos = element.innerHTML.indexOf("("); 13391 if(pos >= 0 && count) { 13392 element.innerHTML = element.innerHTML.substring(0, pos) + count; 13393 } 13394 else{ 13395 if(count) 13396 element.innerHTML = element.innerHTML + count; 13397 } 13398 new Effect.Morph(element, { 13399 style: 'color: #ffff00;font-weight:bold;', 13400 duration: 0.8, 13401 afterFinish: function() { 13402 new Effect.Morph(element, { 13403 style: 'color: #EBBC58;font-weight:normal;', 13404 duration: 0.4 13405 }); 13406 } 13407 }); 13408 }; 13409 }, 13410 13411 updateShoppingCart : function() { 13412 if($$('body.checkout-cart-index div.cart')[0]){ 13413 var url = this.url.replace(this.url.substring(this.url.length-6, this.url.length), 'checkout');// 13414 new Ajax.Request(url, { 13415 method: 'post', 13416 onSuccess: function(transport) { 13417 if(transport.responseText) { 13418 var response = transport.responseText; 13419 var holderDiv = document.createElement('div'); 13420 holderDiv = $(holderDiv); 13421 holderDiv.innerHTML = response; 13422 $$('body.checkout-cart-index div.cart')[0].innerHTML = holderDiv.childElements()[0].innerHTML; 13423 } 13424 }.bind(this) 13425 }); 13426 } 13427 }, 13428 13429 showAnimation: function(loading, element) { 13430 var foundImage = 0; 13431 if(loading != 0 && element && element.parentNode && element.parentNode.parentNode && $$(this.nimiCartClass)[0]) { 13432 var i = 0; 13433 var el = $(element.parentNode); 13434 while(!child && i < 5) { 13435 if(el){ 13436 var massClass = el.getElementsByClassName('product-image'); 13437 if(massClass[0]){ 13438 var child =$(massClass[0]); 13439 } 13440 else { 13441 var el = $(el.parentNode); 13442 i++; 13443 } 13444 } 13445 } 13446 if(child) { 13447 var massClass = child.getElementsByClassName('wrap'); 13448 if(massClass[0]){ 13449 var child =$(massClass[0]); 13450 } 13451 var container = document.createElement('div'); 13452 container = $(container); 13453 container.id = 'am_loading_container'; 13454 container.style.position = 'absolute'; 13455 container.style.zIndex = '99919'; 13456 var contImage = child.getElementsByTagName('img'); 13457 if (contImage[0]){ 13458 container.appendChild($(contImage[0]).cloneNode(true)); 13459 foundImage = 1; 13460 } 13461 child.appendChild(container); 13462 var img = container.childElements()[0]; 13463 13464 var posContainer = jQuery(container).offset(); 13465 if(jQuery(this.nimiCartClass).children().length) { 13466 var posLink = jQuery(this.nimiCartClass).children().first().offset(); 13467 } 13468 else{ 13469 var posLink = jQuery(this.nimiCartClass).offset(); 13470 } 13471 13472 $$('body')[0].appendChild(container); 13473 container.style.position = 'absolute'; 13474 if(img) 13475 container.style.top = posContainer.top - 2*img.getHeight() + 'px'; 13476 container.style.left = posContainer.left + 'px'; 13477 container = $(container); 13478 new Effect.Shrink(container, {duration: 1.5}); 13479 new Effect.Fade(container, {duration: 1.5 }); 13480 new Effect.Move(container, { 13481 x: posLink.left, 13482 y: posLink.top, 13483 duration: 0.9, 13484 mode: 'absolute', 13485 afterFinish: function() { $('am_loading_container').remove(); } 13486 }); 13487 } 13488 } 13489 13490 if(loading == 0 || !foundImage) { 13491 jQuery(function($) { 13492 var progress = document.createElement('div'); 13493 progress = $(progress); // fix for IE 13494 progress.attr('id','amprogress'); 13495 13496 var container = document.createElement('div'); 13497 container = $(container); // fix for IE 13498 container.attr('id','amimg_container'); 13499 container.appendTo(progress); 13500 13501 var img = document.createElement('img'); 13502 img = $(img); // fix for IE 13503 img.attr('src', this.srcImageProgress); 13504 img.appendTo(container); 13505 13506 container.width('150px'); 13507 var width = container.width(); 13508 width = "-" + width/2 + "px" ; 13509 container.css("margin-left", width); 13510 progress.hide().appendTo(jQuery('body', window.parent.document)).fadeIn(); 13511 }.bind(this)); 13512 } 13513 }, 13514 13515 hideAnimation: function() { 13516 if(jQuery('#amprogress', window.parent.document).length) { 13517 jQuery(function($) { 13518 jQuery('#amprogress', window.parent.document).fadeOut(function() { 13519 $(this).remove(); 13520 }); 13521 }); 13522 } 13523 }, 13524 13525 //run every second while time !=0 13526 oneSec: function() { 13527 var elem= jQuery('#confirmButtons button:last-child', window.parent.document); 13528 var value = elem.text(); 13529 var sec = parseInt(value.replace(/\D+/g,"")); 13530 if(sec) { 13531 value = value.replace(sec, sec-1); 13532 elem.text(value); 13533 if(sec <= 1) { 13534 clearInterval(document.timer); 13535 elem.click(); 13536 } 13537 } 13538 else{ 13539 clearInterval(document.timer); 13540 } 13541 }, 13542 13543 //add parametr from form on product view page 13544 addProductParam: function(postData, element) { 13545 var form = null; 13546 if(element) { 13547 var form = $(element).up('form', 0); 13548 } 13549 if($$('#messageBox #product_addtocart_form')[0]){ 13550 form = $$('#messageBox #product_addtocart_form')[0]; 13551 } 13552 if(form) { 13553 var len=form.elements.length-1; 13554 var tmpPostData = postData;
13555 var validator = new Validation(form); 13556 if (validator.validate()) { 13557 var serialize = jQuery(form).serialize(); 13558 if(serialize == '' && len > 0){ 13559 jQuery(form).find('input').each(function(item){ 13560 postData += "&" + item.name + "="; 13561 }); 13562 } 13563 else{ 13564 postData += "&" + serialize; 13565 } 13566 } 13567 else{ 13568 return ''; 13569 } 13570 } 13571 else{ 13572 form = $('product_addtocart_form-' + postData.replace(/[^\d]/gi, '')); 13573 if(form && $('amconf-amcart-' + postData.replace(/[^\d]/gi, ''))) { 13574 if (form.hasClassName('isValid')) { 13575 postData += "&" + jQuery(form).serialize() 13576 form.remove(); 13577 } 13578 else{ 13579 form.remove(); 13580 } 13581 } 13582 } 13583 postData += '&IsProductView=' + this.isProductView + '¤t_category=' + this.currentCategory; 13584 return postData; 13585 }, 13586 13587 sendAjax : function(idProduct, param, oldEvent, element) { 13588 if(idProduct) { 13589 var postData = 'product_id=' + idProduct; 13590 if(jQuery('#amconf-block-' + idProduct).length) { 13591 var validator = new Validation($('amconf-block-' + idProduct)); 13592 if (validator.validate()) { 13593 postData += "&" + jQuery('#amconf-block-' + idProduct + ' :input').serialize(); 13594 } 13595 else{ 13596 return ''; 13597 } 13598 13599 } 13600 postData = this.addProductParam( postData , element); 13601 if('' == postData) 13602 return true; 13603 if(param) { 13604 jQuery.confirm.hide(); 13605 } 13606 new Ajax.Request(this.url, { 13607 method: 'post', 13608 postBody : postData, 13609 onCreate: function() 13610 { 13611 this.showAnimation(this.typeLoading, element); 13612 }.bind(this), 13613 onComplete: function() 13614 { 13615 this.hideAnimation(); 13616 }.bind(this), 13617 onSuccess: function(transport) { 13618 if (transport.responseText.isJSON()) { 13619 var response = transport.responseText.evalJSON(); 13620 if (response.error) { 13621 this.hideAnimation(); 13622 alert(response.error); 13623 } 13624 else{ 13625 if(response.redirect) { 13626 //if IE7 13627 if (document.all && !document.querySelector) { 13628 oldEvent = oldEvent.substring(21, oldEvent.length-2) 13629 eval(oldEvent); 13630 } 13631 else{ 13632 eval(oldEvent); 13633 } 13634 return true; 13635 } 13636 this.hideAnimation(); 13637 try { 13638 jQuery.confirm({ 13639 'title' : response.title, 13640 'message' : response.message, 13641 'buttons' : { 13642 '2' : { 13643 'name' : response.b1_name, 13644 'class' : 'am-btn-right', 13645 'action': function() { 13646 if(response.b1_action.indexOf('document.location') > -1 && window.parent.location != window.location){ 13647 response.b1_action = response.b1_action.replace('document.location', 'window.parent.location'); 13648 } 13649 eval(response.b1_action); 13650 } 13651 }, 13652 '1' : { 13653 'name' : response.b2_name, 13654 'class' : 'am-btn-left', 13655 'action': function() { 13656 if(response.b2_action.indexOf('document.location') > -1 && window.parent.location != window.location){ 13657 response.b2_action = response.b2_action.replace('document.location', 'window.parent.location'); 13658 } 13659 eval(response.b2_action); 13660 } 13661 } 13662 } 13663 }); 13664 13665 var maxHeight = 0.7 * jQuery(window).height(); 13666 var height = jQuery('#messageBox').height(); 13667 if(height > maxHeight){ 13668 $('messageBox').setStyle({ 13669 overflowY : 'scroll', 13670 maxHeight : maxHeight + 'px' 13671 }); 13672 } 13673 if('undefined' != typeof(optionsPrice)){ 13674 window.currentOptionsPrice = optionsPrice; 13675 } 13676 if('undefined' != typeof(opConfig)){ 13677 window.currentopConfig = opConfig; 13678 } 13679 if('undefined' != typeof(spConfig)){ 13680 window.currentspConfig = spConfig; 13681 } 13682 13683 eval(response.script); 13684 } catch(e) { 13685 console.debug(e); 13686 } 13687 if(response.is_add_to_cart === '1'){ 13688 this.updateCart(); 13689 this.updateShoppingCart(); 13690 this.updateMinicart(); 13691 this.updateLinc(response.count); 13692 } 13693 } 13694 } 13695 }.bind(this), 13696 onFailure: function() 13697 { 13698 this.hideAnimation(); 13699 eval(oldEvent); 13700 }.bind(this) 13701 }); 13702 } 13703 }, 13704 13705 sendLinkCompareAjax: function(idProduct) { 13706 var postData = 'product_id=' + idProduct; 13707 var url = this.url.replace(this.url.substring(this.url.length-6, this.url.length), 'linkcompare'); 13708 13709 new Ajax.Request(url, { 13710 method: 'post', 13711 postBody : postData, 13712 onCreate: function() 13713 { 13714 this.showAnimation(); 13715 }.bind(this), 13716 onComplete: function() 13717 { 13718 this.hideAnimation(); 13719 }.bind(this), 13720 onSuccess: function(transport) { 13721 if (transport.responseText.isJSON()) { 13722 var response = transport.responseText.evalJSON(); 13723 if (response.error) { 13724 this.hideAnimation(); 13725 alert(response.error); 13726 } 13727 else{ 13728 if(response.redirect) { 13729 eval(response.redirect); 13730 } 13731 this.hideAnimation(); 13732 try { 13733 jQuery.confirm({ 13734 'title' : response.title, 13735 'message' : response.message, 13736 'buttons' : { 13737 '2' : { 13738 'name' : response.b1_name, 13739 'class' : 'am-btn-right', 13740 'action': function() { 13741 eval(response.b1_action); 13742 } 13743 }, 13744 '1' : { 13745 'name' : response.b2_name, 13746 'class' : 'am-btn-left', 13747 'action': function() { 13748 if(response.b2_action.indexOf('document.location') > -1 && window.parent.location != window.location){ 13749 response.b2_action = response.b2_action.replace('document.location', 'window.parent.location'); 13750 } 13751 eval(response.b2_action); 13752 } 13753 } 13754 } 13755 }); 13756 this.updateCompare(); 13757 } catch(e) { 13758 console.debug(e); 13759 } 13760 } 13761 } 13762 }.bind(this), 13763 onFailure: function() 13764 { 13765 this.hideAnimation(); 13766 }.bind(this) 13767 }); 13768 }, 13769 13770 updateCompare : function() { 13771 if (jQuery('.main-container .block-compare', window.parent.document).length) { 13772 var url = this.url.replace(this.url.substring(this.url.length - 6, this.url.length), 'compare'); 13773 new Ajax.Request(url, { 13774 method: 'post', 13775 onSuccess: function(transport) { 13776 if(transport.responseText) { 13777 var response = transport.responseText; 13778 jQuery('.main-container .block-compare', window.parent.document)[0].outerHTML = response; 13779 13780 } 13781 }.bind(this) 13782 }); 13783 } 13784 }, 13785 13786 updateWishlist : function() {
13787 if (jQuery('.main-container .block-wishlist', window.parent.document).length) { 13788 var url = this.url.replace(this.url.substring(this.url.length - 6, this.url.length), 'wishlist'); 13789 new Ajax.Request(url, { 13790 method: 'post', 13791 onSuccess: function(transport) { 13792 if(transport.responseText) { 13793 var response = transport.responseText; 13794 jQuery('.main-container .block-wishlist', window.parent.document)[0].outerHTML = response; 13795 13796 } 13797 }.bind(this) 13798 }); 13799 } 13800 }, 13801 13802 13803 sendWishlistAjax: function(idProduct) { 13804 var postData = 'product_id=' + idProduct; 13805 var url = this.url.replace(this.url.substring(this.url.length-11, this.url.length), 'wishlist/add'); 13806 13807 new Ajax.Request(url, { 13808 method: 'post', 13809 postBody : postData, 13810 onCreate: function() 13811 { 13812 this.showAnimation(); 13813 }.bind(this), 13814 onComplete: function() 13815 { 13816 this.hideAnimation(); 13817 }.bind(this), 13818 onSuccess: function(transport) { 13819 if (transport.responseText.isJSON()) { 13820 var response = transport.responseText.evalJSON(); 13821 if (response.error) { 13822 this.hideAnimation(); 13823 alert(response.error); 13824 } 13825 else{ 13826 if(response.redirect) { 13827 eval(response.redirect); 13828 } 13829 this.hideAnimation(); 13830 try { 13831 jQuery.confirm({ 13832 'title' : response.title, 13833 'message' : response.message, 13834 'buttons' : { 13835 '2' : { 13836 'name' : response.b1_name, 13837 'class' : 'am-btn-right', 13838 'action': function() { 13839 eval(response.b1_action); 13840 } 13841 }, 13842 '1' : { 13843 'name' : response.b2_name, 13844 'class' : 'am-btn-left', 13845 'action': function() { 13846 if(response.b2_action.indexOf('document.location') > -1 && window.parent.location != window.location){ 13847 response.b2_action = response.b2_action.replace('document.location', 'window.parent.location'); 13848 } 13849 eval(response.b2_action); 13850 } 13851 } 13852 } 13853 }); 13854 this.updateWishlist(); 13855 } catch(e) { 13856 console.debug(e); 13857 } 13858 } 13859 } 13860 }.bind(this), 13861 onFailure: function() 13862 { 13863 this.hideAnimation(); 13864 }.bind(this) 13865 }); 13866 }, 13867 13868 //minicart 13869 createMinicart: function() { 13870 var nmCart = $$(this.nimiCartClass)[0]; 13871 if(nmCart) { 13872 var container = document.createElement('div'); 13873 container = $(container); 13874 container.id = 'am_minicart_container'; 13875 container.style.display = 'none'; 13876 if(nmCart.parentNode){ 13877 nmCart.parentNode.appendChild(container); 13878 this.updateMinicart(); 13879 13880 Event.observe(container, 'mouseover',function() {AmAjaxObj.showMinicart()} ); 13881 Event.observe(container, 'mouseout',function() {AmAjaxObj.hideMinicart()} ); 13882 Event.observe(nmCart, 'mouseover',function() {AmAjaxObj.showMinicart()} ); 13883 Event.observe(nmCart, 'mouseout',function() {AmAjaxObj.hideMinicart()} ); 13884 } 13885 return; 13886 } 13887 }, 13888 13889 updateMinicart: function() { 13890 var url = AmAjaxObj.url.replace(AmAjaxObj.url.substring(AmAjaxObj.url.length-6, AmAjaxObj.url.length), 'minicart'); 13891 var element = $('am_minicart_container'); 13892 if(!element) return; 13893 new Ajax.Updater(element, url, { 13894 method: 'post' 13895 }); 13896 }, 13897 13898 showMinicart: function() { 13899 jQuery("#am_minicart_container").stop(true, true).delay(300).slideDown(500, "easeOutBounce"); 13900 }, 13901 13902 13903 13904 hideMinicart: function() { 13905 jQuery("#am_minicart_container").stop(true, true).delay(300).fadeOut(800, "easeInCubic"); 13906 }, 13907 13908 13909 getProductId: function(parent) { 13910 var selector = 'div.price-box [id^=amcart-], ' + 13911 'div.price-box [id^=product-price-], ' + 13912 'div.special-price [id^=product-price-], ' + 13913 'div.price-box [id^=price-excluding-tax-], ' + 13914 'div.price-box [id^=price-including-tax-], ' + 13915 'div.price-box [id^=product-minimal-price-], ' + 13916 'div.price-box [id^=amasty-product-id-], ' + 13917 'div.price-box [id^=old-price-]'; 13918 var element = parent.select(selector); 13919 if(!element[0]) return false;
13920 13921 var productId = element[0].id.match(/\d+/).first(); 13922 if(parseInt(productId) > 0 && productId < 10000000) { 13923 return parseInt(productId); 13924 } 13925 13926 return false; 13927 }, 13928 13929 searchInPriceBox: function(parent, oldEvent, element) { 13930 var productId = this.getProductId(parent); 13931 if(productId) { 13932 this.sendAjax(productId, '', oldEvent, element); 13933 } 13934 13935 return productId; 13936 }, 13937 13938 external: function() { 13939 /* 13940 * default rwd theme 13941 * */ 13942 if(jQuery('html').width() < 800 && 'undefined' != typeof(SmartHeader)){ 13943 SmartHeader.init(); 13944 } 13945 if(jQuery(".skip-cart").length){ 13946 var skipContents = $j('.skip-content.block-cart'); 13947 var skipLinks = $j('.skip-link.skip-cart'); 13948 13949 skipLinks.on('click', function (e) { 13950 e.preventDefault(); 13951 13952 var self = $j(this); 13953 var target = self.attr('data-target-element') ? self.attr('data-target-element') : self.attr('href'); 13954 13955 // Get target element 13956 var elem = $j(target); 13957 13958 // Check if stub is open 13959 var isSkipContentOpen = elem.hasClass('skip-active') ? 1 : 0; 13960 13961 // Hide all stubs 13962 skipLinks.removeClass('skip-active'); 13963 skipContents.removeClass('skip-active'); 13964 13965 // Toggle stubs 13966 if (isSkipContentOpen) { 13967 self.removeClass('skip-active'); 13968 } else { 13969 self.addClass('skip-active'); 13970 elem.addClass('skip-active'); 13971 } 13972 }); 13973 13974 $j('#header-cart').on('click', '.skip-link-close', function(e) { 13975 var parent = $j(this).parents('.skip-content'); 13976 var link = parent.siblings('.skip-link'); 13977 13978 parent.removeClass('skip-active'); 13979 link.removeClass('skip-active'); 13980 13981 e.preventDefault(); 13982 }); 13983 13984 var minicartOptions = { 13985 formKey: AmAjaxObj.options.form_key 13986 } 13987 var Mini = new Minicart(minicartOptions); 13988 Mini.init(); 13989 } 13990 /* 13991 * fortis theme 13992 * */ 13993 if(jQuery('#mini-cart').length && jQuery('.dropdown-toggle').length){ 13994 var ddOpenTimeout; 13995 var dMenuPosTimeout; 13996 var DD_DELAY_IN = 200; 13997 var DD_DELAY_OUT = 0; 13998 var DD_ANIMATION_IN = 0; 13999 var DD_ANIMATION_OUT = 0; 14000 jQuery(function($) { 14001 14002 $(".clickable-dropdown > .dropdown-toggle").click(function() { 14003 $(this).parent().addClass('open'); 14004 $(this).parent().trigger('mouseenter'); 14005 }); 14006 $(".dropdown").hover(function() { 14007 14008 14009 var ddToggle = $(this).children('.dropdown-toggle'); 14010 var ddMenu = $(this).children('.dropdown-menu'); 14011 var ddWrapper = ddMenu.parent(); 14012 ddMenu.css("left", ""); 14013 ddMenu.css("right", ""); 14014 14015 if ($(this).hasClass('clickable-dropdown')) 14016 { 14017 if ($(this).hasClass('open')) 14018 { 14019 $(this).children('.dropdown-menu').stop(true, true).delay(DD_DELAY_IN).fadeIn(DD_ANIMATION_IN, "easeOutCubic"); 14020 } 14021 } 14022 else 14023 { 14024 clearTimeout(ddOpenTimeout); 14025 ddOpenTimeout = setTimeout(function() { 14026 14027 ddWrapper.addClass('open'); 14028 14029 }, DD_DELAY_IN); 14030 14031 //$(this).addClass('open'); 14032 $(this).children('.dropdown-menu').stop(true, true).delay(DD_DELAY_IN).fadeIn(DD_ANIMATION_IN, "easeOutCubic"); 14033 } 14034 14035 clearTimeout(dMenuPosTimeout); 14036 dMenuPosTimeout = setTimeout(function() { 14037 14038 if (ddMenu.offset().left < 0) 14039 { 14040 var space = ddWrapper.offset().left;
14040 ddMenu.css("left", (-1)*space); 14041 ddMenu.css("right", "auto"); 14042 } 14043 14044 }, DD_DELAY_IN); 14045 14046 }, function() { 14047 var ddMenu = $(this).children('.dropdown-menu'); 14048 clearTimeout(ddOpenTimeout); ddMenu.stop(true, true).delay(DD_DELAY_OUT).fadeOut(DD_ANIMATION_OUT, "easeInCubic"); 14049 if (ddMenu.is(":hidden")) 14050 { 14051 ddMenu.hide(); 14052 } 14053 $(this).removeClass('open'); 14054 }); 14055 }) 14056 } 14057 14058 } 14059} 14060 14061 14062 14063//Class for increasing product count 14064 14065AmQty = Class.create(); 14066AmQty.prototype = 14067{ 14068 initialize : function(min) { 14069 this.min = min; 14070 if(!this.min) this.min = 1; 14071 this.input = $('am-input'); 14072 this.formKey = $('am-form-key'); 14073 }, 14074 14075 increment: function() { 14076 this.input.value++; 14077 this.paint(); 14078 }, 14079 14080 decrement: function() { 14081 if(this.input.value > this.min) { 14082 this.input.value--; 14083 this.paint(); 14084 } 14085 14086 }, 14087 14088 update: function() { 14089 if (this.input.value >= this.min) { 14090 postData = "update_cart_action=update_qty&" + this.input.name + '=' + this.input.value + "&form_key=" + this.formKey.value; 14091 new Ajax.Request(AmAjaxObj.updateUrl, { 14092 method: 'post', 14093 postBody : postData, 14094 onCreate: function() 14095 { 14096 AmAjaxObj.showAnimation(); 14097 }.bind(this), 14098 14099 onComplete: function() 14100 { 14101 AmAjaxObj.hideAnimation(); 14102 }.bind(this), 14103 14104 onSuccess: function(transport) { 14105 var url = AmAjaxObj.url.replace(AmAjaxObj.url.substring(AmAjaxObj.url.length-6, AmAjaxObj.url.length), 'data');// replace ajax to count 14106 new Ajax.Request(url, { 14107 method: 'post', 14108 onSuccess: function(transport) { 14109 if (transport.responseText.isJSON()) { 14110 var response = transport.responseText.evalJSON(); 14111 if($('amcart-count') && response.count) $('amcart-count').innerHTML = response.count; 14112 var price = $$('#messageBox span.am_price')[0]; 14113 if(price && response.price) price.innerHTML = response.price; 14114 } 14115 }.bind(this), 14116 onComplete: function() { 14117 AmAjaxObj.updateLinc(" (" + $$('#amcart-count a')[0].text + ")"); 14118 } 14119 }); 14120 AmAjaxObj.updateCart(); 14121 AmAjaxObj.hideAnimation(); 14122 new Effect.Highlight(this.input, { startcolor: '#ffff99', endcolor: '#a4e9ac', restorecolor : '#a4e9ac'}); 14123 $('am-qty-button-update').hide(); 14124 this.input.removeClassName('focus'); 14125 14126 }.bind(this), 14127 14128 onFailure: function() 14129 { 14130 AmAjaxObj.hideAnimation(); 14131 }.bind(this) 14132 }); 14133 } 14134 else { 14135 this.input.value = this.min; 14136 new Effect.Highlight('am-input', { endcolor: '#E44545', restorecolor : '#E44545'}); 14137 } 14138 14139 }, 14140 14141 paint: function() { 14142 new Effect.Highlight('am-input', { endcolor: '#ffff99', restorecolor : '#ffff99'}); 14143 $('am-input').addClassName('focus'); 14144 $('am-qty-button-update').show(); 14145 this.clearTimer(); 14146 }, 14147 14148 clearTimer: function() { 14149 jQuery(function($) { 14150 var elem= $('#confirmButtons button:last-child'); 14151 var value = elem.text(); 14152 var sec = parseInt(value.replace(/\D+/g,"")); 14153 if(sec) { 14154 value = value.replace('(' + sec + ')', ''); 14155 elem.text(value); 14156 clearInterval(document.timer); 14157 } 14158 }); 14159 } 14160} 14161 14162 14163function searchIdAndSendAjax(event) { 14164 var element = Event.element(event); 14165 event.preventDefault(); 14166 var addToLinc = 'add-to-links'; 14167 14168 if($('confirmBox')) { 14169 jQuery(function($) { 14170 $.confirm.hide(); 14171 }) 14172 } 14173 //in Chrome element = span 14174 if( "SPAN" == element.tagName ) { 14175 element = element.up('button'); 14176 } 14177 14178 //if colors swatches pro 14179 if(amconf = element.getAttribute('amconf')) { 14180 eval(amconf); 14181 } 14182 14183 var oldEvent = element.getAttribute('oldEvent'); 14184 var idProduct = false;
14185 14186 var i = 0; el = element; 14187 while(!idProduct && i < 5) { 14188 el = $(el.parentNode); 14189 i++; 14190 if(el){ 14191 var idProduct = AmAjaxObj.searchInPriceBox(el, oldEvent, element, idProduct); 14192 if(idProduct){ 14193 return false; 14194 } 14195 } 14196 } 14197 14198 //for bundle 14199 14200 var el = $(element.parentNode); 14201 var child = el.getElementsByClassName(addToLinc)[0]; 14202 if(child) { 14203 var childNext = child.childElements()[0]; 14204 if(childNext) { 14205 var childNext = childNext.childElements()[0]; 14206 } 14207 if(childNext) { 14208 var idProduct = childNext.href.match(/product(.*?)form_key/)[0].replace(/[^\d]/gi, ''); 14209 } 14210 if(parseInt(idProduct) > 0) { 14211 var tmp = parseInt(idProduct); 14212 AmAjaxObj.sendAjax(tmp, '', oldEvent, element); 14213 return true; 14214 } 14215 else{ 14216 idProduct = false; 14217 } 14218 } 14219 if(idProduct) return false; 14220 14221 //other 14222 if($$("input[name='product']")[0] && $$("input[name='product']")[0].value) { 14223 idProduct = $$("input[name='product']")[0].value; 14224 if(parseInt(idProduct) > 0) { 14225 var tmp = parseInt(idProduct); 14226 AmAjaxObj.sendAjax(tmp, '', oldEvent, element); 14227 return true; 14228 } 14229 } 14230 if(idProduct) return false; 14231 14232 if(idProduct == '' && oldEvent) { 14233 var productString = '/product/'; 14234 var posStart = oldEvent.indexOf(productString); 14235 if(posStart) { 14236 var posFinish = oldEvent.indexOf('/', posStart + productString.length); 14237 if(posFinish) { 14238 var idProduct = oldEvent.substring(posStart + productString.length, posFinish); 14239 if(parseInt(idProduct) > 0) { 14240 var tmp = parseInt(idProduct); 14241 AmAjaxObj.sendAjax(tmp, '', oldEvent, element); 14242 return false; 14243 } 14244 else { 14245 idProduct = false; 14246 } 14247 } 14248 } 14249 } 14250 //default acrion 14251 if(idProduct) return false; 14252 //if IE7 14253 if (document.all && !document.querySelector) { 14254 oldEvent = oldEvent.substring(21, oldEvent.length-2) 14255 } 14256 eval(oldEvent); 14257 14258} 14259 14260function searchIdAndlinkCompare(event) { 14261 var element = Event.element(event); 14262 event.preventDefault(); 14263 var productId = false; 14264 14265 //in Chrome element = span 14266 if( "SPAN" == element.tagName ) { 14267 element = element.up('a'); 14268 } 14269 14270 if(element.href && element.href != ""){ 14271 var search = element.href.match(/product(.*?)uenc/); 14272 if(search && 'undefined' != typeof(search[0])) { 14273 productId = search[0].replace(/[^\d]/gi, ''); 14274 } 14275 } 14276 14277 if(!productId && element.getAttribute("onclick") && element.getAttribute("onclick") != "") { 14278 var search = element.getAttribute("onclick").match(/product(.*?)uenc/); 14279 if(search && 'undefined' != typeof(search[0])) { 14280 productId = search[0].replace(/[^\d]/gi, ''); 14281 } 14282 14283 } 14284 14285 if(!productId) { 14286 productId = AmAjaxObj.getProductId(element.up('.item, #product_addtocart_form')); 14287 } 14288 if(productId > 0){ 14289 AmAjaxObj.sendLinkCompareAjax(productId); 14290 } 14291} 14292 14293function searchIdWishlist(event) { 14294 var element = Event.element(event); 14295 event.preventDefault(); 14296 var productId = false; 14297 14298 //in Chrome element = span 14299 if( "SPAN" == element.tagName ) { 14300 element = element.up('a'); 14301 } 14302 14303 if(element.href && element.href != ""){ 14304 var search = element.href.match(/product\/(.*?)\//); 14305 if(search && 'undefined' != typeof(search[0])) { 14306 productId = search[0].replace(/[^\d]/gi, ''); 14307 } 14308 } 14309 14310 if(!productId && element.getAttribute("onclick") && element.getAttribute("onclick") != "") { 14311 var search = element.getAttribute("onclick").match(/product\/(.*?)\//); 14312 if(search && 'undefined' != typeof(search[0])) { 14313 productId = search[0].replace(/[^\d]/gi, ''); 14314 } 14315 14316 } 14317 14318 if(!productId) { 14319 productId = AmAjaxObj.getProductId(element.up('.item, #product_addtocart_form')); 14320 } 14321 if(productId > 0){ 14322 AmAjaxObj.sendWishlistAjax(productId); 14323 } 14324} 14325 14326
14327function AmAjaxShoppCartLoad(buttonClass){ 14328 if('undefined' != typeof(AmAjaxObj) && !$$('body').first().hasClassName('checkout-cart-configure')) { 14329 if(!buttonClass) buttonClass = AmAjaxObj.options['buttonClass'];//compatibility with old version 14330 $$(buttonClass).each(function (element) { 14331 if (!element.hasClassName('amcart-ignore')) { 14332 if (element.getAttribute('onclick')) { 14333 var attr = document.createAttribute('oldEvent'); 14334 attr.value = element.getAttribute('onclick').toString(); 14335 element.attributes.setNamedItem(attr); 14336 } 14337 element.onclick = ''; 14338 element.stopObserving('click'); 14339 element.removeAttribute('onclick'); 14340 element.removeAttribute('disabled'); 14341 Event.observe(element, 'click', searchIdAndSendAjax); 14342 } 14343 }.bind(this)); 14344 14345 if(AmAjaxObj.options['linkcompare']) { 14346 $$('a[href*="catalog/product_compare"]').each(function (link) { 14347 link.stopObserving('click'); 14348 link.removeAttribute('onclick'); 14349 Event.observe(link, 'click', searchIdAndlinkCompare); 14350 }.bind(this)); 14351 } 14352 if(AmAjaxObj.options['wishlist']) { 14353 $$('a[href*="wishlist/index/add"]').each(function (link) { 14354 link.stopObserving('click'); 14355 link.removeAttribute('onclick'); 14356 Event.observe(link, 'click', searchIdWishlist); 14357 }.bind(this)); 14358 } 14359 } 14360} 14361 14362document.observe("dom:loaded", function() { 14363 if(AmAjaxObj.enMinicart === "1"){ 14364 AmAjaxObj.createMinicart() 14365 } 14366}); 14367if('undefined' == typeof(jQuery)) { 14368/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
vendor: 92,515 bytes, lines 14368-14371
14368 14369*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj; 14370return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={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:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l) 14371}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.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(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
14372 14373 14374jQuery.noConflict(); 14375} 14376/** 14377 * Anowave Enhanced Ecommerce Tracking 14378 * 14379 * NOTICE OF LICENSE 14380 * 14381 * This source file is subject to the Anowave license that is 14382 * available through the world-wide-web at this URL: 14383 * http://www.anowave.com/license-agreement/ 14384 * 14385 * DISCLAIMER 14386 * 14387 * Do not edit or add to this file if you wish to upgrade this extension to newer 14388 * version in the future. 14389 * 14390 * @category Anowave 14391 * @package Anowave_Ec 14392 * @copyright Copyright (c) 2018 Anowave (http://www.anowave.com/) 14393 * @license http://www.anowave.com/license-agreement/ 14394 */ 14395 14396if ('undefined' === typeof log) 14397{ 14398 var log = function (message) 14399 { 14400 window.console && console.log ? console.log(message) : null; 14401 }; 14402} 14403 14404var AEC = 14405{ 14406 textarea:null, 14407 gtm: function() 14408 { 14409 if ("undefined" === typeof google_tag_manager) 14410 { 14411 /** 14412 * Log error to console 14413 */ 14414 log('Unable to detect Google Tag Manager. Please verify if GTM install snippet is available.'); 14415 14416 return false; 14417 } 14418 14419 return true; 14420 }, 14421 ajax: function(context,dataLayer) 14422 { 14423 var element = jQuery(context), qty = jQuery(':radio[name=qty]:checked, :text[name=qty], select[name=qty]').eq(0).val(), variant = []; 14424 14425 /** 14426 * Default quantity 14427 */ 14428 if ('undefined' === typeof qty) 14429 { 14430 qty = 1; 14431 } 14432 14433 /** 14434 * Collection of products added to cart 14435 */ 14436 var products = []; 14437 14438 if (AEC.forceSelectors) 14439 { 14440 jQuery.each(['id','name','category','brand','price','quantity', 'attributes'], function(index, attribute) 14441 { 14442 element.data(attribute, element.attr('data-' + attribute)); 14443 }); 14444 } 14445 14446 var attributes = {}; 14447 14448 if (!AEC.gtm()) 14449 { 14450 /** 14451 * Invoke original click event(s) 14452 */ 14453 if (element.data('click')) 14454 { 14455 /** 14456 * Track time 14457 */ 14458 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_ADD_TO_CART, element.data('name'), element.data('category')); 14459 14460 eval(element.data('click')); 14461 } 14462 14463 return true; 14464 } 14465 14466 if(element.data('configurable')) 14467 { 14468 var attributes = jQuery('[name^="super_attribute"]'), variants = []; 14469 14470 /** 14471 * Load super attsibutes 14472 */ 14473 14474 jQuery.each(attributes, function(index, attribute) 14475 { 14476 if (jQuery(attribute).is('select')) 14477 { 14478 var name = jQuery(attribute).attr('name'), id = name.substring(name.indexOf('[') + 1, name.lastIndexOf(']')); 14479 14480 var option = jQuery(attribute).find('option:selected'); 14481 14482 if (0 < parseInt(option.val())) 14483 { 14484 variants.push( 14485 { 14486 id: id, 14487 text: option.text() 14488 }); 14489 } 14490 } 14491 }); 14492 14493 if (attributes.length == variants.length) 14494 { 14495 for (i = 0, l = variants.length; i < l; i++) 14496 { 14497 for (a = 0, b = AEC.SUPER.length; a < b; a++) 14498 { 14499 if (AEC.SUPER[a].id == variants[i].id) 14500 { 14501 variant.push([AEC.SUPER[a].label,variants[i].text].join(':')); 14502 } 14503 } 14504 } 14505 } 14506 14507 if (!variant.length) 14508 { 14509 /** 14510 * Invoke original click event(s) 14511 */ 14512 if (element.data('click')) 14513 { 14514 /** 14515 * Track time 14516 */ 14517 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_ADD_TO_CART, element.data('name'), element.data('category')); 14518 14519 eval(element.data('click')); 14520 } 14521 14522 return false; 14523 } 14524 } 14525 14526 /** 14527 * Handle products with custom options 14528 */ 14529 if (element.data('options')) 14530 { 14531 variant = variant || [], options = element.data('options'); 14532 14533 var variant = (function($, variant) 14534 { 14535 var options = element.data('options'), current = []; 14536 14537 $('[name^="options"]').each(function() 14538 { 14539 $(this).find('option:selected').each(function() 14540 { 14541 current.push(parseInt($(this).attr('value'))); 14542 }); 14543 }); 14544 14545 var currentOptions = []; 14546 14547 for (i = 0, l = current.length; i < l; i++) 14548 { 14549 $.each(options, function(index, option) 14550 { 14551 if (parseInt(option.id) == parseInt(current[i])) 14552 { 14553 currentOptions.push([option.label.toString().trim(),option.value.toString().trim()].join(':')); 14554 } 14555 });
14556 } 14557 14558 variant.push(currentOptions.join('-')); 14559 14560 /** 14561 * Return variant 14562 */ 14563 return variant; 14564 14565 })(jQuery, variant); 14566 } 14567 14568 /** 14569 * Handle grouped elements 14570 */ 14571 if (element.data('grouped')) 14572 { 14573 for (u = 0, y = window.G.length; u < y; u++) 14574 { 14575 var qty = Math.abs(jQuery('[name="super_group[' + window.G[u].id + ']"]').val()); 14576 14577 if (qty) 14578 { 14579 products.push( 14580 { 14581 'name': window.G[u].name, 14582 'id': window.G[u].sku, 14583 'price': window.G[u].price, 14584 'category': window.G[u].category, 14585 'brand': window.G[u].brand, 14586 'quantity': qty 14587 }); 14588 } 14589 } 14590 } 14591 else 14592 { 14593 products.push( 14594 { 14595 'name': AEC.convert(element.data('name')), 14596 'id': AEC.convert(element.data('id')), 14597 'price': AEC.convert(element.data('price')), 14598 'category': AEC.convert(element.data('category')), 14599 'brand': AEC.convert(element.data('brand')), 14600 'variant': variant.join('-'), 14601 'quantity': qty 14602 }); 14603 } 14604 14605 /** 14606 * Affiliation attributes 14607 */ 14608 for (i = 0, l = products.length; i < l; i++) 14609 { 14610 (function(product) 14611 { 14612 jQuery.each(AEC.parseJSON(element.data('attributes')), function(key, value) 14613 { 14614 product[key] = value; 14615 }); 14616 })(products[i]); 14617 } 14618 14619 var data = 14620 { 14621 'event': 'addToCart', 14622 'eventLabel': element.data('name'), 14623 'ecommerce': 14624 { 14625 'currencyCode': AEC.currencyCode, 14626 'add': 14627 { 14628 'products': products 14629 } 14630 }, 14631 'eventCallback': function() 14632 { 14633 if (AEC.eventCallback) 14634 { 14635 if (element.data('click')) 14636 { 14637 eval(element.data('click')); 14638 } 14639 else if (element.is('a')) 14640 { 14641 document.location = element.attr('href'); 14642 } 14643 else if (element.is('img') && element.parent().is('a')) 14644 { 14645 document.location = element.parent().attr('href'); 14646 } 14647 else 14648 { 14649 return true; 14650 } 14651 } 14652 }, 14653 'eventTimeout': AEC.eventTimeout 14654 }; 14655 14656 /** 14657 * Cookie Consent 14658 */ 14659 (function(callback, element) 14660 { 14661 if (AEC.CookieConsent.support) 14662 { 14663 if (AEC.CookieConsent.granted) 14664 { 14665 AEC.CookieConsent.queue(callback).process(); 14666 } 14667 else 14668 { 14669 if (AEC.eventCallback) 14670 { 14671 if (element.data('click')) 14672 { 14673 eval(element.data('click')); 14674 } 14675 else if (element.is('a')) 14676 { 14677 document.location = element.attr('href'); 14678 } 14679 else if (element.is('img') && element.parent().is('a')) 14680 { 14681 document.location = element.parent().attr('href'); 14682 } 14683 else 14684 { 14685 return true; 14686 } 14687 } 14688 } 14689 } 14690 else 14691 { 14692 return callback.apply(window,[]); 14693 } 14694 14695 })((function(dataLayer,data, element) 14696 { 14697 return function() 14698 { 14699 dataLayer.push(data); 14700 14701 /** 14702 * Track time 14703 */ 14704 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_ADD_TO_CART, element.data('name'), element.data('category')); 14705 } 14706 })(dataLayer,data, element), element); 14707 14708 /** 14709 * Facebook Pixel Tracking 14710 */ 14711 if (AEC.facebook) 14712 { 14713 if ("undefined" !== typeof fbq) 14714 { 14715 var fb = [], price = 0; 14716 14717 for (i = 0, l = products.length; i < l; i++) 14718 { 14719 fb.push(products[i].id); 14720 14721 /** 14722 * Accumulative price 14723 */ 14724 price += parseFloat(products[i].price); 14725 } 14726 14727 (function(callback) 14728 { 14729 if (AEC.CookieConsent.support) 14730 { 14731 AEC.CookieConsent.queue(callback).process(); 14732 } 14733 else 14734 { 14735 callback.apply(window,[]); 14736 } 14737 14738 })((function(price, element) 14739 { 14740 return function() 14741 { 14742 fbq('track', 'AddToCart', 14743 { 14744 content_name: element.data('name'), 14745 content_ids: fb, 14746 content_type: 'product', 14747 value: price, 14748 currency: AEC.currencyCode 14749 }); 14750 } 14751 })(price, element)); 14752 } 14753 } 14754 14755 if (AEC.eventCallback) 14756 { 14757 return false; 14758 } 14759 14760 return true; 14761 }, 14762 click: function(context,dataLayer) 14763 { 14764 var element = jQuery(context); 14765 14766 if (AEC.forceSelectors) 14767 { 14768 jQuery.each(['id','name','category','brand','price','quantity','position','attributes'], function(index, attribute) 14769 { 14770 element.data(attribute, element.attr('data-' + attribute)); 14771 }); 14772 } 14773 14774 if (!AEC.gtm()) 14775 { 14776 /** 14777 * Track time 14778 */ 14779 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_PRODUCT_CLICK, element.data('name'), element.data('category')); 14780 14781 return true; 14782 } 14783 14784 var item = 14785 { 14786 'name': AEC.convert(element.data('name')), 14787 'id': AEC.convert(element.data('id')), 14788 'price': AEC.convert(element.data('price')), 14789 'category': AEC.convert(element.data('category')), 14790 'brand': AEC.convert(element.data('brand')), 14791 'quantity': AEC.convert(element.data('quantity')), 14792 'position': AEC.convert(element.data('position')) 14793 }; 14794 14795 /** 14796 * Affiliation attributes 14797 */ 14798 jQuery.each(AEC.parseJSON(element.data('attributes')), function(key, value) 14799 { 14800 item[key] = value; 14801 }); 14802 14803 var data = 14804 { 14805 'event': 'productClick', 14806 'eventLabel': AEC.convert(element.data('name')), 14807 'ecommerce': 14808 { 14809 'click': 14810 { 14811 'actionField': 14812 { 14813 'list': AEC.convert(element.data('list')) 14814 }, 14815 'products': 14816 [ 14817 item 14818 ] 14819 } 14820 }, 14821 'eventCallback': function() 14822 { 14823 if (AEC.eventCallback) 14824 { 14825 if (element.data('click')) 14826 { 14827 eval(element.data('click')); 14828 } 14829 else if (element.is('a')) 14830 { 14831 document.location = element.attr('href'); 14832 } 14833 else if (element.is('img') && element.parent().is('a')) 14834 { 14835 document.location = element.parent().attr('href'); 14836 } 14837 else 14838 { 14839 return true; 14840 } 14841 } 14842 }, 14843 'eventTimeout': AEC.eventTimeout, 14844 'eventTarget': (function(element) 14845 { 14846 /** 14847 * Default target 14848 */ 14849 var target = 'Default'; 14850 14851 /** 14852 * Check if element is anchor 14853 */ 14854 if (element.is('a')) 14855 { 14856 target = 'Link'; 14857 14858 if (element.children().first().is('img')) 14859 { 14860 target = 'Image'; 14861 } 14862 } 14863 14864 if (element.is('button')) 14865 { 14866 target = 'Button'; 14867 } 14868 14869 return target; 14870 14871 })(element) 14872 }; 14873 14874 /** 14875 * Cookie Consent 14876 */ 14877 (function(callback, element) 14878 {
14879 if (AEC.CookieConsent.support) 14880 { 14881 if (AEC.CookieConsent.granted) 14882 { 14883 AEC.CookieConsent.queue(callback).process(); 14884 } 14885 else 14886 { 14887 if (AEC.eventCallback) 14888 { 14889 if (element.data('click')) 14890 { 14891 eval(element.data('click')); 14892 } 14893 else if (element.is('a')) 14894 { 14895 document.location = element.attr('href'); 14896 } 14897 else if (element.is('img') && element.parent().is('a')) 14898 { 14899 document.location = element.parent().attr('href'); 14900 } 14901 else 14902 { 14903 return true; 14904 } 14905 } 14906 } 14907 } 14908 else 14909 { 14910 return callback.apply(window,[]); 14911 } 14912 14913 })((function(dataLayer,data, element) 14914 { 14915 return function() 14916 { 14917 dataLayer.push(data); 14918 14919 /** 14920 * Track time 14921 */ 14922 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_PRODUCT_CLICK, element.data('name'), element.data('category')); 14923 } 14924 })(dataLayer,data, element), element); 14925 14926 if (AEC.eventCallback) 14927 { 14928 return false; 14929 } 14930 14931 return true; 14932 }, 14933 ajaxList:function(context,dataLayer) 14934 { 14935 var element = jQuery(context); 14936 14937 /** 14938 * Collection of products added to cart 14939 */ 14940 var products = []; 14941 14942 if (AEC.forceSelectors) 14943 { 14944 jQuery.each(['id','name','category','brand','price','quantity'], function(index, attribute) 14945 { 14946 element.data(attribute, element.attr('data-' + attribute)); 14947 }); 14948 } 14949 14950 if (!AEC.gtm()) 14951 { 14952 if (AEC.eventCallback) 14953 { 14954 /** 14955 * Invoke original click event(s) 14956 */ 14957 if (element.data('click')) 14958 { 14959 /** 14960 * Track time 14961 */ 14962 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_ADD_TO_CART, element.data('name'), element.data('category')); 14963 14964 eval(element.data('click')); 14965 } 14966 } 14967 14968 return true; 14969 } 14970 14971 products.push( 14972 { 14973 'name': AEC.convert(element.data('name')), 14974 'id': AEC.convert(element.data('id')), 14975 'price': AEC.convert(element.data('price')), 14976 'category': AEC.convert(element.data('category')), 14977 'brand': AEC.convert(element.data('brand')), 14978 'quantity': 1 14979 }); 14980 14981 /** 14982 * Affiliation attributes 14983 */ 14984 for (i = 0, l = products.length; i < l; i++) 14985 { 14986 (function(product) 14987 { 14988 jQuery.each(AEC.parseJSON(element.data('attributes')), function(key, value) 14989 { 14990 product[key] = value; 14991 }); 14992 })(products[i]); 14993 } 14994 14995 var data = 14996 { 14997 'event': 'addToCart', 14998 'eventLabel': element.data('name'), 14999 'ecommerce': 15000 { 15001 'currencyCode': AEC.currencyCode, 15002 'add': 15003 { 15004 'actionField': 15005 { 15006 'list':AEC.convert(element.data('list')) 15007 }, 15008 'products': products 15009 } 15010 } 15011 }; 15012 15013 /** 15014 * Cookie Consent 15015 */ 15016 (function(callback, element) 15017 { 15018 if (AEC.CookieConsent.support) 15019 { 15020 if (AEC.CookieConsent.granted) 15021 { 15022 AEC.CookieConsent.queue(callback).process(); 15023 } 15024 else 15025 { 15026 if (element.data('click')) 15027 { 15028 /** 15029 * Track time 15030 */ 15031 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_ADD_TO_CART, element.data('name'), element.data('category')); 15032 15033 /** 15034 * Evaluate original click 15035 */ 15036 eval(element.data('click')); 15037 } 15038 } 15039 } 15040 else 15041 { 15042 return callback.apply(window,[]); 15043 } 15044 15045 })((function(dataLayer,data, element) 15046 { 15047 return function() 15048 { 15049 dataLayer.push(data); 15050 15051 /** 15052 * Track time 15053 */ 15054 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_ADD_TO_CART, element.data('name'), element.data('category')); 15055 } 15056 })(dataLayer,data, element), element); 15057 15058 /** 15059 * Invoke original click event(s) 15060 */ 15061 if (AEC.eventCallback) 15062 { 15063 if (element.data('click')) 15064 { 15065 eval(element.data('click')); 15066 } 15067 } 15068 15069 if (AEC.facebook) 15070 { 15071 if ("undefined" !== typeof fbq) 15072 { 15073 var fb = [], price = 0; 15074 15075 for (i = 0, l = products.length; i < l; i++) 15076 { 15077 fb.push(products[i].id); 15078 15079 /** 15080 * Accumulative price 15081 */ 15082 price += parseFloat(products[i].price); 15083 } 15084 15085 (function(callback) 15086 {
15087 if (AEC.CookieConsent.support) 15088 { 15089 AEC.CookieConsent.queue(callback).process(); 15090 } 15091 else 15092 { 15093 callback.apply(window,[]); 15094 } 15095 15096 })((function(price, element) 15097 { 15098 return function() 15099 { 15100 fbq('track', 'AddToCart', 15101 { 15102 content_name: element.data('name'), 15103 content_ids: fb, 15104 content_type: 'product', 15105 value: price, 15106 currency: AEC.currencyCode 15107 }); 15108 } 15109 })(price, element)); 15110 } 15111 } 15112 15113 return true; 15114 }, 15115 remove: function(context, dataLayer) 15116 { 15117 var element = jQuery(context); 15118 15119 if (AEC.forceSelectors) 15120 { 15121 jQuery.each(['id','name','category','brand','price','quantity'], function(index, attribute) 15122 { 15123 element.data(attribute, element.attr('data-' + attribute)); 15124 }); 15125 } 15126 15127 if (!AEC.gtm()) 15128 { 15129 /** 15130 * Track time 15131 */ 15132 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_REMOVE_FROM_CART, element.data('name'), element.data('category')); 15133 15134 return true; 15135 } 15136 15137 var item = 15138 { 15139 'name': AEC.convert(element.data('name')), 15140 'id': AEC.convert(element.data('id')), 15141 'price': AEC.convert(element.data('price')), 15142 'category': AEC.convert(element.data('category')), 15143 'brand': AEC.convert(element.data('brand')), 15144 'quantity': AEC.convert(element.data('quantity')), 15145 'variant': AEC.convert(element.data('variant')) 15146 }; 15147 15148 /** 15149 * Affiliation attributes 15150 */ 15151 jQuery.each(AEC.parseJSON(element.data('attributes')), function(key, value) 15152 { 15153 item[key] = value; 15154 }); 15155 15156 var data = 15157 { 15158 'event': 'removeFromCart', 15159 'eventLabel': AEC.convert(element.data('name')), 15160 'ecommerce': 15161 { 15162 'remove': 15163 { 15164 'products': 15165 [ 15166 item 15167 ] 15168 } 15169 }, 15170 'eventCallback': function() 15171 { 15172 if (AEC.eventCallback) 15173 { 15174 if (element.data('click')) 15175 { 15176 eval(element.data('click')); 15177 } 15178 else if (element.is('a')) 15179 { 15180 document.location = element.attr('href'); 15181 } 15182 else if (element.is('img') && element.parent().is('a')) 15183 { 15184 document.location = element.parent().attr('href'); 15185 } 15186 else 15187 { 15188 return true; 15189 } 15190 } 15191 }, 15192 'eventTimeout': AEC.eventTimeout 15193 }; 15194 15195 if (element.data('mini-cart')) 15196 { 15197 if ('undefined' !== typeof Minicart) 15198 { 15199 (function(dataLayer, data, Minicart, element, stop) 15200 { 15201 Minicart.prototype.updateContentOnRemove = Minicart.prototype.updateContentOnRemove.wrap(function(parentMethod, result, el) 15202 { 15203 parentMethod(result, el); 15204 15205 if (!stop) 15206 { 15207 stop = true; 15208 15209 if ('undefined' != typeof result.success) 15210 { 15211 data['eventCallback'] = function(){}; 15212 15213 /** 15214 * Fallback for private mode 15215 */ 15216 data['eventTimeout'] = AEC.eventTimeout; 15217 15218 /** 15219 * Push data 15220 */ 15221 dataLayer.push(data); 15222 15223 /** 15224 * Track time 15225 */ 15226 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_REMOVE_FROM_CART, element.data('name')); 15227 } 15228 } 15229 }); 15230 })(dataLayer, data, Minicart, element, false); 15231 } 15232 } 15233 else 15234 { 15235 /** 15236 * Track event 15237 */ 15238 dataLayer.push(data); 15239 15240 /** 15241 * Track time 15242 */ 15243 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_REMOVE_FROM_CART, element.data('name')); 15244 } 15245 15246 if (AEC.eventCallback) 15247 { 15248 return false; 15249 } 15250 15251 return true; 15252 }, 15253 wishlist: function(context,dataLayer) 15254 { 15255 var element = jQuery(context); 15256 15257 if (AEC.forceSelectors) 15258 { 15259 jQuery.each(['id','name','category','brand','price','quantity'], function(index, attribute) 15260 { 15261 element.data(attribute, element.attr('data-' + attribute)); 15262 }); 15263 } 15264 15265 if (!AEC.gtm()) 15266 { 15267 /** 15268 * Track time 15269 */ 15270 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_PRODUCT_WISHLIST, element.data('name'), element.data('category')); 15271 15272 return true; 15273 } 15274 15275 var data = 15276 { 15277 'event': 'addToWishlist',
15278 'eventLabel': AEC.convert(element.data('name')), 15279 'eventCallback': function() 15280 { 15281 if (AEC.eventCallback) 15282 { 15283 if (element.data('click')) 15284 { 15285 eval(element.data('click')); 15286 } 15287 else if (element.is('a')) 15288 { 15289 document.location = element.attr('href'); 15290 } 15291 else if (element.is('img') && element.parent().is('a')) 15292 { 15293 document.location = element.parent().attr('href'); 15294 } 15295 else 15296 { 15297 return true; 15298 } 15299 } 15300 }, 15301 'eventTimeout': AEC.eventTimeout 15302 }; 15303 15304 /** 15305 * Push data 15306 */ 15307 dataLayer.push(data); 15308 15309 /** 15310 * Track time 15311 */ 15312 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_PRODUCT_WISHLIST, element.data('name'), element.data('category')); 15313 15314 if (AEC.eventCallback) 15315 { 15316 return false; 15317 } 15318 15319 return true; 15320 }, 15321 compare: function(context,dataLayer) 15322 { 15323 var element = jQuery(context); 15324 15325 if (AEC.forceSelectors) 15326 { 15327 jQuery.each(['id','name','category','brand','price','quantity'], function(index, attribute) 15328 { 15329 element.data(attribute, element.attr('data-' + attribute)); 15330 }); 15331 } 15332 15333 if (!AEC.gtm()) 15334 { 15335 /** 15336 * Track time 15337 */ 15338 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_PRODUCT_COMPARE, element.data('name'), element.data('category')); 15339 15340 return true; 15341 } 15342 15343 var data = 15344 { 15345 'event': 'addToCompare', 15346 'eventLabel': AEC.convert(element.data('name')), 15347 'eventCallback': function() 15348 { 15349 if (AEC.eventCallback) 15350 { 15351 if (element.data('click')) 15352 { 15353 eval(element.data('click')); 15354 } 15355 else if (element.is('a')) 15356 { 15357 document.location = element.attr('href'); 15358 } 15359 else if (element.is('img') && element.parent().is('a')) 15360 { 15361 document.location = element.parent().attr('href'); 15362 } 15363 else 15364 { 15365 return true; 15366 } 15367 } 15368 }, 15369 'eventTimeout': AEC.eventTimeout 15370 }; 15371 15372 /** 15373 * Push data 15374 */ 15375 dataLayer.push(data); 15376 15377 /** 15378 * Track time 15379 */ 15380 AEC.Time.track(dataLayer, AEC.Const.TIMING_CATEGORY_PRODUCT_COMPARE, element.data('name'), element.data('category')); 15381 15382 if (AEC.eventCallback) 15383 { 15384 return false; 15385 } 15386 15387 return true; 15388 }, 15389 Callbacks:(function() 15390 { 15391 return { 15392 callbacks:[], 15393 queue: function(callback) 15394 { 15395 this.callbacks.push(callback); 15396 15397 return this; 15398 }, 15399 apply: function() 15400 { 15401 while (this.callbacks.length) 15402 { 15403 this.callbacks.shift().apply(AEC,arguments); 15404 } 15405 15406 return this; 15407 } 15408 } 15409 })(), 15410 Time:(function() 15411 { 15412 var T = 15413 { 15414 event: 'trackTime', 15415 timingCategory: '', 15416 timingVar: '', 15417 timingValue: -1, 15418 timingLabel: '' 15419 }; 15420 15421 var time = new Date().getTime(); 15422 15423 return { 15424 track: function(dataLayer, category, variable, label) 15425 { 15426 T.timingValue = (new Date().getTime()) - time; 15427 15428 if (category) 15429 { 15430 T.timingCategory = category; 15431 } 15432 15433 if (variable) 15434 { 15435 T.timingVar = variable; 15436 } 15437 15438 if (label) 15439 { 15440 T.timingLabel = label; 15441 } 15442 15443 /** 15444 * Track time 15445 */ 15446 dataLayer.push(T); 15447 }, 15448 trackContinue: function(dataLayer, category, variable, label) 15449 { 15450 this.track(dataLayer, category, variable, label); 15451 15452 /** 15453 * Reset time 15454 */ 15455 time = new Date().getTime(); 15456 } 15457 } 15458 })(), 15459 Queue: (function() 15460 { 15461 return { 15462 queue: [], 15463 impressions: function(data) 15464 { 15465 if (AEC.Const.Viewport) 15466 { 15467 jQuery(window).on( 15468 { 15469 load: function() 15470 { 15471 AEC.Queue.bind(data); 15472 } 15473 }); 15474 } 15475 else 15476 { 15477 dataLayer.push(data); 15478 } 15479 15480 return this; 15481 }, 15482 bind: function(data) 15483 { 15484 (function(queue, impressions) 15485 { 15486 jQuery.each(impressions, function(index, impression) 15487 { 15488 queue.push(impression); 15489 }); 15490 15491 })(this.queue, data.ecommerce.impressions); 15492 15493 if (this.queue.length) 15494 { 15495 (function(Queue, $) 15496 { 15497 var scroll = function() 15498 { 15499 var items = 15500 { 15501 noticeable: $.grep(Queue.queue, function(element, index) 15502 {
15503 return Queue.isOnScreen($('[data-id="' + element.id + '"][data-event=productClick]')); 15504 }), 15505 concealed: $.grep(Queue.queue, function(element, index) 15506 { 15507 return !Queue.isOnScreen($('[data-id="' + element.id + '"][data-event=productClick]')); 15508 }) 15509 }; 15510 15511 if (items.noticeable.length) 15512 { 15513 /** 15514 * Set event 15515 */ 15516 data.event = 'impression'; 15517 15518 /** 15519 * Update impressions event 15520 */ 15521 data.ecommerce.impressions = items.noticeable; 15522 15523 /** 15524 * Push item to dataLayer 15525 */ 15526 dataLayer.push(data); 15527 } 15528 15529 if (items.concealed.length) 15530 { 15531 Queue.queue = items.concealed; 15532 } 15533 else 15534 { 15535 /** 15536 * Empty queue 15537 */ 15538 Queue.queue = []; 15539 15540 /** 15541 * Remove scroll listener 15542 */ 15543 $(window).off('scroll.ec'); 15544 } 15545 }; 15546 15547 $(window).on('scroll.ec',scroll).trigger('scroll'); 15548 15549 })(this, jQuery); 15550 } 15551 }, 15552 isOnScreen: function(element) 15553 { 15554 /** 15555 * Default viewport 15556 */ 15557 var viewport = 15558 { 15559 top: 0, bottom: 0 15560 }; 15561 15562 /** 15563 * Check if element exists 15564 */ 15565 if ('undefined' === typeof element) 15566 { 15567 return false; 15568 } 15569 15570 /** 15571 * Get top 15572 */ 15573 viewport.top = jQuery(window).scrollTop(); 15574 15575 /** 15576 * Get bottom 15577 */ 15578 viewport.bottom = viewport.top + jQuery(window).height(); 15579 15580 /** 15581 * Get bounds 15582 */ 15583 var bounds = {}, offset = element.offset(); 15584 15585 if ('undefined' === typeof offset) 15586 { 15587 return false; 15588 } 15589 15590 if (offset == null) 15591 { 15592 return false; 15593 } 15594 15595 if (!offset.hasOwnProperty('top')) 15596 { 15597 return false; 15598 } 15599 15600 /** 15601 * Get bounds top 15602 */ 15603 bounds.top = element.offset().top; 15604 15605 /** 15606 * Get bounds bottom 15607 */ 15608 bounds.bottom = bounds.top + element.outerHeight(); 15609 15610 return ((bounds.top <= viewport.bottom) && (bounds.bottom >= viewport.top)); 15611 } 15612 } 15613 })(), 15614 Cookie: (function() //This is an experimental feature to overcome FPC (Full Page Cache) related issues (beta) 15615 { 15616 return { 15617 data: null, 15618 privateData: null, 15619 push: function(dataLayer) 15620 { 15621 if (this.data) 15622 { 15623 /** 15624 * Push data 15625 */ 15626 dataLayer.push(this.data); 15627 15628 /** 15629 * Reset data to prevent further push 15630 */ 15631 this.data = null; 15632 } 15633 15634 return this; 15635 }, 15636 pushPrivate: function() 15637 { 15638 var data = this.getPrivateData(); 15639 15640 if (data) 15641 { 15642 dataLayer.push( 15643 { 15644 privateData: data 15645 }); 15646 } 15647 15648 return this; 15649 }, 15650 visitor: function(data) 15651 { 15652 /** 15653 * Set data 15654 */ 15655 this.data = data; 15656 15657 return this; 15658 }, 15659 detail: function(data) 15660 { 15661 this.data = data; 15662 15663 return this; 15664 }, 15665 purchase: function(data) 15666 { 15667 this.data = data; 15668 15669 return this; 15670 }, 15671 impressions: function(data) 15672 { 15673 this.data = data; 15674 15675 return this; 15676 }, 15677 checkout: function(data) 15678 { 15679 this.data = data; 15680 15681 return this; 15682 }, 15683 promotion: function(data) 15684 { 15685 this.data = data; 15686 15687 return this; 15688 }, 15689 promotionClick: function(data) 15690 { 15691 this.data = data; 15692 15693 return this; 15694 }, 15695 getPrivateData: function() 15696 { 15697 if (!this.privateData) 15698 { 15699 var cookie = this.get('privateData'); 15700 15701 if (cookie) 15702 { 15703 this.privateData = this.parse(cookie); 15704 } 15705 } 15706 15707 return this.privateData; 15708 }, 15709 get: function(name) 15710 { 15711 var start = document.cookie.indexOf(name + "="), len = start + name.length + 1; 15712 15713 if ((!start) && (name != document.cookie.substring(0, name.length))) 15714 { 15715 return null; 15716 } 15717 15718 if (start == -1) 15719 { 15720 return null; 15721 } 15722 15723 var end = document.cookie.indexOf(String.fromCharCode(59), len); 15724 15725 if (end == -1) 15726 { 15727 end = document.cookie.length; 15728 } 15729 15730 return decodeURIComponent(document.cookie.substring(len, end)); 15731 }, 15732 remove: function(name) 15733 { 15734 document.cookie = name + "=" + "; path=/; expires=" + (new Date(0)).toUTCString(); 15735 15736 return this; 15737 }, 15738 parse: function(json) 15739 { 15740 var json = decodeURIComponent(json.replace(/\+/g, ' ')); 15741 15742 return JSON.parse(json); 15743 }, 15744 Storage: (function(cookie) //@todo: Replace Cookie with localStorage 15745 { 15746 return { 15747 set: function(property, value) 15748 { 15749 if ('undefined' !== typeof(Storage)) 15750 { 15751 localStorage.setItem(property, JSON.stringify(value)); 15752 } 15753 15754 return this; 15755 15756 }, 15757 get: function(property) 15758 { 15759 if ('undefined' !== typeof(Storage)) 15760 { 15761 return JSON.parse(localStorage.getItem(property)); 15762 } 15763 15764 return null; 15765 } 15766 } 15767 })(this) 15768 } 15769 })(), 15770 CookieConsent: (function() 15771 { 15772 return { 15773 support: false, 15774 granted: false, 15775 chain: [], 15776 queue: function(callback) 15777 { 15778 this.chain.push(callback); 15779 15780 return this; 15781 }, 15782 dispatch: function(consent) 15783 { 15784 this.granted = true; 15785 15786 dataLayer.push(consent); 15787 15788 return this.process(); 15789 }, 15790 process: function() 15791 { 15792 if (this.granted) 15793 { 15794 for (i = 0, l = this.chain.length; i < l; i++) 15795 { 15796 this.chain[i].apply(this,[]); 15797 } 15798 15799 /** 15800 * Reset chain 15801 */ 15802 this.chain = []; 15803 } 15804 15805 return this; 15806 } 15807 } 15808 })(), 15809 convert: function(content) 15810 { 15811 if ('undefined' !== typeof content && '' !== content && -1 !== content.toString().indexOf('&')) 15812 { 15813 if (null == this.textarea) 15814 { 15815 this.textarea = jQuery('<textarea/>'); 15816 } 15817 15818 return this.textarea.html(content).text(); 15819 } 15820 15821 return content; 15822 }, 15823 getClientId: function() 15824 { 15825 if ('undefined' !== typeof ga) 15826 { 15827 return ga.getAll()[0].get('clientId'); 15828 } 15829 }, 15830 parseJSON: function(content) 15831 { 15832 if ('object' === typeof content) 15833 { 15834 return content; 15835 } 15836 15837 if ('string' === typeof content) 15838 { 15839 try 15840 { 15841 return JSON.parse(content); 15842 } 15843 catch (e){} 15844 } 15845 15846 return {}; 15847 } 15848}; 15849 15850var GOOGLE_PAYLOAD_SIZE = 8192; 15851 15852/** 15853 * Calculate payload size (approx.) 15854 * 15855 * @return int bytes 15856 */ 15857var getPayloadSize = function(object) 15858{ 15859 var objects = [object]; 15860 var size = 0; 15861 15862 for (var index = 0; index < objects.length; index++) 15863 { 15864 switch (typeof objects[index]) 15865 { 15866 case 'boolean': 15867 size += 4; 15868 break; 15869 case 'number': 15870 size += 8; 15871 break; 15872 case 'string': 15873 size += 2 * objects[index].length; 15874 break; 15875 case 'object': 15876 if (Object.prototype.toString.call(objects[index]) != '[object Array]') 15877 { 15878 for (var key in objects[index]) size += 2 * key.length; 15879 } 15880 for (var key in objects[index]) 15881 { 15882 var processed = false; 15883 15884 for (var search = 0; search < objects.length; search++) 15885 { 15886 if (objects[search] === objects[index][key]) { 15887 processed = true; 15888 break; 15889 } 15890 } 15891 if (!processed) objects.push(objects[index][key]); 15892 } 15893 } 15894 } 15895 return size; 15896}; 15897 15898/** 15899 * Chunk payload 15900 */
15901var getPayloadChunks = function(arr, len) 15902{ 15903 var chunks = [],i = 0, n = arr.length; 15904 15905 while (i < n) 15906 { 15907 chunks.push(arr.slice(i, i += len)); 15908 } 15909 15910 return chunks; 15911}; 15912var Downloads = Class.create(); 15913Downloads.prototype = { 15914 15915 initialize: function(countUrlTemplate){ 15916 this.countUrlTemplate = countUrlTemplate; 15917 this.initObservers(); 15918 }, 15919 15920 initObservers:function() 15921 { 15922 document.observe('dom:loaded', function(e){ 15923 $$('.downloads-item .item-link a').each(function(el){ 15924 el.observe('click', function(event){ 15925 url = downloads.countUrlTemplate.replace('%file_id%', el.rel); 15926 downloads.updateCount(url); 15927 }); 15928 }); 15929 }); 15930 }, 15931 15932 postInit: function(){ 15933 this.popup = $('downloads_video_popup'); 15934 this.overlay = $('downloads_video_overlay'); 15935 this.closeButton = $('close_popup'); 15936 15937 this.overlay.observe('click', function(event){ 15938 downloads.close(); 15939 }); 15940 15941 this.closeButton.observe('click', function(event){ 15942 downloads.close(); 15943 }); 15944 15945 width = window.innerWidth || document.documentElement.clientWidth; 15946 posLeft = (width - $('downloads_video_popup').getWidth()) / 2; 15947 posLeft += 'px'; 15948 posTop = '30%'; 15949 this.popup.setStyle({left: posLeft, top: posTop}); 15950 15951 this.overlay.hide(); 15952 this.popup.hide(); 15953 }, 15954 15955 showSpinner: function(){ 15956 $('dl-spinner').addClassName('spin'); 15957 $('dl_video_content').hide(); 15958 }, 15959 15960 hideSpinner: function(){ 15961 $('dl-spinner').removeClassName('spin'); 15962 $('dl_video_content').show(); 15963 }, 15964 15965 openVideo:function(url,title,params){ 15966 this.overlay.show(); 15967 this.popup.show(); 15968 this.showSpinner(); 15969 new Ajax.Request(url,{ 15970 method: 'post', 15971 parameters: params, 15972 onSuccess:function(transport){ 15973 response = new String(transport.responseText); 15974 downloads.hideSpinner(); 15975 $('dl_video_title').update('<h2>' + title + '</h2>'); 15976 $('dl_video').update(response); 15977 } 15978 }); 15979 }, 15980 15981 openFile:function(linkUrl, newTab){ 15982 if(newTab){ 15983 window.open( 15984 linkUrl, 15985 '_blank' 15986 ); 15987 } else { 15988 setLocation(linkUrl); 15989 } 15990 }, 15991 15992 updateCount: function(requestUrl){ 15993 new Ajax.Request(requestUrl,{ 15994 method: 'post', 15995 onSuccess:function(transport){ 15996 15997 } 15998 }); 15999 }, 16000 16001 close:function(){ 16002 this.overlay.hide(); 16003 this.popup.hide(); 16004 $('dl_video').update(''); 16005 } 16006}; 16007function processStockNotify(product_name, product_url, notify_url, product_id) { 16008 if(product_id) { 16009 var customer_email = document.getElementById('notify_customer_email_'+product_id).value; 16010 var customer_name = document.getElementById('notify_customer_name_'+product_id).value; 16011 var parent_id = document.getElementById('product_option_id_'+product_id).value; 16012 document.getElementById('mm-stocknotify-message-'+product_id).style.display = 'none'; 16013 document.getElementById('mm-stocknotify-ajax-'+product_id).style.display = 'block'; 16014 response = processRequest(product_id, product_name, product_url, notify_url, customer_name, customer_email, parent_id, 1); 16015 } else { 16016 var customer_email = document.getElementById('notify_customer_email').value; 16017 var customer_name = document.getElementById('notify_customer_name').value; 16018 var product_id = document.getElementById('product_id').value; 16019 var parent_id = document.getElementById('product_option_id').value; 16020 document.getElementById('mm-stocknotify-message').style.display = 'none'; 16021 document.getElementById('mm-stocknotify-ajax').style.display = 'block'; 16022 response = processRequest(product_id, product_name, product_url, notify_url, customer_name, customer_email, parent_id, 0); 16023 } 16024} 16025 16026function processRequest(product_id, product_name, product_url, notify_url, customer_name, customer_email, parent_id, multiple) { 16027 16028 var xmlhttp; 16029 16030 if(window.XMLHttpRequest) { 16031 xmlhttp=new XMLHttpRequest(); 16032 } else { 16033 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 16034 } 16035 16036 xmlhttp.onreadystatechange = function() { 16037 if(xmlhttp.readyState==4 && xmlhttp.status==200) { 16038 var response = xmlhttp.responseText; 16039 response = response.replace(/^\s+|\s+$/g, ''); 16040 if(response) { 16041 if(multiple) { 16042 document.getElementById('mm-stocknotify-message-'+product_id).innerHTML= response; 16043 document.getElementById('mm-stocknotify-message-'+product_id).style.display = 'block'; 16044 document.getElementById('mm-stocknotify-message-'+product_id).style.color = 'green'; 16045 document.getElementById('mm-stocknotify-ajax-'+product_id).style.display = 'none'; 16046 } else { 16047 document.getElementById('mm-stocknotify-message').innerHTML= response; 16048 document.getElementById('mm-stocknotify-message').style.display = 'block'; 16049 document.getElementById('mm-stocknotify-message').style.color = 'green'; 16050 document.getElementById('mm-stocknotify-ajax').style.display = 'none'; 16051 } 16052 } 16053 } 16054 } 16055 16056 process_url = notify_url+'?product_id='+product_id+'&product_name='+product_name+'&product_url='+product_url+'&customer_name='+customer_name+'&customer_email='+customer_email+'&parent_id='+parent_id; 16057 xmlhttp.open("GET",process_url,true); 16058 xmlhttp.send(); 16059} 16060var EasyTabs = Class.create(); 16061EasyTabs.prototype = { 16062 tpl: { 16063 tab : '(.+)?', 16064 href : '#product_tabs_(.+)?', 16065 content: 'product_tabs_(.+)?_contents' 16066 }, 16067 config: { 16068 tabs : '.easytabs-anchor', 16069 container: '#easytabs', 16070 trackHashValue: true, 16071 scrollSpeed: 0.5, 16072 scrollOffset: -5 16073 }, 16074 container : false, 16075 16076 /** 16077 * Tabs that are active at this moment 16078 * Multiple tabs allowed in accordion mode 16079 * 16080 * @type {Array} 16081 */ 16082 activeTabs: [], 16083 16084 /** 16085 * Activity counters 16086 * { 16087 * tab_id: activation_count, 16088 * ... 16089 * } 16090 * 16091 * @type {Object} 16092 */ 16093 counters: {}, 16094 16095 initialize: function(options) { 16096 Object.extend(this.config, options || {}); 16097 this.container = $$(this.config.container).first(); 16098 16099 if (this.config.trackHashValue && window.location.hash.length > 1) { 16100 this.activate(this.getTabByHref(window.location.hash), true); 16101 Event.observe(window, "load", function() { 16102 this.activate(this.getTabByHref(window.location.hash), true); 16103 }.bind(this)); 16104 } 16105 16106 Event.observe(window, "hashchange", function() { 16107 var href = window.location.hash; 16108 if (href.length <= 1) { 16109 var first = this.container.down(this.config.tabs); 16110 href = first.href || first.readAttribute('data-href'); 16111 } else { 16112 if (-1 === href.indexOf('#product_tabs_')) { 16113 return; 16114 } 16115 } 16116 this.deactivate(); 16117 this.activate(this.getTabByHref(href)); 16118 }.bind(this)); 16119 16120 if (!this.activeTabs.length) { 16121 var first = this.container.down(this.config.tabs); 16122 if ('undefined' !== typeof first) { 16123 this.activate(this.getTabByHref(first.href || first.readAttribute('data-href'))); 16124 } 16125 } 16126 16127 $$(this.config.tabs).each(function(el ,i) { 16128 el.observe('click', this.onclick.bind(this, el)); 16129 16130 var id = $(el).getAttribute('data-href'); 16131 if (!id) { 16132 return; 16133 } 16134 $$(id + '_contents .pages a').each(function(_el){ 16135 if (-1 == _el.href.indexOf("#") 16136 && -1 !== _el.href.indexOf(window.location.host)) { 16137 16138 _el.href = _el.href + id; 16139 } 16140 }); 16141 }.bind(this)); 16142 }, 16143 16144 /** 16145 * @param {String} tab Tab to activate 16146 * @param {Boolean} scroll lag to indicate that page should be scrolled to the tab 16147 * @return {String|false} Activated tab of false if tab wasn't found 16148 */ 16149 activate: function(tab, scroll, animate) { 16150 var content = $(this.tpl.content.replace(this.tpl.tab, tab)); 16151 if (!content) { 16152 return false;
16153 } 16154 16155 document.fire('easytabs:beforeActivate', { 16156 'tab' : tab, 16157 'content' : content, 16158 'easytabs': this 16159 }); 16160 16161 this._updateCounter(tab); 16162 content.addClassName('active'); 16163 content.show(); 16164 16165 if (-1 === this.activeTabs.indexOf(tab)) { 16166 this.activeTabs.push(tab); 16167 } 16168 16169 var href = this.tpl.href.replace(this.tpl.tab, tab), 16170 tabs = this.container.select( 16171 this.config.tabs + '[href="' + href + '"]', 16172 this.config.tabs + '[data-href="' + href + '"]' 16173 ); 16174 16175 tabs.each(function(a) { 16176 a.addClassName('active'); 16177 var parentLi = a.up('li'); 16178 parentLi && parentLi.addClassName('active'); 16179 }); 16180 16181 if (scroll) { 16182 var visibleTab = tabs.detect(function(el) { 16183 return el.getStyle('display') !== 'none'; 16184 }); 16185 if (visibleTab) { 16186 Effect.ScrollTo(visibleTab, { 16187 duration: animate ? this.config.scrollSpeed : 0, 16188 offset: this.config.scrollOffset 16189 }); 16190 } 16191 } 16192 16193 document.fire('easytabs:afterActivate', { 16194 'tab' : tab, 16195 'content' : content, 16196 'easytabs': this 16197 }); 16198 16199 return tab; 16200 }, 16201 16202 /** 16203 * @param {String} tab Tab to deactivate 16204 * @return {String|false} Last deactivated tab or false if tab not found 16205 */ 16206 deactivate: function(tab) { 16207 if (!tab) { 16208 while (this.activeTabs.length) { 16209 this.deactivate(this.activeTabs[0]); 16210 } 16211 return tab; 16212 } 16213 16214 var index = this.activeTabs.indexOf(tab); 16215 if (index > -1) { 16216 this.activeTabs.splice(index, 1); 16217 } 16218 16219 var content = $(this.tpl.content.replace(this.tpl.tab, tab)); 16220 if (!content) { 16221 return false; 16222 } 16223 16224 document.fire('easytabs:beforeDeactivate', { 16225 'tab' : tab, 16226 'content' : content, 16227 'easytabs': this 16228 }); 16229 16230 content.removeClassName('active'); 16231 content.hide(); 16232 16233 var href = this.tpl.href.replace(this.tpl.tab, tab), 16234 tabs = this.container.select( 16235 this.config.tabs + '[href="' + href + '"]', 16236 this.config.tabs + '[data-href="' + href + '"]' 16237 ); 16238 16239 tabs.each(function(a) { 16240 a.removeClassName('active'); 16241 var parentLi = a.up('li'); 16242 parentLi && parentLi.removeClassName('active'); 16243 }); 16244 16245 document.fire('easytabs:afterDeactivate', { 16246 'tab' : tab, 16247 'content' : content, 16248 'easytabs': this 16249 }); 16250 16251 return tab; 16252 }, 16253 16254 /** 16255 * @param {Object} el Element 16256 * @param {Object} e Event 16257 * @param {String} tab Tab to activate 16258 * @param {Boolean} scroll Flag to indicate that page should be scrolled to the tab 16259 */ 16260 onclick: function(el, e, tab, scroll, animate) { 16261 var isAccordion = false, 16262 accordionTrigger = $$('.easytabs-a-accordion').first(); 16263 if (accordionTrigger) { 16264 // accordion tabs are hidden for desktop 16265 isAccordion = (accordionTrigger.getStyle('display') !== 'none'); 16266 } 16267 16268 tab = tab || this.getTabByHref(el.href || el.readAttribute('data-href')); 16269 scroll = scroll || el.hasClassName('easytabs-scroll'); 16270 animate = animate || el.hasClassName('easytabs-animate'); 16271 if (isAccordion) { 16272 if (el.hasClassName('active')) { 16273 this.deactivate(tab); 16274 } else { 16275 this.activate(tab, scroll, animate); 16276 } 16277 } else { 16278 this.deactivate(); 16279 this.activate(tab, scroll, animate); 16280 } 16281 }, 16282 16283 /** 16284 * Retrieve tab name from the url 16285 * 16286 * @param {String} href 16287 */ 16288 getTabByHref: function(href) { 16289 var tab = href.match(this.tpl.href + '$'); 16290 if (!tab) { 16291 return false;
vendor: 5,073 bytes, lines 16292-16324
16292 } 16293 return tab[1]; 16294 }, 16295 16296 /** 16297 * Update activation counter 16298 * 16299 * @param {String} tab 16300 * @return void 16301 */ 16302 _updateCounter: function(tab) { 16303 if (!this.counters[tab]) { 16304 this.counters[tab] = 0; 16305 } 16306 this.counters[tab]++; 16307 }, 16308 16309 /** 16310 * Retreive activation count for specified tab 16311 * 16312 * @param {String} tab 16313 * @return {Integer} 16314 */ 16315 getActivationCount: function(tab) { 16316 if (!this.counters[tab]) { 16317 this.counters[tab] = 0; 16318 } 16319 return this.counters[tab]; 16320 } 16321}; 16322 16323/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ 16324!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=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.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(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.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||m.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&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.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,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s
vendor: 18,080 bytes, line 16324
16324=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=ha(),z=ha(),A=ha(),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=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),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")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=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)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){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 ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(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 ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(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 pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.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.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);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 p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' 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(".#.+[+~]")}),ja(function(a){var b=g.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=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.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===g||a.ownerDocument===v&&t(v,a)?-1:b===g||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,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||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 ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.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},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.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=ga.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=ga.selectors={cacheLength:50,createPseudo:ia,match:X,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(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===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]||ga.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]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.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(ca,da).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=ga.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(Q," ")+" ").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;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(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:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(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:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).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 Z.test(a.nodeName)},input:function(a){return Y.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:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(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]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.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=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[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?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(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=[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(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(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 ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(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 wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(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=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(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=[sa(ta(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 wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.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(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.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(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")}
vendor: 16,844 bytes, lines 16324-16326
16324)||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(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}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(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&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.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=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; 16325 16326return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.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()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.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=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.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 m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.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=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(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},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.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?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{}
vendor: 1,726 bytes, line 16326
16326,e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!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&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>
vendor: 54,827 bytes, lines 16326-16327
16326=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget 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,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ca()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ca()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?aa:ba):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=aa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=aa,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=aa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!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 m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=ba;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(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=ba),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function da(a){var b=ea.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var ea="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fa=/ jQuery\d+="(?:null|\d+)"/g,ga=new RegExp("<(?:"+ea+")[\\s/>]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/<tbody/i,la=/<|&#?\w+;/,ma=/<(?:script|style|link)/i,na=/checked\s*(?:[^=]|=\s*.checked.)/i,oa=/^$|\/(?:java|ecma)script/i,pa=/^true\/(.*)/,qa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ra={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:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._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++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.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)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?"<table>"!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.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 m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ca[0].contentWindow||Ca[0].contentDocument).document,b.write(),b.close(),c=Ea(a,b),Ca.detach()),Da[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(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(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Ga=/^margin/,Ha=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ia,Ja,Ka=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ia=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Ha.test(g)&&Ga.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+""}):y.documentElement.currentStyle&&(Ia=function(a){return a.currentStyle},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ha.test(g)&&!Ka.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 La(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=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};var Ma=/alpha\([^)]*\)/i,Na=/opacity\s*=\s*([^)]*)/,Oa=/^(none|table(?!-c[ea]).+)/,Pa=new RegExp("^("+S+")(.*)$","i"),Qa=new RegExp("^([+-])=("+S+")","i"),Ra={position:"absolute",visibility:"hidden",display:"block"},Sa={letterSpacing:"0",fontWeight:"400"},Ta=["Webkit","O","Moz","ms"];function Ua(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ta.length;while(e--)if(b=Ta[e]+c,b in a)return b;return d}function Va(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fa(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.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 Wa(a,b,c){var d=Pa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xa(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+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Ya(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ia(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Ja(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ha.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xa(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ja(a,"opacity");return""===c?"1":c}}}},cssNumber:{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":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ua(i,h)),g=m.cssHooks[b]||m.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=Qa.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.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=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ua(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Ja(a,b,d)),"normal"===f&&b in Sa&&(f=Sa[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Oa.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Ra,function(){return Ya(a,b,d)}):Ya(a,b,d):void 0},set:function(a,c,d){var e=d&&Ia(a);return Wa(a,c,d?Xa(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Na.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=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Ma,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Ma.test(f)?f.replace(Ma,e):f+" "+e)}}),m.cssHooks.marginRight=La(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Ja,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Ga.test(a)||(m.cssHooks[a+b].set=Wa)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ia(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Va(this,!0)},hide:function(){return Va(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Za(a,b,c,d,e){ 16327return new Za.prototype.init(a,b,c,d,e)}m.Tween=Za,Za.prototype={constructor:Za,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Za.propHooks[this.prop];return a&&a.get?a.get(this):Za.propHooks._default.get(this)},run:function(a){var b,c=Za.propHooks[this.prop];return this.options.duration?this.pos=b=m.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):Za.propHooks._default.set(this),this}},Za.prototype.init.prototype=Za.prototype,Za.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Za.propHooks.scrollTop=Za.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Za.prototype.init,m.fx.step={};var $a,_a,ab=/^(?:toggle|show|hide)$/,bb=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cb=/queueHooks$/,db=[ib],eb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bb.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bb.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fb(){return setTimeout(function(){$a=void 0}),$a=m.now()}function gb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hb(a,b,c){for(var d,e=(eb[b]||[]).concat(eb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.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=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fa(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fa(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.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],ab.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]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fa(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hb(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.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 kb(a,b,c){var d,e,f=0,g=db.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$a||fb(),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:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$a||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.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.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);g>f;f++)if(d=db[f].call(j,a,k,j.opts))return d;return m.map(k,hb,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.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)}m.Animation=m.extend(kb,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],eb[c]=eb[c]||[],eb[c].unshift(b)},prefilter:function(a,b){b?db.unshift(a):db.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kb(this,m.extend({},a),f);(e||m._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=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cb.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)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.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})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),m.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($a=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$a=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_a||(_a=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_a),_a=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lb=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lb,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},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||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mb,nb,ob=m.expr.attrHandle,pb=/^(?:checked|selected)$/i,qb=k.getSetAttribute,rb=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nb:mb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rb&&qb||!pb.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qb?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nb={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rb&&qb||!pb.test(c)?a.setAttribute(!qb&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ob[b]||m.find.attr;ob[b]=rb&&qb||!pb.test(b)?function(a,b,d){var e,f;return d||(f=ob[b],ob[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,ob[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rb&&qb||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mb&&mb.set(a,b,c)}}),qb||(mb={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}},ob.id=ob.name=ob.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mb.set},m.attrHooks.contenteditable={set:function(a,b,c){mb.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sb=/^(?:input|select|textarea|button|object)$/i,tb=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.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=m.find.attr(a,"tabindex");return b?parseInt(b,10):sb.test(a.nodeName)||tb.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var ub=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ub," ").indexOf(b)>=0)return!0;return!1}}),m.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){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},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)}});var vb=m.now(),wb=/\?/,xb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yb,zb,Ab=/#.*$/,Bb=/([?&])_=[^&]*/,Cb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Db=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Eb=/^(?:GET|HEAD)$/,Fb=/^\/\//,Gb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hb={},Ib={},Jb="*/".concat("*");try{zb=location.href}catch(Kb){zb=y.createElement("a"),zb.href="",zb=zb.href}yb=Gb.exec(zb.toLowerCase())||[];function Lb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.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 Mb(a,b,c,d){var e={},f=a===Ib;function g(h){var i;return e[h]=!0,m.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 Nb(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Ob(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 Pb(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}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zb,type:"GET",isLocal:Db.test(yb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nb(Nb(a,m.ajaxSettings),b):Nb(m.ajaxSettings,a)},ajaxPrefilter:Lb(Hb),ajaxTransport:Lb(Ib),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cb.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zb)+"").replace(Ab,"").replace(Fb,yb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gb.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yb[1]&&c[2]===yb[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yb[3]||("http:"===yb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mb(Hb,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Eb.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wb.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bb.test(e)?e.replace(Bb,"$1_="+vb++):e+(wb.test(e)?"&":"?")+"_="+vb++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jb+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mb(Ib,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Ob(k,v,c)),u=Pb(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(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 this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/^(?:submit|button|image|reset|file)$/i,Ub=/^(?:input|select|textarea|keygen)/i;function Vb(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rb.test(a)?d(a,e):Vb(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vb(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vb(c,a[c],b,e);return d.join("&").replace(Qb,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Ub.test(this.nodeName)&&!Tb.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zb()||$b()}:Zb;var Wb=0,Xb={},Yb=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xb)Xb[a](void 0,!0)}),k.cors=!!Yb&&"withCredentials"in Yb,Yb=k.ajax=!!Yb,Yb&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xb[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xb[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zb(){try{return new a.XMLHttpRequest}catch(b){}}function $b(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.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||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _b=[],ac=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_b.pop()||m.expando+"_"+vb++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ac.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ac.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ac,"$1"+e):b.jsonp!==!1&&(b.url+=(wb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_b.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bc=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bc)return bc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cc=a.document.documentElement;function dc(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.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,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dc(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"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cc;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cc})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=La(k.pixelPosition,function(a,c){return c?(c=Ja(a,b),Ha.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.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?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ec=a.jQuery,fc=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fc),b&&a.jQuery===m&&(a.jQuery=ec),m},typeof b===K&&(a.jQuery=a.$=m),m});
vendor: 2,323 bytes, lines 16328-16334
16328jQuery.noConflict(); 16329/*! jQuery UI - v1.11.4 - 2015-03-11 16330* http://jqueryui.com 16331* Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js 16332* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ 16333 16334(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/^(input|select|textarea|button|object)$/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function n(){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","Frid
vendor: 12,117 bytes, line 16334
16334ay","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},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent()[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.4",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}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return a?this.each(function(){var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):(o.length&&(n=e.widget.extend.apply(null,[n].concat(o))),this.each(function(){var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init()):e.data(this,s,new i(n,this))})),r}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var d=!1;e(document).mouseup(function(){d=!1}),e.widget("ui.mouse",{version:"1.11.4
vendor: 6,230 bytes, line 16334
16334",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:a?e.position.scrollbarWidth():0,height:n?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s||n?i.width():i.outerWidth(),height:s||n?i.height():i.outerHeight()}}},e.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=e.extend({},n);var p,m,g,v,y,b,_=e(n.of),x=e.position.getWithinInfo(n.within),w=e.position.getScrollInfo(x),k=(n.collision||"flip").split(" "),T={};return b=s(_),_[0].preventDefault&&(n.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,t,i=(n[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),T[this]=[e?e[0]:0,t?t[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===n.at[0]?y.left+=m:"center"===n.at[0]&&(y.left+=m/2),"bottom"===n.at[1]?y.top+=g:"center"===n.at[1]&&(y.top+=g/2),p=t(T.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function(){var s,l,u=e(this),d=u.outerWidth(),c=u.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),D=d+f+i(this,"marginRight")+w.width,S=c+b+i(this,"marginBottom")+w.height,M=e.extend({},y),C=t(T.my,u.outerWidth(),u.outerHeight());"right"===n.my[0]?M.left-=d:"center"===n.my[0]&&(M.left-=d/2),"bottom"===n.my[1]?M.top-=c:"center"===n.my[1]&&(M.top-=c/2),M.left+=C[0],M.top+=C[1],a||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[k[t]]&&e.ui.position[k[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:D,collisionHeight:S,offset:[p[0]+C[0],p[1]+C[1]],my:n.my,at:n.at,within:x,elem:u})}),n.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,a=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>
vendor: 7,605 bytes, line 16334
16334a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.accordion",{version:"1.11.4",options:{active:0,animate:{},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 t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,n=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),s=t.next(),n=s.uniqueId().attr("id");t.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?(t=n.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.
vendor: 4,829 bytes, lines 16334-16335
16334css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_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(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?e():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:o?e():n,newPanel:r};t.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?e():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),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(e(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,t,i){var s,n,a,o=this,r=0,h=e.css("box-sizing"),l=e.length&&(!t.length||e.index()<t.index()),u=this.options.animate||{},d=l&&u.down||u,c=function(){o._toggleComplete(i)};return"number"==typeof d&&(a=d),"string"==typeof d&&(n=d),n=n||d.easing||u.easing,a=a||d.duration||u.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(this.hideProps,{duration:a,easing:n,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:a,easing:n,complete:c,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==o.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-r),r=0)}}),void 0):t.animate(this.hideProps,a,n,c):e.animate(this.showProps,a,n,c)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).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(t){if(!this.previousFilter){var i=e(t.currentTarget); 16335i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)}
vendor: 5,385 bytes, line 16335
16335)},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var i,s,n,a,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,s=this.previousFilter||"",n=String.fromCharCode(t.keyCode),a=!1,clearTimeout(this.filterTimer),n===s?a=!0:n=s+n,i=this._filterMenuItems(n),i=a&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(t.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(t,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,n=this.options.icons.submenu,a=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),a.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),s=e("<span>").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=a.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset().top-this.activeMenu.offset().top-i-s,a=this.activeMenu.scrollTop(),o=this.activeMenu.height(),r=t.outerHeight(),0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","fal
vendor: 24,112 bytes, line 16335
16335se").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},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(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]()),this.focus(i,s)},nextPage:function(t){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=e(this),0>i.offset().top-s-n}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){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=e(this),i.offset().top-s+n>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)},_filterMenuItems:function(t){var i=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(e.trim(e(this).text()))})}}),e.widget("ui.autocomplete",{version:"1.11.4",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 t,i,s,n=this.element[0].nodeName.toLowerCase(),a="textarea"===n,o="input"===n;this.isMultiLine=a?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[a||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var a=e.ui.keyCode;switch(n.keyCode){case a.PAGE_UP:t=!0,this._move("previousPage",n);break;case a.PAGE_DOWN:t=!0,this._move("nextPage",n);break;case a.UP:t=!0,this._keyEvent("previous",n);break;case a.DOWN:t=!0,this._keyEvent("next",n);break;case a.ENTER:this.menu.active&&(t=!0,n.preventDefault(),this.menu.select(n));break;case a.TAB:this.menu.active&&this.menu.select(n);break;case a.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(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=e.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(e){return s?(s=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(s){s.target===t.element[0]||s.target===i||e.contains(i,s.target)||t.close()})})},menufocus:function(t,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:n})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&e.trim(s).length&&(this.liveRegion.children().hide(),e("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,s=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,s){s(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,n){s.xhr&&s.xhr.abort(),s.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){n(e)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),i=this.menu.element.is(":visible"),s=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!s)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var s=this;e.each(i,function(e,i){s._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var s=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return s.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var c,p="ui-button ui-widget ui-state-default ui-corner-all",f="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",m=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},g=function(t){var i=t.name,s=t.form,n=e([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?e(s).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),n};e.widget("ui.button",{version:"1.11.4",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,m),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,i=this.options,s="checkbox"===this.type||"radio"===this.type,n=s?"":"ui-state-active";null===i.label&&(i.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(p).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){i.disabled||this===c&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){i.disabled||e(this).removeClass(n)}).bind("click"+this.eventNamespace,function(e){i.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),s&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return i.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(i.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var s=t.element[0];g(s).not(s).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return i.disabled?!1:(e(this).addClass("ui-state-active"),c=this,t.document.one("mouseup",function(){c=null}),void 0)}).bind("mouseup"+this.eventNamespace,function(){return i.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return i.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",i.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(p+" ui-state-active "+f).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton(),void 0)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?g(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(f),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),s=this.options.icons,n=s.primary&&s.secondary,a=[];s.primary||s.secondary?(this.options.text&&a.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(a.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):a.push("ui-button-text-only"),t.addClass(a.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),i=this.element.find(this.options.items),s=i.filter(":ui-button");i.not(":ui-button").button(),s.button("refresh"),this.buttons=i.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.4"}});var v;e.extend(n.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return r(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var s,n,a;s=t.nodeName.toLowerCase(),n="div"===s||"span"===s,t.id||(this.uuid+=1,t.id="dp"+this.uuid),a=this._newInst(e(t),n),a.settings=e.extend({},i||{}),"input"===s?this._connectDatepicker(t,a):n&&this._inlineDatepicker(t,a)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?a(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var s=e(t);i.append=e([]),i.trigger=e([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,"datepicker",i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var s,n,a,o=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),o&&(i.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[r?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&t.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),a=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:a,alt:n,title:n}):e("<button type='button'></button>").addClass(this._triggerClass).html(a?e("<img/>").attr({src:a,alt:n,title:n}):n)),t[r?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,s,n,a=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(i=0,s=0,n=0;e.length>n;n++)e[n].length>i&&(i=e[n].length,s=n);return s},a.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),a.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())),e.input.attr("size",this._formatDate(e,a).length)}},_inlineDatepicker:function(t,i){var s=e(t);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,s,n,a){var o,h,l,u,d,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),r(c.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(c,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,l/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var i,s=e(t),n=e.data(t,"datepicker");s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),v===n&&(v=null))},_enableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,a.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=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,a.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=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,s){var n,a,o,h,l=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),a=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),r(l.settings,n),null!==o&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,o)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),l),this._autoSize(l),this._setDate(l,a),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);
vendor: 4,351 bytes, lines 16335-16336
16335i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,s,n,a=e.datepicker._getInst(t.target),o=!0,r=a.dpDiv.is(".ui-datepicker-rtl");if(a._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),o=!1;break;case 13:return n=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",a.dpDiv),n[0]&&e.datepicker._selectDay(t.target,a.selectedMonth,a.selectedYear,n[0]),i=e.datepicker._get(a,"onSelect"),i?(s=e.datepicker._formatDate(a),i.apply(a.input?a.input[0]:null,[s,a])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,s,n=e.datepicker._getInst(t.target); 16336return e.datepicker._get(n,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(t){var i,s=e.datepicker._getInst(t.target);if(s.input.val()!==s.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,e.datepicker._getFormatConfig(s)),i&&(e.datepicker._setDateFromField(s),e.datepicker._updateAlternate(s),e.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,n,a,o,h,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),n=e.datepicker._get(i,"beforeShow"),a=n?n.apply(t,[t,i]):{},a!==!1&&(r(i.settings,a),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),h={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),h=e.datepicker._checkOffset(i,h,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,v=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);
vendor: 11,237 bytes, line 16336
16336var i,s=this._getNumberOfMonths(t),n=s[1],a=17,r=t.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&t.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),t.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,s){var n=t.dpDiv.outerWidth(),a=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,r=t.input?t.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:e(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?n-o:0,i.left-=s&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=s&&i.top===t.input.offset().top+r?e(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+a>l&&l>a?Math.abs(a+r):0),i},_findPos:function(t){for(var i,s=this._getInst(t),n=this._get(s,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[n?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,s,n,a,o=this._curInst;!o||t&&o!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(o,"showAnim"),s=this._get(o,"duration"),n=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[i]||e.effects[i])?o.dpDiv.hide(i,e.datepicker._get(o,"showOptions"),s,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,a=this._get(o,"onClose"),a&&a.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),s=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==s)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,s){var n=e(t),a=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(a,i+("M"===s?this._get(a,"showCurrentAtPos"):0),s),this._updateDatepicker(a))},_gotoToday:function(t){var i,s=e(t),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(t,i,s){var n=e(t),a=this._getInst(n[0]);a["selected"+("M"===s?"Month":"Year")]=a["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(a),this._adjustDate(n)},_selectDay:function(t,i,s,n){var a,o=e(t);e(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(a=this._getInst(o[0]),a.selectedDay=a.currentDay=e("a",n).html(),a.selectedMonth=a.currentMonth=i,a.selectedYear=a.currentYear=s,this._selectDate(t,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var s,n=e(t),a=this._getInst(n[0]);i=null!=i?i:this._formatDate(a),a.input&&a.input.val(i),this._updateAlternate(a),s=this._get(a,"onSelect"),s?s.apply(a.input?a.input[0]:null,[i,a]):a.input&&a.input.trigger("change"),a.inline?this._updateDatepicker(a):(this._hideDatepicker(),this._lastInput=a.input[0],"object"!=typeof a.input[0]&&a.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,s,n,a=this._get(t,"altField");a&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),s=this._getDate(t),n=this.formatDate(i,s,this._getFormatConfig(t)),e(a).each(function(){e(this).val(n)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,s){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,a,o,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,c=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,v=-1,y=-1,b=!1,_=function(e){var i=t.length>n+1&&t.charAt(n+1)===e;return i&&n++,i},x=function(e){var t=_(e),s="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,n="y"===e?s:1,a=RegExp("^\\d{"+n+","+s+"}"),o=i.substring(h).match(a);if(!o)throw"Missing number at position "+h;return h+=o[0].length,parseInt(o[0],10)},w=function(t,s,n){var a=-1,o=e.map(_(t)?n:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,t){var s=t[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(a=t[0],h+=s.length,!1):void 0}),-1!==a)return a+1;throw"Unknown name at position "+h},k=function(){if(i.charAt(h)!==t.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;t.length>n;n++)if(b)"'"!==t.charAt(n)||_("'")?k():b=!1;else switch(t.charAt(n)){case"d":v=x("d");break;case"D":w("D",d,c);break;case"o":y=x("o");break;case"m":g=x("m");break;case"M":g=w("M",p,f);break;case"y":m=x("y");break;case"@":r=new Date(x("@")),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"!":r=new Date((x("!")-this._ticksTo1970)/1e4),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"'":_("'")?k():b=!0;break;default:k()}if(i.length>h&&(o=i.substr(h),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),y>-1)for(g=1,v=y;;){if(a=this._getDaysInMonth(m,g-1),a>=v)break;g++,v-=a}if(r=this._daylightSavingAdjust(new Date(m,g-1,v)),r.getFullYear()!==m||r.getMonth()+1!==g||r.getDate()!==v)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(e,t,i){if(!t)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>s+1&&e.charAt(s+1)===t;return i&&s++,i},l=function(e,t,i){var s=""+t;if(h(e))for(;i>s.length;)s="0"+s;return s},u=function(e,t,i,s){return h(e)?s[t]:i[t]},d="",c=!1;if(t)for(s=0;e.length>s;s++)if(c)"'"!==e.charAt(s)||h("'")?d+=e.charAt(s):c=!1;else switch(e.charAt(s)){case"d":d+=l("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),n,a);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=l("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),o,r);break;case"y":d+=h("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(s)}return d},_possibleChars:function(e){var t,i="",s=!1,n=function(i){var s=e.length>t+1&&e.charAt(t+1)===i;return s&&t++,s};for(t=0;e.length>t;t++)if(s)"'"!==e.charAt(t)||n("'")?i+=e.charAt(t):s=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),s=e.lastVal=e.input?e.input.val():null,n=this._getDefaultDate(e),a=n,o=this._getFormatConfig(e);try{a=this.parseDate(i,s,o)||n}catch(r){s=t?"":s}e.selectedDay=a.getDate(),e.drawMonth=e.selectedMonth=a.getMonth(),e.drawYear=e.selectedYear=a.getFullYear(),e.currentDay=s?a.getDate():0,e.currentMonth=s?a.getMonth():0,e.currentYear=s?a.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,s){var n=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},a=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,a=n.getFullYear(),o=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":o+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o));break;case"y":case"Y":a+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o))}l=h.exec(i)}return new Date(a,o,r)},o=null==i||""===i?s:"string"==typeof i?a(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return o=o&&"Invalid Date"==""+o?s:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var s=!t,n=e.selectedMonth,a=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),n===e.selectedMonth&&a===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(s?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),s="#"+t.id.replace(/\\\\/g,"\\");
vendor: 16,743 bytes, line 16336
16336t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(s,-i,"M")},next:function(){e.datepicker._adjustDate(s,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(s)},selectDay:function(){return e.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(s,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,s,n,a,o,r,h,l,u,d,c,p,f,m,g,v,y,b,_,x,w,k,T,D,S,M,C,N,A,P,I,H,z,F,E,O,j,W,L=new Date,R=this._daylightSavingAdjust(new Date(L.getFullYear(),L.getMonth(),L.getDate())),Y=this._get(e,"isRTL"),B=this._get(e,"showButtonPanel"),J=this._get(e,"hideIfNoPrevNext"),q=this._get(e,"navigationAsDateFormat"),K=this._getNumberOfMonths(e),V=this._get(e,"showCurrentAtPos"),U=this._get(e,"stepMonths"),Q=1!==K[0]||1!==K[1],G=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),X=this._getMinMaxDate(e,"min"),$=this._getMinMaxDate(e,"max"),Z=e.drawMonth-V,et=e.drawYear;if(0>Z&&(Z+=12,et--),$)for(t=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-K[0]*K[1]+1,$.getDate())),t=X&&X>t?X:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=q?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-U,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,-1,et,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>":J?"":"<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(e,"nextText"),n=q?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z+U,1)),this._getFormatConfig(e)):n,a=this._canAdjustMonth(e,1,et,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>":J?"":"<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>",o=this._get(e,"currentText"),r=this._get(e,"gotoCurrent")&&e.currentDay?G:R,o=q?this.formatDate(o,r,this._getFormatConfig(e)):o,h=e.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(e,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(e,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(Y?"":h)+"</div>":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",w=0;K[0]>w;w++){for(k="",this.maxRows=4,T=0;K[1]>T;T++){if(D=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),S=" ui-corner-all",M="",Q){if(M+="<div class='ui-datepicker-group",K[1]>1)switch(T){case 0:M+=" ui-datepicker-group-first",S=" ui-corner-"+(Y?"right":"left");break;case K[1]-1:M+=" ui-datepicker-group-last",S=" ui-corner-"+(Y?"left":"right");break;default:M+=" ui-datepicker-group-middle",S=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+S+"'>"+(/all|left/.test(S)&&0===w?Y?a:s:"")+(/all|right/.test(S)&&0===w?Y?s:a:"")+this._generateMonthYearHeader(e,Z,et,X,$,w>0||T>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",C=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",x=0;7>x;x++)N=(x+u)%7,C+="<th scope='col'"+((x+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+c[N]+"'>"+p[N]+"</span></th>";for(M+=C+"</tr></thead><tbody>",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),P=(this._getFirstDayOfMonth(et,Z)-u+7)%7,I=Math.ceil((P+A)/7),H=Q?this.maxRows>I?this.maxRows:I:I,this.maxRows=H,z=this._daylightSavingAdjust(new Date(et,Z,1-P)),F=0;H>F;F++){for(M+="<tr>",E=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(z)+"</td>":"",x=0;7>x;x++)O=g?g.apply(e.input?e.input[0]:null,[z]):[!0,""],j=z.getMonth()!==Z,W=j&&!y||!O[0]||X&&X>z||$&&z>$,E+="<td class='"+((x+u+6)%7>=5?" ui-datepicker-week-end":"")+(j?" ui-datepicker-other-month":"")+(z.getTime()===D.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===z.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(W?" "+this._unselectableClass+" ui-state-disabled":"")+(j&&!v?"":" "+O[1]+(z.getTime()===G.getTime()?" "+this._currentClass:"")+(z.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(j&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"'")+"'")+(W?"":" data-handler='selectDay' data-event='click' data-month='"+z.getMonth()+"' data-year='"+z.getFullYear()+"'")+">"+(j&&!v?" ":W?"<span class='ui-state-default'>"+z.getDate()+"</span>":"<a class='ui-state-default"+(z.getTime()===R.getTime()?" ui-state-highlight":"")+(z.getTime()===G.getTime()?" ui-state-active":"")+(j?" ui-priority-secondary":"")+"' href='#'>"+z.getDate()+"</a>")+"</td>",z.setDate(z.getDate()+1),z=this._daylightSavingAdjust(z);M+=E+"</tr>"}Z++,Z>11&&(Z=0,et++),M+="</tbody></table>"+(Q?"</div>"+(K[0]>0&&T===K[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),k+=M}_+=k}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,s,n,a,o,r){var h,l,u,d,c,p,f,m,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",_="";if(a||!g)_+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,_+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!h||u>=s.getMonth())&&(!l||n.getMonth()>=u)&&(_+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+r[u]+"</option>");_+="</select>"}if(y||(b+=_+(!a&&g&&v?"":" ")),!e.yearshtml)if(e.yearshtml="",a||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);return isNaN(t)?c:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=n?Math.min(m,n.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!a&&g&&v?"":" ")+_),b+="</div>"},_adjustInstDate:function(e,t,i){var s=e.drawYear+("Y"===i?t:0),n=e.drawMonth+("M"===i?t:0),a=Math.min(e.selectedDay,this._getDaysInMonth(s,n))+("D"===i?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(s,n,a)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),n=i&&i>t?i:t;return s&&n>s?s:n},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,s){var n=this._getNumberOfMonths(e),a=this._daylightSavingAdjust(new Date(i,s+(0>t?t:n[0]*n[1]),1));return 0>t&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(e,a)},_isInRange:function(e,t){var i,s,n=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),o=null,r=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),o=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||t.getTime()>=n.getTime())&&(!a||t.getTime()<=a.getTime())&&(!o||t.getFullYear()>=o)&&(!r||r>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,s){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var n=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(s,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),n,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new n,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.4",e.datepicker,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.4",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.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(s){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.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"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){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:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.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.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper),n=s?e(i.helper.apply(this.element[0],[t])):"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(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRo
vendor: 4,386 bytes, lines 16336-16337
16336otNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_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 t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width()-this.helperProportions.width-this.margins.left,(e(a).height()||a.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=e(n.containment),s=i[0],s&&(t=/(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),(t?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,(t?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) 16337},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.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:t.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(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(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,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.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-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.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
vendor: 16,253 bytes, line 16337
16337: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.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=e.extend({},i,{item:s.element});s.sortables=[],e(s.options.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,e.each(s.sortables,function(){var e=this;e.isOver?(e.isOver=0,s.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,n))})},drag:function(t,i,s){e.each(s.sortables,function(){var n=!1,a=this;a.positionAbs=s.positionAbs,a.helperProportions=s.helperProportions,a.offset.click=s.offset.click,a._intersectsWith(a.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==a&&this._intersectsWith(this.containerCache)&&e.contains(a.element[0],this.element[0])&&(n=!1),n})),n?(a.isOver||(a.isOver=1,s._parent=i.helper.parent(),a.currentItem=i.helper.appendTo(a.element).data("ui-sortable-item",!0),a.options._helper=a.options.helper,a.options.helper=function(){return i.helper[0]},t.target=a.currentItem[0],a._mouseCapture(t,!0),a._mouseStart(t,!0,!0),a.offset.click.top=s.offset.click.top,a.offset.click.left=s.offset.click.left,a.offset.parent.left-=s.offset.parent.left-a.offset.parent.left,a.offset.parent.top-=s.offset.parent.top-a.offset.parent.top,s._trigger("toSortable",t),s.dropped=a.element,e.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,a.fromOutside=s),a.currentItem&&(a._mouseDrag(t),i.position=a.position)):a.isOver&&(a.isOver=0,a.cancelHelperRemoval=!0,a.options._revert=a.options.revert,a.options.revert=!1,a._trigger("out",t,a._uiHash(a)),a._mouseStop(t,!0),a.options.revert=a.options._revert,a.options.helper=a.options._helper,a.placeholder&&a.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(t),i.position=s._generatePosition(t,!0),s._trigger("fromSortable",t),s.dropped=!1,e.each(s.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,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(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY<n.scrollSensitivity?o.scrollTop=a=o.scrollTop+n.scrollSpeed:t.pageY-s.overflowOffset.top<n.scrollSensitivity&&(o.scrollTop=a=o.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+o.offsetWidth-t.pageX<n.scrollSensitivity?o.scrollLeft=a=o.scrollLeft+n.scrollSpeed:t.pageX-s.overflowOffset.left<n.scrollSensitivity&&(o.scrollLeft=a=o.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(r).scrollTop()<n.scrollSensitivity?a=e(r).scrollTop(e(r).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(r).scrollTop())<n.scrollSensitivity&&(a=e(r).scrollTop(e(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(r).scrollLeft()<n.scrollSensitivity?a=e(r).scrollLeft(e(r).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(r).scrollLeft())<n.scrollSensitivity&&(a=e(r).scrollLeft(e(r).scrollLeft()+n.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var n=s.options;s.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var t=e(this),i=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i,s){var n,a,o,r,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left-s.margins.left,l=h+s.snapElements[c].width,u=s.snapElements[c].top-s.margins.top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top),o&&(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||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top),o&&(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[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,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(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return t[s]>0?!0:(t[s]=1,n=t[s]>0,t[s]=0,n)},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e("<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,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom: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({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".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=e(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||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]=e(this.handles[i]),this._on(this.handles[i],{mousedown:o._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=e(this.handles[i],this.element),a=/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(""),t.css(n,a),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.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var i,s,n,a=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=e(a.containment).scrollLeft()||0,s+=e(a.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:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s,n=this.originalMousePosition,a=this.axis,o=t.pageX-n.left||0,r=t.pageY-n.top||0,h=this._change[a];return this._updatePrevProperties(),h?(i=h.apply(this,[t,o,r]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),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 e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,s,n,a,o=this.options;a={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,n=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),a.maxWidth>i&&(a.maxWidth=i),a.maxHeight>n&&(a.maxHeight=n)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left
vendor: 4,708 bytes, line 16337
16337=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,n=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,a=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),o&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),a&&l&&(e.left=r-t.minWidth),s&&l&&(e.left=r-t.maxWidth),o&&u&&(e.top=h-t.minHeight),n&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],s=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],n=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(s[t],10)||0,i[t]+=parseInt(n[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,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(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,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}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,n,a,o,r,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.c
vendor: 3,104 bytes, line 16337
16337ontainerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,a=h.containerSize.width,o=h._hasScroll(c,"left")?c.scrollWidth:a,r=h._hasScroll(c)?c.scrollHeight:n,h.parentData={element:c,left:s.left,top:s.top,width:o,height:r}))},resize:function(t){var i,s,n,a,o=e(this).resizable("instance"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,d={top:0,left:0},c=o.containerElement,p=!0;c[0]!==document&&/static/.test(c.css("position"))&&(d=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-d.left),u&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?h.top:0),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),i=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-d.left:o.offset.left-h.left)),s=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-d.top:o.offset.top-h.top)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options;e(i.alsoResize).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})},resize:function(t,i){var s=e(this).resizable("instance"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left
vendor: 13,802 bytes, lines 16337-16338
16337:s.position.left-o.left||0};e(n.alsoResize).each(function(){var t=e(this),s=e(this).data("ui-resizable-alsoresize"),n={},a=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(a,function(e,t){var i=(s[t]||0)+(r[t]||0);i&&i>=0&&(n[t]=i||null)}),t.css(n)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,i=e(this).resizable("instance"),s=i.options,n=i.size,a=i.originalSize,o=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,u=h[1]||1,d=Math.round((n.width-a.width)/l)*l,c=Math.round((n.height-a.height)/u)*u,p=a.width+d,f=a.height+c,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,v=s.minWidth&&s.minWidth>p,y=s.minHeight&&s.minHeight>f;s.grid=h,v&&(p+=l),y&&(f+=u),m&&(p-=l),g&&(f-=u),/^(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=o.top-c):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=o.left-d):((0>=f-u||0>=p-l)&&(t=i._getPaddingPlusBorderDimensions(this)),f-u>0?(i.size.height=f,i.position.top=o.top-c):(f=u-t.height,i.size.height=f,i.position.top=o.top+a.height-f),p-l>0?(i.size.width=p,i.position.left=o.left-d):(p=l-t.width,i.size.width=p,i.position.left=o.left+a.width-p))}}),e.ui.resizable,e.widget("ui.dialog",{version:"1.11.4",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",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(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.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"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(n){}this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),a=Math.max.apply(null,n);return a>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",a+1),s=!0),s&&!i&&this._trigger("focus",t),s},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),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(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0; 16338if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");t.target!==n[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==s[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){n.focus()}),t.preventDefault()):(this._delay(function(){s.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html(" "),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(i,function(i,s){var n,a;s=e.isFunction(s)?{click:s,text:i}:s,s=e.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(t.element[0],arguments)},a={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,e("<button></button>",s).button(a).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.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){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,t(n))},drag:function(e,s){i._trigger("drag",e,t(s))},stop:function(n,a){var o=a.offset.left-i.document.scrollLeft(),r=a.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(r>=0?"+":"")+r,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,t(a))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,s=this.options,n=s.resizable,a=this.uiDialog.css("position"),o="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:o,start:function(s,n){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,t(n))},resize:function(e,s){i._trigger("resize",e,t(s))},stop:function(n,a){var o=i.uiDialog.offset(),r=o.left-i.document.scrollLeft(),h=o.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},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,t(a))}}).css("position",a)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(s=!0),e in i.resizableRelatedOptions&&(n[e]=t)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,t){var i,s,n=this.uiDialog;"dialogClass"===e&&n.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=n.is(":data(ui-draggable)"),i&&!t&&n.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(s=n.is(":data(ui-resizable)"),s&&!t&&n.resizable("destroy"),s&&"string"==typeof t&&n.resizable("option","handles",t),s||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),e=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),t=Math.max(0,s.minHeight-e),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-e):"none","auto"===s.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),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 e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.droppable",{version:"1.11.4",widgetEventPrefix:"drop",o
vendor: 15,081 bytes, line 16338
16338ptions:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.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=e(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)&&e.ui.intersect(s,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s,n){if(!i.offset)return!1;var a=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,r=a+t.helperProportions.width,h=o+t.helperProportions.height,l=i.offset.left,u=i.offset.top,d=l+i.proportions().width,c=u+i.proportions().height;switch(s){case"fit":return a>=l&&d>=r&&o>=u&&c>=h;case"intersect":return a+t.helperProportions.width/2>l&&d>r-t.helperProportions.width/2&&o+t.helperProportions.height/2>u&&c>h-t.helperProportions.height/2;case"pointer":return e(n.pageY,u,i.proportions().height)&&e(n.pageX,l,i.proportions().width);case"touch":return(o>=u&&c>=o||h>=u&&c>=h||u>o&&h>c)&&(a>=l&&d>=a||r>=l&&d>=r||l>a&&r>d);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions().height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance,i),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===n}),a.length&&(s=e(a[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(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable;var y="ui-effects-",b=e;e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[u[l].cache]=o[u[l].cache],n=s._rgba=o._rgba,!1):t}),n.length?("0,0,0,0"===n.join()&&e.extend(n,a.transparent),s):a[i]}function n(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var a,o="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(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,n){return new e.Color.fn.parse(t,i,s,n)},u={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"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(n,o,r,h){if(n===t)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=e(n).css(o),o=t);var d=this,c=e.type(n),p=this._rgba=[];return o!==t&&(n=[n,o,r,h],c="array"),"string"===c?this.parse(s(n)||a._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(n[t.idx],t)}),this):"object"===c?(n instanceof l?f(u,function(e,t){n[t.cache]&&(d[t.cache]=n[t.cache].slice())}):f(u,function(t,s){var a=s.cache;f(s.props,function(e,t){if(!d[a]&&s.to){if("alpha"===e||null==n[e])return;d[a]=s.to(d._rgba)}d[a][t.idx]=i(n[e],t,!0)}),d[a]&&0>e.inArray(null,d[a].slice(0,3))&&(d[a][3]=1,s.from&&(d._rgba=s.from(d[a])))}),this):t},is:function(e){var i=l(e),s=!0,n=this;return f(u,function(e,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(e,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),n=s._space(),a=u[n],o=0===this.alpha()?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice();return s=s[a.cache],f(a.props,function(e,n){var a=n.idx,o=r[a],l=s[a],u=d[n.type]||{};null!==l&&(null===o?h[a]=l:(u.mod&&(l-o>u.mod/2?o+=u.mod:o-l>u.mod/2&&(o-=u.mod)),h[a]=i((l-o)*t+o,n)))}),this[n](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*n[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,n=e[1]/255,a=e[2]/255,o=e[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,u=r+h,d=.5*u;return t=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==o?1:o]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],a=e[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,t+1/3)),Math.round(255*n(r,o,t)),Math.round(255*n(r,o,t-1/3)),a]},f(u,function(s,n){var a=n.props,o=n.cache,h=n.to,u=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===t)return this[o].slice();var n,r=e.type(s),d="array"===r||"object"===r?s:arguments,c=this[o].slice();return f(a,function(e,t){var s=d["object"===r?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(n=l(u(c)),n[o]=c,n):l(c)},f(a,function(t,i){l.fn[t]||(l.fn[t]=function(n){var a,o=e.type(n),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===o?u:("function"===o&&(n=n.call(this,u),o=e.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=u+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,n){var a,o,r="";if("transparent"!==n&&("string"!==e.type(n)||(a=s(n)))){if(n=l(a||n),!c.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?t.parentNode:t;(""===r||"transparent"===r)&&o&&o.style;)try{r=e.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{t.style[i]=n}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},a=e.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"}}(b),function(){function t(t){var i,s,n=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[e.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function i(t,i){var s,a,o={};for(s in i)a=i[s],t[s]!==a&&(n[s]||(e.fx.step[s]||!isNaN(parseFloat(a)))&&(o[s]=a));return o}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(b.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(n,a,o,r){var h=e.speed(a,o,r);return this.queue(function(){var a,o=e(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack():o;l=l.map(function(){var i=e(this);return{el:i,start:t(this)}}),a=function(){e.each(s,function(e,t){n[t]&&o[t+"Class"](n[t])})},a(),l=l.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),o.attr("class",r),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(i,s,n,a){return s?e.effects.animateClass.call(this,{add:i},s,n,a):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,n,a){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,n,a):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,n,a,o){return"boolean"==typeof s||void 0===s?n?e.effects.animateClass.call(this,s?{add:i}:{remove:i},n,a,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,n,a)}}(e.fn.toggleClass),switchClass:function(t,i,s,n,a){return e.effects.animateClass.call(this,{add:i,remove:t},s,n,a)}})}(),function(){function t(t,i,s,n){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(n=s,s=i,i={}),e.isFunction(s)&&(n=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=n||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"str
vendor: 4,821 bytes, line 16338
16338ing"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.4",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(y+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(y+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:t.width(),height:t.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return t.wrap(s),(t[0]===a||e.contains(t[0],a))&&e(a).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(n),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,n){return n=n||{},e.each(i,function(e,i){var a=t.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(a)&&a.call(n[0]),e.isFunction(t)&&t()}var n=e(this),a=s.complete,r=s.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),i()):o.call(n[0],s,i)}var s=t.apply(this,arguments),n=s.mode,a=s.queue,o=e.effects.effect[s.effect];return e.fx.off||!o?n?this[n](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):a===!1?this.each(i):this.queue(a||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var s,n,a,o=e(this),r=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(o,t.mode||"hide"),d=t.direction||"up",c=r.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u;o.parent().is(".ui-effects-wrapper")?e.effects.save(o.parent(),l):e.effects.save(o,l),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n=s[p](),a=parseFloat(s.css(f))||0,g[p]=v?n:0,m||(o.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?a:n+a),v&&(s.css(p,0),m||s.css(f,a+n)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&o.hide(),e.effects.restore(o,l),e.effects.removeWrapper(o),i()}})},e.effects.effect.bounce=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=o.queue(),_=b.length;for((u||l)&&r.push("opacity"),e.effects.save(o,r),o.show(),e.effects.createWrapper(o),c||
vendor: 9,425 bytes, lines 16338-16339
16338(c=o["top"===v?"outerHeight":"outerWidth"]()/3),u&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,y?2*-c:2*c).animate(a,m,g)),l&&(c/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g).animate(a,m,g),c=l?2*c:c/2;l&&(n={opacity:0},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g)),o.queue(function(){l&&o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),o.dequeue()},e.effects.effect.clip=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(o,r),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[c](),l&&(n.css(c,0),n.css(p,a/2)),f[c]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}})},e.effects.effect.drop=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(n,t.mode||"hide"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:r?1:0};e.effects.save(n,a),n.show(),e.effects.createWrapper(n),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&n()}function n(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var a,o,r,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(a=0;d>a;a++)for(h=g.top+a*y,u=a-(d-1)/2,o=0;c>o;o++)r=g.left+o*v,l=o-(c-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:r+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,n,a=e(this),o=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"hide"),h="show"===r,l="hide"===r,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(a,o),a.show(),s=e.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*n[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?n[0]:u,v[f[1]]=h?n[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){l&&a.hide(),e.effects.restore(a,o),e.effects.removeWrapper(a),i()})},e.effects.effect.highlight=function(t,i){var s=e(this),n=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(s,t.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),e.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&s.hide(),e.effects.restore(s,n),i()}})},e.effects.effect.size=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=o.css("position"),y=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||s):(o.from=t.from||("show"===p?b:s),o.to=t.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(y=y.concat(d),o.from=e.effects.setTransition(o,d,a.from.y,o.from),o.to=e.effects.setTransition(o,d,a.to.y,o.to)),a.from.x!==a.to.x&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,a.from.x,o.from),o.to=e.effects.setTransition(o,c,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(y=y.concat(u).concat(l),o.from=e.effects.setTransition(o,u,a.from.y,o.from),o.to=e.effects.setTransition(o,u,a.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=e.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=r.concat(d).concat(c),o.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()}; 16339f&&e.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=e.effects.setTransition(i,d,a.from.y,i.from),i.to=e.effects.setTransition(i,d,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=e.effects.setTransition(i,c,a.from.x,i.from),i.to=e.effects.setTransition(i,c,a.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),e.effects.restore(o,y),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,i){var s=parseInt(i,10),n=e?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),e.effects.removeWrapper(o),i()}})},e.effects.effect.scale=function(t,i){var s=e(this),n=e.extend(!0,{},t),a=e.effects.setMode(s,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),r=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},e.effects.effect.puff=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"hide"),a="hide"===n,o=parseInt(t.percent,10)||150,r=o/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,n=e(this),a=e.effects.setMode(n,t.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=n.queue(),p=c.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),d=1),s=1;l>s;s++)n.animate({opacity:d},u,t.easing),d=1-d;n.animate({opacity:d},u,t.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),n.dequeue()},e.effects.effect.shake=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"effect"),r=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue(),y=v.length;for(e.effects.save(n,a),n.show(),e.effects.createWrapper(n),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,n.animate(f,d,t.easing),s=1;l>s;s++)n.animate(m,d,t.easing).animate(g,d,t.easing);n.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),n.dequeue()},e.effects.effect.slide=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(n,t.mode||"show"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"to
vendor: 27,943 bytes, line 16339
16339p":"left",u="up"===h||"left"===h,d={};e.effects.save(n,a),n.show(),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(r?u?"+=":"-=":u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.transfer=function(t,i){var s=e(this),n=e(t.to),a="fixed"===n.css("position"),o=e("body"),r=a?o.scrollTop():0,h=a?o.scrollLeft():0,l=n.offset(),u={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},d=s.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:d.top-r,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})},e.widget("ui.progressbar",{version:"1.11.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectable",e.ui.mouse,{version:"1.11.4",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 t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.selectmenu",{version:"1.11.4",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,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.options.disabled&&this.disable()},_drawButton:function(){var t=this;this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",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"}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,i){e.preventDefault(),t._setSelection(),t._select(i.item.data("ui-selectmenu-item"),e)},focus:function(e,i){var s=i.item.data("ui-selectmenu-item");null!=t.focusIndex&&s.index!==t.focusIndex&&(t._trigger("focus",e,{item:s}),t.isOpen||t._select(s,e)),t.focusIndex=s.index,t.button.attr("aria-activedescendant",t.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,i){var s=this,n="";e.each(i,function(i,a){a.optgroup!==n&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(a.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:a.optgroup}).appendTo(t),n=a.optgroup),s._renderItemData(t,a)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,i){var s=e("<li>");return i.disabled&&s.addClass("ui-state-disabled"),this._setText(s,i.label),s.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html(" ")},_move:function(e,t){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex):(i=this.menuItems.eq(this.element[0].selectedIndex),n+=":not(.ui-state-disabled)"),s="first"===e||"last"===e?i["first"===e?"prevAll":"nextAll"](n).eq(-1):i[e+"All"](n).eq(0),s.length&&this.menuInstance.focus(t,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;this.range&&(window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var i=[];t.each(function(t,s){var n=e(s),a=n.parent("optgroup");i.push({element:n,index:t,value:n.val(),label:n.text(),optgroup:a.attr("label")||"",disabled:a.prop("disabled")||n.prop("disabled")})}),this.items=i},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"slide",options:{animate:!1,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.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),t=n.length;i>t;t++)o.push(a);this.handles=n.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.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.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,a,o,r,h,l,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));(n>i||n===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(n=i,a=e(this),o=t)}),r=this._start(t,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),h=a.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-a.width()/2,top:t.pageY-h.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,n,a;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(n=this.values(),n[t]=i,a=this._trigger("slide",e,{handle:this.handles[t],value:i,values:n}),s=this.values(t?0:1),a!==!1&&this.values(t,i))):i!==this.value()&&(a=this._trigger("slide",e,{handle:this.handles[t],value:i}),a!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(t,i){var s,n,a;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),void 0;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(t,i){var s,n=0;switch("range"===t&&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)),e.isArray(this.options.values)&&(n=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!i),this._super(t,i),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),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=0;n>s;s+=1)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}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),i=this.options.step,s=Math.floor(+(e-t).toFixed(this._precision())/i)*i;e=s+t,this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,i,s,n,a,o=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,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-t+"%"},{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-t+"%"},{queue:!1,duration:r.animate}))),t=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(t){var i,s,n,a,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),i=this._start(t,o),i===!1))return}switch(a=this.options.step,s=n=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:n=this._valueMin();break;case e.ui.keyCode.END:n=this._valueMax();break;case e.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+a);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-a)}this._slide(t,o,n)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.4",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(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,a.widgetName+"-item")===a?(s=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left
vendor: 7,912 bytes, lines 16339-16340
16339:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.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(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this)); 16340return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(t),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-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-this.document.scrollTop()<o.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<o.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),t.pageX-this.document.scrollLeft()<o.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),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],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!e.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.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,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].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(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=e.left,o=a+e.width,r=e.top,h=r+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>r&&h>s+l,c="y"===this.options.axis||t+u>a&&o>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return s?this.floating?a&&"right"===a||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;
vendor: 15,076 bytes, line 16340
16340return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){r.push(this)}var s,n,a,o,r=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(a=e(l[s],this.document[0]),n=a.length-1;n>=0;n--)o=e.data(a[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&h.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(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 e(r)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(n=e(c[i],this.document[0]),s=n.length-1;s>=0;s--)a=e.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(d.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(i=d.length-1;i>=0;i--)for(o=d[i][1],r=d[i][0],s=0,l=r.length;l>s;s++)h=e(r[s]),h.data(this.widgetName+"-item",o),u.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){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,a;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?e(this.options.toleranceElement,s.item):s.item,t||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.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--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.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(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),n=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===s?t._createTrPlaceholder(t.currentItem.find("tr").eq(0),e("<tr>",t.document[0]).appendTo(n)):"tr"===s?t._createTrPlaceholder(t.currentItem,n):"img"===s&&n.attr("src",t.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(e,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_createTrPlaceholder:function(t,i){var s=this;t.children().each(function(){e("<td> </td>",s.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(t){var i,s,n,a,o,r,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,a=null,u=c.floating||this._isFloating(this.currentItem),o=u?"left":"top",r=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.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()[o],l=!1,t[d]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(t[d]-h)&&(n=Math.abs(t[d]-h),a=this.items[s],this.direction=l?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("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(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.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 t,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.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(t=e(n.containment)[0],i=e(n.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(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():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(t){var i,s,n=this.options,a=t.pageX,o=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.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&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=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((a-this.originalPageX)/n.grid[0])*n.grid[0],a=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:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}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).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||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,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.spinner",{version:"1.11.4",defaultElement:"<input>",widgetEventPrefix:"spin",options:{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 t={},i=this.element;return e.each(["min","max","step"],function(e,s){var n=i.attr(s);void 0!==n&&n.length&&(t[s]=n)}),t}
vendor: 5,350 bytes, line 16340
16340,_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>▲</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>▼</span>"+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:h(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_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 e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:h(function(e){this._stepUp(e)}
vendor: 6,443 bytes, lines 16340-16341
16340),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:h(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:h(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:h(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(h(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.4",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var i,s;t=t.cloneNode(!1),i=t.href.replace(e,""),s=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return t.hash.length>1&&i===s}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===t&&(s&&this.tabs.each(function(i,n){return e(n).attr("aria-controls")===s?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:n=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),t.ctrlKey||t.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(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function s(){return t>n&&(t=0),0>t&&(t=n),t}for(var n=this.tabs.length-1;-1!==e.inArray(s(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(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.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,i=this.tabs,s=this.anchors,n=this.panels; 16341this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var n,a,o,r=e(s).uniqueId().attr("id"),h=e(s).closest("li"),l=h.attr("aria-controls");t._isLocal(s)?(n=s.hash,o=n.substring(1),a=t.element.find(t._sanitizeSelector(n))):(o=h.attr("aria-controls")||e({}).uniqueId()[0].id,n="#"+o,a=t.element.find(n),a.length||(a=t._createPanel(o),a.insertAfter(t.panels[i-1]||t.tablist)),a.attr("aria-live","polite")),a.length&&(t.panels=t.panels.add(a)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":o,"aria-labelledby":r}),a.attr("aria-labelledby",r)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),i&&(this._off(i.not(this.tabs)
vendor: 11,212 bytes, line 16341
16341),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(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.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(t){var i,s=this.element.parent();"fill"===t?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n.closest("li"),o=a[0]===s[0],r=o&&i.collapsible,h=r?e():this._getPanelForTab(a),l=s.length?this._getPanelForTab(s):e(),u={oldTab:s,oldPanel:l,newTab:r?e():a,newPanel:h};t.preventDefault(),a.hasClass("ui-state-disabled")||a.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=r?!1:this.tabs.index(a),this.active=o?e():a,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(a),t),this._toggle(t,u))},_toggle:function(t,i){function s(){a.running=!1,a._trigger("activate",t,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&a.options.show?a._show(o,a.options.show,s):(o.show(),s())}var a=this,o=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&r.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var s=this,n=this.tabs.eq(t),a=n.find(".ui-tabs-anchor"),o=this._getPanelForTab(n),r={tab:n,panel:o},h=function(e,t){"abort"===t&&s.panels.stop(!1,!0),n.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr};this._isLocal(a[0])||(this.xhr=e.ajax(this._ajaxSettings(a,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(n.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.done(function(e,t,n){setTimeout(function(){o.html(e),s._trigger("load",i,r),h(n,t)},1)}).fail(function(e,t){setTimeout(function(){h(e,t)},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href"),beforeSend:function(t,a){return n._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:a},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.4",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),n=e.inArray(i,s);-1!==n&&s.splice(n,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t.element)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur");n.target=n.currentTarget=s.element[0],t.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.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),t&&"mouseover"===t.type&&s.parents().each(function(){var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(t,s),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,n=this,a=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){n._delay(function(){e.data("ui-tooltip-open")&&(t&&(t.type=a),this._open(t,e,i))})}),i&&this._open(t,e,i),void 0)},_open:function(t,i,s){function n(e){l.of=e,o.is(":hidden")||o.position(l)}var a,o,r,h,l=e.extend({},this.options.position);if(s){if(a=this._find(i))return a.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),a=this._tooltip(i),o=a.tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),s.clone?(h=s.clone(),h.removeAttr("id").find("[id]").removeAttr("id")):h=s,e("<div>").html(h).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:n}),n(t)):o.position(e.extend({of:i},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){o.is(":visible")&&(n(l.of),clearInterval(r))},e.fx.interval)),this._trigger("open",t,{tooltip:o})}},_registerCloseHandlers:function(t,i){var s={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var s=e.Event(t);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),t&&"mouseover"!==t.type||(s.mouseleave="close"),t&&"focusin"!==t.type||(s.focusout="close"),this._on(!0,i,s)},close:function(t){var i,s=this,n=e(t?t.currentTarget:this.element),a=this._find(n);return a?(i=a.tooltip,a.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),a.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(e(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"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete s.parents[t]}),a.closing=!0,this._trigger("close",t,{tooltip:i}),a.hiding||(a.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(t){var i=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),s=i.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[s]={element:t,tooltip:i}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur"),a=s.element;n.target=n.currentTarget=a[0],t.close(n,!0),e("#"+i).remove(),a.data("ui-tooltip-title")&&(a.attr("title")||a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}})});
vendor: 2,583 bytes, lines 16341-16417
16341 16342/** 16343* @preserve HTML5 Shiv prev3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 16344*/ 16345;(function(window, document) { 16346/*jshint evil:true */ 16347 /** version */ 16348 var version = '3.7.0'; 16349 16350 /** Preset options */ 16351 var options = window.html5 || {}; 16352 16353 /** Used to skip problem elements */ 16354 var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; 16355 16356 /** Not all elements can be cloned in IE **/ 16357 var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; 16358 16359 /** Detect whether the browser supports default html5 styles */ 16360 var supportsHtml5Styles; 16361 16362 /** Name of the expando, to work with multiple documents or to re-shiv one document */ 16363 var expando = '_html5shiv'; 16364 16365 /** The id for the the documents expando */ 16366 var expanID = 0; 16367 16368 /** Cached data for each document */ 16369 var expandoData = {}; 16370 16371 /** Detect whether the browser supports unknown elements */ 16372 var supportsUnknownElements; 16373 16374 (function() { 16375 try { 16376 var a = document.createElement('a'); 16377 a.innerHTML = '<xyz></xyz>'; 16378 //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles 16379 supportsHtml5Styles = ('hidden' in a); 16380 16381 supportsUnknownElements = a.childNodes.length == 1 || (function() { 16382 // assign a false positive if unable to shiv 16383 (document.createElement)('a'); 16384 var frag = document.createDocumentFragment(); 16385 return ( 16386 typeof frag.cloneNode == 'undefined' || 16387 typeof frag.createDocumentFragment == 'undefined' || 16388 typeof frag.createElement == 'undefined' 16389 ); 16390 }()); 16391 } catch(e) { 16392 // assign a false positive if detection fails => unable to shiv 16393 supportsHtml5Styles = true; 16394 supportsUnknownElements = true; 16395 } 16396 16397 }()); 16398 16399 /*--------------------------------------------------------------------------*/ 16400 16401 /** 16402 * Creates a style sheet with the given CSS text and adds it to the document. 16403 * @private 16404 * @param {Document} ownerDocument The document. 16405 * @param {String} cssText The CSS text. 16406 * @returns {StyleSheet} The style element. 16407 */ 16408 function addStyleSheet(ownerDocument, cssText) { 16409 var p = ownerDocument.createElement('p'), 16410 parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; 16411 16412 p.innerHTML = 'x<style>' + cssText + '</style>'; 16413 return parent.insertBefore(p.lastChild, parent.firstChild); 16414 } 16415 16416 /** 16417 * Returns the value of `html5.elements` as an array.
vendor: 4,533 bytes, lines 16418-16557
16418 * @private 16419 * @returns {Array} An array of shived element node names. 16420 */ 16421 function getElements() { 16422 var elements = html5.elements; 16423 return typeof elements == 'string' ? elements.split(' ') : elements; 16424 } 16425 16426 /** 16427 * Returns the data associated to the given document 16428 * @private 16429 * @param {Document} ownerDocument The document. 16430 * @returns {Object} An object of data. 16431 */ 16432 function getExpandoData(ownerDocument) { 16433 var data = expandoData[ownerDocument[expando]]; 16434 if (!data) { 16435 data = {}; 16436 expanID++; 16437 ownerDocument[expando] = expanID; 16438 expandoData[expanID] = data; 16439 } 16440 return data; 16441 } 16442 16443 /** 16444 * returns a shived element for the given nodeName and document 16445 * @memberOf html5 16446 * @param {String} nodeName name of the element 16447 * @param {Document} ownerDocument The context document. 16448 * @returns {Object} The shived element. 16449 */ 16450 function createElement(nodeName, ownerDocument, data){ 16451 if (!ownerDocument) { 16452 ownerDocument = document; 16453 } 16454 if(supportsUnknownElements){ 16455 return ownerDocument.createElement(nodeName); 16456 } 16457 if (!data) { 16458 data = getExpandoData(ownerDocument); 16459 } 16460 var node; 16461 16462 if (data.cache[nodeName]) { 16463 node = data.cache[nodeName].cloneNode(); 16464 } else if (saveClones.test(nodeName)) { 16465 node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); 16466 } else { 16467 node = data.createElem(nodeName); 16468 } 16469 16470 // Avoid adding some elements to fragments in IE < 9 because 16471 // * Attributes like `name` or `type` cannot be set/changed once an element 16472 // is inserted into a document/fragment 16473 // * Link elements with `src` attributes that are inaccessible, as with 16474 // a 403 response, will cause the tab/window to crash 16475 // * Script elements appended to fragments will execute when their `src` 16476 // or `text` property is set 16477 return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; 16478 } 16479 16480 /** 16481 * returns a shived DocumentFragment for the given document 16482 * @memberOf html5 16483 * @param {Document} ownerDocument The context document. 16484 * @returns {Object} The shived DocumentFragment. 16485 */ 16486 function createDocumentFragment(ownerDocument, data){ 16487 if (!ownerDocument) { 16488 ownerDocument = document; 16489 } 16490 if(supportsUnknownElements){ 16491 return ownerDocument.createDocumentFragment(); 16492 } 16493 data = data || getExpandoData(ownerDocument); 16494 var clone = data.frag.cloneNode(), 16495 i = 0, 16496 elems = getElements(), 16497 l = elems.length; 16498 for(;i<l;i++){ 16499 clone.createElement(elems[i]); 16500 } 16501 return clone; 16502 } 16503 16504 /** 16505 * Shivs the `createElement` and `createDocumentFragment` methods of the document. 16506 * @private 16507 * @param {Document|DocumentFragment} ownerDocument The document. 16508 * @param {Object} data of the document. 16509 */ 16510 function shivMethods(ownerDocument, data) { 16511 if (!data.cache) { 16512 data.cache = {}; 16513 data.createElem = ownerDocument.createElement; 16514 data.createFrag = ownerDocument.createDocumentFragment; 16515 data.frag = data.createFrag(); 16516 } 16517 16518 16519 ownerDocument.createElement = function(nodeName) { 16520 //abort shiv 16521 if (!html5.shivMethods) { 16522 return data.createElem(nodeName); 16523 } 16524 return createElement(nodeName, ownerDocument, data); 16525 }; 16526 16527 ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + 16528 'var n=f.cloneNode(),c=n.createElement;' + 16529 'h.shivMethods&&(' + 16530 // unroll the `createElement` calls 16531 getElements().join().replace(/[\w\-:]+/g, function(nodeName) { 16532 data.createElem(nodeName); 16533 data.frag.createElement(nodeName); 16534 return 'c("' + nodeName + '")'; 16535 }) + 16536 ');return n}' 16537 )(html5, data.frag); 16538 } 16539 16540 /*--------------------------------------------------------------------------*/ 16541 16542 /** 16543 * Shivs the given document. 16544 * @memberOf html5 16545 * @param {Document} ownerDocument The document to shiv. 16546 * @returns {Document} The shived document. 16547 */ 16548 function shivDocument(ownerDocument) { 16549 if (!ownerDocument) { 16550 ownerDocument = document; 16551 } 16552 var data = getExpandoData(ownerDocument); 16553 16554 if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { 16555 data.hasCSS = !!addStyleSheet(ownerDocument, 16556 // corrects block display not defined in IE6/7/8/9 16557 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{dis
16557play:block}' + 16558 // adds styling not present in IE6/7/8/9 16559 'mark{background:#FF0;color:#000}' + 16560 // hides non-rendered elements 16561 'template{display:none}' 16562 ); 16563 } 16564 if (!supportsUnknownElements) { 16565 shivMethods(ownerDocument, data); 16566 } 16567 return ownerDocument; 16568 } 16569 16570 /*--------------------------------------------------------------------------*/ 16571 16572 /** 16573 * The `html5` object is exposed so that more elements can be shived and 16574 * existing shiving can be detected on iframes. 16575 * @type Object 16576 * @example 16577 * 16578 * // options can be changed before the script is included 16579 * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false }; 16580 */ 16581 var html5 = { 16582 16583 /** 16584 * An array or space separated string of node names of the elements to shiv. 16585 * @memberOf html5 16586 * @type Array|String 16587 */ 16588 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video', 16589 16590 /** 16591 * current version of html5shiv 16592 */ 16593 'version': version, 16594 16595 /** 16596 * A flag to indicate that the HTML5 style sheet should be inserted. 16597 * @memberOf html5 16598 * @type Boolean 16599 */ 16600 'shivCSS': (options.shivCSS !== false), 16601 16602 /** 16603 * Is equal to true if a browser supports creating unknown/HTML5 elements 16604 * @memberOf html5 16605 * @type boolean 16606 */ 16607 'supportsUnknownElements': supportsUnknownElements, 16608 16609 /** 16610 * A flag to indicate that the document's `createElement` and `createDocumentFragment` 16611 * methods should be overwritten. 16612 * @memberOf html5 16613 * @type Boolean 16614 */ 16615 'shivMethods': (options.shivMethods !== false), 16616 16617 /** 16618 * A string to describe the type of `html5` object ("default" or "default print"). 16619 * @memberOf html5
16620 * @type String 16621 */ 16622 'type': 'default', 16623 16624 // shivs the document according to the specified `html5` object options 16625 'shivDocument': shivDocument, 16626 16627 //creates a shived element 16628 createElement: createElement, 16629 16630 //creates a shived documentFragment 16631 createDocumentFragment: createDocumentFragment 16632 }; 16633 16634 /*--------------------------------------------------------------------------*/ 16635 16636 // expose html5 16637 window.html5 = html5; 16638 16639 // shiv the document 16640 shivDocument(document); 16641 16642}(this, document)); 16643 16644/* Respond.js: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */ 16645(function( w ){ 16646 16647 "use strict"; 16648 16649 //exposed namespace 16650 var respond = {}; 16651 w.respond = respond; 16652 16653 //define update even in native-mq-supporting browsers, to avoid errors 16654 respond.update = function(){}; 16655 16656 //define ajax obj 16657 var requestQueue = [], 16658 xmlHttp = (function() { 16659 var xmlhttpmethod = false; 16660 try { 16661 xmlhttpmethod = new w.XMLHttpRequest(); 16662 } 16663 catch( e ){ 16664 xmlhttpmethod = new w.ActiveXObject( "Microsoft.XMLHTTP" ); 16665 } 16666 return function(){ 16667 return xmlhttpmethod; 16668 }; 16669 })(), 16670 16671 //tweaked Ajax functions from Quirksmode 16672 ajax = function( url, callback ) { 16673 var req = xmlHttp(); 16674 if (!req){ 16675 return; 16676 } 16677 req.open( "GET", url, true ); 16678 req.onreadystatechange = function () { 16679 if ( req.readyState !== 4 || req.status !== 200 && req.status !== 304 ){ 16680 return; 16681 } 16682 callback( req.responseText ); 16683 }; 16684 if ( req.readyState === 4 ){ 16685 return; 16686 } 16687 req.send( null ); 16688 }, 16689 isUnsupportedMediaQuery = function( query ) { 16690 return query.replace( respond.regex.minmaxwh, '' ).match( respond.regex.other ); 16691 }; 16692 16693 //expose for testing 16694 respond.ajax = ajax; 16695 respond.queue = requestQueue; 16696 respond.unsupportedmq = isUnsupportedMediaQuery; 16697 respond.regex = { 16698 media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi, 16699 keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi, 16700 comments: /\/\*[^*]*\*+([^/][^*]*\*+)*\//gi, 16701 urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, 16702 findStyles: /@media *([^\{]+)\{([\S\s]+?)$/, 16703 only: /(only\s+)?([a-zA-Z]+)\s?/, 16704 minw: /\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/, 16705 maxw: /\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/, 16706 minmaxwh: /\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi, 16707 other: /\([^\)]*\)/g 16708 }; 16709 16710 //expose media query support flag for external use 16711 respond.mediaQueriesSupported = w.matchMedia && w.matchMedia( "only all" ) !== null && w.matchMedia( "only all" ).matches; 16712 16713 //if media queries are supported, exit here 16714 if( respond.mediaQueriesSupported ){ 16715 return; 16716 } 16717 16718 //define vars 16719 var doc = w.document, 16720 docElem = doc.documentElement, 16721 mediastyles = [], 16722 rules = [], 16723 appendedEls = [], 16724 parsedSheets = {}, 16725 resizeThrottle = 30, 16726 head = doc.getElementsByTagName( "head" )[0] || docElem, 16727 base = doc.getElementsByTagName( "base" )[0], 16728 links = head.getElementsByTagName( "link" ), 16729 16730 lastCall, 16731 resizeDefer, 16732 16733 //cached container for 1em value, populated the first time it's needed 16734 eminpx, 16735 16736 // returns the value of 1em in pixels 16737 getEmValue = function() { 16738 var ret, 16739 div = doc.createElement('div'), 16740 body = doc.body, 16741 originalHTMLFontSize = docElem.style.fontSize, 16742 originalBodyFontSize = body && body.style.fontSize, 16743 fakeUsed = false; 16744 16745 div.style.cssText = "position:absolute;font-size:1em;width:1em"; 16746 16747 if( !body ){ 16748 body = fakeUsed = doc.createElement( "body" ); 16749 body.style.background = "none"; 16750 } 16751 16752 // 1em in a media query is the value of the default font size of the browser 16753 // reset docElem and body to ensure the correct value is returned 16754 docElem.style.fontSize = "100%"; 16755 body.style.fontSize = "100%"; 16756 16757 body.appendChild( div ); 16758 16759 if( fakeUsed ){ 16760 docElem.insertBefore( body, docElem.firstChild ); 16761 } 16762 16763 ret = div.offsetWidth; 16764 16765 if( fakeUsed ){ 16766 docElem.removeChild( body ); 16767 } 16768 else { 16769 body.removeChild( div ); 16770 } 16771 16772 // restore the original values 16773 docElem.style.fontSize = originalHTMLFontSize; 16774 if( originalBodyFontSize ) { 16775 body.style.fontSize = originalBodyFontSize; 16776 } 16777 16778 16779 //also update eminpx before returning 16780 ret = eminpx = parseFloat(ret); 16781 16782 return ret; 16783 }, 16784 16785 //enable/disable styles 16786 applyMedia = function( fromResize ){ 16787 var name = "clientWidth", 16788 docElemProp = docElem[ name ], 16789 currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp, 16790 styleBlocks = {}, 16791 lastLink = links[ links.length-1 ], 16792 now = (new Date()).getTime(); 16793 16794 //throttle resize calls 16795 if( fromResize && lastCall && now - lastCall < resizeThrottle ){ 16796 w.clearTimeout( resizeDefer ); 16797 resizeDefer = w.setTimeout( applyMedia, resizeThrottle ); 16798 return; 16799 } 16800 else {
16801 lastCall = now; 16802 } 16803 16804 for( var i in mediastyles ){ 16805 if( mediastyles.hasOwnProperty( i ) ){ 16806 var thisstyle = mediastyles[ i ], 16807 min = thisstyle.minw, 16808 max = thisstyle.maxw, 16809 minnull = min === null, 16810 maxnull = max === null, 16811 em = "em"; 16812 16813 if( !!min ){ 16814 min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); 16815 } 16816 if( !!max ){ 16817 max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); 16818 } 16819 16820 // if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true 16821 if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){ 16822 if( !styleBlocks[ thisstyle.media ] ){ 16823 styleBlocks[ thisstyle.media ] = []; 16824 } 16825 styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] ); 16826 } 16827 } 16828 } 16829 16830 //remove any existing respond style element(s) 16831 for( var j in appendedEls ){ 16832 if( appendedEls.hasOwnProperty( j ) ){ 16833 if( appendedEls[ j ] && appendedEls[ j ].parentNode === head ){ 16834 head.removeChild( appendedEls[ j ] ); 16835 } 16836 } 16837 } 16838 appendedEls.length = 0; 16839 16840 //inject active styles, grouped by media type 16841 for( var k in styleBlocks ){ 16842 if( styleBlocks.hasOwnProperty( k ) ){ 16843 var ss = doc.createElement( "style" ), 16844 css = styleBlocks[ k ].join( "\n" ); 16845 16846 ss.type = "text/css"; 16847 ss.media = k; 16848 16849 //originally, ss was appended to a documentFragment and sheets were appended in bulk. 16850 //this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one! 16851 head.insertBefore( ss, lastLink.nextSibling ); 16852 16853 if ( ss.styleSheet ){ 16854 ss.styleSheet.cssText = css; 16855 } 16856 else { 16857 ss.appendChild( doc.createTextNode( css ) ); 16858 } 16859 16860 //push to appendedEls to track for later removal 16861 appendedEls.push( ss ); 16862 } 16863 } 16864 }, 16865 //find media blocks in css text, convert to style blocks 16866 translate = function( styles, href, media ){ 16867 var qs = styles.replace( respond.regex.comments, '' ) 16868 .replace( respond.regex.keyframes, '' ) 16869 .match( respond.regex.media ), 16870 ql = qs && qs.length || 0; 16871 16872 //try to get CSS path 16873 href = href.substring( 0, href.lastIndexOf( "/" ) ); 16874 16875 var repUrls = function( css ){ 16876 return css.replace( respond.regex.urls, "$1" + href + "$2$3" ); 16877 }, 16878 useMedia = !ql && media; 16879 16880 //if path exists, tack on trailing slash 16881 if( href.length ){ href += "/"; } 16882 16883 //if no internal queries exist, but media attr does, use that 16884 //note: this currently lacks support for situations where a media attr is specified on a link AND 16885 //its associated stylesheet has internal CSS media queries. 16886 //In those cases, the media attribute will currently be ignored. 16887 if( useMedia ){ 16888 ql = 1; 16889 } 16890 16891 for( var i = 0; i < ql; i++ ){ 16892 var fullq, thisq, eachq, eql; 16893 16894 //media attr 16895 if( useMedia ){ 16896 fullq = media; 16897 rules.push( repUrls( styles ) ); 16898 } 16899 //parse for styles 16900 else{ 16901 fullq = qs[ i ].match( respond.regex.findStyles ) && RegExp.$1; 16902 rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); 16903 } 16904 16905 eachq = fullq.split( "," ); 16906 eql = eachq.length; 16907 16908 for( var j = 0; j < eql; j++ ){ 16909 thisq = eachq[ j ]; 16910 16911 if( isUnsupportedMediaQuery( thisq ) ) { 16912 continue; 16913 } 16914 16915 mediastyles.push( { 16916 media : thisq.split( "(" )[ 0 ].match( respond.regex.only ) && RegExp.$2 || "all", 16917 rules : rules.length - 1, 16918 hasquery : thisq.indexOf("(") > -1, 16919 minw : thisq.match( respond.regex.minw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ), 16920 maxw : thisq.match( respond.regex.maxw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ) 16921 } ); 16922 } 16923 } 16924 16925 applyMedia(); 16926 }, 16927 16928 //recurse through request queue, get css text 16929 makeRequests = function(){ 16930 if( requestQueue.length ){ 16931 var thisRequest = requestQueue.shift(); 16932 16933 ajax( thisRequest.href, function( styles ){ 16934 translate( styles, thisRequest.href, thisRequest.media ); 16935 parsedSheets[ thisRequest.href ] = true; 16936 16937 // by wrapping recursive function call in setTimeout 16938 // we prevent "Stack overflow" error in IE7 16939 w.setTimeout(function(){ makeRequests(); },0); 16940 } ); 16941 } 16942 }, 16943 16944 //loop stylesheets, send text content to translate 16945 ripCSS = function(){ 16946 16947 for( var i = 0; i < links.length; i++ ){ 16948 var sheet = links[ i ], 16949 href = sheet.href, 16950 media = sheet.media, 16951 isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; 16952 16953 //only links plz and prevent re-parsing 16954 if( !!href && isCSS && !parsedSheets[ href ] ){ 16955 // selectivizr exposes css through the rawCssText expando 16956 if (sheet.styleSheet && sheet.styleSheet.rawCssText) { 16957 translate( sheet.styleSheet.rawCssText, href, media ); 16958 parsedSheets[ href ] = true; 16959 } else { 16960 if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) || 16961 href.replace( RegExp.$1, "" ).split( "/" )[0] === w.location.host ){ 16962 // IE7 doesn't handle urls that start with '//' for ajax request 16963 // manually add in the protocol 16964 if ( href.substring(0,2) === "//" ) { href = w.location.protocol + href; } 16965 requestQueue.push( { 16966 href: href, 16967 media: media 16968 } ); 16969 } 16970 } 16971 } 16972 } 16973 makeRequests(); 16974 }; 16975 16976 //translate CSS 16977 ripCSS(); 16978 16979 //expose update for re-running respond later on 16980 respond.update = ripCSS; 16981 16982 //expose getEmValue 16983 respond.getEmValue = getEmValue; 16984 16985 //adjust on resize 16986 function callMedia(){ 16987 applyMedia( true ); 16988 } 16989 16990 if( w.addEventListener ){ 16991 w.addEventListener( "resize", callMedia, false ); 16992 } 16993 else if( w.attachEvent ){ 16994 w.attachEvent( "onresize", callMedia ); 16995 } 16996})(this);
16997/* MediaMatch v.2.0.2 - Testing css media queries in Javascript. Authors & copyright (c) 2013: WebLinc, David Knight. */ 16998 16999window.matchMedia||(window.matchMedia=function(c){var a=c.document,w=a.documentElement,l=[],t=0,x="",h={},G=/\s*(only|not)?\s*(screen|print|[a-z\-]+)\s*(and)?\s*/i,H=/^\s*\(\s*(-[a-z]+-)?(min-|max-)?([a-z\-]+)\s*(:?\s*([0-9]+(\.[0-9]+)?|portrait|landscape)(px|em|dppx|dpcm|rem|%|in|cm|mm|ex|pt|pc|\/([0-9]+(\.[0-9]+)?))?)?\s*\)\s*$/,y=0,A=function(b){var z=-1!==b.indexOf(",")&&b.split(",")||[b],e=z.length-1,j=e,g=null,d=null,c="",a=0,l=!1,m="",f="",g=null,d=0,f=null,k="",p="",q="",n="",r="",k=!1;if(""=== 17000b)return!0;do{g=z[j-e];l=!1;if(d=g.match(G))c=d[0],a=d.index;if(!d||-1===g.substring(0,a).indexOf("(")&&(a||!d[3]&&c!==d.input))k=!1;else{f=g;l="not"===d[1];a||(m=d[2],f=g.substring(c.length));k=m===x||"all"===m||""===m;g=-1!==f.indexOf(" and ")&&f.split(" and ")||[f];d=g.length-1;if(k&&0<=d&&""!==f){do{f=g[d].match(H);if(!f||!h[f[3]]){k=!1;break}k=f[2];n=p=f[5];q=f[7];r=h[f[3]];q&&(n="px"===q?Number(p):"em"===q||"rem"===q?16*p:f[8]?(p/f[8]).toFixed(2):"dppx"===q?96*p:"dpcm"===q?0.3937*p:Number(p)); 17001k="min-"===k&&n?r>=n:"max-"===k&&n?r<=n:n?r===n:!!r;if(!k)break}while(d--)}if(k)break}}while(e--);return l?!k:k},B=function(){var b=c.innerWidth||w.clientWidth,a=c.innerHeight||w.clientHeight,e=c.screen.width,j=c.screen.height,g=c.screen.colorDepth,d=c.devicePixelRatio;h.width=b;h.height=a;h["aspect-ratio"]=(b/a).toFixed(2);h["device-width"]=e;h["device-height"]=j;h["device-aspect-ratio"]=(e/j).toFixed(2);h.color=g;h["color-index"]=Math.pow(2,g);h.orientation=a>=b?"portrait":"landscape";h.resolution= 17002d&&96*d||c.screen.deviceXDPI||96;h["device-pixel-ratio"]=d||1},C=function(){clearTimeout(y);y=setTimeout(function(){var b=null,a=t-1,e=a,j=!1;if(0<=a){B();do if(b=l[e-a])if((j=A(b.mql.media))&&!b.mql.matches||!j&&b.mql.matches)if(b.mql.matches=j,b.listeners)for(var j=0,g=b.listeners.length;j<g;j++)b.listeners[j]&&b.listeners[j].call(c,b.mql);while(a--)}},10)},D=a.getElementsByTagName("head")[0],a=a.createElement("style"),E=null,u="screen print speech projection handheld tv braille embossed tty".split(" "), 17003m=0,I=u.length,s="#mediamatchjs { position: relative; z-index: 0; }",v="",F=c.addEventListener||(v="on")&&c.attachEvent;a.type="text/css";a.id="mediamatchjs";D.appendChild(a);for(E=c.getComputedStyle&&c.getComputedStyle(a)||a.currentStyle;m<I;m++)s+="@media "+u[m]+" { #mediamatchjs { position: relative; z-index: "+m+" } }";a.styleSheet?a.styleSheet.cssText=s:a.textContent=s;x=u[1*E.zIndex||0];D.removeChild(a);B();F(v+"resize",C);F(v+"orientationchange",C);return function(a){var c=t,e={matches:!1, 17004media:a,addListener:function(a){l[c].listeners||(l[c].listeners=[]);a&&l[c].listeners.push(a)},removeListener:function(a){var b=l[c],d=0,e=0;if(b)for(e=b.listeners.length;d<e;d++)b.listeners[d]===a&&b.listeners.splice(d,1)}};if(""===a)return e.matches=!0,e;e.matches=A(a);t=l.push({mql:e,listeners:null});return e}}(window)); 17005/*! 17006 * enquire.js v2.1.2 - Awesome Media Queries in JavaScript 17007 * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/enquire.js 17008 * License: MIT (http://www.opensource.org/licenses/mit-license.php) 17009 */ 17010 17011;(function (name, context, factory) { 17012 var matchMedia = window.matchMedia; 17013 17014 if (typeof module !== 'undefined' && module.exports) { 17015 module.exports = factory(matchMedia); 17016 } 17017 else if (typeof define === 'function' && define.amd) { 17018 define(function() { 17019 return (context[name] = factory(matchMedia)); 17020 }); 17021 } 17022 else { 17023 context[name] = factory(matchMedia); 17024 } 17025}('enquire', this, function (matchMedia) { 17026 17027 'use strict'; 17028 17029 /*jshint unused:false */ 17030 /** 17031 * Helper function for iterating over a collection 17032 * 17033 * @param collection 17034 * @param fn 17035 */ 17036 function each(collection, fn) { 17037 var i = 0, 17038 length = collection.length, 17039 cont; 17040 17041 for(i; i < length; i++) { 17042 cont = fn(collection[i], i); 17043 if(cont === false) { 17044 break; //allow early exit 17045 } 17046 } 17047 } 17048 17049 /** 17050 * Helper function for determining whether target object is an array 17051 * 17052 * @param target the object under test 17053 * @return {Boolean} true if array, false otherwise 17054 */ 17055 function isArray(target) { 17056 return Object.prototype.toString.apply(target) === '[object Array]'; 17057 } 17058 17059 /** 17060 * Helper function for determining whether target object is a function 17061 * 17062 * @param target the object under test 17063 * @return {Boolean} true if function, false otherwise 17064 */ 17065 function isFunction(target) { 17066 return typeof target === 'function'; 17067 } 17068 17069 /** 17070 * Delegate to handle a media query being matched and unmatched. 17071 * 17072 * @param {object} options 17073 * @param {function} options.match callback for when the media query is matched 17074 * @param {function} [options.unmatch] callback for when the media query is unmatched 17075 * @param {function} [options.setup] one-time callback triggered the first time a query is matched 17076 * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched? 17077 * @constructor 17078 */ 17079 function QueryHandler(options) { 17080 this.options = options; 17081 !options.deferSetup && this.setup(); 17082 } 17083 QueryHandler.prototype = { 17084 17085 /** 17086 * coordinates setup of the handler 17087 * 17088 * @function 17089 */ 17090 setup : function() { 17091 if(this.options.setup) { 17092 this.options.setup(); 17093 }
17094 this.initialised = true; 17095 }, 17096 17097 /** 17098 * coordinates setup and triggering of the handler 17099 * 17100 * @function 17101 */ 17102 on : function() { 17103 !this.initialised && this.setup(); 17104 this.options.match && this.options.match(); 17105 }, 17106 17107 /** 17108 * coordinates the unmatch event for the handler 17109 * 17110 * @function 17111 */ 17112 off : function() { 17113 this.options.unmatch && this.options.unmatch(); 17114 }, 17115 17116 /** 17117 * called when a handler is to be destroyed. 17118 * delegates to the destroy or unmatch callbacks, depending on availability. 17119 * 17120 * @function 17121 */ 17122 destroy : function() { 17123 this.options.destroy ? this.options.destroy() : this.off(); 17124 }, 17125 17126 /** 17127 * determines equality by reference. 17128 * if object is supplied compare options, if function, compare match callback 17129 * 17130 * @function 17131 * @param {object || function} [target] the target for comparison 17132 */ 17133 equals : function(target) { 17134 return this.options === target || this.options.match === target; 17135 } 17136 17137 }; 17138 /** 17139 * Represents a single media query, manages it's state and registered handlers for this query 17140 * 17141 * @constructor 17142 * @param {string} query the media query string 17143 * @param {boolean} [isUnconditional=false] whether the media query should run regardless of whether the conditions are met. Primarily for helping older browsers deal with mobile-first design 17144 */ 17145 function MediaQuery(query, isUnconditional) { 17146 this.query = query; 17147 this.isUnconditional = isUnconditional; 17148 this.handlers = []; 17149 this.mql = matchMedia(query); 17150 17151 var self = this; 17152 this.listener = function(mql) { 17153 self.mql = mql; 17154 self.assess(); 17155 }; 17156 this.mql.addListener(this.listener); 17157 } 17158 MediaQuery.prototype = { 17159 17160 /** 17161 * add a handler for this query, triggering if already active 17162 * 17163 * @param {object} handler 17164 * @param {function} handler.match callback for when query is activated 17165 * @param {function} [handler.unmatch] callback for when query is deactivated 17166 * @param {function} [handler.setup] callback for immediate execution when a query handler is registered 17167 * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched? 17168 */ 17169 addHandler : function(handler) { 17170 var qh = new QueryHandler(handler); 17171 this.handlers.push(qh); 17172 17173 this.matches() && qh.on(); 17174 }, 17175 17176 /** 17177 * removes the given handler from the collection, and calls it's destroy methods 17178 * 17179 * @param {object || function} handler the handler to remove 17180 */ 17181 removeHandler : function(handler) { 17182 var handlers = this.handlers; 17183 each(handlers, function(h, i) { 17184 if(h.equals(handler)) { 17185 h.destroy(); 17186 return !handlers.splice(i,1); //remove from array and exit each early 17187 } 17188 }); 17189 }, 17190 17191 /** 17192 * Determine whether the media query should be considered a match 17193 * 17194 * @return {Boolean} true if media query can be considered a match, false otherwise 17195 */ 17196 matches : function() { 17197 return this.mql.matches || this.isUnconditional; 17198 }, 17199 17200 /** 17201 * Clears all handlers and unbinds events 17202 */ 17203 clear : function() { 17204 each(this.handlers, function(handler) { 17205 handler.destroy(); 17206 }); 17207 this.mql.removeListener(this.listener); 17208 this.handlers.length = 0; //clear array 17209 }, 17210 17211 /* 17212 * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match 17213 */ 17214 assess : function() { 17215 var action = this.matches() ? 'on' : 'off'; 17216 17217 each(this.handlers, function(handler) { 17218 handler[action](); 17219 }); 17220 } 17221 }; 17222 /** 17223 * Allows for registration of query handlers. 17224 * Manages the query handler's state and is responsible for wiring up browser events 17225 * 17226 * @constructor 17227 */ 17228 function MediaQueryDispatch () { 17229 if(!matchMedia) {
17230 throw new Error('matchMedia not present, legacy browsers require a polyfill'); 17231 } 17232 17233 this.queries = {}; 17234 this.browserIsIncapable = !matchMedia('only all').matches; 17235 } 17236 17237 MediaQueryDispatch.prototype = { 17238 17239 /** 17240 * Registers a handler for the given media query 17241 * 17242 * @param {string} q the media query 17243 * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers 17244 * @param {function} options.match fired when query matched 17245 * @param {function} [options.unmatch] fired when a query is no longer matched 17246 * @param {function} [options.setup] fired when handler first triggered 17247 * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched 17248 * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers 17249 */ 17250 register : function(q, options, shouldDegrade) { 17251 var queries = this.queries, 17252 isUnconditional = shouldDegrade && this.browserIsIncapable; 17253 17254 if(!queries[q]) { 17255 queries[q] = new MediaQuery(q, isUnconditional); 17256 } 17257 17258 //normalise to object in an array 17259 if(isFunction(options)) { 17260 options = { match : options }; 17261 } 17262 if(!isArray(options)) { 17263 options = [options]; 17264 } 17265 each(options, function(handler) { 17266 if (isFunction(handler)) { 17267 handler = { match : handler }; 17268 } 17269 queries[q].addHandler(handler); 17270 }); 17271 17272 return this; 17273 }, 17274 17275 /** 17276 * unregisters a query and all it's handlers, or a specific handler for a query 17277 * 17278 * @param {string} q the media query to target 17279 * @param {object || function} [handler] specific handler to unregister 17280 */ 17281 unregister : function(q, handler) { 17282 var query = this.queries[q]; 17283 17284 if(query) { 17285 if(handler) { 17286 query.removeHandler(handler); 17287 } 17288 else { 17289 query.clear(); 17290 delete this.queries[q]; 17291 } 17292 } 17293 17294 return this; 17295 } 17296 }; 17297 17298 return new MediaQueryDispatch(); 17299 17300})); 17301jQuery(document).ready(function () { 17302 17303 jQuery('.main-menu-trigger').click(function(){ 17304 jQuery("body").toggleClass('mobile-menu-open'); 17305 }); 17306 17307 jQuery('.mobile-menu-page-overlay').click(function(){ 17308 jQuery("body").removeClass('mobile-menu-open'); 17309 }); 17310 17311 jQuery('.filters-trigger').click(function(){ 17312 jQuery('body').addClass('open-filter-sidebar'); 17313 }); 17314 jQuery('.filters-overlay').click(function(){ 17315 jQuery('body').removeClass('open-filter-sidebar'); 17316 }); 17317 17318 17319 jQuery('.main-menu > .parent').append('<span class="submenu-trigger"><i class="zmdi zmdi-plus"></i></span>'); 17320 17321 jQuery('.submenu-trigger').click(function(){ 17322 jQuery(this).prev().toggleClass('expanded'); 17323 jQuery(this).find('.zmdi').toggleClass('zmdi-plus zmdi-minus'); 17324 }); 17325 17326 jQuery(window).trigger('scroll'); 17327 jQuery(window).trigger('resize'); 17328}); 17329 17330jQuery(window).load(function () { 17331 // Replace retina images 17332 if (window.devicePixelRatio >= 2) { 17333 jQuery('img').each(function () { 17334 data2x = jQuery(this).data('2x'); 17335 if (data2x != "") { 17336 // Set new src 17337 jQuery(this).attr('src', data2x); 17338 } 17339 }); 17340 } 17341}); 17342function scrollPageToTop() { 17343 jQuery('html,body').animate({scrollTop: jQuery('html,body').offset().top - jQuery('desktop-sticky').outerHeight()}, 500); 17344 return false; 17345} 17346 17347jQuery(window).scroll(function () { 17348 17349 if (jQuery(window).scrollTop() > 500) 17350 jQuery(".back-to-top").addClass('visible'); 17351 else 17352 jQuery(".back-to-top").removeClass('visible'); 17353}); 17354 17355jQuery(function() { 17356 17357 jQuery('.amshopby-filters-top .amshopby-item-top > dl > dt').click(function(){ 17358 jQuery(this).parent().toggleClass('expanded'); 17359 jQuery(this).parent().find('dd').stop().slideToggle(150); 17360 }); 17361}); 17362document.observe("dom:loaded", function() { 17363AmAjaxShoppCartLoad(); 17364 17365 (function($){ 17366 17367 $.confirm = function(params){ 17368 if($('#confirmOverlay', window.parent.document).length > 0){ 17369 // A confirm is already shown on the page: 17370 return false;
17371 } 17372 17373 var buttonHTML = ''; 17374 $.each(params.buttons,function(name,obj){ 17375 17376 // Generating the markup for the buttons: 17377 17378 buttonHTML += '<button class="'+obj['class']+'"><span><span>'+obj['name']+'</span></span></button>'; 17379 17380 if(!obj.action){ 17381 obj.action = function(){}; 17382 } 17383 }); 17384 17385 var confirmOverlay = document.createElement('div'); 17386 confirmOverlay = $(confirmOverlay); // fix for IE 17387 confirmOverlay.attr('id','confirmOverlay'); 17388 17389 var hideDiv = document.createElement('div'); 17390 hideDiv = $(hideDiv); // fix for IE 17391 hideDiv.attr('id','hideDiv'); 17392 hideDiv.appendTo(confirmOverlay); 17393 17394 var confirmBox = document.createElement('div'); 17395 confirmBox = $(confirmBox); // fix for IE 17396 confirmBox.attr('id','confirmBox'); 17397 switch(AmAjaxObj.options['align']){ 17398 case "1": 17399 confirmBox.css('top', '130px'); 17400 confirmBox.css('left', '50%'); 17401 break; 17402 case "2": 17403 confirmBox.css('top', '130px'); 17404 confirmBox.css('left', '230px'); 17405 break; 17406 case "3": 17407 confirmBox.css('top', '130px'); 17408 confirmBox.css('right', '0px'); 17409 break; 17410 case "4": 17411 confirmBox.css('top', '30%'); 17412 confirmBox.css('left', '230px'); 17413 break; 17414 case "5": 17415 confirmBox.css('top', '30%'); 17416 confirmBox.css('right', '0px'); 17417 break; 17418 case "0": 17419 default: 17420 confirmBox.css('top', '30%'); 17421 confirmBox.css('left', '50%'); 17422 } 17423 confirmBox.appendTo(confirmOverlay); 17424 17425 var confirmButtons = document.createElement('div'); 17426 confirmButtons = $(confirmButtons); // fix for IE 17427 confirmButtons.attr('id','confirmButtons'); 17428 confirmButtons.html(buttonHTML); 17429 confirmButtons.appendTo(confirmBox); 17430 17431 var messageBox = document.createElement('div'); 17432 messageBox = $(messageBox); // fix for IE 17433 messageBox.attr('id','messageBox'); 17434 messageBox.html(params.message); 17435 messageBox.insertBefore(confirmButtons); 17436 17437 /* 17438 03-11-2016 - Titel van blok weggehaald 17439 var title = document.createElement('h1'); 17440 title = $(title); // fix for IE 17441 title.html(params.title); 17442 title.insertBefore(messageBox); 17443 */ 17444 17445 confirmOverlay.hide().appendTo($('body', window.parent.document)); 17446 17447 confirmOverlay.fadeIn(); 17448 var conWidth = confirmBox.width()/2; 17449 if(conWidth < 160) conWidth = 230; 17450 confirmBox.css('marginLeft', -conWidth); 17451 hideDiv.click(function(){ $.confirm.hide();}); 17452 // confirmOverlay.show("medium"); 17453 // confirmOverlay.slideDown("slow") ; 17454 var buttons = $('#confirmButtons button', window.parent.document), 17455 i = 0; 17456 17457 $.each(params.buttons,function(name,obj){ 17458 buttons.eq(i++).click(function(){ 17459 obj.action(); 17460 return false; 17461 }); 17462 }); 17463 $.confirm.timer(); 17464 } 17465 17466 $.confirm.timer = function(){ 17467 var elem= $('#confirmButtons button:last-child', window.parent.document); 17468 var value = elem.text(); 17469 var sec = parseInt(value.replace(/\D+/g,"")); 17470 if(sec) 17471 document.timer = setInterval("AmAjaxObj.oneSec();", 1000); 17472 } 17473 17474 $.confirm.hide = function(){ 17475 $('#confirmOverlay', window.parent.document).fadeOut(function(){ 17476 var hasPopupOptions = $('#confirmBox .super-attribute-select', window.parent.document).length; 17477 $(this).remove(); 17478 if($('.col-main', window.parent.document).length && hasPopupOptions){ 17479 if('undefined' != typeof(currentOptionsPrice)){ 17480 optionsPrice = currentOptionsPrice; 17481 } 17482 if('undefined' != typeof(currentopConfig)){ 17483 opConfig = currentopConfig; 17484 } 17485 if('undefined' != typeof(currentspConfig)){ 17486 spConfig = currentspConfig; 17487 } 17488 //jQuery(function($){$('.col-main').html().replace(/var /g, "").evalScripts();}) 17489 } 17490 if('undefined' != typeof(parent.jQuery.fancybox)){ 17491 parent.jQuery.fancybox.close(); 17492 } 17493 17494 }); 17495 } 17496 17497 })(jQuery); 17498 17499}); 17500/** 17501 * Magento 17502 * 17503 * NOTICE OF LICENSE 17504 * 17505 * This source file is subject to the Academic Free License (AFL 3.0)
17506 * that is bundled with this package in the file LICENSE_AFL.txt. 17507 * It is also available through the world-wide-web at this URL: 17508 * http://opensource.org/licenses/afl-3.0.php 17509 * If you did not receive a copy of the license and are unable to 17510 * obtain it through the world-wide-web, please send an email 17511 * to [email protected] so we can send you a copy immediately. 17512 * 17513 * DISCLAIMER 17514 * 17515 * Do not edit or add to this file if you wish to upgrade Magento to newer 17516 * versions in the future. If you wish to customize Magento for your 17517 * needs please refer to http://www.magento.com for more information. 17518 * 17519 * @category design 17520 * @package base_default 17521 * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) 17522 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 17523 */ 17524if(typeof Product=='undefined') { 17525 var Product = {}; 17526} 17527/**************************** BUNDLE PRODUCT **************************/ 17528Product.Bundle = Class.create(); 17529Product.Bundle.prototype = { 17530 initialize: function(config){ 17531 this.config = config; 17532 17533 // Set preconfigured values for correct price base calculation 17534 if (config.defaultValues) { 17535 for (var option in config.defaultValues) { 17536 if (this.config['options'][option].isMulti) { 17537 var selected = new Array(); 17538 for (var i = 0; i < config.defaultValues[option].length; i++) { 17539 selected.push(config.defaultValues[option][i]); 17540 } 17541 this.config.selected[option] = selected; 17542 } else { 17543 this.config.selected[option] = new Array(config.defaultValues[option] + ""); 17544 } 17545 } 17546 } 17547 17548 this.reloadPrice(); 17549 }, 17550 changeSelection: function(selection){ 17551 var parts = selection.id.split('-'); 17552 if (this.config['options'][parts[2]].isMulti) { 17553 selected = new Array(); 17554 if (selection.tagName == 'SELECT') { 17555 for (var i = 0; i < selection.options.length; i++) { 17556 if (selection.options[i].selected && selection.options[i].value != '') { 17557 selected.push(selection.options[i].value); 17558 } 17559 } 17560 } else if (selection.tagName == 'INPUT') { 17561 selector = parts[0]+'-'+parts[1]+'-'+parts[2]; 17562 selections = $$('.'+selector); 17563 for (var i = 0; i < selections.length; i++) { 17564 if (selections[i].checked && selections[i].value != '') { 17565 selected.push(selections[i].value); 17566 } 17567 } 17568 } 17569 this.config.selected[parts[2]] = selected; 17570 } else { 17571 if (selection.value != '') { 17572 this.config.selected[parts[2]] = new Array(selection.value); 17573 } else { 17574 this.config.selected[parts[2]] = new Array(); 17575 } 17576 this.populateQty(parts[2], selection.value); 17577 var tierPriceElement = $('bundle-option-' + parts[2] + '-tier-prices'), 17578 tierPriceHtml = ''; 17579 if (selection.value != '' && this.config.options[parts[2]].selections[selection.value].customQty == 1) { 17580 tierPriceHtml = this.config.options[parts[2]].selections[selection.value].tierPriceHtml; 17581 } 17582 tierPriceElement.update(tierPriceHtml); 17583 } 17584 this.reloadPrice(); 17585 }, 17586 17587 reloadPrice: function() { 17588 var calculatedPrice = 0; 17589 var dispositionPrice = 0; 17590 var includeTaxPrice = 0; 17591 17592 for (var option in this.config.selected) { 17593 if (this.config.options[option]) { 17594 for (var i=0; i < this.config.selected[option].length; i++) { 17595 var prices = this.selectionPrice(option, this.config.selected[option][i]); 17596 calculatedPrice += Number(prices[0]); 17597 dispositionPrice += Number(prices[1]); 17598 includeTaxPrice += Number(prices[2]); 17599 } 17600 } 17601 } 17602 17603 //Tax is calculated in a different way for the the TOTAL BASED method 17604 //We round the taxes at the end. Hence we do the same for consistency 17605 //This variable is set in the bundle.phtml 17606 if (taxCalcMethod == CACL_TOTAL_BASE) { 17607 var calculatedPriceFormatted = calculatedPrice.toFixed(10); 17608 var includeTaxPriceFormatted = includeTaxPrice.toFixed(10); 17609 var tax = includeTaxPriceFormatted - calculatedPriceFormatted; 17610 calculatedPrice = includeTaxPrice - Math.round(tax * 100) / 100; 17611 } 17612
17613 //make sure that the prices are all rounded to two digits 17614 //this is needed when tax calculation is based on total for dynamic 17615 //price bundle product. For fixed price bundle product, the rounding 17616 //needs to be done after option price is added to base price 17617 if (this.config.priceType == '0') { 17618 calculatedPrice = Math.round(calculatedPrice*100)/100; 17619 dispositionPrice = Math.round(dispositionPrice*100)/100; 17620 includeTaxPrice = Math.round(includeTaxPrice*100)/100; 17621 17622 } 17623 17624 var event = $(document).fire('bundle:reload-price', { 17625 price: calculatedPrice, 17626 priceInclTax: includeTaxPrice, 17627 dispositionPrice: dispositionPrice, 17628 bundle: this 17629 }); 17630 if (!event.noReloadPrice) { 17631 optionsPrice.specialTaxPrice = 'true'; 17632 optionsPrice.changePrice('bundle', calculatedPrice); 17633 optionsPrice.changePrice('nontaxable', dispositionPrice); 17634 optionsPrice.changePrice('priceInclTax', includeTaxPrice); 17635 optionsPrice.reload(); 17636 } 17637 17638 return calculatedPrice; 17639 }, 17640 17641 selectionPrice: function(optionId, selectionId) { 17642 if (selectionId == '' || selectionId == 'none' || typeof(this.config.options[optionId].selections[selectionId]) == 'undefined') { 17643 return 0; 17644 } 17645 var qty = null; 17646 var tierPriceInclTax, tierPriceExclTax; 17647 if (this.config.options[optionId].selections[selectionId].customQty == 1 && !this.config['options'][optionId].isMulti) { 17648 if ($('bundle-option-' + optionId + '-qty-input')) { 17649 qty = $('bundle-option-' + optionId + '-qty-input').value; 17650 } else { 17651 qty = 1; 17652 } 17653 } else { 17654 qty = this.config.options[optionId].selections[selectionId].qty; 17655 } 17656 if (this.config.priceType == '0') { 17657 price = this.config.options[optionId].selections[selectionId].price; 17658 tierPrice = this.config.options[optionId].selections[selectionId].tierPrice; 17659 17660 for (var i=0; i < tierPrice.length; i++) { 17661 if (Number(tierPrice[i].price_qty) <= qty && Number(tierPrice[i].price) <= price) { 17662 price = tierPrice[i].price; 17663 tierPriceInclTax = tierPrice[i].priceInclTax; 17664 tierPriceExclTax = tierPrice[i].priceExclTax; 17665 } 17666 } 17667 } else { 17668 selection = this.config.options[optionId].selections[selectionId]; 17669 if (selection.priceType == '0') { 17670 price = selection.priceValue; 17671 } else { 17672 price = (this.config.basePrice*selection.priceValue)/100; 17673 } 17674 } 17675 //price += this.config.options[optionId].selections[selectionId].plusDisposition; 17676 //price -= this.config.options[optionId].selections[selectionId].minusDisposition; 17677 //return price*qty; 17678 var disposition = this.config.options[optionId].selections[selectionId].plusDisposition + 17679 this.config.options[optionId].selections[selectionId].minusDisposition; 17680 17681 if (this.config.specialPrice) { 17682 newPrice = (price*this.config.specialPrice)/100; 17683 price = Math.min(newPrice, price); 17684 } 17685 17686 selection = this.config.options[optionId].selections[selectionId]; 17687 if (tierPriceInclTax !== undefined && tierPriceExclTax !== undefined) { 17688 priceInclTax = tierPriceInclTax; 17689 price = tierPriceExclTax; 17690 } else if (selection.priceInclTax !== undefined) { 17691 priceInclTax = selection.priceInclTax; 17692 price = selection.priceExclTax !== undefined ? selection.priceExclTax : selection.price; 17693 } else { 17694 priceInclTax = price; 17695 } 17696 17697 if (this.config.priceType == '1' || taxCalcMethod == CACL_TOTAL_BASE) { 17698 var result = new Array(price*qty, disposition*qty, priceInclTax*qty); 17699 return result; 17700 } 17701 else if (taxCalcMethod == CACL_UNIT_BASE) { 17702 price = (Math.round(price*100)/100).toString(); 17703 disposition = (Math.round(disposition*100)/100).toString(); 17704 priceInclTax = (Math.round(priceInclTax*100)/100).toString(); 17705 var result = new Array(price*qty, disposition*qty, priceInclTax*qty); 17706 return result; 17707 } else { //taxCalcMethod == CACL_ROW_BASE) 17708 price = (Math.round(price*qty*100)/100).toString(); 17709 disposition = (Math.round(disposition*qty*100)/100).toString(); 17710 priceInclTax = (Math.round(priceInclTax*qty*100)/100).toString(); 17711 var result = new Array(price, disposition, priceInclTax); 17712 return result; 17713 } 17714 }, 17715 17716 populateQty: function(optionId, selectionId){ 17717 if (selectionId == '' || selectionId == 'none') { 17718 this.showQtyInput(optionId, '0', false); 17719 return; 17720 } 17721 if (this.config.options[optionId].selections[selectionId].customQty == 1) { 17722 this.showQtyInput(optionId, this.config.options[optionId].selections[selectionId].qty, true); 17723 } else { 17724 this.showQtyInput(optionId, this.config.options[optionId].selections[selectionId].qty, false); 17725 } 17726 }, 17727 17728 showQtyInput: function(optionId, value, canEdit) { 17729 elem = $('bundle-option-' + optionId + '-qty-input'); 17730 elem.value = value; 17731 elem.disabled = !canEdit; 17732 if (canEdit) { 17733 elem.removeClassName('qty-disabled'); 17734 } else { 17735 elem.addClassName('qty-disabled'); 17736 } 17737 }, 17738 17739 changeOptionQty: function (element, event) { 17740 var checkQty = true; 17741 if (typeof(event) != 'undefined') { 17742 if (event.keyCode == 8 || event.keyCode == 46) { 17743 checkQty = false;
17744 } 17745 } 17746 if (checkQty && (Number(element.value) == 0 || isNaN(Number(element.value)))) { 17747 element.value = 1; 17748 } 17749 parts = element.id.split('-'); 17750 optionId = parts[2]; 17751 if (!this.config['options'][optionId].isMulti) { 17752 selectionId = this.config.selected[optionId][0]; 17753 this.config.options[optionId].selections[selectionId].qty = element.value*1; 17754 this.reloadPrice(); 17755 } 17756 }, 17757 17758 validationCallback: function (elmId, result){ 17759 if (elmId == undefined || $(elmId) == undefined) { 17760 return; 17761 } 17762 var container = $(elmId).up('ul.options-list'); 17763 if (typeof container != 'undefined') { 17764 if (result == 'failed') { 17765 container.removeClassName('validation-passed'); 17766 container.addClassName('validation-failed'); 17767 } else { 17768 container.removeClassName('validation-failed'); 17769 container.addClassName('validation-passed'); 17770 } 17771 } 17772 } 17773}; 17774
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.