var isIE = (navigator.appName == "Microsoft Internet Explorer");
var hasFocus = true;
var active_element;

function setFocusEvents()	{
	if(navigator.userAgent.indexOf('MSIE 6') == -1 || navigator.userAgent.indexOf('Chrome') == -1){
		active_element = document.activeElement;
		
		if (isIE)	{
			document.onfocusout = function() {	swfBlur();	      }
			document.onfocusin = function()	 {	swfFocus();     }
		}	else	{
			window.onblur = function()	  {	swfBlur();	         }
			window.onfocus = function()	 {	swfFocus();       }
		}
	}
}

function swfFocus()	{
	if(navigator.userAgent.indexOf('MSIE 6') == -1 || navigator.userAgent.indexOf('Chrome') == -1){
		hasFocus = true;
		//
		try{
			var site_obj = swfobject.getObjectById("dream_loader");
			site_obj.siteFocus();
		} catch(err){
			//
		}
	}
}

function swfBlur()	{
	if(navigator.userAgent.indexOf('MSIE 6') == -1 || navigator.userAgent.indexOf('Chrome') == -1){
		if (active_element != document.activeElement) {
			active_element = document.activeElement;
			//return;
		}
		hasFocus = false;
		//
		try{
			var site_obj = swfobject.getObjectById("dream_loader");
			site_obj.siteBlur();
		} catch(err){
			//
		 }
	}
}