function FlashWrapper(){}

FlashWrapper.prototype.initFlashWrapper = function(thisMovie, thisWidth, thisHeight, thisWmode, thisStaticImg, thisStaticImgLink, thisStaticImgAlt, thisStaticImgMap, thisBoolStaticImgSizeDiff, thisWidth2, thisHeight2, thisCSSClassFlash, thisCSSClassNoFlash)
{
	this.thisMovie = unescape(thisMovie);
	this.thisWidth = thisWidth;
	this.thisHeight = thisHeight;
	this.thisWmode = thisWmode;
	this.thisStaticImg = unescape(thisStaticImg);
	this.thisStaticImgLink = unescape(thisStaticImgLink);
	this.thisStaticImgAlt = unescape(thisStaticImgAlt);
	this.thisStaticImgMap = thisStaticImgMap;
	this.thisBoolStaticImgSizeDiff = thisBoolStaticImgSizeDiff;
	this.thisWidth2 = thisWidth2;
	this.thisHeight2 = thisHeight2;
	this.thisCSSClassFlash = thisCSSClassFlash;
	this.thisCSSClassNoFlash = thisCSSClassNoFlash;
	
	// Check to see that Flash is installed and that it is the correct version
	// If not, show default image

	this.flashinstalled = 0;
	this.flashversion = 0;
	this.MSDetect = "false";
	this.finalObjString = "";
	
	if ( navigator.plugins && navigator.plugins.length )
	{
		x = navigator.plugins["Shockwave Flash"];
		
		if ( x )
		{
			flashinstalled = 2;
			
			if ( x.description )
			{
				y = x.description;
				flashversion = y.charAt(y.indexOf('.')-1);
			}
		}
		else
		{
			flashinstalled = 1;
		}
		
		if ( navigator.plugins["Shockwave Flash 2.0"] )
		{
			flashinstalled = 2;
			flashversion = 2;
		}
		
		if( flashinstalled == "2" && flashversion >= "7" )
		{
			finalObjString = this.getFlashObj();
		}
		else {				
			finalObjString = this.getStaticImg();
		}
	}
	else if ( navigator.mimeTypes && navigator.mimeTypes.length )
	{
		x = navigator.mimeTypes['application/x-shockwave-flash'];
		
		if ( x && x.enabledPlugin )
		{
			flashinstalled = 2;
		}
		else 
		{
			flashinstalled = 1;
		}
		
		if ( flashinstalled == "2" && flashversion >= "7" )
		{
			finalObjString = this.getFlashObj();
		}
		else
		{
			finalObjString = this.getStaticImg();
		}
	}
	else
	{
		MSDetect = "true";
		//---------------------------------------------------------------------------------------------------------------------
		// 	Check the browser...we're looking for ie/win
		
		var isIE  = ( navigator.appVersion.indexOf("MSIE") != -1 ) ? true : false;    // true if we're on ie
		var isWin = ( navigator.appVersion.toLowerCase().indexOf("win") != -1 ) ? true : false; // true if we're on windows
		
		if( isIE && isWin )
		{
			// these variables are defined in FlashWrapperIEDetectVarsInit.js and set for IE
			// in FlashWrapperIEDetectVarsInit.vbs
			
		 	if ((flash6Installed == true) || (flash7Installed == true) || (flash8Installed == true) || (flash9Installed == true)) 
			{
				finalObjString = this.getFlashObj();
			}
			else {
				finalObjString = this.getStaticImg();
			}
		}
	}
	
	// write the resulting object tag to the web page
	//alert(finalObjString);
	document.write(finalObjString);
}	


FlashWrapper.prototype.getFlashObj = function()
{
	var objTag = "";

	if ( this.thisWmode == "" )
	{
		this.thisWmode = "false";
	}
	
	if ( this.thisCSSClassFlash != "" )
	{
		objTag += '<div class="' + this.thisCSSClassFlash + '">';
	}
	
	objTag += '<OBJECT type="application/x-shockwave-flash" data="' + this.thisMovie + '" '
			+ 'WIDTH="' + this.thisWidth + '" HEIGHT="' + this.thisHeight + '">'
			+ '<PARAM NAME="MOVIE" VALUE="' + this.thisMovie + '">'
			+ '<PARAM NAME="PLAY" VALUE="true">'
			+ '<PARAM NAME="QUALITY" VALUE="high">'
			+ '<PARAM NAME="MENU" VALUE="false">'
			+ '<PARAM NAME="WMODE" VALUE="' + this.thisWmode + '">'							
			+ '<\/OBJECT>';
			
	if ( this.thisCSSClassFlash != "" )
	{
		objTag += '<\/div>';
	}

	return(objTag);
}	
		
			
FlashWrapper.prototype.getStaticImg = function()
{
	var objTag = "";

	var p_width, p_height;
	var p_isStaticImgDiff = this.thisBoolStaticImgSizeDiff;
	
	// find size of static image
	if( p_isStaticImgDiff == "true" )
	{
		p_width = this.thisWidth2;
		p_height = this.thisHeight2;
	}
	else {
		p_width = this.thisWidth;
		p_height = this.thisHeight;
	}

	if ( this.thisStaticImg != "" ) 
	{
		if ( this.thisCSSClassNoFlash != "" )
		{
			objTag += ('<div class="' + this.thisCSSClassNoFlash + '">');
		}
			if( this.thisStaticImgMap == "" )
			{
				if ( this.thisStaticImgLink != "" )
				{
					objTag += '<a href="' + this.thisStaticImgLink + '">';
				}
				
				objTag += '<img src="' + this.thisStaticImg + '" width="' + p_width + '" height="' + p_height + '" border="0" alt="' + this.thisStaticImgAlt + '" />';
				
				if ( this.thisStaticImgLink != "" )
				{
					objTag += '<\/a>';
				}
			}
			
			else
			{
				objTag += '<img src="' + this.thisStaticImg + '" width="' + p_width + '" height="' + p_height + '" border="0" alt="' + this.thisStaticImgAlt + '" usemap="#' + this.thisStaticImgMap + '">';
			}
		if ( this.thisCSSClassNoFlash != "" )
		{
			objTag += '</div>';
		}

	}
	
	return(objTag);
}

