// JavaScript Document
// CREDITS:
// Realtime Death Counter 2.01
// By Peter Gehrig
// Copyright (c) 2003 Peter Gehrig. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.24fun.com
// info@24fun.com
// 10/6/2003
// The script is based on statistics by World Health Organisation
// IMPORTANT:
// If you add this script to a script-library or script-archive
// you have to add a highly visible link to
// http://www.24fun.com on the webpage
// where this script will be featured
var cause=new Array()
// delete or add new death-causes like this: 
// cause[x]="cause of death|number of deaths per year"

cause[0]="Infectious and parasitic diseases|10937452"
cause[1]="AIDS|2865804"
cause[2]="Childhood-cluster diseases|1318151"
cause[3]="Dengue|21170"
cause[4]="Low birth weight|1345471"
cause[5]="Protein-energy malnutrition|257530"
cause[6]="Vitamin A deficiency|28358"
cause[7]="Cancers|7114896"
cause[8]="Breast cancer|478687"
cause[9]="Leukaemia|260341"
cause[10]="Violence|500487"
cause[11]="War|229598"



// do not edit below this line
var t = 0
var enterTime = new Date()
var enterTime = Math.floor(enterTime.getTime()/1000)
var secyear=31536000
var rowflag=false
var i_causes=0

if (document.getElementById) {
	initdisplay()
}

/*function initdisplay() {
	
	document.write('<table class="fondo" bgcolor="'+bg+'">')
	document.write('<tr valign=top>')
	document.write('<td colspan=4 style="font-family:'+titlefont+';font-size:'+titlesize+'pt;color:'+titlecolor+';background-color:'+titlebg+'" id="titlecell" align=center>')
	document.write('Deaths within the last 0 seconds')
	document.write('</td></tr>')
	
	document.write('<tr valign=top>')
	document.write('<td colspan=2>')
	document.write(' ')
	document.write('</td></tr>')
	document.write('<tr valign=top>')
	document.write('<td><TABLE>')
	for (i=0; i<=(cause.length)/2-1; i++) {
		var content=cause[i].split("|")
		document.write('<tr valign=top>')
		document.write('<td align=right id="cell'+i+'" style="font-family:'+thisfont+';font-size:'+thissize+'pt;color:'+thiscolor+'">')
		document.write('empty')
		document.write('</td>')
		document.write('<td>')
		document.write('  ')
		document.write('</td>')
		document.write('<td align=left style="font-family:'+thisfont+';font-size:'+thissize+'pt;color:'+thiscolor+'">')
		document.write(content[0]+" ")
		document.write('</td>')
		document.write('</tr>')
		i_causes++
	}			
	document.write('</TABLE></td>')
	document.write('<td>      </td>')
	document.write('<td><TABLE>')

for (i=i_causes; i<=cause.length-1; i++) {
		var content=cause[i].split("|")
		document.write('<tr valign=top>')
		document.write('<td align=right id="cell'+i+'" style="font-family:'+thisfont+';font-size:'+thissize+'pt;color:'+thiscolor+'">')
		document.write('empty')
		document.write('</td>')
		document.write('<td>')
		document.write('  ')
		document.write('</td>')
		document.write('<td align=left style="font-family:'+thisfont+';font-size:'+thissize+'pt;color:'+thiscolor+'">')
		document.write(content[0]+" ")
		document.write('</td>')
		document.write('</tr>')
	}			
	document.write('</TABLE></td></TABLE>')

}*/

function initdisplay() {
	
	document.write('<div class="deathTitle" id="titlecell">')
	document.write('Deaths within the last 0 seconds')
	document.write('</div>')
	
	document.write('<div class="deathValues">')
	document.write('<table cellpadding="0" cellspacing="0" border="0" width="453">')
	document.write('<tr valign=top>')
	document.write('<td width="250"><TABLE cellpadding="0" cellspacing="0" border="0" width="250">')
	for (i=0; i<=(cause.length)/2-1; i++) {
		var content=cause[i].split("|")
		document.write('<tr>')
		document.write('<td align="right" height="15" id="cell'+i+'" width="30" class="counter">')
		document.write('0')
		document.write('</td>')
		document.write('<td width="10">')
		document.write('  ')
		document.write('</td>')
		document.write('<td align=left width="210">')
		document.write(content[0]+" ")
		document.write('</td>')
		document.write('</tr>')
		i_causes++
	}			
	document.write('</TABLE></td>')
	document.write('<td width="13">      </td>')
	document.write('<td width="190"><TABLE cellpadding="0" cellspacing="0" border="0" width="190">')

for (i=i_causes; i<=cause.length-1; i++) {
		var content=cause[i].split("|")
		document.write('<tr>')
		document.write('<td width="30" height="15" align="right" id="cell'+i+'" class="counter">')
		document.write('0')
		document.write('</td>')
		document.write('<td width="10">')
		document.write('  ')
		document.write('</td>')
		document.write('<td align=left width="160">')
		document.write(content[0]+" ")
		document.write('</td>')
		document.write('</tr>')
	}			
	document.write('</TABLE></td></tr></TABLE>')
	document.write('</div>')

}

function docounter() {
	var now = new Date()
	var now=Math.floor((now.getTime()/1000))
	var hereSince = now - enterTime
	for (i=0; i<=cause.length-1; i++) {
		var content=cause[i].split("|")
		content[1]=Math.floor(content[1]/secyear*hereSince)
    	document.getElementById('cell'+i).innerHTML=content[1]
    	document.getElementById('titlecell').innerHTML="  Deaths within the last "+hereSince+" seconds"
	}	
	var setT = setTimeout("docounter()",1000)		
}


function showNr(zahlProSec,hereSi,gifNa) {

	var zahlSince = ""+Math.floor(hereSi*zahlProSec) 
	var rechtsPos = 9 -	zahlSince.length-1

	for (i=0; i<= zahlSince.length-1; i++) {
		document.images[gifNa+(i+rechtsPos)].src = "z"+zahlSince.charAt(i)+".gif"
	}
}

if (document.getElementById) {
	window.onload=docounter
}


