[jQuery] window focus blur flag

[jQuery] window focus blur flag


I'm working on a ajax-based application and have to know if a window
is focused or not.
When i try this in firefox or safari it works fine but when i try IE6
or IE7, the focus gets lost when clicking another element in the dom.
My doctype is XHTML Transitional.
My script:
var focusFlag = 1;
jQuery(window).bind("focus", function(event)
{
    focusFlag = 1;
});
jQuery(window).bind("blur", function(event)
{
    focusFlag = 0;
});
Does anyone know why this doesn't work for IE?