
function generateFlashObject(url, id, width, height, oContainer, bReturn, Style, OtherAttributes, bUseCodeBase, quality, wmode, avatarParams) {
	var VERSION_NUM=0;
	if (! url) return false; //URL required
	if (! id) id="oAvatarControl";
	//== null might be better, mal didnt bother to find out
	if ( bUseCodeBase === true){bUseCodeBase=true;}else{bUseCodeBase=false;}
	if (! quality) quality="high";
	if (! wmode) wmode="Transparent";
	
	if(url.indexOf('?')==-1){
		url+='?';
	}
	url+='&V='+VERSION_NUM;
	
	var html="";
	html+='<object id="'+id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
	if ( bUseCodeBase ){
		html+=' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"';
	} else {
		html+=' codebase="#version=8,0,0,0"';
	}//end if

	html += ' align="middle"';
	
	html += ' onerror="if ( typeof(generateFlashObjectError) == \'function\' ) generateFlashObjectError();return false;"';
	/*
	if ( typeof(generateFlashObjectError) == "function" ){
		html += ' onerror="generateFlashObjectError(\"' + id + '\");"';
	}//end if
	*/
	if (width) html+=' width="'+width+'"';
	if (height) html+=' height="'+height+'"';
	if (null != Style)
		html+=Style;
	if (null != OtherAttributes)
		html+=OtherAttributes;
	html+='>';

	html+='<param name="movie" value="'+url+'">';
	html+='<param name="WMode" value="'+wmode+'">';
	html+='<param name="allowScriptAccess" value="always">';
	html+='<param name="quality" value="'+quality+'">';
	html+='<param name="menu" value="0">';
	html+='<param name="play" value="false">';
	html+='<param name="salign" value="tl">';
	if (avatarParams) html+='<param name="FlashVars" value="'+avatarParams+'">';
	
	var NAV_IE=(navigator.appName.search(/microsoft internet explorer/i)>-1)?true:false;
	
	if (! NAV_IE) {
		html+='<embed src="'+url+'" play="false" menu="false" quality="'+quality+'" wmode="'+wmode+'"';
		if (width) html+=' width="'+width+'"';
		if (height) html+=' height="'+height+'"';
		if (avatarParams) html+=' FlashVars="'+avatarParams+'"';
		html+=' name="'+id+'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	}
	
	html+='</object>';
	if (oContainer) {
		oContainer.innerHTML = html;
	} else if (bReturn) {
		return html;
	} else {
		document.write(html);	
	}
}

function generateExternalObject( html ) {
	document.write( html );
}