function TS_IniciarContador()
{
    setInterval( "TS_Contar()", 1000 );
}


function TS_Contar()
{
    var str_URLContador = window.location.href.replace( "index.php", "contador.php" );

    var TS_xmlHttp = TS_GetXmlHttpObject() ;
    TS_xmlHttp.open( "GET", str_URLContador , true );
    TS_xmlHttp.send( null );
}


function TS_GetXmlHttpObject()
{
    var obj_XmlHttp = null;

    if ( navigator.userAgent.indexOf("Opera") >= 0 )
    {
        alert( "This example doesn't work in Opera" );
        return;
    }

    if ( navigator.userAgent.indexOf( "MSIE" ) >= 0 )
    {
        var str_Nome = "Msxml2.XMLHTTP";

        if ( navigator.appVersion.indexOf( "MSIE 5.5" ) >= 0 )
        {
            str_Nome = "Microsoft.XMLHTTP";
        }

        try
        {
            obj_XmlHttp = new ActiveXObject( str_Nome );
            //obj_XmlHttp.onreadystatechange = fnc_handler;

            return ( obj_XmlHttp );
        }
        catch( e )
        {
            alert( "Error. Scripting for ActiveX might be disabled" );
            return;
        }
    }

    if ( navigator.userAgent.indexOf( "Mozilla" ) >= 0 )
    {
        obj_XmlHttp = new XMLHttpRequest();

        //obj_XmlHttp.onload  = fnc_handler;
        //obj_XmlHttp.onerror = fnc_handler;

        return ( obj_XmlHttp );
    }
}
