Google maps loading images like

I started to create a script that allows me to split a big image into small pieces,to zoom, drag , etc.

I want to know what are the possibilities to load the small images just in the active area like in Google Maps (visible). I thought to try to determine the approximate location of one element with some calcules and to determine the element with document.elementFromPoint, but it’s not a cross browser solution.

Another solution could be: loading from the beginning just the images from active area and when the user drag or zoom the script must calculate the elements that are new in active area.

see here what I mean active and inactive area:

PS: I searched the entire site but I did not found an answer. I read also this topic : How does Google Maps work? , but I would like to develop myself the script. (I don’t need the complexity of Google Maps, just few features)