altTags=[];
altTags[0]="7 February: Jimmy White changes his name to James Brown at the Masters as part of a sponsorship deal.";
altTags[1]="13 September: Freddie Flintoff proves he can hold his catches better than his beer as he leads the England players on an Ashes bender";
altTags[2]="The BBC\'s Squad Selector is hijacked by Liverpool fans annoyed at their poor form in the Premiership.";
altTags[3]="Shane Warne drops Kevin Pietersen on 15 during final day of final Test. Pietersen went on to make 158 to secure the Ashes.";
altTags[4]="Norwich supremo Delia Smith issues a rallying cry to the fans, with the Canaries 2-0 down at half-time to Man City. Let\'s be \'avin you!";
altTags[5]="Steven Gerrard sleeps with the European Cup after leading Liverpool to an amazing 3-2 win over AC Milan in the final.";
altTags[6]="Comedian Peter Kay drops in on Sue Barker before the Grand National to pass on his tips.";
altTags[7]="Robert Pires makes a spectacular mess of a \'clever\' penalty against Man City, leaving Thierry Henry bemused.";
altTags[8]="Jose Mourinho accuses Arsene Wenger of being a \'voyeur\' who is obsessed with Chelsea.";
altTags[9]="Pedro Mendes\' spectacular \'goal\' for Spurs against Man Utd is not given - even though the ball is a foot over the line.";
altTags[10]="BBC Sport Interactive users design a series of wacky trousers for Ian Poulter to wear at The Open.";
altTags[11]="Freddie Flintoff hits nine sixes in the second Test at Edsgbaston, beating Ian Botham\'s 24-year-old record.";
altTags[12]="Prime Minister Tony Blair shows off his football skills on a visit to China…and wishes he hadn\'t bothered.";
altTags[13]="Lawrence Dallaglio\'s past as a choirboy singing backing vocals for Tina Turner is revealed.";
altTags[14]="Henman\'s Hill is renamed Murray\'s Mount by the Wimbledon crowd after unknown Andy Murray\'s heroics see him go further in the tournament than Tim Henman.";
altTags[15]="Paula Radcliffe makes an unscheduled toilet stop on her way to winning the London Marathon.";
altTags[16]="Goalkeeper Jerzy Dudek\'s crazy line dancing wins the European Cup for Liverpool as AC Milan throw away a three-goal lead, then fluff their penalties.";
altTags[17]="Former government bigwig Alistair Campbell spins out of control as he tries to gloss over GB & Ireland\'s disastrous Lions tour.";
altTags[18]="Ellen MacArthur sails around the world in a record time, but it was not all plain sailing for the 28-year-old Dame.";
altTags[19]="Wayne Rooney sees red after sarcastically applauding referee Kim Nielsen during the 0-0 draw with Villareal.";
altTags[20]="Goldie Lookin Chain perform \'Your Missus Is A Nutter\' before Wales-England game - and dedicate it to David Beckham.";
altTags[21]="Australia captain Ricky Ponting turns the air blue after being caught by substitute fielder Gary Pratt in the third Ashes Test.";
altTags[22]="Lance Armstrong clinches his 7th straight Tour de France win and retires to be a roadie for rock star girlfriend Sheryl Crow";
altTags[23]="Manchester City fans give midfielder Kiki Musampa the nickname \'Chris\'…Chris Musampa - you work it out! Happy Christmas everybody!"; 

function makeNewWindow() {
//set up window options
	var address = "days.stm";
	var winOptns='toolbar=no,location=no,directories=no,status=no,menubar=no,';
	winOptns += 'scrollbars=no,resizable=no,width=630,height=400'	 ;
	
    newWindow = window.open(address, "NewWin", winOptns);
	
}

function putContentInNewWindow(today){
	var thisDay="../img/"+today+".gif";
	newWinContent='<!doctype html public "//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">';
	newWinContent+="<html><head><title>Advent Calendar 2005</title><style>";
	newWinContent+="body{background-color:black;text-align:center;color:lime;}";
	newWinContent+="</style></head><body>";
	newWinContent+="<map name='closeSelf'><area alt='close window' coords='307,1,415,25' href='javascript:self.close();'></map><img src='";
	newWinContent+=thisDay;
	newWinContent+="' alt='";
	newWinContent+=altTags[(today-1)];
	newWinContent+="' border='0' usemap='#closeSelf'></body></html>";
	newWindow.document.write(newWinContent);
	newWindow.document.close();
	newWindow.focus();
}

function openThisDay(today){
var nDate = new Date();
var showContent=false;
if(nDate.getYear() <=2005){ // this year
	if(nDate.getMonth()<10){ alert("You're too early"); // Not December yet
	} else if(nDate.getDate() <today){ alert("You're too early"); // Too early in December
	} else showContent=true;
} else showContent=true;//It's next year

if(showContent){
var newWindow;// sub window reference
makeNewWindow();
putContentInNewWindow(today);
}else return;
//alert(nDate.UTCmonth);
}

