/* found online altered by Boz */
jQuery.fn.imageReplace = function(post, pre, onload)
{
	if(!document.images) return this;
	pre = pre || "";
	this.each(
		function()
		{
			var img = $("<img>"), el = jQuery(this);
			if(!el.hasClass('iReplaced')) {
				var file;
				var re = /(?:{src\:)(\S+)(?:})/i;
				var m = this.className.match(re);
				if(m)
				{
					file = pre + m[1];
				}
				else
				{
					file = pre + el.text() + post;
				}
				
				jQuery(img).attr(
				{
					src: file,
					alt: el.text()
				}).load(typeof onload == "function" ? onload : function(){} );
				var a = el.find("a");
				var toAppend = a.length ? a.empty().append(img) : img;
				el.empty().append(toAppend).addClass('iReplaced');
			}
		}
	)
	return this;
}