/**
* FlashMovie Class
* @author Scott Jeppesen
* @author Scott Delamater
* @version 2.0
*
* Javascript class to write out FlashTags.  2.0 implementation includes:
* 	-Flash Detection Kit implementation
*	-Modified constructor allowing definition of src, width, and height properties on creation
* @note Requires inclusion of Flash Detection Kit scripts (main.js, getswfver.vbs, and config.js)
*/

// A static Boolean value obtained from the Flash Detection Kit indicating availability of the required version of Flash.
var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

// A static Boolean value indicating whether a write() attempt has been made
var hasWritten = false;

/**
* @class FlashMovie
*/
function FlashMovie ( s,w,h )
{	
	// <embed> and <object> tag properties
	this.src       = (s!=null) ? s : "";	// [String] path to the swf file
	this.width     = (w!=null) ? w : 550;	// [int] movie width
	this.height    = (h!=null) ? h : 400;	// [int] movie height
	this.flashVars = "";			// [String] name value pairs to pass into the movie on load
	this.align     = "";			// [String] movie alignment
	this.name      = "";			// [String] movie name/id
	this.bgColor   = "#FFFFFF";		// [String] movie background color
	this.quality   = "high";		// [String] movie quality
	this.menu   	= "false";		// [String] right-click menu visibility
	this.wmode 		= "opaque";		// [String] window mode
	this.salign 	= "";			// [String] screen alignment; valid values are "", "lt", "l", "lb", "t", "b", "rt", "r", and "rb"
	this.scale 		= "";			// [String] scale mode; valid values are "", "exactfit", "noborder", and "noscale"
}

/**
* Writes the object/embed tags, if the current version of Flash is available.  Otherwise writes alternate content.
*/
FlashMovie.prototype.write = function ()
{
	// Has required version of Flash
	if ( hasRightVersion )
	{
		document.write( this.getTags() );
	}
	// Has no flash
	else if ( !hasWritten )
	{
		window.location = noFlashURL;
	}
	
	hasWritten = true;
};

FlashMovie.prototype.getTags = function ()
{
	var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
		+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' 
		+ 'width="' + this.width +'" '
		+ 'height="' + this.height + '" '
		+ 'id="' + this.name + '" '
		+ 'align="' + this.align + '" >'
		+ '<param name=movie value="' + this.src + '">'
		+ '<param name=quality value="' + this.quality + '">'
		+ '<param name=bgcolor value="' + this.bgColor + '">'
		+ '<param name=FlashVars value="' + this.flashVars + '">'
		+ '<param name=menu value="' + this.menu + '">'
		+ '<param name=wmode value="' + this.wmode + '">'
		+ '<param name=salign value="' + this.salign + '">'
		+ '<param name=scale value="' + this.scale + '">'
		+ '<param name=allowscriptaccess value="always">'
		+ '<embed src="' + this.src + '" '
		+ 'FlashVars="' + this.flashVars + '" '
		+ 'scale="' + this.scale +'" '
		+ 'wmode="' + this.wmode + '" '
		+ 'salign="' + this.salign + '" '
		+ 'quality="' + this.quality +'" '
		+ 'bgcolor="' + this.bgColor + '" '
		+ 'width="' + this.width + '" '
		+ 'height="' + this.height + '" '
		+ 'name="' + this.name + '" '
		+ 'align="' + this.align + '" '
		+ 'menu="' + this.menu + '" '
		+ 'allowscriptaccess="always" '
		+ 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>';
	return oeTags;
};