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-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) { 6598 return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9]+$/.test(v) 6599 }], 6600 ['validate-alphanum-with-spaces', 'Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.', function(v) { 6601 return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9 ]+$/.test(v) 6602 }], 6603 ['validate-street', 'Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.', function(v) { 6604 return Validation.get('IsEmpty').test(v) || /^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(v) 6605 }], 6606 ['validate-phoneStrict', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) { 6607 return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v); 6608 }], 6609 ['validate-phoneLax', '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[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(v); 6611 }], 6612 ['validate-fax', 'Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.', function(v) { 6613 return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v); 6614 }], 6615 ['validate-date', 'Please enter a valid date.', function(v) { 6616 var test = new Date(v); 6617 return Validation.get('IsEmpty').test(v) || !isNaN(test); 6618 }], 6619 ['validate-date-range', 'The From Date value should be less than or equal to the To Date value.', function(v, elm) { 6620 var m = /\bdate-range-(\w+)-(\w+)\b/.exec(elm.className); 6621 if (!m || m[2] == 'to' || Validation.get('IsEmpty').test(v)) { 6622 return true; 6623 } 6624 6625 var currentYear = new Date().getFullYear() + ''; 6626 var normalizedTime = function(v) { 6627 v = v.split(/[.\/]/); 6628 if (v[2] && v[2].length < 4) { 6629 v[2] = currentYear.substr(0, v[2].length) + v[2]; 6630 } 6631 return new Date(v.join('/')).getTime(); 6632 }; 6633 6634 var dependentElements = Element.select(elm.form, '.validate-date-range.date-range-' + m[1] + '-to'); 6635 return !dependentElements.length || Validation.get('IsEmpty').test(dependentElements[0].value) 6636 || normalizedTime(v) <= normalizedTime(dependentElements[0].value); 6637 }], 6638 ['validate-email', 'Please enter a valid email address. For example [email protected].', function (v) { 6639 //return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v) 6640 //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) 6641 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) 6642 }], 6643 ['validate-emailSender', 'Please use only visible characters and spaces.', function (v) { 6644 return Validation.get('IsEmpty').test(v) || /^[\S ]+$/.test(v) 6645 }], 6646 ['validate-password', 'Please enter 6 or more characters without leading or trailing space
6646s.', function(v) { 6647 var pass=v.strip(); /*strip leading and trailing spaces*/ 6648 return (!(v.length>0 && v.length < 6) && v.length == pass.length); 6649 }], 6650 ['validate-admin-password', 'Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.', function(v) { 6651 var pass=v.strip(); 6652 if (0 == pass.length) { 6653 return true; 6654 } 6655 if (!(/[a-z]/i.test(v)) || !(/[0-9]/.test(v))) { 6656 return false; 6657 } 6658 return !(pass.length < 7); 6659 }], 6660 ['validate-cpassword', 'Please make sure your passwords match.', function(v) { 6661 var conf = $('confirmation') ? $('confirmation') : $$('.validate-cpassword')[0]; 6662 var pass = false; 6663 if ($('password')) { 6664 pass = $('password'); 6665 } 6666 var passwordElements = $$('.validate-password'); 6667 for (var i = 0; i < passwordElements.size(); i++) { 6668 var passwordElement = passwordElements[i]; 6669 if (passwordElement.up('form').id == conf.up('form').id) { 6670 pass = passwordElement; 6671 } 6672 } 6673 if ($$('.validate-admin-password').size()) { 6674 pass = $$('.validate-admin-password')[0]; 6675 } 6676 return (pass.value == conf.value); 6677 }], 6678 ['validate-both-passwords', 'Please make sure your passwords match.', function(v, input) { 6679 var dependentInput = $(input.form[input.name == 'password' ? 'confirmation' : 'password']), 6680 isEqualValues = input.value == dependentInput.value; 6681 6682 if (isEqualValues && dependentInput.hasClassName('validation-failed')) { 6683 Validation.test(this.className, dependentInput); 6684 } 6685 6686 return dependentInput.value == '' || isEqualValues; 6687 }], 6688 ['validate-url', 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)', function (v) { 6689 v = (v || '').replace(/^\s+/, '').replace(/\s+$/, ''); 6690 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) 6691 }], 6692 ['validate-clean-url', 'Please enter a valid URL. For example http://www.example.com or www.example.com', function (v) { 6693 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) 6694 }], 6695 ['validate-identifier', 'Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page".', function (v) { 6696 return Validation.get('IsEmpty').test(v) || /^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/.test(v) 6697 }], 6698 ['validate-xml-identifier', 'Please enter a valid XML-identifier. For example something_1, block5, id-4.', function (v) { 6699 return Validation.get('IsEmpty').test(v) || /^[A-Z][A-Z0-9_\/-]*$/i.test(v) 6700 }], 6701 ['validate-ssn', 'Please enter a valid social security number. For example 123-45-6789.', function(v) { 6702 return Validation.get('IsEmpty').test(v) || /^\d{3}-?\d{2}-?\d{4}$/.test(v); 6703 }], 6704 ['validate-zip', 'Please enter a valid zip code. For example 90602 or 90602-1234.', function(v) { 6705 return Validation.get('IsEmpty').test(v) || /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(v); 6706 }], 6707 ['validate-zip-international', 'Please enter a valid zip code.', function(v) { 6708 //return Validation.get('IsEmpty').test(v) || /(^[A-z0-9]{2,10}([\s]{0,1}|[\-]{0,1})[A-z0-9]{2,10}$)/.test(v); 6709 return true; 6710 }], 6711 ['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.', function(v) { 6712 if(Validation.get('IsEmpty').test(v)) return true; 6713 var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/; 6714 if(!regex.test(v)) return false;
6715 var d = new Date(v.replace(regex, '$2/$1/$3')); 6716 return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) && 6717 (parseInt(RegExp.$1, 10) == d.getDate()) && 6718 (parseInt(RegExp.$3, 10) == d.getFullYear() ); 6719 }], 6720 ['validate-currency-dollar', 'Please enter a valid $ amount. For example $100.00.', function(v) { 6721 // [$]1[##][,###]+[.##] 6722 // [$]1###+[.##] 6723 // [$]0.## 6724 // [$].## 6725 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) 6726 }], 6727 ['validate-one-required', 'Please select one of the above options.', function (v,elm) { 6728 var p = elm.parentNode; 6729 var options = p.getElementsByTagName('INPUT'); 6730 return $A(options).any(function(elm) { 6731 return $F(elm); 6732 }); 6733 }], 6734 ['validate-one-required-by-name', 'Please select one of the options.', function (v,elm) { 6735 var inputs = $$('input[name="' + elm.name.replace(/([\\"])/g, '\\$1') + '"]'); 6736 6737 var error = 1; 6738 for(var i=0;i<inputs.length;i++) { 6739 if((inputs[i].type == 'checkbox' || inputs[i].type == 'radio') && inputs[i].checked == true) { 6740 error = 0; 6741 } 6742 6743 if(Validation.isOnChange && (inputs[i].type == 'checkbox' || inputs[i].type == 'radio')) { 6744 Validation.reset(inputs[i]); 6745 } 6746 } 6747 6748 if( error == 0 ) { 6749 return true; 6750 } else { 6751 return false; 6752 } 6753 }], 6754 ['validate-not-negative-number', 'Please enter a number 0 or greater in this field.', function(v) { 6755 if (Validation.get('IsEmpty').test(v)) { 6756 return true; 6757 } 6758 v = parseNumber(v); 6759 return !isNaN(v) && v >= 0; 6760 }], 6761 ['validate-zero-or-greater', 'Please enter a number 0 or greater in this field.', function(v) { 6762 return Validation.get('validate-not-negative-number').test(v); 6763 }], 6764 ['validate-greater-than-zero', 'Please enter a number greater than 0 in this field.', function(v) { 6765 if (Validation.get('IsEmpty').test(v)) { 6766 return true; 6767 } 6768 v = parseNumber(v); 6769 return !isNaN(v) && v > 0; 6770 }], 6771 6772 ['validate-special-price', 'The Special Price is active only when lower than the Actual Price.', function(v) { 6773 var priceInput = $('price'); 6774 var priceType = $('price_type'); 6775 var priceValue = parseFloat(v); 6776 6777 // Passed on non-related validators conditions (to not change order of validation) 6778 if( 6779 !priceInput 6780 || Validation.get('IsEmpty').test(v) 6781 || !Validation.get('validate-number').test(v) 6782 ) { 6783 return true; 6784 } 6785 if(priceType) { 6786 return (priceType && priceValue <= 99.99); 6787 } 6788 return priceValue < parseFloat($F(priceInput)); 6789 }], 6790 ['validate-state', 'Please select State/Province.', function(v) { 6791 return (v!=0 || v == ''); 6792 }], 6793 ['validate-new-password', 'Please enter 6 or more characters without leading or trailing spaces.', function(v) { 6794 if (!Validation.get('validate-password').test(v)) return false; 6795 if (Validation.get('IsEmpty').test(v) && v != '') return false; 6796 return true; 6797 }], 6798 ['validate-cc-number', 'Please enter a valid credit card number.', function(v, elm) { 6799 // remove non-numerics 6800 var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type'); 6801 if (ccTypeContainer && typeof Validation.creditCartTypes.get(ccTypeContainer.value) != 'undefined' 6802 && Validation.creditCartTypes.get(ccTypeContainer.value)[2] == false) { 6803 if (!Validation.get('IsEmpty').test(v) && Validation.get('validate-digits').test(v)) { 6804 return true; 6805 } else { 6806 return false;
6807 } 6808 } 6809 return validateCreditCard(v); 6810 }], 6811 ['validate-cc-type', 'Credit card number does not match credit card type.', function(v, elm) { 6812 // remove credit card number delimiters such as "-" and space 6813 elm.value = removeDelimiters(elm.value); 6814 v = removeDelimiters(v); 6815 6816 var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type'); 6817 if (!ccTypeContainer) { 6818 return true; 6819 } 6820 var ccType = ccTypeContainer.value; 6821 6822 if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') { 6823 return false; 6824 } 6825 6826 // Other card type or switch or solo card 6827 if (Validation.creditCartTypes.get(ccType)[0]==false) { 6828 return true; 6829 } 6830 6831 var validationFailure = false; 6832 Validation.creditCartTypes.each(function (pair) { 6833 if (pair.key == ccType) { 6834 if (pair.value[0] && !v.match(pair.value[0])) { 6835 validationFailure = true; 6836 } 6837 throw $break; 6838 } 6839 }); 6840 6841 if (validationFailure) { 6842 return false; 6843 } 6844 6845 if (ccTypeContainer.hasClassName('validation-failed') && Validation.isOnChange) { 6846 Validation.validate(ccTypeContainer); 6847 } 6848 6849 return true; 6850 }], 6851 ['validate-cc-type-select', 'Card type does not match credit card number.', function(v, elm) { 6852 var ccNumberContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_type')) + '_cc_number'); 6853 if (Validation.isOnChange && Validation.get('IsEmpty').test(ccNumberContainer.value)) { 6854 return true; 6855 } 6856 if (Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer)) { 6857 Validation.validate(ccNumberContainer); 6858 } 6859 return Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer); 6860 }], 6861 ['validate-cc-exp', 'Incorrect credit card expiration date.', function(v, elm) { 6862 var ccExpMonth = v; 6863 var ccExpYear = $(elm.id.substr(0,elm.id.indexOf('_expiration')) + '_expiration_yr').value; 6864 var currentTime = new Date(); 6865 var currentMonth = currentTime.getMonth() + 1; 6866 var currentYear = currentTime.getFullYear(); 6867 if (ccExpMonth < currentMonth && ccExpYear == currentYear) { 6868 return false; 6869 } 6870 return true; 6871 }], 6872 ['validate-cc-cvn', 'Please enter a valid credit card verification number.', function(v, elm) { 6873 var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_cid')) + '_cc_type'); 6874 if (!ccTypeContainer) { 6875 return true; 6876 } 6877 var ccType = ccTypeContainer.value; 6878 6879 if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') { 6880 return false; 6881 } 6882 6883 var re = Validation.creditCartTypes.get(ccType)[1]; 6884 6885 if (v.match(re)) { 6886 return true; 6887 } 6888 6889 return false; 6890 }], 6891 ['validate-ajax', '', function(v, elm) { return true; }], 6892 ['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) { 6893 if(v != '' && v) { 6894 return /^[A-Za-z]+[A-Za-z0-9_]+$/.test(v); 6895 } 6896 return true; 6897 }], 6898 ['validate-css-length', 'Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%.', function (v) { 6899 if (v != '' && v) { 6900 return /^[0-9\.]+(px|pt|em|ex|%)?$/.test(v) && (!(/\..*\./.test(v))) && !(/\.$/.test(v)); 6901 } 6902 return true; 6903 }], 6904 ['validate-length', 'Text length does not satisfy specified text range.', function (v, elm) { 6905 var reMax = new RegExp(/^maximum-length-[0-9]+$/); 6906 var reMin = new RegExp(/^minimum-length-[0-9]+$/); 6907 var result = true; 6908 $w(elm.className).each(function(name, index) { 6909 if (name.match(reMax) && result) { 6910 var length = name.split('-')[2]; 6911 result = (v.length <= length); 6912 } 6913 if (name.match(reMin) && result && !Validation.get('IsEmpty').test(v)) { 6914 var length = name.split('-')[2]; 6915 result = (v.length >= length); 6916 } 6917 }); 6918 return result; 6919 }], 6920 ['validate-percents', 'Please enter a number lower than 100.', {max:100}], 6921 ['required-file', 'Please select a file', function(v, elm) { 6922 var result = !Validation.get('IsEmpty').test(v); 6923 if (result === false) { 6924 ovId = elm.id + '_value'; 6925 if ($(ovId)) { 6926 result = !Validation.get('IsEmpty').test($(ovId).value); 6927 } 6928 } 6929 return result; 6930 }], 6931 ['validate-cc-ukss', 'Please enter issue number or start date for switch/solo card type.', function(v,elm) { 6932 var endposition; 6933 6934 if (elm.id.match(/(.)+_cc_issue$/)) { 6935 endposition = elm.id.indexOf('_cc_issue'); 6936 } else if (elm.id.match(/(.)+_start_month$/)) { 6937 endposition = elm.id.indexOf('_start_month'); 6938 } else { 6939 endposition = elm.id.indexOf('_start_year'); 6940 } 6941 6942 var prefix = elm.id.substr(0,endposition); 6943 6944 var ccTypeContainer = $(prefix + '_cc_type'); 6945 6946 if (!ccTypeContainer) { 6947 return true; 6948 } 6949 var ccType = ccTypeContainer.value; 6950 6951 if(['SS','SM','SO'].indexOf(ccType) == -1){ 6952 return true; 6953 } 6954 6955 $(prefix + '_cc_issue').advaiceContainer 6956 = $(prefix + '_start_month').advaiceContainer 6957 = $(prefix + '_start_year').advaiceContainer 6958 = $(prefix + '_cc_type_ss_div').down('ul li.adv-container'); 6959 6960 var ccIssue = $(prefix + '_cc_issue').value; 6961 var ccSMonth = $(prefix + '_start_month').value; 6962 var ccSYear = $(prefix + '_start_year').value; 6963 6964 var ccStartDatePresent = (ccSMonth && ccSYear) ? true : false;
6965 6966 if (!ccStartDatePresent && !ccIssue){ 6967 return false; 6968 } 6969 return true; 6970 }] 6971]); 6972 6973function removeDelimiters (v) { 6974 v = v.replace(/\s/g, ''); 6975 v = v.replace(/\-/g, ''); 6976 return v; 6977} 6978 6979function parseNumber(v) 6980{ 6981 if (typeof v != 'string') { 6982 return parseFloat(v); 6983 } 6984 6985 var isDot = v.indexOf('.'); 6986 var isComa = v.indexOf(','); 6987 6988 if (isDot != -1 && isComa != -1) { 6989 if (isComa > isDot) { 6990 v = v.replace('.', '').replace(',', '.'); 6991 } 6992 else { 6993 v = v.replace(',', ''); 6994 } 6995 } 6996 else if (isComa != -1) { 6997 v = v.replace(',', '.'); 6998 } 6999 7000 return parseFloat(v); 7001} 7002 7003/** 7004 * Hash with credit card types which can be simply extended in payment modules 7005 * 0 - regexp for card number 7006 * 1 - regexp for cvn 7007 * 2 - check or not credit card number trough Luhn algorithm by 7008 * function validateCreditCard which you can find above in this file 7009 */ 7010Validation.creditCartTypes = $H({ 7011// '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], 7012 '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], 7013 'VI': [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true], 7014 '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], 7015 'AE': [new RegExp('^3[47][0-9]{13}$'), new RegExp('^[0-9]{4}$'), true], 7016 '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], 7017 '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], 7018 '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], 7019 '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], 7020 'OT': [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false] 7021}); 7022 7023// script.aculo.us builder.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 7024 7025// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 7026// 7027// script.aculo.us is freely distributable under the terms of an MIT-style license. 7028// For details, see the script.aculo.us web site: http://script.aculo.us/ 7029 7030var Builder = { 7031 NODEMAP: { 7032 AREA: 'map', 7033 CAPTION: 'table', 7034 COL: 'table', 7035 COLGROUP: 'table', 7036 LEGEND: 'fieldset', 7037 OPTGROUP: 'select', 7038 OPTION: 'select', 7039 PARAM: 'object', 7040 TBODY: 'table', 7041 TD: 'table', 7042 TFOOT: 'table', 7043 TH: 'table', 7044 THEAD: 'table', 7045 TR: 'table' 7046 }, 7047 // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, 7048 // due to a Firefox bug 7049 node: function(elementName) { 7050 elementName = elementName.toUpperCase(); 7051 7052 // try innerHTML approach 7053 var parentTag = this.NODEMAP[elementName] || 'div'; 7054 var parentElement = document.createElement(parentTag); 7055 try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 7056 parentElement.innerHTML = "<" + elementName + "></" + elementName + ">"; 7057 } catch(e) {} 7058 var element = parentElement.firstChild || null; 7059 7060 // see if browser added wrapping tags 7061 if(element && (element.tagName.toUpperCase() != elementName)) 7062 element = element.getElementsByTagName(elementName)[0]; 7063 7064 // fallback to createElement approach 7065 if(!element) element = document.createElement(elementName); 7066 7067 // abort if nothing could be created 7068 if(!element) return; 7069 7070 // attributes (or text) 7071 if(arguments[1]) 7072 if(this._isStringOrNumber(arguments[1]) || 7073 (arguments[1] instanceof Array) || 7074 arguments[1].tagName) { 7075 this._children(element, arguments[1]); 7076 } else { 7077 var attrs = this._attributes(arguments[1]); 7078 if(attrs.length) { 7079 try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 7080 parentElement.innerHTML = "<" +elementName + " " + 7081 attrs + "></" + elementName + ">"; 7082 } catch(e) {} 7083 element = parentElement.firstChild || null; 7084 // workaround firefox 1.0.X bug 7085 if(!element) { 7086 element = document.createElement(elementName); 7087 for(attr in arguments[1]) 7088 element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; 7089 } 7090 if(element.tagName.toUpperCase() != elementName) 7091 element = parentElement.getElementsByTagName(elementName)[0]; 7092 } 7093 } 7094 7095 // text, or array of children 7096 if(arguments[2]) 7097 this._children(element, arguments[2]); 7098 7099 return $(element); 7100 }, 7101 _text: function(text) { 7102 return document.createTextNode(text); 7103 }, 7104 7105 ATTR_MAP: { 7106 'className': 'class', 7107 'htmlFor': 'for' 7108 }, 7109 7110 _attributes: function(attributes) { 7111 var attrs = []; 7112 for(attribute in attributes) 7113 attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + 7114 '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'"') + '"'); 7115 return attrs.join(" "); 7116 }, 7117 _children: function(element, children) { 7118 if(children.tagName) { 7119 element.appendChild(children); 7120 return; 7121 } 7122 if(typeof children=='object') { // array can hold nodes and text 7123 children.flatten().each( function(e) { 7124 if(typeof e=='object') 7125 element.appendChild(e); 7126 else 7127 if(Builder._isStringOrNumber(e)) 7128 element.appendChild(Builder._text(e)); 7129 }); 7130 } else 7131 if(Builder._isStringOrNumber(children)) 7132 element.appendChild(Builder._text(children)); 7133 }, 7134 _isStringOrNumber: function(param) {
7135 return(typeof param=='string' || typeof param=='number'); 7136 }, 7137 build: function(html) { 7138 var element = this.node('div'); 7139 $(element).update(html.strip()); 7140 return element.down(); 7141 }, 7142 dump: function(scope) { 7143 if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope 7144 7145 var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + 7146 "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + 7147 "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ 7148 "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ 7149 "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ 7150 "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); 7151 7152 tags.each( function(tag){ 7153 scope[tag] = function() { 7154 return Builder.node.apply(Builder, [tag].concat($A(arguments))); 7155 }; 7156 }); 7157 } 7158}; 7159// script.aculo.us effects.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 7160 7161// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 7162// Contributors: 7163// Justin Palmer (http://encytemedia.com/) 7164// Mark Pilgrim (http://diveintomark.org/) 7165// Martin Bialasinki 7166// 7167// script.aculo.us is freely distributable under the terms of an MIT-style license. 7168// For details, see the script.aculo.us web site: http://script.aculo.us/ 7169 7170// converts rgb() and #xxx to #xxxxxx format, 7171// returns self (or first argument) if not convertable 7172String.prototype.parseColor = function() { 7173 var color = '#'; 7174 if (this.slice(0,4) == 'rgb(') { 7175 var cols = this.slice(4,this.length-1).split(','); 7176 var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); 7177 } else { 7178 if (this.slice(0,1) == '#') { 7179 if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); 7180 if (this.length==7) color = this.toLowerCase(); 7181 } 7182 } 7183 return (color.length==7 ? color : (arguments[0] || this)); 7184}; 7185 7186/*--------------------------------------------------------------------------*/ 7187 7188Element.collectTextNodes = function(element) { 7189 return $A($(element).childNodes).collect( function(node) { 7190 return (node.nodeType==3 ? node.nodeValue : 7191 (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); 7192 }).flatten().join(''); 7193}; 7194 7195Element.collectTextNodesIgnoreClass = function(element, className) { 7196 return $A($(element).childNodes).collect( function(node) { 7197 return (node.nodeType==3 ? node.nodeValue : 7198 ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 7199 Element.collectTextNodesIgnoreClass(node, className) : '')); 7200 }).flatten().join(''); 7201}; 7202 7203Element.setContentZoom = function(element, percent) { 7204 element = $(element); 7205 element.setStyle({fontSize: (percent/100) + 'em'}); 7206 if (Prototype.Browser.WebKit) window.scrollBy(0,0); 7207 return element; 7208}; 7209 7210Element.getInlineOpacity = function(element){ 7211 return $(element).style.opacity || ''; 7212}; 7213 7214Element.forceRerendering = function(element) { 7215 try { 7216 element = $(element); 7217 var n = document.createTextNode(' '); 7218 element.appendChild(n); 7219 element.removeChild(n); 7220 } catch(e) { } 7221}; 7222 7223/*--------------------------------------------------------------------------*/ 7224 7225var Effect = { 7226 _elementDoesNotExistError: { 7227 name: 'ElementDoesNotExistError', 7228 message: 'The specified DOM element does not exist, but is required for this effect to operate' 7229 }, 7230 Transitions: { 7231 linear: Prototype.K, 7232 sinoidal: function(pos) { 7233 return (-Math.cos(pos*Math.PI)/2) + .5; 7234 }, 7235 reverse: function(pos) { 7236 return 1-pos; 7237 }, 7238 flicker: function(pos) { 7239 var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4; 7240 return pos > 1 ? 1 : pos; 7241 }, 7242 wobble: function(pos) { 7243 return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5; 7244 }, 7245 pulse: function(pos, pulses) { 7246 return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5; 7247 }, 7248 spring: function(pos) { 7249 return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); 7250 }, 7251 none: function(pos) { 7252 return 0; 7253 }, 7254 full: function(pos) { 7255 return 1; 7256 } 7257 }, 7258 DefaultOptions: { 7259 duration: 1.0, // seconds 7260 fps: 100, // 100= assume 66fps max. 7261 sync: false, // true for combining 7262 from: 0.0, 7263 to: 1.0, 7264 delay: 0.0, 7265 queue: 'parallel' 7266 }, 7267 tagifyText: function(element) { 7268 var tagifyStyle = 'position:relative'; 7269 if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; 7270 7271 element = $(element); 7272 $A(element.childNodes).each( function(child) { 7273 if (child.nodeType==3) {
7274 child.nodeValue.toArray().each( function(character) { 7275 element.insertBefore( 7276 new Element('span', {style: tagifyStyle}).update( 7277 character == ' ' ? String.fromCharCode(160) : character), 7278 child); 7279 }); 7280 Element.remove(child); 7281 } 7282 }); 7283 }, 7284 multiple: function(element, effect) { 7285 var elements; 7286 if (((typeof element == 'object') || 7287 Object.isFunction(element)) && 7288 (element.length)) 7289 elements = element; 7290 else 7291 elements = $(element).childNodes; 7292 7293 var options = Object.extend({ 7294 speed: 0.1, 7295 delay: 0.0 7296 }, arguments[2] || { }); 7297 var masterDelay = options.delay; 7298 7299 $A(elements).each( function(element, index) { 7300 new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); 7301 }); 7302 }, 7303 PAIRS: { 7304 'slide': ['SlideDown','SlideUp'], 7305 'blind': ['BlindDown','BlindUp'], 7306 'appear': ['Appear','Fade'] 7307 }, 7308 toggle: function(element, effect) { 7309 element = $(element); 7310 effect = (effect || 'appear').toLowerCase(); 7311 var options = Object.extend({ 7312 queue: { position:'end', scope:(element.id || 'global'), limit: 1 } 7313 }, arguments[2] || { }); 7314 Effect[element.visible() ? 7315 Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); 7316 } 7317}; 7318 7319Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; 7320 7321/* ------------- core effects ------------- */ 7322 7323Effect.ScopedQueue = Class.create(Enumerable, { 7324 initialize: function() { 7325 this.effects = []; 7326 this.interval = null; 7327 }, 7328 _each: function(iterator) { 7329 this.effects._each(iterator); 7330 }, 7331 add: function(effect) { 7332 var timestamp = new Date().getTime(); 7333 7334 var position = Object.isString(effect.options.queue) ? 7335 effect.options.queue : effect.options.queue.position; 7336 7337 switch(position) { 7338 case 'front': 7339 // move unstarted effects after this effect 7340 this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { 7341 e.startOn += effect.finishOn; 7342 e.finishOn += effect.finishOn; 7343 }); 7344 break; 7345 case 'with-last': 7346 timestamp = this.effects.pluck('startOn').max() || timestamp; 7347 break; 7348 case 'end': 7349 // start effect after last queued effect has finished 7350 timestamp = this.effects.pluck('finishOn').max() || timestamp; 7351 break; 7352 } 7353 7354 effect.startOn += timestamp; 7355 effect.finishOn += timestamp; 7356 7357 if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) 7358 this.effects.push(effect); 7359 7360 if (!this.interval) 7361 this.interval = setInterval(this.loop.bind(this), 15); 7362 }, 7363 remove: function(effect) { 7364 this.effects = this.effects.reject(function(e) { return e==effect }); 7365 if (this.effects.length == 0) { 7366 clearInterval(this.interval); 7367 this.interval = null; 7368 } 7369 }, 7370 loop: function() { 7371 var timePos = new Date().getTime(); 7372 for(var i=0, len=this.effects.length;i<len;i++) 7373 this.effects[i] && this.effects[i].loop(timePos); 7374 } 7375}); 7376 7377Effect.Queues = { 7378 instances: $H(), 7379 get: function(queueName) { 7380 if (!Object.isString(queueName)) return queueName; 7381 7382 return this.instances.get(queueName) || 7383 this.instances.set(queueName, new Effect.ScopedQueue()); 7384 } 7385}; 7386Effect.Queue = Effect.Queues.get('global'); 7387 7388Effect.Base = Class.create({ 7389 position: null, 7390 start: function(options) { 7391 function codeForEvent(options,eventName){ 7392 return ( 7393 (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') + 7394 (options[eventName] ? 'this.options.'+eventName+'(this);' : '') 7395 ); 7396 } 7397 if (options && options.transition === false) options.transition = Effect.Transitions.linear; 7398 this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { }); 7399 this.currentFrame = 0; 7400 this.state = 'idle'; 7401 this.startOn = this.options.delay*1000; 7402 this.finishOn = this.startOn+(this.options.duration*1000); 7403 this.fromToDelta = this.options.to-this.options.from; 7404 this.totalTime = this.finishOn-this.startOn; 7405 this.totalFrames = this.options.fps*this.options.duration; 7406 7407 this.render = (function() { 7408 function dispatch(effect, eventName) { 7409 if (effect.options[eventName + 'Internal']) 7410 effect.options[eventName + 'Internal'](effect); 7411 if (effect.options[eventName]) 7412 effect.options[eventName](effect); 7413 } 7414 7415 return function(pos) {
7416 if (this.state === "idle") { 7417 this.state = "running"; 7418 dispatch(this, 'beforeSetup'); 7419 if (this.setup) this.setup(); 7420 dispatch(this, 'afterSetup'); 7421 } 7422 if (this.state === "running") { 7423 pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from; 7424 this.position = pos; 7425 dispatch(this, 'beforeUpdate'); 7426 if (this.update) this.update(pos); 7427 dispatch(this, 'afterUpdate'); 7428 } 7429 }; 7430 })(); 7431 7432 this.event('beforeStart'); 7433 if (!this.options.sync) 7434 Effect.Queues.get(Object.isString(this.options.queue) ? 7435 'global' : this.options.queue.scope).add(this); 7436 }, 7437 loop: function(timePos) { 7438 if (timePos >= this.startOn) { 7439 if (timePos >= this.finishOn) { 7440 this.render(1.0); 7441 this.cancel(); 7442 this.event('beforeFinish'); 7443 if (this.finish) this.finish(); 7444 this.event('afterFinish'); 7445 return; 7446 } 7447 var pos = (timePos - this.startOn) / this.totalTime, 7448 frame = (pos * this.totalFrames).round(); 7449 if (frame > this.currentFrame) { 7450 this.render(pos); 7451 this.currentFrame = frame; 7452 } 7453 } 7454 }, 7455 cancel: function() { 7456 if (!this.options.sync) 7457 Effect.Queues.get(Object.isString(this.options.queue) ? 7458 'global' : this.options.queue.scope).remove(this); 7459 this.state = 'finished'; 7460 }, 7461 event: function(eventName) { 7462 if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); 7463 if (this.options[eventName]) this.options[eventName](this); 7464 }, 7465 inspect: function() { 7466 var data = $H(); 7467 for(property in this) 7468 if (!Object.isFunction(this[property])) data.set(property, this[property]); 7469 return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>'; 7470 } 7471}); 7472 7473Effect.Parallel = Class.create(Effect.Base, { 7474 initialize: function(effects) { 7475 this.effects = effects || []; 7476 this.start(arguments[1]); 7477 }, 7478 update: function(position) { 7479 this.effects.invoke('render', position); 7480 }, 7481 finish: function(position) { 7482 this.effects.each( function(effect) { 7483 effect.render(1.0); 7484 effect.cancel(); 7485 effect.event('beforeFinish'); 7486 if (effect.finish) effect.finish(position); 7487 effect.event('afterFinish'); 7488 }); 7489 } 7490}); 7491 7492Effect.Tween = Class.create(Effect.Base, { 7493 initialize: function(object, from, to) { 7494 object = Object.isString(object) ? $(object) : object; 7495 var args = $A(arguments), method = args.last(), 7496 options = args.length == 5 ? args[3] : null; 7497 this.method = Object.isFunction(method) ? method.bind(object) : 7498 Object.isFunction(object[method]) ? object[method].bind(object) : 7499 function(value) { object[method] = value }; 7500 this.start(Object.extend({ from: from, to: to }, options || { })); 7501 }, 7502 update: function(position) { 7503 this.method(position); 7504 } 7505}); 7506 7507Effect.Event = Class.create(Effect.Base, { 7508 initialize: function() { 7509 this.start(Object.extend({ duration: 0 }, arguments[0] || { })); 7510 }, 7511 update: Prototype.emptyFunction 7512}); 7513 7514Effect.Opacity = Class.create(Effect.Base, { 7515 initialize: function(element) { 7516 this.element = $(element); 7517 if (!this.element) throw(Effect._elementDoesNotExistError); 7518 // make this work on IE on elements without 'layout' 7519 if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) 7520 this.element.setStyle({zoom: 1}); 7521 var options = Object.extend({ 7522 from: this.element.getOpacity() || 0.0, 7523 to: 1.0 7524 }, arguments[1] || { }); 7525 this.start(options); 7526 }, 7527 update: function(position) { 7528 this.element.setOpacity(position); 7529 } 7530}); 7531 7532Effect.Move = Class.create(Effect.Base, { 7533 initialize: function(element) { 7534 this.element = $(element); 7535 if (!this.element) throw(Effect._elementDoesNotExistError); 7536 var options = Object.extend({ 7537 x: 0, 7538 y: 0, 7539 mode: 'relative' 7540 }, arguments[1] || { }); 7541 this.start(options); 7542 }, 7543 setup: function() { 7544 this.element.makePositioned(); 7545 this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); 7546 this.originalTop = parseFloat(this.element.getStyle('top') || '0'); 7547 if (this.options.mode == 'absolute') { 7548 this.options.x = this.options.x - this.originalLeft; 7549 this.options.y = this.options.y - this.originalTop; 7550 } 7551 }, 7552 update: function(position) { 7553 this.element.setStyle({ 7554 left: (this.options.x * position + this.originalLeft).round() + 'px', 7555 top: (this.options.y * position + this.originalTop).round() + 'px' 7556 }); 7557 } 7558}); 7559 7560// for backwards compatibility 7561Effect.MoveBy = function(element, toTop, toLeft) { 7562 return new Effect.Move(element,
7563 Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); 7564}; 7565 7566Effect.Scale = Class.create(Effect.Base, { 7567 initialize: function(element, percent) { 7568 this.element = $(element); 7569 if (!this.element) throw(Effect._elementDoesNotExistError); 7570 var options = Object.extend({ 7571 scaleX: true, 7572 scaleY: true, 7573 scaleContent: true, 7574 scaleFromCenter: false, 7575 scaleMode: 'box', // 'box' or 'contents' or { } with provided values 7576 scaleFrom: 100.0, 7577 scaleTo: percent 7578 }, arguments[2] || { }); 7579 this.start(options); 7580 }, 7581 setup: function() { 7582 this.restoreAfterFinish = this.options.restoreAfterFinish || false; 7583 this.elementPositioning = this.element.getStyle('position'); 7584 7585 this.originalStyle = { }; 7586 ['top','left','width','height','fontSize'].each( function(k) { 7587 this.originalStyle[k] = this.element.style[k]; 7588 }.bind(this)); 7589 7590 this.originalTop = this.element.offsetTop; 7591 this.originalLeft = this.element.offsetLeft; 7592 7593 var fontSize = this.element.getStyle('font-size') || '100%'; 7594 ['em','px','%','pt'].each( function(fontSizeType) { 7595 if (fontSize.indexOf(fontSizeType)>0) { 7596 this.fontSize = parseFloat(fontSize); 7597 this.fontSizeType = fontSizeType; 7598 } 7599 }.bind(this)); 7600 7601 this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; 7602 7603 this.dims = null; 7604 if (this.options.scaleMode=='box') 7605 this.dims = [this.element.offsetHeight, this.element.offsetWidth]; 7606 if (/^content/.test(this.options.scaleMode)) 7607 this.dims = [this.element.scrollHeight, this.element.scrollWidth]; 7608 if (!this.dims) 7609 this.dims = [this.options.scaleMode.originalHeight, 7610 this.options.scaleMode.originalWidth]; 7611 }, 7612 update: function(position) { 7613 var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); 7614 if (this.options.scaleContent && this.fontSize) 7615 this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); 7616 this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); 7617 }, 7618 finish: function(position) { 7619 if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); 7620 }, 7621 setDimensions: function(height, width) { 7622 var d = { }; 7623 if (this.options.scaleX) d.width = width.round() + 'px'; 7624 if (this.options.scaleY) d.height = height.round() + 'px'; 7625 if (this.options.scaleFromCenter) { 7626 var topd = (height - this.dims[0])/2; 7627 var leftd = (width - this.dims[1])/2; 7628 if (this.elementPositioning == 'absolute') { 7629 if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; 7630 if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; 7631 } else { 7632 if (this.options.scaleY) d.top = -topd + 'px'; 7633 if (this.options.scaleX) d.left = -leftd + 'px'; 7634 } 7635 } 7636 this.element.setStyle(d); 7637 } 7638}); 7639 7640Effect.Highlight = Class.create(Effect.Base, { 7641 initialize: function(element) { 7642 this.element = $(element); 7643 if (!this.element) throw(Effect._elementDoesNotExistError); 7644 var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); 7645 this.start(options); 7646 }, 7647 setup: function() { 7648 // Prevent executing on elements not in the layout flow 7649 if (this.element.getStyle('display')=='none') { this.cancel(); return; } 7650 // Disable background image during the effect 7651 this.oldStyle = { }; 7652 if (!this.options.keepBackgroundImage) { 7653 this.oldStyle.backgroundImage = this.element.getStyle('background-image'); 7654 this.element.setStyle({backgroundImage: 'none'}); 7655 } 7656 if (!this.options.endcolor) 7657 this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); 7658 if (!this.options.restorecolor) 7659 this.options.restorecolor = this.element.getStyle('background-color'); 7660 // init color calculations 7661 this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); 7662 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)); 7663 }, 7664 update: function(position) { 7665 this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ 7666 return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); 7667 }, 7668 finish: function() { 7669 this.element.setStyle(Object.extend(this.oldStyle, { 7670 backgroundColor: this.options.restorecolor 7671 })); 7672 } 7673}); 7674 7675Effect.ScrollTo = function(element) { 7676 var options = arguments[1] || { }, 7677 scrollOffsets = document.viewport.getScrollOffsets(), 7678 elementOffsets = $(element).cumulativeOffset(); 7679 7680 if (options.offset) elementOffsets[1] += options.offset; 7681 7682 return new Effect.Tween(null, 7683 scrollOffsets.top, 7684 elementOffsets[1], 7685 options, 7686 function(p){ scrollTo(scrollOffsets.left, p.round()); } 7687 ); 7688}; 7689 7690/* ------------- combination effects ------------- */ 7691 7692Effect.Fade = function(element) { 7693 element = $(element); 7694 var oldOpacity = element.getInlineOpacity(); 7695 var options = Object.extend({ 7696 from: element.getOpacity() || 1.0, 7697 to: 0.0, 7698 afterFinishInternal: function(effect) { 7699 if (effect.options.to!=0) return; 7700 effect.element.hide().setStyle({opacity: oldOpacity}); 7701 } 7702 }, arguments[1] || { }); 7703 return new Effect.Opacity(element,options); 7704}; 7705 7706Effect.Appear = function(element) { 7707 element = $(element); 7708 var options = Object.extend({ 7709 from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), 7710 to: 1.0, 7711 // force Safari to render floated elements properly 7712 afterFinishInternal: function(effect) { 7713 effect.element.forceRerendering(); 7714 }, 7715 beforeSetup: function(effect) { 7716 effect.element.setOpacity(effect.options.from).show(); 7717 }}, arguments[1] || { }); 7718 return new Effect.Opacity(element,options); 7719}; 7720 7721Effect.Puff = function(element) { 7722 element = $(element); 7723 var oldStyle = { 7724 opacity: element.getInlineOpacity(), 7725 position: element.getStyle('position'), 7726 top: element.style.top, 7727 left: element.style.left, 7728 width: element.style.width, 7729 height: element.style.height 7730 }; 7731 return new Effect.Parallel( 7732 [ new Effect.Scale(element, 200, 7733 { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 7734 new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 7735 Object.extend({ duration: 1.0, 7736 beforeSetupInternal: function(effect) { 7737 Position.absolutize(effect.effects[0].element); 7738 }, 7739 afterFinishInternal: function(effect) { 7740 effect.effects[0].element.hide().setStyle(oldStyle); } 7741 }, arguments[1] || { }) 7742 ); 7743}; 7744 7745Effect.BlindUp = function(element) { 7746 element = $(element); 7747 element.makeClipping(); 7748 return new Effect.Scale(element, 0, 7749 Object.extend({ scaleContent: false, 7750 scaleX: false, 7751 restoreAfterFinish: true, 7752 afterFinishInternal: function(effect) { 7753 effect.element.hide().undoClipping(); 7754 } 7755 }, arguments[1] || { }) 7756 ); 7757}; 7758 7759Effect.BlindDown = function(element) { 7760 element = $(element); 7761 var elementDimensions = element.getDimensions(); 7762 return new Effect.Scale(element, 100, Object.extend({ 7763 scaleContent: false, 7764 scaleX: false, 7765 scaleFrom: 0, 7766 scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 7767 restoreAfterFinish: true, 7768 afterSetup: function(effect) { 7769 effect.element.makeClipping().setStyle({height: '0px'}).show(); 7770 }, 7771 afterFinishInternal: function(effect) { 7772 effect.element.undoClipping(); 7773 } 7774 }, arguments[1] || { })); 7775}; 7776 7777Effect.SwitchOff = function(element) { 7778 element = $(element); 7779 var oldOpacity = element.getInlineOpacity(); 7780 return new Effect.Appear(element, Object.extend({ 7781 duration: 0.4, 7782 from: 0, 7783 transition: Effect.Transitions.flicker, 7784 afterFinishInternal: function(effect) { 7785 new Effect.Scale(effect.element, 1, { 7786 duration: 0.3, scaleFromCenter: true, 7787 scaleX: false, scaleContent: false, restoreAfterFinish: true, 7788 beforeSetup: function(effect) { 7789 effect.element.makePositioned().makeClipping(); 7790 }, 7791 afterFinishInternal: function(effect) { 7792 effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); 7793 } 7794 }); 7795 } 7796 }, arguments[1] || { })); 7797}; 7798 7799Effect.DropOut = function(element) { 7800 element = $(element); 7801 var oldStyle = { 7802 top: element.getStyle('top'), 7803 left: element.getStyle('left'), 7804 opacity: element.getInlineOpacity() }; 7805 return new Effect.Parallel( 7806 [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 7807 new Effect.Opacity(element, { sync: true, to: 0.0 }) ], 7808 Object.extend( 7809 { duration: 0.5, 7810 beforeSetup: function(effect) { 7811 effect.effects[0].element.makePositioned(); 7812 }, 7813 afterFinishInternal: function(effect) { 7814 effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); 7815 } 7816 }, arguments[1] || { })); 7817}; 7818 7819Effect.Shake = function(element) { 7820 element = $(element); 7821 var options = Object.extend({ 7822 distance: 20, 7823 duration: 0.5 7824 }, arguments[1] || {}); 7825 var distance = parseFloat(options.distance); 7826 var split = parseFloat(options.duration) / 10.0; 7827 var oldStyle = { 7828 top: element.getStyle('top'), 7829 left: element.getStyle('left') }; 7830 return new Effect.Move(element, 7831 { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { 7832 new Effect.Move(effect.element, 7833 { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7834 new Effect.Move(effect.element, 7835 { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7836 new Effect.Move(effect.element, 7837 { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7838 new Effect.Move(effect.element, 7839 { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7840 new Effect.Move(effect.element, 7841 { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { 7842 effect.element.undoPositioned().setStyle(oldStyle); 7843 }}); }}); }}); }}); }}); }}); 7844}; 7845 7846Effect.SlideDown = function(element) { 7847 element = $(element).cleanWhitespace(); 7848 // SlideDown need to have the content of the element wrapped in a container element with fixed height! 7849 var oldInnerBottom = element.down().getStyle('bottom'); 7850 var elementDimensions = element.getDimensions(); 7851 return new Effect.Scale(element, 100, Object.extend({ 7852 scaleContent: false, 7853 scaleX: false, 7854 scaleFrom: window.opera ? 0 : 1, 7855 scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 7856 restoreAfterFinish: true, 7857 afterSetup: function(effect) { 7858 effect.element.makePositioned(); 7859 effect.element.down().makePositioned(); 7860 if (window.opera) effect.element.setStyle({top: ''}); 7861 effect.element.makeClipping().setStyle({height: '0px'}).show(); 7862 }, 7863 afterUpdateInternal: function(effect) { 7864 effect.element.down().setStyle({bottom: 7865 (effect.dims[0] - effect.element.clientHeight) + 'px' }); 7866 }, 7867 afterFinishInternal: function(effect) { 7868 effect.element.undoClipping().undoPositioned(); 7869 effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } 7870 }, arguments[1] || { }) 7871 ); 7872}; 7873 7874Effect.SlideUp = function(element) { 7875 element = $(element).cleanWhitespace(); 7876 var oldInnerBottom = element.down().getStyle('bottom'); 7877 var elementDimensions = element.getDimensions(); 7878 return new Effect.Scale(element, window.opera ? 0 : 1, 7879 Object.extend({ scaleContent: false, 7880 scaleX: false, 7881 scaleMode: 'box', 7882 scaleFrom: 100, 7883 scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 7884 restoreAfterFinish: true, 7885 afterSetup: function(effect) { 7886 effect.element.makePositioned(); 7887 effect.element.down().makePositioned(); 7888 if (window.opera) effect.element.setStyle({top: ''}); 7889 effect.element.makeClipping().show(); 7890 }, 7891 afterUpdateInternal: function(effect) { 7892 effect.element.down().setStyle({bottom: 7893 (effect.dims[0] - effect.element.clientHeight) + 'px' }); 7894 }, 7895 afterFinishInternal: function(effect) { 7896 effect.element.hide().undoClipping().undoPositioned(); 7897 effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); 7898 } 7899 }, arguments[1] || { }) 7900 ); 7901}; 7902 7903// Bug in opera makes the TD containing this element expand for a instance after finish 7904Effect.Squish = function(element) { 7905 return new Effect.Scale(element, window.opera ? 1 : 0, { 7906 restoreAfterFinish: true, 7907 beforeSetup: function(effect) { 7908 effect.element.makeClipping(); 7909 }, 7910 afterFinishInternal: function(effect) { 7911 effect.element.hide().undoClipping(); 7912 } 7913 }); 7914}; 7915 7916Effect.Grow = function(element) { 7917 element = $(element); 7918 var options = Object.extend({ 7919 direction: 'center', 7920 moveTransition: Effect.Transitions.sinoidal, 7921 scaleTransition: Effect.Transitions.sinoidal, 7922 opacityTransition: Effect.Transitions.full 7923 }, arguments[1] || { }); 7924 var oldStyle = { 7925 top: element.style.top, 7926 left: element.style.left, 7927 height: element.style.height, 7928 width: element.style.width, 7929 opacity: element.getInlineOpacity() }; 7930 7931 var dims = element.getDimensions(); 7932 var initialMoveX, initialMoveY; 7933 var moveX, moveY; 7934 7935 switch (options.direction) { 7936 case 'top-left': 7937 initialMoveX = initialMoveY = moveX = moveY = 0; 7938 break; 7939 case 'top-right': 7940 initialMoveX = dims.width; 7941 initialMoveY = moveY = 0; 7942 moveX = -dims.width; 7943 break; 7944 case 'bottom-left': 7945 initialMoveX = moveX = 0; 7946 initialMoveY = dims.height; 7947 moveY = -dims.height; 7948 break; 7949 case 'bottom-right': 7950 initialMoveX = dims.width; 7951 initialMoveY = dims.height; 7952 moveX = -dims.width; 7953 moveY = -dims.height; 7954 break; 7955 case 'center': 7956 initialMoveX = dims.width / 2; 7957 initialMoveY = dims.height / 2; 7958 moveX = -dims.width / 2; 7959 moveY = -dims.height / 2; 7960 break; 7961 } 7962 7963 return new Effect.Move(element, { 7964 x: initialMoveX, 7965 y: initialMoveY, 7966 duration: 0.01, 7967 beforeSetup: function(effect) { 7968 effect.element.hide().makeClipping().makePositioned(); 7969 }, 7970 afterFinishInternal: function(effect) { 7971 new Effect.Parallel( 7972 [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), 7973 new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), 7974 new Effect.Scale(effect.element, 100, { 7975 scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 7976 sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) 7977 ], Object.extend({ 7978 beforeSetup: function(effect) { 7979 effect.effects[0].element.setStyle({height: '0px'}).show(); 7980 }, 7981 afterFinishInternal: function(effect) { 7982 effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 7983 } 7984 }, options) 7985 ); 7986 } 7987 }); 7988}; 7989 7990Effect.Shrink = function(element) { 7991 element = $(element); 7992 var options = Object.extend({ 7993 direction: 'center', 7994 moveTransition: Effect.Transitions.sinoidal, 7995 scaleTransition: Effect.Transitions.sinoidal, 7996 opacityTransition: Effect.Transitions.none 7997 }, arguments[1] || { }); 7998 var oldStyle = { 7999 top: element.style.top, 8000 left: element.style.left, 8001 height: element.style.height, 8002 width: element.style.width, 8003 opacity: element.getInlineOpacity() }; 8004 8005 var dims = element.getDimensions(); 8006 var moveX, moveY; 8007 8008 switch (options.direction) { 8009 case 'top-left': 8010 moveX = moveY = 0; 8011 break; 8012 case 'top-right': 8013 moveX = dims.width; 8014 moveY = 0; 8015 break; 8016 case 'bottom-left': 8017 moveX = 0; 8018 moveY = dims.height; 8019 break; 8020 case 'bottom-right': 8021 moveX = dims.width; 8022 moveY = dims.height; 8023 break; 8024 case 'center': 8025 moveX = dims.width / 2; 8026 moveY = dims.height / 2; 8027 break; 8028 } 8029 8030 return new Effect.Parallel( 8031 [ new Effect.Opacity(elemen
8031t, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), 8032 new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), 8033 new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) 8034 ], Object.extend({ 8035 beforeStartInternal: function(effect) { 8036 effect.effects[0].element.makePositioned().makeClipping(); 8037 }, 8038 afterFinishInternal: function(effect) { 8039 effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } 8040 }, options) 8041 ); 8042}; 8043 8044Effect.Pulsate = function(element) { 8045 element = $(element); 8046 var options = arguments[1] || { }, 8047 oldOpacity = element.getInlineOpacity(), 8048 transition = options.transition || Effect.Transitions.linear, 8049 reverser = function(pos){ 8050 return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5); 8051 }; 8052 8053 return new Effect.Opacity(element, 8054 Object.extend(Object.extend({ duration: 2.0, from: 0, 8055 afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } 8056 }, options), {transition: reverser})); 8057}; 8058 8059Effect.Fold = function(element) { 8060 element = $(element); 8061 var oldStyle = { 8062 top: element.style.top, 8063 left: element.style.left, 8064 width: element.style.width, 8065 height: element.style.height }; 8066 element.makeClipping(); 8067 return new Effect.Scale(element, 5, Object.extend({ 8068 scaleContent: false, 8069 scaleX: false, 8070 afterFinishInternal: function(effect) { 8071 new Effect.Scale(element, 1, { 8072 scaleContent: false, 8073 scaleY: false, 8074 afterFinishInternal: function(effect) { 8075 effect.element.hide().undoClipping().setStyle(oldStyle); 8076 } }); 8077 }}, arguments[1] || { })); 8078}; 8079 8080Effect.Morph = Class.create(Effect.Base, { 8081 initialize: function(element) { 8082 this.element = $(element); 8083 if (!this.element) throw(Effect._elementDoesNotExistError); 8084 var options = Object.extend({ 8085 style: { } 8086 }, arguments[1] || { }); 8087 8088 if (!Object.isString(options.style)) this.style = $H(options.style); 8089 else { 8090 if (options.style.include(':')) 8091 this.style = options.style.parseStyle(); 8092 else { 8093 this.element.addClassName(options.style); 8094 this.style = $H(this.element.getStyles()); 8095 this.element.removeClassName(options.style); 8096 var css = this.element.getStyles(); 8097 this.style = this.style.reject(function(style) { 8098 return style.value == css[style.key]; 8099 }); 8100 options.afterFinishInternal = function(effect) { 8101 effect.element.addClassName(effect.options.style); 8102 effect.transforms.each(function(transform) { 8103 effect.element.style[transform.style] = ''; 8104 }); 8105 }; 8106 } 8107 } 8108 this.start(options); 8109 }, 8110 8111 setup: function(){ 8112 function parseColor(color){ 8113 if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; 8114 color = color.parseColor(); 8115 return $R(0,2).map(function(i){ 8116 return parseInt( color.slice(i*2+1,i*2+3), 16 ); 8117 }); 8118 } 8119 this.transforms = this.style.map(function(pair){ 8120 var property = pair[0], value = pair[1], unit = null; 8121 8122 if (value.parseColor('#zzzzzz') != '#zzzzzz') { 8123 value = value.parseColor(); 8124 unit = 'color'; 8125 } else if (property == 'opacity') { 8126 value = parseFloat(value); 8127 if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) 8128 this.element.setStyle({zoom: 1}); 8129 } else if (Element.CSS_LENGTH.test(value)) { 8130 var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); 8131 value = parseFloat(components[1]); 8132 unit = (components.length == 3) ? components[2] : null; 8133 } 8134 8135 var originalValue = this.element.getStyle(property); 8136 return { 8137 style: property.camelize(), 8138 originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 8139 targetValue: unit=='color' ? parseColor(value) : value, 8140 unit: unit 8141 }; 8142 }.bind(this)).reject(function(transform){ 8143 return ( 8144 (transform.originalValue == transform.targetValue) || 8145 ( 8146 transform.unit != 'color' && 8147 (isNaN(transform.originalValue) || isNaN(transform.targetValue)) 8148 ) 8149 ); 8150 }); 8151 }, 8152 update: function(position) { 8153 var style = { }, transform, i = this.transforms.length; 8154 while(i--) 8155 style[(transform = this.transforms[i]).style] = 8156 transform.unit=='color' ? '#'+ 8157 (Math.round(transform.originalValue[0]+ 8158 (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + 8159 (Math.round(transform.originalValue[1]+ 8160 (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + 8161 (Math.round(transform.originalValue[2]+ 8162 (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : 8163 (transform.originalValue + 8164 (transform.targetValue - transform.originalValue) * position).toFixed(3) + 8165 (transform.unit === null ? '' : transform.unit); 8166 this.element.setStyle(style, true); 8167 } 8168}); 8169 8170Effect.Transform = Class.create({ 8171 initialize: function(tracks){ 8172 this.tracks = []; 8173 this.options = arguments[1] || { }; 8174 this.addTracks(tracks); 8175 }, 8176 addTracks: function(tracks){ 8177 tracks.each(function(track){ 8178 track = $H(track); 8179 var data = track.values().first(); 8180 this.tracks.push($H({ 8181 ids: track.keys().first(), 8182 effect: Effect.Morph, 8183 options: { style: data } 8184 })); 8185 }.bind(this)); 8186 return this; 8187 }, 8188 play: function(){ 8189 return new Effect.Parallel( 8190 this.tracks.map(function(track){ 8191 var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); 8192 var elements = [$(ids) || $$(ids)].flatten(); 8193 return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); 8194 }).flatten(), 8195 this.options 8196 ); 8197 } 8198}); 8199 8200Element.CSS_PROPERTIES = $w( 8201 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 8202 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + 8203 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + 8204 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + 8205 'fontSize fontWeight height left letterSpacing lineHeight ' + 8206 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ 8207 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + 8208 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + 8209 'right textIndent top width wordSpacing zIndex'); 8210 8211Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; 8212 8213String.__parseStyleElement = document.createElement('div'); 8214String.prototype.parseStyle = function(){ 8215 var style, styleRules = $H(); 8216 if (Prototype.Browser.WebKit) 8217 style = new Element('div',{style:this}).style; 8218 else { 8219 String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>'; 8220 style = String.__parseStyleElement.childNodes[0].style; 8221 } 8222 8223 Element.CSS_PROPERTIES.each(function(property){ 8224 if (style[property]) styleRules.set(property, style[property]); 8225 }); 8226 8227 if (Prototype.Browser.IE && this.include('opacity')) 8228 styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); 8229 8230 return styleRules; 8231}; 8232 8233if (document.defaultView && document.defaultView.getComputedStyle) { 8234 Element.getStyles = function(element) { 8235 var css = document.defaultView.getComputedStyle($(element), null); 8236 return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { 8237 styles[property] = css[property]; 8238 return styles; 8239 }); 8240 }; 8241} else { 8242 Element.getStyles = function(element) { 8243 element = $(element); 8244 var css = element.currentStyle, styles; 8245 styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) { 8246 results[property] = css[property]; 8247 return results; 8248 }); 8249 if (!styles.opacity) styles.opacity = element.getOpacity(); 8250 return styles; 8251 }; 8252} 8253 8254Effect.Methods = { 8255 morph: function(element, style) { 8256 element = $(element); 8257 new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); 8258 return element; 8259 }, 8260 visualEffect: function(element, effect, options) { 8261 element = $(element); 8262 var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); 8263 new Effect[klass](element, options); 8264 return element; 8265 }, 8266 highlight: function(element, options) { 8267 element = $(element); 8268 new Effect.Highlight(element, options); 8269 return element; 8270 } 8271}; 8272 8273$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ 8274 'pulsate shake puff squish switchOff dropOut').each( 8275 function(effect) { 8276 Effect.Methods[effect] = function(element, options){ 8277 element = $(element);
8278 Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); 8279 return element; 8280 }; 8281 } 8282); 8283 8284$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( 8285 function(f) { Effect.Methods[f] = Element[f]; } 8286); 8287 8288Element.addMethods(Effect.Methods); 8289// script.aculo.us dragdrop.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010 8290 8291// Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 8292// 8293// script.aculo.us is freely distributable under the terms of an MIT-style license. 8294// For details, see the script.aculo.us web site: http://script.aculo.us/ 8295 8296if(Object.isUndefined(Effect)) 8297 throw("dragdrop.js requires including script.aculo.us' effects.js library"); 8298 8299var Droppables = { 8300 drops: [], 8301 8302 remove: function(element) { 8303 this.drops = this.drops.reject(function(d) { return d.element==$(element) }); 8304 }, 8305 8306 add: function(element) { 8307 element = $(element); 8308 var options = Object.extend({ 8309 greedy: true, 8310 hoverclass: null, 8311 tree: false 8312 }, arguments[1] || { }); 8313
8314 // cache containers 8315 if(options.containment) { 8316 options._containers = []; 8317 var containment = options.containment; 8318 if(Object.isArray(containment)) { 8319 containment.each( function(c) { options._containers.push($(c)) }); 8320 } else { 8321 options._containers.push($(containment)); 8322 } 8323 } 8324 8325 if(options.accept) options.accept = [options.accept].flatten(); 8326 8327 Element.makePositioned(element); // fix IE 8328 options.element = element; 8329 8330 this.drops.push(options); 8331 }, 8332 8333 findDeepestChild: function(drops) { 8334 deepest = drops[0]; 8335 8336 for (i = 1; i < drops.length; ++i) 8337 if (Element.isParent(drops[i].element, deepest.element)) 8338 deepest = drops[i]; 8339 8340 return deepest; 8341 }, 8342 8343 isContained: function(element, drop) { 8344 var containmentNode; 8345 if(drop.tree) { 8346 containmentNode = element.treeNode; 8347 } else { 8348 containmentNode = element.parentNode; 8349 } 8350 return drop._containers.detect(function(c) { return containmentNode == c }); 8351 }, 8352 8353 isAffected: function(point, element, drop) { 8354 return ( 8355 (drop.element!=element) && 8356 ((!drop._containers) || 8357 this.isContained(element, drop)) && 8358 ((!drop.accept) || 8359 (Element.classNames(element).detect( 8360 function(v) { return drop.accept.include(v) } ) )) && 8361 Position.within(drop.element, point[0], point[1]) ); 8362 }, 8363 8364 deactivate: function(drop) { 8365 if(drop.hoverclass) 8366 Element.removeClassName(drop.element, drop.hoverclass); 8367 this.last_active = null; 8368 }, 8369 8370 activate: function(drop) { 8371 if(drop.hoverclass) 8372 Element.addClassName(drop.element, drop.hoverclass); 8373 this.last_active = drop; 8374 }, 8375 8376 show: function(point, element) { 8377 if(!this.drops.length) return; 8378 var drop, affected = []; 8379 8380 this.drops.each( function(drop) { 8381 if(Droppables.isAffected(point, element, drop)) 8382 affected.push(drop); 8383 }); 8384 8385 if(affected.length>0) 8386 drop = Droppables.findDeepestChild(affected); 8387 8388 if(this.last_active && this.last_active != drop) this.deactivate(this.last_active); 8389 if (drop) { 8390 Position.within(drop.element, point[0], point[1]); 8391 if(drop.onHover) 8392 drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); 8393 8394 if (drop != this.last_active) Droppables.activate(drop); 8395 } 8396 }, 8397 8398 fire: function(event, element) { 8399 if(!this.last_active) return; 8400 Position.prepare(); 8401 8402 if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) 8403 if (this.last_active.onDrop) { 8404 this.last_active.onDrop(element, this.last_active.element, event); 8405 return true; 8406 } 8407 }, 8408 8409 reset: function() { 8410 if(this.last_active) 8411 this.deactivate(this.last_active); 8412 } 8413}; 8414 8415var Draggables = { 8416 drags: [], 8417 observers: [], 8418 8419 register: function(draggable) { 8420 if(this.drags.length == 0) { 8421 this.eventMouseUp = this.endDrag.bindAsEventListener(this); 8422 this.eventMouseMove = this.updateDrag.bindAsEventListener(this); 8423 this.eventKeypress = this.keyPress.bindAsEventListener(this); 8424 8425 Event.observe(document, "mouseup", this.eventMouseUp); 8426 Event.observe(document, "mousemove", this.eventMouseMove); 8427 Event.observe(document, "keypress", this.eventKeypress); 8428 } 8429 this.drags.push(draggable); 8430 }, 8431 8432 unregister: function(draggable) { 8433 this.drags = this.drags.reject(function(d) { return d==draggable }); 8434 if(this.drags.length == 0) { 8435 Event.stopObserving(document, "mouseup", this.eventMouseUp); 8436 Event.stopObserving(document, "mousemove", this.eventMouseMove); 8437 Event.stopObserving(document, "keypress", this.eventKeypress); 8438 } 8439 }, 8440 8441 activate: function(draggable) { 8442 if(draggable.options.delay) { 8443 this._timeout = setTimeout(function() { 8444 Draggables._timeout = null; 8445 window.focus(); 8446 Draggables.activeDraggable = draggable; 8447 }.bind(this), draggable.options.delay); 8448 } else { 8449 window.focus(); // allows keypress events if window isn't currently focused, fails for Safari 8450 this.activeDraggable = draggable; 8451 } 8452 }, 8453 8454 deactivate: function() { 8455 this.activeDraggable = null; 8456 }, 8457 8458 updateDrag: function(event) { 8459 if(!this.activeDraggable) return; 8460 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 8461 // Mozilla-based browsers fire successive mousemove events with 8462 // the same coordinates, prevent needless redrawing (moz bug?) 8463 if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; 8464 this._lastPointer = pointer; 8465 8466 this.activeDraggable.updateDrag(event, pointer); 8467 }, 8468 8469 endDrag: function(event) { 8470 if(this._timeout) { 8471 clearTimeout(this._timeout); 8472 this._timeout = null; 8473 } 8474 if(!this.activeDraggable) return; 8475 this._lastPointer = null; 8476 this.activeDraggable.endDrag(event); 8477 this.activeDraggable = null; 8478 }, 8479 8480 keyPress: function(event) { 8481 if(this.activeDraggable) 8482 this.activeDraggable.keyPress(event); 8483 }, 8484 8485 addObserver: function(observer) { 8486 this.observers.push(observer); 8487 this._cacheObserverCallbacks(); 8488 }, 8489 8490 removeObserver: function(element) { // element instead of observer fixes mem leaks 8491 this.observers = this.observers.reject( function(o) { return o.element==element }); 8492 this._cacheObserverCallbacks(); 8493 }, 8494 8495 notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' 8496 if(this[eventName+'Count'] > 0) 8497 this.observers.each( function(o) { 8498 if(o[eventName]) o[eventName](eventName, draggable, event); 8499 });
8500 if(draggable.options[eventName]) draggable.options[eventName](draggable, event); 8501 }, 8502 8503 _cacheObserverCallbacks: function() { 8504 ['onStart','onEnd','onDrag'].each( function(eventName) { 8505 Draggables[eventName+'Count'] = Draggables.observers.select( 8506 function(o) { return o[eventName]; } 8507 ).length; 8508 }); 8509 } 8510}; 8511 8512/*--------------------------------------------------------------------------*/ 8513 8514var Draggable = Class.create({ 8515 initialize: function(element) { 8516 var defaults = { 8517 handle: false, 8518 reverteffect: function(element, top_offset, left_offset) { 8519 var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; 8520 new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, 8521 queue: {scope:'_draggable', position:'end'} 8522 }); 8523 }, 8524 endeffect: function(element) { 8525 var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; 8526 new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, 8527 queue: {scope:'_draggable', position:'end'}, 8528 afterFinish: function(){ 8529 Draggable._dragging[element] = false 8530 } 8531 }); 8532 }, 8533 zindex: 1000, 8534 revert: false, 8535 quiet: false, 8536 scroll: false, 8537 scrollSensitivity: 20, 8538 scrollSpeed: 15, 8539 snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } 8540 delay: 0 8541 }; 8542 8543 if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) 8544 Object.extend(defaults, { 8545 starteffect: function(element) { 8546 element._opacity = Element.getOpacity(element); 8547 Draggable._dragging[element] = true; 8548 new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); 8549 } 8550 }); 8551 8552 var options = Object.extend(defaults, arguments[1] || { }); 8553 8554 this.element = $(element); 8555 8556 if(options.handle && Object.isString(options.handle)) 8557 this.handle = this.element.down('.'+options.handle, 0); 8558 8559 if(!this.handle) this.handle = $(options.handle); 8560 if(!this.handle) this.handle = this.element; 8561 8562 if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { 8563 options.scroll = $(options.scroll); 8564 this._isScrollChild = Element.childOf(this.element, options.scroll); 8565 } 8566 8567 Element.makePositioned(this.element); // fix IE 8568 8569 this.options = options; 8570 this.dragging = false; 8571 8572 this.eventMouseDown = this.initDrag.bindAsEventListener(this); 8573 Event.observe(this.handle, "mousedown", this.eventMouseDown); 8574 8575 Draggables.register(this); 8576 }, 8577 8578 destroy: function() { 8579 Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); 8580 Draggables.unregister(this); 8581 }, 8582 8583 currentDelta: function() { 8584 return([ 8585 parseInt(Element.getStyle(this.element,'left') || '0'), 8586 parseInt(Element.getStyle(this.element,'top') || '0')]); 8587 }, 8588 8589 initDrag: function(event) { 8590 if(!Object.isUndefined(Draggable._dragging[this.element]) && 8591 Draggable._dragging[this.element]) return; 8592 if(Event.isLeftClick(event)) { 8593 // abort on form elements, fixes a Firefox issue 8594 var src = Event.element(event); 8595 if((tag_name = src.tagName.toUpperCase()) && ( 8596 tag_name=='INPUT' || 8597 tag_name=='SELECT' || 8598 tag_name=='OPTION' || 8599 tag_name=='BUTTON' || 8600 tag_name=='TEXTAREA')) return; 8601 8602 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 8603 var pos = this.element.cumulativeOffset(); 8604 this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); 8605 8606 Draggables.activate(this); 8607 Event.stop(event); 8608 } 8609 }, 8610 8611 startDrag: function(event) { 8612 this.dragging = true; 8613 if(!this.delta) 8614 this.delta = this.currentDelta(); 8615 8616 if(this.options.zindex) { 8617 this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); 8618 this.element.style.zIndex = this.options.zindex; 8619 } 8620 8621 if(this.options.ghosting) { 8622 this._clone = this.element.cloneNode(true); 8623 this._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); 8624 if (!this._originallyAbsolute) 8625 Position.absolutize(this.element); 8626 this.element.parentNode.insertBefore(this._clone, this.element); 8627 } 8628 8629 if(this.options.scroll) { 8630 if (this.options.scroll == window) { 8631 var where = this._getWindowScroll(this.options.scroll); 8632 this.originalScrollLeft = where.left; 8633 this.originalScrollTop = where.top; 8634 } else {
8635 this.originalScrollLeft = this.options.scroll.scrollLeft; 8636 this.originalScrollTop = this.options.scroll.scrollTop; 8637 } 8638 } 8639 8640 Draggables.notify('onStart', this, event); 8641 8642 if(this.options.starteffect) this.options.starteffect(this.element); 8643 }, 8644 8645 updateDrag: function(event, pointer) { 8646 if(!this.dragging) this.startDrag(event); 8647 8648 if(!this.options.quiet){ 8649 Position.prepare(); 8650 Droppables.show(pointer, this.element); 8651 } 8652 8653 Draggables.notify('onDrag', this, event); 8654 8655 this.draw(pointer); 8656 if(this.options.change) this.options.change(this); 8657 8658 if(this.options.scroll) { 8659 this.stopScrolling(); 8660 8661 var p; 8662 if (this.options.scroll == window) { 8663 with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } 8664 } else { 8665 p = Position.page(this.options.scroll).toArray(); 8666 p[0] += this.options.scroll.scrollLeft + Position.deltaX; 8667 p[1] += this.options.scroll.scrollTop + Position.deltaY; 8668 p.push(p[0]+this.options.scroll.offsetWidth); 8669 p.push(p[1]+this.options.scroll.offsetHeight); 8670 } 8671 var speed = [0,0]; 8672 if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); 8673 if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); 8674 if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); 8675 if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); 8676 this.startScrolling(speed); 8677 } 8678 8679 // fix AppleWebKit rendering 8680 if(Prototype.Browser.WebKit) window.scrollBy(0,0); 8681 8682 Event.stop(event); 8683 }, 8684 8685 finishDrag: function(event, success) { 8686 this.dragging = false; 8687 8688 if(this.options.quiet){ 8689 Position.prepare(); 8690 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 8691 Droppables.show(pointer, this.element); 8692 } 8693 8694 if(this.options.ghosting) { 8695 if (!this._originallyAbsolute) 8696 Position.relativize(this.element); 8697 delete this._originallyAbsolute; 8698 Element.remove(this._clone); 8699 this._clone = null; 8700 } 8701 8702 var dropped = false; 8703 if(success) { 8704 dropped = Droppables.fire(event, this.element); 8705 if (!dropped) dropped = false; 8706 } 8707 if(dropped && this.options.onDropped) this.options.onDropped(this.element); 8708 Draggables.notify('onEnd', this, event); 8709 8710 var revert = this.options.revert; 8711 if(revert && Object.isFunction(revert)) revert = revert(this.element); 8712 8713 var d = this.currentDelta(); 8714 if(revert && this.options.reverteffect) { 8715 if (dropped == 0 || revert != 'failure') 8716 this.options.reverteffect(this.element, 8717 d[1]-this.delta[1], d[0]-this.delta[0]); 8718 } else { 8719 this.delta = d; 8720 } 8721 8722 if(this.options.zindex) 8723 this.element.style.zIndex = this.originalZ; 8724 8725 if(this.options.endeffect) 8726 this.options.endeffect(this.element); 8727 8728 Draggables.deactivate(this); 8729 Droppables.reset(); 8730 }, 8731 8732 keyPress: function(event) { 8733 if(event.keyCode!=Event.KEY_ESC) return; 8734 this.finishDrag(event, false); 8735 Event.stop(event); 8736 }, 8737 8738 endDrag: function(event) { 8739 if(!this.dragging) return; 8740 this.stopScrolling(); 8741 this.finishDrag(event, true); 8742 Event.stop(event); 8743 }, 8744 8745 draw: function(point) { 8746 var pos = this.element.cumulativeOffset(); 8747 if(this.options.ghosting) { 8748 var r = Position.realOffset(this.element); 8749 pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; 8750 } 8751 8752 var d = this.currentDelta(); 8753 pos[0] -= d[0]; pos[1] -= d[1]; 8754 8755 if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { 8756 pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; 8757 pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; 8758 } 8759 8760 var p = [0,1].map(function(i){ 8761 return (point[i]-pos[i]-this.offset[i]) 8762 }.bind(this)); 8763 8764 if(this.options.snap) { 8765 if(Object.isFunction(this.options.snap)) { 8766 p = this.options.snap(p[0],p[1],this); 8767 } else { 8768 if(Object.isArray(this.options.snap)) { 8769 p = p.map( function(v, i) { 8770 return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this)); 8771 } else { 8772 p = p.map( function(v) { 8773 return (v/this.options.snap).round()*this.options.snap }.bind(this)); 8774 } 8775 }} 8776 8777 var style = this.element.style; 8778 if((!this.options.constraint) || (this.options.constraint=='horizontal')) 8779 style.left = p[0] + "px"; 8780 if((!this.options.constraint) || (this.options.constraint=='vertical')) 8781 style.top = p[1] + "px"; 8782 8783 if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering 8784 }, 8785 8786 stopScrolling: function() { 8787 if(this.scrollInterval) { 8788 clearInterval(this.scrollInterval); 8789 this.scrollInterval = null; 8790 Draggables._lastScrollPointer = null; 8791 } 8792 }, 8793 8794 startScrolling: function(speed) { 8795 if(!(speed[0] || speed[1])) return; 8796 this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; 8797 this.lastScrolled = new Date(); 8798 this.scrollInterval = setInterval(this.scroll.bind(this), 10); 8799 }, 8800 8801 scroll: function() { 8802 var current = new Date(); 8803 var delta = current - this.lastScrolled; 8804 this.lastScrolled = current; 8805 if(this.options.scroll == window) { 8806 with (this._getWindowScroll(this.options.scroll)) { 8807 if (this.scrollSpeed[0] || this.scrollSpeed[1]) { 8808 var d = delta / 1000;
8809 this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); 8810 } 8811 } 8812 } else { 8813 this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; 8814 this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; 8815 } 8816 8817 Position.prepare(); 8818 Droppables.show(Draggables._lastPointer, this.element); 8819 Draggables.notify('onDrag', this); 8820 if (this._isScrollChild) { 8821 Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); 8822 Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; 8823 Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; 8824 if (Draggables._lastScrollPointer[0] < 0) 8825 Draggables._lastScrollPointer[0] = 0; 8826 if (Draggables._lastScrollPointer[1] < 0) 8827 Draggables._lastScrollPointer[1] = 0; 8828 this.draw(Draggables._lastScrollPointer); 8829 } 8830 8831 if(this.options.change) this.options.change(this); 8832 }, 8833 8834 _getWindowScroll: function(w) { 8835 var T, L, W, H; 8836 with (w.document) { 8837 if (w.document.documentElement && documentElement.scrollTop) { 8838 T = documentElement.scrollTop; 8839 L = documentElement.scrollLeft; 8840 } else if (w.document.body) { 8841 T = body.scrollTop; 8842 L = body.scrollLeft; 8843 } 8844 if (w.innerWidth) { 8845 W = w.innerWidth; 8846 H = w.innerHeight; 8847 } else if (w.document.documentElement && documentElement.clientWidth) { 8848 W = documentElement.clientWidth; 8849 H = documentElement.clientHeight; 8850 } else { 8851 W = body.offsetWidth; 8852 H = body.offsetHeight; 8853 } 8854 } 8855 return { top: T, left: L, width: W, height: H }; 8856 } 8857}); 8858 8859Draggable._dragging = { }; 8860 8861/*--------------------------------------------------------------------------*/ 8862 8863var SortableObserver = Class.create({ 8864 initialize: function(element, observer) { 8865 this.element = $(element); 8866 this.observer = observer; 8867 this.lastValue = Sortable.serialize(this.element); 8868 }, 8869 8870 onStart: function() { 8871 this.lastValue = Sortable.serialize(this.element); 8872 }, 8873 8874 onEnd: function() { 8875 Sortable.unmark(); 8876 if(this.lastValue != Sortable.serialize(this.element)) 8877 this.observer(this.element) 8878 } 8879}); 8880 8881var Sortable = { 8882 SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, 8883 8884 sortables: { }, 8885 8886 _findRootElement: function(element) { 8887 while (element.tagName.toUpperCase() != "BODY") { 8888 if(element.id && Sortable.sortables[element.id]) return element; 8889 element = element.parentNode; 8890 } 8891 }, 8892 8893 options: function(element) { 8894 element = Sortable._findRootElement($(element)); 8895 if(!element) return; 8896 return Sortable.sortables[element.id]; 8897 }, 8898 8899 destroy: function(element){ 8900 element = $(element); 8901 var s = Sortable.sortables[element.id]; 8902 8903 if(s) { 8904 Draggables.removeObserver(s.element); 8905 s.droppables.each(function(d){ Droppables.remove(d) }); 8906 s.draggables.invoke('destroy'); 8907 8908 delete Sortable.sortables[s.element.id]; 8909 } 8910 }, 8911 8912 create: function(element) { 8913 element = $(element); 8914 var options = Object.extend({ 8915 element: element, 8916 tag: 'li', // assumes li children, override with tag: 'tagname' 8917 dropOnEmpty: false, 8918 tree: false, 8919 treeTag: 'ul', 8920 overlap: 'vertical', // one of 'vertical', 'horizontal' 8921 constraint: 'vertical', // one of 'vertical', 'horizontal', false 8922 containment: element, // also takes array of elements (or id's); or false 8923 handle: false, // or a CSS class 8924 only: false, 8925 delay: 0, 8926 hoverclass: null, 8927 ghosting: false, 8928 quiet: false, 8929 scroll: false, 8930 scrollSensitivity: 20, 8931 scrollSpeed: 15, 8932 format: this.SERIALIZE_RULE, 8933 8934 // these take arrays of elements or ids and can be 8935 // used for better initialization performance 8936 elements: false, 8937 handles: false, 8938 8939 onChange: Prototype.emptyFunction, 8940 onUpdate: Prototype.emptyFunction 8941 }, arguments[1] || { }); 8942 8943 // clear any old sortable with same element 8944 this.destroy(element); 8945 8946 // build options for the draggables 8947 var options_for_draggable = { 8948 revert: true, 8949 quiet: options.quiet, 8950 scroll: options.scroll, 8951 scrollSpeed: options.scrollSpeed,
8952 scrollSensitivity: options.scrollSensitivity, 8953 delay: options.delay, 8954 ghosting: options.ghosting, 8955 constraint: options.constraint, 8956 handle: options.handle }; 8957 8958 if(options.starteffect) 8959 options_for_draggable.starteffect = options.starteffect; 8960 8961 if(options.reverteffect) 8962 options_for_draggable.reverteffect = options.reverteffect; 8963 else 8964 if(options.ghosting) options_for_draggable.reverteffect = function(element) { 8965 element.style.top = 0; 8966 element.style.left = 0; 8967 }; 8968 8969 if(options.endeffect) 8970 options_for_draggable.endeffect = options.endeffect; 8971 8972 if(options.zindex) 8973 options_for_draggable.zindex = options.zindex; 8974 8975 // build options for the droppables 8976 var options_for_droppable = { 8977 overlap: options.overlap, 8978 containment: options.containment, 8979 tree: options.tree, 8980 hoverclass: options.hoverclass, 8981 onHover: Sortable.onHover 8982 }; 8983 8984 var options_for_tree = { 8985 onHover: Sortable.onEmptyHover, 8986 overlap: options.overlap, 8987 containment: options.containment, 8988 hoverclass: options.hoverclass 8989 }; 8990 8991 // fix for gecko engine 8992 Element.cleanWhitespace(element); 8993 8994 options.draggables = []; 8995 options.droppables = []; 8996 8997 // drop on empty handling 8998 if(options.dropOnEmpty || options.tree) { 8999 Droppables.add(element, options_for_tree); 9000 options.droppables.push(element); 9001 } 9002 9003 (options.elements || this.findElements(element, options) || []).each( function(e,i) { 9004 var handle = options.handles ? $(options.handles[i]) : 9005 (options.handle ? $(e).select('.' + options.handle)[0] : e); 9006 options.draggables.push( 9007 new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); 9008 Droppables.add(e, options_for_droppable); 9009 if(options.tree) e.treeNode = element; 9010 options.droppables.push(e); 9011 }); 9012 9013 if(options.tree) { 9014 (Sortable.findTreeElements(element, options) || []).each( function(e) { 9015 Droppables.add(e, options_for_tree); 9016 e.treeNode = element; 9017 options.droppables.push(e); 9018 }); 9019 } 9020 9021 // keep reference 9022 this.sortables[element.identify()] = options; 9023 9024 // for onupdate 9025 Draggables.addObserver(new SortableObserver(element, options.onUpdate)); 9026 9027 }, 9028 9029 // return all suitable-for-sortable elements in a guaranteed order 9030 findElements: function(element, options) { 9031 return Element.findChildren( 9032 element, options.only, options.tree ? true : false, options.tag); 9033 }, 9034 9035 findTreeElements: function(element, options) { 9036 return Element.findChildren( 9037 element, options.only, options.tree ? true : false, options.treeTag); 9038 }, 9039 9040 onHover: function(element, dropon, overlap) { 9041 if(Element.isParent(dropon, element)) return; 9042 9043 if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { 9044 return; 9045 } else if(overlap>0.5) { 9046 Sortable.mark(dropon, 'before'); 9047 if(dropon.previousSibling != element) { 9048 var oldParentNode = element.parentNode; 9049 element.style.visibility = "hidden"; // fix gecko rendering 9050 dropon.parentNode.insertBefore(element, dropon); 9051 if(dropon.parentNode!=oldParentNode) 9052 Sortable.options(oldParentNode).onChange(element); 9053 Sortable.options(dropon.parentNode).onChange(element); 9054 } 9055 } else { 9056 Sortable.mark(dropon, 'after'); 9057 var nextElement = dropon.nextSibling || null; 9058 if(nextElement != element) { 9059 var oldParentNode = element.parentNode; 9060 element.style.visibility = "hidden"; // fix gecko rendering 9061 dropon.parentNode.insertBefore(element, nextElement); 9062 if(dropon.parentNode!=oldParentNode) 9063 Sortable.options(oldParentNode).onChange(element); 9064 Sortable.options(dropon.parentNode).onChange(element); 9065 } 9066 } 9067 }, 9068 9069 onEmptyHover: function(element, dropon, overlap) { 9070 var oldParentNode = element.parentNode; 9071 var droponOptions = Sortable.options(dropon); 9072 9073 if(!Element.isParent(dropon, element)) { 9074 var index; 9075 9076 var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); 9077 var child = null; 9078 9079 if(children) { 9080 var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); 9081 9082 for (index = 0; index < children.length; index += 1) { 9083 if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { 9084 offset -= Element.offsetSize (children[index], droponOptions.overlap); 9085 } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { 9086 child = index + 1 < children.length ? children[index + 1] : null; 9087 break; 9088 } else { 9089 child = children[index]; 9090 break; 9091 } 9092 } 9093 } 9094 9095 dropon.insertBefore(element, child); 9096
9097 Sortable.options(oldParentNode).onChange(element); 9098 droponOptions.onChange(element); 9099 } 9100 }, 9101 9102 unmark: function() { 9103 if(Sortable._marker) Sortable._marker.hide(); 9104 }, 9105 9106 mark: function(dropon, position) { 9107 // mark on ghosting only 9108 var sortable = Sortable.options(dropon.parentNode); 9109 if(sortable && !sortable.ghosting) return; 9110 9111 if(!Sortable._marker) { 9112 Sortable._marker = 9113 ($('dropmarker') || Element.extend(document.createElement('DIV'))). 9114 hide().addClassName('dropmarker').setStyle({position:'absolute'}); 9115 document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); 9116 } 9117 var offsets = dropon.cumulativeOffset(); 9118 Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); 9119 9120 if(position=='after') 9121 if(sortable.overlap == 'horizontal') 9122 Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); 9123 else 9124 Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); 9125 9126 Sortable._marker.show(); 9127 }, 9128 9129 _tree: function(element, options, parent) { 9130 var children = Sortable.findElements(element, options) || []; 9131 9132 for (var i = 0; i < children.length; ++i) { 9133 var match = children[i].id.match(options.format); 9134 9135 if (!match) continue; 9136 9137 var child = { 9138 id: encodeURIComponent(match ? match[1] : null), 9139 element: element, 9140 parent: parent, 9141 children: [], 9142 position: parent.children.length, 9143 container: $(children[i]).down(options.treeTag) 9144 }; 9145 9146 /* Get the element containing the children and recurse over it */ 9147 if (child.container) 9148 this._tree(child.container, options, child); 9149 9150 parent.children.push (child); 9151 } 9152 9153 return parent; 9154 }, 9155 9156 tree: function(element) { 9157 element = $(element); 9158 var sortableOptions = this.options(element); 9159 var options = Object.extend({ 9160 tag: sortableOptions.tag, 9161 treeTag: sortableOptions.treeTag, 9162 only: sortableOptions.only, 9163 name: element.id, 9164 format: sortableOptions.format 9165 }, arguments[1] || { }); 9166 9167 var root = { 9168 id: null, 9169 parent: null, 9170 children: [], 9171 container: element, 9172 position: 0 9173 }; 9174 9175 return Sortable._tree(element, options, root); 9176 }, 9177 9178 /* Construct a [i] index for a particular node */ 9179 _constructIndex: function(node) { 9180 var index = ''; 9181 do { 9182 if (node.id) index = '[' + node.position + ']' + index; 9183 } while ((node = node.parent) != null); 9184 return index; 9185 }, 9186 9187 sequence: function(element) { 9188 element = $(element); 9189 var options = Object.extend(this.options(element), arguments[1] || { }); 9190 9191 return $(this.findElements(element, options) || []).map( function(item) { 9192 return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; 9193 }); 9194 }, 9195 9196 setSequence: function(element, new_sequence) { 9197 element = $(element); 9198 var options = Object.extend(this.options(element), arguments[2] || { }); 9199 9200 var nodeMap = { }; 9201 this.findElements(element, options).each( function(n) { 9202 if (n.id.match(options.format)) 9203 nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; 9204 n.parentNode.removeChild(n); 9205 }); 9206 9207 new_sequence.each(function(ident) { 9208 var n = nodeMap[ident]; 9209 if (n) { 9210 n[1].appendChild(n[0]); 9211 delete nodeMap[ident]; 9212 } 9213 }); 9214 }, 9215 9216 serialize: function(element) { 9217 element = $(element); 9218 var options = Object.extend(Sortable.options(element), arguments[1] || { }); 9219 var name = encodeURIComponent( 9220 (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); 9221 9222 if (options.tree) { 9223 return Sortable.tree(element, arguments[1]).children.map( function (item) { 9224 return [name + Sortable._constructIndex(item) + "[id]=" + 9225 encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); 9226 }).flatten().join('&'); 9227 } else { 9228 return Sortable.sequence(element, arguments[1]).map( function(item) { 9229 return name + "[]=" + encodeURIComponent(item); 9230 }).join('&'); 9231 } 9232 } 9233}; 9234 9235// Returns true if child is contained within element 9236Element.isParent = function(child, element) { 9237 if (!child.parentNode || child == element) return false;
9238 if (child.parentNode == element) return true; 9239 return Element.isParent(child.parentNode, element); 9240}; 9241 9242Element.findChildren = function(element, only, recursive, tagName) { 9243 if(!element.hasChildNodes()) return null; 9244 tagName = tagName.toUpperCase(); 9245 if(only) only = [only].flatten(); 9246 var elements = []; 9247 $A(element.childNodes).each( function(e) { 9248 if(e.tagName && e.tagName.toUpperCase()==tagName && 9249 (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) 9250 elements.push(e); 9251 if(recursive) { 9252 var grandchildren = Element.findChildren(e, only, recursive, tagName); 9253 if(grandchildren) elements.push(grandchildren); 9254 } 9255 }); 9256 9257 return (elements.length>0 ? elements.flatten() : []); 9258}; 9259 9260Element.offsetSize = function (element, type) { 9261 return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; 9262}; 9263// script.aculo.us controls.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 9264 9265// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 9266// (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan) 9267// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com) 9268// Contributors: 9269// Richard Livsey 9270// Rahul Bhargava 9271// Rob Wills 9272// 9273// script.aculo.us is freely distributable under the terms of an MIT-style license. 9274// For details, see the script.aculo.us web site: http://script.aculo.us/ 9275 9276// Autocompleter.Base handles all the autocompletion functionality 9277// that's independent of the data source for autocompletion. This 9278// includes drawing the autocompletion menu, observing keyboard 9279// and mouse events, and similar. 9280// 9281// Specific autocompleters need to provide, at the very least, 9282// a getUpdatedChoices function that will be invoked every time 9283// the text inside the monitored textbox changes. This method 9284// should get the text for which to provide autocompletion by 9285// invoking this.getToken(), NOT by directly accessing 9286// this.element.value. This is to allow incremental tokenized 9287// autocompletion. Specific auto-completion logic (AJAX, etc) 9288// belongs in getUpdatedChoices. 9289// 9290// Tokenized incremental autocompletion is enabled automatically 9291// when an autocompleter is instantiated with the 'tokens' option 9292// in the options parameter, e.g.: 9293// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); 9294// will incrementally autocomplete with a comma as the token. 9295// Additionally, ',' in the above example can be replaced with 9296// a token array, e.g. { tokens: [',', '\n'] } which 9297// enables autocompletion on multiple tokens. This is most 9298// useful when one of the tokens is \n (a newline), as it 9299// allows smart autocompletion after linebreaks. 9300 9301if(typeof Effect == 'undefined') 9302 throw("controls.js requires including script.aculo.us' effects.js library"); 9303 9304var Autocompleter = { }; 9305Autocompleter.Base = Class.create({ 9306 baseInitialize: function(element, update, options) { 9307 element = $(element); 9308 this.element = element; 9309 this.update = $(update); 9310 this.hasFocus = false; 9311 this.changed = false; 9312 this.active = false; 9313 this.index = 0; 9314 this.entryCount = 0; 9315 this.oldElementValue = this.element.value; 9316 9317 if(this.setOptions) 9318 this.setOptions(options); 9319 else 9320 this.options = options || { }; 9321 9322 this.options.paramName = this.options.paramName || this.element.name; 9323 this.options.tokens = this.options.tokens || []; 9324 this.options.frequency = this.options.frequency || 0.4; 9325 this.options.minChars = this.options.minChars || 1; 9326 this.options.onShow = this.options.onShow || 9327 function(element, update){ 9328 if(!update.style.position || update.style.position=='absolute') { 9329 update.style.position = 'absolute'; 9330 Position.clone(element, update, { 9331 setHeight: false, 9332 offsetTop: element.offsetHeight 9333 }); 9334 } 9335 Effect.Appear(update,{duration:0.15}); 9336 }; 9337 this.options.onHide = this.options.onHide || 9338 function(element, update){ new Effect.Fade(update,{duration:0.15}) }; 9339 9340 if(typeof(this.options.tokens) == 'string') 9341 this.options.tokens = new Array(this.options.tokens); 9342 // Force carriage returns as token delimiters anyway 9343 if (!this.options.tokens.include('\n')) 9344 this.options.tokens.push('\n'); 9345 9346 this.observer = null; 9347 9348 this.element.setAttribute('autocomplete','off'); 9349 9350 Element.hide(this.update); 9351 9352 Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); 9353 Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this)); 9354 }, 9355 9356 show: function() { 9357 if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); 9358 if(!this.iefix && 9359 (Prototype.Browser.IE) && 9360 (Element.getStyle(this.update, 'position')=='absolute')) { 9361 new Insertion.After(this.update, 9362 '<iframe id="' + this.update.id + '_iefix" '+ 9363 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' + 9364 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>'); 9365 this.iefix = $(this.update.id+'_iefix'); 9366 } 9367 if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); 9368 }, 9369 9370 fixIEOverlapping: function() { 9371 Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); 9372 this.iefix.style.zIndex = 1; 9373 this.update.style.zIndex = 2; 9374 Element.show(this.iefix); 9375 }, 9376 9377 hide: function() { 9378 this.stopIndicator(); 9379 if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); 9380 if(this.iefix) Element.hide(this.iefix); 9381 }, 9382 9383 startIndicator: function() { 9384 if(this.options.indicator) Element.show(this.options.indicator); 9385 }, 9386 9387 stopIndicator: function() { 9388 if(this.options.indicator) Element.hide(this.options.indicator); 9389 }, 9390 9391 onKeyPress: function(event) { 9392 if(this.active) 9393 switch(event.keyCode) { 9394 case Event.KEY_TAB: 9395 case Event.KEY_RETURN: 9396 this.selectEntry(); 9397 Event.stop(event); 9398 case Event.KEY_ESC: 9399 this.hide(); 9400 this.active = false;
9401 Event.stop(event); 9402 return; 9403 case Event.KEY_LEFT: 9404 case Event.KEY_RIGHT: 9405 return; 9406 case Event.KEY_UP: 9407 this.markPrevious(); 9408 this.render(); 9409 Event.stop(event); 9410 return; 9411 case Event.KEY_DOWN: 9412 this.markNext(); 9413 this.render(); 9414 Event.stop(event); 9415 return; 9416 } 9417 else 9418 if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || 9419 (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; 9420 9421 this.changed = true; 9422 this.hasFocus = true; 9423 9424 if(this.observer) clearTimeout(this.observer); 9425 this.observer = 9426 setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); 9427 }, 9428 9429 activate: function() { 9430 this.changed = false; 9431 this.hasFocus = true; 9432 this.getUpdatedChoices(); 9433 }, 9434 9435 onHover: function(event) { 9436 var element = Event.findElement(event, 'LI'); 9437 if(this.index != element.autocompleteIndex) 9438 { 9439 this.index = element.autocompleteIndex; 9440 this.render(); 9441 } 9442 Event.stop(event); 9443 }, 9444 9445 onClick: function(event) { 9446 var element = Event.findElement(event, 'LI'); 9447 this.index = element.autocompleteIndex; 9448 this.selectEntry(); 9449 this.hide(); 9450 }, 9451 9452 onBlur: function(event) { 9453 // needed to make click events working 9454 setTimeout(this.hide.bind(this), 250); 9455 this.hasFocus = false; 9456 this.active = false; 9457 }, 9458 9459 render: function() { 9460 if(this.entryCount > 0) { 9461 for (var i = 0; i < this.entryCount; i++) 9462 this.index==i ? 9463 Element.addClassName(this.getEntry(i),"selected") : 9464 Element.removeClassName(this.getEntry(i),"selected"); 9465 if(this.hasFocus) { 9466 this.show(); 9467 this.active = true; 9468 } 9469 } else { 9470 this.active = false; 9471 this.hide(); 9472 } 9473 }, 9474 9475 markPrevious: function() { 9476 if(this.index > 0) this.index--; 9477 else this.index = this.entryCount-1; 9478 //this.getEntry(this.index).scrollIntoView(true); useless 9479 }, 9480 9481 markNext: function() { 9482 if(this.index < this.entryCount-1) this.index++; 9483 else this.index = 0; 9484 this.getEntry(this.index).scrollIntoView(false); 9485 }, 9486 9487 getEntry: function(index) { 9488 return this.update.firstChild.childNodes[index]; 9489 }, 9490 9491 getCurrentEntry: function() { 9492 return this.getEntry(this.index); 9493 }, 9494 9495 selectEntry: function() { 9496 this.active = false; 9497 this.updateElement(this.getCurrentEntry()); 9498 }, 9499 9500 updateElement: function(selectedElement) { 9501 if (this.options.updateElement) { 9502 this.options.updateElement(selectedElement); 9503 return; 9504 } 9505 var value = ''; 9506 if (this.options.select) { 9507 var nodes = $(selectedElement).select('.' + this.options.select) || []; 9508 if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); 9509 } else 9510 value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); 9511 9512 var bounds = this.getTokenBounds(); 9513 if (bounds[0] != -1) { 9514 var newValue = this.element.value.substr(0, bounds[0]); 9515 var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/); 9516 if (whitespace) 9517 newValue += whitespace[0]; 9518 this.element.value = newValue + value + this.element.value.substr(bounds[1]); 9519 } else { 9520 this.element.value = value; 9521 } 9522 this.oldElementValue = this.element.value; 9523 this.element.focus(); 9524 9525 if (this.options.afterUpdateElement) 9526 this.options.afterUpdateElement(this.element, selectedElement); 9527 }, 9528 9529 updateChoices: function(choices) { 9530 if(!this.changed && this.hasFocus) { 9531 this.update.innerHTML = choices; 9532 Element.cleanWhitespace(this.update); 9533 Element.cleanWhitespace(this.update.down()); 9534 9535 if(this.update.firstChild && this.update.down().childNodes) { 9536 this.entryCount = 9537 this.update.down().childNodes.length; 9538 for (var i = 0; i < this.entryCount; i++) { 9539 var entry = this.getEntry(i); 9540 entry.autocompleteIndex = i; 9541 this.addObservers(entry); 9542 } 9543 } else { 9544 this.entryCount = 0; 9545 } 9546 9547 this.stopIndicator(); 9548 this.index = 0; 9549 9550 if(this.entryCount==1 && this.options.autoSelect) { 9551 this.selectEntry(); 9552 this.hide(); 9553 } else { 9554 this.render(); 9555 } 9556 } 9557 }, 9558 9559 addObservers: function(element) { 9560 Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); 9561 Event.observe(element, "click", this.onClick.bindAsEventListener(this)); 9562 }, 9563 9564 onObserverEvent: function() { 9565 this.changed = false;
9566 this.tokenBounds = null; 9567 if(this.getToken().length>=this.options.minChars) { 9568 this.getUpdatedChoices(); 9569 } else { 9570 this.active = false; 9571 this.hide(); 9572 } 9573 this.oldElementValue = this.element.value; 9574 }, 9575 9576 getToken: function() { 9577 var bounds = this.getTokenBounds(); 9578 return this.element.value.substring(bounds[0], bounds[1]).strip(); 9579 }, 9580 9581 getTokenBounds: function() { 9582 if (null != this.tokenBounds) return this.tokenBounds; 9583 var value = this.element.value; 9584 if (value.strip().empty()) return [-1, 0]; 9585 var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue); 9586 var offset = (diff == this.oldElementValue.length ? 1 : 0); 9587 var prevTokenPos = -1, nextTokenPos = value.length; 9588 var tp; 9589 for (var index = 0, l = this.options.tokens.length; index < l; ++index) { 9590 tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1); 9591 if (tp > prevTokenPos) prevTokenPos = tp; 9592 tp = value.indexOf(this.options.tokens[index], diff + offset); 9593 if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp; 9594 } 9595 return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); 9596 } 9597}); 9598 9599Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { 9600 var boundary = Math.min(newS.length, oldS.length); 9601 for (var index = 0; index < boundary; ++index) 9602 if (newS[index] != oldS[index]) 9603 return index; 9604 return boundary; 9605}; 9606 9607Ajax.Autocompleter = Class.create(Autocompleter.Base, { 9608 initialize: function(element, update, url, options) { 9609 this.baseInitialize(element, update, options); 9610 this.options.asynchronous = true; 9611 this.options.onComplete = this.onComplete.bind(this); 9612 this.options.defaultParams = this.options.parameters || null; 9613 this.url = url; 9614 }, 9615 9616 getUpdatedChoices: function() { 9617 this.startIndicator(); 9618 9619 var entry = encodeURIComponent(this.options.paramName) + '=' + 9620 encodeURIComponent(this.getToken()); 9621 9622 this.options.parameters = this.options.callback ? 9623 this.options.callback(this.element, entry) : entry; 9624 9625 if(this.options.defaultParams) 9626 this.options.parameters += '&' + this.options.defaultParams; 9627 9628 new Ajax.Request(this.url, this.options); 9629 }, 9630 9631 onComplete: function(request) { 9632 this.updateChoices(request.responseText); 9633 } 9634}); 9635 9636// The local array autocompleter. Used when you'd prefer to 9637// inject an array of autocompletion options into the page, rather 9638// than sending out Ajax queries, which can be quite slow sometimes. 9639// 9640// The constructor takes four parameters. The first two are, as usual, 9641// the id of the monitored textbox, and id of the autocompletion menu. 9642// The third is the array you want to autocomplete from, and the fourth 9643// is the options block. 9644// 9645// Extra local autocompletion options: 9646// - choices - How many autocompletion choices to offer 9647//
9648// - partialSearch - If false, the autocompleter will match entered 9649// text only at the beginning of strings in the 9650// autocomplete array. Defaults to true, which will 9651// match text at the beginning of any *word* in the 9652// strings in the autocomplete array. If you want to 9653// search anywhere in the string, additionally set 9654// the option fullSearch to true (default: off). 9655// 9656// - fullSsearch - Search anywhere in autocomplete array strings. 9657// 9658// - partialChars - How many characters to enter before triggering 9659// a partial match (unlike minChars, which defines 9660// how many characters are required to do any match 9661// at all). Defaults to 2. 9662// 9663// - ignoreCase - Whether to ignore case when autocompleting. 9664// Defaults to true. 9665// 9666// It's possible to pass in a custom function as the 'selector' 9667// option, if you prefer to write your own autocompletion logic. 9668// In that case, the other options above will not apply unless 9669// you support them. 9670 9671Autocompleter.Local = Class.create(Autocompleter.Base, { 9672 initialize: function(element, update, array, options) { 9673 this.baseInitialize(element, update, options); 9674 this.options.array = array; 9675 }, 9676 9677 getUpdatedChoices: function() { 9678 this.updateChoices(this.options.selector(this)); 9679 }, 9680 9681 setOptions: function(options) { 9682 this.options = Object.extend({ 9683 choices: 10, 9684 partialSearch: true, 9685 partialChars: 2, 9686 ignoreCase: true, 9687 fullSearch: false, 9688 selector: function(instance) { 9689 var ret = []; // Beginning matches 9690 var partial = []; // Inside matches 9691 var entry = instance.getToken(); 9692 var count = 0; 9693 9694 for (var i = 0; i < instance.options.array.length && 9695 ret.length < instance.options.choices ; i++) { 9696 9697 var elem = instance.options.array[i]; 9698 var foundPos = instance.options.ignoreCase ? 9699 elem.toLowerCase().indexOf(entry.toLowerCase()) : 9700 elem.indexOf(entry); 9701 9702 while (foundPos != -1) { 9703 if (foundPos == 0 && elem.length != entry.length) { 9704 ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" + 9705 elem.substr(entry.length) + "</li>"); 9706 break; 9707 } else if (entry.length >= instance.options.partialChars && 9708 instance.options.partialSearch && foundPos != -1) { 9709 if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { 9710 partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" + 9711 elem.substr(foundPos, entry.length) + "</strong>" + elem.substr( 9712 foundPos + entry.length) + "</li>"); 9713 break; 9714 } 9715 } 9716 9717 foundPos = instance.options.ignoreCase ? 9718 elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : 9719 elem.indexOf(entry, foundPos + 1); 9720 9721 } 9722 } 9723 if (partial.length) 9724 ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)); 9725 return "<ul>" + ret.join('') + "</ul>"; 9726 } 9727 }, options || { }); 9728 } 9729}); 9730 9731// AJAX in-place editor and collection editor 9732// Full rewrite by Christophe Porteneuve <[email protected]> (April 2007). 9733 9734// Use this if you notice weird scrolling problems on some browsers, 9735// the DOM might be a bit confused when this gets called so do this 9736// waits 1 ms (with setTimeout) until it does the activation 9737Field.scrollFreeActivate = function(field) { 9738 setTimeout(function() { 9739 Field.activate(field); 9740 }, 1); 9741}; 9742 9743Ajax.InPlaceEditor = Class.create({ 9744 initialize: function(element, url, options) { 9745 this.url = url; 9746 this.element = element = $(element); 9747 this.prepareOptions(); 9748 this._controls = { }; 9749 arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!! 9750 Object.extend(this.options, options || { });
9751 if (!this.options.formId && this.element.id) { 9752 this.options.formId = this.element.id + '-inplaceeditor'; 9753 if ($(this.options.formId)) 9754 this.options.formId = ''; 9755 } 9756 if (this.options.externalControl) 9757 this.options.externalControl = $(this.options.externalControl); 9758 if (!this.options.externalControl) 9759 this.options.externalControlOnly = false; 9760 this._originalBackground = this.element.getStyle('background-color') || 'transparent'; 9761 this.element.title = this.options.clickToEditText; 9762 this._boundCancelHandler = this.handleFormCancellation.bind(this); 9763 this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this); 9764 this._boundFailureHandler = this.handleAJAXFailure.bind(this); 9765 this._boundSubmitHandler = this.handleFormSubmission.bind(this); 9766 this._boundWrapperHandler = this.wrapUp.bind(this); 9767 this.registerListeners(); 9768 }, 9769 checkForEscapeOrReturn: function(e) { 9770 if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; 9771 if (Event.KEY_ESC == e.keyCode) 9772 this.handleFormCancellation(e); 9773 else if (Event.KEY_RETURN == e.keyCode) 9774 this.handleFormSubmission(e); 9775 }, 9776 createControl: function(mode, handler, extraClasses) { 9777 var control = this.options[mode + 'Control']; 9778 var text = this.options[mode + 'Text']; 9779 if ('button' == control) { 9780 var btn = document.createElement('input'); 9781 btn.type = 'submit'; 9782 btn.value = text; 9783 btn.className = 'editor_' + mode + '_button'; 9784 if ('cancel' == mode) 9785 btn.onclick = this._boundCancelHandler; 9786 this._form.appendChild(btn); 9787 this._controls[mode] = btn; 9788 } else if ('link' == control) { 9789 var link = document.createElement('a'); 9790 link.href = '#'; 9791 link.appendChild(document.createTextNode(text)); 9792 link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler; 9793 link.className = 'editor_' + mode + '_link'; 9794 if (extraClasses) 9795 link.className += ' ' + extraClasses; 9796 this._form.appendChild(link); 9797 this._controls[mode] = link; 9798 } 9799 }, 9800 createEditField: function() { 9801 var text = (this.options.loadTextURL ? this.options.loadingText : this.getText()); 9802 var fld; 9803 if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) { 9804 fld = document.createElement('input'); 9805 fld.type = 'text'; 9806 var size = this.options.size || this.options.cols || 0; 9807 if (0 < size) fld.size = size; 9808 } else { 9809 fld = document.createElement('textarea'); 9810 fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows); 9811 fld.cols = this.options.cols || 40; 9812 } 9813 fld.name = this.options.paramName; 9814 fld.value = text; // No HTML breaks conversion anymore 9815 fld.className = 'editor_field'; 9816 if (this.options.submitOnBlur) 9817 fld.onblur = this._boundSubmitHandler; 9818 this._controls.editor = fld; 9819 if (this.options.loadTextURL) 9820 this.loadExternalText(); 9821 this._form.appendChild(this._controls.editor); 9822 }, 9823 createForm: function() { 9824 var ipe = this; 9825 function addText(mode, condition) { 9826 var text = ipe.options['text' + mode + 'Controls']; 9827 if (!text || condition === false) return; 9828 ipe._form.appendChild(document.createTextNode(text)); 9829 }; 9830 this._form = $(document.createElement('form')); 9831 this._form.id = this.options.formId; 9832 this._form.addClassName(this.options.formClassName); 9833 this._form.onsubmit = this._boundSubmitHandler; 9834 this.createEditField(); 9835 if ('textarea' == this._controls.editor.tagName.toLowerCase()) 9836 this._form.appendChild(document.createElement('br')); 9837 if (this.options.onFormCustomization) 9838 this.options.onFormCustomization(this, this._form); 9839 addText('Before', this.options.okControl || this.options.cancelControl); 9840 this.createControl('ok', this._boundSubmitHandler); 9841 addText('Between', this.options.okControl && this.options.cancelControl); 9842 this.createControl('cancel', this._boundCancelHandler, 'editor_cancel'); 9843 addText('After', this.options.okControl || this.options.cancelControl); 9844 }, 9845 destroy: function() { 9846 if (this._oldInnerHTML) 9847 this.element.innerHTML = this._oldInnerHTML; 9848 this.leaveEditMode(); 9849 this.unregisterListeners(); 9850 }, 9851 enterEditMode: function(e) { 9852 if (this._saving || this._editing) return; 9853 this._editing = true; 9854 this.triggerCallback('onEnterEditMode'); 9855 if (this.options.externalControl) 9856 this.options.externalControl.hide(); 9857 this.element.hide(); 9858 this.createForm(); 9859 this.element.parentNode.insertBefore(this._form, this.element); 9860 if (!this.options.loadTextURL) 9861 this.postProcessEditField();
9862 if (e) Event.stop(e); 9863 }, 9864 enterHover: function(e) { 9865 if (this.options.hoverClassName) 9866 this.element.addClassName(this.options.hoverClassName); 9867 if (this._saving) return; 9868 this.triggerCallback('onEnterHover'); 9869 }, 9870 getText: function() { 9871 return this.element.innerHTML.unescapeHTML(); 9872 }, 9873 handleAJAXFailure: function(transport) { 9874 this.triggerCallback('onFailure', transport); 9875 if (this._oldInnerHTML) { 9876 this.element.innerHTML = this._oldInnerHTML; 9877 this._oldInnerHTML = null; 9878 } 9879 }, 9880 handleFormCancellation: function(e) { 9881 this.wrapUp(); 9882 if (e) Event.stop(e); 9883 }, 9884 handleFormSubmission: function(e) { 9885 var form = this._form; 9886 var value = $F(this._controls.editor); 9887 this.prepareSubmission(); 9888 var params = this.options.callback(form, value) || ''; 9889 if (Object.isString(params)) 9890 params = params.toQueryParams(); 9891 params.editorId = this.element.id; 9892 if (this.options.htmlResponse) { 9893 var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); 9894 Object.extend(options, { 9895 parameters: params, 9896 onComplete: this._boundWrapperHandler, 9897 onFailure: this._boundFailureHandler 9898 }); 9899 new Ajax.Updater({ success: this.element }, this.url, options); 9900 } else { 9901 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 9902 Object.extend(options, { 9903 parameters: params, 9904 onComplete: this._boundWrapperHandler, 9905 onFailure: this._boundFailureHandler 9906 }); 9907 new Ajax.Request(this.url, options); 9908 } 9909 if (e) Event.stop(e); 9910 }, 9911 leaveEditMode: function() { 9912 this.element.removeClassName(this.options.savingClassName); 9913 this.removeForm(); 9914 this.leaveHover(); 9915 this.element.style.backgroundColor = this._originalBackground; 9916 this.element.show(); 9917 if (this.options.externalControl) 9918 this.options.externalControl.show(); 9919 this._saving = false; 9920 this._editing = false; 9921 this._oldInnerHTML = null; 9922 this.triggerCallback('onLeaveEditMode'); 9923 }, 9924 leaveHover: function(e) { 9925 if (this.options.hoverClassName) 9926 this.element.removeClassName(this.options.hoverClassName); 9927 if (this._saving) return; 9928 this.triggerCallback('onLeaveHover'); 9929 }, 9930 loadExternalText: function() { 9931 this._form.addClassName(this.options.loadingClassName); 9932 this._controls.editor.disabled = true; 9933 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 9934 Object.extend(options, { 9935 parameters: 'editorId=' + encodeURIComponent(this.element.id), 9936 onComplete: Prototype.emptyFunction, 9937 onSuccess: function(transport) { 9938 this._form.removeClassName(this.options.loadingClassName); 9939 var text = transport.responseText; 9940 if (this.options.stripLoadedTextTags) 9941 text = text.stripTags(); 9942 this._controls.editor.value = text; 9943 this._controls.editor.disabled = false; 9944 this.postProcessEditField(); 9945 }.bind(this), 9946 onFailure: this._boundFailureHandler 9947 }); 9948 new Ajax.Request(this.options.loadTextURL, options); 9949 }, 9950 postProcessEditField: function() { 9951 var fpc = this.options.fieldPostCreation; 9952 if (fpc) 9953 $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate'](); 9954 }, 9955 prepareOptions: function() { 9956 this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions); 9957 Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks); 9958 [this._extraDefaultOptions].flatten().compact().each(function(defs) { 9959 Object.extend(this.options, defs); 9960 }.bind(this)); 9961 }, 9962 prepareSubmission: function() { 9963 this._saving = true; 9964 this.removeForm(); 9965 this.leaveHover(); 9966 this.showSaving(); 9967 }, 9968 registerListeners: function() { 9969 this._listeners = { }; 9970 var listener; 9971 $H(Ajax.InPlaceEditor.Listeners).each(function(pair) { 9972 listener = this[pair.value].bind(this); 9973 this._listeners[pair.key] = listener; 9974 if (!this.options.externalControlOnly) 9975 this.element.observe(pair.key, listener); 9976 if (this.options.externalControl) 9977 this.options.externalControl.observe(pair.key, listener); 9978 }.bind(this)); 9979 }, 9980 removeForm: function() { 9981 if (!this._form) return; 9982 this._form.remove(); 9983 this._form = null; 9984 this._controls = { }; 9985 }, 9986 showSaving: function() { 9987 this._oldInnerHTML = this.element.innerHTML; 9988 this.element.innerHTML = this.options.savingText; 9989 this.element.addClassName(this.options.savingClassName); 9990 this.element.style.backgroundColor = this._originalBackgroun
9990d; 9991 this.element.show(); 9992 }, 9993 triggerCallback: function(cbName, arg) { 9994 if ('function' == typeof this.options[cbName]) { 9995 this.options[cbName](this, arg); 9996 } 9997 }, 9998 unregisterListeners: function() { 9999 $H(this._listeners).each(function(pair) { 10000 if (!this.options.externalControlOnly) 10001 this.element.stopObserving(pair.key, pair.value); 10002 if (this.options.externalControl) 10003 this.options.externalControl.stopObserving(pair.key, pair.value); 10004 }.bind(this)); 10005 }, 10006 wrapUp: function(transport) { 10007 this.leaveEditMode(); 10008 // Can't use triggerCallback due to backward compatibility: requires 10009 // binding + direct element 10010 this._boundComplete(transport, this.element); 10011 } 10012}); 10013 10014Object.extend(Ajax.InPlaceEditor.prototype, { 10015 dispose: Ajax.InPlaceEditor.prototype.destroy 10016}); 10017 10018Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, { 10019 initialize: function($super, element, url, options) { 10020 this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; 10021 $super(element, url, options); 10022 }, 10023 10024 createEditField: function() { 10025 var list = document.createElement('select'); 10026 list.name = this.options.paramName; 10027 list.size = 1; 10028 this._controls.editor = list; 10029 this._collection = this.options.collection || []; 10030 if (this.options.loadCollectionURL) 10031 this.loadCollection(); 10032 else 10033 this.checkForExternalText(); 10034 this._form.appendChild(this._controls.editor); 10035 }, 10036 10037 loadCollection: function() { 10038 this._form.addClassName(this.options.loadingClassName); 10039 this.showLoadingText(this.options.loadingCollectionText); 10040 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 10041 Object.extend(options, { 10042 parameters: 'editorId=' + encodeURIComponent(this.element.id), 10043 onComplete: Prototype.emptyFunction, 10044 onSuccess: function(transport) { 10045 var js = transport.responseText.strip(); 10046 if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check 10047 throw('Server returned an invalid collection representation.'); 10048 this._collection = eval(js); 10049 this.checkForExternalText(); 10050 }.bind(this), 10051 onFailure: this.onFailure 10052 }); 10053 new Ajax.Request(this.options.loadCollectionURL, options); 10054 }, 10055 10056 showLoadingText: function(text) { 10057 this._controls.editor.disabled = true; 10058 var tempOption = this._controls.editor.firstChild; 10059 if (!tempOption) { 10060 tempOption = document.createElement('option'); 10061 tempOption.value = ''; 10062 this._controls.editor.appendChild(tempOption); 10063 tempOption.selected = true; 10064 } 10065 tempOption.update((text || '').stripScripts().stripTags()); 10066 }, 10067 10068 checkForExternalText: function() { 10069 this._text = this.getText(); 10070 if (this.options.loadTextURL) 10071 this.loadExternalText(); 10072 else 10073 this.buildOptionList(); 10074 }, 10075 10076 loadExternalText: function() { 10077 this.showLoadingText(this.options.loadingText); 10078 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 10079 Object.extend(options, { 10080 parameters: 'editorId=' + encodeURIComponent(this.element.id), 10081 onComplete: Prototype.emptyFunction, 10082 onSuccess: function(transport) { 10083 this._text = transport.responseText.strip(); 10084 this.buildOptionList(); 10085 }.bind(this), 10086 onFailure: this.onFailure 10087 }); 10088 new Ajax.Request(this.options.loadTextURL, options); 10089 }, 10090 10091 buildOptionList: function() { 10092 this._form.removeClassName(this.options.loadingClassName); 10093 this._collection = this._collection.map(function(entry) { 10094 return 2 === entry.length ? entry : [entry, entry].flatten(); 10095 }); 10096 var marker = ('value' in this.options) ? this.options.value : this._text; 10097 var textFound = this._collection.any(function(entry) { 10098 return entry[0] == marker; 10099 }.bind(this)); 10100 this._controls.editor.update(''); 10101 var option; 10102 this._collection.each(function(entry, index) { 10103 option = document.createElement('option'); 10104 option.value = entry[0]; 10105 option.selected = textFound ? entry[0] == marker : 0 == index; 10106 option.appendChild(document.createTextNode(entry[1])); 10107 this._controls.editor.appendChild(option); 10108 }.bind(this)); 10109 this._controls.editor.disabled = false;
10110 Field.scrollFreeActivate(this._controls.editor); 10111 } 10112}); 10113 10114//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! **** 10115//**** This only exists for a while, in order to let **** 10116//**** users adapt to the new API. Read up on the new **** 10117//**** API and convert your code to it ASAP! **** 10118 10119Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) { 10120 if (!options) return; 10121 function fallback(name, expr) { 10122 if (name in options || expr === undefined) return; 10123 options[name] = expr; 10124 }; 10125 fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' : 10126 options.cancelLink == options.cancelButton == false ? false : undefined))); 10127 fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' : 10128 options.okLink == options.okButton == false ? false : undefined))); 10129 fallback('highlightColor', options.highlightcolor); 10130 fallback('highlightEndColor', options.highlightendcolor); 10131}; 10132 10133Object.extend(Ajax.InPlaceEditor, { 10134 DefaultOptions: { 10135 ajaxOptions: { }, 10136 autoRows: 3, // Use when multi-line w/ rows == 1 10137 cancelControl: 'link', // 'link'|'button'|false 10138 cancelText: 'cancel', 10139 clickToEditText: 'Click to edit', 10140 externalControl: null, // id|elt 10141 externalControlOnly: false, 10142 fieldPostCreation: 'activate', // 'activate'|'focus'|false 10143 formClassName: 'inplaceeditor-form', 10144 formId: null, // id|elt 10145 highlightColor: '#ffff99', 10146 highlightEndColor: '#ffffff', 10147 hoverClassName: '', 10148 htmlResponse: true, 10149 loadingClassName: 'inplaceeditor-loading', 10150 loadingText: 'Loading...', 10151 okControl: 'button', // 'link'|'button'|false 10152 okText: 'ok', 10153 paramName: 'value', 10154 rows: 1, // If 1 and multi-line, uses autoRows 10155 savingClassName: 'inplaceeditor-saving', 10156 savingText: 'Saving...', 10157 size: 0, 10158 stripLoadedTextTags: false, 10159 submitOnBlur: false, 10160 textAfterControls: '', 10161 textBeforeControls: '', 10162 textBetweenControls: '' 10163 }, 10164 DefaultCallbacks: { 10165 callback: function(form) { 10166 return Form.serialize(form); 10167 }, 10168 onComplete: function(transport, element) { 10169 // For backward compatibility, this one is bound to the IPE, and passes 10170 // the element directly. It was too often customized, so we don't break it. 10171 new Effect.Highlight(element, { 10172 startcolor: this.options.highlightColor, keepBackgroundImage: true }); 10173 }, 10174 onEnterEditMode: null, 10175 onEnterHover: function(ipe) { 10176 ipe.element.style.backgroundColor = ipe.options.highlightColor; 10177 if (ipe._effect) 10178 ipe._effect.cancel(); 10179 }, 10180 onFailure: function(transport, ipe) { 10181 alert('Error communication with the server: ' + transport.responseText.stripTags()); 10182 }, 10183 onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. 10184 onLeaveEditMode: null, 10185 onLeaveHover: function(ipe) { 10186 ipe._effect = new Effect.Highlight(ipe.element, { 10187 startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, 10188 restorecolor: ipe._originalBackground, keepBackgroundImage: true 10189 }); 10190 } 10191 }, 10192 Listeners: { 10193 click: 'enterEditMode', 10194 keydown: 'checkForEscapeOrReturn', 10195 mouseover: 'enterHover', 10196 mouseout: 'leaveHover' 10197 } 10198}); 10199 10200Ajax.InPlaceCollectionEditor.DefaultOptions = { 10201 loadingCollectionText: 'Loading options...' 10202}; 10203 10204// Delayed observer, like Form.Element.Observer, 10205// but waits for delay after last key input 10206// Ideal for live-search fields 10207 10208Form.Element.DelayedObserver = Class.create({ 10209 initialize: function(element, delay, callback) { 10210 this.delay = delay || 0.5; 10211 this.element = $(element); 10212 this.callback = callback; 10213 this.timer = null; 10214 this.lastValue = $F(this.element); 10215 Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); 10216 }, 10217 delayedListener: function(event) { 10218 if(this.lastValue == $F(this.element)) return; 10219 if(this.timer) clearTimeout(this.timer); 10220 this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); 10221 this.lastValue = $F(this.element); 10222 },
10223 onTimerEvent: function() { 10224 this.timer = null; 10225 this.callback(this.element, $F(this.element)); 10226 } 10227}); 10228// script.aculo.us slider.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 10229 10230// Copyright (c) 2005-2008 Marty Haught, Thomas Fuchs 10231// 10232// script.aculo.us is freely distributable under the terms of an MIT-style license. 10233// For details, see the script.aculo.us web site: http://script.aculo.us/ 10234 10235if (!Control) var Control = { }; 10236 10237// options: 10238// axis: 'vertical', or 'horizontal' (default) 10239// 10240// callbacks: 10241// onChange(value) 10242// onSlide(value) 10243Control.Slider = Class.create({ 10244 initialize: function(handle, track, options) { 10245 var slider = this; 10246 10247 if (Object.isArray(handle)) { 10248 this.handles = handle.collect( function(e) { return $(e) }); 10249 } else { 10250 this.handles = [$(handle)]; 10251 } 10252 10253 this.track = $(track); 10254 this.options = options || { }; 10255 10256 this.axis = this.options.axis || 'horizontal'; 10257 this.increment = this.options.increment || 1; 10258 this.step = parseInt(this.options.step || '1'); 10259 this.range = this.options.range || $R(0,1); 10260 10261 this.value = 0; // assure backwards compat 10262 this.values = this.handles.map( function() { return 0 }); 10263 this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false; 10264 this.options.startSpan = $(this.options.startSpan || null); 10265 this.options.endSpan = $(this.options.endSpan || null); 10266 10267 this.restricted = this.options.restricted || false; 10268 10269 this.maximum = this.options.maximum || this.range.end; 10270 this.minimum = this.options.minimum || this.range.start; 10271 10272 // Will be used to align the handle onto the track, if necessary 10273 this.alignX = parseInt(this.options.alignX || '0'); 10274 this.alignY = parseInt(this.options.alignY || '0'); 10275 10276 this.trackLength = this.maximumOffset() - this.minimumOffset(); 10277 10278 this.handleLength = this.isVertical() ? 10279 (this.handles[0].offsetHeight != 0 ? 10280 this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : 10281 (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : 10282 this.handles[0].style.width.replace(/px$/,"")); 10283 10284 this.active = false; 10285 this.dragging = false; 10286 this.disabled = false; 10287 10288 if (this.options.disabled) this.setDisabled(); 10289 10290 // Allowed values array 10291 this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false; 10292 if (this.allowedValues) { 10293 this.minimum = this.allowedValues.min(); 10294 this.maximum = this.allowedValues.max(); 10295 } 10296 10297 this.eventMouseDown = this.startDrag.bindAsEventListener(this); 10298 this.eventMouseUp = this.endDrag.bindAsEventListener(this); 10299 this.eventMouseMove = this.update.bindAsEventListener(this); 10300 10301 // Initialize handles in reverse (make sure first handle is active) 10302 this.handles.each( function(h,i) { 10303 i = slider.handles.length-1-i; 10304 slider.setValue(parseFloat( 10305 (Object.isArray(slider.options.sliderValue) ? 10306 slider.options.sliderValue[i] : slider.options.sliderValue) || 10307 slider.range.start), i); 10308 h.makePositioned().observe("mousedown", slider.eventMouseDown); 10309 }); 10310 10311 this.track.observe("mousedown", this.eventMouseDown); 10312 document.observe("mouseup", this.eventMouseUp); 10313 $(this.track.parentNode.parentNode).observe("mousemove", this.eventMouseMove); 10314 10315 10316 this.initialized = true; 10317 }, 10318 dispose: function() { 10319 var slider = this; 10320 Event.stopObserving(this.track, "mousedown", this.eventMouseDown); 10321 Event.stopObserving(document, "mouseup", this.eventMouseUp); 10322 Event.stopObserving(this.track.parentNode.parentNode, "mousemove", this.eventMouseMove); 10323 this.handles.each( function(h) { 10324 Event.stopObserving(h, "mousedown", slider.eventMouseDown); 10325 }); 10326 }, 10327 setDisabled: function(){ 10328 this.disabled = true; 10329 this.track.parentNode.className = this.track.parentNode.className + ' disabled'; 10330 }, 10331 setEnabled: function(){ 10332 this.disabled = false; 10333 }, 10334 getNearestValue: function(value){ 10335 if (this.allowedValues){ 10336 if (value >= this.allowedValues.max()) return(this.allowedValues.max()); 10337 if (value <= this.allowedValues.min()) return(this.allowedValues.min()); 10338 10339 var offset = Math.abs(this.allowedValues[0] - value); 10340 var newValue = this.allowedValues[0]; 10341 this.allowedValues.each( function(v) { 10342 var currentOffset = Math.abs(v - value); 10343 if (currentOffset <= offset){ 10344 newValue = v; 10345 offset = currentOffset; 10346 } 10347 }); 10348 return newValue; 10349 } 10350 if (value > this.range.end) return this.range.end; 10351 if (value < this.range.start) return this.range.start; 10352 return value; 10353 }, 10354 setValue: function(sliderValue, handleIdx){ 10355 if (!this.active) { 10356 this.activeHandleIdx = handleIdx || 0; 10357 this.activeHandle = this.handles[this.activeHandleIdx]; 10358 this.updateStyles(); 10359 } 10360 handleIdx = handleIdx || this.activeHandleIdx || 0; 10361 if (this.initialized && this.restricted) { 10362 if ((handleIdx>0) && (sliderValue<this.values[handleIdx-1])) 10363 sliderValue = this.values[handleIdx-1]; 10364 if ((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1])) 10365 sliderValue = this.values[handleIdx+1]; 10366 } 10367 sliderValue = this.getNearestValue(sliderValue); 10368 this.values[handleIdx] = sliderValue; 10369 this.value = this.values[0]; // assure backwards compat 10370 10371 this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = 10372 this.translateToPx(sliderValue); 10373 10374 this.drawSpans(); 10375 if (!this.dragging || !this.event) this.updateFinished(); 10376 }, 10377 setValueBy: function(delta, handleIdx) { 10378 this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, 10379 handleIdx || this.activeHandleIdx || 0); 10380 }, 10381 translateToPx: function(value) { 10382 return Math.round( 10383 ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * 10384 (value - this.range.start)) + "px"; 10385 }, 10386 translateToValue: function(offset) { 10387 return ((offset/(this.trackLength-this.handleLength) * 10388 (this.range.end-this.range.start)) + this.range.start); 10389 }, 10390 getRange: function(range) { 10391 var v = this.values.sortBy(Prototype.K); 10392 range = range || 0; 10393 return $R(v[range],v[range+1]); 10394 }, 10395 minimumOffset: function(){ 10396 return(this.isVertical() ? this.alignY : this.alignX); 10397 }, 10398 maximumOffset: function(){ 10399 return(this.isVertical() ? 10400 (this.track.offsetHeight != 0 ? this.track.offsetHeight : 10401 this.track.style.height.replace(/px$/,"")) - this.alignY : 10402 (this.track.offsetWidth != 0 ? this.track.offsetWidth : 10403 this.track.style.width.replace(/px$/,"")) - this.alignX); 10404 }, 10405 isVertical: function(){ 10406 return (this.axis == 'vertical'); 10407 }, 10408 drawSpans: function() { 10409 var slider = this; 10410 if (this.spans) 10411 $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) }); 10412 if (this.options.startSpan) 10413 this.setSpan(this.options.startSpan, 10414 $R(0, this.values.length>1 ? this.getRange(0).min() : this.value )); 10415 if (this.options.endSpan) 10416 this.setSpan(this.options.endSpan, 10417 $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum)); 10418 }, 10419 setSpan: function(span, range) { 10420 if (this.isVertical()) { 10421 span.style.top = this.translateToPx(range.start); 10422 span.style.height = this.translateToPx(range.end - range.start + this.range.start); 10423 } else { 10424 span.style.left = this.translateToPx(range.start); 10425 span.style.width = this.translateToPx(range.end - range.start + this.range.start); 10426 } 10427 }, 10428 updateStyles: function() { 10429 this.handles.each( function(h){ Element.removeClassName(h, 'selected') }); 10430 Element.addClassName(this.activeHandle, 'selected'); 10431 }, 10432 startDrag: function(event) { 10433 if (Event.isLeftClick(event)) { 10434 if (!this.disabled){ 10435 this.active = true; 10436 10437 var handle = Event.element(event); 10438 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 10439 var track = handle; 10440 if (track==this.track) { 10441 var offsets = Position.cumulativeOffset(this.track); 10442 this.event = event; 10443 this.setValue(this.translateToValue( 10444 (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) 10445 )); 10446 var offsets = Position.cumulativeOffset(this.activeHandle); 10447 this.offsetX = (pointer[0] - offsets[0]); 10448 this.offsetY = (pointer[1] - offsets[1]); 10449 } else { 10450 // find the handle (prevents issues with Safari) 10451 while((this.handles.indexOf(handle) == -1) && handle.parentNode) 10452 handle = handle.parentNode; 10453 10454 if (this.handles.indexOf(handle)!=-1) { 10455 this.activeHandle = handle; 10456 this.activeHandleIdx = this.handles.indexOf(this.activeHandle); 10457 this.updateStyles(); 10458 10459 var offsets = Position.cumulativeOffset(this.activeHandle); 10460 this.offsetX = (pointer[0] - offsets[0]); 10461 this.offsetY = (pointer[1] - offsets[1]); 10462 } 10463 } 10464 } 10465 Event.stop(event); 10466 } 10467 }, 10468 update: function(event) { 10469 if (this.active) { 10470 if (!this.dragging) this.dragging = true; 10471 this.draw(event); 10472 if (Prototype.Browser.WebKit) window.scrollBy(0,0); 10473 Event.stop(event); 10474 } 10475 }, 10476 draw: function(event) { 10477 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 10478 var offsets = Position.cumulativeOffset(this.track); 10479 pointer[0] -= this.offsetX + offsets[0]; 10480 pointer[1] -= this.offsetY + offsets[1]; 10481 this.event = event; 10482 this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] )); 10483 if (this.initialized && this.options.onSlide) 10484 this.options.onSlide(this.values.length>1 ? this.values : this.value, this); 10485 }, 10486 endDrag: function(event) { 10487 if (this.active && this.dragging) { 10488 this.finishDrag(event, true); 10489 Event.stop(event); 10490 } 10491 this.active = false;
10492 this.dragging = false; 10493 }, 10494 finishDrag: function(event, success) { 10495 this.active = false; 10496 this.dragging = false; 10497 this.updateFinished(); 10498 }, 10499 updateFinished: function() { 10500 if (this.initialized && this.options.onChange) 10501 this.options.onChange(this.values.length>1 ? this.values : this.value, this); 10502 this.event = null; 10503 } 10504}); 10505/** 10506 * Magento 10507 * 10508 * NOTICE OF LICENSE 10509 * 10510 * This source file is subject to the Academic Free License (AFL 3.0) 10511 * that is bundled with this package in the file LICENSE_AFL.txt. 10512 * It is also available through the world-wide-web at this URL: 10513 * http://opensource.org/licenses/afl-3.0.php 10514 * If you did not receive a copy of the license and are unable to 10515 * obtain it through the world-wide-web, please send an email 10516 * to [email protected] so we can send you a copy immediately. 10517 * 10518 * DISCLAIMER 10519 * 10520 * Do not edit or add to this file if you wish to upgrade Magento to newer 10521 * versions in the future. If you wish to customize Magento for your 10522 * needs please refer to http://www.magento.com for more information. 10523 * 10524 * @category Varien 10525 * @package js 10526 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 10527 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 10528 */ 10529function popWin(url,win,para) { 10530 var win = window.open(url,win,para); 10531 win.focus(); 10532} 10533 10534function setLocation(url){ 10535 window.location.href = encodeURI(url); 10536} 10537 10538function setPLocation(url, setFocus){ 10539 if( setFocus ) { 10540 window.opener.focus(); 10541 } 10542 window.opener.location.href = encodeURI(url); 10543} 10544 10545/** 10546 * @deprecated 10547 */ 10548function setLanguageCode(code, fromCode){ 10549 //TODO: javascript cookies have different domain and path than php cookies 10550 var href = window.location.href; 10551 var after = '', dash; 10552 if (dash = href.match(/\#(.*)$/)) { 10553 href = href.replace(/\#(.*)$/, ''); 10554 after = dash[0]; 10555 } 10556 10557 if (href.match(/[?]/)) { 10558 var re = /([?&]store=)[a-z0-9_]*/; 10559 if (href.match(re)) { 10560 href = href.replace(re, '$1'+code); 10561 } else { 10562 href += '&store='+code; 10563 } 10564 10565 var re = /([?&]from_store=)[a-z0-9_]*/; 10566 if (href.match(re)) { 10567 href = href.replace(re, ''); 10568 } 10569 } else { 10570 href += '?store='+code; 10571 } 10572 if (typeof(fromCode) != 'undefined') { 10573 href += '&from_store='+fromCode; 10574 } 10575 href += after; 10576 10577 setLocation(href); 10578} 10579 10580/** 10581 * Add classes to specified elements. 10582 * Supported classes are: 'odd', 'even', 'first', 'last' 10583 * 10584 * @param elements - array of elements to be decorated 10585 * [@param decorateParams] - array of classes to be set. If omitted, all available will be used 10586 */ 10587function decorateGeneric(elements, decorateParams) 10588{ 10589 var allSupportedParams = ['odd', 'even', 'first', 'last']; 10590 var _decorateParams = {}; 10591 var total = elements.length; 10592 10593 if (total) { 10594 // determine params called 10595 if (typeof(decorateParams) == 'undefined') { 10596 decorateParams = allSupportedParams; 10597 } 10598 if (!decorateParams.length) { 10599 return; 10600 } 10601 for (var k in allSupportedParams) { 10602 _decorateParams[allSupportedParams[k]] = false; 10603 } 10604 for (var k in decorateParams) { 10605 _decorateParams[decorateParams[k]] = true; 10606 } 10607 10608 // decorate elements 10609 // elements[0].addClassName('first'); // will cause bug in IE (#5587) 10610 if (_decorateParams.first) { 10611 Element.addClassName(elements[0], 'first'); 10612 } 10613 if (_decorateParams.last) { 10614 Element.addClassName(elements[total-1], 'last'); 10615 } 10616 for (var i = 0; i < total; i++) { 10617 if ((i + 1) % 2 == 0) { 10618 if (_decorateParams.even) { 10619 Element.addClassName(elements[i], 'even'); 10620 } 10621 } 10622 else { 10623 if (_decorateParams.odd) { 10624 Element.addClassName(elements[i], 'odd'); 10625 } 10626 } 10627 } 10628 } 10629} 10630 10631/** 10632 * Decorate table rows and cells, tbody etc 10633 * @see decorateGeneric() 10634 */ 10635function decorateTable(table, options) { 10636 var table = $(table); 10637 if (table) { 10638 // set default options 10639 var _options = { 10640 'tbody' : false, 10641 'tbody tr' : ['odd', 'even', 'first', 'last'], 10642 'thead tr' : ['first', 'last'], 10643 'tfoot tr' : ['first', 'last'], 10644 'tr td' : ['last'] 10645 }; 10646 // overload options 10647 if (typeof(options) != 'undefined') { 10648 for (var k in options) { 10649 _options[k] = options[k]; 10650 } 10651 } 10652 // decorate 10653 if (_options['tbody']) { 10654 decorateGeneric(table.select('tbody'), _options['tbody']); 10655 } 10656 if (_options['tbody tr']) { 10657 decorateGeneric(table.select('tbody tr'), _options['tbody tr']); 10658 } 10659 if (_options['thead tr']) { 10660 decorateGeneric(table.select('thead tr'), _options['thead tr']); 10661 } 10662 if (_options['tfoot tr']) { 10663 decorateGeneric(table.select('tfoot tr'), _options['tfoot tr']); 10664 } 10665 if (_options['tr td']) { 10666 var allRows = table.select('tr'); 10667 if (allRows.length) { 10668 for (var i = 0; i < allRows.length; i++) { 10669 decorateGeneric(allRows[i].getElementsByTagName('TD'), _options['tr td']); 10670 } 10671 } 10672 } 10673 } 10674} 10675 10676/** 10677 * Set "odd", "even" and "last" CSS classes for list items 10678 * @see decorateGeneric() 10679 */ 10680function decorateList(list, nonRecursive) { 10681 if ($(list)) { 10682 if (typeof(nonRecursive) == 'undefined') { 10683 var items = $(list).select('li'); 10684 } 10685 else { 10686 var items = $(list).childElements(); 10687 } 10688 decorateGeneric(items, ['odd', 'even', 'last']); 10689 } 10690} 10691 10692/** 10693 * Set "odd", "even" and "last" CSS classes for list items 10694 * @see decorateGeneric() 10695 */ 10696function decorateDataList(list) { 10697 list = $(list); 10698 if (list) { 10699 decorateGeneric(list.select('dt'), ['odd', 'even', 'last']); 10700 decorateGeneric(list.select('dd'), ['odd', 'even', 'last']); 10701 } 10702} 10703 10704/** 10705 * Parse SID and produces the correct URL 10706 */ 10707function parseSidUrl(baseUrl, urlExt) { 10708 var sidPos = baseUrl.indexOf('/?SID='); 10709 var sid = ''; 10710 urlExt = (urlExt != undefined) ? urlExt : ''; 10711 10712 if(sidPos > -1) { 10713 sid = '?' + baseUrl.substring(sidPos + 2); 10714 baseUrl = baseUrl.substring(0, sidPos + 1); 10715 } 10716 10717 return baseUrl+urlExt+sid; 10718} 10719 10720/** 10721 * Formats currency using patern 10722 * format - JSON (pattern, decimal, decimalsDelimeter, groupsDelimeter) 10723 * showPlus - true (always show '+'or '-'), 10724 * false (never show '-' even if number is negative) 10725 * null (show '-' if number is negative) 10726 */ 10727 10728function formatCurrency(price, format, showPlus){ 10729 var precision = isNaN(format.precision = Math.abs(format.precision)) ? 2 : format.precision; 10730 var requiredPrecision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision; 10731 10732 //precision = (precision > requiredPrecision) ? precision : requiredPrecision; 10733 //for now we don't need this difference so precision is requiredPrecision 10734 precision = requiredPrecision; 10735 10736 var integerRequired = isNaN(format.integerRequired = Math.abs(format.integerRequired)) ? 1 : format.integerRequired; 10737 10738 var decimalSymbol = format.decimalSymbol == undefined ? "," : format.decimalSymbol; 10739 var groupSymbol = format.groupSymbol == undefined ? "." : format.groupSymbol; 10740 var groupLength = format.groupLength == undefined ? 3 : format.groupLength; 10741 10742 var s = ''; 10743 10744 if (showPlus == undefined || showPlus == true) { 10745 s = price < 0 ? "-" : ( showPlus ? "+" : ""); 10746 } else if (showPlus == false) { 10747 s = ''; 10748 } 10749 10750 var i = parseInt(price = Math.abs(+price || 0).toFixed(precision)) + ""; 10751 var pad = (i.length < integerRequired) ? (integerRequired - i.length) : 0; 10752 while (pad) { i = '0' + i; pad--; } 10753 j = (j = i.length) > groupLength ? j % groupLength : 0; 10754 re = new RegExp("(\\d{" + groupLength + "})(?=\\d)", "g"); 10755 10756 /** 10757 * replace(/-/, 0) is only for fixing Safari bug which appears 10758 * when Math.abs(0).toFixed() executed on "0" number. 10759 * Result is "0.-0" :( 10760 */ 10761 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) : ""); 10762 var pattern = ''; 10763 if (format.pattern.indexOf('{sign}') == -1) { 10764 pattern = s + format.pattern; 10765 } else { 10766 pattern = format.pattern.replace('{sign}', s); 10767 } 10768 10769 return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, ''); 10770}; 10771 10772function expandDetails(el, childClass) {
10773 if (Element.hasClassName(el,'show-details')) { 10774 $$(childClass).each(function(item){ 10775 item.hide(); 10776 }); 10777 Element.removeClassName(el,'show-details'); 10778 } 10779 else { 10780 $$(childClass).each(function(item){ 10781 item.show(); 10782 }); 10783 Element.addClassName(el,'show-details'); 10784 } 10785} 10786 10787// Version 1.0 10788var isIE = navigator.appVersion.match(/MSIE/) == "MSIE"; 10789 10790if (!window.Varien) 10791 var Varien = new Object(); 10792 10793Varien.showLoading = function(){ 10794 var loader = $('loading-process'); 10795 loader && loader.show(); 10796}; 10797Varien.hideLoading = function(){ 10798 var loader = $('loading-process'); 10799 loader && loader.hide(); 10800}; 10801Varien.GlobalHandlers = { 10802 onCreate: function() { 10803 Varien.showLoading(); 10804 }, 10805 10806 onComplete: function() { 10807 if(Ajax.activeRequestCount == 0) { 10808 Varien.hideLoading(); 10809 } 10810 } 10811}; 10812 10813Ajax.Responders.register(Varien.GlobalHandlers); 10814 10815/** 10816 * Quick Search form client model 10817 */ 10818Varien.searchForm = Class.create(); 10819Varien.searchForm.prototype = { 10820 initialize : function(form, field, emptyText){ 10821 this.form = $(form); 10822 this.field = $(field); 10823 this.emptyText = emptyText; 10824 10825 Event.observe(this.form, 'submit', this.submit.bind(this)); 10826 Event.observe(this.field, 'focus', this.focus.bind(this)); 10827 Event.observe(this.field, 'blur', this.blur.bind(this)); 10828 this.blur(); 10829 }, 10830 10831 submit : function(event){ 10832 if (this.field.value == this.emptyText || this.field.value == ''){ 10833 Event.stop(event); 10834 return false; 10835 } 10836 return true; 10837 }, 10838 10839 focus : function(event){ 10840 if(this.field.value==this.emptyText){ 10841 this.field.value=''; 10842 } 10843 10844 }, 10845 10846 blur : function(event){ 10847 if(this.field.value==''){ 10848 this.field.value=this.emptyText; 10849 } 10850 }, 10851 10852 initAutocomplete : function(url, destinationElement){ 10853 new Ajax.Autocompleter( 10854 this.field, 10855 destinationElement, 10856 url, 10857 { 10858 paramName: this.field.name, 10859 method: 'get', 10860 minChars: 2, 10861 updateElement: this._selectAutocompleteItem.bind(this), 10862 onShow : function(element, update) { 10863 if(!update.style.position || update.style.position=='absolute') { 10864 update.style.position = 'absolute'; 10865 Position.clone(element, update, { 10866 setHeight: false, 10867 offsetTop: element.offsetHeight 10868 }); 10869 }
10870 Effect.Appear(update,{duration:0}); 10871 } 10872 10873 } 10874 ); 10875 }, 10876 10877 _selectAutocompleteItem : function(element){ 10878 if(element.title){ 10879 this.field.value = element.title; 10880 } 10881 this.form.submit(); 10882 } 10883}; 10884 10885Varien.Tabs = Class.create(); 10886Varien.Tabs.prototype = { 10887 initialize: function(selector) { 10888 var self=this; 10889 $$(selector+' a').each(this.initTab.bind(this)); 10890 }, 10891 10892 initTab: function(el) { 10893 el.href = 'javascript:void(0)'; 10894 if ($(el.parentNode).hasClassName('active')) { 10895 this.showContent(el); 10896 } 10897 el.observe('click', this.showContent.bind(this, el)); 10898 }, 10899 10900 showContent: function(a) { 10901 var li = $(a.parentNode), ul = $(li.parentNode); 10902 ul.getElementsBySelector('li', 'ol').each(function(el){ 10903 var contents = $(el.id+'_contents'); 10904 if (el==li) { 10905 el.addClassName('active'); 10906 contents.show(); 10907 } else { 10908 el.removeClassName('active'); 10909 contents.hide(); 10910 } 10911 }); 10912 } 10913}; 10914 10915Varien.DateElement = Class.create(); 10916Varien.DateElement.prototype = { 10917 initialize: function(type, content, required, format) { 10918 if (type == 'id') { 10919 // id prefix 10920 this.day = $(content + 'day'); 10921 this.month = $(content + 'month'); 10922 this.year = $(content + 'year'); 10923 this.full = $(content + 'full'); 10924 this.advice = $(content + 'date-advice'); 10925 } else if (type == 'container') { 10926 // content must be container with data 10927 this.day = content.day; 10928 this.month = content.month; 10929 this.year = content.year; 10930 this.full = content.full; 10931 this.advice = content.advice; 10932 } else { 10933 return; 10934 } 10935 10936 this.required = required; 10937 this.format = format; 10938 10939 this.day.addClassName('validate-custom'); 10940 this.day.validate = this.validate.bind(this); 10941 this.month.addClassName('validate-custom'); 10942 this.month.validate = this.validate.bind(this); 10943 this.year.addClassName('validate-custom'); 10944 this.year.validate = this.validate.bind(this); 10945 10946 this.setDateRange(false, false); 10947 this.year.setAttribute('autocomplete','off'); 10948 10949 this.advice.hide(); 10950 10951 var date = new Date; 10952 this.curyear = date.getFullYear(); 10953 }, 10954 validate: function() { 10955 var error = false, 10956 day = parseInt(this.day.value, 10) || 0, 10957 month = parseInt(this.month.value, 10) || 0, 10958 year = parseInt(this.year.value, 10) || 0; 10959 if (this.day.value.strip().empty() 10960 && this.month.value.strip().empty() 10961 && this.year.value.strip().empty() 10962 ) { 10963 if (this.required) { 10964 error = 'This date is a required value.'; 10965 } else { 10966 this.full.value = ''; 10967 } 10968 } else if (!day || !month || !year) { 10969 error = 'Please enter a valid full date'; 10970 } else { 10971 var date = new Date, countDaysInMonth = 0, errorType = null; 10972 date.setYear(year);date.setMonth(month-1);date.setDate(32); 10973 countDaysInMonth = 32 - date.getDate(); 10974 if(!countDaysInMonth || countDaysInMonth>31) countDaysInMonth = 31; 10975 if(year < 1900) error = this.errorTextModifier(this.validateDataErrorText); 10976 10977 if (day<1 || day>countDaysInMonth) { 10978 errorType = 'day'; 10979 error = 'Please enter a valid day (1-%d).'; 10980 } else if (month<1 || month>12) { 10981 errorType = 'month'; 10982 error = 'Please enter a valid month (1-12).'; 10983 } else { 10984 if(day % 10 == day) this.day.value = '0'+day; 10985 if(month % 10 == month) this.month.value = '0'+month; 10986 this.full.value = this.format.replace(/%[mb]/i, this.month.value).replace(/%[de]/i, this.day.value).replace(/%y/i, this.year.value); 10987 var testFull = this.month.value + '/' + this.day.value + '/'+ this.year.value; 10988 var test = new Date(testFull); 10989 if (isNaN(test)) { 10990 error = 'Please enter a valid date.'; 10991 } else { 10992 this.setFullDate(test); 10993 } 10994 } 10995 var valueError = false;
10996 if (!error && !this.validateData()){//(year<1900 || year>curyear) { 10997 errorType = this.validateDataErrorType;//'year'; 10998 valueError = this.validateDataErrorText;//'Please enter a valid year (1900-%d).'; 10999 error = valueError; 11000 } 11001 } 11002 11003 if (error !== false) { 11004 try { 11005 error = Translator.translate(error); 11006 } 11007 catch (e) {} 11008 if (!valueError) { 11009 this.advice.innerHTML = error.replace('%d', countDaysInMonth); 11010 } else { 11011 this.advice.innerHTML = this.errorTextModifier(error); 11012 } 11013 this.advice.show(); 11014 return false; 11015 } 11016 11017 // fixing elements class 11018 this.day.removeClassName('validation-failed'); 11019 this.month.removeClassName('validation-failed'); 11020 this.year.removeClassName('validation-failed'); 11021 11022 this.advice.hide(); 11023 return true; 11024 }, 11025 validateData: function() { 11026 var year = this.fullDate.getFullYear(); 11027 return (year>=1900 && year<=this.curyear); 11028 }, 11029 validateDataErrorType: 'year', 11030 validateDataErrorText: 'Please enter a valid year (1900-%d).', 11031 errorTextModifier: function(text) { 11032 text = Translator.translate(text); 11033 return text.replace('%d', this.curyear); 11034 }, 11035 setDateRange: function(minDate, maxDate) { 11036 this.minDate = minDate; 11037 this.maxDate = maxDate; 11038 }, 11039 setFullDate: function(date) { 11040 this.fullDate = date; 11041 } 11042}; 11043 11044Varien.DOB = Class.create(); 11045Varien.DOB.prototype = { 11046 initialize: function(selector, required, format) { 11047 var el = $$(selector)[0]; 11048 var container = {}; 11049 container.day = Element.select(el, '.dob-day input')[0]; 11050 container.month = Element.select(el, '.dob-month input')[0]; 11051 container.year = Element.select(el, '.dob-year input')[0]; 11052 container.full = Element.select(el, '.dob-full input')[0]; 11053 container.advice = Element.select(el, '.validation-advice')[0]; 11054 11055 new Varien.DateElement('container', container, required, format); 11056 } 11057}; 11058 11059Varien.dateRangeDate = Class.create(); 11060Varien.dateRangeDate.prototype = Object.extend(new Varien.DateElement(), { 11061 validateData: function() { 11062 var validate = true; 11063 if (this.minDate || this.maxValue) { 11064 if (this.minDate) { 11065 this.minDate = new Date(this.minDate); 11066 this.minDate.setHours(0); 11067 if (isNaN(this.minDate)) { 11068 this.minDate = new Date('1/1/1900'); 11069 } 11070 validate = validate && (this.fullDate >= this.minDate); 11071 } 11072 if (this.maxDate) { 11073 this.maxDate = new Date(this.maxDate); 11074 this.minDate.setHours(0); 11075 if (isNaN(this.maxDate)) { 11076 this.maxDate = new Date(); 11077 } 11078 validate = validate && (this.fullDate <= this.maxDate); 11079 } 11080 if (this.maxDate && this.minDate) { 11081 this.validateDataErrorText = 'Please enter a valid date between %s and %s'; 11082 } else if (this.maxDate) { 11083 this.validateDataErrorText = 'Please enter a valid date less than or equal to %s'; 11084 } else if (this.minDate) { 11085 this.validateDataErrorText = 'Please enter a valid date equal to or greater than %s'; 11086 } else { 11087 this.validateDataErrorText = ''; 11088 } 11089 } 11090 return validate; 11091 }, 11092 validateDataErrorText: 'Date should be between %s and %s', 11093 errorTextModifier: function(text) { 11094 if (this.minDate) { 11095 text = text.sub('%s', this.dateFormat(this.minDate)); 11096 } 11097 if (this.maxDate) { 11098 text = text.sub('%s', this.dateFormat(this.maxDate)); 11099 } 11100 return text; 11101 }, 11102 dateFormat: function(date) { 11103 return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear(); 11104 } 11105}); 11106 11107Varien.FileElement = Class.create(); 11108Varien.FileElement.prototype = { 11109 initialize: function (id) { 11110 this.fileElement = $(id); 11111 this.hiddenElement = $(id + '_value'); 11112 11113 this.fileElement.observe('change', this.selectFile.bind(this)); 11114 }, 11115 selectFile: function(event) { 11116 this.hiddenElement.value = this.fileElement.getValue(); 11117 } 11118}; 11119 11120Validation.addAllThese([ 11121 ['validate-custom', ' ', function(v,elm) { 11122 return elm.validate(); 11123 }] 11124]); 11125 11126function truncateOptions() { 11127 $$('.truncated').each(function(element){ 11128 Event.observe(element, 'mouseover', function(){ 11129 if (element.down('div.truncated_full_value')) { 11130 element.down('div.truncated_full_value').addClassName('show'); 11131 } 11132 }); 11133 Event.observe(element, 'mouseout', function(){ 11134 if (element.down('div.truncated_full_value')) { 11135 element.down('div.truncated_full_value').removeClassName('show'); 11136 } 11137 }); 11138 11139 }); 11140} 11141Event.observe(window, 'load', function(){ 11142 truncateOptions(); 11143}); 11144 11145Element.addMethods({ 11146 getInnerText: function(element) 11147 { 11148 element = $(element); 11149 if(element.innerText && !Prototype.Browser.Opera) { 11150 return element.innerText; 11151 } 11152 return element.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g, ' ').strip(); 11153 } 11154}); 11155 11156/* 11157if (!("console" in window) || !("firebug" in console)) 11158{ 11159 var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", 11160 "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; 11161 11162 window.console = {}; 11163 for (var i = 0; i < names.length; ++i) 11164 window.console[names[i]] = function() {} 11165} 11166*/ 11167 11168/** 11169 * Executes event handler on the element. Works with event handlers attached by Prototype, 11170 * in a browser-agnostic fashion. 11171 * @param element The element object 11172 * @param event Event name, like 'change' 11173 * 11174 * @example fireEvent($('my-input', 'click')); 11175 */ 11176function fireEvent(element, event) { 11177 if (document.createEvent) { 11178 // dispatch for all browsers except IE before version 9 11179 var evt = document.createEvent("HTMLEvents"); 11180 evt.initEvent(event, true, true ); // event type, bubbling, cancelable 11181 return element.dispatchEvent(evt); 11182 } else { 11183 // dispatch for IE before version 9 11184 var evt = document.createEventObject(); 11185 return element.fireEvent('on' + event, evt); 11186 } 11187} 11188 11189/** 11190 * Returns more accurate results of floating-point modulo division 11191 * E.g.: 11192 * 0.6 % 0.2 = 0.19999999999999996 11193 * modulo(0.6, 0.2) = 0 11194 * 11195 * @param dividend 11196 * @param divisor 11197 */ 11198function modulo(dividend, divisor) 11199{ 11200 var epsilon = divisor / 10000; 11201 var remainder = dividend % divisor; 11202 11203 if (Math.abs(remainder - divisor) < epsilon || Math.abs(remainder) < epsilon) { 11204 remainder = 0; 11205 } 11206 11207 return remainder; 11208} 11209 11210/** 11211 * createContextualFragment is not supported in IE9. Adding its support. 11212 */ 11213if ((typeof Range != "undefined") && !Range.prototype.createContextualFragment) 11214{ 11215 Range.prototype.createContextualFragment = function(html) 11216 { 11217 var frag = document.createDocumentFragment(), 11218 div = document.createElement("div"); 11219 frag.appendChild(div); 11220 div.outerHTML = html; 11221 return frag; 11222 }; 11223} 11224 11225/** 11226 * Magento 11227 * 11228 * NOTICE OF LICENSE 11229 * 11230 * This source file is subject to the Academic Free License (AFL 3.0)
11231 * that is bundled with this package in the file LICENSE_AFL.txt. 11232 * It is also available through the world-wide-web at this URL: 11233 * http://opensource.org/licenses/afl-3.0.php 11234 * If you did not receive a copy of the license and are unable to 11235 * obtain it through the world-wide-web, please send an email 11236 * to [email protected] so we can send you a copy immediately. 11237 * 11238 * DISCLAIMER 11239 * 11240 * Do not edit or add to this file if you wish to upgrade Magento to newer 11241 * versions in the future. If you wish to customize Magento for your 11242 * needs please refer to http://www.magento.com for more information. 11243 * 11244 * @category Varien 11245 * @package js 11246 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 11247 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11248 */ 11249VarienForm = Class.create(); 11250VarienForm.prototype = { 11251 initialize: function(formId, firstFieldFocus){ 11252 this.form = $(formId); 11253 if (!this.form) { 11254 return; 11255 } 11256 this.cache = $A(); 11257 this.currLoader = false;
11258 this.currDataIndex = false; 11259 this.validator = new Validation(this.form); 11260 this.elementFocus = this.elementOnFocus.bindAsEventListener(this); 11261 this.elementBlur = this.elementOnBlur.bindAsEventListener(this); 11262 this.childLoader = this.onChangeChildLoad.bindAsEventListener(this); 11263 this.highlightClass = 'highlight'; 11264 this.extraChildParams = ''; 11265 this.firstFieldFocus= firstFieldFocus || false; 11266 this.bindElements(); 11267 if(this.firstFieldFocus){ 11268 try{ 11269 Form.Element.focus(Form.findFirstElement(this.form)); 11270 } 11271 catch(e){} 11272 } 11273 }, 11274 11275 submit : function(url){ 11276 if(this.validator && this.validator.validate()){ 11277 this.form.submit(); 11278 } 11279 return false; 11280 }, 11281 11282 bindElements:function (){ 11283 var elements = Form.getElements(this.form); 11284 for (var row in elements) { 11285 if (elements[row].id) { 11286 Event.observe(elements[row],'focus',this.elementFocus); 11287 Event.observe(elements[row],'blur',this.elementBlur); 11288 } 11289 } 11290 }, 11291 11292 elementOnFocus: function(event){ 11293 var element = Event.findElement(event, 'fieldset'); 11294 if(element){ 11295 Element.addClassName(element, this.highlightClass); 11296 } 11297 }, 11298 11299 elementOnBlur: function(event){ 11300 var element = Event.findElement(event, 'fieldset'); 11301 if(element){ 11302 Element.removeClassName(element, this.highlightClass); 11303 } 11304 }, 11305 11306 setElementsRelation: function(parent, child, dataUrl, first){ 11307 if (parent=$(parent)) { 11308 // TODO: array of relation and caching 11309 if (!this.cache[parent.id]){ 11310 this.cache[parent.id] = $A(); 11311 this.cache[parent.id]['child'] = child; 11312 this.cache[parent.id]['dataUrl'] = dataUrl; 11313 this.cache[parent.id]['data'] = $A(); 11314 this.cache[parent.id]['first'] = first || false; 11315 } 11316 Event.observe(parent,'change',this.childLoader); 11317 } 11318 }, 11319 11320 onChangeChildLoad: function(event){ 11321 element = Event.element(event); 11322 this.elementChildLoad(element); 11323 }, 11324 11325 elementChildLoad: function(element, callback){ 11326 this.callback = callback || false; 11327 if (element.value) { 11328 this.currLoader = element.id; 11329 this.currDataIndex = element.value; 11330 if (this.cache[element.id]['data'][element.value]) { 11331 this.setDataToChild(this.cache[element.id]['data'][element.value]); 11332 } 11333 else{ 11334 new Ajax.Request(this.cache[this.currLoader]['dataUrl'],{ 11335 method: 'post', 11336 parameters: {"parent":element.value}, 11337 onComplete: this.reloadChildren.bind(this) 11338 }); 11339 } 11340 } 11341 }, 11342 11343 reloadChildren: function(transport){ 11344 var data = transport.responseJSON || transport.responseText.evalJSON(true) || {}; 11345 this.cache[this.currLoader]['data'][this.currDataIndex] = data; 11346 this.setDataToChild(data); 11347 }, 11348 11349 setDataToChild: function(data){ 11350 if (data.length) { 11351 var child = $(this.cache[this.currLoader]['child']); 11352 if (child){ 11353 var html = '<select name="'+child.name+'" id="'+child.id+'" class="'+child.className+'" title="'+child.title+'" '+this.extraChildParams+'>'; 11354 if(this.cache[this.currLoader]['first']){ 11355 html+= '<option value="">'+this.cache[this.currLoader]['first']+'</option>'; 11356 } 11357 for (var i in data){ 11358 if(data[i].value) { 11359 html+= '<option value="'+data[i].value+'"'; 11360 if(child.value && (child.value == data[i].value || child.value == data[i].label)){ 11361 html+= ' selected'; 11362 } 11363 html+='>'+data[i].label+'</option>'; 11364 } 11365 } 11366 html+= '</select>'; 11367 Element.insert(child, {before: html}); 11368 Element.remove(child); 11369 } 11370 } 11371 else{ 11372 var child = $(this.cache[this.currLoader]['child']); 11373 if (child){ 11374 var html = '<input type="text" name="'+child.name+'" id="'+child.id+'" class="'+child.className+'" title="'+child.title+'" '+this.extraChildParams+'>'; 11375 Element.insert(child, {before: html}); 11376 Element.remove(child); 11377 } 11378 } 11379 11380 this.bindElements(); 11381 if (this.callback) { 11382 this.callback(); 11383 } 11384 } 11385}; 11386 11387RegionUpdater = Class.create(); 11388RegionUpdater.prototype = { 11389 initialize: function (countryEl, regionTextEl, regionSelectEl, regions, disableAction, zipEl) 11390 { 11391 this.countryEl = $(countryEl); 11392 this.regionTextEl = $(regionTextEl); 11393 this.regionSelectEl = $(regionSelectEl); 11394 this.zipEl = $(zipEl); 11395 this.config = regions['config']; 11396 delete regions.config; 11397 this.regions = regions; 11398 11399 this.disableAction = (typeof disableAction=='undefined') ? 'hide' : disableAction; 11400 this.zipOptions = (typeof zipOptions=='undefined') ? false : zipOptions; 11401 11402 if (this.regionSelectEl.options.length<=1) { 11403 this.update(); 11404 } 11405 11406 Event.observe(this.countryEl, 'change', this.update.bind(this)); 11407 }, 11408
11409 _checkRegionRequired: function() 11410 { 11411 var label, wildCard; 11412 var elements = [this.regionTextEl, this.regionSelectEl]; 11413 var that = this; 11414 if (typeof this.config == 'undefined') { 11415 return; 11416 } 11417 var regionRequired = this.config.regions_required.indexOf(this.countryEl.value) >= 0; 11418 11419 elements.each(function(currentElement) { 11420 Validation.reset(currentElement); 11421 label = $$('label[for="' + currentElement.id + '"]')[0]; 11422 if (label) { 11423 wildCard = label.down('em') || label.down('span.required'); 11424 if (!that.config.show_all_regions) { 11425 if (regionRequired) { 11426 label.up().show(); 11427 } else { 11428 label.up().hide(); 11429 } 11430 } 11431 } 11432 11433 if (label && wildCard) { 11434 if (!regionRequired) { 11435 wildCard.hide(); 11436 if (label.hasClassName('required')) { 11437 label.removeClassName('required'); 11438 } 11439 } else if (regionRequired) { 11440 wildCard.show(); 11441 if (!label.hasClassName('required')) { 11442 label.addClassName('required'); 11443 } 11444 } 11445 } 11446 11447 if (!regionRequired) { 11448 if (currentElement.hasClassName('required-entry')) { 11449 currentElement.removeClassName('required-entry'); 11450 } 11451 if ('select' == currentElement.tagName.toLowerCase() && 11452 currentElement.hasClassName('validate-select')) { 11453 currentElement.removeClassName('validate-select'); 11454 } 11455 } else { 11456 if (!currentElement.hasClassName('required-entry')) { 11457 currentElement.addClassName('required-entry'); 11458 } 11459 if ('select' == currentElement.tagName.toLowerCase() && 11460 !currentElement.hasClassName('validate-select')) { 11461 currentElement.addClassName('validate-select'); 11462 } 11463 } 11464 }); 11465 }, 11466 11467 update: function() 11468 { 11469 if (this.regions[this.countryEl.value]) { 11470 var i, option, region, def; 11471 11472 def = this.regionSelectEl.getAttribute('defaultValue'); 11473 if (this.regionTextEl) { 11474 if (!def) { 11475 def = this.regionTextEl.value.toLowerCase(); 11476 } 11477 this.regionTextEl.value = ''; 11478 } 11479 11480 this.regionSelectEl.options.length = 1; 11481 for (regionId in this.regions[this.countryEl.value]) { 11482 region = this.regions[this.countryEl.value][regionId]; 11483 11484 option = document.createElement('OPTION'); 11485 option.value = regionId; 11486 option.text = region.name.stripTags(); 11487 option.title = region.name; 11488 11489 if (this.regionSelectEl.options.add) { 11490 this.regionSelectEl.options.add(option); 11491 } else { 11492 this.regionSelectEl.appendChild(option); 11493 } 11494 11495 if (regionId == def || (region.name && region.name.toLowerCase() == def) 11496 || (region.name && region.code.toLowerCase() == def) 11497 ) { 11498 this.regionSelectEl.value = regionId; 11499 } 11500 } 11501 this.sortSelect(); 11502 if (this.disableAction == 'hide') { 11503 if (this.regionTextEl) { 11504 this.regionTextEl.style.display = 'none'; 11505 } 11506 11507 this.regionSelectEl.style.display = ''; 11508 } else if (this.disableAction == 'disable') { 11509 if (this.regionTextEl) { 11510 this.regionTextEl.disabled = true; 11511 } 11512 this.regionSelectEl.disabled = false; 11513 } 11514 this.setMarkDisplay(this.regionSelectEl, true); 11515 } else { 11516 this.regionSelectEl.options.length = 1; 11517 this.sortSelect(); 11518 if (this.disableAction == 'hide') { 11519 if (this.regionTextEl) { 11520 this.regionTextEl.style.display = ''; 11521 } 11522 this.regionSelectEl.style.display = 'none'; 11523 Validation.reset(this.regionSelectEl); 11524 } else if (this.disableAction == 'disable') { 11525 if (this.regionTextEl) { 11526 this.regionTextEl.disabled = false;
11527 } 11528 this.regionSelectEl.disabled = true; 11529 } else if (this.disableAction == 'nullify') { 11530 this.regionSelectEl.options.length = 1; 11531 this.regionSelectEl.value = ''; 11532 this.regionSelectEl.selectedIndex = 0; 11533 this.lastCountryId = ''; 11534 } 11535 this.setMarkDisplay(this.regionSelectEl, false); 11536 } 11537 11538 this._checkRegionRequired(); 11539 // Make Zip and its label required/optional 11540 var zipUpdater = new ZipUpdater(this.countryEl.value, this.zipEl); 11541 zipUpdater.update(); 11542 }, 11543 11544 setMarkDisplay: function(elem, display){ 11545 elem = $(elem); 11546 var labelElement = elem.up(0).down('label > span.required') || 11547 elem.up(1).down('label > span.required') || 11548 elem.up(0).down('label.required > em') || 11549 elem.up(1).down('label.required > em'); 11550 if(labelElement) { 11551 inputElement = labelElement.up().next('input'); 11552 if (display) { 11553 labelElement.show(); 11554 if (inputElement) { 11555 inputElement.addClassName('required-entry'); 11556 } 11557 } else { 11558 labelElement.hide(); 11559 if (inputElement) { 11560 inputElement.removeClassName('required-entry'); 11561 } 11562 } 11563 } 11564 }, 11565 sortSelect : function () { 11566 var elem = this.regionSelectEl; 11567 var tmpArray = new Array(); 11568 var currentVal = $(elem).value; 11569 for (var i = 0; i < $(elem).options.length; i++) { 11570 if (i == 0) { 11571 continue; 11572 } 11573 tmpArray[i-1] = new Array(); 11574 tmpArray[i-1][0] = $(elem).options[i].text; 11575 tmpArray[i-1][1] = $(elem).options[i].value; 11576 } 11577 tmpArray.sort(); 11578 for (var i = 1; i <= tmpArray.length; i++) { 11579 var op = new Option(tmpArray[i-1][0], tmpArray[i-1][1]); 11580 $(elem).options[i] = op; 11581 } 11582 $(elem).value = currentVal; 11583 return; 11584 } 11585}; 11586 11587ZipUpdater = Class.create(); 11588ZipUpdater.prototype = { 11589 initialize: function(country, zipElement) 11590 { 11591 this.country = country; 11592 this.zipElement = $(zipElement); 11593 }, 11594 11595 update: function() 11596 { 11597 // Country ISO 2-letter codes must be pre-defined 11598 if (typeof optionalZipCountries == 'undefined') { 11599 return false; 11600 } 11601 11602 // Ajax-request and normal content load compatibility 11603 if (this.zipElement != undefined) { 11604 Validation.reset(this.zipElement); 11605 this._setPostcodeOptional(); 11606 } else { 11607 Event.observe(window, "load", this._setPostcodeOptional.bind(this)); 11608 } 11609 }, 11610 11611 _setPostcodeOptional: function() 11612 { 11613 this.zipElement = $(this.zipElement); 11614 if (this.zipElement == undefined) { 11615 return false; 11616 } 11617 11618 // find label 11619 var label = $$('label[for="' + this.zipElement.id + '"]')[0]; 11620 if (label != undefined) { 11621 var wildCard = label.down('em') || label.down('span.required'); 11622 } 11623 11624 // Make Zip and its label required/optional 11625 if (optionalZipCountries.indexOf(this.country) != -1) { 11626 while (this.zipElement.hasClassName('required-entry')) { 11627 this.zipElement.removeClassName('required-entry'); 11628 } 11629 if (wildCard != undefined) { 11630 wildCard.hide(); 11631 } 11632 } else { 11633 this.zipElement.addClassName('required-entry'); 11634 if (wildCard != undefined) { 11635 wildCard.show(); 11636 } 11637 } 11638 } 11639}; 11640 11641/** 11642 * Magento 11643 * 11644 * NOTICE OF LICENSE 11645 * 11646 * This source file is subject to the Academic Free License (AFL 3.0) 11647 * that is bundled with this package in the file LICENSE_AFL.txt. 11648 * It is also available through the world-wide-web at this URL: 11649 * http://opensource.org/licenses/afl-3.0.php 11650 * If you did not receive a copy of the license and are unable to 11651 * obtain it through the world-wide-web, please send an email 11652 * to [email protected] so we can send you a copy immediately. 11653 * 11654 * DISCLAIMER 11655 * 11656 * Do not edit or add to this file if you wish to upgrade Magento to newer 11657 * versions in the future. If you wish to customize Magento for your 11658 * needs please refer to http://www.magento.com for more information. 11659 * 11660 * @category Varien 11661 * @package js 11662 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 11663 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11664 */ 11665
11666/** 11667 * @classDescription simple Navigation with replacing old handlers 11668 * @param {String} id id of ul element with navigation lists 11669 * @param {Object} settings object with settings 11670 */ 11671var mainNav = function() { 11672 11673 var main = { 11674 obj_nav : $(arguments[0]) || $("nav"), 11675 11676 settings : { 11677 show_delay : 0, 11678 hide_delay : 0, 11679 _ie6 : /MSIE 6.+Win/.test(navigator.userAgent), 11680 _ie7 : /MSIE 7.+Win/.test(navigator.userAgent) 11681 }, 11682 11683 init : function(obj, level) { 11684 obj.lists = obj.childElements(); 11685 obj.lists.each(function(el,ind){ 11686 main.handlNavElement(el); 11687 if((main.settings._ie6 || main.settings._ie7) && level){ 11688 main.ieFixZIndex(el, ind, obj.lists.size()); 11689 } 11690 }); 11691 if(main.settings._ie6 && !level){ 11692 document.execCommand("BackgroundImageCache", false, true); 11693 } 11694 }, 11695 11696 handlNavElement : function(list) { 11697 if(list !== undefined){ 11698 list.onmouseover = function(){ 11699 main.fireNavEvent(this,true); 11700 }; 11701 list.onmouseout = function(){ 11702 main.fireNavEvent(this,false); 11703 }; 11704 if(list.down("ul")){ 11705 main.init(list.down("ul"), true); 11706 } 11707 } 11708 }, 11709 11710 ieFixZIndex : function(el, i, l) { 11711 if(el.tagName.toString().toLowerCase().indexOf("iframe") == -1){ 11712 el.style.zIndex = l - i; 11713 } else { 11714 el.onmouseover = "null"; 11715 el.onmouseout = "null"; 11716 } 11717 }, 11718 11719 fireNavEvent : function(elm,ev) { 11720 if(ev){ 11721 elm.addClassName("over"); 11722 elm.down("a").addClassName("over"); 11723 if (elm.childElements()[1]) { 11724 main.show(elm.childElements()[1]); 11725 } 11726 } else { 11727 elm.removeClassName("over"); 11728 elm.down("a").removeClassName("over"); 11729 if (elm.childElements()[1]) { 11730 main.hide(elm.childElements()[1]); 11731 } 11732 } 11733 }, 11734 11735 show : function (sub_elm) { 11736 if (sub_elm.hide_time_id) { 11737 clearTimeout(sub_elm.hide_time_id); 11738 } 11739 sub_elm.show_time_id = setTimeout(function() { 11740 if (!sub_elm.hasClassName("shown-sub")) { 11741 sub_elm.addClassName("shown-sub"); 11742 } 11743 }, main.settings.show_delay); 11744 }, 11745 11746 hide : function (sub_elm) { 11747 if (sub_elm.show_time_id) { 11748 clearTimeout(sub_elm.show_time_id); 11749 } 11750 sub_elm.hide_time_id = setTimeout(function(){ 11751 if (sub_elm.hasClassName("shown-sub")) { 11752 sub_elm.removeClassName("shown-sub"); 11753 } 11754 }, main.settings.hide_delay); 11755 } 11756 11757 }; 11758 if (arguments[1]) { 11759 main.settings = Object.extend(main.settings, arguments[1]); 11760 } 11761 if (main.obj_nav) { 11762 main.init(main.obj_nav, false); 11763 } 11764}; 11765 11766document.observe("dom:loaded", function() { 11767 //run navigation without delays and with default id="#nav" 11768 //mainNav(); 11769 11770 //run navigation with delays 11771 mainNav("nav", {"show_delay":"100","hide_delay":"100"}); 11772}); 11773 11774/** 11775 * Magento 11776 * 11777 * NOTICE OF LICENSE 11778 * 11779 * This source file is subject to the Academic Free License (AFL 3.0) 11780 * that is bundled with this package in the file LICENSE_AFL.txt. 11781 * It is also available through the world-wide-web at this URL: 11782 * http://opensource.org/licenses/afl-3.0.php 11783 * If you did not receive a copy of the license and are unable to 11784 * obtain it through the world-wide-web, please send an email 11785 * to [email protected] so we can send you a copy immediately. 11786 * 11787 * DISCLAIMER 11788 * 11789 * Do not edit or add to this file if you wish to upgrade Magento to newer 11790 * versions in the future. If you wish to customize Magento for your 11791 * needs please refer to http://www.magento.com for more information. 11792 * 11793 * @category Mage 11794 * @package js 11795 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 11796 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11797 */ 11798 11799var Translate = Class.create(); 11800Translate.prototype = { 11801 initialize: function(data){ 11802 this.data = $H(data); 11803 }, 11804 11805 translate : function(){ 11806 var args = arguments; 11807 var text = arguments[0]; 11808 11809 if(this.data.get(text)){ 11810 return this.data.get(text); 11811 } 11812 return text; 11813 }, 11814 add : function() { 11815 if (arguments.length > 1) { 11816 this.data.set(arguments[0], arguments[1]); 11817 } else if (typeof arguments[0] =='object') { 11818 $H(arguments[0]).each(function (pair){ 11819 this.data.set(pair.key, pair.value); 11820 }.bind(this)); 11821 } 11822 } 11823}; 11824 11825/** 11826 * Magento 11827 * 11828 * NOTICE OF LICENSE 11829 * 11830 * This source file is subject to the Academic Free License (AFL 3.0)
11831 * that is bundled with this package in the file LICENSE_AFL.txt. 11832 * It is also available through the world-wide-web at this URL: 11833 * http://opensource.org/licenses/afl-3.0.php 11834 * If you did not receive a copy of the license and are unable to 11835 * obtain it through the world-wide-web, please send an email 11836 * to [email protected] so we can send you a copy immediately. 11837 * 11838 * DISCLAIMER 11839 * 11840 * Do not edit or add to this file if you wish to upgrade Magento to newer 11841 * versions in the future. If you wish to customize Magento for your 11842 * needs please refer to http://www.magento.com for more information. 11843 * 11844 * @category Mage 11845 * @package js 11846 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 11847 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11848 */ 11849// old school cookie functions grabbed off the web 11850 11851if (!window.Mage) var Mage = {}; 11852 11853Mage.Cookies = {}; 11854Mage.Cookies.expires = null; 11855Mage.Cookies.path = '/'; 11856Mage.Cookies.domain = null; 11857Mage.Cookies.secure = false; 11858Mage.Cookies.set = function(name, value){ 11859 var argv = arguments; 11860 var argc = arguments.length; 11861 var expires = (argc > 2) ? argv[2] : Mage.Cookies.expires; 11862 var path = (argc > 3) ? argv[3] : Mage.Cookies.path; 11863 var domain = (argc > 4) ? argv[4] : Mage.Cookies.domain; 11864 var secure = (argc > 5) ? argv[5] : Mage.Cookies.secure; 11865 document.cookie = name + "=" + escape (value) + 11866 ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 11867 ((path == null) ? "" : ("; path=" + path)) + 11868 ((domain == null) ? "" : ("; domain=" + domain)) + 11869 ((secure == true) ? "; secure" : ""); 11870}; 11871 11872Mage.Cookies.get = function(name){ 11873 var arg = name + "="; 11874 var alen = arg.length; 11875 var clen = document.cookie.length; 11876 var i = 0; 11877 var j = 0; 11878 while(i < clen){ 11879 j = i + alen; 11880 if (document.cookie.substring(i, j) == arg) 11881 return Mage.Cookies.getCookieVal(j); 11882 i = document.cookie.indexOf(" ", i) + 1; 11883 if(i == 0) 11884 break; 11885 } 11886 return null; 11887}; 11888 11889Mage.Cookies.clear = function(name) { 11890 if(Mage.Cookies.get(name)){ 11891 document.cookie = name + "=" + 11892 "; expires=Thu, 01-Jan-70 00:00:01 GMT"; 11893 } 11894}; 11895 11896Mage.Cookies.getCookieVal = function(offset){ 11897 var endstr = document.cookie.indexOf(";", offset); 11898 if(endstr == -1){ 11899 endstr = document.cookie.length; 11900 } 11901 return unescape(document.cookie.substring(offset, endstr)); 11902}; 11903 11904var Dailydeal = Class.create(); 11905 11906Dailydeal.prototype = { 11907 initialize: function (changeProductUrl) { 11908 this.changeProductUrl = changeProductUrl; 11909 }, 11910 changeProduct: function (product_id) { 11911 var url = this.changeProductUrl; 11912 if (url.indexOf('?') == -1) 11913 url += '?product_id=' + product_id; 11914 else 11915 url += '&product_id=' + product_id; 11916 new Ajax.Updater('product_name_contain', url, { 11917 method: 'get', onComplete: function () { 11918 updateProductName(); 11919 }, onFailure: "" 11920 }); 11921 }, 11922 checkBidderName: function () { 11923 var bidder_name = $('bidder_name').value; 11924 $('bidder_name_form_button').hide(); 11925 11926 var url = this.changeProductUrl; 11927 if (url.indexOf('?') == -1) 11928 url += '?bidder_name=' + bidder_name; 11929 else 11930 url += '&bidder_name=' + bidder_name; 11931 11932 new Ajax.Updater('bidder-notice', url, { 11933 method: 'get', onComplete: function () { 11934 validBidderName(); 11935 }, onFailure: "" 11936 }); 11937 11938 $('biddername-please-wait').style.display = "block"; 11939 $('bidder-notice').style.display = "none"; 11940 $('bidder_name').removeClassName('validation-passed'); 11941 } 11942} 11943 11944var DailydealTimeCounter = Class.create(); 11945DailydealTimeCounter.prototype = { 11946 //params now_time, end_time : seconds 11947 initialize: function (now_time, end_time, dailydeal_id) { 11948 this.now_time = parseInt(now_time) * 1000; 11949 this.end_time = parseInt(end_time) * 1000; 11950 this.dailydeal_id = dailydeal_id; 11951 this.end = new Date(this.end_time); 11952 var endDate = this.end; 11953 this.second = endDate.getSeconds(); 11954 this.minute = endDate.getMinutes(); 11955 this.hour = endDate.getHours(); 11956 this.day = endDate.getDate(); 11957 this.month = endDate.getMonth(); 11958 var yr; 11959 if (endDate.getYear() < 1900) 11960 yr = endDate.getYear() + 1900; 11961 else 11962 yr = endDate.getYear();
11963 this.year = yr; 11964 }, 11965 11966 setTimeleft: function (timeleft_id) { 11967 var now = new Date(this.now_time); 11968 var yr; 11969 11970 if (now.getYear() < 1900) 11971 yr = now.getYear() + 1900; 11972 else 11973 yr = now.getYear(); 11974 11975 var endtext = '0'; 11976 var timerID; 11977 11978 var sec = this.second - now.getSeconds(); 11979 11980 var min = this.minute - now.getMinutes(); 11981 var hr = this.hour - now.getHours(); 11982 var dy = this.day - now.getDate(); 11983 var mnth = this.month - now.getMonth(); 11984 yr = this.year - yr; 11985 11986 var daysinmnth = 32 - new Date(now.getYear(), now.getMonth(), 32).getDate(); 11987 if (sec < 0) { 11988 sec = (sec + 60) % 60; 11989 min--; 11990 } 11991 if (min < 0) { 11992 min = (min + 60) % 60; 11993 hr--; 11994 } 11995 if (hr < 0) { 11996 hr = (hr + 24) % 24; 11997 dy--; 11998 } 11999 if (dy < 0) { 12000 dy = (dy + daysinmnth) % daysinmnth; 12001 mnth--; 12002 } 12003 if (mnth < 0) { 12004 mnth = (mnth + 12) % 12; 12005 yr--; 12006 } 12007 var sectext = "sec"; 12008 var mintext = "min"; 12009 var hrtext = "hour"; 12010 var dytext = " days "; 12011 var mnthtext = " months "; 12012 var yrtext = " years "; 12013 if (yr == 1) 12014 yrtext = " year "; 12015 if (mnth == 1) 12016 mnthtext = " month "; 12017 if (dy == 1) 12018 dytext = " day "; 12019 if (hr == 1) 12020 hrtext = "hour"; 12021 if (min == 1) 12022 mintext = "min"; 12023 if (sec == 1) 12024 sectext = "sec"; 12025 12026 if (dy < 10) 12027 dy = '0' + dy; 12028 if (hr < 10) 12029 hr = '0' + hr; 12030 if (min < 10) 12031 min = '0' + min; 12032 if (sec < 10) 12033 sec = '0' + sec; 12034 12035 if (yr <= 0) 12036 yrtext = '' 12037 else 12038 yrtext = '<li class="time-year"><div><span class="timeleft-text">' + yr + '</span><span class="text-time">' + yrtext + '</span></div></li>'; 12039 12040 if ((mnth <= 0)) 12041 mnthtext = '' 12042 else 12043 mnthtext = '<li class="time-month"><div><span class="timeleft-text">' + mnth + '</span><span class="text-time">' + mnthtext + '</span></div></li>'; 12044 12045 if (dy <= 0 && mnth > 0) 12046 dytext = '' 12047 else 12048 dytext = '<li class="time-day"><div><span class="timeleft-text">' + dy + '</span><span class="text-time">' + dytext + '</span></div></li>'; 12049 12050 if (hr <= 0 && dy > 0) 12051 hrtext = '' 12052 else 12053 hrtext = '<li class="time-hr"><div><span class="timeleft-text">' + hr + '</span><span class="text-time">' + hrtext + '</span></div></li>'; 12054 12055 if (min < 0) 12056 mintext = '' 12057 else 12058 mintext = '<li class="time-min"><div><span class="timeleft-text">' + min + '</span><span class="text-time">' + mintext + '</span></div></li>'; 12059 12060 if (sec < 0) 12061 sectext = '' 12062 else 12063 sectext = '<li class="time-sec"><div><span class="timeleft-text">' + sec + '</span><span class="text-time">' + sectext + '</span></div></li>'; 12064 12065 if (now >= this.end) { 12066 jQuery("."+timeleft_id).html(endtext); 12067 clearTimeout(timerID); 12068 } 12069 else { 12070 jQuery("."+timeleft_id).html(yrtext + mnthtext + dytext + hrtext + mintext + sectext); 12071 } 12072 12073 if (this.now_time == this.end_time) { 12074 location.reload(true); 12075 return; 12076 } 12077 12078 this.now_time = this.now_time + 1000; 12079 12080 timerID = setTimeout("setDailydealTimeleft(" + (this.now_time / 1000) + "," + (this.end_time / 1000) + ",'" + timeleft_id + "','" + this.dailydeal_id + "');", 1000); 12081 } 12082} 12083 12084var timerCounters = {}; 12085function setDailydealTimeleft(now_time, end_time, timeleft_id, dailydeal_id) { 12086 if (timerCounters[dailydeal_id] == undefined) { 12087 timerCounters[dailydeal_id] = new DailydealTimeCounter(now_time, end_time, dailydeal_id); 12088 } else { 12089 timerCounters[dailydeal_id].initialize(now_time, end_time, dailydeal_id); 12090 } 12091 timerCounters[dailydeal_id].setTimeleft(timeleft_id); 12092} 12093 12094function updateProductName() { 12095 $('product_name').value = $('newproduct_name').value; 12096 $('dailydeal_tabs_form_section').addClassName('active'); 12097 $('dailydeal_tabs_form_listproduct').removeClassName('active'); 12098 $('dailydeal_tabs_form_section_content').style.display = ""; 12099 $('dailydeal_tabs_form_listproduct_content').style.display = "none"; 12100} 12101 12102 12103function showSelectProductTab() { 12104 $('dailydeal_tabs_form_section').removeClassName('active'); 12105 $('dailydeal_tabs_form_listproduct').addClassName('active'); 12106 Element.show('dailydeal_tabs_form_listproduct_content'); 12107 Element.hide('dailydeal_tabs_form_section_content'); 12108} 12109/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo 12110 * ----------------------------------------------------------- 12111 * 12112 * The DHTML Calendar, version 1.0 "It is happening again" 12113 * 12114 * Details and latest version at:
12115 * www.dynarch.com/projects/calendar 12116 * 12117 * This script is developed by Dynarch.com. Visit us at www.dynarch.com. 12118 * 12119 * This script is distributed under the GNU Lesser General Public License. 12120 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html 12121 */ 12122 12123// $Id: calendar.js,v 1.51 2005/03/07 16:44:31 mishoo Exp $ 12124 12125/** The Calendar object constructor. */ 12126Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) { 12127 // member variables 12128 this.activeDiv = null; 12129 this.currentDateEl = null; 12130 this.getDateStatus = null; 12131 this.getDateToolTip = null; 12132 this.getDateText = null; 12133 this.timeout = null; 12134 this.onSelected = onSelected || null; 12135 this.onClose = onClose || null; 12136 this.dragging = false; 12137 this.hidden = false; 12138 this.minYear = 1970; 12139 this.maxYear = 2050; 12140 this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; 12141 this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; 12142 this.isPopup = true; 12143 this.weekNumbers = true; 12144 this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc. 12145 this.showsOtherMonths = false; 12146 this.dateStr = dateStr; 12147 this.ar_days = null; 12148 this.showsTime = false; 12149 this.time24 = true; 12150 this.yearStep = 2; 12151 this.hiliteToday = true; 12152 this.multiple = null; 12153 // HTML elements 12154 this.table = null; 12155 this.element = null; 12156 this.tbody = null; 12157 this.firstdayname = null; 12158 // Combo boxes 12159 this.monthsCombo = null; 12160 this.yearsCombo = null; 12161 this.hilitedMonth = null; 12162 this.activeMonth = null; 12163 this.hilitedYear = null; 12164 this.activeYear = null; 12165 // Information 12166 this.dateClicked = false; 12167 12168 // one-time initializations 12169 if (typeof Calendar._SDN == "undefined") { 12170 // table of short day names 12171 if (typeof Calendar._SDN_len == "undefined") 12172 Calendar._SDN_len = 3; 12173 var ar = new Array(); 12174 for (var i = 8; i > 0;) { 12175 ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len); 12176 } 12177 Calendar._SDN = ar; 12178 // table of short month names 12179 if (typeof Calendar._SMN_len == "undefined") 12180 Calendar._SMN_len = 3; 12181 ar = new Array(); 12182 for (var i = 12; i > 0;) { 12183 ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len); 12184 } 12185 Calendar._SMN = ar; 12186 } 12187}; 12188 12189// ** constants 12190 12191/// "static", needed for event handlers. 12192Calendar._C = null; 12193 12194/// detect a special case of "web browser" 12195Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && 12196 !/opera/i.test(navigator.userAgent) ); 12197 12198Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ); 12199 12200/// detect Opera browser 12201Calendar.is_opera = /opera/i.test(navigator.userAgent); 12202 12203/// detect KHTML-based browsers 12204Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent); 12205 12206/// detect Gecko browsers 12207Calendar.is_gecko = navigator.userAgent.match(/gecko/i); 12208 12209// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate 12210// library, at some point. 12211 12212// Returns CSS property for element 12213Calendar.getStyle = function(element, style) { 12214 if (element.currentStyle) { 12215 var y = element.currentStyle[style]; 12216 } else if (window.getComputedStyle) { 12217 var y = document.defaultView.getComputedStyle(element,null).getPropertyValue(style); 12218 } 12219 12220 return y; 12221}; 12222 12223/* 12224 * Different ways to find element's absolute position 12225 */ 12226Calendar.getAbsolutePos = function(element) { 12227 12228 var res = new Object(); 12229 res.x = 0; res.y = 0; 12230 12231 // variant 1 (working best, copy-paste from prototype library) 12232 do { 12233 res.x += element.offsetLeft || 0; 12234 res.y += element.offsetTop || 0; 12235 element = element.offsetParent; 12236 if (element) { 12237 if (element.tagName.toUpperCase() == 'BODY') break; 12238 var p = Calendar.getStyle(element, 'position'); 12239 if ((p !== 'static') && (p !== 'relative')) break; 12240 } 12241 } while (element); 12242 12243 return res; 12244 12245 // variant 2 (good solution, but lost in IE8) 12246 if (element !== null) { 12247 res.x = element.offsetLeft; 12248 res.y = element.offsetTop; 12249 12250 var offsetParent = element.offsetParent; 12251 var parentNode = element.parentNode; 12252 12253 while (offsetParent !== null) { 12254 res.x += offsetParent.offsetLeft; 12255 res.y += offsetParent.offsetTop; 12256 12257 if (offsetParent != document.body && offsetParent != document.documentElement) { 12258 res.x -= offsetParent.scrollLeft; 12259 res.y -= offsetParent.scrollTop; 12260 } 12261 //next lines are necessary to support FireFox problem with offsetParent 12262 if (Calendar.is_gecko) { 12263 while (offsetParent != parentNode && parentNode !== null) { 12264 res.x -= parentNode.scrollLeft; 12265 res.y -= parentNode.scrollTop; 12266 parentNode = parentNode.parentNode; 12267 } 12268 } 12269 parentNode = offsetParent.parentNode; 12270 offsetParent = offsetParent.offsetParent; 12271 } 12272 } 12273 return res; 12274 12275 // variant 2 (not working) 12276 12277// var SL = 0, ST = 0; 12278// var is_div = /^div$/i.test(el.tagName); 12279// if (is_div && el.scrollLeft) 12280// SL = el.scrollLeft; 12281// if (is_div && el.scrollTop) 12282// ST = el.scrollTop; 12283// var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; 12284// if (el.offsetParent) { 12285// var tmp = this.getAbsolutePos(el.offsetParent); 12286// r.x += tmp.x; 12287// r.y += tmp.y; 12288// } 12289// return r; 12290}; 12291 12292Calendar.isRelated = function (el, evt) { 12293 var related = evt.relatedTarget; 12294 if (!related) { 12295 var type = evt.type; 12296 if (type == "mouseover") { 12297 related = evt.fromElement; 12298 } else if (type == "mouseout") { 12299 related = evt.toElement; 12300 } 12301 } 12302 while (related) { 12303 if (related == el) { 12304 return true; 12305 } 12306 related = related.parentNode; 12307 } 12308 return false;
12309}; 12310 12311Calendar.removeClass = function(el, className) { 12312 if (!(el && el.className)) { 12313 return; 12314 } 12315 var cls = el.className.split(" "); 12316 var ar = new Array(); 12317 for (var i = cls.length; i > 0;) { 12318 if (cls[--i] != className) { 12319 ar[ar.length] = cls[i]; 12320 } 12321 } 12322 el.className = ar.join(" "); 12323}; 12324 12325Calendar.addClass = function(el, className) { 12326 Calendar.removeClass(el, className); 12327 el.className += " " + className; 12328}; 12329 12330// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately. 12331Calendar.getElement = function(ev) { 12332 var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; 12333 while (f.nodeType != 1 || /^div$/i.test(f.tagName)) 12334 f = f.parentNode; 12335 return f; 12336}; 12337 12338Calendar.getTargetElement = function(ev) { 12339 var f = Calendar.is_ie ? window.event.srcElement : ev.target; 12340 while (f.nodeType != 1) 12341 f = f.parentNode; 12342 return f; 12343}; 12344 12345Calendar.stopEvent = function(ev) { 12346 ev || (ev = window.event); 12347 if (Calendar.is_ie) { 12348 ev.cancelBubble = true; 12349 ev.returnValue = false; 12350 } else { 12351 ev.preventDefault(); 12352 ev.stopPropagation(); 12353 } 12354 return false; 12355}; 12356 12357Calendar.addEvent = function(el, evname, func) { 12358 if (el.attachEvent) { // IE 12359 el.attachEvent("on" + evname, func); 12360 } else if (el.addEventListener) { // Gecko / W3C 12361 el.addEventListener(evname, func, true); 12362 } else { 12363 el["on" + evname] = func; 12364 } 12365}; 12366 12367Calendar.removeEvent = function(el, evname, func) { 12368 if (el.detachEvent) { // IE 12369 el.detachEvent("on" + evname, func); 12370 } else if (el.removeEventListener) { // Gecko / W3C 12371 el.removeEventListener(evname, func, true); 12372 } else { 12373 el["on" + evname] = null; 12374 } 12375}; 12376 12377Calendar.createElement = function(type, parent) { 12378 var el = null; 12379 if (document.createElementNS) { 12380 // use the XHTML namespace; IE won't normally get here unless 12381 // _they_ "fix" the DOM2 implementation. 12382 el = document.createElementNS("http://www.w3.org/1999/xhtml", type); 12383 } else { 12384 el = document.createElement(type); 12385 } 12386 if (typeof parent != "undefined") { 12387 parent.appendChild(el); 12388 } 12389 return el; 12390}; 12391 12392// END: UTILITY FUNCTIONS 12393 12394// BEGIN: CALENDAR STATIC FUNCTIONS 12395 12396/** Internal -- adds a set of events to make some element behave like a button. */ 12397Calendar._add_evs = function(el) { 12398 with (Calendar) { 12399 addEvent(el, "mouseover", dayMouseOver); 12400 addEvent(el, "mousedown", dayMouseDown); 12401 addEvent(el, "mouseout", dayMouseOut); 12402 if (is_ie) { 12403 addEvent(el, "dblclick", dayMouseDblClick); 12404 el.setAttribute("unselectable", true); 12405 } 12406 } 12407}; 12408 12409Calendar.findMonth = function(el) { 12410 if (typeof el.month != "undefined") { 12411 return el; 12412 } else if (typeof el.parentNode.month != "undefined") { 12413 return el.parentNode; 12414 } 12415 return null; 12416}; 12417 12418Calendar.findYear = function(el) { 12419 if (typeof el.year != "undefined") { 12420 return el; 12421 } else if (typeof el.parentNode.year != "undefined") { 12422 return el.parentNode; 12423 } 12424 return null; 12425}; 12426 12427Calendar.showMonthsCombo = function () { 12428 var cal = Calendar._C; 12429 if (!cal) { 12430 return false; 12431 } 12432 var cal = cal; 12433 var cd = cal.activeDiv; 12434 var mc = cal.monthsCombo; 12435 if (cal.hilitedMonth) { 12436 Calendar.removeClass(cal.hilitedMonth, "hilite"); 12437 } 12438 if (cal.activeMonth) { 12439 Calendar.removeClass(cal.activeMonth, "active"); 12440 } 12441 var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; 12442 Calendar.addClass(mon, "active"); 12443 cal.activeMonth = mon; 12444 var s = mc.style; 12445 s.display = "block"; 12446 if (cd.navtype < 0) 12447 s.left = cd.offsetLeft + "px"; 12448 else { 12449 var mcw = mc.offsetWidth; 12450 if (typeof mcw == "undefined") 12451 // Konqueror brain-dead techniques 12452 mcw = 50; 12453 s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; 12454 } 12455 s.top = (cd.offsetTop + cd.offsetHeight) + "px"; 12456}; 12457
12458Calendar.showYearsCombo = function (fwd) { 12459 var cal = Calendar._C; 12460 if (!cal) { 12461 return false; 12462 } 12463 var cal = cal; 12464 var cd = cal.activeDiv; 12465 var yc = cal.yearsCombo; 12466 if (cal.hilitedYear) { 12467 Calendar.removeClass(cal.hilitedYear, "hilite"); 12468 } 12469 if (cal.activeYear) { 12470 Calendar.removeClass(cal.activeYear, "active"); 12471 } 12472 cal.activeYear = null; 12473 var Y = cal.date.getFullYear() + (fwd ? 1 : -1); 12474 var yr = yc.firstChild; 12475 var show = false; 12476 for (var i = 12; i > 0; --i) { 12477 if (Y >= cal.minYear && Y <= cal.maxYear) { 12478 yr.innerHTML = Y; 12479 yr.year = Y; 12480 yr.style.display = "block"; 12481 show = true; 12482 } else { 12483 yr.style.display = "none"; 12484 } 12485 yr = yr.nextSibling; 12486 Y += fwd ? cal.yearStep : -cal.yearStep; 12487 } 12488 if (show) { 12489 var s = yc.style; 12490 s.display = "block"; 12491 if (cd.navtype < 0) 12492 s.left = cd.offsetLeft + "px"; 12493 else { 12494 var ycw = yc.offsetWidth; 12495 if (typeof ycw == "undefined") 12496 // Konqueror brain-dead techniques 12497 ycw = 50; 12498 s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px"; 12499 } 12500 s.top = (cd.offsetTop + cd.offsetHeight) + "px"; 12501 } 12502}; 12503 12504// event handlers 12505 12506Calendar.tableMouseUp = function(ev) { 12507 var cal = Calendar._C; 12508 if (!cal) { 12509 return false; 12510 } 12511 if (cal.timeout) { 12512 clearTimeout(cal.timeout); 12513 } 12514 var el = cal.activeDiv; 12515 if (!el) { 12516 return false; 12517 } 12518 var target = Calendar.getTargetElement(ev); 12519 ev || (ev = window.event); 12520 Calendar.removeClass(el, "active"); 12521 if (target == el || target.parentNode == el) { 12522 Calendar.cellClick(el, ev); 12523 } 12524 var mon = Calendar.findMonth(target); 12525 var date = null; 12526 if (mon) { 12527 date = new CalendarDateObject(cal.date); 12528 if (mon.month != date.getMonth()) { 12529 date.setMonth(mon.month); 12530 cal.setDate(date); 12531 cal.dateClicked = false; 12532 cal.callHandler(); 12533 } 12534 } else { 12535 var year = Calendar.findYear(target); 12536 if (year) { 12537 date = new CalendarDateObject(cal.date); 12538 if (year.year != date.getFullYear()) { 12539 date.setFullYear(year.year); 12540 cal.setDate(date); 12541 cal.dateClicked = false; 12542 cal.callHandler(); 12543 } 12544 } 12545 } 12546 with (Calendar) { 12547 removeEvent(document, "mouseup", tableMouseUp); 12548 removeEvent(document, "mouseover", tableMouseOver); 12549 removeEvent(document, "mousemove", tableMouseOver); 12550 cal._hideCombos(); 12551 _C = null; 12552 return stopEvent(ev); 12553 } 12554}; 12555 12556Calendar.tableMouseOver = function (ev) { 12557 var cal = Calendar._C; 12558 if (!cal) { 12559 return; 12560 } 12561 var el = cal.activeDiv; 12562 var target = Calendar.getTargetElement(ev); 12563 if (target == el || target.parentNode == el) { 12564 Calendar.addClass(el, "hilite active"); 12565 Calendar.addClass(el.parentNode, "rowhilite"); 12566 } else { 12567 if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2))) 12568 Calendar.removeClass(el, "active"); 12569 Calendar.removeClass(el, "hilite"); 12570 Calendar.removeClass(el.parentNode, "rowhilite"); 12571 } 12572 ev || (ev = window.event); 12573 if (el.navtype == 50 && target != el) { 12574 var pos = Calendar.getAbsolutePos(el); 12575 var w = el.offsetWidth; 12576 var x = ev.clientX; 12577 var dx; 12578 var decrease = true; 12579 if (x > pos.x + w) { 12580 dx = x - pos.x - w; 12581 decrease = false; 12582 } else 12583 dx = pos.x - x; 12584 12585 if (dx < 0) dx = 0; 12586 var range = el._range; 12587 var current = el._current; 12588 var count = Math.floor(dx / 10) % range.length; 12589 for (var i = range.length; --i >= 0;) 12590 if (range[i] == current) 12591 break; 12592 while (count-- > 0) 12593 if (decrease) { 12594 if (--i < 0) 12595 i = range.length - 1; 12596 } else if ( ++i >= range.length ) 12597 i = 0; 12598 var newval = range[i]; 12599 el.innerHTML = newval; 12600 12601 cal.onUpdateTime(); 12602 } 12603 var mon = Calendar.findMonth(target); 12604 if (mon) { 12605 if (mon.month != cal.date.getMonth()) { 12606 if (cal.hilitedMonth) { 12607 Calendar.removeClass(cal.hilitedMonth, "hilite"); 12608 } 12609 Calendar.addClass(mon, "hilite"); 12610 cal.hilitedMonth = mon; 12611 } else if (cal.hilitedMonth) { 12612 Calendar.removeClass(cal.hilitedMonth, "hilite"); 12613 } 12614 } else { 12615 if (cal.hilitedMonth) { 12616 Calendar.removeClass(cal.hilitedMonth, "hilite"); 12617 } 12618 var year = Calendar.findYear(target); 12619 if (year) { 12620 if (year.year != cal.date.getFullYear()) { 12621 if (cal.hilitedYear) { 12622 Calendar.removeClass(cal.hilitedYear, "hilite"); 12623 } 12624 Calendar.addClass(year, "hilite"); 12625 cal.hilitedYear = year; 12626 } else if (cal.hilitedYear) { 12627 Calendar.removeClass(cal.hilitedYear, "hilite"); 12628 } 12629 } else if (cal.hilitedYear) { 12630 Calendar.removeClass(cal.hilitedYear, "hilite"); 12631 } 12632 } 12633 return Calendar.stopEvent(ev); 12634}; 12635 12636Calendar.tableMouseDown = function (ev) { 12637 if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { 12638 return Calendar.stopEvent(ev); 12639 } 12640}; 12641 12642Calendar.calDragIt = function (ev) { 12643 var cal = Calendar._C; 12644 if (!(cal && cal.dragging)) { 12645 return false;
12646 } 12647 var posX; 12648 var posY; 12649 if (Calendar.is_ie) { 12650 posY = window.event.clientY + document.body.scrollTop; 12651 posX = window.event.clientX + document.body.scrollLeft; 12652 } else { 12653 posX = ev.pageX; 12654 posY = ev.pageY; 12655 } 12656 cal.hideShowCovered(); 12657 var st = cal.element.style; 12658 st.left = (posX - cal.xOffs) + "px"; 12659 st.top = (posY - cal.yOffs) + "px"; 12660 return Calendar.stopEvent(ev); 12661}; 12662 12663Calendar.calDragEnd = function (ev) { 12664 var cal = Calendar._C; 12665 if (!cal) { 12666 return false; 12667 } 12668 cal.dragging = false; 12669 with (Calendar) { 12670 removeEvent(document, "mousemove", calDragIt); 12671 removeEvent(document, "mouseup", calDragEnd); 12672 tableMouseUp(ev); 12673 } 12674 cal.hideShowCovered(); 12675}; 12676 12677Calendar.dayMouseDown = function(ev) { 12678 var el = Calendar.getElement(ev); 12679 if (el.disabled) { 12680 return false; 12681 } 12682 var cal = el.calendar; 12683 cal.activeDiv = el; 12684 Calendar._C = cal; 12685 if (el.navtype != 300) with (Calendar) { 12686 if (el.navtype == 50) { 12687 el._current = el.innerHTML; 12688 addEvent(document, "mousemove", tableMouseOver); 12689 } else 12690 addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); 12691 addClass(el, "hilite active"); 12692 addEvent(document, "mouseup", tableMouseUp); 12693 } else if (cal.isPopup) { 12694 cal._dragStart(ev); 12695 } 12696 if (el.navtype == -1 || el.navtype == 1) { 12697 if (cal.timeout) clearTimeout(cal.timeout); 12698 cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); 12699 } else if (el.navtype == -2 || el.navtype == 2) { 12700 if (cal.timeout) clearTimeout(cal.timeout); 12701 cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); 12702 } else { 12703 cal.timeout = null; 12704 } 12705 return Calendar.stopEvent(ev); 12706}; 12707 12708Calendar.dayMouseDblClick = function(ev) { 12709 Calendar.cellClick(Calendar.getElement(ev), ev || window.event); 12710 if (Calendar.is_ie) { 12711 document.selection.empty(); 12712 } 12713}; 12714 12715Calendar.dayMouseOver = function(ev) { 12716 var el = Calendar.getElement(ev); 12717 if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { 12718 return false; 12719 } 12720 if (el.ttip) { 12721 if (el.ttip.substr(0, 1) == "_") { 12722 el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); 12723 } 12724 el.calendar.tooltips.innerHTML = el.ttip; 12725 } 12726 if (el.navtype != 300) { 12727 Calendar.addClass(el, "hilite"); 12728 if (el.caldate) { 12729 Calendar.addClass(el.parentNode, "rowhilite"); 12730 } 12731 } 12732 return Calendar.stopEvent(ev); 12733}; 12734 12735Calendar.dayMouseOut = function(ev) { 12736 with (Calendar) { 12737 var el = getElement(ev); 12738 if (isRelated(el, ev) || _C || el.disabled) 12739 return false; 12740 removeClass(el, "hilite"); 12741 if (el.caldate) 12742 removeClass(el.parentNode, "rowhilite"); 12743 if (el.calendar) 12744 el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; 12745 return stopEvent(ev); 12746 } 12747}; 12748 12749/** 12750 * A generic "click" handler :) handles all types of buttons defined in this 12751 * calendar. 12752 */ 12753Calendar.cellClick = function(el, ev) { 12754 var cal = el.calendar; 12755 var closing = false; 12756 var newdate = false; 12757 var date = null; 12758 if (typeof el.navtype == "undefined") { 12759 if (cal.currentDateEl) { 12760 Calendar.removeClass(cal.currentDateEl, "selected"); 12761 Calendar.addClass(el, "selected"); 12762 closing = (cal.currentDateEl == el); 12763 if (!closing) { 12764 cal.currentDateEl = el; 12765 } 12766 } 12767 cal.date.setDateOnly(el.caldate); 12768 date = cal.date; 12769 var other_month = !(cal.dateClicked = !el.otherMonth); 12770 if (!other_month && !cal.currentDateEl) 12771 cal._toggleMultipleDate(new CalendarDateObject(date)); 12772 else 12773 newdate = !el.disabled; 12774 // a date was clicked 12775 if (other_month) 12776 cal._init(cal.firstDayOfWeek, date); 12777 } else { 12778 if (el.navtype == 200) { 12779 Calendar.removeClass(el, "hilite"); 12780 cal.callCloseHandler(); 12781 return; 12782 } 12783 date = new CalendarDateObject(cal.date); 12784 if (el.navtype == 0) 12785 date.setDateOnly(new CalendarDateObject()); // TODAY 12786 // unless "today" was clicked, we assume no date was clicked so 12787 // the selected handler will know not to close the calenar when 12788 // in single-click mode. 12789 // cal.dateClicked = (el.navtype == 0); 12790 cal.dateClicked = false;
12791 var year = date.getFullYear(); 12792 var mon = date.getMonth(); 12793 function setMonth(m) { 12794 var day = date.getDate(); 12795 var max = date.getMonthDays(m); 12796 if (day > max) { 12797 date.setDate(max); 12798 } 12799 date.setMonth(m); 12800 }; 12801 switch (el.navtype) { 12802 case 400: 12803 Calendar.removeClass(el, "hilite"); 12804 var text = Calendar._TT["ABOUT"]; 12805 if (typeof text != "undefined") { 12806 text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : ""; 12807 } else { 12808 // FIXME: this should be removed as soon as lang files get updated! 12809 text = "Help and about box text is not translated into this language.\n" + 12810 "If you know this language and you feel generous please update\n" + 12811 "the corresponding file in \"lang\" subdir to match calendar-en.js\n" + 12812 "and send it back to <[email protected]> to get it into the distribution ;-)\n\n" + 12813 "Thank you!\n" +
12814 "http://dynarch.com/mishoo/calendar.epl\n"; 12815 } 12816 alert(text); 12817 return; 12818 case -2: 12819 if (year > cal.minYear) { 12820 date.setFullYear(year - 1); 12821 } 12822 break; 12823 case -1: 12824 if (mon > 0) { 12825 setMonth(mon - 1); 12826 } else if (year-- > cal.minYear) { 12827 date.setFullYear(year); 12828 setMonth(11); 12829 } 12830 break; 12831 case 1: 12832 if (mon < 11) { 12833 setMonth(mon + 1); 12834 } else if (year < cal.maxYear) { 12835 date.setFullYear(year + 1); 12836 setMonth(0); 12837 } 12838 break; 12839 case 2: 12840 if (year < cal.maxYear) { 12841 date.setFullYear(year + 1); 12842 } 12843 break; 12844 case 100: 12845 cal.setFirstDayOfWeek(el.fdow); 12846 return; 12847 case 50: 12848 var range = el._range; 12849 var current = el.innerHTML; 12850 for (var i = range.length; --i >= 0;) 12851 if (range[i] == current) 12852 break; 12853 if (ev && ev.shiftKey) { 12854 if (--i < 0) 12855 i = range.length - 1; 12856 } else if ( ++i >= range.length ) 12857 i = 0; 12858 var newval = range[i]; 12859 el.innerHTML = newval; 12860 cal.onUpdateTime(); 12861 return; 12862 case 0: 12863 // TODAY will bring us here 12864 if ((typeof cal.getDateStatus == "function") && 12865 cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) { 12866 return false; 12867 } 12868 break; 12869 } 12870 if (!date.equalsTo(cal.date)) { 12871 cal.setDate(date); 12872 newdate = true; 12873 } else if (el.navtype == 0) 12874 newdate = closing = true; 12875 } 12876 if (newdate) { 12877 ev && cal.callHandler(); 12878 } 12879 if (closing) { 12880 Calendar.removeClass(el, "hilite"); 12881 ev && cal.callCloseHandler(); 12882 } 12883}; 12884 12885// END: CALENDAR STATIC FUNCTIONS 12886 12887// BEGIN: CALENDAR OBJECT FUNCTIONS 12888 12889/** 12890 * This function creates the calendar inside the given parent. If _par is 12891 * null than it creates a popup calendar inside the BODY element. If _par is 12892 * an element, be it BODY, then it creates a non-popup calendar (still 12893 * hidden). Some properties need to be set before calling this function. 12894 */ 12895Calendar.prototype.create = function (_par) { 12896 var parent = null; 12897 if (! _par) { 12898 // default parent is the document body, in which case we create 12899 // a popup calendar. 12900 parent = document.getElementsByTagName("body")[0]; 12901 this.isPopup = true; 12902 } else { 12903 parent = _par; 12904 this.isPopup = false; 12905 } 12906 this.date = this.dateStr ? new CalendarDateObject(this.dateStr) : new CalendarDateObject(); 12907 12908 var table = Calendar.createElement("table"); 12909 this.table = table; 12910 table.cellSpacing = 0; 12911 table.cellPadding = 0; 12912 table.calendar = this; 12913 Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); 12914 12915 var div = Calendar.createElement("div"); 12916 this.element = div; 12917 div.className = "calendar"; 12918 if (this.isPopup) { 12919 div.style.position = "absolute"; 12920 div.style.display = "none"; 12921 } 12922 div.appendChild(table); 12923 12924 var thead = Calendar.createElement("thead", table); 12925 var cell = null; 12926 var row = null; 12927 12928 var cal = this; 12929 var hh = function (text, cs, navtype) { 12930 cell = Calendar.createElement("td", row); 12931 cell.colSpan = cs; 12932 cell.className = "button"; 12933 if (navtype != 0 && Math.abs(navtype) <= 2) 12934 cell.className += " nav"; 12935 Calendar._add_evs(cell); 12936 cell.calendar = cal; 12937 cell.navtype = navtype; 12938 cell.innerHTML = "<div unselectable='on'>
12938" + text + "</div>"; 12939 return cell; 12940 }; 12941 12942 row = Calendar.createElement("tr", thead); 12943 var title_length = 6; 12944 (this.isPopup) && --title_length; 12945 (this.weekNumbers) && ++title_length; 12946 12947 hh("?", 1, 400).ttip = Calendar._TT["INFO"]; 12948 this.title = hh("", title_length, 300); 12949 this.title.className = "title"; 12950 if (this.isPopup) { 12951 this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; 12952 this.title.style.cursor = "move"; 12953 hh("×", 1, 200).ttip = Calendar._TT["CLOSE"]; 12954 } 12955 12956 row = Calendar.createElement("tr", thead); 12957 row.className = "headrow"; 12958 12959 this._nav_py = hh("«", 1, -2); 12960 this._nav_py.ttip = Calendar._TT["PREV_YEAR"]; 12961 12962 this._nav_pm = hh("‹", 1, -1); 12963 this._nav_pm.ttip = Calendar._TT["PREV_MONTH"]; 12964 12965 this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0); 12966 this._nav_now.ttip = Calendar._TT["GO_TODAY"]; 12967 12968 this._nav_nm = hh("›", 1, 1); 12969 this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"]; 12970 12971 this._nav_ny = hh("»", 1, 2); 12972 this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"]; 12973 12974 // day names
12975 row = Calendar.createElement("tr", thead); 12976 row.className = "daynames"; 12977 if (this.weekNumbers) { 12978 cell = Calendar.createElement("td", row); 12979 cell.className = "name wn"; 12980 cell.innerHTML = Calendar._TT["WK"]; 12981 } 12982 for (var i = 7; i > 0; --i) { 12983 cell = Calendar.createElement("td", row); 12984 if (!i) { 12985 cell.navtype = 100; 12986 cell.calendar = this; 12987 Calendar._add_evs(cell); 12988 } 12989 } 12990 this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild; 12991 this._displayWeekdays(); 12992 12993 var tbody = Calendar.createElement("tbody", table); 12994 this.tbody = tbody; 12995 12996 for (i = 6; i > 0; --i) { 12997 row = Calendar.createElement("tr", tbody); 12998 if (this.weekNumbers) { 12999 cell = Calendar.createElement("td", row); 13000 } 13001 for (var j = 7; j > 0; --j) { 13002 cell = Calendar.createElement("td", row); 13003 cell.calendar = this; 13004 Calendar._add_evs(cell); 13005 } 13006 } 13007 13008 if (this.showsTime) { 13009 row = Calendar.createElement("tr", tbody); 13010 row.className = "time"; 13011 13012 cell = Calendar.createElement("td", row); 13013 cell.className = "time"; 13014 cell.colSpan = 2; 13015 cell.innerHTML = Calendar._TT["TIME"] || " "; 13016 13017 cell = Calendar.createElement("td", row); 13018 cell.className = "time"; 13019 cell.colSpan = this.weekNumbers ? 4 : 3; 13020 13021 (function(){ 13022 function makeTimePart(className, init, range_start, range_end) { 13023 var part = Calendar.createElement("span", cell); 13024 part.className = className; 13025 part.innerHTML = init; 13026 part.calendar = cal; 13027 part.ttip = Calendar._TT["TIME_PART"]; 13028 part.navtype = 50; 13029 part._range = []; 13030 if (typeof range_start != "number") 13031 part._range = range_start; 13032 else { 13033 for (var i = range_start; i <= range_end; ++i) { 13034 var txt; 13035 if (i < 10 && range_end >= 10) txt = '0' + i; 13036 else txt = '' + i; 13037 part._range[part._range.length] = txt; 13038 } 13039 } 13040 Calendar._add_evs(part); 13041 return part; 13042 }; 13043 var hrs = cal.date.getHours(); 13044 var mins = cal.date.getMinutes(); 13045 var t12 = !cal.time24; 13046 var pm = (hrs > 12); 13047 if (t12 && pm) hrs -= 12; 13048 var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23); 13049 var span = Calendar.createElement("span", cell); 13050 span.innerHTML = ":"; 13051 span.className = "colon"; 13052 var M = makeTimePart("minute", mins, 0, 59); 13053 var AP = null; 13054 cell = Calendar.createElement("td", row); 13055 cell.className = "time"; 13056 cell.colSpan = 2; 13057 if (t12) 13058 AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]); 13059 else 13060 cell.innerHTML = " "; 13061 13062 cal.onSetTime = function() { 13063 var pm, hrs = this.date.getHours(), 13064 mins = this.date.getMinutes(); 13065 if (t12) { 13066 pm = (hrs >= 12); 13067 if (pm) hrs -= 12; 13068 if (hrs == 0) hrs = 12; 13069 AP.innerHTML = pm ? "pm" : "am"; 13070 } 13071 H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs; 13072 M.innerHTML = (mins < 10) ? ("0" + mins) : mins; 13073 }; 13074 13075 cal.onUpdateTime = function() { 13076 var date = this.date; 13077 var h = parseInt(H.innerHTML, 10); 13078 if (t12) { 13079 if (/pm/i.test(AP.innerHTML) && h < 12) 13080 h += 12; 13081 else if (/am/i.test(AP.innerHTML) && h == 12) 13082 h = 0; 13083 } 13084 var d = date.getDate(); 13085 var m = date.getMonth(); 13086 var y = date.getFullYear(); 13087 date.setHours(h); 13088 date.setMinutes(parseInt(M.innerHTML, 10)); 13089 date.setFullYear(y); 13090 date.setMonth(m); 13091 date.setDate(d); 13092 this.dateClicked = false;
13093 this.callHandler(); 13094 }; 13095 })(); 13096 } else { 13097 this.onSetTime = this.onUpdateTime = function() {}; 13098 } 13099 13100 var tfoot = Calendar.createElement("tfoot", table); 13101 13102 row = Calendar.createElement("tr", tfoot); 13103 row.className = "footrow"; 13104 13105 cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300); 13106 cell.className = "ttip"; 13107 if (this.isPopup) { 13108 cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; 13109 cell.style.cursor = "move"; 13110 } 13111 this.tooltips = cell; 13112 13113 div = Calendar.createElement("div", this.element); 13114 this.monthsCombo = div; 13115 div.className = "combo"; 13116 for (i = 0; i < Calendar._MN.length; ++i) { 13117 var mn = Calendar.createElement("div"); 13118 mn.className = Calendar.is_ie ? "label-IEfix" : "label"; 13119 mn.month = i; 13120 mn.innerHTML = Calendar._SMN[i]; 13121 div.appendChild(mn); 13122 } 13123 13124 div = Calendar.createElement("div", this.element); 13125 this.yearsCombo = div; 13126 div.className = "combo"; 13127 for (i = 12; i > 0; --i) { 13128 var yr = Calendar.createElement("div"); 13129 yr.className = Calendar.is_ie ? "label-IEfix" : "label"; 13130 div.appendChild(yr); 13131 } 13132 13133 this._init(this.firstDayOfWeek, this.date); 13134 parent.appendChild(this.element); 13135}; 13136 13137/** keyboard navigation, only for popup calendars */ 13138Calendar._keyEvent = function(ev) { 13139 var cal = window._dynarch_popupCalendar; 13140 if (!cal || cal.multiple) 13141 return false; 13142 (Calendar.is_ie) && (ev = window.event); 13143 var act = (Calendar.is_ie || ev.type == "keypress"), 13144 K = ev.keyCode; 13145 if (ev.ctrlKey) { 13146 switch (K) { 13147 case 37: // KEY left 13148 act && Calendar.cellClick(cal._nav_pm); 13149 break; 13150 case 38: // KEY up 13151 act && Calendar.cellClick(cal._nav_py); 13152 break; 13153 case 39: // KEY right 13154 act && Calendar.cellClick(cal._nav_nm); 13155 break; 13156 case 40: // KEY down 13157 act && Calendar.cellClick(cal._nav_ny); 13158 break; 13159 default: 13160 return false; 13161 } 13162 } else switch (K) { 13163 case 32: // KEY space (now) 13164 Calendar.cellClick(cal._nav_now); 13165 break; 13166 case 27: // KEY esc 13167 act && cal.callCloseHandler(); 13168 break; 13169 case 37: // KEY left 13170 case 38: // KEY up 13171 case 39: // KEY right 13172 case 40: // KEY down 13173 if (act) { 13174 var prev, x, y, ne, el, step; 13175 prev = K == 37 || K == 38; 13176 step = (K == 37 || K == 39) ? 1 : 7; 13177 function setVars() { 13178 el = cal.currentDateEl; 13179 var p = el.pos; 13180 x = p & 15; 13181 y = p >> 4; 13182 ne = cal.ar_days[y][x]; 13183 };setVars(); 13184 function prevMonth() { 13185 var date = new CalendarDateObject(cal.date); 13186 date.setDate(date.getDate() - step); 13187 cal.setDate(date); 13188 }; 13189 function nextMonth() { 13190 var date = new CalendarDateObject(cal.date); 13191 date.setDate(date.getDate() + step); 13192 cal.setDate(date); 13193 }; 13194 while (1) { 13195 switch (K) { 13196 case 37: // KEY left 13197 if (--x >= 0) 13198 ne = cal.ar_days[y][x]; 13199 else { 13200 x = 6; 13201 K = 38; 13202 continue; 13203 } 13204 break; 13205 case 38: // KEY up 13206 if (--y >= 0) 13207 ne = cal.ar_days[y][x]; 13208 else { 13209 prevMonth(); 13210 setVars(); 13211 } 13212 break; 13213 case 39: // KEY right 13214 if (++x < 7) 13215 ne = cal.ar_days[y][x]; 13216 else { 13217 x = 0; 13218 K = 40; 13219 continue; 13220 } 13221 break; 13222 case 40: // KEY down 13223 if (++y < cal.ar_days.length) 13224 ne = cal.ar_days[y][x]; 13225 else { 13226 nextMonth(); 13227 setVars(); 13228 } 13229 break; 13230 } 13231 break; 13232 } 13233 if (ne) { 13234 if (!ne.disabled) 13235 Calendar.cellClick(ne); 13236 else if (prev) 13237 prevMonth(); 13238 else 13239 nextMonth(); 13240 } 13241 } 13242 break; 13243 case 13: // KEY enter 13244 if (act) 13245 Calendar.cellClick(cal.currentDateEl, ev); 13246 break; 13247 default: 13248 return false;
13249 } 13250 return Calendar.stopEvent(ev); 13251}; 13252 13253/** 13254 * (RE)Initializes the calendar to the given date and firstDayOfWeek 13255 */ 13256Calendar.prototype._init = function (firstDayOfWeek, date) { 13257 var today = new CalendarDateObject(), 13258 TY = today.getFullYear(), 13259 TM = today.getMonth(), 13260 TD = today.getDate(); 13261 this.table.style.visibility = "hidden"; 13262 var year = date.getFullYear(); 13263 if (year < this.minYear) { 13264 year = this.minYear; 13265 date.setFullYear(year); 13266 } else if (year > this.maxYear) { 13267 year = this.maxYear; 13268 date.setFullYear(year); 13269 } 13270 this.firstDayOfWeek = firstDayOfWeek; 13271 this.date = new CalendarDateObject(date); 13272 var month = date.getMonth(); 13273 var mday = date.getDate(); 13274 var no_days = date.getMonthDays(); 13275 13276 // calendar voodoo for computing the first day that would actually be 13277 // displayed in the calendar, even if it's from the previous month. 13278 // WARNING: this is magic. ;-) 13279 date.setDate(1); 13280 var day1 = (date.getDay() - this.firstDayOfWeek) % 7; 13281 if (day1 < 0) 13282 day1 += 7; 13283 date.setDate(-day1); 13284 date.setDate(date.getDate() + 1); 13285 13286 var row = this.tbody.firstChild; 13287 var MN = Calendar._SMN[month]; 13288 var ar_days = this.ar_days = new Array(); 13289 var weekend = Calendar._TT["WEEKEND"]; 13290 var dates = this.multiple ? (this.datesCells = {}) : null; 13291 for (var i = 0; i < 6; ++i, row = row.nextSibling) { 13292 var cell = row.firstChild; 13293 if (this.weekNumbers) { 13294 cell.className = "day wn"; 13295 cell.innerHTML = date.getWeekNumber(); 13296 cell = cell.nextSibling; 13297 } 13298 row.className = "daysrow"; 13299 var hasdays = false, iday, dpos = ar_days[i] = []; 13300 for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) { 13301 iday = date.getDate(); 13302 var wday = date.getDay(); 13303 cell.className = "day"; 13304 cell.pos = i << 4 | j; 13305 dpos[j] = cell; 13306 var current_month = (date.getMonth() == month); 13307 if (!current_month) { 13308 if (this.showsOtherMonths) { 13309 cell.className += " othermonth"; 13310 cell.otherMonth = true; 13311 } else { 13312 cell.className = "emptycell"; 13313 cell.innerHTML = " "; 13314 cell.disabled = true; 13315 continue; 13316 } 13317 } else { 13318 cell.otherMonth = false; 13319 hasdays = true; 13320 } 13321 cell.disabled = false; 13322 cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday; 13323 if (dates) 13324 dates[date.print("%Y%m%d")] = cell; 13325 if (this.getDateStatus) { 13326 var status = this.getDateStatus(date, year, month, iday); 13327 if (this.getDateToolTip) { 13328 var toolTip = this.getDateToolTip(date, year, month, iday); 13329 if (toolTip) 13330 cell.title = toolTip; 13331 } 13332 if (status === true) { 13333 cell.className += " disabled"; 13334 cell.disabled = true; 13335 } else { 13336 if (/disabled/i.test(status)) 13337 cell.disabled = true; 13338 cell.className += " " + status; 13339 } 13340 } 13341 if (!cell.disabled) { 13342 cell.caldate = new CalendarDateObject(date); 13343 cell.ttip = "_"; 13344 if (!this.multiple && current_month 13345 && iday == mday && this.hiliteToday) { 13346 cell.className += " selected"; 13347 this.currentDateEl = cell; 13348 } 13349 if (date.getFullYear() == TY && 13350 date.getMonth() == TM && 13351 iday == TD) { 13352 cell.className += " today"; 13353 cell.ttip += Calendar._TT["PART_TODAY"]; 13354 } 13355 if (weekend.indexOf(wday.toString()) != -1) 13356 cell.className += cell.otherMonth ? " oweekend" : " weekend"; 13357 } 13358 } 13359 if (!(hasdays || this.showsOtherMonths)) 13360 row.className = "emptyrow"; 13361 } 13362 this.title.innerHTML = Calendar._MN[month] + ", " + year; 13363 this.onSetTime(); 13364 this.table.style.visibility = "visible"; 13365 this._initMultipleDates(); 13366 // PROFILE 13367 // this.tooltips.innerHTML = "Generated in " + ((new CalendarDateObject()) - today) + " ms"; 13368}; 13369 13370Calendar.prototype._initMultipleDates = function() { 13371 if (this.multiple) { 13372 for (var i in this.multiple) { 13373 var cell = this.datesCells[i]; 13374 var d = this.multiple[i]; 13375 if (!d) 13376 continue; 13377 if (cell) 13378 cell.className += " selected"; 13379 } 13380 } 13381}; 13382 13383Calendar.prototype._toggleMultipleDate = function(date) { 13384 if (this.multiple) { 13385 var ds = date.print("%Y%m%d"); 13386 var cell = this.datesCells[ds]; 13387 if (cell) { 13388 var d = this.multiple[ds]; 13389 if (!d) { 13390 Calendar.addClass(cell, "selected"); 13391 this.multiple[ds] = date; 13392 } else { 13393 Calendar.removeClass(cell, "selected"); 13394 delete this.multiple[ds]; 13395 } 13396 } 13397 } 13398}; 13399 13400Calendar.prototype.setDateToolTipHandler = function (unaryFunction) { 13401 this.getDateToolTip = unaryFunction; 13402}; 13403 13404/** 13405 * Calls _init function above for going to a certain date (but only if the 13406 * date is different than the currently selected one). 13407 */ 13408Calendar.prototype.setDate = function (date) { 13409 if (!date.equalsTo(this.date)) { 13410 this._init(this.firstDayOfWeek, date); 13411 } 13412}; 13413 13414/** 13415 * Refreshes the calendar. Useful if the "disabledHandler" function is 13416 * dynamic, meaning that the list of disabled date can change at runtime. 13417 * Just * call this function if you think that the list of disabled dates 13418 * should * change. 13419 */ 13420Calendar.prototype.refresh = function () { 13421 this._init(this.firstDayOfWeek, this.date); 13422}; 13423 13424/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */ 13425Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) { 13426 this._init(firstDayOfWeek, this.date); 13427 this._displayWeekdays(); 13428}; 13429 13430/** 13431 * Allows customization of what dates are enabled. The "unaryFunction" 13432 * parameter must be a function object that receives the date (as a JS Date 13433 * object) and returns a boolean value. If the returned value is true then 13434 * the passed date will be marked as disabled. 13435 */ 13436Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) { 13437 this.getDateStatus = unaryFunction; 13438}; 13439 13440/** Customization of allowed year range for the calendar. */ 13441Calendar.prototype.setRange = function (a, z) { 13442 this.minYear = a; 13443 this.maxYear = z; 13444}; 13445 13446/** Calls the first user handler (selectedHandler). */ 13447Calendar.prototype.callHandler = function () { 13448 if (this.onSelected) { 13449 this.onSelected(this, this.date.print(this.dateFormat)); 13450 } 13451}; 13452 13453/** Calls the second user handler (closeHandler). */ 13454Calendar.prototype.callCloseHandler = function () { 13455 if (this.onClose) { 13456 this.onClose(this); 13457 } 13458 this.hideShowCovered(); 13459}; 13460 13461/** Removes the calendar object from the DOM tree and destroys it. */ 13462Calendar.prototype.destroy = function () { 13463 var el = this.element.parentNode; 13464 el.removeChild(this.element); 13465 Calendar._C = null; 13466 window._dynarch_popupCalendar = null; 13467}; 13468 13469/** 13470 * Moves the calendar element to a different section in the DOM tree (changes 13471 * its parent). 13472 */ 13473Calendar.prototype.reparent = function (new_parent) { 13474 var el = this.element; 13475 el.parentNode.removeChild(el); 13476 new_parent.appendChild(el); 13477}; 13478 13479// This gets called when the user presses a mouse button anywhere in the 13480// document, if the calendar is shown. If the click was outside the open 13481// calendar this function closes it. 13482Calendar._checkCalendar = function(ev) { 13483 var calendar = window._dynarch_popupCalendar; 13484 if (!calendar) { 13485 return false;
13486 } 13487 var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); 13488 for (; el != null && el != calendar.element; el = el.parentNode); 13489 if (el == null) { 13490 // calls closeHandler which should hide the calendar. 13491 window._dynarch_popupCalendar.callCloseHandler(); 13492 return Calendar.stopEvent(ev); 13493 } 13494}; 13495 13496/** Shows the calendar. */ 13497Calendar.prototype.show = function () { 13498 var rows = this.table.getElementsByTagName("tr"); 13499 for (var i = rows.length; i > 0;) { 13500 var row = rows[--i]; 13501 Calendar.removeClass(row, "rowhilite"); 13502 var cells = row.getElementsByTagName("td"); 13503 for (var j = cells.length; j > 0;) { 13504 var cell = cells[--j]; 13505 Calendar.removeClass(cell, "hilite"); 13506 Calendar.removeClass(cell, "active"); 13507 } 13508 } 13509 this.element.style.display = "block"; 13510 this.hidden = false; 13511 if (this.isPopup) { 13512 window._dynarch_popupCalendar = this; 13513 Calendar.addEvent(document, "keydown", Calendar._keyEvent); 13514 Calendar.addEvent(document, "keypress", Calendar._keyEvent); 13515 Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); 13516 } 13517 this.hideShowCovered(); 13518}; 13519 13520/** 13521 * Hides the calendar. Also removes any "hilite" from the class of any TD 13522 * element. 13523 */ 13524Calendar.prototype.hide = function () { 13525 if (this.isPopup) { 13526 Calendar.removeEvent(document, "keydown", Calendar._keyEvent); 13527 Calendar.removeEvent(document, "keypress", Calendar._keyEvent); 13528 Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); 13529 } 13530 this.element.style.display = "none"; 13531 this.hidden = true; 13532 this.hideShowCovered(); 13533}; 13534 13535/** 13536 * Shows the calendar at a given absolute position (beware that, depending on 13537 * the calendar element style -- position property -- this might be relative 13538 * to the parent's containing rectangle). 13539 */ 13540Calendar.prototype.showAt = function (x, y) { 13541 var s = this.element.style; 13542 s.left = x + "px"; 13543 s.top = y + "px"; 13544 this.show(); 13545}; 13546 13547/** Shows the calendar near a given element. */ 13548Calendar.prototype.showAtElement = function (el, opts) { 13549 var self = this; 13550 var p = Calendar.getAbsolutePos(el); 13551 if (!opts || typeof opts != "string") { 13552 this.showAt(p.x, p.y + el.offsetHeight); 13553 return true; 13554 } 13555 function fixPosition(box) { 13556 if (box.x < 0) 13557 box.x = 0; 13558 if (box.y < 0) 13559 box.y = 0; 13560 var cp = document.createElement("div"); 13561 var s = cp.style; 13562 s.position = "absolute"; 13563 s.right = s.bottom = s.width = s.height = "0px"; 13564 document.body.appendChild(cp); 13565 var br = Calendar.getAbsolutePos(cp); 13566 document.body.removeChild(cp); 13567 if (Calendar.is_ie) { 13568 br.y += document.documentElement.scrollTop; 13569 br.x += document.documentElement.scrollLeft; 13570 } else { 13571 br.y += window.scrollY; 13572 br.x += window.scrollX; 13573 } 13574 var tmp = box.x + box.width - br.x; 13575 if (tmp > 0) box.x -= tmp; 13576 tmp = box.y + box.height - br.y; 13577 if (tmp > 0) box.y -= tmp; 13578 }; 13579 this.element.style.display = "block"; 13580 Calendar.continuation_for_the_fucking_khtml_browser = function() { 13581 var w = self.element.offsetWidth; 13582 var h = self.element.offsetHeight; 13583 self.element.style.display = "none"; 13584 var valign = opts.substr(0, 1); 13585 var halign = "l"; 13586 if (opts.length > 1) { 13587 halign = opts.substr(1, 1); 13588 } 13589 // vertical alignment 13590 switch (valign) { 13591 case "T": p.y -= h; break; 13592 case "B": p.y += el.offsetHeight; break; 13593 case "C": p.y += (el.offsetHeight - h) / 2; break; 13594 case "t": p.y += el.offsetHeight - h; break; 13595 case "b": break; // already there 13596 } 13597 // horizontal alignment 13598 switch (halign) { 13599 case "L": p.x -= w; break; 13600 case "R": p.x += el.offsetWidth; break; 13601 case "C": p.x += (el.offsetWidth - w) / 2; break; 13602 case "l": p.x += el.offsetWidth - w; break; 13603 case "r": break; // already there 13604 } 13605 p.width = w; 13606 p.height = h + 40; 13607 self.monthsCombo.style.display = "none"; 13608 fixPosition(p); 13609 self.showAt(p.x, p.y); 13610 }; 13611 if (Calendar.is_khtml) 13612 setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); 13613 else 13614 Calendar.continuation_for_the_fucking_khtml_browser(); 13615}; 13616 13617/** Customizes the date format. */ 13618Calendar.prototype.setDateFormat = function (str) { 13619 this.dateFormat = str; 13620}; 13621 13622/** Customizes the tooltip date format. */ 13623Calendar.prototype.setTtDateFormat = function (str) { 13624 this.ttDateFormat = str; 13625}; 13626 13627/** 13628 * Tries to identify the date represented in a string. If successful it also 13629 * calls this.setDate which moves the calendar to the given date. 13630 */ 13631Calendar.prototype.parseDate = function(str, fmt) { 13632 if (!fmt) 13633 fmt = this.dateFormat; 13634 this.setDate(Date.parseDate(str, fmt)); 13635}; 13636 13637Calendar.prototype.hideShowCovered = function () { 13638 if (!Calendar.is_ie && !Calendar.is_opera) 13639 return; 13640 function getVisib(obj){ 13641 var value = obj.style.visibility; 13642 if (!value) { 13643 if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C 13644 if (!Calendar.is_khtml) 13645 value = document.defaultView. 13646 getComputedStyle(obj, "").getPropertyValue("visibility"); 13647 else 13648 value = ''; 13649 } else if (obj.currentStyle) { // IE 13650 value = obj.currentStyle.visibility; 13651 } else 13652 value = ''; 13653 } 13654 return value; 13655 }; 13656 13657 var tags = new Array("applet", "iframe", "select"); 13658 var el = this.element; 13659 13660 var p = Calendar.getAbsolutePos(el); 13661 var EX1 = p.x; 13662 var EX2 = el.offsetWidth + EX1; 13663 var EY1 = p.y; 13664 var EY2 = el.offsetHeight + EY1; 13665 13666 for (var k = tags.length; k > 0; ) { 13667 var ar = document.getElementsByTagName(tags[--k]); 13668 var cc = null; 13669 13670 for (var i = ar.length; i > 0;) { 13671 cc = ar[--i]; 13672 13673 p = Calendar.getAbsolutePos(cc); 13674 var CX1 = p.x; 13675 var CX2 = cc.offsetWidth + CX1; 13676 var CY1 = p.y; 13677 var CY2 = cc.offsetHeight + CY1; 13678 13679 if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { 13680 if (!cc.__msh_save_visibility) { 13681 cc.__msh_save_visibility = getVisib(cc); 13682 } 13683 cc.style.visibility = cc.__msh_save_visibility; 13684 } else { 13685 if (!cc.__msh_save_visibility) { 13686 cc.__msh_save_visibility = getVisib(cc); 13687 } 13688 cc.style.visibility = "hidden"; 13689 } 13690 } 13691 } 13692}; 13693 13694/** Internal function; it displays the bar with the names of the weekday. */ 13695Calendar.prototype._displayWeekdays = function () { 13696 var fdow = this.firstDayOfWeek; 13697 var cell = this.firstdayname; 13698 var weekend = Calendar._TT["WEEKEND"]; 13699 for (var i = 0; i < 7; ++i) { 13700 cell.className = "day name"; 13701 var realday = (i + fdow) % 7; 13702 if (i) { 13703 cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]); 13704 cell.navtype = 100; 13705 cell.calendar = this; 13706 cell.fdow = realday; 13707 Calendar._add_evs(cell); 13708 } 13709 if (weekend.indexOf(realday.toString()) != -1) { 13710 Calendar.addClass(cell, "weekend"); 13711 } 13712 cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; 13713 cell = cell.nextSibling; 13714 } 13715}; 13716 13717/** Internal function. Hides all combo boxes that might be displayed. */ 13718Calendar.prototype._hideCombos = function () { 13719 this.monthsCombo.style.display = "none"; 13720 this.yearsCombo.style.display = "none"; 13721}; 13722 13723/** Internal function. Starts dragging the element. */ 13724Calendar.prototype._dragStart = function (ev) { 13725 if (this.dragging) { 13726 return; 13727 } 13728 this.dragging = true; 13729 var posX; 13730 var posY; 13731 if (Calendar.is_ie) { 13732 posY = window.event.clientY + document.body.scrollTop; 13733 posX = window.event.clientX + document.body.scrollLeft; 13734 } else { 13735 posY = ev.clientY + window.scrollY; 13736 posX = ev.clientX + window.scrollX; 13737 } 13738 var st = this.element.style; 13739 this.xOffs = posX - parseInt(st.left); 13740 this.yOffs = posY - parseInt(st.top); 13741 with (Calendar) { 13742 addEvent(document, "mousemove", calDragIt); 13743 addEvent(document, "mouseup", calDragEnd); 13744 } 13745}; 13746 13747// BEGIN: DATE OBJECT PATCHES 13748 13749/** Adds the number of days array to the Date object. */ 13750Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); 13751 13752/** Constants used for time computations */ 13753Date.SECOND = 1000 /* milliseconds */; 13754Date.MINUTE = 60 * Date.SECOND; 13755Date.HOUR = 60 * Date.MINUTE; 13756Date.DAY = 24 * Date.HOUR;
13757Date.WEEK = 7 * Date.DAY; 13758 13759Date.parseDate = function(str, fmt) { 13760 var today = new CalendarDateObject(); 13761 var y = 0; 13762 var m = -1; 13763 var d = 0; 13764 13765 // translate date into en_US, because split() cannot parse non-latin stuff 13766 var a = str; 13767 var i; 13768 for (i = 0; i < Calendar._MN.length; i++) { 13769 a = a.replace(Calendar._MN[i], enUS.m.wide[i]); 13770 } 13771 for (i = 0; i < Calendar._SMN.length; i++) { 13772 a = a.replace(Calendar._SMN[i], enUS.m.abbr[i]); 13773 } 13774 a = a.replace(Calendar._am, 'am'); 13775 a = a.replace(Calendar._am.toLowerCase(), 'am'); 13776 a = a.replace(Calendar._pm, 'pm'); 13777 a = a.replace(Calendar._pm.toLowerCase(), 'pm'); 13778 13779 a = a.split(/\W+/); 13780 13781 var b = fmt.match(/%./g); 13782 var i = 0, j = 0; 13783 var hr = 0; 13784 var min = 0; 13785 for (i = 0; i < a.length; ++i) { 13786 if (!a[i]) 13787 continue; 13788 switch (b[i]) { 13789 case "%d": 13790 case "%e": 13791 d = parseInt(a[i], 10); 13792 break; 13793 13794 case "%m": 13795 m = parseInt(a[i], 10) - 1; 13796 break; 13797 13798 case "%Y": 13799 case "%y": 13800 y = parseInt(a[i], 10); 13801 (y < 100) && (y += (y > 29) ? 1900 : 2000); 13802 break; 13803 13804 case "%b": 13805 for (j = 0; j < 12; ++j) { 13806 if (enUS.m.abbr[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } 13807 } 13808 break; 13809 13810 case "%B": 13811 for (j = 0; j < 12; ++j) { 13812 if (enUS.m.wide[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } 13813 } 13814 break; 13815 13816 case "%H": 13817 case "%I": 13818 case "%k": 13819 case "%l": 13820 hr = parseInt(a[i], 10); 13821 break; 13822 13823 case "%P": 13824 case "%p": 13825 if (/pm/i.test(a[i]) && hr < 12) 13826 hr += 12; 13827 else if (/am/i.test(a[i]) && hr >= 12) 13828 hr -= 12; 13829 break; 13830 13831 case "%M": 13832 min = parseInt(a[i], 10); 13833 break; 13834 } 13835 } 13836 if (isNaN(y)) y = today.getFullYear(); 13837 if (isNaN(m)) m = today.getMonth(); 13838 if (isNaN(d)) d = today.getDate(); 13839 if (isNaN(hr)) hr = today.getHours(); 13840 if (isNaN(min)) min = today.getMinutes(); 13841 if (y != 0 && m != -1 && d != 0) 13842 return new CalendarDateObject(y, m, d, hr, min, 0); 13843 y = 0; m = -1; d = 0; 13844 for (i = 0; i < a.length; ++i) { 13845 if (a[i].search(/[a-zA-Z]+/) != -1) { 13846 var t = -1; 13847 for (j = 0; j < 12; ++j) { 13848 if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } 13849 } 13850 if (t != -1) { 13851 if (m != -1) { 13852 d = m+1; 13853 } 13854 m = t; 13855 } 13856 } else if (parseInt(a[i], 10) <= 12 && m == -1) { 13857 m = a[i]-1; 13858 } else if (parseInt(a[i], 10) > 31 && y == 0) { 13859 y = parseInt(a[i], 10); 13860 (y < 100) && (y += (y > 29) ? 1900 : 2000); 13861 } else if (d == 0) { 13862 d = a[i]; 13863 } 13864 } 13865 if (y == 0) 13866 y = today.getFullYear(); 13867 if (m != -1 && d != 0) 13868 return new CalendarDateObject(y, m, d, hr, min, 0); 13869 return today; 13870}; 13871 13872/** Returns the number of days in the current month */ 13873Date.prototype.getMonthDays = function(month) { 13874 var year = this.getFullYear(); 13875 if (typeof month == "undefined") { 13876 month = this.getMonth(); 13877 } 13878 if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { 13879 return 29; 13880 } else { 13881 return Date._MD[month]; 13882 } 13883}; 13884 13885/** Returns the number of day in the year. */ 13886Date.prototype.getDayOfYear = function() { 13887 var now = new CalendarDateObject(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); 13888 var then = new CalendarDateObject(this.getFullYear(), 0, 0, 0, 0, 0); 13889 var time = now - then; 13890 return Math.floor(time / Date.DAY); 13891}; 13892 13893/** Returns the number of the week in year, as defined in ISO 8601. */ 13894Date.prototype.getWeekNumber = function() { 13895 var d = new CalendarDateObject(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); 13896 var DoW = d.getDay(); 13897 d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu 13898 var ms = d.valueOf(); // GMT 13899 d.setMonth(0); 13900 d.setDate(4); // Thu in Week 1 13901 return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; 13902}; 13903 13904/** Checks date and time equality */ 13905Date.prototype.equalsTo = function(date) { 13906 return ((this.getFullYear() == date.getFullYear()) && 13907 (this.getMonth() == date.getMonth()) && 13908 (this.getDate() == date.getDate()) && 13909 (this.getHours() == date.getHours()) && 13910 (this.getMinutes() == date.getMinutes())); 13911}; 13912 13913/** Set only the year, month, date parts (keep existing time) */ 13914Date.prototype.setDateOnly = function(date) { 13915 var tmp = new CalendarDateObject(date); 13916 this.setDate(1); 13917 this.setFullYear(tmp.getFullYear()); 13918 this.setMonth(tmp.getMonth()); 13919 this.setDate(tmp.getDate()); 13920}; 13921 13922/** Prints the date in a string according to the given format. */ 13923Date.prototype.print = function (str) { 13924 var m = this.getMonth(); 13925 var d = this.getDate(); 13926 var y = this.getFullYear(); 13927 var wn = this.getWeekNumber(); 13928 var w = this.getDay(); 13929 var s = {}; 13930 var hr = this.getHours(); 13931 var pm = (hr >= 12); 13932 var ir = (pm) ? (hr - 12) : hr; 13933 var dy = this.getDayOfYear(); 13934 if (ir == 0) 13935 ir = 12; 13936 var min = this.getMinutes();
13937 var sec = this.getSeconds(); 13938 s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N] 13939 s["%A"] = Calendar._DN[w]; // full weekday name 13940 s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N] 13941 s["%B"] = Calendar._MN[m]; // full month name 13942 // FIXME: %c : preferred date and time representation for the current locale 13943 s["%C"] = 1 + Math.floor(y / 100); // the century number 13944 s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) 13945 s["%e"] = d; // the day of the month (range 1 to 31) 13946 // FIXME: %D : american date style: %m/%d/%y 13947 // FIXME: %E, %F, %G, %g, %h (man strftime) 13948 s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) 13949 s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) 13950 s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) 13951 s["%k"] = hr; // hour, range 0 to 23 (24h format) 13952 s["%l"] = ir; // hour, range 1 to 12 (12h format) 13953 s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 13954 s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 13955 s["%n"] = "\n"; // a newline character 13956 s["%p"] = pm ? Calendar._pm.toUpperCase() : Calendar._am.toUpperCase(); 13957 s["%P"] = pm ? Calendar._pm.toLowerCase() : Calendar._am.toLowerCase(); 13958 // FIXME: %r : the time in am/pm notation %I:%M:%S %p 13959 // FIXME: %R : the time in 24-hour notation %H:%M 13960 s["%s"] = Math.floor(this.getTime() / 1000); 13961 s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 13962 s["%t"] = "\t"; // a tab character 13963 // FIXME: %T : the time in 24-hour notation (%H:%M:%S) 13964 s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; 13965 s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) 13966 s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) 13967 // FIXME: %x : preferred date representation for the current locale without the time 13968 // FIXME: %X : preferred time representation for the current locale without the date 13969 s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) 13970 s["%Y"] = y; // year with the century 13971 s["%%"] = "%"; // a literal '%' character 13972 13973 var re = /%./g; 13974 if (!Calendar.is_ie5 && !Calendar.is_khtml) 13975 return str.replace(re, function (par) { return s[par] || par; }); 13976 13977 var a = str.match(re); 13978 for (var i = 0; i < a.length; i++) { 13979 var tmp = s[a[i]]; 13980 if (tmp) { 13981 re = new RegExp(a[i], 'g'); 13982 str = str.replace(re, tmp); 13983 } 13984 } 13985 13986 return str; 13987}; 13988 13989Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear; 13990Date.prototype.setFullYear = function(y) { 13991 var d = new CalendarDateObject(this); 13992 d.__msh_oldSetFullYear(y); 13993 if (d.getMonth() != this.getMonth()) 13994 this.setDate(28); 13995 this.__msh_oldSetFullYear(y); 13996}; 13997 13998CalendarDateObject.prototype = new Date(); 13999CalendarDateObject.prototype.constructor = CalendarDateObject; 14000CalendarDateObject.prototype.parent = Date.prototype; 14001function CalendarDateObject() { 14002 var dateObj; 14003 if (arguments.length > 1) { 14004 dateObj = eval("new this.parent.constructor("+Array.prototype.slice.call(arguments).join(",")+");"); 14005 } else if (arguments.length > 0) { 14006 dateObj = new this.parent.constructor(arguments[0]); 14007 } else { 14008 dateObj = new this.parent.constructor(); 14009 if (typeof(CalendarDateObject._SERVER_TIMZEONE_SECONDS) != "undefined") { 14010 dateObj.setTime((CalendarDateObject._SERVER_TIMZEONE_SECONDS + dateObj.getTimezoneOffset()*60)*1000); 14011 } 14012 } 14013 return dateObj; 14014} 14015 14016// END: DATE OBJECT PATCHES 14017 14018 14019// global object that remembers the calendar 14020window._dynarch_popupCalendar = null; 14021
14022/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ 14023 * --------------------------------------------------------------------------- 14024 * 14025 * The DHTML Calendar 14026 * 14027 * Details and latest version at: 14028 * http://dynarch.com/mishoo/calendar.epl 14029 * 14030 * This script is distributed under the GNU Lesser General Public License. 14031 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html 14032 * 14033 * This file defines helper functions for setting up the calendar. They are 14034 * intended to help non-programmers get a working calendar on their site 14035 * quickly. This script should not be seen as part of the calendar. It just 14036 * shows you what one can do with the calendar, while in the same time 14037 * providing a quick and simple method for setting it up. If you need 14038 * exhaustive customization of the calendar creation process feel free to 14039 * modify this code to suit your needs (this is recommended and much better 14040 * than modifying calendar.js itself). 14041 */ 14042Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();if(typeof fireEvent == 'function')fireEvent(p.inputField, "change");}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);}if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&¶ms.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;
vendor: 4,737 bytes, lines 14042-14044
14042cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};return cal;}; 14043/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ 14044!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 14044
14044=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 14044-14046
14044)||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; 14045 14046return!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 14046
14046,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 14046-14047
14046=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){ 14047return 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: 7,954 bytes, lines 14048-14076
14048 14049/*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */ 14050jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){var r=t.console;i[n]||(i[n]=!0,e.migrateWarnings.push(n),r&&r.warn&&!e.migrateMute&&(r.warn("JQMIGRATE: "+n),e.migrateTrace&&r.trace&&r.trace()))}function a(t,a,i,o){if(Object.defineProperty)try{return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){return r(o),i},set:function(e){r(o),i=e}}),n}catch(s){}e._definePropertyBroken=!0,t[a]=i}var i={};e.migrateWarnings=[],!e.migrateMute&&t.console&&t.console.log&&t.console.log("JQMIGRATE: Logging is active"),e.migrateTrace===n&&(e.migrateTrace=!0),e.migrateReset=function(){i={},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQuery is not compatible with Quirks Mode");var o=e("<input/>",{size:1}).attr("size")&&e.attrFn,s=e.attr,u=e.attrHooks.value&&e.attrHooks.value.get||function(){return null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},l=/^(?:input|button)$/i,d=/^[238]$/,p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.attrFn is deprecated"),e.attr=function(t,a,i,u){var c=a.toLowerCase(),g=t&&t.nodeType;return u&&(4>s.length&&r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(g)&&(o?a in o:e.isFunction(e.fn[a])))?e(t)[a](i):("type"===a&&i!==n&&l.test(t.nodeName)&&t.parentNode&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[c]&&p.test(c)&&(e.attrHooks[c]={get:function(t,r){var a,i=e.prop(t,r);return i===!0||"boolean"!=typeof i&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(c)&&r("jQuery.fn.attr('"+c+"') may use property instead of attribute")),s.call(e,t,a,i))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments):("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^([^<]*)(<[\w\W]+>)([^>]*)$/;e.fn.init=function(t,n,a){var i;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(i=y.exec(e.trim(t)))&&i[0]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),i[3]&&r("$(html) HTML text after last tag is ignored"),"#"===i[0].charAt(0)&&(r("HTML string cannot start with a '#' character"),e.error("JQMIGRATE: Invalid selector string (XSS)")),n&&n.context&&(n=n.context),e.parseHTML)?v.call(this,e.parseHTML(i[2],n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSON=function(e){return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e.browser||(g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h),a(e,"browser",e.browser,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var a,i,o=this[0];return!o||"events"!==t||1!==arguments.length||(a=e.data(o,t),i=e._data(o,t),a!==n&&a!==i||i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,i,o){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var s,u,c,l,d=[];if(e.merge(d,e.buildFragment(t,a).childNodes),i)for(c=function(e){return!e.type||j.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):i.appendChild(e):n},s=0;null!=(u=d[s]);s++)e.nodeName(u,"script")&&c(u)||(i.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge([],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)),s+=l.length));return d});var Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,T=e.fn.live,M=e.fn.die,S="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",C=RegExp("\\b(?:"+S+")\\b"),H=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),e.event.dispatch&&a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJAX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,i)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n))return N.apply(this,arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,i=t.guid||e.guid++,o=0,s=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%o;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,arguments)||!1};for(s.guid=i;a.length>o;)a[o++].guid=i;return this.click(s)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),T?T.apply(this,arguments):(e(this.context).on(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),M?M.apply(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return n||C.test(e)||r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(S.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQuery,window); 14051jQuery.noConflict(); 14052 14053(function() { 14054 var isBootstrapEvent = false; 14055 if (window.jQuery) { 14056 var all = jQuery('*'); 14057 jQuery.each(['hide.bs.dropdown', 14058 'hide.bs.collapse', 14059 'hide.bs.modal', 14060 'hide.bs.tooltip', 14061 'hide.bs.popover'], function(index, eventName) { 14062 all.on(eventName, function( event ) { 14063 isBootstrapEvent = true; 14064 }); 14065 }); 14066 } 14067 var originalHide = Element.hide; 14068 Element.addMethods({ 14069 hide: function(element) { 14070 if(isBootstrapEvent) { 14071 isBootstrapEvent = false; 14072 return element; 14073 } 14074 return originalHide(element); 14075 } 14076 });
vendor: 4,535 bytes, lines 14077-14083
14077})(); 14078/*! jQuery UI - v1.11.4 - 2015-03-11 14079* http://jqueryui.com 14080* 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 14081* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ 14082 14083(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","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},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
vendor: 4,947 bytes, line 14083
14083",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
vendor: 10,013 bytes, line 14083
14083),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",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]]}
vendor: 1,160 bytes, line 14083
14083),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 14083
14083a?"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 14083-14084
14083css("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); 14084i.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 14084
14084)},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 14084
14084se").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 14084-14085
14084i&&(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); 14085return 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 14085
14085var 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 14085
14085t.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 14085-14086
14085otNode(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) 14086},_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 14086
14086: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 14086
14086=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 14086
14086ontainerOffset={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 14086-14087
14086: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; 14087if(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 14087
14087ptions:{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 14087
14087ing"!=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 14087-14088
14087(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()}; 14088f&&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 14088
14088p":"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 14088-14089
14088: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)); 14089return 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 14089
14089return 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 14089
14089,_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 14089-14090
14089),_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; 14090this.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 14090
14090),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,763 bytes, lines 14090-14096
14090 14091/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */ 14092(function(r,G,f,v){var J=f("html"),n=f(r),p=f(G),b=f.fancybox=function(){b.open.apply(this,arguments)},I=navigator.userAgent.match(/msie/i),B=null,s=G.createTouch!==v,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},q=function(a){return a&&"string"===f.type(a)},E=function(a){return q(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&E(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},w=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.5",defaults:{padding:15,margin:20, 14093width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"}, 14094keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+ 14095(I?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0, 14096openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,
14097isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k, 14098c.metadata())):k=c);g=d.href||k.href||(q(c)?c:null);h=d.title!==v?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));q(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":q(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(q(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&& 14099k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==v&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| 14100b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= 14101setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index<b.group.length-1))b.player.isActive=!0,p.bind({"onCancel.player beforeClose.player":c,"onUpdate.player":e,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")}else c()},next:function(a){var d=b.current;d&&(q(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},prev:function(a){var d=b.current; 14102d&&(q(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==v&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},e.dim,k)))},update:function(a){var d= 14103a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(B),B=null);b.isOpen&&!B&&(B=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),B=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate")), 14104b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('<div id="fancybox-loading"><i class="ajax-loader large animate-spin"></i></div>').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||!1,d={x:n.scrollLeft(), 14105y:n.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&r.innerWidth?r.innerWidth:n.width(),d.h=s&&r.innerHe
vendor: 5,044 bytes, lines 14105-14114
14105ight?r.innerHeight:n.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");n.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(n.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=e.target||e.srcElement; 14106if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1<a.group.length&&k[c]!==v)return b[d](k[c]),e.preventDefault(),!1;if(-1<f.inArray(c,k))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,k,g){for(var h=f(d.target||null),j=!1;h.length&&!j&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)j=h[0]&&!(h[0].style.overflow&&"hidden"===h[0].style.overflow)&& 14107(h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1<b.group.length&&!a.canShrink){if(0<g||0<k)b.prev(0<g?"down":"left");else if(0>g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&b.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0, 14108{},b.helpers[d].defaults,e),c)});p.trigger(a)}},isImage:function(a){return q(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return q(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1, 14109mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio= 14110!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,w(d.padding[a]))});b.trigger("onReady");if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href"); 14111"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload= 14112this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href); 14113f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload, 14114e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,
14115outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('<div class="fancybox-placeholder"></div>').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case "image":e=a.tpl.image.replace("{href}", 14116g);break;case "swf":e='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e+='<param name="'+a+'" value="'+b+'"></param>';h+=" "+a+'="'+b+'"'}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");a.inner.css("overflow","yes"===k?"scroll": 14117"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,p=h.maxHeight,s=h.scrolling,q=h.scrollOutside? 14118h.scrollbarWidth:0,x=h.margin,y=l(x[1]+x[3]),r=l(x[0]+x[2]),v,z,t,C,A,F,B,D,H;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");x=l(k.outerWidth(!0)-k.width());v=l(k.outerHeight(!0)-k.height());z=y+x;t=r+v;C=E(c)?(a.w-z)*l(c)/100:c;A=E(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(H=h.content,h.autoHeight&&1===H.data("ready"))try{H[0].contentWindow.document.location&&(g.width(C).height(9999),F=H.contents().find("body"),q&&F.css("overflow-x","hidden"),A=F.outerHeight(!0))}catch(G){}}else if(h.autoWidth|| 14119h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=l(C);j=l(A);D=C/A;m=l(E(m)?l(m,"w")-z:m);n=l(E(n)?l(n,"w")-z:n);u=l(E(u)?l(u,"h")-t:u);p=l(E(p)?l(p,"h")-t:p);F=n;B=p;
14119h.fitToView&&(n=Math.min(a.w-z,n),p=Math.min(a.h-t,p));z=a.w-y;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/D)),j>p&&(j=p,c=l(j*D)),c<m&&(c=m,j=l(c/D)),j<u&&(j=u,c=l(j*D))):(c=Math.max(m,Math.min(c,n)),h.autoHeight&& 14120"iframe"!==h.type&&(g.width(c),j=g.height()),j=Math.max(u,Math.min(j,p)));if(h.fitToView)if(g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height(),h.aspectRatio)for(;(a>z||y>r)&&(c>m&&j>u)&&!(19<d++);)j=Math.max(u,Math.min(p,j-10)),c=l(j*D),c<m&&(c=m,j=l(c/D)),c>n&&(c=n,j=l(c/D)),g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height();else c=Math.max(m,Math.min(c,c-(a-z))),j=Math.max(u,Math.min(j,j-(y-r)));q&&("auto"===s&&j<A&&c+x+q<z)&&(c+=q);g.width(c).height(j);e.width(c+x);a=e.width(); 14121y=e.height();e=(a>z||y>r)&&c>m&&j>u;c=h.aspectRatio?c<F&&j<B&&c<C&&j<A:(c<F||j<B)&&(c<C||j<A);f.extend(h,{dim:{width:w(a),height:w(y)},origWidth:C,origHeight:A,canShrink:e,canExpand:c,wPadding:x,hPadding:v,wrapSpace:y-k.outerHeight(!0),skinSpace:k.height()-j});!H&&(h.autoHeight&&j>u&&j<p&&!c)&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",top:c[0],left:c[3]};d.autoCenter&&d.fixed&& 14122!a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=w(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=w(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&(b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){!f(d.target).is("a")&&!f(d.target).parent().is("a")&&(d.preventDefault(), 14123b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(a){a= 14124a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,j=a.wPadding,m=b.getViewport();!e&&(a.isDom&&d.is(":visible"))&&(e=d.find("img:first"),e.length||(e=d));t(e)?(c=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())): 14125(c.top=m.y+(m.h-g)*a.topRatio,c.left=m.x+(m.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=m.y,c.left-=m.x;return c={top:w(c.top-h*a.topRatio),left:w(c.left-j*a.leftRatio),width:w(f+j),height:w(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](l("width"===f?c:c-g*e)),b.inner[f](l("width"=== 14126f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,k=f.extend({opacity:1},d);delete k.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(k,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&(c.opacity=0.1));b.wrap.animate(c, 14127{duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=w(l(e[g])-200),c[g]="+=200px"):(e[g]=w(l(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a= 14128b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!s,fixed:!0},overlay:null,fixed:!1,el:f("html"),create:function(a){a=f.extend({},this.defaults,a);this.overlay&&this.close();this.overlay= 14129f('<div class="fancybox-overlay"></div>').appendTo(b.coming?b.coming.parent:a.parent);this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(n.bind("resize.overlay",f.proxy(this.update,this)),this.update());
14129a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive? 14130b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){var a,b;n.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),a=n.scrollTop(),b=n.scrollLeft(),this.el.removeClass("fancybox-lock"),n.scrollTop(a).scrollLeft(b));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");I?(b=Math.max(G.documentElement.offsetWidth,G.body.offsetWidth), 14131p.width()>b&&(a=p.width())):p.width()>n.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&(this.fixed&&b.fixed)&&(e||(this.margin=p.height()>n.height()?f("html").css("margin-right").replace("px",""):!1),b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){var e,c;b.locked&&(!1!==this.margin&&(f("*").filter(function(){return"fixed"=== 14132f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),e=n.scrollTop(),c=n.scrollLeft(),this.el.addClass("fancybox-lock"),n.scrollTop(e).scrollLeft(c));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d= 14133b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(q(e)&&""!==f.trim(e)){d=f('<div class="fancybox-title fancybox-title-'+c+'-wrap">'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),I&&d.width(d.width()),d.wrapInner('<span class="child"></span>'),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d, 14134e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+'"]'),j=h.index(this)),a.index=j,!1!==b.o
14134pen(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):p.undelegate(c,"click.fb-start").delegate(c+ 14135":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===v&&(f.scrollbarWidth=function(){var a=f('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===v){a=f.support;d=f('<div style="position:fixed;top:20px;"></div>').appendTo("body");var e=20=== 14136d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(r).width();J.addClass("fancybox-lock-test");d=f(r).width();J.removeClass("fancybox-lock-test");f("<style type='text/css'>.fancybox-margin{margin-right:"+(d-a)+"px;}</style>").appendTo("head")})})(window,document,jQuery); 14137var ajaxcart_timer; 14138var ajaxcart_sec; 14139jQuery.noConflict(); 14140 function setAjaxData(data,iframe,type){ 14141 if(data.status == 'ERROR'){ 14142 alert(data.message.replace("<br/>","")); 14143 }else{ 14144 if(jQuery('.header-container .mini-cart')){ 14145 jQuery('.header-container .mini-cart').replaceWith(data.toplink); 14146 } 14147 if(jQuery('.fixed-header .mini-cart')){ 14148 jQuery('.fixed-header .mini-cart').replaceWith(data.toplink); 14149 } 14150 if(jQuery('.sticky-header .mini-cart')){ 14151 jQuery('.sticky-header .mini-cart').replaceWith(data.toplink); 14152 } 14153 if(jQuery('.col-right .block.block-cart')){ 14154 jQuery('.col-right .block.block-cart').replaceWith(data.cart_sidebar); 14155 } 14156 jQuery('#after-loading-success-message #success-message-container .msg-box').html(data.message); 14157 jQuery.fancybox.close(); 14158 if(type!='item'){ 14159 jQuery('#after-loading-success-message').fadeIn(200); 14160 ajaxcart_sec = jQuery('#after-loading-success-message .timer').text(); 14161 ajaxcart_timer = setInterval(function(){ 14162 jQuery('#after-loading-success-message .timer').html(jQuery('#after-loading-success-message .timer').text()-1); 14163 },1000) 14164 setTimeout(function(){ 14165 jQuery('#after-loading-success-message').fadeOut(200); 14166 clearTimeout(ajaxcart_timer); 14167 setTimeout(function(){ 14168 jQuery('#after-loading-success-message .timer').html(ajaxcart_sec); 14169 }, 1000); 14170 },ajaxcart_sec*1000); 14171 } 14172 } 14173 } 14174 function setLocationAjax(el,url,id,type){ 14175 var qty = 1; 14176 if(jQuery("#qty_"+id).val()>0) 14177 qty = jQuery("#qty_"+id).val(); 14178 if (url.indexOf("?")){ 14179 url = url.split("?")[0]; 14180 } 14181 url += 'isAjax/1'; 14182 url = url.replace("checkout/cart","ajaxcart/index"); 14183 if(window.location.href.match("https://") && !url.match("https://")){ 14184 url = url.replace("http://", "https://"); 14185 } 14186 if(window.location.href.match("http://") && !url.match("http://")){ 14187 url = url.replace("https://", "http://"); 14188 } 14189 jQuery('#loading-mask').show(); 14190 jQuery(el).parent().parent().parent().children(".product-image-area").children(".loader-container").show(); 14191 jQuery(el).parent().children(".loader-container").show(); 14192 try { 14193 jQuery.ajax( { 14194 url : url, 14195 dataType : 'json', 14196 data: {qty: qty}, 14197 success : function(data) { 14198 jQuery('#loading-mask').hide(); 14199 jQuery(".loader-container").hide(); 14200 setAjaxData(data,false,type); 14201 } 14202 }); 14203 } catch (e) { 14204 } 14205 } 14206 14207 function showOptions(id){ 14208 initFancybox(); 14209 jQuery('#fancybox'+id).trigger('click'); 14210 } 14211 14212 function initFancybox(){ 14213 jQuery.noConflict(); 14214 jQuery(document).ready(function(){ 14215 jQuery('.fancybox').fancybox({ 14216 hideOnContentClick : true, 14217 width: 382, 14218 autoDimensions: true, 14219 type : 'iframe', 14220 showTitle: false, 14221 scrolling: 'no', 14222 onComplete: function(){ 14223 jQuery('#fancybox-frame').load(function() { // wait for frame to load and then gets it's height 14224 jQuery('#fancybox-content').height(jQuery(this).contents().find('body').height()+100); 14225 jQuery.fancybox.resize(); 14226 });
14227 14228 }, 14229 'beforeLoad' : function() { 14230 jQuery("head").append('<style type="text/css" id="fancybox_hide_loading_css">#fancybox-loading{display:none}.fancybox-overlay{background:transparent}</style>'); 14231 jQuery(".loader-container").hide(); 14232 jQuery(this.element).parent().parent().parent().children(".product-image-area").children(".loader-container").show(); 14233 jQuery(this.element).parent().children(".loader-container").show(); 14234 }, 14235 'afterLoad' : function() { 14236 jQuery("#fancybox_hide_loading_css").remove(); 14237 jQuery(".loader-container").hide(); 14238 }, 14239 'afterClose': function(){ 14240 setTimeout(function(){ 14241 jQuery("#fancybox_hide_loading_css").remove(); 14242 }, 500); 14243 jQuery(".loader-container").hide(); 14244 } 14245 } 14246 ); 14247 }); 14248 } 14249 function ajaxCompare(el,url,id){ 14250 url = url.replace("catalog/product_compare/add","ajaxcart/whishlist/compare"); 14251 if (url.indexOf("?")){ 14252 url = url.split("?")[0]; 14253 } 14254 url += 'isAjax/1'; 14255 if(window.location.href.match("https://") && !url.match("https://")){ 14256 url = url.replace("http://", "https://"); 14257 } 14258 if(window.location.href.match("http://") && !url.match("http://")){ 14259 url = url.replace("https://", "http://"); 14260 } 14261 jQuery('#loading-mask').show(); 14262 jQuery(el).parent().parent().parent().children(".product-image-area").children(".loader-container").show(); 14263 jQuery(el).parent().children(".loader-container").show(); 14264 jQuery.ajax( { 14265 url : url, 14266 dataType : 'json', 14267 success : function(data) { 14268 jQuery('#loading-mask').hide(); 14269 jQuery(".loader-container").hide(); 14270 if(data.status == 'ERROR'){ 14271 alert(data.message.replace("<br/>","")); 14272 }else{ 14273 if(jQuery('.block-compare').length){ 14274 jQuery('.block-compare').replaceWith(data.sidebar); 14275 }else{ 14276 if(jQuery('.col-right').length){ 14277 jQuery('.col-right').prepend(data.sidebar); 14278 } 14279 } 14280 if(jQuery('.compare-link').length){ 14281 jQuery('.compare-link').replaceWith(data.compare_popup); 14282 } 14283 alert(data.message.replace("<br/>","")); 14284 } 14285 } 14286 }); 14287 } 14288 function ajaxWishlist(el,url,id){ 14289 url = url.replace("wishlist/index","ajaxcart/whishlist"); 14290 if (url.indexOf("?")){ 14291 url = url.split("?")[0]; 14292 } 14293 url += 'isAjax/1'; 14294 if(window.location.href.match("https://") && !url.match("https://")){ 14295 url = url.replace("http://", "https://"); 14296 } 14297 if(window.location.href.match("http://") && !url.match("http://")){ 14298 url = url.replace("https://", "http://"); 14299 } 14300 jQuery('#loading-mask').show(); 14301 jQuery(el).parent().parent().parent().children(".product-image-area").children(".loader-container").show(); 14302 jQuery(el).parent().children(".loader-container").show(); 14303 jQuery.ajax( { 14304 url : url, 14305 dataType : 'json', 14306 success : function(data) { 14307 jQuery('#loading-mask').hide(); 14308 jQuery(".loader-container").hide(); 14309 if(data.status == 'ERROR'){ 14310 alert(data.message.replace("<br/>","")); 14311 }else{ 14312 alert(data.message.replace("<br/>","")); 14313 if(jQuery('.header > .quick-access > .links')){ 14314 jQuery('.header > .quick-access > .links').replaceWith(data.toplink); 14315 } 14316 } 14317 } 14318 }); 14319 } 14320 function deleteAction(deleteUrl,itemId,msg){ 14321 var result = confirm(msg); 14322 if(result==true){ 14323 setLocationAjax(deleteUrl,itemId,'item') 14324 }else{ 14325 return false; 14326 } 14327 } 14328/** 14329 * Magento 14330 * 14331 * NOTICE OF LICENSE 14332 * 14333 * This source file is subject to the Academic Free License (AFL 3.0)
14334 * that is bundled with this package in the file LICENSE_AFL.txt. 14335 * It is also available through the world-wide-web at this URL: 14336 * http://opensource.org/licenses/afl-3.0.php 14337 * If you did not receive a copy of the license and are unable to 14338 * obtain it through the world-wide-web, please send an email 14339 * to [email protected] so we can send you a copy immediately. 14340 * 14341 * DISCLAIMER 14342 * 14343 * Do not edit or add to this file if you wish to upgrade Magento to newer 14344 * versions in the future. If you wish to customize Magento for your 14345 * needs please refer to http://www.magento.com for more information. 14346 * 14347 * @category Varien 14348 * @package js 14349 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 14350 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 14351 */ 14352if(typeof Product=='undefined') { 14353 var Product = {}; 14354} 14355 14356/********************* IMAGE ZOOMER ***********************/ 14357 14358Product.Zoom = Class.create(); 14359/** 14360 * Image zoom control 14361 * 14362 * @author Magento Core Team <[email protected]> 14363 */ 14364Product.Zoom.prototype = { 14365 initialize: function(imageEl, trackEl, handleEl, zoomInEl, zoomOutEl, hintEl){ 14366 this.containerEl = $(imageEl).parentNode; 14367 this.imageEl = $(imageEl); 14368 this.handleEl = $(handleEl); 14369 this.trackEl = $(trackEl); 14370 this.hintEl = $(hintEl); 14371 14372 this.containerDim = Element.getDimensions(this.containerEl); 14373 this.imageDim = Element.getDimensions(this.imageEl); 14374 14375 this.imageDim.ratio = this.imageDim.width/this.imageDim.height; 14376 14377 this.floorZoom = 1; 14378 14379 if (this.imageDim.width > this.imageDim.height) { 14380 this.ceilingZoom = this.imageDim.width / this.containerDim.width; 14381 } else { 14382 this.ceilingZoom = this.imageDim.height / this.containerDim.height; 14383 } 14384 14385 if (this.imageDim.width <= this.containerDim.width 14386 && this.imageDim.height <= this.containerDim.height) { 14387 this.trackEl.up().hide(); 14388 this.hintEl.hide(); 14389 this.containerEl.removeClassName('product-image-zoom'); 14390 return; 14391 } 14392 14393 this.imageX = 0; 14394 this.imageY = 0; 14395 this.imageZoom = 1; 14396 14397 this.sliderSpeed = 0; 14398 this.sliderAccel = 0; 14399 this.zoomBtnPressed = false; 14400 14401 this.showFull = false; 14402 14403 this.selects = document.getElementsByTagName('select'); 14404 14405 this.draggable = new Draggable(imageEl, { 14406 starteffect:false, 14407 reverteffect:false, 14408 endeffect:false, 14409 snap:this.contain.bind(this) 14410 }); 14411 14412 this.slider = new Control.Slider(handleEl, trackEl, { 14413 axis:'horizontal', 14414 minimum:0, 14415 maximum:Element.getDimensions(this.trackEl).width, 14416 alignX:0, 14417 increment:1, 14418 sliderValue:0, 14419 onSlide:this.scale.bind(this), 14420 onChange:this.scale.bind(this) 14421 }); 14422 14423 this.scale(0); 14424 14425 Event.observe(this.imageEl, 'dblclick', this.toggleFull.bind(this)); 14426 14427 Event.observe($(zoomInEl), 'mousedown', this.startZoomIn.bind(this)); 14428 Event.observe($(zoomInEl), 'mouseup', this.stopZooming.bind(this)); 14429 Event.observe($(zoomInEl), 'mouseout', this.stopZooming.bind(this)); 14430 14431 Event.observe($(zoomOutEl), 'mousedown', this.startZoomOut.bind(this)); 14432 Event.observe($(zoomOutEl), 'mouseup', this.stopZooming.bind(this)); 14433 Event.observe($(zoomOutEl), 'mouseout', this.stopZooming.bind(this)); 14434 }, 14435 14436 toggleFull: function () { 14437 this.showFull = !this.showFull; 14438 14439 //Hide selects for IE6 only 14440 if (typeof document.body.style.maxHeight == "undefined") { 14441 for (i=0; i<this.selects.length; i++) { 14442 this.selects[i].style.visibility = this.showFull ? 'hidden' : 'visible'; 14443 } 14444 } 14445 val_scale = !this.showFull ? this.slider.value : 1; 14446 this.scale(val_scale); 14447 14448 this.trackEl.style.visibility = this.showFull ? 'hidden' : 'visible';
14449 this.containerEl.style.overflow = this.showFull ? 'visible' : 'hidden'; 14450 this.containerEl.style.zIndex = this.showFull ? '1000' : '9'; 14451 14452 return this; 14453 }, 14454 14455 scale: function (v) { 14456 var centerX = (this.containerDim.width*(1-this.imageZoom)/2-this.imageX)/this.imageZoom; 14457 var centerY = (this.containerDim.height*(1-this.imageZoom)/2-this.imageY)/this.imageZoom; 14458 var overSize = (this.imageDim.width > this.containerDim.width || this.imageDim.height > this.containerDim.height); 14459 14460 this.imageZoom = this.floorZoom+(v*(this.ceilingZoom-this.floorZoom)); 14461 14462 if (overSize) { 14463 if (this.imageDim.width > this.imageDim.height) { 14464 this.imageEl.style.width = (this.imageZoom*this.containerDim.width)+'px'; 14465 } else { 14466 this.imageEl.style.height = (this.imageZoom*this.containerDim.height)+'px'; 14467 } 14468 if (this.containerDim.ratio) { 14469 if (this.imageDim.width > this.imageDim.height) { 14470 this.imageEl.style.height = (this.imageZoom*this.containerDim.width*this.containerDim.ratio)+'px'; // for safari 14471 } else { 14472 this.imageEl.style.width = (this.imageZoom*this.containerDim.height*this.containerDim.ratio)+'px'; // for safari 14473 } 14474 } 14475 } else { 14476 this.slider.setDisabled(); 14477 } 14478 14479 this.imageX = this.containerDim.width*(1-this.imageZoom)/2-centerX*this.imageZoom; 14480 this.imageY = this.containerDim.height*(1-this.imageZoom)/2-centerY*this.imageZoom; 14481 14482 this.contain(this.imageX, this.imageY, this.draggable); 14483 14484 return true; 14485 }, 14486 14487 startZoomIn: function() 14488 { 14489 if (!this.slider.disabled) { 14490 this.zoomBtnPressed = true; 14491 this.sliderAccel = .002; 14492 this.periodicalZoom(); 14493 this.zoomer = new PeriodicalExecuter(this.periodicalZoom.bind(this), .05); 14494 } 14495 return this; 14496 }, 14497 14498 startZoomOut: function() 14499 { 14500 if (!this.slider.disabled) { 14501 this.zoomBtnPressed = true; 14502 this.sliderAccel = -.002; 14503 this.periodicalZoom(); 14504 this.zoomer = new PeriodicalExecuter(this.periodicalZoom.bind(this), .05); 14505 } 14506 return this; 14507 }, 14508 14509 stopZooming: function() 14510 { 14511 if (!this.zoomer || this.sliderSpeed==0) { 14512 return; 14513 } 14514 this.zoomBtnPressed = false; 14515 this.sliderAccel = 0; 14516 }, 14517 14518 periodicalZoom: function() 14519 { 14520 if (!this.zoomer) { 14521 return this; 14522 } 14523 14524 if (this.zoomBtnPressed) { 14525 this.sliderSpeed += this.sliderAccel; 14526 } else { 14527 this.sliderSpeed /= 1.5; 14528 if (Math.abs(this.sliderSpeed)<.001) { 14529 this.sliderSpeed = 0; 14530 this.zoomer.stop(); 14531 this.zoomer = null; 14532 } 14533 } 14534 this.slider.value += this.sliderSpeed; 14535 14536 this.slider.setValue(this.slider.value); 14537 this.scale(this.slider.value); 14538 14539 return this; 14540 }, 14541 14542 contain: function (x,y,draggable) { 14543 14544 var dim = Element.getDimensions(draggable.element); 14545 14546 var xMin = 0, xMax = this.containerDim.width-dim.width; 14547 var yMin = 0, yMax = this.containerDim.height-dim.height; 14548 14549 x = x>xMin ? xMin : x; 14550 x = x<xMax ? xMax : x; 14551 y = y>yMin ? yMin : y; 14552 y = y<yMax ? yMax : y; 14553 14554 if (this.containerDim.width > dim.width) { 14555 x = (this.containerDim.width/2) - (dim.width/2); 14556 } 14557 14558 if (this.containerDim.height > dim.height) { 14559 y = (this.containerDim.height/2) - (dim.height/2); 14560 } 14561 14562 this.imageX = x; 14563 this.imageY = y; 14564 14565 this.imageEl.style.left = this.imageX+'px'; 14566 this.imageEl.style.top = this.imageY+'px'; 14567 14568 return [x,y]; 14569 } 14570}; 14571 14572/**************************** CONFIGURABLE PRODUCT **************************/ 14573Product.Config = Class.create(); 14574Product.Config.prototype = { 14575 initialize: function(config){ 14576 this.config = config; 14577 this.taxConfig = this.config.taxConfig; 14578 this.settings = $$('.super-attribute-select'); 14579 this.state = new Hash(); 14580 this.priceTemplate = new Template(this.config.template); 14581 this.prices = config.prices; 14582 14583 this.settings.each(function(element){ 14584 Event.observe(element, 'change', this.configure.bind(this)); 14585 }.bind(this)); 14586 14587 // fill state 14588 this.settings.each(function(element){
14589 var attributeId = element.id.replace(/[a-z]*/, ''); 14590 if(attributeId && this.config.attributes[attributeId]) { 14591 element.config = this.config.attributes[attributeId]; 14592 element.attributeId = attributeId; 14593 this.state[attributeId] = false; 14594 } 14595 }.bind(this)); 14596 14597 // Init settings dropdown 14598 var childSettings = []; 14599 for(var i=this.settings.length-1;i>=0;i--){ 14600 var prevSetting = this.settings[i-1] ? this.settings[i-1] : false; 14601 var nextSetting = this.settings[i+1] ? this.settings[i+1] : false; 14602 if(i==0){ 14603 this.fillSelect(this.settings[i]); 14604 } 14605 else { 14606 this.settings[i].disabled=true; 14607 } 14608 $(this.settings[i]).childSettings = childSettings.clone(); 14609 $(this.settings[i]).prevSetting = prevSetting; 14610 $(this.settings[i]).nextSetting = nextSetting; 14611 childSettings.push(this.settings[i]); 14612 } 14613 14614 // Set default values - from config and overwrite them by url values 14615 if (config.defaultValues) { 14616 this.values = config.defaultValues; 14617 } 14618 14619 var separatorIndex = window.location.href.indexOf('#'); 14620 if (separatorIndex != -1) { 14621 var paramsStr = window.location.href.substr(separatorIndex+1); 14622 var urlValues = paramsStr.toQueryParams(); 14623 if (!this.values) { 14624 this.values = {}; 14625 } 14626 for (var i in urlValues) { 14627 this.values[i] = urlValues[i]; 14628 } 14629 } 14630 14631 this.configureForValues(); 14632 document.observe("dom:loaded", this.configureForValues.bind(this)); 14633 }, 14634 14635 configureForValues: function () { 14636 if (this.values) { 14637 this.settings.each(function(element){ 14638 var attributeId = element.attributeId; 14639 element.value = (typeof(this.values[attributeId]) == 'undefined')? '' : this.values[attributeId]; 14640 this.configureElement(element); 14641 }.bind(this)); 14642 } 14643 }, 14644 14645 configure: function(event){ 14646 var element = Event.element(event); 14647 this.configureElement(element); 14648 }, 14649 14650 configureElement : function(element) { 14651 this.reloadOptionLabels(element); 14652 if(element.value){ 14653 this.state[element.config.id] = element.value; 14654 if(element.nextSetting){ 14655 element.nextSetting.disabled = false; 14656 this.fillSelect(element.nextSetting); 14657 this.resetChildren(element.nextSetting); 14658 } 14659 } 14660 else { 14661 this.resetChildren(element); 14662 } 14663 this.reloadPrice(); 14664// Calculator.updatePrice(); 14665 }, 14666 14667 reloadOptionLabels: function(element){ 14668 var selectedPrice; 14669 if(element.options[element.selectedIndex].config){ 14670 selectedPrice = parseFloat(element.options[element.selectedIndex].config.price); 14671 } 14672 else{ 14673 selectedPrice = 0; 14674 } 14675 for(var i=0;i<element.options.length;i++){ 14676 if(element.options[i].config){ 14677 element.options[i].text = this.getOptionLabel(element.options[i].config, element.options[i].config.price-selectedPrice); 14678 } 14679 } 14680 }, 14681 14682 resetChildren : function(element){ 14683 if(element.childSettings) { 14684 for(var i=0;i<element.childSettings.length;i++){ 14685 element.childSettings[i].selectedIndex = 0; 14686 element.childSettings[i].disabled = true; 14687 if(element.config){ 14688 this.state[element.config.id] = false; 14689 } 14690 } 14691 } 14692 }, 14693 14694 fillSelect: function(element){ 14695 var attributeId = element.id.replace(/[a-z]*/, ''); 14696 var options = this.getAttributeOptions(attributeId); 14697 this.clearSelect(element); 14698 element.options[0] = new Option('', ''); 14699 element.options[0].innerHTML = this.config.chooseText; 14700 14701 var prevConfig = false; 14702 if(element.prevSetting){ 14703 prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex]; 14704 } 14705 14706 if(options) { 14707 var index = 1; 14708 for(var i=0;i<options.length;i++){ 14709 var allowedProducts = []; 14710 if(prevConfig) { 14711 for(var j=0;j<options[i].products.length;j++){ 14712 if(prevConfig.config.allowedProducts 14713 && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){ 14714 allowedProducts.push(options[i].products[j]); 14715 } 14716 } 14717 } else { 14718 allowedProducts = options[i].products.clone(); 14719 } 14720 14721 if(allowedProducts.size()>0){ 14722 options[i].allowedProducts = allowedProducts; 14723 element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id); 14724 element.options[index].config = options[i]; 14725 index++; 14726 } 14727 } 14728 } 14729 }, 14730 14731 getOptionLabel: function(option, price){ 14732 var price = parseFloat(price); 14733 if (this.taxConfig.includeTax) { 14734 var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax; 14735 var excl = price - tax; 14736 var incl = excl*(1+(this.taxConfig.currentTax/100)); 14737 } else { 14738 var tax = price * (this.taxConfig.currentTax / 100); 14739 var excl = price; 14740 var incl = excl + tax; 14741 } 14742 14743 if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) { 14744 price = incl; 14745 } else { 14746 price = excl; 14747 } 14748 14749 var str = option.label; 14750 if(price){ 14751 if (this.taxConfig.showBothPrices) { 14752 str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')'; 14753 } else { 14754 str+= ' ' + this.formatPrice(price, true); 14755 } 14756 } 14757 return str; 14758 }, 14759 14760 formatPrice: function(price, showSign){ 14761 var str = ''; 14762 price = parseFloat(price); 14763 if(showSign){ 14764 if(price<0){ 14765 str+= '-'; 14766 price = -price; 14767 } 14768 else{ 14769 str+= '+'; 14770 } 14771 } 14772 14773 var roundedPrice = (Math.round(price*100)/100).toString(); 14774 14775 if (this.prices && this.prices[roundedPrice]) { 14776 str+= this.prices[roundedPrice]; 14777 } 14778 else { 14779 str+= this.priceTemplate.evaluate({price:price.toFixed(2)}); 14780 } 14781 return str; 14782 }, 14783 14784 clearSelect: function(element){ 14785 for(var i=element.options.length-1;i>=0;i--){ 14786 element.remove(i); 14787 } 14788 }, 14789 14790 getAttributeOptions: function(attributeId){ 14791 if(this.config.attributes[attributeId]){ 14792 return this.config.attributes[attributeId].options; 14793 } 14794 }, 14795 14796 reloadPrice: function(){ 14797 var price = 0; 14798 var oldPrice = 0; 14799 for(var i=this.settings.length-1;i>=0;i--){ 14800 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 14801 if(selected.config){ 14802 price += parseFloat(selected.config.price); 14803 oldPrice += parseFloat(selected.config.oldPrice); 14804 } 14805 } 14806 14807 optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice}); 14808 optionsPrice.reload(); 14809 14810 return price; 14811 14812 if($('product-price-'+this.config.productId)){ 14813 $('product-price-'+this.config.productId).innerHTML = price; 14814 } 14815 this.reloadOldPrice(); 14816 }, 14817 14818 reloadOldPrice: function(){ 14819 if ($('old-price-'+this.config.productId)) { 14820 14821 var price = parseFloat(this.config.oldPrice); 14822 for(var i=this.settings.length-1;i>=0;i--){ 14823 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 14824 if(selected.config){ 14825 var parsedOldPrice = parseFloat(selected.config.oldPrice); 14826 price += isNaN(parsedOldPrice) ? 0 : parsedOldPrice; 14827 } 14828 } 14829 if (price < 0) 14830 price = 0; 14831 price = this.formatPrice(price); 14832 14833 if($('old-price-'+this.config.productId)){ 14834 $('old-price-'+this.config.productId).innerHTML = price; 14835 } 14836 14837 } 14838 } 14839}; 14840 14841 14842/**************************** SUPER PRODUCTS ********************************/ 14843 14844Product.Super = {}; 14845Product.Super.Configurable = Class.create(); 14846 14847Product.Super.Configurable.prototype = { 14848 initialize: function(container, observeCss, updateUrl, updatePriceUrl, priceContainerId) { 14849 this.container = $(container); 14850 this.observeCss = observeCss; 14851 this.updateUrl = updateUrl; 14852 this.updatePriceUrl = updatePriceUrl; 14853 this.priceContainerId = priceContainerId; 14854 this.registerObservers(); 14855 }, 14856 registerObservers: function() { 14857 var elements = this.container.getElementsByClassName(this.observeCss); 14858 elements.each(function(element){ 14859 Event.observe(element, 'change', this.update.bindAsEventListener(this)); 14860 }.bind(this)); 14861 return this; 14862 }, 14863 update: function(event) { 14864 var elements = this.container.getElementsByClassName(this.observeCss); 14865 var parameters = Form.serializeElements(elements, true); 14866 14867 new Ajax.Updater(this.container, this.updateUrl + '?ajax=1', { 14868 parameters:parameters, 14869 onComplete:this.registerObservers.bind(this) 14870 }); 14871 var priceContainer = $(this.priceContainerId); 14872 if(priceContainer) { 14873 new Ajax.Updater(priceContainer, this.updatePriceUrl + '?ajax=1', { 14874 parameters:parameters 14875 }); 14876 } 14877 } 14878}; 14879 14880/** 14881 * Magento 14882 * 14883 * NOTICE OF LICENSE 14884 * 14885 * This source file is subject to the Academic Free License (AFL 3.0)
14886 * that is bundled with this package in the file LICENSE_AFL.txt. 14887 * It is also available through the world-wide-web at this URL: 14888 * http://opensource.org/licenses/afl-3.0.php 14889 * If you did not receive a copy of the license and are unable to 14890 * obtain it through the world-wide-web, please send an email 14891 * to [email protected] so we can send you a copy immediately. 14892 * 14893 * DISCLAIMER 14894 * 14895 * Do not edit or add to this file if you wish to upgrade Magento to newer 14896 * versions in the future. If you wish to customize Magento for your 14897 * needs please refer to http://www.magento.com for more information. 14898 * 14899 * @category Varien 14900 * @package js 14901 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 14902 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 14903 */ 14904if (typeof Product == 'undefined') { 14905 var Product = {}; 14906} 14907 14908/**************************** CONFIGURABLE PRODUCT **************************/ 14909Product.Config = Class.create(); 14910Product.Config.prototype = { 14911 initialize: function(config){ 14912 this.config = config; 14913 this.taxConfig = this.config.taxConfig; 14914 if (config.containerId) { 14915 this.settings = $$('#' + config.containerId + ' ' + '.super-attribute-select'); 14916 } else { 14917 this.settings = $$('.super-attribute-select'); 14918 } 14919 this.state = new Hash(); 14920 this.priceTemplate = new Template(this.config.template); 14921 this.prices = config.prices; 14922 14923 // Set default values from config 14924 if (config.defaultValues) { 14925 this.values = config.defaultValues; 14926 } 14927 14928 // Overwrite defaults by url 14929 var separatorIndex = window.location.href.indexOf('#'); 14930 if (separatorIndex != -1) { 14931 var paramsStr = window.location.href.substr(separatorIndex+1); 14932 var urlValues = paramsStr.toQueryParams(); 14933 if (!this.values) { 14934 this.values = {}; 14935 } 14936 for (var i in urlValues) { 14937 this.values[i] = urlValues[i]; 14938 } 14939 } 14940 14941 // Overwrite defaults by inputs values if needed 14942 if (config.inputsInitialized) { 14943 this.values = {}; 14944 this.settings.each(function(element) { 14945 if (element.value) { 14946 var attributeId = element.id.replace(/[a-z]*/, ''); 14947 this.values[attributeId] = element.value; 14948 } 14949 }.bind(this)); 14950 } 14951 14952 // Put events to check select reloads 14953 this.settings.each(function(element){ 14954 Event.observe(element, 'change', this.configure.bind(this)); 14955 }.bind(this)); 14956 14957 // fill state 14958 this.settings.each(function(element){ 14959 var attributeId = element.id.replace(/[a-z]*/, ''); 14960 if(attributeId && this.config.attributes[attributeId]) { 14961 element.config = this.config.attributes[attributeId]; 14962 element.attributeId = attributeId; 14963 this.state[attributeId] = false; 14964 } 14965 }.bind(this)); 14966 14967 // Init settings dropdown 14968 var childSettings = []; 14969 for(var i=this.settings.length-1;i>=0;i--){ 14970 var prevSetting = this.settings[i-1] ? this.settings[i-1] : false; 14971 var nextSetting = this.settings[i+1] ? this.settings[i+1] : false; 14972 if (i == 0){ 14973 this.fillSelect(this.settings[i]); 14974 } else { 14975 this.settings[i].disabled = true; 14976 } 14977 $(this.settings[i]).childSettings = childSettings.clone(); 14978 $(this.settings[i]).prevSetting = prevSetting; 14979 $(this.settings[i]).nextSetting = nextSetting; 14980 childSettings.push(this.settings[i]); 14981 } 14982 14983 // Set values to inputs 14984 this.configureForValues(); 14985 document.observe("dom:loaded", this.configureForValues.bind(this)); 14986 }, 14987 14988 configureForValues: function () { 14989 if (this.values) { 14990 this.settings.each(function(element){ 14991 var attributeId = element.attributeId; 14992 element.value = (typeof(this.values[attributeId]) == 'undefined')? '' : this.values[attributeId]; 14993 this.configureElement(element); 14994 }.bind(this)); 14995 } 14996 }, 14997 14998 configure: function(event){ 14999 var element = Event.element(event); 15000 this.configureElement(element); 15001 }, 15002 15003 configureElement : function(element) { 15004 this.reloadOptionLabels(element); 15005 if(element.value){ 15006 this.state[element.config.id] = element.value; 15007 if(element.nextSetting){ 15008 element.nextSetting.disabled = false;
15009 this.fillSelect(element.nextSetting); 15010 this.resetChildren(element.nextSetting); 15011 } 15012 } 15013 else { 15014 this.resetChildren(element); 15015 } 15016 this.reloadPrice(); 15017 }, 15018 15019 reloadOptionLabels: function(element){ 15020 var selectedPrice; 15021 if(element.options[element.selectedIndex].config && !this.config.stablePrices){ 15022 selectedPrice = parseFloat(element.options[element.selectedIndex].config.price); 15023 } 15024 else{ 15025 selectedPrice = 0; 15026 } 15027 for(var i=0;i<element.options.length;i++){ 15028 if(element.options[i].config){ 15029 element.options[i].text = this.getOptionLabel(element.options[i].config, element.options[i].config.price-selectedPrice); 15030 } 15031 } 15032 }, 15033 15034 resetChildren : function(element){ 15035 if(element.childSettings) { 15036 for(var i=0;i<element.childSettings.length;i++){ 15037 element.childSettings[i].selectedIndex = 0; 15038 element.childSettings[i].disabled = true; 15039 if(element.config){ 15040 this.state[element.config.id] = false; 15041 } 15042 } 15043 } 15044 }, 15045 15046 fillSelect: function(element){ 15047 var attributeId = element.id.replace(/[a-z]*/, ''); 15048 var options = this.getAttributeOptions(attributeId); 15049 this.clearSelect(element); 15050 element.options[0] = new Option('', ''); 15051 element.options[0].innerHTML = this.config.chooseText; 15052 15053 var prevConfig = false; 15054 if(element.prevSetting){ 15055 prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex]; 15056 } 15057 15058 if(options) { 15059 var index = 1; 15060 for(var i=0;i<options.length;i++){ 15061 var allowedProducts = []; 15062 if(prevConfig) { 15063 for(var j=0;j<options[i].products.length;j++){ 15064 if(prevConfig.config.allowedProducts 15065 && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){ 15066 allowedProducts.push(options[i].products[j]); 15067 } 15068 } 15069 } else { 15070 allowedProducts = options[i].products.clone(); 15071 } 15072 15073 if(allowedProducts.size()>0){ 15074 options[i].allowedProducts = allowedProducts; 15075 element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id); 15076 if (typeof options[i].price != 'undefined') { 15077 element.options[index].setAttribute('price', options[i].price); 15078 } 15079 element.options[index].config = options[i]; 15080 index++; 15081 } 15082 } 15083 } 15084 }, 15085 15086 getOptionLabel: function(option, price){ 15087 var price = parseFloat(price); 15088 if (this.taxConfig.includeTax) { 15089 var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax; 15090 var excl = price - tax; 15091 var incl = excl*(1+(this.taxConfig.currentTax/100)); 15092 } else { 15093 var tax = price * (this.taxConfig.currentTax / 100); 15094 var excl = price; 15095 var incl = excl + tax; 15096 } 15097 15098 if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) { 15099 price = incl; 15100 } else { 15101 price = excl; 15102 } 15103 15104 var str = option.label; 15105 if(price){ 15106 if (this.taxConfig.showBothPrices) { 15107 str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')'; 15108 } else { 15109 str+= ' ' + this.formatPrice(price, true); 15110 } 15111 } 15112 return str; 15113 }, 15114 15115 formatPrice: function(price, showSign){ 15116 var str = ''; 15117 price = parseFloat(price); 15118 if(showSign){ 15119 if(price<0){ 15120 str+= '-'; 15121 price = -price; 15122 } 15123 else{ 15124 str+= '+'; 15125 } 15126 } 15127 15128 var roundedPrice = (Math.round(price*100)/100).toString(); 15129 15130 if (this.prices && this.prices[roundedPrice]) { 15131 str+= this.prices[roundedPrice]; 15132 } 15133 else { 15134 str+= this.priceTemplate.evaluate({price:price.toFixed(2)}); 15135 } 15136 return str; 15137 }, 15138 15139 clearSelect: function(element){ 15140 for(var i=element.options.length-1;i>=0;i--){ 15141 element.remove(i); 15142 } 15143 }, 15144 15145 getAttributeOptions: function(attributeId){ 15146 if(this.config.attributes[attributeId]){ 15147 return this.config.attributes[attributeId].options; 15148 } 15149 }, 15150 15151 reloadPrice: function(){ 15152 if (this.config.disablePriceReload) { 15153 return; 15154 } 15155 var price = 0; 15156 var oldPrice = 0; 15157 for(var i=this.settings.length-1;i>=0;i--){ 15158 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 15159 if(selected.config){ 15160 price += parseFloat(selected.config.price); 15161 oldPrice += parseFloat(selected.config.oldPrice); 15162 } 15163 } 15164 15165 optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice}); 15166 optionsPrice.reload(); 15167 15168 return price; 15169 15170 if($('product-price-'+this.config.productId)){ 15171 $('product-price-'+this.config.productId).innerHTML = price; 15172 } 15173 this.reloadOldPrice(); 15174 }, 15175 15176 reloadOldPrice: function(){ 15177 if (this.config.disablePriceReload) { 15178 return; 15179 } 15180 if ($('old-price-'+this.config.productId)) { 15181 15182 var price = parseFloat(this.config.oldPrice); 15183 for(var i=this.settings.length-1;i>=0;i--){ 15184 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 15185 if(selected.config){ 15186 price+= parseFloat(selected.config.price); 15187 } 15188 } 15189 if (price < 0) 15190 price = 0; 15191 price = this.formatPrice(price); 15192 15193 if($('old-price-'+this.config.productId)){ 15194 $('old-price-'+this.config.productId).innerHTML = price; 15195 } 15196 15197 } 15198 } 15199}; 15200 15201/* 15202 * Title: jQuery Etalage plugin 15203 * Author: Berend de Jong, Frique 15204 * Author URI: http://www.frique.me/ 15205 * Version: 1.3.4 (20130622.1) 15206 */ 15207 15208(function($){ 15209 $.fn.etalage = function(options){ 15210 15211 // OPTION DEFAULTS 15212 var o = $.extend({ 15213 align: 'left', // Align of the Etalage container. The zoom area will appear on the opposite side ('left'/'right') 15214 thumb_image_width: 300, // The large thumbnail width (excluding borders / padding) (value in pixels) 15215 thumb_image_height: 400, // The large thumbnail height (excluding borders / padding) (value in pixels) 15216 source_image_width: 900, // The source/zoomed image width (not the frame around it) (value in pixels) 15217 source_image_height: 1200, // The source/zoomed image height (not the frame around it) (value in pixels)
15218 zoom_area_width: 600, // Width of the zoomed image frame (including borders, padding) (value in pixels) 15219 zoom_area_height: 'justify', // Height of the zoomed image frame (including borders, padding) (value in pixels / 'justify' = height of large thumb + small thumbs) 15220 zoom_area_distance: 10, // Distance between the zoom area and thumbnail (value in pixels) 15221 zoom_easing: true, // Ease the animation while moving the zoomed image (true/false) 15222 click_to_zoom: false, // Will start zooming when image is clicked instead of when hovering (when true, click-callback functions are disabled) (true/false) 15223 zoom_element: 'auto', // Supply your custom zoom area element as a CSS type selector ('auto'/'#selector'/'.selector') 15224 zoom_enable: true, 15225 show_descriptions: true, // Shows the description area if a title attribute is given to the source image (true/false) 15226 description_location: 'bottom', // Location of the description area ('top'/'bottom') 15227 description_opacity: 0.7, // Opacity of the description area (except for IE) (number between or equal to 0-1) 15228 small_thumbs: 3, // How many small thumbnails will be visible underneath the large thumbnail (minimum of 3) (number) 15229 small_thumbs_width_offset: 0, 15230 smallthumb_inactive_opacity: 0.4, // Opacity of the inactive small thumbnails (number between or equal to 0-1) 15231 smallthumb_hide_single: true, // Don't show the small thumb when there is only 1 image (true/false) 15232 smallthumb_select_on_hover: false, // This will scroll through the small thumbnails when hovering them, instead of clicking them (true/false) 15233 smallthumbs_position: 'bottom', // Where to position the row of small thumbnails ('top' / 'bottom' / 'left' / 'right') 15234 show_begin_end_smallthumb: true, // Whether to show extra thumbnails at the beginning and the end that navigate back to the end or beginning (true/false) 15235 magnifier_opacity: 0.5, // Opacity of the magnifier area (does not apply if magnifier_invert is true) (number between or equal to 0-1) 15236 magnifier_invert: true, // Make the large thumbnail clear through the magnifier, opaque around it (opacity is the value of magnifier_opacity) (true/false) 15237 show_icon: true, // Shows the icon image in the middle of the magnifier (only if magnifier_invert is false) and left-bottom of large thumb (true/false) 15238 icon_offset: 20, // The icon's offset to the left-bottom corner (value in pixels) 15239 hide_cursor: false, // Hides the cursor when hovering the large thumbnail (only works in some browsers) (true/false) 15240 show_hint: false, // Show "hint" until image is zoomed for the first time (true/false) 15241 hint_offset: 15, // The hint's offset to the right-top corner (value in pixels) 15242 speed: 600, // All animation speeds are based on this setting (value in ms) 15243 autoplay: true, // Makes the thumbs switch automatically when not interacting (at each autoplay_interval below) (true/false) 15244 autoplay_interval: 6000, // Time showing each image if autoplay is on (value in ms) 15245 keyboard: true, // Left/right arrow keys to navigate (true/false) 15246 right_to_left: false, // Makes the thumbnails slide from right to left and the caption texts RTL (true/false) 15247 // Callback functions: // These functions are automatically run when certain events trigger. Assign your own behaviour as a plugin option: 15248 click_callback: function(){ // Provide your own callback for the click event (function). Takes 2 arguments:
15248image_anchor, instance_id 15249 return true; 15250 }, 15251 change_callback: function(){ // Provide your own callback for the change event (thumb switching) (function). Takes 2 arguments: image_anchor, instance_id 15252 return true; 15253 } 15254 }, options); 15255 15256 $.each(this, function(){ 15257 var $container = $(this); 15258 15259 // Verify if this is a UL, has atleast 1 LI and 1 source image 15260 if($container.is('ul') && $container.children('li').length && $container.find('img.etalage_source_image').length){ 15261 15262 var i, j, src, thumb_id, magnifier_opacity, autotimer, description, container_outerwidth, smallthumbs_overflow, css, 15263 instance_id = $container.attr('id'), 15264 faster = Math.floor(o.speed*0.7), 15265 zoom_follow_speed = Math.round(o.speed/100), 15266 st_moving = false, 15267 st_steps = 0, 15268 ie6 = false, 15269 preview = true, 15270 clicked_to_zoom = false, 15271 zoom_move_timer = 0, 15272 cur_zoomx = 0, 15273 cur_zoomy = 0, 15274 new_zoomx = 0, 15275 new_zoomy = 0, 15276 smallthumbs_align = 'hori'; 15277 15278 if(typeof instance_id==='undefined' || !instance_id){ 15279 instance_id = '[no id]'; 15280 } 15281 15282 if(o.smallthumbs_position==='left' || o.smallthumbs_position==='right'){ 15283 smallthumbs_align = 'vert'; 15284 } 15285 15286 // IE specifics 15287 if(typeof $.browser==='object' && $.browser.msie){ 15288 if($.browser.version < 9){ 15289 preview = false; 15290 if($.browser.version < 7){ 15291 ie6 = true; 15292 } 15293 } 15294 } 15295 15296// NEW ELEMENTS & CACHE 15297 $container.addClass('etalage').show(); 15298 var $thumbs; 15299 if($container.children('li').first().hasClass('etalage_thumb')){ 15300 $thumbs = $container.children('li.etalage_thumb'); 15301 }else{ 15302 $thumbs = $container.children('li').addClass('etalage_thumb'); 15303 } 15304 $container.children('li.etalage_thumb_active').hide().removeClass('etalage_thumb_active'); 15305 $thumbs.first().show().addClass('etalage_thumb_active').css('opacity', 1); 15306 15307 var images = $thumbs.length, 15308 autoplay = o.autoplay; 15309 if(images < 2){ 15310 autoplay = false; 15311 } 15312 15313 if(o.align==='right'){ 15314 $container.addClass('etalage_right'); 15315 } 15316 15317 // Add/generate large thumbs (& check for existing thumb/source images) 15318 $.each($thumbs, function(i){ 15319 i += 1; 15320 var $t = $(this), 15321 $t_thumb = $t.find('.etalage_thumb_image').show(), 15322 $t_source = $t.find('.etalage_source_image'), 15323 $t_anchor = $t.find('a'); 15324 $t.data('id', i).addClass('thumb_'+i); 15325 // No thumb, but source 15326 if(!$t_thumb.length && $t_source.length){ 15327 $t.prepend('<img class="etalage_thumb_image" src="'+$t_source.attr('src')+'" />'); 15328 } 15329 // No thumb and no source 15330 else if(!$t_thumb.length && !$t_source.length){ 15331 $t.remove(); 15332 } 15333 // Add anchor data to large thumbnail 15334 if($t_anchor.length){ 15335 $t.find('.etalage_thumb_image').data('anchor', $t_anchor.attr('href')); 15336 } 15337 }); 15338 var $thumb_images = $thumbs.find('.etalage_thumb_image').css({ width:o.thumb_image_width, height:o.thumb_image_height }).show(); 15339 $.each($thumb_images, function(){
15340 $(this).data('src', this.src); 15341 $(this).data('title', this.alt); 15342 }); 15343 15344 // Add magnifier 15345 var $magnifier; 15346 $container.children('li.etalage_magnifier').remove(); 15347 $magnifier = $('<li class="etalage_magnifier"><div><img /></div></li>').appendTo($container); 15348 var $magnifier_img_area = $magnifier.children('div'); 15349 var $magnifier_img = $magnifier_img_area.children('img'); 15350 15351 // Add zoom icon 15352 var $icon; 15353 $container.children('li.etalage_icon').remove(); 15354 $icon = $('<li class="etalage_icon"> </li>').appendTo($container); 15355 if(o.show_icon){ 15356 $icon.show(); 15357 } 15358 15359 // Add hint 15360 var $hint; 15361 if(o.show_hint){ 15362 $container.children('li.etalage_hint').remove(); 15363 $hint = $('<li class="etalage_hint"> </li>').appendTo($container).show(); 15364 } 15365 15366 // Add zoom area 15367 var $zoom, 15368 zoom_element = o.zoom_element; 15369 if(zoom_element!=='auto' && zoom_element && $(zoom_element).length){ 15370 $zoom = $(zoom_element) 15371 .addClass('etalage_zoom_area') 15372 .html('<div><img class="etalage_zoom_img" /></div>'); 15373 }else{ 15374 zoom_element = 'auto'; 15375 $container.children('li.etalage_zoom_area').remove(); 15376 $zoom = $('<li class="etalage_zoom_area"><div><img class="etalage_zoom_img" /></div></li>').appendTo($container); 15377 } 15378 var $zoom_img_area = $zoom.children('div'), 15379 $zoom_preview; 15380 if(preview){ 15381 $zoom_preview = $('<img class="etalage_zoom_preview" />').css({ width:o.source_image_width, height:o.source_image_height, opacity:0.3 }).prependTo($zoom_img_area).show(); 15382 } 15383 var $zoom_img = $zoom_img_area.children('.etalage_zoom_img').css({ width:o.source_image_width, height:o.source_image_height }); 15384 15385 // Add description area 15386 var $description; 15387 if(o.show_descriptions){ 15388 $description = $('<div class="etalage_description'+ ((o.right_to_left)?' rtl':'') +'"></div>').prependTo($zoom); 15389 } 15390 15391 // Add/generate smallthumbs 15392 var $smallthumbs, 15393 $smallthumbs_ul, 15394 $smallthumb, 15395 $smallthumb_images, 15396 smallthumbs, 15397 small_thumbs = o.small_thumbs; 15398 var small_thumbs_width_offset = o.small_thumbs_width_offset; 15399 if(images > 1 || !o.smallthumb_hide_single){ 15400 $container.children('li.etalage_small_thumbs').remove(); 15401 $smallthumbs = $('<li class="etalage_small_thumbs"><ul></ul></li>').appendTo($container); 15402 15403 $smallthumbs_ul = $smallthumbs.children('ul'); 15404 $.each($thumb_images, function(){ 15405 var $t = $(this); 15406 src = $t.data('src'); 15407 title = $t.data('title'); 15408 thumb_id = $t.parents('.etalage_thumb').data('id'); 15409 $('<li title="'+title+'"><img class="etalage_small_thumb" src="'+src+'" /></li>').data('thumb_id', thumb_id).appendTo($smallthumbs_ul); 15410 }); 15411 $smallthumb = $smallthumbs_ul.children('li').css({ opacity:o.smallthumb_inactive_opacity }); 15412 if(small_thumbs < 3){ 15413 small_thumbs = 3; 15414 } 15415 // If more smallthumbs than visible 15416 if(images > small_thumbs){ 15417 // Add extra thumb on each side 15418 if(o.show_begin_end_smallthumb){ 15419 src = $thumb_images.eq(images-1).data('src'); 15420 title = $thumb_images.eq(images-1).data('title'); 15421 thumb_id = $thumbs.eq(images-1).data('id'); 15422 $('<li class="etalage_smallthumb_first etalage_smallthumb_navtoend" title="'+title+'"><img class="etalage_small_thumb" src="'+src+'" /></li>') 15423 .data('src', src) 15424 .data('thumb_id', thumb_id) 15425 .css({ opacity:o.smallthumb_inactive_opacity }) 15426 .prependTo($smallthumbs_ul); 15427 src = $thumb_images.eq(0).data('src'); 15428 title = $thumb_images.eq(0).data('title'); 15429 thumb_id = $thumbs.eq(0).data('id'); 15430 $('<li class="etalage_smallthumb_navtostart" title="'+title+'"><img class="etalage_small_thumb" src="'+src+'" /></li>') 15431 .data('src', src) 15432 .data('thumb_id', thumb_id) 15433 .css({ opacity:o.smallthumb_inactive_opacity }) 15434 .appendTo($smallthumbs_ul); 15435 $smallthumb = $smallthumbs_ul.children('li'); 15436 15437 // Set first active smallthumb 15438 $smallthumb.eq(1).addClass('etalage_smallthumb_active').css({ opacity:1 }); 15439 }else{ 15440 // Set first active smallthumb 15441 $smallthumb.eq(0).addClass('etalage_smallthumb_first etalage_smallthumb_active').css({ opacity:1 }); 15442 } 15443 // Prepare for moving them left/right / up/down 15444 $smallthumb.eq(small_thumbs-1).addClass('etalage_smallthumb_last'); 15445 } 15446 // Smallthumbs are within boundries 15447 else{ 15448 // Set first active smallthumb 15449 $smallthumb.eq(0).addClass('etalage_smallthumb_active').css({ opacity:1 }); 15450 } 15451 // Apply id 15452 $.each($smallthumb, function(i){ 15453 $(this).data('id', (i+1)); 15454 }); 15455 $smallthumb_images = $smallthumb.children('img'); 15456 smallthumbs = $smallthumb.length; 15457 // Vertical 15458 if(smallthumbs_align==='vert'){ 15459 $smallthumb.addClass('vertical'); 15460 } 15461 } 15462 15463// PREPARE 15464 // Magnifier invert option 15465 if(o.magnifier_invert){ 15466 magnifier_opacity = 1; 15467 }else{ 15468 magnifier_opacity = o.magnifier_opacity; 15469 } 15470 15471 // Determine (generated) dimensions 15472 var thumb_border = parseInt($thumbs.css('borderLeftWidth'), 10) + parseInt($thumbs.css('borderRightWidth'), 10) + parseInt($thumb_images.css('borderLeftWidth'), 10) + parseInt($thumb_images.css('borderRightWidth'), 10), 15473 thumb_margin = parseInt($thumbs.css('marginLeft'), 10) + parseInt($thumbs.css('marginRight'), 10), 15474 thumb_padding = parseInt($thumbs.css('paddingLeft'), 10) + parseInt($thumbs.css('paddingRight'), 10) + parseInt($thumb_images.css('marginLeft'), 10) + parseInt($thumb_images.css('marginRight'), 10) + parseInt($thumb_images.css('paddingLeft'), 10) + parseInt($thumb_images.css('paddingRight'), 10), 15475 thumb_outerwidth = o.thumb_image_width+thumb_border+thumb_margin+thumb_padding, 15476 thumb_outerheight = o.thumb_image_height+thumb_border+thumb_margin+thumb_padding, 15477 smallthumb_border = 0, 15478 smallthumb_margin = 0, 15479 smallthumb_padding = 0, 15480 smallthumb_width = 0, 15481 smallthumb_height = 0, 15482 smallthumb_outerwidth = 0, 15483 smallthumb_outerheight = 0; 15484 if(images > 1 || !o.smallthumb_hide_single){ 15485 smallthumb_border = parseInt($smallthumb.css('borderLeftWidth'), 10) + parseInt($smallthumb.css('borderRightWidth'), 10) + parseInt($smallthumb_images.css('borderLeftWidth'), 10) + parseInt($smallthumb_images.css('borderRightWidth'), 10); 15486 smallthumb_margin = parseInt($smallthumb.css('marginTop'), 10); 15487 smallthumb_padding = parseInt($smallthumb.css('paddingLeft'), 10) + parseInt($smallthumb.css('paddingRight'), 10) + parseInt($smallthumb_images.css('marginLeft'), 10) + parseInt($smallthumb_images.css('marginRight'), 10) + parseInt($smallthumb_images.css('paddingLeft'), 10) + parseInt($smallthumb_images.css('paddingRight'), 10); 15488 if(smallthumbs_align==='vert'){ 15489 smallthumb_height = Math.round((thumb_outerheight-((small_thumbs-1)*smallthumb_margin))/small_thumbs) - (smallthumb_border+smallthumb_padding); 15490 smallthumb_width = Math.round((o.thumb_image_width * smallthumb_height) / o.thumb_image_height); 15491 smallthumb_outerwidth = smallthumb_width+smallthumb_border+smallthumb_padding; 15492 smallthumb_outerheight = smallthumb_height+smallthumb_border+smallthumb_padding; 15493 }else{ 15494 smallthumb_width = Math.round((thumb_outerwidth+small_thumbs_width_offset-((small_thumbs-1)*smallthumb_margin))/small_thumbs) - (smallthumb_border+smallthumb_padding); 15495 smallthumb_height = Math.round((o.thumb_image_height * smallthumb_width) / o.thumb_image_width); 15496 smallthumb_outerwidth = smallthumb_width+smallthumb_border+smallthumb_padding; 15497 smallthumb_outerheight = smallthumb_height+smallthumb_border+smallthumb_padding; 15498 } 15499 } 15500 15501 var zoom_border = parseInt($zoom.css('borderTopWidth'), 10), 15502 zoom_margin = parseInt(o.zoom_area_distance, 10), 15503 zoom_padding = parseInt($zoom.css('paddingTop'), 10), 15504 zoom_area_width, 15505 zoom_area_height; 15506 // If source image width is smaller than zoom area 15507 if((o.zoom_area_width - (zoom_border*2) - (zoom_padding*2)) > o.source_image_width){ 15508 zoom_area_width = o.source_image_width; 15509 }else{ 15510 zoom_area_width = o.zoom_area_width - (zoom_border*2) - (zoom_padding*2); 15511 } 15512 if(o.zoom_area_height==='justify'){ 15513 zoom_area_height = (thumb_outerheight+smallthumb_margin+smallthumb_outerheight) - (zoom_border*2) - (zoom_padding*2); 15514 }else{ 15515 zoom_area_height = o.zoom_area_height - (zoom_border*2) - (zoom_padding*2); 15516 } 15517 // If source image height is smaller than zoom area 15518 if(zoom_area_height > o.source_image_height){ 15519 zoom_area_height = o.source_image_height; 15520 } 15521 var description_border, 15522 description_margin, 15523 description_padding, 15524 description_width; 15525 if(o.show_descriptions){ 15526 description_border = parseInt($description.css('borderLeftWidth'), 10) + parseInt($description.css('borderRightWidth'), 10); 15527 description_margin = parseInt($description.css('marginLeft'), 10) + parseInt($description.css('marginRight'), 10); 15528 description_padding = parseInt($description.css('paddingLeft'), 10) + parseInt($description.css('paddingRight'), 10); 15529 description_width = zoom_area_width - description_border - description_margin - description_padding; 15530 } 15531 // Add iframe underlay to resolve IE6 <select> tag bug 15532 var $ie6_iframe_fix; 15533 if(ie6){ 15534 $ie6_iframe_fix = $('<iframe marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="javascript:\'<html></html>\'"></iframe>') 15535 .css({ position:'absolute', zIndex:1 }) 15536 .prependTo($zoom); 15537 } 15538 15539 var magnifier_border = parseInt($magnifier.css('borderTopWidth'), 10), 15540 magnifier_top = parseInt($thumbs.css('borderTopWidth'), 10) + 15541 parseInt($thumbs.css('marginTop'), 10) + 15542 parseInt($thumbs.css('paddingTop'), 10) + 15543 parseInt($thumb_images.css('borderTopWidth'), 10) + 15544 parseInt($thumb_images.css('marginTop'), 10) - 15545 magnifier_border, 15546 magnifier_left = $thumb_images.offset().left - $container.offset().left - magnifier_border; 15547 if(o.smallthumbs_position==='left'){ 15548 magnifier_left = magnifier_left + smallthumb_outerwidth + smallthumb_margin; 15549 }else if(o.smallthumbs_position==='top'){ 15550 magnifier_top = magnifier_top + smallthumb_outerheight + smallthumb_margin; 15551 } 15552 var magnifier_width = Math.round(zoom_area_width*(o.thumb_image_width / o.source_image_width)), 15553 magnifier_height = Math.round(zoom_area_height*(o.thumb_image_height / o.source_image_height)), 15554 magnifier_bottom = magnifier_top + o.thumb_image_height - magnifier_height, 15555 magnifier_right = magnifier_left + o.thumb_image_width - magnifier_width, 15556 magnifier_center_x = Math.round(magnifier_width/2), 15557 magnifier_center_y = Math.round(magnifier_height/2), 15558 hint_top, 15559 hint_right; 15560 if(o.show_hint){ 15561 hint_top = parseInt(o.hint_offset, 10) + parseInt($hint.css('marginTop'), 10); 15562 hint_right = parseInt(o.hint_offset, 10) + parseInt($hint.css('marginRight'), 10); 15563 if(o.smallthumbs_position==='right'){ 15564 hint_right = hint_right-smallthumb_outerwidth-smallthumb_margin; 15565 } 15566 } 15567 15568// RESIZE AND REPOSITION ELEMENTS 15569 // Container 15570 if(smallthumbs_align==='vert'){ 15571 container_outerwidth = thumb_outerwidth+smallthumb_margin+smallthumb_outerwidth; 15572 $container.css({ width:container_outerwidth, height:thumb_outerheight }); 15573 }else{ 15574 container_outerwidth = thumb_outerwidth; 15575 $container.css({ width:container_outerwidth, height:thumb_outerheight+smallthumb_margin+smallthumb_outerheight }); 15576 } 15577 // Icon 15578 if(o.show_icon){ 15579 css = { top:thumb_outerheight - $icon.outerHeight(true) - parseInt(o.icon_offset, 10), left:parseInt(o.icon_offset, 10) }; 15580 if(o.smallthumbs_position==='left'){ 15581 css.left = smallthumb_outerwidth + smallthumb_margin + parseInt(o.icon_offset, 10); 15582 }else if(o.smallthumbs_position==='top'){ 15583 css.top += smallthumb_outerheight + smallthumb_margin; 15584 } 15585 $icon.css(css); 15586 } 15587 // Hint 15588 if(o.show_hint){ 15589 $hint.css({ margin:0, top:-hint_top, right:-hint_right }); 15590 } 15591 // Magnifier 15592 $magnifier_img.css({ margin:0, padding:0, width:o.thumb_image_width, height:o.thumb_image_height }); 15593 $magnifier_img_area.css({ margin:0, padding:0, width:magnifier_width, height:magnifier_height }); 15594 css = { margin:0, padding:0, left:(magnifier_right-magnifier_left)/2, top:(magnifier_bottom-magnifier_top)/2 }; 15595 if(o.smallthumbs_position==='left'){ 15596 css.left = '+=' + smallthumb_outerwidth + smallthumb_margin; 15597 }else if(o.smallthumbs_position==='top'){ 15598 css.top = '+=' + smallthumb_outerheight + smallthumb_margin; 15599
15599} 15600 $magnifier.css(css).hide(); 15601 // Zoom area 15602 $zoom_img_area.css({ width:zoom_area_width, height:zoom_area_height }); 15603 css = { margin:0, opacity:0 }; 15604 if(o.align==='right' && zoom_element==='auto'){ 15605 css.left = -(zoom_area_width + (zoom_border*2) + (zoom_padding*2) + zoom_margin); 15606 }else if(zoom_element==='auto'){ 15607 css.left = container_outerwidth + zoom_margin; 15608 } 15609 $zoom.css(css).hide(); 15610 // Descriptions 15611 if(o.show_descriptions){ 15612 css = { width:description_width, bottom:zoom_padding, left:zoom_padding, opacity:o.description_opacity }; 15613 if(o.description_location==='top'){ 15614 css.top = zoom_padding; 15615 css.bottom = 'auto'; 15616 } 15617 $description.css(css).hide(); 15618 } 15619 // Small thumbs 15620 if(images > 1 || !o.smallthumb_hide_single){ 15621 if(smallthumbs_align==='vert'){ 15622 css = { top:0, height:thumb_outerheight }; 15623 if(o.smallthumbs_position==='left'){ 15624 $thumbs.css({ left:smallthumb_outerwidth+smallthumb_margin }); 15625 }else{ 15626 css.marginLeft = thumb_outerwidth + smallthumb_margin; 15627 } 15628 $smallthumbs.css(css); 15629 $smallthumbs_ul.css({ height:(smallthumb_outerheight*smallthumbs) + (smallthumbs*smallthumb_margin) + 100 }); //100 = some extra to prevent a browser zoom glitch fix 15630 $smallthumb_images.css({ width:smallthumb_width, height:smallthumb_height }).attr('height', smallthumb_height); 15631 $smallthumb.css({ margin:0, marginBottom:smallthumb_margin }); 15632 }else{ 15633 css = { width:thumb_outerwidth+small_thumbs_width_offset, left: (-small_thumbs_width_offset/2) }; 15634 if(o.smallthumbs_position==='top'){ 15635 $thumbs.css({ top:smallthumb_outerheight+smallthumb_margin }); 15636 }else{ 15637 css.top = thumb_outerheight + smallthumb_margin; 15638 } 15639 $smallthumbs.css(css); 15640 $smallthumbs_ul.css({ width:(smallthumb_outerwidth*smallthumbs) + (smallthumbs*smallthumb_margin) + 100 }); //100 = some extra to prevent a browser zoom glitch fix 15641 $smallthumb_images.css({ width:smallthumb_width, height:smallthumb_height }).attr('width', smallthumb_width); 15642 $smallthumb.css({ margin:0, marginRight:smallthumb_margin }); 15643 } 15644 15645 // Smallthumbs overflow fix for unmatching space (width/height of visible smallthumbs + their margins is more than the container width/height: 15646 if(smallthumbs_align==='vert'){ 15647 smallthumbs_overflow = ((smallthumb_outerheight*small_thumbs) + ((small_thumbs-1)*smallthumb_margin)) - thumb_outerheight; 15648 }else{ 15649 smallthumbs_overflow = ((smallthumb_outerwidth*small_thumbs) + ((small_thumbs-1)*smallthumb_margin)) - thumb_outerwidth; 15650 } 15651 // Overflow*1px decrease 15652 if(smallthumbs_overflow > 0){ 15653 // Each set 15654 for(i=1; i<=(smallthumbs-1); i=i+(small_thumbs-1)){ 15655 j=1; 15656 // Each smallthumb 15657 for(j; j<=smallthumbs_overflow; j+=1){ 15658 if(smallthumbs_align==='vert'){ 15659 $smallthumb.eq(i+j-1).css({ marginBottom:(smallthumb_margin-1) }); 15660 }else{ 15661 $smallthumb.eq(i+j-1).css({ marginRight:(smallthumb_margin-1) }); 15662 } 15663 } 15664 } 15665 } 15666 // Overflow*1px increase 15667 else if(smallthumbs_overflow < 0){ 15668 for(i=1; i<=(smallthumbs-1); i=i+(small_thumbs-1)){ 15669 j=1; 15670 // Each smallthumb 15671 for(j; j<=(-smallthumbs_overflow); j+=1){ 15672 if(smallthumbs_align==='vert'){ 15673 $smallthumb.eq(i+j-1).css({ marginBottom:(smallthumb_margin+1) }); 15674 $smallthumbs_ul.css({ height:parseInt($smallthumbs_ul.css('height'), 10)+1 }); 15675 }else{ 15676 $smallthumb.eq(i+j-1).css({ marginRight:(smallthumb_margin+1) }); 15677 $smallthumbs_ul.css({ width:parseInt($smallthumbs_ul.css('width'), 10)+1 }); 15678 } 15679 } 15680 } 15681 } 15682 } 15683 15684 if(o.show_icon && !o.magnifier_invert){ 15685 $magnifier.css({ background:$magnifier.css('background-color')+' '+$icon.css('background-image')+' center no-repeat' }); 15686 } 15687 if(o.hide_cursor){ 15688 $magnifier.add($icon).css({ cursor:'none' }); 15689 } 15690 if(ie6){ 15691 $ie6_iframe_fix.css({ width:$zoom_img_area.css('width'), height:$zoom_img_area.css('height') }); 15692 } 15693 15694// INITIATE FIRST RUN 15695 15696 var $current_thumb = $thumbs.first().find('.etalage_thumb_image'), 15697 $current_source = $thumbs.first().find('.etalage_source_image'); 15698 if(o.magnifier_invert){ 15699 $magnifier_img.attr('src', $current_thumb.data('src')).show(); 15700 } 15701 if(preview){ 15702 $zoom_preview.attr('src', $current_thumb.data('src')); 15703 } 15704 $zoom_img.attr('src', $current_source.attr('src')); 15705 if(o.show_descriptions){ 15706 description = $current_source.attr('title'); 15707 if(description){ 15708 $description.html(description).show(); 15709 } 15710 } 15711 15712// FUNCTIONS 15713 15714 // Autoplay 15715 var stopAutoplay = function(){ 15716 if(autotimer){ 15717 clearInterval(autotimer); 15718 autotimer = false;
15719 } 15720 }; 15721 var startAutoplay = function(){ 15722 if(autotimer){ 15723 stopAutoplay(); 15724 } 15725 autotimer = setInterval(function(){ 15726 next(); 15727 }, o.autoplay_interval); 15728 }; 15729 15730 // Start zooming 15731 var start_zoom = function(){ 15732 if(o.zoom_enable == true){ 15733 $magnifier.stop().fadeTo(faster, magnifier_opacity); 15734 $icon.stop().animate({ opacity:0 }, faster); 15735 $zoom.stop().show().animate({ opacity:1 }, faster); 15736 // Magnifier invert option 15737 if(o.magnifier_invert){ 15738 $current_thumb.stop().animate({ opacity:o.magnifier_opacity }, faster); 15739 } 15740 // Pause autoplay 15741 if(autoplay){ 15742 stopAutoplay(); 15743 } 15744 } 15745 }; 15746 15747 // Stop zooming 15748 var stop_zoom = function(){ 15749 $magnifier.stop().fadeOut(o.speed); 15750 $icon.stop().animate({ opacity:1 }, o.speed); 15751 $zoom.stop().animate({ opacity:0 }, o.speed, function(){ 15752 $(this).hide(); 15753 }); 15754 // Magnifier invert option 15755 if(o.magnifier_invert){ 15756 $current_thumb.stop().animate({ opacity:1 }, o.speed, function(){ 15757 if(o.click_to_zoom){ 15758 clicked_to_zoom = false; 15759 } 15760 }); 15761 } 15762 clearTimeout(zoom_move_timer); 15763 // Restart autoplay 15764 if(autoplay){ 15765 startAutoplay(); 15766 } 15767 }; 15768 15769 // Switch active thumb 15770 var st_click = function($next_active, moved){ 15771 var $next_thumb, 15772 image_number, 15773 $active = $container.find('.etalage_smallthumb_active').removeClass('etalage_smallthumb_active'); 15774 $next_active.addClass('etalage_smallthumb_active'); 15775 // Make sure the magnifier is hidden 15776 $magnifier.stop().hide(); 15777 // Make sure the zoom area is hidden 15778 $zoom.stop().hide(); 15779 // Switch small thumb 15780 if(!moved){ 15781 st_moving = true; 15782 $active.stop(true,true).animate({ opacity:o.smallthumb_inactive_opacity }, faster); 15783 $next_active.stop(true,true).animate({ opacity:1 }, faster, function(){ 15784 st_moving = false; 15785 }); 15786 } 15787 setTimeout(function(){$container.find('.gallery-image').remove();$container.find('.etalage_thumb_image.hide').show().removeClass('hide');}, 500); 15788 // Switch large thumb 15789 $container.find('.etalage_thumb_active').removeClass('etalage_thumb_active').stop().animate({ opacity:0 }, o.speed, function(){ 15790 $(this).hide(); 15791 }); 15792 $next_thumb = $thumbs.filter('.thumb_'+$next_active.data('thumb_id')).addClass('etalage_thumb_active').show().stop().css({ opacity:0 }).animate({ opacity:1 }, o.speed); 15793 $current_thumb = $next_thumb.find('.etalage_thumb_image'); 15794 $current_source = $next_thumb.find('.etalage_source_image'); 15795 // Switch magnifier 15796 if(o.magnifier_invert){ 15797 $magnifier_img.attr('src', $current_thumb.data('src')); 15798 } 15799 // Switch zoom image 15800 if(preview){ 15801 $zoom_preview.attr('src', $current_thumb.data('src')); 15802 } 15803 $zoom_img.attr('src', $current_source.attr('src')); 15804 // Switch/hide/show description 15805 if(o.show_descriptions){ 15806 description = $current_source.attr('title'); 15807 if(description){ 15808 $description.html(description).show(); 15809 }else{ 15810 $description.hide(); 15811 } 15812 } 15813 // Reset autoplay 15814 if(autoplay){ 15815 stopAutoplay(); 15816 startAutoplay(); 15817 } 15818 // Trigger change-callback 15819 image_number = $next_active.data('id'); 15820 if(images >= small_thumbs){ 15821 image_number--; 15822 } 15823 change_callback(image_number); 15824 }; 15825 15826 // Smallthumbs sliding 15827 var st_move = function(distance, $next_first, $next_last, $next_active){ 15828 $.each($smallthumb, function(){ 15829 var $this = $(this), 15830 animation = { 15831 opacity: o.smallthumb_inactive_opacity 15832 }; 15833 if($this.data('id') === $next_active.data('id')){ 15834 animation.opacity = 1; 15835 } 15836 if(smallthumbs_align==='vert'){ 15837 animation.top = '-='+distance; 15838 }else{ 15839 animation.left = '-='+distance; 15840 } 15841 $this.animate(animation, faster, 'swing', function(){ 15842 if(st_moving){ 15843 $next_active.addClass('etalage_smallthumb_active'); 15844 st_moving = false;
15845 } 15846 }); 15847 }); 15848 // Switch thumb 15849 st_click($next_active, true); 15850 }; 15851 15852 // Moving the zoomed image 15853 var zoom_move = function(){ 15854 var diff_x = new_zoomx - cur_zoomx, 15855 diff_y = new_zoomy - cur_zoomy, 15856 movethismuchnow_x = -diff_x / zoom_follow_speed, 15857 movethismuchnow_y = -diff_y / zoom_follow_speed; 15858 cur_zoomx = cur_zoomx - movethismuchnow_x; 15859 cur_zoomy = cur_zoomy - movethismuchnow_y; 15860 if(diff_x < 1 && diff_x > -1){ 15861 cur_zoomx = new_zoomx; 15862 } 15863 if(diff_y < 1 && diff_y > -1){ 15864 cur_zoomy = new_zoomy; 15865 } 15866 // Move a bit 15867 $zoom_img.css({ left:cur_zoomx, top:cur_zoomy }); 15868 if(preview){ 15869 $zoom_preview.css({ left:cur_zoomx, top:cur_zoomy }); 15870 } 15871 // Repeat 15872 if(diff_x > 1 || diff_y > 1 || diff_x < 1 || diff_y < 1){ 15873 zoom_move_timer = setTimeout(function(){ 15874 zoom_move(); 15875 }, 25); 15876 } 15877 }; 15878 15879 // Navigate to previous image 15880 var prev = function(){ 15881 var $prev; 15882 if(o.magnifier_invert){ 15883 $container.find('.etalage_thumb_active').mouseleave(); 15884 } 15885 if(!o.right_to_left){ 15886 $prev = $container.find('.etalage_smallthumb_active').prev(); 15887 if(!$prev.length){ 15888 if(images > small_thumbs){ 15889 st_slide_to_end(); 15890 }else{ 15891 $smallthumb.last().trigger('click'); 15892 } 15893 return true; 15894 } 15895 }else{ 15896 $prev = $container.find('.etalage_smallthumb_active').next(); 15897 if(!$prev.length){ 15898 if(images > small_thumbs){ 15899 st_slide_to_start(); 15900 }else{ 15901 $smallthumb.first().trigger('click'); 15902 } 15903 return true; 15904 } 15905 } 15906 $prev.trigger('click'); 15907 }; 15908 15909 // Navigate to next image 15910 var next = function(){ 15911 var $next; 15912 if(o.magnifier_invert){ 15913 $container.find('.etalage_thumb_active').mouseleave(); 15914 } 15915 if(!o.right_to_left){ 15916 $next = $container.find('.etalage_smallthumb_active').next(); 15917 if(!$next.length){ 15918 if(images > small_thumbs){ 15919 st_slide_to_start(); 15920 }else{ 15921 $smallthumb.first().trigger('click'); 15922 } 15923 return true; 15924 } 15925 }else{ 15926 $next = $container.find('.etalage_smallthumb_active').prev(); 15927 if(!$next.length){ 15928 if(images > small_thumbs){ 15929 st_slide_to_end(); 15930 }else{ 15931 $smallthumb.last().trigger('click'); 15932 } 15933 return true; 15934 } 15935 } 15936 $next.trigger('click'); 15937 }; 15938 15939 // Navigate to specific image 15940 var show = function(number){ 15941 if(images <= small_thumbs || !o.show_begin_end_smallthumb){ 15942 number = number-1; 15943 } 15944 var $number = $smallthumb.eq(number); 15945 if($number.length && !st_moving){ 15946 var $active = $container.find('.etalage_smallthumb_active'), 15947 active = $active.data('id')-1, 15948 difference; 15949 // Move backward 15950 if(active > number){ 15951 st_steps = active - number; 15952 var $first = $container.find('.etalage_smallthumb_first'), 15953 firstid = $first.data('id'); 15954 if(number < firstid){ 15955 difference = active - firstid; 15956 st_steps = st_steps - difference; 15957 $first.trigger('click'); 15958 }else{ 15959 st_click($number, false); 15960 } 15961 } 15962 // Move forward 15963 else if(active < number){ 15964 st_steps = number - active; 15965 var $last = $container.find('.etalage_smallthumb_last'), 15966 lastid = $last.data('id')-1; 15967 if(number >= lastid){ 15968 difference = lastid - active - 1; 15969 st_steps = st_steps - difference; 15970 $last.trigger('click'); 15971 }else{ 15972 st_click($number, false); 15973 } 15974 } 15975 } 15976 }; 15977 15978// EXTERNAL FUNCTIONS 15979 15980 // Navigate to previous image 15981 window[instance_id+'_previous'] = function(){ 15982 prev(); 15983 }; 15984 15985 // Navigate to next image 15986 window[instance_id+'_next'] = function(){ 15987 next(); 15988 }; 15989 15990 // Navigate to specific image 15991 window[instance_id+'_show'] = function(number){ 15992 show(number); 15993 }; 15994 15995// CALLBACK FUNCTIONS 15996 15997 // Thumb click callback 15998 // Return false === do not trigger regular click event 15999 var click_callback = function(image_anchor){ 16000 // Plugin option callback 16001 if(!o.click_callback(image_anchor, instance_id)){ 16002 return false;
16003 } 16004 // Legacy support 16005 if(typeof etalage_click_callback === 'function'){ 16006 etalage_click_callback(image_anchor, instance_id); 16007 return false; 16008 } 16009 return true; 16010 }; 16011 16012 // Thumb switched callback 16013 var change_callback = function(image_number){ 16014 // Plugin option callback 16015 if(o.change_callback(image_number, instance_id)){ 16016 // Legacy support 16017 if(typeof etalage_change_callback === 'function'){ 16018 etalage_change_callback(image_number, instance_id); 16019 } 16020 } 16021 }; 16022 16023// ACTIONS 16024 16025 // Thumb hover 16026 16027 $thumbs.add($magnifier).add($icon).mouseenter(function(){ 16028 // Hide hint 16029 if(o.show_hint){ 16030 $hint.hide(); 16031 } 16032 // Start zooming 16033 if(!o.click_to_zoom || clicked_to_zoom){ 16034 start_zoom(); 16035 } 16036 }).mouseleave(function(){ 16037 stop_zoom(); 16038 }); 16039 16040 // Magnifier movement 16041 var max_zoomx = -(o.source_image_width-zoom_area_width), 16042 max_zoomy = -(o.source_image_height-zoom_area_height); 16043 $thumbs.add($magnifier).add($icon).mousemove(function(e){ 16044 var mouse_x = Math.round( e.pageX - $current_thumb.offset().left + magnifier_left ), 16045 mouse_y = Math.round( e.pageY - $current_thumb.offset().top + magnifier_top ); 16046 16047 // Magnifier location 16048 var new_x = (mouse_x-magnifier_center_x), 16049 new_y = (mouse_y-magnifier_center_y); 16050 if(new_x < magnifier_left){ new_x = magnifier_left; } 16051 if(new_x >
16051 magnifier_right){ new_x = magnifier_right; } 16052 if(new_y < magnifier_top){ new_y = magnifier_top; } 16053 if(new_y > magnifier_bottom){ new_y = magnifier_bottom; } 16054 $magnifier.css({ left:new_x, top:new_y }); 16055 16056 // Magnifier invert option 16057 if(o.magnifier_invert){ 16058 var invert_x = new_x-magnifier_left, 16059 invert_y = new_y-magnifier_top; 16060 $magnifier_img.css({ left:-invert_x, top:-invert_y }); 16061 } 16062 16063 // Zoomed area scrolling 16064 new_zoomx = -( (new_x-magnifier_left) * (1/(o.thumb_image_width/o.source_image_width)) ); 16065 new_zoomy = -( (new_y-magnifier_top) * (1/(o.thumb_image_height/o.source_image_height)) ); 16066 if(new_zoomx < max_zoomx){ new_zoomx = max_zoomx; } 16067 if(new_zoomy < max_zoomy){ new_zoomy = max_zoomy; } 16068 if(o.zoom_easing){ 16069 clearTimeout(zoom_move_timer); 16070 zoom_move(); 16071 } 16072 else{ 16073 if(preview){ 16074 $zoom_preview.css({ left:new_zoomx, top:new_zoomy }); 16075 } 16076 $zoom_img.css({ left:new_zoomx, top:new_zoomy }); 16077 } 16078 }); 16079 16080function st_shift_1(direction){ 16081 st_steps = (st_steps) ? st_steps-1 : 0; 16082 st_moving = true; 16083 var $first = $container.find('.etalage_smallthumb_first').removeClass('etalage_smallthumb_first'); 16084 var $last = $container.find('.etalage_smallthumb_last').removeClass('etalage_smallthumb_last'); 16085 var $next_first, $next_last, $next_active, distance; 16086 if(direction === 'left'){ 16087 $next_first = $first.prev().addClass('etalage_smallthumb_first'); 16088 $next_last = $last.prev().addClass('etalage_smallthumb_last'); 16089 $next_active = $first; 16090 }else{ 16091 $next_first = $first.next().addClass('etalage_smallthumb_first'); 16092 $next_last = $last.next().addClass('etalage_smallthumb_last'); 16093 $next_active = $last; 16094 } 16095 // If more steps 16096 if(st_steps){ 16097 if(direction==='left'){ 16098 $next_first.trigger('click'); 16099 }else{ 16100 $next_last.trigger('click'); 16101 } 16102 } 16103 // Move & select new thumb 16104 else{ 16105 // Get position 16106 distance = (smallthumbs_align==='vert') ? $next_first.position().top : $next_first.position().left; 16107 st_move(distance, $next_first, $next_last, $next_active); 16108 } 16109} 16110function st_slide_to_startend(to){ 16111 st_moving = true; 16112 var $first = $container.find('.etalage_smallthumb_first').removeClass('etalage_smallthumb_first'); 16113 var $last = $container.find('.etalage_smallthumb_last').removeClass('etalage_smallthumb_last'); 16114 var $next_first, $next_last, $next_active; 16115 if(to==='end'){ 16116 $next_first = $smallthumb.eq(smallthumbs-small_thumbs).addClass('etalage_smallthumb_first'); 16117 $next_last = $smallthumb.eq(smallthumbs-1).addClass('etalage_smallthumb_last'); 16118 $next_active = $next_last; 16119 if($next_last.hasClass('etalage_smallthumb_navtostart')){ 16120 $next_active = $next_last.prev(); 16121 } 16122 }else{ 16123 $next_first = $smallthumb.eq(0).addClass('etalage_smallthumb_first'); 16124 $next_last = $smallthumb.eq(small_thumbs-1).addClass('etalage_smallthumb_last'); 16125 $next_active = $next_first; 16126 if($next_first.hasClass('etalage_smallthumb_navtoend')){ 16127 $next_active = $next_first.next(); 16128 } 16129 } 16130 // Get position 16131 var distance = (smallthumbs_align==='vert') ? $next_first.position().top : $next_first.position().left; 16132 // Move & select new thumb 16133 st_move(distance, $next_first, $next_last, $next_active); 16134} 16135function st_slide_to_start(){ 16136 st_slide_to_startend('start'); 16137} 16138function st_slide_to_end(){ 16139 st_slide_to_startend('end'); 16140} 16141 16142 // Smallthumb behaviour 16143 if(images > 1 || !o.smallthumb_hide_single){ 16144 // Smallthumb click event 16145 $smallthumb.click(function(){ 16146 var $this = $(this), 16147 i, 16148 distance = 0, 16149 dont_move = false, 16150 $first, 16151 $last, 16152 $next_first, 16153 $next_last, 16154 $next_active; 16155 // If not active thumb & not already moving 16156 if(!$this.hasClass('etalage_smallthumb_active') && (!st_moving || st_steps)){ 16157 16158 // Slide left / up 16159 if($this.hasClass('etalage_smallthumb_first') && $this.prev().length){ 16160 st_shift_1('left'); 16161 } 16162 // Shift to end 16163 else if($this.hasClass('etalage_smallthumb_navtoend')){ 16164 st_slide_to_end(); 16165 } 16166 16167 // Slide right / down 16168 else if($this.hasClass('etalage_smallthumb_last') && $this.next().length){ 16169 st_shift_1('right'); 16170 } 16171 // Shift to beginning 16172 else if($this.hasClass('etalage_smallthumb_navtostart')){ 16173 st_slide_to_start(); 16174 } 16175 16176 // Regular click without moving smallthumbs 16177 else{ 16178 // If still stepping and this is the last 16179 if(st_steps && !$(this).next().length){ 16180 st_slide_to_end(); 16181 return true; 16182 } 16183 // If still stepping and this is the first 16184 else if(st_steps && !$(this).prev().length){ 16185 st_slide_to_start(); 16186 return true; 16187 } 16188 st_click($this, false); 16189 } 16190 16191 } 16192 }); 16193 16194 // Smallthumb hover 16195 if(o.smallthumb_select_on_hover){ 16196 $smallthumb.mouseenter(function(){ 16197 $(this).trigger('click'); 16198 }); 16199 } 16200 16201 } 16202 16203 // Large thumbnail click to zoom 16204 if(o.click_to_zoom){ 16205 $thumbs.click(function(){ 16206 clicked_to_zoom = true; 16207 start_zoom(); 16208 }); 16209 } 16210 // Large thumbnail click callback 16211 else{ 16212 $magnifier.click(function(){ 16213 var image_anchor = $current_thumb.data('anchor'); 16214 if(image_anchor){ 16215 // Click callback function 16216 if(click_callback(image_anchor)){ 16217 // Regular href action 16218 window.location = image_anchor; 16219 } 16220 } 16221 }); 16222 } 16223 16224 if(images > 1 && o.keyboard){ 16225 // Keystrokes 16226 $(document).keydown(function(e){ 16227 // Right arrow = move right / down 16228 if(e.keyCode===39 || e.keyCode==='39'){ 16229 if(!o.right_to_left){ 16230 next(); 16231 }else{ 16232 prev(); 16233 } 16234 } 16235 // Left arrow = move left / up 16236 if(e.keyCode===37 || e.keyCode==='37'){ 16237 if(!o.right_to_left){ 16238 prev(); 16239 }else{ 16240 next(); 16241 } 16242 } 16243 }); 16244 } 16245 16246 // Remove loading gifs when full page is loaded 16247 $(window).bind('load', function(){ 16248 // Large thumbnail background image 16249 $thumbs.css({ 'background-image':'none' }); 16250 // Zoom background image 16251 $zoom.css({ 'background-image':'none' }); 16252 // Remove zoom preview 16253 if(preview){ 16254 preview = false;
16255 $zoom_preview.remove(); 16256 } 16257 }); 16258 16259 // Initiate first autoplay 16260 if(autoplay){ 16261 startAutoplay(); 16262 } 16263 16264 } 16265 }); 16266 return this; 16267 }; 16268})(jQuery); 16269/*! 16270 Zoom 1.7.14 16271 license: MIT 16272 http://www.jacklmoore.com/zoom 16273*/ 16274(function ($) { 16275 var defaults = { 16276 url: false, 16277 callback: false, 16278 target: false, 16279 duration: 120, 16280 on: 'mouseover', // other options: grab, click, toggle 16281 touch: true, // enables a touch fallback 16282 onZoomIn: false, 16283 onZoomOut: false, 16284 magnify: 1 16285 }; 16286 16287 // Core Zoom Logic, independent of event listeners. 16288 $.zoom = function(target, source, img, magnify) { 16289 var targetHeight, 16290 targetWidth, 16291 sourceHeight, 16292 sourceWidth, 16293 xRatio, 16294 yRatio, 16295 offset, 16296 $target = $(target), 16297 position = $target.css('position'), 16298 $source = $(source); 16299 16300 // The parent element needs positioning so that the zoomed element can be correctly positioned within. 16301 $target.css('position', /(absolute|fixed)/.test(position) ? position : 'relative'); 16302 $target.css('overflow', 'hidden'); 16303 16304 img.style.width = img.style.height = ''; 16305 16306 $(img) 16307 .addClass('zoomImg') 16308 .css({ 16309 position: 'absolute', 16310 top: 0, 16311 left: 0, 16312 opacity: 0, 16313 width: img.width * magnify, 16314 height: img.height * magnify, 16315 border: 'none', 16316 maxWidth: 'none', 16317 maxHeight: 'none' 16318 }) 16319 .appendTo(target); 16320 16321 return { 16322 init: function() { 16323 targetWidth = $target.outerWidth(); 16324 targetHeight = $target.outerHeight(); 16325 16326 if (source === $target[0]) { 16327 sourceWidth = targetWidth; 16328 sourceHeight = targetHeight; 16329 } else { 16330 sourceWidth = $source.outerWidth(); 16331 sourceHeight = $source.outerHeight(); 16332 } 16333 16334 xRatio = (img.width - targetWidth) / sourceWidth; 16335 yRatio = (img.height - targetHeight) / sourceHeight; 16336 16337 offset = $source.offset(); 16338 }, 16339 move: function (e) { 16340 var left = (e.pageX - offset.left), 16341 top = (e.pageY - offset.top); 16342 16343 top = Math.max(Math.min(top, sourceHeight), 0); 16344 left = Math.max(Math.min(left, sourceWidth), 0); 16345 16346 img.style.left = (left * -xRatio) + 'px'; 16347 img.style.top = (top * -yRatio) + 'px'; 16348 } 16349 }; 16350 }; 16351 16352 $.fn.zoom = function (options) { 16353 return this.each(function () { 16354 var 16355 settings = $.extend({}, defaults, options || {}), 16356 //target will display the zoomed image 16357 target = settings.target || this, 16358 //source will provide zoom location info (thumbnail) 16359 source = this, 16360 $source = $(source), 16361 $target = $(target), 16362 img = document.createElement('img'), 16363 $img = $(img), 16364 mousemove = 'mousemove.zoom', 16365 clicked = false, 16366 touched = false, 16367 $urlElement; 16368 16369 // If a url wasn't specified, look for an image element. 16370 if (!settings.url) { 16371 $urlElement = $source.find('img'); 16372 if ($urlElement[0]) { 16373 settings.url = $urlElement.data('src') || $urlElement.attr('src'); 16374 } 16375 if (!settings.url) { 16376 return; 16377 } 16378 } 16379 16380 (function(){ 16381 var position = $target.css('position'); 16382 var overflow = $target.css('overflow'); 16383 16384 $source.one('zoom.destroy', function(){ 16385 $source.off(".zoom"); 16386 $target.css('position', position); 16387 $target.css('overflow', overflow); 16388 $img.remove(); 16389 }); 16390 16391 }()); 16392 16393 img.onload = function () { 16394 var zoom = $.zoom(target, source, img, settings.magnify); 16395 16396 function start(e) { 16397 zoom.init(); 16398 zoom.move(e); 16399 16400 // Skip the fade-in for IE8 and lower since it chokes on fading-in 16401 // and changing position based on mousemovement at the same time. 16402 $img.stop() 16403 .fadeTo($.support.opacity ? settings.duration : 0, 1, $.isFunction(settings.onZoomIn) ? settings.onZoomIn.call(img) : false); 16404 } 16405 16406 function stop() { 16407 $img.stop() 16408 .fadeTo(settings.duration, 0, $.isFunction(settings.onZoomOut) ? settings.onZoomOut.call(img) : false); 16409 } 16410 16411 // Mouse events 16412 if (settings.on === 'grab') { 16413 $source 16414 .on('mousedown.zoom', 16415 function (e) { 16416 if (e.which === 1) { 16417 $(document).one('mouseup.zoom', 16418 function () { 16419 stop(); 16420 16421 $(document).off(mousemove, zoom.move); 16422 } 16423 ); 16424 16425 start(e); 16426 16427 $(document).on(mousemove, zoom.move); 16428 16429 e.preventDefault(); 16430 } 16431 } 16432 ); 16433 } else if (settings.on === 'click') { 16434 $source.on('click.zoom', 16435 function (e) { 16436 if (clicked) { 16437 // bubble the event up to the document to trigger the unbind. 16438 return; 16439 } else { 16440 clicked = true; 16441 start(e); 16442 $(document).on(mousemove, zoom.move); 16443 $(document).one('click.zoom', 16444 function () { 16445 stop(); 16446 clicked = false;
16447 $(document).off(mousemove, zoom.move); 16448 } 16449 ); 16450 return false; 16451 } 16452 } 16453 ); 16454 } else if (settings.on === 'toggle') { 16455 $source.on('click.zoom', 16456 function (e) { 16457 if (clicked) { 16458 stop(); 16459 } else { 16460 start(e); 16461 } 16462 clicked = !clicked; 16463 } 16464 ); 16465 } else if (settings.on === 'mouseover') { 16466 zoom.init(); // Preemptively call init because IE7 will fire the mousemove handler before the hover handler. 16467 16468 $source 16469 .on('mouseenter.zoom', start) 16470 .on('mouseleave.zoom', stop) 16471 .on(mousemove, zoom.move); 16472 } 16473 16474 // Touch fallback 16475 if (settings.touch) { 16476 $source 16477 .on('touchstart.zoom', function (e) { 16478 e.preventDefault(); 16479 if (touched) { 16480 touched = false; 16481 stop(); 16482 } else { 16483 touched = true; 16484 start( e.originalEvent.touches[0] || e.originalEvent.changedTouches[0] ); 16485 } 16486 }) 16487 .on('touchmove.zoom', function (e) { 16488 e.preventDefault(); 16489 zoom.move( e.originalEvent.touches[0] || e.originalEvent.changedTouches[0] ); 16490 }); 16491 } 16492 16493 if ($.isFunction(settings.callback)) { 16494 settings.callback.call(img); 16495 } 16496 }; 16497 16498 img.src = settings.url; 16499 }); 16500 }; 16501 16502 $.fn.zoom.defaults = defaults; 16503}(window.jQuery)); 16504 16505/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) 16506 * Licensed under the MIT License (LICENSE.txt). 16507 * 16508 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 16509 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 16510 * Thanks to: Seamus Leahy for adding deltaX and deltaY 16511 * 16512 * Version: 3.0.6 16513 * 16514 * Requires: 1.2.2+ 16515 */ 16516(function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;b.axis!==void 0&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);b.wheelDeltaY!==void 0&&(g=b.wheelDeltaY/120);b.wheelDeltaX!==void 0&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]= 16517d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,false);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery); 16518/* 16519 * jQuery SelectBox Styler v1.0.1 16520 * http://dimox.name/styling-select-boxes-using-jquery-css/ 16521 * 16522 * Copyright 2012 Dimox (http://dimox.name/) 16523 * Released under the MIT license. 16524 * 16525 * Date: 2012.10.07 16526 * 16527 */ 16528 16529(function($) { 16530 $.fn.selectbox = function(options) { 16531 var settings = $.extend({ styleClass: '' }, options); 16532 $(this).each(function() { 16533 var styleClass = settings.styleClass; 16534 var select = $(this); 16535 if (select.prev('span.selectbox').length < 1) { 16536 function doSelect() { 16537 var option = select.find('option'); 16538 var optionSelected = option.filter(':selected'); 16539 var optionText = option.filter(':first').text(); 16540 if(option.filter(':first').attr('data-image')) 16541 optionText = '<img src="' + option.filter(':first').attr('data-image') + '"/>' + optionText; 16542 16543 if (optionSelected.length){ 16544 optionText = optionSelected.text(); 16545 if(optionSelected.attr('data-image')) 16546 optionText = '<img src="' + optionSelected.attr('data-image') + '"/>' + optionText; 16547 16548 } 16549 16550 var ddlist = ''; 16551 for (i = 0; i < option.length; i++) { 16552 var selected = ''; 16553 var disabled = ' class="disabled"'; 16554 if (option.eq(i).is(':selected')) { 16555 selected = ' class="selected sel"'; 16556 ddlist += '<li' + selected + '><a>' 16557 if(option.eq(i).attr('data-image')) 16558 ddlist += '<img src="' + option.eq(i).attr('data-image') + '"/>'; 16559 ddlist += option.eq(i).text() +'</a></li>'; 16560 } 16561 else 16562 if (option.eq(i).is(':disabled')) { 16563 selected = disabled; 16564 ddlist += '<li' + selected + '><a>'+ option.eq(i).text() +'</a></li>'; 16565 } 16566 else { 16567 ddlist += '<li' + selected + '><a href="'+option.eq(i).val()+'">'; 16568 if(option.eq(i).attr('data-image')) 16569 ddlist += '<img src="' + option.eq(i).attr('data-image') + '"/>'; 16570 ddlist += option.eq(i).html() +'</a></li>'; 16571 } 16572 //ddlist += '<li' + selected + '>'+ option.eq(i).text() +'</li>'; 16573 //ddlist += '<li' + selected + '><a href="'+option.eq(i).val()+'">'+ option.eq(i).html() +'</a></li>'; 16574 } 16575 var selectbox = 16576 $('<span class="selectbox '+styleClass+'" style="display:inline-block;position:relative">'+ 16577 '<div class="select" style="float:left;position:relative;z-index:10000"><div class="text">
16577' + optionText + '</div>'+ 16578 '<b class="trigger"><i class="icon-down-dir"></i></b>'+ 16579 '</div>'+ 16580 '<div class="dropdown" style="position:absolute;z-index:9999;overflow:auto;overflow-x:hidden;list-style:none">'+ 16581 '<ul>' + ddlist + '</ul>'+ 16582 '</div>'+ 16583 '</span>'); 16584 select.before(selectbox).css({position: 'absolute', top: -9999}); 16585 var divSelect = selectbox.find('div.select'); 16586 var divText = selectbox.find('div.text'); 16587 var dropdown = selectbox.find('div.dropdown'); 16588 var li = dropdown.find('li'); 16589 var selectHeight = selectbox.outerHeight(); 16590 if (dropdown.css('left') == 'auto') dropdown.css({left: 0}); 16591 if (dropdown.css('top') == 'auto' || dropdown.css('top') == '0px'){ dropdown.css({top: selectHeight}); } 16592 var liHeight = li.outerHeight(); 16593 var position = dropdown.css('top'); 16594 dropdown.hide(); 16595 dropdown.css('width', dropdown.parent().width()+"px"); 16596 /* пÑи клике на пÑевдоÑелекÑе */ 16597 divSelect.mouseover(function() { 16598 /* Ñмное позиÑиониÑование */ 16599 var topOffset = selectbox.offset().top; 16600 var bottomOffset = $(window).height() - selectHeight - (topOffset - $(window).scrollTop()); 16601 if (bottomOffset < 0 || bottomOffset < liHeight * 6) { 16602 dropdown.height('auto').css({top: 'auto', bottom: position}); 16603 dropdown.addClass('top-dropdown'); 16604 if (dropdown.outerHeight() > topOffset - $(window).scrollTop() - 20 ) { 16605 dropdown.height(Math.floor((topOffset - $(window).scrollTop() - 20) / liHeight) * liHeight); 16606 } 16607 } else if (bottomOffset > liHeight * 6) { 16608 dropdown.height('auto').css({bottom: 'auto', top: position}); 16609 if (dropdown.outerHeight() > bottomOffset - 20 ) { 16610 dropdown.height(Math.floor((bottomOffset - 20) / liHeight) * liHeight); 16611 } 16612 } 16613 dropdown.css('width', dropdown.parent().width()+"px"); 16614 16615 $('span.selectbox').css({zIndex: 1}).removeClass('focused'); 16616 selectbox.css({zIndex: 4}); 16617 if (dropdown.is(':hidden')) { 16618 $('div.dropdown:visible').hide(); 16619 dropdown.fadeIn('fast'); 16620 } 16621 return false; 16622 }); 16623 $('span.selectbox').mouseleave(function(){ 16624 dropdown.fadeOut('fast'); 16625 dropdown.removeClass('top-dropdown'); 16626 return false; 16627 }); 16628 /* пÑи наведении кÑÑÑоÑа на пÑÐ½ÐºÑ ÑпиÑка */ 16629 li.hover(function() { 16630 $(this).siblings().removeClass('selected'); 16631 }); 16632 var selectedText = li.filter('.selected').text(); 16633 /* пÑи клике на пÑÐ½ÐºÑ ÑпиÑка */ 16634 li.filter(':not(.disabled)').click(function() { 16635 var liText = $(this).text(); 16636 if ( selectedText != liText ) { 16637 $(this).addClass('selected sel').siblings().removeClass('selected sel'); 16638 option.removeAttr('selected').eq($(this).index()).attr('selected', true); 16639 selectedText = liText; 16640 divText.text(liText); 16641 select.change(); 16642 } 16643 dropdown.hide(); 16644 }); 16645 dropdown.mouseout(function() { 16646 dropdown.find('li.sel').addClass('selected'); 16647 }); 16648 /* ÑокÑÑ Ð½Ð° ÑелекÑе */ 16649 select.focus(function() { 16650 $('span.selectbox').removeClass('focused'); 16651 selectbox.addClass('focused'); 16652 }) 16653 /* менÑем ÑÐµÐ»ÐµÐºÑ Ñ ÐºÐ»Ð°Ð²Ð¸Ð°ÑÑÑÑ */ 16654 .keyup(function() { 16655 divText.text(option.filter(':selected').text()); 16656 li.removeClass('selected sel').eq(option.filter(':selected').index()).addClass('selected sel'); 16657 }); 16658 /* пÑÑÑем вÑпадаÑÑий ÑпиÑок пÑи клике за пÑеделами ÑелекÑа */ 16659 $(document).on('click', function(e) { 16660 if (!$(e.target).parents().hasClass('selectbox')) { 16661 dropdown.hide().find('li.sel').addClass('selected'); 16662 selectbox.removeClass('focused'); 16663 } 16664 }); 16665 } 16666 doSelect(); 16667 // обновление пÑи динамиÑеÑком изменении 16668 select.on('refresh', function() { 16669 select.prev().remove(); 16670 doSelect(); 16671 }) 16672 } 16673 }); 16674 } 16675})(jQuery) 16676/*! Stellar.js v0.6.2 | Copyright 2014, Mark Dalgleish | http://markdalgleish.com/projects/stellar.js | http://markdalgleish.mit-license.org */ 16677!function(a,b,c,d){function e(b,c){this.element=b,this.options=a.extend({},g,c),this._defaults=g,this._name=f,this.init()}var f="stellar",g={scrollProperty:"scroll",positionProperty:"position",horizontalScrolling:!0,verticalScrolling:!0,horizontalOffset:0,verticalOffset:0,responsive:!1,parallaxBackgroun
16677ds:!0,parallaxElements:!0,hideDistantElements:!0,hideElement:function(a){a.hide()},showElement:function(a){a.show()}},h={scroll:{getLeft:function(a){return a.scrollLeft()},setLeft:function(a,b){a.scrollLeft(b)},getTop:function(a){return a.scrollTop()},setTop:function(a,b){a.scrollTop(b)}},position:{getLeft:function(a){return-1*parseInt(a.css("left"),10)},getTop:function(a){return-1*parseInt(a.css("top"),10)}},margin:{getLeft:function(a){return-1*parseInt(a.css("margin-left"),10)},getTop:function(a){return-1*parseInt(a.css("margin-top"),10)}},transform:{getLeft:function(a){var b=getComputedStyle(a[0])[k];return"none"!==b?-1*parseInt(b.match(/(-?[0-9]+)/g)[4],10):0},getTop:function(a){var b=getComputedStyle(a[0])[k];return"none"!==b?-1*parseInt(b.match(/(-?[0-9]+)/g)[5],10):0}}},i={position:{setLeft:function(a,b){a.css("left",b)},setTop:function(a,b){a.css("top",b)}},transform:{setPosition:function(a,b,c,d,e){a[0].style[k]="translate3d("+(b-c)+"px, "+(d-e)+"px, 0)"}}},j=function(){var b,c=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,d=a("script")[0].style,e="";for(b in d)if(c.test(b)){e=b.match(c)[0];break}return"WebkitOpacity"in d&&(e="Webkit"),"KhtmlOpacity"in d&&(e="Khtml"),function(a){return e+(e.length>0?a.charAt(0).toUpperCase()+a.slice(1):a)}}(),k=j("transform"),l=a("<div />",{style:"background:#fff"}).css("background-position-x")!==d,m=l?function(a,b,c){a.css({"background-position-x":b,"background-position-y":c})}:function(a,b,c){a.css("background-position",b+" "+c)},n=l?function(a){return[a.css("background-position-x"),a.css("background-position-y")]}:function(a){return a.css("background-position").split(" ")},o=b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,1e3/60)};e.prototype={init:function(){this.options.name=f+"_"+Math.floor(1e9*Math.random()),this._defineElements(),this._defineGetters(),this._defineSetters(),this._handleWindowLoadAndResize(),this._detectViewport(),this.refresh({firstLoad:!0}),"scroll"===this.options.scrollProperty?this._handleScrollEvent():this._startAnimationLoop()},_defineElements:function(){this.element===c.body&&(this.element=b),this.$scrollElement=a(this.element),this.$element=this.element===b?a("body"):this.$scrollElement,this.$viewportElement=this.options.viewportElement!==d?a(this.options.viewportElement):this.$scrollElement[0]===b||"scroll"===this.options.scrollProperty?this.$scrollElement:this.$scrollElement.parent()},_defineGetters:function(){var a=this,b=h[a.options.scrollProperty];this._getScrollLeft=function(){return b.getLeft(a.$scrollElement)},this._getScrollTop=function(){return b.getTop(a.$scrollElement)}},_defineSetters:function(){var b=this,c=h[b.options.scrollProperty],d=i[b.options.positionProperty],e=c.setLeft,f=c.setTop;this._setScrollLeft="function"==typeof e?function(a){e(b.$scrollElement,a)}:a.noop,this._setScrollTop="function"==typeof f?function(a){f(b.$scrollElement,a)}:a.noop,this._setPosition=d.setPosition||function(a,c,e,f,g){b.options.horizontalScrolling&&d.setLeft(a,c,e),b.options.verticalScrolling&&d.setTop(a,f,g)}},_handleWindowLoadAndResize:function(){var c=this,d=a(b);c.options.responsive&&d.bind("load."+this.name,function(){c.refresh()}),d.bind("resize."+this.name,function(){c._detectViewport(),c.options.responsive&&c.refresh()})},refresh:function(c){var d=this,e=d._getScrollLeft(),f=d._getScrollTop();c&&c.firstLoad||this._reset(),this._setScrollLeft(0),this._setScrollTop(0),this._setOffsets(),this._findParticles(),this._findBackgrounds(),c&&c.firstLoad&&/WebKit/.test(navigator.userAgent)&&a(b).load(function(){var a=d._getScrollLeft(),b=d._getScrollTop();d._setScrollLeft(a+1),d._setScrollTop(b+1),d._setScrollLeft(a),d._setScrollTop(b)}),this._setScrollLeft(e),this._setScrollTop(f)},_detectViewport:function(){var a=this.$viewportElement.offset(),b=null!==a&&a!==d;this.viewportWidth=this.$viewportElement.width(),this.viewportHeight=this.$viewportElement.height(),this.viewportOffsetTop=b?a.top:0,this.viewportOffsetLeft=b?a.left:0},_findParticles:function(){{var b=this;this._getScrollLeft(),this._getScrollTop()}if(this.particles!==d)for(var c=this.particles.length-1;c>=0;c--)this.particles[c].$element.data("stellar-elementIsActive",d);this.particles=[],this.options.parallaxElements&&this.$element.find("[data-stellar-ratio]").each(function(){var c,e,f,g,h,i,j,k,l,m=a(this),n=0,o=0,p=0,q=0;if(m.data("stellar-elementIsActive")){if(m.data("stellar-elementIsActive")!==this)return}else m.data("stellar-elementIsActive",this);b.options.showElement(m),m.data("stellar-startingLeft")?(m.css("left",m.data("stellar-startingLeft")),m.css("top",m.data("stellar-startingTop"))):(m.data("stellar-startingLeft",m.css("left")),m.data("stellar-startingTop",m.css("top"))),f=m.position().left,g=m.position().top,h="auto"===m.css("margin-left")?0:parseInt(m.css("margin-left"),10),i="auto"===m.css("margin-top")?0:parseInt(m.css("margin-top"),10),k=m.offset().left-h,l=m.offset().top-i,m.parents().each(function(){var b=a(this);return b.data("stellar-offset-parent")===!0?(n=p,o=q,j=b,!1):(p+=b.position().left,void(q+=b.position().top))}),c=m.data("stellar-horizontal-offset")!==d?m.data("stellar-horizontal-offset"):j!==d&&j.data("stellar-horizontal-offset")!==d?j.data("stellar-horizontal-offset"):b.horizontalOffset,e=m.data("stellar-vertical-offset")!==d?m.data("stellar-vertical-offset"):j!==d&&j.data("stellar-vertical-offset")!==d?j.data("stellar-vertical-offset"):b.verticalOffset,b.particles.push({$element:m,$offsetParent:j,isFixed:"fixed"===m.css("position"),horizontalOffset:c,verticalOffset:e,startingPositionLeft:f,startingPositionTop:g,
16677startingOffsetLeft:k,startingOffsetTop:l,parentOffsetLeft:n,parentOffsetTop:o,stellarRatio:m.data("stellar-ratio")!==d?m.data("stellar-ratio"):1,width:m.outerWidth(!0),height:m.outerHeight(!0),isHidden:!1})})},_findBackgrounds:function(){var b,c=this,e=this._getScrollLeft(),f=this._getScrollTop();this.backgrounds=[],this.options.parallaxBackgrounds&&(b=this.$element.find("[data-stellar-background-ratio]"),this.$element.data("stellar-background-ratio")&&(b=b.add(this.$element)),b.each(function(){var b,g,h,i,j,k,l,o=a(this),p=n(o),q=0,r=0,s=0,t=0;if(o.data("stellar-backgroundIsActive")){if(o.data("stellar-backgroundIsActive")!==this)return}else o.data("stellar-backgroundIsActive",this);o.data("stellar-backgroundStartingLeft")?m(o,o.data("stellar-backgroundStartingLeft"),o.data("stellar-backgroundStartingTop")):(o.data("stellar-backgroundStartingLeft",p[0]),o.data("stellar-backgroundStartingTop",p[1])),h="auto"===o.css("margin-left")?0:parseInt(o.css("margin-left"),10),i="auto"===o.css("margin-top")?0:parseInt(o.css("margin-top"),10),j=o.offset().left-h-e,k=o.offset().top-i-f,o.parents().each(function(){var b=a(this);return b.data("stellar-offset-parent")===!0?(q=s,r=t,l=b,!1):(s+=b.position().left,void(t+=b.position().top))}),b=o.data("stellar-horizontal-offset")!==d?o.data("stellar-horizontal-offset"):l!==d&&l.data("stellar-horizontal-offset")!==d?l.data("stellar-horizontal-offset"):c.horizontalOffset,g=o.data("stellar-vertical-offset")!==d?o.data("stellar-vertical-offset"):l!==d&&l.data("stellar-vertical-offset")!==d?l.data("stellar-vertical-offset"):c.verticalOffset,c.backgrounds.push({$element:o,$offsetParent:l,isFixed:"fixed"===o.css("background-attachment"),horizontalOffset:b,verticalOffset:g,startingValueLeft:p[0],startingValueTop:p[1],startingBackgroun
16677dPositionLeft:isNaN(parseInt(p[0],10))?0:parseInt(p[0],10),startingBackgroundPositionTop:isNaN(parseInt(p[1],10))?0:parseInt(p[1],10),startingPositionLeft:o.position().left,startingPositionTop:o.position().top,startingOffsetLeft:j,startingOffsetTop:k,parentOffsetLeft:q,parentOffsetTop:r,stellarRatio:o.data("stellar-background-ratio")===d?1:o.data("stellar-background-ratio")})}))},_reset:function(){var a,b,c,d,e;for(e=this.particles.length-1;e>=0;e--)a=this.particles[e],b=a.$element.data("stellar-startingLeft"),c=a.$element.data("stellar-startingTop"),this._setPosition(a.$element,b,b,c,c),this.options.showElement(a.$element),a.$element.data("stellar-startingLeft",null).data("stellar-elementIsActive",null).data("stellar-backgroundIsActive",null);for(e=this.backgrounds.length-1;e>=0;e--)d=this.backgrounds[e],d.$element.data("stellar-backgroundStartingLeft",null).data("stellar-backgroundStartingTop",null),m(d.$element,d.startingValueLeft,d.startingValueTop)},destroy:function(){this._reset(),this.$scrollElement.unbind("resize."+this.name).unbind("scroll."+this.name),this._animationLoop=a.noop,a(b).unbind("load."+this.name).unbind("resize."+this.name)},_setOffsets:function(){var c=this,d=a(b);d.unbind("resize.horizontal-"+this.name).unbind("resize.vertical-"+this.name),"function"==typeof this.options.horizontalOffset?(this.horizontalOffset=this.options.horizontalOffset(),d.bind("resize.horizontal-"+this.name,function(){c.horizontalOffset=c.options.horizontalOffset()})):this.horizontalOffset=this.options.horizontalOffset,"function"==typeof this.options.verticalOffset?(this.verticalOffset=this.options.verticalOffset(),d.bind("resize.vertical-"+this.name,function(){c.verticalOffset=c.options.verticalOffset()})):this.verticalOffset=this.options.verticalOffset},_repositionElements:function(){var a,b,c,d,e,f,g,h,i,j,k=this._getScrollLeft(),l=this._getScrollTop(),n=!0,o=!0;if(this.currentScrollLeft!==k||this.currentScrollTop!==l||this.currentWidth!==this.viewportWidth||this.currentHeight!==this.viewportHeight){for(this.currentScrollLeft=k,this.currentScrollTop=l,this.currentWidth=this.viewportWidth,this.currentHeight=this.viewportHeight,j=this.particles.length-1;j>=0;j--)a=this.particles[j],b=a.isFixed?1:0,this.options.horizontalScrolling?(f=(k+a.horizontalOffset+this.viewportOffsetLeft+a.startingPositionLeft-a.startingOffsetLeft+a.parentOffsetLeft)*-(a.stellarRatio+b-1)+a.startingPositionLeft,h=f-a.startingPositionLeft+a.startingOffsetLeft):(f=a.startingPositionLeft,h=a.startingOffsetLeft),this.options.verticalScrolling?(g=(l+a.verticalOffset+this.viewportOffsetTop+a.startingPositionTop-a.startingOffsetTop+a.parentOffsetTop)*-(a.stellarRatio+b-1)+a.startingPositionTop,i=g-a.startingPositionTop+a.startingOffsetTop):(g=a.startingPositionTop,i=a.startingOffsetTop),this.options.hideDistantElements&&(o=!this.options.horizontalScrolling||h+a.width>(a.isFixed?0:k)&&h<(a.isFixed?0:k)+this.viewportWidth+this.viewportOffsetLeft,n=!this.options.verticalScrolling||i+a.height>(a.isFixed?0:l)&&i<(a.isFixed?0:l)+this.viewportHeight+this.viewportOffsetTop),o&&n?(a.isHidden&&(this.options.showElement(a.$element),a.isHidden=!1),this._setPosition(a.$element,f,a.startingPositionLeft,g,a.startingPositionTop)):a.isHidden||(this.options.hideElement(a.$element),a.isHidden=!0);for(j=this.backgrounds.length-1;j>=0;j--)c=this.backgrounds[j],b=c.isFixed?0:1,d=this.options.horizontalScrolling?(k+c.horizontalOffset-this.viewportOffsetLeft-c.startingOffsetLeft+c.parentOffsetLeft-c.startingBackgroun
16677dPositionLeft)*(b-c.stellarRatio)+"px":c.startingValueLeft,e=this.options.verticalScrolling?(l+c.verticalOffset-this.viewportOffsetTop-c.startingOffsetTop+c.parentOffsetTop-c.startingBackgroundPositionTop)*(b-c.stellarRatio)+"px":c.startingValueTop,m(c.$element,d,e)}},_handleScrollEvent:function(){var a=this,b=!1,c=function(){a._repositionElements(),b=!1},d=function(){b||(o(c),b=!0)};this.$scrollElement.bind("scroll."+this.name,d),d()},_startAnimationLoop:function(){var a=this;this._animationLoop=function(){o(a._animationLoop),a._repositionElements()},this._animationLoop()}},a.fn[f]=function(b){var c=arguments;return b===d||"object"==typeof b?this.each(function(){a.data(this,"plugin_"+f)||a.data(this,"plugin_"+f,new e(this,b))}):"string"==typeof b&&"_"!==b[0]&&"init"!==b?this.each(function(){var d=a.data(this,"plugin_"+f);d instanceof e&&"function"==typeof d[b]&&d[b].apply(d,Array.prototype.slice.call(c,1)),"destroy"===b&&a.data(this,"plugin_"+f,null)}):void 0},a[f]=function(){var c=a(b);return c.stellar.apply(c,Array.prototype.slice.call(arguments,0))},a[f].scrollProperty=h,a[f].positionProperty=i,b.Stellar=e}(jQuery,this,document); 16678/* 16679Plugin: jQuery Parallax 16680Version 1.1.3 16681Author: Ian Lunn 16682Twitter: @IanLunn 16683Author URL: http://www.ianlunn.co.uk/ 16684Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/ 16685 16686Dual licensed under the MIT and GPL licenses: 16687http://www.opensource.org/licenses/mit-license.php 16688http://www.gnu.org/licenses/gpl.html 16689*/ 16690 16691(function( $ ){ 16692 var $window = $(window); 16693 var windowHeight = $window.height(); 16694 16695 $window.resize(function () { 16696 windowHeight = $window.height(); 16697 }); 16698 16699 $.fn.parallax = function(xpos, speedFactor, firstTop, outerHeight) { 16700 var $this = $(this); 16701 var getHeight; 16702 var paddingTop = 0; 16703 16704 //get the starting position of each element to have parallax applied to it 16705 if(firstTop == null){ 16706 $this.each(function(){ 16707 firstTop = $this.offset().top; 16708 }); 16709 } 16710 if (outerHeight) { 16711 getHeight = function(jqo) { 16712 return jqo.outerHeight(true); 16713 }; 16714 } else { 16715 getHeight = function(jqo) { 16716 return jqo.height(); 16717 }; 16718 } 16719 16720 // setup defaults if arguments aren't specified 16721 if (arguments.length < 1 || xpos === null) xpos = "50%"; 16722 if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; 16723 if (arguments.length < 3 || outerHeight === null) outerHeight = true; 16724 16725 // function to be called whenever the window is scrolled or resized 16726 function update(){ 16727 var pos = $window.scrollTop(); 16728 16729 $this.each(function(){ 16730 var $element = $(this); 16731 var top = $element.offset().top; 16732 var height = getHeight($element); 16733 16734 // Check if totally above or totally below viewport 16735 if (top + height < pos || top > pos + windowHeight) { 16736 return; 16737 } 16738 16739 $this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px"); 16740 }); 16741 } 16742 16743 $window.bind('scroll', update).resize(update); 16744 update(); 16745 }; 16746})(jQuery); 16747 16748/*! 16749 * jQuery Cookie Plugin v1.4.1 16750 * https://github.com/carhartl/jquery-cookie 16751 * 16752 * Copyright 2013 Klaus Hartl 16753 * Released under the MIT license 16754 */ 16755(function (factory) { 16756 if (typeof define === 'function' && define.amd) { 16757 // AMD 16758 define(['jquery'], factory); 16759 } else if (typeof exports === 'object') { 16760 // CommonJS 16761 factory(require('jquery')); 16762 } else { 16763 // Browser globals 16764 factory(jQuery); 16765 } 16766}(function ($) { 16767 16768 var pluses = /\+/g; 16769 16770 function encode(s) { 16771 return config.raw ? s : encodeURIComponent(s); 16772 } 16773 16774 function decode(s) { 16775 return config.raw ? s : decodeURIComponent(s); 16776 } 16777 16778 function stringifyCookieValue(value) { 16779 return encode(config.json ? JSON.stringify(value) : String(value)); 16780 } 16781 16782 function parseCookieValue(s) { 16783 if (s.indexOf('"') === 0) { 16784 // This is a quoted cookie as according to RFC2068, unescape... 16785 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 16786 } 16787 16788 try { 16789 // Replace server-side written pluses with spaces. 16790 // If we can't decode the cookie, ignore it, it's unusable. 16791 // If we can't parse the cookie, ignore it, it's unusable. 16792 s = decodeURIComponent(s.replace(pluses, ' ')); 16793 return config.json ? JSON.parse(s) : s; 16794 } catch(e) {} 16795 } 16796 16797 function read(s, converter) { 16798 var value = config.raw ? s : parseCookieValue(s); 16799 return $.isFunction(converter) ? converter(value) : value; 16800 } 16801 16802 var config = $.cookie = function (key, value, options) { 16803 16804 // Write 16805 16806 if (value !== undefined && !$.isFunction(value)) { 16807 options = $.extend({}, config.defaults, options); 16808 16809 if (typeof options.expires === 'number') { 16810 var days = options.expires, t = options.expires = new Date(); 16811 t.setTime(+t + days * 864e+5); 16812 } 16813 16814 return (document.cookie = [ 16815 encode(key), '=', stringifyCookieValue(value), 16816 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 16817 options.path ? '; path=' + options.path : '', 16818 options.domain ? '; domain=' + options.domain : '', 16819 options.secure ? '; secure' : '' 16820 ].join('')); 16821 } 16822 16823 // Read 16824 16825 var result = key ? undefined : {}; 16826 16827 // To prevent the for loop in the first place assign an empty array 16828 // in case there are no cookies at all. Also prevents odd result when 16829 // calling $.cookie(). 16830 var cookies = document.cookie ? document.cookie.split('; ') : []; 16831 16832 for (var i = 0, l = cookies.length; i < l; i++) { 16833 var parts = cookies[i].split('='); 16834 var name = decode(parts.shift()); 16835 var cookie = parts.join('='); 16836 16837 if (key && key === name) { 16838 // If second argument (value) is a function it's a converter... 16839 result = read(cookie, value); 16840 break; 16841 } 16842 16843 // Prevent storing a cookie that we couldn't decode. 16844 if (!key && (cookie = read(cookie)) !== undefined) { 16845 result[name] = cookie; 16846 } 16847 } 16848 16849 return result; 16850 }; 16851 16852 config.defaults = {}; 16853 16854 $.removeCookie = function (key, options) { 16855 if ($.cookie(key) === undefined) { 16856 return false;
16857 } 16858 16859 // Must not alter options, thus extending a fresh object... 16860 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 16861 return !$.cookie(key); 16862 }; 16863 16864})); 16865 16866if(typeof Object.create!=="function"){Object.create=function(e){function t(){}t.prototype=e;return new t}}(function(e,t,n){var r={init:function(t,n){var r=this;r.$elem=e(n);r.options=e.extend({},e.fn.owlCarousel.options,r.$elem.data(),t);r.userOptions=t;r.loadContent()},loadContent:function(){function r(e){var n,r="";if(typeof t.options.jsonSuccess==="function"){t.options.jsonSuccess.apply(this,[e])}else{for(n in e.owl){if(e.owl.hasOwnProperty(n)){r+=e.owl[n].item}}t.$elem.html(r)}t.logIn()}var t=this,n;if(typeof t.options.beforeInit==="function"){t.options.beforeInit.apply(this,[t.$elem])}if(typeof t.options.jsonPath==="string"){n=t.options.jsonPath;e.getJSON(n,r)}else{t.logIn()}},logIn:function(){var e=this;e.$elem.data("owl-originalStyles",e.$elem.attr("style")).data("owl-originalClasses",e.$elem.attr("class"));e.$elem.css({opacity:0});e.orignalItems=e.options.items;e.checkBrowser();e.wrapperWidth=0;e.checkVisible=null;e.setVars()},setVars:function(){var e=this;if(e.$elem.children().length===0){return false}e.baseClass();e.eventTypes();e.$userItems=e.$elem.children();e.itemsAmount=e.$userItems.length;e.wrapItems();e.$owlItems=e.$elem.find(".owl-item");e.$owlWrapper=e.$elem.find(".owl-wrapper");e.playDirection="next";e.prevItem=0;e.prevArr=[0];e.currentItem=0;e.customEvents();e.onStartup()},onStartup:function(){var e=this;e.updateItems();e.calculateAll();e.buildControls();e.updateControls();e.response();e.moveEvents();e.stopOnHover();e.owlStatus();if(e.options.transitionStyle!==false){e.transitionTypes(e.options.transitionStyle)}if(e.options.autoPlay===true){e.options.autoPlay=5e3}e.play();e.$elem.find(".owl-wrapper").css("display","block");if(!e.$elem.is(":visible")){e.watchVisibility()}else{e.$elem.css("opacity",1)}e.onstartup=false;e.eachMoveUpdate();if(typeof e.options.afterInit==="function"){e.options.afterInit.apply(this,[e.$elem])}},eachMoveUpdate:function(){var e=this;if(e.options.lazyLoad===true){e.lazyLoad()}if(e.options.autoHeight===true){e.autoHeight()}e.onVisibleItems();if(typeof e.options.afterAction==="function"){e.options.afterAction.apply(this,[e.$elem])}}
16866,updateVars:function(){var e=this;if(typeof e.options.beforeUpdate==="function"){e.options.beforeUpdate.apply(this,[e.$elem])}e.watchVisibility();e.updateItems();e.calculateAll();e.updatePosition();e.updateControls();e.eachMoveUpdate();if(typeof e.options.afterUpdate==="function"){e.options.afterUpdate.apply(this,[e.$elem])}},reload:function(){var e=this;t.setTimeout(function(){e.updateVars()},0)},watchVisibility:function(){var e=this;if(e.$elem.is(":visible")===false){e.$elem.css({opacity:0});t.clearInterval(e.autoPlayInterval);t.clearInterval(e.checkVisible)}else{return false}e.checkVisible=t.setInterval(function(){if(e.$elem.is(":visible")){e.reload();e.$elem.animate({opacity:1},200);t.clearInterval(e.checkVisible)}},500)},wrapItems:function(){var e=this;e.$userItems.wrapAll('<div class="owl-wrapper">').wrap('<div class="owl-item"></div>');e.$elem.find(".owl-wrapper").wrap('<div class="owl-wrapper-outer">');e.wrapperOuter=e.$elem.find(".owl-wrapper-outer");e.$elem.css("display","block")},baseClass:function(){var e=this,t=e.$elem.hasClass(e.options.baseClass),n=e.$elem.hasClass(e.options.theme);if(!t){e.$elem.addClass(e.options.baseClass)}if(!n){e.$elem.addClass(e.options.theme)}},updateItems:function(){var t=this,n,r;if(t.options.responsive===false){return false}if(t.options.singleItem===true){t.options.items=t.orignalItems=1;t.options.itemsCustom=false;t.options.itemsDesktop=false;t.options.itemsDesktopSmall=false;t.options.itemsTablet=false;t.options.itemsTabletSmall=false;t.options.itemsMobile=false;return false}n=e(t.options.responsiveBaseWidth).width();if(n>(t.options.itemsDesktop[0]||t.orignalItems)){t.options.items=t.orignalItems}if(t.options.itemsCustom!==false){t.options.itemsCustom.sort(function(e,t){return e[0]-t[0]});for(r=0;r<t.options.itemsCustom.length;r+=1){if(t.options.itemsCustom[r][0]<=n){t.options.items=t.options.itemsCustom[r][1]}}}else{if(n<=t.options.itemsDesktop[0]&&t.options.itemsDesktop!==false){t.options.items=t.options.itemsDesktop[1]}if(n<=t.options.itemsDesktopSmall[0]&&t.options.itemsDesktopSmall!==false){t.options.items=t.options.itemsDesktopSmall[1]}if(n<=t.options.itemsTablet[0]&&t.options.itemsTablet!==false){t.options.items=t.options.itemsTablet[1]}if(n<=t.options.itemsTabletSmall[0]&&t.options.itemsTabletSmall!==false){t.options.items=t.options.itemsTabletSmall[1]}if(n<=t.options.itemsMobile[0]&&t.options.itemsMobile!==false){t.options.items=t.options.itemsMobile[1]}}if(t.options.items>t.itemsAmount&&t.options.itemsScaleUp===true){t.options.items=t.itemsAmount}},response:function(){var n=this,r,i;if(n.options.responsive!==true){return false}i=e(t).width();n.resizer=function(){if(e(t).width()!==i){if(n.options.autoPlay!==false){t.clearInterval(n.autoPlayInterval)}t.clearTimeout(r);r=t.setTimeout(function(){i=e(t).width();n.updateVars()},n.options.responsiveRefreshRate)}};e(t).resize(n.resizer)},updatePosition:function(){var e=this;e.jumpTo(e.currentItem);if(e.options.autoPlay!==false){e.checkAp()}},appendItemsSizes:function(){var t=this,n=0,r=t.itemsAmount-t.options.items;t.$owlItems.each(function(i){var s=e(this);s.css({width:t.itemWidth}).data("owl-item",Number(i));if(i%t.options.items===0||i===r){if(!(i>r)){n+=1}}s.data("owl-roundPages",n)})},appendWrapperSizes:function(){var e=this,t=e.$owlItems.length*e.itemWidth;e.$owlWrapper.css({width:t*2,left:0});e.appendItemsSizes()},calculateAll:function(){var e=this;e.calculateWidth();e.appendWrapperSizes();e.loops();e.max()},calculateWidth:function(){var e=this;e.itemWidth=Math.round(e.$elem.width()/e.options.items)},max:function(){var e=this,t=(e.itemsAmount*e.itemWidth-e.options.items*e.itemWidth)*-1;if(e.options.items>e.itemsAmount){e.maximumItem=0;t=0;e.maximumPixels=0}else{e.maximumItem=e.itemsAmount-e.options.items;e.maximumPixels=t}return t},min:function(){return 0},loops:function(){var t=this,n=0,r=0,i,s,o;t.positionsInArray=[0];t.pagesInArray=[];for(i=0;i<t.itemsAmount;i+=1){r+=t.itemWidth;t.positionsInArray.push(-r);if(t.options.scrollPerPage===true){s=e(t.$owlItems[i]);o=s.data("owl-roundPages");if(o!==n){t.pagesInArray[n]=t.positionsInArray[i];n=o}}}},buildControls:function(){var t=this;if(t.options.navigation===true||t.options.pagination===true){t.owlControls=e('<div class="owl-control
16866s"/>').toggleClass("clickable",!t.browser.isTouch).appendTo(t.$elem)}if(t.options.pagination===true){t.buildPagination()}if(t.options.navigation===true){t.buildButtons()}},buildButtons:function(){var t=this,n=e('<div class="owl-buttons"/>');t.owlControls.append(n);t.buttonPrev=e("<div/>",{"class":"owl-prev",html:t.options.navigationText[0]||""});t.buttonNext=e("<div/>",{"class":"owl-next",html:t.options.navigationText[1]||""});n.append(t.buttonPrev).append(t.buttonNext);n.on("touchstart.owlControls mousedown.owlControls",'div[class^="owl"]',function(e){e.preventDefault()});n.on("touchend.owlControls mouseup.owlControls",'div[class^="owl"]',function(n){n.preventDefault();if(e(this).hasClass("owl-next")){t.next()}else{t.prev()}})},buildPagination:function(){var t=this;t.paginationWrapper=e('<div class="owl-pagination"/>');t.owlControls.append(t.paginationWrapper);t.paginationWrapper.on("touchend.owlControls mouseup.owlControls",".owl-page",function(n){n.preventDefault();if(Number(e(this).data("owl-page"))!==t.currentItem){t.goTo(Number(e(this).data("owl-page")),true)}})},updatePagination:function(){var t=this,n,r,i,s,o,u;if(t.options.pagination===false){return false}t.paginationWrapper.html("");n=0;r=t.itemsAmount-t.itemsAmount%t.options.items;for(s=0;s<t.itemsAmount;s+=1){if(s%t.options.items===0){n+=1;if(r===s){i=t.itemsAmount-t.options.items}o=e("<div/>",{"class":"owl-page"});u=e("<span></span>",{text:t.options.paginationNumbers===true?n:"","class":t.options.paginationNumbers===true?"owl-numbers":""});o.append(u);o.data("owl-page",r===s?i:s);o.data("owl-roundPages",n);t.paginationWrapper.append(o)}}t.checkPagination()},checkPagination:function(){var t=this;if(t.options.pagination===false){return false}t.paginationWrapper.find(".owl-page").each(function(){if(e(this).data("owl-roundPages")===e(t.$owlItems[t.currentItem]).data("owl-roundPages")){t.paginationWrapper.find(".owl-page").removeClass("active");e(this).addClass("active")}})},checkNavigation:function(){var e=this;if(e.options.navigation===false){return false}if(e.options.rewindNav===false){if(e.currentItem===0&&e.maximumItem===0){e.buttonPrev.addClass("disabled");e.buttonNext.addClass("disabled")}else if(e.currentItem===0&&e.maximumItem!==0){e.buttonPrev.addClass("disabled");e.buttonNext.removeClass("disabled")}else if(e.currentItem===e.maximumItem){e.buttonPrev.removeClass("disabled");e.buttonNext.addClass("disabled")}else if(e.currentItem!==0&&e.currentItem!==e.maximumItem){e.buttonPrev.removeClass("disabled");e.buttonNext.removeClass("disabled")}}},updateControls:function(){var e=this;e.updatePagination();e.checkNavigation();if(e.owlControls){if(e.options.items>=e.itemsAmount){e.owlControls.hide()}else{e.owlControls.show()}}},destroyControls:function(){var e=this;if(e.owlControls){e.owlControls.remove()}},next:function(e){var t=this;if(t.isTransition){return false}t.currentItem+=t.options.scrollPerPage===true?t.options.items:1;if(t.currentItem>t.maximumItem+(t.options.scrollPerPage===true?t.options.items-1:0)){if(t.options.rewindNav===true){t.currentItem=0;e="rewind"}else{t.currentItem=t.maximumItem;return false}}t.goTo(t.currentItem,e)},prev:function(e){var t=this;if(t.isTransition){return false}if(t.options.scrollPerPage===true&&t.currentItem>0&&t.currentItem<t.options.items){t.currentItem=0}else{t.currentItem-=t.options.scrollPerPage===true?t.options.items:1}if(t.currentItem<0){if(t.options.rewindNav===true){t.currentItem=t.maximumItem;e="rewind"}else{t.currentItem=0;return false}}t.goTo(t.currentItem,e)},goTo:function(e,n,r){var i=this,s;if(i.isTransition){return false}if(typeof i.options.beforeMove==="function"){i.options.beforeMove.apply(this,[i.$elem])}if(e>=i.maximumItem){e=i.maximumItem}else if(e<=0){e=0}i.currentItem=i.owl.currentItem=e;if(i.options.transitionStyle!==false&&r!=="drag"&&i.options.items===1&&i.browser.support3d===true){i.swapSpeed(0);if(i.browser.support3d===true){i.transition3d(i.positionsInArray[e])}else{i.css2slide(i.positionsInArray[e],1)}i.afterGo();i.singleItemTransition();return false}s=i.positionsInArray[e];if(i.browser.support3d===true){i.isCss3Finish=false;if(n===true){i.swapSpeed("paginationSpeed");t.setTimeout(function(){i.isCss3Finish=true},i.options.paginationSpeed)}else if(n==="rewind"){i.swapSpeed(i.options.rewindSpeed);t.setTimeout(function(){i.isCss3Finish=true},i.options.rewindSpeed)}else{i.swapSpeed("slideSpeed");t.setTimeout(function(){i.isCss3Finish=true},i.options.slideSpeed)}i.transition3d(s)}else{if(n===true){i.css2slide(s,i.options.paginationSpeed)}else if(n==="rewind"){i.css2slide(s,i.options.rewindSpeed)}else{i.css2slide(s,i.options.slideSpeed)}}i.afterGo()},jumpTo:function(e){var t=this;if(typeof t.options.beforeMove==="function"){t.options.beforeMove.apply(this,[t.$elem])}if(e>=t.maximumItem||e===-1){e=t.maximumItem}else if(e<=0){e=0}t.swapSpeed(0);if(t.browser.support3d===true){t.transition3d(t.positionsInArray[e])}else{t.css2slide(t.positionsInArray[e],1)}t.currentItem=t.owl.currentItem=e;t.afterGo()},afterGo:function(){var e=this;e.prevArr.push(e.currentItem);e.prevItem=e.owl.prevItem=e.prevArr[e.prevArr.length-2];e.prevArr.shift(0);if(e.prevItem!==e.currentItem){e.checkPagination();e.checkNavigation();e.eachMoveUpdate();if(e.options.autoPlay!==false){e.checkAp()}}
16866if(typeof e.options.afterMove==="function"&&e.prevItem!==e.currentItem){e.options.afterMove.apply(this,[e.$elem])}},stop:function(){var e=this;e.apStatus="stop";t.clearInterval(e.autoPlayInterval)},checkAp:function(){var e=this;if(e.apStatus!=="stop"){e.play()}},play:function(){var e=this;e.apStatus="play";if(e.options.autoPlay===false){return false}t.clearInterval(e.autoPlayInterval);e.autoPlayInterval=t.setInterval(function(){e.next(true)},e.options.autoPlay)},swapSpeed:function(e){var t=this;if(e==="slideSpeed"){t.$owlWrapper.css(t.addCssSpeed(t.options.slideSpeed))}else if(e==="paginationSpeed"){t.$owlWrapper.css(t.addCssSpeed(t.options.paginationSpeed))}else if(typeof e!=="string"){t.$owlWrapper.css(t.addCssSpeed(e))}},addCssSpeed:function(e){return{"-webkit-transition":"all "+e+"ms ease","-moz-transition":"all "+e+"ms ease","-o-transition":"all "+e+"ms ease",transition:"all "+e+"ms ease"}},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"",transition:""}},doTranslate:function(e){return{"-webkit-transform":"translate3d("+e+"px, 0px, 0px)","-moz-transform":"translate3d("+e+"px, 0px, 0px)","-o-transform":"translate3d("+e+"px, 0px, 0px)","-ms-transform":"translate3d("+e+"px, 0px, 0px)",transform:"translate3d("+e+"px, 0px,0px)"}},transition3d:function(e){var t=this;t.$owlWrapper.css(t.doTranslate(e))},css2move:function(e){var t=this;t.$owlWrapper.css({left:e})},css2slide:function(e,t){var n=this;n.isCssFinish=false;n.$owlWrapper.stop(true,true).animate({left:e},{duration:t||n.options.slideSpeed,complete:function(){n.isCssFinish=true}})},checkBrowser:function(){var e=this,r="translate3d(0px, 0px, 0px)",i=n.createElement("div"),s,o,u,a;i.style.cssText=" -moz-transform:"+r+"; -ms-transform:"+r+"; -o-transform:"+r+"; -webkit-transform:"+r+"; transform:"+r;s=/translate3d\(0px, 0px, 0px\)/g;o=i.style.cssText.match(s);u=o!==null&&o.length>=1&&o.length<=2;a="ontouchstart"in t||t.navigator.msMaxTouchPoints;e.browser={support3d:u,isTouch:a}},moveEvents:function(){var e=this;if(e.options.mouseDrag!==false||e.options.touchDrag!==false){e.gestures();e.disabledEvents()}},eventTypes:function(){var e=this,t=["s","e","x"];e.ev_types={};if(e.options.mouseDrag===true&&e.options.touchDrag===true){t=["touchstart.owl mousedown.owl","touchmove.owl mousemove.owl","touchend.owl touchcancel.owl mouseup.owl"]}else if(e.options.mouseDrag===false&&e.options.touchDrag===true){t=["touchstart.owl","touchmove.owl","touchend.owl touchcancel.owl"]}else if(e.options.mouseDrag===true&&e.options.touchDrag===false){t=["mousedown.owl","mousemove.owl","mouseup.owl"]}e.ev_types.start=t[0];e.ev_types.move=t[1];e.ev_types.end=t[2]},disabledEvents:function(){var t=this;t.$elem.on("dragstart.owl",function(e){e.preventDefault()});t.$elem.on("mousedown.disableTextSelect",function(t){return e(t.target).is("input, textarea, select, option")})},gestures:function(){function s(e){if(e.touches!==undefined){return{x:e.touches[0].pageX,y:e.touches[0].pageY}}if(e.touches===undefined){if(e.pageX!==undefined){return{x:e.pageX,y:e.pageY}}if(e.pageX===undefined){return{x:e.clientX,y:e.clientY}}}}function o(t){if(t==="on"){e(n).on(r.ev_types.move,a);e(n).on(r.ev_types.end,f)}else if(t==="off"){e(n).off(r.ev_types.move);e(n).off(r.ev_types.end)}}function u(n){var u=n.originalEvent||n||t.event,a;if(u.which===3){return false}if(r.itemsAmount<=r.options.items){return}if(r.isCssFinish===false&&!r.options.dragBeforeAnimFinish){return false}if(r.isCss3Finish===false&&!r.options.dragBeforeAnimFinish){return false}if(r.options.autoPlay!==false){t.clearInterval(r.autoPlayInterval)}if(r.browser.isTouch!==true&&!r.$owlWrapper.hasClass("grabbing")){r.$owlWrapper.addClass("grabbing")}r.newPosX=0;r.newRelativeX=0;e(this).css(r.removeTransition());a=e(this).position();i.relativePos=a.left;i.offsetX=s(u).x-a.left;i.offsetY=s(u).y-a.top;o("on");i.sliding=false;i.targetElement=u.target||u.srcElement}function a(o){var u=o.originalEvent||o||t.event,a,f;r.newPosX=s(u).x-i.offsetX;r.newPosY=s(u).y-i.offsetY;r.newRelativeX=r.newPosX-i.relativePos;if(typeof r.options.startDragging==="function"&&i.dragging!==true&&r.newRelativeX!==0){i.dragging=true;r.options.startDragging.apply(r,[r.$elem])}if((r.newRelativeX>8||r.newRelativeX<-8)&&r.browser.isTouch===true){if(u.preventDefault!==undefined){u.preventDefault()}else{u.returnValue=false}i.sliding=true}if((r.newPosY>10||r.newPosY<-10)&&i.sliding===false){e(n).off("touchmove.owl")}a=function(){return r.newRelativeX/5};f=function(){return r.maximumPixels+r.newRelativeX/5};r.newPosX=Math.max(Math.min(r.newPosX,a()),f());if(r.browser.support3d===true){r.transition3d(r.newPosX)}else{r.css2move(r.newPosX)}}function f(n){var s=n.originalEvent||n||t.event,u,a,f;s.target=s.target||s.srcElement;i.dragging=false;if(r.browser.isTouch!==true){r.$owlWrapper.removeClass("grabbing")}if(r.newRelativeX<0){r.dragDirection=r.owl.dragDirection="left"}else{r.dragDirection=r.owl.dragDirection="right"}if(r.newRelativeX!==0){u=r.getNewPosition();r.goTo(u,false,"drag");if(i.targetElement===s.target&&r.browser.isTouch!==true){e(s.target).on("click.disable",function(t){t.stopImmediatePropagation();t.stopPropagation();t.preventDefault();e(t.target).off("click.disable")});a=e._data(s.target,"events").click;f=a.pop();a.splice(0,0,f)}}o("off")}var r=this,i={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};r.isCssFinish=true;r.$elem.on(r.ev_types.start,".owl-wrapper",u)},getNewPosition:function(){var e=this,t=e.closestItem();if(t>e.maximumItem){e.currentItem=e.maximumItem;t=e.maximumItem}else if(e.newPosX>=0){t=0;e.currentItem=0}return t},closestItem:function(){var t=this,n=t.options.scrollPerPage===true?t.pagesInArray:t.positionsInArray,r=t.newPosX,i=null;e.each(n,function(s,o){if(r-t.itemWidth/20>n[s+1]&&r-t.itemWidth/20<o&&t.moveDirection()==="left"){i=o;if(t.options.scrollPerPage===true){t.currentItem=e.inArray(i,t.positionsInArray)}else{t.currentItem=s}}else if(r+t.itemWidth/20<o&&r+t.itemWidth/20>(n[s+1]||n[s]-t.itemWidth)&&t.moveDirection()==="right"){if(t.options.scrollPerPage===true){i=n[s+1]||n[n.length-1];t.currentItem=e.inArray(i,t.positionsInArray)}else{i=n[s+1];t.currentItem=s+1}}});return t.currentItem},moveDirection:function(){var e=this,t;if(e.newRelativeX<0){t="right";e.playDirection="next"}else{t="left";e.playDirection="prev"}return t},customEvents:function(){var e=this;e.$elem.on("owl.next",function(){e.next()});e.$elem.on("owl.prev",function(){e.prev()});e.$elem.on("owl.play",function(t,n){e.options.autoPlay=n;e.play();e.hoverStatus="play"});e.$elem.on("owl.stop",function(){e.stop();e.hoverStatus="stop"});e.$elem.on("owl.goTo",function(t,n){e.goTo(n)});e.$elem.on("owl.jumpTo",function(t,n){e.jumpTo(n)})},stopOnHover:function(){var e=this;if(e.options.stopOnHover===true&&e.browser.isTouch!==true&&e.options.autoPlay!==false){e.$elem.on("mouseover",function(){e.stop()});e.$elem.on("mouseout",function(){if(e.hoverStatus!=="stop"){e.play()}})}},lazyLoad:function(){var t=this,n,r,i,s,o;if(t.options.lazyLoad===false){return false}for(n=0;n<t.itemsAmount;n+=1){r=e(t.$owlItems[n]);if(r.data("owl-loaded")==="loaded"){continue}i=r.data("owl-item");s=r.find(".lazyOwl");
16866if(typeof s.data("src")!=="string"){r.data("owl-loaded","loaded");continue}if(r.data("owl-loaded")===undefined){s.hide();r.addClass("loading").data("owl-loaded","checked")}if(t.options.lazyFollow===true){o=i>=t.currentItem}else{o=true}if(o&&i<t.currentItem+t.options.items&&s.length){t.lazyPreload(r,s)}}},lazyPreload:function(e,n){function o(){e.data("owl-loaded","loaded").removeClass("loading");n.removeAttr("data-src");if(r.options.lazyEffect==="fade"){n.fadeIn(400)}else{n.show()}if(typeof r.options.afterLazyLoad==="function"){r.options.afterLazyLoad.apply(this,[r.$elem])}}function u(){i+=1;if(r.completeImg(n.get(0))||s===true){o()}else if(i<=100){t.setTimeout(u,100)}else{o()}}var r=this,i=0,s;if(n.prop("tagName")==="DIV"){n.css("background-image","url("+n.data("src")+")");s=true}else{n[0].src=n.data("src")}u()},autoHeight:function(){function s(){var r=e(n.$owlItems[n.currentItem]).height();n.wrapperOuter.css("height",r+"px");if(!n.wrapperOuter.hasClass("autoHeight")){t.setTimeout(function(){n.wrapperOuter.addClass("autoHeight")},0)}}function o(){i+=1;if(n.completeImg(r.get(0))){s()}else if(i<=100){t.setTimeout(o,100)}else{n.wrapperOuter.css("height","")}}var n=this,r=e(n.$owlItems[n.currentItem]).find("img"),i;if(r.get(0)!==undefined){i=0;o()}else{s()}},completeImg:function(e){var t;if(!e.complete){return false}t=typeof e.naturalWidth;if(t!=="undefined"&&e.naturalWidth===0){return false}return true},onVisibleItems:function(){var t=this,n;if(t.options.addClassActive===true){t.$owlItems.removeClass("active")}t.visibleItems=[];for(n=t.currentItem;n<t.currentItem+t.options.items;n+=1){t.visibleItems.push(n);if(t.options.addClassActive===true){e(t.$owlItems[n]).addClass("active")}}t.owl.visibleItems=t.visibleItems},transitionTypes:function(e){var t=this;t.outClass="owl-"+e+"-out";t.inClass="owl-"+e+"-in"},singleItemTransition:function(){function a(e){return{position:"relative",left:e+"px"}}var e=this,t=e.outClass,n=e.inClass,r=e.$owlItems.eq(e.currentItem),i=e.$owlItems.eq(e.prevItem),s=Math.abs(e.positionsInArray[e.currentItem])+e.positionsInArray[e.prevItem],o=Math.abs(e.positionsInArray[e.currentItem])+e.itemWidth/2,u="webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend";e.isTransition=true;e.$owlWrapper.addClass("owl-origin").css({"-webkit-transform-origin":o+"px","-moz-perspective-origin":o+"px","perspective-origin":o+"px"});i.css(a(s,10)).addClass(t).on(u,function(){e.endPrev=true;i.off(u);e.clearTransStyle(i,t)});r.addClass(n).on(u,function(){e.endCurrent=true;r.off(u);e.clearTransStyle(r,n)})},clearTransStyle:function(e,t){var n=this;e.css({position:"",left:""}).removeClass(t);if(n.endPrev&&n.endCurrent){n.$owlWrapper.removeClass("owl-origin");n.endPrev=false;n.endCurrent=false;n.isTransition=false}},owlStatus:function(){var e=this;e.owl={userOptions:e.userOptions,baseElement:e.$elem,userItems:e.$userItems,owlItems:e.$owlItems,currentItem:e.currentItem,prevItem:e.prevItem,visibleItems:e.visibleItems,isTouch:e.browser.isTouch,browser:e.browser,dragDirection:e.dragDirection}},clearEvents:function(){var r=this;r.$elem.off(".owl owl mousedown.disableTextSelect");e(n).off(".owl owl");e(t).off("resize",r.resizer)},unWrap:function(){var e=this;if(e.$elem.children().length!==0){e.$owlWrapper.unwrap();e.$userItems.unwrap().unwrap();if(e.owlControls){e.owlControls.remove()}}e.clearEvents();e.$elem.attr("style",e.$elem.data("owl-originalStyles")||"").attr("class",e.$elem.data("owl-originalClasses"))},destroy:function(){var e=this;e.stop();t.clearInterval(e.checkVisible);e.unWrap();e.$elem.removeData()},reinit:function(t){var n=this,r=e.extend({},n.userOptions,t);n.unWrap();n.init(r,n.$elem)},addItem:function(e,t){var n=this,r;if(!e){return false}if(n.$elem.children().length===0){n.$elem.append(e);n.setVars();return false}n.unWrap();if(t===undefined||t===-1){r=-1}else{r=t}if(r>=n.$userItems.length||r===-1){n.$userItems.eq(-1).after(e)}else{n.$userItems.eq(r).before(e)}n.setVars()},removeItem:function(e){var t=this,n;if(t.$elem.children().length===0){return false}if(e===undefined||e===-1){n=-1}else{n=e}t.unWrap();t.$userItems.eq(n).remove();t.setVars()}};e.fn.owlCarousel=function(t){return this.each(function(){if(e(this).data("owl-init")===true){return false}e(this).data("owl-init",true);var n=Object.create(r);n.init(t,this);e.data(this,"owlCarousel",n)})};e.fn.owlCarousel.options={items:5,itemsCustom:false,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:false,itemsMobile:[479,1],singleItem:false,itemsScaleUp:false,slideSpeed:200,paginationSpeed:800,rewindSpeed:1e3,autoPlay:false,stopOnHover:false,navigation:false,navigationText:["prev","next"],rewindNav:true,scrollPerPage:false,pagination:true,paginationNumbers:false,responsive:true,responsiveRefreshRate:200,responsiveBaseWidth:t,baseClass:"owl-carousel",theme:"owl-theme",lazyLoad:false,lazyFollow:true,lazyEffect:"fade",autoHeight:false,jsonPath:false,jsonSuccess:false,dragBeforeAnimFinish:true,mouseDrag:true,touchDrag:true,addClassActive:false,transitionStyle:false,beforeUpdate:false,afterUpdate:false,beforeInit:false,afterInit:false,beforeMove:false,afterMove:false,afterAction:false,startDragging:false,afterLazyLoad:false}})(jQuery,window,document) 16867/*! 16868 * Bootstrap v3.3.5 (http://getbootstrap.com) 16869 * Copyright 2011-2015 Twitter, Inc. 16870 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 16871 */ 16872
vendor: 4,442 bytes, lines 16873-16877
16873/*! 16874 * Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=c6a74c1505073b5853fc) 16875 * Config saved to config.json and https://gist.github.com/c6a74c1505073b5853fc 16876 */ 16877if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(t){"use strict";var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(t){"use strict";function e(e){var n,i=e.attr("data-target")||(n=e.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"");return t(i)}function n(e){return this.each(function(){var n=t(this),s=n.data("bs.collapse"),a=t.extend({},i.DEFAULTS,n.data(),"object"==typeof e&&e);!s&&a.toggle&&/show|hide/.test(e)&&(a.toggle=!1),s||n.data("bs.collapse",s=new i(this,a)),"string"==typeof e&&s[e]()})}var i=function(e,n){this.$element=t(e),this.options=t.extend({},i.DEFAULTS,n),this.$trigger=t('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};i.VERSION="3.3.5",i.TRANSITION_DURATION=350,i.DEFAULTS={toggle:!0},i.prototype.dimension=function(){var t=this.$element.hasClass("width");return t?"width":"height"},i.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var e,s=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(s&&s.length&&(e=s.data("bs.collapse"),e&&e.transitioning))){var a=t.Event("show.bs.collapse");if(this.$element.trigger(a),!a.isDefaultPrevented()){s&&s.length&&(n.call(s,"hide"),e||s.data("bs.collapse",null));var r=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[r](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var o=function(){this.$element.removeClass("collapsing").addClass("collapse in")[r](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!t.support.transition)return o.call(this);var l=t.camelCase(["scroll",r].join("-"));this.$element.one("bsTransitionEnd",t.proxy(o,this)).emulateTransitionEnd(i.TRANSITION_DURATION)[r](this.$element[0][l])}}}},i.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var e=t.Event("hide.bs.collapse");if(this.$element.trigger(e),!e.isDefaultPrevented()){var n=this.dimension();this.$element[n](this.$element[n]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var s=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return t.support.transition?void this.$element[n](0).one("bsTransitionEnd",t.proxy(s,this)).emulateTransitionEnd(i.TRANSITION_DURATION):s.call(this)}}},i.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},i.prototype.getParent=function(){return t(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(t.proxy(function(n,i){var s=t(i);this.addAriaAndCollapsedClass(e(s),s)},this)).end()},i.prototype.addAriaAndCollapsedClass=function(t,e){var n=t.hasClass("in");t.attr("aria-expanded",n),e.toggleClass("collapsed",!n).attr("aria-expanded",n)};var s=t.fn.collapse;t.fn.collapse=n,t.fn.collapse.Constructor=i,t.fn.collapse.noConflict=function(){return t.fn.collapse=s,this},t(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(i){var s=t(this);s.attr("data-target")||i.preventDefault();var a=e(s),r=a.data("bs.collapse"),o=r?"toggle":s.data();n.call(a,o)})}(jQuery),+function(t){"use strict";function e(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in e)if(void 0!==t.style[n])return{end:e[n]};return!1}t.fn.emulateTransitionEnd=function(e){var n=!1,i=this;t(this).one("bsTransitionEnd",function(){n=!0});var s=function(){n||t(i).trigger(t.support.transition.end)};return setTimeout(s,e),this},t(function(){t.support.transition=e(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.supp
16877ort.transition.end,delegateType:t.support.transition.end,handle:function(e){return t(e.target).is(this)?e.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery); 16878/** 16879 * Magento 16880 * 16881 * NOTICE OF LICENSE 16882 * 16883 * This source file is subject to the Academic Free License (AFL 3.0) 16884 * that is bundled with this package in the file LICENSE_AFL.txt. 16885 * It is also available through the world-wide-web at this URL: 16886 * http://opensource.org/licenses/afl-3.0.php 16887 * If you did not receive a copy of the license and are unable to 16888 * obtain it through the world-wide-web, please send an email 16889 * to [email protected] so we can send you a copy immediately. 16890 * 16891 * DISCLAIMER 16892 * 16893 * Do not edit or add to this file if you wish to upgrade Magento to newer 16894 * versions in the future. If you wish to customize Magento for your 16895 * needs please refer to http://www.magento.com for more information. 16896 * 16897 * @category Mage 16898 * @package js 16899 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 16900 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 16901 */ 16902var Captcha = Class.create(); 16903Captcha.prototype = { 16904 initialize: function(url, formId){ 16905 this.url = url; 16906 this.formId = formId; 16907 }, 16908 refresh: function(elem) { 16909 formId = this.formId; 16910 if (elem) Element.addClassName(elem, 'refreshing'); 16911 new Ajax.Request(this.url, { 16912 onSuccess: function (response) { 16913 if (response.responseText.isJSON()) { 16914 var json = response.responseText.evalJSON(); 16915 if (!json.error && json.imgSrc) { 16916 $(formId).writeAttribute('src', json.imgSrc); 16917 if (elem) Element.removeClassName(elem, 'refreshing'); 16918 } else { 16919 if (elem) Element.removeClassName(elem, 'refreshing'); 16920 } 16921 } 16922 }, 16923 method: 'post', 16924 parameters: { 16925 'formId' : this.formId 16926 } 16927 }); 16928 } 16929}; 16930 16931document.observe('billing-request:completed', function(event) { 16932 if (typeof window.checkout != 'undefined') { 16933 if (window.checkout.method == 'guest' && $('guest_checkout')){ 16934 $('guest_checkout').captcha.refresh(); 16935 } 16936 if (window.checkout.method == 'register' && $('register_during_checkout')){ 16937 $('register_during_checkout').captcha.refresh(); 16938 } 16939 } 16940}); 16941 16942 16943document.observe('login:setMethod', function(event) { 16944 var switchCaptchaElement = function(shown, hidden) { 16945 var inputPrefix = 'captcha-input-box-', imagePrefix = 'captcha-image-box-'; 16946 if ($(inputPrefix + hidden)) { 16947 $(inputPrefix + hidden).hide(); 16948 $(imagePrefix + hidden).hide(); 16949 } 16950 if ($(inputPrefix + shown)) { 16951 $(inputPrefix + shown).show(); 16952 $(imagePrefix + shown).show(); 16953 } 16954 }; 16955 16956 switch (event.memo.method) { 16957 case 'guest': 16958 switchCaptchaElement('guest_checkout', 'register_during_checkout'); 16959 break; 16960 case 'register': 16961 switchCaptchaElement('register_during_checkout', 'guest_checkout'); 16962 break; 16963 } 16964}); 16965 16966/*! 16967 * imagesLoaded PACKAGED v3.1.4 16968 * JavaScript is all like "You images are done yet or what?" 16969 * MIT License 16970 */ 16971 16972(function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1
16972);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("eventEmitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(this,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function c(e){this.img=e}function f(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);for(var i=n.querySelectorAll("img"),r=0,o=i.length;o>r;r++){var s=i[r];this.addImage(s)}}},s.prototype.addImage=function(e){var t=new c(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),c.prototype=new t,c.prototype.check=function(){var e=v[this.img.src]||new f(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},c.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return f.prototype=new t,f.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},f.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},f.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},f.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},f.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit
16972("confirm",this,t)},f.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s}); 16973 16974// ============================================== 16975// PDP - image zoom - needs to be available outside document.ready scope 16976// ============================================== 16977 16978var ProductMediaManager = { 16979 IMAGE_ZOOM_THRESHOLD: 20, 16980 imageWrapper: null, 16981 16982 swapImage: function(targetImage) { 16983 targetImage = jQuery(targetImage); 16984 targetImage.addClass('gallery-image'); 16985 16986 if(targetImage[0].complete) { //image already loaded -- swap immediately 16987 jQuery("li.etalage_thumb").trigger('zoom.destroy'); 16988 jQuery("li.etalage_thumb .gallery-image").remove(); 16989 jQuery("li.etalage_thumb img.etalage_thumb_image").removeClass("hide").show(); 16990 jQuery("li.etalage_thumb_active img.etalage_thumb_image").addClass("hide").hide(); 16991 jQuery(targetImage).insertBefore(jQuery("li.etalage_thumb_active img.etalage_thumb_image")); 16992 imagesLoaded(targetImage, function() { 16993 if(typeof zoom_enabled !== 'undefined' && zoom_enabled == true){ 16994 if(typeof zoom_type !== 'undefined' && zoom_type == 1){ 16995 jQuery("li.etalage_thumb").zoom({target: jQuery(".product-view-zoom-area"),touch:false}); 16996 } else { 16997 jQuery("li.etalage_thumb").zoom({touch:false}); 16998 } 16999 } 17000 }); 17001 17002 } else { //need to wait for image to load 17003 jQuery("li.etalage_thumb").trigger('zoom.destroy'); 17004 jQuery("li.etalage_thumb .gallery-image").remove(); 17005 jQuery("li.etalage_thumb img.etalage_thumb_image").removeClass("hide").show(); 17006 jQuery("li.etalage_thumb_active img.etalage_thumb_image").addClass("hide").hide(); 17007 jQuery(targetImage).insertBefore(jQuery("li.etalage_thumb_active img.etalage_thumb_image")); 17008 imagesLoaded(targetImage, function() { 17009 if(typeof zoom_enabled !== 'undefined' && zoom_enabled == true){ 17010 if(typeof zoom_type !== 'undefined' && zoom_type == 1){ 17011 jQuery("li.etalage_thumb").zoom({target: jQuery(".product-view-zoom-area"),touch:false}); 17012 } else { 17013 jQuery("li.etalage_thumb").zoom({touch:false}); 17014 } 17015 } 17016 }); 17017 17018 } 17019 jQuery("li.etalage_thumb .gallery-image").each(function(){ 17020 jQuery(this).attr("style",jQuery(this).parent().children(".etalage_thumb_image").attr("style")); 17021 }); 17022 jQuery("li.etalage_thumb .gallery-image").show(); 17023 }, 17024 init: function() { 17025 ProductMediaManager.imageWrapper = jQuery('.product-img-box'); 17026 17027 jQuery(document).trigger('product-media-loaded', ProductMediaManager); 17028 } 17029}; 17030 17031jQuery(document).ready(function() { 17032 ProductMediaManager.init(); 17033}); 17034 17035var initAsiabil = function () { 17036 17037 asiabill.loadStripe(); 17038 initAsiabillModules(); 17039}; 17040 17041 17042var initAsiabillModules = function() 17043{ 17044 if (asiabill.oscInitialized) return; 17045 17046 if (typeof IWD != "undefined" && typeof IWD.OPC != "undefined") { 17047 17048 IWD.OPC.isAuthenticationInProgress = false; 17049 17050 var proceed = function() { 17051 if (typeof $j == 'undefined') $j = $j_opc; 17052 var form = $j('#co-payment-form').serializeArray(); 17053 IWD.OPC.Checkout.xhr = $j.post(IWD.OPC.Checkout.config.baseUrl + 'onepage/json/savePayment', form, IWD.OPC.preparePaymentResponse, 'json'); 17054 }; 17055 17056 asiabill.placeOrder = function() { 17057 if( typeof stripe !== 'undefined' && stripe.isPaymentMethodSelected()){ 17058 createStripeToken(function(err) { 17059 IWD.OPC.Checkout.xhr = null; 17060 IWD.OPC.Checkout.unlockPlaceOrder(); 17061 if (err) { 17062 IWD.OPC.Checkout.hideLoader(); 17063 stripe.displayCardError(err); 17064 } else stripe.placeOrder(); 17065 }); 17066 }else { 17067 proceed(); 17068 } 17069 }; 17070 17071 IWD.OPC.savePayment = function() { 17072 17073 if (!IWD.OPC.saveOrderStatus){ 17074 return; 17075 } 17076 17077 if (IWD.OPC.Checkout.xhr !== null) IWD.OPC.Checkout.xhr.abort(); 17078 IWD.OPC.Checkout.lockPlaceOrder(); 17079 17080 if (!asiabill.isSelected()) { 17081 return asiabill.placeOrder(); 17082 } 17083 if (IWD.OPC.isAuthenticationInProgress && typeof IWD.OPC.saveOrder != "undefined") { 17084 IWD.OPC.isAuthenticationInProgress = false;
17085 IWD.OPC.saveOrder(); 17086 return; 17087 } 17088 asiabill.createPaymentMethodId(); 17089 17090 IWD.OPC.Checkout.xhr = null; 17091 IWD.OPC.Checkout.unlockPlaceOrder(); 17092 }; 17093 17094 asiabill.oscInitialized = true; 17095 } 17096 else if ( typeof Review != 'undefined' && typeof Review.prototype.proceed == 'undefined' ){ 17097 Review.prototype.proce = Review.prototype.save; 17098 17099 asiabill.placeOrder = function() 17100 { 17101 // Awesome Checkout && PlumRocket 17102 checkout.loadWaiting = false; 17103 // Others 17104 review.proce(); 17105 }; 17106 17107 Review.prototype.save = function() 17108 { 17109 if (!asiabill.isSelected()){ 17110 return asiabill.placeOrder(); 17111 } 17112 asiabill.createPaymentMethodId(); 17113 }; 17114 } 17115 17116 17117 17118 17119}; 17120 17121 17122 17123var asiabill = { 17124 oscInitialized: false, 17125 formId: 'asiabill-card-form', 17126 mode: 'pro', 17127 apiToken: null, 17128 layout: { 17129 pageMode: 'block', 17130 style: { 17131 frameMaxHeight: 100, 17132 input: { 17133 FontSize: 14, 17134 FontFamily: '', 17135 FontWeight: '', 17136 Color: '', 17137 ContainerBorder: '1px solid #ddd;', 17138 ContainerBg: '', 17139 ContainerSh: '' 17140 } 17141 } 17142 }, 17143 billingAddress: {}, 17144 17145 loadStripe: function () { 17146 var script = document.getElementsByTagName('script')[0]; 17147 var AsiabillPaymentJs = document.createElement('script'); 17148 AsiabillPaymentJs.src = "https://safepay.asiabill.com/static/v3/js/AsiabillPayment.min.js"; 17149 AsiabillPaymentJs.onload = function() 17150 { 17151 asiabill.initElement(); 17152 }; 17153 AsiabillPaymentJs.onerror = function(evt) { 17154 console.warn("AsiabillPayment.js could not be loaded"); 17155 console.error(evt); 17156 }; 17157 script.parentNode.insertBefore(AsiabillPaymentJs, script); 17158 }, 17159 17160 initElement: function () { 17161 17162 try { 17163 this.asiabillPay = window.AsiabillPay(this.apiToken); 17164 17165 this.asiabillPay.elementInit("payment_steps", { 17166 formId: this.formId, // 页é¢è¡¨åid 17167 frameId: 'asiabill-card-frame', // çæçIframeId 17168 mode: this.mode, 17169 customerId: this.customerId, 17170 autoValidate:false, 17171 layout: this.layout 17172 17173 }).then((res) => { 17174 console.log("initRES", res); 17175 }).catch((err) => { 17176 console.log("initERR", err); 17177 }); 17178 }catch (e) { 17179 if (typeof e != "undefined" && typeof e.message != "undefined") { 17180 this.message = 'Could not initialize asiabillPayment: ' + e.message; 17181 } else { 17182 this.message = 'Could not initialize asiabillPayment'; 17183 } 17184 } 17185 17186 17187 }, 17188 17189 placeOrder: function () {}, 17190 17191 createPaymentMethodId: function( ) { 17192 this.cleanError(); 17193 17194 let owner = { 17195 "billingDetail": this.billingAddress, 17196 "card": { 17197 "cardNo": "", 17198 "cardExpireMonth": "", 17199 "cardExpireYear": "", 17200 "cardSecurityCode": "", 17201 "issuingBank": "" 17202 } 17203 }; 17204 17205 this.asiabillPay.confirmPaymentMethod({ 17206 apikey: this.apiToken, 17207 trnxDetail: owner 17208 }).then((result) => { 17209 17210 if( result.data.code === "0" ){ 17211 this.setPaymentMethodId(result.data.data.customerPaymentMethodId); 17212 this.placeOrder(); 17213 }else { 17214 this.onError(result.data.message); 17215 } 17216 }); 17217 17218 }, 17219 17220 setPaymentMethodId: function (id){ 17221 try 17222 { 17223 var input, inputs = document.getElementsByClassName('asiabill-pmid'); 17224 if (inputs && inputs[0]) input = inputs[0]; 17225 else input = document.createElement("input"); 17226 input.setAttribute("type", "hidden"); 17227 input.setAttribute("name", "payment[cc_asiabill_pmid]"); 17228 input.setAttribute("class", 'asiabill-pmid'); 17229 input.setAttribute("value", id); 17230 input.disabled = false;
17230 // Gets disabled when the user navigates back to shipping method 17231 17232 var form = document.getElementById('co-payment-form'); 17233 if (!form) form = document.getElementById('order-billing_method_form'); 17234 if (!form) form = document.getElementById('onestepcheckout-form'); 17235 if (!form && typeof payment != 'undefined') form = document.getElementById(payment.formId); 17236 if (!form) 17237 { 17238 form = document.getElementById('new-card'); 17239 input.setAttribute("name", "newcard[cc_asiabill_pmid]"); 17240 } 17241 form.appendChild(input); 17242 } catch (e) {} 17243 }, 17244 17245 isSelected: function () { 17246 17247 if (typeof payment != 'undefined' && typeof payment.currentMethod != 'undefined' && payment.currentMethod.length > 0){ 17248 return (payment.currentMethod == 'asiabill_creditcard'); 17249 } else { 17250 var radioButton = document.getElementById('p_method_stripe_payments'); 17251 if (!radioButton || !radioButton.checked) 17252 return false; 17253 17254 return true; 17255 } 17256 }, 17257 17258 onError: function (msg) { 17259 17260 if( !msg ){ 17261 this.cleanError(); 17262 return; 17263 } 17264 17265 if (asiabill.oscInitialized) { 17266 alert(msg); 17267 IWD.OPC.Checkout.hideLoader(); 17268 } 17269 17270 let box = $('asiabill-card-errors'); 17271 17272 if (box) 17273 { 17274 try 17275 { 17276 checkout.gotoSection("payment"); 17277 box.update(msg); 17278 box.removeClassName('hide'); 17279 } 17280 catch (e) { 17281 alert(msg); 17282 } 17283 17284 }else { 17285 alert(msg); 17286 } 17287 17288 17289 }, 17290 17291 cleanError: function () { 17292 17293 let box = $('asiabill-card-errors'); 17294 if (box) 17295 { 17296 box.update(''); 17297 box.addClassName('hide'); 17298 } 17299 } 17300 17301}; 17302 17303 17304addEventListener("getErrorMessage", e => { 17305 asiabill.onError(e.detail.errorMessage); 17306}); 17307 17308jQuery(document).ready(function($){ 17309 // **********************************************************************// 17310 // ! Main Navigation plugin 17311 // **********************************************************************// 17312 17313 $.fn.et_menu = function ( options ) { 17314 var settings = $.extend({ 17315 type: "default", // can be columns, default, mega, combined 17316 animTime: 250, 17317 openByClick: true, 17318 delayTime: 0 17319 }, options ); 17320 17321 var methods = { 17322 showChildren: function(el) { 17323 if(!$(el).hasClass("loading")) { 17324 el.addClass("loading").delay(settings.delayTime).fadeIn(100,function(){ 17325 el.css({ 17326 display: 'list-item', 17327 listStyle: 'none' 17328 }).find('li').css({listStyle: 'none'}); 17329 el.removeClass("loading"); 17330 }); 17331 } 17332 }, 17333 calculateColumns: function(el) { 17334 // calculate columns count 17335 var columnsCount = el.find('.container > ul > li.menu-item-has-children').length; 17336 var dropdownWidth = el.find('.container > ul > li').outerWidth(); 17337 var padding = 20; 17338 if(columnsCount > 1) { 17339 dropdownWidth = dropdownWidth*columnsCount + padding; 17340 el.css({ 17341 'width':dropdownWidth 17342 }); 17343 } 17344 17345 // calculate right offset of the dropdown 17346 var headerWidth = $('.menu-wrapper').outerWidth(); 17347 var headerLeft = $('.menu-wrapper').offset().left; 17348 var dropdownOffset = el.offset().left - headerLeft; 17349 var dropdownRight = headerWidth - (dropdownOffset + dropdownWidth); 17350 17351 if(dropdownRight < 0) { 17352 el.css({ 17353 'left':'auto', 17354 'right':0 17355 }); 17356 } 17357 }, 17358 openOnClick: function(el,e) { 17359 var timeOutTime = 0; 17360 var openedClass = "current"; 17361 var header = $('.header-wrapper'); 17362 var $this = el; 17363 17364 17365 if($this.parent().hasClass(openedClass)) { 17366 e.preventDefault(); 17367 $this.parent().removeClass(openedClass); 17368 $this.next().stop().slideUp(settings.animTime); 17369 header.stop().animate({'paddingBottom': 0}, settings.animTime); 17370 } else { 17371 17372 if($this.parent().find('>div').length < 1) { 17373 return; 17374 } 17375 17376 e.preventDefault(); 17377 17378 if($this.parent().parent().find('.' + openedClass).length > 0) { 17379 timeOutTime = settings.animTime; 17380 header.stop().animate({'paddingBottom': 0}, settings.animTime); 17381 } 17382 17383 $this.parent().parent().find('.' + openedClass).removeClass(openedClass).find('>div').stop().slideUp(settings.animTime); 17384 17385 setTimeout(function(){ 17386 $this.parent().addClass(openedClass); 17387 header.stop().animate({'paddingBottom': $this.next().height()+50},settings.animTime); 17388 $this.next().stop().slideDown(settings.animTime); 17389 },timeOutTime); 17390 } 17391 } 17392 }; 17393 17394 this.find('>li').hover(function (){ 17395 if(!$(this).hasClass('open-by-click') || (!settings.openByCl
17395ick && $(this).hasClass('open-by-click'))) { 17396 var dropdown = $(this).find('> .nav-sublist-dropdown'); 17397 if ($(this).hasClass('menu-full-width') && SW_MENU_POPUP_WIDTH) { 17398 dropdown.css('width', SW_MENU_POPUP_WIDTH); 17399 } 17400 methods.showChildren(dropdown); 17401 17402 if(settings.type == 'columns') { 17403 methods.calculateColumns(dropdown); 17404 } 17405 } 17406 }, function () { 17407 if(!$(this).hasClass('open-by-click') || (!settings.openByClick && $(this).hasClass('open-by-click'))) { 17408 var el = $(this).find('> .nav-sublist-dropdown'); 17409 $(el).addClass("loading").delay(settings.delayTime).fadeOut(100,function(){$(el).removeClass("loading")}); 17410 } 17411 }); 17412 17413 return this; 17414 } 17415 17416 function et_equalize_height(elements, removeHeight) { 17417 var heights = []; 17418 17419 if(removeHeight) { 17420 elements.attr('style', ''); 17421 } 17422 17423 elements.each(function(){ 17424 heights.push($(this).height()); 17425 }); 17426 17427 var maxHeight = Math.max.apply( Math, heights ); 17428 if($(window).width() > 767) { 17429 elements.height(maxHeight); 17430 } 17431 } 17432 17433 $(window).resize(function(){ 17434 //et_equalize_height($('.product-category'), true); 17435 }); 17436 17437 // **********************************************************************// 17438 // ! Mobile navigation 17439 // **********************************************************************// 17440 17441 var navList = $('.mobile-nav div > ul'); 17442 var etOpener = '<span class="open-child">(open)</span>'; 17443 navList.addClass('sw-mobile-menu'); 17444 17445 navList.find('li:has(ul)',this).each(function() { 17446 $(this).prepend(etOpener); 17447 }) 17448 17449 navList.find('.open-child').click(function(){ 17450 if ($(this).parent().hasClass('over')) { 17451 $(this).parent().removeClass('over').find('>ul').slideUp(200); 17452 }else{ 17453 $(this).parent().parent().find('>li.over').removeClass('over').find('>ul').slideUp(200); 17454 $(this).parent().addClass('over').find('>ul').slideDown(200); 17455 } 17456 }); 17457 $('.menu-icon, .close-mobile-nav, .header-container.type10 .dropdown-menu > .menu-container > a').click(function(event) { 17458 if(!$('body').hasClass('md-mobile-menu') && ($(".header-container").hasClass('type11') || $(".header-container").hasClass('type13') || $(".header-container").hasClass('type7'))) 17459 $('body').addClass('md-mobile-menu'); 17460 if(!$('body').hasClass('mobile-nav-shown')) { 17461 $('body').addClass('mobile-nav-shown', function() { 17462 // Hide search input on click 17463 setTimeout(function(){ 17464 $(document).one("click",function(e) { 17465 var target = e.target; 17466 if (!$(target).is('.mobile-nav') && !$(target).parents().is('.mobile-nav')) { 17467 $('body').removeClass('mobile-nav-shown'); 17468 } 17469 }); 17470 }, 111); 17471 }); 17472 } else{ 17473 $('body').removeClass('mobile-nav-shown'); 17474 } 17475 }); 17476}); 17477/** 17478 * Magento 17479 * 17480 * NOTICE OF LICENSE 17481 * 17482 * This source file is subject to the Academic Free License (AFL 3.0) 17483 * that is bundled with this package in the file LICENSE_AFL.txt. 17484 * It is also available through the world-wide-web at this URL: 17485 * http://opensource.org/licenses/afl-3.0.php 17486 * If you did not receive a copy of the license and are unable to 17487 * obtain it through the world-wide-web, please send an email 17488 * to [email protected] so we can send you a copy immediately. 17489 * 17490 * DISCLAIMER 17491 * 17492 * Do not edit or add to this file if you wish to upgrade Magento to newer 17493 * versions in the future. If you wish to customize Magento for your 17494 * needs please refer to http://www.magento.com for more information. 17495 * 17496 * @category design 17497 * @package base_default 17498 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 17499 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 17500 */ 17501if(typeof Product=='undefined') { 17502 var Product = {}; 17503} 17504/**************************** BUNDLE PRODUCT **************************/ 17505Product.Bundle = Class.create(); 17506Product.Bundle.prototype = { 17507 initialize: function(config){ 17508 this.config = config; 17509 17510 // Set preconfigured values for correct price base calculation 17511 if (config.defaultValues) { 17512 for (var option in config.defaultValues) { 17513 if (this.config['options'][option].isMulti) { 17514 var selected = new Array(); 17515 for (var i = 0; i < config.defaultValues[option].length; i++) { 17516 selected.push(config.defaultValues[option][i]); 17517 } 17518 this.config.selected[option] = selected; 17519 } else { 17520 this.config.selected[option] = new Array(config.defaultValues[option] + ""); 17521 } 17522 } 17523 } 17524 17525 this.reloadPrice(); 17526 }, 17527 changeSelection: function(selection){ 17528 var parts = selection.id.split('-'); 17529 if (this.config['options'][parts[2]].isMulti) { 17530 selected = new Array(); 17531 if (selection.tagName == 'SELECT') { 17532 for (var i = 0; i < selection.options.length; i++) { 17533 if (selection.options[i].selected && selection.options[i].value != '') { 17534 selected.push(selection.options[i].value); 17535 } 17536 } 17537 } else if (selection.tagName == 'INPUT') { 17538 selector = parts[0]+'-'+parts[1]+'-'+parts[2]; 17539 selections = $$('.'+selector); 17540 for (var i = 0; i < selections.length; i++) { 17541 if (selections[i].checked && selections[i].value != '') { 17542 selected.push(selections[i].value); 17543 } 17544 } 17545 } 17546 this.config.selected[parts[2]] = selected; 17547 } else { 17548 if (selection.value != '') { 17549 this.config.selected[parts[2]] = new Array(selection.value); 17550 } else { 17551 this.config.selected[parts[2]] = new Array(); 17552 } 17553 this.populateQty(parts[2], selection.value); 17554 var tierPriceElement = $('bundle-option-' + parts[2] + '-tier-prices'), 17555 tierPriceHtml = ''; 17556 if (selection.value != '' && this.config.options[parts[2]].selections[selection.value].customQty == 1) { 17557 tierPriceHtml = this.config.options[parts[2]].selections[selection.value].tierPriceHtml; 17558 } 17559 tierPriceElement.update(tierPriceHtml); 17560 } 17561 this.reloadPrice(); 17562 }, 17563 17564 reloadPrice: function() { 17565 var calculatedPrice = 0; 17566 var dispositionPrice = 0; 17567 var includeTaxPrice = 0; 17568 17569 for (var option in this.config.selected) { 17570 if (this.config.options[option]) { 17571 for (var i=0; i < this.config.selected[option].length; i++) { 17572 var prices = this.selectionPrice(option, this.config.selected[option][i]); 17573 calculatedPrice += Number(prices[0]); 17574 dispositionPrice += Number(prices[1]); 17575 includeTaxPrice += Number(prices[2]); 17576 } 17577 } 17578 } 17579 17580 //Tax is calculated in a different way for the the TOTAL BASED method 17581 //We round the taxes at the end. Hence we do the same for consistency 17582 //This variable is set in the bundle.phtml 17583 if (taxCalcMethod == CACL_TOTAL_BASE) { 17584 var calculatedPriceFormatted = calculatedPrice.toFixed(10); 17585 var includeTaxPriceFormatted = includeTaxPrice.toFixed(10); 17586 var tax = includeTaxPriceFormatted - calculatedPriceFormatted; 17587 calculatedPrice = includeTaxPrice - Math.round(tax * 100) / 100; 17588 } 17589
17590 //make sure that the prices are all rounded to two digits 17591 //this is needed when tax calculation is based on total for dynamic 17592 //price bundle product. For fixed price bundle product, the rounding 17593 //needs to be done after option price is added to base price 17594 if (this.config.priceType == '0') { 17595 calculatedPrice = Math.round(calculatedPrice*100)/100; 17596 dispositionPrice = Math.round(dispositionPrice*100)/100; 17597 includeTaxPrice = Math.round(includeTaxPrice*100)/100; 17598 17599 } 17600 17601 var event = $(document).fire('bundle:reload-price', { 17602 price: calculatedPrice, 17603 priceInclTax: includeTaxPrice, 17604 dispositionPrice: dispositionPrice, 17605 bundle: this 17606 }); 17607 if (!event.noReloadPrice) { 17608 optionsPrice.specialTaxPrice = 'true'; 17609 optionsPrice.changePrice('bundle', calculatedPrice); 17610 optionsPrice.changePrice('nontaxable', dispositionPrice); 17611 optionsPrice.changePrice('priceInclTax', includeTaxPrice); 17612 optionsPrice.reload(); 17613 } 17614 17615 return calculatedPrice; 17616 }, 17617 17618 selectionPrice: function(optionId, selectionId) { 17619 if (selectionId == '' || selectionId == 'none' || typeof(this.config.options[optionId].selections[selectionId]) == 'undefined') { 17620 return 0; 17621 } 17622 var qty = null; 17623 var tierPriceInclTax, tierPriceExclTax; 17624 if (this.config.options[optionId].selections[selectionId].customQty == 1 && !this.config['options'][optionId].isMulti) { 17625 if ($('bundle-option-' + optionId + '-qty-input')) { 17626 qty = $('bundle-option-' + optionId + '-qty-input').value; 17627 } else { 17628 qty = 1; 17629 } 17630 } else { 17631 qty = this.config.options[optionId].selections[selectionId].qty; 17632 } 17633 if (this.config.priceType == '0') { 17634 price = this.config.options[optionId].selections[selectionId].price; 17635 tierPrice = this.config.options[optionId].selections[selectionId].tierPrice; 17636 17637 for (var i=0; i < tierPrice.length; i++) { 17638 if (Number(tierPrice[i].price_qty) <= qty && Number(tierPrice[i].price) <= price) { 17639 price = tierPrice[i].price; 17640 tierPriceInclTax = tierPrice[i].priceInclTax; 17641 tierPriceExclTax = tierPrice[i].priceExclTax; 17642 } 17643 } 17644 } else { 17645 selection = this.config.options[optionId].selections[selectionId]; 17646 if (selection.priceType == '0') { 17647 price = selection.priceValue; 17648 } else { 17649 price = (this.config.basePrice*selection.priceValue)/100; 17650 } 17651 } 17652 //price += this.config.options[optionId].selections[selectionId].plusDisposition; 17653 //price -= this.config.options[optionId].selections[selectionId].minusDisposition; 17654 //return price*qty; 17655 var disposition = this.config.options[optionId].selections[selectionId].plusDisposition + 17656 this.config.options[optionId].selections[selectionId].minusDisposition; 17657 17658 if (this.config.specialPrice) { 17659 newPrice = (price*this.config.specialPrice)/100; 17660 price = Math.min(newPrice, price); 17661 } 17662 17663 selection = this.config.options[optionId].selections[selectionId]; 17664 if (tierPriceInclTax !== undefined && tierPriceExclTax !== undefined) { 17665 priceInclTax = tierPriceInclTax; 17666 price = tierPriceExclTax; 17667 } else if (selection.priceInclTax !== undefined) { 17668 priceInclTax = selection.priceInclTax; 17669 price = selection.priceExclTax !== undefined ? selection.priceExclTax : selection.price; 17670 } else { 17671 priceInclTax = price; 17672 } 17673 17674 if (this.config.priceType == '1' || taxCalcMethod == CACL_TOTAL_BASE) { 17675 var result = new Array(price*qty, disposition*qty, priceInclTax*qty); 17676 return result; 17677 } 17678 else if (taxCalcMethod == CACL_UNIT_BASE) { 17679 price = (Math.round(price*100)/100).toString(); 17680 disposition = (Math.round(disposition*100)/100).toString(); 17681 priceInclTax = (Math.round(priceInclTax*100)/100).toString(); 17682 var result = new Array(price*qty, disposition*qty, priceInclTax*qty); 17683 return result; 17684 } else { //taxCalcMethod == CACL_ROW_BASE) 17685 price = (Math.round(price*qty*100)/100).toString(); 17686 disposition = (Math.round(disposition*qty*100)/100).toString(); 17687 priceInclTax = (Math.round(priceInclTax*qty*100)/100).toString(); 17688 var result = new Array(price, disposition, priceInclTax); 17689 return result; 17690 } 17691 }, 17692 17693 populateQty: function(optionId, selectionId){ 17694 if (selectionId == '' || selectionId == 'none') { 17695 this.showQtyInput(optionId, '0', false); 17696 return; 17697 } 17698 if (this.config.options[optionId].selections[selectionId].customQty == 1) { 17699 this.showQtyInput(optionId, this.config.options[optionId].selections[selectionId].qty, true); 17700 } else { 17701 this.showQtyInput(optionId, this.config.options[optionId].selections[selectionId].qty, false); 17702 } 17703 }, 17704 17705 showQtyInput: function(optionId, value, canEdit) { 17706 elem = $('bundle-option-' + optionId + '-qty-input'); 17707 elem.value = value; 17708 elem.disabled = !canEdit; 17709 if (canEdit) { 17710 elem.removeClassName('qty-disabled'); 17711 } else { 17712 elem.addClassName('qty-disabled'); 17713 } 17714 }, 17715 17716 changeOptionQty: function (element, event) { 17717 var checkQty = true; 17718 if (typeof(event) != 'undefined') { 17719 if (event.keyCode == 8 || event.keyCode == 46) { 17720 checkQty = false;
17721 } 17722 } 17723 if (checkQty && (Number(element.value) == 0 || isNaN(Number(element.value)))) { 17724 element.value = 1; 17725 } 17726 parts = element.id.split('-'); 17727 optionId = parts[2]; 17728 if (!this.config['options'][optionId].isMulti) { 17729 selectionId = this.config.selected[optionId][0]; 17730 this.config.options[optionId].selections[selectionId].qty = element.value*1; 17731 this.reloadPrice(); 17732 } 17733 }, 17734 17735 validationCallback: function (elmId, result){ 17736 if (elmId == undefined || $(elmId) == undefined) { 17737 return; 17738 } 17739 var container = $(elmId).up('ul.options-list'); 17740 if (typeof container != 'undefined') { 17741 if (result == 'failed') { 17742 container.removeClassName('validation-passed'); 17743 container.addClassName('validation-failed'); 17744 } else { 17745 container.removeClassName('validation-failed'); 17746 container.addClassName('validation-passed'); 17747 } 17748 } 17749 } 17750}; 17751 17752jQuery.noConflict(); 17753jQuery(function($) { 17754 //insert quickview popup 17755 $('.quickview-icon').fancybox({ 17756 'type' : 'iframe', 17757 'autoSize' : false, 17758 'titleShow' : false, 17759 'autoScale' : false, 17760 'transitionIn' : 'none', 17761 'transitionOut' : 'none', 17762 'scrolling' : 'auto', 17763 'padding' : 0, 17764 'margin' : 0, 17765 'autoDimensions' : false, 17766 'width' : EM.Quickview.QS_FRM_WIDTH, 17767 'maxHeight' : EM.Quickview.QS_FRM_HEIGHT, 17768 'centerOnScroll' : true, 17769 'height' : 'auto', 17770 'ajaxLoad' : null, 17771 'beforeLoad' : function() { 17772 $("head").append('<style type="text/css" id="fancybox_hide_loading_css">#fancybox-loading{display:none}.fancybox-overlay{background:transparent}</style>'); 17773 $(".loader-container").hide(); 17774 $(this.element).parent().children(".loader-container").show(); 17775 }, 17776 'afterLoad' : function() { 17777 $("#fancybox_hide_loading_css").remove(); 17778 $(".loader-container").hide(); 17779 }, 17780 'afterClose': function(){ 17781 setTimeout(function(){ 17782 $("#fancybox_hide_loading_css").remove(); 17783 }, 500); 17784 $(".loader-container").hide(); 17785 }, 17786 'helpers': { 17787 overlay: { 17788 locked: false 17789 } 17790 } 17791 }); 17792}); 17793 17794 17795 17796var twitterFetcher=function(){function x(e){return e.replace(/<b[^>]*>(.*?)<\/b>/gi,function(c,e){return e}).replace(/class=".*?"|data-query-source=".*?"|dir=".*?"|rel=".*?"/gi,"")}function p(e,c){for(var g=[],f=RegExp("(^| )"+c+"( |$)"),a=e.getElementsByTagName("*"),h=0,d=a.length;h<d;h++)f.test(a[h].className)&&g.push(a[h]);return g}var y="",l=20,s=!0,k=[],t=!1,q=!0,r=!0,u=null,v=!0,z=!0,w=null,A=!0;return{fetch:function(e,c,g,f,a,h,d,b,m,n){void 0===g&&(g=20);void 0===f&&(s=!0);void 0===a&&(a= 17797!0);void 0===h&&(h=!0);void 0===d&&(d="default");void 0===b&&(b=!0);void 0===m&&(m=null);void 0===n&&(n=!0);t?k.push({id:e,domId:c,maxTweets:g,enableLinks:f,showUser:a,showTime:h,dateFunction:d,showRt:b,customCallback:m,showInteraction:n}):(t=!0,y=c,l=g,s=f,r=a,q=h,z=b,u=d,w=m,A=n,c=document.createElement("script"),c.type="text/javascript",c.src="//cdn.syndication.twimg.com/widgets/timelines/"+e+"?&lang=en&callback=twitterFetcher.callback&suppress_response_codes=true&rnd="+Math.random(),document.getElementsByTagName("head")[0].appendChild(c))}, 17798callback:function(e){var c=document.createElement("div");c.innerHTML=e.body;"undefined"===typeof c.getElementsByClassName&&(v=!1);e=[];var g=[],f=[],a=[],h=[],d=0;if(v)for(c=c.getElementsByClassName("tweet");d<c.length;){0<c[d].getElementsByClassName("retweet-credit").length?a.push(!0):a.push(!1);if(!a[d]||a[d]&&z)e.push(c[d].getElementsByClassName("e-entry-title")[0]),h.push(c[d].getAttribute("data-tweet-id")),g.push(c[d].getElementsByClassName("p-author")[0]),f.push(c[d].getElementsByClassName("dt-updated")[0]); 17799d++}else for(c=p(c,"tweet");d<c.length;)e.push(p(c[d],"e-entry-title")[0]),h.push(c[d].getAttribute("data-tweet-id")),g.push(p(c[d],"p-author")[0]),f.push(p(c[d],"dt-updated")[0]),0<p(c[d],"retweet-credit").length?a.push(!0):a.push(!1),d++;e.length>l&&(e.splice(l,e.length-l),g.splice(l,g.length-l),f.splice(l,f.length-l),a.splice(l,a.length-l));c=[];d=e.length;for(a=0;a<d;){if("string"!==typeof u){var b=new Date(f[a].getAttribute("datetime").replace(/-/g,"/").replace("T"," ").split("+")[0]),b=u(b); 17800f[a].setAttribute("aria-label",b);if(e[a].innerText)if(v)f[a].innerText=b;else{var m=document.createElement("p"),n=document.createTextNode(b);m.appendChild(n);m.setAttribute("aria-label",b);f[a]=m}else f[a].textContent=b}b="";s?(r&&(b+='<div class="user">'+x(g[a].innerHTML)+"</div>"),b+='<p class="tweet">'+x(e[a].innerHTML)+"</p>"):e[a].innerText?(r&&(b+='<p class="user">'+g[a].innerText+"</p>"),b+='<p class="tweet">'+e[a].innerText+ 17801"</p>"):(r&&(b+='<p class="user">'+g[a].textContent+"</p>"),b+='<p class="tweet">'+e[a].textContent+"</p>"); q&&(b+='<p class="timePosted">'+f[a].textContent+"</p>");c.push(b);a++}if(null==w){e=c.length;g=0;f=document.getElementById(y);for(h="<div class='owl-carousel owl-theme'>";g<e;)h+="<div class='item'>"+c[g]+"</div>",g++;f.innerHTML=h+"</div>"}else w(c);t=!1;0<k.length&&(twitterFetcher.fetch(k[0].id,k[0].domId,k[0].maxTweets,k[0].enableLinks,k[0].showUser,k[0].showTime,k[0].dateFunction,k[0].showRt,k[0].customCallback,k[0].showInteraction),k.splice(0,1))}}}();
vendor: 4,149 bytes, lines 17802-17821
17802/*! WOW - v0.1.7 - 2014-05-07 17803* Copyright (c) 2014 Matthieu Aussaguel; Licensed MIT */(function(){var a,b=function(a,b){return function(){return a.apply(b,arguments)}};a=function(){function a(){}return a.prototype.extend=function(a,b){var c,d;for(c in a)d=a[c],null!=d&&(b[c]=d);return b},a.prototype.isMobile=function(a){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(a)},a}(),this.WOW=function(){function c(a){null==a&&(a={}),this.scrollCallback=b(this.scrollCallback,this),this.scrollHandler=b(this.scrollHandler,this),this.start=b(this.start,this),this.scrolled=!0,this.config=this.util().extend(a,this.defaults)}return c.prototype.defaults={boxClass:"wow",animateClass:"animated",offset:0,mobile:!0},c.prototype.init=function(){var a;return this.element=window.document.documentElement,"interactive"===(a=document.readyState)||"complete"===a?this.start():document.addEventListener("DOMContentLoaded",this.start)},c.prototype.start=function(){var a,b,c,d;if(this.boxes=this.element.getElementsByClassName(this.config.boxClass),this.boxes.length){if(this.disabled())return this.resetStyle();for(d=this.boxes,b=0,c=d.length;c>b;b++)a=d[b],this.applyStyle(a,!0);return window.addEventListener("scroll",this.scrollHandler,!1),window.addEventListener("resize",this.scrollHandler,!1),this.interval=setInterval(this.scrollCallback,50)}},c.prototype.stop=function(){return window.removeEventListener("scroll",this.scrollHandler,!1),window.removeEventListener("resize",this.scrollHandler,!1),null!=this.interval?clearInterval(this.interval):void 0},c.prototype.show=function(a){return this.applyStyle(a),a.className=""+a.className+" "+this.config.animateClass},c.prototype.applyStyle=function(a,b){var c,d,e;return d=a.getAttribute("data-wow-duration"),c=a.getAttribute("data-wow-delay"),e=a.getAttribute("data-wow-iteration"),this.customStyle(a,b,d,c,e)},c.prototype.resetStyle=function(){var a,b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.setAttribute("style","visibility: visible;"));return e},c.prototype.customStyle=function(a,b,c,d,e){return b?(a.style.visibility="hidden",a.style["-webkit-animation-name"]="none",a.style["animation-name"]="none"):(a.style.visibility="visible",a.style["-webkit-animation-name"]=window.getComputedStyle(a).getPropertyValue("webkitAnimationName"),a.style["animation-name"]=window.getComputedStyle(a).getPropertyValue("animationName")),c&&(a.style["-webkit-animation-duration"]=c,a.style["-moz-animation-duration"]=c,a.style["animation-duration"]=c),d&&(a.style["-webkit-animation-delay"]=d,a.style["-moz-animation-delay"]=d,a.style["animation-delay"]=d),e&&(a.style["-webkit-animation-iteration-count"]=e,a.style["-moz-animation-iteration-count"]=e,a.style["animation-iteration-count"]=e),a},c.prototype.scrollHandler=function(){return this.scrolled=!0},c.prototype.scrollCallback=function(){var a;return this.scrolled&&(this.scrolled=!1,this.boxes=function(){var b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],a&&(this.isVisible(a)?this.show(a):e.push(a));return e}.call(this),!this.boxes.length)?this.stop():void 0},c.prototype.offsetTop=function(a){var b;for(b=a.offsetTop;a=a.offsetParent;)b+=a.offsetTop;return b},c.prototype.isVisible=function(a){var b,c,d,e,f;return c=a.getAttribute("data-wow-offset")||this.config.offset,f=window.pageYOffset,e=f+this.element.clientHeight-c,d=this.offsetTop(a),b=d+a.clientHeight,e>=d&&b>=f},c.prototype.util=function(){return this._util||(this._util=new a)},c.prototype.disabled=function(){return!this.config.mobile&&this.util().isMobile(navigator.userAgent)},c}()}).call(this); 17804function setNewsletterCookie(){ 17805 jQuery.cookie('newsletter_popup','dontshowitagain'); 17806} 17807jQuery.fn.extend({ 17808 scrollToMe: function(){ 17809 if(jQuery(this).length){ 17810 var top = jQuery(this).offset().top - 100; 17811 jQuery('html,body').animate({scrollTop: top}, 300); 17812 } 17813 }, 17814 scrollToJustMe: function(){ 17815 if(jQuery(this).length){ 17816 var top = jQuery(this).offset().top; 17817 jQuery('html,body').animate({scrollTop: top}, 300); 17818 } 17819 } 17820}); 17821function portoAlert(msg){
17822 jQuery('<div class="note-msg container alert" style="display:none;position:fixed;top:30px;margin-left:-30px;z-index:9999;">'+msg+'</div>').appendTo("div.main"); 17823 jQuery(".alert").fadeIn(500); 17824 setTimeout(function(){ jQuery(".alert").fadeOut(500);setTimeout(function(){jQuery(".alert").remove();},500);},3000); 17825} 17826jQuery(function($){ 17827 $('div.product-view p.no-rating a, div.product-view .rating-links a').click(function(){ 17828 if($('#tab_review_tabbed').hasClass("panel-collapse")){ 17829 if(!$('#tab_review_tabbed').hasClass("in")) 17830 $('#tab_review_tabbed').prev().find("a").trigger("click"); 17831 setTimeout(function(){ 17832 $('#product_tab_accordion').scrollToJustMe(); 17833 },200); 17834 } else { 17835 $('.product-tabs ul li').removeClass('active'); 17836 $('#tab_review_tabbed').addClass('active'); 17837 $('.product-tabs .tab-content').hide(); 17838 $('#tab_review_tabbed_contents').show(); 17839 $('#tab_review_tabbed').scrollToMe(); 17840 } 17841 return false; 17842 }); 17843 17844 $(".word-rotate").each(function() { 17845 17846 var $this = $(this), 17847 itemsWrapper = $(this).find(".word-rotate-items"), 17848 items = itemsWrapper.find("> span"), 17849 firstItem = items.eq(0), 17850 firstItemClone = firstItem.clone(), 17851 itemHeight = 0, 17852 currentItem = 1, 17853 currentTop = 0; 17854 17855 itemHeight = firstItem.height(); 17856 17857 itemsWrapper.append(firstItemClone); 17858 17859 $this 17860 .height(itemHeight) 17861 .addClass("active"); 17862 17863 setInterval(function() { 17864 currentTop = (currentItem * itemHeight); 17865 17866 itemsWrapper.animate({ 17867 top: -(currentTop) + "px" 17868 }, 300, function() { 17869 currentItem++; 17870 if(currentItem > items.length) { 17871 itemsWrapper.css("top", 0); 17872 currentItem = 1; 17873 } 17874 }); 17875 17876 }, 2000); 17877 17878 }); 17879 $(window).stellar({ 17880 responsive: true, 17881 scrollProperty: 'scroll', 17882 parallaxElements: false, 17883 horizontalScrolling: false, 17884 horizontalOffset: 0, 17885 verticalOffset: 0 17886 }); 17887/********** Fullscreen Slider ************/ 17888 var s_width = $(window).innerWidth(); 17889 var s_height = $(window).innerHeight(); 17890 var s_ratio = s_width/s_height; 17891 var v_width=320; 17892 var v_height=240; 17893 var v_ratio = v_width/v_height; 17894 $(".full-screen-slider div.item").css("position","relative"); 17895 $(".full-screen-slider div.item").css("overflow","hidden"); 17896 $(".full-screen-slider div.item").width(s_width); 17897 $(".full-screen-slider div.item").height(s_height); 17898 $(".full-screen-slider div.item > video").css("position","absolute"); 17899 $(".full-screen-slider div.item > video").bind("loadedmetadata",function(){ 17900 v_width = this.videoWidth; 17901 v_height = this.videoHeight; 17902 v_ratio = v_width/v_height; 17903 if(s_ratio>=v_ratio){ 17904 $(this).width(s_width); 17905 $(this).height(""); 17906 $(this).css("left","0px"); 17907 $(this).css("top",(s_height-s_width/v_width*v_height)/2+"px"); 17908 }else{ 17909 $(this).width(""); 17910 $(this).height(s_height); 17911 $(this).css("left",(s_width-s_height/v_height*v_width)/2+"px"); 17912 $(this).css("top","0px"); 17913 } 17914 $(this).get(0).play(); 17915 }); 17916 $(".header-container.type10 .dropdown-menu .menu-container>a").click(function(){ 17917 if(!$("body").hasClass("cms-index-index") || $(".header-container.type10").hasClass("sticky-header")) { 17918 if ($(this).next().hasClass("show")) { 17919 $(this).next().removeClass("show"); 17920 } else { 17921 $(this).next().addClass("show"); 17922 } 17923 } 17924 if($(window).width()<=991){ 17925 if ($(".mobile-nav.side-block").hasClass("show")) { 17926 $(".mobile-nav.side-block").removeClass("show"); 17927 $(".mobile-nav.side-block").slideUp(); 17928 } else { 17929 $(".mobile-nav.side-block").addClass("show"); 17930 $(".mobile-nav.side-block").slideDown(); 17931 } 17932 } 17933 }); 17934 if($(window).width()>=992) 17935 $(".cms-index-index .header-container.type10+.top-container .slider-wrapper").css("min-height",$(".header-container.type10 .menu.side-menu").height()+20+"px"); 17936 $(window).resize(function(){ 17937 if($(window).width()>=992) 17938 $(".cms-index-index .header-container.type10+.top-container .slider-wrapper").css("min-height",$(".header-container.type10 .menu.side-menu").height()+20+"px"); 17939 else 17940 $(".cms-index-index .header-container.type10+.top-container .slider-wrapper").css("min-height",""); 17941 s_width = $(window).innerWidth(); 17942 s_height = $(window).innerHeight(); 17943 s_ratio = s_width/s_height; 17944 $(".full-screen-slider div.item").width(s_width); 17945 $(".full-screen-slider div.item").height(s_height); 17946 $(".full-screen-slider div.item > video").each(function(){ 17947 if(s_ratio>=v_ratio){ 17948 $(this).width(s_width); 17949 $(this).height(""); 17950 $(this).css("left","0px"); 17951 $(this).css("top",(s_height-s_width/v_width*v_height)/2+"px"); 17952 }else{ 17953 $(this).width(""); 17954 $(this).height(s_height); 17955 $(this).css("left",(s_width-s_height/v_height*v_width)/2+"px"); 17956 $(this).css("top","0px"); 17957 } 17958 }); 17959 }); 17960 17961/************** Header - Search icon, Links icon click event ***************/ 17962 $(".top-links-icon").click(function(e){ 17963 $("a.search-icon").parent().children("#search_mini_form").removeClass("show"); 17964 if($(this).parent().children("ul.links").hasClass("show")){ 17965 $(this).parent().children("ul.links").removeClass("show"); 17966 } 17967 else 17968 $(this).parent().children("ul.links").addClass("show"); 17969 e.stopPropagation(); 17970 }); 17971 $("a.search-icon").click(function(e){ 17972 $(".top-links-icon").parent().children("ul.links").removeClass("show"); 17973 if($(this).parent().children("#search_mini_form").hasClass("show")){ 17974 $(this).parent().children("#search_mini_form").removeClass("show"); 17975 } 17976 else 17977 $(this).parent().children("#search_mini_form").addClass("show"); 17978 e.stopPropagation(); 17979 }); 17980 $("a.search-icon").parent().click(function(e){ 17981 e.stopPropagation(); 17982 }) 17983 $("html,body").click(function(){ 17984 $(".top-links-icon").parent().children("ul.links").removeClass("show"); 17985 $("a.search-icon").parent().children("#search_mini_form").removeClass("show"); 17986 }); 17987 17988 /********************* Product Images ***********************/ 17989 17990 $("a.product-image img.defaultImage").each(function(){ 17991 var default_img = $(this).attr("src"); 17992 if(!default_img) 17993 default_img = $(this).attr("data-src"); 17994 var thumbnail_img = $(this).parent().children("img.hoverImage").attr("src"); 17995 if(!thumbnail_img) 17996 thumbnail_img = $(this).parent().children("img.hoverImage").attr("data-src"); 17997 if(default_img){ 17998 if(default_img.replace("/small_image/","/thumbnail/")==thumbnail_img){ 17999 $(this).parent().children("img.hoverImage").remove(); 18000 $(this).removeClass("defaultImage"); 18001 } 18002 } 18003 }); 18004 18005 /********************* Qty Holder **************************/ 18006 $(".table_qty_inc").unbind('click').click(function(){ 18007 if($(this).parent().children(".qty").is(':enabled')) 18008 $(this).parent().children(".qty").val((+$(this).parent().children(".qty").val()+1) || 0); 18009 }); 18010 $(".table_qty_dec").unbind('click').click(function(){ 18011 if($(this).parent().children(".qty").is(':enabled')) 18012 $(this).parent().children(".qty").val(($(this).parent().children(".qty").val()-1 > 0)?($(this).parent().children(".qty").val() - 1) : 0); 18013 }); 18014 18015 $(".qty_inc").unbind('click').click(function(){ 18016 if($(this).parent().parent().children("input.qty").is(':enabled')){ 18017 $(this).parent().parent().children("input.qty").val((+$(this).parent().parent().children("input.qty").val() + 1) || 0); 18018 $(this).parent().parent().children("input.qty").focus(); 18019 $(this).focus(); 18020 } 18021 }); 18022 $(".qty_dec").unbind('click').click(function(){ 18023 if($(this).parent().parent().children("input.qty").is(':enabled')){ 18024 $(this).parent().parent().children("input.qty").val(($(this).parent().parent().children("input.qty").val() - 1 > 0) ? ($(this).parent().parent().children("input.qty").val() - 1) : 0); 18025 $(this).parent().parent().children("input.qty").focus(); 18026 $(this).focus(); 18027 } 18028 }); 18029 18030 /* moving action links into product image area */ 18031 $(".move-action .item .details-area .actions").each(function(){ 18032 $(this).parent().parent().children(".product-image-area").append($(this)); 18033 }); 18034}); 18035jQuery(function($){ 18036 var breadcrumb_pos_top = 0; 18037 $(window).scroll(function(){ 18038 if(!$("body").hasClass("cms-index-index")){ 18039 var side_header_height = $(".header-container.type12").innerHeight(); 18040 var window_height = $(window).height(); 18041 if(side_header_height-window_height<$(window).scrollTop()){ 18042 if(!$(".header-container.type12").hasClass("fixed-bottom")) 18043 $(".header-container.type12").addClass("fixed-bottom"); 18044 } 18045 if(side_header_height-window_height>=$(window).scrollTop()){ 18046 if($(".header-container.type12").hasClass("fixed-bottom")) 18047 $(".header-container.type12").removeClass("fixed-bottom"); 18048 } 18049 } 18050 if($("body.side-header .top-container > .breadcrumbs").length){ 18051 if(!$("body.side-header .top-container > .breadcrumbs").hasClass("fixed-position")){ 18052 breadcrumb_pos_top = $("body.side-header .top-container > .breadcrumbs").offset().top; 18053 if($("body.side-header .top-container > .breadcrumbs").offset().top<$(window).scrollTop()){ 18054 $("body.side-header .top-container > .breadcrumbs").addClass("fixed-position"); 18055 } 18056 }else{ 18057 if($(window).scrollTop()<=1){ 18058 $("body.side-header .top-container > .breadcrumbs").removeClass("fixed-position"); 18059 } 18060 } 18061 } 18062 }); 18063});
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.