FlashObject = function(swf, id, w, h, ver, c) {
	this.swf = swf;
	this.id = id;
	this.width = w;
	this.height = h;
	this.version = ver; // default to 6
	this.align = "middle"; // default to middle
	this.parameters = new Object();
	this.variables = new Object();
	if (c) this.color = this.AddParameter("bgcolor", c);
}

FlashObject.prototype.AddParameter = function(name, value) {
	this.parameters[name] = value;
}

FlashObject.prototype.GetParameters = function() {
	return this.parameters;
}

FlashObject.prototype.GetParameter = function(name) {
	return this.parameters[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.GetParameterTags = function() {
	var parameter_tags = "";
	for (var param in this.GetParameters()) {
		parameter_tags += "<param name=\"" + param + "\" value=\"" + this.GetParameter(param) + "\" />";
	}
	if (parameter_tags == "") {
		parameter_tags = null;
	}
	return parameter_tags;
}

FlashObject.prototype.GetHTML = function() {
	var html = "";
	if (window.ActiveXObject && navigator.userAgent.indexOf("Mac") == -1) { // PC IE
		html += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"" + this.width + "\" height=\"" + this.height + "\" id=\"" + this.id + "\" align=\"" + this.align + "\">";
		html += "<param name=\"movie\" value=\"" + this.swf + "\" />";
		if (this.GetParameterTags() != null) {
			html += this.GetParameterTags();
		}
		if (this.GetVariablePairs() != null) {
			html += "<param name=\"flashvars\" value=\"" + this.GetVariablePairs() + "\" />";
		}
		html += "</object>";
	}
	else { // Everyone else
		html += "<embed type=\"application/x-shockwave-flash\" src=\"" + this.swf + "\" width=\"" + this.width + "\" height=\"" + this.height + "\" id=\"" + this.id + "\" align=\"" + this.align + "\"";
		for (var param in this.GetParameters()) {
			html += " " + param + "=\"" + this.GetParameter(param) + "\"";
		}
		if (this.GetVariablePairs() != null) {
			html += " flashvars=\"" + this.GetVariablePairs() + "\"";
		}
		html += "></embed>";
	}
	return html;	
}

FlashObject.prototype.GetVariablePairs = function() {
	var variable_pairs = new Array();
	for (var name in this.GetVariables()) {
		variable_pairs.push(name + "=" + escape(this.GetVariable(name)));
	}
	if (variable_pairs.length > 0) {
		return variable_pairs.join("&");
	}
	else {
		return null;
	}
}

FlashObject.prototype.Write = function(element_id) {
	if (element_id) {
		document.getElementById(element_id).innerHTML = this.GetHTML();
	} 
	else {
		document.write(this.GetHTML());
	}
}

/* add Array.push if needed */
if(Array.prototype.push == null){
	Array.prototype.push = function(item){
		this[this.length] = item;
		return this.length;
	}
}