﻿function checknew(date,gifset) {
  var AddDays = 15;
  if (gifset == 'new'){
  var text = "<b>(最 新)</b>";
  }
  else {
    var text="<b>(更 新)</b>";
  }

  TDate = new Date(date);
  TMonth = new Array('01', '02', '03', '04', '05','06', '07', '08', '09', '10', '11', '12');
  MonthDays = new Array('31', '28', '31', '30', '31', '30', '31', '31', '30', '31', '30', '31');
  function isLeapYear (Year) {
    if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) {
      return true;
    } 
    else {
      return false;
        }
  }
  CurYear = TDate.getYear();
  if (CurYear < 2000)
    CurYear = CurYear + 1900; 
  CurMonth = TDate.getMonth();
  CurDay = TDate.getDate();
  month = TMonth[CurMonth];
  if (month == '02')  {
    if (((CurYear % 4)==0) && ((CurYear % 100)!=0) || ((CurYear % 400)==0)) {
      MonthDays[1] = 29;
    }
    else {
      MonthDays[1] = 28;
    }
  }
  days = MonthDays[CurMonth];
  CurDay += AddDays;
  if (CurDay > days) {
    if (CurMonth == 11) {
      CurMonth = 0;
      month = TMonth[CurMonth];
      CurYear = CurYear + 1
    }
    else {
      month = TMonth[CurMonth+1];
    }
    CurDay = CurDay - days;
  }
  TheDate = month + '/';
  TheDate += CurDay + '/';
  if (CurYear<100) CurYear="19" + CurYear;
  TheDate += CurYear;


  curdate = new Date();
  expdate = new Date(TheDate);
  if (curdate.getTime() < expdate.getTime()) {
  document.write(text);
  }
}
