/*
* File Name    :flash.js
* Dependencies :browser.js
*/

// global variables
flashInstalled = false; // flash player installed status
flashVersion   = 0;     // flash plug-in version default

// detect flash
if(gBrowser.ie && !gBrowser.mac) { // ie on windows
	document.write('<scr' + 'ipt language=VBScript\> \n');
	document.write('Option Explicit \n');
	document.write('If ScriptEngine = "VBScript" And ScriptEngineMajorVersion >= 2 Then \n');
	document.write('Dim versionStart, i, flashObj \n');
	document.write('versionStart = 25 \n');
	document.write('On Error Resume Next \n');
	document.write('For i = versionStart To 1 Step -1 \n');
	document.write('Set flashObj = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n');			 
	document.write('If IsObject(flashObj) Then \n');
	document.write('flashInstalled = true \n');
	document.write('flashVersion = i \n');
	document.write('Exit For \n');
	document.write('End If \n');
	document.write('Next \n');
	document.write('End If \n');
	document.write('</scr' + 'ipt\> \n');
} else { // all other browsers
	if(navigator.plugins["Shockwave Flash"] && navigator.mimeTypes["application/x-shockwave-flash"]) {
	flashInstalled = true;
	flashVersion = parseInt(navigator.plugins["Shockwave Flash"].description.substring(16));
	} else {
		flashInstalled == "unknown";
	}
}

/*
* Name: runActiveX(swfPath,width,height,majorVersion,bgcolor,flashvars,id,wmode)
* Desc: dynamically places an activex control so the user doesn't have to click on it
*/
function runActiveX(swfPath,width,height,majorVersion,bgcolor,flashvars,id,wmode) {
	var axcStr = "";
	axcStr += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+majorVersion+',0,0,0" width="'+width+'" height="'+height+'" id="'+id+'">';
	axcStr += '<param name="movie" value="'+swfPath+'" />';
	axcStr += '<param name="quality" value="high" />';
	axcStr += '<param name="bgcolor" value="'+bgcolor+'" />';
	axcStr += '<param name="flashvars" value="'+flashvars+'" />';
	axcStr += '<param name="wmode" value="'+wmode+'" />';
	axcStr += '<embed src="'+swfPath+'" quality="high" bgcolor="'+bgcolor+'" flashvars="'+flashvars+'" width="'+width+'" height="'+height+'" name="'+id+'" wmode="'+wmode+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	axcStr += '</object>';
	document.write(axcStr);
}

/*
* Name: insertReplacementPic(src,width,height,alt,href)
* Desc: insert a replacement image if the user doesn't have flash
*/
function insertReplacementPic(src,width,height,alt,href) {
	var imgStr = "";
	imgStr += '<a href="'+href+'">';
	imgStr += '<img src="'+src+'" width="'+width+'" height="'+height+'" alt="'+alt+'">';
	imgStr += '</a>';
	document.write(imgStr);
}

