
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 saba='one';
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://'+saba+'.freespace.jp/happytime/3/count/'+BM+'_'+BD+'.gif); background-repeat:no-repeat;" Cellspacing="0" cellpadding="0" Width="100" Height="40">');
document.write( '<Tr><Td ColSpan="3" Height="3"><A Href="http://start.freespace.jp/happytime/" Target="_blank"><Img  Height="7" Width="100" Src="http://'+saba+'.freespace.jp/happytime/3/0.png" Border="0"></A></Td></Tr>');
document.write( '<Tr><Td Width="40"><A Href="http://start.freespace.jp/happytime/" Target="_blank"><Img Height="10" Width="40" Src="http://'+saba+'.freespace.jp/happytime/3/0.png" Border="0"></A></Td>');
document.write( '<Td Width="20" Height="10" Align="center" Valign="middle"><B><Font style="line-height: 9pt;font-size: 9pt;letter-spacing: -1px;" face="Courier New" Color="#000000">'+time+'</Font></B></Td>');
document.write( '<Td Width="40"><A Href="http://start.freespace.jp/happytime/" Target="_blank"><Img Height="10" Width="40"  Src="http://'+saba+'.freespace.jp/happytime/3/0.png" Border="0"></A></Td></Tr>');
document.write( '<Tr><Td ColSpan="3" Height="27"><A Href="http://start.freespace.jp/happytime/" Target="_blank"><Img  Height="23" Width="100"  Src="http://'+saba+'.freespace.jp/happytime/3/0.png" Border="0"></A></Td></Tr></Table>');
}

else
{
document.write( '<Table Border="0" Cellspacing="0" cellpadding="0" Width="100" Height="40" Background="http://'+saba+'.freespace.jp/happytime/3/today/'+BM+'_'+BD+'.gif">');
document.write( '<Tr><Td Width="100"><A Href="http://start.freespace.jp/happytime/" Target="_blank"><Img Src="http://'+saba+'.freespace.jp/happytime/3/0.png" Border="0"></A></Td></Tr></Table>');
}
}

count(12,2);