var MM_contentVersion = 4;
var MM_FlashCanPlay=false;
 
function show_map(c) {
  document.images['imgWorldMap'].src = '../images/locations/WM_' + c + '.gif';
}

function check_flash()
{
 	var plugin = navigator.plugins ; 
    if ( plugin )
    {
       if(navigator.plugins["Shockwave Flash"])//flash (version>2) in plugins
		{
			var flashDescription = navigator.plugins["Shockwave Flash"].description;         
			// A flash plugin-description looks like this: Shockwave Flash 4.0 r5
			// We can get the major version by grabbing the character before the period
			// note that we don't bother with minor version detection. 
			// Do that in your movie with $version or getVersion().
			var MM_PluginVersion = parseInt(flashDescription.substring(16));       
			MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
		} 
	}
}

//if ie on windows, check activeX object
if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1))
{
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
		document.write('on error resume next \n');
		document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion )))\n');
		document.write('</SCR' + 'IPT\> \n'); //break the tag so the javascript not end
}
else
{
    //check plugin array
	check_flash();
}



//based on the check result, output flash or alternative gif files
function create_world_map()
{
// In this section we set up the content to be placed dynamically on the page.
// Customize movie tags and alternate html content below.
    var session=document.resForm["flashmap_paramRockValue"].value;
	if ( MM_FlashCanPlay )
	{
		//embed the flash file
  		var oeTags = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
			    + 'WIDTH="408" HEIGHT="195"'
			    + 'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
			    + '<PARAM name="movie" value="/images/locations/worldmap.swf">'
			    + '<PARAM name="quality" value="high">'
			    + '<PARAM name="BGCOLOR" value="#f3f8fe">'    			  
			    + '<PARAM name="FlashVars" value='
			    + '"'
			    + session
			    +'"'
			    + '>'
			    + '<EMBED SRC="/images/locations/worldmap.swf"'
			    + 'WIDTH="408" HEIGHT="195"'
			    + 'runat="server"'			 
			    + 'QUALITY="high"'
			    + 'bgcolor="#f3f8fe"'
			    + 'FlashVars='
			    + '"'
			    + session
			    + '"'
			    + 'TYPE="application/x-shockwave-flash"'    
			    + 'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">'
			    + '<\/EMBED>'
			    +  '<noembed>'
			    +  '<img src="/images/locations/WM_default.gif"'
			    +  'width="408" height="195"'
			    +   'usemap="#WM_default" style="border-style:none" id="imgWorldMap">'
			    +  '<\/noembed>'
			    + '<\/OBJECT>';
		document.write(oeTags);   // embed the flash movie
	}
	else
	{
          
		// flash is too old or we can't detect the plugin
	    // NOTE: height, width are required!
	    var alternateContent = '<IMG SRC="/images/locations/WM_default.gif" WIDTH="408" HEIGHT="195"'
                                    + 'usemap="#WM_default" style="border-style:none"'
                                    + 'id="imgWorldMap"  >';
                                
 
	    document.write(alternateContent);  // insert non-flash content
	}
}

function create_header_flash()
{
	//display either the best-rate-guarantee flash banner or standard banner within the page header
	if ( MM_FlashCanPlay )
	{
		//browser supports and can play flash; embed the flash file
  		var oeTags = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
			    + 'WIDTH="321" HEIGHT="73"'
			    + 'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
			    + '<PARAM name="movie" value="/images/bestrateguarantee/brg_banner_flash.swf">'
			    + '<PARAM name="quality" value="high">'
			    + '<EMBED SRC="/images/bestrateguarantee/brg_banner_flash.swf" WIDTH="321" HEIGHT="73" RUNAT="server" QUALITY="high" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"><\/EMBED>'
			    + '<NOEMBED><img src="/images/bestrateguarantee/brg_banner.jpg" width="321" height="73"><\/NOEMBED>'
			    + '<\/OBJECT>';
			    
		//embed the flash movie
		document.write(oeTags);
	}
	else
	{
		//flash is too old or we can't detect the plugin; embed the standard image (height and width required)
	    var alternateContent = '<a href="/bestrateguarantee/brg.aspx"><IMG ALT="Best Rate Guarantee" SRC="/images/bestrateguarantee/brg_banner.jpg" WIDTH="321 HEIGHT="70" BORDER="0"></a>';
	    
	    //embed the standard image
	    document.write(alternateContent);
	}
}
