var embedCode = ""; embedCode += ""; embedCode += ""; embedCode += ""; embedCode += ""; embedCode += ""; embedCode += ""; embedCode += ""; embedCode += ""; embedCode += ""; var VideoEmbed = function (publishing_id, embed_code) { this.publishing_id = publishing_id; this.embed_code = embed_code; this.container = document.getElementById(this.publishing_id); /** * Determines the installed (and enabled) version of flash. * @returns [major, minor] */ function get_flash_version() { var fo, ver, RE = /(\d+)[^\d]+(\d+)[^\d]*(\d*)/; try { ver = navigator.plugins["Shockwave Flash"].description.slice(16); } catch(e) { try { fo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); ver = fo && fo.GetVariable("$version"); } catch(err) { try { fo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); ver = fo && fo.GetVariable("$version"); } catch(err2) { } } } ver = RE.exec(ver); return ver ? [ver[1], ver[3]] : [0, 0]; } /** * Inserts a flash embed code in a provided DOM element. */ function insert_embed_code() { // embed the video try { this.container.innerHTML = this.embed_code; } catch (err) {} // for embedding video in WinXP Firefox if (navigator.appVersion.indexOf("Windows") != -1) { if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { this.container.addEventListener("mousedown", function(event) { event.preventDefault(); return false; }, false); } } } /** * Inserts a prompt instructing user to install flash in a provided DOM * element. */ function prompt_to_install_flash() { // set href attribute of container and remove onclick handler try { this.container.setAttribute('href', 'http://www.adobe.com/go/getflash'); this.container.removeAttribute('onclick'); this.container.onclick = null; // for IE7 } catch (err) { } // display message to install flash this.container.innerHTML = '' + '

' + 'To view this video, please install the latest version of Flash.' + '

' + 'Get Adobe Flash player' + '

'; } /** * If a user has flash installed, this embeds a video. Otherwise, it * instructs the user to install flash. */ this.display = function() { // determine flash version var flash_version = get_flash_version.call(this); // TODO: allow for specifying version as argument if (flash_version[0] > 10 || flash_version[0] == 10 && flash_version[1] >= 1) { insert_embed_code.call(this); } // appropriate flash version not installed else { prompt_to_install_flash.call(this); } } }; var embed = new VideoEmbed("b4dd3fecPf150w4285Za79b9215ce94060d9", embedCode); embed.display();