//=============================
// Flash Detection Script
// Revision 2001.09.27
// Seb Chevrel for Second Story
//=============================

var isFlash4 = false;
var isFlash5 = false;
var isFlash6 = false;
var isFlash7 = false;
var isIE45 = false;

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;		// true if we're on ie
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows
var isMac= (navigator.userAgent.indexOf('Mac') != -1) ? true : false; 

// VBScript Detection on IE/Windows
if(isIE && isWin){ 
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('isFlash4 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('isFlash5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	
	document.write('isFlash6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');	
	document.write('isFlash7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');	
	document.write('</SCR' + 'IPT\> \n');
}

// Netscape PlugIn Detection
function detectFlash(){	
	if (navigator.plugins){
		if (navigator.plugins["Shockwave Flash 2.0"]
		|| navigator.plugins["Shockwave Flash"]){

			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			var dot_location = flashDescription.indexOf(".");
			var flashVersion = parseInt(flashDescription.slice(dot_location - 2, dot_location));
			isFlash4 = flashVersion >= 4;
			isFlash5 = flashVersion >= 5;
			isFlash6 = flashVersion >= 6;
			isFlash7 = flashVersion >= 7;
		}
	}	
}
detectFlash();

if ( (navigator.userAgent.indexOf('MSIE 4.5') != -1) && (navigator.userAgent.indexOf('Mac') != -1)) {
	//alert('This interactive feature requires Macromedia Flash player 5 and will not function properly with an earlier version of Flash.');
	isIE45=true; isFlash5=true;
}

// Returns HTML Code to Embed a SWF File
function flashEmbed(swf,width,height,bgcolor,qual,transp,flashvars,id) {
		if (!bgcolor) bgcolor="#000000";
		if (!qual) qual='high';
		if (!id) id='flashid';
		var code = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '
		+ 'width="'+width+'" height="'+height+'" '
		+ 'id="' + id + '" '
		+ 'align="top" '
		+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">'
		+ '<param name="movie" value="'+swf+'">'
		+ '<param name="play" value="true">'
		+ '<param name="loop" value="false">'
		+ '<param name="quality" value="'+qual+'">'
		+ '<param name="menu" value="false">'
		+ '<param name="scale" value="noscale">'
		+ '<param name="flashvars" value="'+flashvars+'">';
		
		
		if (transp) code+='<param name=wmode value=transparent>';
		
		code+='<param name=bgcolor value="'+bgcolor+'"> '
		+ '<embed src="'+swf+'" '
		+ 'width="'+width+'" height="'+height+'" '
		+ 'play="true" '
		+ 'loop="false" '
		+ 'quality="'+qual+'" '
		+ 'menu="false" '
		+ 'scale="showall" '
		+ 'id="' + id + '" '
		+ 'align="top" '
		+ 'bgcolor="'+bgcolor+'" ';
		
		if (transp) code+='wmode=transparent ';
		if (flashvars) code+='flashvars="'+flashvars+'" ';
		
		code+='type="application/x-shockwave-flash" '
		+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
		+ '</embed>'
		+ '</object>';
		return(code);
}

