implementing load event for the document