/**
 * @author jmcardle
 */

$(document).ready(replaceVideo);

function replaceVideo()
{
	if($('.swf').length > 0)
	{
		$('.swf').each(injectVideo);
	}
}

function injectVideo(i,obj)
{
	var opts	= $(obj).text().split(',');
	var src		= opts[0];
	var h		= opts[1].split('=')[1];
	var w		= opts[2].split('=')[1];
	var f_var	= '';
	
	if(opts.length > 3)
	{
		f_var = opts[3];
	}
	
	$(obj).html('');
	$(obj).flash({swf:src,height:h,width:w,flashvars:f_var});
	$(obj).show();
}
