var FlashTicker = function()
{
	this.tickerSource = null;
	this.tickerWidth = FlashTicker.DEFAULT_WIDTH;
	this.tickerHeight = FlashTicker.DEFAULT_HEIGHT;
	this.useRedirect = FlashTicker.DEFAULT_USE_REDIRECT;
	this.version = FlashTicker.DEFAULT_VERSION;
	this.backupImage = FlashTicker.DEFAULT_BUIMAGE;
	this.alternateHTML = '';
	if( FlashTicker.arguments.length > 0 )
	{
		this.tickerSource = FlashTicker.arguments[0];
	}
}

FlashTicker.prototype.render = function()
{
	if (!this.useRedirect) 
	{   // if dynamic embedding is turned on
		if(hasRightVersion)
		{ // if we've detected an acceptable version
			media = '<object id="flashname" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width='+this.tickerWidth+' height='+this.tickerHeight+' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#6,0,79,0"><param name="SRC" value='+FlashTicker.TICKER_CODE+'?textfile='+this.tickerSource+'><param name="QUALITY" value="high"><embed name="flashname" src='+FlashTicker.TICKER_CODE+'?textfile='+this.tickerSource+' width='+this.tickerWidth+' height='+this.tickerHeight+' quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/"></EMBED></OBJECT>';
			document.write(media);  // embed the flash movie
		}
		else
		{
	    	document.writeln(alternateHtml);
		}
	}	
}

FlashTicker.prototype.load = function()
{
  var tempRequiredVersion = document.requiredVersion;
  var tempUseRedirect = document.useRedirect;
  top.requiredVersion = this.version;
  top.useRedirect = this.useRedirect;
  if( typeof flash2Installed == 'undefined' )
  {
	document.write('<script language="javascript" src="http://www.washingtonpost.com/wp-srv/photo/js/init.js"></script><script language="javascript" src="http://www.washingtonpost.com/wp-srv/photo/js/writevb.js"></script><script language="javascript" src="http://www.washingtonpost.com/wp-srv/photo/js/main.js"></script>');	
  }
}

FlashTicker.DEFAULT_WIDTH = 454;
FlashTicker.DEFAULT_HEIGHT = 17;
FlashTicker.DEFAULT_BUIMAGE = 'http://www.washingtonpost.com/wp-srv/images/spacergifs/white.gif';
FlashTicker.DEFAULT_VERSION = 6;
FlashTicker.DEFAULT_USE_REDIRECT = false;
FlashTicker.TICKER_CODE = 'http://www.washingtonpost.com/wp-srv/tickers/ticker_454.swf';
