// 初期設定
var showday = 7;          // 表示日数
var newtext = "NEW!";     // 画像が指定されてないときの置き換え文字
var uptext  = "Update: "; // 画像のツールチップ更新テキスト

// 更新画像表示
function update(year, month, day, image) {
  var today, upday, difday, alttext;
  
  alttext = uptext + year + "/" + month + "/" + day;
  
  today = new Date();
  upday = new Date();
  
  month = month - 1;
  upday.setFullYear(year);
  upday.setMonth(month);
  upday.setDate(day);
  
  difday = today.getTime() - upday.getTime();
  difday = Math.floor(difday / (1000 * 60 * 60 * 24));
  
  if (difday < showday) {
    if (image == undefined) {
      document.write("<small><strong>" + newtext + "</strong></small>")
    } else {
      document.write("<img src='" + image + "' alt='" + alttext + "' />");
    }
  }
}
