/**************************************************************************
/* JS Window Focus
/*
/* Written by Cary Buchmann. (cjbuchmann)
/*
/* Detect when a user has the page focused and when he has it blurred.
/* This is useful, so that we can limit resources if a user isn't on the
/* page.
/*************************************************************************/

function JSWindowFocus()
{

	this.currentFocus = true;
	
	var _this = this;
	
	this.init = function()
	{
				
		window.onFocus = function(){
			_this.currentFocus = true;
		};
		
		window.onBlur = function(){
			_this.currentFocus = false;
		};
		
		window.onfocus = onFocus;
		window.onblur = onBlur;
	}
	
	this.isFocused = function()
	{
		return _this.currentFocus;
	}
}
