function FlashObject(elementId, swf, id, w, h, ver, c, quality, altImage, skipURL, dontShowTip, altContent) {
	this.element = document.getElementById(elementId);
	this.removeBackgroundImage();
	if (!dontShowTip) this.changeContent("<span class='"+elementId+"'>In order to see this content you will have to install <a href='http://www.macromedia.com/shockwave/download/triggerpages_mmcom/flash.html' target='_blank'>Flash Player "+ver+"</a>.</span>");
	
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	
	if (swf) this.setAttribute('swf', swf);
	if (id) this.setAttribute('id', id);
	if (w) this.setAttribute('width', w);
	if (h) this.setAttribute('height', h);
	if (ver) this.setAttribute('version', new PlayerVersion(ver));
	if (c) this.addParam('bgcolor', c);
	this.addParam('quality', quality ? quality : 'high');
	//this.addParam('menu', 'false');
	if (altImage) this.altImage = altImage;
	this.altContent = altContent;
	
	installedVer = FlashObjectUtil.getPlayerVersion();
	this.isValidVersion = installedVer.versionIsValid(this.getAttribute('version'));
	if (!this.isValidVersion && skipURL) {
		window.location = skipURL;
	}
};
FlashObject.prototype.setAttribute = function(name, value) {
	this.attributes[name] = value;
};
FlashObject.prototype.getAttribute = function(name) {
	return this.attributes[name];
};
FlashObject.prototype.getAttributes = function() {
	return this.attributes;
};
FlashObject.prototype.addParam = function(name, value) {
	this.params[name] = value;
};
FlashObject.prototype.getParams = function() {
	return this.params;
};
FlashObject.prototype.getParam = function(name) {
	return this.params[name];
};
FlashObject.prototype.addVariable = function(name, value) {
	this.variables[name] = value;
};
FlashObject.prototype.getVariable = function(name) {
	return this.variables[name];
};
FlashObject.prototype.getVariables = function() {
	return this.variables;
};
FlashObject.prototype.getParamTags = function() {
   var paramTags = ""; var key; var params = this.getParams();
   for (key in params) paramTags += '<param name="'+key+'" value="'+params[key]+'" />';
   return paramTags;
};
FlashObject.prototype.getVariablePairs = function() {
	var variablePairs = new Array();
	var key;
	var variables = this.getVariables();
	for (key in variables) {
		variablePairs.push(key+"="+variables[key]);
	}
	return variablePairs;
};
FlashObject.prototype.getHTML = function() {
    var flashHTML = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
        flashHTML += '<embed type="application/x-shockwave-flash" src="'+this.getAttribute('swf')+'" width="'+this.getAttribute('width') +'" height="'+this.getAttribute('height')+'" id="'+this.getAttribute('id')+'" name="'+this.getAttribute('id')+'"';
		var params = this.getParams();
        for (var key in params) flashHTML += ' '+key+'="'+params[key]+'"';
		pairs = this.getVariablePairs().join("&");
        if (pairs.length > 0) { flashHTML += ' flashvars="'+pairs+'"'; }
        flashHTML += '></embed>';
    } else { // PC IE
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" id="'+this.getAttribute('id')+'">';
        flashHTML += '<param name="movie" value="'+this.getAttribute('swf')+'" />';
		var tags = this.getParamTags();
        if (tags.length > 0) flashHTML += tags;
		var pairs = this.getVariablePairs().join("&");
        if (pairs.length > 0) flashHTML += '<param name="flashvars" value="'+pairs+'" />';
        flashHTML += '</object>';
    }
    return flashHTML;
};
/*FlashObject.prototype.getAltImage = function() {
	return '<div style="background:url('+this.altImage+') no-repeat;width:100%;height:100%;" ></div>';
};*/
FlashObject.prototype.removeBackgroundImage = function() {
	this.setBackgroundImage("");
};
FlashObject.prototype.setBackgroundImage = function(link, repeat, color) {
	if (link != null) this.element.style.backgroundImage = link;
	if (repeat != null) this.element.style.backgroundRepeat = repeat;
	if (color != null) this.element.style.backgroundColor = color;
};
FlashObject.prototype.write = function() {
	if (document.getElementById) {
		if (this.isValidVersion) {
			this.changeContent(this.getHTML());
		} else if (this.altImage) {
			this.changeContent('');
			this.setBackgroundImage(this.altImage);
			//this.element.innerHTML = this.getAltImage();
		} else if (this.altContent) {
			this.setBackgroundImage();
			this.changeContent(this.altContent);
		}
	}
};
FlashObject.prototype.changeContent = function(str) {
	this.element.innerHTML = str;
};

// FlashObjectUtil
function FlashObjectUtil() {};
FlashObjectUtil.getPlayerVersion = function() {
	var version = new PlayerVersion("0.0.0");
	if (navigator.plugins && navigator.mimeTypes.length) {
		var plugin = navigator.plugins["Shockwave Flash"];
		if (plugin && plugin.description) {
			version = new PlayerVersion(plugin.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, "."));
		}
	} else if (window.ActiveXObject) {
		try {
			var ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = new PlayerVersion(ax.GetVariable("$version").split(" ")[1].split(",").join("."));
	   } catch (e) {}
	}
	return version;
};
FlashObjectUtil.getPlayerType = function() {
	return navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length ? "PlugIn" : "ActiveX";
};
FlashObjectUtil.versionIsValid = function(ver) {
	return this.getPlayerVersion().versionIsValid(ver);
};
// PlayerVersion
function PlayerVersion(ver) {
	ver_arr = ver.split(".");
	this.major = parseInt(ver_arr[0]) || 0;
	this.minor = parseInt(ver_arr[1]) || 0;
	this.rev = parseInt(ver_arr[2]) || 0;
};
PlayerVersion.prototype.versionIsValid = function(fv) {
	if (typeof(fv) == 'string' || typeof(fv) == 'number') fv = new PlayerVersion(fv);
	if (this.major < fv.major) {
		return false;
	} else if (this.major == fv.major) {
		if (this.minor < fv.minor) {
			return false;
		} else if (this.minor == fv.minor) {
			if (this.rev < fv.rev) {
				return false;
			}
		}
	}	
	return true;
};

// add Array.push if needed (ie5)
if (Array.prototype.push == null) {
	Array.prototype.push = function(item) {
		this[this.length] = item;
		return this.length;
	}
};