var objXmlhttp = false;

/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try
{
    objXmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
    try
    {
        objXmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (E)
    {
        objXmlhttp = false;
    }
}
@end @*/

if (!objXmlhttp && typeof XMLHttpRequest!='undefined') {
    try
    {
        objXmlhttp = new XMLHttpRequest();
    }
    catch (e)
    {
        objXmlhttp = false;
    }
}

if (!objXmlhttp && window.createRequest)
{
    try
    {
        objXmlhttp = window.createRequest();
    }
    catch (e)
    {
        objXmlhttp = false;
    }
}

if ( objXmlhttp && document.getElementById )
{
    setInterval("updateTracks()", 31000);
}

function updateTracks()
{
    objCurDate = new Date();

    if ( divRecentTracks = document.getElementById("recenttracks") )
    {
        objXmlhttp.open("GET", "recenttracks.php?d=" + objCurDate.getTime(), true);

        objXmlhttp.onreadystatechange = function ()
        {
            if ( objXmlhttp.readyState == 4 )
            {
                divRecentTracks.innerHTML = objXmlhttp.responseText;
            }
        }

        objXmlhttp.send(null);
    }
}
