root/trunk/website/js/swfobject_modified.js @ 42

Revision 5, 21.8 kB (checked in by DanWilson, 17 years ago)

Initial Commit Of ModelGlue? Website (upgrade to blogcfc 511)

Line 
1/*!     SWFObject v2.0 <http://code.google.com/p/swfobject/>
2        Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
3        This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
4*/
5
6var swfobject = function() {
7       
8        var UNDEF = "undefined",
9                OBJECT = "object",
10                SHOCKWAVE_FLASH = "Shockwave Flash",
11                SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
12                FLASH_MIME_TYPE = "application/x-shockwave-flash",
13                EXPRESS_INSTALL_ID = "SWFObjectExprInst",
14               
15                win = window,
16                doc = document,
17                nav = navigator,
18               
19                domLoadFnArr = [],
20                regObjArr = [],
21                timer = null,
22                storedAltContent = null,
23                storedAltContentId = null,
24                isDomLoaded = false,
25                isExpressInstallActive = false;
26       
27        /* Centralized function for browser feature detection
28                - Proprietary feature detection (conditional compiling) is used to detect Internet Explorer's features
29                - User agent string detection is only used when no alternative is possible
30                - Is executed directly for optimal performance
31        */     
32        var ua = function() {
33                var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF && typeof doc.appendChild != UNDEF && typeof doc.replaceChild != UNDEF && typeof doc.removeChild != UNDEF && typeof doc.cloneNode != UNDEF,
34                        playerVersion = [0,0,0],
35                        d = null;
36                if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
37                        d = nav.plugins[SHOCKWAVE_FLASH].description;
38                        if (d) {
39                                d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
40                                playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
41                                playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
42                                playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
43                        }
44                }
45                else if (typeof win.ActiveXObject != UNDEF) {
46                        var a = null, fp6Crash = false;
47                        try {
48                                a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
49                        }
50                        catch(e) {
51                                try { 
52                                        a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
53                                        playerVersion = [6,0,21];
54                                        a.AllowScriptAccess = "always";  // Introduced in fp6.0.47
55                                }
56                                catch(e) {
57                                        if (playerVersion[0] == 6) {
58                                                fp6Crash = true;
59                                        }
60                                }
61                                if (!fp6Crash) {
62                                        try {
63                                                a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
64                                        }
65                                        catch(e) {}
66                                }
67                        }
68                        if (!fp6Crash && a) { // a will return null when ActiveX is disabled
69                                try {
70                                        d = a.GetVariable("$version");  // Will crash fp6.0.21/23/29
71                                        if (d) {
72                                                d = d.split(" ")[1].split(",");
73                                                playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
74                                        }
75                                }
76                                catch(e) {}
77                        }
78                }
79                var u = nav.userAgent.toLowerCase(),
80                        p = nav.platform.toLowerCase(),
81                        webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
82                        ie = false,
83                        windows = p ? /win/.test(p) : /win/.test(u),
84                        mac = p ? /mac/.test(p) : /mac/.test(u);
85                /*@cc_on
86                        ie = true;
87                        @if (@_win32)
88                                windows = true;
89                        @elif (@_mac)
90                                mac = true;
91                        @end
92                @*/
93                return { w3cdom:w3cdom, pv:playerVersion, webkit:webkit, ie:ie, win:windows, mac:mac };
94        }();
95
96        /* Cross-browser onDomLoad
97                - Based on Dean Edwards' solution: http://dean.edwards.name/weblog/2006/06/again/
98                - Will fire an event as soon as the DOM of a page is loaded (supported by Gecko based browsers - like Firefox -, IE, Opera9+, Safari)
99        */ 
100        var onDomLoad = function() {
101                if (!ua.w3cdom) {
102                        return;
103                }
104                addDomLoadEvent(main);
105                if (ua.ie && ua.win) {
106                        try {  // Avoid a possible Operation Aborted error
107                                doc.write("<scr" + "ipt id=__ie_ondomload defer=true src=//:></scr" + "ipt>"); // String is split into pieces to avoid Norton AV to add code that can cause errors
108                                var s = getElementById("__ie_ondomload");
109                                if (s) {
110                                        s.onreadystatechange = function() {
111                                                if (this.readyState == "complete") {
112                                                        this.parentNode.removeChild(this);
113                                                        callDomLoadFunctions();
114                                                }
115                                        };
116                                }
117                        }
118                        catch(e) {}
119                }
120                if (ua.webkit && typeof doc.readyState != UNDEF) {
121                        timer = setInterval(function() { if (/loaded|complete/.test(doc.readyState)) { callDomLoadFunctions(); }}, 10);
122                }
123                if (typeof doc.addEventListener != UNDEF) {
124                        doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, null);
125                }
126                addLoadEvent(callDomLoadFunctions);
127        }();
128       
129        function callDomLoadFunctions() {
130                if (isDomLoaded) {
131                        return;
132                }
133                if (ua.ie && ua.win) { // Test if we can really add elements to the DOM; we don't want to fire it too early
134                        var s = createElement("span");
135                        try { // Avoid a possible Operation Aborted error
136                                var t = doc.getElementsByTagName("body")[0].appendChild(s);
137                                t.parentNode.removeChild(t);
138                        }
139                        catch (e) {
140                                return;
141                        }
142                }
143                isDomLoaded = true;
144                if (timer) {
145                        clearInterval(timer);
146                        timer = null;
147                }
148                var dl = domLoadFnArr.length;
149                for (var i = 0; i < dl; i++) {
150                        domLoadFnArr[i]();
151                }
152        }
153       
154        function addDomLoadEvent(fn) {
155                if (isDomLoaded) {
156                        fn();
157                }
158                else { 
159                        domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
160                }
161        }
162       
163        /* Cross-browser onload
164                - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
165                - Will fire an event as soon as a web page including all of its assets are loaded
166         */
167        function addLoadEvent(fn) {
168                if (typeof win.addEventListener != UNDEF) {
169                        win.addEventListener("load", fn, false);
170                }
171                else if (typeof doc.addEventListener != UNDEF) {
172                        doc.addEventListener("load", fn, false);
173                }
174                else if (typeof win.attachEvent != UNDEF) {
175                        win.attachEvent("onload", fn);
176                }
177                else if (typeof win.onload == "function") {
178                        var fnOld = win.onload;
179                        win.onload = function() {
180                                fnOld();
181                                fn();
182                        };
183                }
184                else {
185                        win.onload = fn;
186                }
187        }
188       
189        /* Main function
190                - Will preferably execute onDomLoad, otherwise onload (as a fallback)
191        */
192        function main() { // Static publishing only
193                var rl = regObjArr.length;
194                for (var i = 0; i < rl; i++) { // For each registered object element
195                        var id = regObjArr[i].id;
196                        if (ua.pv[0] > 0) {
197                                var obj = getElementById(id);
198                                if (obj) {
199                                        regObjArr[i].width = obj.getAttribute("width") ? obj.getAttribute("width") : "0";
200                                        regObjArr[i].height = obj.getAttribute("height") ? obj.getAttribute("height") : "0";
201                                        if (hasPlayerVersion(regObjArr[i].swfVersion)) { // Flash plug-in version >= Flash content version: Houston, we have a match!
202                                                if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements
203                                                        fixParams(obj);
204                                                }
205                                                setVisibility(id, true);
206                                        }
207                                        else if (regObjArr[i].expressInstall && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { // Show the Adobe Express Install dialog if set by the web page author and if supported (fp6.0.65+ on Win/Mac OS only)
208                                                showExpressInstall(regObjArr[i]);
209                                        }
210                                        else { // Flash plug-in and Flash content version mismatch: display alternative content instead of Flash content
211                                                displayAltContent(obj);
212                                        }
213                                }
214                        }
215                        else {  // If no fp is installed, we let the object element do its job (show alternative content)
216                                setVisibility(id, true);
217                        }
218                }
219        }
220       
221        /* Fix nested param elements, which are ignored by older webkit engines
222                - This includes Safari up to and including version 1.2.2 on Mac OS 10.3
223                - Fall back to the proprietary embed element
224        */
225        function fixParams(obj) {
226                var nestedObj = obj.getElementsByTagName(OBJECT)[0];
227                if (nestedObj) {
228                        var e = createElement("embed"), a = nestedObj.attributes;
229                        if (a) {
230                                var al = a.length;
231                                for (var i = 0; i < al; i++) {
232                                        if (a[i].nodeName.toLowerCase() == "data") {
233                                                e.setAttribute("src", a[i].nodeValue);
234                                        }
235                                        else {
236                                                e.setAttribute(a[i].nodeName, a[i].nodeValue);
237                                        }
238                                }
239                        }
240                        var c = nestedObj.childNodes;
241                        if (c) {
242                                var cl = c.length;
243                                for (var j = 0; j < cl; j++) {
244                                        if (c[j].nodeType == 1 && c[j].nodeName.toLowerCase() == "param") {
245                                                e.setAttribute(c[j].getAttribute("name"), c[j].getAttribute("value"));
246                                        }
247                                }
248                        }
249                        obj.parentNode.replaceChild(e, obj);
250                }
251        }
252       
253        /* Fix hanging audio/video threads and force open sockets and NetConnections to disconnect
254                - Occurs when unloading a web page in IE using fp8+ and innerHTML/outerHTML
255                - Dynamic publishing only
256        */
257        function fixObjectLeaks(id) {
258                if (ua.ie && ua.win && hasPlayerVersion("8.0.0")) {
259                        win.attachEvent("onunload", function () {
260                                var obj = getElementById(id);
261                                if (obj) {
262                                        for (var i in obj) {
263                                                if (typeof obj[i] == "function") {
264                                                        obj[i] = function() {};
265                                                }
266                                        }
267                                        obj.parentNode.removeChild(obj);
268                                }
269                        });
270                }
271        }
272       
273        /* Show the Adobe Express Install dialog
274                - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
275        */
276        function showExpressInstall(regObj) {
277                isExpressInstallActive = true;
278                var obj = getElementById(regObj.id);
279                if (obj) {
280                        if (regObj.altContentId) {
281                                var ac = getElementById(regObj.altContentId);
282                                if (ac) {
283                                        storedAltContent = ac;
284                                        storedAltContentId = regObj.altContentId;
285                                }
286                        }
287                        else {
288                                storedAltContent = abstractAltContent(obj);
289                        }
290                        if (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
291                                regObj.width = "310";
292                        }
293                        if (!(/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) {
294                                regObj.height = "137";
295                        }
296                        doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
297                        var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
298                                dt = doc.title,
299                                fv = "MMredirectURL=" + win.location + "&MMplayerType=" + pt + "&MMdoctitle=" + dt,
300                                replaceId = regObj.id;
301                        // For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
302                        // In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
303                        if (ua.ie && ua.win && obj.readyState != 4) {
304                                var newObj = createElement("div");
305                                replaceId += "SWFObjectNew";
306                                newObj.setAttribute("id", replaceId);
307                                obj.parentNode.insertBefore(newObj, obj); // Insert placeholder div that will be replaced by the object element that loads expressinstall.swf
308                                obj.style.display = "none";
309                                win.attachEvent("onload", function() { obj.parentNode.removeChild(obj); });
310                        }
311                        createSWF({ data:regObj.expressInstall, id:EXPRESS_INSTALL_ID, width:regObj.width, height:regObj.height }, { flashvars:fv }, replaceId);
312                }
313        }
314       
315        /* Functions to abstract and display alternative content
316        */
317        function displayAltContent(obj) {
318                if (ua.ie && ua.win && obj.readyState != 4) {
319                        // For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
320                        // In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
321                        var el = createElement("div");
322                        obj.parentNode.insertBefore(el, obj); // Insert placeholder div that will be replaced by the alternative content
323                        el.parentNode.replaceChild(abstractAltContent(obj), el);
324                        obj.style.display = "none";
325                        win.attachEvent("onload", function() { obj.parentNode.removeChild(obj); });
326                }
327                else {
328                        obj.parentNode.replaceChild(abstractAltContent(obj), obj);
329                }
330        }       
331
332        function abstractAltContent(obj) {
333                var ac = createElement("div");
334                if (ua.win && ua.ie) {
335                        ac.innerHTML = obj.innerHTML;
336                }
337                else {
338                        var nestedObj = obj.getElementsByTagName(OBJECT)[0];
339                        if (nestedObj) {
340                                var c = nestedObj.childNodes;
341                                if (c) {
342                                        var cl = c.length;
343                                        for (var i = 0; i < cl; i++) {
344                                                if (!(c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "param") && !(c[i].nodeType == 8)) {
345                                                        ac.appendChild(c[i].cloneNode(true));
346                                                }
347                                        }
348                                }
349                        }
350                }
351                return ac;
352        }
353       
354        /* Cross-browser dynamic SWF creation
355        */
356        function createSWF(attObj, parObj, id) {
357                var r, el = getElementById(id);
358                if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
359                        attObj.id = id;
360                }
361                if (ua.ie && ua.win) { // IE, the object element and W3C DOM methods do not combine: fall back to outerHTML
362                        var att = "";
363                        for (var i in attObj) {
364                                if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries, like Object.prototype.toJSONString = function() {}
365                                        if (i == "data") {
366                                                parObj.movie = attObj[i];
367                                        }
368                                        else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
369                                                att += ' class="' + attObj[i] + '"';
370                                        }
371                                        else if (i != "classid") {
372                                                att += ' ' + i + '="' + attObj[i] + '"';
373                                        }
374                                }
375                        }
376                        var par = "";
377                        for (var j in parObj) {
378                                if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
379                                        par += '<param name="' + j + '" value="' + parObj[j] + '" />';
380                                }
381                        }
382                        el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
383                        fixObjectLeaks(attObj.id); // This bug affects dynamic publishing only
384                        r = getElementById(attObj.id); 
385                }
386                else if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements: fall back to the proprietary embed element
387                        var e = createElement("embed");
388                        e.setAttribute("type", FLASH_MIME_TYPE);
389                        for (var k in attObj) {
390                                if (attObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
391                                        if (k == "data") {
392                                                e.setAttribute("src", attObj[k]);
393                                        }
394                                        else if (k.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
395                                                e.setAttribute("class", attObj[k]);
396                                        }
397                                        else if (k != "classid") { // Filter out IE specific attribute
398                                                e.setAttribute(k, attObj[k]);
399                                        }
400                                }
401                        }
402                        for (var l in parObj) {
403                                if (parObj[l] != Object.prototype[l]) { // Filter out prototype additions from other potential libraries
404                                        if (l != "movie") { // Filter out IE specific param element
405                                                e.setAttribute(l, parObj[l]);
406                                        }
407                                }
408                        }
409                        el.parentNode.replaceChild(e, el);
410                        r = e;
411                }
412                else { // Well-behaving browsers
413                        var o = createElement(OBJECT);
414                        o.setAttribute("type", FLASH_MIME_TYPE);
415                        for (var m in attObj) {
416                                if (attObj[m] != Object.prototype[m]) { // Filter out prototype additions from other potential libraries
417                                        if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
418                                                o.setAttribute("class", attObj[m]);
419                                        }
420                                        else if (m != "classid") { // Filter out IE specific attribute
421                                                o.setAttribute(m, attObj[m]);
422                                        }
423                                }
424                        }
425                        for (var n in parObj) {
426                                if (parObj[n] != Object.prototype[n] && n != "movie") { // Filter out prototype additions from other potential libraries and IE specific param element
427                                        createObjParam(o, n, parObj[n]);
428                                }
429                        }
430                        el.parentNode.replaceChild(o, el);
431                        r = o;
432                }
433                return r;
434        }
435       
436        function createObjParam(el, pName, pValue) {
437                var p = createElement("param");
438                p.setAttribute("name", pName); 
439                p.setAttribute("value", pValue);
440                el.appendChild(p);
441        }
442       
443        function getElementById(id) {
444                return doc.getElementById(id);
445        }
446       
447        function createElement(el) {
448                return doc.createElement(el);
449        }
450       
451        function hasPlayerVersion(rv) {
452                var pv = ua.pv, v = rv.split(".");
453                v[0] = parseInt(v[0], 10);
454                v[1] = parseInt(v[1], 10);
455                v[2] = parseInt(v[2], 10);
456                return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
457        }
458       
459        /* Cross-browser dynamic CSS creation
460                - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
461        */     
462        function createCSS(sel, decl) {
463                if (ua.ie && ua.mac) {
464                        return;
465                }
466                var h = doc.getElementsByTagName("head")[0], s = createElement("style");
467                s.setAttribute("type", "text/css");
468                s.setAttribute("media", "screen");
469                if (!(ua.ie && ua.win) && typeof doc.createTextNode != UNDEF) {
470                        s.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
471                }
472                h.appendChild(s);
473                if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
474                        var ls = doc.styleSheets[doc.styleSheets.length - 1];
475                        if (typeof ls.addRule == OBJECT) {
476                                ls.addRule(sel, decl);
477                        }
478                }
479        }
480       
481        function setVisibility(id, isVisible) {
482                var v = isVisible ? "visible" : "hidden";
483                if (isDomLoaded) {
484                        getElementById(id).style.visibility = v;
485                }
486                else {
487                        createCSS("#" + id, "visibility:" + v);
488                }
489        }
490       
491        function getTargetVersion(obj) {
492            if (!obj)
493                return 0;
494                var c = obj.childNodes;
495                var cl = c.length;
496                for (var i = 0; i < cl; i++) {
497                        if (c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "object") {
498                            c = c[i].childNodes;
499                            cl = c.length;
500                            i = 0;
501                        }     
502                        if (c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "param" && c[i].getAttribute("name") == "swfversion") {
503                           return c[i].getAttribute("value"); 
504                        }
505                }
506                return 0;
507        }
508   
509        function getExpressInstall(obj) {
510            if (!obj)
511                return "";
512                var c = obj.childNodes;
513                var cl = c.length;
514                for (var i = 0; i < cl; i++) {
515                        if (c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "object") {
516                            c = c[i].childNodes;
517                            cl = c.length;
518                            i = 0;
519                        }     
520                        if (c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "param" && c[i].getAttribute("name") == "expressinstall") { 
521                            return c[i].getAttribute("value"); 
522                        }             
523                }
524                return "";
525        }
526   
527        return {
528                /* Public API
529                        - Reference: http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation
530                */ 
531                registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr) {
532                        if (!ua.w3cdom || !objectIdStr) {
533                                return;
534                        }
535                        var obj = document.getElementById(objectIdStr);
536                        var xi = getExpressInstall(obj);
537                        var regObj = {};
538                        regObj.id = objectIdStr;
539                        regObj.swfVersion = swfVersionStr ? swfVersionStr : getTargetVersion(obj);
540                        regObj.expressInstall = xiSwfUrlStr ? xiSwfUrlStr : ((xi != "") ? xi : false);
541                        regObjArr[regObjArr.length] = regObj;
542                        setVisibility(objectIdStr, false);
543                },
544               
545                getObjectById: function(objectIdStr) {
546                        var r = null;
547                        if (ua.w3cdom && isDomLoaded) {
548                                var o = getElementById(objectIdStr);
549                                if (o) {
550                                        var n = o.getElementsByTagName(OBJECT)[0];
551                                        if (!n || (n && typeof o.SetVariable != UNDEF)) {
552                                        r = o;
553                                        }
554                                        else if (typeof n.SetVariable != UNDEF) {
555                                                r = n;
556                                        }
557                                }
558                        }
559                        return r;
560                },
561               
562                embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
563                        if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
564                                return;
565                        }
566                        widthStr += ""; // Auto-convert to string to make it idiot proof
567                        heightStr += "";
568                        if (hasPlayerVersion(swfVersionStr)) {
569                                setVisibility(replaceElemIdStr, false);
570                                var att = (typeof attObj == OBJECT) ? attObj : {};
571                                att.data = swfUrlStr;
572                                att.width = widthStr;
573                                att.height = heightStr;
574                                var par = (typeof parObj == OBJECT) ? parObj : {};
575                                if (typeof flashvarsObj == OBJECT) {
576                                        for (var i in flashvarsObj) {
577                                                if (flashvarsObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries
578                                                        if (typeof par.flashvars != UNDEF) {
579                                                                par.flashvars += "&" + i + "=" + flashvarsObj[i];
580                                                        }
581                                                        else {
582                                                                par.flashvars = i + "=" + flashvarsObj[i];
583                                                        }
584                                                }
585                                        }
586                                }
587                                addDomLoadEvent(function() {
588                                        createSWF(att, par, replaceElemIdStr);
589                                        if (att.id == replaceElemIdStr) {
590                                                setVisibility(replaceElemIdStr, true);
591                                        }
592                                });
593                        }
594                        else if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) {
595                                setVisibility(replaceElemIdStr, false);
596                                addDomLoadEvent(function() {
597                                        var regObj = {};
598                                        regObj.id = regObj.altContentId = replaceElemIdStr;
599                                        regObj.width = widthStr;
600                                        regObj.height = heightStr;
601                                        regObj.expressInstall = xiSwfUrlStr;
602                                        showExpressInstall(regObj);
603                                });
604                        }
605                },
606               
607                getFlashPlayerVersion: function() {
608                        return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
609                },
610               
611                hasFlashPlayerVersion:hasPlayerVersion,
612               
613                createSWF: function(attObj, parObj, replaceElemIdStr) {
614                        if (ua.w3cdom && isDomLoaded) {
615                                return createSWF(attObj, parObj, replaceElemIdStr);
616                        }
617                        else {
618                                return undefined;
619                        }
620                },
621               
622                createCSS: function(sel, decl) {
623                        if (ua.w3cdom) {
624                                createCSS(sel, decl);
625                        }
626                },
627               
628                addDomLoadEvent:addDomLoadEvent,
629               
630                addLoadEvent:addLoadEvent,
631               
632                getQueryParamValue: function(param) {
633                        var q = doc.location.search || doc.location.hash;
634                        if (param == null) {
635                                return q;
636                        }
637                        if(q) {
638                                var pairs = q.substring(1).split("&");
639                                for (var i = 0; i < pairs.length; i++) {
640                                        if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
641                                                return pairs[i].substring((pairs[i].indexOf("=") + 1));
642                                        }
643                                }
644                        }
645                        return "";
646                },
647               
648                // For internal usage only
649                expressInstallCallback: function() {
650                        if (isExpressInstallActive && storedAltContent) {
651                                var obj = getElementById(EXPRESS_INSTALL_ID);
652                                if (obj) {
653                                        obj.parentNode.replaceChild(storedAltContent, obj);
654                                        if (storedAltContentId) {
655                                                setVisibility(storedAltContentId, true);
656                                                if (ua.ie && ua.win) {
657                                                        storedAltContent.style.display = "block";
658                                                }
659                                        }
660                                        storedAltContent = null;
661                                        storedAltContentId = null;
662                                        isExpressInstallActive = false;
663                                }
664                        } 
665                }
666               
667        };
668
669}();
Note: See TracBrowser for help on using the browser.