// NOTE: the month entered must be one less than current month. ie; 0=January, 11=December
// NOTE: the hour is in 24 hour format. 0=12am, 15=3pm etc
// format: date = new Date(year,month-1,day,hour,min,sec)
// example: date = new Date(2003,03,26,14,15,00) = April 26, 2003 - 2:15:00 pm

dateStart 	= new Date(2009,6,25,00,00,00);
dateEnd		= new Date(2009,7,2,00,00,00);

function GetCount(){

	dateNow = new Date();									//grab current date
	amountStart = dateStart.getTime() - dateNow.getTime();	//calc milliseconds between dates
	amountEnd = dateEnd.getTime() - dateNow.getTime();		//calc milliseconds between dates
	delete dateNow;

	if(amountEnd < 0){ // event is already past
		document.getElementById('countboxEN').innerHTML="NICES 2009 has closed.<br/>Photos of this camp will be published on this website soon.";
		document.getElementById('countboxNL').innerHTML="NICES 2009 is alweer voorbij.<br/>Binnenkort zal op deze website de foto's van afgelopen kamp worden gepubliceerd.";
	}
	else{ // date is still good
	
		if(amountStart < 0 && amountEnd > 0){ //event is now on
			amount = amountEnd;
			outEN="It is NICES time!!!<br/>Only ";outENend=" of NICES left."
			outNL="Het is NICES tijd!!!<br/>Nog maar ";outNLend=" van NICES te gaan."
		}
	
		if(amountStart > 0){ //event has to start
			amount = amountStart;
			outEN="Only ";outENend=" left until NICES 2009.";
			outNL="Nog maar ";outNLend=" te gaan tot NICES 2009.";
		}	
		
		days=0;hours=0;mins=0;secs=0;

		amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs

		days=Math.floor(amount/86400);//days
		amount=amount%86400;

		hours=Math.floor(amount/3600);//hours
		amount=amount%3600;

		mins=Math.floor(amount/60);//minutes
		amount=amount%60;

		secs=Math.floor(amount);//seconds

		if(days != 0){
			outEN += days +((days!=1)?" days":" day")+", ";
			outNL += days +((days!=1)?" dagen":" dag")+", ";}
		if(days != 0 || hours != 0){
			outEN += hours +((hours!=1)?" hours":" hour")+", ";
			outNL += hours +((hours!=1)?" uren":" uur")+", ";}
		if(days != 0 || hours != 0 || mins != 0){
			outEN += mins +((mins!=1)?" minutes":" minute")+", ";
			outNL += mins +((mins!=1)?" minuten":" minuut")+", ";}
		outEN += secs +" seconds";
		outNL += secs +" seconden";
		
		document.getElementById('countboxEN').innerHTML=outEN+outENend;
		document.getElementById('countboxNL').innerHTML=outNL+outNLend;
		
		setTimeout("GetCount()", 1000);
	}
}

window.onload=function(){GetCount();}//call when everything has loaded
