| 1 | /********************************************************************** | 
|---|
| 2 | *          Calendar JavaScript [DOM] v3.11 by Michael Loesler          * | 
|---|
| 3 | ************************************************************************ | 
|---|
| 4 | * Copyright (C) 2005-09 by Michael Loesler, http//derletztekick.com    * | 
|---|
| 5 | *                                                                      * | 
|---|
| 6 | *                                                                      * | 
|---|
| 7 | * This program is free software; you can redistribute it and/or modify * | 
|---|
| 8 | * it under the terms of the GNU General Public License as published by * | 
|---|
| 9 | * the Free Software Foundation; either version 3 of the License, or    * | 
|---|
| 10 | * (at your option) any later version.                                  * | 
|---|
| 11 | *                                                                      * | 
|---|
| 12 | * This program is distributed in the hope that it will be useful,      * | 
|---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of       * | 
|---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        * | 
|---|
| 15 | * GNU General Public License for more details.                         * | 
|---|
| 16 | *                                                                      * | 
|---|
| 17 | * You should have received a copy of the GNU General Public License    * | 
|---|
| 18 | * along with this program; if not, see <http://www.gnu.org/licenses/>  * | 
|---|
| 19 | * or write to the                                                      * | 
|---|
| 20 | * Free Software Foundation, Inc.,                                      * | 
|---|
| 21 | * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.            * | 
|---|
| 22 | *                                                                      * | 
|---|
| 23 | **********************************************************************/ | 
|---|
| 24 | /* | 
|---|
| 25 | function logout() | 
|---|
| 26 | { | 
|---|
| 27 | var xmlHttp = new XMLHttpRequest(); | 
|---|
| 28 | xmlHttp.open('POST', "calendar.php?logout=1", true); | 
|---|
| 29 | xmlHttp.onload = function () | 
|---|
| 30 | { | 
|---|
| 31 | if (xmlHttp.status!=200) | 
|---|
| 32 | { | 
|---|
| 33 | alert("ERROR - HTTP request: "+xmlHttp.statusText+" ["+xmlHttp.status+"]"); | 
|---|
| 34 | return; | 
|---|
| 35 | } | 
|---|
| 36 |  | 
|---|
| 37 | alert("Logout successful!"); | 
|---|
| 38 | }; | 
|---|
| 39 |  | 
|---|
| 40 | xmlHttp.send(); | 
|---|
| 41 | } | 
|---|
| 42 | */ | 
|---|
| 43 | function resize() | 
|---|
| 44 | { | 
|---|
| 45 | var table = document.getElementById("table"); | 
|---|
| 46 |  | 
|---|
| 47 | var W = window.innerWidth; | 
|---|
| 48 | var H = window.innerHeight; | 
|---|
| 49 |  | 
|---|
| 50 | table.style.width =W+"px"; | 
|---|
| 51 | table.style.height=H+"px"; | 
|---|
| 52 | } | 
|---|
| 53 |  | 
|---|
| 54 | var institutes= ["User", "EPFL", "ETHZ", "ISDC", "UNIDO", "UNIGE", "UNIWUE" ]; | 
|---|
| 55 |  | 
|---|
| 56 | function CalendarJS() | 
|---|
| 57 | { | 
|---|
| 58 | this.now       = new Date(); | 
|---|
| 59 | this.dayname   = ["Mo","Tu","We","Th","Fr","Sa","So"]; | 
|---|
| 60 | this.monthname = ["January","February","March","April","May","June","July","August","September","October","November","December"]; | 
|---|
| 61 | this.tooltip   = ["previous month","next month","current date","last year","next year"]; | 
|---|
| 62 | this.monthCell = document.createElement("th"); | 
|---|
| 63 | this.tableHead = null; | 
|---|
| 64 | this.tableFoot = null; | 
|---|
| 65 | this.parEl     = null; | 
|---|
| 66 |  | 
|---|
| 67 | this.init = function( id, initDate ) | 
|---|
| 68 | { | 
|---|
| 69 | this.now       = initDate ? initDate : new Date(); | 
|---|
| 70 | this.date      = this.now.getDate(); | 
|---|
| 71 | this.month     = this.mm = this.now.getMonth(); | 
|---|
| 72 | this.year      = this.yy = this.now.getFullYear(); | 
|---|
| 73 | this.monthCell.appendChild(document.createTextNode( this.monthname[this.mm]+"\u00a0"+this.yy )); | 
|---|
| 74 |  | 
|---|
| 75 | this.tableHead = this.createTableHead(); | 
|---|
| 76 | this.tableFoot = this.createTableFoot(); | 
|---|
| 77 |  | 
|---|
| 78 | this.parEl = document.getElementById( id ); | 
|---|
| 79 | this.show(); | 
|---|
| 80 |  | 
|---|
| 81 | if (!initDate) | 
|---|
| 82 | this.checkDate(); | 
|---|
| 83 | }; | 
|---|
| 84 |  | 
|---|
| 85 | this.checkDate = function() | 
|---|
| 86 | { | 
|---|
| 87 | var self  = this; | 
|---|
| 88 | var today = new Date(); | 
|---|
| 89 |  | 
|---|
| 90 | if (this.date != today.getDate()) | 
|---|
| 91 | { | 
|---|
| 92 | this.tableHead = this.createTableHead(); | 
|---|
| 93 | this.tableFoot = this.createTableFoot(); | 
|---|
| 94 |  | 
|---|
| 95 | this.date = today.getDate(); | 
|---|
| 96 | if (this.mm == this.month && this.yy == this.year) | 
|---|
| 97 | this.switchMonth("current"); | 
|---|
| 98 |  | 
|---|
| 99 | this.month = today.getMonth(); | 
|---|
| 100 | if (this.mm == this.month && this.yy == this.year) | 
|---|
| 101 | this.switchMonth("current"); | 
|---|
| 102 |  | 
|---|
| 103 | this.year  = today.getFullYear(); | 
|---|
| 104 | if (this.mm == this.month && this.yy == this.year) | 
|---|
| 105 | this.switchMonth("current"); | 
|---|
| 106 | } | 
|---|
| 107 | window.setTimeout(function() { self.checkDate(); }, Math.abs(new Date(this.year, this.month, this.date, 24, 0, 0)-this.now)); | 
|---|
| 108 | }, | 
|---|
| 109 |  | 
|---|
| 110 | this.removeElements = function( Obj ) | 
|---|
| 111 | { | 
|---|
| 112 | while( Obj.childNodes.length > 0) | 
|---|
| 113 | Obj.removeChild(Obj.lastChild); | 
|---|
| 114 |  | 
|---|
| 115 | return Obj; | 
|---|
| 116 | }; | 
|---|
| 117 |  | 
|---|
| 118 | this.show = function() | 
|---|
| 119 | { | 
|---|
| 120 | this.parEl = this.removeElements( this.parEl ); | 
|---|
| 121 | this.monthCell.firstChild.replaceData(0, this.monthCell.firstChild.nodeValue.length, this.monthname[this.mm]+"\u00a0"+this.yy); | 
|---|
| 122 |  | 
|---|
| 123 | var table = document.createElement("table"); | 
|---|
| 124 | table.id = "table"; | 
|---|
| 125 |  | 
|---|
| 126 | this.parEl.appendChild( table ); | 
|---|
| 127 |  | 
|---|
| 128 | table.appendChild( this.tableHead ); | 
|---|
| 129 | table.appendChild( this.tableFoot ); | 
|---|
| 130 |  | 
|---|
| 131 | table.appendChild( this.createTableBody(window.innerHeight-table.offsetHeight) ); | 
|---|
| 132 |  | 
|---|
| 133 | resize(); | 
|---|
| 134 | }; | 
|---|
| 135 |  | 
|---|
| 136 | this.createTableFoot = function() | 
|---|
| 137 | { | 
|---|
| 138 | var tfoot = document.createElement("tfoot"); | 
|---|
| 139 |  | 
|---|
| 140 | var tr = document.createElement("tr"); | 
|---|
| 141 | var td = document.createElement("td"); | 
|---|
| 142 | td.height = "1%"; | 
|---|
| 143 | td.colSpan = 7; | 
|---|
| 144 | td.style.padding="3px 3px"; | 
|---|
| 145 | tfoot.appendChild(tr); | 
|---|
| 146 | tr.appendChild(td); | 
|---|
| 147 | var table = document.createElement("table"); | 
|---|
| 148 | table.width="100%"; | 
|---|
| 149 | td.appendChild(table); | 
|---|
| 150 | tr = document.createElement("tr"); | 
|---|
| 151 | table.appendChild(tr); | 
|---|
| 152 | for (var i=0; i<institutes.length; i++) | 
|---|
| 153 | { | 
|---|
| 154 | td = document.createElement("td"); | 
|---|
| 155 | td.width=100/institutes.length+"%"; | 
|---|
| 156 | td.setAttribute("style", "text-align:center;font-size:1em;border:solid #112A5D 2px;padding:3px 3px;"); | 
|---|
| 157 | td.changeUser = this.changeUser; | 
|---|
| 158 | td.onclick = function(e) { this.changeUser(); } | 
|---|
| 159 | td.appendChild(document.createTextNode(institutes[i])); | 
|---|
| 160 | tr.appendChild(td); | 
|---|
| 161 |  | 
|---|
| 162 | if (i==0) | 
|---|
| 163 | td.style.backgroundColor = "yellow"; | 
|---|
| 164 | } | 
|---|
| 165 | document.getElementById("body").setAttribute("data-user", institutes[0]); | 
|---|
| 166 |  | 
|---|
| 167 |  | 
|---|
| 168 | tr = document.createElement("tr"); | 
|---|
| 169 | td = document.createElement("td"); | 
|---|
| 170 | td.colSpan = 7; | 
|---|
| 171 | td.style.paddingLeft = "0px"; | 
|---|
| 172 | td.style.paddingTop  = "0px"; | 
|---|
| 173 | td.height = "1%"; | 
|---|
| 174 | var form  = document.createElement("form"); | 
|---|
| 175 | var input = document.createElement("textarea"); | 
|---|
| 176 | input.overflow    = "auto"; | 
|---|
| 177 | input.wrap        = "virtual"; | 
|---|
| 178 | input.id          = "comment"; | 
|---|
| 179 | input.value       = "enter comment here"; | 
|---|
| 180 | input.style.color = "#888"; | 
|---|
| 181 | input.style.width = "100%"; | 
|---|
| 182 | input.rows        = 5; | 
|---|
| 183 | input.title       = "Enter a comment. Click somewhere in the calender to store the comment."; | 
|---|
| 184 | input.onchange    = function() { pushComment(); }; | 
|---|
| 185 | input.onfocus     = function() { if (input.value=="enter comment here" && input.style.color!="black") input.value=""; input.style.color="black"; }; | 
|---|
| 186 | input.onblur      = function() { input.style.color="#888"; if (input.value=="") input.value="enter comment here"; }; | 
|---|
| 187 | form.appendChild(input); | 
|---|
| 188 | td.appendChild( form ); | 
|---|
| 189 | tr.appendChild( td ); | 
|---|
| 190 | tfoot.appendChild(tr); | 
|---|
| 191 |  | 
|---|
| 192 | tr = document.createElement("tr"); | 
|---|
| 193 |  | 
|---|
| 194 | var td = document.createElement("td"); | 
|---|
| 195 | td.height="1%"; | 
|---|
| 196 | td.colSpan=7; | 
|---|
| 197 | tr.appendChild(td); | 
|---|
| 198 |  | 
|---|
| 199 | var tab = document.createElement("table"); | 
|---|
| 200 | var tr2 = document.createElement("tr"); | 
|---|
| 201 | tab.width="100%"; | 
|---|
| 202 | tab.cellSpacing=0; | 
|---|
| 203 | tab.cellPadding=0; | 
|---|
| 204 | tab.style.borderWidth = 0; | 
|---|
| 205 | tab.style.fontSize = "1.5em"; | 
|---|
| 206 | tab.style.marginBottom = "2px"; | 
|---|
| 207 | td.appendChild(tab); | 
|---|
| 208 | tab.appendChild(tr2); | 
|---|
| 209 |  | 
|---|
| 210 | var tm = this.getCell( "td", this.timeTrigger(), "clock" ); | 
|---|
| 211 | tm.style.whiteSpace="nowrap"; | 
|---|
| 212 | tm.style.paddingLeft = "0px"; | 
|---|
| 213 | tm.style.width="33%"; | 
|---|
| 214 | tr2.appendChild( tm ); | 
|---|
| 215 |  | 
|---|
| 216 | var self = this; | 
|---|
| 217 | window.setInterval(function() { tm.firstChild.nodeValue = self.timeTrigger(); }, 500); | 
|---|
| 218 |  | 
|---|
| 219 | var td = document.createElement("td"); | 
|---|
| 220 | td.style.width="33%"; | 
|---|
| 221 | td.style.textAlign="center"; | 
|---|
| 222 | var a = document.createElement("a"); | 
|---|
| 223 | a.href = "overview.png"; | 
|---|
| 224 | a.style.whiteSpace="nowrap"; | 
|---|
| 225 | a.appendChild(document.createTextNode("click here for help")); | 
|---|
| 226 | td.appendChild(a); | 
|---|
| 227 | tr2.appendChild( td ); | 
|---|
| 228 |  | 
|---|
| 229 | td = this.getCell( "td", "logout", "logout"); | 
|---|
| 230 | td.style.width="33%"; | 
|---|
| 231 | td.onclick = function(e) { logout(); } | 
|---|
| 232 | td.style.paddingRight = "0px"; | 
|---|
| 233 | tr2.appendChild( td ); | 
|---|
| 234 |  | 
|---|
| 235 | tfoot.appendChild( tr ); | 
|---|
| 236 |  | 
|---|
| 237 | return tfoot; | 
|---|
| 238 | } | 
|---|
| 239 |  | 
|---|
| 240 | this.createTableHead = function() | 
|---|
| 241 | { | 
|---|
| 242 | var thead = document.createElement("thead"); | 
|---|
| 243 | thead.style.height="1%"; | 
|---|
| 244 | var tr = document.createElement("tr"); | 
|---|
| 245 | var th = this.getCell( "th", "\u00AB", "prev_month" ); | 
|---|
| 246 |  | 
|---|
| 247 | th.rowSpan = 2; | 
|---|
| 248 | th.Instanz = this; | 
|---|
| 249 | th.onclick = function() { this.Instanz.switchMonth("prev"); }; | 
|---|
| 250 | th.title = this.tooltip[0]; | 
|---|
| 251 |  | 
|---|
| 252 | try { th.style.cursor = "pointer"; } catch(e){ th.style.cursor = "hand"; } | 
|---|
| 253 | tr.appendChild( th ); | 
|---|
| 254 |  | 
|---|
| 255 | this.monthCell.Instanz = this; | 
|---|
| 256 | this.monthCell.rowSpan = 2; | 
|---|
| 257 | this.monthCell.colSpan = 4; | 
|---|
| 258 | this.monthCell.onclick = function() { this.Instanz.switchMonth("current"); }; | 
|---|
| 259 | this.monthCell.title = this.tooltip[2]; | 
|---|
| 260 |  | 
|---|
| 261 | try { this.monthCell.style.cursor = "pointer"; } catch(e){ this.monthCell.style.cursor = "hand"; } | 
|---|
| 262 | tr.appendChild( this.monthCell ); | 
|---|
| 263 |  | 
|---|
| 264 | th = this.getCell( "th", "\u00BB", "next_month" ); | 
|---|
| 265 | th.rowSpan = 2; | 
|---|
| 266 | th.Instanz = this; | 
|---|
| 267 | th.onclick = function() { this.Instanz.switchMonth("next"); }; | 
|---|
| 268 | th.title = this.tooltip[1]; | 
|---|
| 269 |  | 
|---|
| 270 | try { th.style.cursor = "pointer"; } catch(e){ th.style.cursor = "hand"; } | 
|---|
| 271 | tr.appendChild( th ); | 
|---|
| 272 |  | 
|---|
| 273 | th = this.getCell( "th", "\u02c4", "prev_year" ); | 
|---|
| 274 | th.Instanz = this; | 
|---|
| 275 | th.onclick = function() { this.Instanz.switchMonth("prev_year"); }; | 
|---|
| 276 | th.title = this.tooltip[3]; | 
|---|
| 277 |  | 
|---|
| 278 | try { th.style.cursor = "pointer"; } catch(e){ th.style.cursor = "hand"; } | 
|---|
| 279 | tr.appendChild( th ); | 
|---|
| 280 |  | 
|---|
| 281 | thead.appendChild( tr ); | 
|---|
| 282 |  | 
|---|
| 283 | tr = document.createElement("tr"); | 
|---|
| 284 | th = this.getCell( "th", "\u02c5", "next_year" ); | 
|---|
| 285 | th.Instanz = this; | 
|---|
| 286 | th.onclick = function() { this.Instanz.switchMonth("next_year"); }; | 
|---|
| 287 | th.title = this.tooltip[4]; | 
|---|
| 288 |  | 
|---|
| 289 | try { th.style.cursor = "pointer"; } catch(e){ th.style.cursor = "hand"; } | 
|---|
| 290 | tr.appendChild( th ); | 
|---|
| 291 |  | 
|---|
| 292 | thead.appendChild( tr ); | 
|---|
| 293 |  | 
|---|
| 294 | tr = document.createElement('tr'); | 
|---|
| 295 | for (var i=0; i<this.dayname.length; i++) | 
|---|
| 296 | { | 
|---|
| 297 | var th = this.getCell("th", this.dayname[i], "weekday" ); | 
|---|
| 298 | th.width=100/7+"%"; | 
|---|
| 299 | tr.appendChild( th ); | 
|---|
| 300 | } | 
|---|
| 301 |  | 
|---|
| 302 | thead.appendChild( tr ); | 
|---|
| 303 |  | 
|---|
| 304 | return thead; | 
|---|
| 305 | }, | 
|---|
| 306 |  | 
|---|
| 307 | this.createTableBody = function(height) | 
|---|
| 308 | { | 
|---|
| 309 | var dayspermonth = [31,28,31,30,31,30,31,31,30,31,30,31]; | 
|---|
| 310 | var sevendaysaweek = 0; | 
|---|
| 311 | var begin = new Date(this.yy, this.mm, 1); | 
|---|
| 312 | var firstday = begin.getDay()-1; | 
|---|
| 313 | if (firstday < 0) | 
|---|
| 314 | firstday = 6; | 
|---|
| 315 | if ((this.yy%4==0) && ((this.yy%100!=0) || (this.yy%400==0))) | 
|---|
| 316 | dayspermonth[1] = 29; | 
|---|
| 317 |  | 
|---|
| 318 | var tbody = document.createElement("tbody"); | 
|---|
| 319 | var tr    = document.createElement('tr'); | 
|---|
| 320 |  | 
|---|
| 321 | tbody.height="100%"; | 
|---|
| 322 |  | 
|---|
| 323 | var height="";//"20%";//100/8+"%"; | 
|---|
| 324 |  | 
|---|
| 325 | if (firstday == 0) | 
|---|
| 326 | { | 
|---|
| 327 | for (var i=0; i<this.dayname.length; i++) | 
|---|
| 328 | { | 
|---|
| 329 | var prevMonth = (this.mm == 0)?11:this.mm-1; | 
|---|
| 330 | var td = this.getCell( "td", dayspermonth[prevMonth]-6+i, "last_month" ); | 
|---|
| 331 | td.style.height=height; | 
|---|
| 332 | tr.appendChild( td ); | 
|---|
| 333 | } | 
|---|
| 334 | tbody.appendChild( tr ); | 
|---|
| 335 | tr = document.createElement('tr'); | 
|---|
| 336 | } | 
|---|
| 337 |  | 
|---|
| 338 | for (var i=0; i<firstday; i++, sevendaysaweek++) | 
|---|
| 339 | { | 
|---|
| 340 | var prevMonth = (this.mm == 0)?11:this.mm-1; | 
|---|
| 341 | var td = this.getCell( "td", dayspermonth[prevMonth]-firstday+i+1, "last_month" ); | 
|---|
| 342 | td.style.height=height; | 
|---|
| 343 | tr.appendChild( td ); | 
|---|
| 344 | } | 
|---|
| 345 |  | 
|---|
| 346 | for (var i=1; i<=dayspermonth[this.mm]; i++, sevendaysaweek++) | 
|---|
| 347 | { | 
|---|
| 348 | if (this.dayname.length == sevendaysaweek) | 
|---|
| 349 | { | 
|---|
| 350 | tbody.appendChild( tr ); | 
|---|
| 351 | tr = document.createElement('tr'); | 
|---|
| 352 | sevendaysaweek = 0; | 
|---|
| 353 | } | 
|---|
| 354 |  | 
|---|
| 355 | var td = null; | 
|---|
| 356 | if (i==this.date && this.mm==this.month && this.yy==this.year && (sevendaysaweek == 5 || sevendaysaweek == 6)) | 
|---|
| 357 | td = this.getCell( "td", i, "today weekend" ); | 
|---|
| 358 | else | 
|---|
| 359 | if (i==this.date && this.mm==this.month && this.yy==this.year) | 
|---|
| 360 | td = this.getCell( "td", i, "today" ); | 
|---|
| 361 | else | 
|---|
| 362 | if (sevendaysaweek == 5 || sevendaysaweek == 6) | 
|---|
| 363 | td = this.getCell( "td", i, "weekend" ); | 
|---|
| 364 | else | 
|---|
| 365 | td = this.getCell( "td", i, null); | 
|---|
| 366 |  | 
|---|
| 367 | td.setDate    = this.setDate; | 
|---|
| 368 | td.chooseDate = this.chooseDate; | 
|---|
| 369 | td.dd = i; | 
|---|
| 370 | td.mm = this.mm; | 
|---|
| 371 | td.yy = this.yy; | 
|---|
| 372 | td.id = this.mm+"-"+i; | 
|---|
| 373 | td.title = "Click to select this date."; | 
|---|
| 374 |  | 
|---|
| 375 | td.style.height=height; | 
|---|
| 376 |  | 
|---|
| 377 | td.onclick = function(e) { | 
|---|
| 378 | this.chooseDate(); | 
|---|
| 379 | }; | 
|---|
| 380 |  | 
|---|
| 381 | var tab = document.createElement("table"); | 
|---|
| 382 | tab.width="100%"; | 
|---|
| 383 | tab.style.border = 0; | 
|---|
| 384 | tab.style.padding = 0; | 
|---|
| 385 | tab.style.margin = 0; | 
|---|
| 386 | tab.style.fontSize = "1.5em"; | 
|---|
| 387 | tab.style.backgroundColor = "transparent"; | 
|---|
| 388 | var tr0 = document.createElement("tr"); | 
|---|
| 389 | var td0 = document.createElement("td"); | 
|---|
| 390 | var td1 = document.createElement("td"); | 
|---|
| 391 | td0.style.textAlign = "left"; | 
|---|
| 392 | td1.style.textAlign = "right"; | 
|---|
| 393 | td1.style.textWeight= "normal"; | 
|---|
| 394 | td0.style.color = "lightgray"; | 
|---|
| 395 | td0.style.border=0; | 
|---|
| 396 | td1.style.border=0; | 
|---|
| 397 | td0.style.padding=0; | 
|---|
| 398 | td1.style.padding=0; | 
|---|
| 399 | tab.appendChild(tr0); | 
|---|
| 400 | tr0.appendChild(td0); | 
|---|
| 401 | tr0.appendChild(td1); | 
|---|
| 402 | //td0.appendChild(document.createTextNode(txt)); | 
|---|
| 403 |  | 
|---|
| 404 | td1.appendChild(td.firstChild); | 
|---|
| 405 | td.appendChild(tab); | 
|---|
| 406 |  | 
|---|
| 407 | var IP    = this.getMoonPhase(this.yy, this.mm, i); | 
|---|
| 408 | var str   = this.getMoonPhaseStr(IP); | 
|---|
| 409 | var phase = 100-Math.abs(IP-0.5)*200; | 
|---|
| 410 | var txt   = parseInt(phase+0.5,10)+"%"; | 
|---|
| 411 | if (phase>50) | 
|---|
| 412 | td0.style.color = "gray"; | 
|---|
| 413 | if (phase<3.4) | 
|---|
| 414 | { | 
|---|
| 415 | txt = "o"; | 
|---|
| 416 | td0.style.textWeight = "bolder"; | 
|---|
| 417 | td0.style.fontSize = "0.7em"; | 
|---|
| 418 | td0.style.color = "darkgreen"; | 
|---|
| 419 | } | 
|---|
| 420 | if (phase>96.6) | 
|---|
| 421 | { | 
|---|
| 422 | txt = "•"; | 
|---|
| 423 | td0.style.textWeight = "bolder"; | 
|---|
| 424 | td0.style.fontSize = "0.8em"; | 
|---|
| 425 | td0.style.color = "darkred"; | 
|---|
| 426 | } | 
|---|
| 427 | tab.title = str; | 
|---|
| 428 | td0.innerHTML = txt; | 
|---|
| 429 |  | 
|---|
| 430 | var sp = document.createElement("span"); | 
|---|
| 431 | sp.appendChild(document.createTextNode("*")); | 
|---|
| 432 | sp.style.color="darkred"; | 
|---|
| 433 | sp.style.display="none"; | 
|---|
| 434 | td1.appendChild(sp); | 
|---|
| 435 |  | 
|---|
| 436 |  | 
|---|
| 437 | tr.appendChild( td ); | 
|---|
| 438 | } | 
|---|
| 439 |  | 
|---|
| 440 | var daysNextMonth = 1; | 
|---|
| 441 | for (var i=sevendaysaweek; i<this.dayname.length; i++) | 
|---|
| 442 | tr.appendChild( this.getCell( "td", daysNextMonth++, "next_month"  ) ); | 
|---|
| 443 |  | 
|---|
| 444 | tbody.appendChild( tr ); | 
|---|
| 445 |  | 
|---|
| 446 | while (tbody.getElementsByTagName("tr").length<6) { | 
|---|
| 447 | tr = document.createElement('tr'); | 
|---|
| 448 | for (var i=0; i<this.dayname.length; i++) | 
|---|
| 449 | { | 
|---|
| 450 | var td = this.getCell( "td", daysNextMonth++, "next_month"  ); | 
|---|
| 451 | td.style.height=height; | 
|---|
| 452 | tr.appendChild( td ); | 
|---|
| 453 | } | 
|---|
| 454 | tbody.appendChild( tr ); | 
|---|
| 455 | } | 
|---|
| 456 |  | 
|---|
| 457 | requestAll(this.yy, this.mm); | 
|---|
| 458 | requestAllComments(this.yy, this.mm); | 
|---|
| 459 | if (this.year==this.yy && this.month==this.mm) | 
|---|
| 460 | requestComment(this.year, this.month, this.date); | 
|---|
| 461 | else | 
|---|
| 462 | { | 
|---|
| 463 | var c = document.getElementById("comment"); | 
|---|
| 464 | c.color="#888"; | 
|---|
| 465 | c.value="enter comment here"; | 
|---|
| 466 | } | 
|---|
| 467 |  | 
|---|
| 468 | return tbody; | 
|---|
| 469 | }; | 
|---|
| 470 |  | 
|---|
| 471 | this.getCalendarWeek = function(j,m,t) | 
|---|
| 472 | { | 
|---|
| 473 | var cwDate = this.now; | 
|---|
| 474 | if (!t) | 
|---|
| 475 | { | 
|---|
| 476 | j = cwDate.getFullYear(); | 
|---|
| 477 | m = cwDate.getMonth(); | 
|---|
| 478 | t = cwDate.getDate(); | 
|---|
| 479 | } | 
|---|
| 480 | cwDate = new Date(j,m,t); | 
|---|
| 481 |  | 
|---|
| 482 | var doDat = new Date(cwDate.getTime() + (3-((cwDate.getDay()+6) % 7)) * 86400000); | 
|---|
| 483 | cwYear = doDat.getFullYear(); | 
|---|
| 484 |  | 
|---|
| 485 | var doCW = new Date(new Date(cwYear,0,4).getTime() + (3-((new Date(cwYear,0,4).getDay()+6) % 7)) * 86400000); | 
|---|
| 486 | cw = Math.floor(1.5+(doDat.getTime()-doCW.getTime())/86400000/7); | 
|---|
| 487 | return cw; | 
|---|
| 488 | }; | 
|---|
| 489 |  | 
|---|
| 490 | function request(td) | 
|---|
| 491 | { | 
|---|
| 492 | var user = document.getElementById("body").getAttribute("data-user"); | 
|---|
| 493 | var uri = "calendar.php?toggle&y="+td.yy+"&m="+td.mm+"&d="+td.dd; | 
|---|
| 494 | if (user!="User") | 
|---|
| 495 | uri += "&u="+user; | 
|---|
| 496 |  | 
|---|
| 497 | var xmlHttp = new XMLHttpRequest(); | 
|---|
| 498 | xmlHttp.open('POST', uri, true); | 
|---|
| 499 | xmlHttp.onload = function () | 
|---|
| 500 | { | 
|---|
| 501 | if (xmlHttp.status!=200) | 
|---|
| 502 | { | 
|---|
| 503 | alert("ERROR - HTTP request: "+xmlHttp.statusText+" ["+xmlHttp.status+"]"); | 
|---|
| 504 | return; | 
|---|
| 505 | } | 
|---|
| 506 |  | 
|---|
| 507 | var lines = xmlHttp.responseText.split('\n'); | 
|---|
| 508 | if (lines.length==0) | 
|---|
| 509 | return; | 
|---|
| 510 |  | 
|---|
| 511 | while (td.childNodes.length>1) | 
|---|
| 512 | td.removeChild(td.lastChild); | 
|---|
| 513 |  | 
|---|
| 514 | for (var i=0; i<lines.length; i++) | 
|---|
| 515 | { | 
|---|
| 516 | var x = lines[i].split('\t'); | 
|---|
| 517 | if (x.length!=2) | 
|---|
| 518 | continue; | 
|---|
| 519 |  | 
|---|
| 520 | var div = document.createElement("div"); | 
|---|
| 521 | div.style.fontWeight="normal"; | 
|---|
| 522 | div.appendChild(document.createTextNode(x[1])); | 
|---|
| 523 | td.appendChild(div); | 
|---|
| 524 |  | 
|---|
| 525 | for (var j=0; j<institutes.length; j++) | 
|---|
| 526 | if (x[1]==institutes[j]) | 
|---|
| 527 | { | 
|---|
| 528 | div.className += " institute"; | 
|---|
| 529 | break; | 
|---|
| 530 | } | 
|---|
| 531 | } | 
|---|
| 532 |  | 
|---|
| 533 | if (td.childNodes.length>1) | 
|---|
| 534 | td.className += " enabled"; | 
|---|
| 535 | else | 
|---|
| 536 | td.className = td.className.replace(/enabled/g, ""); | 
|---|
| 537 | }; | 
|---|
| 538 |  | 
|---|
| 539 | xmlHttp.send(); | 
|---|
| 540 | } | 
|---|
| 541 |  | 
|---|
| 542 | function logout() | 
|---|
| 543 | { | 
|---|
| 544 | var xmlHttp = new XMLHttpRequest(); | 
|---|
| 545 | xmlHttp.open('POST', "calendar.php?logout", true); | 
|---|
| 546 | xmlHttp.onload = function () | 
|---|
| 547 | { | 
|---|
| 548 | if (xmlHttp.status!=401) | 
|---|
| 549 | { | 
|---|
| 550 | alert("ERROR - HTTP request: "+xmlHttp.statusText+" ["+xmlHttp.status+"]"); | 
|---|
| 551 | return; | 
|---|
| 552 | } | 
|---|
| 553 |  | 
|---|
| 554 | alert(xmlHttp.statusText); | 
|---|
| 555 | }; | 
|---|
| 556 |  | 
|---|
| 557 | xmlHttp.send(); | 
|---|
| 558 | } | 
|---|
| 559 |  | 
|---|
| 560 | function pushComment() | 
|---|
| 561 | { | 
|---|
| 562 | var c = document.getElementById("comment"); | 
|---|
| 563 |  | 
|---|
| 564 | var y = c.getAttribute("data-y"); | 
|---|
| 565 | var m = c.getAttribute("data-m"); | 
|---|
| 566 | var d = c.getAttribute("data-d"); | 
|---|
| 567 | var v = c.value; | 
|---|
| 568 |  | 
|---|
| 569 | var uri = "calendar.php?y="+y+"&m="+m+"&d="+d+"&c="+encodeURIComponent(v); | 
|---|
| 570 |  | 
|---|
| 571 | var xmlHttp = new XMLHttpRequest(); | 
|---|
| 572 | xmlHttp.open('POST', uri, true); | 
|---|
| 573 | xmlHttp.onload = function() | 
|---|
| 574 | { | 
|---|
| 575 | if (xmlHttp.status!=200) | 
|---|
| 576 | { | 
|---|
| 577 | alert("ERROR - HTTP request: "+xmlHttp.statusText+" ["+xmlHttp.status+"]"); | 
|---|
| 578 | return; | 
|---|
| 579 | } | 
|---|
| 580 |  | 
|---|
| 581 | alert("Comment inserted successfully."); | 
|---|
| 582 |  | 
|---|
| 583 | var td = document.getElementById(m+"-"+d); | 
|---|
| 584 | var sp = td.firstChild.firstChild.lastChild.lastChild; | 
|---|
| 585 | if (v=="") | 
|---|
| 586 | { | 
|---|
| 587 | sp.style.display="none"; | 
|---|
| 588 | td.title="Click to select this date."; | 
|---|
| 589 | } | 
|---|
| 590 | else | 
|---|
| 591 | { | 
|---|
| 592 | sp.style.display=""; | 
|---|
| 593 | td.title=v; | 
|---|
| 594 | } | 
|---|
| 595 |  | 
|---|
| 596 | }; | 
|---|
| 597 |  | 
|---|
| 598 | xmlHttp.send(); | 
|---|
| 599 | } | 
|---|
| 600 |  | 
|---|
| 601 | function requestComment(yy, mm, dd) | 
|---|
| 602 | { | 
|---|
| 603 | var c = document.getElementById("comment"); | 
|---|
| 604 |  | 
|---|
| 605 | var y = c.getAttribute("data-y"); | 
|---|
| 606 | var m = c.getAttribute("data-m"); | 
|---|
| 607 | var d = c.getAttribute("data-d"); | 
|---|
| 608 |  | 
|---|
| 609 | if (y==yy && m==mm && d==dd) | 
|---|
| 610 | return; | 
|---|
| 611 |  | 
|---|
| 612 | var uri = "calendar.php?comment&y="+yy+"&m="+mm+"&d="+dd; | 
|---|
| 613 | var xmlHttp = new XMLHttpRequest(); | 
|---|
| 614 | xmlHttp.open('POST', uri, true); | 
|---|
| 615 | xmlHttp.onload = function () | 
|---|
| 616 | { | 
|---|
| 617 | if (xmlHttp.status!=200) | 
|---|
| 618 | { | 
|---|
| 619 | alert("ERROR - HTTP request: "+xmlHttp.statusText+" ["+xmlHttp.status+"]"); | 
|---|
| 620 | return; | 
|---|
| 621 | } | 
|---|
| 622 |  | 
|---|
| 623 | var td = document.getElementById(mm+"-"+dd); | 
|---|
| 624 | var sp = td.firstChild.firstChild.lastChild.lastChild; | 
|---|
| 625 |  | 
|---|
| 626 | if (sp!=undefined) | 
|---|
| 627 | { | 
|---|
| 628 | c.color="#888"; | 
|---|
| 629 | if (xmlHttp.responseText=="") | 
|---|
| 630 | { | 
|---|
| 631 | c.value="enter comment here"; | 
|---|
| 632 | sp.style.display="none"; | 
|---|
| 633 | td.title=""; | 
|---|
| 634 | } | 
|---|
| 635 | else | 
|---|
| 636 | { | 
|---|
| 637 | c.value = xmlHttp.responseText; | 
|---|
| 638 | sp.style.display=""; | 
|---|
| 639 | td.title=xmlHttp.responseText; | 
|---|
| 640 | } | 
|---|
| 641 | } | 
|---|
| 642 |  | 
|---|
| 643 | c.setAttribute("data-y", yy); | 
|---|
| 644 | c.setAttribute("data-m", mm); | 
|---|
| 645 | c.setAttribute("data-d", dd); | 
|---|
| 646 | }; | 
|---|
| 647 |  | 
|---|
| 648 | xmlHttp.send(); | 
|---|
| 649 | } | 
|---|
| 650 |  | 
|---|
| 651 | var xmlReqAll = null; | 
|---|
| 652 | function requestAll(yy, mm) | 
|---|
| 653 | { | 
|---|
| 654 | if (xmlReqAll) | 
|---|
| 655 | xmlReqAll.abort(); | 
|---|
| 656 |  | 
|---|
| 657 | var uri = "calendar.php?y="+yy+"&m="+mm; | 
|---|
| 658 |  | 
|---|
| 659 | xmlReqAll = new XMLHttpRequest(); | 
|---|
| 660 | xmlReqAll.open('POST', uri, true); | 
|---|
| 661 | xmlReqAll.onload = function () | 
|---|
| 662 | { | 
|---|
| 663 | if (xmlReqAll.status!=200) | 
|---|
| 664 | { | 
|---|
| 665 | alert("ERROR - HTTP request: "+xmlReqAll.statusText+" ["+xmlReqAll.status+"]"); | 
|---|
| 666 | return; | 
|---|
| 667 | } | 
|---|
| 668 |  | 
|---|
| 669 | var lines = xmlReqAll.responseText.split('\n'); | 
|---|
| 670 | if (lines.length==0) | 
|---|
| 671 | return; | 
|---|
| 672 |  | 
|---|
| 673 | for (var i=0; i<lines.length; i++) | 
|---|
| 674 | { | 
|---|
| 675 | var x = lines[i].split('\t'); | 
|---|
| 676 | if (x.length!=2) | 
|---|
| 677 | continue; | 
|---|
| 678 |  | 
|---|
| 679 | var td = document.getElementById(mm+"-"+x[0]); | 
|---|
| 680 |  | 
|---|
| 681 | var div = document.createElement("div"); | 
|---|
| 682 | div.style.fontWeight="normal"; | 
|---|
| 683 | div.appendChild(document.createTextNode(x[1])); | 
|---|
| 684 | td.appendChild(div); | 
|---|
| 685 |  | 
|---|
| 686 | for (var j=0; j<institutes.length; j++) | 
|---|
| 687 | if (x[1]==institutes[j]) | 
|---|
| 688 | { | 
|---|
| 689 | div.className += " institute"; | 
|---|
| 690 | break; | 
|---|
| 691 | } | 
|---|
| 692 |  | 
|---|
| 693 | td.className += " enabled"; | 
|---|
| 694 | } | 
|---|
| 695 | }; | 
|---|
| 696 |  | 
|---|
| 697 | xmlReqAll.send(); | 
|---|
| 698 | } | 
|---|
| 699 |  | 
|---|
| 700 | var xmlReqCom = null; | 
|---|
| 701 | function requestAllComments(yy, mm) | 
|---|
| 702 | { | 
|---|
| 703 | if (xmlReqCom) | 
|---|
| 704 | xmlReqCom.abort(); | 
|---|
| 705 |  | 
|---|
| 706 | var uri = "calendar.php?comment&y="+yy+"&m="+mm; | 
|---|
| 707 | xmlReqCom = new XMLHttpRequest(); | 
|---|
| 708 | xmlReqCom.open('POST', uri, true); | 
|---|
| 709 | xmlReqCom.onload = function () | 
|---|
| 710 | { | 
|---|
| 711 | if (xmlReqCom.status!=200) | 
|---|
| 712 | { | 
|---|
| 713 | alert("ERROR - HTTP request: "+xmlReqCom.statusText+" ["+xmlReqCom.status+"]"); | 
|---|
| 714 | return; | 
|---|
| 715 | } | 
|---|
| 716 |  | 
|---|
| 717 | if (xmlReqCom.responseText<4) | 
|---|
| 718 | return; | 
|---|
| 719 |  | 
|---|
| 720 | var pos = 6; | 
|---|
| 721 |  | 
|---|
| 722 | while (pos<xmlReqCom.responseText.length) | 
|---|
| 723 | { | 
|---|
| 724 | var len = parseInt(xmlReqCom.responseText.substr(pos-6, 4), 10); | 
|---|
| 725 | var dd  = parseInt(xmlReqCom.responseText.substr(pos-2, 2), 10); | 
|---|
| 726 | var com = xmlReqCom.responseText.substr(pos, len); | 
|---|
| 727 | pos += len+6; | 
|---|
| 728 |  | 
|---|
| 729 | if (com!="") | 
|---|
| 730 | { | 
|---|
| 731 | var td = document.getElementById(mm+"-"+dd); | 
|---|
| 732 | var sp = td.firstChild.firstChild.lastChild.lastChild; | 
|---|
| 733 | sp.style.display=""; | 
|---|
| 734 | td.title=com; | 
|---|
| 735 | } | 
|---|
| 736 | } | 
|---|
| 737 | }; | 
|---|
| 738 |  | 
|---|
| 739 | xmlReqCom.send(); | 
|---|
| 740 | } | 
|---|
| 741 |  | 
|---|
| 742 | this.setDate = function() | 
|---|
| 743 | { | 
|---|
| 744 | request(this); | 
|---|
| 745 | }; | 
|---|
| 746 |  | 
|---|
| 747 | this.changeUser = function() | 
|---|
| 748 | { | 
|---|
| 749 | var sib = this.nextSibling; | 
|---|
| 750 | while (sib) | 
|---|
| 751 | { | 
|---|
| 752 | sib.style.backgroundColor = ""; | 
|---|
| 753 | sib = sib.nextSibling; | 
|---|
| 754 | } | 
|---|
| 755 |  | 
|---|
| 756 | sib = this.previousSibling; | 
|---|
| 757 | while (sib) | 
|---|
| 758 | { | 
|---|
| 759 | sib.style.backgroundColor = ""; | 
|---|
| 760 | sib = sib.previousSibling; | 
|---|
| 761 | } | 
|---|
| 762 |  | 
|---|
| 763 | this.style.backgroundColor = "yellow"; | 
|---|
| 764 |  | 
|---|
| 765 | document.getElementById("body").setAttribute("data-user", this.firstChild.textContent); | 
|---|
| 766 | }; | 
|---|
| 767 |  | 
|---|
| 768 | this.chooseDate = function() | 
|---|
| 769 | { | 
|---|
| 770 | while (document.getElementsByClassName("choosen")[0]) | 
|---|
| 771 | { | 
|---|
| 772 | var e = document.getElementsByClassName("choosen")[0]; | 
|---|
| 773 | e.title = "Click to select this date."; | 
|---|
| 774 | e.className = e.className.replace(/choosen/g, ""); | 
|---|
| 775 | e.onclick = function() { | 
|---|
| 776 | this.chooseDate(); | 
|---|
| 777 | }; | 
|---|
| 778 | } | 
|---|
| 779 |  | 
|---|
| 780 | this.className += " choosen"; | 
|---|
| 781 | this.title = "Click again to add or remove your name."; | 
|---|
| 782 |  | 
|---|
| 783 | requestComment(this.yy, this.mm, this.dd); | 
|---|
| 784 |  | 
|---|
| 785 | this.onclick = function() { | 
|---|
| 786 | this.setDate(); | 
|---|
| 787 | }; | 
|---|
| 788 | }; | 
|---|
| 789 |  | 
|---|
| 790 | this.timeTrigger = function() | 
|---|
| 791 | { | 
|---|
| 792 | var now = new Date(); | 
|---|
| 793 | var ss  = (now.getSeconds()<10)?"0"+now.getSeconds():now.getSeconds(); | 
|---|
| 794 | var mm  = (now.getMinutes()<10)?"0"+now.getMinutes():now.getMinutes(); | 
|---|
| 795 | var hh  = (now.getHours()  <10)?"0"+now.getHours()  :now.getHours(); | 
|---|
| 796 |  | 
|---|
| 797 | var kw = "KW" + this.getCalendarWeek(this.year, this.month, this.date); | 
|---|
| 798 | var str = hh+":"+mm+":"+ss+"\u00a0["+kw+"]"; | 
|---|
| 799 | return str; | 
|---|
| 800 | }; | 
|---|
| 801 |  | 
|---|
| 802 | this.getCell = function(tag, str, cssClass) | 
|---|
| 803 | { | 
|---|
| 804 | var El = document.createElement( tag ); | 
|---|
| 805 | El.appendChild(document.createTextNode( str )); | 
|---|
| 806 | if (cssClass != null) | 
|---|
| 807 | El.className = cssClass; | 
|---|
| 808 | return El; | 
|---|
| 809 | }, | 
|---|
| 810 |  | 
|---|
| 811 | this.switchMonth = function( s ) | 
|---|
| 812 | { | 
|---|
| 813 | switch (s) | 
|---|
| 814 | { | 
|---|
| 815 | case "prev": | 
|---|
| 816 | this.yy = (this.mm == 0) ? this.yy-1 : this.yy; | 
|---|
| 817 | this.mm = (this.mm == 0) ? 11        : this.mm-1; | 
|---|
| 818 | break; | 
|---|
| 819 |  | 
|---|
| 820 | case "next": | 
|---|
| 821 | this.yy = (this.mm == 11) ? this.yy+1 : this.yy; | 
|---|
| 822 | this.mm = (this.mm == 11) ? 0         : this.mm+1; | 
|---|
| 823 | break; | 
|---|
| 824 |  | 
|---|
| 825 | case "prev_year": | 
|---|
| 826 | this.yy = this.yy-1; | 
|---|
| 827 | break; | 
|---|
| 828 |  | 
|---|
| 829 | case "next_year": | 
|---|
| 830 | this.yy = this.yy+1; | 
|---|
| 831 | break; | 
|---|
| 832 |  | 
|---|
| 833 | case "current": | 
|---|
| 834 | this.yy = this.year; | 
|---|
| 835 | this.mm = this.month; | 
|---|
| 836 | break; | 
|---|
| 837 | } | 
|---|
| 838 | this.show(); | 
|---|
| 839 | } | 
|---|
| 840 |  | 
|---|
| 841 | this.getMoonPhase = function(Y, M, D) | 
|---|
| 842 | { | 
|---|
| 843 | // M=0..11 --> 1..12 | 
|---|
| 844 | M += 1; | 
|---|
| 845 |  | 
|---|
| 846 | // calculate the Julian date at 12h UT | 
|---|
| 847 | var YY = Y - Math.floor( ( 12 - M ) / 10 ); | 
|---|
| 848 | var MM = ( M + 9 ) % 12; | 
|---|
| 849 |  | 
|---|
| 850 | var K1 = Math.floor( 365.25 * ( YY + 4712 ) ); | 
|---|
| 851 | var K2 = Math.floor( 30.6 * MM + 0.5 ); | 
|---|
| 852 | var K3 = Math.floor( Math.floor( ( YY / 100 ) + 49 ) * 0.75 ) - 38; | 
|---|
| 853 |  | 
|---|
| 854 | var JD = K1 + K2 + D + 59;  // for dates in Julian calendar | 
|---|
| 855 | if ( JD > 2299160 )         // for Gregorian calendar | 
|---|
| 856 | JD = JD - K3; | 
|---|
| 857 |  | 
|---|
| 858 | // calculate moon's age in days | 
|---|
| 859 | var IP = ( ( JD - 2451550.1 ) / 29.530588853 ) % 1; | 
|---|
| 860 |  | 
|---|
| 861 | return IP; | 
|---|
| 862 |  | 
|---|
| 863 | // Moon's age | 
|---|
| 864 | //var AG = IP*29.53; | 
|---|
| 865 | } | 
|---|
| 866 |  | 
|---|
| 867 | this.getMoonPhaseStr = function(IP) | 
|---|
| 868 | { | 
|---|
| 869 | var phase = " ("+(100-Math.abs(IP-0.5)*200).toPrecision(2)+"%)"; | 
|---|
| 870 |  | 
|---|
| 871 | if (IP*16 < 1) return "New moon" + phase; | 
|---|
| 872 | if (IP*16 < 3) return "Evening crescent" + phase; | 
|---|
| 873 | if (IP*16 < 5) return "First quarter" + phase; | 
|---|
| 874 | if (IP*16 < 7) return "Waxing gibbous" + phase; | 
|---|
| 875 | if (IP*16 < 9) return "Full moon" + phase; | 
|---|
| 876 | if (IP*16 <11) return "Waning gibbous" + phase; | 
|---|
| 877 | if (IP*16 <13) return "Last quarter" + phase; | 
|---|
| 878 | if (IP*16 <15) return "Morning crescent" + phase; | 
|---|
| 879 |  | 
|---|
| 880 | return "New moon"+phase; | 
|---|
| 881 | } | 
|---|
| 882 | } | 
|---|
| 883 |  | 
|---|
| 884 | var DOMContentLoaded = false; | 
|---|
| 885 | function addContentLoadListener (func) | 
|---|
| 886 | { | 
|---|
| 887 | if (document.addEventListener) | 
|---|
| 888 | { | 
|---|
| 889 | var DOMContentLoadFunction = function () | 
|---|
| 890 | { | 
|---|
| 891 | window.DOMContentLoaded = true; | 
|---|
| 892 | func(); | 
|---|
| 893 | }; | 
|---|
| 894 |  | 
|---|
| 895 | document.addEventListener("DOMContentLoaded", DOMContentLoadFunction, false); | 
|---|
| 896 | } | 
|---|
| 897 |  | 
|---|
| 898 | var oldfunc = (window.onload || new Function()); | 
|---|
| 899 |  | 
|---|
| 900 | window.onload = function () | 
|---|
| 901 | { | 
|---|
| 902 | if (!window.DOMContentLoaded) | 
|---|
| 903 | { | 
|---|
| 904 | oldfunc(); | 
|---|
| 905 | func(); | 
|---|
| 906 | } | 
|---|
| 907 | }; | 
|---|
| 908 | } | 
|---|
| 909 |  | 
|---|
| 910 | addContentLoadListener( function() { | 
|---|
| 911 | new CalendarJS().init("calendar"); | 
|---|
| 912 | //new CalendarJS().init("calendar", new Date(2009, 1, 15)); | 
|---|
| 913 | } ); | 
|---|