//WORLD CUP 2006 MATCH COUNTDOWN (c) hinx 2006
//Part of the 'Ultimate Couch Potato World Cup Guide' spreadsheet site
//http://members.optushome.com.au/hinx/wc2006guide/
//External functions of wc06clock2.js from Maxx Blade's v2.0d clock script 
//Get your custom clock at http://www.maxxblade.co.uk/clock

function dC()
{

var matchDATE = new Array(
"June 09, 2006 18:00:00",
"June 09, 2006 21:00:00",
"June 10, 2006 15:00:00",
"June 10, 2006 18:00:00",
"June 10, 2006 21:00:00",
"June 11, 2006 15:00:00",
"June 11, 2006 18:00:00",
"June 11, 2006 21:00:00",
"June 12, 2006 15:00:00",
"June 12, 2006 18:00:00",
"June 12, 2006 21:00:00",
"June 13, 2006 15:00:00",
"June 13, 2006 18:00:00",
"June 13, 2006 21:00:00",
"June 14, 2006 15:00:00",
"June 14, 2006 18:00:00",
"June 14, 2006 21:00:00",
"June 15, 2006 15:00:00",
"June 15, 2006 18:00:00",
"June 15, 2006 21:00:00",
"June 16, 2006 15:00:00",
"June 16, 2006 18:00:00",
"June 16, 2006 21:00:00",
"June 17, 2006 15:00:00",
"June 17, 2006 18:00:00",
"June 17, 2006 21:00:00",
"June 18, 2006 15:00:00",
"June 18, 2006 18:00:00",
"June 18, 2006 21:00:00",
"June 19, 2006 15:00:00",
"June 19, 2006 18:00:00",
"June 19, 2006 21:00:00",
"June 20, 2006 16:00:00",
"June 20, 2006 21:00:00",
"June 21, 2006 16:00:00",
"June 21, 2006 21:00:00",
"June 22, 2006 16:00:00",
"June 22, 2006 21:00:00",
"June 23, 2006 16:00:00",
"June 23, 2006 21:00:00",
"June 24, 2006 17:00:00",
"June 24, 2006 21:00:00",
"June 25, 2006 17:00:00",
"June 25, 2006 21:00:00",
"June 26, 2006 17:00:00",
"June 26, 2006 21:00:00",
"June 27, 2006 17:00:00",
"June 27, 2006 21:00:00",
"June 30, 2006 17:00:00",
"June 30, 2006 21:00:00",
"July 01, 2006 17:00:00",
"July 01, 2006 21:00:00",
"July 04, 2006 21:00:00",
"July 05, 2006 21:00:00",
"July 08, 2006 21:00:00",
"July 09, 2006 20:00:00");

var deMATCH = new Array(
"Germany - Costa Rica\<br\>-.-",
"Poland - Ecuador\<br\>-.-",
"England - Paraguay\<br\>-.-",
"Trinidad and Tobago - Sweden\<br\>-.-",
"Argentina - Cote D'Ivoire\<br\>-.-",
"Serbia and Montenegro - Netherlands\<br\>-.-",
"Mexico - Iran\<br\>-.-",
"Angola - Portugal\<br\>-.-",
"Australia - Japan\<br\>-.-",
"USA - Czech Republic\<br\>-.-",
"Italy - Ghana\<br\>-.-",
"Korea Republic - Togo\<br\>-.-",
"France - Switzerland\<br\>-.-",
"Brazil - Croatia\<br\>-.-",
"Spain - Ukraine\<br\>-.-",
"Tunisia - Saudi Arabia\<br\>-.-",
"Germany - Poland\<br\>-.-",
"Ecuador - Costa Rica\<br\>-.-",
"England - Trinidad and Tobago\<br\>-.-",
"Sweden - Paraguay\<br\>-.-",
"Argentina - Serbia and Montenegro\<br\>-.-",
"Netherlands - Cote D'Ivoire\<br\>-.-",
"Mexico - Angola\<br\>-.-",
"Portugal - Iran\<br\>-.-",
"Czech Republic - Ghana\<br\>-.-",
"Italy - USA\<br\>-.-",
"Japan-  Croatia\<br\>-.-",
"Brazil - Australia\<br\>-.-",
"France - Korea Republic\<br\>-.-",
"Togo - Switzerland\<br\>-.-",
"Saudi Arabia - Ukraine\<br\>-.-",
"Spain - Tunisia\<br\>-.-",
"Ecuador - Germany\<br\>Costa Rica - Poland",
"Paraguay - Trinidad and Tobago\<br\>Sweden - England",
"Portugal - Mexico\<br\>Iran - Angola",
"Netherlands - Argentina\<br\>Cote D'Ivoire - Serbia and Montenegro",
"Czech Republic - Italy\<br\>Ghana - USA",
"Japan - Brazil\<br\>Croatia - Australia",
"Ukraine - Tunisia\<br\>Saudi Arabia - Spain",
"Switzerland - Korea Republic\<br\>Togo - France",
"A1 Germany - B2 Sweden\<br\>-.-",
"C1 Argentina - D2 Mexico\<br\>-.-",
"B1 England - A2 Ecuador\<br\>-.-",
"D1 Portugal - C2 Netherlands\<br\>-.-",
"E1 Italy - F2 Australia\<br\>-.-",
"G1 Switzerland - H2 Ukraine\<br\>-.-",
"F1 Brazil - E2 Ghana\<br\>-.-",
"H1 Spain - G2 France\<br\>-.-",
"WA1B2 Germany - WC1D2 Argentina\<br\>-.-",
"WE1F2 Italy - WG1H2 Ukraine\<br\>-.-",
"WB1A2 England - WD1C2 Portugal\<br\>-.-",
"WF1E2 Brazil - WH1G2 France\<br\>-.-",
"GERMANY - ITALY\<br\>-.-",
"PORTUGAL - FRANCE\<br\>-.-",
"GERMANY - PORTUGAL\<br\>(playoff for third place)",
"ITALY - FRANCE\<br\> *** F I N A L ***");

var cntMsg="";
var theCount=0;
//var testcount=tester()*86400000;// for debug
var berlin = new Date(tN().getUTCFullYear(),tN().getUTCMonth(),tN().getUTCDate(),tN().getUTCHours(),tN().getUTCMinutes(),tN().getUTCSeconds());
berlin = berlin.setTime(berlin.getTime()+dS());
while (theCount<56)
	{
	if (cntMsg=="")
		{
		var date=new Date(matchDATE[theCount]);
		var event=new Date(date.getUTCFullYear(),date.getUTCMonth(),date.getUTCDate(),date.getUTCHours(),date.getUTCMinutes(),date.getUTCSeconds());
		diff=Math.floor((date-berlin)/1000);//-testcount)/1000);//to secs with debug
		days=Math.floor(diff/86400);
		if (diff>0)
			{
			hrs = Math.floor(diff/3600-(24*days));
			mins = Math.floor(diff/60-(1440*days)-(60*hrs));
			secs = Math.floor(diff-(86400*days)-(3600*hrs)-(60*mins));
			if (days>0){cntMsg+=days+((days>1)?" days, ":" day, ");}
			cntMsg+=lZ(hrs)+"h "+lZ(mins)+"m "+lZ(secs)+"s \<br\>";
			}
		if ((theCount==0)&&(days>1)){cntMsg=cntMsg+"to the 2006 World Cup Opening \<br\>-.- ";}
		else if (diff>0){cntMsg=cntMsg+" to kickoff: "+deMATCH[theCount];break;}
		else if (diff>-9000)// * * adjust to 7200 to eliminate extra time
			{
			cntMsg="";
			mins=Math.floor(-diff/60);
			secs=Math.floor(-diff-(60*mins));
			cntMsg+=lZ(mins)+"m "+lZ(secs)+"s since start: \<br\>"+deMATCH[theCount];break;
			}
		else {cntMsg = "";}
		}	
	theCount++;
	}
	if (cntMsg == "")
		{
		if (days<-2){cntMsg="\<br\>Stay tuned for news of the 2010 World Cup ";}
		else if (days<-1){cntMsg="\<br\>Cleanup day in Germany ";}
		else if (days==-1){cntMsg="\<br\>It's over! ";}
		}
	if (cntMsg == "")
 		{
 		cntMsg=now+" - "+days+" days, "+hrs+"h "+mins+"m "+secs+"s\<br\>";
 		cntMsg=cntMsg+"I screwed up somewhere:"+theCount;
 		}
		document.getElementById('dCnt').innerHTML=cntMsg;
		setTimeout('dC()',1100-tN()%1000);
}
dC();
