// this code is for the counter ===========================



// This next little bit of code tests whether the user accepts cookies.

var WM_acceptsCookies = false;

if(document.cookie == '') {

    document.cookie = 'WM_acceptsCookies=yes'; // Try to set a cookie.

    if(document.cookie.indexOf('WM_acceptsCookies=yes') != -1) {

	WM_acceptsCookies = true; 

    }// If it succeeds, set variable

} else { // there was already a cookie

  WM_acceptsCookies = true;

}



function WM_setCookie(name, value, path) {

    if (WM_acceptsCookies) { // Don't waste your time if the browser doesn't accept cookies.

	document.cookie = name + '=' + escape(value) + ((path)?';path=' + path:''); // Set the cookie, adding any parameters that were specified.

    }

} // WM_setCookie





function WM_readCookie(name) {

    if(document.cookie == '') { // there's no cookie, so go no further

	return false; 

    } else { // there is a cookie

	var firstChar, lastChar;

	var theBigCookie = document.cookie;

	firstChar = theBigCookie.indexOf(name);	// find the start of 'name'

	var NN2Hack = firstChar + name.length;

	if((firstChar != -1) && (theBigCookie.charAt(NN2Hack) == '=')) { // if you found the cookie

	    firstChar += name.length + 1; // skip 'name' and '='

	    lastChar = theBigCookie.indexOf(';', firstChar); // Find the end of the value string (i.e. the next ';').

	    if(lastChar == -1) lastChar = theBigCookie.length;

	    return unescape(theBigCookie.substring(firstChar, lastChar));

	} else { // If there was no cookie of that name, return false.

	    return false;

	}

    }	

} // WM_readCookie

function Comma(number) {
number = '' + number;
if (number.length > 3) {
var mod = number.length % 3;
var output = (mod > 0 ? (number.substring(0,mod)) : '');
for (i=0 ; i < Math.floor(number.length / 3); i++) {
if ((mod == 0) && (i == 0))
output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
else
output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
}
return (output);
}
else return number;
}



function start()

{

	if(document.cookie.indexOf("cookietime") == -1) {

		startdate = new Date();

		WM_setCookie("cookietime", startdate.getTime(), "/");

		}

	cookietime = WM_readCookie("cookietime");

	now();

}



function now()

{

	var startpopulation = 6016722474.0;

	var growthpercentage = 0.01387645;

	var bornpersecond = (startpopulation * growthpercentage)/365.0/24.0/60.0/60.0;

	currentdate = new Date ();

	basedate = new Date (2000,0,1);

    totalpop= (currentdate.getTime() - basedate.getTime())/1000*bornpersecond + startpopulation;

	totalpop=Math.round(totalpop);
	
	totalpop=Comma(totalpop);
	
	document.Values.Population.value =totalpop;
	
	
	
	secondsinsession = (currentdate.getTime() - cookietime)/1000;
	
	sessionpopulation = secondsinsession*bornpersecond;
	
	sessionpopulation = Math.round(sessionpopulation)+10000000000;
	
	sessionpopulation = sessionpopulation.toString();
	
	sessionpopulation = sessionpopulation.slice(1,11);
	
	sessionpopulation=Comma(sessionpopulation);
	
	document.Values.Netgrowth.value =sessionpopulation;
	

	the_timeout=setTimeout("now()",50);

}
