/**
 * ActiveXObject - based on SWFObject
 */
if(typeof code == "undefined") var code = new Object();
if(typeof code.util == "undefined") code.util = new Object();
if(typeof code.ActiveXObjectUtil == "undefined") code.ActiveXObjectUtil = new Object();
code.ActiveXObject = function(src, id, w, h, c, cid, cb, pp, mt){
	if (!document.createElement || !document.getElementById) { return; }
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	this.customAttributes = new Object();
	if(src) { this.setAttribute('src', src); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(c) { this.addParam('bgcolor', c); }
	if(cid) { this.setAttribute('classid', cid); }
	if(cb) { this.setAttribute('codebase', cb); }
	if(pp) { this.setAttribute('pluginspage', pp); }
	if(mt) { this.setAttribute('type', mt); }
};
code.ActiveXObject.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;
	},
	addCustomAttribute: function(name, value){
		this.customAttributes[name] = value;
	},
	getCustomAttributes: function(){
		return this.customAttributes;
	},
	getActiveXHTML: function() {
		var axNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length)
		{
			// netscape plugin architecture
			axNode = '<embed type="'+ this.getAttribute('type') +'" pluginspage="'+ this.getAttribute('pluginspage') +'" src="'+ this.getAttribute('src') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			axNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var customAttributes = this.getCustomAttributes();
			 for(var key in customAttributes){ axNode += [key] +'="'+ customAttributes[key] +'" '; }
			var params = this.getParams();
			 for(var key in params){ axNode += [key] +'="'+ params[key] +'" '; }
			axNode += '/>';
		}
		else
		{
			// PC IE
			axNode = '<object id="'+ this.getAttribute('id') +'" classid="'+ this.getAttribute('classid') +'" codebase="'+ this.getAttribute('codebase') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" ';
			var customAttributes = this.getCustomAttributes();
			 for(var key in customAttributes){ axNode += [key] +'="'+ customAttributes[key] +'" '; }
			axNode += '><param name="src" value="'+ this.getAttribute('src') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 axNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			axNode += "</object>";
		}
		return axNode;
	},
	write: function(elementId){
		var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
		n.innerHTML = this.getActiveXHTML();
		return true;
	}
};

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var ActiveXObject = code.ActiveXObject;
