/* FlashReplace is developed by Robert Nyman, http://www.robertnyman.com. License and downloads: http://code.google.com/p/flashreplace/ */ // --- var FlashReplace = { elmToReplace : null, flashIsInstalled : null, defaultFlashVersion : 7, replace : function (elmToReplace, src, id, width, height, version, params){ this.elmToReplace = document.getElementById(elmToReplace); this.flashIsInstalled = this.checkForFlash(version || this.defaultFlashVersion); if(this.elmToReplace && this.flashIsInstalled){ var obj = ''; extraAttributes += ' ' + i + '="' + params[i] + '"'; } var embed = ''; var objEnd = ''; this.elmToReplace.innerHTML = obj + param + extraParams + embed + embedEnd + objEnd; } }, checkForFlash : function (version){ this.flashIsInstalled = false; var flash; if(window.ActiveXObject){ try{ flash = new ActiveXObject(("ShockwaveFlash.ShockwaveFlash." + version)); this.flashIsInstalled = true; } catch(e){ // Throws an error if the version isn't available } } else if(navigator.plugins && navigator.mimeTypes.length > 0){ flash = navigator.plugins["Shockwave Flash"]; if(flash){ var flashVersion = navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/, "$1"); if(flashVersion >= version){ this.flashIsInstalled = true; } } } return this.flashIsInstalled; } }; // ---