// Danny Mavromatis, Mike Davidson
// Version: 2.06.3
// Created: 10/29/2001
// Updated: 23/8/2004
// ESPN.com FLASH detection system
// Glitnir Flash Detection
// Revision / XHTML update / Einar Þór Gústafsson

	var f2 = false;
	var f3 = false;
	var f4 = false;
	var f5 = false;
	var f6 = false;
	var f7 = false;	
	var cId = 0;
	var mV = 7;
	var aV = 0;
	var hRV = false;
	var jsV = 1.0;
	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
	
	jsV = 1.1;
	
if(isIE && isWin){
	document.write('<scr' + 'ipt language=\"VBScript\"\> \n');
	document.write('on error resume next \n');
	document.write('f2 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write('f3 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('f4 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('f5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
	document.write('f6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('f7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
	document.write('</scr' + 'ipt\> \n');
}

function checkFlash(rV)
{
	var ua=navigator.userAgent.toLowerCase();
	this.webtv = (ua.indexOf("webtv")>-1);
	this.ie = (parseFloat(ua.slice(ua.indexOf("msie")+5)));
	this.nn = (parseFloat(ua.slice(ua.indexOf("mozilla/")+8)));
	var browser = navigator.appName.toLowerCase();
	if (browser=="netscape")
		this.netscape = true;
	else
		this.netscape = false;
	this.mac = (ua.indexOf("mac")>-1);
	this.flash = false;
	
	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 fD = navigator.plugins["Shockwave Flash" + isVersion2].description;
			var fV = parseInt(fD.charAt(fD.indexOf(".") - 1));
			f2 = fV == 2;
			f3 = fV == 3;
			f4 = fV == 4;
			f5 = fV == 5;
			f6 = fV == 6;
			f7 = fV == 7;			
		}
	}
	
	for (var i = 2; i <= mV; i++) {
		if (eval("f" + i) == true) aV = i;
	}
	
	//alert("version detected: " + aV);
	if (aV >= rV) {
		if (this.netscape && this.IEonly == 'TRUE' || this.mac && this.IEonly == 'TRUE'){
			this.flash = false;
		} else {
			this.flash = true;
		}
	}
}

function flashObj() 
{
	cId += 1;
	this.flashFile = "filename.swf";
	this.LiveConnect = "FALSE";
	this.IEonly = null;
      	this.wmode = "opaque";
      	this.redirect = null;
	this.DenyIEdl = "FALSE";
	this.altImg = "NoFlash.gif";
	this.bgcolor = null;
	this.altTxt = null;
	this.height = "400";
	this.width = "520";
	this.flashVars = null;
	this.ID = "flash"+ cId;
	this.name = "flash"+ cId;
	this.webTV = "true";
	this.quality = "best";
	this.scale = "exactfit";
	this.menu = "false";
	this.deviceFont = "false";
	this.FlashVer = 4;
	this.cabVersion = "4,0,0,0";
	this.render = writeFlashComponent;
	this.debug = false;
}

function writeFlashComponent() 
{
	var Ticket=new checkFlash(this.FlashVer);
	var debugMSG = "";
	var sCR;		
		 debugMSG += "Flash is installed: " + Ticket.flash + "\n";
	if (Ticket.flash) 
	{		
			debugMSG += "deny ie DL:" + this.DenyIEdl + "\n";		
			debugMSG += "mac: " + Ticket.mac + "\n";		
			debugMSG += "netscape:" + Ticket.netscape + "\n";
			
		if (Ticket.mac || Ticket.netscape) 
		{
			if (this.bgcolor){
					sCR="<embed src=\""+this.flashFile+"\" swLiveConnect=\""+this.LiveConnect+"\" width=\""+this.width+"\" height=\""+this.height+"\" quality=\""+this.quality+"\" scale=\""+this.scale+"\" flashvars=\""+ this.flashVars +"\" wmode=\""+this.wmode+"\" ID=\""+this.ID+"\" name=\""+this.name+"\" menu=\""+this.menu+"\" devicefont=\""+this.deviceFont+"\" bgcolor=\""+this.bgcolor+"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed>";
					} else {
					sCR="<embed src=\""+this.flashFile+"\" swLiveConnect=\""+this.LiveConnect+"\" width=\""+this.width+"\" height=\""+this.height+"\" quality=\""+this.quality+"\" scale=\""+this.scale+"\" flashvars=\""+ this.flashVars +"\" wmode=\""+this.wmode+"\" ID=\""+this.ID+"\" name=\""+this.name+"\" menu=\""+this.menu+"\" devicefont=\""+this.deviceFont+"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed>";
			}
		} 
		else if (this.DenyIEdl=='TRUE') 
		{
			
			debugMSG += "using embed" + "\n";
			sCR="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version="+this.FlashVer+",0,0,0\" id=\""+this.ID+"\" width=\""+this.width+"\" height=\""+this.height+"\">\n";
			sCR+="<param name=\"movie\" value=\""+this.flashFile+"\" />\n";						
			sCR+="<param name=\"quality\" value=\""+this.quality+"\" />\n";
			sCR+="<param name=\"scale\" value=\""+this.scale+"\" />\n";
			sCR+="<param name=\"menu\" value=\""+this.menu+"\" />\n";
			sCR+="<param name=\"wmode\" value=\""+this.wmode+"\" />\n";
			if (this.bgcolor){
				sCR+="<param name=\"bgcolor\" value=\""+this.bgcolor+"\" />\n";
			}
			if (this.flashVars){
				sCR+="<param name=\"FlashVars\" value=\""+this.flashVars+"\" />\n";
			}
			sCR+="<param name=\"devicefont\" value=\""+this.deviceFont+"\" />\n";
			if (this.bgcolor){
			sCR+="<embed src=\""+this.flashFile+"\" swLiveConnect=\""+this.LiveConnect+"\" width=\""+this.width+"\" height=\""+this.height+"\" quality=\""+this.quality+"\" scale=\""+this.scale+"\" wmode=\""+this.wmode+"\" id=\""+this.ID+"\" name=\""+this.name+"\" menu=\""+this.menu+"\" devicefont=\""+this.deviceFont+"\" flashvars=\""+ this.flashVars +"\" bgcolor=\""+this.bgcolor+"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed></object>";
			} else {
			sCR+="<embed src=\""+this.flashFile+"\" swLiveConnect=\""+this.LiveConnect+"\" width=\""+this.width+"\" height=\""+this.height+"\" quality=\""+this.quality+"\" scale=\""+this.scale+"\" wmode=\""+this.wmode+"\" id=\""+this.ID+"\" name=\""+this.name+"\" menu=\""+this.menu+"\" devicefont=\""+this.deviceFont+"\" flashvars=\""+ this.flashVars +"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed></object>";
			}
		} 
		else if (Ticket.ie>=4 && this.DenyIEdl=='FALSE') 
		{
			debugMSG += "using object" + "\n";
			sCR="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version="+this.cabVersion+"\" ID=\""+this.ID+"\" WIDTH=\""+this.width+"\" HEIGHT=\""+this.height+"\">\n";
			sCR+="<param name=\"movie\" value=\""+this.flashFile+"\" />\n";						
			sCR+="<param name=\"quality\" value=\""+this.quality+"\" />\n";
			sCR+="<param name=\"scale\" value=\""+this.scale+"\" />\n";
			sCR+="<param name=\"menu\" value=\""+this.menu+"\" />\n";
			sCR+="<param name=\"wmode\" value=\""+this.wmode+"\" />\n";
			if (this.flashVars){
				sCR+="<param name=\"FlashVars\" value=\""+this.flashVars+"\" />\n";
			}
			if (this.bgcolor){
				sCR+="<param name=\"bgcolor\" value=\""+this.bgcolor+"\" />\n";
			}
			sCR+="<param name=\"devicefont\" value=\""+this.deviceFont+"\" />\n";
			sCR+="</object>\n";
		} 
		else if (Ticket.webtv) 
		{
			debugMSG += "using webtv embed" + "\n";
			sCR="<embed src=\""+this.flashFile+"\" swLiveConnect=\"TRUE\" width=\""+this.width+"\" height=\""+this.height+"\" quality=\""+this.quality+"\" scale=\""+this.scale+"\" wmode=\""+this.wmode+"\" id=\""+this.ID+"\" name=\""+this.name+"\" menu=\""+this.menu+"\" devicefont=\""+this.deviceFont+"\" flashvars=\""+ this.flashVars +"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed>";
		}
	} 
	else 
	{
		if (this.redirect)
		{
			top.location.href = this.redirect;
		} 
		else 
		{
			if (this.altTxt)
				sCR = this.altTxt;
			else 
				sCR="<img src=\""+this.altImg+"\" width=\""+this.width+"\" height=\""+this.height+"\" border=\"0\" alt=\"\" />";
		}
	}
	if(this.debug)
		alert(debugMSG);	
	return sCR;
}