// check for Flash and either offer a choice about download (action='alert'),
// redirect to the download page without a choice (action='require'),
// or just reload with an extra argument (action='reload')
// other behaviors could be added, such as redirecting to an alternate site URL

	function flashDetect(requiredVersion, action) {
	
		installedVersion = getFlashVersion();

		if ((installedVersion < requiredVersion) && (installedVersion != -1)) {
			if (document.URL.indexOf('noflash=1') == -1) {
			
				if (action == "alert") {
					alertMessage = "Your Flash plug-in is not new enough to view some portions of our site. Would you like to update your plug-in now?";
					update = confirm(alertMessage);
				} else if (action == "require") {
					alertMessage = "Your Flash plug-in is not new enough to view this page. You can download a newer plug-in from Adobe.com.";
					alert(alertMessage);
					update = 1;
				} else if (action == "reload") {
					update = 0;
				}
				
				if (update) {
					getFlash();
				} else {
					delimiter = (document.URL.indexOf('?') != -1) ? '&' : '?' ;
					location = document.URL + delimiter + "noflash=1";
				}
			
			}
		}
	}


// set the master location for the Flash download here; this function can be called from any link in your content or template

	function getFlash() {
		location = 'http://get.adobe.com/flashplayer/';
	}


// Flash Version Detector  v1.2.1
// http://www.dithered.com/javascript/flash_detect/index.html
// code by Chris Nott (chris@dithered.com)
	
	function isDefined(property) {
		return (typeof property != 'undefined');
	}
	
	var flashVersion = 0;
	var flashVersion_DONTKNOW = -1;
	
	function getFlashVersion() {
		var latestFlashVersion = 10;
		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;
	}
	
	