// Title: flashEmbed 3.1
// Owner: Copyright 2005, Quickform S.L. (quickform.net)
// Usage: http://creativecommons.org/licenses/sa/1.0/

function runFlash(fileName, version, width, height, bgColor) {
	var align = "";
	var quality = "high";
	var name = "flashObject";
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version + ',0,0,0" WIDTH="' + width + '" HEIGHT="' + height + '" id="' + name + '" ALIGN="' + align + '" swLiveConnect=true>\n');
	document.write('<PARAM NAME=movie VALUE="' + fileName + '"> <PARAM NAME=quality VALUE="' + quality + '"> <PARAM NAME=bgcolor VALUE="#' + bgColor + '"> <PARAM NAME=swLiveConnect VALUE=true> \n');
	document.write('<EMBED src="' + fileName + '" quality="' + quality + '" bgcolor="#' + bgColor + '" WIDTH="' + width + '" HEIGHT="' + height + '" NAME="' + name + '" ALIGN="' + align + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> </EMBED>\n');
	document.write('</object>\n');
}

function flashEmbed(fileName, version, width, height, bgColor) {
	var capableFlash = 0;
	var capableFlashX = 0;
	var flashXVersion = 0;
	for(var i=version; i>0; i--){
		try{
			var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
			flashXVersion = i;
			capableFlashX = (flashXVersion>=version) ? 1 : 0; 
			break;
		}
		catch(e){}
	}
		
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0);
	if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= version) {
		capableFlash = 1;
	}
	if (capableFlash || capableFlashX) { 
		runFlash(fileName, version, width, height, bgColor); 
	} else { 
			runFlash(fileName, version, width, height, bgColor); 
//		window.location = 'flashembed/noflash.php'; 
	}
}