Line 25 is:
top = pos[1];
Turns out 'top' is one of those magically populated objects. In Firefox, you are allowed to assign to top and hence the demo works. In IE, it tells you that assignment is not implemented for that particular object.
In IE, alerting 'top' will show '[object]'. In Firefox, alerting 'top' will show '[object Window]'
If I change my code to use 'top_pos' instead of 'top', the demo works now.