/****************************************************************/
/*	Purple Monkey Flash Detection				*/
/*								*/
/*	Created By: Ray Schauer					*/
/*	Created On: 4/28/2005					*/
/*	Last Modified On: 03/8/2010				*/
/*	Last Modified By: Dave Ross <dave@xenomedia.com>				*/
/*								*/
/*  Thank you http://www.quirksmode.org/ for the inspiration.	*/
/*								*/
/****************************************************************/

function flashInstalled() {
	var installed = 0;
	var version = 0;
	// DMR - No sir, I don't like it. This was set to 9, and we're on Flash 10 now
	// This should buy us a lot of time, but I hate hard-coding a "high" value
	var currenthigh = 30;

	// Standard Flash Detection
	if (navigator.plugins && navigator.plugins.length) {
		x = navigator.plugins["Shockwave Flash"];
		if (x) {
			installed = 1;
			if (x.description) {
				y = x.description;
				version = y.split('.')[0].split(' ');
				version = parseInt(version[version.length-1], 10);
			}
		} else {
			installed = 0;
		}
	} else {
	// IE flash detection
		 v = currenthigh + 1;
		for(var i=currenthigh; i>0; i--){
			version = 0;
			installed = 0;
			try{
				var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
				version = i;
				installed = 1;
				break;
			} catch(e){
				// We really don't do anything with this.
				// It is here to keep IE from throwing
				// an error.
			}
		}
	}


	// Perform Final Test
	// We MUST have version 6 or higher
	if (installed == 1 && version >= 6)
		return true;
	else
		return false;
}