var JCaption=new Class({initialize:function(c){this.selector=c;var d=$$(c);d.each(function(a){this.createCaption(a)},this)},createCaption:function(l){var g=document.createTextNode(l.title);var h=document.createElement("div");var j=document.createElement("p");var k=l.getAttribute("width");var i=l.getAttribute("align");if(!k){k=l.width}if(!i){i=l.getStyle("float")}if(!i){i=l.style.styleFloat}if(i==""){i="none"}j.appendChild(g);j.className=this.selector.replace(".","_");l.parentNode.insertBefore(h,l);h.appendChild(l);if(l.title!=""){h.appendChild(j)}h.className=this.selector.replace(".","_");h.className=h.className+" "+i;h.setAttribute("style","float:"+i);h.style.width=k+"px"}});document.caption=null;window.addEvent("load",function(){var b=new JCaption("img.caption");document.caption=b});
