// JavaScript Document


//下1桁のみの場合0をinsert
function addZero( num )	{
	num = '00' + num;
	str = num.substring( num.length - 2, num.length );
	return str ;
}

$(function() {
  countDown();
});
function countDown() {
var target = new Date( 2011,8,30,23,59,00 );
// 月は、-1 減らした数で表示する。　例＝１月は「0」、１２月は「11」
today = new Date().getTime();
var days = Math.floor( ( target - today ) / ( 24 * 60 * 60 * 1000 ) );
var hour = Math.floor( ( ( target - today ) % ( 24 * 60 * 60 * 1000 ) ) / ( 60 * 60 * 1000 ) );
var mins = Math.floor( ( ( target - today ) % ( 24 * 60 * 60 * 1000 ) ) / ( 60 * 1000 ) ) % 60;
var secs = Math.floor( ( ( target - today ) % ( 24 * 60 * 60 * 1000 ) ) / 1000 ) % 60 % 60;
var mili = Math.floor( ( ( target - today ) % ( 24 * 60 * 60 * 1000 ) ) / 10 ) % 100;
if( target - today > 0 ){
	$(".countdown").html( '期間限定特典配布終了まで&nbsp;' + '残り&nbsp;' + days + '日&nbsp;' + hour + '時間&nbsp;' + addZero( mins ) + '分&nbsp;' + addZero( secs ) + '秒&nbsp;' + addZero( mili ) + ' です');
		setTimeout('countDown()', 10);
}else{
	$(".countdown").html("期間限定特典の配布は終了しました");
}
}

////////////////////


