
function ObjectRewrite(URL, width, height, version, bgcolor, wmode, id) {
	this.defaultImage="";
	this.defaultImageAltText="";
	this.testForPlugin = false;
	this.hasPlugin = false;
	this.URL = URL;
	this.height = height;
	this.width = width;
	this.version = 7;
	this.objectHTML = "";
	if(version) {
		this.version = version;
	}
	this.bgcolor = "FFFFFF";
	if(bgcolor) {
		this.bgcolor = bgcolor;
	}
	this.wmode = "window";
	if(wmode) {
		this.wmode = wmode;
	}
	this.id = "__newObject__";
	if(id) {
		this.id = id;
	}
}
ObjectRewrite.prototype = {
	"prepForFlash": function() {
		this.objectHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + this.version + ',0,0,0" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '">';
		this.objectHTML += '<param name="allowScriptAccess" value="sameDomain" />';
		this.objectHTML += '<param name="movie" value="' + this.URL + '" />';
		this.objectHTML += '<param name="menu" value="false" />';
		this.objectHTML += '<param name="quality" value="best" />';
		this.objectHTML += '<param name="wmode" value="' + this.wmode + '" />';
		this.objectHTML += '<param name="bgcolor" value="#' + this.bgcolor + '" />';
		this.objectHTML += '<embed src="' + this.URL + '" quality="high" bgcolor="' + this.bgcolor + '" width="' + this.width + '" height="' + this.height + '" name="' + this.id + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		this.objectHTML += '</object>';
		if(this.testForPlugin) {
			this.testIfPlugin();
			if(!this.hasPlugin) {
				this.objectHTML = "<img src=\"" + this.defaultImage + "\" alt=\"" + this.defaultImageAltText + "\" />";
			}
		}
	},
	"testIfPlugin": function() {
		if(navigator.plugins && navigator.plugins.length) {
			var x = navigator.plugins["Shockwave Flash"];
			if(x) {
				this.hasPlugin = true;
			} else {
				this.hasPlugin = false;
			}
			if(navigator.plugins["Shockwave Flash 2.0"]) {
				this.hasPlugin = true;
			}
		} else if (navigator.mimeTypes && navigator.mimeTypes.length) {
			var x = navigator.mimeTypes['application/x-shockwave-flash'];
			if (x && x.enabledPlugin) {
				this.hasPlugin = true;
			} else {
				this.hasPlugin = false;
			}
		}else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0)) {
			if(!plugin) {
				this.hasPlugin = false;
			}else {
				this.hasPlugin = true;
			}
		}
	},
	"write": function() {
		document.open();
		document.write(this.objectHTML);
		document.close();
	},
	"default_Image": function(img, alt) {
		this.testForPlugin = true;
		this.defaultImage = img;
		this.defaultImageAltText = alt;
	},
	"getHTML": function() {
		return this.objectHTML;
	}
}