PageSourceSearch

https://igfarab.org/Scripts/Ar/Footer/jssor.js

js igfarab.org collected 2026-10-02 17:51:25 UTC 89,721 bytes, 2,833 lines download raw bytes

1/*
2* Jssor 18.0
3* http://www.jssor.com/
4* 
5* TERMS OF USE - Jssor
6* 
7* Copyright 2014 Jssor
8*
9* Permission is hereby granted, free of charge, to any person obtaining
10* a copy of this software and associated documentation files (the
11* "Software"), to deal in the Software without restriction, including
12* without limitation the rights to use, copy, modify, merge, publish,
13* distribute, sublicense, and/or sell copies of the Software, and to
14* permit persons to whom the Software is furnished to do so, subject to
15* the following conditions:
16* 
17* The above copyright notice and this permission notice shall be
18* included in all copies or substantial portions of the Software.
19* 
20* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27*/
28
29/*! Jssor */
30
31//$JssorDebug$
32var $JssorDebug$ = new function () {
33
34    this.$DebugMode = true;
35
36    // Methods
37
38    this.$Log = function (msg, important) {
39        var console = window.console || {};
40        var debug = this.$DebugMode;
41
42        if (debug && console.log) {
43            console.log(msg);
44        } else if (debug && important) {
45            alert(msg);
46        }
47    };
48
49    this.$Error = function (msg, e) {
50        var console = window.console || {};
51        var debug = this.$DebugMode;
52
53        if (debug && console.error) {
54            console.error(msg);
55        } else if (debug) {
56            alert(msg);
57        }
58
59        if (debug) {
60            // since we're debugging, fail fast by crashing
61            throw e || new Error(msg);
62        }
63    };
64
65    this.$Fail = function (msg) {
66        throw new Error(msg);
67    };
68
69    this.$Assert = function (value, msg) {
70        var debug = this.$DebugMode;
71        if (debug) {
72            if (!value)
73                throw new Error("Assert failed " + msg || "");
74        }
75    };
76
77    this.$Trace = function (msg) {
78        var console = window.console || {};
79        var debug = this.$DebugMode;
80
81        if (debug && console.log) {
82            console.log(msg);
83        }
84    };
85
86    this.$Execute = function (func) {
87        var debug = this.$DebugMode;
88        if (debug)
89            func();
90    };
91
92    this.$LiveStamp = function (obj, id) {
93        var debug = this.$DebugMode;
94        if (debug) {
95            var stamp = document.createElement("DIV");
96            stamp.setAttribute("id", id);
97
98            obj.$Live = stamp;
99        }
100    };
101
102    this.$C_AbstractMethod = function () {
103        ///	<summary>
104        ///		Tells compiler the method is abstract, it should be implemented by subclass.
105        ///	</summary>
106
107        throw new Error("The method is abstract, it should be implemented by subclass.");
108    };
109
110    function C_AbstractClass (instance) {
111        ///	<summary>
112        ///		Tells compiler the class is abstract, it should be implemented by subclass.
113        ///	</summary>
114
115        if(instance.constructor === C_AbstractClass.caller)
116            throw new Error("Cannot create instance of an abstract class.");
117    }
118
119    this.$C_AbstractClass = C_AbstractClass;
120};
121
122//$JssorEasing$
123var $JssorEasing$ = window.$JssorEasing$ = {
124    $EaseLinear: function (t) {
125        return t;
126    },
127    $EaseGoBack: function (t) {
128        return 1 - Math.abs((t *= 2) - 1);
129    },
130    $EaseSwing: function (t) {
131        return -Math.cos(t * Math.PI) / 2 + .5;
132    },
133    $EaseInQuad: function (t) {
134        return t * t;
135    },
136    $EaseOutQuad: function (t) {
137        return -t * (t - 2);
138    },
139    $EaseInOutQuad: function (t) {
140        return (t *= 2) < 1 ? 1 / 2 * t * t : -1 / 2 * (--t * (t - 2) - 1);
141    },
142    $EaseInCubic: function (t) {
143        return t * t * t;
144    },
145    $EaseOutCubic: function (t) {
146        return (t -= 1) * t * t + 1;
147    },
148    $EaseInOutCubic: function (t) {
149        return (t *= 2) < 1 ? 1 / 2 * t * t * t : 1 / 2 * ((t -= 2) * t * t + 2);
150    },
151    $EaseInQuart: function (t) {
152        return t * t * t * t;
153    },
154    $EaseOutQuart: function (t) {
155        return -((t -= 1) * t * t * t - 1);
156    },
157    $EaseInOutQuart: function (t) {
158        return (t *= 2) < 1 ? 1 / 2 * t * t * t * t : -1 / 2 * ((t -= 2) * t * t * t - 2);
159    },
160    $EaseInQuint: function (t) {
161        return t * t * t * t * t;
162    },
163    $EaseOutQuint: function (t) {
164        return (t -= 1) * t * t * t * t + 1;
165    },
166    $EaseInOutQuint: function (t) {
167        return (t *= 2) < 1 ? 1 / 2 * t * t * t * t * t : 1 / 2 * ((t -= 2) * t * t * t * t + 2);
168    },
169    $EaseInSine: function (t) {
170        return 1 - Math.cos(t * Math.PI / 2);
171    },
172    $EaseOutSine: function (t) {
173        return Math.sin(t * Math.PI / 2);
174    },
175    $EaseInOutSine: function (t) {
176        return -1 / 2 * (Math.cos(Math.PI * t) - 1);
177    },
178    $EaseInExpo: function (t) {
179        return t == 0 ? 0 : Math.pow(2, 10 * (t - 1));
180    },
181    $EaseOutExpo: function (t) {
182        return t == 1 ? 1 : -Math.pow(2, -10 * t) + 1;
183    },
184    $EaseInOutExpo: function (t) {
185        return t == 0 || t == 1 ? t : (t *= 2) < 1 ? 1 / 2 * Math.pow(2, 10 * (t - 1)) : 1 / 2 * (-Math.pow(2, -10 * --t) + 2);
186    },
187    $EaseInCirc: function (t) {
188        return -(Math.sqrt(1 - t * t) - 1);
189    },
190    $EaseOutCirc: function (t) {
191        return Math.sqrt(1 - (t -= 1) * t);
192    },
193    $EaseInOutCirc: function (t) {
194        return (t *= 2) < 1 ? -1 / 2 * (Math.sqrt(1 - t * t) - 1) : 1 / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1);
195    },
196    $EaseInElastic: function (t) {
197        if (!t || t == 1)
198            return t;
199        var p = .3, s = .075;
200        return -(Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * 2 * Math.PI / p));
201    },
202    $EaseOutElastic: function (t) {
203        if (!t || t == 1)
204            return t;
205        var p = .3, s = .075;
206        return Math.pow(2, -10 * t) * Math.sin((t - s) * 2 * Math.PI / p) + 1;
207    },
208    $EaseInOutElastic: function (t) {
209        if (!t || t == 1)
210            return t;
211        var p = .45, s = .1125;
212        return (t *= 2) < 1 ? -.5 * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * 2 * Math.PI / p) : Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * 2 * Math.PI / p) * .5 + 1;
213    },
214    $EaseInBack: function (t) {
215        var s = 1.70158;
216        return t * t * ((s + 1) * t - s);
217    },
218    $EaseOutBack: function (t) {
219        var s = 1.70158;
220        return (t -= 1) * t * ((s + 1) * t + s) + 1;
221    },
222    $EaseInOutBack: function (t) {
223        var s = 1.70158;
224        return (t *= 2) < 1 ? 1 / 2 * t * t * (((s *= 1.525) + 1) * t - s) : 1 / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2);
225    },
226    $EaseInBounce: function (t) {
227        return 1 - $JssorEasing$.$EaseOutBounce(1 - t)
228    },
229    $EaseOutBounce: function (t) {
230        return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
231    },
232    $EaseInOutBounce: function (t) {
233        return t < 1 / 2 ? $JssorEasing$.$EaseInBounce(t * 2) * .5 : $JssorEasing$.$EaseOutBounce(t * 2 - 1) * .5 + .5;
234    },
235    $EaseInWave: function (t) {
236        return 1 - Math.cos(t * Math.PI * 2)
237    },
238    $EaseOutWave: function (t) {
239        return Math.sin(t * Math.PI * 2);
240    },
241    $EaseOutJump: function (t) {
242        return 1 - (((t *= 2) < 1) ? (t = 1 - t) * t * t : (t -= 1) * t * t);
243    },
244    $EaseInJump: function (t) {
245        return ((t *= 2) < 1) ? t * t * t : (t = 2 - t) * t * t;
246    }
247};
248
249var $JssorDirection$ = window.$JssorDirection$ = {
250    $TO_LEFT: 0x0001,
251    $TO_RIGHT: 0x0002,
252    $TO_TOP: 0x0004,
253    $TO_BOTTOM: 0x0008,
254    $HORIZONTAL: 0x0003,
255    $VERTICAL: 0x000C,
256    $LEFTRIGHT: 0x0003,
257    $TOPBOTOM: 0x000C,
258    $TOPLEFT: 0x0005,
259    $TOPRIGHT: 0x0006,
260    $BOTTOMLEFT: 0x0009,
261    $BOTTOMRIGHT: 0x000A,
262    $AROUND: 0x000F,
263
264    $GetDirectionHorizontal: function (direction) {
265        return direction & 0x0003;
266    },
267    $GetDirectionVertical: function (direction) {
268        return direction & 0x000C;
269    },
270    $ChessHorizontal: function (direction) {
271        return (~direction & 0x0003) + (direction & 0x000C);
272    },
273    $ChessVertical: function (direction) {
274        return (~direction & 0x000C) + (direction & 0x0003);
275    },
276    $IsToLeft: function (direction) {
277        return (direction & 0x0003) == 0x0001;
278    },
279    $IsToRight: function (direction) {
280        return (direction & 0x0003) == 0x0002;
281    },
282    $IsToTop: function (direction) {
283        return (direction & 0x000C) == 0x0004;
284    },
285    $IsToBottom: function (direction) {
286        return (direction & 0x000C) == 0x0008;
287    },
288    $IsHorizontal: function (direction) {
289        return (direction & 0x0003) > 0;
290    },
291    $IsVertical: function (direction) {
292        return (direction & 0x000C) > 0;
293    }
294};
295
296var $JssorKeyCode$ = {
297    $BACKSPACE: 8,
298    $COMMA: 188,
299    $DELETE: 46,
300    $DOWN: 40,
301    $END: 35,
302    $ENTER: 13,
303    $ESCAPE: 27,
304    $HOME: 36,
305    $LEFT: 37,
306    $NUMPAD_ADD: 107,
307    $NUMPAD_DECIMAL: 110,
308    $NUMPAD_DIVIDE: 111,
309    $NUMPAD_ENTER: 108,
310    $NUMPAD_MULTIPLY: 106,
311    $NUMPAD_SUBTRACT: 109,
312    $PAGE_DOWN: 34,
313    $PAGE_UP: 33,
314    $PERIOD: 190,
315    $RIGHT: 39,
316    $SPACE: 32,
317    $TAB: 9,
318    $UP: 38
319};
320
321var $JssorAlignment$ = {
322    $TopLeft: 0x11,
323    $TopCenter: 0x12,
324    $TopRight: 0x14,
325    $MiddleLeft: 0x21,
326    $MiddleCenter: 0x22,
327    $MiddleRight: 0x24,
328    $BottomLeft: 0x41,
329    $BottomCenter: 0x42,
330    $BottomRight: 0x44,
331
332    $IsTop: function (aligment) {
333        return aligment & 0x10 > 0;
334    },
335    $IsMiddle: function (alignment) {
336        return alignment & 0x20 > 0;
337    },
338    $IsBottom: function (alignment) {
339        return alignment & 0x40 > 0;
340    },
341    $IsLeft: function (alignment) {
342        return alignment & 0x01 > 0;
343    },
344    $IsCenter: function (alignment) {
345        return alignment & 0x02 > 0;
346    },
347    $IsRight: function (alignment) {
348        return alignment & 0x04 > 0;
349    }
350};
351
352var $JssorMatrix$;
353
354var $JssorAnimator$;
355
356// $Jssor$ is a static class, so make it singleton instance
357var $Jssor$ = window.$Jssor$ = new function () {
358    // Fields
359    var _This = this;
360
361    var REGEX_WHITESPACE_GLOBAL = /\S+/g;
362
363    var ROWSER_UNKNOWN = 0;
364    var BROWSER_IE = 1;
365    var BROWSER_FIREFOX = 2;
366    var BROWSER_FIREFOX = 3;
367    var BROWSER_CHROME = 4;
368    var BROWSER_OPERA = 5;
369
370    //var arrActiveX = ["Msxml2.XMLHTTP", "Msxml3.XMLHTTP", "Microsoft.XMLHTTP"];
371
372    var browser = 0;
373    var browserRuntimeVersion = 0;
374    var browserEngineVersion = 0;
375    var browserJavascriptVersion = 0;
376    var webkitVersion = 0;
377
378    var app = navigator.appName;
379    var ver = navigator.appVersion;
380    var ua = navigator.userAgent;
381
382    var _DocElmt = document.documentElement;
383    var _TransformProperty;
384
385    function DetectBrowser() {
386        if (!browser) {
387            if (app == "Microsoft Internet Explorer" &&
388                !!window.attachEvent && !!window.ActiveXObject) {
389
390                var ieOffset = ua.indexOf("MSIE");
391                browser = BROWSER_IE;
392                browserEngineVersion = ParseFloat(ua.substring(ieOffset + 5, ua.indexOf(";", ieOffset)));
393
394                //check IE javascript version
395                /*@cc_on
396                browserJavascriptVersion = @_jscript_version;
397                @*/
398
399                // update: for intranet sites and compat view list sites, IE sends
400                // an IE7 User-Agent to the server to be interoperable, and even if
401                // the page requests a later IE version, IE will still report the
402                // IE7 UA to JS. we should be robust to self
403                //var docMode = document.documentMode;
404                //if (typeof docMode !== "undefined") {
405                //    browserRuntimeVersion = docMode;
406                //}
407
408                browserRuntimeVersion = document.documentMode || browserEngineVersion;
409
410            }
411            else if (app == "Netscape" && !!window.addEventListener) {
412
413                var ffOffset = ua.indexOf("Firefox");
414                var saOffset = ua.indexOf("Safari");
415                var chOffset = ua.indexOf("Chrome");
416                var webkitOffset = ua.indexOf("AppleWebKit");
417
418                if (ffOffset >= 0) {
419                    browser = BROWSER_FIREFOX;
420                    browserRuntimeVersion = ParseFloat(ua.substring(ffOffset + 8));
421                }
422                else if (saOffset >= 0) {
423                    var slash = ua.substring(0, saOffset).lastIndexOf("/");
424                    browser = (chOffset >= 0) ? BROWSER_CHROME : BROWSER_FIREFOX;
425                    browserRuntimeVersion = ParseFloat(ua.substring(slash + 1, saOffset));
426                }
427
428                if (webkitOffset >= 0)
429                    webkitVersion = ParseFloat(ua.substring(webkitOffset + 12));
430            }
431            else {
432                var match = /(opera)(?:.*version|)[ \/]([\w.]+)/i.exec(ua);
433                if (match) {
434                    browser = BROWSER_OPERA;
435                    browserRuntimeVersion = ParseFloat(match[2]);
436                }
437            }
438        }
439    }
440
441    function IsBrowserIE() {
442        DetectBrowser();
443        return browser == BROWSER_IE;
444    }
445
446    function IsBrowserIeQuirks() {
447        return IsBrowserIE() && (browserRuntimeVersion < 6 || document.compatMode == "BackCompat");   //Composite to "CSS1Compat"
448    }
449
450    function IsBrowserFireFox() {
451        DetectBrowser();
452        return browser == BROWSER_FIREFOX;
453    }
454
455    function IsBrowserSafari() {
456        DetectBrowser();
457        return browser == BROWSER_FIREFOX;
458    }
459
460    function IsBrowserChrome() {
461        DetectBrowser();
462        return browser == BROWSER_CHROME;
463    }
464
465    function IsBrowserOpera() {
466        DetectBrowser();
467        return browser == BROWSER_OPERA;
468    }
469
470    function IsBrowserBadTransform() {
471        return IsBrowserSafari() && (webkitVersion > 534) && (webkitVersion < 535);
472    }
473
474    function IsBrowserIe9Earlier() {
475        return IsBrowserIE() && browserRuntimeVersion < 9; 
476    }
477
478    function GetTransformProperty(elmt) {
479
480        if (!_TransformProperty) {
481            // Note that in some versions of IE9 it is critical that
482            // msTransform appear in this list before MozTransform
483
484            each(['transform', 'WebkitTransform', 'msTransform', 'MozTransform', 'OTransform'], function (property) {
485                if (elmt.style[property] != undefined) {
486                    _TransformProperty = property;
487                    return true;
488                }
489            });
490
491            _TransformProperty = _TransformProperty || "transform";
492        }
493
494        return _TransformProperty;
495    }
496
497    // Helpers
498    function getOffsetParent(elmt, isFixed) {
499        // IE and Opera "fixed" position elements don't have offset parents.
500        // regardless, if it's fixed, its offset parent is the body.
501        if (isFixed && elmt != document.body) {
502            return document.body;
503        } else {
504            return elmt.offsetParent;
505        }
506    }
507
508    function toString(obj) {
509        return Object.prototype.toString.call(obj);
510    }
511
512    // [[Class]] -> type pairs
513    var class2type;
514
515    function each(object, callback) {
516        if (toString(object) == "[object Array]") {
517            for (var i = 0; i < object.length; i++) {
518                if (callback(object[i], i, object)) {
519                    return true;
520                }
521            }
522        }
523        else {
524            for (var name in object) {
525                if (callback(object[name], name, object)) {
526                    return true;
527                }
528            }
529        }
530    }
531
532    function GetClass2Type() {
533        if (!class2type) {
534            class2type = {};
535            each(["Boolean", "Number", "String", "Function", "Array", "Date", "RegExp", "Object"], function (name) {
536                class2type["[object " + name + "]"] = name.toLowerCase();
537            });
538        }
539
540        return class2type;
541    }
542
543    function type(obj) {
544        return obj == null ? String(obj) : GetClass2Type()[toString(obj)] || "object";
545    }
546
547    function isPlainObject(obj) {
548        // Must be an Object.
549        // Because of IE, we also have to check the presence of the constructor property.
550        // Make sure that DOM nodes and window objects don't pass through, as well
551        if (!obj || type(obj) !== "object" || obj.nodeType || _This.$IsWindow(obj)) {
552            return false;
553        }
554
555        var hasOwn = Object.prototype.hasOwnProperty;
556
557        try {
558            // Not own constructor property must be Object
559            if (obj.constructor &&
560				!hasOwn.call(obj, "constructor") &&
561				!hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
562                return false;
563            }
564        } catch (e) {
565            // IE8,9 Will throw exceptions on certain host objects #9897
566            return false;
567        }
568
569        // Own properties are enumerated firstly, so to speed up,
570        // if last one is own, then all properties are own.
571
572        var key;
573        for (key in obj) { }
574
575        return key === undefined || hasOwn.call(obj, key);
576    }
577
578    function Point(x, y) {
579        return { x: x, y: y };
580    }
581
582    function Delay(code, delay) {
583        setTimeout(code, delay || 0);
584    }
585
586    function RemoveByReg(str, reg) {
587        var m = reg.exec(str);
588
589        if (m) {
590            var header = str.substr(0, m.index);
591            var tailer = str.substr(m.lastIndex + 1, str.length - (m.lastIndex + 1));
592            str = header + tailer;
593        }
594
595        return str;
596    }
597
598    function BuildNewCss(oldCss, removeRegs, replaceValue) {
599        var css = (!oldCss || oldCss == "inherit") ? "" : oldCss;
600
601        each(removeRegs, function (removeReg) {
602            var m = removeReg.exec(css);
603
604            if (m) {
605                var header = css.substr(0, m.index);
606                var tailer = css.substr(m.lastIndex + 1, css.length - (m.lastIndex + 1));
607                css = header + tailer;
608            }
609        });
610
611        css = replaceValue + (css.indexOf(" ") != 0 ? " " : "") + css;
612
613        return css;
614    }
615
616    function SetStyleFilterIE(elmt, value) {
617        if (browserRuntimeVersion < 9) {
618            elmt.style.filter = value;
619        }
620    }
621
622    function SetStyleMatrixIE(elmt, matrix, offset) {
623        //matrix is not for ie9+ running in ie8- mode
624        if (browserJavascriptVersion < 9) {
625            var oldFilterValue = elmt.style.filter;
626            var matrixReg = new RegExp(/[\s]*progid:DXImageTransform\.Microsoft\.Matrix\([^\)]*\)/g);
627            var matrixValue = matrix ? "progid:DXImageTransform.Microsoft.Matrix(" + "M11=" + matrix[0][0] + ", M12=" + matrix[0][1] + ", M21=" + matrix[1][0] + ", M22=" + matrix[1][1] + ", SizingMethod='auto expand')" : "";
628
629            var newFilterValue = BuildNewCss(oldFilterValue, [matrixReg], matrixValue);
630
631            SetStyleFilterIE(elmt, newFilterValue);
632
633            _This.$CssMarginTop(elmt, offset.y);
634            _This.$CssMarginLeft(elmt, offset.x);
635        }
636    }
637
638    // Methods
639
640    _This.$IsBrowserIE = IsBrowserIE;
641
642    _This.$IsBrowserIeQuirks = IsBrowserIeQuirks;
643
644    _This.$IsBrowserFireFox = IsBrowserFireFox;
645
646    _This.$IsBrowserSafari = IsBrowserSafari;
647
648    _This.$IsBrowserChrome = IsBrowserChrome;
649
650    _This.$IsBrowserOpera = IsBrowserOpera;
651
652    _This.$IsBrowserBadTransform = IsBrowserBadTransform;
653
654    _This.$IsBrowserIe9Earlier = IsBrowserIe9Earlier;
655
656    _This.$BrowserVersion = function () {
657        return browserRuntimeVersion;
658    };
659
660    _This.$BrowserEngineVersion = function () {
661        return browserEngineVersion || browserRuntimeVersion;
662    };
663
664    _This.$WebKitVersion = function () {
665        DetectBrowser();
666
667        return webkitVersion;
668    };
669
670    _This.$Delay = Delay;
671
672    _This.$Inherit = function (instance, baseClass) {
673        baseClass.apply(instance, [].slice.call(arguments, 2));
674        return Extend({}, instance);
675    };
676
677    function Construct(instance, constructor) {
678        instance.constructor === Construct.caller && instance.$Construct && instance.$Construct();
679    }
680
681    _This.$Construct = Construct;
682
683    _This.$GetElement = function (elmt) {
684        if (_This.$IsString(elmt)) {
685            elmt = document.getElementById(elmt);
686        }
687
688        return elmt;
689    };
690
691    function GetEvent(event) {
692        return event || window.event;
693    }
694
695    GetEvent = GetEvent;
696
697    _This.$EventSrc = function (event) {
698        event = GetEvent(event);
699        return event.target || event.srcElement || document;
700    };
701
702    _This.$EventDst = function (event) {
703        event = GetEvent(event);
704        return event.relatedTarget || event.toElement;
705    };
706
707    _This.$MousePosition = function (event) {
708        event = GetEvent(event);
709        var body = document.body;
710
711        return {
712            x: event.pageX || event.clientX + (_DocElmt.scrollLeft || body.scrollLeft || 0) - (_DocElmt.clientLeft || body.clientLeft || 0) || 0,
713            y: event.pageY || event.clientY + (_DocElmt.scrollTop || body.scrollTop || 0) - (_DocElmt.clientTop || body.clientTop || 0) || 0
714        };
715    };
716
717    _This.$PageScroll = function () {
718        var body = document.body;
719
720        return {
721            x: (window.pageXOffset || _DocElmt.scrollLeft || body.scrollLeft || 0) - (_DocElmt.clientLeft || body.clientLeft || 0),
722            y: (window.pageYOffset || _DocElmt.scrollTop || body.scrollTop || 0) - (_DocElmt.clientTop || body.clientTop || 0)
723        };
724    };
725
726    _This.$WindowSize = function () {
727        var body = document.body;
728
729        return {
730            x: body.clientWidth || _DocElmt.clientWidth,
731            y: body.clientHeight || _DocElmt.clientHeight
732        };
733    };
734
735    //_This.$GetElementPosition = function (elmt) {
736    //    elmt = _This.$GetElement(elmt);
737    //    var result = Point();
738
739    //    // technique from:
740    //    // http://www.quirksmode.org/js/findpos.html
741    //    // with special check for "fixed" elements.
742
743    //    while (elmt) {
744    //        result.x += elmt.offsetLeft;
745    //        result.y += elmt.offsetTop;
746
747    //        var isFixed = _This.$GetElementStyle(elmt).position == "fixed";
748
749    //        if (isFixed) {
750    //            result = result.$Plus(_This.$PageScroll(window));
751    //        }
752
753    //        elmt = getOffsetParent(elmt, isFixed);
754    //    }
755
756    //    return result;
757    //};
758
759    //_This.$GetMouseScroll = function (event) {
760    //    event = GetEvent(event);
761    //    var delta = 0; // default value
762
763    //    // technique from:
764    //    // http://blog.paranoidferret.com/index.php/2007/10/31/javascript-tutorial-the-scroll-wheel/
765
766    //    if (typeof (event.wheelDelta) == "number") {
767    //        delta = event.wheelDelta;
768    //    } else if (typeof (event.detail) == "number") {
769    //        delta = event.detail * -1;
770    //    } else {
771    //        $JssorDebug$.$Fail("Unknown event mouse scroll, no known technique.");
772    //    }
773
774    //    // normalize value to [-1, 1]
775    //    return delta ? delta / Math.abs(delta) : 0;
776    //};
777
778    //_This.$MakeAjaxRequest = function (url, callback) {
779    //    var async = typeof (callback) == "function";
780    //    var req = null;
781
782    //    if (async) {
783    //        var actual = callback;
784    //        var callback = function () {
785    //            Delay($Jssor$.$CreateCallback(null, actual, req), 1);
786    //        };
787    //    }
788
789    //    if (window.ActiveXObject) {
790    //        for (var i = 0; i < arrActiveX.length; i++) {
791    //            try {
792    //                req = new ActiveXObject(arrActiveX[i]);
793    //                break;
794    //            } catch (e) {
795    //                continue;
796    //            }
797    //        }
798    //    } else if (window.XMLHttpRequest) {
799    //        req = new XMLHttpRequest();
800    //    }
801
802    //    if (!req) {
803    //        $JssorDebug$.$Fail("Browser doesn't support XMLHttpRequest.");
804    //    }
805
806    //    if (async) {
807    //        req.onreadystatechange = function () {
808    //            if (req.readyState == 4) {
809    //                // prevent memory leaks by breaking circular reference now
810    //                req.onreadystatechange = new Function();
811    //                callback();
812    //            }
813    //        };
814    //    }
815
816    //    try {
817    //        req.open("GET", url, async);
818    //        req.send(null);
819    //    } catch (e) {
820    //        $JssorDebug$.$Log(e.name + " while making AJAX request: " + e.message);
821
822    //        req.onreadystatechange = null;
823    //        req = null;
824
825    //        if (async) {
826    //            callback();
827    //        }
828    //    }
829
830    //    return async ? null : req;
831    //};
832
833    //_This.$ParseXml = function (string) {
834    //    var xmlDoc = null;
835
836    //    if (window.ActiveXObject) {
837    //        try {
838    //            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
839    //            xmlDoc.async = false;
840    //            xmlDoc.loadXML(string);
841    //        } catch (e) {
842    //            $JssorDebug$.$Log(e.name + " while parsing XML (ActiveX): " + e.message);
843    //        }
844    //    } else if (window.DOMParser) {
845    //        try {
846    //            var parser = new DOMParser();
847    //            xmlDoc = parser.parseFromString(string, "text/xml");
848    //        } catch (e) {
849    //            $JssorDebug$.$Log(e.name + " while parsing XML (DOMParser): " + e.message);
850    //        }
851    //    } else {
852    //        $JssorDebug$.$Fail("Browser doesn't support XML DOM.");
853    //    }
854
855    //    return xmlDoc;
856    //};
857
858    function Css(elmt, name, value) {
859        ///	<summary>
860        ///		access css
861        ///     $Jssor$.$Css(elmt, name);         //get css value
862        ///     $Jssor$.$Css(elmt, name, value);  //set css value
863        ///	</summary>
864        ///	<param name="elmt" type="HTMLElement">
865        ///		the element to access css
866        ///	</param>
867        ///	<param name="name" type="String">
868        ///		the name of css property
869        ///	</param>
870        ///	<param name="value" optional="true">
871        ///		the value to set
872        ///	</param>
873        if (value != undefined) {
874            elmt.style[name] = value;
875        }
876        else {
877            var style = elmt.currentStyle || elmt.style;
878            value = style[name];
879
880            if (value == "" && window.getComputedStyle) {
881                style = elmt.ownerDocument.defaultView.getComputedStyle(elmt, null);
882
883                style && (value = style.getPropertyValue(name) || style[name]);
884            }
885
886            return value;
887        }
888    }
889
890    function CssN(elmt, name, value, isDimensional) {
891        ///	<summary>
892        ///		access css as numeric
893        ///     $Jssor$.$CssN(elmt, name);         //get css value
894        ///     $Jssor$.$CssN(elmt, name, value);  //set css value
895        ///	</summary>
896        ///	<param name="elmt" type="HTMLElement">
897        ///		the element to access css
898        ///	</param>
899        ///	<param name="name" type="String">
900        ///		the name of css property
901        ///	</param>
902        ///	<param name="value" type="Number" optional="true">
903        ///		the value to set
904        ///	</param>
905        if (value != undefined) {
906            isDimensional && (value += "px");
907            Css(elmt, name, value);
908        }
909        else {
910            return ParseFloat(Css(elmt, name));
911        }
912    }
913
914    function CssP(elmt, name, value) {
915        ///	<summary>
916        ///		access css in pixel as numeric, like 'top', 'left', 'width', 'height'
917        ///     $Jssor$.$CssP(elmt, name);         //get css value
918        ///     $Jssor$.$CssP(elmt, name, value);  //set css value
919        ///	</summary>
920        ///	<param name="elmt" type="HTMLElement">
921        ///		the element to access css
922        ///	</param>
923        ///	<param name="name" type="String">
924        ///		the name of css property
925        ///	</param>
926        ///	<param name="value" type="Number" optional="true">
927        ///		the value to set
928        ///	</param>
929        return CssN(elmt, name, value, true);
930    }
931
932    function CssProxy(name, numericOrDimension) {
933        ///	<summary>
934        ///		create proxy to access css, CssProxy(name[, numericOrDimension]);
935        ///	</summary>
936        ///	<param name="elmt" type="HTMLElement">
937        ///		the element to access css
938        ///	</param>
939        ///	<param name="numericOrDimension" type="Number" optional="true">
940        ///		not set: access original css, 1: access css as numeric, 2: access css in pixel as numeric
941        ///	</param>
942        var isDimensional = numericOrDimension & 2;
943        var cssAccessor = numericOrDimension ? CssN : Css;
944        return function (elmt, value) {
945            return cssAccessor(elmt, name, value, isDimensional);
946        };
947    }
948
949    function GetStyleOpacity(elmt) {
950        if (IsBrowserIE() && browserEngineVersion < 9) {
951            var match = /opacity=([^)]*)/.exec(elmt.style.filter || "");
952            return match ? (ParseFloat(match[1]) / 100) : 1;
953        }
954        else
955            return ParseFloat(elmt.style.opacity || "1");
956    }
957
958    function SetStyleOpacity(elmt, opacity, ie9EarlierForce) {
959
960        if (IsBrowserIE() && browserEngineVersion < 9) {
961            //var filterName = "filter"; // browserEngineVersion < 8 ? "filter" : "-ms-filter";
962            var finalFilter = elmt.style.filter || "";
963
964            // for CSS filter browsers (IE), remove alpha filter if it's unnecessary.
965            // update: doing _This always since IE9 beta seems to have broken the
966            // behavior if we rely on the programmatic filters collection.
967            var alphaReg = new RegExp(/[\s]*alpha\([^\)]*\)/g);
968
969            // important: note the lazy star! _This protects against
970            // multiple filters; we don't want to delete the other ones.
971            // update: also trimming extra whitespace around filter.
972
973            var ieOpacity = Math.round(100 * opacity);
974            var alphaFilter = "";
975            if (ieOpacity < 100 || ie9EarlierForce) {
976                alphaFilter = "alpha(opacity=" + ieOpacity + ") ";
977                //elmt.style["-ms-filter"] = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + ieOpacity + ") ";
978            }
979
980            var newFilterValue = BuildNewCss(finalFilter, [alphaReg], alphaFilter);
981
982            SetStyleFilterIE(elmt, newFilterValue);
983        }
984
985            //if (!IsBrowserIE() || browserEngineVersion >= 9) 
986        else {
987            elmt.style.opacity = opacity == 1 ? "" : Math.round(opacity * 100) / 100;
988        }
989    }
990
991    function SetStyleTransformInternal(elmt, transform) {
992        var rotate = transform.$Rotate || 0;
993        var scale = transform.$Scale == undefined ? 1 : transform.$Scale;
994
995        if (IsBrowserIe9Earlier()) {
996            var matrix = _This.$CreateMatrix(rotate / 180 * Math.PI, scale, scale);
997            SetStyleMatrixIE(elmt, (!rotate && scale == 1) ? null : matrix, _This.$GetMatrixOffset(matrix, transform.$OriginalWidth, transform.$OriginalHeight));
998        }
999        else {
1000            //rotate(15deg) scale(.5) translateZ(0)
1001            var transformProperty = GetTransformProperty(elmt);
1002            if (transformProperty) {
1003                var transformValue = "rotate(" + rotate % 360 + "deg) scale(" + scale + ")";
1004                if (IsBrowserChrome() && webkitVersion > 535)
1005                    transformValue += " perspective(2000px)";
1006
1007                elmt.style[transformProperty] = transformValue;
1008            }
1009        }
1010    }
1011
1012    _This.$SetStyleTransform = function (elmt, transform) {
1013        if (IsBrowserBadTransform()) {
1014            Delay(_This.$CreateCallback(null, SetStyleTransformInternal, elmt, transform));
1015        }
1016        else {
1017            SetStyleTransformInternal(elmt, transform);
1018        }
1019    };
1020
1021    _This.$SetStyleTransformOrigin = function (elmt, transformOrigin) {
1022        var transformProperty = GetTransformProperty(elmt);
1023
1024        if (transformProperty)
1025            elmt.style[transformProperty + "Origin"] = transformOrigin;
1026    };
1027
1028    _This.$CssScale = function (elmt, scale) {
1029
1030        if (IsBrowserIE() && browserEngineVersion < 9 || (browserEngineVersion < 10 && IsBrowserIeQuirks())) {
1031            elmt.style.zoom = (scale == 1) ? "" : scale;
1032        }
1033        else {
1034            var transformProperty = GetTransformProperty(elmt);
1035
1036            if (transformProperty) {
1037                //rotate(15deg) scale(.5)
1038                var transformValue = "scale(" + scale + ")";
1039
1040                var oldTransformValue = elmt.style[transformProperty];
1041                var scaleReg = new RegExp(/[\s]*scale\(.*?\)/g);
1042
1043                var newTransformValue = BuildNewCss(oldTransformValue, [scaleReg], transformValue);
1044
1045                elmt.style[transformProperty] = newTransformValue;
1046            }
1047        }
1048    };
1049
1050    _This.$EnableHWA = function (elmt) {
1051        if (!elmt.style[GetTransformProperty(elmt)] || elmt.style[GetTransformProperty(elmt)] == "none")
1052            elmt.style[GetTransformProperty(elmt)] = "perspective(2000px)";
1053    };
1054
1055    _This.$DisableHWA = function (elmt) {
1056        //if (force || elmt.style[GetTransformProperty(elmt)] == "perspective(2000px)")
1057        elmt.style[GetTransformProperty(elmt)] = "none";
1058    };
1059
1060    var ie8OffsetWidth = 0;
1061    var ie8OffsetHeight = 0;
1062    //var ie8WindowResizeCallbackHandlers;
1063    //var ie8LastVerticalScrollbar;
1064    //var toggleInfo = "";
1065
1066    //function Ie8WindowResizeFilter(window, handler) {
1067
1068    //    var trigger = true;
1069
1070    //    var checkElement = (IsBrowserIeQuirks() ? window.document.body : window.document.documentElement);
1071    //    if (checkElement) {
1072    //        //check vertical bar
1073    //        //var hasVerticalBar = checkElement.scrollHeight > checkElement.clientHeight;
1074    //        //var verticalBarToggle = hasVerticalBar != ie8LastVerticalScrollbar;
1075    //        //ie8LastVerticalScrollbar = hasVerticalBar;
1076
1077    //        var widthChange = checkElement.offsetWidth - ie8OffsetWidth;
1078    //        var heightChange = checkElement.offsetHeight - ie8OffsetHeight;
1079    //        if (widthChange || heightChange) {
1080
1081    //            ie8OffsetWidth += widthChange;
1082    //            ie8OffsetHeight += heightChange;
1083    //        }
1084    //        else
1085    //            trigger = false;
1086    //    }
1087
1088    //    trigger && handler();
1089    //}
1090
1091    //_This.$OnWindowResize = function (window, handler) {
1092
1093    //    if (IsBrowserIE() && browserEngineVersion < 9) {
1094    //        if (!ie8WindowResizeCallbackHandlers) {
1095    //            ie8WindowResizeCallbackHandlers = [handler];
1096    //            handler = _This.$CreateCallback(null, Ie8WindowResizeFilter, window);
1097    //        }
1098    //        else {
1099    //            ie8WindowResizeCallbackHandlers.push(handler);
1100    //            return;
1101    //        }
1102    //    }
1103
1104    //    _This.$AddEvent(window, "resize", handler);
1105    //};
1106
1107    _This.$WindowResizeFilter = function (window, handler) {
1108        return IsBrowserIe9Earlier() ? function () {
1109
1110            var trigger = true;
1111
1112            var checkElement = (IsBrowserIeQuirks() ? window.document.body : window.document.documentElement);
1113            if (checkElement) {
1114                //check vertical bar
1115                //var hasVerticalBar = checkElement.scrollHeight > checkElement.clientHeight;
1116                //var verticalBarToggle = hasVerticalBar != ie8LastVerticalScrollbar;
1117                //ie8LastVerticalScrollbar = hasVerticalBar;
1118
1119                var widthChange = checkElement.offsetWidth - ie8OffsetWidth;
1120                var heightChange = checkElement.offsetHeight - ie8OffsetHeight;
1121                if (widthChange || heightChange) {
1122                    ie8OffsetWidth += widthChange;
1123                    ie8OffsetHeight += heightChange;
1124                }
1125                else
1126                    trigger = false;
1127            }
1128
1129            trigger && handler();
1130
1131        } : handler;
1132    };
1133
1134    _This.$MouseOverOutFilter = function (handler, target) {
1135        ///	<param name="target" type="HTMLDomElement">
1136        ///		The target element to detect mouse over/out events. (for ie < 9 compatibility)
1137        ///	</param>
1138
1139        $JssorDebug$.$Execute(function () {
1140            if (!target) {
1141                throw new Error("Null reference, parameter \"target\".");
1142            }
1143        });
1144
1145        return function (event) {
1146            event = GetEvent(event);
1147
1148            var eventName = event.type;
1149            var related = event.relatedTarget || (eventName == "mouseout" ? event.toElement : event.fromElement);
1150
1151            if (!related || (related !== target && !_This.$IsChild(target, related))) {
1152                handler(event);
1153            }
1154        };
1155    };
1156
1157    _This.$AddEvent = function (elmt, eventName, handler, useCapture) {
1158        elmt = _This.$GetElement(elmt);
1159
1160        // technique from:
1161        // http://blog.paranoidferret.com/index.php/2007/08/10/javascript-working-with-events/
1162
1163        if (elmt.addEventListener) {
1164            if (eventName == "mousewheel") {
1165                elmt.addEventListener("DOMMouseScroll", handler, useCapture);
1166            }
1167            // we are still going to add the mousewheel -- not a mistake!
1168            // _This is for opera, since it uses onmousewheel but needs addEventListener.
1169            elmt.addEventListener(eventName, handler, useCapture);
1170        }
1171        else if (elmt.attachEvent) {
1172            elmt.attachEvent("on" + eventName, handler);
1173            if (useCapture && elmt.setCapture) {
1174                elmt.setCapture();
1175            }
1176        }
1177
1178        $JssorDebug$.$Execute(function () {
1179            if (!elmt.addEventListener && !elmt.attachEvent) {
1180                $JssorDebug$.$Fail("Unable to attach event handler, no known technique.");
1181            }
1182        });
1183
1184    };
1185
1186    _This.$RemoveEvent = function (elmt, eventName, handler, useCapture) {
1187        elmt = _This.$GetElement(elmt);
1188
1189        // technique from:
1190        // http://blog.paranoidferret.com/index.php/2007/08/10/javascript-working-with-events/
1191
1192        if (elmt.removeEventListener) {
1193            if (eventName == "mousewheel") {
1194                elmt.removeEventListener("DOMMouseScroll", handler, useCapture);
1195            }
1196            // we are still going to remove the mousewheel -- not a mistake!
1197            // _This is for opera, since it uses onmousewheel but needs removeEventListener.
1198            elmt.removeEventListener(eventName, handler, useCapture);
1199        }
1200        else if (elmt.detachEvent) {
1201            elmt.detachEvent("on" + eventName, handler);
1202            if (useCapture && elmt.releaseCapture) {
1203                elmt.releaseCapture();
1204            }
1205        }
1206    };
1207
1208    _This.$FireEvent = function (elmt, eventName) {
1209        //var document = elmt.document;
1210
1211        $JssorDebug$.$Execute(function () {
1212            if (!document.createEvent && !document.createEventObject) {
1213                $JssorDebug$.$Fail("Unable to fire event, no known technique.");
1214            }
1215
1216            if (!elmt.dispatchEvent && !elmt.fireEvent) {
1217                $JssorDebug$.$Fail("Unable to fire event, no known technique.");
1218            }
1219        });
1220
1221        var evento;
1222
1223        if (document.createEvent) {
1224            evento = document.createEvent("HTMLEvents");
1225            evento.initEvent(eventName, false, false);
1226            elmt.dispatchEvent(evento);
1227        }
1228        else {
1229            var ieEventName = "on" + eventName;
1230            evento = document.createEventObject();
1231            //event.eventType = ieEventName;
1232            //event.eventName = ieEventName;
1233
1234            elmt.fireEvent(ieEventName, evento);
1235        }
1236    };
1237
1238    _This.$AddEventBrowserMouseUp = function (handler, userCapture) {
1239        _This.$AddEvent((IsBrowserIe9Earlier()) ? document : window, "mouseup", handler, userCapture);
1240    };
1241
1242    _This.$RemoveEventBrowserMouseUp = function (handler, userCapture) {
1243        _This.$RemoveEvent((IsBrowserIe9Earlier()) ? document : window, "mouseup", handler, userCapture);
1244    };
1245
1246    //_This.$AddEventBrowserMouseDown = function (handler, userCapture) {
1247    //    _This.$AddEvent((IsBrowserIe9Earlier()) ? document : window, "mousedown", handler, userCapture);
1248    //};
1249
1250    //_This.$RemoveEventBrowserMouseDown = function (handler, userCapture) {
1251    //    _This.$RemoveEvent((IsBrowserIe9Earlier()) ? document : window, "mousedown", handler, userCapture);
1252    //};
1253
1254    _This.$CancelEvent = function (event) {
1255        event = GetEvent(event);
1256
1257        // technique from:
1258        // http://blog.paranoidferret.com/index.php/2007/08/10/javascript-working-with-events/
1259
1260        if (event.preventDefault) {
1261            event.preventDefault();     // W3C for preventing default
1262        }
1263
1264        event.cancel = true;            // legacy for preventing default
1265        event.returnValue = false;      // IE for preventing default
1266    };
1267
1268    _This.$StopEvent = function (event) {
1269        event = GetEvent(event);
1270
1271        // technique from:
1272        // http://blog.paranoidferret.com/index.php/2007/08/10/javascript-working-with-events/
1273
1274        if (event.stopPropagation) {
1275            event.stopPropagation();    // W3C for stopping propagation
1276        }
1277
1278        event.cancelBubble = true;      // IE for stopping propagation
1279    };
1280
1281    _This.$CreateCallback = function (object, method) {
1282        // create callback args
1283        var initialArgs = [].slice.call(arguments, 2);
1284
1285        // create closure to apply method
1286        var callback = function () {
1287            // concatenate new args, but make a copy of initialArgs first
1288            var args = initialArgs.concat([].slice.call(arguments, 0));
1289
1290            return method.apply(object, args);
1291        };
1292
1293        //$JssorDebug$.$LiveStamp(callback, "callback_" + ($Jssor$.$GetNow() & 0xFFFFFF));
1294
1295        return callback;
1296    };
1297
1298    var _Freeer;
1299    _This.$FreeElement = function (elmt) {
1300        if (!_Freeer)
1301            _Freeer = _This.$CreateDiv();
1302
1303        if (elmt) {
1304            $Jssor$.$AppendChild(_Freeer, elmt);
1305            $Jssor$.$ClearInnerHtml(_Freeer);
1306        }
1307    };
1308
1309    _This.$InnerText = function (elmt, text) {
1310        if (text == undefined)
1311            return elmt.textContent || elmt.innerText;
1312
1313        var textNode = document.createTextNode(text);
1314        _This.$ClearInnerHtml(elmt);
1315        elmt.appendChild(textNode);
1316    };
1317    
1318    _This.$InnerHtml = function (elmt, html) {
1319        if (html == undefined)
1320            return elmt.innerHTML;
1321
1322        elmt.innerHTML = html;
1323    };
1324
1325    _This.$GetClientRect = function (elmt) {
1326        var rect = elmt.getBoundingClientRect();
1327
1328        return { x: rect.left, y: rect.top, w: rect.right - rect.left, h: rect.bottom - rect.top };
1329    };
1330
1331    _This.$ClearInnerHtml = function (elmt) {
1332        elmt.innerHTML = "";
1333    };
1334
1335    _This.$EncodeHtml = function (text) {
1336        var div = _This.$CreateDiv();
1337        _This.$InnerText(div, text);
1338        return _This.$InnerHtml(div);
1339    };
1340
1341    _This.$DecodeHtml = function (html) {
1342        var div = _This.$CreateDiv();
1343        _This.$InnerHtml(div, html);
1344        return _This.$InnerText(div);
1345    };
1346
1347    _This.$SelectElement = function (elmt) {
1348        var userSelection;
1349        if (window.getSelection) {
1350            //W3C default
1351            userSelection = window.getSelection();
1352        }
1353        var theRange = null;
1354        if (document.createRange) {
1355            theRange = document.createRange();
1356            theRange.selectNode(elmt);
1357        }
1358        else {
1359            theRange = document.body.createTextRange();
1360            theRange.moveToElementText(elmt);
1361            theRange.select();
1362        }
1363        //set user selection
1364        if (userSelection)
1365            userSelection.addRange(theRange);
1366    };
1367
1368    _This.$DeselectElements = function () {
1369        if (document.selection) {
1370            document.selection.empty();
1371        } else if (window.getSelection) {
1372            window.getSelection().removeAllRanges();
1373        }
1374    };
1375
1376    _This.$Children = function (elmt) {
1377        var children = [];
1378
1379        for (var tmpEl = elmt.firstChild; tmpEl; tmpEl = tmpEl.nextSibling) {
1380            if (tmpEl.nodeType == 1) {
1381                children.push(tmpEl);
1382            }
1383        }
1384
1385        return children;
1386    };
1387
1388    function FindChild(elmt, attrValue, noDeep, attrName) {
1389        attrName = attrName || "u";
1390
1391        for (elmt = elmt ? elmt.firstChild : null; elmt; elmt = elmt.nextSibling) {
1392            if (elmt.nodeType == 1) {
1393                if (AttributeEx(elmt, attrName) == attrValue)
1394                    return elmt;
1395
1396                if (!noDeep) {
1397                    var childRet = FindChild(elmt, attrValue, noDeep, attrName);
1398                    if (childRet)
1399                        return childRet;
1400                }
1401            }
1402        }
1403    }
1404
1405    _This.$FindChild = FindChild;
1406
1407    function FindChildren(elmt, attrValue, noDeep, attrName) {
1408        attrName = attrName || "u";
1409
1410        var ret = [];
1411
1412        for (elmt = elmt ? elmt.firstChild : null; elmt; elmt = elmt.nextSibling) {
1413            if (elmt.nodeType == 1) {
1414                if (AttributeEx(elmt, attrName) == attrValue)
1415                    ret.push(elmt);
1416
1417                if (!noDeep) {
1418                    var childRet = FindChildren(elmt, attrValue, noDeep, attrName);
1419                    if (childRet.length)
1420                        ret = ret.concat(childRet);
1421                }
1422            }
1423        }
1424
1425        return ret;
1426    }
1427
1428    _This.$FindChildren = FindChildren;
1429
1430    function FindChildByTag(elmt, tagName, noDeep) {
1431
1432        for (elmt = elmt ? elmt.firstChild : null; elmt; elmt = elmt.nextSibling) {
1433            if (elmt.nodeType == 1) {
1434                if (elmt.tagName == tagName)
1435                    return elmt;
1436
1437                if (!noDeep) {
1438                    var childRet = FindChildByTag(elmt, tagName, noDeep);
1439                    if (childRet)
1440                        return childRet;
1441                }
1442            }
1443        }
1444    }
1445
1446    _This.$FindChildByTag = FindChildByTag;
1447
1448    function FindChildrenByTag(elmt, tagName, noDeep) {
1449        var ret = [];
1450
1451        for (elmt = elmt ? elmt.firstChild : null; elmt; elmt = elmt.nextSibling) {
1452            if (elmt.nodeType == 1) {
1453                if (!tagName || elmt.tagName == tagName)
1454                    ret.push(elmt);
1455
1456                if (!noDeep) {
1457                    var childRet = FindChildrenByTag(elmt, tagName, noDeep);
1458                    if (childRet.length)
1459                        ret = ret.concat(childRet);
1460                }
1461            }
1462        }
1463
1464        return ret;
1465    }
1466
1467    _This.$FindChildrenByTag = FindChildrenByTag;
1468
1469    _This.$GetElementsByTag = function (elmt, tagName) {
1470        return elmt.getElementsByTagName(tagName);
1471    };
1472
1473    function Extend(target) {
1474        for (var i = 1; i < arguments.length; i++) {
1475
1476            var options = arguments[i];
1477
1478            // Only deal with non-null/undefined values
1479            if (options) {
1480                // Extend the base object
1481                for (var name in options) {
1482                    target[name] = options[name];
1483                }
1484            }
1485        }
1486
1487        // Return the modified object
1488        return target;
1489    }
1490
1491    _This.$Extend = Extend;
1492
1493    function Unextend(target, options) {
1494        $JssorDebug$.$Assert(options);
1495
1496        var unextended = {};
1497
1498        // Extend the base object
1499        for (var name in target) {
1500            if (target[name] != options[name]) {
1501                unextended[name] = target[name];
1502            }
1503        }
1504
1505        // Return the modified object
1506        return unextended;
1507    }
1508
1509    _This.$Unextend = Unextend;
1510
1511    _This.$IsUndefined = function (obj) {
1512        return type(obj) == "undefined";
1513    };
1514
1515    _This.$IsFunction = function (obj) {
1516        return type(obj) == "function";
1517    };
1518
1519    _This.$IsArray = function (obj) {
1520        return type(obj) == "array";
1521    };
1522
1523    _This.$IsString = function (obj) {
1524        return type(obj) == "string";
1525    };
1526
1527    _This.$IsNumeric = function (obj) {
1528        return !isNaN(ParseFloat(obj)) && isFinite(obj);
1529    };
1530
1531    _This.$IsWindow = function (obj) {
1532        return obj && obj == obj.window;
1533    };
1534
1535    _This.$Type = type;
1536
1537    // args is for internal usage only
1538    _This.$Each = each;
1539
1540    _This.$IsPlainObject = isPlainObject;
1541
1542    function CreateElement(tagName) {
1543        return document.createElement(tagName);
1544    }
1545
1546    _This.$CreateElement = CreateElement;
1547
1548    _This.$CreateDiv = function () {
1549        return CreateElement("DIV", document);
1550    };
1551
1552    _This.$CreateSpan = function () {
1553        return CreateElement("SPAN", document);
1554    };
1555
1556    _This.$EmptyFunction = function () { };
1557
1558    function Attribute(elmt, name, value) {
1559        if (value == undefined)
1560            return elmt.getAttribute(name);
1561
1562        elmt.setAttribute(name, value);
1563    }
1564
1565    function AttributeEx(elmt, name) {
1566        return Attribute(elmt, name) || Attribute(elmt, "data-" + name);
1567    }
1568
1569    _This.$Attribute = Attribute;
1570    _This.$AttributeEx = AttributeEx;
1571
1572    function ClassName(elmt, className) {
1573        if (className == undefined)
1574            return elmt.className;
1575
1576        elmt.className = className;
1577    }
1578
1579    _This.$ClassName = ClassName;
1580
1581    function ToHash(array) {
1582        var hash = {};
1583
1584        each(array, function (item) {
1585            hash[item] = item;
1586        });
1587
1588        return hash;
1589    }
1590
1591    _This.$ToHash = ToHash;
1592
1593    function Join(separator, strings) {
1594        ///	<param name="separator" type="String">
1595        ///		The element to show the dialog around
1596        ///	</param>
1597        ///	<param name="strings" type="Array" value="['1']">
1598        ///		The element to show the dialog around
1599        ///	</param>
1600
1601        var joined = "";
1602
1603        each(strings, function (str) {
1604            joined && (joined += separator);
1605            joined += str;
1606        });
1607
1608        return joined;
1609    }
1610
1611    _This.$Join = Join;
1612
1613    _This.$AddClass = function (elmt, className) {
1614        var newClassName = ClassName(elmt) + " " + className;
1615        ClassName(elmt, Join(" ", ToHash(newClassName.match(REGEX_WHITESPACE_GLOBAL))));
1616    };
1617
1618    _This.$RemoveClass = function (elmt, className) {
1619        ClassName(elmt, Join(" ", _This.$Unextend(ToHash(ClassName(elmt).match(REGEX_WHITESPACE_GLOBAL)), ToHash(className.match(REGEX_WHITESPACE_GLOBAL)))));
1620    };
1621
1622    _This.$ParentNode = function (elmt) {
1623        return elmt.parentNode;
1624    };
1625
1626    _This.$HideElement = function (elmt) {
1627        _This.$CssDisplay(elmt, "none");
1628    };
1629
1630    _This.$HideElements = function (elmts) {
1631        for (var i = 0; i < elmts.length; i++) {
1632            _This.$HideElement(elmts[i]);
1633        }
1634    };
1635
1636    _This.$ShowElement = function (elmt, hide) {
1637        _This.$CssDisplay(elmt, hide ? "none" : "");
1638    };
1639
1640    _This.$ShowElements = function (elmts, hide) {
1641        for (var i = 0; i < elmts.length; i++) {
1642            _This.$ShowElement(elmts[i], hide);
1643        }
1644    };
1645
1646    _This.$RemoveAttribute = function (elmt, attrbuteName) {
1647        elmt.removeAttribute(attrbuteName);
1648    };
1649
1650    _This.$CanClearClip = function () {
1651        return IsBrowserIE() && browserRuntimeVersion < 10;
1652    };
1653
1654    _This.$SetStyleClip = function (elmt, clip) {
1655        if (clip) {
1656            elmt.style.clip = "rect(" + Math.round(clip.$Top) + "px " + Math.round(clip.$Right) + "px " + Math.round(clip.$Bottom) + "px " + Math.round(clip.$Left) + "px)";
1657        }
1658        else {
1659            var cssText = elmt.style.cssText;
1660            var clipRegs = [
1661                new RegExp(/[\s]*clip: rect\(.*?\)[;]?/i),
1662                new RegExp(/[\s]*cliptop: .*?[;]?/i),
1663                new RegExp(/[\s]*clipright: .*?[;]?/i),
1664                new RegExp(/[\s]*clipbottom: .*?[;]?/i),
1665                new RegExp(/[\s]*clipleft: .*?[;]?/i)
1666            ];
1667
1668            var newCssText = BuildNewCss(cssText, clipRegs, "");
1669
1670            $Jssor$.$CssCssText(elmt, newCssText);
1671        }
1672    };
1673
1674    _This.$GetNow = function () {
1675        return new Date().getTime();
1676    };
1677
1678    _This.$AppendChild = function (elmt, child) {
1679        elmt.appendChild(child);
1680    };
1681
1682    _This.$AppendChildren = function (elmt, children) {
1683        each(children, function (child) {
1684            _This.$AppendChild(elmt, child);
1685        });
1686    };
1687
1688    _This.$InsertBefore = function (elmt, child, refObject) {
1689        elmt.insertBefore(child, refObject);
1690    };
1691
1692    _This.$InsertAdjacentHtml = function (elmt, where, text) {
1693        elmt.insertAdjacentHTML(where, text);
1694    };
1695
1696    _This.$RemoveChild = function (elmt, child) {
1697        elmt.removeChild(child);
1698    };
1699
1700    _This.$RemoveChildren = function (elmt, children) {
1701        each(children, function (child) {
1702            _This.$RemoveChild(elmt, child);
1703        });
1704    };
1705
1706    _This.$ClearChildren = function (elmt) {
1707        _This.$RemoveChildren(elmt, _This.$Children(elmt));
1708    };
1709
1710    _This.$ParseInt = function (str, radix) {
1711        return parseInt(str, radix || 10);
1712    };
1713
1714    function ParseFloat(str) {
1715        return parseFloat(str);
1716    }
1717
1718    _This.$ParseFloat = ParseFloat;
1719
1720    _This.$IsChild = function (elmtA, elmtB) {
1721        var body = document.body;
1722        while (elmtB && elmtA != elmtB && body != elmtB) {
1723            try {
1724                elmtB = elmtB.parentNode;
1725            } catch (e) {
1726                // Firefox sometimes fires events for XUL elements, which throws
1727                // a "permission denied" error. so this is not a child.
1728                return false;
1729            }
1730        }
1731        return elmtA == elmtB;
1732    };
1733
1734    function CloneNode(elmt, noDeep) {
1735        return elmt.cloneNode(!noDeep);
1736    }
1737
1738    _This.$CloneNode = CloneNode;
1739
1740    function TranslateTransition(transition) {
1741        if (transition) {
1742            var flyDirection = transition.$FlyDirection;
1743
1744            if (flyDirection & 1) {
1745                transition.x = transition.$ScaleHorizontal || 1;
1746            }
1747            if (flyDirection & 2) {
1748                transition.x = -transition.$ScaleHorizontal || -1;
1749            }
1750            if (flyDirection & 4) {
1751                transition.y = transition.$ScaleVertical || 1;
1752            }
1753            if (flyDirection & 8) {
1754                transition.y = -transition.$ScaleVertical || -1;
1755            }
1756
1757            if (transition.$Rotate == true)
1758                transition.$Rotate = 1;
1759
1760            TranslateTransition(transition.$Brother);
1761        }
1762    }
1763
1764    _This.$TranslateTransitions = function (transitions) {
1765        ///	<summary>
1766        ///		For backward compatibility only.
1767        ///	</summary>
1768        if (transitions) {
1769            for (var i = 0; i < transitions.length; i++) {
1770                TranslateTransition(transitions[i]);
1771            }
1772            for (var name in transitions) {
1773                TranslateTransition(transitions[name]);
1774            }
1775        }
1776    };
1777
1778    //function ImageLoader() {
1779    //    var _ThisImageLoader = this;
1780    //    var _BaseImageLoader = _This.$Inherit(_ThisImageLoader, $JssorObject$);
1781
1782    //    var _ImageLoading = 1;
1783    //    var _MainImageSrc;
1784    //    var _MainImage;
1785    //    var _CompleteCallback;
1786    //    var _MainImageAbort;
1787
1788    //    function LoadCompleteCallback(image, abort) {
1789    //        _ImageLoading--;
1790
1791    //        if (image) {
1792    //            _This.$RemoveEvent(image, "load");
1793    //            _This.$RemoveEvent(image, "abort");
1794    //            _This.$RemoveEvent(image, "error");
1795
1796    //            if (_MainImageSrc == image.src) {
1797    //                _MainImage = image;
1798    //                _MainImageAbort = abort;
1799    //            }
1800    //        }
1801
1802    //        _CompleteCallback && _CompleteCallback(_MainImage, _MainImageAbort);
1803    //    }
1804
1805    //    function LoadImage(src) {
1806    //        _ImageLoading++;
1807
1808    //        if (IsBrowserOpera() && browserRuntimeVersion < 11.6 || !src) {
1809    //            LoadImageCallback(callback, null, !src);
1810    //        }
1811    //        else {
1812    //            var image = new Image();
1813
1814    //            _This.$AddEvent(image, "load", _This.$CreateCallback(null, LoadImageCallback, image, false));
1815
1816    //            var abortHandler = _This.$CreateCallback(null, LoadImageCallback, image, true);
1817    //            _This.$AddEvent(image, "abort", abortHandler);
1818    //            _This.$AddEvent(image, "error", abortHandler);
1819
1820    //            image.src = src;
1821    //        }
1822    //    }
1823
1824    //    _ThisImageLoader.$LoadImage = function (src, callback) {
1825    //        _MainImageSrc = src;
1826    //        _CompleteCallback = callback;
1827
1828    //        LoadImage(src);
1829    //        LoadComplete();
1830    //    };
1831
1832    //    _ThisImageLoader.$LoadImages = function (imageElmts, mainImageElmt, callback) {
1833    //        mainImageElmt && (_MainImageSrc = mainImageElmt.src);
1834    //        _CompleteCallback = callback;
1835
1836    //        each(imageElmts, function (imageElmt) {
1837    //            LoadImage(imageElmt.src);
1838    //        });
1839    //        LoadComplete();
1840    //    };
1841    //}
1842
1843    _This.$LoadImage = function (src, callback) {
1844        var image = new Image();
1845
1846        function LoadImageCompleteHandler(abort) {
1847            _This.$RemoveEvent(image, "load", LoadImageCompleteHandler);
1848            _This.$RemoveEvent(image, "abort", ErrorOrAbortHandler);
1849            _This.$RemoveEvent(image, "error", ErrorOrAbortHandler);
1850
1851            if (callback)
1852                callback(image, abort);
1853        }
1854
1855        function ErrorOrAbortHandler() {
1856            LoadImageCompleteHandler(true);
1857        }
1858
1859        if (IsBrowserOpera() && browserRuntimeVersion < 11.6 || !src) {
1860            LoadImageCompleteHandler(!src);
1861        }
1862        else {
1863
1864            _This.$AddEvent(image, "load", LoadImageCompleteHandler);
1865            _This.$AddEvent(image, "abort", ErrorOrAbortHandler);
1866            _This.$AddEvent(image, "error", ErrorOrAbortHandler);
1867            
1868            image.src = src;
1869        }
1870    };
1871
1872    _This.$LoadImages = function (imageElmts, mainImageElmt, callback) {
1873
1874        var _ImageLoading = imageElmts.length + 1;
1875
1876        function LoadImageCompleteEventHandler(image, abort) {
1877            _ImageLoading--;
1878            if (mainImageElmt && image && image.src == mainImageElmt.src)
1879                mainImageElmt = image;
1880            !_ImageLoading && callback && callback(mainImageElmt);
1881        }
1882
1883        each(imageElmts, function (imageElmt) {
1884            _This.$LoadImage(imageElmt.src, LoadImageCompleteEventHandler);
1885        });
1886
1887        LoadImageCompleteEventHandler();
1888    };
1889
1890    _This.$BuildElement = function (template, tagName, replacer, createCopy) {
1891        if (createCopy)
1892            template = CloneNode(template);
1893
1894        var templateHolders = $Jssor$.$GetElementsByTag(template, tagName);
1895        for (var j = templateHolders.length -1; j > -1; j--) {
1896            var templateHolder = templateHolders[j];
1897            var replaceItem = CloneNode(replacer);
1898            ClassName(replaceItem, ClassName(templateHolder));
1899            $Jssor$.$CssCssText(replaceItem, templateHolder.style.cssText);
1900
1901            var thumbnailPlaceHolderParent = $Jssor$.$ParentNode(templateHolder);
1902            $Jssor$.$InsertBefore(thumbnailPlaceHolderParent, replaceItem, templateHolder);
1903            $Jssor$.$RemoveChild(thumbnailPlaceHolderParent, templateHolder);
1904        }
1905
1906        return template;
1907    };
1908
1909    var _MouseDownButtons;
1910    function JssorButtonEx(elmt) {
1911        var _Self = this;
1912
1913        var _OriginClassName;
1914
1915        var _IsMouseDown;   //class name 'dn'
1916        var _IsActive;      //class name 'av'
1917        var _IsDisabled;    //class name 'ds'
1918
1919        function Highlight() {
1920            var className = _OriginClassName;
1921
1922            if (_IsDisabled) {
1923                className += 'ds';
1924            }
1925            else if (_IsMouseDown) {
1926                className += 'dn';
1927            }
1928            else if (_IsActive) {
1929                className += "av";
1930            }
1931
1932            ClassName(elmt, className);
1933        }
1934
1935        function OnMouseDown(event) {
1936            if (_IsDisabled) {
1937                _This.$CancelEvent(event);
1938            }
1939            else {
1940                _MouseDownButtons.push(_Self);
1941
1942                _IsMouseDown = true;
1943
1944                Highlight();
1945            }
1946        }
1947
1948        _Self.$MouseUp = function () {
1949            ///	<summary>
1950            ///		Internal member function, do not use it.
1951            ///	</summary>
1952            ///	<private />
1953
1954            _IsMouseDown = false;
1955
1956            Highlight();
1957        };
1958
1959        _Self.$Activate = function (activate) {
1960            if (activate != undefined) {
1961                _IsActive = activate;
1962
1963                Highlight();
1964            }
1965            else {
1966                return _IsActive;
1967            }
1968        };
1969
1970        _Self.$Enable = function (enable) {
1971            if (enable != undefined) {
1972                _IsDisabled = !enable;
1973
1974                Highlight();
1975            }
1976            else {
1977                return !_IsDisabled;
1978            }
1979        };
1980
1981        //JssorButtonEx Constructor
1982        {
1983            elmt = _This.$GetElement(elmt);
1984
1985            if (!_MouseDownButtons) {
1986                _This.$AddEventBrowserMouseUp(function () {
1987                    var oldMouseDownButtons = _MouseDownButtons;
1988                    _MouseDownButtons = [];
1989
1990                    each(oldMouseDownButtons, function (button) {
1991                        button.$MouseUp();
1992                    });
1993                });
1994
1995                _MouseDownButtons = [];
1996            }
1997
1998            _OriginClassName = ClassName(elmt);
1999
2000            $Jssor$.$AddEvent(elmt, "mousedown", OnMouseDown);
2001        }
2002    }
2003
2004    _This.$Buttonize = function (elmt) {
2005        return new JssorButtonEx(elmt);
2006    };
2007
2008    _This.$Css = Css;
2009    _This.$CssN = CssN;
2010    _This.$CssP = CssP;
2011
2012    _This.$CssOverflow = CssProxy("overflow");
2013
2014    _This.$CssTop = CssProxy("top", 2);
2015    _This.$CssLeft = CssProxy("left", 2);
2016    _This.$CssWidth = CssProxy("width", 2);
2017    _This.$CssHeight = CssProxy("height", 2);
2018    _This.$CssMarginLeft = CssProxy("marginLeft", 2);
2019    _This.$CssMarginTop = CssProxy("marginTop", 2);
2020    _This.$CssPosition = CssProxy("position");
2021    _This.$CssDisplay = CssProxy("display");
2022    _This.$CssZIndex = CssProxy("zIndex", 1);
2023    _This.$CssFloat = function (elmt, float) {
2024        return Css(elmt, IsBrowserIE() ? "styleFloat" : "cssFloat", float);
2025    };
2026    _This.$CssOpacity = function (elmt, opacity, ie9EarlierForce) {
2027        if (opacity != undefined) {
2028            SetStyleOpacity(elmt, opacity, ie9EarlierForce);
2029        }
2030        else {
2031            return GetStyleOpacity(elmt);
2032        }
2033    };
2034
2035    _This.$CssCssText = function (elmt, text) {
2036        if (text != undefined) {
2037            elmt.style.cssText = text;
2038        }
2039        else {
2040            return elmt.style.cssText;
2041        }
2042    };
2043
2044    var _StyleGetter = {
2045        $Opacity: _This.$CssOpacity,
2046        $Top: _This.$CssTop,
2047        $Left: _This.$CssLeft,
2048        $Width: _This.$CssWidth,
2049        $Height: _This.$CssHeight,
2050        $Position: _This.$CssPosition,
2051        $Display: _This.$CssDisplay,
2052        $ZIndex: _This.$CssZIndex
2053    };
2054
2055    var _StyleSetterReserved;
2056
2057    function StyleSetter() {
2058        if (!_StyleSetterReserved) {
2059            _StyleSetterReserved = Extend({
2060                $MarginTop: _This.$CssMarginTop,
2061                $MarginLeft: _This.$CssMarginLeft,
2062                $Clip: _This.$SetStyleClip,
2063                $Transform: _This.$SetStyleTransform
2064            }, _StyleGetter);
2065        }
2066        return _StyleSetterReserved;
2067    }
2068
2069    function StyleSetterEx() {
2070        StyleSetter();
2071
2072        //For Compression Only
2073        _StyleSetterReserved.$Transform = _StyleSetterReserved.$Transform;
2074
2075        return _StyleSetterReserved;
2076    }
2077
2078    _This.$StyleSetter = StyleSetter;
2079
2080    _This.$StyleSetterEx = StyleSetterEx;
2081
2082    _This.$GetStyles = function (elmt, originStyles) {
2083        StyleSetter();
2084
2085        var styles = {};
2086
2087        each(originStyles, function (value, key) {
2088            if (_StyleGetter[key]) {
2089                styles[key] = _StyleGetter[key](elmt);
2090            }
2091        });
2092
2093        return styles;
2094    };
2095
2096    _This.$SetStyles = function (elmt, styles) {
2097        var styleSetter = StyleSetter();
2098
2099        each(styles, function (value, key) {
2100            styleSetter[key] && styleSetter[key](elmt, value);
2101        });
2102    };
2103
2104    _This.$SetStylesEx = function (elmt, styles) {
2105        StyleSetterEx();
2106
2107        _This.$SetStyles(elmt, styles);
2108    };
2109
2110    $JssorMatrix$ = new function () {
2111        var _ThisMatrix = this;
2112
2113        function Multiply(ma, mb) {
2114            var acs = ma[0].length;
2115            var rows = ma.length;
2116            var cols = mb[0].length;
2117
2118            var matrix = [];
2119
2120            for (var r = 0; r < rows; r++) {
2121                var row = matrix[r] = [];
2122                for (var c = 0; c < cols; c++) {
2123                    var unitValue = 0;
2124
2125                    for (var ac = 0; ac < acs; ac++) {
2126                        unitValue += ma[r][ac] * mb[ac][c];
2127                    }
2128
2129                    row[c] = unitValue;
2130                }
2131            }
2132
2133            return matrix;
2134        }
2135
2136        _ThisMatrix.$ScaleX = function (matrix, sx) {
2137            return _ThisMatrix.$ScaleXY(matrix, sx, 0);
2138        };
2139
2140        _ThisMatrix.$ScaleY = function (matrix, sy) {
2141            return _ThisMatrix.$ScaleXY(matrix, 0, sy);
2142        };
2143
2144        _ThisMatrix.$ScaleXY = function (matrix, sx, sy) {
2145            return Multiply(matrix, [[sx, 0], [0, sy]]);
2146        };
2147
2148        _ThisMatrix.$TransformPoint = function (matrix, p) {
2149            var pMatrix = Multiply(matrix, [[p.x], [p.y]]);
2150
2151            return Point(pMatrix[0][0], pMatrix[1][0]);
2152        };
2153    };
2154
2155    _This.$CreateMatrix = function (alpha, scaleX, scaleY) {
2156        var cos = Math.cos(alpha);
2157        var sin = Math.sin(alpha);
2158        //var r11 = cos;
2159        //var r21 = sin;
2160        //var r12 = -sin;
2161        //var r22 = cos;
2162
2163        //var m11 = cos * scaleX;
2164        //var m12 = -sin * scaleY;
2165        //var m21 = sin * scaleX;
2166        //var m22 = cos * scaleY;
2167
2168        return [[cos * scaleX, -sin * scaleY], [sin * scaleX, cos * scaleY]];
2169    };
2170
2171    _This.$GetMatrixOffset = function (matrix, width, height) {
2172        var p1 = $JssorMatrix$.$TransformPoint(matrix, Point(-width / 2, -height / 2));
2173        var p2 = $JssorMatrix$.$TransformPoint(matrix, Point(width / 2, -height / 2));
2174        var p3 = $JssorMatrix$.$TransformPoint(matrix, Point(width / 2, height / 2));
2175        var p4 = $JssorMatrix$.$TransformPoint(matrix, Point(-width / 2, height / 2));
2176
2177        return Point(Math.min(p1.x, p2.x, p3.x, p4.x) + width / 2, Math.min(p1.y, p2.y, p3.y, p4.y) + height / 2);
2178    };
2179
2180    _This.$Transform = function (fromStyles, toStyles, interPosition, easings, durings, rounds, options) {
2181
2182        var currentStyles = toStyles;
2183
2184        if (fromStyles) {
2185            currentStyles = {};
2186
2187            for (var key in toStyles) {
2188                var round = rounds[key] || 1;
2189                var during = durings[key] || [0, 1];
2190                var propertyInterPosition = (interPosition - during[0]) / during[1];
2191                propertyInterPosition = Math.min(Math.max(propertyInterPosition, 0), 1);
2192                propertyInterPosition = propertyInterPosition * round;
2193                var floorPosition = Math.floor(propertyInterPosition);
2194                if (propertyInterPosition != floorPosition)
2195                    propertyInterPosition -= floorPosition;
2196
2197                var easing = easings[key] || easings.$Default;
2198                var easingValue = easing(propertyInterPosition);
2199                var currentPropertyValue;
2200                var value = fromStyles[key];
2201                var toValue = toStyles[key];
2202
2203                if ($Jssor$.$IsNumeric(toValue)) {
2204                    currentPropertyValue = value + (toValue - value) * easingValue;
2205                }
2206                else {
2207                    currentPropertyValue = $Jssor$.$Extend({ $Offset: {} }, fromStyles[key]);
2208
2209                    $Jssor$.$Each(toValue.$Offset, function (rectX, n) {
2210                        var offsetValue = rectX * easingValue;
2211                        currentPropertyValue.$Offset[n] = offsetValue;
2212                        currentPropertyValue[n] += offsetValue;
2213                    });
2214                }
2215                currentStyles[key] = currentPropertyValue;
2216            }
2217
2218            if (fromStyles.$Zoom) {
2219                currentStyles.$Transform = { $Rotate: currentStyles.$Rotate || 0, $Scale: currentStyles.$Zoom, $OriginalWidth: options.$OriginalWidth, $OriginalHeight: options.$OriginalHeight };
2220            }
2221        }
2222
2223        if (toStyles.$Clip && options.$Move) {
2224            var styleFrameNClipOffset = currentStyles.$Clip.$Offset;
2225
2226            var offsetY = (styleFrameNClipOffset.$Top || 0) + (styleFrameNClipOffset.$Bottom || 0);
2227            var offsetX = (styleFrameNClipOffset.$Left || 0) + (styleFrameNClipOffset.$Right || 0
2227);
2228
2229            currentStyles.$Left = (currentStyles.$Left || 0) + offsetX;
2230            currentStyles.$Top = (currentStyles.$Top || 0) + offsetY;
2231            currentStyles.$Clip.$Left -= offsetX;
2232            currentStyles.$Clip.$Right -= offsetX;
2233            currentStyles.$Clip.$Top -= offsetY;
2234            currentStyles.$Clip.$Bottom -= offsetY;
2235        }
2236
2237        if (currentStyles.$Clip && $Jssor$.$CanClearClip() && !currentStyles.$Clip.$Top && !currentStyles.$Clip.$Left && (currentStyles.$Clip.$Right == options.$OriginalWidth) && (currentStyles.$Clip.$Bottom == options.$OriginalHeight))
2238            currentStyles.$Clip = null;
2239
2240        return currentStyles;
2241    };
2242};
2243
2244//$JssorObject$
2245var $JssorObject$ = window.$JssorObject$ = function () {
2246    var _ThisObject = this;
2247    // Fields
2248
2249    var _Listeners = []; // dictionary of eventName --> array of handlers
2250    var _Listenees = [];
2251
2252    // Private Methods
2253    function AddListener(eventName, handler) {
2254
2255        $JssorDebug$.$Execute(function () {
2256            if (eventName == undefined || eventName == null)
2257                throw new Error("param 'eventName' is null or empty.");
2258
2259            if (typeof (handler) != "function") {
2260                throw "param 'handler' must be a function.";
2261            }
2262
2263            $Jssor$.$Each(_Listeners, function (listener) {
2264                if (listener.$EventName == eventName && listener.$Handler === handler) {
2265                    throw new Error("The handler listened to the event already, cannot listen to the same event of the same object with the same handler twice.");
2266                }
2267            });
2268        });
2269
2270        _Listeners.push({ $EventName: eventName, $Handler: handler });
2271    }
2272
2273    function RemoveListener(eventName, handler) {
2274
2275        $JssorDebug$.$Execute(function () {
2276            if (eventName == undefined || eventName == null)
2277                throw new Error("param 'eventName' is null or empty.");
2278
2279            if (typeof (handler) != "function") {
2280                throw "param 'handler' must be a function.";
2281            }
2282        });
2283
2284        $Jssor$.$Each(_Listeners, function (listener, index) {
2285            if (listener.$EventName == eventName && listener.$Handler === handler) {
2286                _Listeners.splice(index, 1);
2287            }
2288        });
2289    }
2290
2291    function ClearListeners() {
2292        _Listeners = [];
2293    }
2294
2295    function ClearListenees() {
2296
2297        $Jssor$.$Each(_Listenees, function (listenee) {
2298            $Jssor$.$RemoveEvent(listenee.$Obj, listenee.$EventName, listenee.$Handler);
2299        });
2300
2301        _Listenees = [];
2302    }
2303
2304    //Protected Methods
2305    _ThisObject.$Listen = function (obj, eventName, handler, useCapture) {
2306
2307        $JssorDebug$.$Execute(function () {
2308            if (!obj)
2309                throw new Error("param 'obj' is null or empty.");
2310
2311            if (eventName == undefined || eventName == null)
2312                throw new Error("param 'eventName' is null or empty.");
2313
2314            if (typeof (handler) != "function") {
2315                throw "param 'handler' must be a function.";
2316            }
2317
2318            $Jssor$.$Each(_Listenees, function (listenee) {
2319                if (listenee.$Obj === obj && listenee.$EventName == eventName && listenee.$Handler === handler) {
2320                    throw new Error("The handler listened to the event already, cannot listen to the same event of the same object with the same handler twice.");
2321                }
2322            });
2323        });
2324
2325        $Jssor$.$AddEvent(obj, eventName, handler, useCapture);
2326        _Listenees.push({ $Obj: obj, $EventName: eventName, $Handler: handler });
2327    };
2328
2329    _ThisObject.$Unlisten = function (obj, eventName, handler) {
2330
2331        $JssorDebug$.$Execute(function () {
2332            if (!obj)
2333                throw new Error("param 'obj' is null or empty.");
2334
2335            if (eventName == undefined || eventName == null)
2336                throw new Error("param 'eventName' is null or empty.");
2337
2338            if (typeof (handler) != "function") {
2339                throw "param 'handler' must be a function.";
2340            }
2341        });
2342
2343        $Jssor$.$Each(_Listenees, function (listenee, index) {
2344            if (listenee.$Obj === obj && listenee.$EventName == eventName && listenee.$Handler === handler) {
2345                $Jssor$.$RemoveEvent(obj, eventName, handler);
2346                _Listenees.splice(index, 1);
2347            }
2348        });
2349    };
2350
2351    _ThisObject.$UnlistenAll = ClearListenees;
2352
2353    // Public Methods
2354    _ThisObject.$On = _ThisObject.addEventListener = AddListener;
2355
2356    _ThisObject.$Off = _ThisObject.removeEventListener = RemoveListener;
2357
2358    _ThisObject.$TriggerEvent = function (eventName) {
2359
2360        var args = [].slice.call(arguments, 1);
2361
2362        $Jssor$.$Each(_Listeners, function (listener) {
2363            try {
2364                listener.$EventName == eventName && listener.$Handler.apply(window, args);
2365            } catch (e) {
2366                // handler threw an error, ignore, go on to next one
2367                $JssorDebug$.$Error(e.name + " while executing " + eventName +
2368                        " handler: " + e.message, e);
2369            }
2370        });
2371    };
2372
2373    _ThisObject.$Destroy = function () {
2374        ClearListenees();
2375        ClearListeners();
2376
2377        for (var name in _ThisObject)
2378            delete _ThisObject[name];
2379    };
2380
2381    $JssorDebug$.$C_AbstractClass(_ThisObject);
2382};
2383
2384$JssorAnimator$ = function (delay, duration, options, elmt, fromStyles, toStyles) {
2385    delay = delay || 0;
2386
2387    var _ThisAnimator = this;
2388    var _AutoPlay;
2389    var _Hiden;
2390    var _CombineMode;
2391    var _PlayToPosition;
2392    var _PlayDirection;
2393    var _NoStop;
2394    var _TimeStampLastFrame = 0;
2395
2396    var _SubEasings;
2397    var _SubRounds;
2398    var _SubDurings;
2399    var _Callback;
2400
2401    var _Position_Current = 0;
2402    var _Position_Display = 0;
2403    var _Hooked;
2404
2405    var _Position_InnerBegin = delay;
2406    var _Position_InnerEnd = delay + duration;
2407    var _Position_OuterBegin;
2408    var _Position_OuterEnd;
2409    var _LoopLength;
2410
2411    var _NestedAnimators = [];
2412    var _StyleSetter;
2413
2414    function GetPositionRange(position, begin, end) {
2415        var range = 0;
2416
2417        if (position < begin)
2418            range = -1;
2419
2420        else if (position > end)
2421            range = 1;
2422
2423        return range;
2424    }
2425
2426    function GetInnerPositionRange(position) {
2427        return GetPositionRange(position, _Position_InnerBegin, _Position_InnerEnd);
2428    }
2429
2430    function GetOuterPositionRange(position) {
2431        return GetPositionRange(position, _Position_OuterBegin, _Position_OuterEnd);
2432    }
2433
2434    function Shift(offset) {
2435        _Position_OuterBegin += offset;
2436        _Position_OuterEnd += offset;
2437        _Position_InnerBegin += offset;
2438        _Position_InnerEnd += offset;
2439
2440        _Position_Current += offset;
2441        _Position_Display += offset;
2442
2443        $Jssor$.$Each(_NestedAnimators, function (animator) {
2444            animator, animator.$Shift(offset);
2445        });
2446    }
2447
2448    function Locate(position, relative) {
2449        var offset = position - _Position_OuterBegin + delay * relative;
2450
2451        Shift(offset);
2452
2453        //$JssorDebug$.$Execute(function () {
2454        //    _ThisAnimator.$Position_InnerBegin = _Position_InnerBegin;
2455        //    _ThisAnimator.$Position_InnerEnd = _Position_InnerEnd;
2456        //    _ThisAnimator.$Position_OuterBegin = _Position_OuterBegin;
2457        //    _ThisAnimator.$Position_OuterEnd = _Position_OuterEnd;
2458        //});
2459
2460        return _Position_OuterEnd;
2461    }
2462
2463    function GoToPosition(positionOuter, force) {
2464        var trimedPositionOuter = positionOuter;
2465
2466        if (_LoopLength && (trimedPositionOuter >= _Position_OuterEnd || trimedPositionOuter <= _Position_OuterBegin)) {
2467            trimedPositionOuter = ((trimedPositionOuter - _Position_OuterBegin) % _LoopLength + _LoopLength) % _LoopLength + _Position_OuterBegin;
2468        }
2469
2470        if (!_Hooked || _NoStop || force || _Position_Current != trimedPositionOuter) {
2471
2472            var positionToDisplay = Math.min(trimedPositionOuter, _Position_OuterEnd);
2473            positionToDisplay = Math.max(positionToDisplay, _Position_OuterBegin);
2474
2475            if (!_Hooked || _NoStop || force || positionToDisplay != _Position_Display) {
2476                if (toStyles) {
2477
2478                    var interPosition = (positionToDisplay - _Position_InnerBegin) / (duration || 1);
2479
2480                    //if (options.$Optimize && $Jssor$.$IsBrowserChrome() && duration) {
2481                    //    interPosition = Math.round(interPosition / 8 * duration) * 8 / duration;
2482                    //}
2483
2484                    if (options.$Reverse)
2485                        interPosition = 1 - interPosition;
2486
2487                    var currentStyles = $Jssor$.$Transform(fromStyles, toStyles, interPosition, _SubEasings, _SubDurings, _SubRounds, options);
2488
2489                    $Jssor$.$Each(currentStyles, function (value, key) {
2490                        _StyleSetter[key] && _StyleSetter[key](elmt, value);
2491                    });
2492                }
2493
2494                _ThisAnimator.$OnInnerOffsetChange(_Position_Display - _Position_InnerBegin, positionToDisplay - _Position_InnerBegin);
2495            }
2496
2497            _Position_Display = positionToDisplay;
2498
2499            $Jssor$.$Each(_NestedAnimators, function (animator, i) {
2500                var nestedAnimator = positionOuter < _Position_Current ? _NestedAnimators[_NestedAnimators.length - i - 1] : animator;
2501                nestedAnimator.$GoToPosition(positionOuter, force);
2502            });
2503
2504            var positionOld = _Position_Current;
2505            var positionNew = positionOuter;
2506
2507            _Position_Current = trimedPositionOuter;
2508            _Hooked = true;
2509
2510            _ThisAnimator.$OnPositionChange(positionOld, positionNew);
2511        }
2512    }
2513
2514    function Join(animator, combineMode) {
2515        ///	<summary>
2516        ///		Combine another animator as nested animator
2517        ///	</summary>
2518        ///	<param name="animator" type="$JssorAnimator$">
2519        ///		An instance of $JssorAnimator$
2520        ///	</param>
2521        ///	<param name="combineMode" type="int">
2522        ///		0: parallel - place the animator parallel to this animator.
2523        ///		1: chain - chain the animator at the _Position_InnerEnd of this animator.
2524        ///	</param>
2525        $JssorDebug$.$Execute(function () {
2526            if (combineMode !== 0 && combineMode !== 1)
2527                $JssorDebug$.$Fail("Argument out of range, the value of 'combineMode' should be either 0 or 1.");
2528        });
2529
2530        if (combineMode)
2531            animator.$Locate(_Position_OuterEnd, 1);
2532
2533        _Position_OuterEnd = Math.max(_Position_OuterEnd, animator.$GetPosition_OuterEnd());
2534        _NestedAnimators.push(animator);
2535    }
2536
2537    var RequestAnimationFrame = window.requestAnimationFrame
2538    || window.webkitRequestAnimationFrame
2539    || window.mozRequestAnimationFrame
2540    || window.msRequestAnimationFrame;
2541
2542    if ($Jssor$.$IsBrowserSafari() && $Jssor$.$BrowserVersion() < 7) {
2543        RequestAnimationFrame = null;
2544
2545        $JssorDebug$.$Log("Custom animation frame for safari before 7.");
2546    }
2547
2548    RequestAnimationFrame = RequestAnimationFrame || function (callback) {
2549        $Jssor$.$Delay(callback, options.$Interval);
2550    };
2551
2552    function ShowFrame() {
2553        if (_AutoPlay) {
2554            var now = $Jssor$.$GetNow();
2555            var timeOffset = Math.min(now - _TimeStampLastFrame, options.$IntervalMax);
2556            var timePosition = _Position_Current + timeOffset * _PlayDirection;
2557            _TimeStampLastFrame = now;
2558
2559            if (timePosition * _PlayDirection >= _PlayToPosition * _PlayDirection)
2560                timePosition = _PlayToPosition;
2561
2562            GoToPosition(timePosition);
2563
2564            if (!_NoStop && timePosition * _PlayDirection >= _PlayToPosition * _PlayDirection) {
2565                Stop(_Callback);
2566            }
2567            else {
2568                RequestAnimationFrame(ShowFrame);
2569            }
2570        }
2571    }
2572
2573    function PlayToPosition(toPosition, callback, noStop) {
2574        if (!_AutoPlay) {
2575            _AutoPlay = true;
2576            _NoStop = noStop
2577            _Callback = callback;
2578            toPosition = Math.max(toPosition, _Position_OuterBegin);
2579            toPosition = Math.min(toPosition, _Position_OuterEnd);
2580            _PlayToPosition = toPosition;
2581            _PlayDirection = _PlayToPosition < _Position_Current ? -1 : 1;
2582            _ThisAnimator.$OnStart();
2583            _TimeStampLastFrame = $Jssor$.$GetNow();
2584            RequestAnimationFrame(ShowFrame);
2585        }
2586    }
2587
2588    function Stop(callback) {
2589        if (_AutoPlay) {
2590            _NoStop = _AutoPlay = _Callback = false;
2591            _ThisAnimator.$OnStop();
2592
2593            if (callback)
2594                callback();
2595        }
2596    }
2597
2598    _ThisAnimator.$Play = function (positionLength, callback, noStop) {
2599        PlayToPosition(positionLength ? _Position_Current + positionLength : _Position_OuterEnd, callback, noStop);
2600    };
2601
2602    _ThisAnimator.$PlayToPosition = PlayToPosition;
2603
2604    _ThisAnimator.$PlayToBegin = function (callback, noStop) {
2605        PlayToPosition(_Position_OuterBegin, callback, noStop);
2606    };
2607
2608    _ThisAnimator.$PlayToEnd = function (callback, noStop) {
2609        PlayToPosition(_Position_OuterEnd, callback, noStop);
2610    };
2611
2612    _ThisAnimator.$Stop = Stop;
2613
2614    _ThisAnimator.$Continue = function (toPosition) {
2615        PlayToPosition(toPosition);
2616    };
2617
2618    _ThisAnimator.$GetPosition = function () {
2619        return _Position_Current;
2620    };
2621
2622    _ThisAnimator.$GetPlayToPosition = function () {
2623        return _PlayToPosition;
2624    };
2625
2626    _ThisAnimator.$GetPosition_Display = function () {
2627        return _Position_Display;
2628    };
2629
2630    _ThisAnimator.$GoToPosition = GoToPosition;
2631
2632    _ThisAnimator.$GoToBegin = function () {
2633        GoToPosition(_Position_OuterBegin, true);
2634    };
2635
2636    _ThisAnimator.$GoToEnd = function () {
2637        GoToPosition(_Position_OuterEnd, true);
2638    };
2639
2640    _ThisAnimator.$Move = function (offset) {
2641        GoToPosition(_Position_Current + offset);
2642    };
2643
2644    _ThisAnimator.$CombineMode = function () {
2645        return _CombineMode;
2646    };
2647
2648    _ThisAnimator.$GetDuration = function () {
2649        return duration;
2650    };
2651
2652    _ThisAnimator.$IsPlaying = function () {
2653        return _AutoPlay;
2654    };
2655
2656    _ThisAnimator.$IsOnTheWay = function () {
2657        return _Position_Current > _Position_InnerBegin && _Position_Current <= _Position_InnerEnd;
2658    };
2659
2660    _ThisAnimator.$SetLoopLength = function (length) {
2661        _LoopLength = length;
2662    };
2663
2664    _ThisAnimator.$Locate = Locate;
2665
2666    _ThisAnimator.$Shift = Shift;
2667
2668    _ThisAnimator.$Join = Join;
2669
2670    _ThisAnimator.$Combine = function (animator) {
2671        ///	<summary>
2672        ///		Combine another animator parallel to this animator
2673        ///	</summary>
2674        ///	<param name="animator" type="$JssorAnimator$">
2675        ///		An instance of $JssorAnimator$
2676        ///	</param>
2677        Join(animator, 0);
2678    };
2679
2680    _ThisAnimator.$Chain = function (animator) {
2681        ///	<summary>
2682        ///		Chain another animator at the _Position_InnerEnd of this animator
2683        ///	</summary>
2684        ///	<param name="animator" type="$JssorAnimator$">
2685        ///		An instance of $JssorAnimator$
2686        ///	</param>
2687        Join(animator, 1);
2688    };
2689
2690    _ThisAnimator.$GetPosition_InnerBegin = function () {
2691        ///	<summary>
2692        ///		Internal member function, do not use it.
2693        ///	</summary>
2694        ///	<private />
2695        ///	<returns type="int" />
2696        return _Position_InnerBegin;
2697    };
2698
2699    _ThisAnimator.$GetPosition_InnerEnd = function () {
2700        ///	<summary>
2701        ///		Internal member function, do not use it.
2702        ///	</summary>
2703        ///	<private />
2704        ///	<returns type="int" />
2705        return _Position_InnerEnd;
2706    };
2707
2708    _ThisAnimator.$GetPosition_OuterBegin = function () {
2709        ///	<summary>
2710        ///		Internal member function, do not use it.
2711        ///	</summary>
2712        ///	<private />
2713        ///	<returns type="int" />
2714        return _Position_OuterBegin;
2715    };
2716
2717    _ThisAnimator.$GetPosition_OuterEnd = function () {
2718        ///	<summary>
2719        ///		Internal member function, do not use it.
2720        ///	</summary>
2721        ///	<private />
2722        ///	<returns type="int" />
2723        return _Position_OuterEnd;
2724    };
2725
2726    _ThisAnimator.$OnPositionChange = _ThisAnimator.$OnStart = _ThisAnimator.$OnStop = _ThisAnimator.$OnInnerOffsetChange = $Jssor$.$EmptyFunction;
2727    _ThisAnimator.$Version = $Jssor$.$GetNow();
2728
2729    //Constructor  1
2730    {
2731        options = $Jssor$.$Extend({
2732            $Interval: 16,
2733            $IntervalMax: 50
2734        }, options);
2735
2736        //Sodo statement, for development time intellisence only
2737        $JssorDebug$.$Execute(function () {
2738            options = $Jssor$.$Extend({
2739                $LoopLength: undefined,
2740                $Setter: undefined,
2741                $Easing: undefined
2742            }, options);
2743        });
2744
2745        _LoopLength = options.$LoopLength;
2746
2747        _StyleSetter = $Jssor$.$Extend({}, $Jssor$.$StyleSetter(), options.$Setter);
2748
2749        _Position_OuterBegin = _Position_InnerBegin = delay;
2750        _Position_OuterEnd = _Position_InnerEnd = delay + duration;
2751
2752        _SubRounds = options.$Round || {};
2753        _SubDurings = options.$During || {};
2754        _SubEasings = $Jssor$.$Extend({ $Default: $Jssor$.$IsFunction(options.$Easing) && options.$Easing || $JssorEasing$.$EaseSwing }, options.$Easing);
2755    }
2756};
2757
2758function $JssorPlayerClass$() {
2759
2760    var _ThisPlayer = this;
2761    var _PlayerControllers = [];
2762
2763    function PlayerController(playerElement) {
2764        var _SelfPlayerController = this;
2765        var _PlayerInstance;
2766        var _PlayerInstantces = [];
2767
2768        function OnPlayerInstanceDataAvailable(event) {
2769            var srcElement = $Jssor$.$EventSrc(event);
2770            _PlayerInstance = srcElement.pInstance;
2771
2772            $Jssor$.$RemoveEvent(srcElement, "dataavailable", OnPlayerInstanceDataAvailable);
2773            $Jssor$.$Each(_PlayerInstantces, function (playerInstance) {
2774                if (playerInstance != _PlayerInstance) {
2775                    playerInstance.$Remove();
2776                }
2777            });
2778
2779            playerElement.pTagName = _PlayerInstance.tagName;
2780            _PlayerInstantces = null;
2781        }
2782
2783        function HandlePlayerInstance(playerInstanceElement) {
2784            var playerHandler;
2785
2786            if (!playerInstanceElement.pInstance) {
2787                var playerHandlerAttribute = $Jssor$.$AttributeEx(playerInstanceElement, "pHandler");
2788
2789                if ($JssorPlayer$[playerHandlerAttribute]) {
2790                    $Jssor$.$AddEvent(playerInstanceElement, "dataavailable", OnPlayerInstanceDataAvailable);
2791                    playerHandler = new $JssorPlayer$[playerHandlerAttribute](playerElement, playerInstanceElement);
2792                    _PlayerInstantces.push(playerHandler);
2793
2794                    $JssorDebug$.$Execute(function () {
2795                        if ($Jssor$.$Type(playerHandler.$Remove) != "function") {
2796                            $JssorDebug$.$Fail("'pRemove' interface not implemented for player handler '" + playerHandlerAttribute + "'.");
2797                        }
2798                    });
2799                }
2800            }
2801
2802            return playerHandler;
2803        }
2804
2805        _SelfPlayerController.$InitPlayerController = function () {
2806            if (!playerElement.pInstance && !HandlePlayerInstance(playerElement)) {
2807
2808                var playerInstanceElements = $Jssor$.$Children(playerElement);
2809
2810                $Jssor$.$Each(playerInstanceElements, function (playerInstanceElement) {
2811                    HandlePlayerInstance(playerInstanceElement);
2812                });
2813            }
2814        };
2815    }
2816
2817    _ThisPlayer.$EVT_SWITCH = 21;
2818
2819    _ThisPlayer.$FetchPlayers = function (elmt) {
2820        elmt = elmt || document.body;
2821
2822        var playerElements = $Jssor$.$FindChildren(elmt, "player");
2823
2824        $Jssor$.$Each(playerElements, function (playerElement) {
2825            if (!_PlayerControllers[playerElement.pId]) {
2826                playerElement.pId = _PlayerControllers.length;
2827                _PlayerControllers.push(new PlayerController(playerElement));
2828            }
2829            var playerController = _PlayerControllers[playerElement.pId];
2830            playerController.$InitPlayerController();
2831        });
2832    };
2833}

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.