//Flash object constructor
function flashObject(id, src, width, height, bgcolor, nonflash){
	this.id = id;
	this.src = src;
	this.width = width;
	this.height = height;
	this.bgcolor = bgcolor;
	this.nonflash = nonflash;
}

//detects major version and revision numbers (called from host page)
function detectFlash(){
	var sTemp = '';
	if(flashVersion >= 6){
		sTemp += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="10" height="10" id="" align="middle">';
		sTemp += '<param name="allowScriptAccess" value="sameDomain" />';
		sTemp += '<param name="movie" value="../../../shared/flash/flashdetect.swf?version=6,0,65,0" />';
		sTemp += '<param name="quality" value="high" />';
		sTemp += '<param name="bgcolor" value="#ffffff" />';
		sTemp += '<embed src="../../../shared/flash/flashdetect.swf?version=6,0,65,0" quality="high" bgcolor="#ffffff" width="10" height="10" name="" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		sTemp += '</object>';
		
		document.getElementById('divFlashDetect').innerHTML = sTemp;
	}else{
		renderFlashFeature(false);
	}
}

//renders Flash or redirects to Upgrade page
function renderFlashFeature(supported){
	if(supported){
		var sTemp = '';
		sTemp += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="' + flash.width + '" height="' + flash.height + '" id="' + flash.id + '" align="middle">';
		sTemp += '<param name="allowScriptAccess" value="sameDomain" />';
		sTemp += '<param name="movie" value="' + flash.src + '" />';
		sTemp += '<param name="quality" value="high" />';
		sTemp += '<param name="bgcolor" value="' + flash.bgcolor + '" />';
		sTemp += '<embed src="' + flash.src + '" quality="high" bgcolor="' + flash.bgcolor + '" width="' + flash.width + '" height="' + flash.height + '" name="' + flash.id + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		sTemp += '</object>';
		document.getElementById('divFlash').innerHTML = sTemp;
	}else{
		location.href = '/shared/upgrade_flash.aspx?nonflash=' + escape(flash.nonflash);
	}
}


//suppress myFlash_DoFSCommand errors in Mozilla/Netscape browsers
function myflash_DoFSCommand(command, args){
	
}




//==============================================
//FLASH MAJOR VERSION DETECTION
var agent = navigator.userAgent.toLowerCase();
var flashVersion = 0;

// IE4+ on Win32:  attempt to create an ActiveX object using VBScript
if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	document.write('<scr' + 'ipt language="VBScript"\> \n');
	document.write('on error resume next \n');
	document.write('set swf12Control = CreateObject("ShockwaveFlash.ShockwaveFlash.12") \n')
	document.write('set swf11Control = CreateObject("ShockwaveFlash.ShockwaveFlash.11") \n')
	document.write('set swf10Control = CreateObject("ShockwaveFlash.ShockwaveFlash.10") \n')
	document.write('set swf8Control = CreateObject("ShockwaveFlash.ShockwaveFlash.9") \n')
	document.write('set swf8Control = CreateObject("ShockwaveFlash.ShockwaveFlash.8") \n')
	document.write('set swf7Control = CreateObject("ShockwaveFlash.ShockwaveFlash.7") \n')
	document.write('set swf6Control = CreateObject("ShockwaveFlash.ShockwaveFlash.6") \n')
	document.write('set swf5Control = CreateObject("ShockwaveFlash.ShockwaveFlash.5") \n')
	document.write('set swf4Control = CreateObject("ShockwaveFlash.ShockwaveFlash.4") \n')
	document.write('set swf3Control = CreateObject("ShockwaveFlash.ShockwaveFlash.3") \n')	
	document.write('if IsObject(swf3Control) then flashVersion = 3 \n');
	document.write('if IsObject(swf4Control) then flashVersion = 4 \n');
	document.write('if IsObject(swf5Control) then flashVersion = 5 \n');
	document.write('if IsObject(swf6Control) then flashVersion = 6 \n');
	document.write('if IsObject(swf7Control) then flashVersion = 7 \n');
	document.write('if IsObject(swf8Control) then flashVersion = 8 \n');	
	document.write('if IsObject(swf9Control) then flashVersion = 9 \n');
	document.write('if IsObject(swf10Control) then flashVersion = 10 \n');
	document.write('if IsObject(swf11Control) then flashVersion = 11 \n');
	document.write('if IsObject(swf12Control) then flashVersion = 12 \n');
	document.write('</scr' + 'ipt\> \n'); 
}

// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
else if (navigator.plugins != null && navigator.plugins.length > 0) {
  var flashPlugin = navigator.plugins['Shockwave Flash']; 
  if (typeof flashPlugin == 'object') {
	for (i=25;i>0;i--) {
		  if (flashPlugin.description.indexOf(i+'.') != -1){ 
	      flashVersion = i;
	  }
	}
  }  
}

// WebTV 2.5 supports flash 3
else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;

// older WebTV supports flash 2
else if (agent.indexOf("webtv") != -1) flashVersion = 2;