// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function getFlashVersion(){
	b = navigator.userAgent.toLowerCase();
	if ( (b.indexOf('msie') != -1) && (b.indexOf('win') != -1) && (b.indexOf('opera') == -1) ) {
		document.writeln('<script language="VBscript">');
		document.writeln('Function detectActiveXControl(activeXControlName)');
		document.writeln('  on error resume next');
		document.writeln('  detectActiveXControl = False');
		document.writeln('  detectActiveXControl = IsObject(CreateObject(activeXControlName))');
		document.writeln('End Function');
		document.writeln('</scr' + 'ipt>');
	}
	var installedVersion = 0;
	if ( (b.indexOf('msie') != -1) && (b.indexOf('win') != -1) && (b.indexOf('opera') == -1) ) {
		for (var i=3; i<50; i++){
			if(detectActiveXControl("ShockwaveFlash.ShockwaveFlash."+i) == true) installedVersion = i;
		}
	} else {
		if (navigator.plugins["Shockwave Flash"]) {
			var pluginDesc = navigator.plugins["Shockwave Flash"].description;

			installedVersion = parseInt(pluginDesc.substr( pluginDesc.indexOf(".")-2,2) );
			if (isNaN (installedVersion)) installedVersion = parseInt(pluginDesc.substr( pluginDesc.indexOf(".")-1,1) );
		}

		if(b.indexOf("webtv") != -1) installedVersion = 3;  
	}
	
	return installedVersion;
}