var acumVirusGlobal;
var incVirusGlobal;
var secServidorGlobalIC = -1;
var acumVirusHoy;
var incVirusHoy;
var secServidor = -1;
 
$(document).ready(function() {
datos = "operacion=updateContadorGlobal";

    $.ajax({

                  type: "GET",

                  contentType: "application/x-www-form-urlencoded",

                  url: "http://www.cloudantivirus.com/contadores/ContadoresServlet",                               

                  async:false,

                  data: datos,

                  dataType: "script",
				  error: function( XMLHttpRequest, textStatus, errorThrown){
				  document.write("error"+textStatus+"<br>"+errorThrown);
				  },
				  success: function(msg){
   }


       });     
      });

	  
	  var pandaCollectiveIntellingenceUpdateInterval = 10000;     //cada segundo y medio

setInterval("updatePandaCollectiveIntelligence()",pandaCollectiveIntellingenceUpdateInterval);

 
function addCommas(param)
{

return param;
} 

function addCommas(nStr)
{

	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;


return nStr;
} 

function updatePandaCollectiveIntelligence(){ 

 

      if(secServidorGlobalIC != -1){

      

            secServidorGlobalIC = secServidorGlobalIC + 1;

            

            acumVirusGlobalTotalIC =  acumVirusGlobal + (incVirusGlobal*secServidorGlobalIC);

            

 $("#contadorAnalyzedViruses").fadeOut(1000, function () {
        $("#contadorAnalyzedViruses").fadeIn(1000);
            $('#contadorAnalyzedViruses').html(addCommas(Math.round(acumVirusGlobalTotalIC)));

      });

	

      }

}

 

