/**************************************************************************************************
* author:	Critical Mass, www.criticalmass.com
* notes:	This file contains code for displaying flash object in the site.		
*	
**************************************************************************************************/

function flashClass() {
	this.version = '1.20061026';
	
	var flashQuery = document.location.href.toLowerCase();	
	this.useFlash = (flashQuery.indexOf('noflash=1') == -1 || flashQuery.indexOf('noflash=true') == -1) ? true : false;
	this.flashVersion = 0;
	
	// object paramerters
	this.bgColor = '#ffffff';
	this.quality = 'high';
	this.menu = 'false';
	this.name = '';
	
	/**********************************************************************************************
	*	flash properties
	*
	********/
	
	if(navigator.plugins && navigator.plugins.length) {    	 		
   	 	for(var intCounter = 0; intCounter < navigator.plugins.length; intCounter++) {
			if(navigator.plugins[intCounter].name.indexOf('Shockwave Flash') != -1) {
				var strFlashPlugin = navigator.plugins[intCounter].description.split('Shockwave Flash ')[1];
				this.flashVersion = parseInt(strFlashPlugin);
			}; 
		};
	} else if(window.ActiveXObject) {
		for(var intCounter = 2; intCounter < 15; intCounter++) { 
			try { 
				objFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + intCounter + "');");
				if(objFlash) {
					this.flashVersion = intCounter; 
				};
			} catch(objError) {
			};
		};
	};	
};
var flash = new flashClass();


/**************************************************************************************************
*	method: injectFlash 
*	notes:	Injects flash into document
*
********/

// update all params via properties

flashClass.prototype.injectFlash = function(strFlash, intWidth, intHeight, intVersion, strVariables) {
	
	var strHtml = '	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + intWidth + '" height="' + intHeight + '" name="' + flash.name + '" align="">';
	strHtml += '		<param name="wmode" value="transparent">';
	strHtml += '		<param name="movie" value="' + strFlash + '">';
	strHtml += '		<param name="quality" value="' + flash.quality + '">';
	strHtml += '		<param name="bgcolor" value="' + flash.bgColor + '">';
	strHtml += '		<param name="menu" value="' + flash.menu + '">';
	strHtml += '		<param name="flashvars" value="' + strVariables + '" />';
	strHtml += '		<embed src="' + strFlash + '" flashvars="' + strVariables + '" menu="' + flash.menu + '" quality="' + flash.quality + '" bgcolor="' + flash.bgColor + '" width="' + intWidth + '" height="' + intHeight + '" name="' + flash.name + '" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
	strHtml += '	</object>';

	document.open('text/html');
	document.write(strHtml);
	document.close();
};