<!--
/*	===========================================================================
 *		SWF_Factory
 *	
 *		@author		Isaac Rivera
 *		@version	11/18/2004
 *	===========================================================================
 *
 *	Object instance with a static method to 
 *	make a dynamic SWF into an html file.
 *	
 *	PUBLIC METHODS:
 *	
 *	makeSWF(version, width, height, id, namepath, bgColor, flashVars)
 *	
 *		@param	version:	String target player version in the format 
 *							"6,0,0,0".
 *		@param	width: 		Number or String desired width of the swf object.
 *		@param	height: 	Number or String desired height of the swf object.
 *		@param	id: 		String base name of the swf source file without any 
 *							path or ".swf" extension.
 *		@param	namepath:	String path of the location to the swf source file
 *							plus the complete filename. Relative or absolute
 *							paths are acceptable.
 *		@param	bgColor:	String hexadecimal color value of the bg of the 
 *							string.
 *							If empty string "" it defaults to white.
 *							Also legal are values "white", "grey", "light grey",   
 *							"dark grey", "black", "red", "blue", 
 *							"green", "yellow", "magenta", "cyan", "orange", and 
 *							"brown" in any case.
 *		@param	flashVars	String name=value pairs concatenated by "&" of all 
 *							FlashVars desired.
 *							Example:	"total_time=1000&max_score=10000"
 *		@returns 			nothing
 *	
 *		Writes the requested swf string to the html document.
 */
if(this.SWF_Factory == null)
{
	this.SWF_Factory = new Object();
	this.SWF_Factory.strings = 
		[
			"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=", 
			"' width='", "' height='", "' id='", "' align='middle'><param name='allowScriptAccess' value='always' /><param name='movie' value='", 
			"' /><param name='quality' value='high' /><param name='menu' value='false' /><param name='wmode' value='opaque' /><param name='bgcolor' value='", "' /><param name='FlashVars' value='", "' /><embed src='", 
			"' FlashVars='", "' quality='high' menu='false' wmode='opaque' bgcolor='", "' width='", "' height='", "' name='", 
			"' align='middle' swLiveConnect='true' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>"
		];
	this.SWF_Factory.makeSWFString = function(version, width, height, id, namepath, bgColor, flashVars)
	{
		//	string var to hold the resulting string:
		var swf = "";
		//	resolve color value:
		bgColor = bgColor.toLowerCase();
		switch(bgColor)
		{
			case "grey":
				bgColor = "#999999";
				break;
			case "light grey":
				bgColor = "#CCCCCC";
				break;
			case "dark grey":
				bgColor = "#333333";
				break;
			case "black":
				bgColor = "#000000";
				break;
			case "red":
				bgColor = "#FF0000";
				break;
			case "blue":
				bgColor = "#0000FF";
				break;
			case "green":
				bgColor = "#00FF00";
				break;
			case "yellow":
				bgColor = "#FFFF00";
				break;
			case "magenta":
				bgColor = "#FF00FF";
				break;
			case "cyan":
				bgColor = "#00FFFF";
				break;
			case "orange":
				bgColor = "#FF6600";
				break;
			case "brown":
				bgColor = "#663300";
				break;
			case "white":
				bgColor = "#FFFFFF";
				break;
			default :
				bgColor = bgColor;
				break;
		}
		//	array of values to inject in the resulting string:
		var values = new Array(version, width, height, id, namepath, bgColor, flashVars, namepath, flashVars, bgColor, width, height, id);
		for(var i = 0; i < this.strings.length; i++)
		{
			swf += this.strings[i];
			if(i < values.length) swf += values[i];
		}
		return swf;
	};
	this.SWF_Factory.writeSWFWindow = function(swf)
	{
		document.open();
		document.write(swf);
		document.close();
	};
	this.SWF_Factory.makeSWF = function(version, width, height, id, namepath, bgColor, flashVars)
	{
		var swf = this.makeSWFString(version, width, height, id, namepath, bgColor, flashVars);
		this.writeSWFWindow(swf);
	};
}
//-->