Fixed scrollTop and scrollLeft events, removed global vars