function writeTunerEmbed(tunerWidth, tunerHeight, tunerUrl, tunerVars, disableFragments) {
	if (disableFragments) {
		tunerVars += "&_tunervar_frag=" + escape("#-");
	} else {
		var hash = getLocationHash();
		if (hash != "" && hash != "#") {
			// lame but extremely backward compatible mechanism for
			// escaping plus signs, since the escape method doesn't always do that.
			while (hash.indexOf("+") != -1) {
				hash = hash.replace("+", "%20");
			}
			hash = escape(hash);
			tunerVars += "&_tunervar_frag=" + hash;
		}

		if (navigator.userAgent.match(/MSIE 6/)) { // javascript: URLs + location.hash == bad in IE6
			tunerVars += "&_tunervar_useFSCommand=1";
		}
	}
	
	var lines = [];
	// don't use lines.push() because some browsers don't support it.  (!!!)

	// the "radio" name and id are required for the successful use of FSCommand (see tuner.js)
	
	lines[lines.length] = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	lines[lines.length] = '		codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"';
	lines[lines.length] = '		WIDTH="' + tunerWidth + '"';
	lines[lines.length] = '		HEIGHT="' + tunerHeight + '"';
	lines[lines.length] = '		id="radio">';
	lines[lines.length] = '	<PARAM NAME=movie VALUE="' + tunerUrl + '">';
	lines[lines.length] = '	<PARAM NAME=quality VALUE=high>';
	lines[lines.length] = '	<PARAM NAME=bgcolor VALUE=#FFFFFF>';
	lines[lines.length] = '	<PARAM NAME=allowscriptaccess VALUE=always>';
	lines[lines.length] = '	<PARAM NAME=menu VALUE=false>';
	lines[lines.length] = ' <PARAM NAME="FlashVars" VALUE="' + tunerVars + '">';
	lines[lines.length] = '<EMBED src="' + tunerUrl + '"';
	lines[lines.length] = ' quality=high';
	lines[lines.length] = ' bgcolor=#FFFFFF';
	lines[lines.length] = ' allowscriptaccess=always';
	lines[lines.length] = ' WIDTH="' + tunerWidth + '"';
	lines[lines.length] = ' HEIGHT="' + tunerHeight + '"';
	lines[lines.length] = ' MENU="false"';
	lines[lines.length] = ' NAME="radio" ALIGN="" TYPE="application/x-shockwave-flash"';
	lines[lines.length] = ' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"';
	lines[lines.length] = ' FlashVars="' + tunerVars + '">';
	lines[lines.length] = '</EMBED>';
	lines[lines.length] = '</OBJECT>';
	document.write(lines.join(""));
}

// tunerWidth, -Height, -Url, and -Vars are previously defined.
// watch out for RADIO-5245 -- the following lines are best kept in this file.
var ua = navigator.userAgent;
if (ua.match(/AOL 9/)) {
	tunerVars += "&_tunervar_unsupported=true";
}
writeTunerEmbed(window.tunerWidth, window.tunerHeight, window.tunerUrl, window.tunerVars, window.disableFragments);
