Change delay behavior. Should work flawlessly.
Remove console loggers for delay behavior.
New decision criteria to insert a window.
For details see
http://stackoverflow.com/questions/2407825/how-to-compare-two-elements-in-jquery