I'm having trouble with Global variables in Javascript. From every article I've read a variable declared out of a function has a complete scope. But bellow;
var leftMargin = 36;
alert(leftMargin); /* '36' */
function position(direction) {
alert(leftMargin); /* 'undefined' */
}