var gotFlash6 = false;
var gotFlash7 = false;
var gotFlash8 = false;
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; 
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

if(isIE && isWin)
{
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n'); 
	document.write('gotFlash6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n'); 
	document.write('gotFlash7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n'); 
	document.write('gotFlash8 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n'); 
	document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}

function check_flash(strFlashSrc,strFlashUrl,strImageSrc,strImageAltText,strImageUrl,strText,strSmallText)
{
	var strString = '';
	var blnDebug = false;

	strString = 'Debug scriping:-\n\nstrFlashSrc : ' + strFlashSrc + '\nstrFlashUrl : ' + strFlashUrl + '\nstrImageSrc : ' + strImageSrc + '\nstrImageAltText : ' + strImageAltText + '\nstrImageUrl : ' + strImageUrl + '\nstrText : ' + strText + '\nstrSmallText : ' + strSmallText;
	
	if(blnDebug){alert(strString);}

	if(hasFlashPlayer())
	{
		var strFlashString = '';

		strFlashString += '<div id="divFlashHomepage">';
		strFlashString += '	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="601" height="266" id="" align="top" border="-1">';
		strFlashString += '		<param name="allowScriptAccess" value="sameDomain"/>';
		strFlashString += '		<param name="movie" value="' + strFlashSrc + '?clickTag=' + strFlashUrl + '"/>';
		strFlashString += '		<param name="quality" value="high"/>';
		strFlashString += '			<embed src="' + strFlashSrc + '?clickTag=' + strFlashUrl + '" quality="high" bgcolor="#ffffff" width="601" height="266" name="" align="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
		strFlashString += '	</object>';
		strFlashString += '</div>';

		document.write(strFlashString);

		if(blnDebug){alert(strFlashString);}
	}
	else
	{
		var strNonFlashString = '';
		var strNonFlashStringAdditional = '';

		//Flash in .dcr file, but no flash player on client machine : display static image

		//Restructure homepage will pass both strText and strSmallText an undefined due to differences in homepage dcrs
		//Only build html for the reskin homepage(s) for this reason

		strNonFlashString += '<div><a href="' + strImageUrl + '" target="_blank"><img src="' + strImageSrc + '" title="' + strImageAltText + '" width="601" border="0"></a></div>';

		if(typeof(strText) != "undefined")
		{
			var blnStrText = true;

			strNonFlashStringAdditional += '<div class="spacer-2px"><img src="/shared/images/spacer.gif" height="2" width="1" alt=""></div>';
			strNonFlashStringAdditional += '	<table width="601" border="0" cellpadding="0" cellspacing="0">';
			strNonFlashStringAdditional += '		<tr>';
			strNonFlashStringAdditional += '			<td class="padding-left-11px">';
			strNonFlashStringAdditional += '				<div class="homepage-section-plain-title"><a class="directory-section-title" href="' + strImageUrl + '" title="' + strText + '">' + strText + '</a></div>';

			if(typeof(strSmallText) != "undefined")
			{
				var blnStrNonFlashString = true;

				strNonFlashStringAdditional += '				<div class="homepage-section-summary">' + strSmallText + '</div>';
			}

			strNonFlashStringAdditional += '			</td>';
			strNonFlashStringAdditional += '		</tr>';
			strNonFlashStringAdditional += '	</table>';
			strNonFlashStringAdditional += '</div>';
		}

		if(!blnStrText && !blnStrNonFlashString)
		{
			document.write(strNonFlashStringAdditional);
		}
		else
		{
			document.write(strNonFlashString);
		}

		if(blnDebug){alert(strNonFlashString);}
	}
}

function hasFlashPlayer()
{
	if(navigator.plugins && navigator.plugins["Shockwave Flash"])
	{
		var flashDesc = navigator.plugins["Shockwave Flash"].description;
		var flashVer = parseInt(flashDesc.charAt(flashDesc.indexOf(".") - 1));

		if (flashVer == 6) gotFlash6 = true;
		if (flashVer == 7) gotFlash7 = true;
		if (flashVer == 8) gotFlash8 = true;	
		
	}
	
	if (gotFlash6 == true || gotFlash7 == true || gotFlash8 == true)
	{
		var showFlash = "true";
		
	}
	return (showFlash);
}