Event.observe(window, "load", function() {
	$$("a.external").each(function(s) {
		s.target = "_blank";
	});
	
	// go through all images with alt texts & a caption class, and replace em
	// this is to work around FCK being rather hopeless at letting us do this
	// in the editor.
	// so the replacement doesn't cause any nasty flicker, make sure the original
	// class you're replacing is either the same as the one you replace with, or
	// at least has the same styles applied to it
	$$("img.image-left-caption").each(function(s) {
		if (s.alt != "") {  // this image has alt text, so fits the bill
		
			// make a new div and put the image & caption in it
			var div = new Element("div", {'class':'image-left-caption'}).update(
				'<img src="'+s.src+' alt="'+s.alt+'" /> ' +
				'<p>'+s.alt+'</p>'
			);

			// replace this image with that div
			s.replace(div);
		}
	});
});
