1/************************************************************************************************************ 2JS Calendar 3Copyright (C) September 2006 DTHMLGoodies.com, Alf Magne Kalleland 4 5This library is free software; you can redistribute it and/or 6modify it under the terms of the GNU Lesser General Public 7License as published by the Free Software Foundation; either 8version 2.1 of the License, or (at your option) any later version. 9 10This library is distributed in the hope that it will be useful, 11but WITHOUT ANY WARRANTY; without even the implied warranty of 12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13Lesser General Public License for more details. 14 15You should have received a copy of the GNU Lesser General Public 16License along with this library; if not, write to the Free Software 17Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 19Dhtmlgoodies.com., hereby disclaims all copyright interest in this script 20written by Alf Magne Kalleland. 21 22Alf Magne Kalleland, 2006 23Owner of DHTMLgoodies.com 24 25************************************************************************************************************/ 26 27/* Update log: 28(C) www.dhtmlgoodies.com, September 2005 29 30Version 1.2, November 8th - 2005 - Added <iframe> background in IE 31Version 1.3, November 12th - 2005 - Fixed top bar position in Opera 7 32Version 1.4, December 28th - 2005 - Support for Spanish and Portuguese 33Version 1.5, January 18th - 2006 - Fixed problem with next-previous buttons after a month has been selected from dropdown 34Version 1.6, February 22nd - 2006 - Added variable which holds the path to images. 35 Format todays date at the bottom by use of the todayStringFormat variable 36 Pick todays date by clicking on todays date at the bottom of the calendar
37Version 2.0 May, 25th - 2006 - Added support for time(hour and minutes) and changing year and hour when holding mouse over + and - options. (i.e. instead of click) 38Version 2.1 July, 2nd - 2006 - Added support for more date formats(example: d.m.yyyy, i.e. one letter day and month). 39 40// Modifications by Gregg Buntin 41Version 2.1.1 8/9/2007 gfb - Add switch to turn off Year Span Selection 42 This allows me to only have this year & next year in the drop down 43 44Version 2.1.2 8/30/2007 gfb - Add switch to start week on Sunday 45 Add switch to turn off week number display 46 Fix bug when using on an HTTPS page 47 48*/ 49var turnOffYearSpan = false; // true = Only show This Year and Next, false = show +/- 5 years 50var weekStartsOnSunday = false; // true = Start the week on Sunday, false = start the week on Monday 51var showWeekNumber = false; // true = show week number, false = do not show week number 52 53var languageCode = 'tr'; // Possible values: en,ge,no,nl,es,pt-br,fr,tr 54 // en = english, ge = german, no = norwegian,nl = dutch, es = spanish, pt-br = portuguese, fr = french, da = danish, hu = hungarian(Use UTF-8 doctype for hungarian), tr = Türkçe 55 56var calendar_display_time = true; 57 58// Format of current day at the bottom of the calendar 59// [todayString] = the value of todayString 60// [dayString] = day of week (examle: mon, tue, wed...) 61// [UCFdayString] = day of week (examle: Mon, Tue, Wed...) ( First letter in uppercase) 62// [day] = Day of month, 1..31 63// [monthString] = Name of current month 64// [year] = Current year 65var todayStringFormat = '[todayString] [UCFdayString]. [day]. [monthString] [year]'; 66var pathToImages = DHTMLGOODIES_CALENDER_ROOT + 'images/'; // Relative to your HTML file 67 68var speedOfSelectBoxSliding = 200; // Milliseconds between changing year and hour when holding mouse over "-" and "+" - lower value = faster 69var intervalSelectBox_minutes = 5; // Minute select box - interval between each option (5 = default) 70 71var calendar_offsetTop = 0; // Offset - calendar placement - You probably have to modify this value if you're not using a strict doctype 72var calendar_offsetLeft = 0; // Offset - calendar placement - You probably have to modify this value if you're not using a strict doctype 73var calendarDiv = false; 74 75var MSIE = false; 76var Opera = false; 77if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)MSIE=true; 78if(navigator.userAgent.indexOf('Opera')>=0)Opera=true; 79 80 81switch(languageCode){ 82 case "tr": /* Türkçe */ 83 var monthArray = ['Ocak','Åubat','Mart','Nisan','Mayıs','Haziran','Temmuz','AÄustos','Eylül','Ekim','Kasım','Aralık']; 84 var monthArrayShort = ['Ock','Åub','Mar','Nis','May','Haz','Tem','AÄu','Eyl','Ekm','Kas','Ara']; 85 var dayArray = ['Pzt','Sal','Ãar','Per','Cum','Cts','Paz']; 86 var weekString = 'Hafta'; 87 var todayString = 'Bugün'; 88 break; 89 90 91 case "en": /* English */ 92 var monthArray = ['January','February','March','April','May','June','July','August','September','October','November','December']; 93 var monthArrayShort = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; 94 var dayArray = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun']; 95 var weekString = 'Week'; 96 var todayString = ''; 97 break; 98 case "ge": /* German */ 99 var monthArray = ['Januar','Februar','M�rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember']; 100 var monthArrayShort = ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez']; 101 var dayArray = ['Mon','Die','Mit','Don','Fre','Sam','Son']; 102 var weekString = 'Woche'; 103 var todayString = 'Heute'; 104 break; 105 case "no": /* Norwegian */ 106 var monthArray = ['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember']; 107 var monthArrayShort = ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','N
107ov','Des']; 108 var dayArray = ['Man','Tir','Ons','Tor','Fre','Lør','Søn']; 109 var weekString = 'Uke'; 110 var todayString = 'Dagen i dag er'; 111 break; 112 case "nl": /* Dutch */ 113 var monthArray = ['Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December']; 114 var monthArrayShort = ['Jan','Feb','Mar','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Dec']; 115 var dayArray = ['Ma','Di','Wo','Do','Vr','Za','Zo']; 116 var weekString = 'Week'; 117 var todayString = 'Vandaag'; 118 break; 119 case "es": /* Spanish */ 120 var monthArray = ['Enero','Febrero','Marzo','April','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre']; 121 var monthArrayShort =['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic']; 122 var dayArray = ['Lun','Mar','Mie','Jue','Vie','Sab','Dom']; 123 var weekString = 'Semana'; 124 var todayString = 'Hoy es'; 125 break; 126 case "pt-br": /* Brazilian portuguese (pt-br) */ 127 var monthArray = ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro']; 128 var monthArrayShort = ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez']; 129 var dayArray = ['Seg','Ter','Qua','Qui','Sex','Sáb','Dom']; 130 var weekString = 'Sem.'; 131 var todayString = 'Hoje é'; 132 break; 133 case "fr": /* French */ 134 var monthArray = ['Janvier','F�vrier','Mars','Avril','Mai','Juin','Juillet','Ao�t','Septembre','Octobre','Novembre','D�cembre']; 135 var monthArrayShort = ['Jan','Fev','Mar','Avr','Mai','Jun','Jul','Aou','Sep','Oct','Nov','Dec']; 136 var dayArray = ['Lun','Mar','Mer','Jeu','Ven','Sam','Dim']; 137 var weekString = 'Sem'; 138 var todayString = "Aujourd'hui"; 139 break; 140 case "da": /*Danish*/ 141 var monthArray = ['januar','februar','marts','april','maj','juni','juli','august','september','oktober','november','december']; 142 var monthArrayShort = ['jan','feb','mar','apr','maj','jun','jul','aug','sep','okt','nov','dec']; 143 var dayArray = ['man','tirs','ons','tors','fre','lør','søn']; 144 var weekString = 'Uge'; 145 var todayString = 'I dag er den'; 146 break; 147 case "hu": /* Hungarian - Remember to use UTF-8 encoding, i.e. the <meta> tag */ 148 var monthArray = ['Január','Február','Március','�?prilis','Május','Június','Július','Augusztus','Szeptember','Október','November','December']; 149 var monthArrayShort = ['Jan','Feb','Márc','�?pr','Máj','Jún','Júl','Aug','Szep','Okt','Nov','Dec']; 150 var dayArray = ['Hé','Ke','Sze','Cs','Pé','Szo','Vas']; 151 var weekString = 'Hét'; 152 var todayString = 'Mai nap'; 153 break; 154 case "it": /* Italian*/ 155 var monthArray = ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','N
155ovembre','Dicembre']; 156 var monthArrayShort = ['Gen','Feb','Mar','Apr','Mag','Giu','Lugl','Ago','Set','Ott','Nov','Dic']; 157 var dayArray = ['Lun',';Mar','Mer','Gio','Ven','Sab','Dom']; 158 var weekString = 'Settimana'; 159 var todayString = 'Oggi è il'; 160 break; 161 case "sv": /* Swedish */ 162 var monthArray = ['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December']; 163 var monthArrayShort = ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec']; 164 var dayArray = ['Mån','Tis','Ons','Tor','Fre','Lör','Sön']; 165 var weekString = 'Vecka'; 166 var todayString = 'Idag är det den'; 167 break; 168 case "cz": /* Czech */ 169 var monthArray = ['leden','únor','březen','duben','květen','červen','červenec','srpen','září','říjen','listopad','prosinec']; 170 var monthArrayShort = ['led','ún','bř','dub','kvě','čer','čer-ec','srp','zář','říj','list','pros']; 171 var dayArray = ['Pon','Út','St','Čt','Pá','So','Ne']; 172 var weekString = 'týden'; 173 var todayString = ''; 174 break; 175} 176 177if (weekStartsOnSunday) { 178 var tempDayName = dayArray[6]; 179 for(var theIx = 6; theIx > 0; theIx--) { 180 dayArray[theIx] = dayArray[theIx-1]; 181 } 182 dayArray[0] = tempDayName; 183} 184 185 186 187var daysInMonthArray = [31,28,31,30,31,30,31,31,30,31,30,31]; 188var currentMonth; 189var currentYear; 190var currentHour; 191var currentMinute; 192var calendarContentDiv; 193var returnDateTo; 194var returnFormat; 195var activeSelectBoxMonth; 196var activeSelectBoxYear; 197var activeSelectBoxHour; 198var activeSelectBoxMinute; 199 200var iframeObj = false; 201//// fix for EI frame problem on time dropdowns 09/30/2006 202var iframeObj2 =false; 203function EIS_FIX_EI1(where2fixit) 204{ 205 206 if(!iframeObj2)return; 207 iframeObj2.style.display = 'block'; 208 iframeObj2.style.height =document.getElementById(where2fixit).offsetHeight+1; 209 iframeObj2.style.width=document.getElementById(where2fixit).offsetWidth; 210 iframeObj2.style.left=getleftPos(document.getElementById(where2fixit))+1-calendar_offsetLeft; 211 iframeObj2.style.top=getTopPos(document.getElementById(where2fixit))-document.getElementById(where2fixit).offsetHeight-calendar_offsetTop; 212} 213 214function EIS_Hide_Frame() 215{ if(iframeObj2)iframeObj2.style.display = 'none';} 216//// fix for EI frame problem on time dropdowns 09/30/2006 217var returnDateToYear; 218var returnDateToMonth; 219var returnDateToDay; 220var returnDateToHour; 221var returnDateToMinute; 222 223var inputYear; 224var inputMonth; 225var inputDay; 226var inputHour; 227var inputMinute; 228var calendarDisplayTime = false; 229 230var selectBoxHighlightColor = '#D60808'; // Highlight color of select boxes 231var selectBoxRolloverBgColor = '#E2EBED'; // Background color on drop down lists(rollover) 232 233var selectBoxMovementInProgress = false; 234var activeSelectBox = false; 235 236function cancelCalendarEvent() 237{ 238 return false; 239} 240function isLeapYear(inputYear) 241{ 242 if(inputYear%400==0||(inputYear%4==0&&inputYear%100!=0)) return true; 243 return false; 244 245} 246var activeSelectBoxMonth = false; 247var activeSelectBoxDirection = false; 248 249function highlightMonthYear() 250{ 251 if(activeSelectBoxMonth)activeSelectBoxMonth.className=''; 252 activeSelectBox = this; 253 254 255 if(this.className=='monthYearActive'){ 256 this.className=''; 257 }else{ 258 this.className = 'monthYearActive'; 259 activeSelectBoxMonth = this; 260 } 261 262 if(this.innerHTML.indexOf('-')>=0 || this.innerHTML.indexOf('+')>=0){ 263 if(this.className=='monthYearActive') 264 selectBoxMovementInProgress = true; 265 else 266 selectBoxMovementInProgress = false; 267 if(this.innerHTML.indexOf('-')>=0)activeSelectBoxDirection = -1; else activeSelectBoxDirection = 1; 268 269 }else selectBoxMovementInProgress = false; 270 271} 272 273function showMonthDropDown() 274{ 275 if(document.getElementById('monthDropDown').style.display=='block'){ 276 document.getElementById('monthDropDown').style.display='none'; 277 //// fix for EI frame problem on time dropdowns 09/30/2006 278 EIS_Hide_Frame(); 279 }else{ 280 document.getElementById('monthDropDown').style.display='block'; 281 document.getElementById('yearDropDown').style.display='none'; 282 document.getElementById('hourDropDown').style.display='none'; 283 document.getElementById('minuteDropDown').style.display='none'; 284 if (MSIE) 285 { EIS_FIX_EI1('monthDropDown')} 286 //// fix for EI frame problem on time dropdowns 09/30/2006 287 288 } 289} 290 291function showYearDropDown() 292{ 293 if(document.getElementById('yearDropDown').style.display=='block'){ 294 document.getElementById('yearDropDown').style.display='none'; 295 //// fix for EI frame problem on time dropdowns 09/30/2006 296 EIS_Hide_Frame(); 297 }else{ 298 document.getElementById('yearDropDown').style.display='block'; 299 document.getElementById('monthDropDown').style.display='none'; 300 document.getElementById('hourDropDown').style.display='none'; 301 document.getElementById('minuteDropDown').style.display='none'; 302 if (MSIE) 303 { EIS_FIX_EI1('yearDropDown')} 304 //// fix for EI frame problem on time dropdowns 09/30/2006 305 306 } 307 308} 309function showHourDropDown() 310{ 311 if(document.getElementById('hourDropDown').style.display=='block'){ 312 document.getElementById('hourDropDown').style.display='none'; 313 //// fix for EI frame problem on time dropdowns 09/30/2006 314 EIS_Hide_Frame(); 315 }else{ 316 document.getElementById('hourDropDown').style.display='block'; 317 document.getElementById('monthDropDown').style.display='none'; 318 document.getElementById('yearDropDown').style.display='none'; 319 document.getElementById('minuteDropDown').style.display='none'; 320 if (MSIE) 321 { EIS_FIX_EI1('hourDropDown')} 322 //// fix for EI frame problem on time dropdowns 09/30/2006 323 } 324 325} 326function showMinuteDropDown() 327{ 328 if(document.getElementById('minuteDropDown').style.display=='block'){ 329 document.getElementById('minuteDropDown').style.display='none'; 330 //// fix for EI frame problem on time dropdowns 09/30/2006 331 EIS_Hide_Frame(); 332 }else{ 333 document.getElementById('minuteDropDown').style.display='block'; 334 document.getElementById('monthDropDown').style.display='none'; 335 document.getElementById('yearDropDown').style.display='none'; 336 document.getElementById('hourDropDown').style.display='none'; 337 if (MSIE) 338 { EIS_FIX_EI1('minuteDropDown')} 339 //// fix for EI frame problem on time dropdowns 09/30/2006 340 } 341 342} 343 344function selectMonth() 345{ 346 document.getElementById('calendar_month_txt').innerHTML = this.innerHTML 347 currentMonth = this.id.replace(/[^\d]/g,''); 348 349 document.getElementById('monthDropDown').style.display='none'; 350 //// fix for EI frame problem on time dropdowns 09/30/2006 351 EIS_Hide_Frame(); 352 for(var no=0;no<monthArray.length;no++){ 353 document.getElementById('monthDiv_'+no).style.color=''; 354 } 355 this.style.color = selectBoxHighlightColor; 356 activeSelectBoxMonth = this; 357 writeCalendarContent(); 358 359} 360 361function selectHour() 362{ 363 document.getElementById('calendar_hour_txt').innerHTML = this.innerHTML 364 currentHour = this.innerHTML.replace(/[^\d]/g,''); 365 document.getElementById('hourDropDown').style.display='none'; 366 //// fix for EI frame problem on time dropdowns 09/30/2006 367 EIS_Hide_Frame(); 368 if(activeSelectBoxHour){ 369 activeSelectBoxHour.style.color=''; 370 } 371 activeSelectBoxHour=this; 372 this.style.color = selectBoxHighlightColor; 373} 374 375function selectMinute() 376{ 377 document.getElementById('calendar_minute_txt').innerHTML = this.innerHTML 378 currentMinute = this.innerHTML.replace(/[^\d]/g,''); 379 document.getElementById('minuteDropDown').style.display='none'; 380 //// fix for EI frame problem on time dropdowns 09/30/2006 381 EIS_Hide_Frame(); 382 if(activeSelectBoxMinute){ 383 activeSelectBoxMinute.style.color=''; 384 } 385 activeSelectBoxMinute=this; 386 this.style.color = selectBoxHighlightColor; 387} 388 389 390function selectYear() 391{ 392 document.getElementById('calendar_year_txt').innerHTML = this.innerHTML 393 currentYear = this.innerHTML.replace(/[^\d]/g,''); 394 document.getElementById('yearDropDown').style.display='none'; 395 //// fix for EI frame problem on time dropdowns 09/30/2006 396 EIS_Hide_Frame(); 397 if(activeSelectBoxYear){ 398 activeSelectBoxYear.style.color=''; 399 } 400 activeSelectBoxYear=this; 401 this.style.color = selectBoxHighlightColor; 402 writeCalendarContent(); 403 404} 405 406function switchMonth() 407{ 408 if(this.src.indexOf('left')>=0){ 409 currentMonth=currentMonth-1;; 410 if(currentMonth<0){ 411 currentMonth=11; 412 currentYear=currentYear-1; 413 } 414 }else{ 415 currentMonth=currentMonth+1;; 416 if(currentMonth>11){ 417 currentMonth=0; 418 currentYear=currentYear/1+1; 419 } 420 } 421 422 writeCalendarContent(); 423 424 425} 426 427function createMonthDiv(){ 428 var div = document.createElement('DIV'); 429 div.className='monthYearPicker'; 430 div.id = 'monthPicker'; 431 432 for(var no=0;no<monthArray.length;no++){ 433 var subDiv = document.createElement('DIV'); 434 subDiv.innerHTML = monthArray[no]; 435 subDiv.onmouseover = highlightMonthYear; 436 subDiv.onmouseout = highlightMonthYear; 437 subDiv.onclick = selectMonth; 438 subDiv.id = 'monthDiv_' + no; 439 subDiv.style.width = '56px'; 440 subDiv.onselectstart = cancelCalendarEvent; 441 div.appendChild(subDiv); 442 if(currentMonth && currentMonth==no){ 443 subDiv.style.color = selectBoxHighlightColor; 444 activeSelectBoxMonth = subDiv; 445 } 446 447 } 448 return div; 449 450} 451 452function changeSelectBoxYear(e,inputObj) 453{ 454 if(!inputObj)inputObj =this; 455 var yearItems = inputObj.parentNode.getElementsByTagName('DIV'); 456 if(inputObj.innerHTML.indexOf('-')>=0){ 457 var startYear = yearItems[1].innerHTML/1 -1; 458 if(activeSelectBoxYear){ 459 activeSelectBoxYear.style.color=''; 460 } 461 }else{ 462 var startYear = yearItems[1].innerHTML/1 +1; 463 if(activeSelectBoxYear){ 464 activeSelectBoxYear.style.color=''; 465 466 } 467 } 468 469 for(var no=1;no<yearItems.length-1;no++){ 470 yearItems[no].innerHTML = startYear+no-1; 471 yearItems[no].id = 'yearDiv' + (startYear/1+no/1-1); 472 473 } 474 if(activeSelectBoxYear){ 475 activeSelectBoxYear.style.color=''; 476 if(document.getElementById('yearDiv'+currentYear)){ 477 activeSelectBoxYear = document.getElementById('yearDiv'+currentYear); 478 activeSelectBoxYear.style.color=selectBoxHighlightColor;; 479 } 480 } 481} 482function changeSelectBoxHour(e,inputObj) 483{ 484 if(!inputObj)inputObj = this; 485 486 var hourItems = inputObj.parentNode.getElementsByTagName('DIV'); 487 if(inputObj.innerHTML.indexOf('-')>=0){ 488 var startHour = hourItems[1].innerHTML/1 -1; 489 if(startHour<0)startHour=0; 490 if(activeSelectBoxHour){ 491 activeSelectBoxHour.style.color=''; 492 } 493 }else{ 494 var startHour = hourItems[1].innerHTML/1 +1; 495 if(startHour>14)startHour = 14; 496 if(activeSelectBoxHour){ 497 activeSelectBoxHour.style.color=''; 498 499 } 500 } 501 var prefix = ''; 502 for(var no=1;no<hourItems.length-1;no++){ 503 if((startHour/1 + no/1) < 11)prefix = '0'; else prefix = ''; 504 hourItems[no].innerHTML = prefix + (startHour+no-1); 505 506 hourItems[no].id = 'hourDiv' + (startHour/1+no/1-1); 507 508 } 509 if(activeSelectBoxHour){ 510 activeSelectBoxHour.style.color=''; 511 if(document.getElementById('hourDiv'+currentHour)){ 512 activeSelectBoxHour = document.getElementById('hourDiv'+currentHour); 513 activeSelectBoxHour.style.color=selectBoxHighlightColor;; 514 } 515 } 516} 517 518function updateYearDiv() 519{ 520 var yearSpan = 5; 521 if (turnOffYearSpan) { 522 yearSpan = 0; 523 } 524 var div = document.getElementById('yearDropDown'); 525 var yearItems = div.getElementsByTagName('DIV'); 526 for(var no=1;no<yearItems.length-1;no++){ 527 yearItems[no].innerHTML = currentYear/1 -yearSpan + no; 528 if(currentYear==(currentYear/1 -yearSpan + no)){ 529 yearItems[no].style.color = selectBoxHighlightColor; 530 activeSelectBoxYear = yearItems[no]; 531 }else{ 532 yearItems[no].style.color = ''; 533 } 534 } 535} 536 537function updateMonthDiv() 538{ 539 for(no=0;no<12;no++){ 540 document.getElementById('monthDiv_' + no).style.color = ''; 541 } 542 document.getElementById('monthDiv_' + currentMonth).style.color = selectBoxHighlightColor; 543 activeSelectBoxMonth = document.getElementById('monthDiv_' + currentMonth); 544} 545 546 547function updateHourDiv() 548{ 549 var div = document.getElementById('hourDropDown'); 550 var hourItems = div.getElementsByTagName('DIV'); 551 552 var addHours = 0; 553 if((currentHour/1 -6 + 1)<0){ 554 addHours = (currentHour/1 -6 + 1)*-1; 555 } 556 for(var no=1;no<hourItems.length-1;no++){ 557 var prefix=''; 558 if((currentHour/1 -6 + no + addHours) < 10)prefix='0'; 559 hourItems[no].innerHTML = prefix + (currentHour/1 -6 + no + addHours); 560 if(currentHour==(currentHour/1 -6 + no)){ 561 hourItems[no].style.color = selectBoxHighlightColor; 562 activeSelectBoxHour = hourItems[no]; 563 }else{ 564 hourItems[no].style.color = ''; 565 } 566 } 567} 568 569function updateMinuteDiv() 570{ 571 for(no=0;no<60;no+=intervalSelectBox_minutes){ 572 var prefix = ''; 573 if(no<10)prefix = '0'; 574
575 document.getElementById('minuteDiv_' + prefix + no).style.color = ''; 576 } 577 if(document.getElementById('minuteDiv_' + currentMinute)){ 578 document.getElementById('minuteDiv_' + currentMinute).style.color = selectBoxHighlightColor; 579 activeSelectBoxMinute = document.getElementById('minuteDiv_' + currentMinute); 580 } 581} 582 583 584 585function createYearDiv() 586{ 587 588 if(!document.getElementById('yearDropDown')){ 589 var div = document.createElement('DIV'); 590 div.className='monthYearPicker'; 591 }else{ 592 var div = document.getElementById('yearDropDown'); 593 var subDivs = div.getElementsByTagName('DIV'); 594 for(var no=0;no<subDivs.length;no++){ 595 subDivs[no].parentNode.removeChild(subDivs[no]); 596 } 597 } 598 599 600 var d = new Date(); 601 if(currentYear){ 602 d.setFullYear(currentYear); 603 } 604 605 var startYear = d.getFullYear()/1 - 5; 606 607 var yearSpan = 10; 608 if (! turnOffYearSpan) { 609 var subDiv = document.createElement('DIV'); 610 subDiv.innerHTML = ' - '; 611 subDiv.onclick = changeSelectBoxYear; 612 subDiv.onmouseover = highlightMonthYear; 613 subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;}; 614 subDiv.onselectstart = cancelCalendarEvent; 615 div.appendChild(subDiv); 616 } else { 617 startYear = d.getFullYear()/1 - 0; 618 yearSpan = 2; 619 } 620 621 for(var no=startYear;no<(startYear+yearSpan);no++){ 622 var subDiv = document.createElement('DIV'); 623 subDiv.innerHTML = no; 624 subDiv.onmouseover = highlightMonthYear; 625 subDiv.onmouseout = highlightMonthYear; 626 subDiv.onclick = selectYear; 627 subDiv.id = 'yearDiv' + no; 628 subDiv.onselectstart = cancelCalendarEvent; 629 div.appendChild(subDiv); 630 if(currentYear && currentYear==no){ 631 subDiv.style.color = selectBoxHighlightColor; 632 activeSelectBoxYear = subDiv; 633 } 634 } 635 if (! turnOffYearSpan) { 636 var subDiv = document.createElement('DIV'); 637 subDiv.innerHTML = ' + '; 638 subDiv.onclick = changeSelectBoxYear; 639 subDiv.onmouseover = highlightMonthYear; 640 subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;}; 641 subDiv.onselectstart = cancelCalendarEvent; 642 div.appendChild(subDiv); 643 } 644 return div; 645} 646 647/* This function creates the hour div at the bottom bar */ 648 649function slideCalendarSelectBox() 650{ 651 if(selectBoxMovementInProgress){ 652 if(activeSelectBox.parentNode.id=='hourDropDown'){ 653 changeSelectBoxHour(false,activeSelectBox); 654 } 655 if(activeSelectBox.parentNode.id=='yearDropDown'){ 656 changeSelectBoxYear(false,activeSelectBox); 657 } 658 659 } 660 setTimeout('slideCalendarSelectBox()',speedOfSelectBoxSliding); 661 662} 663 664function createHourDiv() 665{ 666 if(!document.getElementById('hourDropDown')){ 667 var div = document.createElement('DIV'); 668 div.className='monthYearPicker'; 669 }else{ 670 var div = document.getElementById('hourDropDown'); 671 var subDivs = div.getElementsByTagName('DIV'); 672 for(var no=0;no<subDivs.length;no++){ 673 subDivs[no].parentNode.removeChild(subDivs[no]); 674 } 675 } 676 677 if(!currentHour)currentHour=0; 678 var startHour = currentHour/1; 679 if(startHour>14)startHour=14; 680 681 var subDiv = document.createElement('DIV'); 682 subDiv.innerHTML = ' - '; 683 subDiv.onclick = changeSelectBoxHour; 684 subDiv.onmouseover = highlightMonthYear; 685 subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;}; 686 subDiv.onselectstart = cancelCalendarEvent; 687 div.appendChild(subDiv); 688 689 for(var no=startHour;no<startHour+10;no++){ 690 var prefix = ''; 691 if(no/1<10)prefix='0'; 692 var subDiv = document.createElement('DIV'); 693 subDiv.innerHTML = prefix + no; 694 subDiv.onmouseover = highlightMonthYear; 695 subDiv.onmouseout = highlightMonthYear; 696 subDiv.onclick = selectHour; 697 subDiv.id = 'hourDiv' + no; 698 subDiv.onselectstart = cancelCalendarEvent; 699 div.appendChild(subDiv); 700 if(currentYear && currentYear==no){ 701 subDiv.style.color = selectBoxHighlightColor; 702 activeSelectBoxYear = subDiv; 703 } 704 } 705 var subDiv = document.createElement('DIV'); 706 subDiv.innerHTML = ' + '; 707 subDiv.onclick = changeSelectBoxHour; 708 subDiv.onmouseover = highlightMonthYear; 709 subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;}; 710 subDiv.onselectstart = cancelCalendarEvent; 711 div.appendChild(subDiv); 712 713 return div; 714} 715/* This function creates the minute div at the bottom bar */ 716 717function createMinuteDiv() 718{ 719 if(!document.getElementById('minuteDropDown')){ 720 var div = document.createElement('DIV'); 721 div.className='monthYearPicker'; 722 }else{ 723 var div = document.getElementById('minuteDropDown'); 724 var subDivs = div.getElementsByTagName('DIV'); 725 for(var no=0;no<subDivs.length;no++){ 726 subDivs[no].parentNode.removeChild(subDivs[no]); 727 } 728 } 729 var startMinute = 0; 730 var prefix = ''; 731 for(var no=startMinute;no<60;no+=intervalSelectBox_minutes){ 732 733 if(no<10)prefix='0'; else prefix = ''; 734 var subDiv = document.createElement('DIV');
735 subDiv.innerHTML = prefix + no; 736 subDiv.onmouseover = highlightMonthYear; 737 subDiv.onmouseout = highlightMonthYear; 738 subDiv.onclick = selectMinute; 739 subDiv.id = 'minuteDiv_' + prefix + no; 740 subDiv.onselectstart = cancelCalendarEvent; 741 div.appendChild(subDiv); 742 if(currentYear && currentYear==no){ 743 subDiv.style.color = selectBoxHighlightColor; 744 activeSelectBoxYear = subDiv; 745 } 746 } 747 return div; 748} 749 750function highlightSelect() 751{ 752 753 if(this.className=='selectBoxTime'){ 754 this.className = 'selectBoxTimeOver'; 755 this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_time_over.gif'; 756 }else if(this.className=='selectBoxTimeOver'){ 757 this.className = 'selectBoxTime'; 758 this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_time.gif'; 759 } 760 761 if(this.className=='selectBox'){ 762 this.className = 'selectBoxOver'; 763 this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_over.gif'; 764 }else if(this.className=='selectBoxOver'){ 765 this.className = 'selectBox'; 766 this.getElementsByTagName('IMG')[0].src = pathToImages + 'down.gif'; 767 } 768 769} 770 771function highlightArrow() 772{ 773 if(this.src.indexOf('over')>=0){ 774 if(this.src.indexOf('left')>=0)this.src = pathToImages + 'left.gif'; 775 if(this.src.indexOf('right')>=0)this.src = pathToImages + 'right.gif'; 776 }else{ 777 if(this.src.indexOf('left')>=0)this.src = pathToImages + 'left_over.gif'; 778 if(this.src.indexOf('right')>=0)this.src = pathToImages + 'right_over.gif'; 779 } 780} 781 782function highlightClose() 783{ 784 if(this.src.indexOf('over')>=0){ 785 this.src = pathToImages + 'close.gif'; 786 }else{ 787 this.src = pathToImages + 'close_over.gif'; 788 } 789 790} 791 792function closeCalendar(){ 793 794 document.getElementById('yearDropDown').style.display='none'; 795 document.getElementById('monthDropDown').style.display='none'; 796 document.getElementById('hourDropDown').style.display='none'; 797 document.getElementById('minuteDropDown').style.display='none'; 798 799 calendarDiv.style.display='none'; 800 if(iframeObj){ 801 iframeObj.style.display='none'; 802 //// //// fix for EI frame problem on time dropdowns 09/30/2006 803 EIS_Hide_Frame();} 804 if(activeSelectBoxMonth)activeSelectBoxMonth.className=''; 805 if(activeSelectBoxYear)activeSelectBoxYear.className=''; 806 807 808} 809 810function writeTopBar() 811{ 812 813 var topBar = document.createElement('DIV'); 814 topBar.className = 'topBar'; 815 topBar.id = 'topBar'; 816 calendarDiv.appendChild(topBar); 817 818 // Left arrow 819 var leftDiv = document.createElement('DIV'); 820 leftDiv.style.marginRight = '1px'; 821 var img = document.createElement('IMG'); 822 img.src = pathToImages + 'left.gif'; 823 img.onmouseover = highlightArrow; 824 img.onclick = switchMonth; 825 img.onmouseout = highlightArrow; 826 leftDiv.appendChild(img); 827 topBar.appendChild(leftDiv); 828 if(Opera)leftDiv.style.width = '16px'; 829 830 // Right arrow 831 var rightDiv = document.createElement('DIV'); 832 rightDiv.style.marginRight = '1px'; 833 var img = document.createElement('IMG'); 834 img.src = pathToImages + 'right.gif'; 835 img.onclick = switchMonth; 836 img.onmouseover = highlightArrow; 837 img.onmouseout = highlightArrow; 838 rightDiv.appendChild(img); 839 if(Opera)rightDiv.style.width = '16px'; 840 topBar.appendChild(rightDiv); 841 842 843 // Month selector 844 var monthDiv = document.createElement('DIV'); 845 monthDiv.id = 'monthSelect'; 846 monthDiv.onmouseover = highlightSelect; 847 monthDiv.onmouseout = highlightSelect; 848 monthDiv.onclick = showMonthDropDown; 849 var span = document.createElement('SPAN'); 850 span.innerHTML = monthArray[currentMonth]; 851 span.id = 'calendar_month_txt'; 852 monthDiv.appendChild(span); 853 854 var img = document.createElement('IMG'); 855 img.src = pathToImages + 'down.gif'; 856 img.style.position = 'absolute'; 857 img.style.right = '0px'; 858 monthDiv.appendChild(img); 859 monthDiv.className = 'selectBox'; 860 if(Opera){ 861 img.style.cssText = 'float:right;position:relative'; 862 img.style.position = 'relative'; 863 img.style.styleFloat = 'right'; 864 } 865 topBar.appendChild(monthDiv); 866 867 var monthPicker = createMonthDiv(); 868 monthPicker.style.left = '37px'; 869 monthPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px'; 870 monthPicker.style.width ='60px'; 871 monthPicker.id = 'monthDropDown'; 872 873 calendarDiv.appendChild(monthPicker); 874 875 // Year selector 876 var yearDiv = document.createElement('DIV'); 877 yearDiv.onmouseover = highlightSelect; 878 yearDiv.onmouseout = highlightSelect; 879 yearDiv.onclick = showYearDropDown; 880 var span = document.createElement('SPAN'); 881 span.innerHTML = currentYear; 882 span.id = 'calendar_year_txt'; 883 yearDiv.appendChild(span); 884 topBar.appendChild(yearDiv); 885 886 var img = document.createElement('IMG'); 887 img.src = pathToImages + 'down.gif'; 888 yearDiv.appendChild(img); 889 yearDiv.className = 'selectBox'; 890 891 if(Opera){ 892 yearDiv.style.width = '50px'; 893 img.style.cssText = 'float:right'; 894 img.style.position = 'relative'; 895 img.style.styleFloat = 'right'; 896 } 897 898 var yearPicker = createYearDiv(); 899 yearPicker.style.left = '113px'; 900 yearPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px'; 901 yearPicker.style.width = '35px'; 902 yearPicker.id = 'yearDropDown'; 903 calendarDiv.appendChild(yearPicker); 904 905 906 var img = document.createElement('IMG'); 907 img.src = pathToImages + 'close.gif'; 908 img.style.styleFloat = 'right'; 909 img.onmouseover = highlightClose; 910 img.onmouseout = highlightClose;
911 img.onclick = closeCalendar; 912 topBar.appendChild(img); 913 if(!document.all){ 914 img.style.position = 'absolute'; 915 img.style.right = '2px'; 916 } 917 918 919 920} 921 922function writeCalendarContent() 923{ 924 var calendarContentDivExists = true; 925 if(!calendarContentDiv){ 926 calendarContentDiv = document.createElement('DIV'); 927 calendarDiv.appendChild(calendarContentDiv); 928 calendarContentDivExists = false; 929 } 930 currentMonth = currentMonth/1; 931 var d = new Date(); 932 933 d.setFullYear(currentYear); 934 d.setDate(1); 935 d.setMonth(currentMonth); 936 937 var dayStartOfMonth = d.getDay(); 938 if (! weekStartsOnSunday) { 939 if(dayStartOfMonth==0)dayStartOfMonth=7; 940 dayStartOfMonth--; 941 } 942 943 document.getElementById('calendar_year_txt').innerHTML = currentYear; 944 document.getElementById('calendar_month_txt').innerHTML = monthArray[currentMonth]; 945 document.getElementById('calendar_hour_txt').innerHTML = currentHour; 946 document.getElementById('calendar_minute_txt').innerHTML = currentMinute; 947 948 var existingTable = calendarContentDiv.getElementsByTagName('TABLE'); 949 if(existingTable.length>0){ 950 calendarContentDiv.removeChild(existingTable[0]); 951 } 952 953 var calTable = document.createElement('TABLE'); 954 calTable.width = '100%'; 955 calTable.cellSpacing = '0'; 956 calendarContentDiv.appendChild(calTable); 957 958 959 960 961 var calTBody = document.createElement('TBODY'); 962 calTable.appendChild(calTBody); 963 var row = calTBody.insertRow(-1); 964 row.className = 'calendar_week_row'; 965 if (showWeekNumber) { 966 var cell = row.insertCell(-1); 967 cell.innerHTML = weekString; 968 cell.className = 'calendar_week_column'; 969 cell.style.backgroundColor = selectBoxRolloverBgColor; 970 } 971 972 for(var no=0;no<dayArray.length;no++){ 973 var cell = row.insertCell(-1); 974 cell.innerHTML = dayArray[no]; 975 } 976 977 var row = calTBody.insertRow(-1); 978 979 if (showWeekNumber) { 980 var cell = row.insertCell(-1); 981 cell.className = 'calendar_week_column'; 982 cell.style.backgroundColor = selectBoxRolloverBgColor; 983 var week = getWeek(currentYear,currentMonth,1); 984 cell.innerHTML = week; // Week 985 } 986 for(var no=0;no<dayStartOfMonth;no++){ 987 var cell = row.insertCell(-1); 988 cell.innerHTML = ' '; 989 } 990 991 var colCounter = dayStartOfMonth; 992 var daysInMonth = daysInMonthArray[currentMonth]; 993 if(daysInMonth==28){ 994 if(isLeapYear(currentYear))daysInMonth=29; 995 } 996 997 for(var no=1;no<=daysInMonth;no++){ 998 d.setDate(no-1); 999 if(colCounter>0 && colCounter%7==0){ 1000 var row = calTBody.insertRow(-1); 1001 if (showWeekNumber) { 1002 var cell = row.insertCell(-1); 1003 cell.className = 'calendar_week_column'; 1004 var week = getWeek(currentYear,currentMonth,no); 1005 cell.innerHTML = week; // Week 1006 cell.style.backgroundColor = selectBoxRolloverBgColor; 1007 } 1008 } 1009 var cell = row.insertCell(-1); 1010 if(currentYear==inputYear && currentMonth == inputMonth && no==inputDay){ 1011 cell.className='activeDay'; 1012 } 1013 cell.innerHTML = no; 1014 cell.onclick = pickDate; 1015 colCounter++; 1016 } 1017 1018 1019 if(!document.all){ 1020 if(calendarContentDiv.offsetHeight) 1021 document.getElementById('topBar').style.top = calendarContentDiv.offsetHeight + document.getElementById('timeBar').offsetHeight + document.getElementById('topBar').offsetHeight -1 + 'px'; 1022 else{ 1023 document.getElementById('topBar').style.top = ''; 1024 document.getElementById('topBar').style.bottom = '0px'; 1025 } 1026 1027 } 1028 1029 if(iframeObj){ 1030 if(!calendarContentDivExists)setTimeout('resizeIframe()',350);else setTimeout('resizeIframe()',10); 1031 } 1032 1033 1034 1035 1036} 1037 1038function resizeIframe() 1039{ 1040 iframeObj.style.width = calendarDiv.offsetWidth + 'px'; 1041 iframeObj.style.height = calendarDiv.offsetHeight + 'px' ; 1042 1043 1044} 1045 1046function pickTodaysDate() 1047{ 1048 var d = new Date(); 1049 currentMonth = d.getMonth(); 1050 currentYear = d.getFullYear(); 1051 pickDate(false,d.getDate()); 1052 1053} 1054 1055function pickDate(e,inputDay) 1056{
1057 var month = currentMonth/1 +1; 1058 if(month<10)month = '0' + month; 1059 var day; 1060 if(!inputDay && this)day = this.innerHTML; else day = inputDay; 1061 1062 if(day/1<10)day = '0' + day; 1063 if(returnFormat){ 1064 returnFormat = returnFormat.replace('dd',day); 1065 returnFormat = returnFormat.replace('mm',month); 1066 returnFormat = returnFormat.replace('yyyy',currentYear); 1067 returnFormat = returnFormat.replace('hh',currentHour); 1068 returnFormat = returnFormat.replace('ii',currentMinute); 1069 returnFormat = returnFormat.replace('d',day/1); 1070 returnFormat = returnFormat.replace('m',month/1); 1071 1072 returnDateTo.value = returnFormat; 1073 try{ 1074 returnDateTo.onchange(); 1075 }catch(e){ 1076 1077 } 1078 }else{ 1079 for(var no=0;no<returnDateToYear.options.length;no++){ 1080 if(returnDateToYear.options[no].value==currentYear){ 1081 returnDateToYear.selectedIndex=no; 1082 break; 1083 } 1084 } 1085 for(var no=0;no<returnDateToMonth.options.length;no++){ 1086 if(returnDateToMonth.options[no].value==parseInt(month)){ 1087 returnDateToMonth.selectedIndex=no; 1088 break; 1089 } 1090 } 1091 for(var no=0;no<returnDateToDay.options.length;no++){ 1092 if(returnDateToDay.options[no].value==parseInt(day)){ 1093 returnDateToDay.selectedIndex=no; 1094 break; 1095 } 1096 } 1097 if(calendarDisplayTime){ 1098 for(var no=0;no<returnDateToHour.options.length;no++){ 1099 if(returnDateToHour.options[no].value==parseInt(currentHour)){ 1100 returnDateToHour.selectedIndex=no; 1101 break; 1102 } 1103 } 1104 for(var no=0;no<returnDateToMinute.options.length;no++){ 1105 if(returnDateToMinute.options[no].value==parseInt(currentMinute)){ 1106 returnDateToMinute.selectedIndex=no; 1107 break; 1108 } 1109 } 1110 } 1111 } 1112 closeCalendar(); 1113 1114} 1115 1116// This function is from http://www.codeproject.com/csharp/gregorianwknum.asp 1117// Only changed the month add 1118function getWeek(year,month,day){ 1119 if (! weekStartsOnSunday) { 1120 day = (day/1); 1121 } else { 1122 day = (day/1)+1; 1123 } 1124 year = year /1; 1125 month = month/1 + 1; //use 1-12 1126 var a = Math.floor((14-(month))/12); 1127 var y = year+4800-a;
1128 var m = (month)+(12*a)-3; 1129 var jd = day + Math.floor(((153*m)+2)/5) + 1130 (365*y) + Math.floor(y/4) - Math.floor(y/100) + 1131 Math.floor(y/400) - 32045; // (gregorian calendar) 1132 var d4 = (jd+31741-(jd%7))%146097%36524%1461; 1133 var L = Math.floor(d4/1460); 1134 var d1 = ((d4-L)%365)+L; 1135 NumberOfWeek = Math.floor(d1/7) + 1; 1136 return NumberOfWeek; 1137} 1138 1139function writeTimeBar() 1140{ 1141 var timeBar = document.createElement('DIV'); 1142 timeBar.id = 'timeBar'; 1143 timeBar.className = 'timeBar'; 1144 1145 var subDiv = document.createElement('DIV'); 1146 subDiv.innerHTML = 'Time:'; 1147 //timeBar.appendChild(subDiv); 1148 1149 // Year selector 1150 var hourDiv = document.createElement('DIV'); 1151 hourDiv.onmouseover = highlightSelect; 1152 hourDiv.onmouseout = highlightSelect; 1153 hourDiv.onclick = showHourDropDown; 1154 hourDiv.style.width = '30px'; 1155 var span = document.createElement('SPAN'); 1156 span.innerHTML = currentHour; 1157 span.id = 'calendar_hour_txt'; 1158 hourDiv.appendChild(span); 1159 timeBar.appendChild(hourDiv); 1160 1161 var img = document.createElement('IMG'); 1162 img.src = pathToImages + 'down_time.gif'; 1163 hourDiv.appendChild(img); 1164 hourDiv.className = 'selectBoxTime'; 1165 1166 if(Opera){ 1167 hourDiv.style.width = '30px'; 1168 img.style.cssText = 'float:right'; 1169 img.style.position = 'relative'; 1170 img.style.styleFloat = 'right'; 1171 } 1172 1173 var hourPicker = createHourDiv(); 1174 hourPicker.style.left = '130px'; 1175 //hourPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px'; 1176 hourPicker.style.width = '35px'; 1177 hourPicker.id = 'hourDropDown'; 1178 calendarDiv.appendChild(hourPicker); 1179 1180 // Add Minute picker 1181 1182 // Year selector 1183 var minuteDiv = document.createElement('DIV'); 1184 minuteDiv.onmouseover = highlightSelect; 1185 minuteDiv.onmouseout = highlightSelect; 1186 minuteDiv.onclick = showMinuteDropDown; 1187 minuteDiv.style.width = '30px'; 1188 var span = document.createElement('SPAN'); 1189 span.innerHTML = currentMinute; 1190 1191 span.id = 'calendar_minute_txt'; 1192 minuteDiv.appendChild(span); 1193 timeBar.appendChild(minuteDiv); 1194 1195 var img = document.createElement('IMG'); 1196 img.src = pathToImages + 'down_time.gif'; 1197 minuteDiv.appendChild(img); 1198 minuteDiv.className = 'selectBoxTime'; 1199 1200 if(Opera){ 1201 minuteDiv.style.width = '30px'; 1202 img.style.cssText = 'float:right'; 1203 img.style.position = 'relative'; 1204 img.style.styleFloat = 'right'; 1205 } 1206 1207 var minutePicker = createMinuteDiv(); 1208 minutePicker.style.left = '167px'; 1209 //minutePicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px'; 1210 minutePicker.style.width = '35px'; 1211 minutePicker.id = 'minuteDropDown'; 1212 calendarDiv.appendChild(minutePicker); 1213 1214 1215 return timeBar; 1216 1217} 1218 1219function writeBottomBar() 1220{ 1221 var d = new Date(); 1222 var bottomBar = document.createElement('DIV'); 1223 1224 bottomBar.id = 'bottomBar'; 1225 1226 bottomBar.style.cursor = 'pointer'; 1227 bottomBar.className = 'todaysDate'; 1228 // var todayStringFormat = '[todayString] [dayString] [day] [monthString] [year]'; ;; 1229 1230 var subDiv = document.createElement('DIV'); 1231 subDiv.onclick = pickTodaysDate; 1232 subDiv.id = 'todaysDateString'; 1233 subDiv.style.width = (calendarDiv.offsetWidth - 95) + 'px'; 1234 var day = d.getDay(); 1235 if (! weekStartsOnSunday) { 1236 if(day==0)day = 7; 1237 day--; 1238 } 1239 1240 var bottomString = todayStringFormat; 1241 bottomString = bottomString.replace('[monthString]',monthArrayShort[d.getMonth()]); 1242 bottomString = bottomString.replace('[day]',d.getDate()); 1243 bottomString = bottomString.replace('[year]',d.getFullYear()); 1244 bottomString = bottomString.replace('[dayString]',dayArray[day].toLowerCase()); 1245 bottomString = bottomString.replace('[UCFdayString]',dayArray[day]); 1246 bottomString = bottomString.replace('[todayString]',todayString); 1247 1248 1249 subDiv.innerHTML = todayString + ': ' + d.getDate() + '. ' + monthArrayShort[d.getMonth()] + ', ' + d.getFullYear() ; 1250 subDiv.innerHTML = bottomString ; 1251 bottomBar.appendChild(subDiv); 1252 1253 var timeDiv = writeTimeBar(); 1254 bottomBar.appendChild(timeDiv); 1255 1256 calendarDiv.appendChild(bottomBar); 1257 1258 1259 1260} 1261function getTopPos(inputObj) 1262{ 1263 1264 var returnValue = inputObj.offsetTop + inputObj.offsetHeight; 1265 while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop; 1266 return returnValue + calendar_offsetTop; 1267} 1268 1269function getleftPos(inputObj) 1270{ 1271 var returnValue = inputObj.offsetLeft; 1272 while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft; 1273 return returnValue + calendar_offsetLeft; 1274} 1275 1276function positionCalendar(inputObj) 1277{ 1278 calendarDiv.style.left = getleftPos(inputObj) + 'px'; 1279 calendarDiv.style.top = getTopPos(inputObj) + 'px'; 1280 if(iframeObj){ 1281 iframeObj.style.left = calendarDiv.style.left; 1282 iframeObj.style.top = calendarDiv.style.top; 1283 //// fix for EI frame problem on time dropdowns 09/30/2006 1284 iframeObj2.style.left = calendarDiv.style.left; 1285 iframeObj2.style.top = calendarDiv.style.top; 1286 } 1287 1288} 1289
1290function initCalendar() 1291{ 1292 if(MSIE){ 1293 iframeObj = document.createElement('IFRAME'); 1294 iframeObj.style.filter = 'alpha(opacity=0)'; 1295 iframeObj.style.position = 'absolute'; 1296 iframeObj.border='0px'; 1297 iframeObj.style.border = '0px'; 1298 iframeObj.style.backgroundColor = '#FF0000'; 1299 //// fix for EI frame problem on time dropdowns 09/30/2006 1300 iframeObj2 = document.createElement('IFRAME'); 1301 iframeObj2.style.position = 'absolute'; 1302 iframeObj2.border='0px'; 1303 iframeObj2.style.border = '0px'; 1304 iframeObj2.style.height = '1px'; 1305 iframeObj2.style.width = '1px'; 1306 //// fix for EI frame problem on time dropdowns 09/30/2006 1307 // Added fixed for HTTPS 1308 iframeObj2.src = 'blank.html'; 1309 iframeObj.src = 'blank.html'; 1310 document.body.appendChild(iframeObj2); // gfb move this down AFTER the .src is set 1311 document.body.appendChild(iframeObj); 1312 } 1313 1314 calendarDiv = document.createElement('DIV'); 1315 calendarDiv.id = 'calendarDiv'; 1316 calendarDiv.style.zIndex = 1000; 1317 slideCalendarSelectBox(); 1318 1319 document.body.appendChild(calendarDiv); 1320 writeBottomBar(); 1321 writeTopBar(); 1322 1323 1324 1325 if(!currentYear){ 1326 var d = new Date(); 1327 currentMonth = d.getMonth(); 1328 currentYear = d.getFullYear(); 1329 } 1330 writeCalendarContent(); 1331 1332 1333 1334} 1335 1336function setTimeProperties() 1337{ 1338 if(!calendarDisplayTime){ 1339 document.getElementById('timeBar').style.display='none'; 1340 document.getElementById('timeBar').style.visibility='hidden'; 1341 document.getElementById('todaysDateString').style.width = '100%'; 1342 1343 1344 }else{ 1345 document.getElementById('timeBar').style.display='block'; 1346 document.getElementById('timeBar').style.visibility='visible'; 1347 document.getElementById('hourDropDown').style.top = document.getElementById('calendar_minute_txt').parentNode.offsetHeight + calendarContentDiv.offsetHeight + document.getElementById('topBar').offsetHeight + 'px'; 1348 document.getElementById('minuteDropDown').style.top = document.getElementById('calendar_minute_txt').parentNode.offsetHeight + calendarContentDiv.offsetHeight + document.getElementById('topBar').offsetHeight + 'px'; 1349 document.getElementById('minuteDropDown').style.right = '50px'; 1350 document.getElementById('hourDropDown').style.right = '50px'; 1351 document.getElementById('todaysDateString').style.width = '115px'; 1352 } 1353} 1354 1355function calendarSortItems(a,b) 1356{ 1357 return a/1 - b/1; 1358} 1359 1360 1361function displayCalendar(inputField,format,buttonObj,displayTime,timeInput) 1362{ 1363 if(displayTime)calendarDisplayTime=true; else calendarDisplayTime = false; 1364 if(inputField.value.length>0){ 1365 1366 if(!format.match(/^[0-9]*?$/gi)){ 1367 var items = inputField.value.split(/[^0-9]/gi); 1368 var positionArray = new Array(); 1369 positionArray['m'] = format.indexOf('mm'); 1370 if(positionArray['m']==-1)positionArray['m'] = format.indexOf('m'); 1371 positionArray['d'] = format.indexOf('dd'); 1372 if(positionArray['d']==-1)positionArray['d'] = format.indexOf('d'); 1373 positionArray['y'] = format.indexOf('yyyy'); 1374 positionArray['h'] = format.indexOf('hh'); 1375 positionArray['i'] = format.indexOf('ii'); 1376 1377 var positionArrayNumeric = Array(); 1378 positionArrayNumeric[0] = positionArray['m']; 1379 positionArrayNumeric[1] = positionArray['d']; 1380 positionArrayNumeric[2] = positionArray['y']; 1381 positionArrayNumeric[3] = positionArray['h']; 1382 positionArrayNumeric[4] = positionArray['i']; 1383 1384 1385 positionArrayNumeric = positionArrayNumeric.sort(calendarSortItems); 1386 var itemIndex = -1; 1387 currentHour = '00'; 1388 currentMinute = '00'; 1389 for(var no=0;no<positionArrayNumeric.length;no++){ 1390 if(positionArrayNumeric[no]==-1)continue; 1391 itemIndex++; 1392 if(positionArrayNumeric[no]==positionArray['m']){ 1393 currentMonth = items[itemIndex]-1; 1394 continue; 1395 } 1396 if(positionArrayNumeric[no]==positionArray['y']){ 1397 currentYear = items[itemIndex]; 1398 continue; 1399 } 1400 if(positionArrayNumeric[no]==positionArray['d']){ 1401 tmpDay = items[itemIndex]; 1402 continue; 1403 } 1404 if(positionArrayNumeric[no]==positionArray['h']){ 1405 currentHour = items[itemIndex]; 1406 continue; 1407 } 1408 if(positionArrayNumeric[no]==positionArray['i']){ 1409 currentMinute = items[itemIndex]; 1410 continue; 1411 } 1412 } 1413 1414 currentMonth = currentMonth / 1; 1415 tmpDay = tmpDay / 1; 1416 }else{ 1417 var monthPos = format.indexOf('mm'); 1418 currentMonth = inputField.value.substr(monthPos,2)/1 -1; 1419 var yearPos = format.indexOf('yyyy'); 1420 currentYear = inputField.value.substr(yearPos,4); 1421 var dayPos = format.indexOf('dd'); 1422 tmpDay = inputField.value.substr(dayPos,2); 1423 1424 var hourPos = format.indexOf('hh'); 1425 if(hourPos>=0){ 1426 tmpHour = inputField.value.substr(hourPos,2); 1427 currentHour = tmpHour; 1428 }else{ 1429 currentHour = '00'; 1430 } 1431 var minutePos = format.indexOf('ii'); 1432 if(minutePos>=0){ 1433 tmpMinute = inputField.value.substr(minutePos,2); 1434 currentMinute = tmpMinute; 1435 }else{ 1436 currentMinute = '00'; 1437 } 1438 } 1439 }else{ 1440 var d = new Date(); 1441 currentMonth = d.getMonth(); 1442 currentYear = d.getFullYear(); 1443 currentHour = '08'; 1444 currentMinute = '00'; 1445 tmpDay = d.getDate(); 1446 } 1447 1448 inputYear = currentYear; 1449 inputMonth = currentMonth; 1450 inputDay = tmpDay/1; 1451 1452 1453 if(!calendarDiv){
1454 initCalendar(); 1455 }else{ 1456 if(calendarDiv.style.display=='block'){ 1457 closeCalendar(); 1458 return false; 1459 } 1460 writeCalendarContent(); 1461 } 1462 1463 1464 1465 returnFormat = format; 1466 returnDateTo = inputField; 1467 positionCalendar(buttonObj); 1468 calendarDiv.style.visibility = 'visible'; 1469 calendarDiv.style.display = 'block'; 1470 if(iframeObj){ 1471 iframeObj.style.display = ''; 1472 iframeObj.style.height = '140px'; 1473 iframeObj.style.width = '195px'; 1474 iframeObj2.style.display = ''; 1475 iframeObj2.style.height = '140px'; 1476 iframeObj2.style.width = '195px'; 1477 } 1478 1479 setTimeProperties(); 1480 updateYearDiv(); 1481 updateMonthDiv(); 1482 updateMinuteDiv(); 1483 updateHourDiv(); 1484 1485} 1486 1487function displayCalendarSelectBox(yearInput,monthInput,dayInput,hourInput,minuteInput,buttonObj) 1488{ 1489 if(!hourInput)calendarDisplayTime=false; else calendarDisplayTime = true; 1490 1491 currentMonth = monthInput.options[monthInput.selectedIndex].value/1-1; 1492 currentYear = yearInput.options[yearInput.selectedIndex].value; 1493 if(hourInput){ 1494 currentHour = hourInput.options[hourInput.selectedIndex].value; 1495 inputHour = currentHour/1; 1496 } 1497 if(minuteInput){ 1498 currentMinute = minuteInput.options[minuteInput.selectedIndex].value; 1499 inputMinute = currentMinute/1; 1500 } 1501 1502 inputYear = yearInput.options[yearInput.selectedIndex].value; 1503 inputMonth = monthInput.options[monthInput.selectedIndex].value/1 - 1; 1504 inputDay = dayInput.options[dayInput.selectedIndex].value/1; 1505 1506 if(!calendarDiv){ 1507 initCalendar(); 1508 }else{ 1509 writeCalendarContent(); 1510 } 1511 1512 1513 1514 returnDateToYear = yearInput; 1515 returnDateToMonth = monthInput; 1516 returnDateToDay = dayInput; 1517 returnDateToHour = hourInput; 1518 returnDateToMinute = minuteInput; 1519 1520 1521 1522 1523 returnFormat = false; 1524 returnDateTo = false; 1525 positionCalendar(buttonObj); 1526 calendarDiv.style.visibility = 'visible'; 1527 calendarDiv.style.display = 'block'; 1528 if(iframeObj){ 1529 iframeObj.style.display = ''; 1530 iframeObj.style.height = calendarDiv.offsetHeight + 'px'; 1531 iframeObj.style.width = calendarDiv.offsetWidth + 'px'; 1532 //// fix for EI frame problem on time dropdowns 09/30/2006 1533 iframeObj2.style.display = ''; 1534 iframeObj2.style.height = calendarDiv.offsetHeight + 'px'; 1535 iframeObj2.style.width = calendarDiv.offsetWidth + 'px' 1536 } 1537 setTimeProperties(); 1538 updateYearDiv(); 1539 updateMonthDiv(); 1540 updateHourDiv(); 1541 updateMinuteDiv(); 1542 1543}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.