function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func
  }
  else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(setImageFloatRightWidth);

function setImageFloatRightWidth() {
	if (!document.getElementsByTagName) return false;	
	var elements = document.getElementsByTagName("div");
	for (var i=0; i < elements.length; i ++) {
		div = elements[i]
		if (div.className == "img_float_right") {
			children = div.childNodes
			for (var x=0; x < children.length; x ++) {
				child = children[x];
				if (child.nodeName == 'IMG') {
					img_width = child.getAttribute("width")
					div.style.width = img_width + "px"
				}
			}
		}
	}
}