var focus = 1;
var defaultTitle = document.title;
window.onblur = function() {
focus = 0;
migalka();
};
window.onfocus = function() {
focus = 1;
};
function migalka() {
if (focus) {
document.title = defaultTitle;
return;
}
document.title = (document.title == 'НЕТ ФОКУСА') ? 'МИГАЮ': 'НЕТ ФОКУСА';
setTimeout(migalka, 1000);
}