if (Array.prototype.push == null) {
	Array.prototype.push = function(val){
		this[this.length] = val;
		return this.length;
	};
}
function ePluginObject(_id, _src, _type, _w, _h, _classid, _codebase, _pluginspage, _title, _alt, _bgcolor, _align, _hspace, _vspace) {
	if (!document.getElementById) return;
	this._commonAttribs = new Array();
	this._objectOnlyAttribs = new Array();
	this._embedOnlyAttribs = new Array();
	this._commonParams = new Array();
	if (_id) this.addProp(this._commonAttribs, "id", _id);
	if (_src) this.addProp(this._commonParams, "src", _src);
	if (_type) this.addProp(this._commonParams, "type", _type);
	if (_w) this.addProp(this._commonAttribs, "width", _w);
	if (_h) this.addProp(this._commonAttribs, "height", _h);
	if (_classid) this.addProp(this._objectOnlyAttribs, "classid", _classid);
	if (_codebase) this.addProp(this._objectOnlyAttribs, "codebase", _codebase);
	if (_pluginspage) this.addProp(this._embedOnlyAttribs, "pluginspage", _pluginspage);
	if (_title) this.addProp(this._commonAttribs, "title", _title);
	if (_alt) this.addProp(this._commonAttribs, "alt", _alt);
	if (_bgcolor) this.addProp(this._commonParams, "bgcolor", _bgcolor);
	if (_align) this.addProp(this._commonAttribs, "align", _align);
	if (_hspace) this.addProp(this._commonAttribs, "hspace", _hspace);
	if (_vspace) this.addProp(this._commonAttribs, "vspace", _vspace);
}
ePluginObject.prototype.prefix = "_pio_";
ePluginObject.prototype.addProp = function(_dest, _key, _value) {_dest[this.prefix + _key] = _value;}
ePluginObject.prototype.addVar = function(_key, _value) {this.addProp(this._commonParams, _key, _value);}
ePluginObject.prototype.getEmbedAttribs = function() {
	var _result = "";
	var _key;
	for (_key in this._commonAttribs) if (_key.indexOf(this.prefix) ==0) _result += "\n\t" + _key.substr(5) + "=\"" + this._commonAttribs[_key] + "\"";
	for (_key in this._embedOnlyAttribs) if (_key.indexOf(this.prefix) ==0) _result += "\n\t" + _key.substr(5) + "=\"" + this._embedOnlyAttribs[_key] + "\"";
	for (_key in this._commonParams) if (_key.indexOf(this.prefix) ==0) _result += "\n\t" + _key.substr(5) + "=\"" + this._commonParams[_key] + "\"";
	return _result;
}
ePluginObject.prototype.getObjectAttribs = function() {
	var _result = new Array();
	var _key;
	for (_key in this._commonAttribs) if (_key.indexOf(this.prefix) ==0) _result += "\n\t" + _key.substr(5) + "=\"" + this._commonAttribs[_key] + "\"";
	for (_key in this._objectOnlyAttribs) if (_key.indexOf(this.prefix) ==0) _result += "\n\t" + _key.substr(5) + "=\"" + this._objectOnlyAttribs[_key] + "\"";
	return _result;
}
ePluginObject.prototype.getObjectParams = function() {
	var _result = new Array();
	var _key;
	for (_key in this._commonParams) if (_key.indexOf(this.prefix) ==0) _result += "\n\t" + "<param name=\""+ _key.substr(5) + "\" value=\"" + this._commonParams[_key] + "\" />";
	return _result;
}
ePluginObject.prototype.setDetectInstalled = function(_pluginname, _notInstalledMsg) {
	if (_pluginname) this._pluginname = _pluginname;
	if (_notInstalledMsg) this._notInstalledMsg = _notInstalledMsg;
}
ePluginObject.prototype.getHTML = function() {
	var _result = "";
	var _key;
	if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
		_result = "<embed" + this.getEmbedAttribs() + ">\n</embed>";
	} else {
		_result += "<object" + this.getObjectAttribs() + ">";
		_result += this.getObjectParams();
		_result += "\n</object>";
	}
	return _result;
}
ePluginObject.prototype.detectInstalled = function() {
	if (typeof this._pluginname == "undefined") return true;
	if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
		_result = false;
		for (i = 0 ; i < navigator.plugins.length; i++ ) {
			if (navigator.plugins[i].name.indexOf(this._pluginname) == 0) {
				_result = true;
				break;
			}
		}
		return _result;
	} else return true; // return true for MSIE as plugin are automatically installed
}
ePluginObject.prototype.display = function(_container) {
	var _ctn = (typeof _container == "string") ? document.getElementById(_container) : _container;
	if (this.detectInstalled()) _ctn.innerHTML = this.getHTML();
	else _ctn.innerHTML = this._notInstalledMsg;
}
