/*
 * blogplayer.js
 * Copyright (C) 2009
 * Author: Liao Chen <liao.chen@lightmaker.com>
 * Created: 2009-02-17
 */

var BlogPlayer =
{
	setFlashControl : function(id)
	{
		var datasource = new Array();
		
		// Is this <p> still used?
		
		$("p",("#" + id)).map(function()
		{
			datasource.push(escape(this.innerHTML));
		});
		
		$("img",("#" + id)).map(function()
		{
			datasource.push(escape(this.src));
		});
		
		// Added for use with the loading performance test
		
		$("a",("#" + id)).map(function()
		{
			datasource.push(escape(this.href));
		});
		
		swfobject.embedSWF(global_stylesheet_directory + "/swf/blogplayer.swf", id, "100%", "326", "9.0.0", global_stylesheet_directory + "/swf/expressinstall.swf", { DATASOURCE: datasource.join(",") });
	}
	
}

$(document).ready(function(e) {
	$(".BlogPlayer").each(function() {
		BlogPlayer.setFlashControl(this.id);
	});

});

