(function(){
var ua = {
iPhone: navigator.userAgent.indexOf('iPhone') != -1,
iPad: navigator.userAgent.indexOf('iPad') != -1,
iPod: navigator.userAgent.indexOf('iPod') != -1,
android: navigator.userAgent.indexOf('Android') != -1,
windows: navigator.userAgent.indexOf('Windows Phone') != -1
}
if(ua.iPhone || ua.iPod || ua.android || ua.windows){
document.write('\n');
}else if(ua.iPad){
document.write('\n');
}else{
document.write('\n');
}
}());
// 期限の設定
var gYear = 2016, // 年
gMonth = 9, // 月
gDay = 8, // 日
gHour = 15, // 時
gMinute = 0, // 分
gSecond = 0; // 秒
var goal = new Date(gYear, gMonth-1, gDay, gHour, gMinute, gSecond);
// 画像の高さの設定
var numHeight = 72;
// 使用する変数
var currentTime, period,
cDay, cDayHundred, cDayTen, cDayOne,
cHour, cHourTen, cHourOne,
cMinute, cMinuteTen, cMinuteOne,
cSecond, cSecondTen, cSecondOne,
cFlame, cFlameTen, cFlameOne,
insert = "";
// カウント用画像の指定
var dayThousand = document.getElementById('day-thousand'),
dayHundred = document.getElementById('day-hundred'),
dayTen = document.getElementById('day-ten'),
dayOne = document.getElementById('day-one'),
hourTen = document.getElementById('hour-ten'),
hourOne = document.getElementById('hour-one'),
minuteTen = document.getElementById('minute-ten'),
minuteOne = document.getElementById('minute-one'),
secondTen = document.getElementById('second-ten'),
secondOne = document.getElementById('second-one'),
flameTen = document.getElementById('flame-ten'),
flameOne = document.getElementById('flame-one');
// カウントダウンの処理
function countdown() {
// 現在から期限日までの差を取得
currentTime = new Date();
period = goal.getTime() - currentTime.getTime();
// 期限を過ぎていない時
if(period >= 0) {
// 日数を取得
cDay = Math.floor(period / (1000 * 60 * 60 * 24));
period -= (cDay * (1000 * 60 * 60 * 24));
// 桁数を4桁に揃える
cDay = String(cDay);
while(cDay.length < 4) {
cDay = '0' + cDay;
}
// 画像の切り替え
dayThousand.style.top = (- cDay.substr(0, 1) * numHeight) + 'px';
dayHundred.style.top = (- cDay.substr(1, 1) * numHeight) + 'px';
dayTen.style.top = (- cDay.substr(2, 1) * numHeight) + 'px';
dayOne.style.top = (- cDay.substr(3, 1) * numHeight) + 'px';
// 時間を取得
cHour = Math.floor(period / (1000 * 60 * 60));
period -= (cHour * (1000 * 60 * 60));
// 桁数を2桁に揃える
cHour = String(cHour);
while(cHour.length < 2) {
cHour = '0' + cHour;
}
// 画像の切り替え
hourTen.style.top = (- cHour.substr(0, 1) * numHeight) + 'px';
hourOne.style.top = (- cHour.substr(1, 1) * numHeight) + 'px';
// 分を取得
cMinute = Math.floor(period / (1000 * 60));
period -= (cMinute * (1000 * 60));
// 桁数を2桁に揃える
cMinute = String(cMinute);
while(cMinute.length < 2) {
cMinute = '0' + cMinute;
}
// 画像の切り替え
minuteTen.style.top = (- cMinute.substr(0, 1) * numHeight) + 'px';
minuteOne.style.top = (- cMinute.substr(1, 1) * numHeight) + 'px';
// 秒を取得
cSecond = Math.floor(period / (1000));
period -= (cSecond * (1000));
// 桁数を2桁に揃える
cSecond = String(cSecond);
while(cSecond.length < 2) {
cSecond = '0' + cSecond;
}
// 画像の切り替え
secondTen.style.top = (- cSecond.substr(0, 1) * numHeight) + 'px';
secondOne.style.top = (- cSecond.substr(1, 1) * numHeight) + 'px';
// フレーム
cFlame = Math.floor(period / (10));
// 桁数を2桁に揃える
cFlame = String(cFlame);
while(cFlame.length < 2) {
cFlame = '0' + cFlame;
}
// 画像の切り替え
flameTen.style.top = (- cFlame.substr(0, 1) * numHeight) + 'px';
flameOne.style.top = (- cFlame.substr(1, 1) * numHeight) + 'px';
// カウントダウンの処理を再実行
setTimeout(countdown, 10);
// 期限を過ぎた時
} else {
}
}
// 処理の実行
countdown();
var list = [
{ date: new Date (2116, 12-1, 31, 0, 0, 0, 000), css : 'css/cd1.css' }
];
for (var t = +(new Date), i= 0, o; o = list[i++]; ) {
if (t < +(o.date)) {
document.write ('');
break;
}
}