function ObjectRewrite(URL, width, height, version, bgcolor, wmode, id, flashVars, testForPlugin) {
	this.defaultImage="";
	this.defaultImageAltText="";
	this.testForPlugin = testForPlugin;
	//this.hasPlugin = false;
	this.URL = URL;
	this.height = height;
	this.width = width;
	this.version = 7;
	this.objectHTML = "";
	this.flashVars = "";
	
	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="always" />';
		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="flashvars" value="' + this.flashVars + '" />';
		this.objectHTML += '<param name="wmode" value="' + this.wmode + '" />';
		this.objectHTML += '<param name="bgcolor" value="#' + this.bgcolor + '" />';
		this.objectHTML += '<embed flashVars="' + this.flashVars + '" src="' + this.URL + '" wmode="' + this.wmode + '" quality="high" bgcolor="' + this.bgcolor + '" width="' + this.width + '" height="' + this.height + '" name="' + this.id + '" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		this.objectHTML += '</object>';
		
		if(this.testForPlugin)
		 {
			var pluginVersion = this.testIfPlugin();
			if( ! pluginVersion || parseInt(pluginVersion) < parseInt(this.version) ) {
				this.objectHTML = '<div style="padding: 20px;">';
				this.objectHTML += '<p>You do not have the Flash plugin installed. <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Get it here</a>.</p>';
				this.objectHTML += '<p>If you are unable to get it, or choose not to, important site functionality will be unavailable.</p>';
				this.objectHTML += '</div>';
			}//*/
		}
	},
	"testIfPlugin": function() {
		var PlayerVersion = [];
		if(navigator.plugins && navigator.mimeTypes.length){
			var x = navigator.plugins["Shockwave Flash"];
			if(x && x.description) {
				PlayerVersion = x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".");
			}
		} else {
			try{
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}catch(e){
				try {
					var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					PlayerVersion = new flashVersion([6,0,21]);
					axo.AllowScriptAccess = "always";
				} catch(e) {
					if (PlayerVersion.major == 6) {
						return PlayerVersion;
					}
				}
				try {
					axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				} catch(e) {}
			}
			if (axo != null) {
				PlayerVersion = axo.GetVariable("$version").split(" ")[1].split(",");
			}
		}
		if( PlayerVersion[0] ) { 
			return PlayerVersion[0];
		} else {
			return false;
		}
	},
	"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);
		//alert(this.objectHTML);
		document.close();
	},
	"defaultImage": function(img, alt) {
		this.testForPlugin = true;
		this.defaultImage = img;
		this.defaultImageAltText = alt;
	},
	"getHTML": function() {
		return this.objectHTML;
	}
};