3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js">/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
\r
10 is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
\r
13 var swfobject = function() {
\r
15 var UNDEF = "undefined",
\r
17 SHOCKWAVE_FLASH = "Shockwave Flash",
\r
18 SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
\r
19 FLASH_MIME_TYPE = "application/x-shockwave-flash",
\r
20 EXPRESS_INSTALL_ID = "SWFObjectExprInst",
\r
21 ON_READY_STATE_CHANGE = "onreadystatechange",
\r
28 domLoadFnArr = [main],
\r
36 isDomLoaded = false,
\r
37 isExpressInstallActive = false,
\r
39 dynamicStylesheetMedia,
\r
40 autoHideShow = true,
\r
42 /* Centralized function for browser feature detection
\r
43 - User agent string detection is only used when no good alternative is possible
\r
44 - Is executed directly for optimal performance
\r
47 var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
\r
48 u = nav.userAgent.toLowerCase(),
\r
49 p = nav.platform.toLowerCase(),
\r
50 windows = p ? /win/.test(p) : /win/.test(u),
\r
51 mac = p ? /mac/.test(p) : /mac/.test(u),
\r
52 webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
\r
53 ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
\r
54 playerVersion = [0,0,0],
\r
56 if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
\r
57 d = nav.plugins[SHOCKWAVE_FLASH].description;
\r
58 if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
\r
60 ie = false; // cascaded feature detection for Internet Explorer
\r
61 d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
\r
62 playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
\r
63 playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
\r
64 playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
\r
67 else if (typeof win.ActiveXObject != UNDEF) {
\r
69 var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
\r
70 if (a) { // a will return null when ActiveX is disabled
\r
71 d = a.GetVariable("$version");
\r
73 ie = true; // cascaded feature detection for Internet Explorer
\r
74 d = d.split(" ")[1].split(",");
\r
75 playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
\r
81 return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
\r
84 /* Cross-browser onDomLoad
\r
85 - Will fire an event as soon as the DOM of a web page is loaded
\r
86 - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
\r
87 - Regular onload serves as fallback
\r
89 onDomLoad = function() {
\r
90 if (!ua.w3) { return; }
\r
91 if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
\r
92 callDomLoadFunctions();
\r
95 if (typeof doc.addEventListener != UNDEF) {
\r
96 doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
\r
98 if (ua.ie && ua.win) {
\r
99 doc.attachEvent(ON_READY_STATE_CHANGE, function() {
\r
100 if (doc.readyState == "complete") {
\r
101 doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
\r
102 callDomLoadFunctions();
\r
105 if (win == top) { // if not inside an iframe
\r
107 if (isDomLoaded) { return; }
\r
109 doc.documentElement.doScroll("left");
\r
112 setTimeout(arguments.callee, 0);
\r
115 callDomLoadFunctions();
\r
121 if (isDomLoaded) { return; }
\r
122 if (!/loaded|complete/.test(doc.readyState)) {
\r
123 setTimeout(arguments.callee, 0);
\r
126 callDomLoadFunctions();
\r
129 addLoadEvent(callDomLoadFunctions);
\r
133 function callDomLoadFunctions() {
\r
134 if (isDomLoaded) { return; }
\r
135 try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
\r
136 var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
\r
137 t.parentNode.removeChild(t);
\r
139 catch (e) { return; }
\r
140 isDomLoaded = true;
\r
141 var dl = domLoadFnArr.length;
\r
142 for (var i = 0; i < dl; i++) {
\r
147 function addDomLoadEvent(fn) {
\r
152 domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
\r
156 /* Cross-browser onload
\r
157 - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
\r
158 - Will fire an event as soon as a web page including all of its assets are loaded
\r
160 function addLoadEvent(fn) {
\r
161 if (typeof win.addEventListener != UNDEF) {
\r
162 win.addEventListener("load", fn, false);
\r
164 else if (typeof doc.addEventListener != UNDEF) {
\r
165 doc.addEventListener("load", fn, false);
\r
167 else if (typeof win.attachEvent != UNDEF) {
\r
168 addListener(win, "onload", fn);
\r
170 else if (typeof win.onload == "function") {
\r
171 var fnOld = win.onload;
\r
172 win.onload = function() {
\r
183 - Will preferably execute onDomLoad, otherwise onload (as a fallback)
\r
187 testPlayerVersion();
\r
194 /* Detect the Flash Player version for non-Internet Explorer browsers
\r
195 - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
\r
196 a. Both release and build numbers can be detected
\r
197 b. Avoid wrong descriptions by corrupt installers provided by Adobe
\r
198 c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
\r
199 - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
\r
201 function testPlayerVersion() {
\r
202 var b = doc.getElementsByTagName("body")[0];
\r
203 var o = createElement(OBJECT);
\r
204 o.setAttribute("type", FLASH_MIME_TYPE);
\r
205 var t = b.appendChild(o);
\r
209 if (typeof t.GetVariable != UNDEF) {
\r
210 var d = t.GetVariable("$version");
\r
212 d = d.split(" ")[1].split(",");
\r
213 ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
\r
216 else if (counter < 10) {
\r
218 setTimeout(arguments.callee, 10);
\r
231 /* Perform Flash Player and SWF version matching; static publishing only
\r
233 function matchVersions() {
\r
234 var rl = regObjArr.length;
\r
236 for (var i = 0; i < rl; i++) { // for each registered object element
\r
237 var id = regObjArr[i].id;
\r
238 var cb = regObjArr[i].callbackFn;
\r
239 var cbObj = {success:false, id:id};
\r
240 if (ua.pv[0] > 0) {
\r
241 var obj = getElementById(id);
\r
243 if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
\r
244 setVisibility(id, true);
\r
246 cbObj.success = true;
\r
247 cbObj.ref = getObjectById(id);
\r
251 else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
\r
253 att.data = regObjArr[i].expressInstall;
\r
254 att.width = obj.getAttribute("width") || "0";
\r
255 att.height = obj.getAttribute("height") || "0";
\r
256 if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
\r
257 if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
\r
258 // parse HTML object param element's name-value pairs
\r
260 var p = obj.getElementsByTagName("param");
\r
262 for (var j = 0; j < pl; j++) {
\r
263 if (p[j].getAttribute("name").toLowerCase() != "movie") {
\r
264 par[p[j].getAttribute("name")] = p[j].getAttribute("value");
\r
267 showExpressInstall(att, par, id, cb);
\r
269 else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
\r
270 displayAltContent(obj);
\r
271 if (cb) { cb(cbObj); }
\r
275 else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
\r
276 setVisibility(id, true);
\r
278 var o = getObjectById(id); // test whether there is an HTML object element or not
\r
279 if (o && typeof o.SetVariable != UNDEF) {
\r
280 cbObj.success = true;
\r
290 function getObjectById(objectIdStr) {
\r
292 var o = getElementById(objectIdStr);
\r
293 if (o && o.nodeName == "OBJECT") {
\r
294 if (typeof o.SetVariable != UNDEF) {
\r
298 var n = o.getElementsByTagName(OBJECT)[0];
\r
307 /* Requirements for Adobe Express Install
\r
308 - only one instance can be active at a time
\r
309 - fp 6.0.65 or higher
\r
311 - no Webkit engines older than version 312
\r
313 function canExpressInstall() {
\r
314 return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
\r
317 /* Show the Adobe Express Install dialog
\r
318 - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
\r
320 function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
\r
321 isExpressInstallActive = true;
\r
322 storedCallbackFn = callbackFn || null;
\r
323 storedCallbackObj = {success:false, id:replaceElemIdStr};
\r
324 var obj = getElementById(replaceElemIdStr);
\r
326 if (obj.nodeName == "OBJECT") { // static publishing
\r
327 storedAltContent = abstractAltContent(obj);
\r
328 storedAltContentId = null;
\r
330 else { // dynamic publishing
\r
331 storedAltContent = obj;
\r
332 storedAltContentId = replaceElemIdStr;
\r
334 att.id = EXPRESS_INSTALL_ID;
\r
335 if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
\r
336 if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
\r
337 doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
\r
338 var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
\r
339 fv = "MMredirectURL=" + win.location.toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
\r
340 if (typeof par.flashvars != UNDEF) {
\r
341 par.flashvars += "&" + fv;
\r
344 par.flashvars = fv;
\r
346 // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
\r
347 // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
\r
348 if (ua.ie && ua.win && obj.readyState != 4) {
\r
349 var newObj = createElement("div");
\r
350 replaceElemIdStr += "SWFObjectNew";
\r
351 newObj.setAttribute("id", replaceElemIdStr);
\r
352 obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
\r
353 obj.style.display = "none";
\r
355 if (obj.readyState == 4) {
\r
356 obj.parentNode.removeChild(obj);
\r
359 setTimeout(arguments.callee, 10);
\r
363 createSWF(att, par, replaceElemIdStr);
\r
367 /* Functions to abstract and display alternative content
\r
369 function displayAltContent(obj) {
\r
370 if (ua.ie && ua.win && obj.readyState != 4) {
\r
371 // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
\r
372 // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
\r
373 var el = createElement("div");
\r
374 obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
\r
375 el.parentNode.replaceChild(abstractAltContent(obj), el);
\r
376 obj.style.display = "none";
\r
378 if (obj.readyState == 4) {
\r
379 obj.parentNode.removeChild(obj);
\r
382 setTimeout(arguments.callee, 10);
\r
387 obj.parentNode.replaceChild(abstractAltContent(obj), obj);
\r
391 function abstractAltContent(obj) {
\r
392 var ac = createElement("div");
\r
393 if (ua.win && ua.ie) {
\r
394 ac.innerHTML = obj.innerHTML;
\r
397 var nestedObj = obj.getElementsByTagName(OBJECT)[0];
\r
399 var c = nestedObj.childNodes;
\r
402 for (var i = 0; i < cl; i++) {
\r
403 if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
\r
404 ac.appendChild(c[i].cloneNode(true));
\r
413 /* Cross-browser dynamic SWF creation
\r
415 function createSWF(attObj, parObj, id) {
\r
416 var r, el = getElementById(id);
\r
417 if (ua.wk && ua.wk < 312) { return r; }
\r
419 if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
\r
422 if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
\r
424 for (var i in attObj) {
\r
425 if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
\r
426 if (i.toLowerCase() == "data") {
\r
427 parObj.movie = attObj[i];
\r
429 else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
\r
430 att += ' class="' + attObj[i] + '"';
\r
432 else if (i.toLowerCase() != "classid") {
\r
433 att += ' ' + i + '="' + attObj[i] + '"';
\r
438 for (var j in parObj) {
\r
439 if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
\r
440 par += '<param name="' + j + '" value="' + parObj[j] + '" />';
\r
443 el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
\r
444 objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
\r
445 r = getElementById(attObj.id);
\r
447 else { // well-behaving browsers
\r
448 var o = createElement(OBJECT);
\r
449 o.setAttribute("type", FLASH_MIME_TYPE);
\r
450 for (var m in attObj) {
\r
451 if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
\r
452 if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
\r
453 o.setAttribute("class", attObj[m]);
\r
455 else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
\r
456 o.setAttribute(m, attObj[m]);
\r
460 for (var n in parObj) {
\r
461 if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
\r
462 createObjParam(o, n, parObj[n]);
\r
465 el.parentNode.replaceChild(o, el);
\r
472 function createObjParam(el, pName, pValue) {
\r
473 var p = createElement("param");
\r
474 p.setAttribute("name", pName);
\r
475 p.setAttribute("value", pValue);
\r
479 /* Cross-browser SWF removal
\r
480 - Especially needed to safely and completely remove a SWF in Internet Explorer
\r
482 function removeSWF(id) {
\r
483 var obj = getElementById(id);
\r
484 if (obj && obj.nodeName == "OBJECT") {
\r
485 if (ua.ie && ua.win) {
\r
486 obj.style.display = "none";
\r
488 if (obj.readyState == 4) {
\r
489 removeObjectInIE(id);
\r
492 setTimeout(arguments.callee, 10);
\r
497 obj.parentNode.removeChild(obj);
\r
502 function removeObjectInIE(id) {
\r
503 var obj = getElementById(id);
\r
505 for (var i in obj) {
\r
506 if (typeof obj[i] == "function") {
\r
510 obj.parentNode.removeChild(obj);
\r
514 /* Functions to optimize JavaScript compression
\r
516 function getElementById(id) {
\r
519 el = doc.getElementById(id);
\r
525 function createElement(el) {
\r
526 return doc.createElement(el);
\r
529 /* Updated attachEvent function for Internet Explorer
\r
530 - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
\r
532 function addListener(target, eventType, fn) {
\r
533 target.attachEvent(eventType, fn);
\r
534 listenersArr[listenersArr.length] = [target, eventType, fn];
\r
537 /* Flash Player and SWF content version matching
\r
539 function hasPlayerVersion(rv) {
\r
540 var pv = ua.pv, v = rv.split(".");
\r
541 v[0] = parseInt(v[0], 10);
\r
542 v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
\r
543 v[2] = parseInt(v[2], 10) || 0;
\r
544 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;
\r
547 /* Cross-browser dynamic CSS creation
\r
548 - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
\r
550 function createCSS(sel, decl, media, newStyle) {
\r
551 if (ua.ie && ua.mac) { return; }
\r
552 var h = doc.getElementsByTagName("head")[0];
\r
553 if (!h) { return; } // to also support badly authored HTML pages that lack a head element
\r
554 var m = (media && typeof media == "string") ? media : "screen";
\r
556 dynamicStylesheet = null;
\r
557 dynamicStylesheetMedia = null;
\r
559 if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
\r
560 // create dynamic stylesheet + get a global reference to it
\r
561 var s = createElement("style");
\r
562 s.setAttribute("type", "text/css");
\r
563 s.setAttribute("media", m);
\r
564 dynamicStylesheet = h.appendChild(s);
\r
565 if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
\r
566 dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
\r
568 dynamicStylesheetMedia = m;
\r
571 if (ua.ie && ua.win) {
\r
572 if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
\r
573 dynamicStylesheet.addRule(sel, decl);
\r
577 if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
\r
578 dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
\r
583 function setVisibility(id, isVisible) {
\r
584 if (!autoHideShow) { return; }
\r
585 var v = isVisible ? "visible" : "hidden";
\r
586 if (isDomLoaded && getElementById(id)) {
\r
587 getElementById(id).style.visibility = v;
\r
590 createCSS("#" + id, "visibility:" + v);
\r
594 /* Filter to avoid XSS attacks
\r
596 function urlEncodeIfNecessary(s) {
\r
597 var regex = /[\\\"<>\.;]/;
\r
598 var hasBadChars = regex.exec(s) != null;
\r
599 return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
\r
602 /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
\r
604 var cleanup = function() {
\r
605 if (ua.ie && ua.win) {
\r
606 window.attachEvent("onunload", function() {
\r
607 // remove listeners to avoid memory leaks
\r
608 var ll = listenersArr.length;
\r
609 for (var i = 0; i < ll; i++) {
\r
610 listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
\r
612 // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
\r
613 var il = objIdArr.length;
\r
614 for (var j = 0; j < il; j++) {
\r
615 removeSWF(objIdArr[j]);
\r
617 // cleanup library's main closures to avoid memory leaks
\r
618 for (var k in ua) {
\r
622 for (var l in swfobject) {
\r
623 swfobject[l] = null;
\r
632 - Reference: http://code.google.com/p/swfobject/wiki/documentation
\r
634 registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
\r
635 if (ua.w3 && objectIdStr && swfVersionStr) {
\r
637 regObj.id = objectIdStr;
\r
638 regObj.swfVersion = swfVersionStr;
\r
639 regObj.expressInstall = xiSwfUrlStr;
\r
640 regObj.callbackFn = callbackFn;
\r
641 regObjArr[regObjArr.length] = regObj;
\r
642 setVisibility(objectIdStr, false);
\r
644 else if (callbackFn) {
\r
645 callbackFn({success:false, id:objectIdStr});
\r
649 getObjectById: function(objectIdStr) {
\r
651 return getObjectById(objectIdStr);
\r
655 embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
\r
656 var callbackObj = {success:false, id:replaceElemIdStr};
\r
657 if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
\r
658 setVisibility(replaceElemIdStr, false);
\r
659 addDomLoadEvent(function() {
\r
660 widthStr += ""; // auto-convert to string
\r
663 if (attObj && typeof attObj === OBJECT) {
\r
664 for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
\r
665 att[i] = attObj[i];
\r
668 att.data = swfUrlStr;
\r
669 att.width = widthStr;
\r
670 att.height = heightStr;
\r
672 if (parObj && typeof parObj === OBJECT) {
\r
673 for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
\r
674 par[j] = parObj[j];
\r
677 if (flashvarsObj && typeof flashvarsObj === OBJECT) {
\r
678 for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
\r
679 if (typeof par.flashvars != UNDEF) {
\r
680 par.flashvars += "&" + k + "=" + flashvarsObj[k];
\r
683 par.flashvars = k + "=" + flashvarsObj[k];
\r
687 if (hasPlayerVersion(swfVersionStr)) { // create SWF
\r
688 var obj = createSWF(att, par, replaceElemIdStr);
\r
689 if (att.id == replaceElemIdStr) {
\r
690 setVisibility(replaceElemIdStr, true);
\r
692 callbackObj.success = true;
\r
693 callbackObj.ref = obj;
\r
695 else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
\r
696 att.data = xiSwfUrlStr;
\r
697 showExpressInstall(att, par, replaceElemIdStr, callbackFn);
\r
700 else { // show alternative content
\r
701 setVisibility(replaceElemIdStr, true);
\r
703 if (callbackFn) { callbackFn(callbackObj); }
\r
706 else if (callbackFn) { callbackFn(callbackObj); }
\r
709 switchOffAutoHideShow: function() {
\r
710 autoHideShow = false;
\r
715 getFlashPlayerVersion: function() {
\r
716 return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
\r
719 hasFlashPlayerVersion: hasPlayerVersion,
\r
721 createSWF: function(attObj, parObj, replaceElemIdStr) {
\r
723 return createSWF(attObj, parObj, replaceElemIdStr);
\r
730 showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
\r
731 if (ua.w3 && canExpressInstall()) {
\r
732 showExpressInstall(att, par, replaceElemIdStr, callbackFn);
\r
736 removeSWF: function(objElemIdStr) {
\r
738 removeSWF(objElemIdStr);
\r
742 createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
\r
744 createCSS(selStr, declStr, mediaStr, newStyleBoolean);
\r
748 addDomLoadEvent: addDomLoadEvent,
\r
750 addLoadEvent: addLoadEvent,
\r
752 getQueryParamValue: function(param) {
\r
753 var q = doc.location.search || doc.location.hash;
\r
755 if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
\r
756 if (param == null) {
\r
757 return urlEncodeIfNecessary(q);
\r
759 var pairs = q.split("&");
\r
760 for (var i = 0; i < pairs.length; i++) {
\r
761 if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
\r
762 return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
\r
769 // For internal usage only
\r
770 expressInstallCallback: function() {
\r
771 if (isExpressInstallActive) {
\r
772 var obj = getElementById(EXPRESS_INSTALL_ID);
\r
773 if (obj && storedAltContent) {
\r
774 obj.parentNode.replaceChild(storedAltContent, obj);
\r
775 if (storedAltContentId) {
\r
776 setVisibility(storedAltContentId, true);
\r
777 if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
\r
779 if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
\r
781 isExpressInstallActive = false;
\r