I understand everything said and asked except what the meaning of your grid array is.
Is that supposed to mean that the overlay <div> is divided into 3 rows of 4 columns each?
If so, are you wanting the JS code to automatically calculate the size of each cell in the grid?
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.