
function times(y,BM,BD)
{
time=new Date(y,BM-1,BD);
time=Math.ceil((time.getTime()-new Date().getTime())/86400000); 
return time;
}

function count(BM,BD)
{
var y = new Date().getFullYear();
times(y,BM,BD);
if(time<=-1){times(y+1,BM,BD);}

if(time>0)
{
document.write( '<Table Border="0" style=" background-image: url(http://first.freespace.jp/happytime/2/count/'+BM+'_'+BD+'.gif); background-repeat:no-repeat;" Cellspacing="0" cellpadding="0" Width="150" Height="150">');
document.write( '<Tr><Td ColSpan="3" Height="58"><A Href="http://start.freespace.jp/happytime/" Target="_blank"><Img Src="http://first.freespace.jp/happytime/2/1.png" Border="0"></A></Td></Tr>');
document.write( '<Tr><Td Width="42"><A Href="http://start.freespace.jp/happytime/" Target="_blank"><Img Src="http://first.freespace.jp/happytime/2/2.png" Border="0"></A></Td>');
document.write( '<Td Width="67" Height="50" Align="center" Valign="middle"><Font style="line-height: 45px;font-size: 30pt;" face="Impact" Color="#000000">'+time+'</Font></Td>');
document.write( '<Td Width="41"><A Href="http://start.freespace.jp/happytime/" Target="_blank"><Img Src="http://first.freespace.jp/happytime/2/3.png" Border="0"></A></Td></Tr>');
document.write( '<Tr><Td ColSpan="3" Height="38"><A Href="http://start.freespace.jp/happytime/" Target="_blank"><Img Height="38" Src="http://first.freespace.jp/happytime/2/4.png" Border="0"></A></Td></Tr></Table>');
}

else
{
document.write( '<Table Border="0" Cellspacing="0" cellpadding="0" Width="150" Height="150" Background="http://first.freespace.jp/happytime/2/today/'+BM+'_'+BD+'.gif">');
document.write( '<Tr><Td Width="150"><A Href="http://start.freespace.jp/happytime/" Target="_blank"><Img Src="http://first.freespace.jp/happytime/2/0.png" Border="0"></A></Td></Tr></Table>');
}
}

count(6,7);