var changeTitle = function() {
this.title = function () {
var title = document.title;
document.title = (title == "hello" ? "" : "hello");
}
};
changeTitle.prototype.start = function() {
this.timer = setInterval(this.title, 1000);
};
changeTitle.prototype.stop = function() {
clearInterval(this.timer)
};
var timerTitle = new changeTitle();
window.onblur = function() {
timerTitle.start();
};
window.onfocus = function() {
timerTitle.stop();
};