/****************************************************************/
/*	Purple Monkey Flash Detection				*/
/*								*/
/*	Created By: Ray Schauer					*/
/*	Created On: 4/28/2005					*/
/*	Last Modified On: 04/28/2005				*/
/*	Last Modified By: Ray Schauer				*/
/*								*/
/*  Thank you http://www.quirksmode.org/ for the inspiration.	*/
/*								*/
/****************************************************************/

function flashInstalled() {
	var installed = 0;
	var version = 0;
	var currenthigh = 9;

	// 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.charAt(y.indexOf('.')-1);
			}
		} else {
			installed = 0;
		}
	} else {
	// IE flash detection
		currenthigh = 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 4 or higher
	if (installed == 1 && version >= 6)
		return true;
	else
		return false;
}