var actualVersion = 0;
var requiredVersion = 4;

function m_lngGetFlashVersion() {
	var latestFlashVersion = 8;
  var agent = navigator.userAgent.toLowerCase(); 
	
  // NS3 needs actualVersion to be a local variable
  if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
  	actualVersion = 0;
  }
   
	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') { 
			for (var m_iFlashVersionIndex = latestFlashVersion; m_iFlashVersionIndex >= 3; m_iFlashVersionIndex--) {
            if (flashPlugin.description.indexOf(m_iFlashVersionIndex + '.') != -1) {
               actualVersion = m_iFlashVersionIndex;
               break;
            }
         }
		}
	}

	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	   var doc = '<scr' + 'ipt language="VBScript"\> \n';
      doc += ' on error resume next \n';
      doc += 'Dim obFlash \n';
      doc += 'For m_iFlashVersionIndex = ' + latestFlashVersion + ' To 3 Step -1 \n';
      doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & m_iFlashVersionIndex) \n';
      doc += '   If IsObject(obFlash) Then \n';
      doc += '      actualVersion = m_iFlashVersionIndex \n';
      doc += '      Exit For \n';
      doc += '   End If \n';
      doc += 'Next \n';
      doc += '</scr' + 'ipt\> \n';
      document.write(doc);
   }
		
	// WebTV 2.5 supports flash 3
	else if (agent.indexOf("webtv/2.5") != -1) actualVersion = 3;

	// older WebTV supports flash 2
	else if (agent.indexOf("webtv") != -1) actualVersion = 2;

	// Can't detect in all other cases
	else {
		actualVersion = -1;
	}

	return actualVersion;
}


function m_DoEmbed() {
	//if(m_lngGetFlashVersion() > requiredVersion) {
		var oeTags = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
		+ ' WIDTH='+adwidth+' HEIGHT='+adheight+''
		+ ' CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">\n'
		+ '<PARAM NAME="MOVIE" VALUE="'+swfpath+'?clickTAG='+redirlink+'">\n'
		+ '<PARAM NAME="QUALITY" VALUE="high">\n'
		+ '<PARAM NAME="MENU" VALUE="false">\n'
		+ '<PARAM NAME="WMODE" VALUE="opaque">\n'
		+ '<EMBED SRC="'+swfpath+'?clickTAG='+redirlink+'"'
		+ ' WIDTH='+adwidth+' HEIGHT='+adheight+''
		+ ' QUALITY="high"'
		+ ' MENU="false"'
		+ ' WMODE="opaque"'
		+ ' TYPE="application/x-shockwave-flash"'
		+ ' PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">\n'
		+ '</EMBED>\n'
		+ '</OBJECT>\n';

		document.write(oeTags);
	//} else {
		//var alternateContent = '<A HREF="'+redirlink+'" TARGET="_blank"><IMG SRC="'+altGIFpath+'" WIDTH="'+adwidth+'" HEIGHT="'+adheight+'" BORDER=0 ALT="'+altText+'"></A>';
		document.write(alternateContent);
	//}
}

m_DoEmbed();
