var flashinstalled = 0;
var flashversion = 0;
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;
	}
}
else if (navigator.mimeTypes && navigator.mimeTypes.length)
{
	x = navigator.mimeTypes['application/x-shockwave-flash'];
	if (x && x.enabledPlugin)
		flashinstalled = 2;
	else
		flashinstalled = 1;
}
else
{
	// IE flash detection.
	document.write('<SCRIPT LANGUAGE="VBScript"> \n');
		document.write('on error resume next \n');
		document.write('For i = 2 to 10 \n');
			document.write('If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then \n');
			document.write('Else \n');
				document.write('flashinstalled = 2 \n');
				document.write('flashversion = i \n');
			document.write('End If \n');
		document.write('Next \n');
		document.write('If flashinstalled = 0 Then \n');
			document.write('flashinstalled = 1 \n');
		document.write('End If \n');
	document.write('</SCRIPT> \n');
}


function showTour(rootPath, flash_vars, flash_rgb)
{
	if (flashinstalled == 2 && flashversion > 6)
	{
		swfPath = rootPath + 'tourdata/tourviewer.swf';
		myOut = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="554" height="485">';
		myOut += '<param name="movie" value="' + swfPath + '" />';
		myOut += '<param name="bgcolor" value="#' + flash_rgb + '" />';
		myOut += '<param name="FlashVars" value="' + flash_vars + '" />';
		myOut += '<embed src="' + swfPath + '" FlashVars="' + flash_vars + '" bgcolor="#' + flash_rgb + '" width="554" height="485" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
		myOut += '</object>';
	}
	else
	{
		myOut = '<div class="noflash">';
		myOut += '<p><a href="http://www.macromedia.com/go/getflashplayer/" title="Get Flash Player" target="_blank"><span class="alert">Alert!</span><span>This virtual tour requires Macromedia Flash.</span><img src="' + rootPath + 'frontend/images/get_flash_player.gif" border="0" alt="[Get Flash Player]" /><span class="bold">Click here to download the Macromedia Flash Player.</span><span class="size80">Once you have installed the flash player come back to this page and refresh your browser.</span></a></p>';
		//myOut += '<p>flashinstalled ' + flashinstalled + '.</p>';
		//myOut += '<p>Flash version ' + flashversion + '.</p>';
		myOut += '</div>';
	}
	return myOut;
}