// FLASH DETECTION
//function test() { alert('Welcome');}

function flashDetect(flFileName, flWidth, flHeight, variables) 
{
 			var browserVersion = getFlashVersion();
      var contentVersion = 5;
			if (browserVersion == -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('FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & contentVersion)))\n');
      	document.write('</SCR' + 'IPT\> \n');			
			}else { 
      			var FlashCanPlay = browserVersion >= contentVersion;
			}
      if ( FlashCanPlay ) {						
		 			newFlashObject(flFileName, flWidth, flHeight, variables)
      } else{
					noFlashImg(flFileName, flWidth, flHeight)
      }
}

// Flash Version Detector  v1.2.1
// documentation: http://www.dithered.com/javascript/flash_detect/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)
// with VBScript code from Alastair Hamilton (now somewhat modified)


function isDefined(property) {
  return (typeof property != 'undefined');
}

var flashVersion = 0;
function getFlashVersion() {
	 var flashVersion_DONTKNOW = -1;
   var latestFlashVersion = 50;
   var agent = navigator.userAgent.toLowerCase(); 
   
   // NS3 needs flashVersion to be a local variable
   if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
      flashVersion = 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 i = latestFlashVersion; i >= 3; i--) {
            if (flashPlugin.description.indexOf(i + '.') != -1) {
               flashVersion = i;
               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 i = ' + latestFlashVersion + ' To 3 Step -1 \n';
      doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
      doc += '   If IsObject(obFlash) Then \n';
      doc += '      flashVersion = i \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) flashVersion = 3;

   // older WebTV supports flash 2
   else if (agent.indexOf("webtv") != -1) flashVersion = 2;

   // Can't detect in all other cases
   else {
      flashVersion = flashVersion_DONTKNOW;
   }

   return flashVersion;
}

//<NOSCRIPT><IMG SRC="images/noflashmenu.jpg" alt="Follys End Church, Croydon Church" WIDTH="760" HEIGHT="187" usemap="#noflash" BORDER=0></noscript>					

function noFlashImg(imgFileName, imgWidth, imgHeight)
{
      	document.write('<IMG SRC="images/' + imgFileName + '.jpg" WIDTH="' + imgWidth + '" HEIGHT="' + imgHeight + '" usemap="#noflash" BORDER=0>');			
}

function newFlashObject(flFileName, flWidth, flHeight, variables)
{
      	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
      	document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
      	document.write(' ID="script" WIDTH="' + flWidth + '" HEIGHT="' + flHeight + '" ALIGN="">');
      	document.write(' <PARAM NAME=movie VALUE="swf/' + flFileName + '.swf' + variables + '"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> '); 
      	document.write(' <EMBED src="swf/' + flFileName + '.swf' + variables + '" quality=high bgcolor=#FFFFFF  ');
      	document.write(' swLiveConnect=FALSE WIDTH="' + flWidth + '" HEIGHT="' + flHeight + '" NAME="script" ALIGN=""');
      	document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
      	document.write(' </EMBED>');
      	document.write(' </OBJECT>');
}

/*
<map id="noflash" name="noflash">
       <area shape ="rect" coords ="14,130,449,164"
        href ="http://www.macromedia.com/go/getflashplayer"
        alt="Flash" target="_blank" />						
       <area shape ="rect" coords ="14,167,67,182"
        href ="http://www.follysend.org/index.php"
        alt="Home" />

       <area shape ="rect" coords ="68,167,157,182"
        href ="http://www.follysend.org/worship.php"
        alt="Worship" />						
       <area shape ="rect" coords ="159,167,239,182"
        href ="http://www.follysend.org/jesus.php"
        alt="Jesus" />						
       <area shape ="rect" coords ="241,167,325,182"
        href ="http://www.follysend.org/family.php"
        alt="Family" />						
       <area shape ="rect" coords ="327,167,400,182"
        href ="http://www.follysend.org/contact.php"
        alt="Contact" />												
</map>
*/