function getFlashById(SWFObjectId) {
	if(window.document[SWFObjectId]) {
		return window.document[SWFObjectId];
	}
	if(navigator.appName.indexOf("Microsoft Internet") == -1) {
		if(document.embeds && document.embeds[SWFObjectId]) {
			return document.embeds[SWFObjectId]; 
		}
	}
	else {
		return document.getElementById(SWFObjectId);
	}
}

deconcept.SWFObject.prototype.setVariable = function(variable, value) {
	var swf = getFlashById(this.getAttribute("id"));	
	swf.SetVariable(variable, value);
};

deconcept.SWFObject.prototype.connect = function(id) {
	this.SWFLocalConnId = id;
	this.addVariable("SWFLocalConnId", id);
};

deconcept.SWFObject.prototype.call = function() {
	if(this.SWFLocalConnId != undefined) {
		var flashvars = new String();
		flashvars = 'func='+arguments[0]+'&args='+arguments.length;
		for(var i = 1; i < arguments.length; i++) {
			switch(typeof(arguments[i])) {			
				case 'string':
					flashvars += '&a'+i+'='+arguments[i]+'&t'+i+'=string';
					break;
				case 'number':
					flashvars += '&a'+i+'='+arguments[i]+'&t'+i+'=number';
					break;
				case 'boolean':
					flashvars += '&a'+i+'='+arguments[i]+'&t'+i+'=boolean';
					break;
				case 'undefined':
					flashvars += '&a'+i+'='+arguments[i]+'&t'+i+'=undefined';
					break;
				default:
					alert('Acceptable arguments are of type String, Number, Boolean, or undefined.');
					break;
			}
		}
		
		var SWFObjectId = this.getAttribute("id");	
		var divId = SWFObjectId+"_swf_proxy";
		if(!document.getElementById(divId)){
			var div = document.createElement("div");
			div.id = divId;
			document.body.appendChild(div);
		}
		document.getElementById(divId).innerHTML = "";
		var html = "<embed src='/flash/SWFProxy.swf' FlashVars='SWFLocalConnId="+this.SWFLocalConnId+"&flashvars="+escape(flashvars)+"' width='0' height='0' type='application/x-shockwave-flash'></embed>";
		document.getElementById(divId).innerHTML = html;	
	}
};


