Changed "document" var to "newDoc", added alerts for left offset