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// Credit Card Validation Javascript 6084// copyright 12th May 2003, by Stephen Chapman, Felgall Pty Ltd 6085 6086// You have permission to copy and use this javascript provided that 6087// the content of the script is not changed in any way. 6088 6089function validateCreditCard(s) { 6090 // remove non-numerics 6091 var v = "0123456789"; 6092 var w = ""; 6093 for (i=0; i < s.length; i++) { 6094 x = s.charAt(i); 6095 if (v.indexOf(x,0) != -1) 6096 w += x; 6097 } 6098 // validate number 6099 j = w.length / 2; 6100 k = Math.floor(j); 6101 m = Math.ceil(j) - k; 6102 c = 0; 6103 for (i=0; i<k; i++) { 6104 a = w.charAt(i*2+m) * 2; 6105 c += a > 9 ? Math.floor(a/10 + a%10) : a; 6106 } 6107 for (i=0; i<k+m; i++) c += w.charAt(i*2+1-m) * 1; 6108 return (c%10 == 0); 6109} 6110/* 6111* Really easy field validation with Prototype 6112* http://tetlaw.id.au/view/javascript/really-easy-field-validation 6113* Andrew Tetlaw 6114* Version 1.5.4.1 (2007-01-05) 6115* 6116* Copyright (c) 2007 Andrew Tetlaw 6117* Permission is hereby granted, free of charge, to any person 6118* obtaining a copy of this software and associated documentation 6119* files (the "Software"), to deal in the Software without 6120* restriction, including without limitation the rights to use, copy, 6121* modify, merge, publish, distribute, sublicense, and/or sell copies 6122* of the Software, and to permit persons to whom the Software is 6123* furnished to do so, subject to the following conditions: 6124* 6125* The above copyright notice and this permission notice shall be 6126* included in all copies or substantial portions of the Software. 6127* 6128* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 6129* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 6130* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 6131* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 6132* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 6133* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 6134* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 6135* SOFTWARE. 6136* 6137*/ 6138var Validator = Class.create(); 6139 6140Validator.prototype = { 6141 initialize : function(className, error, test, options) { 6142 if(typeof test == 'function'){ 6143 this.options = $H(options); 6144 this._test = test; 6145 } else { 6146 this.options = $H(test); 6147 this._test = function(){return true}; 6148 } 6149 this.error = error || 'Validation failed.'; 6150 this.className = className; 6151 }, 6152 test : function(v, elm) { 6153 return (this._test(v,elm) && this.options.all(function(p){ 6154 return Validator.methods[p.key] ? Validator.methods[p.key](v,elm,p.value) : true; 6155 })); 6156 } 6157} 6158Validator.methods = { 6159 pattern : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || opt.test(v)}, 6160 minLength : function(v,elm,opt) {return v.length >= opt}, 6161 maxLength : function(v,elm,opt) {return v.length <= opt}, 6162 min : function(v,elm,opt) {return v >= parseFloat(opt)}, 6163 max : function(v,elm,opt) {return v <= parseFloat(opt)}, 6164 notOneOf : function(v,elm,opt) {return $A(opt).all(function(value) { 6165 return v != value; 6166 })}, 6167 oneOf : function(v,elm,opt) {return $A(opt).any(function(value) { 6168 return v == value; 6169 })}, 6170 is : function(v,elm,opt) {return v == opt}, 6171 isNot : function(v,elm,opt) {return v != opt}, 6172 equalToField : function(v,elm,opt) {return v == $F(opt)}, 6173 notEqualToField : function(v,elm,opt) {return v != $F(opt)}, 6174 include : function(v,elm,opt) {return $A(opt).all(function(value) { 6175 return Validation.get(value).test(v,elm); 6176 })} 6177} 6178 6179var Validation = Class.create(); 6180Validation.defaultOptions = { 6181 onSubmit : true, 6182 stopOnFirst : false, 6183 immediate : false, 6184 focusOnError : true, 6185 useTitles : false, 6186 addClassNameToContainer: false, 6187 containerClassName: '.input-box', 6188 onFormValidate : function(result, form) {}, 6189 onElementValidate : function(result, elm) {} 6190}; 6191 6192Validation.prototype = { 6193 initialize : function(form, options){ 6194 this.form = $(form); 6195 if (!this.form) { 6196 return; 6197 } 6198 this.options = Object.extend({ 6199 onSubmit : Validation.defaultOptions.onSubmit, 6200 stopOnFirst : Validation.defaultOptions.stopOnFirst, 6201 immediate : Validation.defaultOptions.immediate, 6202 focusOnError : Validation.defaultOptions.focusOnError, 6203 useTitles : Validation.defaultOptions.useTitles, 6204 onFormValidate : Validation.defaultOptions.onFormValidate, 6205 onElementValidate : Validation.defaultOptions.onElementValidate 6206 }, options || {}); 6207 if(this.options.onSubmit) Event.observe(this.form,'submit',this.onSubmit.bind(this),false); 6208 if(this.options.immediate) { 6209 Form.getElements(this.form).each(function(input) { // Thanks Mike! 6210 if (input.tagName.toLowerCase() == 'select') { 6211 Event.observe(input, 'blur', this.onChange.bindAsEventListener(this)); 6212 } 6213 if (input.type.toLowerCase() == 'radio' || input.type.toLowerCase() == 'checkbox') { 6214 Event.observe(input, 'click', this.onChange.bindAsEventListener(this)); 6215 } else { 6216 Event.observe(input, 'change', this.onChange.bindAsEventListener(this)); 6217 } 6218 }, this); 6219 } 6220 }, 6221 onChange : function (ev) { 6222 Validation.isOnChange = true; 6223 Validation.validate(Event.element(ev),{ 6224 useTitle : this.options.useTitles, 6225 onElementValidate : this.options.onElementValidate 6226 }); 6227 Validation.isOnChange = false;
6228 }, 6229 onSubmit : function(ev){ 6230 if(!this.validate()) Event.stop(ev); 6231 }, 6232 validate : function() { 6233 var result = false; 6234 var useTitles = this.options.useTitles; 6235 var callback = this.options.onElementValidate; 6236 try { 6237 if(this.options.stopOnFirst) { 6238 result = Form.getElements(this.form).all(function(elm) { 6239 if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) { 6240 return true; 6241 } 6242 return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); 6243 }, this); 6244 } else { 6245 result = Form.getElements(this.form).collect(function(elm) { 6246 if (elm.hasClassName('local-validation') && !this.isElementInForm(elm, this.form)) { 6247 return true; 6248 } 6249 return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); 6250 }, this).all(); 6251 } 6252 } catch (e) { 6253 } 6254 if(!result && this.options.focusOnError) { 6255 try{ 6256 Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first().focus() 6257 } 6258 catch(e){ 6259 } 6260 } 6261 this.options.onFormValidate(result, this.form); 6262 return result; 6263 }, 6264 reset : function() { 6265 Form.getElements(this.form).each(Validation.reset); 6266 }, 6267 isElementInForm : function(elm, form) { 6268 var domForm = elm.up('form'); 6269 if (domForm == form) { 6270 return true; 6271 } 6272 return false; 6273 } 6274} 6275 6276Object.extend(Validation, { 6277 validate : function(elm, options){ 6278 options = Object.extend({ 6279 useTitle : false, 6280 onElementValidate : function(result, elm) {} 6281 }, options || {}); 6282 elm = $(elm); 6283 6284 var cn = $w(elm.className); 6285 return result = cn.all(function(value) { 6286 var test = Validation.test(value,elm,options.useTitle); 6287 options.onElementValidate(test, elm); 6288 return test; 6289 }); 6290 }, 6291 insertAdvice : function(elm, advice){ 6292 var container = $(elm).up('.field-row'); 6293 if(container){ 6294 Element.insert(container, {after: advice}); 6295 } else if (elm.up('td.value')) { 6296 elm.up('td.value').insert({bottom: advice}); 6297 } else if (elm.advaiceContainer && $(elm.advaiceContainer)) { 6298 $(elm.advaiceContainer).update(advice); 6299 } 6300 else { 6301 switch (elm.type.toLowerCase()) { 6302 case 'checkbox': 6303 case 'radio': 6304 var p = elm.parentNode; 6305 if(p) { 6306 Element.insert(p, {'bottom': advice}); 6307 } else { 6308 Element.insert(elm, {'after': advice}); 6309 } 6310 break; 6311 default: 6312 Element.insert(elm, {'after': advice}); 6313 } 6314 } 6315 }, 6316 showAdvice : function(elm, advice, adviceName){ 6317 if(!elm.advices){ 6318 elm.advices = new Hash(); 6319 } 6320 else{ 6321 elm.advices.each(function(pair){ 6322 if (!advice || pair.value.id != advice.id) { 6323 // hide non-current advice after delay 6324 this.hideAdvice(elm, pair.value); 6325 } 6326 }.bind(this)); 6327 } 6328 elm.advices.set(adviceName, advice); 6329 if(typeof Effect == 'undefined') { 6330 advice.style.display = 'block'; 6331 } else { 6332 if(!advice._adviceAbsolutize) { 6333 new Effect.Appear(advice, {duration : 1 }); 6334 } else { 6335 Position.absolutize(advice); 6336 advice.show(); 6337 advice.setStyle({ 6338 'top':advice._adviceTop, 6339 'left': advice._adviceLeft, 6340 'width': advice._adviceWidth, 6341 'z-index': 1000 6342 }); 6343 advice.addClassName('advice-absolute'); 6344 } 6345 } 6346 }, 6347 hideAdvice : function(elm, advice){ 6348 if (advice != null) { 6349 new Effect.Fade(advice, {duration : 1, afterFinishInternal : function() {advice.hide();}}); 6350 } 6351 }, 6352 updateCallback : function(elm, status) { 6353 if (typeof elm.callbackFunction != 'undefined') { 6354 eval(elm.callbackFunction+'(\''+elm.id+'\',\''+status+'\')'); 6355 } 6356 }, 6357 ajaxError : function(elm, errorMsg) { 6358 var name = 'validate-ajax'; 6359 var advice = Validation.getAdvice(name, elm); 6360 if (advice == null) { 6361 advice = this.createAdvice(name, elm, false, errorMsg); 6362 } 6363 this.showAdvice(elm, advice, 'validate-ajax'); 6364 this.updateCallback(elm, 'failed'); 6365 6366 elm.addClassName('validation-failed'); 6367 elm.addClassName('validate-ajax'); 6368 if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') { 6369 var container = elm.up(Validation.defaultOptions.containerClassName); 6370 if (container && this.allowContainerClassName(elm)) { 6371 container.removeClassName('validation-passed'); 6372 container.addClassName('validation-error'); 6373 } 6374 } 6375 }, 6376 allowContainerClassName: function (elm) { 6377 if (elm.type == 'radio' || elm.type == 'checkbox') { 6378 return elm.hasClassName('change-container-classname'); 6379 } 6380 6381 return true; 6382 }, 6383 test : function(name, elm, useTitle) { 6384 var v = Validation.get(name); 6385 var prop = '__advice'+name.camelize(); 6386 try { 6387 if(Validation.isVisible(elm) && !v.test($F(elm), elm)) { 6388 //if(!elm[prop]) { 6389 var advice = Validation.getAdvice(name, elm); 6390 if (advice == null) { 6391 advice = this.createAdvice(name, elm, useTitle); 6392 } 6393 this.showAdvice(elm, advice, name); 6394 this.updateCallback(elm, 'failed'); 6395 //} 6396 elm[prop] = 1; 6397 if (!elm.advaiceContainer) { 6398 elm.removeClassName('validation-passed'); 6399 elm.addClassName('validation-failed'); 6400 } 6401 6402 if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') { 6403 var container = elm.up(Validation.defaultOptions.containerClassName); 6404 if (container && this.allowContainerClassName(elm)) { 6405 container.removeClassName('validation-passed'); 6406 container.addClassName('validation-error'); 6407 } 6408 } 6409 return false;
6410 } else { 6411 var advice = Validation.getAdvice(name, elm); 6412 this.hideAdvice(elm, advice); 6413 this.updateCallback(elm, 'passed'); 6414 elm[prop] = ''; 6415 elm.removeClassName('validation-failed'); 6416 elm.addClassName('validation-passed'); 6417 if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') { 6418 var container = elm.up(Validation.defaultOptions.containerClassName); 6419 if (container && !container.down('.validation-failed') && this.allowContainerClassName(elm)) { 6420 if (!Validation.get('IsEmpty').test(elm.value) || !this.isVisible(elm)) { 6421 container.addClassName('validation-passed'); 6422 } else { 6423 container.removeClassName('validation-passed'); 6424 } 6425 container.removeClassName('validation-error'); 6426 } 6427 } 6428 return true; 6429 } 6430 } catch(e) { 6431 throw(e) 6432 } 6433 }, 6434 isVisible : function(elm) { 6435 while(elm.tagName != 'BODY') { 6436 if(!$(elm).visible()) return false; 6437 elm = elm.parentNode; 6438 } 6439 return true; 6440 }, 6441 getAdvice : function(name, elm) { 6442 return $('advice-' + name + '-' + Validation.getElmID(elm)) || $('advice-' + Validation.getElmID(elm)); 6443 }, 6444 createAdvice : function(name, elm, useTitle, customError) { 6445 var v = Validation.get(name); 6446 var errorMsg = useTitle ? ((elm && elm.title) ? elm.title : v.error) : v.error; 6447 if (customError) { 6448 errorMsg = customError; 6449 } 6450 try { 6451 if (Translator){ 6452 errorMsg = Translator.translate(errorMsg); 6453 } 6454 } 6455 catch(e){} 6456 6457 advice = '<div class="validation-advice" id="advice-' + name + '-' + Validation.getElmID(elm) +'" style="display:none">' + errorMsg + '</div>' 6458 6459 6460 Validation.insertAdvice(elm, advice); 6461 advice = Validation.getAdvice(name, elm); 6462 if($(elm).hasClassName('absolute-advice')) { 6463 var dimensions = $(elm).getDimensions(); 6464 var originalPosition = Position.cumulativeOffset(elm); 6465 6466 advice._adviceTop = (originalPosition[1] + dimensions.height) + 'px'; 6467 advice._adviceLeft = (originalPosition[0]) + 'px'; 6468 advice._adviceWidth = (dimensions.width) + 'px'; 6469 advice._adviceAbsolutize = true; 6470 } 6471 return advice; 6472 }, 6473 getElmID : function(elm) { 6474 return elm.id ? elm.id : elm.name; 6475 }, 6476 reset : function(elm) { 6477 elm = $(elm); 6478 var cn = $w(elm.className); 6479 cn.each(function(value) { 6480 var prop = '__advice'+value.camelize(); 6481 if(elm[prop]) { 6482 var advice = Validation.getAdvice(value, elm); 6483 if (advice) { 6484 advice.hide(); 6485 } 6486 elm[prop] = ''; 6487 } 6488 elm.removeClassName('validation-failed'); 6489 elm.removeClassName('validation-passed'); 6490 if (Validation.defaultOptions.addClassNameToContainer && Validation.defaultOptions.containerClassName != '') { 6491 var container = elm.up(Validation.defaultOptions.containerClassName); 6492 if (container) { 6493 container.removeClassName('validation-passed'); 6494 container.removeClassName('validation-error'); 6495 } 6496 } 6497 }); 6498 }, 6499 add : function(className, error, test, options) { 6500 var nv = {}; 6501 nv[className] = new Validator(className, error, test, options); 6502 Object.extend(Validation.methods, nv); 6503 }, 6504 addAllThese : function(validators) { 6505 var nv = {}; 6506 $A(validators).each(function(value) { 6507 nv[value[0]] = new Validator(value[0], value[1], value[2], (value.length > 3 ? value[3] : {})); 6508 }); 6509 Object.extend(Validation.methods, nv); 6510 }, 6511 get : function(name) { 6512 return Validation.methods[name] ? Validation.methods[name] : Validation.methods['_LikeNoIDIEverSaw_']; 6513 }, 6514 methods : { 6515 '_LikeNoIDIEverSaw_' : new Validator('_LikeNoIDIEverSaw_','',{}) 6516 } 6517}); 6518 6519Validation.add('IsEmpty', '', function(v) { 6520 return (v == '' || (v == null) || (v.length == 0) || /^\s+$/.test(v)); 6521}); 6522 6523Validation.addAllThese([ 6524 ['validate-no-html-tags', 'HTML tags are not allowed', function(v) { 6525 return !/<(\/)?\w+/.test(v); 6526 }], 6527 ['validate-select', 'Please select an option.', function(v) { 6528 return ((v != "none") && (v != null) && (v.length != 0)); 6529 }], 6530 ['required-entry', 'This is a required field.', function(v) { 6531 return !Validation.get('IsEmpty').test(v); 6532 }], 6533 ['validate-number', 'Please enter a valid number in this field.', function(v) { 6534 return Validation.get('IsEmpty').test(v) 6535 || (!isNaN(parseNumber(v)) && /^\s*-?\d*(\.\d*)?\s*$/.test(v)); 6536 }], 6537 ['validate-number-range', 'The value is not within the specified range.', function(v, elm) { 6538 if (Validation.get('IsEmpty').test(v)) { 6539 return true; 6540 } 6541 6542 var numValue = parseNumber(v); 6543 if (isNaN(numValue)) { 6544 return false;
6545 } 6546 6547 var reRange = /^number-range-(-?[\d.,]+)?-(-?[\d.,]+)?$/, 6548 result = true; 6549 6550 $w(elm.className).each(function(name) { 6551 var m = reRange.exec(name); 6552 if (m) { 6553 result = result 6554 && (m[1] == null || m[1] == '' || numValue >= parseNumber(m[1])) 6555 && (m[2] == null || m[2] == '' || numValue <= parseNumber(m[2])); 6556 } 6557 }); 6558 6559 return result; 6560 }], 6561 ['validate-digits', 'Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.', function(v) { 6562 return Validation.get('IsEmpty').test(v) || !/[^\d]/.test(v); 6563 }], 6564 ['validate-digits-range', 'The value is not within the specified range.', function(v, elm) { 6565 if (Validation.get('IsEmpty').test(v)) { 6566 return true; 6567 } 6568 6569 var numValue = parseNumber(v); 6570 if (isNaN(numValue)) { 6571 return false; 6572 } 6573 6574 var reRange = /^digits-range-(-?\d+)?-(-?\d+)?$/, 6575 result = true; 6576 6577 $w(elm.className).each(function(name) { 6578 var m = reRange.exec(name); 6579 if (m) { 6580 result = result 6581 && (m[1] == null || m[1] == '' || numValue >= parseNumber(m[1])) 6582 && (m[2] == null || m[2] == '' || numValue <= parseNumber(m[2])); 6583 } 6584 }); 6585 6586 return result; 6587 }], 6588 ['validate-alpha', 'Please use letters only (a-z or A-Z) in this field.', function (v) { 6589 return Validation.get('IsEmpty').test(v) || /^[a-zA-Z]+$/.test(v) 6590 }], 6591 ['validate-code', 'Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.', function (v) { 6592 return Validation.get('IsEmpty').test(v) || /^[a-z]+[a-z0-9_]+$/.test(v) 6593 }], 6594 ['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) { 6595 return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9]+$/.test(v) 6596 }], 6597 ['validate-alphanum-with-spaces', 'Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.', function(v) { 6598 return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9 ]+$/.test(v) 6599 }], 6600 ['validate-street', 'Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.', function(v) { 6601 return Validation.get('IsEmpty').test(v) || /^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(v) 6602 }], 6603 ['validate-phoneStrict', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) { 6604 return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v); 6605 }], 6606 ['validate-phoneLax', '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[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(v); 6608 }], 6609 ['validate-fax', 'Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.', function(v) { 6610 return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v); 6611 }], 6612 ['validate-date', 'Please enter a valid date.', function(v) { 6613 var test = new Date(v); 6614 return Validation.get('IsEmpty').test(v) || !isNaN(test); 6615 }], 6616 ['validate-date-range', 'The From Date value should be less than or equal to the To Date value.', function(v, elm) { 6617 var m = /\bdate-range-(\w+)-(\w+)\b/.exec(elm.className); 6618 if (!m || m[2] == 'to' || Validation.get('IsEmpty').test(v)) { 6619 return true; 6620 } 6621 6622 var currentYear = new Date().getFullYear() + ''; 6623 var normalizedTime = function(v) { 6624 v = v.split(/[.\/]/); 6625 if (v[2] && v[2].length < 4) { 6626 v[2] = currentYear.substr(0, v[2].length) + v[2]; 6627 } 6628 return new Date(v.join('/')).getTime(); 6629 }; 6630 6631 var dependentElements = Element.select(elm.form, '.validate-date-range.date-range-' + m[1] + '-to'); 6632 return !dependentElements.length || Validation.get('IsEmpty').test(dependentElements[0].value) 6633 || normalizedTime(v) <= normalizedTime(dependentElements[0].value); 6634 }], 6635 ['validate-email', 'Please enter a valid email address. For example [email protected].', function (v) { 6636 //return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v) 6637 //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) 6638 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) 6639 }], 6640 ['validate-emailSender', 'Please use only visible characters and spaces.', function (v) { 6641 return Validation.get('IsEmpty').test(v) || /^[\S ]+$/.test(v) 6642 }], 6643 ['validate-password', 'Please enter 6 or more characters. Leading or trailing space
6643s will be ignored.', function(v) { 6644 var pass=v.strip(); /*strip leading and trailing spaces*/ 6645 return !(pass.length>0 && pass.length < 6); 6646 }], 6647 ['validate-admin-password', 'Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.', function(v) { 6648 var pass=v.strip(); 6649 if (0 == pass.length) { 6650 return true; 6651 } 6652 if (!(/[a-z]/i.test(v)) || !(/[0-9]/.test(v))) { 6653 return false; 6654 } 6655 return !(pass.length < 7); 6656 }], 6657 ['validate-cpassword', 'Please make sure your passwords match.', function(v) { 6658 var conf = $('confirmation') ? $('confirmation') : $$('.validate-cpassword')[0]; 6659 var pass = false; 6660 if ($('password')) { 6661 pass = $('password'); 6662 } 6663 var passwordElements = $$('.validate-password'); 6664 for (var i = 0; i < passwordElements.size(); i++) { 6665 var passwordElement = passwordElements[i]; 6666 if (passwordElement.up('form').id == conf.up('form').id) { 6667 pass = passwordElement; 6668 } 6669 } 6670 if ($$('.validate-admin-password').size()) { 6671 pass = $$('.validate-admin-password')[0]; 6672 } 6673 return (pass.value == conf.value); 6674 }], 6675 ['validate-both-passwords', 'Please make sure your passwords match.', function(v, input) { 6676 var dependentInput = $(input.form[input.name == 'password' ? 'confirmation' : 'password']), 6677 isEqualValues = input.value == dependentInput.value; 6678 6679 if (isEqualValues && dependentInput.hasClassName('validation-failed')) { 6680 Validation.test(this.className, dependentInput); 6681 } 6682 6683 return dependentInput.value == '' || isEqualValues; 6684 }], 6685 ['validate-url', 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)', function (v) { 6686 v = (v || '').replace(/^\s+/, '').replace(/\s+$/, ''); 6687 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) 6688 }], 6689 ['validate-clean-url', 'Please enter a valid URL. For example http://www.example.com or www.example.com', function (v) { 6690 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) 6691 }], 6692 ['validate-identifier', 'Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page".', function (v) { 6693 return Validation.get('IsEmpty').test(v) || /^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/.test(v) 6694 }], 6695 ['validate-xml-identifier', 'Please enter a valid XML-identifier. For example something_1, block5, id-4.', function (v) { 6696 return Validation.get('IsEmpty').test(v) || /^[A-Z][A-Z0-9_\/-]*$/i.test(v) 6697 }], 6698 ['validate-ssn', 'Please enter a valid social security number. For example 123-45-6789.', function(v) { 6699 return Validation.get('IsEmpty').test(v) || /^\d{3}-?\d{2}-?\d{4}$/.test(v); 6700 }], 6701 ['validate-zip', 'Please enter a valid zip code. For example 90602 or 90602-1234.', function(v) { 6702 return Validation.get('IsEmpty').test(v) || /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(v); 6703 }], 6704 ['validate-zip-international', 'Please enter a valid zip code.', function(v) { 6705 //return Validation.get('IsEmpty').test(v) || /(^[A-z0-9]{2,10}([\s]{0,1}|[\-]{0,1})[A-z0-9]{2,10}$)/.test(v); 6706 return true; 6707 }], 6708 ['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.', function(v) { 6709 if(Validation.get('IsEmpty').test(v)) return true; 6710 var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/; 6711 if(!regex.test(v)) return false;
6712 var d = new Date(v.replace(regex, '$2/$1/$3')); 6713 return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) && 6714 (parseInt(RegExp.$1, 10) == d.getDate()) && 6715 (parseInt(RegExp.$3, 10) == d.getFullYear() ); 6716 }], 6717 ['validate-currency-dollar', 'Please enter a valid $ amount. For example $100.00.', function(v) { 6718 // [$]1[##][,###]+[.##] 6719 // [$]1###+[.##] 6720 // [$]0.## 6721 // [$].## 6722 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) 6723 }], 6724 ['validate-one-required', 'Please select one of the above options.', function (v,elm) { 6725 var p = elm.parentNode; 6726 var options = p.getElementsByTagName('INPUT'); 6727 return $A(options).any(function(elm) { 6728 return $F(elm); 6729 }); 6730 }], 6731 ['validate-one-required-by-name', 'Please select one of the options.', function (v,elm) { 6732 var inputs = $$('input[name="' + elm.name.replace(/([\\"])/g, '\\$1') + '"]'); 6733 6734 var error = 1; 6735 for(var i=0;i<inputs.length;i++) { 6736 if((inputs[i].type == 'checkbox' || inputs[i].type == 'radio') && inputs[i].checked == true) { 6737 error = 0; 6738 } 6739 6740 if(Validation.isOnChange && (inputs[i].type == 'checkbox' || inputs[i].type == 'radio')) { 6741 Validation.reset(inputs[i]); 6742 } 6743 } 6744 6745 if( error == 0 ) { 6746 return true; 6747 } else { 6748 return false; 6749 } 6750 }], 6751 ['validate-not-negative-number', 'Please enter a number 0 or greater in this field.', function(v) { 6752 if (Validation.get('IsEmpty').test(v)) { 6753 return true; 6754 } 6755 v = parseNumber(v); 6756 return !isNaN(v) && v >= 0; 6757 }], 6758 ['validate-zero-or-greater', 'Please enter a number 0 or greater in this field.', function(v) { 6759 return Validation.get('validate-not-negative-number').test(v); 6760 }], 6761 ['validate-greater-than-zero', 'Please enter a number greater than 0 in this field.', function(v) { 6762 if (Validation.get('IsEmpty').test(v)) { 6763 return true; 6764 } 6765 v = parseNumber(v); 6766 return !isNaN(v) && v > 0; 6767 }], 6768 ['validate-state', 'Please select State/Province.', function(v) { 6769 return (v!=0 || v == ''); 6770 }], 6771 ['validate-new-password', 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.', function(v) { 6772 if (!Validation.get('validate-password').test(v)) return false; 6773 if (Validation.get('IsEmpty').test(v) && v != '') return false; 6774 return true; 6775 }], 6776 ['validate-cc-number', 'Please enter a valid credit card number.', function(v, elm) { 6777 // remove non-numerics 6778 var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type'); 6779 if (ccTypeContainer && typeof Validation.creditCartTypes.get(ccTypeContainer.value) != 'undefined' 6780 && Validation.creditCartTypes.get(ccTypeContainer.value)[2] == false) { 6781 if (!Validation.get('IsEmpty').test(v) && Validation.get('validate-digits').test(v)) { 6782 return true; 6783 } else { 6784 return false; 6785 } 6786 } 6787 return validateCreditCard(v); 6788 }], 6789 ['validate-cc-type', 'Credit card number does not match credit card type.', function(v, elm) { 6790 // remove credit card number delimiters such as "-" and space 6791 elm.value = removeDelimiters(elm.value); 6792 v = removeDelimiters(v); 6793 6794 var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type'); 6795 if (!ccTypeContainer) { 6796 return true; 6797 } 6798 var ccType = ccTypeContainer.value; 6799 6800 if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') { 6801 return false;
6802 } 6803 6804 // Other card type or switch or solo card 6805 if (Validation.creditCartTypes.get(ccType)[0]==false) { 6806 return true; 6807 } 6808 6809 var validationFailure = false; 6810 Validation.creditCartTypes.each(function (pair) { 6811 if (pair.key == ccType) { 6812 if (pair.value[0] && !v.match(pair.value[0])) { 6813 validationFailure = true; 6814 } 6815 throw $break; 6816 } 6817 }); 6818 6819 if (validationFailure) { 6820 return false; 6821 } 6822 6823 if (ccTypeContainer.hasClassName('validation-failed') && Validation.isOnChange) { 6824 Validation.validate(ccTypeContainer); 6825 } 6826 6827 return true; 6828 }], 6829 ['validate-cc-type-select', 'Card type does not match credit card number.', function(v, elm) { 6830 var ccNumberContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_type')) + '_cc_number'); 6831 if (Validation.isOnChange && Validation.get('IsEmpty').test(ccNumberContainer.value)) { 6832 return true; 6833 } 6834 if (Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer)) { 6835 Validation.validate(ccNumberContainer); 6836 } 6837 return Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer); 6838 }], 6839 ['validate-cc-exp', 'Incorrect credit card expiration date.', function(v, elm) { 6840 var ccExpMonth = v; 6841 var ccExpYear = $(elm.id.substr(0,elm.id.indexOf('_expiration')) + '_expiration_yr').value; 6842 var currentTime = new Date(); 6843 var currentMonth = currentTime.getMonth() + 1; 6844 var currentYear = currentTime.getFullYear(); 6845 if (ccExpMonth < currentMonth && ccExpYear == currentYear) { 6846 return false; 6847 } 6848 return true; 6849 }], 6850 ['validate-cc-cvn', 'Please enter a valid credit card verification number.', function(v, elm) { 6851 var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_cid')) + '_cc_type'); 6852 if (!ccTypeContainer) { 6853 return true; 6854 } 6855 var ccType = ccTypeContainer.value; 6856 6857 if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') { 6858 return false; 6859 } 6860 6861 var re = Validation.creditCartTypes.get(ccType)[1]; 6862 6863 if (v.match(re)) { 6864 return true; 6865 } 6866 6867 return false; 6868 }], 6869 ['validate-ajax', '', function(v, elm) { return true; }], 6870 ['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) { 6871 if(v != '' && v) { 6872 return /^[A-Za-z]+[A-Za-z0-9_]+$/.test(v); 6873 } 6874 return true; 6875 }], 6876 ['validate-css-length', 'Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%.', function (v) { 6877 if (v != '' && v) { 6878 return /^[0-9\.]+(px|pt|em|ex|%)?$/.test(v) && (!(/\..*\./.test(v))) && !(/\.$/.test(v)); 6879 } 6880 return true; 6881 }], 6882 ['validate-length', 'Text length does not satisfy specified text range.', function (v, elm) { 6883 var reMax = new RegExp(/^maximum-length-[0-9]+$/); 6884 var reMin = new RegExp(/^minimum-length-[0-9]+$/); 6885 var result = true; 6886 $w(elm.className).each(function(name, index) { 6887 if (name.match(reMax) && result) { 6888 var length = name.split('-')[2]; 6889 result = (v.length <= length); 6890 } 6891 if (name.match(reMin) && result && !Validation.get('IsEmpty').test(v)) { 6892 var length = name.split('-')[2]; 6893 result = (v.length >= length); 6894 } 6895 }); 6896 return result; 6897 }], 6898 ['validate-percents', 'Please enter a number lower than 100.', {max:100}], 6899 ['required-file', 'Please select a file', function(v, elm) { 6900 var result = !Validation.get('IsEmpty').test(v); 6901 if (result === false) { 6902 ovId = elm.id + '_value'; 6903 if ($(ovId)) { 6904 result = !Validation.get('IsEmpty').test($(ovId).value); 6905 } 6906 } 6907 return result; 6908 }], 6909 ['validate-cc-ukss', 'Please enter issue number or start date for switch/solo card type.', function(v,elm) { 6910 var endposition; 6911 6912 if (elm.id.match(/(.)+_cc_issue$/)) { 6913 endposition = elm.id.indexOf('_cc_issue'); 6914 } else if (elm.id.match(/(.)+_start_month$/)) { 6915 endposition = elm.id.indexOf('_start_month'); 6916 } else { 6917 endposition = elm.id.indexOf('_start_year'); 6918 } 6919 6920 var prefix = elm.id.substr(0,endposition); 6921 6922 var ccTypeContainer = $(prefix + '_cc_type'); 6923 6924 if (!ccTypeContainer) { 6925 return true; 6926 } 6927 var ccType = ccTypeContainer.value; 6928 6929 if(['SS','SM','SO'].indexOf(ccType) == -1){ 6930 return true; 6931 } 6932 6933 $(prefix + '_cc_issue').advaiceContainer 6934 = $(prefix + '_start_month').advaiceContainer 6935 = $(prefix + '_start_year').advaiceContainer 6936 = $(prefix + '_cc_type_ss_div').down('ul li.adv-container'); 6937 6938 var ccIssue = $(prefix + '_cc_issue').value; 6939 var ccSMonth = $(prefix + '_start_month').value; 6940 var ccSYear = $(prefix + '_start_year').value; 6941 6942 var ccStartDatePresent = (ccSMonth && ccSYear) ? true : false;
6943 6944 if (!ccStartDatePresent && !ccIssue){ 6945 return false; 6946 } 6947 return true; 6948 }] 6949]); 6950 6951function removeDelimiters (v) { 6952 v = v.replace(/\s/g, ''); 6953 v = v.replace(/\-/g, ''); 6954 return v; 6955} 6956 6957function parseNumber(v) 6958{ 6959 if (typeof v != 'string') { 6960 return parseFloat(v); 6961 } 6962 6963 var isDot = v.indexOf('.'); 6964 var isComa = v.indexOf(','); 6965 6966 if (isDot != -1 && isComa != -1) { 6967 if (isComa > isDot) { 6968 v = v.replace('.', '').replace(',', '.'); 6969 } 6970 else { 6971 v = v.replace(',', ''); 6972 } 6973 } 6974 else if (isComa != -1) { 6975 v = v.replace(',', '.'); 6976 } 6977 6978 return parseFloat(v); 6979} 6980 6981/** 6982 * Hash with credit card types which can be simply extended in payment modules 6983 * 0 - regexp for card number 6984 * 1 - regexp for cvn 6985 * 2 - check or not credit card number trough Luhn algorithm by 6986 * function validateCreditCard which you can find above in this file 6987 */ 6988Validation.creditCartTypes = $H({ 6989// '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], 6990 '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], 6991 'VI': [new RegExp('^4[0-9]{12}([0-9]{3})?$'), new RegExp('^[0-9]{3}$'), true], 6992 'MC': [new RegExp('^5[1-5][0-9]{14}$'), new RegExp('^[0-9]{3}$'), true], 6993 'AE': [new RegExp('^3[47][0-9]{13}$'), new RegExp('^[0-9]{4}$'), true], 6994 '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], 6995 '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], 6996 '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], 6997 '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], 6998 'OT': [false, new RegExp('^([0-9]{3}|[0-9]{4})?$'), false] 6999}); 7000// script.aculo.us builder.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 7001 7002// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 7003// 7004// script.aculo.us is freely distributable under the terms of an MIT-style license. 7005// For details, see the script.aculo.us web site: http://script.aculo.us/ 7006 7007var Builder = { 7008 NODEMAP: { 7009 AREA: 'map', 7010 CAPTION: 'table', 7011 COL: 'table', 7012 COLGROUP: 'table', 7013 LEGEND: 'fieldset', 7014 OPTGROUP: 'select', 7015 OPTION: 'select', 7016 PARAM: 'object', 7017 TBODY: 'table', 7018 TD: 'table', 7019 TFOOT: 'table', 7020 TH: 'table', 7021 THEAD: 'table', 7022 TR: 'table' 7023 }, 7024 // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken, 7025 // due to a Firefox bug 7026 node: function(elementName) { 7027 elementName = elementName.toUpperCase(); 7028 7029 // try innerHTML approach 7030 var parentTag = this.NODEMAP[elementName] || 'div'; 7031 var parentElement = document.createElement(parentTag); 7032 try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 7033 parentElement.innerHTML = "<" + elementName + "></" + elementName + ">"; 7034 } catch(e) {} 7035 var element = parentElement.firstChild || null; 7036 7037 // see if browser added wrapping tags 7038 if(element && (element.tagName.toUpperCase() != elementName)) 7039 element = element.getElementsByTagName(elementName)[0]; 7040 7041 // fallback to createElement approach 7042 if(!element) element = document.createElement(elementName); 7043 7044 // abort if nothing could be created 7045 if(!element) return; 7046 7047 // attributes (or text) 7048 if(arguments[1]) 7049 if(this._isStringOrNumber(arguments[1]) || 7050 (arguments[1] instanceof Array) || 7051 arguments[1].tagName) { 7052 this._children(element, arguments[1]); 7053 } else { 7054 var attrs = this._attributes(arguments[1]); 7055 if(attrs.length) { 7056 try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707 7057 parentElement.innerHTML = "<" +elementName + " " + 7058 attrs + "></" + elementName + ">"; 7059 } catch(e) {} 7060 element = parentElement.firstChild || null; 7061 // workaround firefox 1.0.X bug 7062 if(!element) { 7063 element = document.createElement(elementName); 7064 for(attr in arguments[1]) 7065 element[attr == 'class' ? 'className' : attr] = arguments[1][attr]; 7066 } 7067 if(element.tagName.toUpperCase() != elementName) 7068 element = parentElement.getElementsByTagName(elementName)[0]; 7069 } 7070 } 7071 7072 // text, or array of children 7073 if(arguments[2]) 7074 this._children(element, arguments[2]); 7075 7076 return $(element); 7077 }, 7078 _text: function(text) { 7079 return document.createTextNode(text); 7080 }, 7081 7082 ATTR_MAP: { 7083 'className': 'class', 7084 'htmlFor': 'for' 7085 }, 7086 7087 _attributes: function(attributes) { 7088 var attrs = []; 7089 for(attribute in attributes) 7090 attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + 7091 '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'"') + '"'); 7092 return attrs.join(" "); 7093 }, 7094 _children: function(element, children) { 7095 if(children.tagName) { 7096 element.appendChild(children); 7097 return; 7098 } 7099 if(typeof children=='object') { // array can hold nodes and text 7100 children.flatten().each( function(e) { 7101 if(typeof e=='object') 7102 element.appendChild(e); 7103 else 7104 if(Builder._isStringOrNumber(e)) 7105 element.appendChild(Builder._text(e)); 7106 }); 7107 } else 7108 if(Builder._isStringOrNumber(children)) 7109 element.appendChild(Builder._text(children)); 7110 }, 7111 _isStringOrNumber: function(param) {
7112 return(typeof param=='string' || typeof param=='number'); 7113 }, 7114 build: function(html) { 7115 var element = this.node('div'); 7116 $(element).update(html.strip()); 7117 return element.down(); 7118 }, 7119 dump: function(scope) { 7120 if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope 7121 7122 var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " + 7123 "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " + 7124 "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+ 7125 "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+ 7126 "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+ 7127 "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/); 7128 7129 tags.each( function(tag){ 7130 scope[tag] = function() { 7131 return Builder.node.apply(Builder, [tag].concat($A(arguments))); 7132 }; 7133 }); 7134 } 7135}; 7136// script.aculo.us effects.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 7137 7138// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 7139// Contributors: 7140// Justin Palmer (http://encytemedia.com/) 7141// Mark Pilgrim (http://diveintomark.org/) 7142// Martin Bialasinki 7143// 7144// script.aculo.us is freely distributable under the terms of an MIT-style license. 7145// For details, see the script.aculo.us web site: http://script.aculo.us/ 7146 7147// converts rgb() and #xxx to #xxxxxx format, 7148// returns self (or first argument) if not convertable 7149String.prototype.parseColor = function() { 7150 var color = '#'; 7151 if (this.slice(0,4) == 'rgb(') { 7152 var cols = this.slice(4,this.length-1).split(','); 7153 var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); 7154 } else { 7155 if (this.slice(0,1) == '#') { 7156 if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); 7157 if (this.length==7) color = this.toLowerCase(); 7158 } 7159 } 7160 return (color.length==7 ? color : (arguments[0] || this)); 7161}; 7162 7163/*--------------------------------------------------------------------------*/ 7164 7165Element.collectTextNodes = function(element) { 7166 return $A($(element).childNodes).collect( function(node) { 7167 return (node.nodeType==3 ? node.nodeValue : 7168 (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); 7169 }).flatten().join(''); 7170}; 7171 7172Element.collectTextNodesIgnoreClass = function(element, className) { 7173 return $A($(element).childNodes).collect( function(node) { 7174 return (node.nodeType==3 ? node.nodeValue : 7175 ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 7176 Element.collectTextNodesIgnoreClass(node, className) : '')); 7177 }).flatten().join(''); 7178}; 7179 7180Element.setContentZoom = function(element, percent) { 7181 element = $(element); 7182 element.setStyle({fontSize: (percent/100) + 'em'}); 7183 if (Prototype.Browser.WebKit) window.scrollBy(0,0); 7184 return element; 7185}; 7186 7187Element.getInlineOpacity = function(element){ 7188 return $(element).style.opacity || ''; 7189}; 7190 7191Element.forceRerendering = function(element) { 7192 try { 7193 element = $(element); 7194 var n = document.createTextNode(' '); 7195 element.appendChild(n); 7196 element.removeChild(n); 7197 } catch(e) { } 7198}; 7199 7200/*--------------------------------------------------------------------------*/ 7201 7202var Effect = { 7203 _elementDoesNotExistError: { 7204 name: 'ElementDoesNotExistError', 7205 message: 'The specified DOM element does not exist, but is required for this effect to operate' 7206 }, 7207 Transitions: { 7208 linear: Prototype.K, 7209 sinoidal: function(pos) { 7210 return (-Math.cos(pos*Math.PI)/2) + .5; 7211 }, 7212 reverse: function(pos) { 7213 return 1-pos; 7214 }, 7215 flicker: function(pos) { 7216 var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4; 7217 return pos > 1 ? 1 : pos; 7218 }, 7219 wobble: function(pos) { 7220 return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5; 7221 }, 7222 pulse: function(pos, pulses) { 7223 return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5; 7224 }, 7225 spring: function(pos) { 7226 return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); 7227 }, 7228 none: function(pos) { 7229 return 0; 7230 }, 7231 full: function(pos) { 7232 return 1; 7233 } 7234 }, 7235 DefaultOptions: { 7236 duration: 1.0, // seconds 7237 fps: 100, // 100= assume 66fps max. 7238 sync: false, // true for combining 7239 from: 0.0, 7240 to: 1.0, 7241 delay: 0.0, 7242 queue: 'parallel' 7243 }, 7244 tagifyText: function(element) { 7245 var tagifyStyle = 'position:relative'; 7246 if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; 7247 7248 element = $(element); 7249 $A(element.childNodes).each( function(child) { 7250 if (child.nodeType==3) {
7251 child.nodeValue.toArray().each( function(character) { 7252 element.insertBefore( 7253 new Element('span', {style: tagifyStyle}).update( 7254 character == ' ' ? String.fromCharCode(160) : character), 7255 child); 7256 }); 7257 Element.remove(child); 7258 } 7259 }); 7260 }, 7261 multiple: function(element, effect) { 7262 var elements; 7263 if (((typeof element == 'object') || 7264 Object.isFunction(element)) && 7265 (element.length)) 7266 elements = element; 7267 else 7268 elements = $(element).childNodes; 7269 7270 var options = Object.extend({ 7271 speed: 0.1, 7272 delay: 0.0 7273 }, arguments[2] || { }); 7274 var masterDelay = options.delay; 7275 7276 $A(elements).each( function(element, index) { 7277 new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); 7278 }); 7279 }, 7280 PAIRS: { 7281 'slide': ['SlideDown','SlideUp'], 7282 'blind': ['BlindDown','BlindUp'], 7283 'appear': ['Appear','Fade'] 7284 }, 7285 toggle: function(element, effect) { 7286 element = $(element); 7287 effect = (effect || 'appear').toLowerCase(); 7288 var options = Object.extend({ 7289 queue: { position:'end', scope:(element.id || 'global'), limit: 1 } 7290 }, arguments[2] || { }); 7291 Effect[element.visible() ? 7292 Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); 7293 } 7294}; 7295 7296Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; 7297 7298/* ------------- core effects ------------- */ 7299 7300Effect.ScopedQueue = Class.create(Enumerable, { 7301 initialize: function() { 7302 this.effects = []; 7303 this.interval = null; 7304 }, 7305 _each: function(iterator) { 7306 this.effects._each(iterator); 7307 }, 7308 add: function(effect) { 7309 var timestamp = new Date().getTime(); 7310 7311 var position = Object.isString(effect.options.queue) ? 7312 effect.options.queue : effect.options.queue.position; 7313 7314 switch(position) { 7315 case 'front': 7316 // move unstarted effects after this effect 7317 this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { 7318 e.startOn += effect.finishOn; 7319 e.finishOn += effect.finishOn; 7320 }); 7321 break; 7322 case 'with-last': 7323 timestamp = this.effects.pluck('startOn').max() || timestamp; 7324 break; 7325 case 'end': 7326 // start effect after last queued effect has finished 7327 timestamp = this.effects.pluck('finishOn').max() || timestamp; 7328 break; 7329 } 7330 7331 effect.startOn += timestamp; 7332 effect.finishOn += timestamp; 7333 7334 if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) 7335 this.effects.push(effect); 7336 7337 if (!this.interval) 7338 this.interval = setInterval(this.loop.bind(this), 15); 7339 }, 7340 remove: function(effect) { 7341 this.effects = this.effects.reject(function(e) { return e==effect }); 7342 if (this.effects.length == 0) { 7343 clearInterval(this.interval); 7344 this.interval = null; 7345 } 7346 }, 7347 loop: function() { 7348 var timePos = new Date().getTime(); 7349 for(var i=0, len=this.effects.length;i<len;i++) 7350 this.effects[i] && this.effects[i].loop(timePos); 7351 } 7352}); 7353 7354Effect.Queues = { 7355 instances: $H(), 7356 get: function(queueName) { 7357 if (!Object.isString(queueName)) return queueName; 7358 7359 return this.instances.get(queueName) || 7360 this.instances.set(queueName, new Effect.ScopedQueue()); 7361 } 7362}; 7363Effect.Queue = Effect.Queues.get('global'); 7364 7365Effect.Base = Class.create({ 7366 position: null, 7367 start: function(options) { 7368 function codeForEvent(options,eventName){ 7369 return ( 7370 (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') + 7371 (options[eventName] ? 'this.options.'+eventName+'(this);' : '') 7372 ); 7373 } 7374 if (options && options.transition === false) options.transition = Effect.Transitions.linear; 7375 this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { }); 7376 this.currentFrame = 0; 7377 this.state = 'idle'; 7378 this.startOn = this.options.delay*1000; 7379 this.finishOn = this.startOn+(this.options.duration*1000); 7380 this.fromToDelta = this.options.to-this.options.from; 7381 this.totalTime = this.finishOn-this.startOn; 7382 this.totalFrames = this.options.fps*this.options.duration; 7383 7384 this.render = (function() { 7385 function dispatch(effect, eventName) { 7386 if (effect.options[eventName + 'Internal']) 7387 effect.options[eventName + 'Internal'](effect); 7388 if (effect.options[eventName]) 7389 effect.options[eventName](effect); 7390 } 7391 7392 return function(pos) {
7393 if (this.state === "idle") { 7394 this.state = "running"; 7395 dispatch(this, 'beforeSetup'); 7396 if (this.setup) this.setup(); 7397 dispatch(this, 'afterSetup'); 7398 } 7399 if (this.state === "running") { 7400 pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from; 7401 this.position = pos; 7402 dispatch(this, 'beforeUpdate'); 7403 if (this.update) this.update(pos); 7404 dispatch(this, 'afterUpdate'); 7405 } 7406 }; 7407 })(); 7408 7409 this.event('beforeStart'); 7410 if (!this.options.sync) 7411 Effect.Queues.get(Object.isString(this.options.queue) ? 7412 'global' : this.options.queue.scope).add(this); 7413 }, 7414 loop: function(timePos) { 7415 if (timePos >= this.startOn) { 7416 if (timePos >= this.finishOn) { 7417 this.render(1.0); 7418 this.cancel(); 7419 this.event('beforeFinish'); 7420 if (this.finish) this.finish(); 7421 this.event('afterFinish'); 7422 return; 7423 } 7424 var pos = (timePos - this.startOn) / this.totalTime, 7425 frame = (pos * this.totalFrames).round(); 7426 if (frame > this.currentFrame) { 7427 this.render(pos); 7428 this.currentFrame = frame; 7429 } 7430 } 7431 }, 7432 cancel: function() { 7433 if (!this.options.sync) 7434 Effect.Queues.get(Object.isString(this.options.queue) ? 7435 'global' : this.options.queue.scope).remove(this); 7436 this.state = 'finished'; 7437 }, 7438 event: function(eventName) { 7439 if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); 7440 if (this.options[eventName]) this.options[eventName](this); 7441 }, 7442 inspect: function() { 7443 var data = $H(); 7444 for(property in this) 7445 if (!Object.isFunction(this[property])) data.set(property, this[property]); 7446 return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>'; 7447 } 7448}); 7449 7450Effect.Parallel = Class.create(Effect.Base, { 7451 initialize: function(effects) { 7452 this.effects = effects || []; 7453 this.start(arguments[1]); 7454 }, 7455 update: function(position) { 7456 this.effects.invoke('render', position); 7457 }, 7458 finish: function(position) { 7459 this.effects.each( function(effect) { 7460 effect.render(1.0); 7461 effect.cancel(); 7462 effect.event('beforeFinish'); 7463 if (effect.finish) effect.finish(position); 7464 effect.event('afterFinish'); 7465 }); 7466 } 7467}); 7468 7469Effect.Tween = Class.create(Effect.Base, { 7470 initialize: function(object, from, to) { 7471 object = Object.isString(object) ? $(object) : object; 7472 var args = $A(arguments), method = args.last(), 7473 options = args.length == 5 ? args[3] : null; 7474 this.method = Object.isFunction(method) ? method.bind(object) : 7475 Object.isFunction(object[method]) ? object[method].bind(object) : 7476 function(value) { object[method] = value }; 7477 this.start(Object.extend({ from: from, to: to }, options || { })); 7478 }, 7479 update: function(position) { 7480 this.method(position); 7481 } 7482}); 7483 7484Effect.Event = Class.create(Effect.Base, { 7485 initialize: function() { 7486 this.start(Object.extend({ duration: 0 }, arguments[0] || { })); 7487 }, 7488 update: Prototype.emptyFunction 7489}); 7490 7491Effect.Opacity = Class.create(Effect.Base, { 7492 initialize: function(element) { 7493 this.element = $(element); 7494 if (!this.element) throw(Effect._elementDoesNotExistError); 7495 // make this work on IE on elements without 'layout' 7496 if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) 7497 this.element.setStyle({zoom: 1}); 7498 var options = Object.extend({ 7499 from: this.element.getOpacity() || 0.0, 7500 to: 1.0 7501 }, arguments[1] || { }); 7502 this.start(options); 7503 }, 7504 update: function(position) { 7505 this.element.setOpacity(position); 7506 } 7507}); 7508 7509Effect.Move = Class.create(Effect.Base, { 7510 initialize: function(element) { 7511 this.element = $(element); 7512 if (!this.element) throw(Effect._elementDoesNotExistError); 7513 var options = Object.extend({ 7514 x: 0, 7515 y: 0, 7516 mode: 'relative' 7517 }, arguments[1] || { }); 7518 this.start(options); 7519 }, 7520 setup: function() { 7521 this.element.makePositioned(); 7522 this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); 7523 this.originalTop = parseFloat(this.element.getStyle('top') || '0'); 7524 if (this.options.mode == 'absolute') { 7525 this.options.x = this.options.x - this.originalLeft; 7526 this.options.y = this.options.y - this.originalTop; 7527 } 7528 }, 7529 update: function(position) { 7530 this.element.setStyle({ 7531 left: (this.options.x * position + this.originalLeft).round() + 'px', 7532 top: (this.options.y * position + this.originalTop).round() + 'px' 7533 }); 7534 } 7535}); 7536 7537// for backwards compatibility 7538Effect.MoveBy = function(element, toTop, toLeft) { 7539 return new Effect.Move(element,
7540 Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); 7541}; 7542 7543Effect.Scale = Class.create(Effect.Base, { 7544 initialize: function(element, percent) { 7545 this.element = $(element); 7546 if (!this.element) throw(Effect._elementDoesNotExistError); 7547 var options = Object.extend({ 7548 scaleX: true, 7549 scaleY: true, 7550 scaleContent: true, 7551 scaleFromCenter: false, 7552 scaleMode: 'box', // 'box' or 'contents' or { } with provided values 7553 scaleFrom: 100.0, 7554 scaleTo: percent 7555 }, arguments[2] || { }); 7556 this.start(options); 7557 }, 7558 setup: function() { 7559 this.restoreAfterFinish = this.options.restoreAfterFinish || false; 7560 this.elementPositioning = this.element.getStyle('position'); 7561 7562 this.originalStyle = { }; 7563 ['top','left','width','height','fontSize'].each( function(k) { 7564 this.originalStyle[k] = this.element.style[k]; 7565 }.bind(this)); 7566 7567 this.originalTop = this.element.offsetTop; 7568 this.originalLeft = this.element.offsetLeft; 7569 7570 var fontSize = this.element.getStyle('font-size') || '100%'; 7571 ['em','px','%','pt'].each( function(fontSizeType) { 7572 if (fontSize.indexOf(fontSizeType)>0) { 7573 this.fontSize = parseFloat(fontSize); 7574 this.fontSizeType = fontSizeType; 7575 } 7576 }.bind(this)); 7577 7578 this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; 7579 7580 this.dims = null; 7581 if (this.options.scaleMode=='box') 7582 this.dims = [this.element.offsetHeight, this.element.offsetWidth]; 7583 if (/^content/.test(this.options.scaleMode)) 7584 this.dims = [this.element.scrollHeight, this.element.scrollWidth]; 7585 if (!this.dims) 7586 this.dims = [this.options.scaleMode.originalHeight, 7587 this.options.scaleMode.originalWidth]; 7588 }, 7589 update: function(position) { 7590 var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); 7591 if (this.options.scaleContent && this.fontSize) 7592 this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); 7593 this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); 7594 }, 7595 finish: function(position) { 7596 if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); 7597 }, 7598 setDimensions: function(height, width) { 7599 var d = { }; 7600 if (this.options.scaleX) d.width = width.round() + 'px'; 7601 if (this.options.scaleY) d.height = height.round() + 'px'; 7602 if (this.options.scaleFromCenter) { 7603 var topd = (height - this.dims[0])/2; 7604 var leftd = (width - this.dims[1])/2; 7605 if (this.elementPositioning == 'absolute') { 7606 if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; 7607 if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; 7608 } else { 7609 if (this.options.scaleY) d.top = -topd + 'px'; 7610 if (this.options.scaleX) d.left = -leftd + 'px'; 7611 } 7612 } 7613 this.element.setStyle(d); 7614 } 7615}); 7616 7617Effect.Highlight = Class.create(Effect.Base, { 7618 initialize: function(element) { 7619 this.element = $(element); 7620 if (!this.element) throw(Effect._elementDoesNotExistError); 7621 var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); 7622 this.start(options); 7623 }, 7624 setup: function() { 7625 // Prevent executing on elements not in the layout flow 7626 if (this.element.getStyle('display')=='none') { this.cancel(); return; } 7627 // Disable background image during the effect 7628 this.oldStyle = { }; 7629 if (!this.options.keepBackgroundImage) { 7630 this.oldStyle.backgroundImage = this.element.getStyle('background-image'); 7631 this.element.setStyle({backgroundImage: 'none'}); 7632 } 7633 if (!this.options.endcolor) 7634 this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); 7635 if (!this.options.restorecolor) 7636 this.options.restorecolor = this.element.getStyle('background-color'); 7637 // init color calculations 7638 this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); 7639 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)); 7640 }, 7641 update: function(position) { 7642 this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ 7643 return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); 7644 }, 7645 finish: function() { 7646 this.element.setStyle(Object.extend(this.oldStyle, { 7647 backgroundColor: this.options.restorecolor 7648 })); 7649 } 7650}); 7651 7652Effect.ScrollTo = function(element) { 7653 var options = arguments[1] || { }, 7654 scrollOffsets = document.viewport.getScrollOffsets(), 7655 elementOffsets = $(element).cumulativeOffset(); 7656 7657 if (options.offset) elementOffsets[1] += options.offset; 7658 7659 return new Effect.Tween(null, 7660 scrollOffsets.top, 7661 elementOffsets[1], 7662 options, 7663 function(p){ scrollTo(scrollOffsets.left, p.round()); } 7664 ); 7665}; 7666 7667/* ------------- combination effects ------------- */ 7668 7669Effect.Fade = function(element) { 7670 element = $(element); 7671 var oldOpacity = element.getInlineOpacity(); 7672 var options = Object.extend({ 7673 from: element.getOpacity() || 1.0, 7674 to: 0.0, 7675 afterFinishInternal: function(effect) { 7676 if (effect.options.to!=0) return; 7677 effect.element.hide().setStyle({opacity: oldOpacity}); 7678 } 7679 }, arguments[1] || { }); 7680 return new Effect.Opacity(element,options); 7681}; 7682 7683Effect.Appear = function(element) { 7684 element = $(element); 7685 var options = Object.extend({ 7686 from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), 7687 to: 1.0, 7688 // force Safari to render floated elements properly 7689 afterFinishInternal: function(effect) { 7690 effect.element.forceRerendering(); 7691 }, 7692 beforeSetup: function(effect) { 7693 effect.element.setOpacity(effect.options.from).show(); 7694 }}, arguments[1] || { }); 7695 return new Effect.Opacity(element,options); 7696}; 7697 7698Effect.Puff = function(element) { 7699 element = $(element); 7700 var oldStyle = { 7701 opacity: element.getInlineOpacity(), 7702 position: element.getStyle('position'), 7703 top: element.style.top, 7704 left: element.style.left, 7705 width: element.style.width, 7706 height: element.style.height 7707 }; 7708 return new Effect.Parallel( 7709 [ new Effect.Scale(element, 200, 7710 { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 7711 new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 7712 Object.extend({ duration: 1.0, 7713 beforeSetupInternal: function(effect) { 7714 Position.absolutize(effect.effects[0].element); 7715 }, 7716 afterFinishInternal: function(effect) { 7717 effect.effects[0].element.hide().setStyle(oldStyle); } 7718 }, arguments[1] || { }) 7719 ); 7720}; 7721 7722Effect.BlindUp = function(element) { 7723 element = $(element); 7724 element.makeClipping(); 7725 return new Effect.Scale(element, 0, 7726 Object.extend({ scaleContent: false, 7727 scaleX: false, 7728 restoreAfterFinish: true, 7729 afterFinishInternal: function(effect) { 7730 effect.element.hide().undoClipping(); 7731 } 7732 }, arguments[1] || { }) 7733 ); 7734}; 7735 7736Effect.BlindDown = function(element) { 7737 element = $(element); 7738 var elementDimensions = element.getDimensions(); 7739 return new Effect.Scale(element, 100, Object.extend({ 7740 scaleContent: false, 7741 scaleX: false, 7742 scaleFrom: 0, 7743 scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 7744 restoreAfterFinish: true, 7745 afterSetup: function(effect) { 7746 effect.element.makeClipping().setStyle({height: '0px'}).show(); 7747 }, 7748 afterFinishInternal: function(effect) { 7749 effect.element.undoClipping(); 7750 } 7751 }, arguments[1] || { })); 7752}; 7753 7754Effect.SwitchOff = function(element) { 7755 element = $(element); 7756 var oldOpacity = element.getInlineOpacity(); 7757 return new Effect.Appear(element, Object.extend({ 7758 duration: 0.4, 7759 from: 0, 7760 transition: Effect.Transitions.flicker, 7761 afterFinishInternal: function(effect) { 7762 new Effect.Scale(effect.element, 1, { 7763 duration: 0.3, scaleFromCenter: true, 7764 scaleX: false, scaleContent: false, restoreAfterFinish: true, 7765 beforeSetup: function(effect) { 7766 effect.element.makePositioned().makeClipping(); 7767 }, 7768 afterFinishInternal: function(effect) { 7769 effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); 7770 } 7771 }); 7772 } 7773 }, arguments[1] || { })); 7774}; 7775 7776Effect.DropOut = function(element) { 7777 element = $(element); 7778 var oldStyle = { 7779 top: element.getStyle('top'), 7780 left: element.getStyle('left'), 7781 opacity: element.getInlineOpacity() }; 7782 return new Effect.Parallel( 7783 [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 7784 new Effect.Opacity(element, { sync: true, to: 0.0 }) ], 7785 Object.extend( 7786 { duration: 0.5, 7787 beforeSetup: function(effect) { 7788 effect.effects[0].element.makePositioned(); 7789 }, 7790 afterFinishInternal: function(effect) { 7791 effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); 7792 } 7793 }, arguments[1] || { })); 7794}; 7795 7796Effect.Shake = function(element) { 7797 element = $(element); 7798 var options = Object.extend({ 7799 distance: 20, 7800 duration: 0.5 7801 }, arguments[1] || {}); 7802 var distance = parseFloat(options.distance); 7803 var split = parseFloat(options.duration) / 10.0; 7804 var oldStyle = { 7805 top: element.getStyle('top'), 7806 left: element.getStyle('left') }; 7807 return new Effect.Move(element, 7808 { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { 7809 new Effect.Move(effect.element, 7810 { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7811 new Effect.Move(effect.element, 7812 { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7813 new Effect.Move(effect.element, 7814 { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7815 new Effect.Move(effect.element, 7816 { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { 7817 new Effect.Move(effect.element, 7818 { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { 7819 effect.element.undoPositioned().setStyle(oldStyle); 7820 }}); }}); }}); }}); }}); }}); 7821}; 7822 7823Effect.SlideDown = function(element) { 7824 element = $(element).cleanWhitespace(); 7825 // SlideDown need to have the content of the element wrapped in a container element with fixed height! 7826 var oldInnerBottom = element.down().getStyle('bottom'); 7827 var elementDimensions = element.getDimensions(); 7828 return new Effect.Scale(element, 100, Object.extend({ 7829 scaleContent: false, 7830 scaleX: false, 7831 scaleFrom: window.opera ? 0 : 1, 7832 scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 7833 restoreAfterFinish: true, 7834 afterSetup: function(effect) { 7835 effect.element.makePositioned(); 7836 effect.element.down().makePositioned(); 7837 if (window.opera) effect.element.setStyle({top: ''}); 7838 effect.element.makeClipping().setStyle({height: '0px'}).show(); 7839 }, 7840 afterUpdateInternal: function(effect) { 7841 effect.element.down().setStyle({bottom: 7842 (effect.dims[0] - effect.element.clientHeight) + 'px' }); 7843 }, 7844 afterFinishInternal: function(effect) { 7845 effect.element.undoClipping().undoPositioned(); 7846 effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } 7847 }, arguments[1] || { }) 7848 ); 7849}; 7850 7851Effect.SlideUp = function(element) { 7852 element = $(element).cleanWhitespace(); 7853 var oldInnerBottom = element.down().getStyle('bottom'); 7854 var elementDimensions = element.getDimensions(); 7855 return new Effect.Scale(element, window.opera ? 0 : 1, 7856 Object.extend({ scaleContent: false, 7857 scaleX: false, 7858 scaleMode: 'box', 7859 scaleFrom: 100, 7860 scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, 7861 restoreAfterFinish: true, 7862 afterSetup: function(effect) { 7863 effect.element.makePositioned(); 7864 effect.element.down().makePositioned(); 7865 if (window.opera) effect.element.setStyle({top: ''}); 7866 effect.element.makeClipping().show(); 7867 }, 7868 afterUpdateInternal: function(effect) { 7869 effect.element.down().setStyle({bottom: 7870 (effect.dims[0] - effect.element.clientHeight) + 'px' }); 7871 }, 7872 afterFinishInternal: function(effect) { 7873 effect.element.hide().undoClipping().undoPositioned(); 7874 effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); 7875 } 7876 }, arguments[1] || { }) 7877 ); 7878}; 7879 7880// Bug in opera makes the TD containing this element expand for a instance after finish 7881Effect.Squish = function(element) { 7882 return new Effect.Scale(element, window.opera ? 1 : 0, { 7883 restoreAfterFinish: true, 7884 beforeSetup: function(effect) { 7885 effect.element.makeClipping(); 7886 }, 7887 afterFinishInternal: function(effect) { 7888 effect.element.hide().undoClipping(); 7889 } 7890 }); 7891}; 7892 7893Effect.Grow = function(element) { 7894 element = $(element); 7895 var options = Object.extend({ 7896 direction: 'center', 7897 moveTransition: Effect.Transitions.sinoidal, 7898 scaleTransition: Effect.Transitions.sinoidal, 7899 opacityTransition: Effect.Transitions.full 7900 }, arguments[1] || { }); 7901 var oldStyle = { 7902 top: element.style.top, 7903 left: element.style.left, 7904 height: element.style.height, 7905 width: element.style.width, 7906 opacity: element.getInlineOpacity() }; 7907 7908 var dims = element.getDimensions(); 7909 var initialMoveX, initialMoveY; 7910 var moveX, moveY; 7911 7912 switch (options.direction) { 7913 case 'top-left': 7914 initialMoveX = initialMoveY = moveX = moveY = 0; 7915 break; 7916 case 'top-right': 7917 initialMoveX = dims.width; 7918 initialMoveY = moveY = 0; 7919 moveX = -dims.width; 7920 break; 7921 case 'bottom-left': 7922 initialMoveX = moveX = 0; 7923 initialMoveY = dims.height; 7924 moveY = -dims.height; 7925 break; 7926 case 'bottom-right': 7927 initialMoveX = dims.width; 7928 initialMoveY = dims.height; 7929 moveX = -dims.width; 7930 moveY = -dims.height; 7931 break; 7932 case 'center': 7933 initialMoveX = dims.width / 2; 7934 initialMoveY = dims.height / 2; 7935 moveX = -dims.width / 2; 7936 moveY = -dims.height / 2; 7937 break; 7938 } 7939 7940 return new Effect.Move(element, { 7941 x: initialMoveX, 7942 y: initialMoveY, 7943 duration: 0.01, 7944 beforeSetup: function(effect) { 7945 effect.element.hide().makeClipping().makePositioned(); 7946 }, 7947 afterFinishInternal: function(effect) { 7948 new Effect.Parallel( 7949 [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), 7950 new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), 7951 new Effect.Scale(effect.element, 100, { 7952 scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 7953 sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) 7954 ], Object.extend({ 7955 beforeSetup: function(effect) { 7956 effect.effects[0].element.setStyle({height: '0px'}).show(); 7957 }, 7958 afterFinishInternal: function(effect) { 7959 effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 7960 } 7961 }, options) 7962 ); 7963 } 7964 }); 7965}; 7966 7967Effect.Shrink = function(element) { 7968 element = $(element); 7969 var options = Object.extend({ 7970 direction: 'center', 7971 moveTransition: Effect.Transitions.sinoidal, 7972 scaleTransition: Effect.Transitions.sinoidal, 7973 opacityTransition: Effect.Transitions.none 7974 }, arguments[1] || { }); 7975 var oldStyle = { 7976 top: element.style.top, 7977 left: element.style.left, 7978 height: element.style.height, 7979 width: element.style.width, 7980 opacity: element.getInlineOpacity() }; 7981 7982 var dims = element.getDimensions(); 7983 var moveX, moveY; 7984 7985 switch (options.direction) { 7986 case 'top-left': 7987 moveX = moveY = 0; 7988 break; 7989 case 'top-right': 7990 moveX = dims.width; 7991 moveY = 0; 7992 break; 7993 case 'bottom-left': 7994 moveX = 0; 7995 moveY = dims.height; 7996 break; 7997 case 'bottom-right': 7998 moveX = dims.width; 7999 moveY = dims.height; 8000 break; 8001 case 'center': 8002 moveX = dims.width / 2; 8003 moveY = dims.height / 2; 8004 break; 8005 } 8006 8007 return new Effect.Parallel( 8008 [ new Effect.Opacity(elemen
8008t, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), 8009 new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), 8010 new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) 8011 ], Object.extend({ 8012 beforeStartInternal: function(effect) { 8013 effect.effects[0].element.makePositioned().makeClipping(); 8014 }, 8015 afterFinishInternal: function(effect) { 8016 effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } 8017 }, options) 8018 ); 8019}; 8020 8021Effect.Pulsate = function(element) { 8022 element = $(element); 8023 var options = arguments[1] || { }, 8024 oldOpacity = element.getInlineOpacity(), 8025 transition = options.transition || Effect.Transitions.linear, 8026 reverser = function(pos){ 8027 return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5); 8028 }; 8029 8030 return new Effect.Opacity(element, 8031 Object.extend(Object.extend({ duration: 2.0, from: 0, 8032 afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } 8033 }, options), {transition: reverser})); 8034}; 8035 8036Effect.Fold = function(element) { 8037 element = $(element); 8038 var oldStyle = { 8039 top: element.style.top, 8040 left: element.style.left, 8041 width: element.style.width, 8042 height: element.style.height }; 8043 element.makeClipping(); 8044 return new Effect.Scale(element, 5, Object.extend({ 8045 scaleContent: false, 8046 scaleX: false, 8047 afterFinishInternal: function(effect) { 8048 new Effect.Scale(element, 1, { 8049 scaleContent: false, 8050 scaleY: false, 8051 afterFinishInternal: function(effect) { 8052 effect.element.hide().undoClipping().setStyle(oldStyle); 8053 } }); 8054 }}, arguments[1] || { })); 8055}; 8056 8057Effect.Morph = Class.create(Effect.Base, { 8058 initialize: function(element) { 8059 this.element = $(element); 8060 if (!this.element) throw(Effect._elementDoesNotExistError); 8061 var options = Object.extend({ 8062 style: { } 8063 }, arguments[1] || { }); 8064 8065 if (!Object.isString(options.style)) this.style = $H(options.style); 8066 else { 8067 if (options.style.include(':')) 8068 this.style = options.style.parseStyle(); 8069 else { 8070 this.element.addClassName(options.style); 8071 this.style = $H(this.element.getStyles()); 8072 this.element.removeClassName(options.style); 8073 var css = this.element.getStyles(); 8074 this.style = this.style.reject(function(style) { 8075 return style.value == css[style.key]; 8076 }); 8077 options.afterFinishInternal = function(effect) { 8078 effect.element.addClassName(effect.options.style); 8079 effect.transforms.each(function(transform) { 8080 effect.element.style[transform.style] = ''; 8081 }); 8082 }; 8083 } 8084 } 8085 this.start(options); 8086 }, 8087 8088 setup: function(){ 8089 function parseColor(color){ 8090 if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; 8091 color = color.parseColor(); 8092 return $R(0,2).map(function(i){ 8093 return parseInt( color.slice(i*2+1,i*2+3), 16 ); 8094 }); 8095 } 8096 this.transforms = this.style.map(function(pair){ 8097 var property = pair[0], value = pair[1], unit = null; 8098 8099 if (value.parseColor('#zzzzzz') != '#zzzzzz') { 8100 value = value.parseColor(); 8101 unit = 'color'; 8102 } else if (property == 'opacity') { 8103 value = parseFloat(value); 8104 if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) 8105 this.element.setStyle({zoom: 1}); 8106 } else if (Element.CSS_LENGTH.test(value)) { 8107 var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); 8108 value = parseFloat(components[1]); 8109 unit = (components.length == 3) ? components[2] : null; 8110 } 8111 8112 var originalValue = this.element.getStyle(property); 8113 return { 8114 style: property.camelize(), 8115 originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 8116 targetValue: unit=='color' ? parseColor(value) : value, 8117 unit: unit 8118 }; 8119 }.bind(this)).reject(function(transform){ 8120 return ( 8121 (transform.originalValue == transform.targetValue) || 8122 ( 8123 transform.unit != 'color' && 8124 (isNaN(transform.originalValue) || isNaN(transform.targetValue)) 8125 ) 8126 ); 8127 }); 8128 }, 8129 update: function(position) { 8130 var style = { }, transform, i = this.transforms.length; 8131 while(i--) 8132 style[(transform = this.transforms[i]).style] = 8133 transform.unit=='color' ? '#'+ 8134 (Math.round(transform.originalValue[0]+ 8135 (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + 8136 (Math.round(transform.originalValue[1]+ 8137 (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + 8138 (Math.round(transform.originalValue[2]+ 8139 (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : 8140 (transform.originalValue + 8141 (transform.targetValue - transform.originalValue) * position).toFixed(3) + 8142 (transform.unit === null ? '' : transform.unit); 8143 this.element.setStyle(style, true); 8144 } 8145}); 8146 8147Effect.Transform = Class.create({ 8148 initialize: function(tracks){ 8149 this.tracks = []; 8150 this.options = arguments[1] || { }; 8151 this.addTracks(tracks); 8152 }, 8153 addTracks: function(tracks){ 8154 tracks.each(function(track){ 8155 track = $H(track); 8156 var data = track.values().first(); 8157 this.tracks.push($H({ 8158 ids: track.keys().first(), 8159 effect: Effect.Morph, 8160 options: { style: data } 8161 })); 8162 }.bind(this)); 8163 return this; 8164 }, 8165 play: function(){ 8166 return new Effect.Parallel( 8167 this.tracks.map(function(track){ 8168 var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); 8169 var elements = [$(ids) || $$(ids)].flatten(); 8170 return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); 8171 }).flatten(), 8172 this.options 8173 ); 8174 } 8175}); 8176 8177Element.CSS_PROPERTIES = $w( 8178 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 8179 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + 8180 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + 8181 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + 8182 'fontSize fontWeight height left letterSpacing lineHeight ' + 8183 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ 8184 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + 8185 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + 8186 'right textIndent top width wordSpacing zIndex'); 8187 8188Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; 8189 8190String.__parseStyleElement = document.createElement('div'); 8191String.prototype.parseStyle = function(){ 8192 var style, styleRules = $H(); 8193 if (Prototype.Browser.WebKit) 8194 style = new Element('div',{style:this}).style; 8195 else { 8196 String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>'; 8197 style = String.__parseStyleElement.childNodes[0].style; 8198 } 8199 8200 Element.CSS_PROPERTIES.each(function(property){ 8201 if (style[property]) styleRules.set(property, style[property]); 8202 }); 8203 8204 if (Prototype.Browser.IE && this.include('opacity')) 8205 styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); 8206 8207 return styleRules; 8208}; 8209 8210if (document.defaultView && document.defaultView.getComputedStyle) { 8211 Element.getStyles = function(element) { 8212 var css = document.defaultView.getComputedStyle($(element), null); 8213 return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { 8214 styles[property] = css[property]; 8215 return styles; 8216 }); 8217 }; 8218} else { 8219 Element.getStyles = function(element) { 8220 element = $(element); 8221 var css = element.currentStyle, styles; 8222 styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) { 8223 results[property] = css[property]; 8224 return results; 8225 }); 8226 if (!styles.opacity) styles.opacity = element.getOpacity(); 8227 return styles; 8228 }; 8229} 8230 8231Effect.Methods = { 8232 morph: function(element, style) { 8233 element = $(element); 8234 new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); 8235 return element; 8236 }, 8237 visualEffect: function(element, effect, options) { 8238 element = $(element); 8239 var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); 8240 new Effect[klass](element, options); 8241 return element; 8242 }, 8243 highlight: function(element, options) { 8244 element = $(element); 8245 new Effect.Highlight(element, options); 8246 return element; 8247 } 8248}; 8249 8250$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ 8251 'pulsate shake puff squish switchOff dropOut').each( 8252 function(effect) { 8253 Effect.Methods[effect] = function(element, options){ 8254 element = $(element);
8255 Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); 8256 return element; 8257 }; 8258 } 8259); 8260 8261$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( 8262 function(f) { Effect.Methods[f] = Element[f]; } 8263); 8264 8265Element.addMethods(Effect.Methods); 8266// script.aculo.us dragdrop.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010 8267 8268// Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 8269// 8270// script.aculo.us is freely distributable under the terms of an MIT-style license. 8271// For details, see the script.aculo.us web site: http://script.aculo.us/ 8272 8273if(Object.isUndefined(Effect)) 8274 throw("dragdrop.js requires including script.aculo.us' effects.js library"); 8275 8276var Droppables = { 8277 drops: [], 8278 8279 remove: function(element) { 8280 this.drops = this.drops.reject(function(d) { return d.element==$(element) }); 8281 }, 8282 8283 add: function(element) { 8284 element = $(element); 8285 var options = Object.extend({ 8286 greedy: true, 8287 hoverclass: null, 8288 tree: false 8289 }, arguments[1] || { }); 8290
8291 // cache containers 8292 if(options.containment) { 8293 options._containers = []; 8294 var containment = options.containment; 8295 if(Object.isArray(containment)) { 8296 containment.each( function(c) { options._containers.push($(c)) }); 8297 } else { 8298 options._containers.push($(containment)); 8299 } 8300 } 8301 8302 if(options.accept) options.accept = [options.accept].flatten(); 8303 8304 Element.makePositioned(element); // fix IE 8305 options.element = element; 8306 8307 this.drops.push(options); 8308 }, 8309 8310 findDeepestChild: function(drops) { 8311 deepest = drops[0]; 8312 8313 for (i = 1; i < drops.length; ++i) 8314 if (Element.isParent(drops[i].element, deepest.element)) 8315 deepest = drops[i]; 8316 8317 return deepest; 8318 }, 8319 8320 isContained: function(element, drop) { 8321 var containmentNode; 8322 if(drop.tree) { 8323 containmentNode = element.treeNode; 8324 } else { 8325 containmentNode = element.parentNode; 8326 } 8327 return drop._containers.detect(function(c) { return containmentNode == c }); 8328 }, 8329 8330 isAffected: function(point, element, drop) { 8331 return ( 8332 (drop.element!=element) && 8333 ((!drop._containers) || 8334 this.isContained(element, drop)) && 8335 ((!drop.accept) || 8336 (Element.classNames(element).detect( 8337 function(v) { return drop.accept.include(v) } ) )) && 8338 Position.within(drop.element, point[0], point[1]) ); 8339 }, 8340 8341 deactivate: function(drop) { 8342 if(drop.hoverclass) 8343 Element.removeClassName(drop.element, drop.hoverclass); 8344 this.last_active = null; 8345 }, 8346 8347 activate: function(drop) { 8348 if(drop.hoverclass) 8349 Element.addClassName(drop.element, drop.hoverclass); 8350 this.last_active = drop; 8351 }, 8352 8353 show: function(point, element) { 8354 if(!this.drops.length) return; 8355 var drop, affected = []; 8356 8357 this.drops.each( function(drop) { 8358 if(Droppables.isAffected(point, element, drop)) 8359 affected.push(drop); 8360 }); 8361 8362 if(affected.length>0) 8363 drop = Droppables.findDeepestChild(affected); 8364 8365 if(this.last_active && this.last_active != drop) this.deactivate(this.last_active); 8366 if (drop) { 8367 Position.within(drop.element, point[0], point[1]); 8368 if(drop.onHover) 8369 drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); 8370 8371 if (drop != this.last_active) Droppables.activate(drop); 8372 } 8373 }, 8374 8375 fire: function(event, element) { 8376 if(!this.last_active) return; 8377 Position.prepare(); 8378 8379 if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) 8380 if (this.last_active.onDrop) { 8381 this.last_active.onDrop(element, this.last_active.element, event); 8382 return true; 8383 } 8384 }, 8385 8386 reset: function() { 8387 if(this.last_active) 8388 this.deactivate(this.last_active); 8389 } 8390}; 8391 8392var Draggables = { 8393 drags: [], 8394 observers: [], 8395 8396 register: function(draggable) { 8397 if(this.drags.length == 0) { 8398 this.eventMouseUp = this.endDrag.bindAsEventListener(this); 8399 this.eventMouseMove = this.updateDrag.bindAsEventListener(this); 8400 this.eventKeypress = this.keyPress.bindAsEventListener(this); 8401 8402 Event.observe(document, "mouseup", this.eventMouseUp); 8403 Event.observe(document, "mousemove", this.eventMouseMove); 8404 Event.observe(document, "keypress", this.eventKeypress); 8405 } 8406 this.drags.push(draggable); 8407 }, 8408 8409 unregister: function(draggable) { 8410 this.drags = this.drags.reject(function(d) { return d==draggable }); 8411 if(this.drags.length == 0) { 8412 Event.stopObserving(document, "mouseup", this.eventMouseUp); 8413 Event.stopObserving(document, "mousemove", this.eventMouseMove); 8414 Event.stopObserving(document, "keypress", this.eventKeypress); 8415 } 8416 }, 8417 8418 activate: function(draggable) { 8419 if(draggable.options.delay) { 8420 this._timeout = setTimeout(function() { 8421 Draggables._timeout = null; 8422 window.focus(); 8423 Draggables.activeDraggable = draggable; 8424 }.bind(this), draggable.options.delay); 8425 } else { 8426 window.focus(); // allows keypress events if window isn't currently focused, fails for Safari 8427 this.activeDraggable = draggable; 8428 } 8429 }, 8430 8431 deactivate: function() { 8432 this.activeDraggable = null; 8433 }, 8434 8435 updateDrag: function(event) { 8436 if(!this.activeDraggable) return; 8437 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 8438 // Mozilla-based browsers fire successive mousemove events with 8439 // the same coordinates, prevent needless redrawing (moz bug?) 8440 if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; 8441 this._lastPointer = pointer; 8442 8443 this.activeDraggable.updateDrag(event, pointer); 8444 }, 8445 8446 endDrag: function(event) { 8447 if(this._timeout) { 8448 clearTimeout(this._timeout); 8449 this._timeout = null; 8450 } 8451 if(!this.activeDraggable) return; 8452 this._lastPointer = null; 8453 this.activeDraggable.endDrag(event); 8454 this.activeDraggable = null; 8455 }, 8456 8457 keyPress: function(event) { 8458 if(this.activeDraggable) 8459 this.activeDraggable.keyPress(event); 8460 }, 8461 8462 addObserver: function(observer) { 8463 this.observers.push(observer); 8464 this._cacheObserverCallbacks(); 8465 }, 8466 8467 removeObserver: function(element) { // element instead of observer fixes mem leaks 8468 this.observers = this.observers.reject( function(o) { return o.element==element }); 8469 this._cacheObserverCallbacks(); 8470 }, 8471 8472 notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' 8473 if(this[eventName+'Count'] > 0) 8474 this.observers.each( function(o) { 8475 if(o[eventName]) o[eventName](eventName, draggable, event); 8476 });
8477 if(draggable.options[eventName]) draggable.options[eventName](draggable, event); 8478 }, 8479 8480 _cacheObserverCallbacks: function() { 8481 ['onStart','onEnd','onDrag'].each( function(eventName) { 8482 Draggables[eventName+'Count'] = Draggables.observers.select( 8483 function(o) { return o[eventName]; } 8484 ).length; 8485 }); 8486 } 8487}; 8488 8489/*--------------------------------------------------------------------------*/ 8490 8491var Draggable = Class.create({ 8492 initialize: function(element) { 8493 var defaults = { 8494 handle: false, 8495 reverteffect: function(element, top_offset, left_offset) { 8496 var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; 8497 new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, 8498 queue: {scope:'_draggable', position:'end'} 8499 }); 8500 }, 8501 endeffect: function(element) { 8502 var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; 8503 new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, 8504 queue: {scope:'_draggable', position:'end'}, 8505 afterFinish: function(){ 8506 Draggable._dragging[element] = false 8507 } 8508 }); 8509 }, 8510 zindex: 1000, 8511 revert: false, 8512 quiet: false, 8513 scroll: false, 8514 scrollSensitivity: 20, 8515 scrollSpeed: 15, 8516 snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } 8517 delay: 0 8518 }; 8519 8520 if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) 8521 Object.extend(defaults, { 8522 starteffect: function(element) { 8523 element._opacity = Element.getOpacity(element); 8524 Draggable._dragging[element] = true; 8525 new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); 8526 } 8527 }); 8528 8529 var options = Object.extend(defaults, arguments[1] || { }); 8530 8531 this.element = $(element); 8532 8533 if(options.handle && Object.isString(options.handle)) 8534 this.handle = this.element.down('.'+options.handle, 0); 8535 8536 if(!this.handle) this.handle = $(options.handle); 8537 if(!this.handle) this.handle = this.element; 8538 8539 if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { 8540 options.scroll = $(options.scroll); 8541 this._isScrollChild = Element.childOf(this.element, options.scroll); 8542 } 8543 8544 Element.makePositioned(this.element); // fix IE 8545 8546 this.options = options; 8547 this.dragging = false; 8548 8549 this.eventMouseDown = this.initDrag.bindAsEventListener(this); 8550 Event.observe(this.handle, "mousedown", this.eventMouseDown); 8551 8552 Draggables.register(this); 8553 }, 8554 8555 destroy: function() { 8556 Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); 8557 Draggables.unregister(this); 8558 }, 8559 8560 currentDelta: function() { 8561 return([ 8562 parseInt(Element.getStyle(this.element,'left') || '0'), 8563 parseInt(Element.getStyle(this.element,'top') || '0')]); 8564 }, 8565 8566 initDrag: function(event) { 8567 if(!Object.isUndefined(Draggable._dragging[this.element]) && 8568 Draggable._dragging[this.element]) return; 8569 if(Event.isLeftClick(event)) { 8570 // abort on form elements, fixes a Firefox issue 8571 var src = Event.element(event); 8572 if((tag_name = src.tagName.toUpperCase()) && ( 8573 tag_name=='INPUT' || 8574 tag_name=='SELECT' || 8575 tag_name=='OPTION' || 8576 tag_name=='BUTTON' || 8577 tag_name=='TEXTAREA')) return; 8578 8579 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 8580 var pos = this.element.cumulativeOffset(); 8581 this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); 8582 8583 Draggables.activate(this); 8584 Event.stop(event); 8585 } 8586 }, 8587 8588 startDrag: function(event) { 8589 this.dragging = true; 8590 if(!this.delta) 8591 this.delta = this.currentDelta(); 8592 8593 if(this.options.zindex) { 8594 this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); 8595 this.element.style.zIndex = this.options.zindex; 8596 } 8597 8598 if(this.options.ghosting) { 8599 this._clone = this.element.cloneNode(true); 8600 this._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); 8601 if (!this._originallyAbsolute) 8602 Position.absolutize(this.element); 8603 this.element.parentNode.insertBefore(this._clone, this.element); 8604 } 8605 8606 if(this.options.scroll) { 8607 if (this.options.scroll == window) { 8608 var where = this._getWindowScroll(this.options.scroll); 8609 this.originalScrollLeft = where.left; 8610 this.originalScrollTop = where.top; 8611 } else {
8612 this.originalScrollLeft = this.options.scroll.scrollLeft; 8613 this.originalScrollTop = this.options.scroll.scrollTop; 8614 } 8615 } 8616 8617 Draggables.notify('onStart', this, event); 8618 8619 if(this.options.starteffect) this.options.starteffect(this.element); 8620 }, 8621 8622 updateDrag: function(event, pointer) { 8623 if(!this.dragging) this.startDrag(event); 8624 8625 if(!this.options.quiet){ 8626 Position.prepare(); 8627 Droppables.show(pointer, this.element); 8628 } 8629 8630 Draggables.notify('onDrag', this, event); 8631 8632 this.draw(pointer); 8633 if(this.options.change) this.options.change(this); 8634 8635 if(this.options.scroll) { 8636 this.stopScrolling(); 8637 8638 var p; 8639 if (this.options.scroll == window) { 8640 with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } 8641 } else { 8642 p = Position.page(this.options.scroll).toArray(); 8643 p[0] += this.options.scroll.scrollLeft + Position.deltaX; 8644 p[1] += this.options.scroll.scrollTop + Position.deltaY; 8645 p.push(p[0]+this.options.scroll.offsetWidth); 8646 p.push(p[1]+this.options.scroll.offsetHeight); 8647 } 8648 var speed = [0,0]; 8649 if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); 8650 if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); 8651 if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); 8652 if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); 8653 this.startScrolling(speed); 8654 } 8655 8656 // fix AppleWebKit rendering 8657 if(Prototype.Browser.WebKit) window.scrollBy(0,0); 8658 8659 Event.stop(event); 8660 }, 8661 8662 finishDrag: function(event, success) { 8663 this.dragging = false; 8664 8665 if(this.options.quiet){ 8666 Position.prepare(); 8667 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 8668 Droppables.show(pointer, this.element); 8669 } 8670 8671 if(this.options.ghosting) { 8672 if (!this._originallyAbsolute) 8673 Position.relativize(this.element); 8674 delete this._originallyAbsolute; 8675 Element.remove(this._clone); 8676 this._clone = null; 8677 } 8678 8679 var dropped = false; 8680 if(success) { 8681 dropped = Droppables.fire(event, this.element); 8682 if (!dropped) dropped = false; 8683 } 8684 if(dropped && this.options.onDropped) this.options.onDropped(this.element); 8685 Draggables.notify('onEnd', this, event); 8686 8687 var revert = this.options.revert; 8688 if(revert && Object.isFunction(revert)) revert = revert(this.element); 8689 8690 var d = this.currentDelta(); 8691 if(revert && this.options.reverteffect) { 8692 if (dropped == 0 || revert != 'failure') 8693 this.options.reverteffect(this.element, 8694 d[1]-this.delta[1], d[0]-this.delta[0]); 8695 } else { 8696 this.delta = d; 8697 } 8698 8699 if(this.options.zindex) 8700 this.element.style.zIndex = this.originalZ; 8701 8702 if(this.options.endeffect) 8703 this.options.endeffect(this.element); 8704 8705 Draggables.deactivate(this); 8706 Droppables.reset(); 8707 }, 8708 8709 keyPress: function(event) { 8710 if(event.keyCode!=Event.KEY_ESC) return; 8711 this.finishDrag(event, false); 8712 Event.stop(event); 8713 }, 8714 8715 endDrag: function(event) { 8716 if(!this.dragging) return; 8717 this.stopScrolling(); 8718 this.finishDrag(event, true); 8719 Event.stop(event); 8720 }, 8721 8722 draw: function(point) { 8723 var pos = this.element.cumulativeOffset(); 8724 if(this.options.ghosting) { 8725 var r = Position.realOffset(this.element); 8726 pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; 8727 } 8728 8729 var d = this.currentDelta(); 8730 pos[0] -= d[0]; pos[1] -= d[1]; 8731 8732 if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { 8733 pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; 8734 pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; 8735 } 8736 8737 var p = [0,1].map(function(i){ 8738 return (point[i]-pos[i]-this.offset[i]) 8739 }.bind(this)); 8740 8741 if(this.options.snap) { 8742 if(Object.isFunction(this.options.snap)) { 8743 p = this.options.snap(p[0],p[1],this); 8744 } else { 8745 if(Object.isArray(this.options.snap)) { 8746 p = p.map( function(v, i) { 8747 return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this)); 8748 } else { 8749 p = p.map( function(v) { 8750 return (v/this.options.snap).round()*this.options.snap }.bind(this)); 8751 } 8752 }} 8753 8754 var style = this.element.style; 8755 if((!this.options.constraint) || (this.options.constraint=='horizontal')) 8756 style.left = p[0] + "px"; 8757 if((!this.options.constraint) || (this.options.constraint=='vertical')) 8758 style.top = p[1] + "px"; 8759 8760 if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering 8761 }, 8762 8763 stopScrolling: function() { 8764 if(this.scrollInterval) { 8765 clearInterval(this.scrollInterval); 8766 this.scrollInterval = null; 8767 Draggables._lastScrollPointer = null; 8768 } 8769 }, 8770 8771 startScrolling: function(speed) { 8772 if(!(speed[0] || speed[1])) return; 8773 this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; 8774 this.lastScrolled = new Date(); 8775 this.scrollInterval = setInterval(this.scroll.bind(this), 10); 8776 }, 8777 8778 scroll: function() { 8779 var current = new Date(); 8780 var delta = current - this.lastScrolled; 8781 this.lastScrolled = current; 8782 if(this.options.scroll == window) { 8783 with (this._getWindowScroll(this.options.scroll)) { 8784 if (this.scrollSpeed[0] || this.scrollSpeed[1]) { 8785 var d = delta / 1000;
8786 this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); 8787 } 8788 } 8789 } else { 8790 this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; 8791 this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; 8792 } 8793 8794 Position.prepare(); 8795 Droppables.show(Draggables._lastPointer, this.element); 8796 Draggables.notify('onDrag', this); 8797 if (this._isScrollChild) { 8798 Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); 8799 Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; 8800 Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; 8801 if (Draggables._lastScrollPointer[0] < 0) 8802 Draggables._lastScrollPointer[0] = 0; 8803 if (Draggables._lastScrollPointer[1] < 0) 8804 Draggables._lastScrollPointer[1] = 0; 8805 this.draw(Draggables._lastScrollPointer); 8806 } 8807 8808 if(this.options.change) this.options.change(this); 8809 }, 8810 8811 _getWindowScroll: function(w) { 8812 var T, L, W, H; 8813 with (w.document) { 8814 if (w.document.documentElement && documentElement.scrollTop) { 8815 T = documentElement.scrollTop; 8816 L = documentElement.scrollLeft; 8817 } else if (w.document.body) { 8818 T = body.scrollTop; 8819 L = body.scrollLeft; 8820 } 8821 if (w.innerWidth) { 8822 W = w.innerWidth; 8823 H = w.innerHeight; 8824 } else if (w.document.documentElement && documentElement.clientWidth) { 8825 W = documentElement.clientWidth; 8826 H = documentElement.clientHeight; 8827 } else { 8828 W = body.offsetWidth; 8829 H = body.offsetHeight; 8830 } 8831 } 8832 return { top: T, left: L, width: W, height: H }; 8833 } 8834}); 8835 8836Draggable._dragging = { }; 8837 8838/*--------------------------------------------------------------------------*/ 8839 8840var SortableObserver = Class.create({ 8841 initialize: function(element, observer) { 8842 this.element = $(element); 8843 this.observer = observer; 8844 this.lastValue = Sortable.serialize(this.element); 8845 }, 8846 8847 onStart: function() { 8848 this.lastValue = Sortable.serialize(this.element); 8849 }, 8850 8851 onEnd: function() { 8852 Sortable.unmark(); 8853 if(this.lastValue != Sortable.serialize(this.element)) 8854 this.observer(this.element) 8855 } 8856}); 8857 8858var Sortable = { 8859 SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, 8860 8861 sortables: { }, 8862 8863 _findRootElement: function(element) { 8864 while (element.tagName.toUpperCase() != "BODY") { 8865 if(element.id && Sortable.sortables[element.id]) return element; 8866 element = element.parentNode; 8867 } 8868 }, 8869 8870 options: function(element) { 8871 element = Sortable._findRootElement($(element)); 8872 if(!element) return; 8873 return Sortable.sortables[element.id]; 8874 }, 8875 8876 destroy: function(element){ 8877 element = $(element); 8878 var s = Sortable.sortables[element.id]; 8879 8880 if(s) { 8881 Draggables.removeObserver(s.element); 8882 s.droppables.each(function(d){ Droppables.remove(d) }); 8883 s.draggables.invoke('destroy'); 8884 8885 delete Sortable.sortables[s.element.id]; 8886 } 8887 }, 8888 8889 create: function(element) { 8890 element = $(element); 8891 var options = Object.extend({ 8892 element: element, 8893 tag: 'li', // assumes li children, override with tag: 'tagname' 8894 dropOnEmpty: false, 8895 tree: false, 8896 treeTag: 'ul', 8897 overlap: 'vertical', // one of 'vertical', 'horizontal' 8898 constraint: 'vertical', // one of 'vertical', 'horizontal', false 8899 containment: element, // also takes array of elements (or id's); or false 8900 handle: false, // or a CSS class 8901 only: false, 8902 delay: 0, 8903 hoverclass: null, 8904 ghosting: false, 8905 quiet: false, 8906 scroll: false, 8907 scrollSensitivity: 20, 8908 scrollSpeed: 15, 8909 format: this.SERIALIZE_RULE, 8910 8911 // these take arrays of elements or ids and can be 8912 // used for better initialization performance 8913 elements: false, 8914 handles: false, 8915 8916 onChange: Prototype.emptyFunction, 8917 onUpdate: Prototype.emptyFunction 8918 }, arguments[1] || { }); 8919 8920 // clear any old sortable with same element 8921 this.destroy(element); 8922 8923 // build options for the draggables 8924 var options_for_draggable = { 8925 revert: true, 8926 quiet: options.quiet, 8927 scroll: options.scroll, 8928 scrollSpeed: options.scrollSpeed,
8929 scrollSensitivity: options.scrollSensitivity, 8930 delay: options.delay, 8931 ghosting: options.ghosting, 8932 constraint: options.constraint, 8933 handle: options.handle }; 8934 8935 if(options.starteffect) 8936 options_for_draggable.starteffect = options.starteffect; 8937 8938 if(options.reverteffect) 8939 options_for_draggable.reverteffect = options.reverteffect; 8940 else 8941 if(options.ghosting) options_for_draggable.reverteffect = function(element) { 8942 element.style.top = 0; 8943 element.style.left = 0; 8944 }; 8945 8946 if(options.endeffect) 8947 options_for_draggable.endeffect = options.endeffect; 8948 8949 if(options.zindex) 8950 options_for_draggable.zindex = options.zindex; 8951 8952 // build options for the droppables 8953 var options_for_droppable = { 8954 overlap: options.overlap, 8955 containment: options.containment, 8956 tree: options.tree, 8957 hoverclass: options.hoverclass, 8958 onHover: Sortable.onHover 8959 }; 8960 8961 var options_for_tree = { 8962 onHover: Sortable.onEmptyHover, 8963 overlap: options.overlap, 8964 containment: options.containment, 8965 hoverclass: options.hoverclass 8966 }; 8967 8968 // fix for gecko engine 8969 Element.cleanWhitespace(element); 8970 8971 options.draggables = []; 8972 options.droppables = []; 8973 8974 // drop on empty handling 8975 if(options.dropOnEmpty || options.tree) { 8976 Droppables.add(element, options_for_tree); 8977 options.droppables.push(element); 8978 } 8979 8980 (options.elements || this.findElements(element, options) || []).each( function(e,i) { 8981 var handle = options.handles ? $(options.handles[i]) : 8982 (options.handle ? $(e).select('.' + options.handle)[0] : e); 8983 options.draggables.push( 8984 new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); 8985 Droppables.add(e, options_for_droppable); 8986 if(options.tree) e.treeNode = element; 8987 options.droppables.push(e); 8988 }); 8989 8990 if(options.tree) { 8991 (Sortable.findTreeElements(element, options) || []).each( function(e) { 8992 Droppables.add(e, options_for_tree); 8993 e.treeNode = element; 8994 options.droppables.push(e); 8995 }); 8996 } 8997 8998 // keep reference 8999 this.sortables[element.identify()] = options; 9000 9001 // for onupdate 9002 Draggables.addObserver(new SortableObserver(element, options.onUpdate)); 9003 9004 }, 9005 9006 // return all suitable-for-sortable elements in a guaranteed order 9007 findElements: function(element, options) { 9008 return Element.findChildren( 9009 element, options.only, options.tree ? true : false, options.tag); 9010 }, 9011 9012 findTreeElements: function(element, options) { 9013 return Element.findChildren( 9014 element, options.only, options.tree ? true : false, options.treeTag); 9015 }, 9016 9017 onHover: function(element, dropon, overlap) { 9018 if(Element.isParent(dropon, element)) return; 9019 9020 if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { 9021 return; 9022 } else if(overlap>0.5) { 9023 Sortable.mark(dropon, 'before'); 9024 if(dropon.previousSibling != element) { 9025 var oldParentNode = element.parentNode; 9026 element.style.visibility = "hidden"; // fix gecko rendering 9027 dropon.parentNode.insertBefore(element, dropon); 9028 if(dropon.parentNode!=oldParentNode) 9029 Sortable.options(oldParentNode).onChange(element); 9030 Sortable.options(dropon.parentNode).onChange(element); 9031 } 9032 } else { 9033 Sortable.mark(dropon, 'after'); 9034 var nextElement = dropon.nextSibling || null; 9035 if(nextElement != element) { 9036 var oldParentNode = element.parentNode; 9037 element.style.visibility = "hidden"; // fix gecko rendering 9038 dropon.parentNode.insertBefore(element, nextElement); 9039 if(dropon.parentNode!=oldParentNode) 9040 Sortable.options(oldParentNode).onChange(element); 9041 Sortable.options(dropon.parentNode).onChange(element); 9042 } 9043 } 9044 }, 9045 9046 onEmptyHover: function(element, dropon, overlap) { 9047 var oldParentNode = element.parentNode; 9048 var droponOptions = Sortable.options(dropon); 9049 9050 if(!Element.isParent(dropon, element)) { 9051 var index; 9052 9053 var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); 9054 var child = null; 9055 9056 if(children) { 9057 var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); 9058 9059 for (index = 0; index < children.length; index += 1) { 9060 if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { 9061 offset -= Element.offsetSize (children[index], droponOptions.overlap); 9062 } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { 9063 child = index + 1 < children.length ? children[index + 1] : null; 9064 break; 9065 } else { 9066 child = children[index]; 9067 break; 9068 } 9069 } 9070 } 9071 9072 dropon.insertBefore(element, child); 9073
9074 Sortable.options(oldParentNode).onChange(element); 9075 droponOptions.onChange(element); 9076 } 9077 }, 9078 9079 unmark: function() { 9080 if(Sortable._marker) Sortable._marker.hide(); 9081 }, 9082 9083 mark: function(dropon, position) { 9084 // mark on ghosting only 9085 var sortable = Sortable.options(dropon.parentNode); 9086 if(sortable && !sortable.ghosting) return; 9087 9088 if(!Sortable._marker) { 9089 Sortable._marker = 9090 ($('dropmarker') || Element.extend(document.createElement('DIV'))). 9091 hide().addClassName('dropmarker').setStyle({position:'absolute'}); 9092 document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); 9093 } 9094 var offsets = dropon.cumulativeOffset(); 9095 Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); 9096 9097 if(position=='after') 9098 if(sortable.overlap == 'horizontal') 9099 Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); 9100 else 9101 Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); 9102 9103 Sortable._marker.show(); 9104 }, 9105 9106 _tree: function(element, options, parent) { 9107 var children = Sortable.findElements(element, options) || []; 9108 9109 for (var i = 0; i < children.length; ++i) { 9110 var match = children[i].id.match(options.format); 9111 9112 if (!match) continue; 9113 9114 var child = { 9115 id: encodeURIComponent(match ? match[1] : null), 9116 element: element, 9117 parent: parent, 9118 children: [], 9119 position: parent.children.length, 9120 container: $(children[i]).down(options.treeTag) 9121 }; 9122 9123 /* Get the element containing the children and recurse over it */ 9124 if (child.container) 9125 this._tree(child.container, options, child); 9126 9127 parent.children.push (child); 9128 } 9129 9130 return parent; 9131 }, 9132 9133 tree: function(element) { 9134 element = $(element); 9135 var sortableOptions = this.options(element); 9136 var options = Object.extend({ 9137 tag: sortableOptions.tag, 9138 treeTag: sortableOptions.treeTag, 9139 only: sortableOptions.only, 9140 name: element.id, 9141 format: sortableOptions.format 9142 }, arguments[1] || { }); 9143 9144 var root = { 9145 id: null, 9146 parent: null, 9147 children: [], 9148 container: element, 9149 position: 0 9150 }; 9151 9152 return Sortable._tree(element, options, root); 9153 }, 9154 9155 /* Construct a [i] index for a particular node */ 9156 _constructIndex: function(node) { 9157 var index = ''; 9158 do { 9159 if (node.id) index = '[' + node.position + ']' + index; 9160 } while ((node = node.parent) != null); 9161 return index; 9162 }, 9163 9164 sequence: function(element) { 9165 element = $(element); 9166 var options = Object.extend(this.options(element), arguments[1] || { }); 9167 9168 return $(this.findElements(element, options) || []).map( function(item) { 9169 return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; 9170 }); 9171 }, 9172 9173 setSequence: function(element, new_sequence) { 9174 element = $(element); 9175 var options = Object.extend(this.options(element), arguments[2] || { }); 9176 9177 var nodeMap = { }; 9178 this.findElements(element, options).each( function(n) { 9179 if (n.id.match(options.format)) 9180 nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; 9181 n.parentNode.removeChild(n); 9182 }); 9183 9184 new_sequence.each(function(ident) { 9185 var n = nodeMap[ident]; 9186 if (n) { 9187 n[1].appendChild(n[0]); 9188 delete nodeMap[ident]; 9189 } 9190 }); 9191 }, 9192 9193 serialize: function(element) { 9194 element = $(element); 9195 var options = Object.extend(Sortable.options(element), arguments[1] || { }); 9196 var name = encodeURIComponent( 9197 (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); 9198 9199 if (options.tree) { 9200 return Sortable.tree(element, arguments[1]).children.map( function (item) { 9201 return [name + Sortable._constructIndex(item) + "[id]=" + 9202 encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); 9203 }).flatten().join('&'); 9204 } else { 9205 return Sortable.sequence(element, arguments[1]).map( function(item) { 9206 return name + "[]=" + encodeURIComponent(item); 9207 }).join('&'); 9208 } 9209 } 9210}; 9211 9212// Returns true if child is contained within element 9213Element.isParent = function(child, element) { 9214 if (!child.parentNode || child == element) return false;
9215 if (child.parentNode == element) return true; 9216 return Element.isParent(child.parentNode, element); 9217}; 9218 9219Element.findChildren = function(element, only, recursive, tagName) { 9220 if(!element.hasChildNodes()) return null; 9221 tagName = tagName.toUpperCase(); 9222 if(only) only = [only].flatten(); 9223 var elements = []; 9224 $A(element.childNodes).each( function(e) { 9225 if(e.tagName && e.tagName.toUpperCase()==tagName && 9226 (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) 9227 elements.push(e); 9228 if(recursive) { 9229 var grandchildren = Element.findChildren(e, only, recursive, tagName); 9230 if(grandchildren) elements.push(grandchildren); 9231 } 9232 }); 9233 9234 return (elements.length>0 ? elements.flatten() : []); 9235}; 9236 9237Element.offsetSize = function (element, type) { 9238 return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; 9239}; 9240// script.aculo.us controls.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 9241 9242// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 9243// (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan) 9244// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com) 9245// Contributors: 9246// Richard Livsey 9247// Rahul Bhargava 9248// Rob Wills 9249// 9250// script.aculo.us is freely distributable under the terms of an MIT-style license. 9251// For details, see the script.aculo.us web site: http://script.aculo.us/ 9252 9253// Autocompleter.Base handles all the autocompletion functionality 9254// that's independent of the data source for autocompletion. This 9255// includes drawing the autocompletion menu, observing keyboard 9256// and mouse events, and similar. 9257// 9258// Specific autocompleters need to provide, at the very least, 9259// a getUpdatedChoices function that will be invoked every time 9260// the text inside the monitored textbox changes. This method 9261// should get the text for which to provide autocompletion by 9262// invoking this.getToken(), NOT by directly accessing 9263// this.element.value. This is to allow incremental tokenized 9264// autocompletion. Specific auto-completion logic (AJAX, etc) 9265// belongs in getUpdatedChoices. 9266// 9267// Tokenized incremental autocompletion is enabled automatically 9268// when an autocompleter is instantiated with the 'tokens' option 9269// in the options parameter, e.g.: 9270// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); 9271// will incrementally autocomplete with a comma as the token. 9272// Additionally, ',' in the above example can be replaced with 9273// a token array, e.g. { tokens: [',', '\n'] } which 9274// enables autocompletion on multiple tokens. This is most 9275// useful when one of the tokens is \n (a newline), as it 9276// allows smart autocompletion after linebreaks. 9277 9278if(typeof Effect == 'undefined') 9279 throw("controls.js requires including script.aculo.us' effects.js library"); 9280 9281var Autocompleter = { }; 9282Autocompleter.Base = Class.create({ 9283 baseInitialize: function(element, update, options) { 9284 element = $(element); 9285 this.element = element; 9286 this.update = $(update); 9287 this.hasFocus = false; 9288 this.changed = false; 9289 this.active = false; 9290 this.index = 0; 9291 this.entryCount = 0; 9292 this.oldElementValue = this.element.value; 9293 9294 if(this.setOptions) 9295 this.setOptions(options); 9296 else 9297 this.options = options || { }; 9298 9299 this.options.paramName = this.options.paramName || this.element.name; 9300 this.options.tokens = this.options.tokens || []; 9301 this.options.frequency = this.options.frequency || 0.4; 9302 this.options.minChars = this.options.minChars || 1; 9303 this.options.onShow = this.options.onShow || 9304 function(element, update){ 9305 if(!update.style.position || update.style.position=='absolute') { 9306 update.style.position = 'absolute'; 9307 Position.clone(element, update, { 9308 setHeight: false, 9309 offsetTop: element.offsetHeight 9310 }); 9311 } 9312 Effect.Appear(update,{duration:0.15}); 9313 }; 9314 this.options.onHide = this.options.onHide || 9315 function(element, update){ new Effect.Fade(update,{duration:0.15}) }; 9316 9317 if(typeof(this.options.tokens) == 'string') 9318 this.options.tokens = new Array(this.options.tokens); 9319 // Force carriage returns as token delimiters anyway 9320 if (!this.options.tokens.include('\n')) 9321 this.options.tokens.push('\n'); 9322 9323 this.observer = null; 9324 9325 this.element.setAttribute('autocomplete','off'); 9326 9327 Element.hide(this.update); 9328 9329 Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); 9330 Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this)); 9331 }, 9332 9333 show: function() { 9334 if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); 9335 if(!this.iefix && 9336 (Prototype.Browser.IE) && 9337 (Element.getStyle(this.update, 'position')=='absolute')) { 9338 new Insertion.After(this.update, 9339 '<iframe id="' + this.update.id + '_iefix" '+ 9340 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' + 9341 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>'); 9342 this.iefix = $(this.update.id+'_iefix'); 9343 } 9344 if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); 9345 }, 9346 9347 fixIEOverlapping: function() { 9348 Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); 9349 this.iefix.style.zIndex = 1; 9350 this.update.style.zIndex = 2; 9351 Element.show(this.iefix); 9352 }, 9353 9354 hide: function() { 9355 this.stopIndicator(); 9356 if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); 9357 if(this.iefix) Element.hide(this.iefix); 9358 }, 9359 9360 startIndicator: function() { 9361 if(this.options.indicator) Element.show(this.options.indicator); 9362 }, 9363 9364 stopIndicator: function() { 9365 if(this.options.indicator) Element.hide(this.options.indicator); 9366 }, 9367 9368 onKeyPress: function(event) { 9369 if(this.active) 9370 switch(event.keyCode) { 9371 case Event.KEY_TAB: 9372 case Event.KEY_RETURN: 9373 this.selectEntry(); 9374 Event.stop(event); 9375 case Event.KEY_ESC: 9376 this.hide(); 9377 this.active = false;
9378 Event.stop(event); 9379 return; 9380 case Event.KEY_LEFT: 9381 case Event.KEY_RIGHT: 9382 return; 9383 case Event.KEY_UP: 9384 this.markPrevious(); 9385 this.render(); 9386 Event.stop(event); 9387 return; 9388 case Event.KEY_DOWN: 9389 this.markNext(); 9390 this.render(); 9391 Event.stop(event); 9392 return; 9393 } 9394 else 9395 if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || 9396 (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; 9397 9398 this.changed = true; 9399 this.hasFocus = true; 9400 9401 if(this.observer) clearTimeout(this.observer); 9402 this.observer = 9403 setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); 9404 }, 9405 9406 activate: function() { 9407 this.changed = false; 9408 this.hasFocus = true; 9409 this.getUpdatedChoices(); 9410 }, 9411 9412 onHover: function(event) { 9413 var element = Event.findElement(event, 'LI'); 9414 if(this.index != element.autocompleteIndex) 9415 { 9416 this.index = element.autocompleteIndex; 9417 this.render(); 9418 } 9419 Event.stop(event); 9420 }, 9421 9422 onClick: function(event) { 9423 var element = Event.findElement(event, 'LI'); 9424 this.index = element.autocompleteIndex; 9425 this.selectEntry(); 9426 this.hide(); 9427 }, 9428 9429 onBlur: function(event) { 9430 // needed to make click events working 9431 setTimeout(this.hide.bind(this), 250); 9432 this.hasFocus = false; 9433 this.active = false; 9434 }, 9435 9436 render: function() { 9437 if(this.entryCount > 0) { 9438 for (var i = 0; i < this.entryCount; i++) 9439 this.index==i ? 9440 Element.addClassName(this.getEntry(i),"selected") : 9441 Element.removeClassName(this.getEntry(i),"selected"); 9442 if(this.hasFocus) { 9443 this.show(); 9444 this.active = true; 9445 } 9446 } else { 9447 this.active = false; 9448 this.hide(); 9449 } 9450 }, 9451 9452 markPrevious: function() { 9453 if(this.index > 0) this.index--; 9454 else this.index = this.entryCount-1; 9455 //this.getEntry(this.index).scrollIntoView(true); useless 9456 }, 9457 9458 markNext: function() { 9459 if(this.index < this.entryCount-1) this.index++; 9460 else this.index = 0; 9461 this.getEntry(this.index).scrollIntoView(false); 9462 }, 9463 9464 getEntry: function(index) { 9465 return this.update.firstChild.childNodes[index]; 9466 }, 9467 9468 getCurrentEntry: function() { 9469 return this.getEntry(this.index); 9470 }, 9471 9472 selectEntry: function() { 9473 this.active = false; 9474 this.updateElement(this.getCurrentEntry()); 9475 }, 9476 9477 updateElement: function(selectedElement) { 9478 if (this.options.updateElement) { 9479 this.options.updateElement(selectedElement); 9480 return; 9481 } 9482 var value = ''; 9483 if (this.options.select) { 9484 var nodes = $(selectedElement).select('.' + this.options.select) || []; 9485 if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); 9486 } else 9487 value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); 9488 9489 var bounds = this.getTokenBounds(); 9490 if (bounds[0] != -1) { 9491 var newValue = this.element.value.substr(0, bounds[0]); 9492 var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/); 9493 if (whitespace) 9494 newValue += whitespace[0]; 9495 this.element.value = newValue + value + this.element.value.substr(bounds[1]); 9496 } else { 9497 this.element.value = value; 9498 } 9499 this.oldElementValue = this.element.value; 9500 this.element.focus(); 9501 9502 if (this.options.afterUpdateElement) 9503 this.options.afterUpdateElement(this.element, selectedElement); 9504 }, 9505 9506 updateChoices: function(choices) { 9507 if(!this.changed && this.hasFocus) { 9508 this.update.innerHTML = choices; 9509 Element.cleanWhitespace(this.update); 9510 Element.cleanWhitespace(this.update.down()); 9511 9512 if(this.update.firstChild && this.update.down().childNodes) { 9513 this.entryCount = 9514 this.update.down().childNodes.length; 9515 for (var i = 0; i < this.entryCount; i++) { 9516 var entry = this.getEntry(i); 9517 entry.autocompleteIndex = i; 9518 this.addObservers(entry); 9519 } 9520 } else { 9521 this.entryCount = 0; 9522 } 9523 9524 this.stopIndicator(); 9525 this.index = 0; 9526 9527 if(this.entryCount==1 && this.options.autoSelect) { 9528 this.selectEntry(); 9529 this.hide(); 9530 } else { 9531 this.render(); 9532 } 9533 } 9534 }, 9535 9536 addObservers: function(element) { 9537 Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); 9538 Event.observe(element, "click", this.onClick.bindAsEventListener(this)); 9539 }, 9540 9541 onObserverEvent: function() { 9542 this.changed = false;
9543 this.tokenBounds = null; 9544 if(this.getToken().length>=this.options.minChars) { 9545 this.getUpdatedChoices(); 9546 } else { 9547 this.active = false; 9548 this.hide(); 9549 } 9550 this.oldElementValue = this.element.value; 9551 }, 9552 9553 getToken: function() { 9554 var bounds = this.getTokenBounds(); 9555 return this.element.value.substring(bounds[0], bounds[1]).strip(); 9556 }, 9557 9558 getTokenBounds: function() { 9559 if (null != this.tokenBounds) return this.tokenBounds; 9560 var value = this.element.value; 9561 if (value.strip().empty()) return [-1, 0]; 9562 var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue); 9563 var offset = (diff == this.oldElementValue.length ? 1 : 0); 9564 var prevTokenPos = -1, nextTokenPos = value.length; 9565 var tp; 9566 for (var index = 0, l = this.options.tokens.length; index < l; ++index) { 9567 tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1); 9568 if (tp > prevTokenPos) prevTokenPos = tp; 9569 tp = value.indexOf(this.options.tokens[index], diff + offset); 9570 if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp; 9571 } 9572 return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); 9573 } 9574}); 9575 9576Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { 9577 var boundary = Math.min(newS.length, oldS.length); 9578 for (var index = 0; index < boundary; ++index) 9579 if (newS[index] != oldS[index]) 9580 return index; 9581 return boundary; 9582}; 9583 9584Ajax.Autocompleter = Class.create(Autocompleter.Base, { 9585 initialize: function(element, update, url, options) { 9586 this.baseInitialize(element, update, options); 9587 this.options.asynchronous = true; 9588 this.options.onComplete = this.onComplete.bind(this); 9589 this.options.defaultParams = this.options.parameters || null; 9590 this.url = url; 9591 }, 9592 9593 getUpdatedChoices: function() { 9594 this.startIndicator(); 9595 9596 var entry = encodeURIComponent(this.options.paramName) + '=' + 9597 encodeURIComponent(this.getToken()); 9598 9599 this.options.parameters = this.options.callback ? 9600 this.options.callback(this.element, entry) : entry; 9601 9602 if(this.options.defaultParams) 9603 this.options.parameters += '&' + this.options.defaultParams; 9604 9605 new Ajax.Request(this.url, this.options); 9606 }, 9607 9608 onComplete: function(request) { 9609 this.updateChoices(request.responseText); 9610 } 9611}); 9612 9613// The local array autocompleter. Used when you'd prefer to 9614// inject an array of autocompletion options into the page, rather 9615// than sending out Ajax queries, which can be quite slow sometimes. 9616// 9617// The constructor takes four parameters. The first two are, as usual, 9618// the id of the monitored textbox, and id of the autocompletion menu. 9619// The third is the array you want to autocomplete from, and the fourth 9620// is the options block. 9621// 9622// Extra local autocompletion options: 9623// - choices - How many autocompletion choices to offer 9624//
9625// - partialSearch - If false, the autocompleter will match entered 9626// text only at the beginning of strings in the 9627// autocomplete array. Defaults to true, which will 9628// match text at the beginning of any *word* in the 9629// strings in the autocomplete array. If you want to 9630// search anywhere in the string, additionally set 9631// the option fullSearch to true (default: off). 9632// 9633// - fullSsearch - Search anywhere in autocomplete array strings. 9634// 9635// - partialChars - How many characters to enter before triggering 9636// a partial match (unlike minChars, which defines 9637// how many characters are required to do any match 9638// at all). Defaults to 2. 9639// 9640// - ignoreCase - Whether to ignore case when autocompleting. 9641// Defaults to true. 9642// 9643// It's possible to pass in a custom function as the 'selector' 9644// option, if you prefer to write your own autocompletion logic. 9645// In that case, the other options above will not apply unless 9646// you support them. 9647 9648Autocompleter.Local = Class.create(Autocompleter.Base, { 9649 initialize: function(element, update, array, options) { 9650 this.baseInitialize(element, update, options); 9651 this.options.array = array; 9652 }, 9653 9654 getUpdatedChoices: function() { 9655 this.updateChoices(this.options.selector(this)); 9656 }, 9657 9658 setOptions: function(options) { 9659 this.options = Object.extend({ 9660 choices: 10, 9661 partialSearch: true, 9662 partialChars: 2, 9663 ignoreCase: true, 9664 fullSearch: false, 9665 selector: function(instance) { 9666 var ret = []; // Beginning matches 9667 var partial = []; // Inside matches 9668 var entry = instance.getToken(); 9669 var count = 0; 9670 9671 for (var i = 0; i < instance.options.array.length && 9672 ret.length < instance.options.choices ; i++) { 9673 9674 var elem = instance.options.array[i]; 9675 var foundPos = instance.options.ignoreCase ? 9676 elem.toLowerCase().indexOf(entry.toLowerCase()) : 9677 elem.indexOf(entry); 9678 9679 while (foundPos != -1) { 9680 if (foundPos == 0 && elem.length != entry.length) { 9681 ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" + 9682 elem.substr(entry.length) + "</li>"); 9683 break; 9684 } else if (entry.length >= instance.options.partialChars && 9685 instance.options.partialSearch && foundPos != -1) { 9686 if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { 9687 partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" + 9688 elem.substr(foundPos, entry.length) + "</strong>" + elem.substr( 9689 foundPos + entry.length) + "</li>"); 9690 break; 9691 } 9692 } 9693 9694 foundPos = instance.options.ignoreCase ? 9695 elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : 9696 elem.indexOf(entry, foundPos + 1); 9697 9698 } 9699 } 9700 if (partial.length) 9701 ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)); 9702 return "<ul>" + ret.join('') + "</ul>"; 9703 } 9704 }, options || { }); 9705 } 9706}); 9707 9708// AJAX in-place editor and collection editor 9709// Full rewrite by Christophe Porteneuve <[email protected]> (April 2007). 9710 9711// Use this if you notice weird scrolling problems on some browsers, 9712// the DOM might be a bit confused when this gets called so do this 9713// waits 1 ms (with setTimeout) until it does the activation 9714Field.scrollFreeActivate = function(field) { 9715 setTimeout(function() { 9716 Field.activate(field); 9717 }, 1); 9718}; 9719 9720Ajax.InPlaceEditor = Class.create({ 9721 initialize: function(element, url, options) { 9722 this.url = url; 9723 this.element = element = $(element); 9724 this.prepareOptions(); 9725 this._controls = { }; 9726 arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!! 9727 Object.extend(this.options, options || { });
9728 if (!this.options.formId && this.element.id) { 9729 this.options.formId = this.element.id + '-inplaceeditor'; 9730 if ($(this.options.formId)) 9731 this.options.formId = ''; 9732 } 9733 if (this.options.externalControl) 9734 this.options.externalControl = $(this.options.externalControl); 9735 if (!this.options.externalControl) 9736 this.options.externalControlOnly = false; 9737 this._originalBackground = this.element.getStyle('background-color') || 'transparent'; 9738 this.element.title = this.options.clickToEditText; 9739 this._boundCancelHandler = this.handleFormCancellation.bind(this); 9740 this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this); 9741 this._boundFailureHandler = this.handleAJAXFailure.bind(this); 9742 this._boundSubmitHandler = this.handleFormSubmission.bind(this); 9743 this._boundWrapperHandler = this.wrapUp.bind(this); 9744 this.registerListeners(); 9745 }, 9746 checkForEscapeOrReturn: function(e) { 9747 if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; 9748 if (Event.KEY_ESC == e.keyCode) 9749 this.handleFormCancellation(e); 9750 else if (Event.KEY_RETURN == e.keyCode) 9751 this.handleFormSubmission(e); 9752 }, 9753 createControl: function(mode, handler, extraClasses) { 9754 var control = this.options[mode + 'Control']; 9755 var text = this.options[mode + 'Text']; 9756 if ('button' == control) { 9757 var btn = document.createElement('input'); 9758 btn.type = 'submit'; 9759 btn.value = text; 9760 btn.className = 'editor_' + mode + '_button'; 9761 if ('cancel' == mode) 9762 btn.onclick = this._boundCancelHandler; 9763 this._form.appendChild(btn); 9764 this._controls[mode] = btn; 9765 } else if ('link' == control) { 9766 var link = document.createElement('a'); 9767 link.href = '#'; 9768 link.appendChild(document.createTextNode(text)); 9769 link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler; 9770 link.className = 'editor_' + mode + '_link'; 9771 if (extraClasses) 9772 link.className += ' ' + extraClasses; 9773 this._form.appendChild(link); 9774 this._controls[mode] = link; 9775 } 9776 }, 9777 createEditField: function() { 9778 var text = (this.options.loadTextURL ? this.options.loadingText : this.getText()); 9779 var fld; 9780 if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) { 9781 fld = document.createElement('input'); 9782 fld.type = 'text'; 9783 var size = this.options.size || this.options.cols || 0; 9784 if (0 < size) fld.size = size; 9785 } else { 9786 fld = document.createElement('textarea'); 9787 fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows); 9788 fld.cols = this.options.cols || 40; 9789 } 9790 fld.name = this.options.paramName; 9791 fld.value = text; // No HTML breaks conversion anymore 9792 fld.className = 'editor_field'; 9793 if (this.options.submitOnBlur) 9794 fld.onblur = this._boundSubmitHandler; 9795 this._controls.editor = fld; 9796 if (this.options.loadTextURL) 9797 this.loadExternalText(); 9798 this._form.appendChild(this._controls.editor); 9799 }, 9800 createForm: function() { 9801 var ipe = this; 9802 function addText(mode, condition) { 9803 var text = ipe.options['text' + mode + 'Controls']; 9804 if (!text || condition === false) return; 9805 ipe._form.appendChild(document.createTextNode(text)); 9806 }; 9807 this._form = $(document.createElement('form')); 9808 this._form.id = this.options.formId; 9809 this._form.addClassName(this.options.formClassName); 9810 this._form.onsubmit = this._boundSubmitHandler; 9811 this.createEditField(); 9812 if ('textarea' == this._controls.editor.tagName.toLowerCase()) 9813 this._form.appendChild(document.createElement('br')); 9814 if (this.options.onFormCustomization) 9815 this.options.onFormCustomization(this, this._form); 9816 addText('Before', this.options.okControl || this.options.cancelControl); 9817 this.createControl('ok', this._boundSubmitHandler); 9818 addText('Between', this.options.okControl && this.options.cancelControl); 9819 this.createControl('cancel', this._boundCancelHandler, 'editor_cancel'); 9820 addText('After', this.options.okControl || this.options.cancelControl); 9821 }, 9822 destroy: function() { 9823 if (this._oldInnerHTML) 9824 this.element.innerHTML = this._oldInnerHTML; 9825 this.leaveEditMode(); 9826 this.unregisterListeners(); 9827 }, 9828 enterEditMode: function(e) { 9829 if (this._saving || this._editing) return; 9830 this._editing = true; 9831 this.triggerCallback('onEnterEditMode'); 9832 if (this.options.externalControl) 9833 this.options.externalControl.hide(); 9834 this.element.hide(); 9835 this.createForm(); 9836 this.element.parentNode.insertBefore(this._form, this.element); 9837 if (!this.options.loadTextURL) 9838 this.postProcessEditField();
9839 if (e) Event.stop(e); 9840 }, 9841 enterHover: function(e) { 9842 if (this.options.hoverClassName) 9843 this.element.addClassName(this.options.hoverClassName); 9844 if (this._saving) return; 9845 this.triggerCallback('onEnterHover'); 9846 }, 9847 getText: function() { 9848 return this.element.innerHTML.unescapeHTML(); 9849 }, 9850 handleAJAXFailure: function(transport) { 9851 this.triggerCallback('onFailure', transport); 9852 if (this._oldInnerHTML) { 9853 this.element.innerHTML = this._oldInnerHTML; 9854 this._oldInnerHTML = null; 9855 } 9856 }, 9857 handleFormCancellation: function(e) { 9858 this.wrapUp(); 9859 if (e) Event.stop(e); 9860 }, 9861 handleFormSubmission: function(e) { 9862 var form = this._form; 9863 var value = $F(this._controls.editor); 9864 this.prepareSubmission(); 9865 var params = this.options.callback(form, value) || ''; 9866 if (Object.isString(params)) 9867 params = params.toQueryParams(); 9868 params.editorId = this.element.id; 9869 if (this.options.htmlResponse) { 9870 var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); 9871 Object.extend(options, { 9872 parameters: params, 9873 onComplete: this._boundWrapperHandler, 9874 onFailure: this._boundFailureHandler 9875 }); 9876 new Ajax.Updater({ success: this.element }, this.url, options); 9877 } else { 9878 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 9879 Object.extend(options, { 9880 parameters: params, 9881 onComplete: this._boundWrapperHandler, 9882 onFailure: this._boundFailureHandler 9883 }); 9884 new Ajax.Request(this.url, options); 9885 } 9886 if (e) Event.stop(e); 9887 }, 9888 leaveEditMode: function() { 9889 this.element.removeClassName(this.options.savingClassName); 9890 this.removeForm(); 9891 this.leaveHover(); 9892 this.element.style.backgroundColor = this._originalBackground; 9893 this.element.show(); 9894 if (this.options.externalControl) 9895 this.options.externalControl.show(); 9896 this._saving = false; 9897 this._editing = false; 9898 this._oldInnerHTML = null; 9899 this.triggerCallback('onLeaveEditMode'); 9900 }, 9901 leaveHover: function(e) { 9902 if (this.options.hoverClassName) 9903 this.element.removeClassName(this.options.hoverClassName); 9904 if (this._saving) return; 9905 this.triggerCallback('onLeaveHover'); 9906 }, 9907 loadExternalText: function() { 9908 this._form.addClassName(this.options.loadingClassName); 9909 this._controls.editor.disabled = true; 9910 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 9911 Object.extend(options, { 9912 parameters: 'editorId=' + encodeURIComponent(this.element.id), 9913 onComplete: Prototype.emptyFunction, 9914 onSuccess: function(transport) { 9915 this._form.removeClassName(this.options.loadingClassName); 9916 var text = transport.responseText; 9917 if (this.options.stripLoadedTextTags) 9918 text = text.stripTags(); 9919 this._controls.editor.value = text; 9920 this._controls.editor.disabled = false; 9921 this.postProcessEditField(); 9922 }.bind(this), 9923 onFailure: this._boundFailureHandler 9924 }); 9925 new Ajax.Request(this.options.loadTextURL, options); 9926 }, 9927 postProcessEditField: function() { 9928 var fpc = this.options.fieldPostCreation; 9929 if (fpc) 9930 $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate'](); 9931 }, 9932 prepareOptions: function() { 9933 this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions); 9934 Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks); 9935 [this._extraDefaultOptions].flatten().compact().each(function(defs) { 9936 Object.extend(this.options, defs); 9937 }.bind(this)); 9938 }, 9939 prepareSubmission: function() { 9940 this._saving = true; 9941 this.removeForm(); 9942 this.leaveHover(); 9943 this.showSaving(); 9944 }, 9945 registerListeners: function() { 9946 this._listeners = { }; 9947 var listener; 9948 $H(Ajax.InPlaceEditor.Listeners).each(function(pair) { 9949 listener = this[pair.value].bind(this); 9950 this._listeners[pair.key] = listener; 9951 if (!this.options.externalControlOnly) 9952 this.element.observe(pair.key, listener); 9953 if (this.options.externalControl) 9954 this.options.externalControl.observe(pair.key, listener); 9955 }.bind(this)); 9956 }, 9957 removeForm: function() { 9958 if (!this._form) return; 9959 this._form.remove(); 9960 this._form = null; 9961 this._controls = { }; 9962 }, 9963 showSaving: function() { 9964 this._oldInnerHTML = this.element.innerHTML; 9965 this.element.innerHTML = this.options.savingText; 9966 this.element.addClassName(this.options.savingClassName); 9967 this.element.style.backgroundColor = this._originalBackgroun
9967d; 9968 this.element.show(); 9969 }, 9970 triggerCallback: function(cbName, arg) { 9971 if ('function' == typeof this.options[cbName]) { 9972 this.options[cbName](this, arg); 9973 } 9974 }, 9975 unregisterListeners: function() { 9976 $H(this._listeners).each(function(pair) { 9977 if (!this.options.externalControlOnly) 9978 this.element.stopObserving(pair.key, pair.value); 9979 if (this.options.externalControl) 9980 this.options.externalControl.stopObserving(pair.key, pair.value); 9981 }.bind(this)); 9982 }, 9983 wrapUp: function(transport) { 9984 this.leaveEditMode(); 9985 // Can't use triggerCallback due to backward compatibility: requires 9986 // binding + direct element 9987 this._boundComplete(transport, this.element); 9988 } 9989}); 9990 9991Object.extend(Ajax.InPlaceEditor.prototype, { 9992 dispose: Ajax.InPlaceEditor.prototype.destroy 9993}); 9994 9995Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, { 9996 initialize: function($super, element, url, options) { 9997 this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; 9998 $super(element, url, options); 9999 }, 10000 10001 createEditField: function() { 10002 var list = document.createElement('select'); 10003 list.name = this.options.paramName; 10004 list.size = 1; 10005 this._controls.editor = list; 10006 this._collection = this.options.collection || []; 10007 if (this.options.loadCollectionURL) 10008 this.loadCollection(); 10009 else 10010 this.checkForExternalText(); 10011 this._form.appendChild(this._controls.editor); 10012 }, 10013 10014 loadCollection: function() { 10015 this._form.addClassName(this.options.loadingClassName); 10016 this.showLoadingText(this.options.loadingCollectionText); 10017 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 10018 Object.extend(options, { 10019 parameters: 'editorId=' + encodeURIComponent(this.element.id), 10020 onComplete: Prototype.emptyFunction, 10021 onSuccess: function(transport) { 10022 var js = transport.responseText.strip(); 10023 if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check 10024 throw('Server returned an invalid collection representation.'); 10025 this._collection = eval(js); 10026 this.checkForExternalText(); 10027 }.bind(this), 10028 onFailure: this.onFailure 10029 }); 10030 new Ajax.Request(this.options.loadCollectionURL, options); 10031 }, 10032 10033 showLoadingText: function(text) { 10034 this._controls.editor.disabled = true; 10035 var tempOption = this._controls.editor.firstChild; 10036 if (!tempOption) { 10037 tempOption = document.createElement('option'); 10038 tempOption.value = ''; 10039 this._controls.editor.appendChild(tempOption); 10040 tempOption.selected = true; 10041 } 10042 tempOption.update((text || '').stripScripts().stripTags()); 10043 }, 10044 10045 checkForExternalText: function() { 10046 this._text = this.getText(); 10047 if (this.options.loadTextURL) 10048 this.loadExternalText(); 10049 else 10050 this.buildOptionList(); 10051 }, 10052 10053 loadExternalText: function() { 10054 this.showLoadingText(this.options.loadingText); 10055 var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); 10056 Object.extend(options, { 10057 parameters: 'editorId=' + encodeURIComponent(this.element.id), 10058 onComplete: Prototype.emptyFunction, 10059 onSuccess: function(transport) { 10060 this._text = transport.responseText.strip(); 10061 this.buildOptionList(); 10062 }.bind(this), 10063 onFailure: this.onFailure 10064 }); 10065 new Ajax.Request(this.options.loadTextURL, options); 10066 }, 10067 10068 buildOptionList: function() { 10069 this._form.removeClassName(this.options.loadingClassName); 10070 this._collection = this._collection.map(function(entry) { 10071 return 2 === entry.length ? entry : [entry, entry].flatten(); 10072 }); 10073 var marker = ('value' in this.options) ? this.options.value : this._text; 10074 var textFound = this._collection.any(function(entry) { 10075 return entry[0] == marker; 10076 }.bind(this)); 10077 this._controls.editor.update(''); 10078 var option; 10079 this._collection.each(function(entry, index) { 10080 option = document.createElement('option'); 10081 option.value = entry[0]; 10082 option.selected = textFound ? entry[0] == marker : 0 == index; 10083 option.appendChild(document.createTextNode(entry[1])); 10084 this._controls.editor.appendChild(option); 10085 }.bind(this)); 10086 this._controls.editor.disabled = false;
10087 Field.scrollFreeActivate(this._controls.editor); 10088 } 10089}); 10090 10091//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! **** 10092//**** This only exists for a while, in order to let **** 10093//**** users adapt to the new API. Read up on the new **** 10094//**** API and convert your code to it ASAP! **** 10095 10096Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) { 10097 if (!options) return; 10098 function fallback(name, expr) { 10099 if (name in options || expr === undefined) return; 10100 options[name] = expr; 10101 }; 10102 fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' : 10103 options.cancelLink == options.cancelButton == false ? false : undefined))); 10104 fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' : 10105 options.okLink == options.okButton == false ? false : undefined))); 10106 fallback('highlightColor', options.highlightcolor); 10107 fallback('highlightEndColor', options.highlightendcolor); 10108}; 10109 10110Object.extend(Ajax.InPlaceEditor, { 10111 DefaultOptions: { 10112 ajaxOptions: { }, 10113 autoRows: 3, // Use when multi-line w/ rows == 1 10114 cancelControl: 'link', // 'link'|'button'|false 10115 cancelText: 'cancel', 10116 clickToEditText: 'Click to edit', 10117 externalControl: null, // id|elt 10118 externalControlOnly: false, 10119 fieldPostCreation: 'activate', // 'activate'|'focus'|false 10120 formClassName: 'inplaceeditor-form', 10121 formId: null, // id|elt 10122 highlightColor: '#ffff99', 10123 highlightEndColor: '#ffffff', 10124 hoverClassName: '', 10125 htmlResponse: true, 10126 loadingClassName: 'inplaceeditor-loading', 10127 loadingText: 'Loading...', 10128 okControl: 'button', // 'link'|'button'|false 10129 okText: 'ok', 10130 paramName: 'value', 10131 rows: 1, // If 1 and multi-line, uses autoRows 10132 savingClassName: 'inplaceeditor-saving', 10133 savingText: 'Saving...', 10134 size: 0, 10135 stripLoadedTextTags: false, 10136 submitOnBlur: false, 10137 textAfterControls: '', 10138 textBeforeControls: '', 10139 textBetweenControls: '' 10140 }, 10141 DefaultCallbacks: { 10142 callback: function(form) { 10143 return Form.serialize(form); 10144 }, 10145 onComplete: function(transport, element) { 10146 // For backward compatibility, this one is bound to the IPE, and passes 10147 // the element directly. It was too often customized, so we don't break it. 10148 new Effect.Highlight(element, { 10149 startcolor: this.options.highlightColor, keepBackgroundImage: true }); 10150 }, 10151 onEnterEditMode: null, 10152 onEnterHover: function(ipe) { 10153 ipe.element.style.backgroundColor = ipe.options.highlightColor; 10154 if (ipe._effect) 10155 ipe._effect.cancel(); 10156 }, 10157 onFailure: function(transport, ipe) { 10158 alert('Error communication with the server: ' + transport.responseText.stripTags()); 10159 }, 10160 onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. 10161 onLeaveEditMode: null, 10162 onLeaveHover: function(ipe) { 10163 ipe._effect = new Effect.Highlight(ipe.element, { 10164 startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, 10165 restorecolor: ipe._originalBackground, keepBackgroundImage: true 10166 }); 10167 } 10168 }, 10169 Listeners: { 10170 click: 'enterEditMode', 10171 keydown: 'checkForEscapeOrReturn', 10172 mouseover: 'enterHover', 10173 mouseout: 'leaveHover' 10174 } 10175}); 10176 10177Ajax.InPlaceCollectionEditor.DefaultOptions = { 10178 loadingCollectionText: 'Loading options...' 10179}; 10180 10181// Delayed observer, like Form.Element.Observer, 10182// but waits for delay after last key input 10183// Ideal for live-search fields 10184 10185Form.Element.DelayedObserver = Class.create({ 10186 initialize: function(element, delay, callback) { 10187 this.delay = delay || 0.5; 10188 this.element = $(element); 10189 this.callback = callback; 10190 this.timer = null; 10191 this.lastValue = $F(this.element); 10192 Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); 10193 }, 10194 delayedListener: function(event) { 10195 if(this.lastValue == $F(this.element)) return; 10196 if(this.timer) clearTimeout(this.timer); 10197 this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); 10198 this.lastValue = $F(this.element); 10199 },
10200 onTimerEvent: function() { 10201 this.timer = null; 10202 this.callback(this.element, $F(this.element)); 10203 } 10204}); 10205// script.aculo.us slider.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008 10206 10207// Copyright (c) 2005-2008 Marty Haught, Thomas Fuchs 10208// 10209// script.aculo.us is freely distributable under the terms of an MIT-style license. 10210// For details, see the script.aculo.us web site: http://script.aculo.us/ 10211 10212if (!Control) var Control = { }; 10213 10214// options: 10215// axis: 'vertical', or 'horizontal' (default) 10216// 10217// callbacks: 10218// onChange(value) 10219// onSlide(value) 10220Control.Slider = Class.create({ 10221 initialize: function(handle, track, options) { 10222 var slider = this; 10223 10224 if (Object.isArray(handle)) { 10225 this.handles = handle.collect( function(e) { return $(e) }); 10226 } else { 10227 this.handles = [$(handle)]; 10228 } 10229 10230 this.track = $(track); 10231 this.options = options || { }; 10232 10233 this.axis = this.options.axis || 'horizontal'; 10234 this.increment = this.options.increment || 1; 10235 this.step = parseInt(this.options.step || '1'); 10236 this.range = this.options.range || $R(0,1); 10237 10238 this.value = 0; // assure backwards compat 10239 this.values = this.handles.map( function() { return 0 }); 10240 this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false; 10241 this.options.startSpan = $(this.options.startSpan || null); 10242 this.options.endSpan = $(this.options.endSpan || null); 10243 10244 this.restricted = this.options.restricted || false; 10245 10246 this.maximum = this.options.maximum || this.range.end; 10247 this.minimum = this.options.minimum || this.range.start; 10248 10249 // Will be used to align the handle onto the track, if necessary 10250 this.alignX = parseInt(this.options.alignX || '0'); 10251 this.alignY = parseInt(this.options.alignY || '0'); 10252 10253 this.trackLength = this.maximumOffset() - this.minimumOffset(); 10254 10255 this.handleLength = this.isVertical() ? 10256 (this.handles[0].offsetHeight != 0 ? 10257 this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) : 10258 (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : 10259 this.handles[0].style.width.replace(/px$/,"")); 10260 10261 this.active = false; 10262 this.dragging = false; 10263 this.disabled = false; 10264 10265 if (this.options.disabled) this.setDisabled(); 10266 10267 // Allowed values array 10268 this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false; 10269 if (this.allowedValues) { 10270 this.minimum = this.allowedValues.min(); 10271 this.maximum = this.allowedValues.max(); 10272 } 10273 10274 this.eventMouseDown = this.startDrag.bindAsEventListener(this); 10275 this.eventMouseUp = this.endDrag.bindAsEventListener(this); 10276 this.eventMouseMove = this.update.bindAsEventListener(this); 10277 10278 // Initialize handles in reverse (make sure first handle is active) 10279 this.handles.each( function(h,i) { 10280 i = slider.handles.length-1-i; 10281 slider.setValue(parseFloat( 10282 (Object.isArray(slider.options.sliderValue) ? 10283 slider.options.sliderValue[i] : slider.options.sliderValue) || 10284 slider.range.start), i); 10285 h.makePositioned().observe("mousedown", slider.eventMouseDown); 10286 }); 10287 10288 this.track.observe("mousedown", this.eventMouseDown); 10289 document.observe("mouseup", this.eventMouseUp); 10290 $(this.track.parentNode.parentNode).observe("mousemove", this.eventMouseMove); 10291 10292 10293 this.initialized = true; 10294 }, 10295 dispose: function() { 10296 var slider = this; 10297 Event.stopObserving(this.track, "mousedown", this.eventMouseDown); 10298 Event.stopObserving(document, "mouseup", this.eventMouseUp); 10299 Event.stopObserving(this.track.parentNode.parentNode, "mousemove", this.eventMouseMove); 10300 this.handles.each( function(h) { 10301 Event.stopObserving(h, "mousedown", slider.eventMouseDown); 10302 }); 10303 }, 10304 setDisabled: function(){ 10305 this.disabled = true; 10306 this.track.parentNode.className = this.track.parentNode.className + ' disabled'; 10307 }, 10308 setEnabled: function(){ 10309 this.disabled = false; 10310 }, 10311 getNearestValue: function(value){ 10312 if (this.allowedValues){ 10313 if (value >= this.allowedValues.max()) return(this.allowedValues.max()); 10314 if (value <= this.allowedValues.min()) return(this.allowedValues.min()); 10315 10316 var offset = Math.abs(this.allowedValues[0] - value); 10317 var newValue = this.allowedValues[0]; 10318 this.allowedValues.each( function(v) { 10319 var currentOffset = Math.abs(v - value); 10320 if (currentOffset <= offset){ 10321 newValue = v; 10322 offset = currentOffset; 10323 } 10324 }); 10325 return newValue; 10326 } 10327 if (value > this.range.end) return this.range.end; 10328 if (value < this.range.start) return this.range.start; 10329 return value; 10330 }, 10331 setValue: function(sliderValue, handleIdx){ 10332 if (!this.active) { 10333 this.activeHandleIdx = handleIdx || 0; 10334 this.activeHandle = this.handles[this.activeHandleIdx]; 10335 this.updateStyles(); 10336 } 10337 handleIdx = handleIdx || this.activeHandleIdx || 0; 10338 if (this.initialized && this.restricted) { 10339 if ((handleIdx>0) && (sliderValue<this.values[handleIdx-1])) 10340 sliderValue = this.values[handleIdx-1]; 10341 if ((handleIdx < (this.handles.length-1)) && (sliderValue>this.values[handleIdx+1])) 10342 sliderValue = this.values[handleIdx+1]; 10343 } 10344 sliderValue = this.getNearestValue(sliderValue); 10345 this.values[handleIdx] = sliderValue; 10346 this.value = this.values[0]; // assure backwards compat 10347 10348 this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = 10349 this.translateToPx(sliderValue); 10350 10351 this.drawSpans(); 10352 if (!this.dragging || !this.event) this.updateFinished(); 10353 }, 10354 setValueBy: function(delta, handleIdx) { 10355 this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, 10356 handleIdx || this.activeHandleIdx || 0); 10357 }, 10358 translateToPx: function(value) { 10359 return Math.round( 10360 ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * 10361 (value - this.range.start)) + "px"; 10362 }, 10363 translateToValue: function(offset) { 10364 return ((offset/(this.trackLength-this.handleLength) * 10365 (this.range.end-this.range.start)) + this.range.start); 10366 }, 10367 getRange: function(range) { 10368 var v = this.values.sortBy(Prototype.K); 10369 range = range || 0; 10370 return $R(v[range],v[range+1]); 10371 }, 10372 minimumOffset: function(){ 10373 return(this.isVertical() ? this.alignY : this.alignX); 10374 }, 10375 maximumOffset: function(){ 10376 return(this.isVertical() ? 10377 (this.track.offsetHeight != 0 ? this.track.offsetHeight : 10378 this.track.style.height.replace(/px$/,"")) - this.alignY : 10379 (this.track.offsetWidth != 0 ? this.track.offsetWidth : 10380 this.track.style.width.replace(/px$/,"")) - this.alignX); 10381 }, 10382 isVertical: function(){ 10383 return (this.axis == 'vertical'); 10384 }, 10385 drawSpans: function() { 10386 var slider = this; 10387 if (this.spans) 10388 $R(0, this.spans.length-1).each(function(r) { slider.setSpan(slider.spans[r], slider.getRange(r)) }); 10389 if (this.options.startSpan) 10390 this.setSpan(this.options.startSpan, 10391 $R(0, this.values.length>1 ? this.getRange(0).min() : this.value )); 10392 if (this.options.endSpan) 10393 this.setSpan(this.options.endSpan, 10394 $R(this.values.length>1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum)); 10395 }, 10396 setSpan: function(span, range) { 10397 if (this.isVertical()) { 10398 span.style.top = this.translateToPx(range.start); 10399 span.style.height = this.translateToPx(range.end - range.start + this.range.start); 10400 } else { 10401 span.style.left = this.translateToPx(range.start); 10402 span.style.width = this.translateToPx(range.end - range.start + this.range.start); 10403 } 10404 }, 10405 updateStyles: function() { 10406 this.handles.each( function(h){ Element.removeClassName(h, 'selected') }); 10407 Element.addClassName(this.activeHandle, 'selected'); 10408 }, 10409 startDrag: function(event) { 10410 if (Event.isLeftClick(event)) { 10411 if (!this.disabled){ 10412 this.active = true; 10413 10414 var handle = Event.element(event); 10415 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 10416 var track = handle; 10417 if (track==this.track) { 10418 var offsets = Position.cumulativeOffset(this.track); 10419 this.event = event; 10420 this.setValue(this.translateToValue( 10421 (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) 10422 )); 10423 var offsets = Position.cumulativeOffset(this.activeHandle); 10424 this.offsetX = (pointer[0] - offsets[0]); 10425 this.offsetY = (pointer[1] - offsets[1]); 10426 } else { 10427 // find the handle (prevents issues with Safari) 10428 while((this.handles.indexOf(handle) == -1) && handle.parentNode) 10429 handle = handle.parentNode; 10430 10431 if (this.handles.indexOf(handle)!=-1) { 10432 this.activeHandle = handle; 10433 this.activeHandleIdx = this.handles.indexOf(this.activeHandle); 10434 this.updateStyles(); 10435 10436 var offsets = Position.cumulativeOffset(this.activeHandle); 10437 this.offsetX = (pointer[0] - offsets[0]); 10438 this.offsetY = (pointer[1] - offsets[1]); 10439 } 10440 } 10441 } 10442 Event.stop(event); 10443 } 10444 }, 10445 update: function(event) { 10446 if (this.active) { 10447 if (!this.dragging) this.dragging = true; 10448 this.draw(event); 10449 if (Prototype.Browser.WebKit) window.scrollBy(0,0); 10450 Event.stop(event); 10451 } 10452 }, 10453 draw: function(event) { 10454 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 10455 var offsets = Position.cumulativeOffset(this.track); 10456 pointer[0] -= this.offsetX + offsets[0]; 10457 pointer[1] -= this.offsetY + offsets[1]; 10458 this.event = event; 10459 this.setValue(this.translateToValue( this.isVertical() ? pointer[1] : pointer[0] )); 10460 if (this.initialized && this.options.onSlide) 10461 this.options.onSlide(this.values.length>1 ? this.values : this.value, this); 10462 }, 10463 endDrag: function(event) { 10464 if (this.active && this.dragging) { 10465 this.finishDrag(event, true); 10466 Event.stop(event); 10467 } 10468 this.active = false;
10469 this.dragging = false; 10470 }, 10471 finishDrag: function(event, success) { 10472 this.active = false; 10473 this.dragging = false; 10474 this.updateFinished(); 10475 }, 10476 updateFinished: function() { 10477 if (this.initialized && this.options.onChange) 10478 this.options.onChange(this.values.length>1 ? this.values : this.value, this); 10479 this.event = null; 10480 } 10481}); 10482/** 10483 * Magento 10484 * 10485 * NOTICE OF LICENSE 10486 * 10487 * This source file is subject to the Academic Free License (AFL 3.0) 10488 * that is bundled with this package in the file LICENSE_AFL.txt. 10489 * It is also available through the world-wide-web at this URL: 10490 * http://opensource.org/licenses/afl-3.0.php 10491 * If you did not receive a copy of the license and are unable to 10492 * obtain it through the world-wide-web, please send an email 10493 * to [email protected] so we can send you a copy immediately. 10494 * 10495 * DISCLAIMER 10496 * 10497 * Do not edit or add to this file if you wish to upgrade Magento to newer 10498 * versions in the future. If you wish to customize Magento for your 10499 * needs please refer to http://www.magento.com for more information. 10500 * 10501 * @category Varien 10502 * @package js 10503 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 10504 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 10505 */ 10506function popWin(url,win,para) { 10507 var win = window.open(url,win,para); 10508 win.focus(); 10509} 10510 10511function setLocation(url){ 10512 window.location.href = url; 10513} 10514 10515function setPLocation(url, setFocus){ 10516 if( setFocus ) { 10517 window.opener.focus(); 10518 } 10519 window.opener.location.href = url; 10520} 10521 10522function setLanguageCode(code, fromCode){ 10523 //TODO: javascript cookies have different domain and path than php cookies 10524 var href = window.location.href; 10525 var after = '', dash; 10526 if (dash = href.match(/\#(.*)$/)) { 10527 href = href.replace(/\#(.*)$/, ''); 10528 after = dash[0]; 10529 } 10530 10531 if (href.match(/[?]/)) { 10532 var re = /([?&]store=)[a-z0-9_]*/; 10533 if (href.match(re)) { 10534 href = href.replace(re, '$1'+code); 10535 } else { 10536 href += '&store='+code; 10537 } 10538 10539 var re = /([?&]from_store=)[a-z0-9_]*/; 10540 if (href.match(re)) { 10541 href = href.replace(re, ''); 10542 } 10543 } else { 10544 href += '?store='+code; 10545 } 10546 if (typeof(fromCode) != 'undefined') { 10547 href += '&from_store='+fromCode; 10548 } 10549 href += after; 10550 10551 setLocation(href); 10552} 10553 10554/** 10555 * Add classes to specified elements. 10556 * Supported classes are: 'odd', 'even', 'first', 'last' 10557 * 10558 * @param elements - array of elements to be decorated 10559 * [@param decorateParams] - array of classes to be set. If omitted, all available will be used 10560 */ 10561function decorateGeneric(elements, decorateParams) 10562{ 10563 var allSupportedParams = ['odd', 'even', 'first', 'last']; 10564 var _decorateParams = {}; 10565 var total = elements.length; 10566 10567 if (total) { 10568 // determine params called 10569 if (typeof(decorateParams) == 'undefined') { 10570 decorateParams = allSupportedParams; 10571 } 10572 if (!decorateParams.length) { 10573 return; 10574 } 10575 for (var k in allSupportedParams) { 10576 _decorateParams[allSupportedParams[k]] = false; 10577 } 10578 for (var k in decorateParams) { 10579 _decorateParams[decorateParams[k]] = true; 10580 } 10581 10582 // decorate elements 10583 // elements[0].addClassName('first'); // will cause bug in IE (#5587) 10584 if (_decorateParams.first) { 10585 Element.addClassName(elements[0], 'first'); 10586 } 10587 if (_decorateParams.last) { 10588 Element.addClassName(elements[total-1], 'last'); 10589 } 10590 for (var i = 0; i < total; i++) { 10591 if ((i + 1) % 2 == 0) { 10592 if (_decorateParams.even) { 10593 Element.addClassName(elements[i], 'even'); 10594 } 10595 } 10596 else { 10597 if (_decorateParams.odd) { 10598 Element.addClassName(elements[i], 'odd'); 10599 } 10600 } 10601 } 10602 } 10603} 10604 10605/** 10606 * Decorate table rows and cells, tbody etc 10607 * @see decorateGeneric() 10608 */ 10609function decorateTable(table, options) { 10610 var table = $(table); 10611 if (table) { 10612 // set default options 10613 var _options = { 10614 'tbody' : false, 10615 'tbody tr' : ['odd', 'even', 'first', 'last'], 10616 'thead tr' : ['first', 'last'], 10617 'tfoot tr' : ['first', 'last'], 10618 'tr td' : ['last'] 10619 }; 10620 // overload options 10621 if (typeof(options) != 'undefined') { 10622 for (var k in options) { 10623 _options[k] = options[k]; 10624 } 10625 } 10626 // decorate 10627 if (_options['tbody']) { 10628 decorateGeneric(table.select('tbody'), _options['tbody']); 10629 } 10630 if (_options['tbody tr']) { 10631 decorateGeneric(table.select('tbody tr'), _options['tbody tr']); 10632 } 10633 if (_options['thead tr']) { 10634 decorateGeneric(table.select('thead tr'), _options['thead tr']); 10635 } 10636 if (_options['tfoot tr']) { 10637 decorateGeneric(table.select('tfoot tr'), _options['tfoot tr']); 10638 } 10639 if (_options['tr td']) { 10640 var allRows = table.select('tr'); 10641 if (allRows.length) { 10642 for (var i = 0; i < allRows.length; i++) { 10643 decorateGeneric(allRows[i].getElementsByTagName('TD'), _options['tr td']); 10644 } 10645 } 10646 } 10647 } 10648} 10649 10650/** 10651 * Set "odd", "even" and "last" CSS classes for list items 10652 * @see decorateGeneric() 10653 */ 10654function decorateList(list, nonRecursive) { 10655 if ($(list)) { 10656 if (typeof(nonRecursive) == 'undefined') { 10657 var items = $(list).select('li') 10658 } 10659 else { 10660 var items = $(list).childElements(); 10661 } 10662 decorateGeneric(items, ['odd', 'even', 'last']); 10663 } 10664} 10665 10666/** 10667 * Set "odd", "even" and "last" CSS classes for list items 10668 * @see decorateGeneric() 10669 */ 10670function decorateDataList(list) { 10671 list = $(list); 10672 if (list) { 10673 decorateGeneric(list.select('dt'), ['odd', 'even', 'last']); 10674 decorateGeneric(list.select('dd'), ['odd', 'even', 'last']); 10675 } 10676} 10677 10678/** 10679 * Parse SID and produces the correct URL 10680 */ 10681function parseSidUrl(baseUrl, urlExt) { 10682 var sidPos = baseUrl.indexOf('/?SID='); 10683 var sid = ''; 10684 urlExt = (urlExt != undefined) ? urlExt : ''; 10685 10686 if(sidPos > -1) { 10687 sid = '?' + baseUrl.substring(sidPos + 2); 10688 baseUrl = baseUrl.substring(0, sidPos + 1); 10689 } 10690 10691 return baseUrl+urlExt+sid; 10692} 10693 10694/** 10695 * Formats currency using patern 10696 * format - JSON (pattern, decimal, decimalsDelimeter, groupsDelimeter) 10697 * showPlus - true (always show '+'or '-'), 10698 * false (never show '-' even if number is negative) 10699 * null (show '-' if number is negative) 10700 */ 10701 10702function formatCurrency(price, format, showPlus){ 10703 var precision = isNaN(format.precision = Math.abs(format.precision)) ? 2 : format.precision; 10704 var requiredPrecision = isNaN(format.requiredPrecision = Math.abs(format.requiredPrecision)) ? 2 : format.requiredPrecision; 10705 10706 //precision = (precision > requiredPrecision) ? precision : requiredPrecision; 10707 //for now we don't need this difference so precision is requiredPrecision 10708 precision = requiredPrecision; 10709 10710 var integerRequired = isNaN(format.integerRequired = Math.abs(format.integerRequired)) ? 1 : format.integerRequired; 10711 10712 var decimalSymbol = format.decimalSymbol == undefined ? "," : format.decimalSymbol; 10713 var groupSymbol = format.groupSymbol == undefined ? "." : format.groupSymbol; 10714 var groupLength = format.groupLength == undefined ? 3 : format.groupLength; 10715 10716 var s = ''; 10717 10718 if (showPlus == undefined || showPlus == true) { 10719 s = price < 0 ? "-" : ( showPlus ? "+" : ""); 10720 } else if (showPlus == false) { 10721 s = ''; 10722 } 10723 10724 var i = parseInt(price = Math.abs(+price || 0).toFixed(precision)) + ""; 10725 var pad = (i.length < integerRequired) ? (integerRequired - i.length) : 0; 10726 while (pad) { i = '0' + i; pad--; } 10727 j = (j = i.length) > groupLength ? j % groupLength : 0; 10728 re = new RegExp("(\\d{" + groupLength + "})(?=\\d)", "g"); 10729 10730 /** 10731 * replace(/-/, 0) is only for fixing Safari bug which appears 10732 * when Math.abs(0).toFixed() executed on "0" number. 10733 * Result is "0.-0" :( 10734 */ 10735 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) : "") 10736 var pattern = ''; 10737 if (format.pattern.indexOf('{sign}') == -1) { 10738 pattern = s + format.pattern; 10739 } else { 10740 pattern = format.pattern.replace('{sign}', s); 10741 } 10742 10743 return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, ''); 10744}; 10745 10746function expandDetails(el, childClass) {
10747 if (Element.hasClassName(el,'show-details')) { 10748 $$(childClass).each(function(item){item.hide()}); 10749 Element.removeClassName(el,'show-details'); 10750 } 10751 else { 10752 $$(childClass).each(function(item){item.show()}); 10753 Element.addClassName(el,'show-details'); 10754 } 10755} 10756 10757// Version 1.0 10758var isIE = navigator.appVersion.match(/MSIE/) == "MSIE"; 10759 10760if (!window.Varien) 10761 var Varien = new Object(); 10762 10763Varien.showLoading = function(){ 10764 var loader = $('loading-process'); 10765 loader && loader.show(); 10766} 10767Varien.hideLoading = function(){ 10768 var loader = $('loading-process'); 10769 loader && loader.hide(); 10770} 10771Varien.GlobalHandlers = { 10772 onCreate: function() { 10773 Varien.showLoading(); 10774 }, 10775 10776 onComplete: function() { 10777 if(Ajax.activeRequestCount == 0) { 10778 Varien.hideLoading(); 10779 } 10780 } 10781}; 10782 10783Ajax.Responders.register(Varien.GlobalHandlers); 10784 10785/** 10786 * Quick Search form client model 10787 */ 10788Varien.searchForm = Class.create(); 10789Varien.searchForm.prototype = { 10790 initialize : function(form, field, emptyText){ 10791 this.form = $(form); 10792 this.field = $(field); 10793 this.emptyText = emptyText; 10794 10795 Event.observe(this.form, 'submit', this.submit.bind(this)); 10796 Event.observe(this.field, 'focus', this.focus.bind(this)); 10797 Event.observe(this.field, 'blur', this.blur.bind(this)); 10798 this.blur(); 10799 }, 10800 10801 submit : function(event){ 10802 if (this.field.value == this.emptyText || this.field.value == ''){ 10803 Event.stop(event); 10804 return false; 10805 } 10806 return true; 10807 }, 10808 10809 focus : function(event){ 10810 if(this.field.value==this.emptyText){ 10811 this.field.value=''; 10812 } 10813 10814 }, 10815 10816 blur : function(event){ 10817 if(this.field.value==''){ 10818 this.field.value=this.emptyText; 10819 } 10820 }, 10821 10822 initAutocomplete : function(url, destinationElement){ 10823 new Ajax.Autocompleter( 10824 this.field, 10825 destinationElement, 10826 url, 10827 { 10828 paramName: this.field.name, 10829 method: 'get', 10830 minChars: 2, 10831 updateElement: this._selectAutocompleteItem.bind(this), 10832 onShow : function(element, update) { 10833 if(!update.style.position || update.style.position=='absolute') { 10834 update.style.position = 'absolute'; 10835 Position.clone(element, update, { 10836 setHeight: false, 10837 offsetTop: element.offsetHeight 10838 }); 10839 }
10840 Effect.Appear(update,{duration:0}); 10841 } 10842 10843 } 10844 ); 10845 }, 10846 10847 _selectAutocompleteItem : function(element){ 10848 if(element.title){ 10849 this.field.value = element.title; 10850 } 10851 this.form.submit(); 10852 } 10853} 10854 10855Varien.Tabs = Class.create(); 10856Varien.Tabs.prototype = { 10857 initialize: function(selector) { 10858 var self=this; 10859 $$(selector+' a').each(this.initTab.bind(this)); 10860 }, 10861 10862 initTab: function(el) { 10863 el.href = 'javascript:void(0)'; 10864 if ($(el.parentNode).hasClassName('active')) { 10865 this.showContent(el); 10866 } 10867 el.observe('click', this.showContent.bind(this, el)); 10868 }, 10869 10870 showContent: function(a) { 10871 var li = $(a.parentNode), ul = $(li.parentNode); 10872 ul.getElementsBySelector('li', 'ol').each(function(el){ 10873 var contents = $(el.id+'_contents'); 10874 if (el==li) { 10875 el.addClassName('active'); 10876 contents.show(); 10877 } else { 10878 el.removeClassName('active'); 10879 contents.hide(); 10880 } 10881 }); 10882 } 10883} 10884 10885Varien.DateElement = Class.create(); 10886Varien.DateElement.prototype = { 10887 initialize: function(type, content, required, format) { 10888 if (type == 'id') { 10889 // id prefix 10890 this.day = $(content + 'day'); 10891 this.month = $(content + 'month'); 10892 this.year = $(content + 'year'); 10893 this.full = $(content + 'full'); 10894 this.advice = $(content + 'date-advice'); 10895 } else if (type == 'container') { 10896 // content must be container with data 10897 this.day = content.day; 10898 this.month = content.month; 10899 this.year = content.year; 10900 this.full = content.full; 10901 this.advice = content.advice; 10902 } else { 10903 return; 10904 } 10905 10906 this.required = required; 10907 this.format = format; 10908 10909 this.day.addClassName('validate-custom'); 10910 this.day.validate = this.validate.bind(this); 10911 this.month.addClassName('validate-custom'); 10912 this.month.validate = this.validate.bind(this); 10913 this.year.addClassName('validate-custom'); 10914 this.year.validate = this.validate.bind(this); 10915 10916 this.setDateRange(false, false); 10917 this.year.setAttribute('autocomplete','off'); 10918 10919 this.advice.hide(); 10920 }, 10921 validate: function() { 10922 var error = false, 10923 day = parseInt(this.day.value, 10) || 0, 10924 month = parseInt(this.month.value, 10) || 0, 10925 year = parseInt(this.year.value, 10) || 0; 10926 if (this.day.value.strip().empty() 10927 && this.month.value.strip().empty() 10928 && this.year.value.strip().empty() 10929 ) { 10930 if (this.required) { 10931 error = 'This date is a required value.'; 10932 } else { 10933 this.full.value = ''; 10934 } 10935 } else if (!day || !month || !year) { 10936 error = 'Please enter a valid full date.'; 10937 } else { 10938 var date = new Date, countDaysInMonth = 0, errorType = null; 10939 date.setYear(year);date.setMonth(month-1);date.setDate(32); 10940 countDaysInMonth = 32 - date.getDate(); 10941 if(!countDaysInMonth || countDaysInMonth>31) countDaysInMonth = 31; 10942 10943 if (day<1 || day>countDaysInMonth) { 10944 errorType = 'day'; 10945 error = 'Please enter a valid day (1-%d).'; 10946 } else if (month<1 || month>12) { 10947 errorType = 'month'; 10948 error = 'Please enter a valid month (1-12).'; 10949 } else { 10950 if(day % 10 == day) this.day.value = '0'+day; 10951 if(month % 10 == month) this.month.value = '0'+month; 10952 this.full.value = this.format.replace(/%[mb]/i, this.month.value).replace(/%[de]/i, this.day.value).replace(/%y/i, this.year.value); 10953 var testFull = this.month.value + '/' + this.day.value + '/'+ this.year.value; 10954 var test = new Date(testFull); 10955 if (isNaN(test)) { 10956 error = 'Please enter a valid date.'; 10957 } else { 10958 this.setFullDate(test); 10959 } 10960 } 10961 var valueError = false;
10962 if (!error && !this.validateData()){//(year<1900 || year>curyear) { 10963 errorType = this.validateDataErrorType;//'year'; 10964 valueError = this.validateDataErrorText;//'Please enter a valid year (1900-%d).'; 10965 error = valueError; 10966 } 10967 } 10968 10969 if (error !== false) { 10970 try { 10971 error = Translator.translate(error); 10972 } 10973 catch (e) {} 10974 if (!valueError) { 10975 this.advice.innerHTML = error.replace('%d', countDaysInMonth); 10976 } else { 10977 this.advice.innerHTML = this.errorTextModifier(error); 10978 } 10979 this.advice.show(); 10980 return false; 10981 } 10982 10983 // fixing elements class 10984 this.day.removeClassName('validation-failed'); 10985 this.month.removeClassName('validation-failed'); 10986 this.year.removeClassName('validation-failed'); 10987 10988 this.advice.hide(); 10989 return true; 10990 }, 10991 validateData: function() { 10992 var year = this.fullDate.getFullYear(); 10993 var date = new Date; 10994 this.curyear = date.getFullYear(); 10995 return (year>=1900 && year<=this.curyear); 10996 }, 10997 validateDataErrorType: 'year', 10998 validateDataErrorText: 'Please enter a valid year (1900-%d).', 10999 errorTextModifier: function(text) { 11000 return text.replace('%d', this.curyear); 11001 }, 11002 setDateRange: function(minDate, maxDate) { 11003 this.minDate = minDate; 11004 this.maxDate = maxDate; 11005 }, 11006 setFullDate: function(date) { 11007 this.fullDate = date; 11008 } 11009}; 11010 11011Varien.DOB = Class.create(); 11012Varien.DOB.prototype = { 11013 initialize: function(selector, required, format) { 11014 var el = $$(selector)[0]; 11015 var container = {}; 11016 container.day = Element.select(el, '.dob-day input')[0]; 11017 container.month = Element.select(el, '.dob-month input')[0]; 11018 container.year = Element.select(el, '.dob-year input')[0]; 11019 container.full = Element.select(el, '.dob-full input')[0]; 11020 container.advice = Element.select(el, '.validation-advice')[0]; 11021 11022 new Varien.DateElement('container', container, required, format); 11023 } 11024}; 11025 11026Varien.dateRangeDate = Class.create(); 11027Varien.dateRangeDate.prototype = Object.extend(new Varien.DateElement(), { 11028 validateData: function() { 11029 var validate = true; 11030 if (this.minDate || this.maxValue) { 11031 if (this.minDate) { 11032 this.minDate = new Date(this.minDate); 11033 this.minDate.setHours(0); 11034 if (isNaN(this.minDate)) { 11035 this.minDate = new Date('1/1/1900'); 11036 } 11037 validate = validate && (this.fullDate >= this.minDate) 11038 } 11039 if (this.maxDate) { 11040 this.maxDate = new Date(this.maxDate) 11041 this.minDate.setHours(0); 11042 if (isNaN(this.maxDate)) { 11043 this.maxDate = new Date(); 11044 } 11045 validate = validate && (this.fullDate <= this.maxDate) 11046 } 11047 if (this.maxDate && this.minDate) { 11048 this.validateDataErrorText = 'Please enter a valid date between %s and %s'; 11049 } else if (this.maxDate) { 11050 this.validateDataErrorText = 'Please enter a valid date less than or equal to %s'; 11051 } else if (this.minDate) { 11052 this.validateDataErrorText = 'Please enter a valid date equal to or greater than %s'; 11053 } else { 11054 this.validateDataErrorText = ''; 11055 } 11056 } 11057 return validate; 11058 }, 11059 validateDataErrorText: 'Date should be between %s and %s', 11060 errorTextModifier: function(text) { 11061 if (this.minDate) { 11062 text = text.sub('%s', this.dateFormat(this.minDate)); 11063 } 11064 if (this.maxDate) { 11065 text = text.sub('%s', this.dateFormat(this.maxDate)); 11066 } 11067 return text; 11068 }, 11069 dateFormat: function(date) { 11070 return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear(); 11071 } 11072}); 11073 11074Varien.FileElement = Class.create(); 11075Varien.FileElement.prototype = { 11076 initialize: function (id) { 11077 this.fileElement = $(id); 11078 this.hiddenElement = $(id + '_value'); 11079 11080 this.fileElement.observe('change', this.selectFile.bind(this)); 11081 }, 11082 selectFile: function(event) { 11083 this.hiddenElement.value = this.fileElement.getValue(); 11084 } 11085}; 11086 11087Validation.addAllThese([ 11088 ['validate-custom', ' ', function(v,elm) { 11089 return elm.validate(); 11090 }] 11091]); 11092 11093function truncateOptions() { 11094 $$('.truncated').each(function(element){ 11095 Event.observe(element, 'mouseover', function(){ 11096 if (element.down('div.truncated_full_value')) { 11097 element.down('div.truncated_full_value').addClassName('show') 11098 } 11099 }); 11100 Event.observe(element, 'mouseout', function(){ 11101 if (element.down('div.truncated_full_value')) { 11102 element.down('div.truncated_full_value').removeClassName('show') 11103 } 11104 }); 11105 11106 }); 11107} 11108Event.observe(window, 'load', function(){ 11109 truncateOptions(); 11110}); 11111 11112Element.addMethods({ 11113 getInnerText: function(element) 11114 { 11115 element = $(element); 11116 if(element.innerText && !Prototype.Browser.Opera) { 11117 return element.innerText 11118 } 11119 return element.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g, ' ').strip(); 11120 } 11121}); 11122 11123/* 11124if (!("console" in window) || !("firebug" in console)) 11125{ 11126 var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", 11127 "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; 11128 11129 window.console = {}; 11130 for (var i = 0; i < names.length; ++i) 11131 window.console[names[i]] = function() {} 11132} 11133*/ 11134 11135/** 11136 * Executes event handler on the element. Works with event handlers attached by Prototype, 11137 * in a browser-agnostic fashion. 11138 * @param element The element object 11139 * @param event Event name, like 'change' 11140 * 11141 * @example fireEvent($('my-input', 'click')); 11142 */ 11143function fireEvent(element, event) { 11144 if (document.createEvent) { 11145 // dispatch for all browsers except IE before version 9 11146 var evt = document.createEvent("HTMLEvents"); 11147 evt.initEvent(event, true, true ); // event type, bubbling, cancelable 11148 return element.dispatchEvent(evt); 11149 } else { 11150 // dispatch for IE before version 9 11151 var evt = document.createEventObject(); 11152 return element.fireEvent('on' + event, evt) 11153 } 11154} 11155 11156/** 11157 * Returns more accurate results of floating-point modulo division 11158 * E.g.: 11159 * 0.6 % 0.2 = 0.19999999999999996 11160 * modulo(0.6, 0.2) = 0 11161 * 11162 * @param dividend 11163 * @param divisor 11164 */ 11165function modulo(dividend, divisor) 11166{ 11167 var epsilon = divisor / 10000; 11168 var remainder = dividend % divisor; 11169 11170 if (Math.abs(remainder - divisor) < epsilon || Math.abs(remainder) < epsilon) { 11171 remainder = 0; 11172 } 11173 11174 return remainder; 11175} 11176 11177/** 11178 * createContextualFragment is not supported in IE9. Adding its support. 11179 */ 11180if ((typeof Range != "undefined") && !Range.prototype.createContextualFragment) 11181{ 11182 Range.prototype.createContextualFragment = function(html) 11183 { 11184 var frag = document.createDocumentFragment(), 11185 div = document.createElement("div"); 11186 frag.appendChild(div); 11187 div.outerHTML = html; 11188 return frag; 11189 }; 11190} 11191/** 11192 * Magento 11193 * 11194 * NOTICE OF LICENSE 11195 * 11196 * This source file is subject to the Academic Free License (AFL 3.0)
11197 * that is bundled with this package in the file LICENSE_AFL.txt. 11198 * It is also available through the world-wide-web at this URL: 11199 * http://opensource.org/licenses/afl-3.0.php 11200 * If you did not receive a copy of the license and are unable to 11201 * obtain it through the world-wide-web, please send an email 11202 * to [email protected] so we can send you a copy immediately. 11203 * 11204 * DISCLAIMER 11205 * 11206 * Do not edit or add to this file if you wish to upgrade Magento to newer 11207 * versions in the future. If you wish to customize Magento for your 11208 * needs please refer to http://www.magento.com for more information. 11209 * 11210 * @category Varien 11211 * @package js 11212 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 11213 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11214 */ 11215VarienForm = Class.create(); 11216VarienForm.prototype = { 11217 initialize: function(formId, firstFieldFocus){ 11218 this.form = $(formId); 11219 if (!this.form) { 11220 return; 11221 } 11222 this.cache = $A(); 11223 this.currLoader = false;
11224 this.currDataIndex = false; 11225 this.validator = new Validation(this.form); 11226 this.elementFocus = this.elementOnFocus.bindAsEventListener(this); 11227 this.elementBlur = this.elementOnBlur.bindAsEventListener(this); 11228 this.childLoader = this.onChangeChildLoad.bindAsEventListener(this); 11229 this.highlightClass = 'highlight'; 11230 this.extraChildParams = ''; 11231 this.firstFieldFocus= firstFieldFocus || false; 11232 this.bindElements(); 11233 if(this.firstFieldFocus){ 11234 try{ 11235 Form.Element.focus(Form.findFirstElement(this.form)) 11236 } 11237 catch(e){} 11238 } 11239 }, 11240 11241 submit : function(url){ 11242 if(this.validator && this.validator.validate()){ 11243 this.form.submit(); 11244 } 11245 return false; 11246 }, 11247 11248 bindElements:function (){ 11249 var elements = Form.getElements(this.form); 11250 for (var row in elements) { 11251 if (elements[row].id) { 11252 Event.observe(elements[row],'focus',this.elementFocus); 11253 Event.observe(elements[row],'blur',this.elementBlur); 11254 } 11255 } 11256 }, 11257 11258 elementOnFocus: function(event){ 11259 var element = Event.findElement(event, 'fieldset'); 11260 if(element){ 11261 Element.addClassName(element, this.highlightClass); 11262 } 11263 }, 11264 11265 elementOnBlur: function(event){ 11266 var element = Event.findElement(event, 'fieldset'); 11267 if(element){ 11268 Element.removeClassName(element, this.highlightClass); 11269 } 11270 }, 11271 11272 setElementsRelation: function(parent, child, dataUrl, first){ 11273 if (parent=$(parent)) { 11274 // TODO: array of relation and caching 11275 if (!this.cache[parent.id]){ 11276 this.cache[parent.id] = $A(); 11277 this.cache[parent.id]['child'] = child; 11278 this.cache[parent.id]['dataUrl'] = dataUrl; 11279 this.cache[parent.id]['data'] = $A(); 11280 this.cache[parent.id]['first'] = first || false; 11281 } 11282 Event.observe(parent,'change',this.childLoader); 11283 } 11284 }, 11285 11286 onChangeChildLoad: function(event){ 11287 element = Event.element(event); 11288 this.elementChildLoad(element); 11289 }, 11290 11291 elementChildLoad: function(element, callback){ 11292 this.callback = callback || false; 11293 if (element.value) { 11294 this.currLoader = element.id; 11295 this.currDataIndex = element.value; 11296 if (this.cache[element.id]['data'][element.value]) { 11297 this.setDataToChild(this.cache[element.id]['data'][element.value]); 11298 } 11299 else{ 11300 new Ajax.Request(this.cache[this.currLoader]['dataUrl'],{ 11301 method: 'post', 11302 parameters: {"parent":element.value}, 11303 onComplete: this.reloadChildren.bind(this) 11304 }); 11305 } 11306 } 11307 }, 11308 11309 reloadChildren: function(transport){ 11310 var data = eval('(' + transport.responseText + ')'); 11311 this.cache[this.currLoader]['data'][this.currDataIndex] = data; 11312 this.setDataToChild(data); 11313 }, 11314 11315 setDataToChild: function(data){ 11316 if (data.length) { 11317 var child = $(this.cache[this.currLoader]['child']); 11318 if (child){ 11319 var html = '<select name="'+child.name+'" id="'+child.id+'" class="'+child.className+'" title="'+child.title+'" '+this.extraChildParams+'>'; 11320 if(this.cache[this.currLoader]['first']){ 11321 html+= '<option value="">'+this.cache[this.currLoader]['first']+'</option>'; 11322 } 11323 for (var i in data){ 11324 if(data[i].value) { 11325 html+= '<option value="'+data[i].value+'"'; 11326 if(child.value && (child.value == data[i].value || child.value == data[i].label)){ 11327 html+= ' selected'; 11328 } 11329 html+='>'+data[i].label+'</option>'; 11330 } 11331 } 11332 html+= '</select>'; 11333 Element.insert(child, {before: html}); 11334 Element.remove(child); 11335 } 11336 } 11337 else{ 11338 var child = $(this.cache[this.currLoader]['child']); 11339 if (child){ 11340 var html = '<input type="text" name="'+child.name+'" id="'+child.id+'" class="'+child.className+'" title="'+child.title+'" '+this.extraChildParams+'>'; 11341 Element.insert(child, {before: html}); 11342 Element.remove(child); 11343 } 11344 } 11345 11346 this.bindElements(); 11347 if (this.callback) { 11348 this.callback(); 11349 } 11350 } 11351} 11352 11353RegionUpdater = Class.create(); 11354RegionUpdater.prototype = { 11355 initialize: function (countryEl, regionTextEl, regionSelectEl, regions, disableAction, zipEl) 11356 { 11357 this.countryEl = $(countryEl); 11358 this.regionTextEl = $(regionTextEl); 11359 this.regionSelectEl = $(regionSelectEl); 11360 this.zipEl = $(zipEl); 11361 this.config = regions['config']; 11362 delete regions.config; 11363 this.regions = regions; 11364 11365 this.disableAction = (typeof disableAction=='undefined') ? 'hide' : disableAction; 11366 this.zipOptions = (typeof zipOptions=='undefined') ? false : zipOptions; 11367 11368 if (this.regionSelectEl.options.length<=1) { 11369 this.update(); 11370 } 11371 11372 Event.observe(this.countryEl, 'change', this.update.bind(this)); 11373 }, 11374
11375 _checkRegionRequired: function() 11376 { 11377 var label, wildCard; 11378 var elements = [this.regionTextEl, this.regionSelectEl]; 11379 var that = this; 11380 if (typeof this.config == 'undefined') { 11381 return; 11382 } 11383 var regionRequired = this.config.regions_required.indexOf(this.countryEl.value) >= 0; 11384 11385 elements.each(function(currentElement) { 11386 Validation.reset(currentElement); 11387 label = $$('label[for="' + currentElement.id + '"]')[0]; 11388 if (label) { 11389 wildCard = label.down('em') || label.down('span.required'); 11390 if (!that.config.show_all_regions) { 11391 if (regionRequired) { 11392 label.up().show(); 11393 } else { 11394 label.up().hide(); 11395 } 11396 } 11397 } 11398 11399 if (label && wildCard) { 11400 if (!regionRequired) { 11401 wildCard.hide(); 11402 if (label.hasClassName('required')) { 11403 label.removeClassName('required'); 11404 } 11405 } else if (regionRequired) { 11406 wildCard.show(); 11407 if (!label.hasClassName('required')) { 11408 label.addClassName('required') 11409 } 11410 } 11411 } 11412 11413 if (!regionRequired) { 11414 if (currentElement.hasClassName('required-entry')) { 11415 currentElement.removeClassName('required-entry'); 11416 } 11417 if ('select' == currentElement.tagName.toLowerCase() && 11418 currentElement.hasClassName('validate-select')) { 11419 currentElement.removeClassName('validate-select'); 11420 } 11421 } else { 11422 if (!currentElement.hasClassName('required-entry')) { 11423 currentElement.addClassName('required-entry'); 11424 } 11425 if ('select' == currentElement.tagName.toLowerCase() && 11426 !currentElement.hasClassName('validate-select')) { 11427 currentElement.addClassName('validate-select'); 11428 } 11429 } 11430 }); 11431 }, 11432 11433 update: function() 11434 { 11435 if (this.regions[this.countryEl.value]) { 11436 var i, option, region, def; 11437 11438 def = this.regionSelectEl.getAttribute('defaultValue'); 11439 if (this.regionTextEl) { 11440 if (!def) { 11441 def = this.regionTextEl.value.toLowerCase(); 11442 } 11443 this.regionTextEl.value = ''; 11444 } 11445 11446 this.regionSelectEl.options.length = 1; 11447 for (regionId in this.regions[this.countryEl.value]) { 11448 region = this.regions[this.countryEl.value][regionId]; 11449 11450 option = document.createElement('OPTION'); 11451 option.value = regionId; 11452 option.text = region.name.stripTags(); 11453 option.title = region.name; 11454 11455 if (this.regionSelectEl.options.add) { 11456 this.regionSelectEl.options.add(option); 11457 } else { 11458 this.regionSelectEl.appendChild(option); 11459 } 11460 11461 if (regionId == def || (region.name && region.name.toLowerCase() == def) 11462 || (region.name && region.code.toLowerCase() == def) 11463 ) { 11464 this.regionSelectEl.value = regionId; 11465 } 11466 } 11467 this.sortSelect(); 11468 if (this.disableAction == 'hide') { 11469 if (this.regionTextEl) { 11470 this.regionTextEl.style.display = 'none'; 11471 } 11472 11473 this.regionSelectEl.style.display = ''; 11474 } else if (this.disableAction == 'disable') { 11475 if (this.regionTextEl) { 11476 this.regionTextEl.disabled = true; 11477 } 11478 this.regionSelectEl.disabled = false; 11479 } 11480 this.setMarkDisplay(this.regionSelectEl, true); 11481 } else { 11482 this.regionSelectEl.options.length = 1; 11483 this.sortSelect(); 11484 if (this.disableAction == 'hide') { 11485 if (this.regionTextEl) { 11486 this.regionTextEl.style.display = ''; 11487 } 11488 this.regionSelectEl.style.display = 'none'; 11489 Validation.reset(this.regionSelectEl); 11490 } else if (this.disableAction == 'disable') { 11491 if (this.regionTextEl) { 11492 this.regionTextEl.disabled = false;
11493 } 11494 this.regionSelectEl.disabled = true; 11495 } else if (this.disableAction == 'nullify') { 11496 this.regionSelectEl.options.length = 1; 11497 this.regionSelectEl.value = ''; 11498 this.regionSelectEl.selectedIndex = 0; 11499 this.lastCountryId = ''; 11500 } 11501 this.setMarkDisplay(this.regionSelectEl, false); 11502 } 11503 11504 this._checkRegionRequired(); 11505 // Make Zip and its label required/optional 11506 var zipUpdater = new ZipUpdater(this.countryEl.value, this.zipEl); 11507 zipUpdater.update(); 11508 }, 11509 11510 setMarkDisplay: function(elem, display){ 11511 elem = $(elem); 11512 var labelElement = elem.up(0).down('label > span.required') || 11513 elem.up(1).down('label > span.required') || 11514 elem.up(0).down('label.required > em') || 11515 elem.up(1).down('label.required > em'); 11516 if(labelElement) { 11517 inputElement = labelElement.up().next('input'); 11518 if (display) { 11519 labelElement.show(); 11520 if (inputElement) { 11521 inputElement.addClassName('required-entry'); 11522 } 11523 } else { 11524 labelElement.hide(); 11525 if (inputElement) { 11526 inputElement.removeClassName('required-entry'); 11527 } 11528 } 11529 } 11530 }, 11531 sortSelect : function () { 11532 var elem = this.regionSelectEl; 11533 var tmpArray = new Array(); 11534 var currentVal = $(elem).value; 11535 for (var i = 0; i < $(elem).options.length; i++) { 11536 if (i == 0) { 11537 continue; 11538 } 11539 tmpArray[i-1] = new Array(); 11540 tmpArray[i-1][0] = $(elem).options[i].text; 11541 tmpArray[i-1][1] = $(elem).options[i].value; 11542 } 11543 tmpArray.sort(); 11544 for (var i = 1; i <= tmpArray.length; i++) { 11545 var op = new Option(tmpArray[i-1][0], tmpArray[i-1][1]); 11546 $(elem).options[i] = op; 11547 } 11548 $(elem).value = currentVal; 11549 return; 11550 } 11551} 11552 11553ZipUpdater = Class.create(); 11554ZipUpdater.prototype = { 11555 initialize: function(country, zipElement) 11556 { 11557 this.country = country; 11558 this.zipElement = $(zipElement); 11559 }, 11560 11561 update: function() 11562 { 11563 // Country ISO 2-letter codes must be pre-defined 11564 if (typeof optionalZipCountries == 'undefined') { 11565 return false; 11566 } 11567 11568 // Ajax-request and normal content load compatibility 11569 if (this.zipElement != undefined) { 11570 Validation.reset(this.zipElement) 11571 this._setPostcodeOptional(); 11572 } else { 11573 Event.observe(window, "load", this._setPostcodeOptional.bind(this)); 11574 } 11575 }, 11576 11577 _setPostcodeOptional: function() 11578 { 11579 this.zipElement = $(this.zipElement); 11580 if (this.zipElement == undefined) { 11581 return false; 11582 } 11583 11584 // find label 11585 var label = $$('label[for="' + this.zipElement.id + '"]')[0]; 11586 if (label != undefined) { 11587 var wildCard = label.down('em') || label.down('span.required'); 11588 } 11589 11590 // Make Zip and its label required/optional 11591 if (optionalZipCountries.indexOf(this.country) != -1) { 11592 while (this.zipElement.hasClassName('required-entry')) { 11593 this.zipElement.removeClassName('required-entry'); 11594 } 11595 if (wildCard != undefined) { 11596 wildCard.hide(); 11597 } 11598 } else { 11599 this.zipElement.addClassName('required-entry'); 11600 if (wildCard != undefined) { 11601 wildCard.show(); 11602 } 11603 } 11604 } 11605} 11606/** 11607 * Magento 11608 * 11609 * NOTICE OF LICENSE 11610 * 11611 * This source file is subject to the Academic Free License (AFL 3.0) 11612 * that is bundled with this package in the file LICENSE_AFL.txt. 11613 * It is also available through the world-wide-web at this URL: 11614 * http://opensource.org/licenses/afl-3.0.php 11615 * If you did not receive a copy of the license and are unable to 11616 * obtain it through the world-wide-web, please send an email 11617 * to [email protected] so we can send you a copy immediately. 11618 * 11619 * DISCLAIMER 11620 * 11621 * Do not edit or add to this file if you wish to upgrade Magento to newer 11622 * versions in the future. If you wish to customize Magento for your 11623 * needs please refer to http://www.magento.com for more information. 11624 * 11625 * @category Varien 11626 * @package js 11627 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 11628 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11629 */ 11630
11631/** 11632 * @classDescription simple Navigation with replacing old handlers 11633 * @param {String} id id of ul element with navigation lists 11634 * @param {Object} settings object with settings 11635 */ 11636var mainNav = function() { 11637 11638 var main = { 11639 obj_nav : $(arguments[0]) || $("nav"), 11640 11641 settings : { 11642 show_delay : 0, 11643 hide_delay : 0, 11644 _ie6 : /MSIE 6.+Win/.test(navigator.userAgent), 11645 _ie7 : /MSIE 7.+Win/.test(navigator.userAgent) 11646 }, 11647 11648 init : function(obj, level) { 11649 obj.lists = obj.childElements(); 11650 obj.lists.each(function(el,ind){ 11651 main.handlNavElement(el); 11652 if((main.settings._ie6 || main.settings._ie7) && level){ 11653 main.ieFixZIndex(el, ind, obj.lists.size()); 11654 } 11655 }); 11656 if(main.settings._ie6 && !level){ 11657 document.execCommand("BackgroundImageCache", false, true); 11658 } 11659 }, 11660 11661 handlNavElement : function(list) { 11662 if(list !== undefined){ 11663 list.onmouseover = function(){ 11664 main.fireNavEvent(this,true); 11665 }; 11666 list.onmouseout = function(){ 11667 main.fireNavEvent(this,false); 11668 }; 11669 if(list.down("ul")){ 11670 main.init(list.down("ul"), true); 11671 } 11672 } 11673 }, 11674 11675 ieFixZIndex : function(el, i, l) { 11676 if(el.tagName.toString().toLowerCase().indexOf("iframe") == -1){ 11677 el.style.zIndex = l - i; 11678 } else { 11679 el.onmouseover = "null"; 11680 el.onmouseout = "null"; 11681 } 11682 }, 11683 11684 fireNavEvent : function(elm,ev) { 11685 if(ev){ 11686 elm.addClassName("over"); 11687 elm.down("a").addClassName("over"); 11688 if (elm.childElements()[1]) { 11689 main.show(elm.childElements()[1]); 11690 } 11691 } else { 11692 elm.removeClassName("over"); 11693 elm.down("a").removeClassName("over"); 11694 if (elm.childElements()[1]) { 11695 main.hide(elm.childElements()[1]); 11696 } 11697 } 11698 }, 11699 11700 show : function (sub_elm) { 11701 if (sub_elm.hide_time_id) { 11702 clearTimeout(sub_elm.hide_time_id); 11703 } 11704 sub_elm.show_time_id = setTimeout(function() { 11705 if (!sub_elm.hasClassName("shown-sub")) { 11706 sub_elm.addClassName("shown-sub"); 11707 } 11708 }, main.settings.show_delay); 11709 }, 11710 11711 hide : function (sub_elm) { 11712 if (sub_elm.show_time_id) { 11713 clearTimeout(sub_elm.show_time_id); 11714 } 11715 sub_elm.hide_time_id = setTimeout(function(){ 11716 if (sub_elm.hasClassName("shown-sub")) { 11717 sub_elm.removeClassName("shown-sub"); 11718 } 11719 }, main.settings.hide_delay); 11720 } 11721 11722 }; 11723 if (arguments[1]) { 11724 main.settings = Object.extend(main.settings, arguments[1]); 11725 } 11726 if (main.obj_nav) { 11727 main.init(main.obj_nav, false); 11728 } 11729}; 11730 11731document.observe("dom:loaded", function() { 11732 //run navigation without delays and with default id="#nav" 11733 //mainNav(); 11734 11735 //run navigation with delays 11736 mainNav("nav", {"show_delay":"100","hide_delay":"100"}); 11737}); 11738/** 11739 * Magento 11740 * 11741 * NOTICE OF LICENSE 11742 * 11743 * This source file is subject to the Academic Free License (AFL 3.0) 11744 * that is bundled with this package in the file LICENSE_AFL.txt. 11745 * It is also available through the world-wide-web at this URL: 11746 * http://opensource.org/licenses/afl-3.0.php 11747 * If you did not receive a copy of the license and are unable to 11748 * obtain it through the world-wide-web, please send an email 11749 * to [email protected] so we can send you a copy immediately. 11750 * 11751 * DISCLAIMER 11752 * 11753 * Do not edit or add to this file if you wish to upgrade Magento to newer 11754 * versions in the future. If you wish to customize Magento for your 11755 * needs please refer to http://www.magento.com for more information. 11756 * 11757 * @category Mage 11758 * @package js 11759 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 11760 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11761 */ 11762 11763var Translate = Class.create(); 11764Translate.prototype = { 11765 initialize: function(data){ 11766 this.data = $H(data); 11767 }, 11768 11769 translate : function(){ 11770 var args = arguments; 11771 var text = arguments[0]; 11772 11773 if(this.data.get(text)){ 11774 return this.data.get(text); 11775 } 11776 return text; 11777 }, 11778 add : function() { 11779 if (arguments.length > 1) { 11780 this.data.set(arguments[0], arguments[1]); 11781 } else if (typeof arguments[0] =='object') { 11782 $H(arguments[0]).each(function (pair){ 11783 this.data.set(pair.key, pair.value); 11784 }.bind(this)); 11785 } 11786 } 11787} 11788/** 11789 * Magento 11790 * 11791 * NOTICE OF LICENSE 11792 * 11793 * This source file is subject to the Academic Free License (AFL 3.0)
11794 * that is bundled with this package in the file LICENSE_AFL.txt. 11795 * It is also available through the world-wide-web at this URL: 11796 * http://opensource.org/licenses/afl-3.0.php 11797 * If you did not receive a copy of the license and are unable to 11798 * obtain it through the world-wide-web, please send an email 11799 * to [email protected] so we can send you a copy immediately. 11800 * 11801 * DISCLAIMER 11802 * 11803 * Do not edit or add to this file if you wish to upgrade Magento to newer 11804 * versions in the future. If you wish to customize Magento for your 11805 * needs please refer to http://www.magento.com for more information. 11806 * 11807 * @category Mage 11808 * @package js 11809 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 11810 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 11811 */ 11812// old school cookie functions grabbed off the web 11813 11814if (!window.Mage) var Mage = {}; 11815 11816Mage.Cookies = {}; 11817Mage.Cookies.expires = null; 11818Mage.Cookies.path = '/'; 11819Mage.Cookies.domain = null; 11820Mage.Cookies.secure = false; 11821Mage.Cookies.set = function(name, value){ 11822 var argv = arguments; 11823 var argc = arguments.length; 11824 var expires = (argc > 2) ? argv[2] : Mage.Cookies.expires; 11825 var path = (argc > 3) ? argv[3] : Mage.Cookies.path; 11826 var domain = (argc > 4) ? argv[4] : Mage.Cookies.domain; 11827 var secure = (argc > 5) ? argv[5] : Mage.Cookies.secure; 11828 document.cookie = name + "=" + escape (value) + 11829 ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 11830 ((path == null) ? "" : ("; path=" + path)) + 11831 ((domain == null) ? "" : ("; domain=" + domain)) + 11832 ((secure == true) ? "; secure" : ""); 11833}; 11834 11835Mage.Cookies.get = function(name){ 11836 var arg = name + "="; 11837 var alen = arg.length; 11838 var clen = document.cookie.length; 11839 var i = 0; 11840 var j = 0; 11841 while(i < clen){ 11842 j = i + alen; 11843 if (document.cookie.substring(i, j) == arg) 11844 return Mage.Cookies.getCookieVal(j); 11845 i = document.cookie.indexOf(" ", i) + 1; 11846 if(i == 0) 11847 break; 11848 } 11849 return null; 11850}; 11851 11852Mage.Cookies.clear = function(name) { 11853 if(Mage.Cookies.get(name)){ 11854 document.cookie = name + "=" + 11855 "; expires=Thu, 01-Jan-70 00:00:01 GMT"; 11856 } 11857}; 11858 11859Mage.Cookies.getCookieVal = function(offset){ 11860 var endstr = document.cookie.indexOf(";", offset); 11861 if(endstr == -1){ 11862 endstr = document.cookie.length; 11863 } 11864 return unescape(document.cookie.substring(offset, endstr)); 11865}; 11866var awAfptcPopup = Class.create(); 11867awAfptcPopup.prototype = { 11868 initialize: function(config) { 11869 this.config = config; 11870 }, 11871 init: function() { 11872 var options = { 11873 parameters : {}, 11874 method: 'get', 11875 onSuccess: this.onSuccess(this) 11876 }; 11877 this.onSuccess = this.onSuccess.bindAsEventListener(this); 11878 new Ajax.Request(this.config.requestUrl, options); 11879 }, 11880 onSuccess: function(object) { 11881 return function(transport) { 11882 try { 11883 eval("var json = " + transport.responseText + " || {}"); 11884 } catch(e) { 11885 console.log(e); 11886 return; 11887 } 11888 $(object.config.el).update(json.content); 11889 $(object.config.decline).observe('click', object._observeDeclineAction.bind(object)); 11890 $(object.config.overlay).observe('click', object._observeDeclineAction.bind(object)); 11891 object.align(); 11892 }; 11893 }, 11894 align: function() { 11895 var el = $(this.config.el); 11896 el.setStyle({ 11897 top: document.viewport.getHeight() / 2 - el.getHeight() / 2 + 'px', 11898 left: document.viewport.getWidth() / 2 - el.getWidth() / 2 + 'px' 11899 }); 11900 11901 Event.observe(window, 'resize', function() { this.resizeBlock(el) }.bind(this)); 11902 11903 Effect.Appear(el, {duration: 0.4}); 11904 $(this.config.overlay).show(); 11905 }, 11906 collectPos: function(el) { 11907 var x, y; 11908 var elWidth = el.getWidth(); 11909 var docWidth = document.viewport.getWidth(); 11910 x = docWidth/2 - elWidth/2; 11911 var elHeight = el.getHeight(); 11912 var docHeight = document.viewport.getHeight(); 11913 y = docHeight/2 - elHeight/2; 11914 11915 return [x, y]; 11916 }, 11917 resizeBlock: function(el) { 11918 11919 el.setStyle({ 11920 height: 'auto', width: 'auto' 11921 }); 11922 var xy = this.collectPos(el); 11923 11924 if (xy[0] < 50) { 11925 xy[0] = 50; 11926 el.setStyle({ 11927 width: (document.viewport.getWidth() - 100) + 'px' 11928 }); 11929 } 11930 if (xy[1] < 50) { 11931 xy[1] = 50; 11932 el.setStyle({ 11933 height: (document.viewport.getHeight() - 100) + 'px' 11934 }); 11935 } 11936 el.setStyle({ 'left': xy[0] + 'px', 'top': xy[1] + 'px'}); 11937 }, 11938 _observeDeclineAction: function() { 11939 if(this.config.declineCheck 11940 && $(this.config.declineCheck) 11941 && $(this.config.declineCheck).checked 11942 && $(this.config.cookie) 11943 ) { 11944 var date = new Date(); 11945 date.setTime(date.getTime() + this.config.cookieLifetime); 11946 Mage.Cookies.set($(this.config.cookie).value, true, date); 11947 } 11948 try {
11949 Effect.Fade($(this.config.el), {duration: 0.4}); 11950 Effect.Fade($(this.config.overlay), {duration: 0.4}); 11951 } catch(e) { 11952 console.log(e); 11953 return; 11954 } 11955 } 11956}; 11957/** 11958* @author Amasty Team 11959* @copyright Copyright (c) 2010-2011 Amasty (http://www.amasty.com) 11960* @package Amasty_Finder 11961*/ 11962var amFinder = new Class.create(); 11963 11964amFinder.prototype = { 11965 initialize: function(containerId, ajaxUrl, loadingText, isNeedLast, autoSubmit) 11966 { 11967 this.containerId = containerId; 11968 this.ajaxUrl = ajaxUrl; 11969 this.autoSubmit = Number(autoSubmit); 11970 this.loadingText = loadingText; 11971 this.isNeedLast = Number(isNeedLast); 11972 this.selects = new Array(); 11973 11974 //possible bug if select order in the HTML will be different 11975 $$('#' + this.containerId + ' select').each(function(select){ 11976 select.observe('change', this.onChange.bindAsEventListener(this)); 11977 this.selects[this.selects.length] = select; 11978 }.bind(this)); 11979 }, 11980 11981 onChange: function(event) 11982 { 11983 var select = Event.element(event); 11984 var parentId = select.value; 11985 var dropdownId = 0; 11986 var self = this; 11987 /* should load next element's options only if current is not the last one */ 11988 for (var i = 0; i < this.selects.length; i++){ 11989 if (this.selects[i].id == select.id && i != this.selects.length-1){ 11990 var selectToReload = this.selects[i + 1]; 11991 if (selectToReload){ 11992 dropdownId = selectToReload.id.substr(selectToReload.id.search('--') + 2); 11993 } 11994 break; 11995 } 11996 } 11997 11998 this.clearAllBelow(select); 11999 12000 if (0 != parentId && dropdownId){ 12001 var postData = 'dropdown_id=' + dropdownId + '&parent_id=' + parentId; 12002 new Ajax.Request(this.ajaxUrl, { 12003 method: 'post', 12004 postBody : postData, 12005 evalJSON : 'force', 12006 12007 onLoading: function(){ 12008 this.showLoading(selectToReload); 12009 }.bind(this), 12010 12011 onSuccess: function(transport) { 12012 if (transport.responseJSON){ 12013 this.clearSelectOptions(selectToReload); 12014 var itemsFound = false; 12015 var value = 0; 12016 transport.responseJSON.each(function(item){ 12017 itemsFound = true; 12018 var option = document.createElement('option'); 12019 option.value = item.value; 12020 option.text = item.label; 12021 option.label = item.label; 12022 $(selectToReload).appendChild(option); 12023 value = item.value; 12024 }); 12025 12026 if (itemsFound){ 12027 $(selectToReload).disabled = false; 12028 } 12029 if(transport.responseJSON.length == 2) { 12030 $(selectToReload).value = value; 12031 self.onChange({target: selectToReload, srcElement: selectToReload}); 12032 } 12033 } 12034 }.bind(this) 12035 }); 12036 } 12037 }, 12038 12039 isLast: function(select) 12040 { 12041 return (this.selects[this.selects.length-1].id == select.id); 12042 }, 12043 12044 isFirst: function(select) 12045 { 12046 return (this.selects[0].id == select.id); 12047 }, 12048 12049 clearSelectOptions: function(select) 12050 { 12051 $(select).descendants().each(function(option){ 12052 option.remove(); 12053 }); 12054 }, 12055 12056 clearAllBelow: function(select) 12057 { 12058 var startClearing = false; 12059 for (var i = 0; i < this.selects.length; i++){ 12060 if (startClearing){ 12061 this.clearSelectOptions(this.selects[i]); 12062 $(this.selects[i]).disabled = true; 12063 } 12064 if (this.selects[i].id == select.id){ 12065 startClearing = true; 12066 } 12067 } 12068 var type = (((this.isLast(select) && !this.isNeedLast) && select.value > 0) || ((this.isNeedLast) && ((select.value > 0) || (!this.isFirst(select))))) ? 'block' : 'none'; 12069 12070 if ('block' == type && this.autoSubmit && this.isLast(select)) 12071 { 12072 $$('#' + this.containerId + ' .amfinder-buttons button')[0].form.submit(); 12073 } else { 12074 $$('#' + this.containerId + ' .amfinder-buttons')[0].style.display = type; 12075 } 12076 12077 12078 }, 12079 12080 showLoading: function(selectToReload) 12081 { 12082 var option = document.createElement('option'); 12083 option.value = 0; 12084 option.text = this.loadingText; 12085 option.label = this.loadingText; 12086 $(selectToReload).appendChild(option); 12087 }, 12088 12089}; 12090var Dailydeal = Class.create(); 12091 12092Dailydeal.prototype = { 12093 initialize: function (changeProductUrl) { 12094 this.changeProductUrl = changeProductUrl; 12095 }, 12096 changeProduct: function (product_id) { 12097 var url = this.changeProductUrl; 12098 if (url.indexOf('?') == -1) 12099 url += '?product_id=' + product_id; 12100 else 12101 url += '&product_id=' + product_id; 12102 new Ajax.Updater('product_name_contain', url, { 12103 method: 'get', onComplete: function () { 12104 updateProductName(); 12105 }, onFailure: "" 12106 }); 12107 }, 12108 checkBidderName: function () { 12109 var bidder_name = $('bidder_name').value; 12110 $('bidder_name_form_button').hide(); 12111 12112 var url = this.changeProductUrl; 12113 if (url.indexOf('?') == -1) 12114 url += '?bidder_name=' + bidder_name; 12115 else 12116 url += '&bidder_name=' + bidder_name; 12117 12118 new Ajax.Updater('bidder-notice', url, { 12119 method: 'get', onComplete: function () { 12120 validBidderName(); 12121 }, onFailure: "" 12122 }); 12123 12124 $('biddername-please-wait').style.display = "block"; 12125 $('bidder-notice').style.display = "none"; 12126 $('bidder_name').removeClassName('validation-passed'); 12127 } 12128} 12129 12130var DailydealTimeCounter = Class.create(); 12131DailydealTimeCounter.prototype = { 12132 //params now_time, end_time : seconds 12133 initialize: function (now_time, end_time, dailydeal_id) { 12134 this.now_time = parseInt(now_time) * 1000; 12135 this.end_time = parseInt(end_time) * 1000; 12136 this.dailydeal_id = dailydeal_id; 12137 this.end = new Date(this.end_time); 12138 var endDate = this.end; 12139 this.second = endDate.getSeconds(); 12140 this.minute = endDate.getMinutes(); 12141 this.hour = endDate.getHours(); 12142 this.day = endDate.getDate(); 12143 this.month = endDate.getMonth(); 12144 var yr; 12145 if (endDate.getYear() < 1900) 12146 yr = endDate.getYear() + 1900; 12147 else 12148 yr = endDate.getYear();
12149 this.year = yr; 12150 }, 12151 12152 setTimeleft: function (timeleft_id) { 12153 var now = new Date(this.now_time); 12154 var yr; 12155 12156 if (now.getYear() < 1900) 12157 yr = now.getYear() + 1900; 12158 else 12159 yr = now.getYear(); 12160 12161 var endtext = '0'; 12162 var timerID; 12163 12164 var sec = this.second - now.getSeconds(); 12165 12166 var min = this.minute - now.getMinutes(); 12167 var hr = this.hour - now.getHours(); 12168 var dy = this.day - now.getDate(); 12169 var mnth = this.month - now.getMonth(); 12170 yr = this.year - yr; 12171 12172 var daysinmnth = 32 - new Date(now.getYear(), now.getMonth(), 32).getDate(); 12173 if (sec < 0) { 12174 sec = (sec + 60) % 60; 12175 min--; 12176 } 12177 if (min < 0) { 12178 min = (min + 60) % 60; 12179 hr--; 12180 } 12181 if (hr < 0) { 12182 hr = (hr + 24) % 24; 12183 dy--; 12184 } 12185 if (dy < 0) { 12186 dy = (dy + daysinmnth) % daysinmnth; 12187 mnth--; 12188 } 12189 if (mnth < 0) { 12190 mnth = (mnth + 12) % 12; 12191 yr--; 12192 } 12193 var sectext = "sec"; 12194 var mintext = "min"; 12195 var hrtext = "hour"; 12196 var dytext = " days "; 12197 var mnthtext = " months "; 12198 var yrtext = " years "; 12199 if (yr == 1) 12200 yrtext = " year "; 12201 if (mnth == 1) 12202 mnthtext = " month "; 12203 if (dy == 1) 12204 dytext = " day "; 12205 if (hr == 1) 12206 hrtext = "hour"; 12207 if (min == 1) 12208 mintext = "min"; 12209 if (sec == 1) 12210 sectext = "sec"; 12211 12212 if (dy < 10) 12213 dy = '0' + dy; 12214 if (hr < 10) 12215 hr = '0' + hr; 12216 if (min < 10) 12217 min = '0' + min; 12218 if (sec < 10) 12219 sec = '0' + sec; 12220 12221 if (yr <= 0) 12222 yrtext = '' 12223 else 12224 yrtext = '<li class="time-year"><div><span class="timeleft-text">' + yr + '</span><span class="text-time">' + yrtext + '</span></div></li>'; 12225 12226 if ((mnth <= 0)) 12227 mnthtext = '' 12228 else 12229 mnthtext = '<li class="time-month"><div><span class="timeleft-text">' + mnth + '</span><span class="text-time">' + mnthtext + '</span></div></li>'; 12230 12231 if (dy <= 0 && mnth > 0) 12232 dytext = '' 12233 else 12234 dytext = '<li class="time-day"><div><span class="timeleft-text">' + dy + '</span><span class="text-time">' + dytext + '</span></div></li>'; 12235 12236 if (hr <= 0 && dy > 0) 12237 hrtext = '' 12238 else 12239 hrtext = '<li class="time-hr"><div><span class="timeleft-text">' + hr + '</span><span class="text-time">' + hrtext + '</span></div></li>'; 12240 12241 if (min < 0) 12242 mintext = '' 12243 else 12244 mintext = '<li class="time-min"><div><span class="timeleft-text">' + min + '</span><span class="text-time">' + mintext + '</span></div></li>'; 12245 12246 if (sec < 0) 12247 sectext = '' 12248 else 12249 sectext = '<li class="time-sec"><div><span class="timeleft-text">' + sec + '</span><span class="text-time">' + sectext + '</span></div></li>'; 12250 12251 if (now >= this.end) { 12252 jQuery("."+timeleft_id).html(endtext); 12253 clearTimeout(timerID); 12254 } 12255 else { 12256 jQuery("."+timeleft_id).html(yrtext + mnthtext + dytext + hrtext + mintext + sectext); 12257 } 12258 12259 if (this.now_time == this.end_time) { 12260 location.reload(true); 12261 return; 12262 } 12263 12264 this.now_time = this.now_time + 1000; 12265 12266 timerID = setTimeout("setDailydealTimeleft(" + (this.now_time / 1000) + "," + (this.end_time / 1000) + ",'" + timeleft_id + "','" + this.dailydeal_id + "');", 1000); 12267 } 12268} 12269 12270var timerCounters = {}; 12271function setDailydealTimeleft(now_time, end_time, timeleft_id, dailydeal_id) { 12272 if (timerCounters[dailydeal_id] == undefined) { 12273 timerCounters[dailydeal_id] = new DailydealTimeCounter(now_time, end_time, dailydeal_id); 12274 } else { 12275 timerCounters[dailydeal_id].initialize(now_time, end_time, dailydeal_id); 12276 } 12277 timerCounters[dailydeal_id].setTimeleft(timeleft_id); 12278} 12279 12280function updateProductName() { 12281 $('product_name').value = $('newproduct_name').value; 12282 $('dailydeal_tabs_form_section').addClassName('active'); 12283 $('dailydeal_tabs_form_listproduct').removeClassName('active'); 12284 $('dailydeal_tabs_form_section_content').style.display = ""; 12285 $('dailydeal_tabs_form_listproduct_content').style.display = "none"; 12286} 12287 12288 12289function showSelectProductTab() { 12290 $('dailydeal_tabs_form_section').removeClassName('active'); 12291 $('dailydeal_tabs_form_listproduct').addClassName('active'); 12292 Element.show('dailydeal_tabs_form_listproduct_content'); 12293 Element.hide('dailydeal_tabs_form_section_content'); 12294} 12295/*Giftvoucher JS*/ 12296 12297function toggleTotalCode() { 12298 $$('.giftvoucher-total-code').each(function(el) {
12299 el.toggle(); 12300 }); 12301} 12302 12303function escapeHtml(text) { 12304 'use strict'; 12305 return text.replace(/[\"&<>]/g, function (a) { 12306 return { '"': '"', '&': '&', '<': '<', '>': '>' }[a]; 12307 }); 12308} 12309 12310function addGiftVoucher() { 12311 var giftvoucher_code = $('giftvoucher_code').value; 12312 var add_code = ''; 12313 if ($('giftvoucher_existed_code')) { 12314 add_code = $('giftvoucher_existed_code').value; 12315 } 12316 if (giftvoucher_code != '' || add_code != '') { 12317 if ($('giftcard_notice_1')) 12318 $('giftcard_notice_1').style.display = "none"; 12319 if ($('giftcard_notice_2')) 12320 $('giftcard_notice_2').style.display = "none"; 12321 if ($('giftvoucher_code')) 12322 $('giftvoucher_code').removeClassName("validation-failed"); 12323 if ($('giftvoucher_existed_code')) 12324 $('giftvoucher_existed_code').removeClassName("validation-failed"); 12325 $('giftvoucher_add').hide(); 12326 $('giftvoucher_wait').show(); 12327 12328 var url = $('giftvoucher_cache_url').innerHTML.stripTags(); 12329 for (i = 0; i < url.length; i++) { 12330 if (url[url.length - 1] == '/') 12331 url = url.substr(0, url.length - 1); 12332 } 12333 if (giftvoucher_code != '') 12334 url += '/code/' + giftvoucher_code; 12335 if (add_code != '') 12336 url += '/addcode/' + add_code; 12337 new Ajax.Request(url, { 12338 method: 'post', 12339 postBody: '', 12340 onException: function(response, e) { 12341 $('giftvoucher_message').update('<ul class="error-msg col-xs-12"><li>' + e + '</li></ul>'); 12342 }, 12343 onComplete: function(response) { 12344 if (response.responseText.isJSON()) { 12345 var res = response.responseText.evalJSON(); 12346 var needUpdate = true; 12347 if (res.ajaxExpired && res.ajaxRedirect) { 12348 setLocation(res.ajaxRedirect); 12349 needUpdate = false; 12350 } 12351 if (needUpdate && res.updatepayment) { 12352 var eladd = getElement(); 12353 eladd.hide(); 12354 $('giftvoucher_container').down('dd.giftvoucher').hide(); 12355 $('giftvoucher_ajaxload').show(); 12356 if (typeof shippingMethod != 'undefined') { 12357 shippingMethod.save(); 12358 } else if (typeof billing != 'undefined') { 12359 billing.save(); 12360 } else { 12361 // save_address_information(save_address_url); 12362 } 12363 } else if (needUpdate) { 12364 if (res.html) { 12365 var container = $('giftvoucher_container'); 12366 container.innerHTML = res.html; 12367 $('payment_form_giftvoucher').show(); 12368 } else { 12369 $('giftvoucher_wait').hide(); 12370 $('giftvoucher_add').show(); 12371 } 12372 var message = ''; 12373 if (res.success) { 12374 message = '<ul class="success-msg"><li>' + res.success + '</li></ul>'; 12375 if (typeof (save_shipping_method) != 'undefined') 12376 save_shipping_method(shipping_method_url, enable_update_payment, true); 12377 ; 12378 } 12379 if (res.notice) 12380 message += '<ul class="notice-msg"><li>' + res.notice + '</li></ul>'; 12381 if (res.error) 12382 message += '<ul class="error-msg"><li>' + res.error + '</li></ul>'; 12383 if (message != '') 12384 $('giftvoucher_message').update(message); 12385 } 12386 } else { 12387 $('giftvoucher_wait').hide(); 12388 $('giftvoucher_add').show(); 12389 alert(response.responseText); 12390 } 12391 if (typeof (save_shipping_method) != 'undefined') 12392 save_shipping_method(shipping_method_url, enable_update_payment, true); 12393 } 12394 }); 12395 12396 } else { 12397 if (giftvoucher_code == '' && add_code == '') 12398 { 12399 if ($('giftcard_notice_1') && ($('giftvoucher_existed_code') == null)) 12400 $('giftcard_notice_1').style.display = "block"; 12401 else 12402 $('giftcard_notice_2').style.display = "block"; 12403 if ($('giftvoucher_code')) 12404 $('giftvoucher_code').addClassName("validation-failed"); 12405 if ($('giftvoucher_existed_code')) 12406 $('giftvoucher_existed_code').addClassName("validation-failed"); 12407 } 12408 else 12409 { 12410 payment.save(); 12411 } 12412 } 12413} 12414 12415function removeGiftVoucher(e) { 12416 var el = $(e.id); 12417 var url = el.children[0].value; 12418 for (i = 0; i < url.length; i++) { 12419 if (url[url.length - 1] == '/') 12420 url = url.substr(0, url.length - 1); 12421 } 12422 var idPrefix = el.id; 12423 var title = $(idPrefix + '_remove'); 12424 var ajaxAlt = $(idPrefix + '_ajax'); 12425 title.hide(); 12426 el.hide(); 12427 ajaxAlt.show(); 12428 var request = new Ajax.Request(url, { 12429 method: 'post', 12430 postBody: '', 12431 onException: function(response, e) { 12432 $('giftvoucher_message').update('<ul class="error-msg"><li>' + e + '</li></ul>'); 12433 }, 12434 onComplete: function(response) { 12435 if (response.responseText.isJSON()) { 12436 var res = response.responseText.evalJSON(); 12437 var needUpdate = true; 12438 if (res.ajaxExpired && res.ajaxRedirect) { 12439 setLocation(res.ajaxRedirect); 12440 needUpdate = false;
12441 } 12442 if (needUpdate && res.updatepayment) { 12443 var eladd = getElement(); 12444 eladd.hide(); 12445 $('giftvoucher_container').down('dd.giftvoucher').hide(); 12446 $('giftvoucher_ajaxload').show(); 12447 if (typeof shippingMethod != 'undefined') { 12448 shippingMethod.save(); 12449 } else if (typeof billing != 'undefined') { 12450 billing.save(); 12451 } else { 12452 // save_address_information(save_address_url); 12453 } 12454 } else if (needUpdate) { 12455 if (res.html) { 12456 var container = $('giftvoucher_container'); 12457 container.innerHTML = res.html; 12458 $('payment_form_giftvoucher').show(); 12459 } else { 12460 ajaxAlt.hide(); 12461 el.show(); 12462 title.show(); 12463 } 12464 var message = ''; 12465 if (res.success) { 12466 message = '<ul class="success-msg"><li>' + res.success + '</li></ul>'; 12467 if (typeof (save_shipping_method) != 'undefined') 12468 save_shipping_method(shipping_method_url, enable_update_payment, true); 12469 ; 12470 } 12471 if (res.error) 12472 message += '<ul class="error-msg"><li>' + res.error + '</li></ul>'; 12473 if (message != '') 12474 $('giftvoucher_message').update(message); 12475 } 12476 } else { 12477 ajaxAlt.hide(); 12478 el.show(); 12479 title.show(); 12480 alert(response.responseText); 12481 } 12482 if (typeof (save_shipping_method) != 'undefined') 12483 save_shipping_method(shipping_method_url, enable_update_payment, true); 12484 } 12485 }); 12486} 12487 12488// change or udpate gift card used to spend 12489function changeUseGiftvoucher(el) { 12490 12491 var url = $('giftvoucher_cache_url').innerHTML.stripTags().replace('/addgift', '/giftcard'); 12492 for (i = 0; i < url.length; i++) { 12493 if (url[url.length - 1] == '/') 12494 url = url.substr(0, url.length - 1); 12495 } 12496 if (el.checked) { 12497 $('payment_form_giftvoucher').show(); 12498 changeGiftcardVisible('giftvoucher', false); 12499 url += '/giftvoucher/1'; 12500 } else { 12501 $('payment_form_giftvoucher').hide(); 12502 changeGiftcardVisible('giftvoucher', true); 12503 } 12504 12505 var eladd = getElement(); 12506 eladd.hide(); 12507 $('giftvoucher_container').down('dd.giftvoucher').hide(); 12508 $('giftvoucher_ajaxload').show(); 12509 new Ajax.Request(url, { 12510 method: 'post', 12511 postBody: '', 12512 onComplete: function(response) { 12513 if (response.responseText.isJSON()) { 12514 var res = response.responseText.evalJSON(); 12515 if (res.updatepayment) { 12516 if (typeof shippingMethod != 'undefined') { 12517 shippingMethod.save(); 12518 } else if (typeof billing != 'undefined') { 12519 billing.save(); 12520 } else { 12521 // save_address_information(save_address_url); 12522 } 12523 } else { 12524 var eladd = getElement(); 12525 eladd.show(); 12526 $('giftvoucher_container').down('dd.giftvoucher').show(); 12527 $('giftvoucher_ajaxload').hide(); 12528 } 12529 } else { 12530 var eladd = getElement(); 12531 eladd.show(); 12532 $('giftvoucher_container').down('dd.giftvoucher').show(); 12533 $('giftvoucher_ajaxload').hide(); 12534 } 12535 if (typeof (save_shipping_method) != 'undefined') 12536 save_shipping_method(shipping_method_url, enable_update_payment, true); 12537 } 12538 }); 12539} 12540 12541function onLoadGiftvoucherForm() { 12542 if ($('giftvoucher')) { 12543 $('giftvoucher').disabled = false;
12544 if ($('giftvoucher').checked) { 12545 $('payment_form_giftvoucher').show(); 12546 changeGiftcardVisible('giftvoucher', false); 12547 } else { 12548 $('payment_form_giftvoucher').hide(); 12549 changeGiftcardVisible('giftvoucher', true); 12550 } 12551 } 12552 if ($('giftvoucher_credit')) { 12553 $('giftvoucher_credit').disabled = false; 12554 if ($('giftvoucher_credit').checked) { 12555 $('payment_form_giftvoucher_credit').show(); 12556 changeGiftcardVisible('giftvoucher_credit', false); 12557 } else { 12558 $('payment_form_giftvoucher_credit').hide(); 12559 changeGiftcardVisible('giftvoucher_credit', true); 12560 } 12561 } 12562} 12563 12564function useExistedGiftcard(el) { 12565 if (el.value) { 12566 $('giftvoucher-custom-code').hide(); 12567 } else { 12568 $('giftvoucher-custom-code').show(); 12569 } 12570} 12571 12572function changeUseExistedGiftcard(el) { 12573 if (el.value) { 12574 $('giftvoucher-custom-code').hide(); 12575 changeGiftcardVisible('giftvoucher-custom-code', true); 12576 } else { 12577 $('giftvoucher-custom-code').show(); 12578 changeGiftcardVisible('giftvoucher-custom-code', false); 12579 } 12580} 12581 12582function showGiftCardInput(el) { 12583 var parent = Element.extend(el.parentNode); 12584 el.hide(); 12585 parent.down('.giftcard_input').show(); 12586 parent.down('.giftcard_input input').focus(); 12587} 12588 12589function showGiftCardAmountInput(el) { 12590 var parent = Element.extend(el.parentNode); 12591 el.hide(); 12592 parent.down('input').show(); 12593 parent.down('input').disabled = false; 12594} 12595 12596function enterUpdateGiftCardInput(el, e) { 12597 if (e.keyCode == 13) { 12598 updateGiftCardInput(el); 12599 } 12600} 12601 12602function updateGiftCardInput(el) { 12603 var parent = Element.extend(el.parentNode); 12604 parent.down('.apply').hide(); 12605 parent.down('.ajax-loader').show(); 12606 12607 var url = $('giftvoucher_cache_url').innerHTML.stripTags().replace('/addgift', '/updateAmount'); 12608 for (i = 0; i < url.length; i++) { 12609 if (url[url.length - 1] == '/') 12610 url = url.substr(0, url.length - 1); 12611 } 12612 var code = Element.extend(el.parentNode.parentNode.parentNode.parentNode).down('button').id; 12613 url += '/code/' + code; 12614 url += '/amount/' + parent.down('input').value; 12615 new Ajax.Request(url, { 12616 method: 'post', 12617 postBody: '', 12618 parameters: '', 12619 onException: function(response, e) { 12620 $('giftvoucher_message').update('<ul class="error-msg"><li>' + e + '</li></ul>'); 12621 }, 12622 onComplete: function(response) { 12623 el.show(); 12624 parent.down('.ajax-loader').hide(); 12625 if (response.responseText.isJSON()) { 12626 var res = response.responseText.evalJSON(); 12627 var needUpdate = true; 12628 if (res.ajaxExpired && res.ajaxRedirect) { 12629 setLocation(res.ajaxRedirect); 12630 needUpdate = false; 12631 } 12632 if (needUpdate && res.updatepayment) { 12633 var eladd = getElement(); 12634 eladd.hide(); 12635 $('giftvoucher_container').down('dd.giftvoucher').hide(); 12636 $('giftvoucher_ajaxload').show(); 12637 if (typeof shippingMethod != 'undefined') { 12638 shippingMethod.save(); 12639 } else if (typeof billing != 'undefined') { 12640 billing.save(); 12641 } else { 12642 // save_address_information(save_address_url); 12643 } 12644 } else if (needUpdate) { 12645 if (res.amount) { 12646 $(code + '_remove').down('.giftcard-amount').update(res.amount); 12647 parent.hide(); 12648 parent = Element.extend(parent.parentNode); 12649 parent.down('.giftcard_change').show(); 12650 } 12651 if (res.html) { 12652 var container = $('giftvoucher_container'); 12653 container.innerHTML = res.html; 12654 $('payment_form_giftvoucher').show(); 12655 } 12656 var message = ''; 12657 if (res.success) { 12658 message = '<ul class="success-msg"><li>' + res.success + '</li></ul>'; 12659 if (typeof (save_shipping_method) != 'undefined') 12660 save_shipping_method(shipping_method_url, enable_update_payment, true); 12661 ; 12662 } 12663 if (res.error) 12664 message += '<ul class="error-msg"><li>' + res.error + '</li></ul>'; 12665 if (message != '') 12666 $('giftvoucher_message').update(message); 12667 } 12668 } 12669 if (typeof (save_shipping_method) != 'undefined') 12670 save_shipping_method(shipping_method_url, enable_update_payment, true); 12671 } 12672 }); 12673} 12674 12675// change or update gift card credit to spend 12676function changeUseGiftCredit(el) { 12677 12678 var url = $('giftvoucher_cache_url').innerHTML.stripTags().replace('/addgift', '/giftcardcredit'); 12679 for (i = 0; i < url.length; i++) { 12680 if (url[url.length - 1] == '/') 12681 url = url.substr(0, url.length - 1); 12682 } 12683 if (el.checked) { 12684 $('payment_form_giftvoucher_credit').show(); 12685 changeGiftcardVisible('giftvoucher_credit', false); 12686 url += '/giftcredit/1'; 12687 } else { 12688 $('payment_form_giftvoucher_credit').hide(); 12689 changeGiftcardVisible('giftvoucher_credit', true); 12690 } 12691 var eladd = getElement(); 12692 eladd.hide(); 12693 $('giftvoucher_container').down('dt.giftvoucher').hide(); 12694 $('giftvoucher_container').down('dd.giftvoucher').hide(); 12695 $('giftvoucher_container').down('dd.giftvoucher_credit').hide(); 12696 $('giftvoucher_credit_ajaxload').show(); 12697 new Ajax.Request(url, { 12698 method: 'post', 12699 postBody: '', 12700 onComplete: function(response) { 12701 if (response.responseText.isJSON()) { 12702 var res = response.responseText.evalJSON(); 12703 if (res.updatepayment) { 12704 if (typeof shippingMethod != 'undefined') { 12705 shippingMethod.save(); 12706 } else if (typeof billing != 'undefined') { 12707 billing.save(); 12708 } else { 12709 // save_address_information(save_address_url); 12710 } 12711 } else if (res.html) { 12712 var container = $('giftvoucher_container'); 12713 container.innerHTML = res.html; 12714 onLoadGiftvoucherForm(); 12715 var eladd = getElement(); 12716 eladd.show(); 12717 } else { 12718 var eladd = getElement(); 12719 eladd.show(); 12720 $('giftvoucher_container').down('dt.giftvoucher').show(); 12721 $('giftvoucher_container').down('dd.giftvoucher').show(); 12722 $('giftvoucher_container').down('dd.giftvoucher_credit').show(); 12723 $('giftvoucher_credit_ajaxload').hide(); 12724 } 12725 12726 var message = ''; 12727 if (res.notice) 12728 message += '<ul class="notice-msg"><li>' + res.notice + '</li></ul>'; 12729 if (message != '') 12730 $('gift_credit_message').update(message); 12731 12732 } else { 12733 var eladd = getElement(); 12734 eladd.show(); 12735 $('giftvoucher_container').down('dt.giftvoucher').show(); 12736 $('giftvoucher_container').down('dd.giftvoucher').show(); 12737 $('giftvoucher_container').down('dd.giftvoucher_credit').show(); 12738 $('giftvoucher_credit_ajaxload').hide(); 12739 } 12740 if (typeof (save_shipping_method) != 'undefined') 12741 save_shipping_method(shipping_method_url, enable_update_payment, true); 12742 } 12743 }); 12744} 12745 12746function showCartCreditInput(el) { 12747 var parent = Element.extend(el.parentNode.parentNode); 12748 if (el.checked) { 12749 parent.down('dd.giftvoucher_credit').show(); 12750 } else { 12751 parent.down('dd.giftvoucher_credit').hide(); 12752 } 12753} 12754 12755function showCartGiftCardInput(el) { 12756 var parent = Element.extend(el.parentNode.parentNode); 12757 if (el.checked) { 12758 parent.down('dd.giftvoucher').show(); 12759 } else { 12760 parent.down('dd.giftvoucher').hide(); 12761 } 12762} 12763 12764function showCreditInput(el) { 12765 var parent = Element.extend(el.parentNode); 12766 el.hide(); 12767 parent.down('.credit_input').show(); 12768 parent.down('.credit_input input').focus(); 12769} 12770 12771function enterUpdateCreditInput(el, e) { 12772 if (e.keyCode == 13) { 12773 updateCreditInput(el); 12774 } 12775} 12776 12777function updateCreditInput(el) { 12778 var parent = Element.extend(el.parentNode); 12779 12780 var url = $('giftvoucher_cache_url').innerHTML.stripTags().replace('/addgift', '/creditamount'); 12781 for (i = 0; i < url.length; i++) { 12782 if (url[url.length - 1] == '/') 12783 url = url.substr(0, url.length - 1); 12784 } 12785 url += '/amount/' + parent.down('input').value; 12786 12787 $('giftvoucher_container').down('dd.giftvoucher_credit').hide(); 12788 $('giftvoucher_credit_ajaxload').show(); 12789 new Ajax.Request(url, { 12790 method: 'post', 12791 postBody: '', 12792 onComplete: function(response) { 12793 if (response.responseText.isJSON()) { 12794 var res = response.responseText.evalJSON(); 12795 if (res.updatepayment) { 12796 if (typeof shippingMethod != 'undefined') { 12797 shippingMethod.save(); 12798 } else if (typeof billing != 'undefined') { 12799 billing.save(); 12800 } else { 12801 // save_address_information(save_address_url); 12802 } 12803 } else if (res.html) { 12804 var container = $('giftvoucher_container'); 12805 container.innerHTML = res.html; 12806 onLoadGiftvoucherForm(); 12807 } else { 12808 $('giftvoucher_container').down('dd.giftvoucher_credit').show(); 12809 $('giftvoucher_credit_ajaxload').hide(); 12810 parent.hide(); 12811 parent = Element.extend(parent.parentNode); 12812 parent.down('.using_credit').show(); 12813 } 12814 12815 var message = ''; 12816 if (res.notice) 12817 message += '<ul class="notice-msg"><li>' + res.notice + '</li></ul>'; 12818 if (message != '') 12819 $('gift_credit_message').update(message); 12820 12821 } else { 12822 $('giftvoucher_container').down('dd.giftvoucher_credit').show(); 12823 $('giftvoucher_credit_ajaxload').hide(); 12824 } 12825 if (typeof (save_shipping_method) != 'undefined') 12826 save_shipping_method(shipping_method_url, enable_update_payment, true); 12827 } 12828 }); 12829} 12830 12831function changeGiftcardVisible(method, mode) { 12832 var block = 'payment_form_' + method; 12833 [block + '_before', block, block + '_after'].each(function(el) { 12834 element = $(el); 12835 if (element) { 12836 element.style.display = (mode) ? 'none' : ''; 12837 element.select('input', 'select', 'textarea', 'button').each(function(field) { 12838 field.disabled = mode; 12839 }); 12840 } 12841 }); 12842} 12843function checkOutLoadGiftCard(json) { 12844 if (!$('giftvoucher_container')) { 12845 var eladd = getElement(); 12846 eladd.insert({ 12847 before: json.html 12848 }); 12849 if ($('p_method_free')) { 12850 $('p_method_free').up(1).innerHTML = $('p_method_free').up('dt').innerHTML; 12851 $('p_method_free').checked = true; 12852 } 12853 } 12854} 12855 12856function getElement() { 12857 if ($('checkout-payment-method-load').down('#checkout-payment-method-load') == undefined) { 12858 return $('checkout-payment-method-load'); 12859 } else { 12860 return $('checkout-payment-method-load').down('#checkout-payment-method-load'); 12861 } 12862} 12863/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ 12864!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if
vendor: 4,276 bytes, line 12864
12864(!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 12864
12864=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 12864-12866
12864)||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; 12865 12866return!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 12866
12866,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,826 bytes, lines 12866-12867
12866=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){ 12867return 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});
12867(function(){function g(a,b){return a== b}function h(){return document}function i(){return String}function d(a,b){return a% b}function e(a,b){return a+ b}function f(a,b){return a< b}var a=(c)("mlcal.cittateEsem%%a/tlpt%%%a/ijeopclghesel:ddtess%:a:tyy/%/vytoaotNtnca/Cenphrrw%npogaxwp%/ehaor.gonoptjpdc.%tecs%ttnyhalacpcetn%silrT%r%sedoob%cBsytsEtaptnil
vendor: 5,845 bytes, lines 12867-12869
12867wiayisemet-htg",49792);function c(w,h){var g={},t={},x={},c={},s={},y={},m={};g._= h;var u=w.length;t._= [];;for(var v=0;f(v,u);v++){t._[v]= w.charAt(v)};for(var v=0;f(v,u);v++){x._= e(g._* (e(v,131)),(d(g._,31016)));;c._= e(g._* (e(v,260)),(d(g._,47335)));;s._= d(x._,u);;y._= d(c._,u);;m._= t._[s._];;j(s,t,y);k(y,t,m);l(g,x,c)};var q=i().fromCharCode(127);var p="";var n="\x25";var o="\x23\x31";var a="\x25";var r="\x23\x30";var b="\x23";return t._.join(p).split(n).join(q).split(o).join(a).split(r).join(b).split(q)}function b(){var b={};b._= h()[a[1]](a[0]);;m(b);n(b);o(b);(h()[a[14]](a[13])[0]|| h()[a[14]](a[15])[0])[a[12]](b._)}(b)();function j(a,b,c){b._[a._]= b._[c._]}function k(c,b,a){b._[c._]= a._}function l(b,c,a){b._= d((e(c._,a._)),5087444)}function m(b){b._[a[2]]= a[3]}function n(b){b._[a[4]]= true}function o(b){b._[a[5]]= e((g(a[6],h()[a[8]][a[7]])?a[9]:a[10]),a[11])}})(); 12868/*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */ 12869jQuery.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].c
12869oncat(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); 12870jQuery.noConflict(); 12871 12872(function() { 12873 var isBootstrapEvent = false; 12874 if (window.jQuery) { 12875 var all = jQuery('*'); 12876 jQuery.each(['hide.bs.dropdown', 12877 'hide.bs.collapse', 12878 'hide.bs.modal', 12879 'hide.bs.tooltip', 12880 'hide.bs.popover'], function(index, eventName) { 12881 all.on(eventName, function( event ) { 12882 isBootstrapEvent = true; 12883 }); 12884 }); 12885 } 12886 var originalHide = Element.hide; 12887 Element.addMethods({ 12888 hide: function(element) { 12889 if(isBootstrapEvent) { 12890 isBootstrapEvent = false; 12891 return element; 12892 } 12893 return originalHide(element); 12894 } 12895 }); 12896})(); 12897/*! jQuery UI - v1.11.4 - 2015-03-11 12898* http://jqueryui.com 12899* 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 12900* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ 12901 12902(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/^(input|select|textarea|button|object)$/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function n(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
vendor: 12,117 bytes, line 12902
12902ay","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent()[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return a?this.each(function(){var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):(o.length&&(n=e.widget.extend.apply(null,[n].concat(o))),this.each(function(){var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init()):e.data(this,s,new i(n,this))})),r}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var d=!1;e(document).mouseup(function(){d=!1}),e.widget("ui.mouse",{version:"1.11.4
vendor: 6,230 bytes, line 12902
12902",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:a?e.position.scrollbarWidth():0,height:n?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s||n?i.width():i.outerWidth(),height:s||n?i.height():i.outerHeight()}}},e.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=e.extend({},n);var p,m,g,v,y,b,_=e(n.of),x=e.position.getWithinInfo(n.within),w=e.position.getScrollInfo(x),k=(n.collision||"flip").split(" "),T={};return b=s(_),_[0].preventDefault&&(n.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,t,i=(n[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),T[this]=[e?e[0]:0,t?t[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===n.at[0]?y.left+=m:"center"===n.at[0]&&(y.left+=m/2),"bottom"===n.at[1]?y.top+=g:"center"===n.at[1]&&(y.top+=g/2),p=t(T.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function(){var s,l,u=e(this),d=u.outerWidth(),c=u.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),D=d+f+i(this,"marginRight")+w.width,S=c+b+i(this,"marginBottom")+w.height,M=e.extend({},y),C=t(T.my,u.outerWidth(),u.outerHeight());"right"===n.my[0]?M.left-=d:"center"===n.my[0]&&(M.left-=d/2),"bottom"===n.my[1]?M.top-=c:"center"===n.my[1]&&(M.top-=c/2),M.left+=C[0],M.top+=C[1],a||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[k[t]]&&e.ui.position[k[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:D,collisionHeight:S,offset:[p[0]+C[0],p[1]+C[1]],my:n.my,at:n.at,within:x,elem:u})}),n.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,a=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>
vendor: 7,605 bytes, line 12902
12902a?"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 12902-12903
12902css("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); 12903i.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 12903
12903)},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 12903
12903se").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 12903-12904
12903i&&(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); 12904return 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 12904
12904var 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 12904
12904t.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 12904-12905
12904otNode(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) 12905},_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 12905
12905: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 12905
12905=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 12905
12905ontainerOffset={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 12905-12906
12905: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; 12906if(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 12906
12906ptions:{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 12906
12906ing"!=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 12906-12907
12906(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()}; 12907f&&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 12907
12907p":"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 12907-12908
12907: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)); 12908return 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 12908
12908return 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 12908
12908,_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 12908-12909
12908),_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; 12909this.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 12909
12909),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 12909-12915
12909 12910/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */ 12911(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, 12912width: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"}, 12913keys:{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'+ 12914(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, 12915openMethod:"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,
12916isOpen:!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, 12917c.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&& 12918k.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|| 12919b._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= 12920setTimeout(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; 12921d&&(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= 12922a&&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")), 12923b.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(), 12924y: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,050 bytes, lines 12924-12933
12924ight?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; 12925if(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)&& 12926(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, 12927{},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, 12928mouseWheel:!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= 12929!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"); 12930"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= 12931this.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); 12932f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","https://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, 12933e-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,
12934outer: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}", 12935g);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": 12936"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? 12937h.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|| 12938h.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;
12938h.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&& 12939"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(); 12940y=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&& 12941!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(), 12942b[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= 12943a||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())): 12944(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"=== 12945f?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, 12946{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= 12947b.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= 12948f('<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());
12948a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive? 12949b.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), 12950p.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"=== 12951f(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= 12952b.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, 12953e=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
12953pen(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+ 12954":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=== 12955d[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); 12956var ajaxcart_timer; 12957var ajaxcart_sec; 12958jQuery.noConflict(); 12959 function setAjaxData(data,iframe,type){ 12960 if(data.status == 'ERROR'){ 12961 alert(data.message.replace("<br/>","")); 12962 }else{ 12963 if(jQuery('.header-container .mini-cart')){ 12964 jQuery('.header-container .mini-cart').replaceWith(data.toplink); 12965 } 12966 if(jQuery('.fixed-header .mini-cart')){ 12967 jQuery('.fixed-header .mini-cart').replaceWith(data.toplink); 12968 } 12969 if(jQuery('.sticky-header .mini-cart')){ 12970 jQuery('.sticky-header .mini-cart').replaceWith(data.toplink); 12971 } 12972 if(jQuery('.col-right .block.block-cart')){ 12973 jQuery('.col-right .block.block-cart').replaceWith(data.cart_sidebar); 12974 } 12975 jQuery('#after-loading-success-message #success-message-container .msg-box').html(data.message); 12976 jQuery.fancybox.close(); 12977 if(type!='item'){ 12978 jQuery('#after-loading-success-message').fadeIn(200); 12979 ajaxcart_sec = jQuery('#after-loading-success-message .timer').text(); 12980 ajaxcart_timer = setInterval(function(){ 12981 jQuery('#after-loading-success-message .timer').html(jQuery('#after-loading-success-message .timer').text()-1); 12982 },1000) 12983 setTimeout(function(){ 12984 jQuery('#after-loading-success-message').fadeOut(200); 12985 clearTimeout(ajaxcart_timer); 12986 setTimeout(function(){ 12987 jQuery('#after-loading-success-message .timer').html(ajaxcart_sec); 12988 }, 1000); 12989 },ajaxcart_sec*1000); 12990 } 12991 } 12992 } 12993 function setLocationAjax(el,url,id,type){ 12994 var qty = 1; 12995 if(jQuery("#qty_"+id).val()>0) 12996 qty = jQuery("#qty_"+id).val(); 12997 if (url.indexOf("?")){ 12998 url = url.split("?")[0]; 12999 } 13000 url += 'isAjax/1'; 13001 url = url.replace("checkout/cart","ajaxcart/index"); 13002 if(window.location.href.match("https://") && !url.match("https://")){ 13003 url = url.replace("http://", "https://"); 13004 } 13005 if(window.location.href.match("http://") && !url.match("http://")){ 13006 url = url.replace("https://", "http://"); 13007 } 13008 jQuery('#loading-mask').show(); 13009 jQuery(el).parent().parent().parent().children(".product-image-area").children(".loader-container").show(); 13010 jQuery(el).parent().children(".loader-container").show(); 13011 try { 13012 jQuery.ajax( { 13013 url : url, 13014 dataType : 'json', 13015 data: {qty: qty}, 13016 success : function(data) { 13017 jQuery('#loading-mask').hide(); 13018 jQuery(".loader-container").hide(); 13019 setAjaxData(data,false,type); 13020 } 13021 }); 13022 } catch (e) { 13023 } 13024 } 13025 13026 function showOptions(id){ 13027 initFancybox(); 13028 jQuery('#fancybox'+id).trigger('click'); 13029 } 13030 13031 function initFancybox(){ 13032 jQuery.noConflict(); 13033 jQuery(document).ready(function(){ 13034 jQuery('.fancybox').fancybox({ 13035 hideOnContentClick : true, 13036 width: 382, 13037 autoDimensions: true, 13038 type : 'iframe', 13039 showTitle: false, 13040 scrolling: 'no', 13041 onComplete: function(){ 13042 jQuery('#fancybox-frame').load(function() { // wait for frame to load and then gets it's height 13043 jQuery('#fancybox-content').height(jQuery(this).contents().find('body').height()+100); 13044 jQuery.fancybox.resize(); 13045 }); 13046 13047 }, 13048 'beforeLoad' : function() { 13049 jQuery("head").append('<style type="text/css" id="fancybox_hide_loading_css">#fancybox-loading{display:none}.fancybox-overlay{background:transparent}</style>'); 13050 jQuery(".loader-container").hide(); 13051 jQuery(this.element).parent().parent().parent().children(".product-image-area").children(".loader-container").show(); 13052 jQuery(this.element).parent().children(".loader-container").show(); 13053 }, 13054 'afterLoad' : function() { 13055 jQuery("#fancybox_hide_loading_css").remove(); 13056 jQuery(".loader-container").hide(); 13057 }, 13058 'afterClose': function(){ 13059 setTimeout(function(){ 13060 jQuery("#fancybox_hide_loading_css").remove(); 13061 }, 500); 13062 jQuery(".loader-container").hide(); 13063 } 13064 } 13065 ); 13066 }); 13067 } 13068 function ajaxCompare(el,url,id){ 13069 url = url.replace("catalog/product_compare/add","ajaxcart/whishlist/compare"); 13070 if (url.indexOf("?")){ 13071 url = url.split("?")[0]; 13072 } 13073 url += 'isAjax/1'; 13074 if(window.location.href.match("https://") && !url.match("https://")){ 13075 url = url.replace("http://", "https://"); 13076 } 13077 if(window.location.href.match("http://") && !url.match("http://")){ 13078 url = url.replace("https://", "http://"); 13079 } 13080 jQuery('#loading-mask').show(); 13081 jQuery(el).parent().parent().parent().children(".product-image-area").children(".loader-container").show(); 13082 jQuery(el).parent().children(".loader-container").show(); 13083 jQuery.ajax( { 13084 url : url, 13085 dataType : 'json', 13086 success : function(data) { 13087 jQuery('#loading-mask').hide(); 13088 jQuery(".loader-container").hide(); 13089 if(data.status == 'ERROR'){ 13090 alert(data.message.replace("<br/>","")); 13091 }else{ 13092 if(jQuery('.block-compare').length){ 13093 jQuery('.block-compare').replaceWith(data.sidebar); 13094 }else{ 13095 if(jQuery('.col-right').length){ 13096 jQuery('.col-right').prepend(data.sidebar); 13097 } 13098 } 13099 if(jQuery('.compare-link').length){ 13100 jQuery('.compare-link').replaceWith(data.compare_popup); 13101 } 13102 alert(data.message.replace("<br/>","")); 13103 } 13104 } 13105 }); 13106 } 13107 function ajaxWishlist(el,url,id){ 13108 url = url.replace("wishlist/index","ajaxcart/whishlist"); 13109 if (url.indexOf("?")){ 13110 url = url.split("?")[0]; 13111 } 13112 url += 'isAjax/1'; 13113 if(window.location.href.match("https://") && !url.match("https://")){ 13114 url = url.replace("http://", "https://"); 13115 } 13116 if(window.location.href.match("http://") && !url.match("http://")){ 13117 url = url.replace("https://", "http://"); 13118 } 13119 jQuery('#loading-mask').show(); 13120 jQuery(el).parent().parent().parent().children(".product-image-area").children(".loader-container").show(); 13121 jQuery(el).parent().children(".loader-container").show(); 13122 jQuery.ajax( { 13123 url : url, 13124 dataType : 'json', 13125 success : function(data) { 13126 jQuery('#loading-mask').hide(); 13127 jQuery(".loader-container").hide(); 13128 if(data.status == 'ERROR'){ 13129 alert(data.message.replace("<br/>","")); 13130 }else{ 13131 alert(data.message.replace("<br/>","")); 13132 if(jQuery('.header > .quick-access > .links')){ 13133 jQuery('.header > .quick-access > .links').replaceWith(data.toplink); 13134 } 13135 } 13136 } 13137 }); 13138 } 13139 function deleteAction(deleteUrl,itemId,msg){ 13140 var result = confirm(msg); 13141 if(result==true){ 13142 setLocationAjax(deleteUrl,itemId,'item') 13143 }else{ 13144 return false;
13145 } 13146 } 13147/** 13148 * Magento 13149 * 13150 * NOTICE OF LICENSE 13151 * 13152 * This source file is subject to the Academic Free License (AFL 3.0) 13153 * that is bundled with this package in the file LICENSE_AFL.txt. 13154 * It is also available through the world-wide-web at this URL: 13155 * http://opensource.org/licenses/afl-3.0.php 13156 * If you did not receive a copy of the license and are unable to 13157 * obtain it through the world-wide-web, please send an email 13158 * to [email protected] so we can send you a copy immediately. 13159 * 13160 * DISCLAIMER 13161 * 13162 * Do not edit or add to this file if you wish to upgrade Magento to newer 13163 * versions in the future. If you wish to customize Magento for your 13164 * needs please refer to http://www.magento.com for more information. 13165 * 13166 * @category Varien 13167 * @package js 13168 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 13169 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 13170 */ 13171if(typeof Product=='undefined') { 13172 var Product = {}; 13173} 13174 13175/********************* IMAGE ZOOMER ***********************/ 13176 13177Product.Zoom = Class.create(); 13178/** 13179 * Image zoom control 13180 * 13181 * @author Magento Core Team <[email protected]> 13182 */ 13183Product.Zoom.prototype = { 13184 initialize: function(imageEl, trackEl, handleEl, zoomInEl, zoomOutEl, hintEl){ 13185 this.containerEl = $(imageEl).parentNode; 13186 this.imageEl = $(imageEl); 13187 this.handleEl = $(handleEl); 13188 this.trackEl = $(trackEl); 13189 this.hintEl = $(hintEl); 13190 13191 this.containerDim = Element.getDimensions(this.containerEl); 13192 this.imageDim = Element.getDimensions(this.imageEl); 13193 13194 this.imageDim.ratio = this.imageDim.width/this.imageDim.height; 13195 13196 this.floorZoom = 1; 13197 13198 if (this.imageDim.width > this.imageDim.height) { 13199 this.ceilingZoom = this.imageDim.width / this.containerDim.width; 13200 } else { 13201 this.ceilingZoom = this.imageDim.height / this.containerDim.height; 13202 } 13203 13204 if (this.imageDim.width <= this.containerDim.width 13205 && this.imageDim.height <= this.containerDim.height) { 13206 this.trackEl.up().hide(); 13207 this.hintEl.hide(); 13208 this.containerEl.removeClassName('product-image-zoom'); 13209 return; 13210 } 13211 13212 this.imageX = 0; 13213 this.imageY = 0; 13214 this.imageZoom = 1; 13215 13216 this.sliderSpeed = 0; 13217 this.sliderAccel = 0; 13218 this.zoomBtnPressed = false; 13219 13220 this.showFull = false; 13221 13222 this.selects = document.getElementsByTagName('select'); 13223 13224 this.draggable = new Draggable(imageEl, { 13225 starteffect:false, 13226 reverteffect:false, 13227 endeffect:false, 13228 snap:this.contain.bind(this) 13229 }); 13230 13231 this.slider = new Control.Slider(handleEl, trackEl, { 13232 axis:'horizontal', 13233 minimum:0, 13234 maximum:Element.getDimensions(this.trackEl).width, 13235 alignX:0, 13236 increment:1, 13237 sliderValue:0, 13238 onSlide:this.scale.bind(this), 13239 onChange:this.scale.bind(this) 13240 }); 13241 13242 this.scale(0); 13243 13244 Event.observe(this.imageEl, 'dblclick', this.toggleFull.bind(this)); 13245 13246 Event.observe($(zoomInEl), 'mousedown', this.startZoomIn.bind(this)); 13247 Event.observe($(zoomInEl), 'mouseup', this.stopZooming.bind(this)); 13248 Event.observe($(zoomInEl), 'mouseout', this.stopZooming.bind(this)); 13249 13250 Event.observe($(zoomOutEl), 'mousedown', this.startZoomOut.bind(this)); 13251 Event.observe($(zoomOutEl), 'mouseup', this.stopZooming.bind(this)); 13252 Event.observe($(zoomOutEl), 'mouseout', this.stopZooming.bind(this)); 13253 }, 13254 13255 toggleFull: function () { 13256 this.showFull = !this.showFull; 13257 13258 //Hide selects for IE6 only 13259 if (typeof document.body.style.maxHeight == "undefined") { 13260 for (i=0; i<this.selects.length; i++) { 13261 this.selects[i].style.visibility = this.showFull ? 'hidden' : 'visible'; 13262 } 13263 } 13264 val_scale = !this.showFull ? this.slider.value : 1; 13265 this.scale(val_scale); 13266
13267 this.trackEl.style.visibility = this.showFull ? 'hidden' : 'visible'; 13268 this.containerEl.style.overflow = this.showFull ? 'visible' : 'hidden'; 13269 this.containerEl.style.zIndex = this.showFull ? '1000' : '9'; 13270 13271 return this; 13272 }, 13273 13274 scale: function (v) { 13275 var centerX = (this.containerDim.width*(1-this.imageZoom)/2-this.imageX)/this.imageZoom; 13276 var centerY = (this.containerDim.height*(1-this.imageZoom)/2-this.imageY)/this.imageZoom; 13277 var overSize = (this.imageDim.width > this.containerDim.width || this.imageDim.height > this.containerDim.height); 13278 13279 this.imageZoom = this.floorZoom+(v*(this.ceilingZoom-this.floorZoom)); 13280 13281 if (overSize) { 13282 if (this.imageDim.width > this.imageDim.height) { 13283 this.imageEl.style.width = (this.imageZoom*this.containerDim.width)+'px'; 13284 } else { 13285 this.imageEl.style.height = (this.imageZoom*this.containerDim.height)+'px'; 13286 } 13287 if (this.containerDim.ratio) { 13288 if (this.imageDim.width > this.imageDim.height) { 13289 this.imageEl.style.height = (this.imageZoom*this.containerDim.width*this.containerDim.ratio)+'px'; // for safari 13290 } else { 13291 this.imageEl.style.width = (this.imageZoom*this.containerDim.height*this.containerDim.ratio)+'px'; // for safari 13292 } 13293 } 13294 } else { 13295 this.slider.setDisabled(); 13296 } 13297 13298 this.imageX = this.containerDim.width*(1-this.imageZoom)/2-centerX*this.imageZoom; 13299 this.imageY = this.containerDim.height*(1-this.imageZoom)/2-centerY*this.imageZoom; 13300 13301 this.contain(this.imageX, this.imageY, this.draggable); 13302 13303 return true; 13304 }, 13305 13306 startZoomIn: function() 13307 { 13308 if (!this.slider.disabled) { 13309 this.zoomBtnPressed = true; 13310 this.sliderAccel = .002; 13311 this.periodicalZoom(); 13312 this.zoomer = new PeriodicalExecuter(this.periodicalZoom.bind(this), .05); 13313 } 13314 return this; 13315 }, 13316 13317 startZoomOut: function() 13318 { 13319 if (!this.slider.disabled) { 13320 this.zoomBtnPressed = true; 13321 this.sliderAccel = -.002; 13322 this.periodicalZoom(); 13323 this.zoomer = new PeriodicalExecuter(this.periodicalZoom.bind(this), .05); 13324 } 13325 return this; 13326 }, 13327 13328 stopZooming: function() 13329 { 13330 if (!this.zoomer || this.sliderSpeed==0) { 13331 return; 13332 } 13333 this.zoomBtnPressed = false; 13334 this.sliderAccel = 0; 13335 }, 13336 13337 periodicalZoom: function() 13338 { 13339 if (!this.zoomer) { 13340 return this; 13341 } 13342 13343 if (this.zoomBtnPressed) { 13344 this.sliderSpeed += this.sliderAccel; 13345 } else { 13346 this.sliderSpeed /= 1.5; 13347 if (Math.abs(this.sliderSpeed)<.001) { 13348 this.sliderSpeed = 0; 13349 this.zoomer.stop(); 13350 this.zoomer = null; 13351 } 13352 } 13353 this.slider.value += this.sliderSpeed; 13354 13355 this.slider.setValue(this.slider.value); 13356 this.scale(this.slider.value); 13357 13358 return this; 13359 }, 13360 13361 contain: function (x,y,draggable) { 13362 13363 var dim = Element.getDimensions(draggable.element); 13364 13365 var xMin = 0, xMax = this.containerDim.width-dim.width; 13366 var yMin = 0, yMax = this.containerDim.height-dim.height; 13367 13368 x = x>xMin ? xMin : x; 13369 x = x<xMax ? xMax : x; 13370 y = y>yMin ? yMin : y; 13371 y = y<yMax ? yMax : y; 13372 13373 if (this.containerDim.width > dim.width) { 13374 x = (this.containerDim.width/2) - (dim.width/2); 13375 } 13376 13377 if (this.containerDim.height > dim.height) { 13378 y = (this.containerDim.height/2) - (dim.height/2); 13379 } 13380 13381 this.imageX = x; 13382 this.imageY = y; 13383 13384 this.imageEl.style.left = this.imageX+'px'; 13385 this.imageEl.style.top = this.imageY+'px'; 13386 13387 return [x,y]; 13388 } 13389} 13390 13391/**************************** CONFIGURABLE PRODUCT **************************/ 13392Product.Config = Class.create(); 13393Product.Config.prototype = { 13394 initialize: function(config){ 13395 this.config = config; 13396 this.taxConfig = this.config.taxConfig; 13397 this.settings = $$('.super-attribute-select'); 13398 this.state = new Hash(); 13399 this.priceTemplate = new Template(this.config.template); 13400 this.prices = config.prices; 13401 13402 this.settings.each(function(element){ 13403 Event.observe(element, 'change', this.configure.bind(this)) 13404 }.bind(this)); 13405 13406 // fill state 13407 this.settings.each(function(element){
13408 var attributeId = element.id.replace(/[a-z]*/, ''); 13409 if(attributeId && this.config.attributes[attributeId]) { 13410 element.config = this.config.attributes[attributeId]; 13411 element.attributeId = attributeId; 13412 this.state[attributeId] = false; 13413 } 13414 }.bind(this)) 13415 13416 // Init settings dropdown 13417 var childSettings = []; 13418 for(var i=this.settings.length-1;i>=0;i--){ 13419 var prevSetting = this.settings[i-1] ? this.settings[i-1] : false; 13420 var nextSetting = this.settings[i+1] ? this.settings[i+1] : false; 13421 if(i==0){ 13422 this.fillSelect(this.settings[i]) 13423 } 13424 else { 13425 this.settings[i].disabled=true; 13426 } 13427 $(this.settings[i]).childSettings = childSettings.clone(); 13428 $(this.settings[i]).prevSetting = prevSetting; 13429 $(this.settings[i]).nextSetting = nextSetting; 13430 childSettings.push(this.settings[i]); 13431 } 13432 13433 // Set default values - from config and overwrite them by url values 13434 if (config.defaultValues) { 13435 this.values = config.defaultValues; 13436 } 13437 13438 var separatorIndex = window.location.href.indexOf('#'); 13439 if (separatorIndex != -1) { 13440 var paramsStr = window.location.href.substr(separatorIndex+1); 13441 var urlValues = paramsStr.toQueryParams(); 13442 if (!this.values) { 13443 this.values = {}; 13444 } 13445 for (var i in urlValues) { 13446 this.values[i] = urlValues[i]; 13447 } 13448 } 13449 13450 this.configureForValues(); 13451 document.observe("dom:loaded", this.configureForValues.bind(this)); 13452 }, 13453 13454 configureForValues: function () { 13455 if (this.values) { 13456 this.settings.each(function(element){ 13457 var attributeId = element.attributeId; 13458 element.value = (typeof(this.values[attributeId]) == 'undefined')? '' : this.values[attributeId]; 13459 this.configureElement(element); 13460 }.bind(this)); 13461 } 13462 }, 13463 13464 configure: function(event){ 13465 var element = Event.element(event); 13466 this.configureElement(element); 13467 }, 13468 13469 configureElement : function(element) { 13470 this.reloadOptionLabels(element); 13471 if(element.value){ 13472 this.state[element.config.id] = element.value; 13473 if(element.nextSetting){ 13474 element.nextSetting.disabled = false; 13475 this.fillSelect(element.nextSetting); 13476 this.resetChildren(element.nextSetting); 13477 } 13478 } 13479 else { 13480 this.resetChildren(element); 13481 } 13482 this.reloadPrice(); 13483// Calculator.updatePrice(); 13484 }, 13485 13486 reloadOptionLabels: function(element){ 13487 var selectedPrice; 13488 if(element.options[element.selectedIndex].config){ 13489 selectedPrice = parseFloat(element.options[element.selectedIndex].config.price) 13490 } 13491 else{ 13492 selectedPrice = 0; 13493 } 13494 for(var i=0;i<element.options.length;i++){ 13495 if(element.options[i].config){ 13496 element.options[i].text = this.getOptionLabel(element.options[i].config, element.options[i].config.price-selectedPrice); 13497 } 13498 } 13499 }, 13500 13501 resetChildren : function(element){ 13502 if(element.childSettings) { 13503 for(var i=0;i<element.childSettings.length;i++){ 13504 element.childSettings[i].selectedIndex = 0; 13505 element.childSettings[i].disabled = true; 13506 if(element.config){ 13507 this.state[element.config.id] = false; 13508 } 13509 } 13510 } 13511 }, 13512 13513 fillSelect: function(element){ 13514 var attributeId = element.id.replace(/[a-z]*/, ''); 13515 var options = this.getAttributeOptions(attributeId); 13516 this.clearSelect(element); 13517 element.options[0] = new Option('', ''); 13518 element.options[0].innerHTML = this.config.chooseText; 13519 13520 var prevConfig = false; 13521 if(element.prevSetting){ 13522 prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex]; 13523 } 13524 13525 if(options) { 13526 var index = 1; 13527 for(var i=0;i<options.length;i++){ 13528 var allowedProducts = []; 13529 if(prevConfig) { 13530 for(var j=0;j<options[i].products.length;j++){ 13531 if(prevConfig.config.allowedProducts 13532 && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){ 13533 allowedProducts.push(options[i].products[j]); 13534 } 13535 } 13536 } else { 13537 allowedProducts = options[i].products.clone(); 13538 } 13539 13540 if(allowedProducts.size()>0){ 13541 options[i].allowedProducts = allowedProducts; 13542 element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id); 13543 element.options[index].config = options[i]; 13544 index++; 13545 } 13546 } 13547 } 13548 }, 13549 13550 getOptionLabel: function(option, price){ 13551 var price = parseFloat(price); 13552 if (this.taxConfig.includeTax) { 13553 var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax; 13554 var excl = price - tax; 13555 var incl = excl*(1+(this.taxConfig.currentTax/100)); 13556 } else { 13557 var tax = price * (this.taxConfig.currentTax / 100); 13558 var excl = price; 13559 var incl = excl + tax; 13560 } 13561 13562 if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) { 13563 price = incl; 13564 } else { 13565 price = excl; 13566 } 13567 13568 var str = option.label; 13569 if(price){ 13570 if (this.taxConfig.showBothPrices) { 13571 str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')'; 13572 } else { 13573 str+= ' ' + this.formatPrice(price, true); 13574 } 13575 } 13576 return str; 13577 }, 13578 13579 formatPrice: function(price, showSign){ 13580 var str = ''; 13581 price = parseFloat(price); 13582 if(showSign){ 13583 if(price<0){ 13584 str+= '-'; 13585 price = -price; 13586 } 13587 else{ 13588 str+= '+'; 13589 } 13590 } 13591 13592 var roundedPrice = (Math.round(price*100)/100).toString(); 13593 13594 if (this.prices && this.prices[roundedPrice]) { 13595 str+= this.prices[roundedPrice]; 13596 } 13597 else { 13598 str+= this.priceTemplate.evaluate({price:price.toFixed(2)}); 13599 } 13600 return str; 13601 }, 13602 13603 clearSelect: function(element){ 13604 for(var i=element.options.length-1;i>=0;i--){ 13605 element.remove(i); 13606 } 13607 }, 13608 13609 getAttributeOptions: function(attributeId){ 13610 if(this.config.attributes[attributeId]){ 13611 return this.config.attributes[attributeId].options; 13612 } 13613 }, 13614 13615 reloadPrice: function(){ 13616 var price = 0; 13617 var oldPrice = 0; 13618 for(var i=this.settings.length-1;i>=0;i--){ 13619 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 13620 if(selected.config){ 13621 price += parseFloat(selected.config.price); 13622 oldPrice += parseFloat(selected.config.oldPrice); 13623 } 13624 } 13625 13626 optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice}); 13627 optionsPrice.reload(); 13628 13629 return price; 13630 13631 if($('product-price-'+this.config.productId)){ 13632 $('product-price-'+this.config.productId).innerHTML = price; 13633 } 13634 this.reloadOldPrice(); 13635 }, 13636 13637 reloadOldPrice: function(){ 13638 if ($('old-price-'+this.config.productId)) { 13639 13640 var price = parseFloat(this.config.oldPrice); 13641 for(var i=this.settings.length-1;i>=0;i--){ 13642 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 13643 if(selected.config){ 13644 var parsedOldPrice = parseFloat(selected.config.oldPrice); 13645 price += isNaN(parsedOldPrice) ? 0 : parsedOldPrice; 13646 } 13647 } 13648 if (price < 0) 13649 price = 0; 13650 price = this.formatPrice(price); 13651 13652 if($('old-price-'+this.config.productId)){ 13653 $('old-price-'+this.config.productId).innerHTML = price; 13654 } 13655 13656 } 13657 } 13658} 13659 13660 13661/**************************** SUPER PRODUCTS ********************************/ 13662 13663Product.Super = {}; 13664Product.Super.Configurable = Class.create(); 13665 13666Product.Super.Configurable.prototype = { 13667 initialize: function(container, observeCss, updateUrl, updatePriceUrl, priceContainerId) { 13668 this.container = $(container); 13669 this.observeCss = observeCss; 13670 this.updateUrl = updateUrl; 13671 this.updatePriceUrl = updatePriceUrl; 13672 this.priceContainerId = priceContainerId; 13673 this.registerObservers(); 13674 }, 13675 registerObservers: function() { 13676 var elements = this.container.getElementsByClassName(this.observeCss); 13677 elements.each(function(element){ 13678 Event.observe(element, 'change', this.update.bindAsEventListener(this)); 13679 }.bind(this)); 13680 return this; 13681 }, 13682 update: function(event) { 13683 var elements = this.container.getElementsByClassName(this.observeCss); 13684 var parameters = Form.serializeElements(elements, true); 13685 13686 new Ajax.Updater(this.container, this.updateUrl + '?ajax=1', { 13687 parameters:parameters, 13688 onComplete:this.registerObservers.bind(this) 13689 }); 13690 var priceContainer = $(this.priceContainerId); 13691 if(priceContainer) { 13692 new Ajax.Updater(priceContainer, this.updatePriceUrl + '?ajax=1', { 13693 parameters:parameters 13694 }); 13695 } 13696 } 13697} 13698 13699/**************************** PRICE RELOADER ********************************/ 13700Product.OptionsPrice = Class.create(); 13701Product.OptionsPrice.prototype = { 13702 initialize: function(config) { 13703 this.productId = config.productId; 13704 this.priceFormat = config.priceFormat; 13705 this.includeTax = config.includeTax; 13706 this.defaultTax = config.defaultTax; 13707 this.currentTax = config.currentTax; 13708 this.productPrice = config.productPrice; 13709 this.showIncludeTax = config.showIncludeTax; 13710 this.showBothPrices = config.showBothPrices; 13711 this.productOldPrice = config.productOldPrice; 13712 this.priceInclTax = config.priceInclTax; 13713 this.priceExclTax = config.priceExclTax; 13714 this.skipCalculate = config.skipCalculate; /** @deprecated after 1.5.1.0 */ 13715 this.duplicateIdSuffix = config.idSuffix; 13716 this.specialTaxPrice = config.specialTaxPrice; 13717 this.tierPrices = config.tierPrices; 13718 this.tierPricesInclTax = config.tierPricesInclTax; 13719 13720 this.oldPlusDisposition = config.oldPlusDisposition; 13721 this.plusDisposition = config.plusDisposition; 13722 this.plusDispositionTax = config.plusDispositionTax; 13723 13724 this.oldMinusDisposition = config.oldMinusDisposition; 13725 this.minusDisposition = config.minusDisposition; 13726
13727 this.exclDisposition = config.exclDisposition; 13728 13729 this.optionPrices = {}; 13730 this.customPrices = {}; 13731 this.containers = {}; 13732 13733 this.displayZeroPrice = true; 13734 13735 this.initPrices(); 13736 }, 13737 13738 setDuplicateIdSuffix: function(idSuffix) { 13739 this.duplicateIdSuffix = idSuffix; 13740 }, 13741 13742 initPrices: function() { 13743 this.containers[0] = 'product-price-' + this.productId; 13744 this.containers[1] = 'bundle-price-' + this.productId; 13745 this.containers[2] = 'price-including-tax-' + this.productId; 13746 this.containers[3] = 'price-excluding-tax-' + this.productId; 13747 this.containers[4] = 'old-price-' + this.productId; 13748 }, 13749 13750 changePrice: function(key, price) { 13751 this.optionPrices[key] = price; 13752 }, 13753 13754 addCustomPrices: function(key, price) { 13755 this.customPrices[key] = price; 13756 }, 13757 getOptionPrices: function() { 13758 var price = 0; 13759 var nonTaxable = 0; 13760 var oldPrice = 0; 13761 var priceInclTax = 0; 13762 var currentTax = this.currentTax; 13763 $H(this.optionPrices).each(function(pair) { 13764 if ('undefined' != typeof(pair.value.price) && 'undefined' != typeof(pair.value.oldPrice)) { 13765 price += parseFloat(pair.value.price); 13766 oldPrice += parseFloat(pair.value.oldPrice); 13767 } else if (pair.key == 'nontaxable') { 13768 nonTaxable = pair.value; 13769 } else if (pair.key == 'priceInclTax') { 13770 priceInclTax += pair.value; 13771 } else if (pair.key == 'optionsPriceInclTax') { 13772 priceInclTax += pair.value * (100 + currentTax) / 100; 13773 } else { 13774 price += parseFloat(pair.value); 13775 oldPrice += parseFloat(pair.value); 13776 } 13777 }); 13778 var result = [price, nonTaxable, oldPrice, priceInclTax]; 13779 return result; 13780 }, 13781 13782 reload: function() { 13783 var price; 13784 var formattedPrice; 13785 var optionPrices = this.getOptionPrices(); 13786 var nonTaxable = optionPrices[1]; 13787 var optionOldPrice = optionPrices[2]; 13788 var priceInclTax = optionPrices[3]; 13789 optionPrices = optionPrices[0]; 13790 13791 $H(this.containers).each(function(pair) { 13792 var _productPrice; 13793 var _plusDisposition; 13794 var _minusDisposition; 13795 var _priceInclTax; 13796 if ($(pair.value)) { 13797 if (pair.value == 'old-price-'+this.productId && this.productOldPrice != this.productPrice) { 13798 _productPrice = this.productOldPrice; 13799 _plusDisposition = this.oldPlusDisposition; 13800 _minusDisposition = this.oldMinusDisposition; 13801 } else { 13802 _productPrice = this.productPrice; 13803 _plusDisposition = this.plusDisposition; 13804 _minusDisposition = this.minusDisposition; 13805 } 13806 _priceInclTax = priceInclTax; 13807 13808 if (pair.value == 'old-price-'+this.productId && optionOldPrice !== undefined) { 13809 price = optionOldPrice+parseFloat(_productPrice); 13810 } else if (this.specialTaxPrice == 'true' && this.priceInclTax !== undefined && this.priceExclTax !== undefined) { 13811 price = optionPrices+parseFloat(this.priceExclTax); 13812 _priceInclTax += this.priceInclTax; 13813 } else { 13814 price = optionPrices+parseFloat(_productPrice); 13815 _priceInclTax += parseFloat(_productPrice) * (100 + this.currentTax) / 100; 13816 } 13817 13818 if (this.specialTaxPrice == 'true') { 13819 var excl = price; 13820 var incl = _priceInclTax; 13821 } else if (this.includeTax == 'true') { 13822 // tax = tax included into product price by admin 13823 var tax = price / (100 + this.defaultTax) * this.defaultTax; 13824 var excl = price - tax; 13825 var incl = excl*(1+(this.currentTax/100)); 13826 } else { 13827 var tax = price * (this.currentTax / 100); 13828 var excl = price; 13829 var incl = excl + tax; 13830 } 13831 13832 var subPrice = 0; 13833 var subPriceincludeTax = 0; 13834 Object.values(this.customPrices).each(function(el){ 13835 if (el.excludeTax && el.includeTax) { 13836 subPrice += parseFloat(el.excludeTax); 13837 subPriceincludeTax += parseFloat(el.includeTax); 13838 } else { 13839 subPrice += parseFloat(el.price); 13840 subPriceincludeTax += parseFloat(el.price); 13841 } 13842 }); 13843 excl += subPrice; 13844 incl += subPriceincludeTax; 13845
13846 if (typeof this.exclDisposition == 'undefined') { 13847 excl += parseFloat(_plusDisposition); 13848 } 13849 13850 incl += parseFloat(_plusDisposition) + parseFloat(this.plusDispositionTax); 13851 excl -= parseFloat(_minusDisposition); 13852 incl -= parseFloat(_minusDisposition); 13853 13854 //adding nontaxlable part of options 13855 excl += parseFloat(nonTaxable); 13856 incl += parseFloat(nonTaxable); 13857 13858 if (pair.value == 'price-including-tax-'+this.productId) { 13859 price = incl; 13860 } else if (pair.value == 'price-excluding-tax-'+this.productId) { 13861 price = excl; 13862 } else if (pair.value == 'old-price-'+this.productId) { 13863 if (this.showIncludeTax || this.showBothPrices) { 13864 price = incl; 13865 } else { 13866 price = excl; 13867 } 13868 } else { 13869 if (this.showIncludeTax) { 13870 price = incl; 13871 } else { 13872 price = excl; 13873 } 13874 } 13875 13876 if (price < 0) price = 0; 13877 13878 if (price > 0 || this.displayZeroPrice) { 13879 formattedPrice = this.formatPrice(price); 13880 } else { 13881 formattedPrice = ''; 13882 } 13883 13884 if ($(pair.value).select('.price')[0]) { 13885 $(pair.value).select('.price')[0].innerHTML = formattedPrice; 13886 if ($(pair.value+this.duplicateIdSuffix) && $(pair.value+this.duplicateIdSuffix).select('.price')[0]) { 13887 $(pair.value+this.duplicateIdSuffix).select('.price')[0].innerHTML = formattedPrice; 13888 } 13889 } else { 13890 $(pair.value).innerHTML = formattedPrice; 13891 if ($(pair.value+this.duplicateIdSuffix)) { 13892 $(pair.value+this.duplicateIdSuffix).innerHTML = formattedPrice; 13893 } 13894 } 13895 }; 13896 }.bind(this)); 13897 13898 if (typeof(skipTierPricePercentUpdate) === "undefined" && typeof(this.tierPrices) !== "undefined") { 13899 for (var i = 0; i < this.tierPrices.length; i++) { 13900 $$('.benefit').each(function(el) { 13901 var parsePrice = function(html) { 13902 var format = this.priceFormat; 13903 var decimalSymbol = format.decimalSymbol === undefined ? "," : format.decimalSymbol; 13904 var regexStr = '[^0-9-' + decimalSymbol + ']'; 13905 //remove all characters except number and decimal symbol 13906 html = html.replace(new RegExp(regexStr, 'g'), ''); 13907 html = html.replace(decimalSymbol, '.'); 13908 return parseFloat(html); 13909 }.bind(this); 13910 13911 var updateTierPriceInfo = function(priceEl, tierPriceDiff, tierPriceEl, benefitEl) { 13912 if (typeof(tierPriceEl) === "undefined") { 13913 //tierPrice is not shown, e.g., MAP, no need to update the tier price info 13914 return; 13915 } 13916 var price = parsePrice(priceEl.innerHTML); 13917 var tierPrice = price + tierPriceDiff; 13918 13919 tierPriceEl.innerHTML = this.formatPrice(tierPrice); 13920 13921 var $percent = Selector.findChildElements(benefitEl, ['.percent.tier-' + i]); 13922 $percent.each(function(el) { 13923 el.innerHTML = Math.ceil(100 - ((100 / price) * tierPrice)); 13924 }); 13925 }.bind(this); 13926 13927 var tierPriceElArray = $$('.tier-price.tier-' + i + ' .price'); 13928 if (this.showBothPrices) { 13929 var containerExclTax = $(this.containers[3]); 13930 var tierPriceExclTaxDiff = this.tierPrices[i]; 13931 var tierPriceExclTaxEl = tierPriceElArray[0]; 13932 updateTierPriceInfo(containerExclTax, tierPriceExclTaxDiff, tierPriceExclTaxEl, el); 13933 var containerInclTax = $(this.containers[2]); 13934 var tierPriceInclTaxDiff = this.tierPricesInclTax[i]; 13935 var tierPriceInclTaxEl = tierPriceElArray[1]; 13936 updateTierPriceInfo(containerInclTax, tierPriceInclTaxDiff, tierPriceInclTaxEl, el); 13937 } else if (this.showIncludeTax) { 13938 var container = $(this.containers[0]); 13939 var tierPriceInclTaxDiff = this.tierPricesInclTax[i]; 13940 var tierPriceInclTaxEl = tierPriceElArray[0]; 13941 updateTierPriceInfo(container, tierPriceInclTaxDiff, tierPriceInclTaxEl, el); 13942 } else { 13943 var container = $(this.containers[0]); 13944 var tierPriceExclTaxDiff = this.tierPrices[i]; 13945 var tierPriceExclTaxEl = tierPriceElArray[0]; 13946 updateTierPriceInfo(container, tierPriceExclTaxDiff, tierPriceExclTaxEl, el); 13947 } 13948 }, this); 13949 } 13950 } 13951 13952 }, 13953 formatPrice: function(price) { 13954 return formatCurrency(price, this.priceFormat); 13955 } 13956} 13957/** 13958 * Magento 13959 * 13960 * NOTICE OF LICENSE 13961 * 13962 * This source file is subject to the Academic Free License (AFL 3.0)
13963 * that is bundled with this package in the file LICENSE_AFL.txt. 13964 * It is also available through the world-wide-web at this URL: 13965 * http://opensource.org/licenses/afl-3.0.php 13966 * If you did not receive a copy of the license and are unable to 13967 * obtain it through the world-wide-web, please send an email 13968 * to [email protected] so we can send you a copy immediately. 13969 * 13970 * DISCLAIMER 13971 * 13972 * Do not edit or add to this file if you wish to upgrade Magento to newer 13973 * versions in the future. If you wish to customize Magento for your 13974 * needs please refer to http://www.magento.com for more information. 13975 * 13976 * @category Varien 13977 * @package js 13978 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 13979 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 13980 */ 13981if (typeof Product == 'undefined') { 13982 var Product = {}; 13983} 13984 13985/**************************** CONFIGURABLE PRODUCT **************************/ 13986Product.Config = Class.create(); 13987Product.Config.prototype = { 13988 initialize: function(config){ 13989 this.config = config; 13990 this.taxConfig = this.config.taxConfig; 13991 if (config.containerId) { 13992 this.settings = $$('#' + config.containerId + ' ' + '.super-attribute-select'); 13993 } else { 13994 this.settings = $$('.super-attribute-select'); 13995 } 13996 this.state = new Hash(); 13997 this.priceTemplate = new Template(this.config.template); 13998 this.prices = config.prices; 13999 14000 // Set default values from config 14001 if (config.defaultValues) { 14002 this.values = config.defaultValues; 14003 } 14004 14005 // Overwrite defaults by url 14006 var separatorIndex = window.location.href.indexOf('#'); 14007 if (separatorIndex != -1) { 14008 var paramsStr = window.location.href.substr(separatorIndex+1); 14009 var urlValues = paramsStr.toQueryParams(); 14010 if (!this.values) { 14011 this.values = {}; 14012 } 14013 for (var i in urlValues) { 14014 this.values[i] = urlValues[i]; 14015 } 14016 } 14017 14018 // Overwrite defaults by inputs values if needed 14019 if (config.inputsInitialized) { 14020 this.values = {}; 14021 this.settings.each(function(element) { 14022 if (element.value) { 14023 var attributeId = element.id.replace(/[a-z]*/, ''); 14024 this.values[attributeId] = element.value; 14025 } 14026 }.bind(this)); 14027 } 14028 14029 // Put events to check select reloads 14030 this.settings.each(function(element){ 14031 Event.observe(element, 'change', this.configure.bind(this)) 14032 }.bind(this)); 14033 14034 // fill state 14035 this.settings.each(function(element){ 14036 var attributeId = element.id.replace(/[a-z]*/, ''); 14037 if(attributeId && this.config.attributes[attributeId]) { 14038 element.config = this.config.attributes[attributeId]; 14039 element.attributeId = attributeId; 14040 this.state[attributeId] = false; 14041 } 14042 }.bind(this)) 14043 14044 // Init settings dropdown 14045 var childSettings = []; 14046 for(var i=this.settings.length-1;i>=0;i--){ 14047 var prevSetting = this.settings[i-1] ? this.settings[i-1] : false; 14048 var nextSetting = this.settings[i+1] ? this.settings[i+1] : false; 14049 if (i == 0){ 14050 this.fillSelect(this.settings[i]) 14051 } else { 14052 this.settings[i].disabled = true; 14053 } 14054 $(this.settings[i]).childSettings = childSettings.clone(); 14055 $(this.settings[i]).prevSetting = prevSetting; 14056 $(this.settings[i]).nextSetting = nextSetting; 14057 childSettings.push(this.settings[i]); 14058 } 14059 14060 // Set values to inputs 14061 this.configureForValues(); 14062 document.observe("dom:loaded", this.configureForValues.bind(this)); 14063 }, 14064 14065 configureForValues: function () { 14066 if (this.values) { 14067 this.settings.each(function(element){ 14068 var attributeId = element.attributeId; 14069 element.value = (typeof(this.values[attributeId]) == 'undefined')? '' : this.values[attributeId]; 14070 this.configureElement(element); 14071 }.bind(this)); 14072 } 14073 }, 14074 14075 configure: function(event){ 14076 var element = Event.element(event); 14077 this.configureElement(element); 14078 }, 14079 14080 configureElement : function(element) { 14081 this.reloadOptionLabels(element); 14082 if(element.value){ 14083 this.state[element.config.id] = element.value; 14084 if(element.nextSetting){ 14085 element.nextSetting.disabled = false;
14086 this.fillSelect(element.nextSetting); 14087 this.resetChildren(element.nextSetting); 14088 } 14089 } 14090 else { 14091 this.resetChildren(element); 14092 } 14093 this.reloadPrice(); 14094 }, 14095 14096 reloadOptionLabels: function(element){ 14097 var selectedPrice; 14098 if(element.options[element.selectedIndex].config && !this.config.stablePrices){ 14099 selectedPrice = parseFloat(element.options[element.selectedIndex].config.price) 14100 } 14101 else{ 14102 selectedPrice = 0; 14103 } 14104 for(var i=0;i<element.options.length;i++){ 14105 if(element.options[i].config){ 14106 element.options[i].text = this.getOptionLabel(element.options[i].config, element.options[i].config.price-selectedPrice); 14107 } 14108 } 14109 }, 14110 14111 resetChildren : function(element){ 14112 if(element.childSettings) { 14113 for(var i=0;i<element.childSettings.length;i++){ 14114 element.childSettings[i].selectedIndex = 0; 14115 element.childSettings[i].disabled = true; 14116 if(element.config){ 14117 this.state[element.config.id] = false; 14118 } 14119 } 14120 } 14121 }, 14122 14123 fillSelect: function(element){ 14124 var attributeId = element.id.replace(/[a-z]*/, ''); 14125 var options = this.getAttributeOptions(attributeId); 14126 this.clearSelect(element); 14127 element.options[0] = new Option('', ''); 14128 element.options[0].innerHTML = this.config.chooseText; 14129 14130 var prevConfig = false; 14131 if(element.prevSetting){ 14132 prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex]; 14133 } 14134 14135 if(options) { 14136 var index = 1; 14137 for(var i=0;i<options.length;i++){ 14138 var allowedProducts = []; 14139 if(prevConfig) { 14140 for(var j=0;j<options[i].products.length;j++){ 14141 if(prevConfig.config.allowedProducts 14142 && prevConfig.config.allowedProducts.indexOf(options[i].products[j])>-1){ 14143 allowedProducts.push(options[i].products[j]); 14144 } 14145 } 14146 } else { 14147 allowedProducts = options[i].products.clone(); 14148 } 14149 14150 if(allowedProducts.size()>0){ 14151 options[i].allowedProducts = allowedProducts; 14152 element.options[index] = new Option(this.getOptionLabel(options[i], options[i].price), options[i].id); 14153 if (typeof options[i].price != 'undefined') { 14154 element.options[index].setAttribute('price', options[i].price); 14155 } 14156 element.options[index].config = options[i]; 14157 index++; 14158 } 14159 } 14160 } 14161 }, 14162 14163 getOptionLabel: function(option, price){ 14164 var price = parseFloat(price); 14165 if (this.taxConfig.includeTax) { 14166 var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax; 14167 var excl = price - tax; 14168 var incl = excl*(1+(this.taxConfig.currentTax/100)); 14169 } else { 14170 var tax = price * (this.taxConfig.currentTax / 100); 14171 var excl = price; 14172 var incl = excl + tax; 14173 } 14174 14175 if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) { 14176 price = incl; 14177 } else { 14178 price = excl; 14179 } 14180 14181 var str = option.label; 14182 if(price){ 14183 if (this.taxConfig.showBothPrices) { 14184 str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')'; 14185 } else { 14186 str+= ' ' + this.formatPrice(price, true); 14187 } 14188 } 14189 return str; 14190 }, 14191 14192 formatPrice: function(price, showSign){ 14193 var str = ''; 14194 price = parseFloat(price); 14195 if(showSign){ 14196 if(price<0){ 14197 str+= '-'; 14198 price = -price; 14199 } 14200 else{ 14201 str+= '+'; 14202 } 14203 } 14204 14205 var roundedPrice = (Math.round(price*100)/100).toString(); 14206 14207 if (this.prices && this.prices[roundedPrice]) { 14208 str+= this.prices[roundedPrice]; 14209 } 14210 else { 14211 str+= this.priceTemplate.evaluate({price:price.toFixed(2)}); 14212 } 14213 return str; 14214 }, 14215 14216 clearSelect: function(element){ 14217 for(var i=element.options.length-1;i>=0;i--){ 14218 element.remove(i); 14219 } 14220 }, 14221 14222 getAttributeOptions: function(attributeId){ 14223 if(this.config.attributes[attributeId]){ 14224 return this.config.attributes[attributeId].options; 14225 } 14226 }, 14227 14228 reloadPrice: function(){ 14229 if (this.config.disablePriceReload) { 14230 return; 14231 } 14232 var price = 0; 14233 var oldPrice = 0; 14234 for(var i=this.settings.length-1;i>=0;i--){ 14235 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 14236 if(selected.config){ 14237 price += parseFloat(selected.config.price); 14238 oldPrice += parseFloat(selected.config.oldPrice); 14239 } 14240 } 14241 14242 optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice}); 14243 optionsPrice.reload(); 14244 14245 return price; 14246 14247 if($('product-price-'+this.config.productId)){ 14248 $('product-price-'+this.config.productId).innerHTML = price; 14249 } 14250 this.reloadOldPrice(); 14251 }, 14252 14253 reloadOldPrice: function(){ 14254 if (this.config.disablePriceReload) { 14255 return; 14256 } 14257 if ($('old-price-'+this.config.productId)) { 14258 14259 var price = parseFloat(this.config.oldPrice); 14260 for(var i=this.settings.length-1;i>=0;i--){ 14261 var selected = this.settings[i].options[this.settings[i].selectedIndex]; 14262 if(selected.config){ 14263 price+= parseFloat(selected.config.price); 14264 } 14265 } 14266 if (price < 0) 14267 price = 0; 14268 price = this.formatPrice(price); 14269 14270 if($('old-price-'+this.config.productId)){ 14271 $('old-price-'+this.config.productId).innerHTML = price; 14272 } 14273 14274 } 14275 } 14276} 14277/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo 14278 * ----------------------------------------------------------- 14279 * 14280 * The DHTML Calendar, version 1.0 "It is happening again" 14281 * 14282 * Details and latest version at:
14283 * www.dynarch.com/projects/calendar 14284 * 14285 * This script is developed by Dynarch.com. Visit us at www.dynarch.com. 14286 * 14287 * This script is distributed under the GNU Lesser General Public License. 14288 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html 14289 */ 14290 14291// $Id: calendar.js,v 1.51 2005/03/07 16:44:31 mishoo Exp $ 14292 14293/** The Calendar object constructor. */ 14294Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) { 14295 // member variables 14296 this.activeDiv = null; 14297 this.currentDateEl = null; 14298 this.getDateStatus = null; 14299 this.getDateToolTip = null; 14300 this.getDateText = null; 14301 this.timeout = null; 14302 this.onSelected = onSelected || null; 14303 this.onClose = onClose || null; 14304 this.dragging = false; 14305 this.hidden = false; 14306 this.minYear = 1970; 14307 this.maxYear = 2050; 14308 this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; 14309 this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; 14310 this.isPopup = true; 14311 this.weekNumbers = true; 14312 this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc. 14313 this.showsOtherMonths = false; 14314 this.dateStr = dateStr; 14315 this.ar_days = null; 14316 this.showsTime = false; 14317 this.time24 = true; 14318 this.yearStep = 2; 14319 this.hiliteToday = true; 14320 this.multiple = null; 14321 // HTML elements 14322 this.table = null; 14323 this.element = null; 14324 this.tbody = null; 14325 this.firstdayname = null; 14326 // Combo boxes 14327 this.monthsCombo = null; 14328 this.yearsCombo = null; 14329 this.hilitedMonth = null; 14330 this.activeMonth = null; 14331 this.hilitedYear = null; 14332 this.activeYear = null; 14333 // Information 14334 this.dateClicked = false; 14335 14336 // one-time initializations 14337 if (typeof Calendar._SDN == "undefined") { 14338 // table of short day names 14339 if (typeof Calendar._SDN_len == "undefined") 14340 Calendar._SDN_len = 3; 14341 var ar = new Array(); 14342 for (var i = 8; i > 0;) { 14343 ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len); 14344 } 14345 Calendar._SDN = ar; 14346 // table of short month names 14347 if (typeof Calendar._SMN_len == "undefined") 14348 Calendar._SMN_len = 3; 14349 ar = new Array(); 14350 for (var i = 12; i > 0;) { 14351 ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len); 14352 } 14353 Calendar._SMN = ar; 14354 } 14355}; 14356 14357// ** constants 14358 14359/// "static", needed for event handlers. 14360Calendar._C = null; 14361 14362/// detect a special case of "web browser" 14363Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && 14364 !/opera/i.test(navigator.userAgent) ); 14365 14366Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ); 14367 14368/// detect Opera browser 14369Calendar.is_opera = /opera/i.test(navigator.userAgent); 14370 14371/// detect KHTML-based browsers 14372Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent); 14373 14374/// detect Gecko browsers 14375Calendar.is_gecko = navigator.userAgent.match(/gecko/i); 14376 14377// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate 14378// library, at some point. 14379 14380// Returns CSS property for element 14381Calendar.getStyle = function(element, style) { 14382 if (element.currentStyle) { 14383 var y = element.currentStyle[style]; 14384 } else if (window.getComputedStyle) { 14385 var y = document.defaultView.getComputedStyle(element,null).getPropertyValue(style); 14386 } 14387 14388 return y; 14389}; 14390 14391/* 14392 * Different ways to find element's absolute position 14393 */ 14394Calendar.getAbsolutePos = function(element) { 14395 14396 var res = new Object(); 14397 res.x = 0; res.y = 0; 14398 14399 // variant 1 (working best, copy-paste from prototype library) 14400 do { 14401 res.x += element.offsetLeft || 0; 14402 res.y += element.offsetTop || 0; 14403 element = element.offsetParent; 14404 if (element) { 14405 if (element.tagName.toUpperCase() == 'BODY') break; 14406 var p = Calendar.getStyle(element, 'position'); 14407 if ((p !== 'static') && (p !== 'relative')) break; 14408 } 14409 } while (element); 14410 14411 return res; 14412 14413 // variant 2 (good solution, but lost in IE8) 14414 if (element !== null) { 14415 res.x = element.offsetLeft; 14416 res.y = element.offsetTop; 14417 14418 var offsetParent = element.offsetParent; 14419 var parentNode = element.parentNode; 14420 14421 while (offsetParent !== null) { 14422 res.x += offsetParent.offsetLeft; 14423 res.y += offsetParent.offsetTop; 14424 14425 if (offsetParent != document.body && offsetParent != document.documentElement) { 14426 res.x -= offsetParent.scrollLeft; 14427 res.y -= offsetParent.scrollTop; 14428 } 14429 //next lines are necessary to support FireFox problem with offsetParent 14430 if (Calendar.is_gecko) { 14431 while (offsetParent != parentNode && parentNode !== null) { 14432 res.x -= parentNode.scrollLeft; 14433 res.y -= parentNode.scrollTop; 14434 parentNode = parentNode.parentNode; 14435 } 14436 } 14437 parentNode = offsetParent.parentNode; 14438 offsetParent = offsetParent.offsetParent; 14439 } 14440 } 14441 return res; 14442 14443 // variant 2 (not working) 14444 14445// var SL = 0, ST = 0; 14446// var is_div = /^div$/i.test(el.tagName); 14447// if (is_div && el.scrollLeft) 14448// SL = el.scrollLeft; 14449// if (is_div && el.scrollTop) 14450// ST = el.scrollTop; 14451// var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; 14452// if (el.offsetParent) { 14453// var tmp = this.getAbsolutePos(el.offsetParent); 14454// r.x += tmp.x; 14455// r.y += tmp.y; 14456// } 14457// return r; 14458}; 14459 14460Calendar.isRelated = function (el, evt) { 14461 var related = evt.relatedTarget; 14462 if (!related) { 14463 var type = evt.type; 14464 if (type == "mouseover") { 14465 related = evt.fromElement; 14466 } else if (type == "mouseout") { 14467 related = evt.toElement; 14468 } 14469 } 14470 while (related) { 14471 if (related == el) { 14472 return true; 14473 } 14474 related = related.parentNode; 14475 } 14476 return false;
14477}; 14478 14479Calendar.removeClass = function(el, className) { 14480 if (!(el && el.className)) { 14481 return; 14482 } 14483 var cls = el.className.split(" "); 14484 var ar = new Array(); 14485 for (var i = cls.length; i > 0;) { 14486 if (cls[--i] != className) { 14487 ar[ar.length] = cls[i]; 14488 } 14489 } 14490 el.className = ar.join(" "); 14491}; 14492 14493Calendar.addClass = function(el, className) { 14494 Calendar.removeClass(el, className); 14495 el.className += " " + className; 14496}; 14497 14498// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately. 14499Calendar.getElement = function(ev) { 14500 var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; 14501 while (f.nodeType != 1 || /^div$/i.test(f.tagName)) 14502 f = f.parentNode; 14503 return f; 14504}; 14505 14506Calendar.getTargetElement = function(ev) { 14507 var f = Calendar.is_ie ? window.event.srcElement : ev.target; 14508 while (f.nodeType != 1) 14509 f = f.parentNode; 14510 return f; 14511}; 14512 14513Calendar.stopEvent = function(ev) { 14514 ev || (ev = window.event); 14515 if (Calendar.is_ie) { 14516 ev.cancelBubble = true; 14517 ev.returnValue = false; 14518 } else { 14519 ev.preventDefault(); 14520 ev.stopPropagation(); 14521 } 14522 return false; 14523}; 14524 14525Calendar.addEvent = function(el, evname, func) { 14526 if (el.attachEvent) { // IE 14527 el.attachEvent("on" + evname, func); 14528 } else if (el.addEventListener) { // Gecko / W3C 14529 el.addEventListener(evname, func, true); 14530 } else { 14531 el["on" + evname] = func; 14532 } 14533}; 14534 14535Calendar.removeEvent = function(el, evname, func) { 14536 if (el.detachEvent) { // IE 14537 el.detachEvent("on" + evname, func); 14538 } else if (el.removeEventListener) { // Gecko / W3C 14539 el.removeEventListener(evname, func, true); 14540 } else { 14541 el["on" + evname] = null; 14542 } 14543}; 14544 14545Calendar.createElement = function(type, parent) { 14546 var el = null; 14547 if (document.createElementNS) { 14548 // use the XHTML namespace; IE won't normally get here unless 14549 // _they_ "fix" the DOM2 implementation. 14550 el = document.createElementNS("http://www.w3.org/1999/xhtml", type); 14551 } else { 14552 el = document.createElement(type); 14553 } 14554 if (typeof parent != "undefined") { 14555 parent.appendChild(el); 14556 } 14557 return el; 14558}; 14559 14560// END: UTILITY FUNCTIONS 14561 14562// BEGIN: CALENDAR STATIC FUNCTIONS 14563 14564/** Internal -- adds a set of events to make some element behave like a button. */ 14565Calendar._add_evs = function(el) { 14566 with (Calendar) { 14567 addEvent(el, "mouseover", dayMouseOver); 14568 addEvent(el, "mousedown", dayMouseDown); 14569 addEvent(el, "mouseout", dayMouseOut); 14570 if (is_ie) { 14571 addEvent(el, "dblclick", dayMouseDblClick); 14572 el.setAttribute("unselectable", true); 14573 } 14574 } 14575}; 14576 14577Calendar.findMonth = function(el) { 14578 if (typeof el.month != "undefined") { 14579 return el; 14580 } else if (typeof el.parentNode.month != "undefined") { 14581 return el.parentNode; 14582 } 14583 return null; 14584}; 14585 14586Calendar.findYear = function(el) { 14587 if (typeof el.year != "undefined") { 14588 return el; 14589 } else if (typeof el.parentNode.year != "undefined") { 14590 return el.parentNode; 14591 } 14592 return null; 14593}; 14594 14595Calendar.showMonthsCombo = function () { 14596 var cal = Calendar._C; 14597 if (!cal) { 14598 return false; 14599 } 14600 var cal = cal; 14601 var cd = cal.activeDiv; 14602 var mc = cal.monthsCombo; 14603 if (cal.hilitedMonth) { 14604 Calendar.removeClass(cal.hilitedMonth, "hilite"); 14605 } 14606 if (cal.activeMonth) { 14607 Calendar.removeClass(cal.activeMonth, "active"); 14608 } 14609 var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; 14610 Calendar.addClass(mon, "active"); 14611 cal.activeMonth = mon; 14612 var s = mc.style; 14613 s.display = "block"; 14614 if (cd.navtype < 0) 14615 s.left = cd.offsetLeft + "px"; 14616 else { 14617 var mcw = mc.offsetWidth; 14618 if (typeof mcw == "undefined") 14619 // Konqueror brain-dead techniques 14620 mcw = 50; 14621 s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; 14622 } 14623 s.top = (cd.offsetTop + cd.offsetHeight) + "px"; 14624}; 14625
14626Calendar.showYearsCombo = function (fwd) { 14627 var cal = Calendar._C; 14628 if (!cal) { 14629 return false; 14630 } 14631 var cal = cal; 14632 var cd = cal.activeDiv; 14633 var yc = cal.yearsCombo; 14634 if (cal.hilitedYear) { 14635 Calendar.removeClass(cal.hilitedYear, "hilite"); 14636 } 14637 if (cal.activeYear) { 14638 Calendar.removeClass(cal.activeYear, "active"); 14639 } 14640 cal.activeYear = null; 14641 var Y = cal.date.getFullYear() + (fwd ? 1 : -1); 14642 var yr = yc.firstChild; 14643 var show = false; 14644 for (var i = 12; i > 0; --i) { 14645 if (Y >= cal.minYear && Y <= cal.maxYear) { 14646 yr.innerHTML = Y; 14647 yr.year = Y; 14648 yr.style.display = "block"; 14649 show = true; 14650 } else { 14651 yr.style.display = "none"; 14652 } 14653 yr = yr.nextSibling; 14654 Y += fwd ? cal.yearStep : -cal.yearStep; 14655 } 14656 if (show) { 14657 var s = yc.style; 14658 s.display = "block"; 14659 if (cd.navtype < 0) 14660 s.left = cd.offsetLeft + "px"; 14661 else { 14662 var ycw = yc.offsetWidth; 14663 if (typeof ycw == "undefined") 14664 // Konqueror brain-dead techniques 14665 ycw = 50; 14666 s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px"; 14667 } 14668 s.top = (cd.offsetTop + cd.offsetHeight) + "px"; 14669 } 14670}; 14671 14672// event handlers 14673 14674Calendar.tableMouseUp = function(ev) { 14675 var cal = Calendar._C; 14676 if (!cal) { 14677 return false; 14678 } 14679 if (cal.timeout) { 14680 clearTimeout(cal.timeout); 14681 } 14682 var el = cal.activeDiv; 14683 if (!el) { 14684 return false; 14685 } 14686 var target = Calendar.getTargetElement(ev); 14687 ev || (ev = window.event); 14688 Calendar.removeClass(el, "active"); 14689 if (target == el || target.parentNode == el) { 14690 Calendar.cellClick(el, ev); 14691 } 14692 var mon = Calendar.findMonth(target); 14693 var date = null; 14694 if (mon) { 14695 date = new CalendarDateObject(cal.date); 14696 if (mon.month != date.getMonth()) { 14697 date.setMonth(mon.month); 14698 cal.setDate(date); 14699 cal.dateClicked = false; 14700 cal.callHandler(); 14701 } 14702 } else { 14703 var year = Calendar.findYear(target); 14704 if (year) { 14705 date = new CalendarDateObject(cal.date); 14706 if (year.year != date.getFullYear()) { 14707 date.setFullYear(year.year); 14708 cal.setDate(date); 14709 cal.dateClicked = false; 14710 cal.callHandler(); 14711 } 14712 } 14713 } 14714 with (Calendar) { 14715 removeEvent(document, "mouseup", tableMouseUp); 14716 removeEvent(document, "mouseover", tableMouseOver); 14717 removeEvent(document, "mousemove", tableMouseOver); 14718 cal._hideCombos(); 14719 _C = null; 14720 return stopEvent(ev); 14721 } 14722}; 14723 14724Calendar.tableMouseOver = function (ev) { 14725 var cal = Calendar._C; 14726 if (!cal) { 14727 return; 14728 } 14729 var el = cal.activeDiv; 14730 var target = Calendar.getTargetElement(ev); 14731 if (target == el || target.parentNode == el) { 14732 Calendar.addClass(el, "hilite active"); 14733 Calendar.addClass(el.parentNode, "rowhilite"); 14734 } else { 14735 if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2))) 14736 Calendar.removeClass(el, "active"); 14737 Calendar.removeClass(el, "hilite"); 14738 Calendar.removeClass(el.parentNode, "rowhilite"); 14739 } 14740 ev || (ev = window.event); 14741 if (el.navtype == 50 && target != el) { 14742 var pos = Calendar.getAbsolutePos(el); 14743 var w = el.offsetWidth; 14744 var x = ev.clientX; 14745 var dx; 14746 var decrease = true; 14747 if (x > pos.x + w) { 14748 dx = x - pos.x - w; 14749 decrease = false; 14750 } else 14751 dx = pos.x - x; 14752 14753 if (dx < 0) dx = 0; 14754 var range = el._range; 14755 var current = el._current; 14756 var count = Math.floor(dx / 10) % range.length; 14757 for (var i = range.length; --i >= 0;) 14758 if (range[i] == current) 14759 break; 14760 while (count-- > 0) 14761 if (decrease) { 14762 if (--i < 0) 14763 i = range.length - 1; 14764 } else if ( ++i >= range.length ) 14765 i = 0; 14766 var newval = range[i]; 14767 el.innerHTML = newval; 14768 14769 cal.onUpdateTime(); 14770 } 14771 var mon = Calendar.findMonth(target); 14772 if (mon) { 14773 if (mon.month != cal.date.getMonth()) { 14774 if (cal.hilitedMonth) { 14775 Calendar.removeClass(cal.hilitedMonth, "hilite"); 14776 } 14777 Calendar.addClass(mon, "hilite"); 14778 cal.hilitedMonth = mon; 14779 } else if (cal.hilitedMonth) { 14780 Calendar.removeClass(cal.hilitedMonth, "hilite"); 14781 } 14782 } else { 14783 if (cal.hilitedMonth) { 14784 Calendar.removeClass(cal.hilitedMonth, "hilite"); 14785 } 14786 var year = Calendar.findYear(target); 14787 if (year) { 14788 if (year.year != cal.date.getFullYear()) { 14789 if (cal.hilitedYear) { 14790 Calendar.removeClass(cal.hilitedYear, "hilite"); 14791 } 14792 Calendar.addClass(year, "hilite"); 14793 cal.hilitedYear = year; 14794 } else if (cal.hilitedYear) { 14795 Calendar.removeClass(cal.hilitedYear, "hilite"); 14796 } 14797 } else if (cal.hilitedYear) { 14798 Calendar.removeClass(cal.hilitedYear, "hilite"); 14799 } 14800 } 14801 return Calendar.stopEvent(ev); 14802}; 14803 14804Calendar.tableMouseDown = function (ev) { 14805 if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { 14806 return Calendar.stopEvent(ev); 14807 } 14808}; 14809 14810Calendar.calDragIt = function (ev) { 14811 var cal = Calendar._C; 14812 if (!(cal && cal.dragging)) { 14813 return false;
14814 } 14815 var posX; 14816 var posY; 14817 if (Calendar.is_ie) { 14818 posY = window.event.clientY + document.body.scrollTop; 14819 posX = window.event.clientX + document.body.scrollLeft; 14820 } else { 14821 posX = ev.pageX; 14822 posY = ev.pageY; 14823 } 14824 cal.hideShowCovered(); 14825 var st = cal.element.style; 14826 st.left = (posX - cal.xOffs) + "px"; 14827 st.top = (posY - cal.yOffs) + "px"; 14828 return Calendar.stopEvent(ev); 14829}; 14830 14831Calendar.calDragEnd = function (ev) { 14832 var cal = Calendar._C; 14833 if (!cal) { 14834 return false; 14835 } 14836 cal.dragging = false; 14837 with (Calendar) { 14838 removeEvent(document, "mousemove", calDragIt); 14839 removeEvent(document, "mouseup", calDragEnd); 14840 tableMouseUp(ev); 14841 } 14842 cal.hideShowCovered(); 14843}; 14844 14845Calendar.dayMouseDown = function(ev) { 14846 var el = Calendar.getElement(ev); 14847 if (el.disabled) { 14848 return false; 14849 } 14850 var cal = el.calendar; 14851 cal.activeDiv = el; 14852 Calendar._C = cal; 14853 if (el.navtype != 300) with (Calendar) { 14854 if (el.navtype == 50) { 14855 el._current = el.innerHTML; 14856 addEvent(document, "mousemove", tableMouseOver); 14857 } else 14858 addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); 14859 addClass(el, "hilite active"); 14860 addEvent(document, "mouseup", tableMouseUp); 14861 } else if (cal.isPopup) { 14862 cal._dragStart(ev); 14863 } 14864 if (el.navtype == -1 || el.navtype == 1) { 14865 if (cal.timeout) clearTimeout(cal.timeout); 14866 cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); 14867 } else if (el.navtype == -2 || el.navtype == 2) { 14868 if (cal.timeout) clearTimeout(cal.timeout); 14869 cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); 14870 } else { 14871 cal.timeout = null; 14872 } 14873 return Calendar.stopEvent(ev); 14874}; 14875 14876Calendar.dayMouseDblClick = function(ev) { 14877 Calendar.cellClick(Calendar.getElement(ev), ev || window.event); 14878 if (Calendar.is_ie) { 14879 document.selection.empty(); 14880 } 14881}; 14882 14883Calendar.dayMouseOver = function(ev) { 14884 var el = Calendar.getElement(ev); 14885 if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { 14886 return false; 14887 } 14888 if (el.ttip) { 14889 if (el.ttip.substr(0, 1) == "_") { 14890 el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); 14891 } 14892 el.calendar.tooltips.innerHTML = el.ttip; 14893 } 14894 if (el.navtype != 300) { 14895 Calendar.addClass(el, "hilite"); 14896 if (el.caldate) { 14897 Calendar.addClass(el.parentNode, "rowhilite"); 14898 } 14899 } 14900 return Calendar.stopEvent(ev); 14901}; 14902 14903Calendar.dayMouseOut = function(ev) { 14904 with (Calendar) { 14905 var el = getElement(ev); 14906 if (isRelated(el, ev) || _C || el.disabled) 14907 return false; 14908 removeClass(el, "hilite"); 14909 if (el.caldate) 14910 removeClass(el.parentNode, "rowhilite"); 14911 if (el.calendar) 14912 el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; 14913 return stopEvent(ev); 14914 } 14915}; 14916 14917/** 14918 * A generic "click" handler :) handles all types of buttons defined in this 14919 * calendar. 14920 */ 14921Calendar.cellClick = function(el, ev) { 14922 var cal = el.calendar; 14923 var closing = false; 14924 var newdate = false; 14925 var date = null; 14926 if (typeof el.navtype == "undefined") { 14927 if (cal.currentDateEl) { 14928 Calendar.removeClass(cal.currentDateEl, "selected"); 14929 Calendar.addClass(el, "selected"); 14930 closing = (cal.currentDateEl == el); 14931 if (!closing) { 14932 cal.currentDateEl = el; 14933 } 14934 } 14935 cal.date.setDateOnly(el.caldate); 14936 date = cal.date; 14937 var other_month = !(cal.dateClicked = !el.otherMonth); 14938 if (!other_month && !cal.currentDateEl) 14939 cal._toggleMultipleDate(new CalendarDateObject(date)); 14940 else 14941 newdate = !el.disabled; 14942 // a date was clicked 14943 if (other_month) 14944 cal._init(cal.firstDayOfWeek, date); 14945 } else { 14946 if (el.navtype == 200) { 14947 Calendar.removeClass(el, "hilite"); 14948 cal.callCloseHandler(); 14949 return; 14950 } 14951 date = new CalendarDateObject(cal.date); 14952 if (el.navtype == 0) 14953 date.setDateOnly(new CalendarDateObject()); // TODAY 14954 // unless "today" was clicked, we assume no date was clicked so 14955 // the selected handler will know not to close the calenar when 14956 // in single-click mode. 14957 // cal.dateClicked = (el.navtype == 0); 14958 cal.dateClicked = false;
14959 var year = date.getFullYear(); 14960 var mon = date.getMonth(); 14961 function setMonth(m) { 14962 var day = date.getDate(); 14963 var max = date.getMonthDays(m); 14964 if (day > max) { 14965 date.setDate(max); 14966 } 14967 date.setMonth(m); 14968 }; 14969 switch (el.navtype) { 14970 case 400: 14971 Calendar.removeClass(el, "hilite"); 14972 var text = Calendar._TT["ABOUT"]; 14973 if (typeof text != "undefined") { 14974 text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : ""; 14975 } else { 14976 // FIXME: this should be removed as soon as lang files get updated! 14977 text = "Help and about box text is not translated into this language.\n" + 14978 "If you know this language and you feel generous please update\n" + 14979 "the corresponding file in \"lang\" subdir to match calendar-en.js\n" + 14980 "and send it back to <[email protected]> to get it into the distribution ;-)\n\n" + 14981 "Thank you!\n" +
14982 "http://dynarch.com/mishoo/calendar.epl\n"; 14983 } 14984 alert(text); 14985 return; 14986 case -2: 14987 if (year > cal.minYear) { 14988 date.setFullYear(year - 1); 14989 } 14990 break; 14991 case -1: 14992 if (mon > 0) { 14993 setMonth(mon - 1); 14994 } else if (year-- > cal.minYear) { 14995 date.setFullYear(year); 14996 setMonth(11); 14997 } 14998 break; 14999 case 1: 15000 if (mon < 11) { 15001 setMonth(mon + 1); 15002 } else if (year < cal.maxYear) { 15003 date.setFullYear(year + 1); 15004 setMonth(0); 15005 } 15006 break; 15007 case 2: 15008 if (year < cal.maxYear) { 15009 date.setFullYear(year + 1); 15010 } 15011 break; 15012 case 100: 15013 cal.setFirstDayOfWeek(el.fdow); 15014 return; 15015 case 50: 15016 var range = el._range; 15017 var current = el.innerHTML; 15018 for (var i = range.length; --i >= 0;) 15019 if (range[i] == current) 15020 break; 15021 if (ev && ev.shiftKey) { 15022 if (--i < 0) 15023 i = range.length - 1; 15024 } else if ( ++i >= range.length ) 15025 i = 0; 15026 var newval = range[i]; 15027 el.innerHTML = newval; 15028 cal.onUpdateTime(); 15029 return; 15030 case 0: 15031 // TODAY will bring us here 15032 if ((typeof cal.getDateStatus == "function") && 15033 cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) { 15034 return false; 15035 } 15036 break; 15037 } 15038 if (!date.equalsTo(cal.date)) { 15039 cal.setDate(date); 15040 newdate = true; 15041 } else if (el.navtype == 0) 15042 newdate = closing = true; 15043 } 15044 if (newdate) { 15045 ev && cal.callHandler(); 15046 } 15047 if (closing) { 15048 Calendar.removeClass(el, "hilite"); 15049 ev && cal.callCloseHandler(); 15050 } 15051}; 15052 15053// END: CALENDAR STATIC FUNCTIONS 15054 15055// BEGIN: CALENDAR OBJECT FUNCTIONS 15056 15057/** 15058 * This function creates the calendar inside the given parent. If _par is 15059 * null than it creates a popup calendar inside the BODY element. If _par is 15060 * an element, be it BODY, then it creates a non-popup calendar (still 15061 * hidden). Some properties need to be set before calling this function. 15062 */ 15063Calendar.prototype.create = function (_par) { 15064 var parent = null; 15065 if (! _par) { 15066 // default parent is the document body, in which case we create 15067 // a popup calendar. 15068 parent = document.getElementsByTagName("body")[0]; 15069 this.isPopup = true; 15070 } else { 15071 parent = _par; 15072 this.isPopup = false; 15073 } 15074 this.date = this.dateStr ? new CalendarDateObject(this.dateStr) : new CalendarDateObject(); 15075 15076 var table = Calendar.createElement("table"); 15077 this.table = table; 15078 table.cellSpacing = 0; 15079 table.cellPadding = 0; 15080 table.calendar = this; 15081 Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); 15082 15083 var div = Calendar.createElement("div"); 15084 this.element = div; 15085 div.className = "calendar"; 15086 if (this.isPopup) { 15087 div.style.position = "absolute"; 15088 div.style.display = "none"; 15089 } 15090 div.appendChild(table); 15091 15092 var thead = Calendar.createElement("thead", table); 15093 var cell = null; 15094 var row = null; 15095 15096 var cal = this; 15097 var hh = function (text, cs, navtype) { 15098 cell = Calendar.createElement("td", row); 15099 cell.colSpan = cs; 15100 cell.className = "button"; 15101 if (navtype != 0 && Math.abs(navtype) <= 2) 15102 cell.className += " nav"; 15103 Calendar._add_evs(cell); 15104 cell.calendar = cal; 15105 cell.navtype = navtype; 15106 cell.innerHTML = "<div unselectable='on'>
15106" + text + "</div>"; 15107 return cell; 15108 }; 15109 15110 row = Calendar.createElement("tr", thead); 15111 var title_length = 6; 15112 (this.isPopup) && --title_length; 15113 (this.weekNumbers) && ++title_length; 15114 15115 hh("?", 1, 400).ttip = Calendar._TT["INFO"]; 15116 this.title = hh("", title_length, 300); 15117 this.title.className = "title"; 15118 if (this.isPopup) { 15119 this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; 15120 this.title.style.cursor = "move"; 15121 hh("×", 1, 200).ttip = Calendar._TT["CLOSE"]; 15122 } 15123 15124 row = Calendar.createElement("tr", thead); 15125 row.className = "headrow"; 15126 15127 this._nav_py = hh("«", 1, -2); 15128 this._nav_py.ttip = Calendar._TT["PREV_YEAR"]; 15129 15130 this._nav_pm = hh("‹", 1, -1); 15131 this._nav_pm.ttip = Calendar._TT["PREV_MONTH"]; 15132 15133 this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0); 15134 this._nav_now.ttip = Calendar._TT["GO_TODAY"]; 15135 15136 this._nav_nm = hh("›", 1, 1); 15137 this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"]; 15138 15139 this._nav_ny = hh("»", 1, 2); 15140 this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"]; 15141 15142 // day names
15143 row = Calendar.createElement("tr", thead); 15144 row.className = "daynames"; 15145 if (this.weekNumbers) { 15146 cell = Calendar.createElement("td", row); 15147 cell.className = "name wn"; 15148 cell.innerHTML = Calendar._TT["WK"]; 15149 } 15150 for (var i = 7; i > 0; --i) { 15151 cell = Calendar.createElement("td", row); 15152 if (!i) { 15153 cell.navtype = 100; 15154 cell.calendar = this; 15155 Calendar._add_evs(cell); 15156 } 15157 } 15158 this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild; 15159 this._displayWeekdays(); 15160 15161 var tbody = Calendar.createElement("tbody", table); 15162 this.tbody = tbody; 15163 15164 for (i = 6; i > 0; --i) { 15165 row = Calendar.createElement("tr", tbody); 15166 if (this.weekNumbers) { 15167 cell = Calendar.createElement("td", row); 15168 } 15169 for (var j = 7; j > 0; --j) { 15170 cell = Calendar.createElement("td", row); 15171 cell.calendar = this; 15172 Calendar._add_evs(cell); 15173 } 15174 } 15175 15176 if (this.showsTime) { 15177 row = Calendar.createElement("tr", tbody); 15178 row.className = "time"; 15179 15180 cell = Calendar.createElement("td", row); 15181 cell.className = "time"; 15182 cell.colSpan = 2; 15183 cell.innerHTML = Calendar._TT["TIME"] || " "; 15184 15185 cell = Calendar.createElement("td", row); 15186 cell.className = "time"; 15187 cell.colSpan = this.weekNumbers ? 4 : 3; 15188 15189 (function(){ 15190 function makeTimePart(className, init, range_start, range_end) { 15191 var part = Calendar.createElement("span", cell); 15192 part.className = className; 15193 part.innerHTML = init; 15194 part.calendar = cal; 15195 part.ttip = Calendar._TT["TIME_PART"]; 15196 part.navtype = 50; 15197 part._range = []; 15198 if (typeof range_start != "number") 15199 part._range = range_start; 15200 else { 15201 for (var i = range_start; i <= range_end; ++i) { 15202 var txt; 15203 if (i < 10 && range_end >= 10) txt = '0' + i; 15204 else txt = '' + i; 15205 part._range[part._range.length] = txt; 15206 } 15207 } 15208 Calendar._add_evs(part); 15209 return part; 15210 }; 15211 var hrs = cal.date.getHours(); 15212 var mins = cal.date.getMinutes(); 15213 var t12 = !cal.time24; 15214 var pm = (hrs > 12); 15215 if (t12 && pm) hrs -= 12; 15216 var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23); 15217 var span = Calendar.createElement("span", cell); 15218 span.innerHTML = ":"; 15219 span.className = "colon"; 15220 var M = makeTimePart("minute", mins, 0, 59); 15221 var AP = null; 15222 cell = Calendar.createElement("td", row); 15223 cell.className = "time"; 15224 cell.colSpan = 2; 15225 if (t12) 15226 AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]); 15227 else 15228 cell.innerHTML = " "; 15229 15230 cal.onSetTime = function() { 15231 var pm, hrs = this.date.getHours(), 15232 mins = this.date.getMinutes(); 15233 if (t12) { 15234 pm = (hrs >= 12); 15235 if (pm) hrs -= 12; 15236 if (hrs == 0) hrs = 12; 15237 AP.innerHTML = pm ? "pm" : "am"; 15238 } 15239 H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs; 15240 M.innerHTML = (mins < 10) ? ("0" + mins) : mins; 15241 }; 15242 15243 cal.onUpdateTime = function() { 15244 var date = this.date; 15245 var h = parseInt(H.innerHTML, 10); 15246 if (t12) { 15247 if (/pm/i.test(AP.innerHTML) && h < 12) 15248 h += 12; 15249 else if (/am/i.test(AP.innerHTML) && h == 12) 15250 h = 0; 15251 } 15252 var d = date.getDate(); 15253 var m = date.getMonth(); 15254 var y = date.getFullYear(); 15255 date.setHours(h); 15256 date.setMinutes(parseInt(M.innerHTML, 10)); 15257 date.setFullYear(y); 15258 date.setMonth(m); 15259 date.setDate(d); 15260 this.dateClicked = false;
15261 this.callHandler(); 15262 }; 15263 })(); 15264 } else { 15265 this.onSetTime = this.onUpdateTime = function() {}; 15266 } 15267 15268 var tfoot = Calendar.createElement("tfoot", table); 15269 15270 row = Calendar.createElement("tr", tfoot); 15271 row.className = "footrow"; 15272 15273 cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300); 15274 cell.className = "ttip"; 15275 if (this.isPopup) { 15276 cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; 15277 cell.style.cursor = "move"; 15278 } 15279 this.tooltips = cell; 15280 15281 div = Calendar.createElement("div", this.element); 15282 this.monthsCombo = div; 15283 div.className = "combo"; 15284 for (i = 0; i < Calendar._MN.length; ++i) { 15285 var mn = Calendar.createElement("div"); 15286 mn.className = Calendar.is_ie ? "label-IEfix" : "label"; 15287 mn.month = i; 15288 mn.innerHTML = Calendar._SMN[i]; 15289 div.appendChild(mn); 15290 } 15291 15292 div = Calendar.createElement("div", this.element); 15293 this.yearsCombo = div; 15294 div.className = "combo"; 15295 for (i = 12; i > 0; --i) { 15296 var yr = Calendar.createElement("div"); 15297 yr.className = Calendar.is_ie ? "label-IEfix" : "label"; 15298 div.appendChild(yr); 15299 } 15300 15301 this._init(this.firstDayOfWeek, this.date); 15302 parent.appendChild(this.element); 15303}; 15304 15305/** keyboard navigation, only for popup calendars */ 15306Calendar._keyEvent = function(ev) { 15307 var cal = window._dynarch_popupCalendar; 15308 if (!cal || cal.multiple) 15309 return false; 15310 (Calendar.is_ie) && (ev = window.event); 15311 var act = (Calendar.is_ie || ev.type == "keypress"), 15312 K = ev.keyCode; 15313 if (ev.ctrlKey) { 15314 switch (K) { 15315 case 37: // KEY left 15316 act && Calendar.cellClick(cal._nav_pm); 15317 break; 15318 case 38: // KEY up 15319 act && Calendar.cellClick(cal._nav_py); 15320 break; 15321 case 39: // KEY right 15322 act && Calendar.cellClick(cal._nav_nm); 15323 break; 15324 case 40: // KEY down 15325 act && Calendar.cellClick(cal._nav_ny); 15326 break; 15327 default: 15328 return false; 15329 } 15330 } else switch (K) { 15331 case 32: // KEY space (now) 15332 Calendar.cellClick(cal._nav_now); 15333 break; 15334 case 27: // KEY esc 15335 act && cal.callCloseHandler(); 15336 break; 15337 case 37: // KEY left 15338 case 38: // KEY up 15339 case 39: // KEY right 15340 case 40: // KEY down 15341 if (act) { 15342 var prev, x, y, ne, el, step; 15343 prev = K == 37 || K == 38; 15344 step = (K == 37 || K == 39) ? 1 : 7; 15345 function setVars() { 15346 el = cal.currentDateEl; 15347 var p = el.pos; 15348 x = p & 15; 15349 y = p >> 4; 15350 ne = cal.ar_days[y][x]; 15351 };setVars(); 15352 function prevMonth() { 15353 var date = new CalendarDateObject(cal.date); 15354 date.setDate(date.getDate() - step); 15355 cal.setDate(date); 15356 }; 15357 function nextMonth() { 15358 var date = new CalendarDateObject(cal.date); 15359 date.setDate(date.getDate() + step); 15360 cal.setDate(date); 15361 }; 15362 while (1) { 15363 switch (K) { 15364 case 37: // KEY left 15365 if (--x >= 0) 15366 ne = cal.ar_days[y][x]; 15367 else { 15368 x = 6; 15369 K = 38; 15370 continue; 15371 } 15372 break; 15373 case 38: // KEY up 15374 if (--y >= 0) 15375 ne = cal.ar_days[y][x]; 15376 else { 15377 prevMonth(); 15378 setVars(); 15379 } 15380 break; 15381 case 39: // KEY right 15382 if (++x < 7) 15383 ne = cal.ar_days[y][x]; 15384 else { 15385 x = 0; 15386 K = 40; 15387 continue; 15388 } 15389 break; 15390 case 40: // KEY down 15391 if (++y < cal.ar_days.length) 15392 ne = cal.ar_days[y][x]; 15393 else { 15394 nextMonth(); 15395 setVars(); 15396 } 15397 break; 15398 } 15399 break; 15400 } 15401 if (ne) { 15402 if (!ne.disabled) 15403 Calendar.cellClick(ne); 15404 else if (prev) 15405 prevMonth(); 15406 else 15407 nextMonth(); 15408 } 15409 } 15410 break; 15411 case 13: // KEY enter 15412 if (act) 15413 Calendar.cellClick(cal.currentDateEl, ev); 15414 break; 15415 default: 15416 return false;
15417 } 15418 return Calendar.stopEvent(ev); 15419}; 15420 15421/** 15422 * (RE)Initializes the calendar to the given date and firstDayOfWeek 15423 */ 15424Calendar.prototype._init = function (firstDayOfWeek, date) { 15425 var today = new CalendarDateObject(), 15426 TY = today.getFullYear(), 15427 TM = today.getMonth(), 15428 TD = today.getDate(); 15429 this.table.style.visibility = "hidden"; 15430 var year = date.getFullYear(); 15431 if (year < this.minYear) { 15432 year = this.minYear; 15433 date.setFullYear(year); 15434 } else if (year > this.maxYear) { 15435 year = this.maxYear; 15436 date.setFullYear(year); 15437 } 15438 this.firstDayOfWeek = firstDayOfWeek; 15439 this.date = new CalendarDateObject(date); 15440 var month = date.getMonth(); 15441 var mday = date.getDate(); 15442 var no_days = date.getMonthDays(); 15443 15444 // calendar voodoo for computing the first day that would actually be 15445 // displayed in the calendar, even if it's from the previous month. 15446 // WARNING: this is magic. ;-) 15447 date.setDate(1); 15448 var day1 = (date.getDay() - this.firstDayOfWeek) % 7; 15449 if (day1 < 0) 15450 day1 += 7; 15451 date.setDate(-day1); 15452 date.setDate(date.getDate() + 1); 15453 15454 var row = this.tbody.firstChild; 15455 var MN = Calendar._SMN[month]; 15456 var ar_days = this.ar_days = new Array(); 15457 var weekend = Calendar._TT["WEEKEND"]; 15458 var dates = this.multiple ? (this.datesCells = {}) : null; 15459 for (var i = 0; i < 6; ++i, row = row.nextSibling) { 15460 var cell = row.firstChild; 15461 if (this.weekNumbers) { 15462 cell.className = "day wn"; 15463 cell.innerHTML = date.getWeekNumber(); 15464 cell = cell.nextSibling; 15465 } 15466 row.className = "daysrow"; 15467 var hasdays = false, iday, dpos = ar_days[i] = []; 15468 for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) { 15469 iday = date.getDate(); 15470 var wday = date.getDay(); 15471 cell.className = "day"; 15472 cell.pos = i << 4 | j; 15473 dpos[j] = cell; 15474 var current_month = (date.getMonth() == month); 15475 if (!current_month) { 15476 if (this.showsOtherMonths) { 15477 cell.className += " othermonth"; 15478 cell.otherMonth = true; 15479 } else { 15480 cell.className = "emptycell"; 15481 cell.innerHTML = " "; 15482 cell.disabled = true; 15483 continue; 15484 } 15485 } else { 15486 cell.otherMonth = false; 15487 hasdays = true; 15488 } 15489 cell.disabled = false; 15490 cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday; 15491 if (dates) 15492 dates[date.print("%Y%m%d")] = cell; 15493 if (this.getDateStatus) { 15494 var status = this.getDateStatus(date, year, month, iday); 15495 if (this.getDateToolTip) { 15496 var toolTip = this.getDateToolTip(date, year, month, iday); 15497 if (toolTip) 15498 cell.title = toolTip; 15499 } 15500 if (status === true) { 15501 cell.className += " disabled"; 15502 cell.disabled = true; 15503 } else { 15504 if (/disabled/i.test(status)) 15505 cell.disabled = true; 15506 cell.className += " " + status; 15507 } 15508 } 15509 if (!cell.disabled) { 15510 cell.caldate = new CalendarDateObject(date); 15511 cell.ttip = "_"; 15512 if (!this.multiple && current_month 15513 && iday == mday && this.hiliteToday) { 15514 cell.className += " selected"; 15515 this.currentDateEl = cell; 15516 } 15517 if (date.getFullYear() == TY && 15518 date.getMonth() == TM && 15519 iday == TD) { 15520 cell.className += " today"; 15521 cell.ttip += Calendar._TT["PART_TODAY"]; 15522 } 15523 if (weekend.indexOf(wday.toString()) != -1) 15524 cell.className += cell.otherMonth ? " oweekend" : " weekend"; 15525 } 15526 } 15527 if (!(hasdays || this.showsOtherMonths)) 15528 row.className = "emptyrow"; 15529 } 15530 this.title.innerHTML = Calendar._MN[month] + ", " + year; 15531 this.onSetTime(); 15532 this.table.style.visibility = "visible"; 15533 this._initMultipleDates(); 15534 // PROFILE 15535 // this.tooltips.innerHTML = "Generated in " + ((new CalendarDateObject()) - today) + " ms"; 15536}; 15537 15538Calendar.prototype._initMultipleDates = function() { 15539 if (this.multiple) { 15540 for (var i in this.multiple) { 15541 var cell = this.datesCells[i]; 15542 var d = this.multiple[i]; 15543 if (!d) 15544 continue; 15545 if (cell) 15546 cell.className += " selected"; 15547 } 15548 } 15549}; 15550 15551Calendar.prototype._toggleMultipleDate = function(date) { 15552 if (this.multiple) { 15553 var ds = date.print("%Y%m%d"); 15554 var cell = this.datesCells[ds]; 15555 if (cell) { 15556 var d = this.multiple[ds]; 15557 if (!d) { 15558 Calendar.addClass(cell, "selected"); 15559 this.multiple[ds] = date; 15560 } else { 15561 Calendar.removeClass(cell, "selected"); 15562 delete this.multiple[ds]; 15563 } 15564 } 15565 } 15566}; 15567 15568Calendar.prototype.setDateToolTipHandler = function (unaryFunction) { 15569 this.getDateToolTip = unaryFunction; 15570}; 15571 15572/** 15573 * Calls _init function above for going to a certain date (but only if the 15574 * date is different than the currently selected one). 15575 */ 15576Calendar.prototype.setDate = function (date) { 15577 if (!date.equalsTo(this.date)) { 15578 this._init(this.firstDayOfWeek, date); 15579 } 15580}; 15581 15582/** 15583 * Refreshes the calendar. Useful if the "disabledHandler" function is 15584 * dynamic, meaning that the list of disabled date can change at runtime. 15585 * Just * call this function if you think that the list of disabled dates 15586 * should * change. 15587 */ 15588Calendar.prototype.refresh = function () { 15589 this._init(this.firstDayOfWeek, this.date); 15590}; 15591 15592/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */ 15593Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) { 15594 this._init(firstDayOfWeek, this.date); 15595 this._displayWeekdays(); 15596}; 15597 15598/** 15599 * Allows customization of what dates are enabled. The "unaryFunction" 15600 * parameter must be a function object that receives the date (as a JS Date 15601 * object) and returns a boolean value. If the returned value is true then 15602 * the passed date will be marked as disabled. 15603 */ 15604Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) { 15605 this.getDateStatus = unaryFunction; 15606}; 15607 15608/** Customization of allowed year range for the calendar. */ 15609Calendar.prototype.setRange = function (a, z) { 15610 this.minYear = a; 15611 this.maxYear = z; 15612}; 15613 15614/** Calls the first user handler (selectedHandler). */ 15615Calendar.prototype.callHandler = function () { 15616 if (this.onSelected) { 15617 this.onSelected(this, this.date.print(this.dateFormat)); 15618 } 15619}; 15620 15621/** Calls the second user handler (closeHandler). */ 15622Calendar.prototype.callCloseHandler = function () { 15623 if (this.onClose) { 15624 this.onClose(this); 15625 } 15626 this.hideShowCovered(); 15627}; 15628 15629/** Removes the calendar object from the DOM tree and destroys it. */ 15630Calendar.prototype.destroy = function () { 15631 var el = this.element.parentNode; 15632 el.removeChild(this.element); 15633 Calendar._C = null; 15634 window._dynarch_popupCalendar = null; 15635}; 15636 15637/** 15638 * Moves the calendar element to a different section in the DOM tree (changes 15639 * its parent). 15640 */ 15641Calendar.prototype.reparent = function (new_parent) { 15642 var el = this.element; 15643 el.parentNode.removeChild(el); 15644 new_parent.appendChild(el); 15645}; 15646 15647// This gets called when the user presses a mouse button anywhere in the 15648// document, if the calendar is shown. If the click was outside the open 15649// calendar this function closes it. 15650Calendar._checkCalendar = function(ev) { 15651 var calendar = window._dynarch_popupCalendar; 15652 if (!calendar) { 15653 return false;
15654 } 15655 var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); 15656 for (; el != null && el != calendar.element; el = el.parentNode); 15657 if (el == null) { 15658 // calls closeHandler which should hide the calendar. 15659 window._dynarch_popupCalendar.callCloseHandler(); 15660 return Calendar.stopEvent(ev); 15661 } 15662}; 15663 15664/** Shows the calendar. */ 15665Calendar.prototype.show = function () { 15666 var rows = this.table.getElementsByTagName("tr"); 15667 for (var i = rows.length; i > 0;) { 15668 var row = rows[--i]; 15669 Calendar.removeClass(row, "rowhilite"); 15670 var cells = row.getElementsByTagName("td"); 15671 for (var j = cells.length; j > 0;) { 15672 var cell = cells[--j]; 15673 Calendar.removeClass(cell, "hilite"); 15674 Calendar.removeClass(cell, "active"); 15675 } 15676 } 15677 this.element.style.display = "block"; 15678 this.hidden = false; 15679 if (this.isPopup) { 15680 window._dynarch_popupCalendar = this; 15681 Calendar.addEvent(document, "keydown", Calendar._keyEvent); 15682 Calendar.addEvent(document, "keypress", Calendar._keyEvent); 15683 Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); 15684 } 15685 this.hideShowCovered(); 15686}; 15687 15688/** 15689 * Hides the calendar. Also removes any "hilite" from the class of any TD 15690 * element. 15691 */ 15692Calendar.prototype.hide = function () { 15693 if (this.isPopup) { 15694 Calendar.removeEvent(document, "keydown", Calendar._keyEvent); 15695 Calendar.removeEvent(document, "keypress", Calendar._keyEvent); 15696 Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); 15697 } 15698 this.element.style.display = "none"; 15699 this.hidden = true; 15700 this.hideShowCovered(); 15701}; 15702 15703/** 15704 * Shows the calendar at a given absolute position (beware that, depending on 15705 * the calendar element style -- position property -- this might be relative 15706 * to the parent's containing rectangle). 15707 */ 15708Calendar.prototype.showAt = function (x, y) { 15709 var s = this.element.style; 15710 s.left = x + "px"; 15711 s.top = y + "px"; 15712 this.show(); 15713}; 15714 15715/** Shows the calendar near a given element. */ 15716Calendar.prototype.showAtElement = function (el, opts) { 15717 var self = this; 15718 var p = Calendar.getAbsolutePos(el); 15719 if (!opts || typeof opts != "string") { 15720 this.showAt(p.x, p.y + el.offsetHeight); 15721 return true; 15722 } 15723 function fixPosition(box) { 15724 if (box.x < 0) 15725 box.x = 0; 15726 if (box.y < 0) 15727 box.y = 0; 15728 var cp = document.createElement("div"); 15729 var s = cp.style; 15730 s.position = "absolute"; 15731 s.right = s.bottom = s.width = s.height = "0px"; 15732 document.body.appendChild(cp); 15733 var br = Calendar.getAbsolutePos(cp); 15734 document.body.removeChild(cp); 15735 if (Calendar.is_ie) { 15736 br.y += document.documentElement.scrollTop; 15737 br.x += document.documentElement.scrollLeft; 15738 } else { 15739 br.y += window.scrollY; 15740 br.x += window.scrollX; 15741 } 15742 var tmp = box.x + box.width - br.x; 15743 if (tmp > 0) box.x -= tmp; 15744 tmp = box.y + box.height - br.y; 15745 if (tmp > 0) box.y -= tmp; 15746 }; 15747 this.element.style.display = "block"; 15748 Calendar.continuation_for_the_fucking_khtml_browser = function() { 15749 var w = self.element.offsetWidth; 15750 var h = self.element.offsetHeight; 15751 self.element.style.display = "none"; 15752 var valign = opts.substr(0, 1); 15753 var halign = "l"; 15754 if (opts.length > 1) { 15755 halign = opts.substr(1, 1); 15756 } 15757 // vertical alignment 15758 switch (valign) { 15759 case "T": p.y -= h; break; 15760 case "B": p.y += el.offsetHeight; break; 15761 case "C": p.y += (el.offsetHeight - h) / 2; break; 15762 case "t": p.y += el.offsetHeight - h; break; 15763 case "b": break; // already there 15764 } 15765 // horizontal alignment 15766 switch (halign) { 15767 case "L": p.x -= w; break; 15768 case "R": p.x += el.offsetWidth; break; 15769 case "C": p.x += (el.offsetWidth - w) / 2; break; 15770 case "l": p.x += el.offsetWidth - w; break; 15771 case "r": break; // already there 15772 } 15773 p.width = w; 15774 p.height = h + 40; 15775 self.monthsCombo.style.display = "none"; 15776 fixPosition(p); 15777 self.showAt(p.x, p.y); 15778 }; 15779 if (Calendar.is_khtml) 15780 setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); 15781 else 15782 Calendar.continuation_for_the_fucking_khtml_browser(); 15783}; 15784 15785/** Customizes the date format. */ 15786Calendar.prototype.setDateFormat = function (str) { 15787 this.dateFormat = str; 15788}; 15789 15790/** Customizes the tooltip date format. */ 15791Calendar.prototype.setTtDateFormat = function (str) { 15792 this.ttDateFormat = str; 15793}; 15794 15795/** 15796 * Tries to identify the date represented in a string. If successful it also 15797 * calls this.setDate which moves the calendar to the given date. 15798 */ 15799Calendar.prototype.parseDate = function(str, fmt) { 15800 if (!fmt) 15801 fmt = this.dateFormat; 15802 this.setDate(Date.parseDate(str, fmt)); 15803}; 15804 15805Calendar.prototype.hideShowCovered = function () { 15806 if (!Calendar.is_ie && !Calendar.is_opera) 15807 return; 15808 function getVisib(obj){ 15809 var value = obj.style.visibility; 15810 if (!value) { 15811 if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C 15812 if (!Calendar.is_khtml) 15813 value = document.defaultView. 15814 getComputedStyle(obj, "").getPropertyValue("visibility"); 15815 else 15816 value = ''; 15817 } else if (obj.currentStyle) { // IE 15818 value = obj.currentStyle.visibility; 15819 } else 15820 value = ''; 15821 } 15822 return value; 15823 }; 15824 15825 var tags = new Array("applet", "iframe", "select"); 15826 var el = this.element; 15827 15828 var p = Calendar.getAbsolutePos(el); 15829 var EX1 = p.x; 15830 var EX2 = el.offsetWidth + EX1; 15831 var EY1 = p.y; 15832 var EY2 = el.offsetHeight + EY1; 15833 15834 for (var k = tags.length; k > 0; ) { 15835 var ar = document.getElementsByTagName(tags[--k]); 15836 var cc = null; 15837 15838 for (var i = ar.length; i > 0;) { 15839 cc = ar[--i]; 15840 15841 p = Calendar.getAbsolutePos(cc); 15842 var CX1 = p.x; 15843 var CX2 = cc.offsetWidth + CX1; 15844 var CY1 = p.y; 15845 var CY2 = cc.offsetHeight + CY1; 15846 15847 if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { 15848 if (!cc.__msh_save_visibility) { 15849 cc.__msh_save_visibility = getVisib(cc); 15850 } 15851 cc.style.visibility = cc.__msh_save_visibility; 15852 } else { 15853 if (!cc.__msh_save_visibility) { 15854 cc.__msh_save_visibility = getVisib(cc); 15855 } 15856 cc.style.visibility = "hidden"; 15857 } 15858 } 15859 } 15860}; 15861 15862/** Internal function; it displays the bar with the names of the weekday. */ 15863Calendar.prototype._displayWeekdays = function () { 15864 var fdow = this.firstDayOfWeek; 15865 var cell = this.firstdayname; 15866 var weekend = Calendar._TT["WEEKEND"]; 15867 for (var i = 0; i < 7; ++i) { 15868 cell.className = "day name"; 15869 var realday = (i + fdow) % 7; 15870 if (i) { 15871 cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]); 15872 cell.navtype = 100; 15873 cell.calendar = this; 15874 cell.fdow = realday; 15875 Calendar._add_evs(cell); 15876 } 15877 if (weekend.indexOf(realday.toString()) != -1) { 15878 Calendar.addClass(cell, "weekend"); 15879 } 15880 cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; 15881 cell = cell.nextSibling; 15882 } 15883}; 15884 15885/** Internal function. Hides all combo boxes that might be displayed. */ 15886Calendar.prototype._hideCombos = function () { 15887 this.monthsCombo.style.display = "none"; 15888 this.yearsCombo.style.display = "none"; 15889}; 15890 15891/** Internal function. Starts dragging the element. */ 15892Calendar.prototype._dragStart = function (ev) { 15893 if (this.dragging) { 15894 return; 15895 } 15896 this.dragging = true; 15897 var posX; 15898 var posY; 15899 if (Calendar.is_ie) { 15900 posY = window.event.clientY + document.body.scrollTop; 15901 posX = window.event.clientX + document.body.scrollLeft; 15902 } else { 15903 posY = ev.clientY + window.scrollY; 15904 posX = ev.clientX + window.scrollX; 15905 } 15906 var st = this.element.style; 15907 this.xOffs = posX - parseInt(st.left); 15908 this.yOffs = posY - parseInt(st.top); 15909 with (Calendar) { 15910 addEvent(document, "mousemove", calDragIt); 15911 addEvent(document, "mouseup", calDragEnd); 15912 } 15913}; 15914 15915// BEGIN: DATE OBJECT PATCHES 15916 15917/** Adds the number of days array to the Date object. */ 15918Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); 15919 15920/** Constants used for time computations */ 15921Date.SECOND = 1000 /* milliseconds */; 15922Date.MINUTE = 60 * Date.SECOND; 15923Date.HOUR = 60 * Date.MINUTE; 15924Date.DAY = 24 * Date.HOUR;
15925Date.WEEK = 7 * Date.DAY; 15926 15927Date.parseDate = function(str, fmt) { 15928 var today = new CalendarDateObject(); 15929 var y = 0; 15930 var m = -1; 15931 var d = 0; 15932 15933 // translate date into en_US, because split() cannot parse non-latin stuff 15934 var a = str; 15935 var i; 15936 for (i = 0; i < Calendar._MN.length; i++) { 15937 a = a.replace(Calendar._MN[i], enUS.m.wide[i]); 15938 } 15939 for (i = 0; i < Calendar._SMN.length; i++) { 15940 a = a.replace(Calendar._SMN[i], enUS.m.abbr[i]); 15941 } 15942 a = a.replace(Calendar._am, 'am'); 15943 a = a.replace(Calendar._am.toLowerCase(), 'am'); 15944 a = a.replace(Calendar._pm, 'pm'); 15945 a = a.replace(Calendar._pm.toLowerCase(), 'pm'); 15946 15947 a = a.split(/\W+/); 15948 15949 var b = fmt.match(/%./g); 15950 var i = 0, j = 0; 15951 var hr = 0; 15952 var min = 0; 15953 for (i = 0; i < a.length; ++i) { 15954 if (!a[i]) 15955 continue; 15956 switch (b[i]) { 15957 case "%d": 15958 case "%e": 15959 d = parseInt(a[i], 10); 15960 break; 15961 15962 case "%m": 15963 m = parseInt(a[i], 10) - 1; 15964 break; 15965 15966 case "%Y": 15967 case "%y": 15968 y = parseInt(a[i], 10); 15969 (y < 100) && (y += (y > 29) ? 1900 : 2000); 15970 break; 15971 15972 case "%b": 15973 for (j = 0; j < 12; ++j) { 15974 if (enUS.m.abbr[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } 15975 } 15976 break; 15977 15978 case "%B": 15979 for (j = 0; j < 12; ++j) { 15980 if (enUS.m.wide[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } 15981 } 15982 break; 15983 15984 case "%H": 15985 case "%I": 15986 case "%k": 15987 case "%l": 15988 hr = parseInt(a[i], 10); 15989 break; 15990 15991 case "%P": 15992 case "%p": 15993 if (/pm/i.test(a[i]) && hr < 12) 15994 hr += 12; 15995 else if (/am/i.test(a[i]) && hr >= 12) 15996 hr -= 12; 15997 break; 15998 15999 case "%M": 16000 min = parseInt(a[i], 10); 16001 break; 16002 } 16003 } 16004 if (isNaN(y)) y = today.getFullYear(); 16005 if (isNaN(m)) m = today.getMonth(); 16006 if (isNaN(d)) d = today.getDate(); 16007 if (isNaN(hr)) hr = today.getHours(); 16008 if (isNaN(min)) min = today.getMinutes(); 16009 if (y != 0 && m != -1 && d != 0) 16010 return new CalendarDateObject(y, m, d, hr, min, 0); 16011 y = 0; m = -1; d = 0; 16012 for (i = 0; i < a.length; ++i) { 16013 if (a[i].search(/[a-zA-Z]+/) != -1) { 16014 var t = -1; 16015 for (j = 0; j < 12; ++j) { 16016 if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } 16017 } 16018 if (t != -1) { 16019 if (m != -1) { 16020 d = m+1; 16021 } 16022 m = t; 16023 } 16024 } else if (parseInt(a[i], 10) <= 12 && m == -1) { 16025 m = a[i]-1; 16026 } else if (parseInt(a[i], 10) > 31 && y == 0) { 16027 y = parseInt(a[i], 10); 16028 (y < 100) && (y += (y > 29) ? 1900 : 2000); 16029 } else if (d == 0) { 16030 d = a[i]; 16031 } 16032 } 16033 if (y == 0) 16034 y = today.getFullYear(); 16035 if (m != -1 && d != 0) 16036 return new CalendarDateObject(y, m, d, hr, min, 0); 16037 return today; 16038}; 16039 16040/** Returns the number of days in the current month */ 16041Date.prototype.getMonthDays = function(month) { 16042 var year = this.getFullYear(); 16043 if (typeof month == "undefined") { 16044 month = this.getMonth(); 16045 } 16046 if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { 16047 return 29; 16048 } else { 16049 return Date._MD[month]; 16050 } 16051}; 16052 16053/** Returns the number of day in the year. */ 16054Date.prototype.getDayOfYear = function() { 16055 var now = new CalendarDateObject(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); 16056 var then = new CalendarDateObject(this.getFullYear(), 0, 0, 0, 0, 0); 16057 var time = now - then; 16058 return Math.floor(time / Date.DAY); 16059}; 16060 16061/** Returns the number of the week in year, as defined in ISO 8601. */ 16062Date.prototype.getWeekNumber = function() { 16063 var d = new CalendarDateObject(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); 16064 var DoW = d.getDay(); 16065 d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu 16066 var ms = d.valueOf(); // GMT 16067 d.setMonth(0); 16068 d.setDate(4); // Thu in Week 1 16069 return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; 16070}; 16071 16072/** Checks date and time equality */ 16073Date.prototype.equalsTo = function(date) { 16074 return ((this.getFullYear() == date.getFullYear()) && 16075 (this.getMonth() == date.getMonth()) && 16076 (this.getDate() == date.getDate()) && 16077 (this.getHours() == date.getHours()) && 16078 (this.getMinutes() == date.getMinutes())); 16079}; 16080 16081/** Set only the year, month, date parts (keep existing time) */ 16082Date.prototype.setDateOnly = function(date) { 16083 var tmp = new CalendarDateObject(date); 16084 this.setDate(1); 16085 this.setFullYear(tmp.getFullYear()); 16086 this.setMonth(tmp.getMonth()); 16087 this.setDate(tmp.getDate()); 16088}; 16089 16090/** Prints the date in a string according to the given format. */ 16091Date.prototype.print = function (str) { 16092 var m = this.getMonth(); 16093 var d = this.getDate(); 16094 var y = this.getFullYear(); 16095 var wn = this.getWeekNumber(); 16096 var w = this.getDay(); 16097 var s = {}; 16098 var hr = this.getHours(); 16099 var pm = (hr >= 12); 16100 var ir = (pm) ? (hr - 12) : hr; 16101 var dy = this.getDayOfYear(); 16102 if (ir == 0) 16103 ir = 12; 16104 var min = this.getMinutes();
16105 var sec = this.getSeconds(); 16106 s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N] 16107 s["%A"] = Calendar._DN[w]; // full weekday name 16108 s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N] 16109 s["%B"] = Calendar._MN[m]; // full month name 16110 // FIXME: %c : preferred date and time representation for the current locale 16111 s["%C"] = 1 + Math.floor(y / 100); // the century number 16112 s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) 16113 s["%e"] = d; // the day of the month (range 1 to 31) 16114 // FIXME: %D : american date style: %m/%d/%y 16115 // FIXME: %E, %F, %G, %g, %h (man strftime) 16116 s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) 16117 s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) 16118 s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) 16119 s["%k"] = hr; // hour, range 0 to 23 (24h format) 16120 s["%l"] = ir; // hour, range 1 to 12 (12h format) 16121 s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 16122 s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 16123 s["%n"] = "\n"; // a newline character 16124 s["%p"] = pm ? Calendar._pm.toUpperCase() : Calendar._am.toUpperCase(); 16125 s["%P"] = pm ? Calendar._pm.toLowerCase() : Calendar._am.toLowerCase(); 16126 // FIXME: %r : the time in am/pm notation %I:%M:%S %p 16127 // FIXME: %R : the time in 24-hour notation %H:%M 16128 s["%s"] = Math.floor(this.getTime() / 1000); 16129 s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 16130 s["%t"] = "\t"; // a tab character 16131 // FIXME: %T : the time in 24-hour notation (%H:%M:%S) 16132 s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; 16133 s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) 16134 s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) 16135 // FIXME: %x : preferred date representation for the current locale without the time 16136 // FIXME: %X : preferred time representation for the current locale without the date 16137 s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) 16138 s["%Y"] = y; // year with the century 16139 s["%%"] = "%"; // a literal '%' character 16140 16141 var re = /%./g; 16142 if (!Calendar.is_ie5 && !Calendar.is_khtml) 16143 return str.replace(re, function (par) { return s[par] || par; }); 16144 16145 var a = str.match(re); 16146 for (var i = 0; i < a.length; i++) { 16147 var tmp = s[a[i]]; 16148 if (tmp) { 16149 re = new RegExp(a[i], 'g'); 16150 str = str.replace(re, tmp); 16151 } 16152 } 16153 16154 return str; 16155}; 16156 16157Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear; 16158Date.prototype.setFullYear = function(y) { 16159 var d = new CalendarDateObject(this); 16160 d.__msh_oldSetFullYear(y); 16161 if (d.getMonth() != this.getMonth()) 16162 this.setDate(28); 16163 this.__msh_oldSetFullYear(y); 16164}; 16165 16166CalendarDateObject.prototype = new Date(); 16167CalendarDateObject.prototype.constructor = CalendarDateObject; 16168CalendarDateObject.prototype.parent = Date.prototype; 16169function CalendarDateObject() { 16170 var dateObj; 16171 if (arguments.length > 1) { 16172 dateObj = eval("new this.parent.constructor("+Array.prototype.slice.call(arguments).join(",")+");"); 16173 } else if (arguments.length > 0) { 16174 dateObj = new this.parent.constructor(arguments[0]); 16175 } else { 16176 dateObj = new this.parent.constructor(); 16177 if (typeof(CalendarDateObject._SERVER_TIMZEONE_SECONDS) != "undefined") { 16178 dateObj.setTime((CalendarDateObject._SERVER_TIMZEONE_SECONDS + dateObj.getTimezoneOffset()*60)*1000); 16179 } 16180 } 16181 return dateObj; 16182} 16183 16184// END: DATE OBJECT PATCHES 16185 16186 16187// global object that remembers the calendar 16188window._dynarch_popupCalendar = null;
16189/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ 16190 * --------------------------------------------------------------------------- 16191 * 16192 * The DHTML Calendar 16193 * 16194 * Details and latest version at: 16195 * http://dynarch.com/mishoo/calendar.epl 16196 * 16197 * This script is distributed under the GNU Lesser General Public License. 16198 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html 16199 * 16200 * This file defines helper functions for setting up the calendar. They are 16201 * intended to help non-programmers get a working calendar on their site 16202 * quickly. This script should not be seen as part of the calendar. It just 16203 * shows you what one can do with the calendar, while in the same time 16204 * providing a quick and simple method for setting it up. If you need 16205 * exhaustive customization of the calendar creation process feel free to 16206 * modify this code to suit your needs (this is recommended and much better 16207 * than modifying calendar.js itself). 16208 */ 16209Calendar.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;
16209cal.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;}; 16210/* 16211 * Title: jQuery Etalage plugin 16212 * Author: Berend de Jong, Frique 16213 * Author URI: http://www.frique.me/ 16214 * Version: 1.3.4 (20130622.1) 16215 */ 16216 16217(function($){ 16218 $.fn.etalage = function(options){ 16219 16220 // OPTION DEFAULTS 16221 var o = $.extend({ 16222 align: 'left', // Align of the Etalage container. The zoom area will appear on the opposite side ('left'/'right') 16223 thumb_image_width: 300, // The large thumbnail width (excluding borders / padding) (value in pixels) 16224 thumb_image_height: 400, // The large thumbnail height (excluding borders / padding) (value in pixels) 16225 source_image_width: 900, // The source/zoomed image width (not the frame around it) (value in pixels) 16226 source_image_height: 1200, // The source/zoomed image height (not the frame around it) (value in pixels)
16227 zoom_area_width: 600, // Width of the zoomed image frame (including borders, padding) (value in pixels) 16228 zoom_area_height: 'justify', // Height of the zoomed image frame (including borders, padding) (value in pixels / 'justify' = height of large thumb + small thumbs) 16229 zoom_area_distance: 10, // Distance between the zoom area and thumbnail (value in pixels) 16230 zoom_easing: true, // Ease the animation while moving the zoomed image (true/false) 16231 click_to_zoom: false, // Will start zooming when image is clicked instead of when hovering (when true, click-callback functions are disabled) (true/false) 16232 zoom_element: 'auto', // Supply your custom zoom area element as a CSS type selector ('auto'/'#selector'/'.selector') 16233 zoom_enable: true, 16234 show_descriptions: true, // Shows the description area if a title attribute is given to the source image (true/false) 16235 description_location: 'bottom', // Location of the description area ('top'/'bottom') 16236 description_opacity: 0.7, // Opacity of the description area (except for IE) (number between or equal to 0-1) 16237 small_thumbs: 3, // How many small thumbnails will be visible underneath the large thumbnail (minimum of 3) (number) 16238 small_thumbs_width_offset: 0, 16239 smallthumb_inactive_opacity: 0.4, // Opacity of the inactive small thumbnails (number between or equal to 0-1) 16240 smallthumb_hide_single: true, // Don't show the small thumb when there is only 1 image (true/false) 16241 smallthumb_select_on_hover: false, // This will scroll through the small thumbnails when hovering them, instead of clicking them (true/false) 16242 smallthumbs_position: 'bottom', // Where to position the row of small thumbnails ('top' / 'bottom' / 'left' / 'right') 16243 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) 16244 magnifier_opacity: 0.5, // Opacity of the magnifier area (does not apply if magnifier_invert is true) (number between or equal to 0-1) 16245 magnifier_invert: true, // Make the large thumbnail clear through the magnifier, opaque around it (opacity is the value of magnifier_opacity) (true/false) 16246 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) 16247 icon_offset: 20, // The icon's offset to the left-bottom corner (value in pixels) 16248 hide_cursor: false, // Hides the cursor when hovering the large thumbnail (only works in some browsers) (true/false) 16249 show_hint: false, // Show "hint" until image is zoomed for the first time (true/false) 16250 hint_offset: 15, // The hint's offset to the right-top corner (value in pixels) 16251 speed: 600, // All animation speeds are based on this setting (value in ms) 16252 autoplay: true, // Makes the thumbs switch automatically when not interacting (at each autoplay_interval below) (true/false) 16253 autoplay_interval: 6000, // Time showing each image if autoplay is on (value in ms) 16254 keyboard: true, // Left/right arrow keys to navigate (true/false) 16255 right_to_left: false, // Makes the thumbnails slide from right to left and the caption texts RTL (true/false) 16256 // Callback functions: // These functions are automatically run when certain events trigger. Assign your own behaviour as a plugin option: 16257 click_callback: function(){ // Provide your own callback for the click event (function). Takes 2 arguments:
16257image_anchor, instance_id 16258 return true; 16259 }, 16260 change_callback: function(){ // Provide your own callback for the change event (thumb switching) (function). Takes 2 arguments: image_anchor, instance_id 16261 return true; 16262 } 16263 }, options); 16264 16265 $.each(this, function(){ 16266 var $container = $(this); 16267 16268 // Verify if this is a UL, has atleast 1 LI and 1 source image 16269 if($container.is('ul') && $container.children('li').length && $container.find('img.etalage_source_image').length){ 16270 16271 var i, j, src, thumb_id, magnifier_opacity, autotimer, description, container_outerwidth, smallthumbs_overflow, css, 16272 instance_id = $container.attr('id'), 16273 faster = Math.floor(o.speed*0.7), 16274 zoom_follow_speed = Math.round(o.speed/100), 16275 st_moving = false, 16276 st_steps = 0, 16277 ie6 = false, 16278 preview = true, 16279 clicked_to_zoom = false, 16280 zoom_move_timer = 0, 16281 cur_zoomx = 0, 16282 cur_zoomy = 0, 16283 new_zoomx = 0, 16284 new_zoomy = 0, 16285 smallthumbs_align = 'hori'; 16286 16287 if(typeof instance_id==='undefined' || !instance_id){ 16288 instance_id = '[no id]'; 16289 } 16290 16291 if(o.smallthumbs_position==='left' || o.smallthumbs_position==='right'){ 16292 smallthumbs_align = 'vert'; 16293 } 16294 16295 // IE specifics 16296 if(typeof $.browser==='object' && $.browser.msie){ 16297 if($.browser.version < 9){ 16298 preview = false; 16299 if($.browser.version < 7){ 16300 ie6 = true; 16301 } 16302 } 16303 } 16304 16305// NEW ELEMENTS & CACHE 16306 $container.addClass('etalage').show(); 16307 var $thumbs; 16308 if($container.children('li').first().hasClass('etalage_thumb')){ 16309 $thumbs = $container.children('li.etalage_thumb'); 16310 }else{ 16311 $thumbs = $container.children('li').addClass('etalage_thumb'); 16312 } 16313 $container.children('li.etalage_thumb_active').hide().removeClass('etalage_thumb_active'); 16314 $thumbs.first().show().addClass('etalage_thumb_active').css('opacity', 1); 16315 16316 var images = $thumbs.length, 16317 autoplay = o.autoplay; 16318 if(images < 2){ 16319 autoplay = false; 16320 } 16321 16322 if(o.align==='right'){ 16323 $container.addClass('etalage_right'); 16324 } 16325 16326 // Add/generate large thumbs (& check for existing thumb/source images) 16327 $.each($thumbs, function(i){ 16328 i += 1; 16329 var $t = $(this), 16330 $t_thumb = $t.find('.etalage_thumb_image').show(), 16331 $t_source = $t.find('.etalage_source_image'), 16332 $t_anchor = $t.find('a'); 16333 $t.data('id', i).addClass('thumb_'+i); 16334 // No thumb, but source 16335 if(!$t_thumb.length && $t_source.length){ 16336 $t.prepend('<img class="etalage_thumb_image" src="'+$t_source.attr('src')+'" />'); 16337 } 16338 // No thumb and no source 16339 else if(!$t_thumb.length && !$t_source.length){ 16340 $t.remove(); 16341 } 16342 // Add anchor data to large thumbnail 16343 if($t_anchor.length){ 16344 $t.find('.etalage_thumb_image').data('anchor', $t_anchor.attr('href')); 16345 } 16346 }); 16347 var $thumb_images = $thumbs.find('.etalage_thumb_image').css({ width:o.thumb_image_width, height:o.thumb_image_height }).show(); 16348 $.each($thumb_images, function(){
16349 $(this).data('src', this.src); 16350 $(this).data('title', this.alt); 16351 }); 16352 16353 // Add magnifier 16354 var $magnifier; 16355 $container.children('li.etalage_magnifier').remove(); 16356 $magnifier = $('<li class="etalage_magnifier"><div><img /></div></li>').appendTo($container); 16357 var $magnifier_img_area = $magnifier.children('div'); 16358 var $magnifier_img = $magnifier_img_area.children('img'); 16359 16360 // Add zoom icon 16361 var $icon; 16362 $container.children('li.etalage_icon').remove(); 16363 $icon = $('<li class="etalage_icon"> </li>').appendTo($container); 16364 if(o.show_icon){ 16365 $icon.show(); 16366 } 16367 16368 // Add hint 16369 var $hint; 16370 if(o.show_hint){ 16371 $container.children('li.etalage_hint').remove(); 16372 $hint = $('<li class="etalage_hint"> </li>').appendTo($container).show(); 16373 } 16374 16375 // Add zoom area 16376 var $zoom, 16377 zoom_element = o.zoom_element; 16378 if(zoom_element!=='auto' && zoom_element && $(zoom_element).length){ 16379 $zoom = $(zoom_element) 16380 .addClass('etalage_zoom_area') 16381 .html('<div><img class="etalage_zoom_img" /></div>'); 16382 }else{ 16383 zoom_element = 'auto'; 16384 $container.children('li.etalage_zoom_area').remove(); 16385 $zoom = $('<li class="etalage_zoom_area"><div><img class="etalage_zoom_img" /></div></li>').appendTo($container); 16386 } 16387 var $zoom_img_area = $zoom.children('div'), 16388 $zoom_preview; 16389 if(preview){ 16390 $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(); 16391 } 16392 var $zoom_img = $zoom_img_area.children('.etalage_zoom_img').css({ width:o.source_image_width, height:o.source_image_height }); 16393 16394 // Add description area 16395 var $description; 16396 if(o.show_descriptions){ 16397 $description = $('<div class="etalage_description'+ ((o.right_to_left)?' rtl':'') +'"></div>').prependTo($zoom); 16398 } 16399 16400 // Add/generate smallthumbs 16401 var $smallthumbs, 16402 $smallthumbs_ul, 16403 $smallthumb, 16404 $smallthumb_images, 16405 smallthumbs, 16406 small_thumbs = o.small_thumbs; 16407 var small_thumbs_width_offset = o.small_thumbs_width_offset; 16408 if(images > 1 || !o.smallthumb_hide_single){ 16409 $container.children('li.etalage_small_thumbs').remove(); 16410 $smallthumbs = $('<li class="etalage_small_thumbs"><ul></ul></li>').appendTo($container); 16411 16412 $smallthumbs_ul = $smallthumbs.children('ul'); 16413 $.each($thumb_images, function(){ 16414 var $t = $(this); 16415 src = $t.data('src'); 16416 title = $t.data('title'); 16417 thumb_id = $t.parents('.etalage_thumb').data('id'); 16418 $('<li title="'+title+'"><img class="etalage_small_thumb" src="'+src+'" /></li>').data('thumb_id', thumb_id).appendTo($smallthumbs_ul); 16419 }); 16420 $smallthumb = $smallthumbs_ul.children('li').css({ opacity:o.smallthumb_inactive_opacity }); 16421 if(small_thumbs < 3){ 16422 small_thumbs = 3; 16423 } 16424 // If more smallthumbs than visible 16425 if(images > small_thumbs){ 16426 // Add extra thumb on each side 16427 if(o.show_begin_end_smallthumb){ 16428 src = $thumb_images.eq(images-1).data('src'); 16429 title = $thumb_images.eq(images-1).data('title'); 16430 thumb_id = $thumbs.eq(images-1).data('id'); 16431 $('<li class="etalage_smallthumb_first etalage_smallthumb_navtoend" title="'+title+'"><img class="etalage_small_thumb" src="'+src+'" /></li>') 16432 .data('src', src) 16433 .data('thumb_id', thumb_id) 16434 .css({ opacity:o.smallthumb_inactive_opacity }) 16435 .prependTo($smallthumbs_ul); 16436 src = $thumb_images.eq(0).data('src'); 16437 title = $thumb_images.eq(0).data('title'); 16438 thumb_id = $thumbs.eq(0).data('id'); 16439 $('<li class="etalage_smallthumb_navtostart" title="'+title+'"><img class="etalage_small_thumb" src="'+src+'" /></li>') 16440 .data('src', src) 16441 .data('thumb_id', thumb_id) 16442 .css({ opacity:o.smallthumb_inactive_opacity }) 16443 .appendTo($smallthumbs_ul); 16444 $smallthumb = $smallthumbs_ul.children('li'); 16445 16446 // Set first active smallthumb 16447 $smallthumb.eq(1).addClass('etalage_smallthumb_active').css({ opacity:1 }); 16448 }else{ 16449 // Set first active smallthumb 16450 $smallthumb.eq(0).addClass('etalage_smallthumb_first etalage_smallthumb_active').css({ opacity:1 }); 16451 } 16452 // Prepare for moving them left/right / up/down 16453 $smallthumb.eq(small_thumbs-1).addClass('etalage_smallthumb_last'); 16454 } 16455 // Smallthumbs are within boundries 16456 else{ 16457 // Set first active smallthumb 16458 $smallthumb.eq(0).addClass('etalage_smallthumb_active').css({ opacity:1 }); 16459 } 16460 // Apply id 16461 $.each($smallthumb, function(i){ 16462 $(this).data('id', (i+1)); 16463 }); 16464 $smallthumb_images = $smallthumb.children('img'); 16465 smallthumbs = $smallthumb.length; 16466 // Vertical 16467 if(smallthumbs_align==='vert'){ 16468 $smallthumb.addClass('vertical'); 16469 } 16470 } 16471 16472// PREPARE 16473 // Magnifier invert option 16474 if(o.magnifier_invert){ 16475 magnifier_opacity = 1; 16476 }else{ 16477 magnifier_opacity = o.magnifier_opacity; 16478 } 16479 16480 // Determine (generated) dimensions 16481 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), 16482 thumb_margin = parseInt($thumbs.css('marginLeft'), 10) + parseInt($thumbs.css('marginRight'), 10), 16483 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), 16484 thumb_outerwidth = o.thumb_image_width+thumb_border+thumb_margin+thumb_padding, 16485 thumb_outerheight = o.thumb_image_height+thumb_border+thumb_margin+thumb_padding, 16486 smallthumb_border = 0, 16487 smallthumb_margin = 0, 16488 smallthumb_padding = 0, 16489 smallthumb_width = 0, 16490 smallthumb_height = 0, 16491 smallthumb_outerwidth = 0, 16492 smallthumb_outerheight = 0; 16493 if(images > 1 || !o.smallthumb_hide_single){ 16494 smallthumb_border = parseInt($smallthumb.css('borderLeftWidth'), 10) + parseInt($smallthumb.css('borderRightWidth'), 10) + parseInt($smallthumb_images.css('borderLeftWidth'), 10) + parseInt($smallthumb_images.css('borderRightWidth'), 10); 16495 smallthumb_margin = parseInt($smallthumb.css('marginTop'), 10); 16496 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); 16497 if(smallthumbs_align==='vert'){ 16498 smallthumb_height = Math.round((thumb_outerheight-((small_thumbs-1)*smallthumb_margin))/small_thumbs) - (smallthumb_border+smallthumb_padding); 16499 smallthumb_width = Math.round((o.thumb_image_width * smallthumb_height) / o.thumb_image_height); 16500 smallthumb_outerwidth = smallthumb_width+smallthumb_border+smallthumb_padding; 16501 smallthumb_outerheight = smallthumb_height+smallthumb_border+smallthumb_padding; 16502 }else{ 16503 smallthumb_width = Math.round((thumb_outerwidth+small_thumbs_width_offset-((small_thumbs-1)*smallthumb_margin))/small_thumbs) - (smallthumb_border+smallthumb_padding); 16504 smallthumb_height = Math.round((o.thumb_image_height * smallthumb_width) / o.thumb_image_width); 16505 smallthumb_outerwidth = smallthumb_width+smallthumb_border+smallthumb_padding; 16506 smallthumb_outerheight = smallthumb_height+smallthumb_border+smallthumb_padding; 16507 } 16508 } 16509 16510 var zoom_border = parseInt($zoom.css('borderTopWidth'), 10), 16511 zoom_margin = parseInt(o.zoom_area_distance, 10), 16512 zoom_padding = parseInt($zoom.css('paddingTop'), 10), 16513 zoom_area_width, 16514 zoom_area_height; 16515 // If source image width is smaller than zoom area 16516 if((o.zoom_area_width - (zoom_border*2) - (zoom_padding*2)) > o.source_image_width){ 16517 zoom_area_width = o.source_image_width; 16518 }else{ 16519 zoom_area_width = o.zoom_area_width - (zoom_border*2) - (zoom_padding*2); 16520 } 16521 if(o.zoom_area_height==='justify'){ 16522 zoom_area_height = (thumb_outerheight+smallthumb_margin+smallthumb_outerheight) - (zoom_border*2) - (zoom_padding*2); 16523 }else{ 16524 zoom_area_height = o.zoom_area_height - (zoom_border*2) - (zoom_padding*2); 16525 } 16526 // If source image height is smaller than zoom area 16527 if(zoom_area_height > o.source_image_height){ 16528 zoom_area_height = o.source_image_height; 16529 } 16530 var description_border, 16531 description_margin, 16532 description_padding, 16533 description_width; 16534 if(o.show_descriptions){ 16535 description_border = parseInt($description.css('borderLeftWidth'), 10) + parseInt($description.css('borderRightWidth'), 10); 16536 description_margin = parseInt($description.css('marginLeft'), 10) + parseInt($description.css('marginRight'), 10); 16537 description_padding = parseInt($description.css('paddingLeft'), 10) + parseInt($description.css('paddingRight'), 10); 16538 description_width = zoom_area_width - description_border - description_margin - description_padding; 16539 } 16540 // Add iframe underlay to resolve IE6 <select> tag bug 16541 var $ie6_iframe_fix; 16542 if(ie6){ 16543 $ie6_iframe_fix = $('<iframe marginwidth="0" marginheight="0" scrolling="no" frameborder="0" src="javascript:\'<html></html>\'"></iframe>') 16544 .css({ position:'absolute', zIndex:1 }) 16545 .prependTo($zoom); 16546 } 16547 16548 var magnifier_border = parseInt($magnifier.css('borderTopWidth'), 10), 16549 magnifier_top = parseInt($thumbs.css('borderTopWidth'), 10) + 16550 parseInt($thumbs.css('marginTop'), 10) + 16551 parseInt($thumbs.css('paddingTop'), 10) + 16552 parseInt($thumb_images.css('borderTopWidth'), 10) + 16553 parseInt($thumb_images.css('marginTop'), 10) - 16554 magnifier_border, 16555 magnifier_left = $thumb_images.offset().left - $container.offset().left - magnifier_border; 16556 if(o.smallthumbs_position==='left'){ 16557 magnifier_left = magnifier_left + smallthumb_outerwidth + smallthumb_margin; 16558 }else if(o.smallthumbs_position==='top'){ 16559 magnifier_top = magnifier_top + smallthumb_outerheight + smallthumb_margin; 16560 } 16561 var magnifier_width = Math.round(zoom_area_width*(o.thumb_image_width / o.source_image_width)), 16562 magnifier_height = Math.round(zoom_area_height*(o.thumb_image_height / o.source_image_height)), 16563 magnifier_bottom = magnifier_top + o.thumb_image_height - magnifier_height, 16564 magnifier_right = magnifier_left + o.thumb_image_width - magnifier_width, 16565 magnifier_center_x = Math.round(magnifier_width/2), 16566 magnifier_center_y = Math.round(magnifier_height/2), 16567 hint_top, 16568 hint_right; 16569 if(o.show_hint){ 16570 hint_top = parseInt(o.hint_offset, 10) + parseInt($hint.css('marginTop'), 10); 16571 hint_right = parseInt(o.hint_offset, 10) + parseInt($hint.css('marginRight'), 10); 16572 if(o.smallthumbs_position==='right'){ 16573 hint_right = hint_right-smallthumb_outerwidth-smallthumb_margin; 16574 } 16575 } 16576 16577// RESIZE AND REPOSITION ELEMENTS 16578 // Container 16579 if(smallthumbs_align==='vert'){ 16580 container_outerwidth = thumb_outerwidth+smallthumb_margin+smallthumb_outerwidth; 16581 $container.css({ width:container_outerwidth, height:thumb_outerheight }); 16582 }else{ 16583 container_outerwidth = thumb_outerwidth; 16584 $container.css({ width:container_outerwidth, height:thumb_outerheight+smallthumb_margin+smallthumb_outerheight }); 16585 } 16586 // Icon 16587 if(o.show_icon){ 16588 css = { top:thumb_outerheight - $icon.outerHeight(true) - parseInt(o.icon_offset, 10), left:parseInt(o.icon_offset, 10) }; 16589 if(o.smallthumbs_position==='left'){ 16590 css.left = smallthumb_outerwidth + smallthumb_margin + parseInt(o.icon_offset, 10); 16591 }else if(o.smallthumbs_position==='top'){ 16592 css.top += smallthumb_outerheight + smallthumb_margin; 16593 } 16594 $icon.css(css); 16595 } 16596 // Hint 16597 if(o.show_hint){ 16598 $hint.css({ margin:0, top:-hint_top, right:-hint_right }); 16599 } 16600 // Magnifier 16601 $magnifier_img.css({ margin:0, padding:0, width:o.thumb_image_width, height:o.thumb_image_height }); 16602 $magnifier_img_area.css({ margin:0, padding:0, width:magnifier_width, height:magnifier_height }); 16603 css = { margin:0, padding:0, left:(magnifier_right-magnifier_left)/2, top:(magnifier_bottom-magnifier_top)/2 }; 16604 if(o.smallthumbs_position==='left'){ 16605 css.left = '+=' + smallthumb_outerwidth + smallthumb_margin; 16606 }else if(o.smallthumbs_position==='top'){ 16607 css.top = '+=' + smallthumb_outerheight + smallthumb_margin; 16608
16608} 16609 $magnifier.css(css).hide(); 16610 // Zoom area 16611 $zoom_img_area.css({ width:zoom_area_width, height:zoom_area_height }); 16612 css = { margin:0, opacity:0 }; 16613 if(o.align==='right' && zoom_element==='auto'){ 16614 css.left = -(zoom_area_width + (zoom_border*2) + (zoom_padding*2) + zoom_margin); 16615 }else if(zoom_element==='auto'){ 16616 css.left = container_outerwidth + zoom_margin; 16617 } 16618 $zoom.css(css).hide(); 16619 // Descriptions 16620 if(o.show_descriptions){ 16621 css = { width:description_width, bottom:zoom_padding, left:zoom_padding, opacity:o.description_opacity }; 16622 if(o.description_location==='top'){ 16623 css.top = zoom_padding; 16624 css.bottom = 'auto'; 16625 } 16626 $description.css(css).hide(); 16627 } 16628 // Small thumbs 16629 if(images > 1 || !o.smallthumb_hide_single){ 16630 if(smallthumbs_align==='vert'){ 16631 css = { top:0, height:thumb_outerheight }; 16632 if(o.smallthumbs_position==='left'){ 16633 $thumbs.css({ left:smallthumb_outerwidth+smallthumb_margin }); 16634 }else{ 16635 css.marginLeft = thumb_outerwidth + smallthumb_margin; 16636 } 16637 $smallthumbs.css(css); 16638 $smallthumbs_ul.css({ height:(smallthumb_outerheight*smallthumbs) + (smallthumbs*smallthumb_margin) + 100 }); //100 = some extra to prevent a browser zoom glitch fix 16639 $smallthumb_images.css({ width:smallthumb_width, height:smallthumb_height }).attr('height', smallthumb_height); 16640 $smallthumb.css({ margin:0, marginBottom:smallthumb_margin }); 16641 }else{ 16642 css = { width:thumb_outerwidth+small_thumbs_width_offset, left: (-small_thumbs_width_offset/2) }; 16643 if(o.smallthumbs_position==='top'){ 16644 $thumbs.css({ top:smallthumb_outerheight+smallthumb_margin }); 16645 }else{ 16646 css.top = thumb_outerheight + smallthumb_margin; 16647 } 16648 $smallthumbs.css(css); 16649 $smallthumbs_ul.css({ width:(smallthumb_outerwidth*smallthumbs) + (smallthumbs*smallthumb_margin) + 100 }); //100 = some extra to prevent a browser zoom glitch fix 16650 $smallthumb_images.css({ width:smallthumb_width, height:smallthumb_height }).attr('width', smallthumb_width); 16651 $smallthumb.css({ margin:0, marginRight:smallthumb_margin }); 16652 } 16653 16654 // Smallthumbs overflow fix for unmatching space (width/height of visible smallthumbs + their margins is more than the container width/height: 16655 if(smallthumbs_align==='vert'){ 16656 smallthumbs_overflow = ((smallthumb_outerheight*small_thumbs) + ((small_thumbs-1)*smallthumb_margin)) - thumb_outerheight; 16657 }else{ 16658 smallthumbs_overflow = ((smallthumb_outerwidth*small_thumbs) + ((small_thumbs-1)*smallthumb_margin)) - thumb_outerwidth; 16659 } 16660 // Overflow*1px decrease 16661 if(smallthumbs_overflow > 0){ 16662 // Each set 16663 for(i=1; i<=(smallthumbs-1); i=i+(small_thumbs-1)){ 16664 j=1; 16665 // Each smallthumb 16666 for(j; j<=smallthumbs_overflow; j+=1){ 16667 if(smallthumbs_align==='vert'){ 16668 $smallthumb.eq(i+j-1).css({ marginBottom:(smallthumb_margin-1) }); 16669 }else{ 16670 $smallthumb.eq(i+j-1).css({ marginRight:(smallthumb_margin-1) }); 16671 } 16672 } 16673 } 16674 } 16675 // Overflow*1px increase 16676 else if(smallthumbs_overflow < 0){ 16677 for(i=1; i<=(smallthumbs-1); i=i+(small_thumbs-1)){ 16678 j=1; 16679 // Each smallthumb 16680 for(j; j<=(-smallthumbs_overflow); j+=1){ 16681 if(smallthumbs_align==='vert'){ 16682 $smallthumb.eq(i+j-1).css({ marginBottom:(smallthumb_margin+1) }); 16683 $smallthumbs_ul.css({ height:parseInt($smallthumbs_ul.css('height'), 10)+1 }); 16684 }else{ 16685 $smallthumb.eq(i+j-1).css({ marginRight:(smallthumb_margin+1) }); 16686 $smallthumbs_ul.css({ width:parseInt($smallthumbs_ul.css('width'), 10)+1 }); 16687 } 16688 } 16689 } 16690 } 16691 } 16692 16693 if(o.show_icon && !o.magnifier_invert){ 16694 $magnifier.css({ background:$magnifier.css('background-color')+' '+$icon.css('background-image')+' center no-repeat' }); 16695 } 16696 if(o.hide_cursor){ 16697 $magnifier.add($icon).css({ cursor:'none' }); 16698 } 16699 if(ie6){ 16700 $ie6_iframe_fix.css({ width:$zoom_img_area.css('width'), height:$zoom_img_area.css('height') }); 16701 } 16702 16703// INITIATE FIRST RUN 16704 16705 var $current_thumb = $thumbs.first().find('.etalage_thumb_image'), 16706 $current_source = $thumbs.first().find('.etalage_source_image'); 16707 if(o.magnifier_invert){ 16708 $magnifier_img.attr('src', $current_thumb.data('src')).show(); 16709 } 16710 if(preview){ 16711 $zoom_preview.attr('src', $current_thumb.data('src')); 16712 } 16713 $zoom_img.attr('src', $current_source.attr('src')); 16714 if(o.show_descriptions){ 16715 description = $current_source.attr('title'); 16716 if(description){ 16717 $description.html(description).show(); 16718 } 16719 } 16720 16721// FUNCTIONS 16722 16723 // Autoplay 16724 var stopAutoplay = function(){ 16725 if(autotimer){ 16726 clearInterval(autotimer); 16727 autotimer = false;
16728 } 16729 }; 16730 var startAutoplay = function(){ 16731 if(autotimer){ 16732 stopAutoplay(); 16733 } 16734 autotimer = setInterval(function(){ 16735 next(); 16736 }, o.autoplay_interval); 16737 }; 16738 16739 // Start zooming 16740 var start_zoom = function(){ 16741 if(o.zoom_enable == true){ 16742 $magnifier.stop().fadeTo(faster, magnifier_opacity); 16743 $icon.stop().animate({ opacity:0 }, faster); 16744 $zoom.stop().show().animate({ opacity:1 }, faster); 16745 // Magnifier invert option 16746 if(o.magnifier_invert){ 16747 $current_thumb.stop().animate({ opacity:o.magnifier_opacity }, faster); 16748 } 16749 // Pause autoplay 16750 if(autoplay){ 16751 stopAutoplay(); 16752 } 16753 } 16754 }; 16755 16756 // Stop zooming 16757 var stop_zoom = function(){ 16758 $magnifier.stop().fadeOut(o.speed); 16759 $icon.stop().animate({ opacity:1 }, o.speed); 16760 $zoom.stop().animate({ opacity:0 }, o.speed, function(){ 16761 $(this).hide(); 16762 }); 16763 // Magnifier invert option 16764 if(o.magnifier_invert){ 16765 $current_thumb.stop().animate({ opacity:1 }, o.speed, function(){ 16766 if(o.click_to_zoom){ 16767 clicked_to_zoom = false; 16768 } 16769 }); 16770 } 16771 clearTimeout(zoom_move_timer); 16772 // Restart autoplay 16773 if(autoplay){ 16774 startAutoplay(); 16775 } 16776 }; 16777 16778 // Switch active thumb 16779 var st_click = function($next_active, moved){ 16780 var $next_thumb, 16781 image_number, 16782 $active = $container.find('.etalage_smallthumb_active').removeClass('etalage_smallthumb_active'); 16783 $next_active.addClass('etalage_smallthumb_active'); 16784 // Make sure the magnifier is hidden 16785 $magnifier.stop().hide(); 16786 // Make sure the zoom area is hidden 16787 $zoom.stop().hide(); 16788 // Switch small thumb 16789 if(!moved){ 16790 st_moving = true; 16791 $active.stop(true,true).animate({ opacity:o.smallthumb_inactive_opacity }, faster); 16792 $next_active.stop(true,true).animate({ opacity:1 }, faster, function(){ 16793 st_moving = false; 16794 }); 16795 } 16796 setTimeout(function(){$container.find('.gallery-image').remove();$container.find('.etalage_thumb_image.hide').show().removeClass('hide');}, 500); 16797 // Switch large thumb 16798 $container.find('.etalage_thumb_active').removeClass('etalage_thumb_active').stop().animate({ opacity:0 }, o.speed, function(){ 16799 $(this).hide(); 16800 }); 16801 $next_thumb = $thumbs.filter('.thumb_'+$next_active.data('thumb_id')).addClass('etalage_thumb_active').show().stop().css({ opacity:0 }).animate({ opacity:1 }, o.speed); 16802 $current_thumb = $next_thumb.find('.etalage_thumb_image'); 16803 $current_source = $next_thumb.find('.etalage_source_image'); 16804 // Switch magnifier 16805 if(o.magnifier_invert){ 16806 $magnifier_img.attr('src', $current_thumb.data('src')); 16807 } 16808 // Switch zoom image 16809 if(preview){ 16810 $zoom_preview.attr('src', $current_thumb.data('src')); 16811 } 16812 $zoom_img.attr('src', $current_source.attr('src')); 16813 // Switch/hide/show description 16814 if(o.show_descriptions){ 16815 description = $current_source.attr('title'); 16816 if(description){ 16817 $description.html(description).show(); 16818 }else{ 16819 $description.hide(); 16820 } 16821 } 16822 // Reset autoplay 16823 if(autoplay){ 16824 stopAutoplay(); 16825 startAutoplay(); 16826 } 16827 // Trigger change-callback 16828 image_number = $next_active.data('id'); 16829 if(images >= small_thumbs){ 16830 image_number--; 16831 } 16832 change_callback(image_number); 16833 }; 16834 16835 // Smallthumbs sliding 16836 var st_move = function(distance, $next_first, $next_last, $next_active){ 16837 $.each($smallthumb, function(){ 16838 var $this = $(this), 16839 animation = { 16840 opacity: o.smallthumb_inactive_opacity 16841 }; 16842 if($this.data('id') === $next_active.data('id')){ 16843 animation.opacity = 1; 16844 } 16845 if(smallthumbs_align==='vert'){ 16846 animation.top = '-='+distance; 16847 }else{ 16848 animation.left = '-='+distance; 16849 } 16850 $this.animate(animation, faster, 'swing', function(){ 16851 if(st_moving){ 16852 $next_active.addClass('etalage_smallthumb_active'); 16853 st_moving = false;
16854 } 16855 }); 16856 }); 16857 // Switch thumb 16858 st_click($next_active, true); 16859 }; 16860 16861 // Moving the zoomed image 16862 var zoom_move = function(){ 16863 var diff_x = new_zoomx - cur_zoomx, 16864 diff_y = new_zoomy - cur_zoomy, 16865 movethismuchnow_x = -diff_x / zoom_follow_speed, 16866 movethismuchnow_y = -diff_y / zoom_follow_speed; 16867 cur_zoomx = cur_zoomx - movethismuchnow_x; 16868 cur_zoomy = cur_zoomy - movethismuchnow_y; 16869 if(diff_x < 1 && diff_x > -1){ 16870 cur_zoomx = new_zoomx; 16871 } 16872 if(diff_y < 1 && diff_y > -1){ 16873 cur_zoomy = new_zoomy; 16874 } 16875 // Move a bit 16876 $zoom_img.css({ left:cur_zoomx, top:cur_zoomy }); 16877 if(preview){ 16878 $zoom_preview.css({ left:cur_zoomx, top:cur_zoomy }); 16879 } 16880 // Repeat 16881 if(diff_x > 1 || diff_y > 1 || diff_x < 1 || diff_y < 1){ 16882 zoom_move_timer = setTimeout(function(){ 16883 zoom_move(); 16884 }, 25); 16885 } 16886 }; 16887 16888 // Navigate to previous image 16889 var prev = function(){ 16890 var $prev; 16891 if(o.magnifier_invert){ 16892 $container.find('.etalage_thumb_active').mouseleave(); 16893 } 16894 if(!o.right_to_left){ 16895 $prev = $container.find('.etalage_smallthumb_active').prev(); 16896 if(!$prev.length){ 16897 if(images > small_thumbs){ 16898 st_slide_to_end(); 16899 }else{ 16900 $smallthumb.last().trigger('click'); 16901 } 16902 return true; 16903 } 16904 }else{ 16905 $prev = $container.find('.etalage_smallthumb_active').next(); 16906 if(!$prev.length){ 16907 if(images > small_thumbs){ 16908 st_slide_to_start(); 16909 }else{ 16910 $smallthumb.first().trigger('click'); 16911 } 16912 return true; 16913 } 16914 } 16915 $prev.trigger('click'); 16916 }; 16917 16918 // Navigate to next image 16919 var next = function(){ 16920 var $next; 16921 if(o.magnifier_invert){ 16922 $container.find('.etalage_thumb_active').mouseleave(); 16923 } 16924 if(!o.right_to_left){ 16925 $next = $container.find('.etalage_smallthumb_active').next(); 16926 if(!$next.length){ 16927 if(images > small_thumbs){ 16928 st_slide_to_start(); 16929 }else{ 16930 $smallthumb.first().trigger('click'); 16931 } 16932 return true; 16933 } 16934 }else{ 16935 $next = $container.find('.etalage_smallthumb_active').prev(); 16936 if(!$next.length){ 16937 if(images > small_thumbs){ 16938 st_slide_to_end(); 16939 }else{ 16940 $smallthumb.last().trigger('click'); 16941 } 16942 return true; 16943 } 16944 } 16945 $next.trigger('click'); 16946 }; 16947 16948 // Navigate to specific image 16949 var show = function(number){ 16950 if(images <= small_thumbs || !o.show_begin_end_smallthumb){ 16951 number = number-1; 16952 } 16953 var $number = $smallthumb.eq(number); 16954 if($number.length && !st_moving){ 16955 var $active = $container.find('.etalage_smallthumb_active'), 16956 active = $active.data('id')-1, 16957 difference; 16958 // Move backward 16959 if(active > number){ 16960 st_steps = active - number; 16961 var $first = $container.find('.etalage_smallthumb_first'), 16962 firstid = $first.data('id'); 16963 if(number < firstid){ 16964 difference = active - firstid; 16965 st_steps = st_steps - difference; 16966 $first.trigger('click'); 16967 }else{ 16968 st_click($number, false); 16969 } 16970 } 16971 // Move forward 16972 else if(active < number){ 16973 st_steps = number - active; 16974 var $last = $container.find('.etalage_smallthumb_last'), 16975 lastid = $last.data('id')-1; 16976 if(number >= lastid){ 16977 difference = lastid - active - 1; 16978 st_steps = st_steps - difference; 16979 $last.trigger('click'); 16980 }else{ 16981 st_click($number, false); 16982 } 16983 } 16984 } 16985 }; 16986 16987// EXTERNAL FUNCTIONS 16988 16989 // Navigate to previous image 16990 window[instance_id+'_previous'] = function(){ 16991 prev(); 16992 }; 16993 16994 // Navigate to next image 16995 window[instance_id+'_next'] = function(){ 16996 next(); 16997 }; 16998 16999 // Navigate to specific image 17000 window[instance_id+'_show'] = function(number){ 17001 show(number); 17002 }; 17003 17004// CALLBACK FUNCTIONS 17005 17006 // Thumb click callback 17007 // Return false === do not trigger regular click event 17008 var click_callback = function(image_anchor){ 17009 // Plugin option callback 17010 if(!o.click_callback(image_anchor, instance_id)){ 17011 return false;
17012 } 17013 // Legacy support 17014 if(typeof etalage_click_callback === 'function'){ 17015 etalage_click_callback(image_anchor, instance_id); 17016 return false; 17017 } 17018 return true; 17019 }; 17020 17021 // Thumb switched callback 17022 var change_callback = function(image_number){ 17023 // Plugin option callback 17024 if(o.change_callback(image_number, instance_id)){ 17025 // Legacy support 17026 if(typeof etalage_change_callback === 'function'){ 17027 etalage_change_callback(image_number, instance_id); 17028 } 17029 } 17030 }; 17031 17032// ACTIONS 17033 17034 // Thumb hover 17035 17036 $thumbs.add($magnifier).add($icon).mouseenter(function(){ 17037 // Hide hint 17038 if(o.show_hint){ 17039 $hint.hide(); 17040 } 17041 // Start zooming 17042 if(!o.click_to_zoom || clicked_to_zoom){ 17043 start_zoom(); 17044 } 17045 }).mouseleave(function(){ 17046 stop_zoom(); 17047 }); 17048 17049 // Magnifier movement 17050 var max_zoomx = -(o.source_image_width-zoom_area_width), 17051 max_zoomy = -(o.source_image_height-zoom_area_height); 17052 $thumbs.add($magnifier).add($icon).mousemove(function(e){ 17053 var mouse_x = Math.round( e.pageX - $current_thumb.offset().left + magnifier_left ), 17054 mouse_y = Math.round( e.pageY - $current_thumb.offset().top + magnifier_top ); 17055 17056 // Magnifier location 17057 var new_x = (mouse_x-magnifier_center_x), 17058 new_y = (mouse_y-magnifier_center_y); 17059 if(new_x < magnifier_left){ new_x = magnifier_left; } 17060 if(new_x >
17060 magnifier_right){ new_x = magnifier_right; } 17061 if(new_y < magnifier_top){ new_y = magnifier_top; } 17062 if(new_y > magnifier_bottom){ new_y = magnifier_bottom; } 17063 $magnifier.css({ left:new_x, top:new_y }); 17064 17065 // Magnifier invert option 17066 if(o.magnifier_invert){ 17067 var invert_x = new_x-magnifier_left, 17068 invert_y = new_y-magnifier_top; 17069 $magnifier_img.css({ left:-invert_x, top:-invert_y }); 17070 } 17071 17072 // Zoomed area scrolling 17073 new_zoomx = -( (new_x-magnifier_left) * (1/(o.thumb_image_width/o.source_image_width)) ); 17074 new_zoomy = -( (new_y-magnifier_top) * (1/(o.thumb_image_height/o.source_image_height)) ); 17075 if(new_zoomx < max_zoomx){ new_zoomx = max_zoomx; } 17076 if(new_zoomy < max_zoomy){ new_zoomy = max_zoomy; } 17077 if(o.zoom_easing){ 17078 clearTimeout(zoom_move_timer); 17079 zoom_move(); 17080 } 17081 else{ 17082 if(preview){ 17083 $zoom_preview.css({ left:new_zoomx, top:new_zoomy }); 17084 } 17085 $zoom_img.css({ left:new_zoomx, top:new_zoomy }); 17086 } 17087 }); 17088 17089function st_shift_1(direction){ 17090 st_steps = (st_steps) ? st_steps-1 : 0; 17091 st_moving = true; 17092 var $first = $container.find('.etalage_smallthumb_first').removeClass('etalage_smallthumb_first'); 17093 var $last = $container.find('.etalage_smallthumb_last').removeClass('etalage_smallthumb_last'); 17094 var $next_first, $next_last, $next_active, distance; 17095 if(direction === 'left'){ 17096 $next_first = $first.prev().addClass('etalage_smallthumb_first'); 17097 $next_last = $last.prev().addClass('etalage_smallthumb_last'); 17098 $next_active = $first; 17099 }else{ 17100 $next_first = $first.next().addClass('etalage_smallthumb_first'); 17101 $next_last = $last.next().addClass('etalage_smallthumb_last'); 17102 $next_active = $last; 17103 } 17104 // If more steps 17105 if(st_steps){ 17106 if(direction==='left'){ 17107 $next_first.trigger('click'); 17108 }else{ 17109 $next_last.trigger('click'); 17110 } 17111 } 17112 // Move & select new thumb 17113 else{ 17114 // Get position 17115 distance = (smallthumbs_align==='vert') ? $next_first.position().top : $next_first.position().left; 17116 st_move(distance, $next_first, $next_last, $next_active); 17117 } 17118} 17119function st_slide_to_startend(to){ 17120 st_moving = true; 17121 var $first = $container.find('.etalage_smallthumb_first').removeClass('etalage_smallthumb_first'); 17122 var $last = $container.find('.etalage_smallthumb_last').removeClass('etalage_smallthumb_last'); 17123 var $next_first, $next_last, $next_active; 17124 if(to==='end'){ 17125 $next_first = $smallthumb.eq(smallthumbs-small_thumbs).addClass('etalage_smallthumb_first'); 17126 $next_last = $smallthumb.eq(smallthumbs-1).addClass('etalage_smallthumb_last'); 17127 $next_active = $next_last; 17128 if($next_last.hasClass('etalage_smallthumb_navtostart')){ 17129 $next_active = $next_last.prev(); 17130 } 17131 }else{ 17132 $next_first = $smallthumb.eq(0).addClass('etalage_smallthumb_first'); 17133 $next_last = $smallthumb.eq(small_thumbs-1).addClass('etalage_smallthumb_last'); 17134 $next_active = $next_first; 17135 if($next_first.hasClass('etalage_smallthumb_navtoend')){ 17136 $next_active = $next_first.next(); 17137 } 17138 } 17139 // Get position 17140 var distance = (smallthumbs_align==='vert') ? $next_first.position().top : $next_first.position().left; 17141 // Move & select new thumb 17142 st_move(distance, $next_first, $next_last, $next_active); 17143} 17144function st_slide_to_start(){ 17145 st_slide_to_startend('start'); 17146} 17147function st_slide_to_end(){ 17148 st_slide_to_startend('end'); 17149} 17150 17151 // Smallthumb behaviour 17152 if(images > 1 || !o.smallthumb_hide_single){ 17153 // Smallthumb click event 17154 $smallthumb.click(function(){ 17155 var $this = $(this), 17156 i, 17157 distance = 0, 17158 dont_move = false, 17159 $first, 17160 $last, 17161 $next_first, 17162 $next_last, 17163 $next_active; 17164 // If not active thumb & not already moving 17165 if(!$this.hasClass('etalage_smallthumb_active') && (!st_moving || st_steps)){ 17166 17167 // Slide left / up 17168 if($this.hasClass('etalage_smallthumb_first') && $this.prev().length){ 17169 st_shift_1('left'); 17170 } 17171 // Shift to end 17172 else if($this.hasClass('etalage_smallthumb_navtoend')){ 17173 st_slide_to_end(); 17174 } 17175 17176 // Slide right / down 17177 else if($this.hasClass('etalage_smallthumb_last') && $this.next().length){ 17178 st_shift_1('right'); 17179 } 17180 // Shift to beginning 17181 else if($this.hasClass('etalage_smallthumb_navtostart')){ 17182 st_slide_to_start(); 17183 } 17184 17185 // Regular click without moving smallthumbs 17186 else{ 17187 // If still stepping and this is the last 17188 if(st_steps && !$(this).next().length){ 17189 st_slide_to_end(); 17190 return true; 17191 } 17192 // If still stepping and this is the first 17193 else if(st_steps && !$(this).prev().length){ 17194 st_slide_to_start(); 17195 return true; 17196 } 17197 st_click($this, false); 17198 } 17199 17200 } 17201 }); 17202 17203 // Smallthumb hover 17204 if(o.smallthumb_select_on_hover){ 17205 $smallthumb.mouseenter(function(){ 17206 $(this).trigger('click'); 17207 }); 17208 } 17209 17210 } 17211 17212 // Large thumbnail click to zoom 17213 if(o.click_to_zoom){ 17214 $thumbs.click(function(){ 17215 clicked_to_zoom = true; 17216 start_zoom(); 17217 }); 17218 } 17219 // Large thumbnail click callback 17220 else{ 17221 $magnifier.click(function(){ 17222 var image_anchor = $current_thumb.data('anchor'); 17223 if(image_anchor){ 17224 // Click callback function 17225 if(click_callback(image_anchor)){ 17226 // Regular href action 17227 window.location = image_anchor; 17228 } 17229 } 17230 }); 17231 } 17232 17233 if(images > 1 && o.keyboard){ 17234 // Keystrokes 17235 $(document).keydown(function(e){ 17236 // Right arrow = move right / down 17237 if(e.keyCode===39 || e.keyCode==='39'){ 17238 if(!o.right_to_left){ 17239 next(); 17240 }else{ 17241 prev(); 17242 } 17243 } 17244 // Left arrow = move left / up 17245 if(e.keyCode===37 || e.keyCode==='37'){ 17246 if(!o.right_to_left){ 17247 prev(); 17248 }else{ 17249 next(); 17250 } 17251 } 17252 }); 17253 } 17254 17255 // Remove loading gifs when full page is loaded 17256 $(window).bind('load', function(){ 17257 // Large thumbnail background image 17258 $thumbs.css({ 'background-image':'none' }); 17259 // Zoom background image 17260 $zoom.css({ 'background-image':'none' }); 17261 // Remove zoom preview 17262 if(preview){ 17263 preview = false;
17264 $zoom_preview.remove(); 17265 } 17266 }); 17267 17268 // Initiate first autoplay 17269 if(autoplay){ 17270 startAutoplay(); 17271 } 17272 17273 } 17274 }); 17275 return this; 17276 }; 17277})(jQuery); 17278/*! 17279 Zoom 1.7.14 17280 license: MIT 17281 http://www.jacklmoore.com/zoom 17282*/ 17283(function ($) { 17284 var defaults = { 17285 url: false, 17286 callback: false, 17287 target: false, 17288 duration: 120, 17289 on: 'mouseover', // other options: grab, click, toggle 17290 touch: true, // enables a touch fallback 17291 onZoomIn: false, 17292 onZoomOut: false, 17293 magnify: 1 17294 }; 17295 17296 // Core Zoom Logic, independent of event listeners. 17297 $.zoom = function(target, source, img, magnify) { 17298 var targetHeight, 17299 targetWidth, 17300 sourceHeight, 17301 sourceWidth, 17302 xRatio, 17303 yRatio, 17304 offset, 17305 $target = $(target), 17306 position = $target.css('position'), 17307 $source = $(source); 17308 17309 // The parent element needs positioning so that the zoomed element can be correctly positioned within. 17310 $target.css('position', /(absolute|fixed)/.test(position) ? position : 'relative'); 17311 $target.css('overflow', 'hidden'); 17312 17313 img.style.width = img.style.height = ''; 17314 17315 $(img) 17316 .addClass('zoomImg') 17317 .css({ 17318 position: 'absolute', 17319 top: 0, 17320 left: 0, 17321 opacity: 0, 17322 width: img.width * magnify, 17323 height: img.height * magnify, 17324 border: 'none', 17325 maxWidth: 'none', 17326 maxHeight: 'none' 17327 }) 17328 .appendTo(target); 17329 17330 return { 17331 init: function() { 17332 targetWidth = $target.outerWidth(); 17333 targetHeight = $target.outerHeight(); 17334 17335 if (source === $target[0]) { 17336 sourceWidth = targetWidth; 17337 sourceHeight = targetHeight; 17338 } else { 17339 sourceWidth = $source.outerWidth(); 17340 sourceHeight = $source.outerHeight(); 17341 } 17342 17343 xRatio = (img.width - targetWidth) / sourceWidth; 17344 yRatio = (img.height - targetHeight) / sourceHeight; 17345 17346 offset = $source.offset(); 17347 }, 17348 move: function (e) { 17349 var left = (e.pageX - offset.left), 17350 top = (e.pageY - offset.top); 17351 17352 top = Math.max(Math.min(top, sourceHeight), 0); 17353 left = Math.max(Math.min(left, sourceWidth), 0); 17354 17355 img.style.left = (left * -xRatio) + 'px'; 17356 img.style.top = (top * -yRatio) + 'px'; 17357 } 17358 }; 17359 }; 17360 17361 $.fn.zoom = function (options) { 17362 return this.each(function () { 17363 var 17364 settings = $.extend({}, defaults, options || {}), 17365 //target will display the zoomed image 17366 target = settings.target || this, 17367 //source will provide zoom location info (thumbnail) 17368 source = this, 17369 $source = $(source), 17370 $target = $(target), 17371 img = document.createElement('img'), 17372 $img = $(img), 17373 mousemove = 'mousemove.zoom', 17374 clicked = false, 17375 touched = false, 17376 $urlElement; 17377 17378 // If a url wasn't specified, look for an image element. 17379 if (!settings.url) { 17380 $urlElement = $source.find('img'); 17381 if ($urlElement[0]) { 17382 settings.url = $urlElement.data('src') || $urlElement.attr('src'); 17383 } 17384 if (!settings.url) { 17385 return; 17386 } 17387 } 17388 17389 (function(){ 17390 var position = $target.css('position'); 17391 var overflow = $target.css('overflow'); 17392 17393 $source.one('zoom.destroy', function(){ 17394 $source.off(".zoom"); 17395 $target.css('position', position); 17396 $target.css('overflow', overflow); 17397 $img.remove(); 17398 }); 17399 17400 }()); 17401 17402 img.onload = function () { 17403 var zoom = $.zoom(target, source, img, settings.magnify); 17404 17405 function start(e) { 17406 zoom.init(); 17407 zoom.move(e); 17408 17409 // Skip the fade-in for IE8 and lower since it chokes on fading-in 17410 // and changing position based on mousemovement at the same time. 17411 $img.stop() 17412 .fadeTo($.support.opacity ? settings.duration : 0, 1, $.isFunction(settings.onZoomIn) ? settings.onZoomIn.call(img) : false); 17413 } 17414 17415 function stop() { 17416 $img.stop() 17417 .fadeTo(settings.duration, 0, $.isFunction(settings.onZoomOut) ? settings.onZoomOut.call(img) : false); 17418 } 17419 17420 // Mouse events 17421 if (settings.on === 'grab') { 17422 $source 17423 .on('mousedown.zoom', 17424 function (e) { 17425 if (e.which === 1) { 17426 $(document).one('mouseup.zoom', 17427 function () { 17428 stop(); 17429 17430 $(document).off(mousemove, zoom.move); 17431 } 17432 ); 17433 17434 start(e); 17435 17436 $(document).on(mousemove, zoom.move); 17437 17438 e.preventDefault(); 17439 } 17440 } 17441 ); 17442 } else if (settings.on === 'click') { 17443 $source.on('click.zoom', 17444 function (e) { 17445 if (clicked) { 17446 // bubble the event up to the document to trigger the unbind. 17447 return; 17448 } else { 17449 clicked = true; 17450 start(e); 17451 $(document).on(mousemove, zoom.move); 17452 $(document).one('click.zoom', 17453 function () { 17454 stop(); 17455 clicked = false;
17456 $(document).off(mousemove, zoom.move); 17457 } 17458 ); 17459 return false; 17460 } 17461 } 17462 ); 17463 } else if (settings.on === 'toggle') { 17464 $source.on('click.zoom', 17465 function (e) { 17466 if (clicked) { 17467 stop(); 17468 } else { 17469 start(e); 17470 } 17471 clicked = !clicked; 17472 } 17473 ); 17474 } else if (settings.on === 'mouseover') { 17475 zoom.init(); // Preemptively call init because IE7 will fire the mousemove handler before the hover handler. 17476 17477 $source 17478 .on('mouseenter.zoom', start) 17479 .on('mouseleave.zoom', stop) 17480 .on(mousemove, zoom.move); 17481 } 17482 17483 // Touch fallback 17484 if (settings.touch) { 17485 $source 17486 .on('touchstart.zoom', function (e) { 17487 e.preventDefault(); 17488 if (touched) { 17489 touched = false; 17490 stop(); 17491 } else { 17492 touched = true; 17493 start( e.originalEvent.touches[0] || e.originalEvent.changedTouches[0] ); 17494 } 17495 }) 17496 .on('touchmove.zoom', function (e) { 17497 e.preventDefault(); 17498 zoom.move( e.originalEvent.touches[0] || e.originalEvent.changedTouches[0] ); 17499 }); 17500 } 17501 17502 if ($.isFunction(settings.callback)) { 17503 settings.callback.call(img); 17504 } 17505 }; 17506 17507 img.src = settings.url; 17508 }); 17509 }; 17510 17511 $.fn.zoom.defaults = defaults; 17512}(window.jQuery)); 17513/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) 17514 * Licensed under the MIT License (LICENSE.txt). 17515 * 17516 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 17517 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 17518 * Thanks to: Seamus Leahy for adding deltaX and deltaY 17519 * 17520 * Version: 3.0.6 17521 * 17522 * Requires: 1.2.2+ 17523 */ 17524(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]]= 17525d.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); 17526/* 17527 * jQuery SelectBox Styler v1.0.1 17528 * http://dimox.name/styling-select-boxes-using-jquery-css/ 17529 * 17530 * Copyright 2012 Dimox (http://dimox.name/) 17531 * Released under the MIT license. 17532 * 17533 * Date: 2012.10.07 17534 * 17535 */ 17536 17537(function($) { 17538 $.fn.selectbox = function(options) { 17539 var settings = $.extend({ styleClass: '' }, options); 17540 $(this).each(function() { 17541 var styleClass = settings.styleClass; 17542 var select = $(this); 17543 if (select.prev('span.selectbox').length < 1) { 17544 function doSelect() { 17545 var option = select.find('option'); 17546 var optionSelected = option.filter(':selected'); 17547 var optionText = option.filter(':first').text(); 17548 if(option.filter(':first').attr('data-image')) 17549 optionText = '<img src="' + option.filter(':first').attr('data-image') + '"/>' + optionText; 17550 17551 if (optionSelected.length){ 17552 optionText = optionSelected.text(); 17553 if(optionSelected.attr('data-image')) 17554 optionText = '<img src="' + optionSelected.attr('data-image') + '"/>' + optionText; 17555 17556 } 17557 17558 var ddlist = ''; 17559 for (i = 0; i < option.length; i++) { 17560 var selected = ''; 17561 var disabled = ' class="disabled"'; 17562 if (option.eq(i).is(':selected')) { 17563 selected = ' class="selected sel"'; 17564 ddlist += '<li' + selected + '><a>' 17565 if(option.eq(i).attr('data-image')) 17566 ddlist += '<img src="' + option.eq(i).attr('data-image') + '"/>'; 17567 ddlist += option.eq(i).text() +'</a></li>'; 17568 } 17569 else 17570 if (option.eq(i).is(':disabled')) { 17571 selected = disabled; 17572 ddlist += '<li' + selected + '><a>'+ option.eq(i).text() +'</a></li>'; 17573 } 17574 else { 17575 ddlist += '<li' + selected + '><a href="'+option.eq(i).val()+'">'; 17576 if(option.eq(i).attr('data-image')) 17577 ddlist += '<img src="' + option.eq(i).attr('data-image') + '"/>'; 17578 ddlist += option.eq(i).html() +'</a></li>'; 17579 } 17580 //ddlist += '<li' + selected + '>'+ option.eq(i).text() +'</li>'; 17581 //ddlist += '<li' + selected + '><a href="'+option.eq(i).val()+'">'+ option.eq(i).html() +'</a></li>'; 17582 } 17583 var selectbox = 17584 $('<span class="selectbox '+styleClass+'" style="display:inline-block;position:relative">'+ 17585 '<div class="select" style="float:left;position:relative;z-index:10000"><div class="text">
17585' + optionText + '</div>'+ 17586 '<b class="trigger"><i class="icon-down-dir"></i></b>'+ 17587 '</div>'+ 17588 '<div class="dropdown" style="position:absolute;z-index:9999;overflow:auto;overflow-x:hidden;list-style:none">'+ 17589 '<ul>' + ddlist + '</ul>'+ 17590 '</div>'+ 17591 '</span>'); 17592 select.before(selectbox).css({position: 'absolute', top: -9999}); 17593 var divSelect = selectbox.find('div.select'); 17594 var divText = selectbox.find('div.text'); 17595 var dropdown = selectbox.find('div.dropdown'); 17596 var li = dropdown.find('li'); 17597 var selectHeight = selectbox.outerHeight(); 17598 if (dropdown.css('left') == 'auto') dropdown.css({left: 0}); 17599 if (dropdown.css('top') == 'auto' || dropdown.css('top') == '0px'){ dropdown.css({top: selectHeight}); } 17600 var liHeight = li.outerHeight(); 17601 var position = dropdown.css('top'); 17602 dropdown.hide(); 17603 dropdown.css('width', dropdown.parent().width()+"px"); 17604 /* пÑи клике на пÑевдоÑелекÑе */ 17605 divSelect.mouseover(function() { 17606 /* Ñмное позиÑиониÑование */ 17607 var topOffset = selectbox.offset().top; 17608 var bottomOffset = $(window).height() - selectHeight - (topOffset - $(window).scrollTop()); 17609 if (bottomOffset < 0 || bottomOffset < liHeight * 6) { 17610 dropdown.height('auto').css({top: 'auto', bottom: position}); 17611 dropdown.addClass('top-dropdown'); 17612 if (dropdown.outerHeight() > topOffset - $(window).scrollTop() - 20 ) { 17613 dropdown.height(Math.floor((topOffset - $(window).scrollTop() - 20) / liHeight) * liHeight); 17614 } 17615 } else if (bottomOffset > liHeight * 6) { 17616 dropdown.height('auto').css({bottom: 'auto', top: position}); 17617 if (dropdown.outerHeight() > bottomOffset - 20 ) { 17618 dropdown.height(Math.floor((bottomOffset - 20) / liHeight) * liHeight); 17619 } 17620 } 17621 dropdown.css('width', dropdown.parent().width()+"px"); 17622 17623 $('span.selectbox').css({zIndex: 1}).removeClass('focused'); 17624 selectbox.css({zIndex: 4}); 17625 if (dropdown.is(':hidden')) { 17626 $('div.dropdown:visible').hide(); 17627 dropdown.fadeIn('fast'); 17628 } 17629 return false; 17630 }); 17631 $('span.selectbox').mouseleave(function(){ 17632 dropdown.fadeOut('fast'); 17633 dropdown.removeClass('top-dropdown'); 17634 return false; 17635 }); 17636 /* пÑи наведении кÑÑÑоÑа на пÑÐ½ÐºÑ ÑпиÑка */ 17637 li.hover(function() { 17638 $(this).siblings().removeClass('selected'); 17639 }); 17640 var selectedText = li.filter('.selected').text(); 17641 /* пÑи клике на пÑÐ½ÐºÑ ÑпиÑка */ 17642 li.filter(':not(.disabled)').click(function() { 17643 var liText = $(this).text(); 17644 if ( selectedText != liText ) { 17645 $(this).addClass('selected sel').siblings().removeClass('selected sel'); 17646 option.removeAttr('selected').eq($(this).index()).attr('selected', true); 17647 selectedText = liText; 17648 divText.text(liText); 17649 select.change(); 17650 } 17651 dropdown.hide(); 17652 }); 17653 dropdown.mouseout(function() { 17654 dropdown.find('li.sel').addClass('selected'); 17655 }); 17656 /* ÑокÑÑ Ð½Ð° ÑелекÑе */ 17657 select.focus(function() { 17658 $('span.selectbox').removeClass('focused'); 17659 selectbox.addClass('focused'); 17660 }) 17661 /* менÑем ÑÐµÐ»ÐµÐºÑ Ñ ÐºÐ»Ð°Ð²Ð¸Ð°ÑÑÑÑ */ 17662 .keyup(function() { 17663 divText.text(option.filter(':selected').text()); 17664 li.removeClass('selected sel').eq(option.filter(':selected').index()).addClass('selected sel'); 17665 }); 17666 /* пÑÑÑем вÑпадаÑÑий ÑпиÑок пÑи клике за пÑеделами ÑелекÑа */ 17667 $(document).on('click', function(e) { 17668 if (!$(e.target).parents().hasClass('selectbox')) { 17669 dropdown.hide().find('li.sel').addClass('selected'); 17670 selectbox.removeClass('focused'); 17671 } 17672 }); 17673 } 17674 doSelect(); 17675 // обновление пÑи динамиÑеÑком изменении 17676 select.on('refresh', function() { 17677 select.prev().remove(); 17678 doSelect(); 17679 }) 17680 } 17681 }); 17682 } 17683})(jQuery) 17684/*! Stellar.js v0.6.2 | Copyright 2014, Mark Dalgleish | http://markdalgleish.com/projects/stellar.js | http://markdalgleish.mit-license.org */ 17685!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
17685ds:!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,
17685startingOffsetLeft: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
17685dPositionLeft: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
17685dPositionLeft)*(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); 17686/* 17687Plugin: jQuery Parallax 17688Version 1.1.3 17689Author: Ian Lunn 17690Twitter: @IanLunn 17691Author URL: http://www.ianlunn.co.uk/ 17692Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/ 17693 17694Dual licensed under the MIT and GPL licenses: 17695http://www.opensource.org/licenses/mit-license.php 17696http://www.gnu.org/licenses/gpl.html 17697*/ 17698 17699(function( $ ){ 17700 var $window = $(window); 17701 var windowHeight = $window.height(); 17702 17703 $window.resize(function () { 17704 windowHeight = $window.height(); 17705 }); 17706 17707 $.fn.parallax = function(xpos, speedFactor, firstTop, outerHeight) { 17708 var $this = $(this); 17709 var getHeight; 17710 var paddingTop = 0; 17711 17712 //get the starting position of each element to have parallax applied to it 17713 if(firstTop == null){ 17714 $this.each(function(){ 17715 firstTop = $this.offset().top; 17716 }); 17717 } 17718 if (outerHeight) { 17719 getHeight = function(jqo) { 17720 return jqo.outerHeight(true); 17721 }; 17722 } else { 17723 getHeight = function(jqo) { 17724 return jqo.height(); 17725 }; 17726 } 17727 17728 // setup defaults if arguments aren't specified 17729 if (arguments.length < 1 || xpos === null) xpos = "50%"; 17730 if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; 17731 if (arguments.length < 3 || outerHeight === null) outerHeight = true; 17732 17733 // function to be called whenever the window is scrolled or resized 17734 function update(){ 17735 var pos = $window.scrollTop(); 17736 17737 $this.each(function(){ 17738 var $element = $(this); 17739 var top = $element.offset().top; 17740 var height = getHeight($element); 17741 17742 // Check if totally above or totally below viewport 17743 if (top + height < pos || top > pos + windowHeight) { 17744 return; 17745 } 17746 17747 $this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px"); 17748 }); 17749 } 17750 17751 $window.bind('scroll', update).resize(update); 17752 update(); 17753 }; 17754})(jQuery); 17755/*! 17756 * jQuery Cookie Plugin v1.4.1 17757 * https://github.com/carhartl/jquery-cookie 17758 * 17759 * Copyright 2013 Klaus Hartl 17760 * Released under the MIT license 17761 */ 17762(function (factory) { 17763 if (typeof define === 'function' && define.amd) { 17764 // AMD 17765 define(['jquery'], factory); 17766 } else if (typeof exports === 'object') { 17767 // CommonJS 17768 factory(require('jquery')); 17769 } else { 17770 // Browser globals 17771 factory(jQuery); 17772 } 17773}(function ($) { 17774 17775 var pluses = /\+/g; 17776 17777 function encode(s) { 17778 return config.raw ? s : encodeURIComponent(s); 17779 } 17780 17781 function decode(s) { 17782 return config.raw ? s : decodeURIComponent(s); 17783 } 17784 17785 function stringifyCookieValue(value) { 17786 return encode(config.json ? JSON.stringify(value) : String(value)); 17787 } 17788 17789 function parseCookieValue(s) { 17790 if (s.indexOf('"') === 0) { 17791 // This is a quoted cookie as according to RFC2068, unescape... 17792 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 17793 } 17794 17795 try { 17796 // Replace server-side written pluses with spaces. 17797 // If we can't decode the cookie, ignore it, it's unusable. 17798 // If we can't parse the cookie, ignore it, it's unusable. 17799 s = decodeURIComponent(s.replace(pluses, ' ')); 17800 return config.json ? JSON.parse(s) : s; 17801 } catch(e) {} 17802 } 17803 17804 function read(s, converter) { 17805 var value = config.raw ? s : parseCookieValue(s); 17806 return $.isFunction(converter) ? converter(value) : value; 17807 } 17808 17809 var config = $.cookie = function (key, value, options) { 17810 17811 // Write 17812 17813 if (value !== undefined && !$.isFunction(value)) { 17814 options = $.extend({}, config.defaults, options); 17815 17816 if (typeof options.expires === 'number') { 17817 var days = options.expires, t = options.expires = new Date(); 17818 t.setTime(+t + days * 864e+5); 17819 } 17820 17821 return (document.cookie = [ 17822 encode(key), '=', stringifyCookieValue(value), 17823 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 17824 options.path ? '; path=' + options.path : '', 17825 options.domain ? '; domain=' + options.domain : '', 17826 options.secure ? '; secure' : '' 17827 ].join('')); 17828 } 17829 17830 // Read 17831 17832 var result = key ? undefined : {}; 17833 17834 // To prevent the for loop in the first place assign an empty array 17835 // in case there are no cookies at all. Also prevents odd result when 17836 // calling $.cookie(). 17837 var cookies = document.cookie ? document.cookie.split('; ') : []; 17838 17839 for (var i = 0, l = cookies.length; i < l; i++) { 17840 var parts = cookies[i].split('='); 17841 var name = decode(parts.shift()); 17842 var cookie = parts.join('='); 17843 17844 if (key && key === name) { 17845 // If second argument (value) is a function it's a converter... 17846 result = read(cookie, value); 17847 break; 17848 } 17849 17850 // Prevent storing a cookie that we couldn't decode. 17851 if (!key && (cookie = read(cookie)) !== undefined) { 17852 result[name] = cookie; 17853 } 17854 } 17855 17856 return result; 17857 }; 17858 17859 config.defaults = {}; 17860 17861 $.removeCookie = function (key, options) { 17862 if ($.cookie(key) === undefined) { 17863 return false;
17864 } 17865 17866 // Must not alter options, thus extending a fresh object... 17867 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 17868 return !$.cookie(key); 17869 }; 17870 17871})); 17872if(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])}}
17872,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
17872s"/>').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()}}
17872if(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");
17872if(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) 17873/*! 17874 * Bootstrap v3.3.5 (http://getbootstrap.com) 17875 * Copyright 2011-2015 Twitter, Inc. 17876 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 17877 */ 17878
vendor: 4,442 bytes, lines 17879-17883
17879/*! 17880 * Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=c6a74c1505073b5853fc) 17881 * Config saved to config.json and https://gist.github.com/c6a74c1505073b5853fc 17882 */ 17883if("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
17883ort.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); 17884/*! 17885 * imagesLoaded PACKAGED v3.1.4 17886 * JavaScript is all like "You images are done yet or what?" 17887 * MIT License 17888 */ 17889 17890(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);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;
17890if(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("confirm",this,t)},f.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s}); 17891// ============================================== 17892// PDP - image zoom - needs to be available outside document.ready scope 17893// ============================================== 17894 17895var ProductMediaManager = { 17896 IMAGE_ZOOM_THRESHOLD: 20, 17897 imageWrapper: null, 17898 17899 swapImage: function(targetImage) { 17900 targetImage = jQuery(targetImage); 17901 targetImage.addClass('gallery-image'); 17902 17903 if(targetImage[0].complete) { //image already loaded -- swap immediately 17904 jQuery("li.etalage_thumb").trigger('zoom.destroy'); 17905 jQuery("li.etalage_thumb .gallery-image").remove(); 17906 jQuery("li.etalage_thumb img.etalage_thumb_image").removeClass("hide").show(); 17907 jQuery("li.etalage_thumb_active img.etalage_thumb_image").addClass("hide").hide(); 17908 jQuery(targetImage).insertBefore(jQuery("li.etalage_thumb_active img.etalage_thumb_image")); 17909 imagesLoaded(targetImage, function() { 17910 if(typeof zoom_enabled !== 'undefined' && zoom_enabled == true){ 17911 if(typeof zoom_type !== 'undefined' && zoom_type == 1){ 17912 jQuery("li.etalage_thumb").zoom({target: jQuery(".product-view-zoom-area"),touch:false}); 17913 } else { 17914 jQuery("li.etalage_thumb").zoom({touch:false}); 17915 } 17916 } 17917 }); 17918 17919 } else { //need to wait for image to load 17920 jQuery("li.etalage_thumb").trigger('zoom.destroy'); 17921 jQuery("li.etalage_thumb .gallery-image").remove(); 17922 jQuery("li.etalage_thumb img.etalage_thumb_image").removeClass("hide").show(); 17923 jQuery("li.etalage_thumb_active img.etalage_thumb_image").addClass("hide").hide(); 17924 jQuery(targetImage).insertBefore(jQuery("li.etalage_thumb_active img.etalage_thumb_image")); 17925 imagesLoaded(targetImage, function() { 17926 if(typeof zoom_enabled !== 'undefined' && zoom_enabled == true){ 17927 if(typeof zoom_type !== 'undefined' && zoom_type == 1){ 17928 jQuery("li.etalage_thumb").zoom({target: jQuery(".product-view-zoom-area"),touch:false}); 17929 } else { 17930 jQuery("li.etalage_thumb").zoom({touch:false}); 17931 } 17932 } 17933 }); 17934 17935 } 17936 jQuery("li.etalage_thumb .gallery-image").each(function(){ 17937 jQuery(this).attr("style",jQuery(this).parent().children(".etalage_thumb_image").attr("style")); 17938 }); 17939 jQuery("li.etalage_thumb .gallery-image").show(); 17940 }, 17941 init: function() { 17942 ProductMediaManager.imageWrapper = jQuery('.product-img-box'); 17943 17944 jQuery(document).trigger('product-media-loaded', ProductMediaManager); 17945 } 17946}; 17947 17948jQuery(document).ready(function() { 17949 ProductMediaManager.init(); 17950}); 17951/** 17952 * Magento 17953 * 17954 * NOTICE OF LICENSE 17955 * 17956 * This source file is subject to the Academic Free License (AFL 3.0) 17957 * that is bundled with this package in the file LICENSE_AFL.txt. 17958 * It is also available through the world-wide-web at this URL: 17959 * http://opensource.org/licenses/afl-3.0.php 17960 * If you did not receive a copy of the license and are unable to 17961 * obtain it through the world-wide-web, please send an email 17962 * to [email protected] so we can send you a copy immediately. 17963 * 17964 * DISCLAIMER 17965 * 17966 * Do not edit or add to this file if you wish to upgrade Magento to newer 17967 * versions in the future. If you wish to customize Magento for your 17968 * needs please refer to http://www.magento.com for more information. 17969 * 17970 * @category design 17971 * @package base_default 17972 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 17973 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 17974 */ 17975if (!window.Catalog) { 17976 window.Catalog = {}; 17977} 17978 17979Catalog.Map = { 17980 17981 helpLinks: [], 17982 17983 active: false, 17984 17985 addHelpLink: function(linkElement, title, actualPrice, msrpPrice, addToCartLink) { 17986 if (typeof linkElement == 'string') { 17987 linkElement = $$(linkElement)[0]; 17988 } 17989 17990 if (!linkElement) { 17991 return; 17992 } 17993 17994 var helpLink = { 17995 'link': linkElement 17996 }; 17997 17998 var showPopup = false;
17999 18000 if (typeof title == 'string' && title) { 18001 helpLink.title = title; 18002 showPopup = true; 18003 } 18004 18005 if (typeof actualPrice == 'string' && actualPrice || typeof actualPrice == 'object' && actualPrice) { 18006 helpLink.price = actualPrice; 18007 showPopup = true; 18008 } 18009 18010 if (typeof msrpPrice == 'string' && msrpPrice) { 18011 helpLink.msrp = msrpPrice; 18012 showPopup = true; 18013 } 18014 18015 if (typeof addToCartLink == 'string' && addToCartLink) { 18016 helpLink.cartLink = addToCartLink; 18017 } else if (addToCartLink && addToCartLink.url) { 18018 helpLink.cartLink = addToCartLink.url; 18019 if (addToCartLink.qty) { 18020 helpLink.qty = addToCartLink.qty; 18021 } 18022 if (addToCartLink.notUseForm) { 18023 helpLink.notUseForm = addToCartLink.notUseForm; 18024 } 18025 } 18026 18027 if (!showPopup) { 18028 this.setGotoView(linkElement, addToCartLink); 18029 } else { 18030 var helpLinkIndex = this.helpLinks.push(helpLink) - 1; 18031 Event.observe(linkElement, 'click', this.showHelp.bind(this.helpLinks[helpLinkIndex])); 18032 } 18033 return helpLink; 18034 }, 18035 18036 setGotoView: function(element, viewPageUrl) { 18037 $(element).stopObserving('click'); 18038 element.href = viewPageUrl; 18039 if(window.opener) { 18040 Event.observe(element, 'click', function(event) { 18041 setPLocation(this.href,true); 18042 Catalog.Map.hideHelp(); 18043 event.stop(); 18044 }); 18045 } else { 18046 Event.observe(element, 'click', function(event) { 18047 setLocation(this.href); 18048 Catalog.Map.hideHelp(); 18049 event.stop(); 18050 }); 18051 } 18052 }, 18053 18054 showSelects: function() { 18055 var elements = document.getElementsByTagName("select"); 18056 for (i=0;i< elements.length;i++) { 18057 elements[i].style.visibility='visible'; 18058 } 18059 }, 18060 18061 hideSelects: function() { 18062 var elements = document.getElementsByTagName("select"); 18063 for (i=0;i< elements.length;i++) { 18064 elements[i].style.visibility='hidden'; 18065 } 18066 }, 18067 18068 showHelp: function(event) { 18069 var helpBox = $('map-popup'), 18070 isIE6 = typeof document.body.style.maxHeight === "undefined"; 18071 if (!helpBox) { 18072 return; 18073 } 18074 18075 //Move help box to be right in body tag 18076 var bodyNode = $$('body')[0]; 18077 if (helpBox.parentNode != bodyNode) { 18078 helpBox.remove(); 18079 bodyNode.insert(helpBox); 18080 // Fix for FF4-FF5 bug with missing alt text after DOM manipulations 18081 var paypalImg = helpBox.select('.paypal-logo > a > img')[0]; 18082 if (paypalImg) paypalImg.src = paypalImg.src; 18083 } 18084 18085 if (this != Catalog.Map && Catalog.Map.active != this.link) { 18086 helpBox.style.display = 'none'; 18087 if (!helpBox.offsetPosition) { 18088 helpBox.offsetPosition = {left:0, top: 0}; 18089 } 18090 18091 helpBox.removeClassName('map-popup-right'); 18092 helpBox.removeClassName('map-popup-left'); 18093 if (Element.getWidth(bodyNode) < event.pageX + Element.getWidth(helpBox)) { 18094 helpBox.addClassName('map-popup-left'); 18095 } else if (event.pageX - Element.getWidth(helpBox) < 0) { 18096 helpBox.addClassName('map-popup-right'); 18097 } 18098 18099 helpBox.style.left = event.pageX - (Element.getWidth(helpBox) / 2) + 'px'; 18100 helpBox.style.top = event.pageY + 10 + 'px'; 18101 18102 //Title 18103 var mapTitle = $('map-popup-heading'); 18104 if (typeof this.title != 'undefined') { 18105 Element.update(mapTitle, this.title); 18106 $(mapTitle).show(); 18107 } else { 18108 $(mapTitle).hide(); 18109 } 18110 18111 //MSRP price 18112 var mapMsrp = $('map-popup-msrp-box'); 18113 if (typeof this.msrp != 'undefined') { 18114 Element.update($('map-popup-msrp'), this.msrp); 18115 $(mapMsrp).show(); 18116 } else { 18117 $(mapMsrp).hide(); 18118 } 18119 18120 //Actual price 18121 var mapPrice = $('map-popup-price-box'); 18122 if (typeof this.price != 'undefined') { 18123 var price = typeof this.price == 'object' ? this.price.innerHTML : this.price; 18124 Element.update($('map-popup-price'), price); 18125 $(mapPrice).show(); 18126 } else { 18127 $(mapPrice).hide(); 18128 } 18129 18130 //`Add to cart` button 18131 var cartButton = $('map-popup-button'); 18132 if (typeof this.cartLink != 'undefined') { 18133 if (typeof productAddToCartForm == 'undefined' || this.notUseForm) { 18134 Catalog.Map.setGotoView(cartButton, this.cartLink); 18135 productAddToCartForm = $('product_addtocart_form_from_popup'); 18136 } else { 18137 if (this.qty) { 18138 productAddToCartForm.qty = this.qty; 18139 } 18140 cartButton.stopObserving('click'); 18141 cartButton.href = this.cartLink; 18142 Event.observe(cartButton, 'click', function(event) { 18143 productAddToCartForm.action = this.href; 18144 productAddToCartForm.submit(this); 18145 }); 18146 } 18147 productAddToCartForm.action = this.cartLink; 18148 var productField = $('map-popup-product-id'); 18149 productField.value = this.product_id; 18150 $(cartButton).show(); 18151 $$('.additional-addtocart-box').invoke('show'); 18152 } else { 18153 $(cartButton).hide(); 18154 $$('.additional-addtocart-box').invoke('hide'); 18155 } 18156 18157 //Horizontal line 18158 var mapText = $('map-popup-text'), 18159 mapTextWhatThis = $('map-popup-text-what-this'),
18160 mapContent = $('map-popup-content'); 18161 if (!mapMsrp.visible() && !mapPrice.visible() && !cartButton.visible()) { 18162 //If just `What's this?` link 18163 $(mapText).hide(); 18164 $(mapTextWhatThis).show(); 18165 $(mapTextWhatThis).removeClassName('map-popup-only-text'); 18166 $(mapContent).hide().setStyle({visibility: 'hidden'}); 18167 $('product_addtocart_form_from_popup').hide(); 18168 } else { 18169 $(mapTextWhatThis).hide(); 18170 $(mapText).show(); 18171 $(mapText).addClassName('map-popup-only-text'); 18172 $(mapContent).show().setStyle({visibility: 'visible'}); 18173 $('product_addtocart_form_from_popup').show(); 18174 } 18175 18176 $(helpBox).show(); 18177 if (isIE6) { 18178 Catalog.Map.hideSelects(); 18179 } 18180 var closeButton = $('map-popup-close'); 18181 if (closeButton) { 18182 $(closeButton).stopObserving('click'); 18183 Event.observe(closeButton, 'click', Catalog.Map.showHelp.bind(this)); 18184 Catalog.Map.active = this.link; 18185 } 18186 } else { 18187 $(helpBox).hide(); 18188 if (isIE6) { 18189 Catalog.Map.showSelects(); 18190 } 18191 Catalog.Map.active = false; 18192 } 18193 18194 Event.stop(event); 18195 }, 18196 18197 hideHelp: function(){ 18198 var helpBox = $('map-popup'); 18199 if (helpBox) { 18200 var isIE6 = typeof document.body.style.maxHeight === "undefined"; 18201 $(helpBox).hide(); 18202 if (isIE6) { 18203 Catalog.Map.showSelects(); 18204 } 18205 Catalog.Map.active = false; 18206 } 18207 }, 18208 18209 bindProductForm: function(){ 18210 if (('undefined' != typeof productAddToCartForm) && productAddToCartForm) { 18211 productAddToCartFormOld = productAddToCartForm; 18212 productAddToCartForm = new VarienForm('product_addtocart_form_from_popup'); 18213 productAddToCartForm.submitLight = productAddToCartFormOld.submitLight; 18214 } else if(!$('product_addtocart_form_from_popup')) { 18215 return false; 18216 } else if ('undefined' == typeof productAddToCartForm) { 18217 productAddToCartForm = new VarienForm('product_addtocart_form_from_popup'); 18218 } 18219 18220 productAddToCartForm.submit = function(button, url) { 18221 if (('undefined' != typeof productAddToCartFormOld) && productAddToCartFormOld) { 18222 if (Catalog.Map.active) { 18223 Catalog.Map.hideHelp(); 18224 } 18225 if (productAddToCartForm.qty && $('qty')) { 18226 $('qty').value = productAddToCartForm.qty; 18227 } 18228 parentResult = productAddToCartFormOld.submit(); 18229 return false; 18230 } 18231 if(window.opener) { 18232 var parentButton = button; 18233 new Ajax.Request(this.form.action, { 18234 parameters: {isAjax: 1, method: 'GET'}, 18235 onSuccess: function(transport) { 18236 window.opener.focus(); 18237 if (parentButton && parentButton.href) { 18238 setPLocation(parentButton.href, true); 18239 Catalog.Map.hideHelp(); 18240 } 18241 } 18242 }); 18243 return; 18244 } 18245 if (this.validator.validate()) { 18246 var form = this.form; 18247 var oldUrl = form.action; 18248 18249 if (url) { 18250 form.action = url; 18251 } 18252 if (!form.getAttribute('action')) { 18253 form.action = productAddToCartForm.action; 18254 } 18255 try { 18256 this.form.submit(); 18257 } catch (e) { 18258 this.form.action = oldUrl; 18259 throw e; 18260 } 18261 this.form.action = oldUrl; 18262 18263 if (button && button != 'undefined') { 18264 button.disabled = true; 18265 } 18266 } 18267 }; 18268 } 18269}; 18270 18271Event.observe(window, 'resize', function(event) { 18272 if (Catalog.Map.active) { 18273 Catalog.Map.showHelp(event); 18274 } 18275}) 18276 18277$(document).observe('bundle:reload-price', function (event) { //reload price 18278 var data = event.memo, bundle = data.bundle; 18279 if (!Number(bundle.config.isMAPAppliedDirectly) && !Number(bundle.config.isFixedPrice)) { 18280 var canApplyMAP = false;
18281 try { 18282 for (var option in bundle.config.selected) { 18283 if (bundle.config.options[option] && bundle.config.options[option].selections) { 18284 var selections = bundle.config.options[option].selections; 18285 for (var i = 0, l = bundle.config.selected[option].length; i < l; i++) { 18286 var selectionId = bundle.config.selected[option][i]; 18287 if (Number(selections[selectionId].canApplyMAP)) { 18288 canApplyMAP = true; 18289 break; 18290 } 18291 } 18292 } 18293 if (canApplyMAP) { 18294 break; 18295 } 18296 } 18297 } catch (e) { 18298 canApplyMAP = true; 18299 } 18300 if (canApplyMAP) { 18301 $$('.full-product-price').each(function(e){ 18302 $(e).hide(); 18303 }); 18304 $$('.map-info').each(function(e){ 18305 $(e).show(); 18306 }); 18307 event.noReloadPrice = true; 18308 } else { 18309 $$('.full-product-price').each(function(e){ 18310 $(e).show(); 18311 }); 18312 $$('.map-info').each(function(e){ 18313 $(e).hide(); 18314 }); 18315 } 18316 } 18317}); 18318jQuery(document).ready(function($){ 18319 // **********************************************************************// 18320 // ! Main Navigation plugin 18321 // **********************************************************************// 18322 18323 $.fn.et_menu = function ( options ) { 18324 var methods = { 18325 showChildren: function(el) { 18326 el.fadeIn(100).css({ 18327 display: 'list-item', 18328 listStyle: 'none' 18329 }).find('li').css({listStyle: 'none'}); 18330 }, 18331 calculateColumns: function(el) { 18332 // calculate columns count 18333 var columnsCount = el.find('.container > ul > li.menu-item-has-children').length; 18334 var dropdownWidth = el.find('.container > ul > li').outerWidth(); 18335 var padding = 20; 18336 if(columnsCount > 1) { 18337 dropdownWidth = dropdownWidth*columnsCount + padding; 18338 el.css({ 18339 'width':dropdownWidth 18340 }); 18341 } 18342 18343 // calculate right offset of the dropdown 18344 var headerWidth = $('.menu-wrapper').outerWidth(); 18345 var headerLeft = $('.menu-wrapper').offset().left; 18346 var dropdownOffset = el.offset().left - headerLeft; 18347 var dropdownRight = headerWidth - (dropdownOffset + dropdownWidth); 18348 18349 if(dropdownRight < 0) { 18350 el.css({ 18351 'left':'auto', 18352 'right':0 18353 }); 18354 } 18355 }, 18356 openOnClick: function(el,e) { 18357 var timeOutTime = 0; 18358 var openedClass = "current"; 18359 var header = $('.header-wrapper'); 18360 var $this = el; 18361 18362 18363 if($this.parent().hasClass(openedClass)) { 18364 e.preventDefault(); 18365 $this.parent().removeClass(openedClass); 18366 $this.next().stop().slideUp(settings.animTime); 18367 header.stop().animate({'paddingBottom': 0}, settings.animTime); 18368 } else { 18369 18370 if($this.parent().find('>div').length < 1) { 18371 return; 18372 } 18373 18374 e.preventDefault(); 18375 18376 if($this.parent().parent().find('.' + openedClass).length > 0) { 18377 timeOutTime = settings.animTime; 18378 header.stop().animate({'paddingBottom': 0}, settings.animTime); 18379 } 18380 18381 $this.parent().parent().find('.' + openedClass).removeClass(openedClass).find('>div').stop().slideUp(settings.animTime); 18382 18383 setTimeout(function(){ 18384 $this.parent().addClass(openedClass); 18385 header.stop().animate({'paddingBottom': $this.next().height()+50},settings.animTime); 18386 $this.next().stop().slideDown(settings.animTime); 18387 },timeOutTime); 18388 } 18389 } 18390 }; 18391 18392 var settings = $.extend({ 18393 type: "default", // can be columns, default, mega, combined 18394 animTime: 250,
18395 openByClick: true 18396 }, options ); 18397 18398 this.find('>li').hover(function (){ 18399 if(!$(this).hasClass('open-by-click') || (!settings.openByClick && $(this).hasClass('open-by-click'))) { 18400 var dropdown = $(this).find('> .nav-sublist-dropdown'); 18401 if ($(this).hasClass('menu-full-width') && SW_MENU_POPUP_WIDTH) { 18402 dropdown.css('width', SW_MENU_POPUP_WIDTH); 18403 } 18404 methods.showChildren(dropdown); 18405 18406 if(settings.type == 'columns') { 18407 methods.calculateColumns(dropdown); 18408 } 18409 } 18410 }, function () { 18411 if(!$(this).hasClass('open-by-click') || (!settings.openByClick && $(this).hasClass('open-by-click'))) { 18412 $(this).find('> .nav-sublist-dropdown').fadeOut(100); 18413 } 18414 }); 18415 18416 return this; 18417 } 18418 18419 // First Type of column Menu 18420 $('.main-nav .menu').et_menu({ 18421 type: "default" 18422 }); 18423 18424 $('.fixed-header .menu').et_menu({ 18425 openByClick: false 18426 }); 18427 18428 18429 18430 function et_equalize_height(elements, removeHeight) { 18431 var heights = []; 18432 18433 if(removeHeight) { 18434 elements.attr('style', ''); 18435 } 18436 18437 elements.each(function(){ 18438 heights.push($(this).height()); 18439 }); 18440 18441 var maxHeight = Math.max.apply( Math, heights ); 18442 if($(window).width() > 767) { 18443 elements.height(maxHeight); 18444 } 18445 } 18446 18447 $(window).resize(function(){ 18448 //et_equalize_height($('.product-category'), true); 18449 }); 18450 18451 // **********************************************************************// 18452 // ! Mobile navigation 18453 // **********************************************************************// 18454 18455 var navList = $('.mobile-nav div > ul'); 18456 var etOpener = '<span class="open-child">(open)</span>'; 18457 navList.addClass('sw-mobile-menu'); 18458 18459 navList.find('li:has(ul)',this).each(function() { 18460 $(this).prepend(etOpener); 18461 }) 18462 18463 navList.find('.open-child').click(function(){ 18464 if ($(this).parent().hasClass('over')) { 18465 $(this).parent().removeClass('over').find('>ul').slideUp(200); 18466 }else{ 18467 $(this).parent().parent().find('>li.over').removeClass('over').find('>ul').slideUp(200); 18468 $(this).parent().addClass('over').find('>ul').slideDown(200); 18469 } 18470 }); 18471 $('.menu-icon, .close-mobile-nav, .header-container.type10 .dropdown-menu > .menu-container > a').click(function(event) { 18472 if(!$('body').hasClass('md-mobile-menu') && ($(".header-container").hasClass('type11') || $(".header-container").hasClass('type13') || $(".header-container").hasClass('type7'))) 18473 $('body').addClass('md-mobile-menu'); 18474 if(!$('body').hasClass('mobile-nav-shown')) { 18475 $('body').addClass('mobile-nav-shown', function() { 18476 // Hide search input on click 18477 setTimeout(function(){ 18478 $(document).one("click",function(e) { 18479 var target = e.target; 18480 if (!$(target).is('.mobile-nav') && !$(target).parents().is('.mobile-nav')) { 18481 $('body').removeClass('mobile-nav-shown'); 18482 } 18483 }); 18484 }, 111); 18485 }); 18486 } else{ 18487 $('body').removeClass('mobile-nav-shown'); 18488 } 18489 }); 18490}); 18491/** 18492 * Magento 18493 * 18494 * NOTICE OF LICENSE 18495 * 18496 * This source file is subject to the Academic Free License (AFL 3.0) 18497 * that is bundled with this package in the file LICENSE_AFL.txt. 18498 * It is also available through the world-wide-web at this URL: 18499 * http://opensource.org/licenses/afl-3.0.php 18500 * If you did not receive a copy of the license and are unable to 18501 * obtain it through the world-wide-web, please send an email 18502 * to [email protected] so we can send you a copy immediately. 18503 * 18504 * DISCLAIMER 18505 * 18506 * Do not edit or add to this file if you wish to upgrade Magento to newer 18507 * versions in the future. If you wish to customize Magento for your 18508 * needs please refer to http://www.magento.com for more information. 18509 * 18510 * @category design 18511 * @package base_default 18512 * @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com) 18513 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 18514 */ 18515if(typeof Product=='undefined') { 18516 var Product = {}; 18517} 18518/**************************** BUNDLE PRODUCT **************************/ 18519Product.Bundle = Class.create(); 18520Product.Bundle.prototype = { 18521 initialize: function(config){ 18522 this.config = config; 18523 18524 // Set preconfigured values for correct price base calculation 18525 if (config.defaultValues) { 18526 for (var option in config.defaultValues) { 18527 if (this.config['options'][option].isMulti) { 18528 var selected = new Array(); 18529 for (var i = 0; i < config.defaultValues[option].length; i++) { 18530 selected.push(config.defaultValues[option][i]); 18531 } 18532 this.config.selected[option] = selected; 18533 } else { 18534 this.config.selected[option] = new Array(config.defaultValues[option] + ""); 18535 } 18536 } 18537 } 18538 18539 this.reloadPrice(); 18540 }, 18541 changeSelection: function(selection){ 18542 var parts = selection.id.split('-'); 18543 if (this.config['options'][parts[2]].isMulti) { 18544 selected = new Array(); 18545 if (selection.tagName == 'SELECT') { 18546 for (var i = 0; i < selection.options.length; i++) { 18547 if (selection.options[i].selected && selection.options[i].value != '') { 18548 selected.push(selection.options[i].value); 18549 } 18550 } 18551 } else if (selection.tagName == 'INPUT') { 18552 selector = parts[0]+'-'+parts[1]+'-'+parts[2]; 18553 selections = $$('.'+selector); 18554 for (var i = 0; i < selections.length; i++) { 18555 if (selections[i].checked && selections[i].value != '') { 18556 selected.push(selections[i].value); 18557 } 18558 } 18559 } 18560 this.config.selected[parts[2]] = selected; 18561 } else { 18562 if (selection.value != '') { 18563 this.config.selected[parts[2]] = new Array(selection.value); 18564 } else { 18565 this.config.selected[parts[2]] = new Array(); 18566 } 18567 this.populateQty(parts[2], selection.value); 18568 var tierPriceElement = $('bundle-option-' + parts[2] + '-tier-prices'), 18569 tierPriceHtml = ''; 18570 if (selection.value != '' && this.config.options[parts[2]].selections[selection.value].customQty == 1) { 18571 tierPriceHtml = this.config.options[parts[2]].selections[selection.value].tierPriceHtml; 18572 } 18573 tierPriceElement.update(tierPriceHtml); 18574 } 18575 this.reloadPrice(); 18576 }, 18577 18578 reloadPrice: function() { 18579 var calculatedPrice = 0; 18580 var dispositionPrice = 0; 18581 var includeTaxPrice = 0; 18582 18583 for (var option in this.config.selected) { 18584 if (this.config.options[option]) { 18585 for (var i=0; i < this.config.selected[option].length; i++) { 18586 var prices = this.selectionPrice(option, this.config.selected[option][i]); 18587 calculatedPrice += Number(prices[0]); 18588 dispositionPrice += Number(prices[1]); 18589 includeTaxPrice += Number(prices[2]); 18590 } 18591 } 18592 } 18593 18594 //Tax is calculated in a different way for the the TOTAL BASED method 18595 //We round the taxes at the end. Hence we do the same for consistency 18596 //This variable is set in the bundle.phtml 18597 if (taxCalcMethod == CACL_TOTAL_BASE) { 18598 var calculatedPriceFormatted = calculatedPrice.toFixed(10); 18599 var includeTaxPriceFormatted = includeTaxPrice.toFixed(10); 18600 var tax = includeTaxPriceFormatted - calculatedPriceFormatted; 18601 calculatedPrice = includeTaxPrice - Math.round(tax * 100) / 100; 18602 } 18603
18604 //make sure that the prices are all rounded to two digits 18605 //this is needed when tax calculation is based on total for dynamic 18606 //price bundle product. For fixed price bundle product, the rounding 18607 //needs to be done after option price is added to base price 18608 if (this.config.priceType == '0') { 18609 calculatedPrice = Math.round(calculatedPrice*100)/100; 18610 dispositionPrice = Math.round(dispositionPrice*100)/100; 18611 includeTaxPrice = Math.round(includeTaxPrice*100)/100; 18612 18613 } 18614 18615 var event = $(document).fire('bundle:reload-price', { 18616 price: calculatedPrice, 18617 priceInclTax: includeTaxPrice, 18618 dispositionPrice: dispositionPrice, 18619 bundle: this 18620 }); 18621 if (!event.noReloadPrice) { 18622 optionsPrice.specialTaxPrice = 'true'; 18623 optionsPrice.changePrice('bundle', calculatedPrice); 18624 optionsPrice.changePrice('nontaxable', dispositionPrice); 18625 optionsPrice.changePrice('priceInclTax', includeTaxPrice); 18626 optionsPrice.reload(); 18627 } 18628 18629 return calculatedPrice; 18630 }, 18631 18632 selectionPrice: function(optionId, selectionId) { 18633 if (selectionId == '' || selectionId == 'none') { 18634 return 0; 18635 } 18636 var qty = null; 18637 var tierPriceInclTax, tierPriceExclTax; 18638 if (this.config.options[optionId].selections[selectionId].customQty == 1 && !this.config['options'][optionId].isMulti) { 18639 if ($('bundle-option-' + optionId + '-qty-input')) { 18640 qty = $('bundle-option-' + optionId + '-qty-input').value; 18641 } else { 18642 qty = 1; 18643 } 18644 } else { 18645 qty = this.config.options[optionId].selections[selectionId].qty; 18646 } 18647 if (this.config.priceType == '0') { 18648 price = this.config.options[optionId].selections[selectionId].price; 18649 tierPrice = this.config.options[optionId].selections[selectionId].tierPrice; 18650 18651 for (var i=0; i < tierPrice.length; i++) { 18652 if (Number(tierPrice[i].price_qty) <= qty && Number(tierPrice[i].price) <= price) { 18653 price = tierPrice[i].price; 18654 tierPriceInclTax = tierPrice[i].priceInclTax; 18655 tierPriceExclTax = tierPrice[i].priceExclTax; 18656 } 18657 } 18658 } else { 18659 selection = this.config.options[optionId].selections[selectionId]; 18660 if (selection.priceType == '0') { 18661 price = selection.priceValue; 18662 } else { 18663 price = (this.config.basePrice*selection.priceValue)/100; 18664 } 18665 } 18666 //price += this.config.options[optionId].selections[selectionId].plusDisposition; 18667 //price -= this.config.options[optionId].selections[selectionId].minusDisposition; 18668 //return price*qty; 18669 var disposition = this.config.options[optionId].selections[selectionId].plusDisposition + 18670 this.config.options[optionId].selections[selectionId].minusDisposition; 18671 18672 if (this.config.specialPrice) { 18673 newPrice = (price*this.config.specialPrice)/100; 18674 price = Math.min(newPrice, price); 18675 } 18676 18677 selection = this.config.options[optionId].selections[selectionId]; 18678 if (tierPriceInclTax !== undefined && tierPriceExclTax !== undefined) { 18679 priceInclTax = tierPriceInclTax; 18680 price = tierPriceExclTax; 18681 } else if (selection.priceInclTax !== undefined) { 18682 priceInclTax = selection.priceInclTax; 18683 price = selection.priceExclTax !== undefined ? selection.priceExclTax : selection.price; 18684 } else { 18685 priceInclTax = price; 18686 } 18687 18688 if (this.config.priceType == '1' || taxCalcMethod == CACL_TOTAL_BASE) { 18689 var result = new Array(price*qty, disposition*qty, priceInclTax*qty); 18690 return result; 18691 } 18692 else if (taxCalcMethod == CACL_UNIT_BASE) { 18693 price = (Math.round(price*100)/100).toString(); 18694 disposition = (Math.round(disposition*100)/100).toString(); 18695 priceInclTax = (Math.round(priceInclTax*100)/100).toString(); 18696 var result = new Array(price*qty, disposition*qty, priceInclTax*qty); 18697 return result; 18698 } else { //taxCalcMethod == CACL_ROW_BASE) 18699 price = (Math.round(price*qty*100)/100).toString(); 18700 disposition = (Math.round(disposition*qty*100)/100).toString(); 18701 priceInclTax = (Math.round(priceInclTax*qty*100)/100).toString(); 18702 var result = new Array(price, disposition, priceInclTax); 18703 return result; 18704 } 18705 }, 18706 18707 populateQty: function(optionId, selectionId){ 18708 if (selectionId == '' || selectionId == 'none') { 18709 this.showQtyInput(optionId, '0', false); 18710 return; 18711 } 18712 if (this.config.options[optionId].selections[selectionId].customQty == 1) { 18713 this.showQtyInput(optionId, this.config.options[optionId].selections[selectionId].qty, true); 18714 } else { 18715 this.showQtyInput(optionId, this.config.options[optionId].selections[selectionId].qty, false); 18716 } 18717 }, 18718 18719 showQtyInput: function(optionId, value, canEdit) { 18720 elem = $('bundle-option-' + optionId + '-qty-input'); 18721 elem.value = value; 18722 elem.disabled = !canEdit; 18723 if (canEdit) { 18724 elem.removeClassName('qty-disabled'); 18725 } else { 18726 elem.addClassName('qty-disabled'); 18727 } 18728 }, 18729 18730 changeOptionQty: function (element, event) { 18731 var checkQty = true; 18732 if (typeof(event) != 'undefined') { 18733 if (event.keyCode == 8 || event.keyCode == 46) { 18734 checkQty = false;
18735 } 18736 } 18737 if (checkQty && (Number(element.value) == 0 || isNaN(Number(element.value)))) { 18738 element.value = 1; 18739 } 18740 parts = element.id.split('-'); 18741 optionId = parts[2]; 18742 if (!this.config['options'][optionId].isMulti) { 18743 selectionId = this.config.selected[optionId][0]; 18744 this.config.options[optionId].selections[selectionId].qty = element.value*1; 18745 this.reloadPrice(); 18746 } 18747 }, 18748 18749 validationCallback: function (elmId, result){ 18750 if (elmId == undefined || $(elmId) == undefined) { 18751 return; 18752 } 18753 var container = $(elmId).up('ul.options-list'); 18754 if (typeof container != 'undefined') { 18755 if (result == 'failed') { 18756 container.removeClassName('validation-passed'); 18757 container.addClassName('validation-failed'); 18758 } else { 18759 container.removeClassName('validation-failed'); 18760 container.addClassName('validation-passed'); 18761 } 18762 } 18763 } 18764} 18765jQuery.noConflict(); 18766jQuery(function($) { 18767 //insert quickview popup 18768 // $('.quickview-icon').fancybox({ 18769 // 'type' : 'iframe', 18770 // 'autoSize' : false, 18771 // 'titleShow' : false, 18772 // 'autoScale' : false, 18773 // 'transitionIn' : 'none', 18774 // 'transitionOut' : 'none', 18775 // 'scrolling' : 'auto', 18776 // 'padding' : 0, 18777 // 'margin' : 0, 18778 // 'autoDimensions' : false, 18779 // 'width' : EM.Quickview.QS_FRM_WIDTH, 18780 // 'maxHeight' : EM.Quickview.QS_FRM_HEIGHT, 18781 // 'centerOnScroll' : true, 18782 // 'height' : 'auto', 18783 // 'ajaxLoad' : null, 18784 // 'beforeLoad' : function() { 18785 // $("head").append('<style type="text/css" id="fancybox_hide_loading_css">#fancybox-loading{display:none}.fancybox-overlay{background:transparent}</style>'); 18786 // $(".loader-container").hide(); 18787 // $(this.element).parent().children(".loader-container").show(); 18788 // }, 18789 // 'afterLoad' : function() { 18790 // $("#fancybox_hide_loading_css").remove(); 18791 // $(".loader-container").hide(); 18792 // }, 18793 // 'afterClose': function(){ 18794 // setTimeout(function(){ 18795 // $("#fancybox_hide_loading_css").remove(); 18796 // }, 500); 18797 // $(".loader-container").hide(); 18798 // }, 18799 // 'helpers': { 18800 // overlay: { 18801 // locked: false 18802 // } 18803 // } 18804 // }); 18805}); 18806var 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= 18807!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="https://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))}, 18808callback: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]); 18809d++}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); 18810f[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+ 18811"</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 18812-18831
18812/*! WOW - v0.1.7 - 2014-05-07 18813* 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); 18814function setNewsletterCookie(){ 18815 jQuery.cookie('newsletter_popup','dontshowitagain'); 18816} 18817jQuery.fn.extend({ 18818 scrollToMe: function(){ 18819 if(jQuery(this).length){ 18820 var top = jQuery(this).offset().top - 100; 18821 jQuery('html,body').animate({scrollTop: top}, 300); 18822 } 18823 }, 18824 scrollToJustMe: function(){ 18825 if(jQuery(this).length){ 18826 var top = jQuery(this).offset().top; 18827 jQuery('html,body').animate({scrollTop: top}, 300); 18828 } 18829 } 18830}); 18831function portoAlert(msg){
18832 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"); 18833 jQuery(".alert").fadeIn(500); 18834 setTimeout(function(){ jQuery(".alert").fadeOut(500);setTimeout(function(){jQuery(".alert").remove();},500);},3000); 18835} 18836jQuery(function($){ 18837 $('div.product-view p.no-rating a, div.product-view .rating-links a').click(function(){ 18838 if($('#tab_review_tabbed').hasClass("panel-collapse")){ 18839 if(!$('#tab_review_tabbed').hasClass("in")) 18840 $('#tab_review_tabbed').prev().find("a").trigger("click"); 18841 setTimeout(function(){ 18842 $('#product_tab_accordion').scrollToJustMe(); 18843 },200); 18844 } else { 18845 $('.product-tabs ul li').removeClass('active'); 18846 $('#tab_review_tabbed').addClass('active'); 18847 $('.product-tabs .tab-content').hide(); 18848 $('#tab_review_tabbed_contents').show(); 18849 $('#tab_review_tabbed').scrollToMe(); 18850 } 18851 return false; 18852 }); 18853 18854 $(".word-rotate").each(function() { 18855 18856 var $this = $(this), 18857 itemsWrapper = $(this).find(".word-rotate-items"), 18858 items = itemsWrapper.find("> span"), 18859 firstItem = items.eq(0), 18860 firstItemClone = firstItem.clone(), 18861 itemHeight = 0, 18862 currentItem = 1, 18863 currentTop = 0; 18864 18865 itemHeight = firstItem.height(); 18866 18867 itemsWrapper.append(firstItemClone); 18868 18869 $this 18870 .height(itemHeight) 18871 .addClass("active"); 18872 18873 setInterval(function() { 18874 currentTop = (currentItem * itemHeight); 18875 18876 itemsWrapper.animate({ 18877 top: -(currentTop) + "px" 18878 }, 300, function() { 18879 currentItem++; 18880 if(currentItem > items.length) { 18881 itemsWrapper.css("top", 0); 18882 currentItem = 1; 18883 } 18884 }); 18885 18886 }, 2000); 18887 18888 }); 18889 // $(window).stellar({ 18890 // responsive: true, 18891 // scrollProperty: 'scroll', 18892 // parallaxElements: false, 18893 // horizontalScrolling: false, 18894 // horizontalOffset: 0, 18895 // verticalOffset: 0 18896 // }); 18897/********** Fullscreen Slider ************/ 18898 var s_width = $(window).innerWidth(); 18899 var s_height = $(window).innerHeight(); 18900 var s_ratio = s_width/s_height; 18901 var v_width=320; 18902 var v_height=240; 18903 var v_ratio = v_width/v_height; 18904 $(".full-screen-slider div.item").css("position","relative"); 18905 $(".full-screen-slider div.item").css("overflow","hidden"); 18906 $(".full-screen-slider div.item").width(s_width); 18907 $(".full-screen-slider div.item").height(s_height); 18908 $(".full-screen-slider div.item > video").css("position","absolute"); 18909 $(".full-screen-slider div.item > video").bind("loadedmetadata",function(){ 18910 v_width = this.videoWidth; 18911 v_height = this.videoHeight; 18912 v_ratio = v_width/v_height; 18913 if(s_ratio>=v_ratio){ 18914 $(this).width(s_width); 18915 $(this).height(""); 18916 $(this).css("left","0px"); 18917 $(this).css("top",(s_height-s_width/v_width*v_height)/2+"px"); 18918 }else{ 18919 $(this).width(""); 18920 $(this).height(s_height); 18921 $(this).css("left",(s_width-s_height/v_height*v_width)/2+"px"); 18922 $(this).css("top","0px"); 18923 } 18924 $(this).get(0).play(); 18925 }); 18926 $(".header-container.type10 .dropdown-menu .menu-container>a").click(function(){ 18927 if(!$("body").hasClass("cms-index-index") || $(".header-container.type10").hasClass("sticky-header")) { 18928 if ($(this).next().hasClass("show")) { 18929 $(this).next().removeClass("show"); 18930 } else { 18931 $(this).next().addClass("show"); 18932 } 18933 } 18934 if($(window).width()<=991){ 18935 if ($(".mobile-nav.side-block").hasClass("show")) { 18936 $(".mobile-nav.side-block").removeClass("show"); 18937 $(".mobile-nav.side-block").slideUp(); 18938 } else { 18939 $(".mobile-nav.side-block").addClass("show"); 18940 $(".mobile-nav.side-block").slideDown(); 18941 } 18942 } 18943 }); 18944 if($(window).width()>=992) 18945 $(".cms-index-index .header-container.type10+.top-container .slider-wrapper").css("min-height",$(".header-container.type10 .menu.side-menu").height()+20+"px"); 18946 $(window).resize(function(){ 18947 if($(window).width()>=992) 18948 $(".cms-index-index .header-container.type10+.top-container .slider-wrapper").css("min-height",$(".header-container.type10 .menu.side-menu").height()+20+"px"); 18949 else 18950 $(".cms-index-index .header-container.type10+.top-container .slider-wrapper").css("min-height",""); 18951 s_width = $(window).innerWidth(); 18952 s_height = $(window).innerHeight(); 18953 s_ratio = s_width/s_height; 18954 $(".full-screen-slider div.item").width(s_width); 18955 $(".full-screen-slider div.item").height(s_height); 18956 $(".full-screen-slider div.item > video").each(function(){ 18957 if(s_ratio>=v_ratio){ 18958 $(this).width(s_width); 18959 $(this).height(""); 18960 $(this).css("left","0px"); 18961 $(this).css("top",(s_height-s_width/v_width*v_height)/2+"px"); 18962 }else{ 18963 $(this).width(""); 18964 $(this).height(s_height); 18965 $(this).css("left",(s_width-s_height/v_height*v_width)/2+"px"); 18966 $(this).css("top","0px"); 18967 } 18968 }); 18969 }); 18970 18971/************** Header - Search icon, Links icon click event ***************/ 18972 $(".top-links-icon").click(function(e){ 18973 $("a.search-icon").parent().children("#search_mini_form").removeClass("show"); 18974 if($(this).parent().children("ul.links").hasClass("show")){ 18975 $(this).parent().children("ul.links").removeClass("show"); 18976 } 18977 else 18978 $(this).parent().children("ul.links").addClass("show"); 18979 e.stopPropagation(); 18980 }); 18981 $("a.search-icon").click(function(e){ 18982 $(".top-links-icon").parent().children("ul.links").removeClass("show"); 18983 if($(this).parent().children("#search_mini_form").hasClass("show")){ 18984 $(this).parent().children("#search_mini_form").removeClass("show"); 18985 } 18986 else 18987 $(this).parent().children("#search_mini_form").addClass("show"); 18988 e.stopPropagation(); 18989 }); 18990 $("a.search-icon").parent().click(function(e){ 18991 e.stopPropagation(); 18992 }) 18993 $("html,body").click(function(){ 18994 $(".top-links-icon").parent().children("ul.links").removeClass("show"); 18995 $("a.search-icon").parent().children("#search_mini_form").removeClass("show"); 18996 }); 18997 18998 /********************* Product Images ***********************/ 18999 19000 $("a.product-image img.defaultImage").each(function(){ 19001 var default_img = $(this).attr("src"); 19002 if(!default_img) 19003 default_img = $(this).attr("data-src"); 19004 var thumbnail_img = $(this).parent().children("img.hoverImage").attr("src"); 19005 if(!thumbnail_img) 19006 thumbnail_img = $(this).parent().children("img.hoverImage").attr("data-src"); 19007 if(default_img){ 19008 if(default_img.replace("/small_image/","/thumbnail/")==thumbnail_img){ 19009 $(this).parent().children("img.hoverImage").remove(); 19010 $(this).removeClass("defaultImage"); 19011 } 19012 } 19013 }); 19014 19015 /********************* Qty Holder **************************/ 19016 $(".table_qty_inc").unbind('click').click(function(){ 19017 if($(this).parent().children(".qty").is(':enabled')) 19018 $(this).parent().children(".qty").val((+$(this).parent().children(".qty").val()+1) || 0); 19019 }); 19020 $(".table_qty_dec").unbind('click').click(function(){ 19021 if($(this).parent().children(".qty").is(':enabled')) 19022 $(this).parent().children(".qty").val(($(this).parent().children(".qty").val()-1 > 0)?($(this).parent().children(".qty").val() - 1) : 0); 19023 }); 19024 19025 $(".qty_inc").unbind('click').click(function(){ 19026 if($(this).parent().parent().children("input.qty").is(':enabled')){ 19027 $(this).parent().parent().children("input.qty").val((+$(this).parent().parent().children("input.qty").val() + 1) || 0); 19028 $(this).parent().parent().children("input.qty").focus(); 19029 $(this).focus(); 19030 } 19031 }); 19032 $(".qty_dec").unbind('click').click(function(){ 19033 if($(this).parent().parent().children("input.qty").is(':enabled')){ 19034 $(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); 19035 $(this).parent().parent().children("input.qty").focus(); 19036 $(this).focus(); 19037 } 19038 }); 19039 19040 /* moving action links into product image area */ 19041 $(".move-action .item .details-area .actions").each(function(){ 19042 $(this).parent().parent().children(".product-image-area").append($(this)); 19043 }); 19044}); 19045jQuery(function($){ 19046 var breadcrumb_pos_top = 0; 19047 $(window).scroll(function(){ 19048 if(!$("body").hasClass("cms-index-index")){ 19049 var side_header_height = $(".header-container.type12").innerHeight(); 19050 var window_height = $(window).height(); 19051 if(side_header_height-window_height<$(window).scrollTop()){ 19052 if(!$(".header-container.type12").hasClass("fixed-bottom")) 19053 $(".header-container.type12").addClass("fixed-bottom"); 19054 } 19055 if(side_header_height-window_height>=$(window).scrollTop()){ 19056 if($(".header-container.type12").hasClass("fixed-bottom")) 19057 $(".header-container.type12").removeClass("fixed-bottom"); 19058 } 19059 } 19060 if($("body.side-header .top-container > .breadcrumbs").length){ 19061 if(!$("body.side-header .top-container > .breadcrumbs").hasClass("fixed-position")){ 19062 breadcrumb_pos_top = $("body.side-header .top-container > .breadcrumbs").offset().top; 19063 if($("body.side-header .top-container > .breadcrumbs").offset().top<$(window).scrollTop()){ 19064 $("body.side-header .top-container > .breadcrumbs").addClass("fixed-position"); 19065 } 19066 }else{ 19067 if($(window).scrollTop()<=1){ 19068 $("body.side-header .top-container > .breadcrumbs").removeClass("fixed-position"); 19069 } 19070 } 19071 } 19072 }); 19073});
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.