I'm not quite sure there is enough detail to understand what you're doing. My understanding is that you are dropping images over a div, and then the div contains that image. And you only want images to be dropped over the div itself, not over other images?
What you are then talking about is event bubbling. Event bubbling is when child elements inherit event handlers of their parents, which you don't want. In which case, you can use addEventListener and set the third value to false.
// watch the false!
document.getElementById("top").addEventListener("drop", drop, false);