function CreateFlashObjects ()
{
	this.replaceFlash();
}

CreateFlashObjects.prototype.replaceFlash = function ()
{
	jQuery(".flash").each(function()
	{
		if (this.title != '')
		{
			var str = '<object ';

			str += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
			str += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ';
			str += 'align="top" ';

			str += 'width="'+this.getAttribute('width')+'" ';
			str += 'height="'+this.getAttribute('height')+'" ';
			str += 'id="'+this.id+'_embed" ';

			str += '>';

			str += '<param name="movie" value="'+this.getAttribute('title')+'" /> ';

			str += '<param name="quality" value="high" /> ';
			str += '<param name="scale" value="noscale" /> ';
			str += '<param name="salign" value="tl" /> ';
			str += '<param name="wmode" value="transparent" /> ';
			str += '<param name="allowFullScreen" value="true" /> ';
			str += '<param name="allowScriptAccess" value="always" /> ';

			str += '<embed ';
			str += 'type="application/x-shockwave-flash" ';
			str += 'pluginspage="http://www.macromedia.com/go/getflashplayer" ';
			str += 'allowScriptAccess="always" ';
			str += 'scale="noscale" ';
			str += 'quality="high" ';
			str += 'salign="tl" ';
			str += 'align="top" ';
			// str += 'wmode="transparent" ';
			str += 'allowFullScreen="true" ';

			str += 'src="'+this.getAttribute('title')+'" ';
			str += 'width="'+this.getAttribute('width')+'" ';
			str += 'height="'+this.getAttribute('height')+'" ';
			str += 'name="'+this.id+'_embed" ';

			str += 'allowScriptAccess="always" ';
			str += ' ></embed></object>';

			this.title = '';
			this.innerHTML = str;
		}  
	});

	jQuery(".virb_artist_player .marquee .track_name").css('display', 'block');
	jQuery(".virb_artist_player .marquee .artist_album_name").css('visibility','visible');
	jQuery(".virb_artist_player .marquee .loading_player").hide();
};

jQuery(document).ready(function()
{
	// alert(typeof window.createFlashObjects);
	if(typeof window.createFlashObjects == "undefined")
	{
		// Has Flash just not the right version
		if (hasProductInstall && !hasReqestedVersion)
		{
			jQuery(".loading_flash").hide();

			jQuery(".no_flash.upgrade").each(function()
			{
				jQuery(this).css('display','block');
			});
		}	
		else if (hasReqestedVersion)
		{
			if (jQuery('.not_allowed').length > 0)
			{
				jQuery('.not_allowed').each(function()
				{
					jQuery(this).css('display','block');
					playerId = this.id.replace('hide_','');
					// alert(playerId);
					jQuery('.rn_'+playerId).css('display','none');
				});
			}

			var createFlashObjects = new CreateFlashObjects();
		}
		// No Flash
		else
		{
			jQuery(".loading_flash").hide();

			jQuery(".no_flash.install").each(function()
			{
				jQuery(this).css('display','block');
			});
		}
	}
});