﻿var timerID = setInterval("count()",5000);
var xmlHttp=null;
function count() {
        //alert("sdlf");
        xmlHttp = createXMLHttpRequest();
        xmlHttp.onreadystatechange = state_Change;
        xmlHttp.open("get","Handler.ashx?CheckLogin="+new Date(),true);
        xmlHttp.send(null);
}
function createXMLHttpRequest()
 {
    if(window.ActiveXObject)
     {
         xmlHttp = new  ActiveXObject("microsoft.XMLHTTP")
     }
    else if (window.XMLHttpRequest)
     {
        xmlHttp = new XMLHttpRequest(); 
     }
         return xmlHttp;
 }
 
 
 function state_Change()
{
    if (xmlHttp.readyState==4)
      {
          if (xmlHttp.status==200){           
                if(xmlHttp.responseText=='no'){
                    window.clearInterval(timerID);
                }
            }
      }
}

