function FlashContainer() {
//	Variable properties
	this.movie = null;
	this.image = null;
	this.altLink  = null;
	this.width = "762";
	this.height = "58";

//	Static properties
	this.flashVersion = 4;
	this.classid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
	this.codebase= "http://active.macromedia.com/flash2/cabs/swflash.cab";
	this.id = "flash";
	this.quality = "high";
	this.scale = "exactfit";
	this.loop  = "true";
	this.mimeType  = "application/x-shockwave-flash";
	this.imageBorder=0;

//  Working properties
	this.version = parseInt(navigator.appVersion.substring(navigator.appVersion.indexOf('.')-1));
	this.isIE    =  (navigator.userAgent.indexOf('MSIE') >= 0)?true:false;
	this.isMac   =  (navigator.userAgent.indexOf('Mac') >= 0)?true:false;
	this.isIEMac = (this.isIE && this.isMac)?true:false;


//  Methods
	this.write = writeFlashContainer;	
	this.isFlashInstalled = isFlashInstalled;
	this.writeFlash = writeFlash;
	this.writeAlternate = writeAlternate;
}
// Check Flash installed in IE
	var isIEFlashInstalled = 
		'<SCRIPT LANGUAGE="VBScript"\> \n' +
			'on error resume next \n' +
			'Dim IEFlashInstalled(9) \n' +
			'IEFlashInstalled(4) = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n' +
			'IEFlashInstalled(5) = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n' +
		'</SCRIPT\> \n'
	document.write(isIEFlashInstalled)

function isFlashInstalled() {
	if (this.movie==null) return false 
	
	if (this.isIE) return IEFlashInstalled(this.flashVersion) 
	else {
		var plugin = navigator.mimeTypes && navigator.mimeTypes[this.mimeType] ? navigator.mimeTypes[this.mimeType].enabledPlugin : 0;
		if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf('.')-1)) >= this.flashVersion) return true
		else return false
	}
}

function writeFlashContainer() {
	if (this.version < 4 || this.isIEMac) {this.writeAlternate();return true;}
	
	if (this.isFlashInstalled()) this.writeFlash()
	else this.writeAlternate()
}

function writeFlash() {

	if (this.isIE) {
		var ln = ''
			ln+='<OBJECT CLASSID="' + this.classid + '" CODEBASE="' + this.codebase + '#version=' + this.flashVersion + ',0,0,0"\n'
			ln+='	 ID="' + this.id + '" WIDTH="' + this.width + '" HEIGHT="' + this.height + '">\n'
			ln+='	<PARAM NAME=movie VALUE="' + this.movie +'">\n'
			ln+='	<PARAM NAME=quality VALUE=' + this.quality + '>\n' 
			ln+='	<PARAM NAME=scale VALUE=' + this.exactfit + '>\n'
			ln+='	<PARAM NAME=loop VALUE=' + this.loop + '>\n'
			ln+=' </OBJECT>\n '
	} else {
		var ln ='';
			ln+='<EMBED NAME=' + this.id + ' MAYSCRIPT SRC="' + this.movie +'" WIDTH="' + this.width + '"'
			ln+=' HEIGHT="' + this.height + '" Loop=' + this.loop
			ln+=' PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"'
			ln+=' swLiveConnect=true type="' + this.mimeType + '"></EMBED>' 
	}

	document.writeln(ln)
}
	
function writeAlternate() {
	if (this.image!=null) {
		if (this.image.toLowerCase().indexOf('<img')>=0) var imageTag = this.image
		else var imageTag = '<img src="' + this.image + '" width="' + this.width + '" height="' + this.height + '" border="' + this.border + '">'
	}
	
	if (this.altLink==null) 
		if (this.image==null) document.write("Error: Neither link or image has been defined in ShowFlash");
		else document.write(imageTag)
	else
		if (this.image==null) document.location.replace(this.altLink)
		else document.write('<a href="' + this.altLink + '">' + imageTag + '</a>');
}	

