function attachimg(obj, action) {
	if(action == 'load') {
		if(is_ie && is_ie < 7) {
			var objinfo = fetchOffset(obj);
			msgwidth = document.body.clientWidth - objinfo['left'] - 20 - 300;
		} else {
			if(!msgwidth) {
				var re = /postcontent|message/i;
				var testobj = obj;
				while((testobj = testobj.parentNode) != null) {
					var matches = re.exec(testobj.className);
					if(matches != null) {
						msgwidth = testobj.clientWidth - 20;
						break;
					}
				}
				if(msgwidth < 1) {
					msgwidth = window.screen.width;
				}
			}
		}
		if(obj.width > msgwidth) {
			obj.resized = true;
			obj.width = msgwidth;
			obj.style.cursor = 'pointer';
		} else {
			obj.onclick = null;
		}
	} else if(action == 'mouseover') {
		if(obj.resized) {
			obj.style.cursor = 'pointer';
		}
	}
}

function fetchOffset(obj) {
	var left_offset = obj.offsetLeft;
	var top_offset = obj.offsetTop;
	while((obj = obj.offsetParent) != null) {
		left_offset += obj.offsetLeft;
		top_offset += obj.offsetTop;
	}
	return { 'left' : left_offset, 'top' : top_offset };
}