var flashinstalled = 0;
var flashversion = 0;
MSDetect = "false";
if (navigator.plugins && navigator.plugins.length)
{
	if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
		var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
		var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
		var descArray = flashDescription.split(" ");
		var tempArrayMajor = descArray[2].split(".");			
		var versionMajor = tempArrayMajor[0];
		var versionMinor = tempArrayMajor[1];
		var versionRevision = descArray[3];
		if (versionRevision == "") {
			versionRevision = descArray[4];
		}
		if (versionRevision[0] == "d") {
			versionRevision = versionRevision.substring(1);
		} else if (versionRevision[0] == "r") {
			versionRevision = versionRevision.substring(1);
			if (versionRevision.indexOf("d") > 0) {
				versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
			}
		}
		//var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		flashinstalled = 2;
		flashversion = parseInt(versionMajor);
		//alert("flashVer="+flashVer);
	}
}
else if (navigator.mimeTypes && navigator.mimeTypes.length)
{
	x = navigator.mimeTypes['application/x-shockwave-flash'];
	if (x && x.enabledPlugin)
		flashinstalled = 2;
	else
		flashinstalled = 1;
}
else
	MSDetect = "true";


if (MSDetect == "true") {
	var doc = '<scr' + 'ipt language="VBScript"\> \n';
	doc += 'on error resume next \n';
	doc += '	For i = 3 to 10\n';
	doc += '		If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then\n';
	doc += '\n';
	doc += '		Else\n';
	doc += '			flashinstalled = 2\n';
	doc += '			flashversion = i\n';
	doc += '		End If\n';
	doc += '	Next\n';
	doc += '\n';
	doc += 'If flashinstalled = 0 Then\n';
	doc += '	flashinstalled = 1\n';
	doc += 'End If\n';
	doc += '</scr' + 'ipt\> \n';
	document.write(doc);
}

function m_overwriteWithFlash(strSRC, strName, intWidth, intHeight, intFlashVersion, strWMode, strBackgroundUrl){
	//alert(document.getElementById(strName).innerHTML);
	if(flashinstalled == 0){
		if(strBackgroundUrl != null){
			m_replaceBackgroundByError(strBackgroundUrl);
		}
		return false;
	}
	
	if(flashversion < intFlashVersion){
		if(strBackgroundUrl != null){
			m_replaceBackgroundByError(strBackgroundUrl);
		}
		return false;
	}
	
	if(strWMode == null){
		strWMode = "opaque";
	}
	
	var strFlash = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
	
	strFlash += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" '; 	
	strFlash += 'width="'+intWidth+'" height="'+intHeight+'" id="oSwf'+strName+'" align="middle">'; 	
	strFlash += '<param name="movie" value="'+strSRC+'" />'; 	
	strFlash += '<param name="quality" value="high" />'; 	
	strFlash += '<param name="wmode" value="'+strWMode+'" />'; 	
	strFlash += '<embed src="'+strSRC+'" '; 	
	strFlash += 'quality="high" '; 	
	strFlash += 'width="'+intWidth+'" height="'+intHeight+'" '; 	
	strFlash += 'name="oSwf'+strName+'" align="middle" type="application/x-shockwave-flash" wmode="'+strWMode+'" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>'; 	
	document.getElementById(strName).innerHTML = strFlash;
}

function m_replaceBackgroundByError(strBackgroundUrl)
{
	if(document.getElementById("mfInnerBackground") != null){
		document.getElementById("mfInnerBackground").style.backgroundImage = "url('" + strBackgroundUrl + "')";
		return;
	}
	document.getElementById("mcContentBackGround").style.backgroundImage = "url('" + strBackgroundUrl + "')";
}

function overwriteWithFlash(strSRC, strName, intWidth, intHeight, intFlashVersion, strWMode, strBackgroundUrl){
	if(strWMode == null){
		strWMode = "opaque";
	}
	window.setTimeout("m_overwriteWithFlash('"+strSRC+"', '"+strName+"', '"+intWidth+"', '"+intHeight+"', '"+intFlashVersion+"', '"+strWMode+"', '"+strBackgroundUrl+"')", 100);
}