function HorizontalPositionCache(getElement) { var t = this, elements = {}, lefts = {}, rights = {}; function e(i) { return (elements[i] = (elements[i] || getElement(i))); } t.left = function(i) { return (lefts[i] = (lefts[i] === undefined ? e(i).position().left : lefts[i])); }; t.right = function(i) { return (rights[i] = (rights[i] === undefined ? t.left(i) + e(i).width() : rights[i])); }; t.clear = function() { elements = {}; lefts = {}; rights = {}; }; }