should just be `function boxLen(direction){` (i.e., no need for `var` here).