
/*
* World Populution Counter - By JavaScript Kit (http://www.javascriptkit.com)
* Based on code by Adam Brown
* This notice MUST stay intact for use
* Visit JavaScript Kit (http://www.javascriptkit.com) for this script and more
*/

function maind(){
	// alert ('test')
	startdate = new Date()
	now(startdate.getYear(),startdate.getMonth(),startdate.getDate(),startdate.getHours(),startdate.getMinutes(),startdate.getSeconds())
}


function ChangeValue(number,pv){
	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

if (pv==1) {document.getElementById("worldpop").innerHTML= "Population Clock: " + numberstring }
}


function now(year,month,date,hours,minutes,seconds){       
startdatum = new Date(year,month,date,hours,minutes,seconds)
// 1st march 2007 1131043000.0
// 1st march 2008 1147677000.0
//var now = 1100000000.0
//var now2 = 1120000000.0

// was put on the site around february 2007, source website population projection for 2006-2007-2008
// 1st march 2007 1131043000.0
// 1st march 2008 1147677000.0
// var now = 1131043000.0
// var now2 = 1147677000.0

// as per Census population report - table no. 8
// 1st march 2001 1028610000.0
// 1st march 2007 1128521000.0

var nowThisYear = 1128521000.0
var nowNextYear = 1144734000.0
// 2008 march - var now2 = 1144734000.0

var populationDiff = (nowNextYear - nowThisYear) / nowThisYear * 100
var populationPerSecond = ( (nowThisYear * (populationDiff/100) ) /365.0/24.0/60.0/60.0  )
nu = new Date ()                
schuldstartdatum = new Date (2007,2,1,12,0,0)
secondenoppagina = (nu.getTime() - startdatum.getTime())/1000

diffInDays = secondenoppagina / 60.0 / 60.0 / 24.0
totaleschuld= (nu.getTime() - schuldstartdatum.getTime())/1000*populationPerSecond + nowThisYear
//window.status = totaleschuld + " / c/s. " + populationPerSecond + "c/m. " + (populationPerSecond*60) + " start date/time " + schuldstartdatum;
ChangeValue(totaleschuld,1);

timerID = setTimeout("now(startdatum.getYear(),startdatum.getMonth(),startdatum.getDate(),startdatum.getHours(),startdatum.getMinutes(),startdatum.getSeconds())",200)
}

//window.onload=maind
