aSWF = function(swfName, id, width, height, color){
	this.variables = [];
	this.parameters = {};
	this.swfName = swfName;
	this.id = id;
	this.width = width;
	this.height = height;
	this.color = color;
}

aSWF.prototype = {
	addVariable: function(name, value) {
		this.variables[this.variables.length] = name+'='+value;
	},
	getVariables: function() {
		return this.variables.join('&');
	},
	addParameter: function(name, value) {
		this.parameters[name] = value;
	},
	getParameters: function() {
		return this.parameters;
	},
	getHTML: function() {
		var html = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length)	{
			html += '<embed type="application/x-shockwave-flash" src="'+ this.swfName + '" width="' + this.width + '" height="' + this.height + '"';
			html += ' id="'+ this.id +'" name="'+ this.id + '"';
			html += ' quality="high" bgcolor="' + this.color +'" ';
			var params = this.getParameters();
			for(var key in params) {
				html += [key] +'="'+ params[key] +'" ';
			}
			if (this.variables.length > 0)
				html += 'flashvars="' + this.getVariables() + '" ';	
			html += ' />';				
		}
		else {
			html += '<object name="'+ this.id +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.width +'" height="' + this.height +'">';
			html += '<param name="movie" value="'+ this.swfName +'" />';
			html += '<param name="bgcolor" value="'+ this.color +'" />';
			
			var params = this.getParameters();
			for (var key in params) {
			 	html += '<param name="'+ key +'" value="'+ params[key] +'" />';				
			}
			if (this.variables.length > 0)
				html += '<param name="flashvars" value="' + this.getVariables() + '" />';
			html += '</object>';				
		}
		return html;
	},
	initialize: function() {
		var id = document.getElementById(this.id);
		id.innerHTML = this.getHTML();
	}
}