Example code so I can start explaining this problem:
5 2
In your place I would simply attach event onclick on each div. I think then Javascript or jQuery will automatically take into account zindex information and you will get event exactly on DIV where you clicked.