change  window to document

change  window to document