/*
	Filename         :	mt.lib.flash.js
	Created by       :	Mark Thomas
	Last modified by :	Mark Thomas
	Created          :	24 April 2006 13:22:52
	Last Updated     :	25 April 2006 13:23:37
*/

/*********************************************************************************/
function JSFlashObject(sPath, sID, nW, nH, nVersionRequired){
	this.sPath 				= sPath;
	this.sID 				= sID;
	this.nW 				= nW;
	this.nH 				= nH, 
	this.nVersionRequired 	= nVersionRequired || 6;
	this.sParamsIE 			= "";
	this.sParamsOther 		= "";
	this.sAltHTML			= "";
	this.addParam = function(sName, sValue) {
		this.sParamsIE 		+= "<param name=\"" + sName + "\" value=\"" + sValue + "\" />"
		this.sParamsOther 	+= " " + sName + "=\"" + sValue + "\"";
	};
	this.bFlash = flashCheck();
	this.getXHTML = function() {
		var sReturn = new String();
		if(this.bFlash >= this.nVersionRequired) {
			sReturn += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"  codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + this.nW + "\" height=\"" + this.nH + "\" id=\"" + this.sID + "\" align=\"middle\">";
			sReturn += "<param name=\"movie\" value=\"" + this.sPath + "\" />";
			sReturn += this.sParamsIE;
			sReturn += "<embed align=\"middle\" type=\"application/x-shockwave-flash\" src=\"" + this.sPath + "\" width=\"" + this.nW + "\" height=\"" + this.nH + "\" id=\"" + this.sID + "\"" + this.sParamsOther + " pluginspage=\"http://www.macromedia.com/go/getflashplayer\"/>";			
		        sReturn += "</object>";
		}else {
			sReturn += this.sAltHTML;	
		};
		return sReturn;		
	};
	this.addNonFlashHTML = function(sHTML){
		this.sAltHTML += sHTML;
	};
};

function flashCheck(nVersion){
	if(this.nFlash) {
		return this.nFlashVersion
	};
	this.nFlashVersion = 0;
	if(navigator.plugins && navigator.plugins.length) {
		var x = navigator.plugins["Shockwave Flash"];
		if(x) {
			if(x.description) {
				var y = x.description;
	   			this.nFlashVersion = y.charAt(y.indexOf('.')-1);
			};
		};
	} else {
		result = false;
	    for(var i=10; i>=3 && result != true; i--){
   			execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
   			this.nFlashVersion = i;
   		};
	};
	return this.nFlashVersion;
};
