document should be local variable not the windows

var should be always be there and mostly in cases of the general variables like document.