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