﻿// Developed by Lokesh Goyal

function getXMLHTTP( ) 
{
    var XMLHTTP = null;
    if (window.ActiveXObject) 
    {
        try 
        {
            XMLHTTP = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (e) 
        {
            try 
            {
                XMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    } 
    else if (window.XMLHttpRequest) 
    {
        try 
        {
            XMLHTTP = new XMLHttpRequest( );
        } catch (e) {}
    }
    return XMLHTTP;
}
var XMLHTTP;
var imgChat;
function checkSupport()
{
    imgChat=document.getElementById("imgChat");
    if(imgChat)
    {
        try
        {
            if(!XMLHTTP)
                XMLHTTP=getXMLHTTP();
            var url="Support.ashx";
            XMLHTTP.open("POST",url,true);
            XMLHTTP.onreadystatechange=function(){
                if(XMLHTTP.readyState==4 && XMLHTTP.status==200)
                {
//                    if(XMLHTTP.responseText=="1")
//                        imgChat.src=imgChat.src.substring(0,imgChat.src.lastIndexOf("/")+1)+"141x44-online.gif";
//                    else
//                        imgChat.src=imgChat.src.substring(0,imgChat.src.lastIndexOf("/")+1)+"141x44-offline.gif";                    
                        imgChat.src=imgChat.src;
                } 
            };
            XMLHTTP.send(null);
         }
         catch(ex)
         {
            alert(ex.message);
         }
    }
}

window.setInterval("checkSupport()",10000);