Просмотр исходного кода

Merge pull request #76 from visuddhinanda/master

课程加入开始时间功能
visuddhinanda 5 лет назад
Родитель
Сommit
600532d800
69 измененных файлов с 9604 добавлено и 441 удалено
  1. 954 0
      app/calendar/Almanac v2.0_files/almanac_style.css
  2. 4689 0
      app/calendar/Almanac v2.0_files/almanac_v2.js
  3. 516 0
      app/calendar/Almanac v2.0_files/jquery-ui.css
  4. 5 0
      app/calendar/Almanac v2.0_files/jquery-ui.min.js.下载
  5. 1 0
      app/calendar/Almanac v2.0_files/jquery.min.js.下载
  6. 2 0
      app/calendar/Almanac v2.0_files/saved_resource.html
  7. 153 0
      app/calendar/Almanac v2.0_files/validate_geo.js.下载
  8. 225 0
      app/calendar/README.md
  9. 6 6
      app/calendar/index.php
  10. 566 0
      app/calendar/index1.html
  11. 1 0
      app/calendar/jquery-3.3.1.min.js
  12. 12 0
      app/calendar/julian.js
  13. 158 0
      app/calendar/lib/README.md
  14. 12 0
      app/calendar/lib/julian.js
  15. 355 0
      app/calendar/lib/lune.js
  16. 355 0
      app/calendar/lune.js
  17. 261 0
      app/calendar/moon.js
  18. 34 0
      app/calendar/package.json
  19. 326 0
      app/calendar/suncalc.js
  20. 166 0
      app/calendar/test/index.js
  21. 12 7
      app/course/course.php
  22. 9 1
      app/course/course_list.php
  23. 6 10
      app/course/list_new.php
  24. 0 12
      app/course/my_course_list.php
  25. 1 6
      app/course/my_course_new.php
  26. 8 11
      app/course/my_lesson_edit.php
  27. 8 3
      app/course/my_lesson_insert.php
  28. 15 9
      app/course/my_lesson_new.php
  29. 11 3
      app/course/my_lesson_update.php
  30. 2 2
      app/course/teacher_list.php
  31. 5 4
      app/dict/dict_lookup.php
  32. 4 4
      app/lang/lang.php
  33. 60 37
      app/palicanon/index.php
  34. 4 4
      app/pcdl/classroom.php
  35. 1 1
      app/pcdl/html_head.php
  36. 4 4
      app/pcdl/index1.php
  37. 4 4
      app/pcdl/reader.php
  38. 4 4
      app/pcdl/uhome.php
  39. 139 139
      app/public/book_tag/en.json
  40. 20 0
      app/public/book_tag/tag_list.json
  41. 4 0
      app/public/lang/default.json
  42. 4 0
      app/public/lang/en.json
  43. 4 0
      app/public/lang/my.json
  44. 4 0
      app/public/lang/si.json
  45. 4 2
      app/public/lang/zh-cn.json
  46. 4 0
      app/public/lang/zh-tw.json
  47. 4 4
      app/studio/buddhist_calendar.php
  48. 7 1
      app/studio/css/style.css
  49. 4 4
      app/studio/filenew.php
  50. 127 6
      app/studio/index.php
  51. 4 4
      app/studio/index_head.php
  52. 4 4
      app/studio/index_new.php
  53. 1 1
      app/studio/js/common.js
  54. 1 1
      app/studio/js/message.js
  55. 40 40
      app/studio/js/render.js
  56. 1 1
      app/studio/js/vn.js
  57. 1 1
      app/studio/project.php
  58. 4 4
      app/studio/recycle.php
  59. 4 4
      app/studio/search.php
  60. 4 4
      app/studio/term_sys_tool.php
  61. 4 4
      app/tools/tree_designer.php
  62. 3 3
      app/ucenter/function.php
  63. 77 59
      app/ucenter/name_selector.js
  64. 7 1
      app/ucenter/user.php
  65. 49 0
      app/uhome/course.php
  66. 54 0
      app/uhome/head.php
  67. 19 0
      app/uhome/index.php
  68. 24 0
      app/uwbw/update_analytics.php
  69. 23 22
      documents/development/functions.md

+ 954 - 0
app/calendar/Almanac v2.0_files/almanac_style.css

@@ -0,0 +1,954 @@
+body {
+    background: darkgrey;
+    font: normal 14px/18px Arial, Helvetica, sans-serif;
+    margin: 0;
+    padding: 0;
+    color: #FFFFFF;
+    width: 100%;
+    overflow-x: hidden;
+    overflow-y: auto;
+}
+html {
+    overflow-x: hidden;
+    overflow-y: auto;
+}
+ul li {
+    text-align: left;
+}
+
+html {
+    width: 100%;
+}
+
+input {
+    height: 25px;
+    border: 1px solid white;
+}
+
+a:link {
+    color: #FF0000;
+}
+
+a:visited {
+    color: #FF0000;
+}
+
+a:active {
+    color: #FF0000;
+}
+
+img {
+    border: none;
+    padding: 0;
+    margin: 0;
+}
+
+select {
+    /*height: 20px;*/
+    background-color: lightslategrey;
+    color: white;
+    border-radius: 2px;
+}
+
+input {
+    border: 1px solid black;
+    border-radius: 2px;
+    text-indent: 5px;
+}
+
+
+a {
+    color: #660066;
+    text-decoration: none;
+}
+
+a:hover {
+    color: #000000;
+    text-decoration: underline;
+}
+
+h1 {
+    font: bold italic 1.3em Georgia, "Times New Roman", Times, serif;
+    color: #333333;
+    padding: 0;
+    margin: 0;
+}
+
+h2 {
+    font: italic 1.3em Georgia, "Times New Roman", Times, serif;
+    color: #660066;
+}
+
+h3 {
+    font: bold 1.1em Arial, Helvetica, sans-serif;
+    display: inline;
+    color: #333;
+    background-color: transparent;
+}
+
+span {
+display:inline-block; margin-top: 5%;
+}
+
+span label {
+display:block
+}
+
+
+
+textarea {
+    resize: none;
+}
+label {
+    font: bold 13px/13px Arial, Helvetica, sans-serif;
+
+}
+/* MAJOR IDs used for layout */
+#header {
+    background-image: url("http://media.skyandtelescope.com/designimages/hMain_back2.jpg");
+    /*width: 972px;*/
+}
+
+#wrapper {
+    clear: both;
+}
+
+#nav a:hover {
+    color: #CCCCCC;
+    text-decoration: underline;
+}
+
+#hMags img {
+    border: solid 1px white;
+}
+
+#hMags .cWrap {
+    border: none;
+    background-color: #000000;
+}
+
+#hMags .smLinks a {
+    color: #FFFFFF;
+    /*padding: 0 3px;*/
+}
+
+#hSearch {
+    /*padding: 3px 10px;*/
+    background-color: #FFFFFF;
+    color: #660066;
+}
+
+#hSearch form {
+    margin: 0;
+    padding: 0;
+    font-weight: bold;
+    font-size: 14px;
+    line-height: 12px;
+}
+
+#hProfile {
+    /*padding: 8px 0 0 8px;*/
+    color: #FFFFFF;
+}
+
+#hProfile form, input, textarea, select, option {
+    margin: 0;
+    padding: 0;
+    font-size: 13px;
+}
+#hProfile h1 {
+    margin: 0;
+    padding: 0;
+    /*padding-bottom: 3px;*/
+    color: #FFFFFF;
+    font: bold 15px/10px Arial, Helvetica, sans-serif;
+    text-transform: capitalize;
+}
+
+#hProfile a {
+    color: #FFFFFF;
+}
+
+#hProfile a:hover {
+    color: black;
+}
+
+#hAlmanac img {
+    /*padding-bottom: 5px;*/
+    margin: 0;
+}
+
+#hAlmanac_alt {
+    /*width: 728px;*/
+    /*height: 24px;*/
+    /*padding-top: 5px;*/
+    background-color: black;
+    color: #FFFFFF;
+    font: bold italic 18px Georgia, serif;
+    text-align: left;
+    text-transform: none;
+}
+
+#hAlmanac_alt h1 {
+    display: inline;
+    color: #FFFFFF;
+    /*padding: 0 5px;*/
+    margin: 0;
+    font: bold 15px Arial, sans;
+    text-transform: capitalize;
+}
+
+#hAdvert img {
+    padding: 0;
+    margin: 0;
+}
+
+/* -- ids and classes within content */
+.comment {
+    border: solid 1px #5274AE;
+    background-color: #F6F6ED;
+    /*padding: 5px;*/
+    /*margin-right: 117px;*/
+    /*margin-bottom: 5px;*/
+}
+
+#cLeft {
+    /*width: 567px;*/
+}
+
+#cRight {
+}
+.smDate {
+    color: #5274AE;
+    font: bold 12px/13px Arial, Helvetica, sans-serif;
+    text-transform: capitalize;
+}
+
+.smHeader {
+    font: bold 15px/13px Arial, Helvetica, sans-serif;
+    text-align: left;
+    color: #000000;
+}
+
+.smByline {
+    font: bold 13px/13px Arial, Helvetica, sans-serif;
+    text-transform: capitalize;
+    text-align: right;
+    background-color: black;
+    color: #FFFFFF;
+    padding-right: 3px;
+    margin: 0 0 5px 0;
+}
+
+.smLinks {
+    clear: left;
+    /*padding-top: 7px;*/
+    color: #359;
+    font: bold 12px/11px Arial, Helvetica, sans-serif;
+    text-transform: capitalize;
+}
+
+.smLinks a {
+    /*padding-right: 8px;*/
+    color: #359;
+}
+
+.smLinks a:hover {
+    color: #000000;
+}
+
+.crumbs {
+    clear: none;
+    /*margin-bottom: 15px;*/
+    font: bold 12px/11px Arial, Helvetica, sans-serif;
+    text-transform: capitalize;
+}
+
+.crumbs a {
+    color: #000000;
+    /*padding-right: 8px;*/
+}
+
+.crumbs a:hover {
+    color: #660000;
+}
+
+.utils {
+    font: bold 12px/11px Arial, Helvetica, sans-serif;
+    text-transform: capitalize;
+}
+
+.utils a {
+    vertical-align: 50%;
+}
+
+.vRule {
+    border-left: 1px solid #5274AE;
+}
+
+.hRule {
+    border-top: 1px solid #5274AE;
+}
+
+.note {
+    font: bold .21em/1.25em Arial, sans;
+}
+
+.bg_bug {
+    /*padding: 5px;*/
+    /*padding-top: 60px;*/
+    color: #FFFFFF;
+    font: bold italic 13px/12px Georgia, serif;
+    background-image: url("http://media.skyandtelescope.com/designimages/BG_back.jpg");
+    border: solid 1px #000000;
+    /*margin-bottom: 5px;*/
+}
+
+.bg_bug form {
+    padding: 0;
+    margin: 0;
+}
+
+.right {
+    float: right;
+}
+
+.left {
+    float: left;
+}
+
+/* Ad Column elements on all pages */
+#cAdvert {
+    float: right;
+    /*width: 213px;*/
+    /*margin: 5px 6px 0 0;*/
+}
+
+#cAdvert img {
+    border: 1px solid #000000;
+    /*margin-bottom: 5px;*/
+}
+
+#cAdvert .artTopAds img {
+    border: none;
+}
+
+#cAdvert h2 {
+    font: bold 14px Georgia, serif;
+    font-style: italic;
+    padding-bottom: 0;
+    margin-bottom: 0;
+}
+#cMain {
+    /*padding-bottom: 7px;*/
+}
+
+.cWrap {
+    border: solid 1px black;
+    background-color: #FFFFFF;
+}
+
+.cMainImg {
+    float: left;
+    /*margin-right: 5px;*/
+}
+
+.cHeader {
+    /*padding: 1% 0 0 5px;*/
+    background-color: transparent;
+    color: #FFFFFF;
+    font: bold 13px/13px Arial, Helvetica, sans-serif;
+    text-transform: capitalize;
+}
+
+.MoonHeader {
+    /*padding-left: 5px;*/
+    background: transparent;
+    color: #FFFFFF;
+    font: bold 13px/13px Arial, Helvetica, sans-serif;
+    text-transform: capitalize;
+}
+
+.smBlurb, .cArea {
+    font: normal 14px/16px Arial, Helvetica, sans-serif;
+}
+
+.cArea {
+    /*padding: 5px;*/
+    color: black;
+}
+
+.smBlurb {
+    color: #000000;
+}
+
+.cArea form {
+    padding: 0;
+    margin: 0;
+}
+
+.cFooter {
+    border-bottom: solid 6px black;
+}
+
+.cMainSub {
+    clear: both;
+    /*padding: 5px 0;*/
+    border: solid 1px black;
+    background-color: #E7E7E7;
+    text-transform: capitalize;
+    text-align: center;
+}
+
+.cSubBox {
+    /*width: 567px;*/
+    border: 1px solid #FFFFFF;
+    /*margin: 7px 0 0 10px;*/
+}
+
+.smPhoto {
+    float: left;
+    /*padding: 0 5px 5px 0;*/
+}
+
+
+/*
+Template custom elements
+*/
+.btn {
+    border-radius: 2px;
+    border: 1px solid white;
+    background-color: transparent;
+    color: white;
+    font-size: 13px;
+    font-weight: bolder;
+    font-family: 'Open Sans', sans-serif;
+    /*padding:5px 15px;*/
+    text-transform: capitalize;
+    transition: background-color .15s ease-out;
+}
+.container {
+    max-width: 915px;
+    /*height: 1100px;*/
+}
+
+.row {
+    overflow: auto;
+    /*height: 100%;*/
+    width: 100%;
+    border-bottom: 1px solid white;
+    background: url(almanac_files/header-bg.jpg) no-repeat;
+    background-size: cover;
+}
+
+.btn:hover {
+    background-color: white;
+    color: black;
+}
+.show {
+    display: none;
+}
+
+
+/*
+Top row custom elements
+*/
+.box1 {
+    /*width: 32.98%;*/
+    overflow: auto;
+    float: left;
+    border-right: 1px solid white;
+    height: 210px;
+
+}
+#header_box {
+    width: 34%;
+    overflow: auto;
+    float: left;
+    border-right: 1px solid white;
+}
+#loc_box {
+    width: 38.2%;
+    overflow: auto;
+    float: left;
+    border-right: 1px solid white;
+}
+
+#location_select {
+    margin-top: 7%;
+    margin-left: 5%;
+    width: 90%;
+}
+#time_select {
+    margin-left: 5%;
+    width: 90%;
+
+}
+
+.box1:nth-child(1), .box1:nth-child(2) {
+    padding-right: 0.33%;
+}
+
+#new_logo {
+    width: 75%;
+    height: auto;
+    margin-top: 5%;
+    margin-left: 9%;
+    vertical-align: middle;
+    text-align: center;
+}
+#d_s_t {
+    width: 13px;
+    height: 13px;
+    padding: 0;
+    /*margin-top: 10%;*/
+    margin-left: 5%;
+    vertical-align: bottom;
+    position: relative;
+    top: -1%;
+    *overflow: hidden;
+}
+#d_s_t_2 {
+    display: block;
+    padding-left: .5%;
+    text-indent: -.5%;
+}
+.long_span {
+    display: inline-block;
+    margin-top: 0;
+}
+.back_to_now {
+    margin-left: 5%; margin-top: 5%;
+}
+
+#lat_span {
+    display:inline-block;
+    /*margin-top: 5%;*/
+}
+#lat_lon_tz {
+    text-align: center;
+    border-right: none;
+    width: 26.2%;
+    overflow: auto;
+    float: left;
+}
+
+#lat_lon_tz select {
+    margin-top: 3%;
+}
+.box1 p {
+    text-transform: none; margin-left:10%;font: bold 13px/20px Arial, Helvetica, sans-serif;
+}
+
+
+
+#ut_img {
+    border: none;
+    background-color: transparent;
+    color: white;
+    outline: none;
+}
+
+/*
+Second row custom elements
+*/
+.box2 {
+    /*border-top: 1px solid white;*/
+    width: 16.4%;
+    height: 70px;
+    overflow: auto;
+    float: left;
+    text-align: center;
+}
+.box2 .btn {
+    margin-top: 15%;
+    font-size: 15px;
+    font-weight: bolder;
+
+}
+
+/*
+Almanac computation row custom elements
+*/
+.popup {
+    color:#FF0000; cursor:pointer;
+    cursor:hand; margin-left: 37%;
+    margin-top: 0;
+}
+.popup2 {
+    color:#FF0000; cursor:pointer;
+    cursor:hand;  margin-top: 0;
+}
+.box3 label {
+    width: 10%;
+}
+.box_comp p {
+    font-weight: bolder; text-transform: uppercase;
+}
+
+.box_comp {
+    width: 20%;
+    height: 110px;
+    overflow: auto;
+    float: left;
+    text-align: center;
+    vertical-align: middle;
+}
+.box_comp div {
+    position: relative;
+    top: 50%;
+    transform: translateY(-50%);
+}
+.box3 {
+    width: 39.5%;
+    height: 110px;
+    overflow: auto;
+    float: left;
+    text-align: center;
+
+}
+
+.box3 input {
+    width: 50%;
+    margin-top: 3%;
+}
+
+.box3 label {
+    display: inline-block;
+    text-align: center;
+    margin-right: 25%;
+    font: bold 13px/13px Arial, Helvetica, sans-serif;
+}
+
+#hours {
+    margin-top: -.5%;
+    margin-left: 35%;
+}
+
+/*
+Moon/Sun data row custom elements
+*/
+.inner_row {
+    margin-top: 2%;
+    margin-bottom: 2%;
+    width: 100%;
+}
+.inner_row label {
+    text-align: center;
+}
+
+.inner_box span {
+    margin-top: 0;
+}
+.inner_box label {
+    text-align: center;
+}
+
+.inner_row span {
+    margin-top: 0;
+    display: inline-block;
+}
+#margin, #margin2 {
+    margin-left: 10%;
+}
+
+#phase6 {
+    width: 95%; height: 65px; margin-top: 2%; padding: 1px; font: normal 13px/18px Arial, Helvetica, sans-serif;
+}
+
+.box4 {
+    width: 25%;
+    height: 215px;
+    overflow: auto;
+    float: left;
+    background: black;
+    background-size: cover;
+}
+
+#moon_img {
+    width: 75%;
+    height: auto;
+    margin-left: 12%;
+    margin-top: 7%;
+}
+
+.box5 {
+    width: 75%;
+    height: 215px;
+    overflow: auto;
+    float: left;
+    background: url(almanac_files/header-bg.jpg) no-repeat;
+    background-size: cover;
+}
+
+
+/*
+Table data row custom elements
+*/
+#hide {
+    color: black;
+}
+.row_new p {
+    margin: 0; padding-left: 1%; color: black;
+}
+.data input {
+    display: inline-block;
+    width: 10.89%;
+    border: 1px solid black;
+    float: left;
+}
+
+.data h3 {
+    display: inline-block;
+    width: 10.89%;
+    border: 1px solid transparent;;
+    float: left;
+    text-align: center;
+    margin: 0;
+    color: white;
+    background: black;
+    padding-top: 1%;
+    padding-bottom: 1%;
+
+}
+
+.data h2 {
+    display: inline-block;
+    width: 10.89%;
+    border: 1px solid transparent;;
+    float: left;
+    margin: 0;
+    vertical-align: middle;
+    height: 25px;
+    text-align: center;
+    color: black;
+    font-family: Arial;
+    font-style: normal;
+}
+
+.row_new {
+    overflow: auto;
+    /*height: 100%;*/
+    width: 100%;
+    border-bottom: 1px solid white;
+    background: darkgrey;
+    background-size: cover;
+}
+
+.data2 {
+    display: none;
+}
+
+@media (max-width: 767px) {
+    .inner_row label {
+        text-align: center;
+    }
+
+    .inner_box span {
+        margin-top: 0;
+        width: 100%;
+    }
+    .inner_box label {
+        text-align: center;
+        width: 100%;
+
+    }
+    .inner_box input{
+        width: 75%;
+    }
+    .inner_row span {
+        margin-top: 0;
+        display: inline-block;
+    }
+    #margin, #margin2 {
+        margin-left: 0;
+    }
+
+    .show {
+        border-radius: 2px;
+        width: 30%;
+        display: block;
+        border: 1px solid black;
+        background-color: black;
+        color: white;
+        font-size: 13px;
+        font-weight: bolder;
+        font-family: 'Open Sans', sans-serif;
+        text-transform: capitalize;
+        transition: background-color .15s ease-out;
+        margin-left: 35%;
+        /*margin-top: 2%;*/
+        margin-bottom: 2%;
+    }
+textarea{
+    margin-left: 2%;
+}
+    .show:hover {
+        background-color: white;
+        color: black;
+    }
+
+    .container {
+        width: 100%;
+    }
+
+    #header_box {
+        width: 99%;
+        border-bottom: 1px solid white;
+        border-right:none;
+        /*height: auto;*/
+    }
+    #loc_box {
+        width: 100%;
+        border-bottom: 1px solid white;
+        border-right:none;
+        /*height: auto;*/
+    }
+    #lat_lon_tz {
+        width: 99%;
+        border-bottom: 1px solid white;
+        border-right:none;
+        /*height: auto;*/
+    }
+    .data input {
+        width: 10.89%;
+        border: 1px solid black;
+        display: block;
+    }
+    .row_new {
+        overflow: auto;
+        width: 100%;
+        border-bottom: 1px solid white;
+        background: darkgrey;
+        background-size: cover;
+        display: none;
+    }
+
+    #show {
+        display: block;
+    }
+
+    #lat_lon_tz {
+        margin: 0;
+        border:none;
+        height: 225px;
+    }
+    #btn{
+        margin-bottom: 3%;
+    }
+
+    .box2 {
+        width: 16.4%;
+        overflow: auto;
+        float: left;
+        text-align: center;
+    }
+
+    .box2 .btn {
+        margin-top: 25px;
+        font-size: 10px;
+
+    }
+
+    .box_comp {
+        width: 100%;
+
+    }
+
+    .box3 {
+        width: 80%;
+    }
+
+    .box4 {
+        width: 100%;
+        height: auto;
+        border-bottom: 1px solid white;
+    }
+
+    #moon_img {
+        width: 82%;
+        height: auto;
+    }
+
+    .box5 {
+        width: 100%;
+        height: 300px;
+    }
+
+    .data input {
+        display: inline-block;
+        width: 10.89%;
+        border: 1px solid black;
+        float: left;
+        font-size: 5px;
+        padding: 0;
+        margin: 0;
+    }
+
+    .data h3 {
+        display: inline-block;
+        width: 10.89%;
+        border: 1px solid transparent;;
+        float: left;
+        text-align: center;
+        margin: 0;
+        color: white;
+        background: black;
+        padding-top: 1%;
+        padding-bottom: 1%;
+        font-size: 9px;
+    }
+
+    .inner_row {
+        width: 100%;
+        text-align: center;
+
+    }
+
+
+
+    .inner_box {
+        text-align: center;
+        width: 100%;
+
+    }
+
+    .inner_row input {
+        margin: 0;
+        padding: 0;
+    }
+
+    .inner_row span {
+        margin: 0;
+        padding: 0;
+    }
+
+    .inner_row label {
+        margin: 0;
+        padding: 0;
+    }
+
+    .data h2 {
+        display: inline-block;
+        width: 10.89%;
+        border: 1px solid transparent;;
+        float: left;
+        font-size: 9px;
+
+        margin: 0;
+        vertical-align: middle;
+        text-align: center;
+        color: black;
+        font-family: Arial;
+        font-style: normal;
+    }
+    .data2 h2 {
+        color: black;
+        font-family: Arial;
+        font-style: normal;
+    }
+    #new_logo {
+        width: 75%;
+    }
+
+}

+ 4689 - 0
app/calendar/Almanac v2.0_files/almanac_v2.js

@@ -0,0 +1,4689 @@
+/*
+ Almanac v2.2
+
+ Commented out 2009-specific event list Jan 27, 2010 -- DAF
+
+ JavaScript programming and graphics,
+ copyright: Adrian R. Ashford, December 29th, 2008.
+
+ Used with permission by Sky Publishing Corporation.
+
+ http://www.skyandtelescope.com/templates/almanac_v2.js
+
+ Parts of sunrise, sunset, moonrise and moonset from
+ moonup.bas and sunup.bas by Roger W. Sinnott,
+ Sky and Telescope magazine.
+ Free date & time validation scripts:
+ Sandeep Tamhankar
+ stamhankar@hotmail.com
+ http://javascript.internet.com
+
+ Free dynamic form event script:
+ http://www.hscripts.com
+
+ Free variable passing in URL script:
+ http://javascript.internet.com
+
+ Public domain cookie scripts:
+ Dustin Diaz
+ http://www.dustindiaz.com/top-ten-javascript/
+ */
+
+
+/*
+ Cycle through moon phase images, to select correct Moonphase image on page load- write to page
+ */
+var myImage = ["almanac_files/mp0.gif","almanac_files/mp1.gif","almanac_files/mp2.gif","almanac_files/mp3.gif","almanac_files/mp4.gif","almanac_files/mp5.gif","almanac_files/mp6.gif","almanac_files/mp7.gif","almanac_files/mp8.gif","almanac_files/mp9.gif","almanac_files/mp10.gif","almanac_files/mp11.gif","almanac_files/mp12.gif","almanac_files/mp13.gif","almanac_files/mp14.gif","almanac_files/mp15.gif","almanac_files/mp16.gif","almanac_files/mp17.gif","almanac_files/mp18.gif","almanac_files/mp19.gif","almanac_files/mp20.gif","almanac_files/mp21.gif","almanac_files/mp22.gif","almanac_files/mp23.gif","almanac_files/mp24.gif","almanac_files/mp25.gif","almanac_files/mp26.gif","almanac_files/mp27.gif"];
+thisImage = 0;
+images = myImage.length - 1;
+
+
+/*
+ Get parameters for Latitude, Longitude, and time from URL
+ */
+function getParams()
+{
+    var idx = document.URL.indexOf('?');
+    var params = [];
+    if (idx != -1) {
+        var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
+        for (var i=0; i<pairs.length; i++)
+        {
+            nameVal = pairs[i].split('=');
+            params[nameVal[0]] = nameVal[1];
+        }
+    }
+    return params;
+}
+
+
+/*
+ Initialize variables from URL
+ */
+params = getParams();
+
+
+/*
+ Set variables from custom URL set in the params
+ */
+if(window.location.href.indexOf("latitude") != -1) {
+    latitude = parseFloat(decodeURI(params["latitude"]));
+    longitude = parseFloat(decodeURI(params["longitude"]));
+    t_zone = parseFloat(decodeURI(params["tzone"]));
+    UTdate = decodeURI(params["UTdate"]);
+    UTtime = decodeURI(params["UTtime"]);
+}
+
+/*
+ Initialize default variables
+ */
+else {
+    latitude = 42.383;
+    longitude = 71.133;
+    t_zone = -5;
+    UTdate = "now";
+    UTtime = "now";
+}
+
+/*
+ Set country option variables in array
+ */
+var country = [
+    "Select",
+    "USA",
+    "Canada",
+    "Afghanistan",
+    "Albania",
+    "Algeria",
+    "Angola",
+    "Argentina",
+    "Armenia",
+    "Australia",
+    "Austria",
+    "Azerbaijan",
+    "Bahamas",
+    "Bangladesh",
+    "Belarus",
+    "Belgium",
+    "Belize",
+    "Benin",
+    "Bhutan",
+    "Bolivia",
+    "Bosnia_and_Herzegovina",
+    "Botswana",
+    "Brazil",
+    "Brunei",
+    "Bulgaria",
+    "Burkina_Faso",
+    "Burma",
+    "Burundi",
+    "Cambodia",
+    "Cameroon",
+    "Cape_Verde",
+    "Central_African_Rep",
+    "Chad",
+    "Chile",
+    "China",
+    "Colombia",
+    "Congo",
+    "Congo_Dem_Rep",
+    "Costa_Rica",
+    "Cote_dIvoire",
+    "Croatia",
+    "Cuba",
+    "Cyprus",
+    "Czech_Republic",
+    "Denmark",
+    "Djibouti",
+    "Dominican_Rep",
+    "East_Timor",
+    "Ecuador",
+    "Egypt",
+    "El_Salvador",
+    "Eritrea",
+    "Estonia",
+    "Ethiopia",
+    "Falkland_Islands",
+    "Fiji",
+    "Finland",
+    "France",
+    "French_Guiana",
+    "French_Polynesia",
+    "Gabon",
+    "Gambia",
+    "Georgia",
+    "Germany",
+    "Ghana",
+    "Greece",
+    "Greenland",
+    "Guatemala",
+    "Guinea",
+    "Guinea_Bissau",
+    "Guyana",
+    "Haiti",
+    "Honduras",
+    "Hungary",
+    "Iceland",
+    "India",
+    "Indonesia",
+    "Iran",
+    "Iraq",
+    "Ireland",
+    "Israel",
+    "Italy",
+    "Jamaica",
+    "Japan",
+    "Jordan",
+    "Kazakhstan",
+    "Kenya",
+    "Korea_North",
+    "Korea_South",
+    "Kyrgyzstan",
+    "Laos",
+    "Latvia",
+    "Lebanon",
+    "Lesotho",
+    "Liberia",
+    "Libya",
+    "Lithuania",
+    "Macedonia",
+    "Madagascar",
+    "Malawi",
+    "Malaysia",
+    "Mali",
+    "Mauritania",
+    "Mexico",
+    "Moldova",
+    "Mongolia",
+    "Morocco",
+    "Mozambique",
+    "Namibia",
+    "Nepal",
+    "Netherlands",
+    "New_Zealand",
+    "Nicaragua",
+    "Niger",
+    "Nigeria",
+    "Northern_Ireland",
+    "Norway",
+    "Pakistan",
+    "Panama",
+    "Papua_New_Guinea",
+    "Paraguay",
+    "Peru",
+    "Philippines",
+    "Poland",
+    "Portugal",
+    "Puerto_Rico",
+    "Qatar",
+    "Romania",
+    "Russia",
+    "Rwanda",
+    "Saudi_Arabia",
+    "Senegal",
+    "Sierra_Leone",
+    "Singapore",
+    "Slovakia",
+    "Slovenia",
+    "Somalia",
+    "South_Africa",
+    "Spain",
+    "Sri_Lanka",
+    "Sudan",
+    "Suriname",
+    "Swaziland",
+    "Sweden",
+    "Switzerland",
+    "Syria",
+    "Taiwan",
+    "Tajikistan",
+    "Tanzania",
+    "Tasmania",
+    "Thailand",
+    "Togo",
+    "Trinidad_and_Tobago",
+    "Tunisia",
+    "Turkey",
+    "Turkmenistan",
+    "Uganda",
+    "Ukraine",
+    "United_Arab_Emirates",
+    "United_Kingdom",
+    "Uruguay",
+    "Uzbekistan",
+    "Vatican_City",
+    "Venezuela",
+    "Vietnam",
+    "Yemen",
+    "Yugoslavia",
+    "Zambia",
+    "Zimbabwe"];
+
+/*
+ Create array that holds all Cities
+ */
+Select = new Array("City");
+
+
+/*
+ Set American Cities into new array
+ */
+var USA = ["---",
+    "Albany, NY",
+    "Albuquerque, NM",
+    "Amarillo, TX",
+    "Anchorage, AK",
+    "Atlanta, GA",
+    "Austin, TX",
+    "Baker, OR",
+    "Baltimore, MD",
+    "Bangor, ME",
+    "Birmingham, AL",
+    "Bismarck, ND",
+    "Boise, ID",
+    "Boston, MA",
+    "Buffalo, NY",
+    "Carlsbad, NM",
+    "Charleston, SC",
+    "Charleston, WV",
+    "Charlotte, NC",
+    "Cheyenne, WY",
+    "Chicago, IL",
+    "Cincinnati, OH",
+    "Cleveland, OH",
+    "Columbia, SC",
+    "Columbus, OH",
+    "Dallas, TX",
+    "Denver, CO",
+    "Des Moines, IA",
+    "Detroit, MI",
+    "Dubuque, IA",
+    "Duluth, MN",
+    "Eastport, ME",
+    "El Centro, CA",
+    "El Paso, TX",
+    "Eugene, OR",
+    "Fargo, ND",
+    "Flagstaff, AZ",
+    "Fort Worth, TX",
+    "Fresno, CA",
+    "Grand Junction, CO",
+    "Grand Rapids, MI",
+    "Havre, MT",
+    "Helena, MT",
+    "Honolulu, HI",
+    "Hot Springs, AR",
+    "Houston, TX",
+    "Idaho Falls, ID",
+    "Indianapolis, IN",
+    "Jackson, MS",
+    "Jacksonville, FL",
+    "Juneau, AK",
+    "Kansas City, MO",
+    "Key West, FL",
+    "Klamath Falls, OR",
+    "Knoxville, TN",
+    "Las Vegas, NV",
+    "Lewiston, ID",
+    "Lincoln, NE",
+    "Long Beach, CA",
+    "Los Angeles, CA",
+    "Louisville, KY",
+    "Manchester, NH",
+    "Memphis, TN",
+    "Miami, FL",
+    "Milwaukee, WI",
+    "Minneapolis, MN",
+    "Mobile, AL",
+    "Montgomery, AL",
+    "Montpelier, VT",
+    "Nashville, TN",
+    "Newark, NJ",
+    "New Haven, CT",
+    "New Orleans, LA",
+    "New York, NY",
+    "Nome, AK",
+    "Oakland, CA",
+    "Oklahoma City, OK",
+    "Omaha, NE",
+    "Philadelphia, PA",
+    "Phoenix, AZ",
+    "Pierre, SD",
+    "Pittsburgh, PA",
+    "Portland, ME",
+    "Portland, OR",
+    "Providence, RI",
+    "Raleigh, NC",
+    "Reno, NV",
+    "Richfield, UT",
+    "Richmond, VA",
+    "Roanoke, VA",
+    "Sacramento, CA",
+    "St Louis, MO",
+    "Salt Lake City, UT",
+    "San Antonio, TX",
+    "San Diego, CA",
+    "San Francisco, CA",
+    "San Jose, CA",
+    "Santa Fe, NM",
+    "Savannah, GA",
+    "Seattle, WA",
+    "Shreveport, LA",
+    "Sioux Falls, SD",
+    "Sitka, AK",
+    "Spokane, WA",
+    "Springfield, IL",
+    "Springfield, MA",
+    "Springfield, MO",
+    "Syracuse, NY",
+    "Tampa, FL",
+    "Toledo, OH",
+    "Tulsa, OK",
+    "Virginia Beach, VA",
+    "Washington, D.C.",
+    "Wichita, KS",
+    "Wilmington, NC"];
+
+
+/*
+ Set Canadian Cities into new array
+ */
+var Canada = ["---",
+    "Calgary, AB",
+    "Charlottetown, PE",
+    "Chicoutimi, QC",
+    "Edmonton, AB",
+    "Guelph, ON",
+    "Halifax, NS",
+    "Hamilton, ON",
+    "Hull, QC",
+    "Iqaluit, NU",
+    "Kelowna, BC",
+    "Kingston, ON",
+    "Kitchener, ON",
+    "London, ON",
+    "Montreal, QC",
+    "Oshawa, ON",
+    "Ottawa, ON",
+    "Quebec City, QC",
+    "Regina, SK",
+    "Saint John, NB",
+    "Saskatoon, SK",
+    "Sherbrooke, QC",
+    "St Catharines, ON",
+    "St Johns, NL",
+    "Sudbury, ON",
+    "Thunder Bay, ON",
+    "Toronto, ON",
+    "Trois-Rivieres, QC",
+    "Vancouver, BC",
+    "Victoria, BC",
+    "Whitehorse, YT",
+    "Windsor, ON",
+    "Winnipeg, MB",
+    "Yellowknife, NT"];
+
+
+/*
+ Set Misc. Cities into new array
+ */
+Afghanistan = ["---","Kabul"];
+Albania = ["---","Tirana"];
+Algeria = ["---","Algiers"];
+Angola = ["---","Luanda"];
+Argentina = ["---","Buenos Aires","Cordoba"];
+Armenia = ["---","Yerevan"];
+Australia = ["---","Adelaide","Brisbane","Darwin","Melbourne","Perth","Sydney"];
+Austria = ["---","Vienna"];
+Azerbaijan = ["---","Baku"];
+Bahamas = ["---"," Nassau"];
+Bangladesh = ["---","Chittagong"];
+Belarus = ["---","Minsk"];
+Belgium = ["---","Brussels"];
+Belize = ["---","Belmopan"];
+Benin = ["---","Porto Novo"];
+Bhutan = ["---","Thimphu"];
+Bolivia = ["---","La Paz"];
+Bosnia_and_Herzegovina = ["---","Sarajevo"];
+Botswana = ["---","Gaborone"];
+Brazil =["---","Belem","Rio de Janeiro","Salvador","Sao Paulo"];
+Brunei = ["---","Bandar Seri Begawan"];
+Bulgaria = ["---","Sofia"];
+Burkina_Faso = ["---","Ouagadougou"];
+Burma = ["---","Rangoon"];
+Burundi = ["---","Bujumbura"];
+Cambodia = ["---","Phnom Penh"];
+Cameroon = ["---","Yaounde"];
+Cape_Verde = ["---","Praia"];
+Central_African_Rep = ["---","Bangui"];
+Chad = ["---","Ndjamena"];
+Chile = ["---","Iquique","Santiago"];
+China = ["---","Beijing","Canton","Chongqing","Hong Kong","Nanjing","Shanghai"];
+Colombia = ["---","Bogota"];
+Congo = ["---","Brazzaville"];
+Congo_Dem_Rep = ["---","Kinshasa"];
+Costa_Rica = ["---","San Jose"];
+Cote_dIvoire = ["---","Abidjan"];
+Croatia = ["---","Zagreb"];
+Cuba = ["---","Havana"];
+Cyprus = ["---","Nicosia"];
+Czech_Republic = ["---","Prague"];
+Denmark = ["---","Copenhagen"];
+Djibouti = ["---","Djibouti"];
+Dominican_Rep = ["---","Santo Domingo"];
+East_Timor = ["---","Dili"];
+Ecuador = ["---","Guayaquil"];
+Egypt = ["---","Cairo"];
+El_Salvador = ["---","San Salvador"];
+Eritrea = ["---","Asmera"];
+Estonia = ["---","Tallinn"];
+Ethiopia = ["---","Addis Ababa"];
+Falkland_Islands = ["---","Port Stanley"];
+Fiji = ["---","Suva"];
+Finland = ["---","Helsinki"];
+France = ["---","Bordeaux","Lyons","Marseilles","Paris"];
+French_Guiana = ["---","Cayenne"];
+French_Polynesia = ["---","Papeete"];
+Gabon = ["---","Libreville"];
+Gambia = ["---","Banjul"];
+Georgia = ["---","Tbilisi"];
+Germany = ["---","Berlin","Bremen","Frankfurt","Hamburg","Munich"];
+Ghana = ["---","Accra"];
+Greece = ["---","Athens"];
+Greenland = ["---","Nuuk"];
+Guatemala = ["---","Guatemala City"];
+Guinea = ["---","Conakry"];
+Guinea_Bissau = ["---","Bissau"];
+Guyana = ["---","Georgetown"];
+Haiti = ["---","Port-au-Prince"];
+Honduras = ["---","Tegucigalpa"];
+Hungary = ["---","Budapest"];
+Iceland = ["---","Reykjavik"];
+India = ["---","Bombay","Calcutta","Delhi"];
+Indonesia = ["---","Jakarta"];
+Iran = ["---","Teheran"];
+Iraq = ["---","Baghdad"];
+Ireland = ["---","Dublin"];
+Israel = ["---","Jerusalem","Tel Aviv"];
+Italy = ["---","Milan","Naples","Rome","Venice"];
+Jamaica =["---","Kingston"];
+Japan = ["---","Nagasaki","Nagoya","Osaka","Tokyo"];
+Jordan = ["---","Amman"];
+Kazakhstan = ["---","Almaty"];
+Kenya =["---","Nairobi"];
+Korea_North = ["---","Pyongyang"];
+Korea_South = ["---","Seoul"];
+Kyrgyzstan = ["---","Bishkek"];
+Laos = ["---","Vientiane"];
+Latvia = ["---","Riga"];
+Lebanon =["---","Beirut"];
+Lesotho = ["---","Maseru"];
+Liberia = ["---","Monrovia"];
+Libya = ["---","Tripoli"];
+Lithuania = ["---","Vilnius"];
+Macedonia = ["---","Skopje"];
+Madagascar = ["---","Tananarive"];
+Malawi = ["---","Lilongwe"];
+Malaysia = ["---","Kuala Lumpur"];
+Mali = ["---","Bamako"];
+Mauritania = ["---","Nouakchott"];
+Mexico = ["---","Chihuahua","Mazatlan","Mexico City","Veracruz"];
+Moldova = ["---","Kishinev"];
+Mongolia = ["---","Ulaanbaatar"];
+Morocco = ["---","Casablanca"];
+Mozambique = ["---","Maputo"];
+Namibia = ["---","Windhoek"];
+Nepal = ["---","Kathmandu"];
+Netherlands = ["---","Amsterdam"];
+New_Zealand = ["---","Auckland","Christchurch","Wellington"];
+Nicaragua = ["---","Managua"];
+Niger = ["---","Niamey"];
+Nigeria = ["---","Lagos"];
+Northern_Ireland = ["---","Belfast"];
+Norway = ["---","Hammerfest","Oslo"];
+Pakistan = ["---","Islamabad"];
+Panama = ["---","Panama City"];
+Papua_New_Guinea = ["---","Port Moresby"];
+Paraguay = ["---","Asuncion"];
+Peru = ["---","Lima"];
+Philippines = ["---","Manila"];
+Poland = ["---","Warsaw"];
+Portugal = ["---","Lisbon"];
+Puerto_Rico = ["---","San Juan"];
+Qatar = ["---","Doha"];
+Romania = ["---","Bucharest"];
+Russia = ["---","Irkutsk","Moscow","St Petersburg","Vladivostok"];
+Rwanda = ["---","Kigali"];
+Saudi_Arabia = ["---","Mecca"];
+Senegal = ["---","Dakar"];
+Sierra_Leone = ["---","Freetown"];
+Singapore = ["---","Singapore"];
+Slovakia = ["---","Bratislava"];
+Slovenia = ["---","Ljubljana"];
+Somalia = ["---","Mogadishu"];
+South_Africa = ["---","Johannesburg","CapeTown","Durban"];
+Spain =["---","Barcelona","Madrid"];
+Sri_Lanka = ["---","Colombo"];
+Sudan = ["---","Khartoum"];
+Suriname = ["---","Paramaribo"];
+Swaziland = ["---","Mbabane"];
+Sweden = ["---","Stockholm"];
+Switzerland = ["---","Zurich"];
+Syria = ["---","Damascus"];
+Taiwan = ["---","Taipei"];
+Tajikistan = ["---","Dushanbe"];
+Tanzania = ["---","Dar es Salaam"];
+Tasmania = ["---","Hobart"];
+Thailand = ["---","Bangkok"];
+Togo = ["---","Lome"];
+Trinidad_and_Tobago = ["---","Port of Spain"];
+Tunisia = ["---","Tunis"];
+Turkey = ["---","Ankara"];
+Turkmenistan = ["---","Ashgabat"];
+Uganda = ["---","Kampala"];
+Ukraine = ["---","Odessa"];
+United_Arab_Emirates = ["---","Dubai"];
+United_Kingdom = ["---","Aberdeen","Birmingham","Bristol","Cardiff","Edinburgh","Glasgow","Leeds","Liverpool","London","Manchester","Newcastle","Norwich","Plymouth"];
+Uruguay = ["---","Montevideo"];
+Uzbekistan = ["---","Tashkent"];
+Vatican_City = ["---","Vatican City"];
+Venezuela = ["---","Caracas"];
+Vietnam = ["---","Hanoi"];
+Yemen = ["---","Sana"];
+Yugoslavia = ["---","Belgrade"];
+Zambia = ["---","Lusaka"];
+Zimbabwe = ["---","Harare"];
+
+City = "...";
+
+
+/*
+ Set city list to match selected state/country- e.g. if "USA" selected city list only shows US cities
+ */
+function changeval()
+{
+    var val1 = document.planets.sel1.value;
+    var optionArray = eval(val1);
+    for (var df=0; df<optionArray.length; df++)
+    {
+        var ss = document.planets.sel2;
+        ss.options.length = 0;
+        for (var ff=0; ff<optionArray.length; ff++)
+        {
+            var val = optionArray[ff];
+            ss.options[ff] = new Option(val,val);
+        }
+    }
+}
+
+
+/*
+ Assign correct latitude + longitude to selected city
+ */
+function recordval()
+{
+    City = document.planets.sel2.value;
+
+    switch (City) {
+        /* US cities listing */
+        case 'Albany, NY' :
+            latitude = 42.666667;
+            longitude = 73.75;
+            t_zone = -5;
+            break;
+        case 'Albuquerque, NM':
+            latitude = 35.85;
+            longitude = 106.65;
+            t_zone = -7;
+            break;
+        case 'Amarillo, TX':
+            latitude = 35.183333;
+            longitude = 101.833333;
+            t_zone = -6;
+            break;
+        case 'Anchorage, AK':
+            latitude = 61.216667;
+            longitude = 149.9;
+            t_zone = -9;
+            break;
+        case 'Atlanta, GA':
+            latitude = 33.75;
+            longitude = 84.383333;
+            t_zone = -5;
+            break;
+        case 'Austin, TX':
+            latitude = 30.266667;
+            longitude = 97.733333;
+            t_zone = -6;
+            break;
+        case 'Baker, OR':
+            latitude = 44.783333;
+            longitude = 117.833333;
+            t_zone = -8;
+            break;
+        case 'Baltimore, MD':
+            latitude = 39.3;
+            longitude = 76.633333;
+            t_zone = -5;
+            break;
+        case 'Bangor, ME':
+            latitude = 44.8;
+            longitude = 68.783333;
+            t_zone = -5;
+            break;
+        case 'Birmingham, AL':
+            latitude = 33.5;
+            longitude = 86.833333;
+            t_zone = -6;
+            break;
+        case 'Bismarck, ND':
+            latitude = 46.8;
+            longitude = 100.783333;
+            t_zone = -6;
+            break;
+        case 'Boise, ID':
+            latitude = 43.6;
+            longitude = 116.216667;
+            t_zone = -7;
+            break;
+        case 'Boston, MA':
+            latitude = 42.35;
+            longitude = 71.083333;
+            t_zone = -5;
+            break;
+        case 'Buffalo, NY':
+            latitude = 42.916667;
+            longitude = 78.833333;
+            t_zone = -5;
+            break;
+        case 'Carlsbad, NM':
+            latitude = 32.433333;
+            longitude = 104.25;
+            t_zone = -7;
+            break;
+        case 'Charleston, SC':
+            latitude = 32.783333;
+            longitude = 79.933333;
+            t_zone = -5;
+            break;
+        case 'Charleston, WV':
+            latitude = 38.35;
+            longitude = 81.633333;
+            t_zone = -5;
+            break;
+        case 'Charlotte, NC':
+            latitude = 35.233333;
+            longitude = 80.833333;
+            t_zone = -5;
+            break;
+        case 'Cheyenne, WY':
+            latitude = 41.15;
+            longitude = 104.866667;
+            t_zone = -7;
+            break;
+        case  'Chicago, IL':
+            latitude = 41.833333;
+            longitude = 87.616667;
+            t_zone = -6;
+            break;
+        case 'Cincinnati, OH':
+            latitude = 39.133333;
+            longitude = 84.5;
+            t_zone = -5;
+            break;
+        case 'Cleveland, OH':
+            latitude = 41.466667;
+            longitude = 81.616667;
+            t_zone = -5;
+            break;
+        case 'Columbia, SC':
+            latitude = 34;
+            longitude = 81.033333;
+            t_zone = -5;
+            break;
+        case 'Columbus, OH':
+            latitude = 40;
+            longitude = 83.016667;
+            t_zone = -5;
+            break;
+        case 'Dallas, TX':
+            latitude = 32.766667;
+            longitude = 96.766667;
+            t_zone = -6;
+            break;
+        case 'Denver, CO':
+            latitude = 39.75;
+            longitude = 105;
+            t_zone = -7;
+            break;
+        case 'Des Moines, IA':
+            latitude = 41.583333;
+            longitude = 93.616667;
+            t_zone = -6;
+            break;
+        case 'Detroit, MI':
+            latitude = 42.333333;
+            longitude = 83.05;
+            t_zone = -5;
+            break;
+        case 'Dubuque, IA':
+            latitude = 42.516667;
+            longitude = 90.666667;
+            t_zone = -6;
+            break;
+        case 'Duluth, MN':
+            latitude = 46.816667;
+            longitude = 92.083333;
+            t_zone = -6;
+            break;
+        case 'Eastport, ME':
+            latitude = 44.9;
+            longitude = 67;
+            t_zone = -5;
+            break;
+        case 'El Centro, CA':
+            latitude = 32.633333;
+            longitude = 115.55;
+            t_zone = -8;
+            break;
+        case 'El Paso, TX':
+            latitude = 31.766667;
+            longitude = 106.483333;
+            t_zone = -7;
+            break;
+        case 'Eugene, OR':
+            latitude = 44.05;
+            longitude = 123.083333;
+            t_zone = -8;
+            break;
+        case 'Fargo, ND':
+            latitude = 46.866667;
+            longitude = 96.8;
+            t_zone = -6;
+            break;
+        case 'Flagstaff, AZ':
+            latitude = 35.216667;
+            longitude = 111.683333;
+            t_zone = -7;
+            break;
+        case  'Fort Worth, TX':
+            latitude = 32.716667;
+            longitude = 97.316667;
+            t_zone = -6;
+            break;
+        case 'Fresno, CA':
+            latitude = 36.733333;
+            longitude = 119.8;
+            t_zone = -8;
+            break;
+        case 'Grand Junction, CO':
+            latitude = 39.083333;
+            longitude = 108.55;
+            t_zone = -7;
+            break;
+        case 'Grand Rapids, MI':
+            latitude = 42.966667;
+            longitude = 85.666667;
+            t_zone = -5;
+            break;
+        case 'Havre, MT':
+            latitude = 48.55;
+            longitude = 109.716667;
+            t_zone = -7;
+            break;
+        case 'Helena, MT':
+            latitude = 46.583333;
+            longitude = 112.033333;
+            t_zone = -7;
+            break;
+        case 'Honolulu, HI':
+            latitude = 21.3;
+            longitude = 157.833333;
+            t_zone = -10;
+            break;
+        case 'Hot Springs, AR':
+            latitude = 34.516667;
+            longitude = 93.05;
+            t_zone = -6;
+            break;
+        case 'Houston, TX':
+            latitude = 29.75;
+            longitude = 95.35;
+            t_zone = -6;
+            break;
+        case 'Idaho Falls, ID':
+            latitude = 43.5;
+            longitude = 112.016667;
+            t_zone = -7;
+            break;
+        case 'Indianapolis, IN':
+            latitude = 39.766667;
+            longitude = 86.166667;
+            t_zone = -5;
+            break;
+        case 'Jackson, MS':
+            latitude = 32.333333;
+            longitude = 90.2;
+            t_zone = -6;
+            break;
+        case 'Jacksonville, FL':
+            latitude = 30.366667;
+            longitude = 81.666667;
+            t_zone = -5;
+            break;
+        case 'Juneau, AK':
+            latitude = 58.3;
+            longitude = 134.4;
+            t_zone = -9;
+            break;
+        case 'Kansas City, MO':
+            latitude = 39.1;
+            longitude = 94.583333;
+            t_zone = -6;
+            break;
+        case 'Key West, FL':
+            latitude = 24.55;
+            longitude = 81.8;
+            t_zone = -5;
+            break;
+        case 'Klamath Falls, OR':
+            latitude = 42.166667;
+            longitude = 121.733333;
+            t_zone = -8;
+            break;
+        case  'Knoxville, TN':
+            latitude = 35.95;
+            longitude = 83.933333;
+            t_zone = -5;
+            break;
+        case 'Las Vegas, NV':
+            latitude = 36.166667;
+            longitude = 115.2;
+            t_zone = -8;
+            break;
+        case  'Lewiston, ID':
+            latitude = 46.4;
+            longitude = 117.033333;
+            t_zone = -8;
+            break;
+        case 'Lincoln, NE':
+            latitude = 40.833333;
+            longitude = 96.666667;
+            t_zone = -6;
+            break;
+        case  'Long Beach, CA':
+            latitude = 33.766667;
+            longitude = 118.183333;
+            t_zone = -8;
+            break;
+        case  'Los Angeles, CA':
+            latitude = 34.05;
+            longitude = 118.25;
+            t_zone = -8;
+            break;
+        case 'Louisville, KY':
+            latitude = 38.25;
+            longitude = 85.766667;
+            t_zone = -5;
+            break;
+        case 'Manchester, NH':
+            latitude = 43;
+            longitude = 71.5;
+            t_zone = -5;
+            break;
+        case 'Memphis, TN':
+            latitude = 35.15;
+            longitude = 90.05;
+            t_zone = -6;
+            break;
+        case 'Miami, FL':
+            latitude = 25.766667;
+            longitude = 80.2;
+            t_zone = -5;
+            break;
+        case 'Milwaukee, WI':
+            latitude = 43.033333;
+            longitude = 87.916667;
+            t_zone = -6;
+            break;
+        case 'Minneapolis, MN':
+            latitude = 44.983333;
+            longitude = 93.233333;
+            t_zone = -6;
+            break;
+        case 'Mobile, AL':
+            latitude = 30.7;
+            longitude = 88.05;
+            t_zone = -6;
+            break;
+        case  'Montgomery, AL':
+            latitude = 32.35;
+            longitude = 86.3;
+            t_zone = -6;
+            break;
+        case 'Montpelier, VT':
+            latitude = 44.25;
+            longitude = 72.533333;
+            t_zone = -5;
+            break;
+        case  'Nashville, TN':
+            latitude = 36.166667;
+            longitude = 86.783333;
+            t_zone = -6;
+            break;
+        case  'Newark, NJ':
+            latitude = 40.733333;
+            longitude = 74.166667;
+            t_zone = -5;
+            break;
+        case  'New Haven, CT':
+            longitude = 72.916667;
+            t_zone = -5;
+            break;
+        case  'New Orleans, LA':
+            latitude = 29.95;
+            longitude = 90.066667;
+            t_zone = -6;
+            break;
+        case 'New York, NY':
+            latitude = 40.783333;
+            longitude = 73.966667;
+            t_zone = -5;
+            break;
+        case  'Nome, AK':
+            latitude = 64.416667;
+            longitude = 165.5;
+            t_zone = -9;
+            break;
+        case  'Oakland, CA':
+            latitude = 37.8;
+            longitude = 122.266667;
+            t_zone = -8;
+            break;
+        case 'Oklahoma City, OK':
+            latitude = 35.433333;
+            longitude = 97.466667;
+            t_zone = -6;
+            break;
+        case 'Omaha, NE':
+            latitude = 41.25;
+            longitude = 95.933333;
+            t_zone = -6;
+            break;
+        case 'Philadelphia, PA':
+            latitude = 39.95;
+            longitude = 75.166667;
+            t_zone = -5;
+            break;
+        case  'Phoenix, AZ':
+            latitude = 33.483333;
+            longitude = 112.066667;
+            t_zone = -7;
+            break;
+        case 'Pierre, SD':
+            latitude = 44.366667;
+            longitude = 100.35;
+            t_zone = -6;
+            break;
+        case 'Pittsburgh, PA':
+            latitude = 40.45;
+            longitude = 79.95;
+            t_zone = -5;
+            break;
+        case  'Portland, ME':
+            latitude = 43.666667;
+            longitude = 70.25;
+            t_zone = -5;
+            break;
+        case 'Portland, OR':
+            latitude = 45.516667;
+            longitude = 122.683333;
+            t_zone = -8;
+            break;
+        case 'Providence, RI':
+            latitude = 41.833333;
+            longitude = 71.4;
+            t_zone = -5;
+            break;
+        case  'Raleigh, NC':
+            latitude = 35.766667;
+            longitude = 78.65;
+            t_zone = -5;
+            break;
+        case  'Reno, NV':
+            latitude = 39.5;
+            longitude = 119.816667;
+            t_zone = -8;
+            break;
+        case 'Richfield, UT':
+            latitude = 38.766667;
+            longitude = 112.083333;
+            t_zone = -7;
+            break;
+        case  'Richmond, VA':
+            latitude = 37.55;
+            longitude = 77.483333;
+            t_zone = -5;
+            break;
+        case 'Roanoke, VA':
+            latitude = 37.283333;
+            longitude = 79.95;
+            t_zone = -5;
+            break;
+        case 'Sacramento, CA':
+            latitude = 38.583333;
+            longitude = 121.5;
+            t_zone = -8;
+            break;
+        case 'St Louis, MO':
+            latitude = 38.583333;
+            longitude = 90.2;
+            t_zone = -6;
+            break;
+        case  'Salt Lake City, UT':
+            latitude = 40.766667;
+            longitude = 111.9;
+            t_zone = -7;
+            break;
+        case 'San Antonio, TX':
+            latitude = 29.383333;
+            longitude = 98.55;
+            t_zone = -6;
+            break;
+        case 'San Diego, CA':
+            latitude = 32.7;
+            longitude = 117.166667;
+            t_zone = -8;
+            break;
+        case 'San Francisco, CA':
+            latitude = 37.783333;
+            longitude = 122.433333;
+            t_zone = -8;
+            break;
+        case 'San Jose, CA':
+            latitude = 37.333333;
+            longitude = 121.883333;
+            t_zone = -8;
+            break;
+        case 'Santa Fe, NM':
+            latitude = 35.683333;
+            longitude = 105.95;
+            t_zone = -7;
+            break;
+        case 'Savannah, GA':
+            latitude = 32.083333;
+            longitude = 81.083333;
+            t_zone = -5;
+            break;
+        case 'Seattle, WA':
+            latitude = 47.616667;
+            longitude = 122.333333;
+            t_zone = -8;
+            break;
+        case  'Shreveport, LA':
+            latitude = 32.466667;
+            longitude = 93.7;
+            t_zone = -6;
+            break;
+        case 'Sioux Falls, SD':
+            latitude = 43.55;
+            longitude = 96.733333;
+            t_zone = -6;
+            break;
+        case 'Sitka, AK':
+            latitude = 57.166667;
+            longitude = 135.25;
+            t_zone = -9;
+            break;
+        case 'Spokane, WA':
+            latitude = 47.666667;
+            longitude = 117.433333;
+            t_zone = -8;
+            break;
+        case 'Springfield, IL':
+            latitude = 39.8;
+            longitude = 89.633333;
+            t_zone = -6;
+            break;
+        case 'Springfield, MA':
+            latitude = 42.1;
+            longitude = 72.566667;
+            t_zone = -5;
+            break;
+        case 'Springfield, MO':
+            latitude = 37.216667;
+            longitude = 93.283333;
+            t_zone = -6;
+            break;
+        case 'Syracuse, NY':
+            latitude = 43.033333;
+            longitude = 76.133333;
+            t_zone = -5;
+            break;
+        case 'Tampa, FL':
+            latitude = 27.95;
+            longitude = 82.45;
+            t_zone = -5;
+            break;
+        case 'Toledo, OH':
+            latitude = 41.65;
+            longitude = 83.55;
+            t_zone = -5;
+            break;
+        case 'Tulsa, OK':
+            latitude = 36.15;
+            longitude = 95.983333;
+            t_zone = -6;
+            break;
+        case 'Virginia Beach, VA':
+            latitude = 36.85;
+            longitude = 75.966667;
+            t_zone = -5;
+            break;
+        case 'Washington, D.C.':
+            latitude = 38.883333;
+            longitude = 77.033333;
+            t_zone = -5;
+            break;
+        case 'Wichita, KS':
+            latitude = 37.716667;
+            longitude = 97.283333;
+            t_zone = -6;
+            break;
+        case 'Wilmington, NC':
+            latitude = 34.233333;
+            longitude = 77.95;
+            t_zone = -5;
+            break;
+
+        /* Canadian cities listing */
+        case 'Calgary, AB':
+            latitude = 51 + 6 / 60;
+            longitude = 114 + 1 / 60;
+            t_zone = -7;
+            break;
+        case 'Charlottetown, PE':
+            latitude = 46 + 14 / 60;
+            longitude = 63 + 9 / 60;
+            t_zone = -4;
+            break;
+        case  'Chicoutimi, QC':
+            latitude = 48 + 25 / 60;
+            longitude = 71 + 5 / 60;
+            t_zone = -5;
+            break;
+        case 'Edmonton, AB':
+            latitude = 53 + 34 / 60;
+            longitude = 113 + 31 / 60;
+            t_zone = -7;
+            break;
+        case 'Guelph, ON':
+            latitude = 43 + 33 / 60;
+            longitude = 80 + 15 / 60;
+            t_zone = -5;
+            break;
+        case 'Halifax, NS':
+            latitude = 44 + 39 / 60;
+            longitude = 63 + 34 / 60;
+            t_zone = -4;
+            break;
+        case 'Hamilton, ON':
+            latitude = 43 + 16 / 60;
+            longitude = 79 + 54 / 60;
+            t_zone = -5;
+            break;
+        case 'Hull, QC':
+            latitude = 45 + 26 / 60;
+            longitude = 75 + 44 / 60;
+            t_zone = -5;
+            break;
+        case 'Iqaluit, NU':
+            latitude = 63 + 45 / 60;
+            longitude = 68 + 31 / 60;
+            t_zone = -6;
+            break;
+        case 'Kelowna, BC':
+            latitude = 49 + 53 / 60;
+            longitude = 119 + 30 / 60;
+            t_zone = -8;
+            break;
+        case 'Kingston, ON':
+            latitude = 44 + 16 / 60;
+            longitude = 76 + 30 / 60;
+            t_zone = -5;
+            break;
+        case 'Kitchener, ON':
+            latitude = 43 + 26 / 60;
+            longitude = 80 + 30 / 60;
+            t_zone = -5;
+            break;
+        case 'London, ON':
+            latitude = 43 + 2 / 60;
+            longitude = 81 + 9 / 60;
+            t_zone = -5;
+            break;
+        case 'Montreal, QC':
+            latitude = 45 + 28 / 60;
+            longitude = 73 + 45 / 60;
+            t_zone = -5;
+            break;
+        case 'Oshawa, ON':
+            latitude = 43 + 54 / 60;
+            longitude = 78 + 52 / 60;
+            t_zone = -5;
+            break;
+        case  'Ottawa, ON':
+            latitude = 45 + 19 / 60;
+            longitude = 75 + 40 / 60;
+            t_zone = -5;
+            break;
+        case 'Quebec City, QC':
+            latitude = 46 + 48 / 60;
+            longitude = 71 + 23 / 60;
+            t_zone = -5;
+            break;
+        case 'Regina, SK':
+            latitude = 50 + 26 / 60;
+            longitude = 104 + 40 / 60;
+            t_zone = -7;
+            break;
+        case 'Saint John, NB':
+            latitude = 46 + 6 / 60;
+            longitude = 64 + 46 / 60;
+            t_zone = -4;
+            break;
+        case 'Saskatoon, SK':
+            latitude = 52 + 10 / 60;
+            longitude = 106 + 41 / 60;
+            t_zone = -7;
+            break;
+        case 'Sherbrooke, QC':
+            latitude = 45 + 24 / 60;
+            longitude = 71 + 54 / 60;
+            t_zone = -5;
+            break;
+        case 'St Catharines, ON':
+            latitude = 43 + 11 / 60;
+            longitude = 79 + 14 / 60;
+            t_zone = -5;
+            break;
+        case 'St Johns, NL':
+            latitude = 47 + 37 / 60;
+            longitude = 52 + 45 / 60;
+            t_zone = -3.5;
+            break;
+        case 'Sudbury, ON':
+            latitude = 46 + 37 / 60;
+            longitude = 80 + 48 / 60;
+            t_zone = -5;
+            break;
+        case  'Thunder Bay, ON':
+            latitude = 48 + 22 / 60;
+            longitude = 89 + 19 / 60;
+            t_zone = -5;
+            break;
+        case 'Toronto, ON':
+            latitude = 43 + 41 / 60;
+            longitude = 79 + 38 / 60;
+            t_zone = -5;
+            break;
+        case 'Trois-Rivieres, QC':
+            latitude = 46 + 21 / 60;
+            longitude = 72 + 35 / 60;
+            t_zone = -5;
+            break;
+        case 'Vancouver, BC':
+            latitude = 49 + 11 / 60;
+            longitude = 123 + 10 / 60;
+            t_zone = -8;
+            break;
+        case 'Victoria, BC':
+            latitude = 48 + 25 / 60;
+            longitude = 123 + 19 / 60;
+            t_zone = -8;
+            break;
+        case 'Whitehorse, YT':
+            latitude = 60 + 43 / 60;
+            longitude = 135 + 3 / 60;
+            t_zone = -8;
+            break;
+        case 'Windsor, ON':
+            latitude = 42 + 16 / 60;
+            longitude = 82 + 58 / 60;
+            t_zone = -4;
+            break;
+        case 'Winnipeg, MB':
+            latitude = 49 + 54 / 60;
+            longitude = 97 + 14 / 60;
+            t_zone = -6;
+            break;
+        case 'Yellowknife, NT':
+            latitude = 62 + 27 / 60;
+            longitude = 114 + 24 / 60;
+            t_zone = -7;
+            break;
+
+        case 'Kabul':
+            latitude = 34 + 35 / 60;
+            longitude = -(69 + 12 / 60);
+            t_zone = 4.5;
+            break;
+
+        case 'Luanda':
+            latitude = -(8 + 50 / 60);
+            longitude = -(13 + 20 / 60);
+            t_zone = 0;
+            break;
+
+        case 'Algiers':
+            latitude = 36.833333;
+            longitude = -3;
+            t_zone = 1;
+            break;
+        case 'Buenos Aires':
+            latitude = -34.583333;
+            longitude = 58.366667;
+            t_zone = -3;
+            break;
+        case 'Cordoba':
+            latitude = -31.466667;
+            longitude = 64.166667;
+            t_zone = -3;
+            break;
+
+        case 'Yerevan':
+            latitude = 40 + 16 / 60;
+            longitude = -(44 + 34 / 60);
+            t_zone = 4;
+            break;
+
+
+        case 'Adelaide':
+            latitude = -34.916667;
+            longitude = -138.6;
+            t_zone = 9.5;
+            break;
+        case  'Brisbane':
+            latitude = -27.483333;
+            longitude = -153.133333;
+            t_zone = 10;
+            break;
+        case 'Darwin':
+            latitude = -12.466667;
+            longitude = -130.85;
+            t_zone = 9.5;
+            break;
+        case 'Melbourne':
+            latitude = -37.783333;
+            longitude = -144.966667;
+            t_zone = 10;
+            break;
+        case 'Perth':
+            latitude = -31.95;
+            longitude = -115.866667;
+            t_zone = 8;
+            break;
+        case 'Sydney':
+            latitude = -34;
+            longitude = -151;
+            t_zone = 10;
+            break;
+        case 'Vienna':
+            latitude = 48.233333;
+            longitude = -16.333333;
+            t_zone = 1;
+            break;
+        case 'Baku':
+            latitude = 40 + 22 / 60;
+            longitude = -(49 + 53 / 60);
+            t_zone = 4;
+            break;
+        case 'Chittagong':
+            latitude = 22 + 21 / 60;
+            longitude = -(91 + 50 / 60);
+            t_zone = 6;
+            break;
+        case 'Minsk':
+            latitude = 53 + 54 / 60;
+            longitude = -(27 + 33 / 60);
+            t_zone = 2;
+            break;
+        case 'Brussels':
+            latitude = 50.866667;
+            longitude = -4.366667;
+            t_zone = 1;
+            break;
+        case 'La Paz':
+            latitude = -16.45;
+            longitude = 68.366667;
+            t_zone = -4;
+            break;
+        case 'Belem':
+            latitude = -1.466667;
+            longitude = 48.483333;
+            t_zone = -3;
+            break;
+        case 'Rio de Janeiro':
+            latitude = -22.95;
+            longitude = 43.2;
+            t_zone = -3;
+            break;
+        case 'Salvador':
+            latitude = -12.933333;
+            longitude = 38.45;
+            t_zone = -3;
+            break;
+        case 'Sao Paulo':
+            latitude = -23.516667;
+            longitude = 46.516667;
+            t_zone = -3;
+            break;
+        case 'Sofia':
+            latitude = 42.666667;
+            longitude = -23.333333;
+            t_zone = 2;
+            break;
+        case 'Rangoon':
+            latitude = 16 + 47 / 60;
+            longitude = -(96 + 9 / 60);
+            t_zone = 6.5;
+            break;
+        case 'Phnom Penh':
+            latitude = 11 + 33 / 60;
+            longitude = -(104 + 51 / 60);
+            t_zone = 7;
+            break;
+        case 'Iquique':
+            latitude = -20.166667;
+            longitude = 70.116667;
+            t_zone = -4;
+            break;
+        case  'Santiago':
+            latitude = -33.466667;
+            longitude = 70.75;
+            t_zone = -4;
+            break;
+        case 'Beijing':
+            latitude = 39.916667;
+            longitude = -116.416667;
+            t_zone = 8;
+            break;
+        case 'Canton':
+            latitude = 23.116667;
+            longitude = -113.25;
+            t_zone = 8;
+            break;
+        case 'Chongqing':
+            latitude = 29.766667;
+            longitude = -106.566667;
+            t_zone = 8;
+            break;
+        case  'Hong Kong':
+            latitude = 22 + 17 / 60;
+            longitude = -(114 + 8 / 60);
+            t_zone = 8;
+            break;
+        case 'Nanjing':
+            latitude = 32.05;
+            longitude = -118.883333;
+            t_zone = 8;
+            break;
+        case 'Shanghai':
+            latitude = 31.166667;
+            longitude = -121.466667;
+            t_zone = 8;
+            break;
+        case  'Bogota':
+            latitude = 4.533333;
+            longitude = 74.25;
+            t_zone = -5;
+            break;
+        case 'Kinshasa':
+            latitude = -4.3;
+            longitude = -15.283333;
+            t_zone = 1;
+            break;
+        case 'Havana':
+            latitude = 23.133333;
+            longitude = 82.383333;
+            t_zone = -5;
+            break;
+        case 'Prague':
+            latitude = 50.083333;
+            longitude = -14.433333;
+            t_zone = 1;
+            break;
+        case 'Copenhagen':
+            latitude = 55.666667;
+            longitude = -12.566667;
+            t_zone = 1;
+            break;
+        case 'Djibouti':
+            latitude = 11.5;
+            longitude = -43.05;
+            t_zone = 3;
+            break;
+        case 'Guayaquil':
+            latitude = -2.166667;
+            longitude = 79.933333;
+            t_zone = -5;
+            break;
+        case 'Cairo':
+            latitude = 30.033333;
+            longitude = -31.35;
+            t_zone = 2;
+            break;
+        case 'Birmingham':
+            latitude = 52.416667;
+            longitude = 1.916667;
+            t_zone = 0;
+            break;
+        case 'Bristol':
+            latitude = 51.466667;
+            longitude = 2.583333;
+            t_zone = 0;
+            break;
+        case 'Leeds':
+            latitude = 53.75;
+            longitude = 1.5;
+            t_zone = 0;
+            break;
+        case 'Liverpool':
+            latitude = 53.416667;
+            longitude = 3;
+            t_zone = 0;
+            break;
+        case 'London':
+            latitude = 51.533333;
+            longitude = 0.083333;
+            t_zone = 0;
+            break;
+        case 'Manchester':
+            latitude = 53.5;
+            longitude = 2.25;
+            t_zone = 0;
+            break;
+        case 'Newcastle':
+            latitude = 54.966667;
+            longitude = 1.616667;
+            t_zone = 0;
+            break;
+        case 'Norwich':
+            latitude = 52.6309;
+            longitude = -1.2973;
+            t_zone = 0;
+            break;
+        case 'Plymouth':
+            latitude = 50.416667;
+            longitude = 4.083333;
+            t_zone = 0;
+            break;
+        case  'Helsinki':
+            latitude = 60.166667;
+            longitude = -25;
+            t_zone = 2;
+            break;
+        case 'Bordeaux':
+            latitude = 44.833333;
+            longitude = 0.516667;
+            t_zone = 1;
+            break;
+        case 'Lyons':
+            latitude = 45.75;
+            longitude = -4.833333;
+            t_zone = 1;
+            break;
+        case 'Marseilles':
+            latitude = 43.333333;
+            longitude = -5.333333;
+            t_zone = 1;
+            break;
+        case 'Paris':
+            latitude = 48.8;
+            longitude = -2.333333;
+            t_zone = 1;
+            break;
+        case 'Cayenne':
+            latitude = 4.816667;
+            longitude = 52.3;
+            t_zone = -4;
+            break;
+        case 'Berlin':
+            latitude = 52.5;
+            longitude = -13.416667;
+            t_zone = 1;
+            break;
+        case 'Bremen':
+            latitude = 53.083333;
+            longitude = -8.816667;
+            t_zone = 1;
+            break;
+        case 'Frankfurt':
+            latitude = 50.116667;
+            longitude = -8.683333;
+            t_zone = 1;
+            break;
+        case 'Hamburg':
+            latitude = 53.55;
+            longitude = -10.033333;
+            t_zone = 1;
+            break;
+        case 'Munich':
+            latitude = 48.133333;
+            longitude = -11.583333;
+            t_zone = 1;
+            break;
+        case 'Athens':
+            latitude = 37.966667;
+            longitude = -23.716667;
+            t_zone = 2;
+            break;
+        case 'Guatemala City':
+            latitude = 14.616667;
+            longitude = 90.516667;
+            t_zone = -6;
+            break;
+        case 'Georgetown':
+            latitude = 6.75;
+            longitude = 58.25;
+            t_zone = -3.75;
+            break;
+        case 'Budapest':
+            latitude = 47.5;
+            longitude = -19.083333;
+            t_zone = 1;
+            break;
+        case 'Reykjavik':
+            latitude = 64.066667;
+            longitude = 21.966667;
+            t_zone = -1;
+            break;
+        case 'Bombay':
+            latitude = 19;
+            longitude = -72.8;
+            t_zone = 5.5;
+            break;
+        case 'Calcutta':
+            latitude = 22.566667;
+            longitude = -88.4;
+            t_zone = 5.5;
+            break;
+        case 'Delhi':
+            latitude = 28.667;
+            longitude = -77.233;
+            t_zone = 5.5;
+            break;
+        case 'Jakarta':
+            latitude = -6.266667;
+            longitude = -106.8;
+            t_zone = 7.5;
+            break;
+        case 'Teheran':
+            latitude = 35.75;
+            longitude = -51.75;
+            t_zone = 3.5;
+            break;
+        case 'Baghdad':
+            latitude = 33 + 20 / 60;
+            longitude = -(44 + 26 / 60);
+            t_zone = 3;
+            break;
+        case 'Dublin':
+            latitude = 53.333333;
+            longitude = 6.25;
+            t_zone = 0;
+            break;
+
+        case 'Jerusalem':
+            latitude = 31 + 47 / 60;
+            longitude = -(35 + 13 / 60);
+            t_zone = 2;
+            break;
+        case 'Tel Aviv':
+            latitude = 32 + 5 / 60;
+            longitude = -(34 + 46 / 60);
+            t_zone = 2;
+            break;
+
+        case 'Milan':
+            latitude = 45.45;
+            longitude = -9.166667;
+            t_zone = 1;
+            break;
+        case 'Naples':
+            latitude = 40.833333;
+            longitude = -14.25;
+            t_zone = 1;
+            break;
+        case 'Rome':
+            latitude = 41.9;
+            longitude = -12.45;
+            t_zone = 1;
+            break;
+        case 'Venice':
+            latitude = 45.433333;
+            longitude = -12.333333;
+            t_zone = 1;
+            break;
+        case 'Kingston':
+            latitude = 17.983333;
+            longitude = 76.816667;
+            t_zone = -5;
+            break;
+        case 'Nagasaki':
+            latitude = 32.8;
+            longitude = -129.95;
+            t_zone = 9;
+            break;
+        case 'Nagoya':
+            latitude = 35.116667;
+            longitude = -136.933333;
+            t_zone = 9;
+            break;
+        case 'Osaka':
+            latitude = 34.533333;
+            longitude = -135.5;
+            t_zone = 9;
+            break;
+        case 'Tokyo':
+            latitude = 35.666667;
+            longitude = -139.75;
+            t_zone = 9;
+            break;
+        case 'Nairobi':
+            latitude = -1.416667;
+            longitude = -36.916667;
+            t_zone = 3;
+            break;
+        case 'Beirut':
+            latitude = 33 + 54 / 60;
+            longitude = -(35 + 32 / 60);
+            t_zone = 2;
+            break;
+        case 'Tripoli':
+            latitude = 32.95;
+            longitude = -13.2;
+            t_zone = 2;
+            break;
+        case 'Tananarive':
+            latitude = -18.833333;
+            longitude = -47.55;
+            t_zone = 3;
+            break;
+        case 'Chihuahua':
+            latitude = 28.616667;
+            longitude = 106.083333;
+            t_zone = -6;
+            break;
+        case 'Mazatlan':
+            latitude = 23.2;
+            longitude = 106.416667;
+            t_zone = -7;
+            break;
+        case 'Mexico City':
+            latitude = 19.433333;
+            longitude = 99.116667;
+            t_zone = -6;
+            break;
+        case 'Veracruz':
+            latitude = 19.166667;
+            longitude = 96.166667;
+            t_zone = -6;
+            break;
+        case 'Amsterdam':
+            latitude = 52.366667;
+            longitude = -4.883333;
+            t_zone = 1;
+            break;
+        case 'Auckland':
+            latitude = -36.883333;
+            longitude = -174.75;
+            t_zone = 12;
+            break;
+        case 'Christchurch':
+            latitude = -(43 + 31.8 / 60);
+            longitude = -(172 + 37.2 / 60);
+            t_zone = 12;
+            break;
+        case 'Wellington':
+            latitude = -41.283333;
+            longitude = -174.783333;
+            t_zone = 12;
+            break;
+        case 'Belfast':
+            latitude = 54.616667;
+            longitude = 5.933333;
+            t_zone = 0;
+            break;
+        case 'Hammerfest':
+            latitude = 70.633333;
+            longitude = -23.633333;
+            t_zone = 1;
+            break;
+        case 'Oslo':
+            latitude = 59.95;
+            longitude = -10.7;
+            t_zone = 1;
+            break;
+        case 'Islamabad':
+            latitude = 33 + 40 / 60;
+            longitude = -(73 + 10 / 60);
+            t_zone = 5;
+            break;
+        case 'Panama City':
+            latitude = 8.966667;
+            longitude = 79.533333;
+            t_zone = -5;
+            break;
+        case 'Port Moresby':
+            latitude = -9.416667;
+            longitude = -147.133333;
+            t_zone = 10;
+            break;
+        case 'Asuncion':
+            latitude = -25.25;
+            longitude = 57.666667;
+            t_zone = -4;
+            break;
+        case 'Lima':
+            latitude = -12;
+            longitude = 77.033333;
+            t_zone = -5;
+            break;
+        case 'Manila':
+            latitude = 14.583333;
+            longitude = -120.95;
+            t_zone = 8;
+            break;
+        case 'Warsaw':
+            latitude = 52.233333;
+            longitude = -21;
+            t_zone = 1;
+            break;
+        case 'Lisbon':
+            latitude = 38.733333;
+            longitude = 9.15;
+            t_zone = 0;
+            break;
+        case 'Bucharest':
+            latitude = 44.416667;
+            longitude = -26.116667;
+            t_zone = 2;
+            break;
+        case 'Irkutsk':
+            latitude = 52.5;
+            longitude = -104.333333;
+            t_zone = 8;
+            break;
+        case 'Moscow':
+            latitude = 55.75;
+            longitude = -37.6;
+            t_zone = 3;
+            break;
+        case 'St Petersburg':
+            latitude = 59.933333;
+            longitude = -30.3;
+            t_zone = 3;
+            break;
+        case 'Vladivostok':
+            latitude = 43.166667;
+            longitude = -132;
+            t_zone = 10;
+            break;
+        case 'Mecca':
+            latitude = 21.483333;
+            longitude = -39.75;
+            t_zone = 3;
+            break;
+        case  'Aberdeen':
+            latitude = 57.15;
+            longitude = 2.15;
+            t_zone = 0;
+            break;
+        case 'Edinburgh':
+            latitude = 55.916667;
+            longitude = 3.166667;
+            t_zone = 0;
+            break;
+        case 'Glasgow':
+            latitude = 55.833333;
+            longitude = 4.25;
+            t_zone = 0;
+            break;
+        case 'Dakar':
+            latitude = 14.666667;
+            longitude = 17.466667;
+            t_zone = 0;
+            break;
+        case 'Singapore':
+            latitude = 1.233333;
+            longitude = -103.916667;
+            t_zone = 7.5;
+            break;
+        case 'Johannesburg':
+            latitude = -26.2;
+            longitude = -28.066667;
+            t_zone = 2;
+            break;
+        case 'CapeTown':
+            latitude = -33.916667;
+            longitude = -18.366667;
+            t_zone = 2;
+            break;
+        case 'Durban':
+            latitude = -29.883333;
+            longitude = -30.883333;
+            t_zone = 2;
+            break;
+        case 'Barcelona':
+            latitude = 41.383333;
+            longitude = -2.15;
+            t_zone = 1;
+            break;
+        case 'Madrid':
+            latitude = 40.433333;
+            longitude = 3.7;
+            t_zone = 1;
+            break;
+        case 'Paramaribo':
+            latitude = 5.75;
+            longitude = 55.25;
+            t_zone = -3.5;
+            break;
+        case 'Stockholm':
+            latitude = 59.283333;
+            longitude = -18.05;
+            t_zone = 1;
+            break;
+        case 'Zurich':
+            latitude = 47.35;
+            longitude = -8.516667;
+            t_zone = 1;
+            break;
+        case 'Hobart':
+            latitude = -42.866667;
+            longitude = -147.166667;
+            t_zone = 10;
+            break;
+        case 'Bangkok':
+            latitude = 13.75;
+            longitude = -100.5;
+            t_zone = 7;
+            break;
+        case 'Ankara':
+            latitude = 39.916667;
+            longitude = -32.916667;
+            t_zone = 2;
+            break;
+        case 'Odessa':
+            latitude = 46.45;
+            longitude = -30.8;
+            t_zone = 3;
+            break;
+        case  'Montevideo':
+            latitude = -34.883333;
+            longitude = 56.166667;
+            t_zone = -3;
+            break;
+        case 'Caracas':
+            latitude = 10.466667;
+            longitude = 67.033333;
+            t_zone = -4;
+            break;
+        case 'Hanoi':
+            latitude = 21 + 2 / 60;
+            longitude = -(105 + 51 / 60);
+            t_zone = 7;
+            break;
+        case 'Cardiff':
+            latitude = 51 + 29 / 60;
+            longitude = 3 + 11 / 60;
+            t_zone = 0;
+            break;
+        case 'Belgrade':
+            latitude = 44.866667;
+            longitude = -20.533333;
+            t_zone = 1;
+            break;
+
+        /* Added August 6th */
+        case 'Tirana':
+            latitude = 41.33;
+            longitude = -19.82;
+            t_zone = 1;
+            break;
+
+        case 'Nassau':
+            latitude = 25.06;
+            longitude = 77.33;
+            t_zone = -5;
+            break;
+
+        case 'Belmopan':
+            latitude = 17 + 25 / 60;
+            longitude = 88 + 46 / 60;
+            t_zone = -6;
+            break;
+
+        case 'Porto Novo':
+            latitude = 6.5;
+            longitude = -(2 + 47 / 60);
+            t_zone = 1;
+            break;
+
+        case 'Thimphu':
+            latitude = 27.48;
+            longitude = -89.70;
+            t_zone = 6;
+            break;
+
+        case 'Sarajevo':
+            latitude = 43.85;
+            longitude = -18.38;
+            t_zone = 1;
+            break;
+
+        case 'Gaborone':
+            latitude = -24.65;
+            longitude = -25.91;
+            t_zone = 2;
+            break;
+
+        case 'Bandar Seri Begawan':
+            latitude = 4.93;
+            longitude = -114.95;
+            t_zone = 8;
+            break;
+
+        case 'Ouagadougou':
+            latitude = 12.37;
+            longitude = 1.53;
+            t_zone = 0;
+            break;
+
+        case 'Bujumbura':
+            latitude = -3.37;
+            longitude = -29.35;
+            t_zone = 2;
+            break;
+
+        case 'Yaounde':
+            latitude = 3 + 51 / 60;
+            longitude = -(11 + 31 / 60);
+            t_zone = 1;
+            break;
+
+        case 'Praia':
+            latitude = 14.93;
+            longitude = 23.54;
+            t_zone = -1;
+            break;
+
+        case 'Bangui':
+            latitude = 4.36;
+            longitude = -18.56;
+            t_zone = 1;
+            break;
+
+        case 'Ndjamena':
+            latitude = 12.11;
+            longitude = -15.05;
+            t_zone = 1;
+            break;
+
+        case 'Brazzaville':
+            latitude = -4.25;
+            longitude = -15.26;
+            t_zone = 1;
+            break;
+
+        case 'San Jose':
+            latitude = 9.93;
+            longitude = 84.08;
+            t_zone = -6;
+            break;
+
+        case 'Abidjan':
+            latitude = 5.33;
+            longitude = 4.03;
+            t_zone = 0;
+            break;
+
+        case 'Zagreb':
+            latitude = 45.80;
+            longitude = -15.97;
+            t_zone = 1;
+            break;
+
+        case  'Nicosia':
+            latitude = 35.16;
+            longitude = -33.38;
+            t_zone = 2;
+            break;
+
+        case  'Santo Domingo':
+            latitude = 18.48;
+            longitude = 69.91;
+            t_zone = -4;
+            break;
+
+        case 'Dili':
+            latitude = -8.57;
+            longitude = -125.58;
+            t_zone = 9;
+            break;
+
+        case 'San Salvador':
+            latitude = 13.69;
+            longitude = 89.19;
+            t_zone = -6;
+            break;
+
+        case 'Asmera':
+            latitude = 15.33;
+            longitude = -38.94;
+            t_zone = 3;
+            break;
+
+        case 'Tallinn':
+            latitude = 59.44;
+            longitude = -24.74;
+            t_zone = 2;
+            break;
+
+        case 'Addis Ababa':
+            latitude = 9.03;
+            longitude = -38.74;
+            t_zone = 3;
+            break;
+
+        case 'Port Stanley':
+            latitude = -51.70;
+            longitude = 57.82;
+            t_zone = -4;
+            break;
+
+        case 'Suva':
+            latitude = -18.13;
+            longitude = -178.43;
+            t_zone = 12;
+            break;
+
+        case 'Papeete':
+            latitude = -(17 + 32 / 60);
+            longitude = 149 + 34 / 60;
+            t_zone = -10;
+            break;
+
+        case 'Libreville':
+            latitude = 0.39;
+            longitude = -9.45;
+            t_zone = 1;
+            break;
+
+        case 'Banjul':
+            latitude = 13.45;
+            longitude = 16.68;
+            t_zone = 0;
+            break;
+
+        case 'Tbilisi':
+            latitude = 41.72;
+            longitude = -44.79;
+            t_zone = 4;
+            break;
+
+        case 'Accra':
+            latitude = 5.56;
+            longitude = 0.20;
+            t_zone = 0;
+            break;
+
+        case 'Nuuk':
+            latitude = 64 + 10 / 60;
+            longitude = 51 + 40 / 60;
+            t_zone = -3;
+            break;
+
+        case 'Conakry':
+            latitude = 9.55;
+            longitude = 13.67;
+            t_zone = 0;
+            break;
+
+        case 'Bissau':
+            latitude = 11.87;
+            longitude = 15.60;
+            t_zone = 0;
+            break;
+
+        case 'Port-au-Prince':
+            latitude = 18.54;
+            longitude = 72.34;
+            t_zone = -5;
+            break;
+
+        case 'Tegucigalpa':
+            latitude = 14.09;
+            longitude = 87.22;
+            t_zone = -6;
+            break;
+
+        case 'Amman':
+            latitude = 31.95;
+            longitude = -35.93;
+            t_zone = 2;
+            break;
+
+        case 'Almaty':
+            latitude = 43.32;
+            longitude = -76.92;
+            t_zone = 6;
+            break;
+
+        case 'Pyongyang':
+            latitude = 39.02;
+            longitude = -125.75;
+            t_zone = 9;
+            break;
+
+        case 'Seoul':
+            latitude = 37.56;
+            longitude = -126.99;
+            t_zone = 9;
+            break;
+
+        case 'Bishkek':
+            latitude = 42.87;
+            longitude = -74.57;
+            t_zone = 6;
+            break;
+
+        case 'Vientiane':
+            latitude = 17.97;
+            longitude = -102.61;
+            t_zone = 7;
+            break;
+
+        case 'Riga':
+            latitude = 56.97;
+            longitude = -24.13;
+            t_zone = 2;
+            break;
+
+        case 'Maseru':
+            latitude = -29.31;
+            longitude = -27.49;
+            t_zone = 2;
+            break;
+
+        case 'Monrovia':
+            latitude = 6.31;
+            longitude = 10.80;
+            t_zone = 0;
+            break;
+
+        case 'Vilnius':
+            latitude = 54.70;
+            longitude = -25.27;
+            t_zone = 2;
+            break;
+
+        case 'Skopje':
+            latitude = 42.00;
+            longitude = -21.47;
+            t_zone = 1;
+            break;
+
+        case 'Lilongwe':
+            latitude = -13.97;
+            longitude = -33.80;
+            t_zone = 2;
+            break;
+
+        case 'Kuala Lumpur':
+            latitude = 3.16;
+            longitude = -101.71;
+            t_zone = 8;
+            break;
+
+        case 'Bamako':
+            latitude = 12.65;
+            longitude = 7.99;
+            t_zone = 0;
+            break;
+
+        case 'Nouakchott':
+            latitude = 18.09;
+            longitude = 15.98;
+            t_zone = 0;
+            break;
+
+        case 'Kishinev':
+            latitude = 47.03;
+            longitude = -28.83;
+            t_zone = 2;
+            break;
+
+        case 'Ulaanbaatar':
+            latitude = 47.93;
+            longitude = -106.91;
+            t_zone = 8;
+            break;
+
+        case 'Casablanca':
+            latitude = 33.60;
+            longitude = 7.62;
+            t_zone = 0;
+            break;
+
+        case 'Maputo':
+            latitude = -25.95;
+            longitude = -32.57;
+            t_zone = 2;
+            break;
+
+        case 'Windhoek':
+            latitude = -22.56;
+            longitude = -17.09;
+            t_zone = 1;
+            break;
+
+        case 'Kathmandu':
+            latitude = 27.71;
+            longitude = -85.31;
+            t_zone = 5.75;
+            break;
+
+        case 'Managua':
+            latitude = 12.15;
+            longitude = 86.27;
+            t_zone = -6;
+            break;
+
+        case 'Niamey':
+            latitude = 13.52;
+            longitude = -2.12;
+            t_zone = 1;
+            break;
+
+        case 'Lagos':
+            latitude = 6.45;
+            longitude = -3.47;
+            t_zone = 1;
+            break;
+
+        case 'San Juan':
+            latitude = 18.44;
+            longitude = 66.13;
+            t_zone = -4;
+            break;
+
+        case 'Doha':
+            latitude = 25.30;
+            longitude = -51.51;
+            t_zone = 3;
+            break;
+
+        case 'Kigali':
+            latitude = -1.94;
+            longitude = -30.06;
+            t_zone = 2;
+            break;
+
+        case  'Freetown':
+            latitude = 8.49;
+            longitude = 13.24;
+            t_zone = 0;
+            break;
+
+        case 'Bratislava':
+            latitude = 48.16;
+            longitude = -17.13;
+            t_zone = 1;
+            break;
+
+        case 'Ljubljana':
+            latitude = 46.06;
+            longitude = -14.51;
+            t_zone = 1;
+            break;
+
+        case 'Mogadishu':
+            latitude = 2.05;
+            longitude = -45.33;
+            t_zone = 3;
+            break;
+
+        case  'Colombo':
+            latitude = 6.93;
+            longitude = -79.85;
+            t_zone = 5.5;
+            break;
+
+        case 'Khartoum':
+            latitude = 15.58;
+            longitude = -32.52;
+            t_zone = 3;
+            break;
+
+        case 'Mbabane':
+            latitude = -(26 + 19 / 60);
+            longitude = -(31 + 7 / 60);
+            t_zone = 2;
+            break;
+
+        case 'Damascus':
+            latitude = 33.4;
+            longitude = -36.5;
+            t_zone = 2;
+            break;
+
+        case 'Taipei':
+            latitude = 25.02;
+            longitude = -121.45;
+            t_zone = 8;
+            break;
+
+        case 'Dushanbe':
+            latitude = 38.57;
+            longitude = -68.78;
+            t_zone = 5;
+            break;
+
+        case 'Dar es Salaam':
+            latitude = -6.82;
+            longitude = -39.28;
+            t_zone = 3;
+            break;
+
+        case  'Lome':
+            latitude = 6.17;
+            longitude = -1.35;
+            t_zone = 0;
+            break;
+
+        case  'Port of Spain':
+            latitude = 10 + 38 / 60;
+            longitude = 61 + 31 / 60;
+            t_zone = -4;
+            break;
+
+        case 'Tunis':
+            latitude = 36.84;
+            longitude = -10.22;
+            t_zone = 1;
+            break;
+
+        case 'Ashgabat':
+            latitude = 37.95;
+            longitude = -58.38;
+            t_zone = 5;
+            break;
+
+        case 'Kampala':
+            latitude = 0.32;
+            longitude = -32.58;
+            t_zone = 3;
+            break;
+
+        case 'Dubai':
+            latitude = 25.27;
+            longitude = -55.33;
+            t_zone = 4;
+            break;
+
+        case 'Tashkent':
+            latitude = 41.31;
+            longitude = -69.30;
+            t_zone = 5;
+            break;
+
+        case 'Vatican City':
+            latitude = 41.90;
+            longitude = -12.46;
+            t_zone = 1;
+            break;
+
+        case 'Sana':
+            latitude = 15.38;
+            longitude = -44.21;
+            t_zone = 3;
+            break;
+
+        case 'Lusaka':
+            latitude = -15.42;
+            longitude = -28.29;
+            t_zone = 2;
+            break;
+
+        case 'Harare':
+            latitude = -17.82;
+            longitude = -31.05;
+            t_zone = 2;
+            break;
+    }
+    planets();
+}
+
+
+/*
+ Set current date and time
+ */
+function setup()
+{
+    planet_name = ["the Sun","Mercury","Venus","Mars","Jupiter","Saturn","Moon","the Pleiades","Aldebaran","the Beehive","Regulus","Spica","Antares","Pollux","Elnath","Alhena","Nunki"];
+    planet_decl = new Array(16);
+    planet_r_a = new Array(16);
+    planet_altitude = new Array(6);
+    planet_azimuth = new Array(6);
+    planet_mag = new Array(6);
+    planet_decl[7] = 0.42121;
+    planet_r_a[7] = 0.99222;
+    planet_decl[8] = 0.28827;
+    planet_r_a[8] = 1.20559;
+    planet_decl[9] = 0.34296;
+    planet_r_a[9] = 2.27242;
+    planet_decl[10] = 0.20828;
+    planet_r_a[10] = 2.65595;
+    planet_decl[11] = -0.19548;
+    planet_r_a[11] = 3.51466;
+    planet_decl[12] = -0.46164;
+    planet_r_a[12] = 4.31882;
+    planet_decl[13] = 0.48898;
+    planet_r_a[13] = 2.03199;
+    planet_decl[14] = 0.49946;
+    planet_r_a[14] = 1.42549;
+    planet_decl[15] = 0.28623;
+    planet_r_a[15] = 1.73704;
+    planet_decl[16] = -0.45873;
+    planet_r_a[16] = 4.95543;
+    phenomena = "...";
+    phases = new Array(3);
+    phase = new Array(3);
+    moon_data = "...";
+    new_moon = 0;
+    var nowdate = new Date();
+    var utc_day = nowdate.getUTCDate();
+    var utc_month = nowdate.getUTCMonth() + 1;
+    var utc_year = nowdate.getUTCFullYear();
+    zone_comp = nowdate.getTimezoneOffset() / 1440;
+    var utc_hours = nowdate.getUTCHours();
+    var utc_mins = nowdate.getUTCMinutes();
+    var utc_secs = nowdate.getUTCSeconds();
+    utc_mins += utc_secs / 60.0;
+    utc_mins = Math.floor((utc_mins + 0.5));
+    if (utc_mins < 10) utc_mins = "0" + utc_mins;
+    if (utc_mins > 59) utc_mins = 59;
+    if (utc_hours < 10) utc_hours = "0" + utc_hours;
+    if (utc_month < 10) utc_month = "0" + utc_month;
+    if (utc_day < 10) utc_day = "0" + utc_day;
+    if (UTdate == "now")
+    {
+        document.planets.date_txt.value = utc_month + "/" + utc_day + "/" + utc_year;
+    }
+    else
+    {
+        document.planets.date_txt.value = UTdate;
+    }
+    if (UTtime == "now")
+    {
+        document.planets.ut_h_m.value = utc_hours + ":" + utc_mins;
+    }
+    else
+    {
+        document.planets.ut_h_m.value = UTtime;
+    }
+    planets();
+    dst();
+}
+
+
+/*
+ Reset date and time to current local time
+ */
+function back_to_now()
+{
+    var nowdate = new Date();
+    var utc_day = nowdate.getUTCDate();
+    var utc_month = nowdate.getUTCMonth() + 1;
+    var utc_year = nowdate.getUTCFullYear();
+    zone_comp = nowdate.getTimezoneOffset() / 1440;
+    var utc_hours = nowdate.getUTCHours();
+    var utc_mins = nowdate.getUTCMinutes();
+    var utc_secs = nowdate.getUTCSeconds();
+    utc_mins += utc_secs / 60.0;
+    utc_mins = Math.floor((utc_mins + 0.5));
+    if (utc_mins < 10) utc_mins = "0" + utc_mins;
+    if (utc_mins > 59) utc_mins = 59;
+    if (utc_hours < 10) utc_hours = "0" + utc_hours;
+    if (utc_month < 10) utc_month = "0" + utc_month;
+    if (utc_day < 10) utc_day = "0" + utc_day;
+
+    document.planets.date_txt.value = utc_month + "/" + utc_day + "/" + utc_year;
+    document.planets.ut_h_m.value = utc_hours + ":" + utc_mins;
+
+    /*
+     if (UTdate == "now")
+     {
+     document.planets.date_txt.value = utc_month + "/" + utc_day + "/" + utc_year;
+     }
+     else
+     {
+     document.planets.date_txt.value = UTdate;
+     }
+     if (UTtime == "now")
+     {
+     document.planets.ut_h_m.value = utc_hours + ":" + utc_mins;
+     }
+     else
+     {
+     document.planets.ut_h_m.value = UTtime;
+     }
+     */
+    planets();
+}
+
+
+/*
+ todo: Unnecessary function
+ */
+function resizeDocumentTo(setw,seth)
+{
+    return window.resizeTo(setw,seth),window.resizeTo(setw*2-((typeof window.innerWidth == 'undefined')?document.body.clientWidth:window.innerWidth),seth*2-((typeof window.innerHeight == 'undefined')?document.body.clientHeight:window.innerHeight));
+}
+
+/*
+ Determine if "x" is 0, 1, or -1
+ */
+function sign_of(x)
+{
+    return x == 0 ? 0 : (x > 0 ? 1 : -1);
+}
+
+
+/*
+ todo: Do not know what this function does
+ */
+function proper_ang(big)
+{
+    with (Math)
+    {
+        var tmp = 0;
+        if (big > 0)
+        {
+            tmp = big / 360.0;
+            tmp = (tmp - floor(tmp)) * 360.0;
+        }
+        else
+        {
+            tmp = ceil(abs(big / 360.0));
+            tmp = big + tmp * 360.0;
+        }
+    }
+    return tmp;
+}
+
+/*
+ todo: Do not know what this function does
+ */
+function proper_ang_rad(big)
+{
+    with (Math)
+    {
+        var tmp = 0;
+        if (big > 0)
+        {
+            tmp = big / 2 / PI;
+            tmp = (tmp - floor(tmp)) * 2 * PI;
+        }
+        else
+        {
+            tmp = ceil(abs(big / 2 / PI));
+            tmp = big + tmp * 2 * PI;
+        }
+    }
+    return tmp;
+}
+
+/*
+ todo: Do not know what this function does
+ */
+function range_1(num)
+{
+    var temp = num;
+    if (num > 1) temp = num - 1;
+    if (num < 0) temp = num + 1;
+    return temp;
+}
+
+
+/*
+ fixme: Unecessary function
+ */
+//function range_24(big)
+//{
+//    with (Math)
+//    {
+//        var tmp = 0;
+//        if (big > 0)
+//        {
+//            tmp = big / 24.0;
+//            tmp = (tmp - floor(tmp)) * 24.0;
+//        }
+//        else
+//        {
+//            tmp = ceil(abs(big / 24.0));
+//            tmp = big + tmp * 24.0;
+//        }
+//    }
+//    return tmp;
+//}
+
+
+/*
+ Math functions to round to nearest whole number
+ */
+function round_10(num)
+{
+    return Math.floor((num + 0.05) * 10) / 10;
+}
+
+function round_100(num)
+{
+    return Math.floor((num + 0.005) * 100) / 100;
+}
+
+function round_1000(num)
+{
+    return Math.floor((num + 0.0005) * 1000) / 1000;
+}
+
+function hundred_miles(num)
+{
+    return Math.floor((num / 100) + 0.5) * 100;
+}
+
+
+/*
+ Validate date and time
+ */
+function isValidDate(dateStr)
+{
+    if (IsValidTime(document.planets.ut_h_m.value) == true)
+    {
+        var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;
+        var matchArray = dateStr.match(datePat);
+        if (matchArray == null) {
+            alert("Date is not in a valid format.");
+            return false;
+        }
+        var month = matchArray[1];
+        var day = matchArray[3];
+        var year = matchArray[4];
+        if (month < 1 || month > 12) {
+            alert("Month must be between 1 and 12.");
+            return false;
+        }
+        if (year < 1600 || year > 2400) {
+            alert("Year must be between 1600 and 2400.");
+            return false;
+        }
+        if (day < 1 || day > 31) {
+            alert("Day must be between 1 and 31.");
+            return false;
+        }
+        if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) {
+            alert("Month " + month + " doesn't have 31 days!");
+            return false
+        }
+        if (month == 2) {
+            var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
+            if (day > 29 || (day == 29 && !isleap))
+            {
+                alert("February " + year + " doesn't have " + day + " days!");
+                return false;
+            }
+        }
+        if (month < 10 && month.length == 1) month = "0" + month;
+        if (day < 10 && day.length == 1) day = "0" + day;
+        document.planets.date_txt.value = month + "/" + day + "/" + year;
+        var dt_str = document.planets.date_txt.value;
+        if ((dt_str.substring(2,3) != "/") || (dt_str.substring(5,6) != "/"))
+        {
+            alert ("Date is not in a valid format.");
+            return false;
+        }
+        planets();
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+
+/*
+ Error messages for invalid times
+ */
+function IsValidTime(timeStr)
+{
+    var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;
+    var matchArray = timeStr.match(timePat);
+    if (matchArray == null)
+    {
+        alert("Time is not in a valid format.");
+        return false;
+    }
+    var hour = matchArray[1];
+    var minute = matchArray[2];
+    if (hour < 0 || hour > 23)
+    {
+        alert("Hour must be between 0 and 23.");
+        return false;
+    }
+    if (minute < 0 || minute > 59)
+    {
+        alert ("Minute must be between 0 and 59.");
+        return false;
+    }
+    if (hour < 10 && hour.length == 1) hour = "0" + hour;
+    if (minute < 10 && minute.length == 1) minute = "0" + minute;
+    document.planets.ut_h_m.value = hour + ":" + minute;
+    var tm_str = document.planets.ut_h_m.value;
+    if ((tm_str.substring(2,3) != ":") && (dt_str.length != 5))
+    {
+        alert ("Time is not in a valid format.");
+        return false;
+    }
+    return true;
+}
+
+
+/*
+ Manually change time from almanac
+ */
+function time_change(tmp)
+{
+    if (isValidDate(document.planets.date_txt.value) == true)
+    {
+        var jd_temp, zz, ff, alpha, aa, bb, cc, dd, ee;
+        var calendar_day, calendar_month, calendar_year;
+        var int_day, hours, minutes;
+
+        var tm_as_str, ut_hrs, ut_mns, part_day;
+
+        var jd = julian_date();
+
+        tm_as_str = document.planets.ut_h_m.value;
+        ut_hrs = eval(tm_as_str.substring(0,2));
+        ut_mns = eval(tm_as_str.substring(3,5));
+        part_day = ut_hrs / 24.0 + ut_mns / 1440.0;
+
+        with (Math) {
+
+            jd_temp = jd + part_day + tmp / 24.0 + 0.5;
+
+            zz = floor(jd_temp);
+            ff = jd_temp - zz;
+            alpha = floor((zz - 1867216.25) / 36524.25);
+            aa = zz + 1 + alpha - floor(alpha / 4);
+            bb = aa + 1524;
+            cc = floor((bb - 122.1) / 365.25);
+            dd = floor(365.25 * cc);
+            ee = floor((bb - dd) / 30.6001);
+            calendar_day = bb - dd - floor(30.6001 * ee) + ff;
+            calendar_month = ee;
+            if (ee < 13.5) calendar_month = ee - 1;
+            if (ee > 13.5) calendar_month = ee - 13;
+            calendar_year = cc;
+            if (calendar_month > 2.5) calendar_year = cc - 4716;
+            if (calendar_month < 2.5) calendar_year = cc - 4715;
+            int_day = floor(calendar_day);
+            hours = (calendar_day - int_day) * 24;
+            minutes = floor((hours - floor(hours)) * 60 + 0.5);
+            hours = floor(hours);
+            if (minutes > 59)
+            {minutes = 0; hours = hours + 1;}
+            if (calendar_month < 10) calendar_month = "0" + calendar_month;
+            if (int_day < 10) int_day = "0" + int_day;
+            if (hours < 10) hours = "0" + floor(hours);
+            if (minutes < 10) minutes = "0" + minutes;
+        }
+        document.planets.date_txt.value = calendar_month + "/" + int_day + "/" + calendar_year;
+        document.planets.ut_h_m.value = hours + ":" + minutes;
+        planets();
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+
+
+/*
+ Calculate t-zone and compass direction of location
+ */
+function zone_date_time()
+{
+    var jd_temp, zz, ff, alpha, aa, bb, cc, dd, ee;
+    var calendar_day, calendar_month, calendar_year;
+    var int_day, hours, minutes, daylight_saving;
+    var d_of_w, dow_str, x, y, lat_long = "", dst = 0;
+    var tm_as_str, ut_hrs, ut_mns, part_day;
+
+    var jd = julian_date();
+
+    tm_as_str = document.planets.ut_h_m.value;
+    ut_hrs = eval(tm_as_str.substring(0,2));
+    ut_mns = eval(tm_as_str.substring(3,5));
+    part_day = ut_hrs / 24.0 + ut_mns / 1440.0;
+
+    with (Math) {
+
+        x = floor(abs(latitude));
+        y = floor((abs(latitude) - x) * 60 + 0.5);
+        if (x < 10) lat_long += "0";
+        lat_long = lat_long + x + "\u00B0" + " ";
+        if (y < 10) lat_long += "0";
+        lat_long = lat_long + y + "\'";
+        if (latitude >= 0)
+        {
+            lat_long += " N  ";
+        }
+        else
+        {
+            lat_long += " S  ";
+        }
+
+        x = floor(abs(longitude));
+        y = floor((abs(longitude) - x) * 60 + 0.5);
+        if (x < 100) lat_long += "0";
+        if (x < 10) lat_long += "0";
+        lat_long = lat_long + x + "\u00B0" + " ";
+        if (y < 10) lat_long += "0";
+        lat_long = lat_long + y + "\'";
+        if (longitude >= 0)
+        {
+            lat_long += " W";
+        }
+        else
+        {
+            lat_long += " E";
+        }
+
+        document.planets.lat_long.value = lat_long;
+
+        daylight_saving = document.planets.d_s_t.checked;
+        if (daylight_saving == true)
+        {
+            dst = 1;
+            zone = t_zone + dst;
+        }
+        else
+        {
+            zone = t_zone;
+        }
+
+        document.planets.timezone.value = zone;
+
+        jd_temp = jd + part_day + zone / 24 + 0.5;
+
+        d_of_w = floor(jd_temp + 1.0) % 7;
+
+        if (d_of_w == 0) dow_str = "Sun.";
+        if (d_of_w == 1) dow_str = "Mon.";
+        if (d_of_w == 2) dow_str = "Tue.";
+        if (d_of_w == 3) dow_str = "Wed.";
+        if (d_of_w == 4) dow_str = "Thu.";
+        if (d_of_w == 5) dow_str = "Fri.";
+        if (d_of_w == 6) dow_str = "Sat.";
+
+        zz = floor(jd_temp);
+        ff = jd_temp - zz;
+        alpha = floor((zz - 1867216.25) / 36524.25);
+        aa = zz + 1 + alpha - floor(alpha / 4);
+        bb = aa + 1524;
+        cc = floor((bb - 122.1) / 365.25);
+        dd = floor(365.25 * cc);
+        ee = floor((bb - dd) / 30.6001);
+        calendar_day = bb - dd - floor(30.6001 * ee) + ff;
+        calendar_month = ee;
+        if (ee < 13.5) calendar_month = ee - 1;
+        if (ee > 13.5) calendar_month = ee - 13;
+        calendar_year = cc;
+        if (calendar_month > 2.5) calendar_year = cc - 4716;
+        if (calendar_month < 2.5) calendar_year = cc - 4715;
+        int_day = floor(calendar_day);
+        hours = (calendar_day - int_day) * 24;
+        minutes = floor((hours - floor(hours)) * 60 + 0.5);
+        hours = floor(hours);
+        if (minutes > 59)
+        {minutes = 0; hours = hours + 1;}
+        if (calendar_month < 10) calendar_month = "0" + calendar_month;
+        if (int_day < 10) int_day = "0" + int_day;
+
+    }
+    document.planets.date_zone.value = dow_str + " " + calendar_month + "/" + int_day + "/" + calendar_year + " " + am_pm(hours + minutes / 60.0);
+}
+
+
+function dst () {
+
+    var arr = [];
+    for (var i = 0; i < 365; i++) {
+        var d = new Date();
+        d.setDate(i);
+        newoffset1 = d.getTimezoneOffset();
+        arr.push(newoffset1);
+    }
+    DST = Math.min.apply(null, arr);
+    nonDST = Math.max.apply(null, arr);
+
+
+    var dstDate = new Date();
+    var newOffset = dstDate.getTimezoneOffset();
+    if (DST == newOffset) {
+        document.getElementById("d_s_t").checked = true;
+    }
+}
+/*
+ Convert UT to am/pm
+ */
+function am_pm(h)
+{
+    with (Math) {
+        var hours, minutes, ampm, result="";
+        hours = floor(h);
+        minutes = floor((h - hours) * 60 + 0.5);
+        if (minutes == 60)
+        {
+            hours += 1;
+            minutes = 0;
+        }
+
+        if (hours > 11)
+        {
+            hours -= 12;
+            ampm = " pm";
+        }
+        else
+        {ampm = " am";}
+        if (hours < 1) hours = 12;
+
+        if (hours < 10)
+        {result = result + "0" + floor(hours);}
+        else
+        {result = result + floor(hours);}
+        result = result + ":";
+
+        if (minutes < 10)
+        {result = result + "0" + minutes;}
+        else
+        {result = result + minutes;}
+    }
+    result = result + ampm;
+    return result;
+}
+
+
+/*
+ Find julian Moon date
+ */
+function julian_date()
+{
+    var dt_as_str, mm, dd, yy;
+    var a, b;
+
+    dt_as_str = document.planets.date_txt.value;
+
+    mm = eval(dt_as_str.substring(0,2));
+    dd = eval(dt_as_str.substring(3,5));
+    yy = eval(dt_as_str.substring(6,10));
+
+    with (Math) {
+        var yyy=yy;
+        var mmm=mm;
+        if (mm < 3)
+        {
+            yyy = yy - 1;
+            mmm = mm + 12;
+        }
+        a = floor(yyy/100);
+        b = 2 - a + floor(a/4);
+
+        return floor(365.25*yyy) + floor(30.6001*(mmm+1)) + dd + 1720994.5 + b;
+    }
+}
+
+
+/*
+ find Julian t-zone
+ */
+function julian_date_zoned()
+{
+    var dt_as_str, mm, dd, yy;
+    var a, b;
+
+    dt_as_str = document.planets.date_zone.value;
+
+    mm = eval(dt_as_str.substring(5,7));
+    dd = eval(dt_as_str.substring(8,10));
+    yy = eval(dt_as_str.substring(11,15));
+
+    with (Math) {
+        var yyy=yy;
+        var mmm=mm;
+        if (mm < 3)
+        {
+            yyy = yy - 1;
+            mmm = mm + 12;
+        }
+        a = floor(yyy/100);
+        b = 2 - a + floor(a/4);
+
+        return floor(365.25*yyy) + floor(30.6001*(mmm+1)) + dd + 1720994.5 + b;
+    }
+}
+
+
+/*
+ Calculate moon age, phase, and other facts
+ */
+function moon_facts()
+{
+    with (Math) {
+
+        var dt_as_str, mm,  yy,  i, tmp, k, t;
+        var M, M1, F, NM_FM, FQ_LQ, RAD = 180 / PI;
+        var jd_temp, d_of_w, dow_str, zz, ff, alpha;
+        var aa, bb, cc, dd, ee, calendar_day, month;
+        var calendar_month, int_day, hours, minutes;
+
+        moon_data = "";
+        phase[0] = "New Moon ";
+        phase[1] = "Moon at first quarter ";
+        phase[2] = "Full Moon ";
+        phase[3] = "Moon at last quarter ";
+
+        dt_as_str = document.planets.date_txt.value;
+        yy = eval(dt_as_str.substring(6,10));
+        mm = eval(dt_as_str.substring(0,2));
+        dd = eval(dt_as_str.substring(3,5));
+
+        tmp = floor(((yy + (mm - 1) / 12 + dd / 365.25) - 1900.0) * 12.3685);
+
+        for (i=0; i<4; i++)
+        {
+            k = tmp + i * 0.25;
+            t = k / 1236.85;
+            M = proper_ang(359.2242 + 29.10535608 * k - 0.0000333 * pow(t,2) - 0.00000347 * pow(t,3)) / RAD;
+            M1 = proper_ang(306.0253 + 385.81691806 * k + 0.0107306 * pow(t,2) + 0.00001236 * pow(t,3)) / RAD;
+            F = proper_ang(21.2964 + 390.67050646 * k - 0.0016528 * pow(t,2) - 0.00000239 * pow(t,3)) / RAD;
+            NM_FM = (0.1734 - 0.000393 * t) * sin(M) + 0.0021 * sin(2 * M) - 0.4068 * sin(M1) + 0.0161 * sin(2 * M1) - 0.0004 * sin(3 * M1) + 0.0104 * sin(2 * F) - 0.0051 * sin(M + M1) - 0.0074 * sin(M - M1) + 0.0004 * sin(2 * F + M) - 0.0004 * sin(2 * F - M) - 0.0006 * sin(2 * F + M1) + 0.0010 * sin(2 * F - M1) + 0.0005 * sin(M + 2 * M1);
+            FQ_LQ = (0.1721 - 0.0004 * t) * sin(M) + 0.0021 * sin(2 * M) - 0.628 * sin(M1) + 0.0089 * sin(2 * M1) - 0.0004 * sin(3 * M1) + 0.0079 * sin(2 * F) - 0.0119 * sin(M + M1) - 0.0047 * sin(M - M1) + 0.0003 * sin(2 * F + M) - 0.0004 * sin(2 * F - M) - 0.0006 * sin(2 * F + M1) + 0.0021 * sin(2 * F - M1) + 0.0003 * sin(M + 2 * M1) + 0.0004 * sin(M - 2 * M1) - 0.0003 * sin(2 * M + M1);
+            phases[i] = 2415020.75933 + 29.53058868 * k + 0.0001178 * pow(t,2) - 0.000000155 * pow(t,3) + 0.00033 * sin(2.907 + 2.319 * t - 1.6e-4 * pow(t,2));
+            if (i == 0 || i == 2) phases[i] += NM_FM;
+            if (i == 1) phases[i] = phases[i] + FQ_LQ + 0.0028 - 0.0004 * cos(M) + 0.0003 * cos(M1);
+            if (i == 3) phases[i] = phases[i] + FQ_LQ - 0.0028 + 0.0004 * cos(M) - 0.0003 * cos(M1);
+        }
+        new_moon = phases[0];
+
+        for (i=0; i<4; i++)
+        {
+            jd_temp = phases[i] + 0.5;
+
+            d_of_w = floor(jd_temp + 1.0) % 7;
+            if (d_of_w == 0) dow_str = "Sun.";
+            if (d_of_w == 1) dow_str = "Mon.";
+            if (d_of_w == 2) dow_str = "Tue.";
+            if (d_of_w == 3) dow_str = "Wed.";
+            if (d_of_w == 4) dow_str = "Thu.";
+            if (d_of_w == 5) dow_str = "Fri.";
+            if (d_of_w == 6) dow_str = "Sat.";
+
+            zz = floor(jd_temp);
+            ff = jd_temp - zz;
+            alpha = floor((zz - 1867216.25) / 36524.25);
+            aa = zz + 1 + alpha - floor(alpha / 4);
+            bb = aa + 1524;
+            cc = floor((bb - 122.1) / 365.25);
+            dd = floor(365.25 * cc);
+            ee = floor((bb - dd) / 30.6001);
+            calendar_day = bb - dd - floor(30.6001 * ee) + ff;
+            calendar_month = ee;
+            if (ee < 13.5) calendar_month = ee - 1;
+            if (ee > 13.5) calendar_month = ee - 13;
+            calendar_year = cc;
+            if (calendar_month > 2.5) calendar_year = cc - 4716;
+            if (calendar_month < 2.5) calendar_year = cc - 4715;
+            int_day = floor(calendar_day);
+            hours = (calendar_day - int_day) * 24;
+            minutes = floor((hours - floor(hours)) * 60 + 0.5);
+            hours = floor(hours);
+            if (minutes > 59)
+            {minutes = 0; hours = hours + 1;}
+            if (hours < 10) hours = "0" + hours;
+            if (minutes < 10) minutes = "0" + minutes;
+            if (int_day < 10) int_day = "0" + int_day;
+
+            if (calendar_month == 1) month = "Jan.";
+            if (calendar_month == 2) month = "Feb.";
+            if (calendar_month == 3) month = "Mar.";
+            if (calendar_month == 4) month = "Apr.";
+            if (calendar_month == 5) month = "May ";
+            if (calendar_month == 6) month = "Jun.";
+            if (calendar_month == 7) month = "Jul.";
+            if (calendar_month == 8) month = "Aug.";
+            if (calendar_month == 9) month = "Sep.";
+            if (calendar_month == 10) month = "Oct.";
+            if (calendar_month == 11) month = "Nov.";
+            if (calendar_month == 12) month = "Dec.";
+
+            moon_data += dow_str + " " + month + " " + int_day + ", " + calendar_year + "   " + phase[i] + "(" + hours + ":" + minutes + " UT)";
+
+            if (i == 1 || i == 3)
+            {
+                moon_data += "\n"
+            }
+            else
+            {
+                moon_data += "     ";
+            }
+
+        }
+
+    }
+}
+
+/*
+ Calculate planet location's based on user location, along with values for R.A., Dec, etc.
+ */
+function planets()
+{
+    with (Math) {
+
+        var RAD = 180 / PI;
+
+        document.planets.size6.value = "";
+        document.planets.size7.value = "";
+        document.planets.phase7.value = "";
+        document.planets.phase6.value = "";
+        document.planets.dawn.value = "";
+        document.planets.dusk.value = "";
+        document.planets.tr0.value = "...";
+        document.planets.tr1.value = "...";
+        document.planets.tr2.value = "...";
+        document.planets.tr3.value = "...";
+        document.planets.tr4.value = "...";
+        document.planets.tr5.value = "...";
+        document.planets.tr6.value = "...";
+
+        var planet_dec = new Array(9);
+        var planet_ra = new Array(9);
+        var planet_dist = new Array(9);
+        var planet_phase = new Array(9);
+        var planet_size = new Array(9);
+        var planet_alt = new Array(9);
+        var planet_az = new Array(9);
+
+        var ang_at_1au = [1,6.68,16.82,9.36,196.94,166.6];
+
+        var planet_a = new Array(5);
+        var planet_l = new Array(5);
+        var planet_i = new Array(5);
+        var planet_e = new Array(5);
+        var planet_n = new Array(5);
+        var planet_m = new Array(5);
+        var planet_r = new Array(5);
+
+        var jd, t, l, m, e, c, sl, r, R, Rm, u, p, q, v, z, a, b, ee, oe, t0, gt;
+        var g0, x, y, i, indx, count, hl, ha, eg, et, dr, en, de, ra, la, lo, height;
+        var az, al, size, il, dist, rho_sin_lat, rho_cos_lat, rise_str, set_str;
+        var dawn, dusk, gt_dawn, gt_dusk, dawn_planets, dusk_planets, morn, eve;
+        var sunrise_set, moonrise_set, twilight_begin_end, twilight_start, twilight_end;
+        var sat_lat, phase_angle, dt_as_str, tm_as_str, ut_hrs, ut_mns, part_day, dt;
+        var moon_days, Days, age, N, M_sun, Ec, lambdasun, P0, N0, rise, set, tr, h0;
+        var i_m, e_m, l_m, M_m, N_m, Ev, Ae, A3, A4, lambda_moon, beta_moon, phase;
+        var transit, lambda_transit, beta_transit,  ra_transit;
+        var ra_np, d_beta, d_lambda, lambda_moon_D, beta_moon_D, yy;
+
+        la = latitude / RAD;
+        lo = longitude / RAD;
+        height = 10.0;
+
+        tm_as_str = document.planets.ut_h_m.value;
+        ut_hrs = eval(tm_as_str.substring(0,2));
+        ut_mns = eval(tm_as_str.substring(3,5));
+        dt_as_str = document.planets.date_txt.value;
+        yy = eval(dt_as_str.substring(6,10));
+
+
+        part_day = ut_hrs / 24.0 + ut_mns / 1440.0;
+
+        jd = julian_date() + part_day;
+
+        document.planets.phase8.value = round_1000(jd);
+
+        y = floor(yy / 50 + 0.5) * 50;
+        if (y == 1600) dt = 2;
+        if (y == 1650) dt = 0.8;
+        if (y == 1700) dt = 0.1;
+        if (y == 1750) dt = 0.2;
+        if (y == 1800) dt = 0.2;
+        if (y == 1850) dt = 0.1;
+        if (y == 1900) dt = 0;
+        if (y == 1950) dt = 0.5;
+        if (y == 2000) dt = 1.1;
+        if (y == 2050) dt = 3;
+        if (y == 2100) dt = 5;
+        if (y == 2150) dt = 6;
+        if (y == 2200) dt = 8;
+        if (y == 2250) dt = 11;
+        if (y == 2300) dt = 13;
+        if (y == 2350) dt = 16;
+        if (y == 2400) dt = 19;
+        dt = dt / 1440;
+
+        jd += dt;
+
+        zone_date_time();
+
+        moon_facts();
+
+        t=(jd-2415020.0)/36525;
+        oe=.409319747-2.271109689e-4*t-2.8623e-8*pow(t,2)+8.779e-9*pow(t,3);
+        t0=(julian_date()-2415020.0)/36525;
+        g0=.276919398+100.0021359*t0+1.075e-6*pow(t0,2);
+        g0=(g0-floor(g0))*2*PI;
+        gt=proper_ang_rad(g0+part_day*6.30038808);
+
+        l=proper_ang_rad(4.88162797+628.331951*t+5.27962099e-6*pow(t,2));
+        m=proper_ang_rad(6.2565835+628.3019457*t-2.617993878e-6*pow(t,2)-5.759586531e-8*pow(t,3));
+        e=.01675104-4.18e-5*t-1.26e-7*pow(t,2);
+        c=proper_ang_rad(3.3500896e-2-8.358382e-5*t-2.44e-7*pow(t,2))*sin(m)+(3.50706e-4-1.7e-6*t)*sin(2*m)+5.1138e-6*sin(3*m);
+        sl=proper_ang_rad(l+c);
+        R=1.0000002*(1-pow(e,2))/(1+e*cos(m+c));
+
+        de = asin(sin(oe) * sin(sl));
+        y = sin(sl) * cos(oe);
+        x = cos(sl);
+        ra = proper_ang_rad(atan2(y,x));
+        dist = R;
+        size = 31.9877 / dist;
+
+        ha=proper_ang_rad(gt-lo-ra);
+        al=asin(sin(la)*sin(de)+cos(la)*cos(de)*cos(ha));
+        az=acos((sin(de)-sin(la)*sin(al))/(cos(la)*cos(al)));
+        if (sin(ha)>=0) az=2*PI-az;
+
+        planet_decl[0] = de;
+        planet_r_a[0] = ra;
+        planet_mag[0] = -26.7;
+
+        planet_dec[8] = "";
+        planet_ra[8] = "";
+        planet_dist[8] = "";
+        planet_size[8] = "";
+        planet_alt[8] = "";
+        planet_az[8] = "";
+
+        y = sin(-0.8333/RAD) - sin(la) * sin(de);
+        x = cos(la) * cos(de);
+        if (y/x >= 1)
+        {
+            //rise_str = "No rise";
+            //set_str = "No rise";
+            h0 = 0;
+        }
+        if (y/x <= -1)
+        {
+            //rise_str = "No set";
+            //set_str = "No set";
+            h0 = 0;
+        }
+        if (abs(y/x) < 1)
+        {
+            h0 = acos(y/x) * RAD;
+            tr = range_1((ra * RAD + lo * RAD - g0 * RAD) / 360);
+            document.planets.tr0.value = am_pm(range_1(tr + zone / 24 - dt) * 24);
+            document.planets.tr0_2.value = am_pm(range_1(tr + zone / 24 - dt) * 24);
+
+
+        }
+        y = sin(-18/RAD) - sin(la) * sin(de);
+        x = cos(la) * cos(de);
+        if (y/x >= 1)
+        {
+            twilight_start = "No twilight";
+            twilight_end = "No twilight";
+            h0 = 0;
+        }
+        if (y/x <= -1)
+        {
+            twilight_start = "All night";
+            twilight_end = "All night";
+            h0 = 0;
+        }
+        if (abs(y/x) < 1)
+        {
+            h0 = acos(y/x) * RAD;
+            tr = range_1((ra * RAD + lo * RAD - g0 * RAD) / 360);
+            twilight_start = am_pm(range_1(tr - h0 / 360 + zone / 24 - dt) * 24);
+            twilight_end = am_pm(range_1(tr + h0 / 360 + zone / 24 - dt) * 24);
+        }
+
+        al = al * RAD;
+        az = az * RAD;
+        if (al >= 0)
+        {
+            al += 1.2 / (al + 2);
+        }
+        else
+        {
+            al += 1.2 / (abs(al) + 2);
+        }
+
+        planet_altitude[0] = al;
+        planet_azimuth[0] = az;
+
+        de = de * RAD;
+        ra = ra * RAD / 15;
+
+        x = round_10(abs(de));
+        if (de < 0)
+        {
+            planet_dec[8] += "-";
+        }
+        else
+        {
+            planet_dec[8] += "+";
+        }
+        if (x < 10) planet_dec[8] += "0";
+        planet_dec[8] += x;
+        if (x == floor(x)) planet_dec[8] += ".0";
+        planet_dec[8] += "\u00B0";
+
+        x = floor(ra);
+        y = floor((ra - x) * 60 + 0.5);
+        if (y == 60)
+        {
+            x += 1;
+            y = 0;
+        }
+        if (x < 10) planet_ra[8] += "0";
+        planet_ra[8] += x + "h ";
+        if (y < 10) planet_ra[8] += "0";
+        planet_ra[8] += y + "m";
+
+        dist = round_100(dist);
+        if (dist < 10)
+            planet_dist[8] += "0";
+        planet_dist[8] += dist;
+
+        size = round_10(size);
+        planet_size[8] += size;
+        if (size == floor(size)) planet_size[8] += ".0";
+        planet_size[8] += "\'";
+
+        sunrise_set = sun_rise_set(la,lo,zone);
+        rise_str = sunrise_set.substring(0,8);
+        set_str = sunrise_set.substring(11,19);
+        planet_alt[8] = rise_str;
+        planet_az[8] = set_str;
+
+        /*
+         planet_alt[8] = rise_str;
+         planet_az[8] = set_str;
+         sunrise_set = rise_str + " / " + set_str;
+         */
+
+        moon_days = 29.53058868;
+        Days = jd - 2444238.5;
+        N = proper_ang(Days / 1.01456167);
+        M_sun = proper_ang(N - 3.762863);
+        Ec = 1.91574168 * sin(M_sun / RAD);
+        lambdasun = proper_ang(N + Ec + 278.83354);
+        l0 = 64.975464;
+        P0 = 349.383063;
+        N0 = 151.950429;
+        i_m = 5.145396;
+        e_m = 0.0549;
+        l_m = proper_ang(13.1763966 * Days + l0);
+        M_m = proper_ang(l_m - 0.111404 * Days - P0);
+        N_m = proper_ang(N0 - 0.0529539 * Days);
+        Ev = 1.2739 * sin((2 * (l_m - lambdasun) - M_m) / RAD);
+        Ae = 0.1858 * sin(M_sun / RAD);
+        A3 = 0.37 * sin(M_sun / RAD);
+        M_m += Ev - Ae - A3;
+        Ec = 6.2886 * sin(M_m / RAD);
+        dist = hundred_miles(238855.7 * (1 - pow(e_m,2)) / (1 + e_m * cos((M_m + Ec) / RAD)));
+        A4 = 0.214 * sin(2 * M_m / RAD);
+        l_m += Ev + Ec - Ae + A4;
+        l_m += 0.6583 * sin(2 * (l_m - lambdasun) / RAD);
+        N_m -= 0.16 * sin(M_sun / RAD);
+
+        y = sin((l_m - N_m) / RAD) * cos(i_m / RAD);
+        x = cos((l_m - N_m) / RAD);
+        lambda_moon = proper_ang_rad(atan2(y,x) + N_m / RAD);
+        beta_moon = asin(sin((l_m - N_m) / RAD) * sin(i_m / RAD));
+        d_beta = 8.727e-4 * cos((l_m - N_m) / RAD);
+        d_lambda = 9.599e-3 + 1.047e-3 * cos(M_m / RAD);
+
+        de = asin(sin(beta_moon) * cos(oe) + cos(beta_moon) * sin(oe) * sin(lambda_moon));
+        y = sin(lambda_moon) * cos(oe) - tan(beta_moon) * sin(oe);
+        x = cos(lambda_moon);
+        ra = proper_ang_rad(atan2(y,x));
+
+        ra_np = ra;
+
+        size = 2160 / dist * RAD * 60;
+
+        x = proper_ang(l_m - lambdasun);
+        phase = 50.0 * (1.0 - cos(x / RAD));
+
+        age = jd - new_moon;
+        if (age > moon_days) age -= moon_days;
+        if (age < 0) age += moon_days;
+
+        /*
+         age = (x / 360 * moon_days);
+         */
+        Rm = R - dist * cos(x / RAD) / 92955800;
+        phase_angle = acos((pow(Rm,2) + pow((dist/92955800),2) - pow(R,2)) / (2 * Rm * dist/92955800)) * RAD / 100;
+        planet_mag[6] = round_10(0.21 + 5 * log(Rm * dist / 92955800)/log(10) + 3.05 * (phase_angle) - 1.02 * pow(phase_angle,2) + 1.05 * pow(phase_angle,3));
+        if (planet_mag[6] == floor(planet_mag[6])) planet_mag[6] += ".0";
+
+        /*
+         thisImage = floor(age / moon_days * 28);
+         */
+
+        thisImage = floor(age / moon_days * 27 + 0.5);
+        document.myPicture.src = myImage[thisImage];
+        age = round_10(age);
+
+        x = atan(0.996647 * tan(la));
+        rho_sin_lat = 0.996647 * sin(x) + height * sin(la) / 6378140;
+        rho_cos_lat = cos(x) + height * cos(la) / 6378140;
+        r = dist / 3963.2;
+        ha = proper_ang_rad(gt - lo - ra);
+        x = atan(rho_cos_lat * sin(ha) / (r * cos(de) - rho_cos_lat * cos(ha)));
+        ra -= x;
+        y = ha;
+        ha += x;
+        de = atan(cos(ha) * (r * sin(de) - rho_sin_lat) / (r * cos(de) * cos(y) - rho_cos_lat));
+        ha = proper_ang_rad(gt - lo - ra);
+        al = asin(sin(de) * sin(la) + cos(de) * cos(la) * cos(ha));
+        az = acos((sin(de) - sin(la) * sin(al)) / (cos(la) * cos(al)));
+        if (sin(ha) >= 0) az = 2 * PI - az;
+
+        planet_decl[6] = de;
+        planet_r_a[6] = ra;
+
+        planet_dec[9] = "";
+        planet_ra[9] = "";
+        planet_dist[9] = "";
+        planet_dist[6] = "";
+        planet_phase[9] = "";
+        planet_size[9] = "";
+        planet_alt[9] = "";
+        planet_az[9] = "";
+
+        lambda_moon_D = lambda_moon - d_lambda * part_day * 24;
+        beta_moon_D = beta_moon - d_beta * part_day * 24;
+
+        tr = range_1((ra_np * RAD + lo * RAD - g0 * RAD) / 360);
+        transit = tr * 24;
+        lambda_transit = lambda_moon_D + transit * d_lambda;
+        beta_transit = beta_moon_D + transit * d_beta;
+
+        y = sin(lambda_transit) * cos(oe) - tan(beta_transit) * sin(oe);
+        x = cos(lambda_transit);
+        ra_transit = proper_ang_rad(atan2(y,x));
+        tr = range_1((ra_transit * RAD + lo * RAD - g0 * RAD) / 360);
+        document.planets.tr6.value = am_pm(range_1(tr + zone / 24 - dt) * 24);
+        document.planets.tr6_2.value = am_pm(range_1(tr + zone / 24 - dt) * 24);
+
+
+        al = al * RAD;
+        az = az * RAD;
+        if (al >= 0)
+        {
+            al += 1.2 / (al + 2);
+        }
+        else
+        {
+            al += 1.2 / (abs(al) + 2);
+        }
+
+        planet_altitude[6] = al;
+        planet_azimuth[6] = az;
+
+        de = de * RAD;
+        ra = ra * RAD / 15;
+
+        x = round_10(abs(de));
+        if (de < 0)
+        {
+            planet_dec[9] += "-";
+        }
+        else
+        {
+            planet_dec[9] += "+";
+        }
+        if (x < 10) planet_dec[9] += "0";
+        planet_dec[9] += x;
+        if (x == floor(x)) planet_dec[9] += ".0";
+        planet_dec[9] += "\u00B0";
+
+        x = floor(ra);
+        y = floor((ra - x) * 60 + 0.5);
+        if (y == 60)
+        {
+            x += 1;
+            y = 0;
+        }
+        if (x < 10) planet_ra[9] += "0";
+        planet_ra[9] += x + "h ";
+        if (y < 10) planet_ra[9] += "0";
+        planet_ra[9] += y + "m";
+
+        if (age < 10)
+            planet_dist[6] += "0";
+        planet_dist[6] += age;
+        if (age == floor(age)) planet_dist[6] += ".0";
+        planet_dist[6] += " days";
+
+        planet_dist[9] += dist;
+
+        size = round_10(size);
+        planet_size[9] += size;
+        if (size == floor(size)) planet_size[9] += ".0";
+        planet_size[9] += "\'";
+
+        phase = floor(phase + 0.5);
+        planet_phase[9] += phase + "%";
+
+        moonrise_set = moon_rise_set(la,lo,zone);
+        rise_str = moonrise_set.substring(0,8);
+        set_str = moonrise_set.substring(11,19);
+        planet_alt[9] = rise_str;
+        planet_az[9] = set_str;
+
+
+        if (twilight_start == "All night")
+        {
+            twilight_begin_end = "twilight all night";
+        }
+        else if (twilight_start == "No twilight")
+        {
+            twilight_begin_end = "Sky dark for 24h";
+        }
+        else
+        {
+            twilight_begin_end = twilight_start + " / " + twilight_end;
+        }
+
+        u=t/5+.1;
+        p=proper_ang_rad(4.14473024+52.96910393*t);
+        q=proper_ang_rad(4.64111846+21.32991139*t);
+
+        v=5*q-2*p;
+        z=proper_ang_rad(q-p);
+        if (v >= 0)
+        {
+            v=proper_ang_rad(v);
+        }
+        else
+        {
+            v=proper_ang_rad(abs(v))+2*PI;
+        }
+
+        planet_a[1]=0.3870986;
+        planet_l[1]=proper_ang_rad(3.109811569+2608.814681*t+5.2552e-6*pow(t,2));
+        planet_e[1]=.20561421+2.046e-5*t-3e-8*pow(t,2);
+        planet_i[1]=.12222333+3.247708672e-5*t-3.194e-7*pow(t,2);
+        planet_n[1]=.822851951+.020685787*t+3.035127569e-6*pow(t,2);
+        planet_m[1]=proper_ang_rad(1.785111938+2608.787533*t+1.22e-7*pow(t,2));
+        planet_a[2]=0.7233316;
+        planet_l[2]=proper_ang_rad(5.982413642+1021.352924*t+5.4053e-6*pow(t,2));
+        planet_e[2]=.00682069-4.774e-5*t+9.1e-8*pow(t,2);
+        planet_i[2]=.059230034+1.75545e-5*t-1.7e-8*pow(t,2);
+        planet_n[2]=1.322604346+.0157053*t+7.15585e-6*pow(t,2);
+        planet_m[2]=proper_ang_rad(3.710626189+1021.328349*t+2.2445e-5*pow(t,2));
+        planet_a[3]=1.5236883;
+        planet_l[3]=proper_ang_rad(5.126683614+334.0856111*t+5.422738e-6*pow(t,2));
+        planet_e[3]=.0933129+9.2064e-5*t-7.7e-8*pow(t,2);
+        planet_i[3]=.032294403-1.178097e-5*t+2.199e-7*pow(t,2);
+        planet_n[3]=.851484043+.013456343*t-2.44e-8*pow(t,2)-9.3026e-8*pow(t,3);
+        planet_m[3]=proper_ang_rad(5.576660841+334.0534837*t+3.159e-6*pow(t,2));
+        planet_l[4]=proper_ang_rad(4.154743317+52.99346674*t+5.841617e-6*pow(t,2)-2.8798e-8*pow(t,3));
+        a=.0058*sin(v)-1.1e-3*u*cos(v)+3.2e-4*sin(2*z)-5.8e-4*cos(z)*sin(q)-6.2e-4*sin(z)*cos(q)+2.4e-4*sin(z);
+        b=-3.5e-4*cos(v)+5.9e-4*cos(z)*sin(q)+6.6e-4*sin(z)*cos(q);
+        ee=3.6e-4*sin(v)-6.8e-4*sin(z)*sin(q);
+        planet_e[4]=.04833475+1.6418e-4*t-4.676e-7*pow(t,2)-1.7e-9*pow(t,3);
+        planet_a[4]=5.202561+7e-4*cos(2*z);
+        planet_i[4]=.022841752-9.941569952e-5*t+6.806784083e-8*pow(t,2);
+        planet_n[4]=1.735614994+.017637075*t+6.147398691e-6*pow(t,2)-1.485275193e-7*pow(t,3);
+        planet_m[4]=proper_ang_rad(3.932721257+52.96536753*t-1.26012772e-5*pow(t,2));
+        planet_m[4]=proper_ang_rad(planet_m[4]+a-b/planet_e[4]);
+        planet_l[4]=proper_ang_rad(planet_l[4]+a);
+        planet_e[4]=planet_e[4]+ee;
+
+        planet_a[5]=9.554747;
+        planet_l[5]=proper_ang_rad(4.652426047+21.35427591*t+5.663593422e-6*pow(t,2)-1.01229e-7*pow(t,3));
+        a=-.014*sin(v)+2.8e-3*u*cos(v)-2.6e-3*sin(z)-7.1e-4*sin(2*z)+1.4e-3*cos(z)*sin(q);
+        a=a+1.5e-3*sin(z)*cos(q)+4.4e-4*cos(z)*cos(q);
+        a=a-2.7e-4*sin(3*z)-2.9e-4*sin(2*z)*sin(q)+2.6e-4*cos(2*z)*sin(q);
+        a=a+2.5e-4*cos(2*z)*cos(q);
+        b=1.4e-3*sin(v)+7e-4*cos(v)-1.3e-3*sin(z)*sin(q);
+        b=b-4.3e-4*sin(2*z)*sin(q)-1.3e-3*cos(q)-2.6e-3*cos(z)*cos(q)+4.7e-4*cos(2*z)*cos(q);
+        b=b+1.7e-4*cos(3*z)*cos(q)-2.4e-4*sin(z)*sin(2*q);
+        b=b+2.3e-4*cos(2*z)*sin(2*q)-2.3e-4*sin(z)*cos(2*q)+2.1e-4*sin(2*z)*cos(2*q);
+        b=b+2.6e-4*cos(z)*cos(2*q)-2.4e-4*cos(2*z)*cos(2*q);
+        planet_l[5]=proper_ang_rad(planet_l[5]+a);
+        planet_e[5]=.05589232-3.455e-4*t-7.28e-7*pow(t,2)+7.4e-10*pow(t,3);
+        planet_i[5]=.043502663-6.839770806e-5*t-2.703515011e-7*pow(t,2)+6.98e-10*pow(t,3);
+        planet_n[5]=1.968564089+.015240129*t-2.656042056e-6*pow(t,2)-9.2677e-8*pow(t,3);
+        planet_m[5]=proper_ang_rad(3.062463265+21.32009513*t-8.761552845e-6*pow(t,2));
+        planet_m[5]=proper_ang_rad(planet_m[5]+a-b/planet_e[5]);
+        planet_a[5]=planet_a[5]+.0336*cos(z)-.00308*cos(2*z)+.00293*cos(v);
+        planet_e[5]=planet_e[5]+1.4e-3*cos(v)+1.2e-3*sin(q)+2.7e-3*cos(z)*sin(q)-1.3e-3*sin(z)*cos(q);
+
+        for (i=1; i<6; i++)
+
+        {
+
+            e = planet_m[i];
+            for (count = 1; count <= 50; count++)
+            {
+                de = e - planet_e[i] * sin(e) - planet_m[i];
+                if (abs(de) <= 5e-8) break;
+                e = e - de / (1 - planet_e[i] * cos(e));
+            }
+            v=2*atan(sqrt((1+planet_e[i])/(1-planet_e[i]))*tan(e/2));
+            planet_r[i]=planet_a[i]*(1-planet_e[i]*cos(e));
+            u=proper_ang_rad(planet_l[i]+v-planet_m[i]-planet_n[i]);
+            x=cos(planet_i[i])*sin(u);
+            y=cos(u);
+            y=acos(y/sqrt(pow(x,2)+pow(y,2)));
+            if (x<0) y=2*PI-y;
+
+            hl=proper_ang_rad(y+planet_n[i]);
+            ha=asin(sin(u)*sin(planet_i[i]));
+            x=planet_r[i]*cos(ha)*sin(proper_ang_rad(hl-sl));
+            y=planet_r[i]*cos(ha)*cos(proper_ang_rad(hl-sl))+R;
+            y=acos(y/sqrt(pow(x,2)+pow(y,2)));
+            if (x<0) y=2*PI-y;
+
+            eg=proper_ang_rad(y+sl);
+            dr=sqrt(pow(R,2)+pow(planet_r[i],2)+2*planet_r[i]*R*cos(ha)*cos(proper_ang_rad(hl-sl)));
+            size=ang_at_1au[i]/dr;
+            il=floor((pow((planet_r[i]+dr),2)-pow(R,2))/(4*planet_r[i]*dr)*100+.5);
+            phase_angle=acos((pow(planet_r[i],2)+pow(dr,2)-pow(R,2))/(2*planet_r[i]*dr))*RAD;
+            et=asin(planet_r[i]/dr*sin(ha));
+            en=acos(cos(et)*cos(proper_ang_rad(eg-sl)));
+            de=asin(sin(et)*cos(oe)+cos(et)*sin(oe)*sin(eg));
+            y=cos(eg);
+            x=sin(eg)*cos(oe)-tan(et)*sin(oe);
+            y=acos(y/sqrt(pow(x,2)+pow(y,2)));
+            if (x<0) y=2*PI-y;
+
+            ra=y;
+            ha=proper_ang_rad(gt-lo-ra);
+            al=asin(sin(la)*sin(de)+cos(la)*cos(de)*cos(ha));
+            az=acos((sin(de)-sin(la)*sin(al))/(cos(la)*cos(al)));
+            if (sin(ha)>=0) az=2*PI-az;
+
+            planet_decl[i] = de;
+            planet_r_a[i] = ra;
+
+            planet_mag[i]=5*log(planet_r[i]*dr)/log(10);
+            if (i == 1) planet_mag[i] = -0.42 + planet_mag[i] + 0.038*phase_angle - 0.000273*pow(phase_angle,2) + 0.000002*pow(phase_angle,3);
+            if (i == 2) planet_mag[i] = -4.4 + planet_mag[i] + 0.0009*phase_angle + 0.000239*pow(phase_angle,2) - 0.00000065*pow(phase_angle,3);
+            if (i == 3) planet_mag[i] = -1.52 + planet_mag[i] + 0.016*phase_angle;
+            if (i == 4) planet_mag[i] = -9.4 + planet_mag[i] + 0.005*phase_angle;
+            if (i == 5)
+            {
+                sat_lat = asin(0.47063*cos(et)*sin(eg-2.9585)-0.88233*sin(et));
+                planet_mag[i] = -8.88 + planet_mag[i] + 0.044*phase_angle - 2.6*sin(abs(sat_lat)) + 1.25*pow(sin(sat_lat),2);
+            }
+            planet_mag[i] = round_10(planet_mag[i]);
+            if (planet_mag[i] == floor(planet_mag[i])) planet_mag[i] += ".0";
+            if (planet_mag[i] >= 0) planet_mag[i] = "+" + planet_mag[i];
+
+            planet_dec[i] = "";
+            planet_ra[i] = "";
+            planet_dist[i] = "";
+            planet_size[i] = "";
+            planet_phase[i] = "";
+            planet_alt[i] = "";
+            planet_az[i] = "";
+
+            y = sin(-0.5667/RAD) - sin(la) * sin(de);
+            x = cos(la) * cos(de);
+            if (y/x >= 1)
+            {
+                rise_str = "No rise";
+                set_str = "No rise";
+                h0 = 0;
+            }
+            if (y/x <= -1)
+            {
+                rise_str = "No set";
+                set_str = "No set";
+                h0 = 0;
+            }
+            if (abs(y/x) < 1)
+            {
+                h0 = acos(y/x) * RAD;
+                tr = range_1((ra * RAD + lo * RAD - g0 * RAD) / 360);
+                rise_str = am_pm(range_1(tr - h0 / 360 + zone / 24 - dt) * 24);
+                set_str = am_pm(range_1(tr + h0 / 360 + zone / 24 - dt) * 24);
+                tr = am_pm(range_1(tr + zone / 24 - dt) * 24);
+                if (i == 1) document.planets.tr1.value = tr;
+                if (i == 2) document.planets.tr2.value = tr;
+                if (i == 3) document.planets.tr3.value = tr;
+                if (i == 4) document.planets.tr4.value = tr;
+                if (i == 5) document.planets.tr5.value = tr;
+
+                if (i == 1) document.planets.tr1_2.value = tr;
+                if (i == 2) document.planets.tr2_2.value = tr;
+                if (i == 3) document.planets.tr3_2.value = tr;
+                if (i == 4) document.planets.tr4_2.value = tr;
+                if (i == 5) document.planets.tr5_2.value = tr;
+            }
+
+            al = al * RAD;
+            az = az * RAD;
+            planet_altitude[i] = al;
+            planet_azimuth[i] = az;
+
+            de = de * RAD;
+            ra = ra * RAD / 15;
+
+            x = round_10(abs(de));
+            if (de < 0)
+            {
+                planet_dec[i] += "-";
+            }
+            else
+            {
+                planet_dec[i] += "+";
+            }
+            if (x < 10) planet_dec[i] += "0";
+            planet_dec[i] += x;
+            if (x == floor(x)) planet_dec[i] += ".0";
+            planet_dec[i] += "\u00B0";
+
+            x = floor(ra);
+            y = floor((ra - x) * 60 + 0.5);
+            if (y == 60)
+            {
+                x += 1;
+                y = 0;
+            }
+            if (x < 10) planet_ra[i] += "0";
+            planet_ra[i] += x + "h ";
+            if (y < 10) planet_ra[i] += "0";
+            planet_ra[i] += y + "m";
+
+            dr = round_100(dr);
+            if (dr < 10)
+                planet_dist[i] += "0";
+            planet_dist[i] += dr;
+
+            size = round_10(size);
+            if (size < 10)
+                planet_size[i] += "0";
+            planet_size[i] += size;
+            if (size == floor(size)) planet_size[i] += ".0";
+            planet_size[i] += "\"";
+
+            planet_phase[i] += il + "%";
+
+            planet_alt[i] = rise_str;
+            planet_az[i] = set_str;
+
+        }
+
+        dawn_planets = "";
+        dusk_planets = "";
+        phenomena = "";
+
+        y = sin(-9/RAD) - sin(la) * sin(planet_decl[0]);
+        x = cos(la) * cos(planet_decl[0]);
+        if (y/x >= 1)
+        {
+
+            dawn_planets = "-----";
+            dusk_planets = "-----";
+        }
+        if (y/x <= -1)
+        {
+
+            dawn_planets = "-----";
+            dusk_planets = "-----";
+        }
+        if (abs(y/x) < 1)
+        {
+            h0 = acos(y/x) * RAD;
+            tr = range_1((planet_r_a[0] * RAD + lo * RAD - g0 * RAD) / 360);
+            dawn = range_1(tr - h0 / 360 - dt);
+            dusk = range_1(tr + h0 / 360 - dt);
+        }
+        gt_dawn = proper_ang_rad(g0 + dawn * 6.30038808);
+        gt_dusk = proper_ang_rad(g0 + dusk * 6.30038808);
+
+        indx = 0;
+        morn = 0;
+        eve = 0;
+        for (i=0; i<17; i++)
+        {
+
+            if (i < 6)
+            {
+                ha = proper_ang_rad(gt_dawn - lo - planet_r_a[i]);
+                al = asin(sin(la) * sin(planet_decl[i]) + cos(la) * cos(planet_decl[i]) * cos(ha));
+
+                if (al >= 0)
+                {
+                    if (morn > 0) dawn_planets += ", ";
+                    dawn_planets += planet_name[i];
+                    morn ++;
+                }
+
+                ha = proper_ang_rad(gt_dusk - lo - planet_r_a[i]);
+                al = asin(sin(la) * sin(planet_decl[i]) + cos(la) * cos(planet_decl[i]) * cos(ha));
+
+                if (al >= 0)
+                {
+                    if (eve > 0) dusk_planets += ", ";
+                    dusk_planets += planet_name[i];
+                    eve ++;
+                }
+            }
+
+            x = round_10(acos(sin(planet_decl[6]) * sin(planet_decl[i]) + cos(planet_decl[6]) * cos(planet_decl[i]) * cos(planet_r_a[6] - planet_r_a[i])) * RAD);
+
+            if (x <= 10 && i != 6)
+            {
+                if (indx > 0) phenomena += " and ";
+                if (x < 1)
+                {
+                    phenomena += "less than 1";
+                }
+                else
+                {
+                    phenomena += floor(x + 0.5);
+                }
+                phenomena += "\u00B0" + " from " + planet_name[i];
+                if (x < 0.5)
+                {
+                    if (i == 0)
+                    {
+                        phenomena += " (eclipse possible)";
+                    }
+                    else
+                    {
+                        phenomena += " (occultation possible)";
+                    }
+                }
+                indx ++
+            }
+        }
+
+        if (dawn_planets == "") dawn_planets = "-----";
+        if (dusk_planets == "") dusk_planets = "-----";
+
+        if (indx > 0)
+        {
+            phenomena = "The Moon is " + phenomena + ".  ";
+        }
+        indx = 0;
+        for (i=1; i<16; i++)
+        {
+            for (count=i+1; count<17; count++)
+            {
+                if (i != 6 && count != 6)
+                {
+                    x = round_10(acos(sin(planet_decl[count]) * sin(planet_decl[i]) + cos(planet_decl[count]) * cos(planet_decl[i]) * cos(planet_r_a[count] - planet_r_a[i])) * RAD);
+                    if (x <= 5)
+                    {
+                        if (indx > 0) phenomena += " and ";
+                        phenomena += planet_name[count] + " is ";
+                        if (x < 1)
+                        {
+                            phenomena += "less than 1";
+                        }
+                        else
+                        {
+                            phenomena += floor(x + 0.5);
+                        }
+                        phenomena += "\u00B0" + " from " + planet_name[i];
+                        indx ++
+                    }
+                    x = 0;
+                }
+            }
+        }
+        if (indx > 0) phenomena += ".";
+
+        if (jd > 2454048.3007 && jd < 2454048.5078)
+        {
+            phenomena += "\nMercury is transiting the face of the Sun. ";
+            x = round_10((2454048.50704 - jd) * 24);
+            if (x >= 0.1)
+            {
+                phenomena += "The spectacle continues for a further " + x + " hours."
+            }
+        }
+
+        if (phenomena != "") { phenomena += "\n"; }
+        if (planet_altitude[0] < -18) phenomena += "The sky is dark. ";
+        if (planet_altitude[0] >= -18 && planet_altitude[0] < -12) phenomena += "The Sun is below the horizon (altitude " + floor(planet_altitude[0] + 0.5) + "\u00B0) and the sky is in deep twilight. ";
+        if (planet_altitude[0] >= -12 && planet_altitude[0] < -6) phenomena += "The Sun is below the horizon (altitude " + floor(planet_altitude[0] + 0.5) + "\u00B0) and the sky is in twilight. ";
+        if (planet_altitude[0] >= -6 && planet_altitude[0] < -0.3) phenomena += "The Sun is below the horizon (altitude " + floor(planet_altitude[0] + 0.5) + "\u00B0) and the sky is in bright twilight. ";
+        if (planet_altitude[0] >= -0.3) phenomena += "The Sun is above the horizon (altitude " + floor(planet_altitude[0] + 0.5) + "\u00B0). ";
+        if (planet_altitude[6] >= -0.3) phenomena += "The Moon is above the horizon (altitude " + floor(planet_altitude[6] + 0.5) + "\u00B0). ";
+        if (planet_altitude[6] < -0.3) phenomena += "The Moon is below the horizon. ";
+        phenomena += "\n";
+        phenomena += moon_data;
+
+        /* Commented out 2009-specific events 2010/01/27 - DAF
+         phenomena += "-----\n2009 Phenomena\n";
+         phenomena += "yyyy mm dd hh UT    All dates and times are UT\n"
+         + "2009 01 02 04 UT    Mercury at greatest illuminated extent (evening)\n"
+         + "2009 01 03 13 UT    Meteor shower peak -- Quadrantids\n"
+         + "2009 01 04 14 UT    Mercury at greatest elongation, 19.3\u00B0 east of Sun (evening)\n"
+         + "2009 01 04 16 UT    Earth at perihelion 91,400,939 miles (147,095,552 km)\n"
+         + "2009 01 10 11 UT    Moon at perigee, 222,137 miles (357,495 km)\n"
+         + "2009 01 14 21 UT    Venus at greatest elongation, 47.1\u00B0 east of Sun (evening)\n"
+         + "2009 01 23 00 UT    Moon at apogee, 252,350 miles (406,118 km)\n"
+         + "2009 01 26          Annular eclipse of the Sun (South Atlantic, Indonesia)\n"
+         + "2009 02 07 20 UT    Moon at perigee, 224,619 miles (361,489 km)\n"
+         + "2009 02 09 14:38 UT Penumbral lunar eclipse (midtime)\n"
+         + "2009 02 11 01 UT    Mercury at greatest illuminated extent (morning)\n"
+         + "2009 02 13 21 UT    Mercury at greatest elongation, 26.1\u00B0 west of Sun (morning)\n"
+         + "2009 02 19 16 UT    Venus at greatest illuminated extent (evening)\n"
+         + "2009 02 19 17 UT    Moon at apogee, 251,736 miles (405,129 km)\n"
+         + "2009 03 07 15 UT    Moon at perigee, 228,053 miles (367,016 km)\n"
+         + "2009 03 08 20 UT    Saturn at opposition\n"
+         + "2009 03 19 13 UT    Moon at apogee, 251,220 miles (404,299 km)\n"
+         + "2009 03 20 11:44 UT Spring (Northern Hemisphere) begins at the equinox\n"
+         + "2009 03 27 19 UT    Venus at inferior conjunction with Sun\n"
+         + "2009 04 02 02 UT    Moon at perigee, 229,916 miles (370,013 km)\n"
+         + "2009 04 13 05 UT    Mercury at greatest illuminated extent (evening)\n"
+         + "2009 04 16 09 UT    Moon at apogee, 251,178 miles (404,232 km)\n"
+         + "2009 04 22 11 UT    Meteor shower peak -- Lyrids\n"
+         + "2009 04 26 08 UT    Mercury at greatest elongation, 20.4\u00B0 east of Sun (evening)\n"
+         + "2009 04 28 06 UT    Moon at perigee, 227,446 miles (366,039 km)\n"
+         + "2009 05 02 14 UT    Venus at greatest illuminated extent (morning)\n"
+         + "2009 05 06 00 UT    Meteor shower peak -- Eta Aquarids\n"
+         + "2009 05 14 03 UT    Moon at apogee, 251,603 miles (404,915 km)\n"
+         + "2009 05 26 04 UT    Moon at perigee, 224,410 miles (361,153 km)\n"
+         + "2009 06 05 21 UT    Venus at greatest elongation, 45.8\u00B0 west of Sun (morning)\n"
+         + "2009 06 10 16 UT    Moon at apogee, 252,144 miles (405,787 km)\n"
+         + "2009 06 13 12 UT    Mercury at greatest elongation, 23.5\u00B0 west of Sun (morning)\n"
+         + "2009 06 21 05:46 UT Summer (Northern Hemisphere) begins at the solstice\n"
+         + "2009 06 23 11 UT    Moon at perigee, 222,459 miles (358,013 km)\n"
+         + "2009 07 03 21 UT    Mercury at greatest illuminated extent (morning)\n"
+         + "2009 07 04 02 UT    Earth at aphelion 94,505,048 miles (152,091,132 km)\n"
+         + "2009 07 07 09:39 UT Penumbral lunar eclipse (too slight to see)\n"
+         + "2009 07 07 22 UT    Moon at apogee, 252,421 miles (406,232 km)\n"
+         + "2009 07 21 20 UT    Moon at perigee, 222,118 miles (357,464 km)\n"
+         + "2009 07 22          Total solar eclipse (India, China, and a few Pacific islands)\n"
+         + "2009 07 28 02 UT    Meteor shower peak -- Delta Aquarids\n"
+         + "2009 08 04 01 UT    Moon at apogee, 252,294 miles (406,028 km)\n"
+         + "2009 08 06 00:39 UT Weak penumbral lunar eclipse (midtime)\n"
+         + "2009 08 12 17 UT    Meteor shower peak -- Perseids\n"
+         + "2009 08 14 18 UT    Jupiter at opposition\n"
+         + "2009 08 17 21 UT    Neptune at opposition\n"
+         + "2009 08 19 05 UT    Moon at perigee, 223,469 miles (359,638 km)\n"
+         + "2009 08 24 16 UT    Mercury at greatest elongation, 27.4\u00B0 east of Sun (evening)\n"
+         + "2009 08 26 09 UT    Mercury at greatest illuminated extent (evening)\n"
+         + "2009 08 31 11 UT    Moon at apogee, 251,823 miles (405,269 km)\n"
+         + "2009 09 16 08 UT    Moon at perigee, 226,211 miles (364,052 km)\n"
+         + "2009 09 17 09 UT    Uranus at opposition\n"
+         + "2009 09 22 21:19 UT Fall (Northern Hemisphere) begins at the equinox\n"
+         + "2009 09 28 04 UT    Moon at apogee, 251,302 miles (404,432 km)\n"
+         + "2009 10 06 02 UT    Mercury at greatest elongation, 17.9\u00B0 west of Sun (morning)\n"
+         + "2009 10 11 07 UT    Mercury at greatest illuminated extent (morning)\n"
+         + "2009 10 13 12 UT    Moon at perigee, 229,327 miles (369,066 km)\n"
+         + "2009 10 21 10 UT    Meteor shower peak -- Orionids\n"
+         + "2009 10 25 23 UT    Moon at apogee, 251,137 miles (404,166 km)\n"
+         + "2009 11 05 10 UT    Meteor shower peak -- Southern Taurids\n"
+         + "2009 11 07 07 UT    Moon at perigee, 229,225 miles (368,902 km)\n"
+         + "2009 11 12 10 UT    Meteor shower peak -- Northern Taurids\n"
+         + "2009 11 17 15 UT    Meteor shower peak -- Leonids\n"
+         + "2009 11 22 20 UT    Moon at apogee, 251,489 miles (404,733 km)\n"
+         + "2009 12 04 14 UT    Moon at perigee, 225,856 miles (363,481 km)\n"
+         + "2009 12 14 05 UT    Meteor shower peak -- Geminids\n"
+         + "2009 12 17 13 UT    Mercury at greatest illuminated extent (evening)\n"
+         + "2009 12 18 17 UT    Mercury at greatest elongation, 20.3\u00B0 east of Sun (evening)\n"
+         + "2009 12 20 15 UT    Moon at apogee, 252,109 miles (405,731 km)\n"
+         + "2009 12 21 17:47 UT Winter (Northern Hemisphere) begins at the solstice\n"
+         + "2009 12 31          Partial lunar eclipse, 18:52 UT to 19:54 UT\n-----\n";
+         END Comment DAF */
+
+        document.planets.ra1.value = planet_ra[1];
+        document.planets.dec1.value = planet_dec[1];
+        document.planets.dist1.value = planet_mag[1];
+        document.planets.size1.value = planet_size[1];
+        document.planets.phase1.value = planet_phase[1];
+        document.planets.alt1.value = planet_alt[1];
+        document.planets.az1.value = planet_az[1];
+
+        document.planets.ra1_2.value = planet_ra[1];
+        document.planets.dec1_2.value = planet_dec[1];
+        document.planets.dist1_2.value = planet_mag[1];
+        document.planets.size1_2.value = planet_size[1];
+        document.planets.phase1_2.value = planet_phase[1];
+        document.planets.alt1_2.value = planet_alt[1];
+        document.planets.az1_2.value = planet_az[1];
+
+        document.planets.ra2.value = planet_ra[2];
+        document.planets.dec2.value = planet_dec[2];
+        document.planets.dist2.value = planet_mag[2];
+        document.planets.size2.value = planet_size[2];
+        document.planets.phase2.value = planet_phase[2];
+        document.planets.alt2.value = planet_alt[2];
+        document.planets.az2.value = planet_az[2];
+
+        document.planets.ra2_2.value = planet_ra[2];
+        document.planets.dec2_2.value = planet_dec[2];
+        document.planets.dist2_2.value = planet_mag[2];
+        document.planets.size2_2.value = planet_size[2];
+        document.planets.phase2_2.value = planet_phase[2];
+        document.planets.alt2_2.value = planet_alt[2];
+        document.planets.az2_2.value = planet_az[2];
+
+        document.planets.ra3.value = planet_ra[3];
+        document.planets.dec3.value = planet_dec[3];
+        document.planets.dist3.value = planet_mag[3];
+        document.planets.size3.value = planet_size[3];
+        document.planets.phase3.value = planet_phase[3];
+        document.planets.alt3.value = planet_alt[3];
+        document.planets.az3.value = planet_az[3];
+
+        document.planets.ra3_2.value = planet_ra[3];
+        document.planets.dec3_2.value = planet_dec[3];
+        document.planets.dist3_2.value = planet_mag[3];
+        document.planets.size3_2.value = planet_size[3];
+        document.planets.phase3_2.value = planet_phase[3];
+        document.planets.alt3_2.value = planet_alt[3];
+        document.planets.az3_2.value = planet_az[3];
+
+        document.planets.ra4.value = planet_ra[4];
+        document.planets.dec4.value = planet_dec[4];
+        document.planets.dist4.value = planet_mag[4];
+        document.planets.size4.value = planet_size[4];
+        // document.planets.phase4.value = planet_phase[4];
+        document.planets.alt4.value = planet_alt[4];
+        document.planets.az4.value = planet_az[4];
+
+        document.planets.ra4_2.value = planet_ra[4];
+        document.planets.dec4_2.value = planet_dec[4];
+        document.planets.dist4_2.value = planet_mag[4];
+        document.planets.size4_2.value = planet_size[4];
+        // document.planets.phase4_2.value = planet_phase[4];
+        document.planets.alt4_2.value = planet_alt[4];
+        document.planets.az4_2.value = planet_az[4];
+
+        document.planets.ra5.value = planet_ra[5];
+        document.planets.dec5.value = planet_dec[5];
+        document.planets.dist5.value = planet_mag[5];
+        document.planets.size5.value = planet_size[5];
+        // document.planets.phase5.value = planet_phase[5];
+        document.planets.alt5.value = planet_alt[5];
+        document.planets.az5.value = planet_az[5];
+
+        document.planets.ra5_2.value = planet_ra[5];
+        document.planets.dec5_2.value = planet_dec[5];
+        document.planets.dist5_2.value = planet_mag[5];
+        document.planets.size5_2.value = planet_size[5];
+        // document.planets.phase5_2.value = planet_phase[5];
+        document.planets.alt5_2.value = planet_alt[5];
+        document.planets.az5_2.value = planet_az[5];
+
+        document.planets.dist6.value = planet_dist[6];
+        document.planets.size6.value = sunrise_set;
+        document.planets.phase6.value = phenomena;
+        document.planets.dawn.value = dawn_planets;
+        document.planets.dusk.value = dusk_planets;
+        document.planets.size7.value = moonrise_set;
+        document.planets.phase7.value = twilight_begin_end;
+
+        document.planets.ra8.value = planet_ra[8];
+        document.planets.dec8.value = planet_dec[8];
+        document.planets.dist8.value = planet_mag[0];
+        document.planets.size8.value = planet_size[8];
+        document.planets.alt8.value = planet_alt[8];
+        document.planets.az8.value = planet_az[8];
+
+        document.planets.ra8_2.value = planet_ra[8];
+        document.planets.dec8_2.value = planet_dec[8];
+        document.planets.dist8_2.value = planet_mag[0];
+        document.planets.size8_2.value = planet_size[8];
+        document.planets.alt8_2.value = planet_alt[8];
+        document.planets.az8_2.value = planet_az[8];
+
+        document.planets.ra9.value = planet_ra[9];
+        document.planets.dec9.value = planet_dec[9];
+        document.planets.dist9.value = planet_mag[6];
+        document.planets.size9.value = planet_size[9];
+        document.planets.phase9.value = planet_phase[9];
+        document.planets.alt9.value = planet_alt[9];
+        document.planets.az9.value = planet_az[9];
+
+        document.planets.ra9_2.value = planet_ra[9];
+        document.planets.dec9_2.value = planet_dec[9];
+        document.planets.dist9_2.value = planet_mag[6];
+        document.planets.size9_2.value = planet_size[9];
+        document.planets.phase9_2.value = planet_phase[9];
+        document.planets.alt9_2.value = planet_alt[9];
+        document.planets.az9_2.value = planet_az[9];
+
+    }
+}
+
+
+/*
+ Calculate time for moonrise/moonset
+ */
+function moon_rise_set(latitude,longitude,tzone)
+{
+    with (Math) {
+
+        var r_a = new Array(3);
+        var dec = new Array(3);
+        var dist = new Array(3);
+        var i, c0, p1, p2, r1, RAD, k1, b5, l5, h, z0, t, t0;
+        var s, l, m, f, d, n, g, v, u, w, a5, d5, r5, z1, c, z, m8, w8;
+        var a0, d0, p, f0, f1, f2, a, b, a2, d2, l0, l2, h0, h2, d1;
+        var v0=0, v1=0, v2=0, e, t3, rise_str = "", set_str = "";
+
+        p1 = PI;
+        p2 = 2 * p1;
+        r1 = PI / 180;
+        RAD = 1 / r1;
+        k1 = 15 * r1 * 1.002738;
+
+        b5 = latitude * RAD;
+        l5 = longitude * RAD;
+        h = tzone;
+        l5 = -l5 / 360;
+        z0 = -h / 24;
+
+        t = (julian_date_zoned() - 2451545.0);
+
+        t0 = t / 36525;
+        s = (24110.5 + 8640184.813 * t0 + 86636.6 * z0 + 86400 * l5) / 86400;
+        s = s - floor(s);
+        t0 = s * 360 * r1;
+        t = t + z0;
+
+        for (i=1; i<4; i++)
+        {
+            l = 0.606434 + 0.036601 * t;
+            m = 0.374897 + 0.036292 * t;
+            f = 0.259091 + 0.036748 * t;
+            d = 0.827362 + 0.033863 * t;
+            n = 0.347343 - 1.470939e-04 * t;
+            g = 0.993126 + 2.737778e-03 * t;
+
+            l = (l - floor(l)) * p2;
+            m = (m - floor(m)) * p2;
+            f = (f - floor(f)) * p2;
+            d = (d - floor(d)) * p2;
+            n = (n - floor(n)) * p2;
+            g = (g - floor(g)) * p2;
+
+            v = 0.39558*sin(f+n) + 0.082*sin(f) + 0.03257*sin(m-f-n) + 0.01092*sin(m+f+n) + 6.66e-03*sin(m-f) - 6.44e-03*sin(m+f-2*d+n) - 3.31e-03*sin(f-2*d+n) - 3.04e-03*sin(f-2*d) - 2.4e-03*sin(m-f-2*d-n) + 2.26e-03*sin(m+f) - 1.08e-03*sin(m+f-2*d) - 7.9e-04*sin(f-n) + 7.8e-04*sin(f+2*d+n);
+
+            u = 1 - 0.10828*cos(m) - 0.0188*cos(m-2*d) - 0.01479*cos(2*d) + 1.81e-03*cos(2*m-2*d) - 1.47e-03*cos(2*m) - 1.05e-03*cos(2*d-g) - 7.5e-04*cos(m-2*d+g);
+
+            w = 0.10478*sin(m) - 0.04105*sin(2*f+2*n) - 0.0213*sin(m-2*d) - 0.01779*sin(2*f+n) + 0.01774*sin(n) + 9.87e-03*sin(2*d) - 3.38e-03*sin(m-2*f-2*n) - 3.09e-03*sin(g) - 1.9e-03*sin(2*f) - 1.44e-03*sin(m+n) - 1.44e-03*sin(m-2*f-n) - 1.13e-03*sin(m+2*f+2*n) - 9.4e-04*sin(m-2*d+g) - 9.2e-04*sin(2*m-2*d);
+
+            s = w / sqrt(u-v*v);
+            a5 = l + atan(s / sqrt(1-s*s));
+            s = v / sqrt(u);
+            d5 = atan(s / sqrt(1-s*s));
+            r5 = 60.40974 * sqrt(u);
+            r_a[i] = a5;
+            dec[i] = d5;
+            dist[i] = r5;
+
+            t += 0.5;
+        }
+
+        if (r_a[2] < r_a[1]) r_a[2] += p2;
+        if (r_a[3] < r_a[2]) r_a[3] += p2;
+
+        z1 = r1 * (90.567 - 41.685 / dist[2]);
+        s = sin(b5*r1);
+        c = cos(b5*r1);
+        z = cos(z1);
+        m8 = 0;
+        w8 = 0;
+        a0 = r_a[1];
+        d0 = dec[1];
+
+        for (c0=0; c0<24; c0++)
+        {
+            p = (c0 + 1) / 24;
+            f0 = r_a[1];
+            f1 = r_a[2];
+            f2 = r_a[3];
+            a = f1 - f0;
+            b = f2 - f1 - a;
+            f = f0 + p * (2 * a + b * (2 * p - 1));
+            a2 = f;
+
+            f0 = dec[1];
+            f1 = dec[2];
+            f2 = dec[3];
+            a = f1 - f0;
+            b = f2 - f1 - a;
+            f = f0 + p * (2 * a + b * (2 * p - 1));
+            d2 = f;
+
+            l0 = t0 + c0 * k1;
+            l2 = l0 + k1;
+            if (a2 < a0) a2 += p2;
+            h0 = l0 - a0;
+            h2 = l2 - a2;
+            h1 = (h2 + h0) / 2;
+            d1 = (d2 + d0) / 2;
+            if (c0 < 1) v0 = s * sin(d0) + c * cos(d0) * cos(h0) - z;
+            v2 = s * sin(d2) + c * cos(d2) * cos(h2) - z;
+            if (sign_of(v0) != sign_of(v2))
+            {
+                v1 = s * sin(d1) + c * cos(d1) * cos(h1) - z;
+                a = 2 * v2 - 4 * v1 + 2 * v0;
+                b = 4 * v1 - 3 * v0 - v2;
+                d = b * b - 4 * a * v0;
+                if (d >= 0)
+                {
+                    d = sqrt(d);
+                    e = (-b + d) / (2 * a);
+                    if (e > 1 || e < 0) e = (-b - d) / (2 * a);
+                    t3 = am_pm(c0 + e);
+                    if (v0 < 0 && v2 > 0)
+                    {
+                        m8 = 1;
+                        rise_str = t3;
+                    }
+                    if (v0 > 0 && v2 < 0)
+                    {
+                        w8 = 1;
+                        set_str = t3;
+                    }
+                }
+            }
+            a0 = a2;
+            d0 = d2;
+            v0 = v2;
+        }
+
+        if (m8 == 0 && w8 == 0)
+        {
+            if (v2 < 0)
+            {
+                rise_str = "down 24h";
+                set_str = "down 24h";
+            }
+            if (v2 > 0)
+            {
+                rise_str = " up 24h ";
+                set_str = " up 24h ";
+            }
+        }
+        else
+        {
+            if (m8 == 0) rise_str = " ------ ";
+            if (w8 == 0) set_str = " ------ ";
+        }
+
+        result = rise_str + " / " + set_str;
+
+        return result;
+    }
+}
+
+
+/*
+ Calculate time for sunrise/sunset
+ */
+function sun_rise_set(latitude,longitude,tzone)
+{
+    with (Math) {
+
+        var r_a = new Array(2);
+        var dec = new Array(2);
+        var p1 = PI;
+        var p2 = 2 * p1;
+        var dr = p1 / 180;
+        var RAD = 1 / dr;
+        var k1 = 15 * dr * 1.0027379;
+
+        var b5, l5, h, z0, t, tt, t0, s, l, g, v, u, w;
+        var a5, d5,  z1, c, z, m8, w8, a0, d0, da, dd;
+        var c0, p, a2, d2, l0, l2, h0, h1, h2, d1;
+        var v0=0, v1=0, v2=0, a, b, d, e, t3;
+        var rise_str = "", set_str = "";
+
+        b5 = latitude * RAD;
+        l5 = longitude * RAD;
+        h = tzone;
+        l5 = -l5 / 360;
+        z0 = -h / 24;
+        t = (julian_date_zoned() - 2451545.0);
+
+        tt = t / 36525 + 1;
+        t0 = t / 36525;
+        s = (24110.5 + 8640184.813 * t0 + 86636.6 * z0 + 86400 * l5) / 86400;
+        s = s - floor(s);
+        t0 = s * 360 * dr;
+
+        t = t + z0;
+        l = .779072+.00273790931*t;
+        g = .993126+.0027377785*t;
+        l = (l-floor(l))*p2;
+        g = (g-floor(g))*p2;
+        v = .39785*sin(l)-.01000*sin(l-g)+.00333*sin(l+g)-.00021*tt*sin(l);
+        u = 1-.03349*cos(g)-.00014*cos(2*l)+.00008*cos(l);
+        w = -.00010-.04129*sin(2*l)+.03211*sin(g)+.00104*sin(2*l-g)-.00035*sin(2*l+g)-.00008*tt*sin(g);
+        s = w/sqrt(u-v*v);
+        a5 = l+atan(s/sqrt(1-s*s));
+        s = v/sqrt(u);
+        d5 = atan(s/sqrt(1-s*s));
+
+        r_a[1] = a5;
+        dec[1] = d5;
+
+        t = t + 1;
+
+        l = .779072+.00273790931*t;
+        g = .993126+.0027377785*t;
+        l = (l-floor(l))*p2;
+        g = (g-floor(g))*p2;
+        v = .39785*sin(l)-.01000*sin(l-g)+.00333*sin(l+g)-.00021*tt*sin(l);
+        u = 1-.03349*cos(g)-.00014*cos(2*l)+.00008*cos(l);
+        w = -.00010-.04129*sin(2*l)+.03211*sin(g)+.00104*sin(2*l-g)-.00035*sin(2*l+g)-.00008*tt*sin(g);
+        s = w/sqrt(u-v*v);
+        a5 = l+atan(s/sqrt(1-s*s));
+        s = v/sqrt(u);
+        d5 = atan(s/sqrt(1-s*s));
+
+        r_a[2] = a5;
+        dec[2] = d5;
+        if (r_a[2] < r_a[1]) r_a[2] += p2;
+        z1 = dr * 90.833;
+        s = sin(b5 * dr);
+        c = cos(b5 * dr);
+        z = cos(z1);
+        m8 = 0;
+        w8 = 0;
+        a0 = r_a[1];
+        d0 = dec[1];
+        da = r_a[2] - r_a[1];
+        dd = dec[2] - dec[1];
+
+        for (c0=0; c0<24; c0++)
+        {
+            p = (c0 + 1) / 24;
+            a2 = r_a[1] + p * da;
+            d2 = dec[1] + p * dd;
+
+            l0 = t0 + c0 * k1;
+            l2 = l0 + k1;
+            h0 = l0 - a0;
+            h2 = l2 - a2;
+            h1 = (h2 + h0) / 2;
+            d1 = (d2 + d0) / 2;
+            if (c0 < 1) v0 = s * sin(d0) + c * cos(d0) * cos(h0) - z;
+            v2 = s * sin(d2) + c * cos(d2) * cos(h2) - z;
+            if (sign_of(v0) != sign_of(v2))
+            {
+                v1 = s * sin(d1) + c * cos(d1) * cos(h1) - z;
+                a = 2 * v2 - 4 * v1 + 2 * v0;
+                b = 4 * v1 - 3 * v0 - v2;
+                d = b * b - 4 * a * v0;
+                if (d >= 0)
+                {
+                    d = sqrt(d);
+                    e = (-b + d) / (2 * a);
+                    if (e > 1 || e < 0) e = (-b - d) / (2 * a);
+                    t3 = am_pm(c0 + e);
+                    if (v0 < 0 && v2 > 0)
+                    {
+                        m8 = 1;
+                        rise_str = t3;
+                    }
+                    if (v0 > 0 && v2 < 0)
+                    {
+                        w8 = 1;
+                        set_str = t3;
+                    }
+                }
+            }
+            a0 = a2;
+            d0 = d2;
+            v0 = v2;
+        }
+
+        if (m8 == 0 && w8 == 0)
+        {
+            if (v2 < 0)
+            {
+                rise_str = "down 24h";
+                set_str = "down 24h";
+            }
+            if (v2 > 0)
+            {
+                rise_str = " up 24h ";
+                set_str = " up 24h ";
+            }
+        }
+        else
+        {
+            if (m8 == 0) rise_str = " ------ ";
+            if (w8 == 0) set_str = " ------ ";
+        }
+
+        result = rise_str + " / " + set_str;
+
+        return result;
+    }
+}
+
+
+/*
+ Get cookie data for loading location
+ */
+function getCookie( name )
+{
+    var start = document.cookie.indexOf( name + "=" );
+    var len = start + name.length + 1;
+    if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
+        return null;
+    }
+    if ( start == -1 ) return null;
+    var end = document.cookie.indexOf( ";", len );
+    if ( end == -1 ) end = document.cookie.length;
+    return decodeURI( document.cookie.substring( len, end ) );
+}
+
+
+/*
+ Set cookie data for loading location
+ */
+function setCookie( name, value, expires, path, domain, secure )
+{
+    var today = new Date();
+    today.setTime( today.getTime() );
+    if ( expires ) {
+        expires = expires * 1000 * 60 * 60 * 24;
+    }
+    var expires_date = new Date( today.getTime() + (expires) );
+    document.cookie = name+"="+ encodeURI( value ) +
+        ( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
+        ( ( path ) ? ";path=" + path : "" ) +
+        ( ( domain ) ? ";domain=" + domain : "" ) +
+        ( ( secure ) ? ";secure" : "" );
+}
+
+
+/*
+ Delete cookies for new location
+ */
+function deleteCookie( name, path, domain )
+{
+    if ( getCookie( name ) ) document.cookie = name + "=" +
+        ( ( path ) ? ";path=" + path : "") +
+        ( ( domain ) ? ";domain=" + domain : "" ) +
+        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
+}
+
+
+/*
+ Save current location
+ */
+function save_loc()
+{
+    deleteCookie('almanac2latdeg','','');
+    deleteCookie('almanac2longdeg','','');
+    deleteCookie('almanac2tzonehours','','');
+    setCookie('almanac2latdeg',round_1000(latitude),365,'','','');
+    setCookie('almanac2longdeg',round_1000(longitude),365,'','','');
+    setCookie('almanac2tzonehours',t_zone,365,'','','');
+    alert("The current location has been saved.");
+}
+
+/*
+ Load saved location and reload window
+ */
+function load_loc()
+{
+    var full_custom_URL = "/wp-content/plugins/observing-tools/almanac/almanac.html?";
+    var display_saved_almanac;
+    var lat_deg = getCookie('almanac2latdeg');
+    var lng_deg = getCookie('almanac2longdeg');
+    var time_zone_hours = getCookie('almanac2tzonehours');
+
+    if (lat_deg == null && lng_deg == null)
+    {
+        alert ("Sorry, but you haven't saved a previous latitude and longitude. If you want the Almanac to remember the currently displayed location, please click the 'Save this?' link. Alternatively, enter a new latitude and longitude by clicking the 'New?' link.")
+    }
+    else
+    {
+        full_custom_URL += "latitude=" + lat_deg + "&";
+        full_custom_URL += "longitude=" + lng_deg + "&";
+        full_custom_URL += "tzone=" + time_zone_hours + "&";
+        full_custom_URL += "UTdate=" + document.planets.date_txt.value + "&";
+        full_custom_URL += "UTtime=" + document.planets.ut_h_m.value;
+        display_saved_almanac = window.open(full_custom_URL,'chooser');
+    }
+}

Разница между файлами не показана из-за своего большого размера
+ 516 - 0
app/calendar/Almanac v2.0_files/jquery-ui.css


Разница между файлами не показана из-за своего большого размера
+ 5 - 0
app/calendar/Almanac v2.0_files/jquery-ui.min.js.下载


Разница между файлами не показана из-за своего большого размера
+ 1 - 0
app/calendar/Almanac v2.0_files/jquery.min.js.下载


Разница между файлами не показана из-за своего большого размера
+ 2 - 0
app/calendar/Almanac v2.0_files/saved_resource.html


+ 153 - 0
app/calendar/Almanac v2.0_files/validate_geo.js.下载

@@ -0,0 +1,153 @@
+function round_1000(num)
+{
+    return Math.floor((num + 0.0005) * 1000) / 1000;
+}
+
+
+/*
+ Validate set latitude and longitude 
+ */
+function check_values()
+{
+    var custom_URL = "/wp-content/plugins/observing-tools/almanac/almanac.html?";
+    var display_almanac;
+    var lat = parseFloat(document.observing.lat.value);
+    var lat_min = parseFloat(document.observing.latmin.value);
+    var lat_sgn = document.observing.latsgn.value;
+    var lng = parseFloat(document.observing.lng.value);
+    var lng_min = parseFloat(document.observing.lngmin.value);
+    var lng_sgn = document.observing.lngsgn.value;
+    var tzone = parseFloat(document.observing.tzone.value);
+
+    with (Math) {
+
+        lat = round_1000(lat + lat_min / 60);
+        lng = round_1000(lng + lng_min / 60);
+
+        if (lat_sgn == "S") {lat = lat * -1;}
+        if (lng_sgn == "E") {lng = lng * -1;}
+
+        if ((tzone > 0 && lng_sgn == "W") || (tzone < 0 && lng_sgn == "E"))
+        {
+            alert("Please check that you have selected the correct time zone for your longitude. Time zones are positive east of Greenwich, negative if west.");
+        }
+        else
+        {
+            custom_URL += "latitude=" + lat + "&";
+            custom_URL += "longitude=" + lng + "&";
+            custom_URL += "tzone=" + tzone + "&";
+            custom_URL += "UTdate=now&UTtime=now";
+            display_almanac = window.open(custom_URL,'chooser');
+            display_almanac.resizeTo(950, 975);
+        }
+
+    }
+}
+
+function check_values2()
+{
+    var custom_URL = "/wp-content/plugins/observing-tools/almanac/almanac.html?";
+    var display_almanac;
+    var lat = parseFloat(document.planets.lat.value);
+    var lat_min = parseFloat(document.planets.latmin.value);
+    var lat_sgn = document.planets.latsgn.value;
+    var lng = parseFloat(document.planets.lng.value);
+    var lng_min = parseFloat(document.planets.lngmin.value);
+    var lng_sgn = document.planets.lngsgn.value;
+    var tzone = parseFloat(document.planets.tzone.value);
+
+    with (Math) {
+
+        lat = round_1000(lat + lat_min / 60);
+        lng = round_1000(lng + lng_min / 60);
+
+        if (lat_sgn == "S") {lat = lat * -1;}
+        if (lng_sgn == "E") {lng = lng * -1;}
+
+        if ((tzone > 0 && lng_sgn == "W") || (tzone < 0 && lng_sgn == "E"))
+        {
+            alert("Please check that you have selected the correct time zone for your longitude. Time zones are positive east of Greenwich, negative if west.");
+        }
+        else
+        {
+            custom_URL += "latitude=" + lat + "&";
+            custom_URL += "longitude=" + lng + "&";
+            custom_URL += "tzone=" + tzone + "&";
+            custom_URL += "UTdate=now&UTtime=now";
+            display_almanac = window.open(custom_URL,'chooser');
+            display_almanac.resizeTo(970, 1025);
+        }
+
+    }
+}
+/*
+    Get cookie data for saved location
+ */
+function getCookie( name )
+{
+    var start = document.cookie.indexOf( name + "=" );
+    var len = start + name.length + 1;
+    if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
+        return null;
+    }
+    if ( start == -1 ) return null;
+    var end = document.cookie.indexOf( ";", len );
+    if ( end == -1 ) end = document.cookie.length;
+    return decodeURI( document.cookie.substring( len, end ) );
+}
+
+
+/*
+    Set cookie data for saving a location
+ */
+function setCookie( name, value, expires, path, domain, secure )
+{
+    var today = new Date();
+    today.setTime( today.getTime() );
+    if ( expires ) {
+        expires = expires * 1000 * 60 * 60 * 24;
+    }
+    var expires_date = new Date( today.getTime() + (expires) );
+    document.cookie = name+"="+encodeURI( value ) +
+        ( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
+        ( ( path ) ? ";path=" + path : "" ) +
+        ( ( domain ) ? ";domain=" + domain : "" ) +
+        ( ( secure ) ? ";secure" : "" );
+}
+
+/*
+ todo: Do not know what this function does
+ */
+function deleteCookie( name, path, domain )
+{
+    if ( getCookie( name ) ) document.cookie = name + "=" +
+        ( ( path ) ? ";path=" + path : "") +
+        ( ( domain ) ? ";domain=" + domain : "" ) +
+        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
+}
+
+/*
+ Load cookie data for a saved location
+ */
+function load_saved()
+{
+    var recall_custom_URL = "/wp-content/plugins/observing-tools/almanac/almanac.html?";
+    var show_saved_almanac;
+    var latitude_degrees = getCookie('almanac2latdeg');
+    var longitude_degrees = getCookie('almanac2longdeg');
+    var t_zone_hours = getCookie('almanac2tzonehours');
+
+    if (latitude_degrees == null && longitude_degrees == null)
+    {
+        alert ("Sorry, but you haven't saved a previous location. Please choose a city from the Almanac's built-in gazetteer, or select a custom latitude, longitude and time zone from the pull-down menus. Once the Almanac is displayed you will have the option to save this information for future use.")
+    }
+    else
+    {
+        recall_custom_URL += "latitude=" + latitude_degrees + "&";
+        recall_custom_URL += "longitude=" + longitude_degrees + "&";
+        recall_custom_URL += "tzone=" + t_zone_hours + "&";
+        recall_custom_URL += "UTdate=now&UTtime=now";
+        show_saved_almanac = window.open(recall_custom_URL,'chooser');
+        show_saved_almanac.resizeTo(950, 975);
+    }
+}

+ 225 - 0
app/calendar/README.md

@@ -0,0 +1,225 @@
+
+SunCalc
+=======
+
+[![Build Status](https://travis-ci.org/mourner/suncalc.svg?branch=master)](https://travis-ci.org/mourner/suncalc)
+
+SunCalc is a tiny BSD-licensed JavaScript library for calculating sun position,
+sunlight phases (times for sunrise, sunset, dusk, etc.),
+moon position and lunar phase for the given location and time,
+created by [Vladimir Agafonkin](http://agafonkin.com/en) ([@mourner](https://github.com/mourner))
+as a part of the [SunCalc.net project](http://suncalc.net).
+
+Most calculations are based on the formulas given in the excellent Astronomy Answers articles
+about [position of the sun](http://aa.quae.nl/en/reken/zonpositie.html)
+and [the planets](http://aa.quae.nl/en/reken/hemelpositie.html).
+You can read about different twilight phases calculated by SunCalc
+in the [Twilight article on Wikipedia](http://en.wikipedia.org/wiki/Twilight).
+
+
+## Usage example
+
+```javascript
+// get today's sunlight times for London
+// 获取当天伦敦的太阳时间参数
+var times = SunCalc.getTimes(new Date(), 51.5, -0.1);// 经度,纬度 
+
+// format sunrise time from the Date object
+// 从Date对象格式化日出时间 hh:mm
+var sunriseStr = times.sunrise.getHours() + ':' + times.sunrise.getMinutes();
+
+// get position of the sun (azimuth and altitude) at today's sunrise
+// 获取今天日出时太阳的位置(当地经度,当地纬度)
+var sunrisePos = SunCalc.getPosition(times.sunrise, 51.5, -0.1);
+
+// get sunrise azimuth in degrees
+// 得到太阳方位角
+var sunriseAzimuth = sunrisePos.azimuth * 180 / Math.PI;
+```
+
+SunCalc is also available as an NPM package:
+SunCalc也可以作为NPM软件包提供:
+
+```bash
+$ npm install suncalc
+```
+
+```js
+var SunCalc = require('suncalc');
+```
+
+
+## Reference调用
+
+### Sunlight times 太阳时间
+
+```javascript
+SunCalc.getTimes(/*Date*/ date, /*Number*/ latitude, /*Number*/ longitude, /*Number (default=0)*/ height)
+SunCalc.getTimes(/*日期*/ date, /*纬度*/ latitude, /*经度*/ longitude, /*海拔高度(千米) (default=0)*/ height)
+```
+
+Returns an object with the following properties (each is a `Date` object):
+
+返回一个对象具有一下属性(每一个都是一个`Date`对象)
+
+| Property属性    | Description描述                                                                                            |
+| --------------- | ---------------------------------------------------------------------------------------------------------- |
+| `sunrise`       | sunrise 日出(top edge of the sun appears on the horizon  日轮上缘出现在地平线)                             |
+| `sunriseEnd`    | sunrise ends 日出结束(bottom edge of the sun touches the horizon    日轮下缘触及地平线)                    |
+| `goldenHourEnd` | 朝霞结束morning golden hour (soft light, best time for photography) ends                                   |
+| `solarNoon`     | 正午solar noon (sun is in the highest position 太阳位于高度角达到最高)                                     |
+| `goldenHour`    | evening golden hour starts  晚霞开始                                                                       |
+| `sunsetStart`   | sunset starts 日落开始 (bottom edge of the sun touches the horizon 日轮下缘触及地平线)                     |
+| `sunset`        | sunset 日落(sun disappears below the horizon, evening civil twilight starts日轮上缘消失在地平线,夜幕降临) |
+| `dusk`          | dusk 暮色 (evening nautical twilight starts 航海夜幕开始)                                                  |
+| `nauticalDusk`  | nautical dusk 航海暮色 (evening astronomical twilight starts 天文夜幕开始)                                 |
+| `night`         | night starts 入夜 (dark enough for astronomical observations夜色足够黑暗可以进行天文学观察)                |
+| `nadir`         | nadir天底 (darkest moment of the night, sun is in the lowest position 夜晚的至暗之时,太阳位于最低点)      |
+| `nightEnd`      | night ends夜尽 (morning astronomical twilight starts 天文曙光开始)                                         |
+| `nauticalDawn`  | nautical dawn 航海曙光 (morning nautical twilight starts 航海曙光开始)                                     |
+| `dawn`          | dawn 破晓(morning nautical twilight ends, morning civil twilight starts航海曙光结束,民用曙光开始)         |
+
+```javascript
+SunCalc.addTime(/*Number*/ angleInDegrees, /*String*/ morningName, /*String*/ eveningName)
+```
+
+Adds a custom time when the sun reaches the given angle to results returned by `SunCalc.getTimes`.
+
+当太阳到达给定角度时,通过`SunCalc.getTimes`将自定义时间添加到返回的结果中。
+
+`SunCalc.times` property contains all currently defined times.
+`SunCalc.times`属性包含了所有当前已定义的时间
+
+### Sun position太阳位置
+
+```javascript
+SunCalc.getPosition(/*Date*/ timeAndDate, /*Number*/ latitude, /*Number*/ longitude)
+```
+
+Returns an object with the following properties:
+
+ * `altitude`: sun altitude above the horizon in radians,太阳高度(以弧度为单位)
+ e.g. `0` at the horizon and `PI/2` at the zenith (straight over your head)
+ `0`为地平线 `PI/2`为天顶
+ * `azimuth`: sun azimuth in radians (direction along the horizon, measured from south to west),太阳弧度(以弧度为单位)(地平线的投影方向,从南到西测量),
+ e.g. `0` is south and `Math.PI * 3/4` is northwest
+- `0`为正南
+- `Math.PI * 1/4`为西南
+- `Math.PI * 1/2`为正西
+- `Math.PI * 3/4` 西北
+- `Math.PI` 为正北
+
+
+### Moon position
+
+```javascript
+SunCalc.getMoonPosition(/*Date*/ timeAndDate, /*Number*/ latitude, /*Number*/ longitude)
+```
+
+Returns an object with the following properties:
+
+ * `altitude`: moon altitude above the horizon in radians  月亮高度(弧度)
+ * `azimuth`: moon azimuth in radians 月亮水平偏移(弧度)
+ * `distance`: distance to moon in kilometers 地月距离(千米)
+ * `parallacticAngle`: parallactic angle of the moon in radians 月亮的视差角(弧度)
+
+
+### Moon illumination月轮亮度
+
+```javascript
+SunCalc.getMoonIllumination(/*Date*/ timeAndDate)
+```
+
+Returns an object with the following properties:
+返回一个具有以下属性的对象
+ * `fraction`: illuminated fraction of the moon; varies from `0.0` (new moon) to `1.0` (full moon)
+ * 月亮照亮的部分,从`0.0`到`1.0`变化
+ * `phase`: moon phase; varies from `0.0` to `1.0`, described below
+ * 月相;从`0.0`到`1.0`变化,描述如下
+ * `angle`: midpoint angle in radians of the illuminated limb of the moon reckoned eastward from the north point of the disk;
+ the moon is waxing if the angle is negative, and waning if positive
+* 通过月亮照亮的部分从圆盘的正北向东偏移的角度(以弧度计)的中点;如果角度为负,则月亮在变亮;如果角度为正,则月亮在变暗
+
+Moon phase value should be interpreted like this:
+月相值的解释如下:
+
+| Phase相 | Name                     |
+| ------: | ------------------------ |
+|       0 | New Moon 新月            |
+|         | Waxing Crescent 凹月渐亮 |
+|    0.25 | First Quarter 上弦月     |
+|         | Waxing Gibbous 凸月渐满  |
+|     0.5 | Full Moon 满月           |
+|         | Waning Gibbous 满月渐小  |
+|    0.75 | Last Quarter 下弦月      |
+|         | Waning Crescent 凹月渐暗 |
+
+By subtracting the `parallacticAngle` from the `angle` one can get the zenith angle of the moons bright limb (anticlockwise).
+The zenith angle can be used do draw the moon shape from the observers perspective (e.g. moon lying on its back).
+
+### Moon rise and set times
+
+```js
+SunCalc.getMoonTimes(/*Date*/ date, /*Number*/ latitude, /*Number*/ longitude[, inUTC])
+```
+
+Returns an object with the following properties:
+
+ * `rise`: moonrise time as `Date`
+ * `set`: moonset time as `Date`
+ * `alwaysUp`: `true` if the moon never rises/sets and is always _above_ the horizon during the day
+ * `alwaysDown`: `true` if the moon is always _below_ the horizon
+
+By default, it will search for moon rise and set during local user's day (frou 0 to 24 hours).
+If `inUTC` is set to true, it will instead search the specified date from 0 to 24 UTC hours.
+
+## Changelog
+
+#### 1.8.0 &mdash; Dec 22, 2016
+
+- Improved precision of moonrise/moonset calculations.
+- Added `parallacticAngle` calculation to `getMoonPosition`.
+- Default to today's date in `getMoonIllumination`.
+- Fixed incompatibility when using Browserify/Webpack together with a global AMD loader.
+
+#### 1.7.0 &mdash; Nov 11, 2015
+
+- Added `inUTC` argument to `getMoonTimes`.
+
+#### 1.6.0 &mdash; Oct 27, 2014
+
+- Added `SunCalc.getMoonTimes` for calculating moon rise and set times.
+
+#### 1.5.1 &mdash; May 16, 2014
+
+- Exposed `SunCalc.times` property with defined daylight times.
+- Slightly improved `SunCalc.getTimes` performance.
+
+#### 1.4.0 &mdash; Apr 10, 2014
+
+- Added `phase` to `SunCalc.getMoonIllumination` results (moon phase).
+- Switched from mocha to tape for tests.
+
+#### 1.3.0 &mdash; Feb 21, 2014
+
+- Added `SunCalc.getMoonIllumination` (in place of `getMoonFraction`) that returns an object with `fraction` and `angle`
+(angle of illuminated limb of the moon).
+
+#### 1.2.0 &mdash; Mar 07, 2013
+
+- Added `SunCalc.getMoonFraction` function that returns illuminated fraction of the moon.
+
+#### 1.1.0 &mdash; Mar 06, 2013
+
+- Added `SunCalc.getMoonPosition` function.
+- Added nadir (darkest time of the day, middle of the night).
+- Added tests.
+
+#### 1.0.0 &mdash; Dec 07, 2011
+
+- Published to NPM.
+- Added `SunCalc.addTime` function.
+
+#### 0.0.0 &mdash; Aug 25, 2011
+
+- First commit.

+ 6 - 6
app/calendar/index.php

@@ -61,14 +61,14 @@ $dir_app="../studio/";
 	<link type="text/css" rel="stylesheet" href="<?php echo $dir_app; ?>css/style.css"/>
 	<link type="text/css" rel="stylesheet" href="<?php echo $dir_app; ?>css/color_day.css" id="colorchange" />
 	<link type="text/css" rel="stylesheet" href="<?php echo $dir_app; ?>css/style.css"/>
-	<title><?php echo $_local->gui->pcd_studio;?></title>
+	<title><?php echo $_local->gui->BE;?></title>
 	<script src="<?php echo $dir_app; ?>js/jquery-3.3.1.min.js"></script>
 <!--	<script language="javascript" src="<?php echo $dir_app; ?>charcode/sinhala.js"></script>
 	<script language="javascript" src="<?php echo $dir_app; ?>charcode/myanmar.js"></script>
 	<script language="javascript" src="<?php echo $dir_app; ?>charcode/unicode.js"></script>
 -->
 <script>
-		<?php 
+	<?php 
 	//加载js语言包
 	require_once '../public/load_lang_js.php';
 	?>
@@ -149,7 +149,7 @@ input[type="date"]{
 		}
 
 
-			var g_langrage="en";
+			var g_language="en";
 function setCookie(c_name,value,expiredays)
 {
 	var exdate=new Date()
@@ -806,9 +806,9 @@ function set_time_string(date_obj){
 	return(hh+":"+mm+":"+ss)
 }
 function menuLangrage(obj,year,month){
-	g_langrage=obj.value;
-	setCookie('language',g_langrage,365);
-	window.location.assign("index.php?language="+g_langrage+"&y="+year+"&m="+month);
+	g_language=obj.value;
+	setCookie('language',g_language,365);
+	window.location.assign("index.php?language="+g_language+"&y="+year+"&m="+month);
 
 }
 set_uposatha_day();

+ 566 - 0
app/calendar/index1.html

@@ -0,0 +1,566 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <link type="text/css" rel="stylesheet" href="../pcdl/css/font.css" />
+    <link type="text/css" rel="stylesheet" href="../pcdl/css/basic_style.css" />
+    <link type="text/css" rel="stylesheet" href="../pcdl/css/style.css" />
+    <link type="text/css" rel="stylesheet" href="../pcdl/css/color_day.css" id="colorchange" />
+    <link type="text/css" rel="stylesheet" href="../pcdl/css/style_mobile.css" media="screen and (max-width:767px)">
+
+    <script src="../public/js/jquery.js"></script>
+    <script src="../public/js/comm.js"></script>
+    <script src="jquery-3.3.1.min.js"></script>
+    <script src="lib/julian.js"></script>
+    <script src="lib/lune.js"></script>
+    <script src="suncalc.js"></script>
+    <script src="../studio/js/fixedsticky.js"></script>
+    <script src="../guide/guide.js"></script>
+    <link type="text/css" rel="stylesheet" href="../guide/guide.css" />
+
+    <script src="../public/js/marked.js"></script>
+    <!--获取语言-->
+    <script>
+        var g_language = "en";
+        var g_currLink = "";
+        function lang_init(strPage) {
+            g_currLink = strPage;
+        }
+        function setLang(strLang) {
+            g_language = strLang;
+            setCookie('language', g_language, 365);
+            window.location.assign(location.pathname + "?language=" + g_language);
+        }
+    </script>
+    <script>
+        var localString = new Array();
+        localString["zh-cn"] = {
+            "and_another": "又 ",
+            "atitude": "纬度",
+            "BE": "佛历",
+            "bhumma": "周二",
+            "budha": "周三",
+            "canda": "周一",
+            "confirm": "确认",
+            "date": "日期",
+            "day": "日",
+            "days": "天 ",
+            "departure_in_detail": "起飞详情",
+            "dhamma_time": "会延续五千年的教法 ",
+            "eat": "进餐",
+            "gama_entry": "入村",
+            "guru": "周四",
+            "hori_ref_time": "蒙气差修正 ",
+            "kala": "适当的时间",
+            "language_select": "选择语言",
+            "left": "还剩下",
+            "loading": "载入中……",
+            "longitude": "经度",
+            "māsa": "月",
+            "mins": "分钟",
+            "month": "月 ",
+            "month_1": "月 ",
+            "months": "个月 ",
+            "my_loc": "我的位置",
+            "need_inform": "未告知其他比库",
+            "no_string": "不能",
+            "noon_time": "正午",
+            "noon_time": "正午",
+            "note": "注释",
+            "now_time": "现在",
+            "pacchā_māsa": "下个月",
+            "pakkha": "月相变化 ",
+            "past": "已过去",
+            "pubba_māsa": "上个月",
+            "ravi": "周日",
+            "saṃvacchara": "年",
+            "season": "季节 ",
+            "sec": "秒",
+            "sora": "周六",
+            "sukka": "周五",
+            "sun_height_degree": "正午太阳高度 ",
+            "time": "时间",
+            "twilight_time": "曙光",
+            "twilight_time": "曙光",
+            "vikala": "不适当的时间",
+            "week_day": "星期",
+            "year_0": "年",
+            "year_1": "年 ",
+            "years": "年 ",
+            "yes_string": "可以"
+        };
+        localString["zh-tw"] = {
+            "and_another": "又 ",
+            "atitude": "緯度",
+            "BE": "佛曆",
+            "bhumma": "週二",
+            "budha": "週三",
+            "canda": "週一",
+            "confirm": "確認",
+            "date": "日期",
+            "day": "日",
+            "days": "天 ",
+            "departure_in_detail": "起飛詳情",
+            "dhamma_time": "會延續五千年的教法 ",
+            "eat": "進餐",
+            "gama_entry": "入村",
+            "guru": "週四",
+            "hori_ref_time": "蒙氣差修正 ",
+            "kala": "適當的時間",
+            "language_select": "選擇語言",
+            "left": "還剩下",
+            "loading": "載入中……",
+            "longitude": "經度",
+            "māsa": "月",
+            "mins": "分鐘",
+            "month": "月 ",
+            "month_1": "月 ",
+            "months": "個月 ",
+            "my_loc": "我的位置",
+            "need_inform": "未告知其他比庫",
+            "no_string": "不能",
+            "noon_time": "正午",
+            "noon_time": "正午",
+            "note": "註釋",
+            "now_time": "現在",
+            "pacchā_māsa": "下個月",
+            "pakkha": "月相變化 ",
+            "past": "已過去",
+            "pubba_māsa": "上個月",
+            "ravi": "週日",
+            "saṃvacchara": "年",
+            "season": "季節 ",
+            "sec": "秒",
+            "sora": "週六",
+            "sukka": "週五",
+            "sun_height_degree": "正午太陽高度 ",
+            "time": "時間",
+            "twilight_time": "曙光",
+            "twilight_time": "曙光",
+            "vikala": "不適當的時間",
+            "week_day": "星期",
+            "year_0": "年",
+            "year_1": "年 ",
+            "years": "年 ",
+            "yes_string": "可以"
+        };
+        localString["default"] = {
+            "and_another": " and ",
+            "atitude": "Atitude",
+            "BE": "Buddhist Era ",
+            "bhumma": "Bhumma",
+            "budha": "Budha",
+            "canda": "Canda",
+            "confirm": "Confirm",
+            "date": "Date ",
+            "day": " day(s) ",
+            "days": " day(s) ",
+            "departure_in_detail": "departure in detail",
+            "dhamma_time": "5000 Years of the Buddha’s Dispensation ",
+            "eat": "eat",
+            "gama_entry": "entry the village",
+            "guru": "Guru",
+            "hori_ref_time": "horizontal refraction correct ",
+            "kala": "suitable time",
+            "language_select": "bhāsā",
+            "left": "Remains ",
+            "loading": "loading…",
+            "longitude": "Longitude",
+            "māsa": "māsa",
+            "mins": "(min)",
+            "month": "Month ",
+            "month_1": "- ",
+            "months": " month(s) ",
+            "my_loc": "attasmiṃ",
+            "need_inform": "without informing other Bhikkhu ",
+            "no_string": "cannot ",
+            "noon_time": "NOON",
+            "noon_time": "NOON",
+            "note": "Note",
+            "now_time": "NOW",
+            "pacchā_māsa": "pacchā-māsa",
+            "pakkha": "Lunar Phases ",
+            "past": "Passed ",
+            "pubba_māsa": "pubba-māsa",
+            "ravi": "Ravi",
+            "saṃvacchara": "saṃvacchara",
+            "season": "Season ",
+            "sec": "sec ",
+            "sora": "Sora",
+            "sukka": "Sukka",
+            "sun_height_degree": "Max solar altitude ",
+            "time": "Time",
+            "twilight_time": "dawn",
+            "twilight_time": "dawn",
+            "vikala": "unsuitable time",
+            "week_day": "Day",
+            "year_0": "saṃvacchara",
+            "year_1": "- ",
+            "years": " year(s) ",
+            "yes_string": "can "
+        };
+        localString["en"] = {
+            "and_another": " and ",
+            "atitude": "Atitude",
+            "BE": "Buddhist Era ",
+            "bhumma": "Bhumma",
+            "budha": "Budha",
+            "canda": "Canda",
+            "confirm": "Confirm",
+            "date": "Date",
+            "day": " day(s) ",
+            "days": " day(s) ",
+            "departure_in_detail": "departure in detail",
+            "dhamma_time": "5000 Years of the Buddha’s Dispensation ",
+            "eat": "eat",
+            "gama_entry": "entry the village",
+            "guru": "Guru",
+            "hori_ref_time": "horizontal refraction correct ",
+            "kala": "suitable time",
+            "language_select": "Language",
+            "left": "Remains ",
+            "loading": "loading…",
+            "longitude": "Longitude",
+            "māsa": "māsa",
+            "mins": "(min)",
+            "month": "Month ",
+            "month_1": "- ",
+            "months": " month(s) ",
+            "my_loc": "my location",
+            "need_inform": "without informing other Bhikkhu ",
+            "no_string": "cannot ",
+            "noon_time": "NOON",
+            "noon_time": "NOON",
+            "note": "Note",
+            "now_time": "NOW",
+            "pacchā_māsa": "pacchā-māsa",
+            "pakkha": "Lunar Phases ",
+            "past": "Passed ",
+            "pubba_māsa": "pubba-māsa",
+            "ravi": "Ravi",
+            "saṃvacchara": "saṃvacchara",
+            "season": "Season ",
+            "sec": "sec",
+            "sora": "Sora",
+            "sukka": "Sukka",
+            "sun_height_degree": "Max solar altitude ",
+            "time": "time",
+            "twilight_time": "dawn",
+            "twilight_time": "dawn",
+            "vikala": "unsuitable time",
+            "week_day": "Day",
+            "year_0": "year",
+            "year_1": "- ",
+            "years": " year(s) ",
+            "yes_string": "can "
+        };
+        localString["my"] = {
+            "and_another": " and ",
+            "atitude": "Atitude",
+            "BE": "Buddhist Era ",
+            "bhumma": "ဘုမ္မ",
+            "budha": "ဗုဓ",
+            "canda": "စန္ဒ",
+            "confirm": "Confirm",
+            "date": "Date ",
+            "day": " day(s) ",
+            "days": " day(s) ",
+            "departure_in_detail": "departure in detail",
+            "dhamma_time": "5000 Years of the Buddha’s Dispensation ",
+            "eat": "eat",
+            "gama_entry": "entry the village",
+            "guru": "ဂုရု",
+            "hori_ref_time": "horizontal refraction correct ",
+            "kala": "ကာလ",
+            "language_select": "ဘာသာ",
+            "left": "Remains ",
+            "loading": "loading…",
+            "longitude": "Longitude",
+            "māsa": "မာသ",
+            "mins": "(min)",
+            "month": "Month ",
+            "month_1": "- ",
+            "months": " month(s) ",
+            "my_loc": "အတ္တသ္မိံ",
+            "need_inform": "without informing other Bhikkhu ",
+            "no_string": "cannot ",
+            "noon_time": "မဇ္ဈန္ဟိက",
+            "noon_time": "မဇ္ဈန္ဟိက",
+            "note": "Note",
+            "now_time": "ပစ္စုပ္ပန္န",
+            "pacchā_māsa": "ပစ္ဆာ-မာသ",
+            "pakkha": "Lunar Phases ",
+            "past": "Passed ",
+            "pubba_māsa": "ပုဗ္ဗ-မာသ",
+            "ravi": "ရဝိ",
+            "saṃvacchara": "သံဝစ္ဆရ",
+            "season": "Season ",
+            "sec": "sec ",
+            "sora": "သောရ",
+            "sukka": "သုက္က",
+            "sun_height_degree": "Max solar altitude ",
+            "time": "Time",
+            "twilight_time": "အရုဏုဂ္ဂမန",
+            "twilight_time": "အရုဏုဂ္ဂမန",
+            "vikala": "ဝိကာလ",
+            "week_day": "Day",
+            "year_0": "year",
+            "year_1": "- ",
+            "years": " year(s) ",
+            "yes_string": "can "
+        };
+        localString["si"] = {
+            "and_another": " ච ",
+            "atitude": "Atitude",
+            "BE": "බුද්ධ වර්ෂය ",
+            "bhumma": "භුම්ම",
+            "budha": "බුධ",
+            "canda": "චන්ද",
+            "confirm": "Confirm",
+            "date": "දිවස ",
+            "day": " දිවසා(නි) ",
+            "days": " දිවසා(නි) ",
+            "departure_in_detail": "departure in detail",
+            "dhamma_time": "සම්මා සම්බුද්ධස්ස සාසනං පට්ච-වස්ස-සහස්සානි පවත්තිස්සති ",
+            "eat": "eat",
+            "gama_entry": "entry the village",
+            "guru": "ගු‍රු",
+            "hori_ref_time": "horizontal refraction correct ",
+            "kala": "කාල",
+            "language_select": "භාෂාව",
+            "left": "අවසිට්ඨ ",
+            "loading": "ප්‍රවේශනය වෙනවා ",
+            "longitude": "Longitude",
+            "māsa": "මාස",
+            "mins": "(min)",
+            "month": "මාස ",
+            "month_1": "- ",
+            "months": " මාසා(නි) ",
+            "my_loc": "අත‍්තස‍්මිං",
+            "need_inform": "without informing other Bhikkhu ",
+            "no_string": "cannot ",
+            "noon_time": "මජ්ඣන්හික",
+            "noon_time": "මජ්ඣන්හික",
+            "note": "නෝට්ටුව ",
+            "now_time": "පච්චුප්පන්න",
+            "pacchā_māsa": "පච්ඡා-මාස",
+            "pakkha": "පක්ඛ ",
+            "past": "අතික්කන්ත ",
+            "pubba_māsa": "පුබ්බ-මාස",
+            "ravi": "රවි",
+            "saṃvacchara": "සංවච්ඡ‍ර",
+            "season": "උතු ",
+            "sec": "sec",
+            "sora": "සො‍ර",
+            "sukka": "සුක්ක",
+            "sun_height_degree": "Max solar altitude ",
+            "time": "time",
+            "twilight_time": "අ‍රුණුග්ගමන",
+            "twilight_time": "අ‍රුණුග්ගමන",
+            "vikala": "විකාල",
+            "week_day": "වා‍ර ",
+            "year_0": "සංවච්ඡ‍ර",
+            "year_1": "- ",
+            "years": " සංවච්ඡ‍රා(නි) ",
+            "yes_string": "can "
+        };
+
+
+    </script>
+    <style>
+        .card {
+            box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
+            font-size: 1em;
+            line-height: 1.3;
+        }
+
+        .card>.title>a,
+        .card>.title>a:link {
+            color: var(--main-color);
+        }
+
+        .card a:hover {
+            color: var(--tool-link-hover-color);
+        }
+
+        .index_inner {
+            width: 960px;
+            margin-left: auto;
+            margin-right: auto;
+        }
+    </style>
+    <title id='title_text'>
+    </title>
+</head>
+
+<body>
+    <!--多语言范例
+        <script>
+            document.write(localString["language"].XXXX);
+        </script>
+
+    -->
+    <div id='position_change'>
+        <span id='selected_position_string'>
+            <script>
+                document.write(localString[g_language].loading);
+                //localString[g_language].loading;
+            </script>
+        </span>
+        <!--自动定位-->
+        <button onclick='getLocation()' style='font-size: 100%; padding: 2px 6px;'>
+            <svg class='icon' style='min-width: 1.8em; min-height: 1.8em;'>
+                <path
+                    d='M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3A8.994 8.994 0 0 0 13 3.06V1h-2v2.06A8.994 8.994 0 0 0 3.06 11H1v2h2.06A8.994 8.994 0 0 0 11 20.94V23h2v-2.06A8.994 8.994 0 0 0 20.94 13H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z' />
+            </svg>
+            <script>
+                document.write(localString[g_language].my_loc);
+                //localString[g_language].my_loc
+            </script>
+        </button>
+        <input id="input_time" type="datetime-local">
+    </div>
+    <div>
+        <div onclick="show_time()">Sun time table</div>
+        <div><span id="today_dawn"></span></div>
+        <div><span id="today_solarNoon"></span></div>
+        <div><span id="today_sunset"></span></div>
+        <div>月相<span id="today_moon_phase"></span></div>
+        <div>圆满度<span id="today_moon_percent"></span></div>
+        <div>南偏西<span id="today_sun_azimuth"></span></div>
+        <div>北偏东<span id="today_moon_azimuth"></span></div>
+        <div>日月角<span id="angle_sun_e_moon"></span></div>
+        <div>月相角<span id="today_moon_angle"></span></div>
+        <div>当前时间<span id="curr_time"></span></div>
+        <div>现在时间<span id="now_time"></span></div>
+
+
+    </div>
+    <script>
+        var current_phase = lune.phase()
+        console.log(current_phase)//输出到控制台
+
+        $("#title_text").html(localString[g_language].BE);
+        var g_coordinate_this = new Object();
+        var g_now_date = new Date();
+        var sun_times = new Object();
+        var curr_position = localStorage.getItem("local_position");
+        if (curr_position) {
+            g_coordinate_this.AT = curr_position.split("#")[0];
+            g_coordinate_this.LT = curr_position.split("#")[1];
+            if (g_coordinate_this.AT >= 0) {
+                var AT_string = angle_trans(g_coordinate_this.AT) + "N";
+            }
+            else {
+                var AT_string = angle_trans(g_coordinate_this.AT) + "S";
+            }
+            if (g_coordinate_this.LT >= 0) {
+                var LT_string = angle_trans(g_coordinate_this.LT) + "E";
+            }
+            else {
+                var LT_string = angle_trans(g_coordinate_this.LT) + "W";
+            }
+            $("#selected_position_string").html(AT_string + " " + LT_string);
+
+        }
+        else {
+            getLocation();
+        }
+        function show_time() {
+            if ($("#input_time").val()) {
+                today = new Date($("#input_time").val());
+            }
+            else {
+                today = g_now_date
+            }
+            sun_times = SunCalc.getTimes(today, g_coordinate_this.AT, g_coordinate_this.LT, 0);
+            sun_position = SunCalc.getPosition(today, g_coordinate_this.AT, g_coordinate_this.LT);
+            moon_position = SunCalc.getMoonPosition(today, g_coordinate_this.AT, g_coordinate_this.LT);
+            moon_Illumination = SunCalc.getMoonIllumination(today)
+            $("#today_dawn").html(sun_times.dawn.toLocaleTimeString());
+            $("#today_solarNoon").html(sun_times.solarNoon.toLocaleTimeString());
+            $("#today_sunset").html(sun_times.sunset.toLocaleTimeString());
+            $("#today_sun_azimuth").html(angle_trans(sun_position.azimuth / Math.PI * 180));//太阳水平弧度
+            $("#today_moon_azimuth").html(angle_trans(moon_position.azimuth / Math.PI * 180));//月亮水平弧度
+            $("#today_moon_phase").html(1 - 2 * moon_Illumination.phase);//月相值
+            $("#today_moon_percent").html(moon_Illumination.fraction);//月相值
+            $("#today_moon_angle").html(angle_trans(moon_Illumination.angle / Math.PI * 180));//月相角
+            $("#angle_sun_e_moon").html(angle_trans(Math.abs(Math.PI + sun_position.azimuth - moon_position.azimuth) / Math.PI * 180));//月亮水平弧度
+            $("#curr_time").html(today.toLocaleTimeString());//当前时间
+            $("#now_time").html(g_now_date.toLocaleTimeString());//现在
+
+
+
+        }
+
+        function getLocation() {//自动定位
+            if (navigator.geolocation) {
+                navigator.geolocation.getCurrentPosition(showPosition, showError);
+            }
+            else {
+                $("#selected_position_string").html("Geolocation is not supported by this browser.");
+            }
+        }
+        function showPosition(position) {
+            alert("get cordinate success");
+            g_coordinate_this.AT = position.coords.latitude;
+            g_coordinate_this.LT = position.coords.longitude;
+            let position_string = g_coordinate_this.AT + "#" + g_coordinate_this.LT
+            localStorage.setItem("local_position", position_string);
+
+            if (g_coordinate_this.AT >= 0) {
+                var AT_string = angle_trans(g_coordinate_this.AT) + "N";
+            }
+            else {
+                var AT_string = angle_trans(g_coordinate_this.AT) + "S";
+            }
+            if (g_coordinate_this.LT >= 0) {
+                var LT_string = angle_trans(g_coordinate_this.LT) + "E";
+            }
+            else {
+                var LT_string = angle_trans(g_coordinate_this.LT) + "W";
+            }
+            $("#selected_position_string").html(AT_string + " " + LT_string);
+
+        }
+        function showError(error) {
+            switch (error.code) {
+                case error.PERMISSION_DENIED:
+                    alert("定位失败,用户拒绝请求地理定位");
+                    break;
+                case error.POSITION_UNAVAILABLE:
+                    alert("定位失败,位置信息是不可用");
+                    break;
+                case error.TIMEOUT:
+                    alert("定位失败,请求获取用户位置超时");
+                    break;
+                case error.UNKNOWN_ERROR:
+                    alert("定位失败,定位系统失效");
+                    break;
+            }
+        }
+        function angle_trans(angle) {
+            var angle_str = "";
+            var num_d = Math.floor(angle);
+            var num_m = Math.floor((angle - num_d) * 60);
+            var num_s = Math.round((angle - num_d) * 60 - num_m);
+            if (num_d != 0) {
+                angle_str += num_d + "°";
+            }
+            if (num_m != 0) {
+                angle_str += num_m + "’";
+            }
+            if (num_s != 0) {
+                angle_str += num_s + "”";
+            }
+            return (angle_str);
+        }
+
+    </script>
+
+
+</body>
+
+</html>

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
app/calendar/jquery-3.3.1.min.js


+ 12 - 0
app/calendar/julian.js

@@ -0,0 +1,12 @@
+'use strict'
+
+function fromDate (date) {
+  return date.getTime() / 86400000 + 2440587.5
+}
+
+function toDate (julian) {
+  return new Date((julian - 2440587.5) * 86400000)
+}
+
+exports.fromDate = fromDate
+exports.toDate = toDate

+ 158 - 0
app/calendar/lib/README.md

@@ -0,0 +1,158 @@
+<div align="center">
+  <img height="150" width="150"  src="http://ryanseys.com/img/moon.png"/>
+</div>
+
+# Lune [![Build Status](https://travis-ci.org/ryanseys/lune.svg?branch=0.2.0)](https://travis-ci.org/ryanseys/lune)
+
+Lune.js — calculate the phases of the moon.
+
+## Installation
+
+```sh   
+npm install lune
+```
+
+## Usage
+
+### To calculate *current* phase information:计算*当前*相的信息
+
+```javascript
+var lune = require('lune')//
+var current_phase = lune.phase()
+console.log(current_phase)//输出到控制台
+```
+
+#### Output:
+
+```javascript
+{ phase: 0.3435664924086369,
+  illuminated: 0.7773055846628978,
+  age: 10.1457207715498,
+  distance: 386679.7626047325,
+  angular_diameter: 0.5150467579643708,
+  sun_distance: 148929846.0148686,
+  sun_angular_diameter: 0.5354732715700135 }
+```
+- phase: 月相,
+- illuminated: 亮度,
+- age: 月龄,
+- distance: 地月距离,
+- angular_diameter: 月角直径
+- sun_distance: 地日距离,
+- sun_angular_diameter: 日角直径
+
+
+### To calculate phase information for a *specific* date:
+计算一个*指定*日期的相的信息
+```javascript
+var lune = require('lune')
+var some_date = new Date('2014-02-17T00:00-0500')
+var some_date_phase = lune.phase(some_date)
+console.log(some_date_phase)
+```
+
+#### Output:
+
+```javascript
+{ phase: 0.568204641580006,
+  illuminated: 0.9547862069882863,
+  age: 16.779417556565985,
+  distance: 396084.54752883443,
+  angular_diameter: 0.5028172882344054,
+  sun_distance: 147822484.14817196,
+  sun_angular_diameter: 0.5394845874736046 }
+```
+- phase: 月相,
+- illuminated: 亮度,
+- age: 月龄,
+- distance: 地月距离,
+- angular_diameter: 月角直径
+- sun_distance: 地日距离,
+- sun_angular_diameter: 日角直径
+
+### To search for recent phases around the *current* date:
+在*当前*日期附近搜索最近的相
+```javascript
+var lune = require('lune')
+var recent_phases = lune.phase_hunt()
+console.log(recent_phases)
+```
+
+#### Output:
+
+```javascript
+{ new_date: Tue Mar 08 2016 20:55:59 GMT-0500 (EST),
+  q1_date: Tue Mar 15 2016 13:04:23 GMT-0400 (EDT),
+  full_date: Wed Mar 23 2016 08:01:38 GMT-0400 (EDT),
+  q3_date: Thu Mar 31 2016 11:18:41 GMT-0400 (EDT),
+  nextnew_date: Thu Apr 07 2016 07:25:20 GMT-0400 (EDT) }
+```
+- new_date: 新月日期
+- q1_date: 上弦月日期
+- full_date: 满月日期
+- q3_date: 下弦月日期
+- nextnew_date: 下次新月日期
+### To search for recent phases around a *specific* date:
+在*指定*日期附近搜索最近的相
+```javascript
+var lune = require('lune')
+var some_date = new Date('2014-02-17T00:00-0500')
+var some_date_phase = lune.phase_hunt(some_date)
+console.log(some_date_phase)
+```
+
+#### Output:
+
+```javascript
+{ new_date: Thu Jan 30 2014 16:40:35 GMT-0500 (EST),
+  q1_date: Thu Feb 06 2014 14:22:33 GMT-0500 (EST),
+  full_date: Fri Feb 14 2014 18:54:46 GMT-0500 (EST),
+  q3_date: Sat Feb 22 2014 12:16:56 GMT-0500 (EST),
+  nextnew_date: Sat Mar 01 2014 03:02:41 GMT-0500 (EST) }
+```
+- new_date: 新月日期
+- q1_date: 上弦月日期
+- full_date: 满月日期
+- q3_date: 下弦月日期
+- nextnew_date: 下次新月日期
+
+### To search for phases between two dates:
+在两个日期之间搜索相
+```javascript
+// print all full moons in the first quarter of 2014
+var lune = require('lune')
+var phase_list = lune.phase_range(
+  new Date('2014-01-01T00:00:00.000Z'),
+  new Date('2014-03-31T23:59:59.999Z'),
+  lune.PHASE_FULL
+)
+console.log(phase_list)
+```
+
+Possible values for the third argument of the function are:
+
+*   `lune.PHASE_NEW` (new moon)
+*   `lune.PHASE_FIRST` (first quarter moon)
+*   `lune.PHASE_FULL` (full moon)
+*   `lune.PHASE_LAST` (third or last quarter moon)
+
+#### Output:
+
+```javascript
+[ Wed Jan 01 2014 06:15:02 GMT-0500 (EST),
+  Thu Jan 30 2014 16:40:35 GMT-0500 (EST),
+  Sat Mar 01 2014 03:02:41 GMT-0500 (EST),
+  Sun Mar 30 2014 14:48:06 GMT-0400 (EDT) ]
+```
+
+## Image
+
+Moon image graciously provided by [Mike DiLuigi.](https://www.behance.net/mikediluigi)
+
+## Contributing
+
+Please feel free to contribute to this project! :) Pull requests and feature requests welcome!
+
+## License
+
+See LICENSE file in this repo

+ 12 - 0
app/calendar/lib/julian.js

@@ -0,0 +1,12 @@
+'use strict'
+
+function fromDate (date) {
+  return date.getTime() / 86400000 + 2440587.5
+}
+
+function toDate (julian) {
+  return new Date((julian - 2440587.5) * 86400000)
+}
+
+exports.fromDate = fromDate
+exports.toDate = toDate

+ 355 - 0
app/calendar/lib/lune.js

@@ -0,0 +1,355 @@
+/**
+ * This library calculates the current phase of the moon
+ * as well as finds the dates of the recent moon phases.
+ *
+ * Some functionality is ported from python version found here:
+ * https://bazaar.launchpad.net/~keturn/py-moon-phase/trunk/annotate/head:/moon.py
+ *
+ * Some functionality is taken from Astronomical Algorithms, 2nd ed.
+ *
+ * Some functionality is taken from the US Naval Observatory, described here:
+ * https://aa.usno.navy.mil/faq/docs/SunApprox.php
+ *
+ * Author: Ryan Seys (https://github.com/ryanseys)
+ * Author: Jay LaPorte (https://github.com/ironwallaby)
+ */
+
+'use strict'
+
+const julian = require('./julian')
+
+// Phases of the moon & precision
+const NEW = 0
+const FIRST = 1
+const FULL = 2
+const LAST = 3
+const PHASE_MASK = 3
+
+// Astronomical Constants
+// Semi-major axis of Earth's orbit, in kilometers
+const SUN_SMAXIS = 1.49585e8
+
+// SUN_SMAXIS premultiplied by the angular size of the Sun from the Earth
+const SUN_ANGULAR_SIZE_SMAXIS = SUN_SMAXIS * 0.533128
+
+// Semi-major axis of the Moon's orbit, in kilometers
+const MOON_SMAXIS = 384401.0
+
+// MOON_SMAXIS premultiplied by the angular size of the Moon from the Earth
+const MOON_ANGULAR_SIZE_SMAXIS = MOON_SMAXIS * 0.5181
+
+// Synodic month (new Moon to new Moon), in days
+const SYNODIC_MONTH = 29.53058868
+
+/**
+ * Convert degrees to radians
+ * @param  {Number} d Angle in degrees
+ * @return {Number}   Angle in radians
+ */
+function torad (d) {
+  return (Math.PI / 180.0) * d
+}
+
+/**
+ * Convert radians to degrees
+ * @param  {Number} r Angle in radians
+ * @return {Number}   Angle in degrees
+ */
+function dsin (d) {
+  return Math.sin(torad(d))
+}
+
+function dcos (d) {
+  return Math.cos(torad(d))
+}
+
+/**
+ * Convert astronomical units to kilometers
+ * @param  {Number} au Distance in astronomical units
+ * @return {Number}    Distance in kilometers
+ */
+function tokm (au) {
+  return 149597870.700 * au
+}
+
+/**
+ * Finds the phase information for specific date.
+ * @param  {Date}   date Date to get phase information of.
+ * @return {Object}      Phase data
+ */
+function phase (date) {
+  if (!date) {
+    date = new Date()
+  }
+  if (!(date instanceof Date)) {
+    throw new TypeError('Invalid parameter')
+  }
+  if (Number.isNaN(date.getTime())) {
+    throw new RangeError('Invalid Date')
+  }
+
+  // t is the time in "Julian centuries" of 36525 days starting from 2000-01-01
+  // (Note the 0.3 is because the UNIX epoch is on 1970-01-01 and that's 3/10th
+  // of a century before 2000-01-01, which I find cute :3 )
+  const t = date.getTime() * (1 / 3155760000000) - 0.3
+
+  // lunar mean elongation (Astronomical Algorithms, 2nd ed., p. 338)
+  const d = 297.8501921 + t * (445267.1114034 + t * (-0.0018819 + t * ((1 / 545868) + t * (-1 / 113065000))))
+
+  // solar mean anomaly (p. 338)
+  const m = 357.5291092 + t * (35999.0502909 + t * (-0.0001536 + t * (1 / 24490000)))
+
+  // lunar mean anomaly (p. 338)
+  const n = 134.9633964 + t * (477198.8675055 + t * (0.0087414 + t * ((1 / 69699) + t * (-1 / 14712000))))
+
+  // derive sines and cosines necessary for the below calculations
+  const sind = dsin(d)
+  const sinm = dsin(m)
+  const sinn = dsin(n)
+  const cosd = dcos(d)
+  const cosm = dcos(m)
+  const cosn = dcos(n)
+
+  // use trigonometric identities to derive the remainder of the sines and
+  // cosines we need. this reduces us from needing 14 sin/cos calls to only 7,
+  // and makes the lunar distance and solar distance essentially free.
+  // http://mathworld.wolfram.com/Double-AngleFormulas.html
+  // http://mathworld.wolfram.com/TrigonometricAdditionFormulas.html
+  const sin2d = 2 * sind * cosd // sin(2d)
+  const sin2n = 2 * sinn * cosn // sin(2n)
+  const cos2d = 2 * cosd * cosd - 1 // cos(2d)
+  const cos2m = 2 * cosm * cosm - 1 // cos(2m)
+  const cos2n = 2 * cosn * cosn - 1 // cos(2n)
+  const sin2dn = sin2d * cosn - cos2d * sinn // sin(2d - n)
+  const cos2dn = cos2d * cosn + sin2d * sinn // cos(2d - n)
+
+  // lunar phase angle (p. 346)
+  const i = 180 - d - 6.289 * sinn + 2.100 * sinm - 1.274 * sin2dn - 0.658 * sin2d - 0.214 * sin2n - 0.110 * sind
+
+  // fractional illumination (p. 345)
+  const illumination = dcos(i) * 0.5 + 0.5
+
+  // fractional lunar phase
+  let phase = 0.5 - i * (1 / 360)
+  phase -= Math.floor(phase)
+
+  // lunar distance (p. 339-342)
+  // XXX: the book is not clear on how many terms to use for a given level of
+  // accuracy! I used all the easy ones that we already have for free above,
+  // but I imagine this is more than necessary...
+  const moonDistance = 385000.56 - 20905.355 * cosn - 3699.111 * cos2dn - 2955.968 * cos2d - 569.925 * cos2n + 108.743 * cosd
+
+  // solar distance
+  // https://aa.usno.navy.mil/faq/docs/SunApprox.php
+  const sunDistance = tokm(1.00014 - 0.01671 * cosm - 0.00014 * cos2m)
+
+  return {
+    phase: phase,
+    illuminated: illumination,
+    age: phase * SYNODIC_MONTH,
+    distance: moonDistance,
+    angular_diameter: MOON_ANGULAR_SIZE_SMAXIS / moonDistance,
+    sun_distance: sunDistance,
+    sun_angular_diameter: SUN_ANGULAR_SIZE_SMAXIS / sunDistance
+  }
+}
+
+/**
+ * Calculates time of the mean new Moon for a given base date.
+ * This argument K to this function is the precomputed synodic month
+ * index, given by:
+ *   K = (year - 1900) * 12.3685
+ * where year is expressed as a year and fractional year.
+ * @param  {Date} sdate   Start date
+ * @param  {[type]} k     [description]
+ * @return {[type]}       [description]
+ */
+function meanphase (sdate, k) {
+  // Time in Julian centuries from 1900 January 12 noon UTC
+  const delta = (sdate - -2208945600000.0) / 86400000.0
+  const t = delta / 36525
+  return 2415020.75933 +
+    SYNODIC_MONTH * k +
+    (0.0001178 - 0.000000155 * t) * t * t +
+    0.00033 * dsin(166.56 + (132.87 - 0.009173 * t) * t)
+}
+
+/**
+ * Given a K value used to determine the mean phase of the new moon, and a
+ * phase selector (0, 1, 2, 3), obtain the true, corrected phase time.
+ * @param  {[type]} k      [description]
+ * @param  {[type]} tphase [description]
+ * @return {[type]}        [description]
+ */
+function truephase (k, tphase) {
+  // restrict tphase to (0, 1, 2, 3)
+  tphase = tphase & PHASE_MASK
+
+  // add phase to new moon time
+  k = k + 0.25 * tphase
+
+  // Time in Julian centuries from 1900 January 0.5
+  const t = (1.0 / 1236.85) * k
+
+  // Mean time of phase
+  let pt = 2415020.75933 +
+    SYNODIC_MONTH * k +
+    (0.0001178 - 0.000000155 * t) * t * t +
+    0.00033 * dsin(166.56 + (132.87 - 0.009173 * t) * t)
+
+  // Sun's mean anomaly
+  const m = 359.2242 + 29.10535608 * k - (0.0000333 - 0.00000347 * t) * t * t
+
+  // Moon's mean anomaly
+  const mprime = 306.0253 + 385.81691806 * k + (0.0107306 + 0.00001236 * t) * t * t
+
+  // Moon's argument of latitude
+  const f = 21.2964 + 390.67050646 * k - (0.0016528 - 0.00000239 * t) * t * t
+
+  // use different correction equations depending on the phase being sought
+  switch (tphase) {
+    // new and full moon use one correction
+    case NEW:
+    case FULL:
+      pt += (0.1734 - 0.000393 * t) * dsin(m) +
+        0.0021 * dsin(2 * m) -
+        0.4068 * dsin(mprime) +
+        0.0161 * dsin(2 * mprime) -
+        0.0004 * dsin(3 * mprime) +
+        0.0104 * dsin(2 * f) -
+        0.0051 * dsin(m + mprime) -
+        0.0074 * dsin(m - mprime) +
+        0.0004 * dsin(2 * f + m) -
+        0.0004 * dsin(2 * f - m) -
+        0.0006 * dsin(2 * f + mprime) +
+        0.0010 * dsin(2 * f - mprime) +
+        0.0005 * dsin(m + 2 * mprime)
+      break
+
+    // first and last quarter moon use a different correction
+    case FIRST:
+    case LAST:
+      pt += (0.1721 - 0.0004 * t) * dsin(m) +
+        0.0021 * dsin(2 * m) -
+        0.6280 * dsin(mprime) +
+        0.0089 * dsin(2 * mprime) -
+        0.0004 * dsin(3 * mprime) +
+        0.0079 * dsin(2 * f) -
+        0.0119 * dsin(m + mprime) -
+        0.0047 * dsin(m - mprime) +
+        0.0003 * dsin(2 * f + m) -
+        0.0004 * dsin(2 * f - m) -
+        0.0006 * dsin(2 * f + mprime) +
+        0.0021 * dsin(2 * f - mprime) +
+        0.0003 * dsin(m + 2 * mprime) +
+        0.0004 * dsin(m - 2 * mprime) -
+        0.0003 * dsin(2 * m + mprime)
+
+      // the sign of the last term depends on whether we're looking for a first
+      // or last quarter moon!
+      const sign = (tphase < FULL) ? +1 : -1
+      pt += sign * (0.0028 - 0.0004 * dcos(m) + 0.0003 * dcos(mprime))
+
+      break
+  }
+
+  return julian.toDate(pt)
+}
+
+/**
+ * Find time of phases of the moon which surround the current date.
+ * Five phases are found, starting and ending with the new moons
+ * which bound the current lunation.
+ * @param  {Date} sdate Date to start hunting from (defaults to current date)
+ * @return {Object}     Object containing recent past and future phases
+ */
+function phaseHunt (sdate) {
+  if (!sdate) {
+    sdate = new Date()
+  }
+  if (!(sdate instanceof Date)) {
+    throw new TypeError('Invalid parameter')
+  }
+  if (Number.isNaN(sdate.getTime())) {
+    throw new RangeError('Invalid Date')
+  }
+
+  let adate = new Date(sdate.getTime() - (45 * 86400000)) // 45 days prior
+  let k1 = Math.floor(12.3685 * (adate.getFullYear() + (1.0 / 12.0) * adate.getMonth() - 1900))
+  let nt1 = meanphase(adate.getTime(), k1)
+
+  sdate = julian.fromDate(sdate)
+  adate = nt1 + SYNODIC_MONTH
+  let k2 = k1 + 1
+  let nt2 = meanphase(adate, k2)
+  while (nt1 > sdate || sdate >= nt2) {
+    adate += SYNODIC_MONTH
+    k1++
+    k2++
+    nt1 = nt2
+    nt2 = meanphase(adate, k2)
+  }
+
+  return {
+    new_date: truephase(k1, NEW),
+    q1_date: truephase(k1, FIRST),
+    full_date: truephase(k1, FULL),
+    q3_date: truephase(k1, LAST),
+    nextnew_date: truephase(k2, NEW)
+  }
+}
+
+function phaseRange (start, end, phase) {
+  if (!(start instanceof Date)) {
+    throw new TypeError('First argument must be a Date object.')
+  }
+  if (Number.isNaN(start.getTime())) {
+    throw new RangeError('First argument not a valid date.')
+  }
+  if (!(end instanceof Date)) {
+    throw new TypeError('Second argument must be a Date object.')
+  }
+  if (Number.isNaN(end.getTime())) {
+    throw new RangeError('Second argument not a valid date.')
+  }
+
+  if (end - start < 0) {
+    let temp = end
+    end = start
+    start = temp
+  }
+
+  start = start.getTime()
+  end = end.getTime()
+
+  let t = start - 45 * 86400000
+
+  let k
+  {
+    const d = new Date(t)
+    k = Math.floor(12.3685 * (d.getFullYear() + (1.0 / 12.0) * d.getMonth() - 1900))
+  }
+
+  let date = truephase(k, phase)
+  // skip every phase before starting date
+  while (date.getTime() < start) {
+    k++
+    date = truephase(k, phase)
+  }
+  // add every phase before (or on!) ending date to a list, and return it
+  const list = []
+  while (date.getTime() <= end) {
+    list.push(date)
+    k++
+    date = truephase(k, phase)
+  }
+  return list
+}
+
+exports.PHASE_NEW = NEW
+exports.PHASE_FIRST = FIRST
+exports.PHASE_FULL = FULL
+exports.PHASE_LAST = LAST
+exports.phase = phase
+exports.phase_hunt = phaseHunt
+exports.phase_range = phaseRange

+ 355 - 0
app/calendar/lune.js

@@ -0,0 +1,355 @@
+/**
+ * This library calculates the current phase of the moon
+ * as well as finds the dates of the recent moon phases.
+ *
+ * Some functionality is ported from python version found here:
+ * https://bazaar.launchpad.net/~keturn/py-moon-phase/trunk/annotate/head:/moon.py
+ *
+ * Some functionality is taken from Astronomical Algorithms, 2nd ed.
+ *
+ * Some functionality is taken from the US Naval Observatory, described here:
+ * https://aa.usno.navy.mil/faq/docs/SunApprox.php
+ *
+ * Author: Ryan Seys (https://github.com/ryanseys)
+ * Author: Jay LaPorte (https://github.com/ironwallaby)
+ */
+
+'use strict'
+
+const julian = require('./julian')
+
+// Phases of the moon & precision
+const NEW = 0
+const FIRST = 1
+const FULL = 2
+const LAST = 3
+const PHASE_MASK = 3
+
+// Astronomical Constants
+// Semi-major axis of Earth's orbit, in kilometers
+const SUN_SMAXIS = 1.49585e8
+
+// SUN_SMAXIS premultiplied by the angular size of the Sun from the Earth
+const SUN_ANGULAR_SIZE_SMAXIS = SUN_SMAXIS * 0.533128
+
+// Semi-major axis of the Moon's orbit, in kilometers
+const MOON_SMAXIS = 384401.0
+
+// MOON_SMAXIS premultiplied by the angular size of the Moon from the Earth
+const MOON_ANGULAR_SIZE_SMAXIS = MOON_SMAXIS * 0.5181
+
+// Synodic month (new Moon to new Moon), in days
+const SYNODIC_MONTH = 29.53058868
+
+/**
+ * Convert degrees to radians
+ * @param  {Number} d Angle in degrees
+ * @return {Number}   Angle in radians
+ */
+function torad (d) {
+  return (Math.PI / 180.0) * d
+}
+
+/**
+ * Convert radians to degrees
+ * @param  {Number} r Angle in radians
+ * @return {Number}   Angle in degrees
+ */
+function dsin (d) {
+  return Math.sin(torad(d))
+}
+
+function dcos (d) {
+  return Math.cos(torad(d))
+}
+
+/**
+ * Convert astronomical units to kilometers
+ * @param  {Number} au Distance in astronomical units
+ * @return {Number}    Distance in kilometers
+ */
+function tokm (au) {
+  return 149597870.700 * au
+}
+
+/**
+ * Finds the phase information for specific date.
+ * @param  {Date}   date Date to get phase information of.
+ * @return {Object}      Phase data
+ */
+function phase (date) {
+  if (!date) {
+    date = new Date()
+  }
+  if (!(date instanceof Date)) {
+    throw new TypeError('Invalid parameter')
+  }
+  if (Number.isNaN(date.getTime())) {
+    throw new RangeError('Invalid Date')
+  }
+
+  // t is the time in "Julian centuries" of 36525 days starting from 2000-01-01
+  // (Note the 0.3 is because the UNIX epoch is on 1970-01-01 and that's 3/10th
+  // of a century before 2000-01-01, which I find cute :3 )
+  const t = date.getTime() * (1 / 3155760000000) - 0.3
+
+  // lunar mean elongation (Astronomical Algorithms, 2nd ed., p. 338)
+  const d = 297.8501921 + t * (445267.1114034 + t * (-0.0018819 + t * ((1 / 545868) + t * (-1 / 113065000))))
+
+  // solar mean anomaly (p. 338)
+  const m = 357.5291092 + t * (35999.0502909 + t * (-0.0001536 + t * (1 / 24490000)))
+
+  // lunar mean anomaly (p. 338)
+  const n = 134.9633964 + t * (477198.8675055 + t * (0.0087414 + t * ((1 / 69699) + t * (-1 / 14712000))))
+
+  // derive sines and cosines necessary for the below calculations
+  const sind = dsin(d)
+  const sinm = dsin(m)
+  const sinn = dsin(n)
+  const cosd = dcos(d)
+  const cosm = dcos(m)
+  const cosn = dcos(n)
+
+  // use trigonometric identities to derive the remainder of the sines and
+  // cosines we need. this reduces us from needing 14 sin/cos calls to only 7,
+  // and makes the lunar distance and solar distance essentially free.
+  // http://mathworld.wolfram.com/Double-AngleFormulas.html
+  // http://mathworld.wolfram.com/TrigonometricAdditionFormulas.html
+  const sin2d = 2 * sind * cosd // sin(2d)
+  const sin2n = 2 * sinn * cosn // sin(2n)
+  const cos2d = 2 * cosd * cosd - 1 // cos(2d)
+  const cos2m = 2 * cosm * cosm - 1 // cos(2m)
+  const cos2n = 2 * cosn * cosn - 1 // cos(2n)
+  const sin2dn = sin2d * cosn - cos2d * sinn // sin(2d - n)
+  const cos2dn = cos2d * cosn + sin2d * sinn // cos(2d - n)
+
+  // lunar phase angle (p. 346)
+  const i = 180 - d - 6.289 * sinn + 2.100 * sinm - 1.274 * sin2dn - 0.658 * sin2d - 0.214 * sin2n - 0.110 * sind
+
+  // fractional illumination (p. 345)
+  const illumination = dcos(i) * 0.5 + 0.5
+
+  // fractional lunar phase
+  let phase = 0.5 - i * (1 / 360)
+  phase -= Math.floor(phase)
+
+  // lunar distance (p. 339-342)
+  // XXX: the book is not clear on how many terms to use for a given level of
+  // accuracy! I used all the easy ones that we already have for free above,
+  // but I imagine this is more than necessary...
+  const moonDistance = 385000.56 - 20905.355 * cosn - 3699.111 * cos2dn - 2955.968 * cos2d - 569.925 * cos2n + 108.743 * cosd
+
+  // solar distance
+  // https://aa.usno.navy.mil/faq/docs/SunApprox.php
+  const sunDistance = tokm(1.00014 - 0.01671 * cosm - 0.00014 * cos2m)
+
+  return {
+    phase: phase,
+    illuminated: illumination,
+    age: phase * SYNODIC_MONTH,
+    distance: moonDistance,
+    angular_diameter: MOON_ANGULAR_SIZE_SMAXIS / moonDistance,
+    sun_distance: sunDistance,
+    sun_angular_diameter: SUN_ANGULAR_SIZE_SMAXIS / sunDistance
+  }
+}
+
+/**
+ * Calculates time of the mean new Moon for a given base date.
+ * This argument K to this function is the precomputed synodic month
+ * index, given by:
+ *   K = (year - 1900) * 12.3685
+ * where year is expressed as a year and fractional year.
+ * @param  {Date} sdate   Start date
+ * @param  {[type]} k     [description]
+ * @return {[type]}       [description]
+ */
+function meanphase (sdate, k) {
+  // Time in Julian centuries from 1900 January 12 noon UTC
+  const delta = (sdate - -2208945600000.0) / 86400000.0
+  const t = delta / 36525
+  return 2415020.75933 +
+    SYNODIC_MONTH * k +
+    (0.0001178 - 0.000000155 * t) * t * t +
+    0.00033 * dsin(166.56 + (132.87 - 0.009173 * t) * t)
+}
+
+/**
+ * Given a K value used to determine the mean phase of the new moon, and a
+ * phase selector (0, 1, 2, 3), obtain the true, corrected phase time.
+ * @param  {[type]} k      [description]
+ * @param  {[type]} tphase [description]
+ * @return {[type]}        [description]
+ */
+function truephase (k, tphase) {
+  // restrict tphase to (0, 1, 2, 3)
+  tphase = tphase & PHASE_MASK
+
+  // add phase to new moon time
+  k = k + 0.25 * tphase
+
+  // Time in Julian centuries from 1900 January 0.5
+  const t = (1.0 / 1236.85) * k
+
+  // Mean time of phase
+  let pt = 2415020.75933 +
+    SYNODIC_MONTH * k +
+    (0.0001178 - 0.000000155 * t) * t * t +
+    0.00033 * dsin(166.56 + (132.87 - 0.009173 * t) * t)
+
+  // Sun's mean anomaly
+  const m = 359.2242 + 29.10535608 * k - (0.0000333 - 0.00000347 * t) * t * t
+
+  // Moon's mean anomaly
+  const mprime = 306.0253 + 385.81691806 * k + (0.0107306 + 0.00001236 * t) * t * t
+
+  // Moon's argument of latitude
+  const f = 21.2964 + 390.67050646 * k - (0.0016528 - 0.00000239 * t) * t * t
+
+  // use different correction equations depending on the phase being sought
+  switch (tphase) {
+    // new and full moon use one correction
+    case NEW:
+    case FULL:
+      pt += (0.1734 - 0.000393 * t) * dsin(m) +
+        0.0021 * dsin(2 * m) -
+        0.4068 * dsin(mprime) +
+        0.0161 * dsin(2 * mprime) -
+        0.0004 * dsin(3 * mprime) +
+        0.0104 * dsin(2 * f) -
+        0.0051 * dsin(m + mprime) -
+        0.0074 * dsin(m - mprime) +
+        0.0004 * dsin(2 * f + m) -
+        0.0004 * dsin(2 * f - m) -
+        0.0006 * dsin(2 * f + mprime) +
+        0.0010 * dsin(2 * f - mprime) +
+        0.0005 * dsin(m + 2 * mprime)
+      break
+
+    // first and last quarter moon use a different correction
+    case FIRST:
+    case LAST:
+      pt += (0.1721 - 0.0004 * t) * dsin(m) +
+        0.0021 * dsin(2 * m) -
+        0.6280 * dsin(mprime) +
+        0.0089 * dsin(2 * mprime) -
+        0.0004 * dsin(3 * mprime) +
+        0.0079 * dsin(2 * f) -
+        0.0119 * dsin(m + mprime) -
+        0.0047 * dsin(m - mprime) +
+        0.0003 * dsin(2 * f + m) -
+        0.0004 * dsin(2 * f - m) -
+        0.0006 * dsin(2 * f + mprime) +
+        0.0021 * dsin(2 * f - mprime) +
+        0.0003 * dsin(m + 2 * mprime) +
+        0.0004 * dsin(m - 2 * mprime) -
+        0.0003 * dsin(2 * m + mprime)
+
+      // the sign of the last term depends on whether we're looking for a first
+      // or last quarter moon!
+      const sign = (tphase < FULL) ? +1 : -1
+      pt += sign * (0.0028 - 0.0004 * dcos(m) + 0.0003 * dcos(mprime))
+
+      break
+  }
+
+  return julian.toDate(pt)
+}
+
+/**
+ * Find time of phases of the moon which surround the current date.
+ * Five phases are found, starting and ending with the new moons
+ * which bound the current lunation.
+ * @param  {Date} sdate Date to start hunting from (defaults to current date)
+ * @return {Object}     Object containing recent past and future phases
+ */
+function phaseHunt (sdate) {
+  if (!sdate) {
+    sdate = new Date()
+  }
+  if (!(sdate instanceof Date)) {
+    throw new TypeError('Invalid parameter')
+  }
+  if (Number.isNaN(sdate.getTime())) {
+    throw new RangeError('Invalid Date')
+  }
+
+  let adate = new Date(sdate.getTime() - (45 * 86400000)) // 45 days prior
+  let k1 = Math.floor(12.3685 * (adate.getFullYear() + (1.0 / 12.0) * adate.getMonth() - 1900))
+  let nt1 = meanphase(adate.getTime(), k1)
+
+  sdate = julian.fromDate(sdate)
+  adate = nt1 + SYNODIC_MONTH
+  let k2 = k1 + 1
+  let nt2 = meanphase(adate, k2)
+  while (nt1 > sdate || sdate >= nt2) {
+    adate += SYNODIC_MONTH
+    k1++
+    k2++
+    nt1 = nt2
+    nt2 = meanphase(adate, k2)
+  }
+
+  return {
+    new_date: truephase(k1, NEW),
+    q1_date: truephase(k1, FIRST),
+    full_date: truephase(k1, FULL),
+    q3_date: truephase(k1, LAST),
+    nextnew_date: truephase(k2, NEW)
+  }
+}
+
+function phaseRange (start, end, phase) {
+  if (!(start instanceof Date)) {
+    throw new TypeError('First argument must be a Date object.')
+  }
+  if (Number.isNaN(start.getTime())) {
+    throw new RangeError('First argument not a valid date.')
+  }
+  if (!(end instanceof Date)) {
+    throw new TypeError('Second argument must be a Date object.')
+  }
+  if (Number.isNaN(end.getTime())) {
+    throw new RangeError('Second argument not a valid date.')
+  }
+
+  if (end - start < 0) {
+    let temp = end
+    end = start
+    start = temp
+  }
+
+  start = start.getTime()
+  end = end.getTime()
+
+  let t = start - 45 * 86400000
+
+  let k
+  {
+    const d = new Date(t)
+    k = Math.floor(12.3685 * (d.getFullYear() + (1.0 / 12.0) * d.getMonth() - 1900))
+  }
+
+  let date = truephase(k, phase)
+  // skip every phase before starting date
+  while (date.getTime() < start) {
+    k++
+    date = truephase(k, phase)
+  }
+  // add every phase before (or on!) ending date to a list, and return it
+  const list = []
+  while (date.getTime() <= end) {
+    list.push(date)
+    k++
+    date = truephase(k, phase)
+  }
+  return list
+}
+
+exports.PHASE_NEW = NEW
+exports.PHASE_FIRST = FIRST
+exports.PHASE_FULL = FULL
+exports.PHASE_LAST = LAST
+exports.phase = phase
+exports.phase_hunt = phaseHunt
+exports.phase_range = phaseRange

+ 261 - 0
app/calendar/moon.js

@@ -0,0 +1,261 @@
+/*   
+  Moon-phase calculation
+  Roger W. Sinnott, Sky & Telescope, June 16, 2006.
+*/
+
+/*
+ Declare constant variables
+ */
+var jd = 0;
+
+/*
+ Set date and time to current date and time
+ */
+function setup() {
+    var nowdate = new Date();
+    var day = nowdate.getDate();
+    var month = nowdate.getMonth();
+    var year = nowdate.getFullYear();
+    document.moonfaseBox.yearf.value = year;
+    document.moonfaseBox.monthf.selectedIndex = month;
+    document.moonfaseBox.dayf.selectedIndex = day - 1;
+}
+
+
+/*
+ todo: Do not know what function does
+ */
+function proper_ang(big) {
+    with (Math) {
+        var tmp = 0;
+        if (big > 0) {
+            tmp = big / 360.0;
+            tmp = (tmp - floor(tmp)) * 360.0;
+        }
+        else {
+            tmp = ceil(abs(big / 360.0));
+            tmp = big + tmp * 360.0;
+        }
+    }
+    return tmp;
+}
+
+
+/*
+ Calculate dates in February
+ */
+function daysInFebruary(year) {
+    if (year > 1582) {
+        return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
+    }
+    else {
+        return ((year % 4 == 0) ? 29 : 28 );
+    }
+}
+
+
+/*
+ Calculate days in every month
+ */
+function DaysArray(n) {
+    for (var i = 1; i <= n; i++) {
+        this[i] = 31;
+        if (i == 4 || i == 6 || i == 9 || i == 11) {
+            this[i] = 30
+        }
+        if (i == 2) {
+            this[i] = 29
+        }
+    }
+    return this;
+}
+
+
+/*
+ Validate date and display errors
+ */
+function isDate() {
+    var daysInMonth = new DaysArray(12);
+    var monthIdx = document.moonfaseBox.monthf.selectedIndex;
+    var month = eval(document.moonfaseBox.monthf.options[monthIdx].value);
+    var dayIdx = document.moonfaseBox.dayf.selectedIndex;
+    var day = eval(document.moonfaseBox.dayf.options[dayIdx].value);
+    var yearff = document.moonfaseBox.yearf.value;
+
+    if (yearff == "") {
+        alert("Please enter the year.");
+        document.moonfaseBox.yearf.focus();
+        return false;
+    }
+
+    if (isNaN(yearff)) {
+        alert("Please reenter the year.  Only numbers are allowed.");
+        document.moonfaseBox.yearf.focus();
+        return false;
+    }
+
+    var year = eval(yearff);
+
+    if (year == 0) {
+        alert("Sorry!  There was no year 0 in common reckoning.  Please enter 1 and click 'BC' if that is what you meant.");
+        document.moonfaseBox.yearf.focus();
+        return false;
+    }
+
+    if (year < 0) {
+        alert("Sorry!  Don't use a minus sign with the year.  Instead, click 'BC' and increase the absolute value of the year by one.");
+        document.moonfaseBox.yearf.focus();
+        return false;
+    }
+
+    var eraObj = document.getElementsByName("adbc");
+    for (var i = 0; i < eraObj.length; i++) {
+        if (eraObj[i].checked) {
+            era = eraObj[i].value;
+        }
+    }
+    if (era == 0) year = 1 - year;
+
+// Note:  From here on, in this function only, 'year' is the astronomical year with sign!!
+    if (month == 2 && day == 29 && day > daysInFebruary(year)) {
+        alert("Sorry!  Not a leap year, so there is no February 29th.");
+        return false;
+    }
+
+    if (day > daysInMonth[month]) {
+        alert("Oops!  Please enter a valid number for the day.");
+        return false;
+    }
+
+    if (year == 1582 && month == 10 && day > 4 && day < 15) {
+        alert("Invalid date.  In the Gregorian calendar reform, October 4, 1582, was immediately followed by October 15, 1582.");
+        return false;
+    }
+
+    if (year < -3999) {
+        alert("The year you've entered is too early.  Please enter a year after 4001 BC.");
+        return false;
+    }
+
+    if (year > 8000) {
+        alert("The year you've entered is too far in the future.  Please enter a year prior to AD 8001.");
+        return false;
+    }
+
+    if ((year < 100) && (year > 0)) {
+        alert("Caution!  You've entered a year prior to AD 100.  If you intended a modern date, be sure 'AD' is clicked and enter all four digits of the year.  If you really did mean an early historical date in the Julian calendar, the Moon's phase will be correctly shown.")
+    }
+
+    return true;
+}
+
+
+/*
+ Validate form
+ */
+function ValidateForm() {
+    if (isDate() == false) {
+        return false;
+    }
+    jdn();
+    moonElong();
+    return true;
+}
+
+
+/*
+ todo: Do not know what function does
+ */
+function jdn() {
+    var now_date = new Date();
+    var zone = now_date.getTimezoneOffset() / 1440;
+
+    var monthIdx = document.moonfaseBox.monthf.selectedIndex;
+    var mm = eval(document.moonfaseBox.monthf.options[monthIdx].value);
+
+    var dayIdx = document.moonfaseBox.dayf.selectedIndex;
+    var dd = eval(document.moonfaseBox.dayf.options[dayIdx].value);
+
+    var yy = eval(document.moonfaseBox.yearf.value);
+    with (Math) {
+        var yyy = yy;
+        var eraObj = document.getElementsByName("adbc");
+        for (var i = 0; i < eraObj.length; i++) {
+            if (eraObj[i].checked) {
+                var era = eraObj[i].value;
+            }
+        }
+        if (era == 0) yyy = 1 - yy;
+        var mmm = mm;
+        if (mm < 3) {
+            yyy = yyy - 1;
+            mmm = mm + 12;
+        }
+        var day = dd + zone + 0.5;
+        var a = floor(yyy / 100);
+        var b = 2 - a + floor(a / 4);
+        jd = floor(365.25 * yyy) + floor(30.6001 * (mmm + 1)) + day + 1720994.5;
+        if (jd > 2299160.4999999) jd = jd + b;
+    }
+    // document.moonfaseBox.jdnum.value = jd;
+}
+
+
+/*
+ todo: Do not know what function does
+ */
+function moonElong() {
+    with (Math) {
+        var dr = PI / 180;
+        var rd = 1 / dr;
+        var meeDT = pow((jd - 2382148), 2) / (41048480 * 86400);
+        var meeT = (jd + meeDT - 2451545.0) / 36525;
+        var meeT2 = pow(meeT, 2);
+        var meeT3 = pow(meeT, 3);
+        var meeD = 297.85 + (445267.1115 * meeT) - (0.0016300 * meeT2) + (meeT3 / 545868);
+        meeD = proper_ang(meeD) * dr;
+        var meeM1 = 134.96 + (477198.8676 * meeT) + (0.0089970 * meeT2) + (meeT3 / 69699);
+        meeM1 = proper_ang(meeM1) * dr;
+        var meeM = 357.53 + (35999.0503 * meeT);
+        meeM = proper_ang(meeM) * dr;
+        var elong = meeD * rd + 6.29 * sin(meeM1);
+        elong = elong - 2.10 * sin(meeM);
+        elong = elong + 1.27 * sin(2 * meeD - meeM1);
+        elong = elong + 0.66 * sin(2 * meeD);
+        elong = proper_ang(elong);
+        elong = round(elong);
+        var moonNum = ((elong + 6.43) / 360) * 28;
+        moonNum = floor(moonNum);
+        if (moonNum == 28) moonNum = 0;
+        if (moonNum < 10) moonNum = "0" + moonNum;
+        var moonImage = "moon_files/moon" + moonNum.toString() + ".gif"
+    }
+    var moonPhase = " new Moon";
+    if ((moonNum > 03) && (moonNum < 11)) moonPhase = " First Quarter";
+    if ((moonNum > 10) && (moonNum < 18)) moonPhase = " Full Moon";
+    if ((moonNum > 17) && (moonNum < 25)) moonPhase = " Last Quarter";
+
+    if ((moonNum == 01) || (moonNum == 8) || (moonNum == 15) || (moonNum == 22)) {
+        moonPhase = " 1 day past" + moonPhase
+    }
+    if ((moonNum == 02) || (moonNum == 9) || (moonNum == 16) || (moonNum == 23)) {
+        moonPhase = " 2 days past" + moonPhase
+    }
+    if ((moonNum == 03) || (moonNum == 10) || (moonNum == 17) || (moonNum == 24)) {
+        moonPhase = " 3 days past" + moonPhase
+    }
+    if ((moonNum == 04) || (moonNum == 11) || (moonNum == 18) || (moonNum == 25)) {
+        moonPhase = " 3 days before" + moonPhase
+    }
+    if ((moonNum == 05) || (moonNum == 12) || (moonNum == 19) || (moonNum == 26)) {
+        moonPhase = " 2 days before" + moonPhase
+    }
+    if ((moonNum == 06) || (moonNum == 13) || (moonNum == 20) || (moonNum == 27)) {
+        moonPhase = " 1 day before" + moonPhase
+    }
+
+    document.moonfaseBox.moonphasetext.value = moonPhase;
+    document.slideshow.src = moonImage;
+    // document.moonfaseBox.elongation.value = elong
+}
+

+ 34 - 0
app/calendar/package.json

@@ -0,0 +1,34 @@
+{
+  "name": "lune",
+  "version": "0.4.1",
+  "description": "Calculate the phases of the moon",
+  "keywords": [
+    "lune",
+    "moon",
+    "phase",
+    "phases",
+    "lunar"
+  ],
+  "homepage": "https://github.com/ryanseys/lune",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/ryanseys/lune.git"
+  },
+  "bugs": {
+    "url": "https://github.com/ryanseys/lune/issues",
+    "email": "ryan@ryanseys.com"
+  },
+  "engines": {
+    "node": ">=4.0.0"
+  },
+  "main": "lib/lune.js",
+  "license": "Apache-2.0",
+  "devDependencies": {
+    "chai": "~4.2.0",
+    "mocha": "~6.1.4",
+    "standard": "^12.0.1"
+  },
+  "scripts": {
+    "test": "standard && mocha --reporter min"
+  }
+}

+ 326 - 0
app/calendar/suncalc.js

@@ -0,0 +1,326 @@
+/*
+ (c) 2011-2015, Vladimir Agafonkin
+ SunCalc is a JavaScript library for calculating sun/moon position and light phases.
+ https://github.com/mourner/suncalc
+*/
+
+(function () { 'use strict';
+
+// shortcuts for easier to read formulas 公式易读快捷方式
+
+var PI   = Math.PI,
+    sin  = Math.sin,
+    cos  = Math.cos,
+    tan  = Math.tan,
+    asin = Math.asin,
+    atan = Math.atan2,
+    acos = Math.acos,
+    rad  = PI / 180;
+
+// sun calculations are based on http://aa.quae.nl/en/reken/zonpositie.html formulas
+// 太阳计算基于 http://aa.quae.nl/en/reken/zonpositie.html 上的公式
+
+// date/time constants and conversions 日期/时间常量和转换
+
+var dayMs = 1000 * 60 * 60 * 24,//一天的毫秒数
+    J1970 = 2440588,
+    J2000 = 2451545;
+
+function toJulian(date) { return date.valueOf() / dayMs - 0.5 + J1970; }
+function fromJulian(j)  { return new Date((j + 0.5 - J1970) * dayMs); }
+function toDays(date)   { return toJulian(date) - J2000; }
+
+
+// general calculations for position 通用位置计算
+
+var e = rad * 23.4397; // obliquity of the Earth
+
+function rightAscension(l, b) { return atan(sin(l) * cos(e) - tan(b) * sin(e), cos(l)); }
+function declination(l, b)    { return asin(sin(b) * cos(e) + cos(b) * sin(e) * sin(l)); }
+//方位角
+function azimuth(H, phi, dec)  { return atan(sin(H), cos(H) * sin(phi) - tan(dec) * cos(phi)); }
+//高度角
+function altitude(H, phi, dec) { return asin(sin(phi) * sin(dec) + cos(phi) * cos(dec) * cos(H)); }
+
+function siderealTime(d, lw) { return rad * (280.16 + 360.9856235 * d) - lw; }
+
+function astroRefraction(h) {
+    if (h < 0) // the following formula works for positive altitudes only.
+        h = 0; // if h = -0.08901179 a div/0 would occur.
+
+    // formula 16.4 of "Astronomical Algorithms" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.
+    // 1.02 / tan(h + 10.26 / (h + 5.10)) h in degrees, result in arc minutes -> converted to rad:
+    return 0.0002967 / Math.tan(h + 0.00312536 / (h + 0.08901179));
+}
+
+// general sun calculations 通用太阳计算
+
+function solarMeanAnomaly(d) { return rad * (357.5291 + 0.98560028 * d); }
+
+function eclipticLongitude(M) {
+
+    var C = rad * (1.9148 * sin(M) + 0.02 * sin(2 * M) + 0.0003 * sin(3 * M)), // equation of center 中心差
+        P = rad * 102.9372; // perihelion of the Earth 地球近日点
+
+    return M + C + P + PI;
+}
+
+function sunCoords(d) {
+
+    var M = solarMeanAnomaly(d),
+        L = eclipticLongitude(M);
+
+    return {
+        dec: declination(L, 0),
+        ra: rightAscension(L, 0)
+    };
+}
+
+
+var SunCalc = {};
+
+
+// calculates sun position for a given date and latitude/longitude 根据给定的日期与经纬度计算太阳位置
+
+SunCalc.getPosition = function (date, lat, lng) {
+
+    var lw  = rad * -lng,
+        phi = rad * lat,
+        d   = toDays(date),
+
+        c  = sunCoords(d),
+        H  = siderealTime(d, lw) - c.ra;
+
+    return {
+        azimuth: azimuth(H, phi, c.dec),
+        altitude: altitude(H, phi, c.dec)
+    };
+};
+
+
+// sun times configuration (angle, morning name, evening name) 太阳时间配置(高度,晨名,昏名)
+
+var times = SunCalc.times = [
+    [-0.833, 'sunrise',       'sunset'      ], //日出,日落
+    [  -0.3, 'sunriseEnd',    'sunsetStart' ], //日出结束,日落开始
+    [-6.833, 'dawn',          'dusk'        ], //曙光升起,夜幕降临(修正蒙气差)
+    [   -12, 'nauticalDawn',  'nauticalDusk'], //航海曙光,航海暮光
+    [   -18, 'nightEnd',      'night'       ], //夜尽,入夜
+    [     6, 'goldenHourEnd', 'goldenHour'  ]  //朝霞结束,晚霞开始
+];
+
+// adds a custom time to the times config 在时间配置中添加自定义时间
+
+SunCalc.addTime = function (angle, riseName, setName) {
+    times.push([angle, riseName, setName]);
+};
+
+
+// calculations for sun times 计算太阳时
+
+var J0 = 0.0009;
+
+function julianCycle(d, lw) { return Math.round(d - J0 - lw / (2 * PI)); }
+
+function approxTransit(Ht, lw, n) { return J0 + (Ht + lw) / (2 * PI) + n; }
+function solarTransitJ(ds, M, L)  { return J2000 + ds + 0.0053 * sin(M) - 0.0069 * sin(2 * L); }
+
+function hourAngle(h, phi, d) { return acos((sin(h) - sin(phi) * sin(d)) / (cos(phi) * cos(d))); }
+function observerAngle(height) { return -2.076 * Math.sqrt(height) / 60; }
+
+// returns set time for the given sun altitude 返回给定太阳高度的设置时间
+function getSetJ(h, lw, phi, dec, n, M, L) {
+
+    var w = hourAngle(h, phi, dec),
+        a = approxTransit(w, lw, n);
+    return solarTransitJ(a, M, L);
+}
+
+
+// calculates sun times for a given date, latitude/longitude, and, optionally,
+// 计算给定日期,纬度/经度的太阳时间,以及(可选)
+// the observer height (in meters) relative to the horizon
+// 观察者相对于地平线的高度(以米为单位)
+
+SunCalc.getTimes = function (date, lat, lng, height) {
+
+    height = height || 0;
+
+    var lw = rad * -lng,
+        phi = rad * lat,
+
+        dh = observerAngle(height),
+
+        d = toDays(date),
+        n = julianCycle(d, lw),
+        ds = approxTransit(0, lw, n),
+
+        M = solarMeanAnomaly(ds),
+        L = eclipticLongitude(M),
+        dec = declination(L, 0),
+
+        Jnoon = solarTransitJ(ds, M, L),
+
+        i, len, time, h0, Jset, Jrise;
+
+
+    var result = {
+        solarNoon: fromJulian(Jnoon),
+        nadir: fromJulian(Jnoon - 0.5)
+    };
+
+    for (i = 0, len = times.length; i < len; i += 1) {
+        time = times[i];
+        h0 = (time[0] + dh) * rad;
+
+        Jset = getSetJ(h0, lw, phi, dec, n, M, L);
+        Jrise = Jnoon - (Jset - Jnoon);
+
+        result[time[1]] = fromJulian(Jrise);
+        result[time[2]] = fromJulian(Jset);
+    }
+
+    return result;
+};
+
+
+// moon calculations, based on http://aa.quae.nl/en/reken/hemelpositie.html formulas
+// 月亮计算,基于 http://aa.quae.nl/en/reken/hemelpositie.html 上的公式
+function moonCoords(d) { // geocentric ecliptic coordinates of the moon 月球的地心黄道坐标
+
+    var L = rad * (218.316 + 13.176396 * d), // ecliptic longitude 黄道经度
+        M = rad * (134.963 + 13.064993 * d), // mean anomaly 平均异常
+        F = rad * (93.272 + 13.229350 * d),  // mean distance 平均距离
+
+        l  = L + rad * 6.289 * sin(M), // longitude 经度
+        b  = rad * 5.128 * sin(F),     // latitude 纬度
+        dt = 385001 - 20905 * cos(M);  // distance to the moon in km 地月距离
+
+    return {
+        ra: rightAscension(l, b),
+        dec: declination(l, b),
+        dist: dt
+    };
+}
+
+SunCalc.getMoonPosition = function (date, lat, lng) {
+
+    var lw  = rad * -lng,
+        phi = rad * lat,
+        d   = toDays(date),
+
+        c = moonCoords(d),
+        H = siderealTime(d, lw) - c.ra,
+        h = altitude(H, phi, c.dec),
+        // formula 14.1 of "Astronomical Algorithms" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.
+        // 公式14.1——“Astronomical Algorithms” 第二版 Jean Meeus (Willmann-Bell, Richmond) 1998
+        pa = atan(sin(H), tan(phi) * cos(c.dec) - sin(c.dec) * cos(H));
+
+    h = h + astroRefraction(h); // altitude correction for refraction 折射高度修正
+
+    return {
+        azimuth: azimuth(H, phi, c.dec),
+        altitude: h,
+        distance: c.dist,
+        parallacticAngle: pa
+    };
+};
+
+
+// calculations for illumination parameters of the moon, 计算月球的照明参数,
+// based on http://idlastro.gsfc.nasa.gov/ftp/pro/astro/mphase.pro formulas and
+// 基于 http://idlastro.gsfc.nasa.gov/ftp/pro/astro/mphase.pro 上的公式
+// Chapter 48 of "Astronomical Algorithms" 2nd edition by Jean Meeus (Willmann-Bell, Richmond) 1998.
+// 第48章 ——“Astronomical Algorithms” 第二版 Jean Meeus (Willmann-Bell, Richmond) 1998
+
+SunCalc.getMoonIllumination = function (date) {
+
+    var d = toDays(date || new Date()),
+        s = sunCoords(d),
+        m = moonCoords(d),
+
+        sdist = 149598000, // distance from Earth to Sun in km 地日距离(单位:千米)
+
+        phi = acos(sin(s.dec) * sin(m.dec) + cos(s.dec) * cos(m.dec) * cos(s.ra - m.ra)),
+        inc = atan(sdist * sin(phi), m.dist - sdist * cos(phi)),
+        angle = atan(cos(s.dec) * sin(s.ra - m.ra), sin(s.dec) * cos(m.dec) -
+                cos(s.dec) * sin(m.dec) * cos(s.ra - m.ra));
+
+    return {
+        fraction: (1 + cos(inc)) / 2,
+        phase: 0.5 + 0.5 * inc * (angle < 0 ? -1 : 1) / Math.PI,
+        angle: angle
+    };
+};
+
+
+function hoursLater(date, h) {
+    return new Date(date.valueOf() + h * dayMs / 24);
+}
+
+// calculations for moon rise/set times are based on http://www.stargazing.net/kepler/moonrise.html article
+// 计算月亮升起和落下的实践,基于 http://www.stargazing.net/kepler/moonrise.html 上的文章
+
+SunCalc.getMoonTimes = function (date, lat, lng, inUTC) {
+    var t = new Date(date);
+    if (inUTC) t.setUTCHours(0, 0, 0, 0);
+    else t.setHours(0, 0, 0, 0);
+
+    var hc = 0.133 * rad,
+        h0 = SunCalc.getMoonPosition(t, lat, lng).altitude - hc,
+        h1, h2, rise, set, a, b, xe, ye, d, roots, x1, x2, dx;
+
+    // go in 2-hour chunks, each time seeing if a 3-point quadratic curve crosses zero (which means rise or set)
+    // 进行2小时的测试,每次查看3点二次曲线是否过零(表示上升或下降)
+    for (var i = 1; i <= 24; i += 2) {
+        h1 = SunCalc.getMoonPosition(hoursLater(t, i), lat, lng).altitude - hc;
+        h2 = SunCalc.getMoonPosition(hoursLater(t, i + 1), lat, lng).altitude - hc;
+
+        a = (h0 + h2) / 2 - h1;
+        b = (h2 - h0) / 2;
+        xe = -b / (2 * a);
+        ye = (a * xe + b) * xe + h1;
+        d = b * b - 4 * a * h1;
+        roots = 0;
+
+        if (d >= 0) {
+            dx = Math.sqrt(d) / (Math.abs(a) * 2);
+            x1 = xe - dx;
+            x2 = xe + dx;
+            if (Math.abs(x1) <= 1) roots++;
+            if (Math.abs(x2) <= 1) roots++;
+            if (x1 < -1) x1 = x2;
+        }
+
+        if (roots === 1) {
+            if (h0 < 0) rise = i + x1;
+            else set = i + x1;
+
+        } else if (roots === 2) {
+            rise = i + (ye < 0 ? x2 : x1);
+            set = i + (ye < 0 ? x1 : x2);
+        }
+
+        if (rise && set) break;
+
+        h0 = h2;
+    }
+
+    var result = {};
+
+    if (rise) result.rise = hoursLater(t, rise);
+    if (set) result.set = hoursLater(t, set);
+
+    if (!rise && !set) result[ye > 0 ? 'alwaysUp' : 'alwaysDown'] = true;
+
+    return result;
+};
+
+
+// export as Node module / AMD module / browser variable
+// 导出为节点模块/ AMD模块/浏览器变量
+if (typeof exports === 'object' && typeof module !== 'undefined') module.exports = SunCalc;
+else if (typeof define === 'function' && define.amd) define(SunCalc);
+else window.SunCalc = SunCalc;
+
+}());

+ 166 - 0
app/calendar/test/index.js

@@ -0,0 +1,166 @@
+/* global describe, it */
+'use strict'
+const assert = require('chai').assert
+const julian = require('../lib/julian')
+const lune = require('../lib/lune')
+
+describe('lune', function () {
+  const observations = [
+    ['1989-01-07T19:22Z', 0.00, lune.PHASE_NEW],
+    ['1989-01-14T13:58Z', 0.25, lune.PHASE_FIRST],
+    ['1989-01-21T21:33Z', 0.50, lune.PHASE_FULL],
+    ['1989-01-30T02:02Z', 0.75, lune.PHASE_LAST],
+    ['1989-02-06T07:37Z', 0.00, lune.PHASE_NEW],
+    ['1989-02-12T23:15Z', 0.25, lune.PHASE_FIRST],
+    ['1989-02-20T15:32Z', 0.50, lune.PHASE_FULL],
+    ['1989-02-28T20:08Z', 0.75, lune.PHASE_LAST],
+    ['1989-03-07T18:19Z', 0.00, lune.PHASE_NEW],
+    ['1989-03-14T10:11Z', 0.25, lune.PHASE_FIRST],
+    ['1989-03-22T09:58Z', 0.50, lune.PHASE_FULL],
+    ['1989-03-30T10:21Z', 0.75, lune.PHASE_LAST],
+    ['1989-04-06T03:33Z', 0.00, lune.PHASE_NEW],
+    ['1989-04-12T23:13Z', 0.25, lune.PHASE_FIRST],
+    ['1989-04-21T03:13Z', 0.50, lune.PHASE_FULL],
+    ['1989-04-28T20:46Z', 0.75, lune.PHASE_LAST],
+    ['1989-05-05T11:46Z', 0.00, lune.PHASE_NEW],
+    ['1989-05-12T14:19Z', 0.25, lune.PHASE_FIRST],
+    ['1989-05-20T18:16Z', 0.50, lune.PHASE_FULL],
+    ['1989-05-28T04:01Z', 0.75, lune.PHASE_LAST],
+    ['1989-06-03T19:53Z', 0.00, lune.PHASE_NEW],
+    ['1989-06-11T06:59Z', 0.25, lune.PHASE_FIRST],
+    ['1989-06-19T06:57Z', 0.50, lune.PHASE_FULL],
+    ['1989-06-26T09:09Z', 0.75, lune.PHASE_LAST],
+    ['1989-07-03T04:59Z', 0.00, lune.PHASE_NEW],
+    ['1989-07-11T00:19Z', 0.25, lune.PHASE_FIRST],
+    ['1989-07-18T17:42Z', 0.50, lune.PHASE_FULL],
+    ['1989-07-25T13:31Z', 0.75, lune.PHASE_LAST],
+    ['1989-08-01T16:06Z', 0.00, lune.PHASE_NEW],
+    ['1989-08-09T17:28Z', 0.25, lune.PHASE_FIRST],
+    ['1989-08-17T03:07Z', 0.50, lune.PHASE_FULL],
+    ['1989-08-23T18:40Z', 0.75, lune.PHASE_LAST],
+    ['1989-08-31T05:44Z', 0.00, lune.PHASE_NEW],
+    ['1989-09-08T09:49Z', 0.25, lune.PHASE_FIRST],
+    ['1989-09-15T11:51Z', 0.50, lune.PHASE_FULL],
+    ['1989-09-22T02:10Z', 0.75, lune.PHASE_LAST],
+    ['1989-09-29T21:47Z', 0.00, lune.PHASE_NEW]
+  ]
+
+  describe('#phase()', function () {
+    it('should return expected values for 2014-02-17', function () {
+      const phase = lune.phase(new Date('2014-02-17T00:00-0500'))
+
+      assert.closeTo(phase.phase, 0.568, 0.001)
+      assert.closeTo(phase.illuminated, 0.955, 0.001)
+      assert.closeTo(phase.age, 16.779, 0.030)
+      assert.closeTo(phase.sun_distance, 147822500, 149600)
+      assert.closeTo(phase.sun_angular_diameter, 0.5395, 0.0005)
+    })
+
+    // Astronomical Algorithms, 2nd ed., p. 347
+    it('should return expected values for 1992-04-12', function () {
+      const phase = lune.phase(new Date('1992-04-12'))
+
+      assert.closeTo(phase.illuminated, 0.6802, 0.0001)
+      assert.closeTo(phase.distance, 368405, 400)
+      assert.closeTo(phase.angular_diameter, 0.5405, 0.0005)
+    })
+
+    // Astronomical Algorithms, 2nd ed., p. 169
+    it('should return expected values for 1992-10-13', function () {
+      const phase = lune.phase(new Date('1992-10-13'))
+
+      assert.closeTo(phase.sun_distance, 149240000, 10000)
+    })
+
+    // http://bazaar.launchpad.net/~keturn/py-moon-phase/trunk/view/head:/moontest.py
+    it('should be accurate to astronomical observations', function () {
+      let error = 0
+      for (let obs of observations) {
+        let e = Math.abs(lune.phase(new Date(obs[0])).phase - obs[1])
+        if (e > 0.5) {
+          // phase is circular
+          e = 1 - e
+        }
+
+        error += e
+      }
+
+      // tolerate an average error of up to a tenth of a percent
+      assert.isAtMost(error / observations.length, 0.001)
+    })
+  })
+
+  describe('#phase_hunt', function () {
+    it('should handle timezones correctly', function () {
+      // 1415292777000 incorrect EST time
+      // 1415312577000 correct UTC time
+      // date conversion is now accurate to the millisecond, but these tests
+      // were written when they were only accurate to the second
+      assert.closeTo(
+        lune.phase_hunt(new Date('2014-11-01T06:26-0400')).full_date.getTime(),
+        1415312577000,
+        500
+      )
+    })
+  })
+
+  describe('#phase_range', function () {
+    const PHASES = [
+      lune.PHASE_NEW,
+      lune.PHASE_FIRST,
+      lune.PHASE_FULL,
+      lune.PHASE_LAST
+    ]
+
+    /* http://aa.usno.navy.mil/data/docs/JulianDate.php */
+    it('should return all moon phases within a time range', function () {
+      let error = 0
+
+      for (let phase of PHASES) {
+        const actual = lune.phase_range(
+          new Date('1989-01-01T00:00Z'),
+          new Date('1989-10-01T00:00Z'),
+          phase
+        )
+        const expected = observations.filter(function (obs) {
+          return obs[2] === phase
+        })
+        assert.strictEqual(actual.length, expected.length)
+
+        for (let i = 0; i < actual.length; i++) {
+          const date = actual[i]
+          const obs = new Date(expected[i][0])
+
+          error += Math.abs(date.getTime() - obs.getTime())
+        }
+      }
+
+      // tolerate an average error of up to five minutes
+      assert.isAtMost(error / observations.length, 300000)
+    })
+  })
+})
+
+describe('julian', function () {
+  describe('#fromDate', function () {
+    /* http://aa.usno.navy.mil/data/docs/JulianDate.php */
+    it('should convert 2000-01-01T00:00Z to 2451544.5', function () {
+      assert.closeTo(
+        julian.fromDate(new Date('2000-01-01T00:00Z')),
+        2451544.5,
+        0.5 / 86400
+      )
+    })
+  })
+
+  describe('#toDate', function () {
+    /* http://aa.usno.navy.mil/data/docs/JulianDate.php */
+    it('should convert 2457464.179862 to 2016-03-16T16:19Z', function () {
+      assert.closeTo(
+        julian.toDate(2457464.179862).getTime(),
+        (new Date('2016-03-16T16:19Z')).getTime(),
+        500
+      )
+    })
+  })
+})

+ 12 - 7
app/course/course.php

@@ -18,7 +18,7 @@ include "../pcdl/html_head.php";
 
 require_once "../path.php";
 require_once "../public/_pdo.php";
-require_once '../media/function.php';
+require_once '../ucenter/function.php';
 require_once '../public/function.php';
 
 global $PDO;
@@ -35,7 +35,10 @@ $course_info = $Fetch[0];
 echo "<div id='course_head_bar' style='background-color:var(--tool-bg-color1);padding:1em 10px 10px 10px;'>";
 echo "<div class='index_inner '>";
 echo "<div style='font-size:140%'>";
-echo $course_info["teacher"]." > ";
+echo "<a href='../uhome/course.php?userid={$course_info["teacher"]}'>";
+echo ucenter_getA($course_info["teacher"]);
+echo "</a>";
+echo " > ";
 echo $course_info["title"];
 echo "</div>";
 echo '<div class="summary"  style="padding-bottom:5px;">'.$course_info["subtitle"].'</div>';
@@ -70,14 +73,16 @@ echo '</div>';
         echo '<div style="flex:7;">';
         echo '<div class="pd-10">';
         echo '<div class="title" style="padding-bottom:5px;font-size:100%;font-weight:600;">'.$row["title"].'</div>';
-        echo '<div class="summary"  style="padding-bottom:5px;">'.$row["subtitle"].'</div>';
         echo '<div class="summary"  style="padding-bottom:5px;">'.$row["summary"].'</div>';
+        echo '<div class="summary"  style="padding-bottom:5px;">'.$row["live"].'</div>';
+        echo '<div class="summary"  style="padding-bottom:5px;">'.$row["replay"].'</div>';
+        echo '<div class="summary"  style="padding-bottom:5px;">'.$row["attachment"].'</div>';
         echo '</div>'; 
         echo '</div>';
 
         echo '<div style="flex:3;max-width:15em;">';
         echo '<div >开始:'.date("Y/m/d h:ia",$row["date"]/1000) .'</div>';
-        $dt = $row["duration"];
+        $dt = $row["duration"]/60;
         $sdt = "";
         if($dt>59){
             $sdt .= floor($dt/60)."小时";
@@ -93,12 +98,12 @@ echo '</div>';
             $lesson_time = "尚未开始";
         }
         else if($now>$row["date"] && $now<($row["date"]+$dt*1000)){
-            $lesson_time = "已经结束";
+            $lesson_time = "正在进行";
         }
         else{
-            $lesson_time = "正在进行";
+            $lesson_time = "已经结束";
         }
-        echo '<div ><span class="lesson_status">已经结束</span></div>';
+        echo '<div ><span class="lesson_status">'.$lesson_time.'</span></div>';
         echo '</div>';
 
         echo '</div>';

+ 9 - 1
app/course/course_list.php

@@ -6,9 +6,17 @@ require_once "../public/_pdo.php";
 require_once '../public/load_lang.php';
 require_once '../media/function.php';
 
+if(isset($_GET["teacher"])){
+    $teacher = " teacher = '".$_GET["teacher"]."'";
+}
+else{
+    $teacher = " 1= 1";
+}
+
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
-$query = "select * from course where 1  order by create_time DESC limit 0,100";
+
+$query = "select * from course where $teacher  order by create_time DESC limit 0,100";
 $Fetch = PDO_FetchAll($query);
 echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
 

+ 6 - 10
app/course/list_new.php

@@ -4,21 +4,13 @@
 require_once "../path.php";
 require_once "../public/_pdo.php";
 require_once '../public/load_lang.php';
-require_once '../media/function.php';
+require_once '../ucenter/function.php';
 
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
 $query = "select * from course where 1  order by create_time DESC limit 0,4";
 $Fetch = PDO_FetchAll($query);
 
-$coverList = array();
-foreach($Fetch as $row){
-    $coverList[] = $row["cover"];
-}
-$covers = media_get($coverList);
-foreach ($covers as $value) {
-    $cover["{$value["id"]}"] = $value["link"];
-}
 foreach($Fetch as $row){
     echo '<div class="content_block">';
     echo '<div class="card">';
@@ -26,7 +18,11 @@ foreach($Fetch as $row){
     echo '<div class="pd-10">';
     echo '<div class="title" style="padding-bottom:5px;font-size:110%;font-weight:600;"><a href="../course/course.php?id='.$row["id"].'">'.$row["title"].'</a></div>';
     echo '<div class="summary"  style="padding-bottom:5px;">'.$row["subtitle"].'</div>';
-    echo '<div class="author"  style="padding-bottom:5px;margin-bottom:0.4em;">主讲:'.$row["teacher"].'</div>';    
+    echo '<div class="author"  style="padding-bottom:5px;margin-bottom:0.4em;">主讲:';
+    echo '<a href="../uhome/course.php?userid='.$row['teacher'].'">';
+    echo ucenter_getA($row["teacher"]);
+    echo '</a>';
+    echo '</div>';    
     echo '<div class="summary"  style="padding-bottom:5px;">'.$row["summary"].'</div>';
     echo '</div>';
     echo '<div class="pd-10" style="display:flex;justify-content: space-between;">';

+ 0 - 12
app/course/my_course_list.php

@@ -52,17 +52,6 @@ foreach ($covers as $value) {
 foreach($Fetch as $row){
     echo '<div class="file_list_row">';
 
-    
-    $coverlink = $cover["{$row["cover"]}"];
-    echo '<div class="v-cover" style="flex:2;">';
-    if(substr($coverlink,0,6)=="media:"){
-        echo '<img src="'._DIR_USER_IMG_LINK_.'/'.substr($coverlink,6).'" width="100%" height="auto">';
-    }
-    else{
-        echo '<img src="'.$coverlink.'" width="50" height="50">';
-    }
-    echo '</div>';
-
     echo '<div class="pd-10" style="flex:8;padding:5px;">';
     echo '<div class="title" style="padding-bottom:5px;"><a href="../course/my_course_index.php?course='.$row["id"].'">'.$row["title"].'</a></div>';
     echo '<div class="summary"  style="padding-bottom:5px;">'.$row["subtitle"].'</div>';
@@ -70,7 +59,6 @@ foreach($Fetch as $row){
     echo '<div class="author"  style="padding-bottom:5px;">主讲:'.$row["teacher"].'</div>';
     echo '</div>';
     
-
     echo '</div>';
 }
 

+ 1 - 6
app/course/my_course_new.php

@@ -17,11 +17,6 @@ echo '</div>';
 <input type="hidden" name="op" value="insert" />
 
 <div id="userfilelist">
-    <div style="display:flex;">
-    <div style="flex:2;">封面</div>
-    <div style="flex:8;"></div>
-    <input type="hidden" name="cover" value="" />
-    </div>
 
     <div style="display:flex;">
     <div style="flex:2;">标题</div>
@@ -31,7 +26,7 @@ echo '</div>';
     </div>
     </div>
 
-    <div style="display:flex;">
+    <div style="display:none;">
     <div style="flex:2;">副标题</div>
     <div style="flex:8;">
         <div style="text-align: right;color:gray;">0/32</div>

+ 8 - 11
app/course/my_lesson_edit.php

@@ -68,11 +68,6 @@ echo '<form action="../course/my_course_index.php" onsubmit="return lesson_valid
 echo '<input type="hidden" name="lesson" value="'.$lesson_info["id"].'" />';
 echo '<input type="hidden" name="op" value="update" />';
 echo '<div id="userfilelist">';
-    echo '<div style="display:flex;">';
-    echo '<div style="flex:2;">'.'封面'.'</div>';
-    echo '<div id="img_cover" style="flex:8;">'.$cover_html.'</div>';
-    echo "<input id = 'cover_id' type='hidden' name = 'cover' value='{$lesson_info["cover"]}'>";
-    echo '</div>';
 
     echo '<div style="display:flex;">';
     echo '<div style="flex:2;">'.'标题'.'</div>';
@@ -88,17 +83,19 @@ echo '<div id="userfilelist">';
     echo '<div style="flex:8;"><input type="input" name = "subtitle" value="'.$lesson_info["subtitle"].'" /></div>';
     echo '</div>';
     $strDate = date("Y-m-d",$lesson_info["date"]/1000);
+    $strTime = date("H:i",$lesson_info["date"]/1000);
+    $strDuration = date("H:i",$lesson_info["duration"]);
     echo 'Date: <input type="date" name="lesson_date" value="'.$strDate.'"/>';
-    echo 'Time: <input type="time" name="lesson_time" />';
-    echo 'Duration: <input type="time" name="lesson_duration" />';
+    echo 'Time: <input type="time" name="lesson_time" value="'.$strTime.'"/>';
+    echo 'Duration: <input type="time" name="duration" value="'.$strDuration.'"/>';
 
     echo '<div style="display:flex;">';
-    echo '<div style="flex:2;">'.'直播链接'.'</div>';
-    echo '<div style="flex:8;"><textarea name="link" style="height:6em;">'.$lesson_info["link"].'</textarea></div>';
+    echo '<div style="flex:2;">'.'直播'.'</div>';
+    echo '<div style="flex:8;"><textarea name="live" style="height:6em;">'.$lesson_info["live"].'</textarea></div>';
     echo '</div>';
     echo '<div style="display:flex;">';
-    echo '<div style="flex:2;">'.'录播链接'.'</div>';
-    echo '<div style="flex:8;"><textarea name="link1" style="height:6em;">'.$lesson_info["link"].'</textarea></div>';
+    echo '<div style="flex:2;">'.'录播'.'</div>';
+    echo '<div style="flex:8;"><textarea name="replay" style="height:6em;">'.$lesson_info["replay"].'</textarea></div>';
     echo '</div>';
 
 

+ 8 - 3
app/course/my_lesson_insert.php

@@ -6,11 +6,16 @@ require_once '../public/function.php';
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
 
-$query = "INSERT INTO lesson (id, course_id, video, link, title,  subtitle, creator, tag, summary, status, cover, teacher, attachment , lang , speech_lang , create_time , modify_time , receive_time ) 
-                      VALUES (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )";
+$query = "INSERT INTO lesson (id, course_id,  live, replay, title,  subtitle ,  date ,  duration  ,  creator,  tag,  summary,  status,  cover,  teacher, attachment , lang , speech_lang , create_time , modify_time , receive_time ) 
+				 VALUES (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )";
+
 $sth = $PDO->prepare($query);
+$data = strtotime($_POST["lesson_date"]);
+$time = strtotime($_POST["lesson_time"]) - strtotime("today");
+$datatime = ($data+$time)*1000;
+$duration = strtotime($_POST["duration"]) - strtotime("today");
 
-$sth->execute(array(UUID::v4(), $_POST["course_id"] , $_POST["video"] , $_POST["link"] ,$_POST["title"] , $_POST["subtitle"]  , $_COOKIE["userid"] , $_POST["tag"] ,$_POST["summary"] , 1, $_POST["cover"] ,$_POST["teacher"] , $_POST["attachment"] , $_POST["lang"] , $_POST["speech_lang"] ,mTime() , mTime() ,  mTime() ));
+$sth->execute(array(UUID::v4(), $_POST["course_id"] , $_POST["live"] , $_POST["replay"] ,$_POST["title"] , $_POST["subtitle"]  , $datatime  , $duration  , $_COOKIE["userid"] , $_POST["tag"] ,$_POST["summary"] , 1, $_POST["cover"] ,$_POST["teacher"] , $_POST["attachment"] , $_POST["lang"] , $_POST["speech_lang"] ,mTime() , mTime() ,  mTime() ));
 $respond=array("status"=>0,"message"=>"");
 if (!$sth || ($sth && $sth->errorCode() != 0)) {
 	$error = PDO_ErrorInfo();

+ 15 - 9
app/course/my_lesson_new.php

@@ -31,10 +31,6 @@ echo '</div>';
 <input type="hidden" name="video" value="" />
 
 <div id="userfilelist">
-    <div style="display:flex;">
-    <div style="flex:2;">封面</div>
-    <div style="flex:8;"></div>
-    </div>
 
     <div style="display:flex;">
     <div style="flex:2;">标题</div>
@@ -44,7 +40,7 @@ echo '</div>';
     </div>
     </div>
 
-    <div style="display:flex;">
+    <div style="display:none;">
     <div style="flex:2;">副标题</div>
     <div style="flex:8;">
         <div style="text-align: right;color:gray;">0/32</div>
@@ -66,12 +62,20 @@ echo '</div>';
     </div> 
 
     <div style="display:flex;">
-    <div style="flex:2;">链接</div>
-    <div style="flex:8;"><textarea  style="height:6em;"></textarea></div>
+        <div style="flex:2;">直播信息</div>
+        <div style="flex:8;"><textarea  name="live"  style="height:6em;"></textarea></div>
     </div>
     <div style="display:flex;">
-    <div style="flex:2;">链接(中国大陆)</div>
-    <div style="flex:8;"><textarea style="height:6em;"></textarea></div>
+        <div style="flex:2;">课程时间</div>
+        <div style="flex:8;">
+    日期: <input type="date" name="lesson_date" value=""/>
+    时间: <input type="time" name="lesson_time" value="08:00"/>
+   课程持续时间: <input type="time" name="duration" value="01:00"/>
+        </div>
+    </div>
+    <div style="display:flex;">
+    <div style="flex:2;">录播信息</div>
+    <div style="flex:8;"><textarea name="replay" style="height:6em;"></textarea></div>
     </div>
 
     <div style="display:flex;">
@@ -82,6 +86,8 @@ echo '</div>';
     </div>
     </div> 
 
+
+
     <div style="display:flex;">
     <div style="flex:2;">标签</div>
     <div   style="flex:8;">

+ 11 - 3
app/course/my_lesson_update.php

@@ -6,10 +6,13 @@ require_once '../public/function.php';
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
 
-$query="UPDATE lesson SET title = ? , subtitle = ? , link = ? , summary = ? , teacher = ?  , receive_time= ?  , modify_time= ?   where  id = ?  ";
+$query="UPDATE lesson SET title = ? , subtitle = ? , date = ? , duration = ? , live = ? , replay = ? , summary = ? , teacher = ?  , receive_time= ?  , modify_time= ?   where  id = ?  ";
 $sth = $PDO->prepare($query);
-
-$sth->execute(array($_POST["title"] , $_POST["subtitle"] , $_POST["link"] , $_POST["summary"] ,  $_POST["teacher"] ,  mTime() , mTime() , $_POST["lesson"]));
+$data = strtotime($_POST["lesson_date"]);
+$time = strtotime($_POST["lesson_time"]) - strtotime("today");
+$datatime = ($data+$time)*1000;
+$duration = strtotime($_POST["duration"]) - strtotime("today");
+$sth->execute(array($_POST["title"] , $_POST["subtitle"] ,$datatime, $duration , $_POST["live"] , $_POST["replay"] , $_POST["summary"] ,  $_POST["teacher"] ,  mTime() , mTime() , $_POST["lesson"]));
 $respond=array("status"=>0,"message"=>"");
 if (!$sth || ($sth && $sth->errorCode() != 0)) {
 	$error = PDO_ErrorInfo();
@@ -21,6 +24,11 @@ else{
 	$respond['status']=0;
 	$respond['message']="成功";
 	echo "<div style=''>Lesson 数据修改成功</div>";
+	echo $d=strtotime("today");
+
+	echo  strtotime($_POST["lesson_date"])."<br>";
+	echo  strtotime($_POST["lesson_time"])."<br>";
+	echo  (strtotime($_POST["duration"]) - $d)."<br>";
 }
 //echo json_encode($respond, JSON_UNESCAPED_UNICODE);
 ?>

+ 2 - 2
app/course/teacher_list.php

@@ -4,7 +4,7 @@
 require_once "../path.php";
 require_once "../public/_pdo.php";
 require_once '../public/load_lang.php';
-require_once '../media/function.php';
+require_once '../ucenter/function.php';
 
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
@@ -14,7 +14,7 @@ $Fetch = PDO_FetchAll($query);
 foreach($Fetch as $value){
     echo '<div class="content_block">';
     echo '<div class="card pd-10">';
-    echo '<div class="title" style="padding-bottom:5px;font-size:110%;font-weight:600;"><a href="../course/course.php?id='.$row["id"].'">'.$value['teacher'].'</a></div>';
+    echo '<div class="title" style="padding-bottom:5px;font-size:110%;font-weight:600;"><a href="../uhome/course.php?userid='.$value['teacher'].'">'.ucenter_getA($value['teacher']).'</a></div>';
     
     $query = "select id, title  from course where teacher = '{$value['teacher']}'  order by create_time DESC limit 0,5";
     $FetchTeacher = PDO_FetchAll($query);

+ 5 - 4
app/dict/dict_lookup.php

@@ -187,13 +187,13 @@ switch($op){
 
 			}
 			echo "<div class='dict_word'>";
-			echo "<div class='dict'>社区字典</div><a name='net'></a>";
-			$dict_list_a[] = array("net","社区字典");
+			echo "<div class='dict'>{$_local->gui->com_dict}</div><a name='net'></a>";
+			$dict_list_a[] = array("net",$_local->gui->com_dict);
 
 			foreach($userdict as $key => $value){
 				echo "<div class='mean'>{$key}:{$value["mean"]}</div>";
 			}
-			echo "<div><span>贡献者:</span>";
+			echo "<div><span>{$_local->gui->contributor}:</span>";
 			foreach ($userlist as $key => $value) {
 				echo $key."[".$value."]";
 			}
@@ -358,7 +358,8 @@ switch($op){
 		echo "<div id='dictlist'>";
 		foreach($dict_list_a as $x_value) {
 			if(substr($x_value[0],0,4)=="word"){
-				echo "<div style='font-size:120%;font-weight:700;margin-top:15px;'><a href='#{$x_value[0]}'>$x_value[1]</a></div>";
+				echo "<div style='font-size:120%;font-weight:700;margin-top:15px;'>";
+				echo "<a href='#{$x_value[0]}'>$x_value[1]</a></div>";
 			}
 			else{
 				echo "<div><a href='#{$x_value[0]}'>$x_value[1]</a></div>";

+ 4 - 4
app/lang/lang.php

@@ -1,14 +1,14 @@
 	<!--显示模式-->
 	<script>
-		var g_langrage="en";
+		var g_language="en";
 		var g_currLink="";
 		function lang_init(strPage){
 			g_currLink = strPage;
 		}
 		function setLang(strLang){
-			g_langrage=strLang;
-			setCookie('language',g_langrage,365);
-			window.location.assign(location.pathname+"?language="+g_langrage);
+			g_language=strLang;
+			setCookie('language',g_language,365);
+			window.location.assign(location.pathname+"?language="+g_language);
 		}
 	</script>
 	<style>

+ 60 - 37
app/palicanon/index.php

@@ -14,14 +14,14 @@ include "../pcdl/html_head.php";
     }
     #main_tag span{
         margin: 2px;
-    padding: 2px 12px;
-    font-weight: 500;
-    transition-duration: 0.2s;
-    cursor: pointer;
-    display: inline-flex;
-    align-items: center;
-    flex-wrap: nowrap;
-    justify-content: center;
+        padding: 2px 12px;
+        font-weight: 500;
+        transition-duration: 0.2s;
+        cursor: pointer;
+        display: inline-flex;
+        align-items: center;
+        flex-wrap: nowrap;
+        justify-content: center;
         font-size:110%;
         border: unset;
         border-radius: 0;
@@ -47,7 +47,11 @@ include "../pcdl/html_head.php";
     tag .icon:hover{
         background-color: silver;
     }
+    var tag_level = <?php echo file_get_contents("../public/book_tag/tag_list.json"); ?>;
 </style>
+<script>
+    var tag_level = <?php echo file_get_contents("../public/book_tag/tag_list.json"); ?>;
+</script>
 <?php
 //
 
@@ -56,8 +60,6 @@ require_once "../public/_pdo.php";
 require_once '../media/function.php';
 require_once '../public/function.php';
 
-
-
 echo "<div id='course_head_bar' style='background-color:var(--tool-bg-color1);padding:1em 10px 10px 10px;'>";
 echo "<div class='index_inner '>";
 echo "<div style='font-size:140%'>";
@@ -71,8 +73,15 @@ echo '<span tag="aṭṭhakathā">Aṭṭhakathā</span>';
 echo '<span tag="ṭīkā">ṭīkā</span>';
 echo '<span tag="añña">añña</span>';
 echo '</div>';
-echo '<div id="tag_selected" class="summary"  style="padding-bottom:5px;margin:0.5em 0;"></div>';
-echo '<div id="tag_others" class="summary"  style="padding-bottom:5px;"></div>';
+echo '<div id="tag_selected" class=""  style="padding-bottom:5px;margin:0.5em 0;"></div>';
+echo '<div level="0" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="1" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="2" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="3" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="4" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="5" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="100" class="tag_others"  style="padding-bottom:5px;"></div>';
+echo '<div level="8" class="tag_others"  style="padding-bottom:5px;"></div>';
 echo "</div>";
 echo '</div>';
 ?>
@@ -83,7 +92,7 @@ echo '</div>';
 <script>
     var main_tag="";
     var list_tag=new Array();
-    
+    var currTagLevel0= new Array();
 
     $("span[tag]").click(function(){
         $(this).siblings().removeClass("select");
@@ -92,18 +101,6 @@ echo '</div>';
         list_tag=new Array();
         tag_changed();
         render_tag_list();
-        /*
-        const tagSelected = document.getElementsByClassName("select");
-        if(tagSelected){
-            let tagList = new Array();
-            for (const iterator of tagSelected) {
-                tagList.push(iterator.getAttributeNode("tag").value);
-            }
-            main_tag = tagList[0];
-
-            tag_changed();
-        }
-        */
   });
   var allTags = new Array();
   function tag_changed(){
@@ -124,13 +121,7 @@ echo '</div>';
                 let html="";
                 allTags = new Array();
                 for (const iterator of arrBookList) {
-                    html += "<div style='width:25%;padding:0.5em;'>";
-                    html += "<div class='card' style='padding:10px;'>";
-                    html += "<div style='font-weight:700'><a href='../pcdl/reader.php?view=chapter&book="+iterator[0].book+"&para="+iterator[0].para+"' target = '_blank'>"+iterator[0].title+"</a></div>";
-                    html += "<div style=''>book:"+iterator[0].book+" para:"+iterator[0].para+"</div>";
-                    html += "<div style='overflow-wrap: anywhere;'>tag="+ iterator[0].tag+"</div>";
-                    html += "</div>";
-                    html += "</div>";
+                    let tag0="";
                     let tags = iterator[0].tag.split("::");
                     let currTag = new Array();
                     currTag[main_tag] = 1;
@@ -144,7 +135,9 @@ echo '</div>';
                         if(tag.slice(-1)==":"){
                             tag = tag.slice(0,-1);
                         }
-
+                        if(currTagLevel0.hasOwnProperty(tag)){
+                            tag0 = tag;
+                        }
                         if(!currTag.hasOwnProperty(tag)){
                             if(allTags.hasOwnProperty(tag) ){
                                 allTags[tag] += 1;
@@ -154,7 +147,26 @@ echo '</div>';
                             } 
                         }
                     }
+
+                    html += "<div style='width:25%;padding:0.5em;'>";
+                    html += "<div class='card' style='padding:10px;'>";
+                    html += "<div class='' style='position: absolute;background-color: #862002;margin-top: -10px;margin-left: 12em;color: white;padding: 0 3px;display: inline-block;'>"+tag0+"</div>";
+                    html += "<div style='font-weight:700'><a href='../pcdl/reader.php?view=chapter&book="+iterator[0].book+"&para="+iterator[0].para+"' target = '_blank'>"+iterator[0].title+"</a></div>";
+                    html += "<div style=''>book:"+iterator[0].book+" para:"+iterator[0].para+"</div>";
+                    html += "<div style='overflow-wrap: anywhere;'>tag="+ iterator[0].tag+"</div>";
+                    html += "</div>";
+                    html += "</div>";
+
+                }
+
+                let newTags = new Array();
+                for (const oneTag in allTags) {
+                    if(allTags[oneTag]<arrBookList.length){
+                        newTags[oneTag] = allTags[oneTag];
+                    }
+                    
                 }
+                allTags = newTags;
                 allTags.sort(sortNumber);
                 tag_render_others();
                 $("#book_list").html(html);
@@ -165,24 +177,35 @@ echo '</div>';
 $("#tag_input").keypress(function(){
     tag_render_others();
 });
+
   function tag_render_others(){
     let strOthersTag = "";
+    currTagLevel0= new Array();
+    $(".tag_others").html("");
     for (const key in allTags) {
         if (allTags.hasOwnProperty(key)) {
             if($("#tag_input").val().length>0){
                 if(key.indexOf($("#tag_input").val())>=0){
-                    strOthersTag += "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
+                    strOthersTag = "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
                 }
             }
             else{
-                strOthersTag += "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
+                strOthersTag = "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
+            }
+            let thisLevel = 100;
+            if(tag_level.hasOwnProperty(key)){
+                thisLevel = tag_level[key].level;
+                if(tag_level[key].level==0){
+                    currTagLevel0[key] = 1;
+                }
             }
-            
+            $(".tag_others[level='"+thisLevel+"']").html($(".tag_others[level='"+thisLevel+"']").html()+strOthersTag);
         }
     }
-    $("#tag_others").html(strOthersTag);
+   
 
   }
+
   function tag_click(tag){
     list_tag.push(tag);
     render_tag_list();

+ 4 - 4
app/pcdl/classroom.php

@@ -98,11 +98,11 @@ else{
 		}
 
 
-			var g_langrage="en";
+			var g_language="en";
 			function menuLangrage(obj){
-				g_langrage=obj.value;
-				setCookie('language',g_langrage,365);
-				window.location.assign("index_pc.php?language="+g_langrage);
+				g_language=obj.value;
+				setCookie('language',g_language,365);
+				window.location.assign("index_pc.php?language="+g_language);
 			}
 
 	</script>

+ 1 - 1
app/pcdl/html_head.php

@@ -30,7 +30,7 @@ else{
     <link type="text/css" rel="stylesheet" href="../pcdl/css/style_mobile.css" media="screen and (max-width:767px)">
 
 
-    <title>圣典</title>
+    <title>wikipāḷi</title>
 
 	<script src="../public/js/jquery.js"></script>
 	<script src="../public/js/comm.js"></script>

+ 4 - 4
app/pcdl/index1.php

@@ -102,11 +102,11 @@ else{
 		}
 
 
-			var g_langrage="en";
+			var g_language="en";
 			function menuLangrage(obj){
-				g_langrage=obj.value;
-				setCookie('language',g_langrage,365);
-				window.location.assign("index_pc.php?language="+g_langrage);
+				g_language=obj.value;
+				setCookie('language',g_language,365);
+				window.location.assign("index_pc.php?language="+g_language);
 			}
 
 	</script>

+ 4 - 4
app/pcdl/reader.php

@@ -166,7 +166,8 @@ para:hover{
 }
 .sent_toc{
 	font-weight:700;
-	font-size:120%;
+	font-family: Noto serif;
+    font-size: 150%;
 }
 </style>
 		<!-- tool bar begin-->
@@ -356,6 +357,7 @@ else{
 			$toc2Level = 0;
 			echo "<div><div>";
 			foreach ($chapter_toc as $key => $value) {
+				$tocList[$value["paragraph"]] = $value["level"];
 				$classCurrToc="";
 				$classCurrToc2 = "";
 				$classCurrTocTitle2="";
@@ -412,7 +414,7 @@ else{
 				//右侧目录
 				
 				if($value["paragraph"]>$currParaBegin && $value["paragraph"]<$currParaEnd){
-					$tocList[$value["paragraph"]] = $value["level"];
+					//$tocList[$value["paragraph"]] = $value["level"];
 					$htmlToc2 .= "<div><a href='#para_{$value["paragraph"]}'>{$value["toc"]}</a></div>";
 				}
 				
@@ -556,8 +558,6 @@ else{
 		break;
 	}
 	echo "</div>";
-
-
 	//生成一个段落空壳 等会儿查询数据,按照不同数据类型填充进去
 	PDO_Connect("sqlite:"._FILE_DB_PALI_SENTENCE_);
 

+ 4 - 4
app/pcdl/uhome.php

@@ -94,11 +94,11 @@ else{
 			}
 		}
 		
-			var g_langrage="en";
+			var g_language="en";
 			function menuLangrage(obj){
-				g_langrage=obj.value;
-				setCookie('language',g_langrage,365);
-				window.location.assign("index.php?language="+g_langrage);
+				g_language=obj.value;
+				setCookie('language',g_language,365);
+				window.location.assign("index.php?language="+g_language);
 			}
 		function indexInit(){
 			showUserFilaList();

Разница между файлами не показана из-за своего большого размера
+ 139 - 139
app/public/book_tag/en.json


+ 20 - 0
app/public/book_tag/tag_list.json

@@ -0,0 +1,20 @@
+{
+  "sutta": { "level": 0 },
+  "vinaya": { "level": 0 },
+  "abhidhamma": { "level": 0 },
+  "mūla": { "level": 0 },
+  "aṭṭhakathā": { "level": 0 },
+  "ṭīkā": { "level": 0 },
+  "añña": { "level": 0 },
+  "dīgha": { "level": 1 },
+  "majjhima": { "level": 1 },
+  "saṃyutta": { "level": 1 },
+  "aṅguttara": { "level": 1 },
+  "khuddaka": { "level": 1 },
+  "mahāvibhaṅga": { "level": 1 },
+  "Bhikkhunīvibhaṅga": { "level": 1 },
+  "mahāvaggapāḷi": { "level": 1 },
+  "Cūḷavaggapāḷi": { "level": 1 },
+  "vibhaṅga": { "level": 1 },
+  "Theragāthā": { "level": 2 }
+}

+ 4 - 0
app/public/lang/default.json

@@ -471,6 +471,10 @@
 		"end_of_text": "No Prev",
 		"begin_of_text": "No Next",
 		"chapter_select": "Please choose a chapter in the left sidebar",
+		"kala_pakkha": "kāḷapakkha",
+		"sukka_pakkha": "sukkapakkha",
+		"com_dict": "community dictionary",
+		"contributor": "contributor",
 		"": ""
 	},
 	"grammastr": [

+ 4 - 0
app/public/lang/en.json

@@ -470,6 +470,10 @@
 		"end_of_text": "No Prev",
 		"begin_of_text": "No Next",
 		"chapter_select": "Please choose a chapter in the left sidebar",
+		"kala_pakkha": "waning",
+		"sukka_pakkha": "waxing",
+		"com_dict": "Community Dictionary",
+		"contributor": "contributor",
 		"": ""
 	},
 	"grammastr": [

+ 4 - 0
app/public/lang/my.json

@@ -470,6 +470,10 @@
 		"end_of_text": "No Prev",
 		"begin_of_text": "No Next",
 		"chapter_select": "Please choose a chapter in the left sidebar",
+		"kala_pakkha": "ကာဠပက္ခ",
+		"sukka_pakkha": "သုက္ကပက္ခ",
+		"com_dict": "Community Dictionary",
+		"contributor": "contributor",
 		"": "",
 		"": ""
 	},

+ 4 - 0
app/public/lang/si.json

@@ -475,6 +475,10 @@
 		"end_of_text": "No Prev",
 		"begin_of_text": "No Next",
 		"chapter_select": "Please choose a chapter in the left sidebar",
+		"kala_pakkha": "කාළපක‍්ඛ",
+		"sukka_pakkha": "සුක‍්කපක‍්ඛ",
+		"com_dict": "Community Dictionary",
+		"contributor": "contributor",
 		"": "",
 		"": ""
 	},

+ 4 - 2
app/public/lang/zh-cn.json

@@ -472,8 +472,10 @@
 		"end_of_text": "到底啦",
 		"begin_of_text": "到顶啦",
 		"chapter_select": "请在左侧边栏中选择章节",
-		"kala_pakkha": "渐凹半月",
-		"sukka_pakkha": "渐凸半月",
+		"kala_pakkha": "渐亏半月",
+		"sukka_pakkha": "渐盈半月",
+		"com_dict": "社区字典",
+		"contributor": "贡献者",
 		"": ""
 	},
 	"grammastr": [

+ 4 - 0
app/public/lang/zh-tw.json

@@ -472,6 +472,10 @@
 		"end_of_text": "到底啦",
 		"begin_of_text": "到頂啦",
 		"chapter_select": "請在左側邊欄中選擇章節",
+		"kala_pakkha": "漸虧半月",
+		"sukka_pakkha": "漸盈半月",
+		"com_dict": "社羣字典",
+		"contributor": "貢獻者",
 		"": ""
 	},
 	"grammastr": [

+ 4 - 4
app/studio/buddhist_calendar.php

@@ -153,7 +153,7 @@ $month=$_GET['m']?$_GET['m']:date('m');
 		}
 
 
-			var g_langrage="en";
+			var g_language="en";
 
 var pali_num_str=[
 { "id":"1" , "value":"eka" },
@@ -674,9 +674,9 @@ function set_time_string(date_obj){
 	return(hh+":"+mm+":"+ss)
 }
 function menuLangrage(obj,year,month){
-	g_langrage=obj.value;
-	setCookie('language',g_langrage,365);
-	window.location.assign("buddhist_calendar.php?language="+g_langrage+"&y="+year+"&m="+month);
+	g_language=obj.value;
+	setCookie('language',g_language,365);
+	window.location.assign("buddhist_calendar.php?language="+g_language+"&y="+year+"&m="+month);
 }
 set_uposatha_day();
 set_cur_day_era();

+ 7 - 1
app/studio/css/style.css

@@ -2022,6 +2022,7 @@ border: 1px solid #DCDCDC;
     margin: 2px 5px 2px 1em;
     padding: 2px;
     clear: left;
+    /*max-height: 30vh;*/
 }
 .wnotediv p {
     margin: 5px 2px;
@@ -3731,9 +3732,13 @@ border-bottom: 2px solid red;
     flex: 7;
     display: flex;
     flex-wrap: wrap;
+    /*overflow-y: auto;
+    max-height: 35vh;*/
 }
 .translate_sent{
     flex: 3;
+    /*overflow-y: auto;
+    max-height: 35vh;*/
     display:none;
 }
 
@@ -4118,9 +4123,10 @@ text-align: center;
 
 .sent_wbw_trans_bar{
     position: absolute;
-    background-color: silver;
     padding: 0 3px;
     margin-top: -23px;
+    width: 92%;
+    display: flex;
 }
 
 .tran_sent_inner{

+ 4 - 4
app/studio/filenew.php

@@ -78,11 +78,11 @@ else{$currDevice="computer";}
 			g_is_mobile=false;
 		}
 			
-			var g_langrage="en";
+			var g_language="en";
 			function menuLangrage(obj){
-				g_langrage=obj.value;
-				setCookie('language',g_langrage,365);
-				window.location.assign("filenew.php?language="+g_langrage);
+				g_language=obj.value;
+				setCookie('language',g_language,365);
+				window.location.assign("filenew.php?language="+g_language);
 			}
 
 	</script>

+ 127 - 6
app/studio/index.php

@@ -67,11 +67,11 @@ else{
 			g_is_mobile=false;
 		}
 
-		var g_langrage="en";
+		var g_language="en";
 		function menuLangrage(obj){
-			g_langrage=obj.value;
-			setCookie('language',g_langrage,365);
-			window.location.assign("index.php?language="+g_langrage);
+			g_language=obj.value;
+			setCookie('language',g_language,365);
+			window.location.assign("index.php?language="+g_language);
 		}
 	
 	var gCurrPage="index";
@@ -187,7 +187,6 @@ else{
 
             .help_div{
                 margin-bottom: 2em;
-                width: 28em;
             }
             .htlp_title{
                 font-size:140%;
@@ -385,6 +384,11 @@ else{
 		</div>
 	</div>       
 
+	<script src="../public/js/highcharts/highcharts.js"></script>
+	<script src="../public/js/highcharts/modules/exporting.js"></script>
+	<script src="../public/js/highcharts/modules/data.js"></script>
+	<script src="../public/js/highcharts/modules/series-label.js"></script>
+	<script src="../public/js/highcharts/modules/oldie.js"></script>
 
 	<div class="help_div">
 		<div  class="htlp_title">
@@ -393,12 +397,17 @@ else{
 		<div>
 			<div class="help_fun_block">
 				<div class="title" ><?php echo $_local->gui->studio;?></div>
-				<ul class="help_fun_block_link_list">
+				<div style="display:flex;">
+				<ul class="help_fun_block_link_list" style="flex:3;">
 					<li style="display:block;">已发表的文集:2</li>
 					<li style="display:block;">已发表的文章:12</li>
 					<li style="display:block;"><?php echo $_local->gui->my_document;?>:234</li>
 					<li style="display:block;"><?php echo $_local->gui->encyclopedia;?>:245</li>
+					<li style="display:block;"><?php echo $_local->gui->userdict;?>:245</li>
 				</ul>
+				<div id="container" style="height:250px;flex:7;">
+				</div>
+				</div>
 			</div>
 			<div class="help_fun_block">
 				<div class="title" ><?php echo $_local->gui->library;?></div>
@@ -478,6 +487,118 @@ else{
 file_list();
 </script>
 		
+<script>
+/*
+		$.get('../uwbw/update_analytics.php', function (csvStr) {
+			csvStr = csvStr.replace(/\n\n/g, '\n');
+			Highcharts.chart('container', {
+
+			chart: {
+				scrollablePlotArea: {
+					minWidth: 400
+				}
+			},
+
+			data: {
+				//csvURL: 'https://cdn.jsdelivr.net/gh/highcharts/highcharts@v7.0.0/samples/data/analytics.csv',
+				csv: csvStr
+			},
+
+			title: {
+				text: '逐词解析'
+			},
+
+			subtitle: {
+				text: ''
+			},
+
+			xAxis: {
+				tickInterval: 7 * 24 * 3600 * 1000, // one week
+				tickWidth: 0,
+				gridLineWidth: 1,
+				labels: {
+					align: 'left',
+					x: 3,
+					y: -3
+				}
+			},
+
+			yAxis: [{ // left y axis
+				title: {
+					text: null
+				},
+				labels: {
+					align: 'left',
+					x: 3,
+					y: 16,
+					format: '{value:.,0f}'
+				},
+				showFirstLabel: false
+			}, { // right y axis
+				linkedTo: 0,
+				gridLineWidth: 0,
+				opposite: true,
+				title: {
+					text: null
+				},
+				labels: {
+					align: 'right',
+					x: -3,
+					y: 16,
+					format: '{value:.,0f}'
+				},
+				showFirstLabel: false
+			}],
+
+			legend: {
+				align: 'left',
+				verticalAlign: 'top',
+				borderWidth: 0
+			},
+
+			tooltip: {
+				shared: true,
+				crosshairs: true
+			},
+
+			plotOptions: {
+				series: {
+					cursor: 'pointer',
+					point: {
+						events: {
+							click: function (e) {
+								hs.htmlExpand(null, {
+									pageOrigin: {
+										x: e.pageX || e.clientX,
+										y: e.pageY || e.clientY
+									},
+									headingText: this.series.name,
+									maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x) + ':<br/> ' +
+										this.y + ' sessions',
+									width: 200
+								});
+							}
+						}
+					},
+					marker: {
+						lineWidth: 1
+					}
+				}
+			},
+
+			series: [{
+				name: 'All sessions',
+				lineWidth: 4,
+				marker: {
+					radius: 4
+				}
+			}, {
+				name: 'New users'
+			}]
+			});
+		});
+		*/
+        </script>
 	</div>
 	
 	<div class="foot_div">

+ 4 - 4
app/studio/index_head.php

@@ -30,11 +30,11 @@ require_once '../public/load_lang.php';
 	<script type="text/javascript">
 	<?php require_once '../public/load_lang_js.php';//加载js语言包?>
 		
-		var g_langrage="en";
+		var g_language="en";
 		function menuLangrage(obj){
-			g_langrage=obj.value;
-			setCookie('language',g_langrage,365);
-			window.location.assign("index.php?language="+g_langrage);
+			g_language=obj.value;
+			setCookie('language',g_language,365);
+			window.location.assign("index.php?language="+g_language);
 		}
 	
 	</script>

+ 4 - 4
app/studio/index_new.php

@@ -58,11 +58,11 @@ else{
 		}
 
 
-			var g_langrage="en";
+			var g_language="en";
 			function menuLangrage(obj){
-				g_langrage=obj.value;
-				setCookie('language',g_langrage,365);
-				window.location.assign("index_new.php?language="+g_langrage);
+				g_language=obj.value;
+				setCookie('language',g_language,365);
+				window.location.assign("index_new.php?language="+g_language);
 			}
 
 	</script>

+ 1 - 1
app/studio/js/common.js

@@ -1,5 +1,5 @@
 var g_is_mobile = false;
-var g_langrage = "langrage_cn";
+var g_language = "langrage_cn";
 
 var gConfigDirMydocument = "../user/My Document/";
 

+ 1 - 1
app/studio/js/message.js

@@ -889,7 +889,7 @@ function show_tran_net(book, para, begin, end) {
           "<div class='trans_text_info'>" +
           "<span><span class='author'>" +
           iterator.author +
-          "</span><span class='tag'>笔记</span></span>" +
+          "</span><span class='tag'>tag</span></span>" +
           "<span class='tools'>" +
           "<button>采纳</button>" +
           "</span>" +

+ 40 - 40
app/studio/js/render.js

@@ -429,7 +429,7 @@ function updataHeadingBlockInHtml(book, par) {
   }
 }
 
-function renderBlock() {}
+function renderBlock() { }
 /*
 重绘翻译数据块
 */
@@ -634,7 +634,7 @@ function renderTranslateParBlockInner(elementBlock) {
   return output;
 }
 
-function renderTranslateParBlockInnerPreview(strText) {}
+function renderTranslateParBlockInnerPreview(strText) { }
 function updateTranslationPreview_a(blockId, text) {
   var out = "";
   var newText = text;
@@ -1302,13 +1302,13 @@ function render_sent_tool_bar(elementBlock, begin) {
       iEnd;
   }
   output +=
-    "<span>" +
+    "<span style='flex: 7;'><span style='background-color: silver;>" +
     sentIdString +
     "<a onclick=\"copy_to_clipboard('" +
     sentIdStringLink +
     "')\">[";
   output += gLocal.gui.copy_to_clipboard;
-  output += "]</a></span>";
+  output += "]</a>";
   //	output += "<span>"+abook+"-"+aparagraph+"-"+iBegin+"-"+iEnd+"</span>";
   if (_display_sbs == 0) {
     //逐段模式
@@ -1333,7 +1333,8 @@ function render_sent_tool_bar(elementBlock, begin) {
   }
   output += "[" + gLocal.gui.scan_in_reader + "]";
   output += "</a>";
-  output += "<guide gid='sent_func' style='margin:unset;'></guide>";
+  output += "<guide gid='sent_func' style='margin:unset;'></guide></span></span>";
+  output += "<span style='flex: 3;'><guide gid='sent_trans' style='margin:unset;'></guide></span>";
   output += "</div>";
   return output;
 }
@@ -1517,7 +1518,6 @@ function renderWordParBlockInner(elementBlock) {
         output += "<div id='sent_div_" + wID + "' class='translate_sent'>";
         output += "<div class='translate_sent_head'>";
         output += "<div class='translate_sent_head_toolbar'>";
-        output += "<guide gid='sent_trans' style='margin:unset;'></guide>";
         output += "<span></span>";
         output +=
           "<span onclick=\"show_tran_net('" +
@@ -1612,13 +1612,13 @@ function renderWordParBlockInner(elementBlock) {
           book + "-" + paragraph + "-" + nextBegin + "-" + nextEnd;
         let sentIdStringLink = "{{" + sentIdString + "}}";
         output +=
-          "<span>" +
+          "<span style='flex: 7;'><span style='background-color: silver;'>" +
           sentIdString +
           "<a onclick=\"copy_to_clipboard('" +
           sentIdStringLink +
           "')\">[";
         output += gLocal.gui.copy_to_clipboard;
-        output += "]</a></span>";
+        output += "]</a>";
         output +=
           "<a href='../pcdl/reader.php?view=sent&book=" +
           book +
@@ -1631,7 +1631,8 @@ function renderWordParBlockInner(elementBlock) {
           "' target='_blank'>";
         output += "[" + gLocal.gui.scan_in_reader + "]";
         output += "</a>";
-        output += "<guide gid='sent_func' style='margin:unset;'></guide>";
+        output += "<guide gid='sent_func' style='margin:unset;'></guide></span></span>";
+        output += "<span style='flex: 3;'><guide gid='sent_trans' style='margin:unset;'></guide></span>";
         output += "</div>";
 
         output += "<div class='sent_wbw'>";
@@ -1649,7 +1650,6 @@ function renderWordParBlockInner(elementBlock) {
   output += "<div id='sent_div_" + wID + "' class='translate_sent'>";
   output += "<div class='translate_sent_head'>";
   output += "<div class='translate_sent_head_toolbar'>";
-  output += "<guide gid='sent_trans' style='margin:unset;'></guide>";
   output += "<span></span>";
   output +=
     "<span onclick=\"show_tran_net('" +
@@ -2472,12 +2472,12 @@ function renderWordDetailByElement(xmlElement) {
             ) {
               arrMeaning.push(
                 g_DictWordList[iDict].dictID +
-                  "$" +
-                  arrMeaning.length +
-                  "$$" +
-                  arrMean[i] +
-                  "$" +
-                  g_DictWordList[iDict].Language
+                "$" +
+                arrMeaning.length +
+                "$$" +
+                arrMean[i] +
+                "$" +
+                g_DictWordList[iDict].Language
               );
             }
           }
@@ -2527,12 +2527,12 @@ function renderWordDetailByElement(xmlElement) {
               ) {
                 arrMeaning.push(
                   g_DictWordList[iDict].dictID +
-                    "$" +
-                    arrMeaning.length +
-                    "$*$" +
-                    getLocalParentFormulaStr(wordGramma0, arrMean[i]) +
-                    "$" +
-                    g_DictWordList[iDict].Language
+                  "$" +
+                  arrMeaning.length +
+                  "$*$" +
+                  getLocalParentFormulaStr(wordGramma0, arrMean[i]) +
+                  "$" +
+                  g_DictWordList[iDict].Language
                 );
               }
             }
@@ -2582,12 +2582,12 @@ function renderWordDetailByElement(xmlElement) {
               ) {
                 arrMeaning.push(
                   g_DictWordList[iDict].dictID +
-                    "$" +
-                    arrMeaning.length +
-                    "$**$" +
-                    getLocalParentFormulaStr(wordGramma1, arrMean[i]) +
-                    "$" +
-                    g_DictWordList[iDict].Language
+                  "$" +
+                  arrMeaning.length +
+                  "$**$" +
+                  getLocalParentFormulaStr(wordGramma1, arrMean[i]) +
+                  "$" +
+                  g_DictWordList[iDict].Language
                 );
               }
             }
@@ -3062,7 +3062,7 @@ function renderWordDetailByElement(xmlElement) {
   return _txtOutDetail;
 }
 
-function renderWordNoteDivByParaNo(book, paragraph) {}
+function renderWordNoteDivByParaNo(book, paragraph) { }
 /*
 paragraph word note
 */
@@ -3261,7 +3261,7 @@ function updateWordNote(element) {
   }
 }
 
-function updateWordCommentary(element) {}
+function updateWordCommentary(element) { }
 
 //根据xmlDocument 对象中的单词序号修改单词块的显示(不含Pali)
 //返回 无
@@ -3384,13 +3384,13 @@ function prev_page() {
   gVisibleParEndOld = gVisibleParEnd;
   if (
     g_allparlen_array[gVisibleParEnd - 1] -
-      g_allparlen_array[gVisibleParBegin - 1] <=
+    g_allparlen_array[gVisibleParBegin - 1] <=
     gDisplayCapacity
   ) {
     gVisibleParBegin -= 1;
   } else if (
     g_allparlen_array[gVisibleParEnd + 1] -
-      g_allparlen_array[gVisibleParBegin - 1] >
+    g_allparlen_array[gVisibleParBegin - 1] >
     gDisplayCapacity
   ) {
     gVisibleParBegin -= 1;
@@ -3417,13 +3417,13 @@ function next_page() {
 
   if (
     g_allparlen_array[gVisibleParEnd + 1] -
-      g_allparlen_array[gVisibleParBegin + 1] <=
+    g_allparlen_array[gVisibleParBegin + 1] <=
     gDisplayCapacity
   ) {
     gVisibleParEnd += 1;
   } else if (
     g_allparlen_array[gVisibleParEnd + 1] -
-      g_allparlen_array[gVisibleParBegin + 1] >
+    g_allparlen_array[gVisibleParBegin + 1] >
     gDisplayCapacity
   ) {
     gVisibleParBegin += 1;
@@ -3860,12 +3860,12 @@ function refreshNoteNumber() {
     let id = $(this).attr("wid");
     $(this).html(
       "<a href='#word_note_root_" +
-        id +
-        "' name=\"word_note_" +
-        id +
-        '">[' +
-        (index + 1) +
-        "]</a>"
+      id +
+      "' name=\"word_note_" +
+      id +
+      '">[' +
+      (index + 1) +
+      "]</a>"
     );
   });
 

+ 1 - 1
app/studio/js/vn.js

@@ -1,5 +1,5 @@
 var g_is_mobile=false;
-var g_langrage="langrage_cn";
+var g_language="langrage_cn";
 //输出调试信息
 function debugOutput(str,level){
 str = "<p>"+str+"</p>";

+ 1 - 1
app/studio/project.php

@@ -183,7 +183,7 @@ switch($op){
 							$strXml.="<style>{$result["style"]}</style>";
 							$strXml.="<status>0</status>";
 							$strXml.="</word>";
-							$wbw_data[] = array(UUID::v4(),$block_id,$book,$iPar,$result["wid"],$result["real"],$strXml,time(),time(),1,$USER_NAME);
+							$wbw_data[] = array(UUID::v4(),$block_id,$book,$iPar,$result["wid"],$result["real"],$strXml,mTime(),mTime(),1,$USER_NAME);
 						}
 							
 						}

+ 4 - 4
app/studio/recycle.php

@@ -66,11 +66,11 @@ else{
 			g_is_mobile=false;
 		}
 
-		var g_langrage="en";
+		var g_language="en";
 		function menuLangrage(obj){
-			g_langrage=obj.value;
-			setCookie('language',g_langrage,365);
-			window.location.assign("index.php?language="+g_langrage);
+			g_language=obj.value;
+			setCookie('language',g_language,365);
+			window.location.assign("index.php?language="+g_language);
 		}
 
 	var gCurrPage="recycle_bin";

+ 4 - 4
app/studio/search.php

@@ -99,11 +99,11 @@ else{
 		}
 
 
-			var g_langrage="en";
+			var g_language="en";
 			function menuLangrage(obj){
-				g_langrage=obj.value;
-				setCookie('language',g_langrage,365);
-				window.location.assign("search.php?language="+g_langrage);
+				g_language=obj.value;
+				setCookie('language',g_language,365);
+				window.location.assign("search.php?language="+g_language);
 			}
 
 	</script>

+ 4 - 4
app/studio/term_sys_tool.php

@@ -103,11 +103,11 @@ else{
 		}
 
 
-			var g_langrage="en";
+			var g_language="en";
 			function menuLangrage(obj){
-				g_langrage=obj.value;
-				setCookie('language',g_langrage,365);
-				window.location.assign("search.php?language="+g_langrage);
+				g_language=obj.value;
+				setCookie('language',g_language,365);
+				window.location.assign("search.php?language="+g_language);
 			}
 var g_selected_array=new Array();
 var g_unselected_array=new Array();

+ 4 - 4
app/tools/tree_designer.php

@@ -96,11 +96,11 @@ else{
 		}
 
 
-			var g_langrage="en";
+			var g_language="en";
 			function menuLangrage(obj){
-				g_langrage=obj.value;
-				setCookie('language',g_langrage,365);
-				window.location.assign("search.php?language="+g_langrage);
+				g_language=obj.value;
+				setCookie('language',g_language,365);
+				window.location.assign("search.php?language="+g_language);
 			}
 function treedesign(){
 	var tree_word=tree_head_input.value;

+ 3 - 3
app/ucenter/function.php

@@ -19,18 +19,18 @@ function ucenter_get($userid,$fields="username"){
 
 }
 
-function ucenter_getA($userid,$fields){
+function ucenter_getA($userid,$fields="nickname"){
     //打开数据库
     $dns = "sqlite:"._FILE_DB_USERINFO_;
     $dbh = new PDO($dns, "", "",array(PDO::ATTR_PERSISTENT=>true));
     $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);  
-    $query = "select username from user where userid= ? ";
+    $query = "select username,nickname from user where userid= ? ";
     $stmt = $dbh->prepare($query);
     $stmt->execute(array($userid));
     $fUser = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $dbh=null;
     if(count($fUser)>0){
-        return($fUser[0]["username"]);
+        return($fUser[0][$fields]);
     }
     else{
         return("");

+ 77 - 59
app/ucenter/name_selector.js

@@ -1,73 +1,91 @@
 var user_select_param;
-function name_selector_init(container,parameter){
-    user_select_param = parameter;
-    $.get("../ucenter/get.php",
-        {
-            id:$("#"+parameter.input_id).val()
-        },
-        function(data,status){
-            let result= JSON.parse(data);
-            let html = '<div id="user_select_nickname" onclick="user_select_click()">';
-            if(result.length>0){
-                html += result[0].nickname;
-            }
-            else{
-                html += "未找到";
-            }
-            html += "</div>";
-            html += "<div id='user_selector_popwin' style='position: absolute; background-color: dimgray; padding: 8px;display: none;'><input id='user_selector_input' type='input' onkeyup=\"user_select_search_keyup(event,this)\" /><div id='user_selector_list'></div></div>"
-            $("#"+container).html(html);
-        });
+function name_selector_init(container, parameter) {
+  user_select_param = parameter;
+  $.get(
+    "../ucenter/get.php",
+    {
+      id: $("#" + parameter.input_id).val(),
+    },
+    function (data, status) {
+      let result = JSON.parse(data);
+      let html =
+        '<div id="user_select_nickname" onclick="user_select_click()">';
+      if (result.length > 0) {
+        html += result[0].nickname;
+      } else {
+        html += "未找到";
+      }
+      html += "</div>";
+      html +=
+        "<div id='user_selector_popwin' style='position: absolute; background-color: dimgray; padding: 8px;display: none;'>";
+      html +=
+        "<input id='user_selector_input' type='input' onkeyup=\"user_select_search_keyup(event,this)\" />";
+      html += "<div id='user_selector_list'></div>";
+      html += "<span onclick='user_select_close()'>关闭</span>";
+      html += "</div>";
+      $("#" + container).html(html);
+    }
+  );
 }
 
-function user_select_click(){
-    $("#user_selector_popwin").show();
+function user_select_click() {
+  $("#user_selector_popwin").show();
 }
 
-function user_select_search_keyup(e,obj){
-    var keynum
-    var keychar
-    var numcheck
+function user_select_close() {
+  $("#user_selector_popwin").hide();
+}
 
+function user_select_search_keyup(e, obj) {
+  var keynum;
+  var keychar;
+  var numcheck;
 
-    
-    if(window.event) // IE
-    {
-        keynum = e.keyCode
-    }
-    else if(e.which) // Netscape/Firefox/Opera
-    {
-        keynum = e.which
-    }
-    var keychar = String.fromCharCode(keynum)
-    if(keynum==13){
-
-    }
-    else{
-        user_select_search(obj.value);
-    }
+  if (window.event) {
+    // IE
+    keynum = e.keyCode;
+  } else if (e.which) {
+    // Netscape/Firefox/Opera
+    keynum = e.which;
+  }
+  var keychar = String.fromCharCode(keynum);
+  if (keynum == 13) {
+  } else {
+    user_select_search(obj.value);
+  }
 }
 
-function user_select_search(keyword){
-    $.get("../ucenter/get.php",
+function user_select_search(keyword) {
+  $.get(
+    "../ucenter/get.php",
     {
-        username:keyword
+      username: keyword,
     },
-    function(data,status){
-        let result= JSON.parse(data);
-        let html="<div id='user_list'>";
-        if(result.length>0){
-            for(x in result){
-                html += "<div><a onclick=\"user_select_apply('"+result[x].id+"','"+result[x].nickname+"')\">"+result[x].nickname+"["+result[x].email+"]</a></div>";
-            }
+    function (data, status) {
+      let result = JSON.parse(data);
+      let html = "<div id='user_list'>";
+      if (result.length > 0) {
+        for (x in result) {
+          html +=
+            "<div><a onclick=\"user_select_apply('" +
+            result[x].id +
+            "','" +
+            result[x].nickname +
+            "')\">" +
+            result[x].nickname +
+            "[" +
+            result[x].email +
+            "]</a></div>";
         }
-        html += "</div>";
-        $("#user_selector_list").html(html);
-    });
+      }
+      html += "</div>";
+      $("#user_selector_list").html(html);
+    }
+  );
 }
 
-function user_select_apply(userid,nickname){
-    $("#"+user_select_param.input_id).val(userid);
-    $("#user_select_nickname").html(nickname);
-    $("#user_list").hidden();
-}
+function user_select_apply(userid, nickname) {
+  $("#" + user_select_param.input_id).val(userid);
+  $("#user_select_nickname").html(nickname);
+  $("#user_selector_popwin").hide();
+}

+ 7 - 1
app/ucenter/user.php

@@ -1,6 +1,6 @@
 	<!--显示模式-->
 	<script>
-		var g_langrage="en";
+		var g_language="en";
 		var g_currLink="";
 		function user_init(strPage){
 			g_currLink = strPage;
@@ -93,6 +93,12 @@
 					</svg>
 					<?php echo $_local->gui->logout;?>
 				</a>
+				<a href='../uhome/index.php?userid=<?php echo $_COOKIE["userid"];?>'>
+					<svg class="icon">
+						<use xlink:href="../studio/svg/icon.svg#ic_exit_to_app_24px"></use>
+					</svg>
+					<?php echo "我的空间";?>
+				</a>
 			</div>
 
 				<?php

+ 49 - 0
app/uhome/course.php

@@ -0,0 +1,49 @@
+<?PHP
+include "../pcdl/html_head.php";
+?>
+<body>
+
+<?php
+    require_once "../path.php";
+    require_once "../public/_pdo.php";
+    require_once '../public/function.php';
+    require_once '../ucenter/function.php';
+    require_once "../pcdl/head_bar.php";
+    $currChannal = "course";
+    require_once "../uhome/head.php";
+?>
+
+<div class='index_inner'>
+<div id="course_list">
+</div>
+</div>
+<script>
+	$.get("../course/course_list.php",
+    {
+    teacher:"<?php echo $_GET["userid"]; ?>"
+    },
+    function(data,status){
+        let arrData = JSON.parse(data);
+        let html="";
+        for (const iterator of arrData) {
+            html += '<div class="card" style="display:flex;margin:1em;padding:10px;">';
+
+            html += '<div style="flex:7;">';
+            html +=  '<div class="title" style="padding-bottom:5px;font-size:110%;font-weight:600;"><a href="../course/course.php?id='+iterator.id+'">'+iterator.title+'</a></div>';
+            html += '<div class="summary"  style="padding-bottom:5px;">'+iterator.subtitle+'</div>';
+            html += '<div class="summary"  style="padding-bottom:5px;">'+iterator.summary+'</div>';
+
+            html += '</div>';
+
+            html += '<div style="flex:3;max-width:15em;">';
+
+            html += '</div>';
+
+            html += '</div>';
+            $("#course_list").html(html);
+        }
+	});
+</script>
+<?php
+include "../pcdl/html_foot.php";
+?>

+ 54 - 0
app/uhome/head.php

@@ -0,0 +1,54 @@
+<style>
+    #main_video_win iframe{
+        width:100%;
+        height:100%;
+    }
+    #main_tag span{
+        margin: 2px;
+        color:black;
+        padding: 2px 12px 0 12px;
+        font-weight: 500;
+        transition-duration: 0.2s;
+        cursor: pointer;
+        display: inline-flex;
+        align-items: center;
+        flex-wrap: nowrap;
+        justify-content: center;
+        font-size:110%;
+        border: unset;
+        border-radius: 0;
+        border-bottom: 2px solid var(--nocolor);
+    }
+    #main_tag span:hover{
+        background-color:unset;
+        border-color: var(--link-hover-color);
+    }
+    #main_tag .select{
+        border-bottom: 2px solid var(--link-color);
+    }
+</style>
+
+<div id='course_head_bar' style='background-color:var(--tool-bg-color1);padding:1em 10px 0 10px;'>
+    <div class='index_inner '>
+        <div style='display:flex;'>
+            <div style='font-size:280%;flex:7;'>
+                <?php echo ucenter_getA($_GET["userid"]);?>
+            </div>
+            <div  style="display: inline-block;"><button>关注</button><button>分享</button></div>
+        </div>
+
+        <div id="main_tag"  style="">
+            <a href="trans.php?userid=<?php echo $_GET["userid"];?>"><span tag="译文">译文</span></a>
+            <?php 
+                if(isset($currChannal) && $currChannal=="course"){
+                    echo '<span class="select" tag="课程">课程</span>';
+                }
+                else{
+                    echo '<a href="course.php?userid='.$_GET["userid"].'"><span tag="课程">课程</span></a>';
+                }
+            ?>
+            <span tag="经验">经验</span>
+            <span tag="统计">统计</span>
+        </div>
+    </div>
+</div>

+ 19 - 0
app/uhome/index.php

@@ -1,3 +1,22 @@
+<?PHP
+include "../pcdl/html_head.php";
+?>
+<body>
+
 <?php
+    require_once "../path.php";
+    require_once "../public/_pdo.php";
+    require_once '../public/function.php';
+    require_once '../ucenter/function.php';
+    require_once "../pcdl/head_bar.php";
+    require_once "../uhome/head.php";
+?>
+
+<div class='index_inner'>
+</div>
+<script>
 
+</script>
+<?php
+include "../pcdl/html_foot.php";
 ?>

+ 24 - 0
app/uwbw/update_analytics.php

@@ -0,0 +1,24 @@
+<?php
+require_once "../path.php";
+require_once "../public/_pdo.php";
+require_once '../public/load_lang.php';
+require_once '../public/function.php';
+
+global $PDO;
+PDO_Connect("sqlite:"._FILE_DB_USER_WBW_);
+
+echo "Day Index,创建,更新\n";
+$end = strtotime("now")*1000;
+$begin = strtotime("-1 day")*1000;
+for($i=0;$i<30;$i++){
+    //$query = "select count(*) from wbw where \"create_time\" > ".$PDO->quote($begin)." AND \"create_time\" < ".$PDO->quote($end). " AND owner = ".$PDO->quote($_COOKIE["userid"]);
+    $create = 0;//PDO_FetchOne($query);
+    $query = "select count(*) from wbw where  \"modify_time\" > ".$PDO->quote($begin)." AND \"modify_time\" < ".$PDO->quote($end). " AND owner = ".$PDO->quote($_COOKIE["username"]);
+    $modify = PDO_FetchOne($query);
+    echo date("m/d/Y",$begin/1000).','.$create.",".$modify."\n"; 
+    $end = $begin;
+    $begin = strtotime("-1 day",$end/1000)*1000;
+}
+
+
+?>

+ 23 - 22
documents/development/functions.md

@@ -11,7 +11,7 @@
 
 # PCD Suite 设计原则
 
-- **可重用的数据** 从逐词解析到整篇译文。所有的数据应该是可重用的。可重用意味着在技术层面应该存储计算机可辨识格式的数据。
+- **可重用的数据** 从逐词解析到整篇译文。所有的数据应该是可重用的。可重用意味着在技术层面应该存储计算机可辨识格式的数据。
 
 ```
 应该存储
@@ -22,12 +22,12 @@
 }
 
 不应存储
-citta:nt. 心;缤纷;
+citta:中性 心;缤纷;
 ```
 
 - **智能重用** 程序应根据经文类型(经藏或律藏)或其他特征,提供提供不同的数据给用户。或将数据列表按信心指数排序。以减少不必要的人工劳动。
 - **公共版权** 有版权的信息与前两条原则违背。所以,一切在本平台公开的数据都应使用公共版权。
-- **平等的发言权** 每个平台的使用者都有权发表自己的观点。平台不应以人工的方式评价观点的正确性或给予排名靠前或靠后的操作。但是平台应该记录和向所有人提供信息发布者的使用经验数值(如:使用平台时间,发表信息量,被点赞量等)供阅读者自己判断信息的可用性。没有实质内容的信息(如:“很好”;“太差了”),管理员应根据过滤规则,将信息隐藏。在读者选择“查看隐藏的内容”时展示。
+- **平等的发言权** 每个平台的使用者都有权发表自己的观点。平台不应以官方的角度用人工的方式评价观点的正确性或给予排名靠前或靠后的操作。但是平台应该记录和向所有人提供统计数据,如:信息发布者的使用经验数值(使用平台时间,发表信息量,被点赞量等),阅读者的阅读数据(阅读量,收藏量)供阅读者自己判断信息的可用性。没有实质内容的信息(如:“很好”;“太差了”等)将对读者造成困扰,增加读者搜寻有用信息的时间。管理员应根据判定规则,将信息隐藏。在读者选择“查看隐藏的内容”时展示。
 
 # 程序架构设计
 
@@ -90,16 +90,13 @@ www.wikipali.org
 
 ### 尚未实现的功能(目前的需求)
 
-#### 最新课程列表
-
-- 报名数字显示和报名功能
-
-#### 最新三藏译文列表
+- **最新课程列表**-报名数字显示和报名功能
 
-#### 手机版 css
+- 最新三藏译文列表
 
-- 写不同的 css 在手机端和 pc 看到不同的页面。
-- 不一定用 css 切换,可以使用不同的技术实现方式。
+- 手机版 css
+  - 写不同的 css 在手机端和 pc 看到不同的页面。
+  - 不一定用 css 切换,可以使用不同的技术实现方式。
 
 ### 未来可能的发展
 
@@ -165,27 +162,31 @@ www.wikipali.org/palicanon
 
 ## 经典阅读器
 
-## 译经楼-欢迎页
+# 译经楼 Studio
+
+## 欢迎页
+
+## 经文选择
 
-## 译经楼-经文选择
+## 最近打开
 
-## 译经楼-最近打开
+## 协作
 
-## 译经楼-协作
+## 课程管理
 
-## 译经楼-课程管理
+## 用户字典管理
 
-## 译经楼-用户字典管理
+## 百科字典管理
 
-## 译经楼-百科字典管理
+## 工作组管理
 
-## 译经楼-工作组管理
+# 用户中心
 
-## 用户中心-登录
+## 登录
 
-## 用户中心-注册
+## 注册
 
-## 用户中心-用户设置
+## 用户设置
 
 # 网站后台管理
 

Некоторые файлы не были показаны из-за большого количества измененных файлов