//Created for CQ 6918  Dated 29 Sep 2004 anoop_mathew@mindtree.com
//Updated by krzysztof.skladzien@volvo.com (27 Apr 2007)

var isIE = (navigator.appName == 'Microsoft Internet Explorer');
var isWin = ( navigator.userAgent.indexOf('Windows') != -1 );

function CreateFlash(cnt) { document.write(cnt); }

var bShowFlash = false;
var flashEnabled = false;

function DetectFlash()
{
  if(isIE && isWin){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');  // Must break up tag so it doesn't break our script
	document.write('on error resume next \n');
	document.write('Dim Ver \n');
	document.write('For Ver = 4 to 12 \n');
	document.write('flashEnabled = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & CStr( Ver ))))\n');
	document.write('If flashEnabled = True Then \n');
	document.write('Break \n');
	document.write('End If \n');	
	document.write('Next \n');
	document.write('</SCR' + 'IPT\> \n'); 		// Must break up tag so it doesn't break our script
  }

  if( navigator.plugins && (navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]) ) {
	var flashName = navigator.plugins["Shockwave Flash"] ? "Shockwave Flash" : "Shockwave Flash 2.0";
	var flashDesc = navigator.plugins[flashName].description;
	var flashVersion = parseInt(flashDesc.charAt(flashDesc.indexOf(".")-1));

	if (flashVersion >= 3)
	{
		var plugin = navigator.plugins[flashName];
		var numTypes = plugin.length;
		for (j = 0; j < numTypes; j++)
		{
			mimetype = plugin[j];
			if (mimetype)
			{
				if (mimetype.enabledPlugin && (mimetype.suffixes.indexOf("swf") != -1))
					flashEnabled = true;
				// Mac wierdness
				if (navigator.mimeTypes["application/x-shockwave-flash"] == null)
					flashEnabled = false;
			}
		}
	}
  }
  if (!flashEnabled) {
	bShowFlash=false;
  }
  else
  {
	bShowFlash=true;
  }
}

// Make flash detection now
DetectFlash();

