
$(function() {
	$("a.flash").each(function () {
		var obj = $(this);
		var img = obj.children("img");
		
		obj.attr("id", getUniqueId());
		swfobject.embedSWF(obj.attr("href"), obj.attr("id"), img.width(), img.height(), "9.0.0", false, false, { wmode: "opaque" });
	});
});

function getUniqueId()
{
	var chars = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789";
	var out = "";
	
	while(true)
	{
		while(out.length < 32)
			out += chars[getRandom(0, chars.length)];
		
		if(document.getElementById(out) == null)
			break;
	}
	
	return out;
}

function getRandom(low, high)
{
	return Math.floor((high - low - 1) * Math.random()) + low;
}
