	function WriteObject(type, width, height, movie, id) {
		this.width = width;
		this.height = height;
		this.movie = movie;
		this.id = id;
		this.classid = new String;
		this.codebase = new String;
		this.archive = new String;
		this.codetype = new String;
		this.data = new String;
		this.declare = new String;
		this.name = new String;
		this.standby = new String;
		this.etc = new String;
		this.tagParm = new String;
		this.tagEmbed = new String;
		this._output = new String;
		switch (type) {
			case "flash":
				this.classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
				this.codebase = "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0";
				break;
			case "movie":
			default:
				this.classid = "";
				this.codebase = "";
		}
	}

	WriteObject.prototype.addParam = function (sName, sValue) {
		if (sValue == undefined) {
			this.tagParam += sName;
			this.tagEmbed += sName;
		} else {
			this.tagParam += '<param name="' + sName + '" value="' + sValue + '" />';
			this.tagEmbed += ' ' + sName + '="' + sValue + '"';
		}
	}

	WriteObject.prototype._print = function () {
		document.write(this.fetch());
	}

	WriteObject.prototype.fetch = function () {
		var sTmpEmbed = '<embed width="' + this.width + '" height="' + this.height + '"';
		if (this.classid != "") {
			this._output = '<object classid="'+ this.classid + '" codebase="' + this.codebase + '" width="' + this.width + '" height="' + this.height +'" ';

			if (this.id != "" && this.id != undefined)
				this._output += 'id="' + this.id + '" />';
			else
				this._output += '>';
		}

		if (this.movie != "" && this.movie != undefined) {
			this._output += '<param name="movie" value="' + this.movie + '" />';
			sTmpEmbed += ' src="' + this.movie + '"';
		}

		if (this.classid != "") this._output += this.tagParam;
		this._output += sTmpEmbed;
		this._output += this.tagEmbed;
		this._output += ' />';

		if (this.classid != "") {
			this._output += '</object>';
		}

		return this._output;
	}

	function InsertFlash(movie, width, height, id, wmode, auto) {
		this.WObject = new WriteObject("flash", width, height, movie, id);
		if (wmode != "" && wmode != undefined) {
			this.WObject.addParam("wmode", wmode);
		}
		if (auto == "Y")
			this.WObject._print();
	}

	function InsertMovie(movie, width, height,  id, autostart, auto) {
		this.WObject = new WriteObject("movie", width, height, movie, id);
		if (autostart != "" && autostart != undefined) {
			this.WObject.addParam("autostart", autostart);
		}
		if (auto == "Y")
			this.WObject._print();
	}

	function insertObject(str) {
		document.write(str);
	}

	/*
	if ( typeof(window.attachEvent) == "object" ) {
		window.attachEvent('onload', function() {
			// ie only
			var objs = document.all.tags('OBJECT');
			var embs = document.all.tags('EMBED');
			for (var i=0,cnt=objs.length; i<cnt; i++)
				objs[i].outerHTML = objs[i].outerHTML;
			for (var i=0,cnt=embs.length; i<cnt; i++)
				embs[i].outerHTML = embs[i].outerHTML;
		} );
	}
	*/