Ext.EventManager.on(window, "load", function() {
	Ext.select(".expandable").each(function(e) {
		var ct = e.parent(), e = Ext.get(e.dom);
		if(e.first().getHeight() > e.getHeight()) {
			// The body of the expandable is overflowing. Show the
			// link.
			ct.select(".expand-link").on("click", function(ev, a) {
				e.setStyle("max-height", "none");
				e.removeClass("expandable");
				Ext.fly(a).setVisible(false, true);
			}, null, { stopEvent: true });
		} else {
			ct.select(".expand-link").setVisible(false);
			e.removeClass("expandable");
		}
	});
});

