﻿document.writeln("<SCRIPT language=JavaScript>");
document.writeln("function RunGLNL(){");
document.writeln("var today=new Date();");
document.writeln("var d=new Array(\"星期日\",\"星期一\",\"星期二\",\"星期三\",\"星期四\",\"星期五\",\"星期六\");");
document.writeln("var DDDD=(today.getFullYear()<100 ? today.getFullYear()+1900:today.getFullYear())+\"年\"+(today.getMonth()+1)+\"月\"+today.getDate()+\"日\";");
document.writeln("DDDD = DDDD + \" \" + d[today.getDay()];");
document.writeln("DDDD = DDDD+ \" \" + (CnDateofDateStr(today));");
document.writeln("document.write(DDDD);");
document.writeln("}");
document.writeln("function DaysNumberofDate(DateGL){");
document.writeln("return parseInt((Date.parse(DateGL)-Date.parse(DateGL.getFullYear()+\"/1/1\"))/86400000)+1;");
document.writeln("}");
document.writeln("function CnDateofDate(DateGL){");
document.writeln("var CnData=new Array(");
document.writeln("0x16,0x2a,0xda,0x00,0x83,0x49,0xb6,0x05,0x0e,0x64,0xbb,0x00,0x19,0xb2,0x5b,0x00,");
document.writeln("0x87,0x6a,0x57,0x04,0x12,0x75,0x2b,0x00,0x1d,0xb6,0x95,0x00,0x8a,0xad,0x55,0x02,");
document.writeln("0x15,0x55,0xaa,0x00,0x82,0x55,0x6c,0x07,0x0d,0xc9,0x76,0x00,0x17,0x64,0xb7,0x00,");
document.writeln("0x86,0xe4,0xae,0x05,0x11,0xea,0x56,0x00,0x1b,0x6d,0x2a,0x00,0x88,0x5a,0xaa,0x04,");
document.writeln("0x14,0xad,0x55,0x00,0x81,0xaa,0xd5,0x09,0x0b,0x52,0xea,0x00,0x16,0xa9,0x6d,0x00,");
document.writeln("0x84,0xa9,0x5d,0x06,0x0f,0xd4,0xae,0x00,0x1a,0xea,0x4d,0x00,0x87,0xba,0x55,0x04");
document.writeln(");");
document.writeln("var CnMonth=new Array();");
document.writeln("var CnMonthDays=new Array();");
document.writeln("var CnBeginDay;");
document.writeln("var LeapMonth;");
document.writeln("var Bytes=new Array();");
document.writeln("var I;");
document.writeln("var CnMonthData;");
document.writeln("var DaysCount;");
document.writeln("var CnDaysCount;");
document.writeln("var ResultMonth;");
document.writeln("var ResultDay;");
document.writeln("var yyyy=DateGL.getFullYear();");
document.writeln("var mm=DateGL.getMonth()+1;");
document.writeln("var dd=DateGL.getDate();");
document.writeln("if(yyyy<100) yyyy+=1900;");
document.writeln("      if ((yyyy < 1997) || (yyyy > 2020)){");
document.writeln("        return 0;");
document.writeln("        }");
document.writeln("      Bytes[0] = CnData[(yyyy - 1997) * 4];");
document.writeln("      Bytes[1] = CnData[(yyyy - 1997) * 4 + 1];");
document.writeln("      Bytes[2] = CnData[(yyyy - 1997) * 4 + 2];");
document.writeln("      Bytes[3] = CnData[(yyyy - 1997) * 4 + 3];");
document.writeln("      if ((Bytes[0] & 0x80) != 0) {CnMonth[0] = 12;}");
document.writeln("      else {CnMonth[0] = 11;}");
document.writeln("      CnBeginDay = (Bytes[0] & 0x7f);");
document.writeln("      CnMonthData = Bytes[1];");
document.writeln("      CnMonthData = CnMonthData << 8;");
document.writeln("      CnMonthData = CnMonthData | Bytes[2];");
document.writeln("      LeapMonth = Bytes[3];");
document.writeln("for (I=15;I>=0;I--){");
document.writeln("        CnMonthDays[15 - I] = 29;");
document.writeln("        if (((1 << I) & CnMonthData) != 0 ){");
document.writeln("          CnMonthDays[15 - I]++;}");
document.writeln("        if (CnMonth[15 - I] == LeapMonth ){");
document.writeln("          CnMonth[15 - I + 1] = - LeapMonth;}");
document.writeln("        else{");
document.writeln("          if (CnMonth[15 - I] < 0 ){CnMonth[15 - I + 1] = - CnMonth[15 - I] + 1;}");
document.writeln("          else {CnMonth[15 - I + 1] = CnMonth[15 - I] + 1;}");
document.writeln("          if (CnMonth[15 - I + 1] > 12 ){ CnMonth[15 - I + 1] = 1;}");
document.writeln("        }");
document.writeln("      }");
document.writeln("      DaysCount = DaysNumberofDate(DateGL) - 1;");
document.writeln("      if (DaysCount <= (CnMonthDays[0] - CnBeginDay)){");
document.writeln("        if ((yyyy > 1901) && (CnDateofDate(new Date((yyyy - 1)+\"/12/31\")) < 0)){");
document.writeln("          ResultMonth = - CnMonth[0];}");
document.writeln("        else {ResultMonth = CnMonth[0];}");
document.writeln("        ResultDay = CnBeginDay + DaysCount;");
document.writeln("      }");
document.writeln("      else{");
document.writeln("        CnDaysCount = CnMonthDays[0] - CnBeginDay;");
document.writeln("        I = 1;");
document.writeln("        while ((CnDaysCount < DaysCount) && (CnDaysCount + CnMonthDays[I] < DaysCount)){");
document.writeln("          CnDaysCount+= CnMonthDays[I];");
document.writeln("          I++;");
document.writeln("        }");
document.writeln("        ResultMonth = CnMonth[I];");
document.writeln("        ResultDay = DaysCount - CnDaysCount;");
document.writeln("      }");
document.writeln("      if (ResultMonth > 0){");
document.writeln("        return ResultMonth * 100 + ResultDay;}");
document.writeln("      else{return ResultMonth * 100 - ResultDay;}");
document.writeln("}");
document.writeln("function CnYearofDate(DateGL){");
document.writeln("var YYYY=DateGL.getFullYear();");
document.writeln("var MM=DateGL.getMonth()+1;");
document.writeln("var CnMM=parseInt(Math.abs(CnDateofDate(DateGL))/100);");
document.writeln("if(YYYY<100) YYYY+=1900;");
document.writeln("if(CnMM>MM) YYYY--;");
document.writeln("YYYY-=1864;");
document.writeln("return CnEra(YYYY)+\"年\";");
document.writeln("}");
document.writeln("function CnMonthofDate(DateGL){");
document.writeln("var      CnMonthStr=new Array(\"零\",\"正\",\"二\",\"三\",\"四\",\"五\",\"六\",\"七\",\"八\",\"九\",\"十\",\"冬\",\"腊\");");
document.writeln("var      Month;");
document.writeln("      Month = parseInt(CnDateofDate(DateGL)/100);");
document.writeln("      if (Month < 0){return \"闰\" + CnMonthStr[-Month] + \"月\";}");
document.writeln("      else{return CnMonthStr[Month] + \"月\";}");
document.writeln("}");
document.writeln("function CnDayofDate(DateGL){");
document.writeln("var CnDayStr=new Array(\"零\",");
document.writeln("        \"初一\", \"初二\", \"初三\", \"初四\", \"初五\",");
document.writeln("        \"初六\", \"初七\", \"初八\", \"初九\", \"初十\",");
document.writeln("        \"十一\", \"十二\", \"十三\", \"十四\", \"十五\",");
document.writeln("        \"十六\", \"十七\", \"十八\", \"十九\", \"二十\",");
document.writeln("        \"廿一\", \"廿二\", \"廿三\", \"廿四\", \"廿五\",");
document.writeln("        \"廿六\", \"廿七\", \"廿八\", \"廿九\", \"三十\");");
document.writeln("var Day;");
document.writeln("      Day = (Math.abs(CnDateofDate(DateGL)))%100;");
document.writeln("      return CnDayStr[Day];");
document.writeln("}");
document.writeln("function DaysNumberofMonth(DateGL){");
document.writeln("var MM1=DateGL.getFullYear();");
document.writeln("        MM1<100 ? MM1+=1900:MM1;");
document.writeln("var MM2=MM1;");
document.writeln("        MM1+=\"/\"+(DateGL.getMonth()+1);");
document.writeln("        MM2+=\"/\"+(DateGL.getMonth()+2);");
document.writeln("        MM1+=\"/1\";");
document.writeln("        MM2+=\"/1\";");
document.writeln("return parseInt((Date.parse(MM2)-Date.parse(MM1))/86400000);");
document.writeln("}");
document.writeln("function CnEra(YYYY){");
document.writeln("var Tiangan=new Array(\"甲\",\"乙\",\"丙\",\"丁\",\"戊\",\"己\",\"庚\",\"辛\",\"壬\",\"癸\");");
document.writeln("var Dizhi=new Array(\"子\",\"丑\",\"寅\",\"卯\",\"辰\",\"巳\",\"午\",\"未\",\"申\",\"酉\",\"戌\",\"亥\");");
document.writeln("return Tiangan[YYYY%10]+Dizhi[YYYY%12];");
document.writeln("}");
document.writeln("function CnDateofDateStr(DateGL){");
document.writeln("      if(CnMonthofDate(DateGL)==\"零月\") return \"　请调整您的计算机日期!\";");
document.writeln("      else return \"农历\"+CnYearofDate(DateGL)+ \" \" + CnMonthofDate(DateGL) + CnDayofDate(DateGL);");
document.writeln("}");
document.writeln("function SolarTerm(DateGL){");
document.writeln("      var SolarTermStr=new Array(");
document.writeln("            \"小寒\",\"大寒\",\"立春\",\"雨水\",\"惊蛰\",\"春分\",");
document.writeln("            \"清明\",\"谷雨\",\"立夏\",\"小满\",\"芒种\",\"夏至\",");
document.writeln("            \"小暑\",\"大暑\",\"立秋\",\"处暑\",\"白露\",\"秋分\",");
document.writeln("            \"寒露\",\"霜降\",\"立冬\",\"小雪\",\"大雪\",\"冬至\");");
document.writeln("      var DifferenceInMonth=new Array(");
document.writeln("            1272060,1275495,1281180,1289445,1299225,1310355,");
document.writeln("            1321560,1333035,1342770,1350855,1356420,1359045,");
document.writeln("            1358580,1355055,1348695,1340040,1329630,1318455,");
document.writeln("            1306935,1297380,1286865,1277730,1274550,1271556);");
document.writeln("      var DifferenceInYear=31556926;");
document.writeln("      var BeginTime=new Date(1901/1/1);");
document.writeln("      BeginTime.setTime(947120460000);");
document.writeln("         for(;DateGL.getFullYear()<BeginTime.getFullYear();){");
document.writeln("            BeginTime.setTime(BeginTime.getTime()-DifferenceInYear*1000);");
document.writeln("         }");
document.writeln("         for(;DateGL.getFullYear()>BeginTime.getFullYear();){");
document.writeln("            BeginTime.setTime(BeginTime.getTime()+DifferenceInYear*1000);");
document.writeln("         }");
document.writeln("         for(var M=0;DateGL.getMonth()>BeginTime.getMonth();M++){");
document.writeln("            BeginTime.setTime(BeginTime.getTime()+DifferenceInMonth[M]*1000);");
document.writeln("         }");
document.writeln("         if(DateGL.getDate()>BeginTime.getDate()){");
document.writeln("            BeginTime.setTime(BeginTime.getTime()+DifferenceInMonth[M]*1000);");
document.writeln("            M++;");
document.writeln("         }");
document.writeln("         if(DateGL.getDate()>BeginTime.getDate()){");
document.writeln("            BeginTime.setTime(BeginTime.getTime()+DifferenceInMonth[M]*1000);");
document.writeln("            M==23?M=0:M++;");
document.writeln("         }");
document.writeln("      var JQ;");
document.writeln("      if(DateGL.getDate()==BeginTime.getDate()){");
document.writeln("        JQ=\"　 今天是<font color=\'#FF9999\'><b>\"+SolarTermStr[M] + \"</b></font>\";");
document.writeln("      }");
document.writeln("      else if(DateGL.getDate()==BeginTime.getDate()-1){");
document.writeln("        JQ=\"　 明天是<font color=\'#FF9999\'><b>\"+SolarTermStr[M] + \"</b></font>\";");
document.writeln("      }");
document.writeln("      else if(DateGL.getDate()==BeginTime.getDate()-2){");
document.writeln("        JQ=\"　 后天是<font color=\'#FF9999\'><b>\"+SolarTermStr[M] + \"</b></font>\";");
document.writeln("      }");
document.writeln("      else{");
document.writeln("       JQ=\" \"");
document.writeln("       if(DateGL.getMonth()==BeginTime.getMonth()){");
document.writeln("          JQ+=\"　 本月\";");
document.writeln("       }");
document.writeln("       else{");
document.writeln("         JQ+=\"　 下月\";");
document.writeln("       }");
document.writeln("       JQ+=BeginTime.getDate()+\"日\"+\"<font color=\'#FF9999\'><b>\"+SolarTermStr[M]+\"</b></font>\";");
document.writeln("      }");
document.writeln("return JQ;");
document.writeln("}");
document.writeln("function CAL()");
document.writeln("{}");
document.writeln("RunGLNL();");
document.writeln("");
document.writeln("function CurentTime(){ ");
document.writeln("        var now = new Date(); ");
document.writeln("        var hh = now.getHours(); ");
document.writeln("        var mm = now.getMinutes(); ");
document.writeln("        var ss = now.getTime() % 60000; ");
document.writeln("        ss = (ss - (ss % 1000)) / 1000; ");
document.writeln("        var clock = hh+\':\'; ");
document.writeln("        if (mm < 10) clock += \'0\'; ");
document.writeln("        clock += mm+\':\'; ");
document.writeln("        if (ss < 10) clock += \'0\'; ");
document.writeln("        clock += ss; ");
document.writeln("        return(clock); ");
document.writeln("} ");
document.writeln("</SCRIPT>");