var FlashDetect={
	detect : function(){
		this.flashinstalled = 0;
		this.flashversion = 0;

		if (navigator.plugins && navigator.plugins.length)
		{
			this.x = navigator.plugins["Shockwave Flash"];
			if (this.x)
			{
				this.flashinstalled = 2;
				if (this.x.description)
				{
					this.y = this.x.description;
					this.cursor = this.y.indexOf(".")-1;
					this.flashversion="";
					while(this.isDigit(this.y.charAt(this.cursor))){
					    this.flashversion=this.y.charAt(this.cursor)+this.flashversion;
					    this.cursor--;
					}
				}
			}
			else
				this.flashinstalled = 1;
			if (navigator.plugins["Shockwave Flash 2.0"])
			{
				this.flashinstalled = 2;
				this.flashversion = 2;
			}
		}
		else if (navigator.mimeTypes && navigator.mimeTypes.length)
		{
			this.x = navigator.mimeTypes['application/x-shockwave-flash'];
			if (this.x && this.x.enabledPlugin)
				this.flashinstalled = 2;
			else
				this.flashinstalled = 1;
		}else{
			// IE flash detection.
			this.flashversion = 0;
			for(var i=10; i>0; i--){
				try{
					var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
					this.flashversion = i;
					this.flashinstalled = 2;
					break;
				}
				catch(e){
				}
			}
	   }
	},
	
	check : function(minVersion, divName, messageInvalidVersion, messageNotInstalled){
		this.detect();
		if(this.flashinstalled == 2){
			if(this.flashversion < minVersion){
				this.messageDiv = document.getElementById(divName);
				if(this.messageDiv){
					this.messageDiv.innerHTML = messageInvalidVersion;
				}
			}
		}else{
				this.messageDiv = document.getElementById(divName);
				if(this.messageDiv){
					this.messageDiv.innerHTML = messageNotInstalled;
				}
		}
	},
	isDigit : function(num) {
		if (num.length>1){return false;}
		this.string="1234567890";
		if (this.string.indexOf(num)!=-1){return true;}
		return false;
	}
}
