

if(typeof cwflash == "undefined") var cwflash = new Object();

cwflash.SWFObject = function(swf, el_id, w, h, vers, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	
	this.params = new Object();
	this.flashvars = new Object();
	this.attributes = new Object();
	//this.flashvars = false;
	//this.attributes = false;
	
	this.params = {
		loop: "false",
		menu: "false",
		quality: "high",
		scale: "noscale",
		wmode: "opaque",
		allowscriptaccess: "always",
		bgcolor: c
	};
	this.attributes['id'] = el_id;
	
	this.swf = swf;
	this.w = w;
	this.h = h;
	this.vers = vers;    
}

cwflash.SWFObject.prototype = {
	
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.flashvars[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	
	write: function(elementId){
		var swfdiv = elementId+'_swfdiv';
		$('#'+elementId).html('<div id="'+swfdiv+'"></div>');
		swfobject.embedSWF(this.swf, swfdiv, this.w, this.h, this.vers, "/images/cw/expressInstall.swf", this.flashvars, this.params, this.attributes);
	}
}

var FlashObject = cwflash.SWFObject; // for legacy support
