function runbottlecounter()
{
	setupZoom();
    startcount = 0.0;
	bags_increment = 1666.666666666667;
	oil_import_increment = 11.71;
	oil_consumed_increment = 23.941666666667;
	gas_consumed_increment = 449.798333333333;
	gas_consumed_world_increment = 95.521666666667;
	gas_produced_world_increment = 96.766666666667;
	waste_generated_increment = 0.795;
	bottles_increment = 69.4444;
	
    theCounter();
}



function ChangeValue(number)
{
	numberstring ="";
	var j=0;
	var i=0;

	while (number > 1)
	 { 
	    numberstring = (Math.round(number-0.5) % 10) + numberstring;
	    number= number / 10;
	    j++;
	    if (number > 1 && j==3) { 
			numberstring = "," + numberstring;
			j=0;}
	    i++;
	 }

	numberstring= " " + numberstring;
	 

}

	

function theCounter() 
{       
	startcount = startcount + 1.0;
	
	ChangeValue(startcount*bags_increment);

	myPlasticBagsP=document.getElementById("plastic_bags");
	myTextNode=myPlasticBagsP.childNodes[0];
	myTextNode.data=numberstring + " plastic bags have been consumed worldwide.";


	ChangeValue(startcount*oil_import_increment);

	myP=document.getElementById("barrels_oil_imported");
	myTextNode=myP.childNodes[0];
	myTextNode.data=numberstring + " barrels of oil have been imported into the US.";

	ChangeValue(startcount*oil_consumed_increment);

	myP=document.getElementById("barrels_oil_consumed");
	myTextNode=myP.childNodes[0];
	myTextNode.data=numberstring + " barrels of oil have been consumed in the US.";

	ChangeValue(startcount*gas_consumed_increment);

	myP=document.getElementById("gallons_gas_consumed");
	myTextNode=myP.childNodes[0];
	myTextNode.data=numberstring + " gallons of gasoline have been consumed by automobiles in the US.";

	ChangeValue(startcount*gas_consumed_world_increment);

	myP=document.getElementById("barrels_gas_consumed_worldwide");
	myTextNode=myP.childNodes[0];
	myTextNode.data=numberstring + " barrels of petroleum have been consumed worldwide.";

	ChangeValue(startcount*gas_produced_world_increment);

	myP=document.getElementById("barrels_gas_produced_worldwide");
	myTextNode=myP.childNodes[0];
	myTextNode.data=numberstring + " barrels of petroleum have been produced worldwide.";

	ChangeValue(startcount*waste_generated_increment);

	myP=document.getElementById("tons_waste_generated_us");
	myTextNode=myP.childNodes[0];
	myTextNode.data=numberstring + " tons of waste have been generated in the United States.";
	
	ChangeValue(startcount*bottles_increment);

	myP=document.getElementById("bottles_num");
	myTextNode=myP.childNodes[0];
	myTextNode.data=numberstring + " plastic bottles have been thrown away in the United States.";


	timerID = setTimeout("theCounter()",100);

}
window.onload = runbottlecounter;
