var PLAYER_HEIGHT = '385';
var PLAYER_WIDTH = '640';
var PLAYER_CLOSE_TEXT = 'Close';
var PLAYER_NOFLASH_TEXT = 'This video requires Adobe ';
PLAYER_NOFLASH_TEXT += 'Flash Player.';
var PLAYER_ALT_TEXT = '';
PLAYER_ALT_TEXT += 'Download video in Ogg Theora format';
function FirefoxVideoLaunch(id, video_url)
{
this.video_url = video_url;
this.overlay = document.createElement('div');
this.overlay.className = 'firefox-video-overlay';
this.overlay.style.display = 'none';
this.video_container = document.createElement('div');
this.video_container.className = 'firefox-video-window';
this.video_container.style.display = 'none';
this.opened = false;
// add overlay and preview image to document
var video_link = document.getElementById(id);
video_link.parentNode.appendChild(this.overlay);
video_link.parentNode.appendChild(this.video_container);
var links = YAHOO.util.Dom.getElementsByClassName('launch-video');
for(var i = 0; i < links.length; i++)
YAHOO.util.Event.addListener(links[i], 'click',
this.handleClick, this, true);
YAHOO.util.Event.addListener(this.overlay, 'click',
this.handleClick, this, true);
}
FirefoxVideoLaunch.prototype.buildVideoPlayer = function()
{
var player = '
';
player += '';
player += '
';
player += '
' + PLAYER_ALT_TEXT + '
';
return player;
}
FirefoxVideoLaunch.prototype.open = function()
{
this.video_container.style.display = 'block';
this.overlay.style.display = 'block';
// hide the language form because its flydown won't render right in IE
var hide_form = document.getElementById('lang_form');
if (hide_form)
hide_form.style.display = 'none';
this.video_container.style.top =
(YAHOO.util.Dom.getDocumentScrollTop() +
((YAHOO.util.Dom.getViewportHeight() - 570) / 2)) + 'px';
this.video_container.innerHTML = this.buildVideoPlayer();
this.overlay.style.height = YAHOO.util.Dom.getDocumentHeight() + 'px';
YAHOO.util.Event.addListener(
document.getElementById('firefox-video-player-close'), 'click',
this.handleClick, this, true);
this.opened = true;
}
FirefoxVideoLaunch.prototype.close = function()
{
this.overlay.style.display = 'none';
this.video_container.style.display = 'none';
// clear the video content so IE will stop playing the audio
this.video_container.innerHTML = '';
var hide_form = document.getElementById('lang_form');
if (hide_form)
hide_form.style.display = 'block';
this.opened = false;
}
FirefoxVideoLaunch.prototype.handleClick = function(e)
{
YAHOO.util.Event.preventDefault(e);
if (this.opened)
this.close();
else
this.open();
}