xhReq = createXMLHttpRequest();
var syncTimer = null;
var timeoutTimer = null;

ajaxCaller.shouldDebug = false;
ajaxCaller.shouldMakeHeaderMap = false;

var REFRESH_PERIOD = 11000;

window.onload = function() {
  startPeriodicSync();
}

function startPeriodicSync() {
  stopPeriodicSync();
  syncTimer = setInterval(synchronise, REFRESH_PERIOD);
}

function stopPeriodicSync() {
  clearInterval(syncTimer);
}

function synchronise() {
	try{
		if( (undefined)!=chatPopupWindow && chatPopupWindow.closed == false) return;
	} catch (err){
		;
	}
	xhReq.open("GET", "/addon/bind.php", true);
	xhReq.onreadystatechange = function() {if (xhReq.readyState == 4){if (xhReq.responseText != '') eval(xhReq.responseText);}}
	xhReq.send(null);
    return;
}

