FObject = function(swf, eid, width, height, ver, quality, wmode, bgcolor){
	this.attributes = new Object();
	this.params = new Object();
	this.flashvars = new Object();
	if(swf) { this.setAttribute('swf', swf); }
	if(eid) { this.setAttribute('eid', eid); 
			 this.setFlashVar('eid', eid); }
	if(width) { this.setAttribute('width', width); }
	if(height) { this.setAttribute('height', height); }
	if(quality) { this.setAttribute('quality', quality); }
	if(wmode) { this.setAttribute('wmode', wmode); }
	if(bgcolor) { this.setAttribute('bgcolor', bgcolor); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	this.setFlashVar('allowResize', FUtil.canResizeFlash());
}
FObject.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;
	},
	setFlashVar: function(name, value){
		this.addFlashVar(name, value);
	},
	addFlashVar: function(name, value){
		this.flashvars[name] = value;
	},
	getFlashVar: function(name){
		return this.flashvars[name];
	},
	getFlashVars: function(name){
		return this.flashvars;
	},
	addURLFlashVar: function(name) {
		this.setFlashVar(name, FUtil.getParamFromURL(name));
	},
	setURLFlashVar: function(name) {
		this.addURLFlashVar(name);
	},
	getFlashVarsPairs: function(){
		var flashvarsPairs = new Array();
		var key;
		var variables = this.getFlashVars();
		for(key in variables){
			flashvarsPairs.push(key +"="+ variables[key]);
		}
		return flashvarsPairs;
	},
	getHTML: function() {
		var h = "<object " + (window.ActiveXObject ? "classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"" : "type=\"application/x-shockwave-flash\" data=\""+this.getAttribute('swf')+"\"");
		h += " height=\""+this.getAttribute('height')+"\" width=\""+this.getAttribute('width')+"\">"
		var params = this.getParams();
		for(var key in params) {h+= '<param name="'+ key +'" value="'+ params[key] +'" />';	}
		h += "<param name=\"flashvars\" value=\""+this.getFlashVarsPairs().join("&")+"\">"
		h += "<param name=\"movie\" value=\""+this.getAttribute('swf')+"\">"
		h += "<param name=\"quality\" value=\""+this.getAttribute('quality')+"\">"
		h += "<param name=\"wmode\" value=\""+this.getAttribute('wmode')+"\">"
		if(this.getAttribute('bgcolor')){h += "<param name=\"bgcolor\" value=\""+this.getAttribute('bgcolor')+"\">"}
		h += "</object>";
		return h;
	},
	write:function(){
		var x = document.getElementById(this.getAttribute("eid"));
		if(x && this.installedVer.versionIsValid(this.getAttribute('version'))) {
			x.innerHTML = this.getHTML(); 
			var v = document.getElementById(this.getAttribute("eid")+"-html"); 
			if(v){v.innerHTML = this.getHTML().replace(/[<]/g,"&lt;").replace(/[>]/g,"&gt;<br />")}
		}
	}
}
var FUtil = {
	setFlashWidth: function(did,w){
		if(document.getElementById(did)){document.getElementById(did).style.width = w+"px";}
	},
	setFlashHeight: function(did,h){
		if(document.getElementById(did)){document.getElementById(did).style.height = h+"px";}
	},
	setFlashSize: function(did,w,h){
		this.setFlashWidth(did,w);
		this.setFlashHeight(did,h);
	},
	canResizeFlash: function(){
		var ua = navigator.userAgent.toLowerCase();
		var opera = ua.indexOf("opera");
		if(document.getElementById){
			if(opera == -1) return true;
			else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
		}
		return false;
	},
	getParamFromURL:function(name){
		var qs = window.location.href.match(/([^?=&]+)(=([^&]*))?/g)
		for(i=0; i<qs.length; i++) {
			if(qs[i].match(new RegExp("^"+name+"=.*"),"i") )
				return qs[i].split('=').pop();
		}
		return ""
	}	
}


/* ---- detection functions ---- */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else{
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */

