
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 + '" wmode="' + this.wmode + '" 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;
			}
		}
	},
	"prepForWindowsMedia": function(AutoPlay, ViewControls, ShowStatusBar) {
		this.AutoPlay = true;
		if(AutoPlay) {
			this.AutoPlay = AutoPlay;
		}
		this.ViewControls = true;
		if(ViewControls) {
			this.ViewControls = ViewControls;
		}
		this.ShowStatusBar = true;
		if(ShowStatusBar) {
			this.ShowStatusBar = ShowStatusBar;
		}
		this.objectHTML = '<object id="MediaPlayer" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Media Player" type="application/x-oleobject"	width="' + this.width + '" height="' + this.height + '">';
		this.objectHTML += '<param name="FileName" value="' + this.URL + '" />';
		this.objectHTML += '<param name="AutoStart" value="' + this.AutoPlay + '" />';
		this.objectHTML += '<param name="ShowControls" value="' + this.ViewControls + '" />';
		this.objectHTML += '<param name="ShowStatusBar" value="' + this.ShowStatusBar + '" />';
		this.objectHTML += '<embed type="application/x-mplayer2" src="' + this.URL + '" width="' + this.width + '" height="' + this.height + '" name="MediaPlayer" autostart="' + this.AutoPlay + '" ShowStatusBar="' + this.ShowStatusBar + '" ShowControls="' + this.ViewControls + '" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" />';
		this.objectHTML += '</object>';
	},
	"prepForRealPlayer": function(AutoPlay, Controls) {
		this.AutoPlay = true;
		if(AutoPlay) {
			this.AutoPlay = AutoPlay;
		}
		this.Controls = "ImageWindow,ControlPanel";
		if(Controls) {
			this.Controls = Controls;
		}
		this.objectHTML = '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" type="audio/x-pn-realaudio-plugin" width="' + this.width + '" height="' + this.height + '">';
		this.objectHTML += '<param name="src" value="' + this.URL + '" />';
		this.objectHTML += '<param name="AutoStart" value="' + this.AutoPlay + '" />';
		this.objectHTML += '<param name="controls" value="' + this.Controls + '" />';
		this.objectHTML += '<param name="console" value="one" />';
		this.objectHTML += '<param name="nojava" value="true" />';
		this.objectHTML += '<embed src="' + this.URL + '" width="' + this.width + '" height="' + this.height + '" nojava="true" controls="' + this.Controls + '" console="one" autostart="' + this.AutoPlay + '" pluginspage="http://www.real.com/player/" type="audio/x-pn-realaudio-plugin" />';
		this.objectHTML += '</object>';
	},
	"prepForQuickTime": 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>';
		*/
	},
	"write": function() {
		document.open();
		document.write(this.objectHTML);
		document.close();
	},
	"defaultImage": function(img, alt) {
		this.testForPlugin = true;
		this.defaultImage = img;
		this.defaultImageAltText = alt;
	},
	"getHTML": function() {
		return this.objectHTML;
	}
}