1var scwDateNow = new Date(Date.parse(new Date().toDateString())); 2var scwBaseYear = scwDateNow.getFullYear(); 3var scwDropDownYears = 10; 4var scwLanguage; 5function scwSetDefaultLanguage() 6 { 7 try {scwSetLanguage();} 8 catch (exception) 9 { 10 scwToday = 'Today:'; 11 scwDrag = 'click here to drag'; 12 scwArrMonthNames = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; 13 scwArrWeekInits = ['S','M','T','W','T','F','S']; 14 scwInvalidDateMsg = 'The entered date is invalid.\n'; 15 scwOutOfRangeMsg = 'The entered date is out of range.'; 16 scwDoesNotExistMsg = 'The entered date does not exist.'; 17 scwInvalidAlert = ['Invalid date (',') ignored.']; 18 scwDateDisablingError = ['Error ',' is not a Date object.']; 19 scwRangeDisablingError = ['Error ',' should consist of two elements.']; 20 } 21 } 22var scwWeekStart = 1; 23var scwWeekNumberDisplay = false; 24var scwWeekNumberBaseDay = 4; 25var scwShowInvalidDateMsg = false,scwShowOutOfRangeMsg = true,scwShowDoesNotExistMsg = true,scwShowInvalidAlert = true,scwShowDateDisablingError = true,scwShowRangeDisablingError = true; 26var scwArrDelimiters = ['/','-','.',',',' ']; 27var scwDateDisplayFormat = 'dd/mm/yy'; 28var scwDateOutputFormat = 'DD/MM/YYYY'; 29var scwDateInputSequence = 'DMY'; 30var scwZindex = 3; 31var scwBlnStrict = false; 32var scwEnabledDay = [true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true]; 33var scwDisabledDates = new Array(); 34var scwActiveToday = true; 35var scwOutOfRangeDisable = true; 36var scwAllowDrag = false; 37var scwClickToHide = false;
38document.writeln 39 ( 40 '<style type="text/css">' + 41 '.scw {padding:1px;vertical-align:middle;}' + 42 'iframe.scw {position:absolute;z-index:' + scwZindex + 43 ';top:0px;left:0px;visibility:hidden;' + 44 'width:1px;height:1px;}' + 45 'table.scw {padding:0px;visibility:hidden;' + 46 'position:absolute;cursor:default;' + 47 'width:200px;top:0px;left:0px;' + 48 'z-index:' + (scwZindex+1) + 49 ';text-align:center;}' + 50 '</style>' 51 ); 52document.writeln 53 ( 54 '<style type="text/css">' + 55 '/* IMPORTANT: The SCW calendar script requires all ' + 56 ' the classes defined here.' + 57 '*/' + 58 'table.scw {padding: 1px;' + 59 'vertical-align:middle;' + 60 'border: ridge 2px;' + 61 'font-size: 10pt;' + 62 'font-family: Arial,Helvetica,Sans-Serif;'+ 63 'font-weight: bold;}' + 64 'td.scwDrag,' + 65 'td.scwHead {padding: 0px 0px;' + 66 'text-align: center;}' + 67 'td.scwDrag {font-size: 8pt;}' + 68 'select.scwHead {margin: 3px 1px;}' + 69 'input.scwHead {height: 22px;' + 70 'width: 22px;' + 71 'vertical-align:middle;' + 72 'text-align: center;' + 73 'margin: 2px 1px;' + 74 'font-weight: bold;' + 75 'font-size: 10pt;' + 76 'font-family: fixedSys;}' + 77 'td.scwWeekNumberHead,' + 78 'td.scwWeek {padding: 0px;' + 79 'text-align: center;' + 80 'font-weight: bold;}' + 81 'td.scwFoot,' + 82 'td.scwFootHover,' + 83 'td.scwFoot:hover,' + 84 'td.scwFootDisabled {padding: 0px;' + 85 'text-align: center;' + 86 'color: white;font-weight: bold;}' + 87 'table.scwCells {text-align: right;' + 88 'font-size: 8pt;' + 89 'width: 96%;}' + 90 'td.scwCells,' + 91 'td.scwCellsHover,' + 92 'td.scwCells:hover,' + 93 'td.scwCellsDisabled,' + 94 'td.scwCellsExMonth,' + 95 'td.scwCellsExMonthHover,' + 96 'td.scwCellsExMonth:hover,' + 97 'td.scwCellsExMonthDisabled,' + 98 'td.scwCellsWeekend,' + 99 'td.scwCellsWeekendHover,' + 100 'td.scwCellsWeekend:hover,' + 101 'td.scwCellsWeekendDisabled,' + 102 'td.scwInputDate,' + 103 'td.scwInputDateHover,' + 104 'td.scwInputDate:hover,' + 105 'td.scwInputDateDisabled,' + 106 'td.scwWeekNo,' + 107 'td.scwWeeks {padding: 3px;' + 108 'width: 16px;' + 109 'height: 16px;' + 110 'font-weight: bold;' + 111 'vertical-align: middle;}' + 112 '/* Blend the colours into your page here... */' + 113 '/* Calendar background */' + 114 'table.scw {background-color: #c5d150;}' + 115 '/* Drag Handle */' + 116 'td.scwDrag {background-color: #9999CC;' + 117 'color: #CCCCFF;}' + 118 '/* Week number heading */' + 119 'td.scwWeekNumberHead {color: #611515;}' + 120 '/* Week day headings */' + 121 'td.scwWeek {color: black;}' + 122 '/* Week numbers */' + 123 'td.scwWeekNo {background-color: #666666;' + 124 'color: #e2eb8a;}' + 125 '/* Enabled Days */' + 126 '/* Week Day */' + 127 'td.scwCells {background-color: #e2eb8a;' + 128 'color: black;}' + 129 '/* Day matching the input date */' + 130 'td.scwInputDate {background-color: RED;' + 131 'color: #FFFFFF;}' + 132 '/* Weekend Day */' + 133 'td.scwCellsWeekend {background-color: #e2eb8a;' + 134 'color: RED;}' + 135 '/* Day outside the current month */' + 136 'td.scwCellsExMonth {background-color: #e2eb8a;' + 137 'color: #666666;}' + 138 '/* Today selector */' + 139 'td.scwFoot {background-color: #611515;' + 140 'color: white;}' + 141 '/* MouseOver/Hover formatting ' + 142 ' If you want to "turn off" any of the formatting ' + 143 ' then just set to the same as the standard format' + 144 ' above.' + 145 ' ' + 146 ' Note: The reason that the following are' + 147 ' implemented using both a class and a :hover' + 148 ' pseudoclass is because Opera handles the rendering' + 149 ' involved in the class swap very poorly and IE6 ' + 150 ' (and below) only implements pseudoclasses on the' + 151 ' anchor tag.' + 152 '*/' + 153 '/* Active cells */' + 154 'td.scwCells:hover,' + 155 'td.scwCellsHover {background-color: #611515;' + 156 'color: #FFFFFF;}' + 157 '/* Day matching the input date */' + 158 'td.scwInputDate:hover,' + 159 'td.scwInputDateHover {background-color: #611515;' + 160 'color: #FFFFFF;}' + 161 '/* Weekend cells */' + 162 'td.scwCellsWeekend:hover,' + 163 'td.scwCellsWeekendHover {background-color: #611515;' + 164 'color: #FFFFFF;}' + 165 '/* Day outside the current month */' + 166 'td.scwCellsExMonth:hover,' + 167 'td.scwCellsExMonthHover {background-color: #611515;' + 168 'color: #FFFFFF;}' + 169 '/* Today selector */' + 170 'td.scwFoot:hover,' + 171 'td.scwFootHover {color: white;' + 172 'font-weight: bold;}' + 173 '/* Disabled cells */' + 174 '/* Week Day */' + 175 '/* Day matching the input date */' + 176 'td.scwInputDateDisabled {background-color: #999999;' + 177 'color: #000000;}' + 178 'td.scwCellsDisabled {background-color: #999999;' + 179 'color: #000000;}' + 180 '/* Weekend Day */' + 181 'td.scwCellsWeekendDisabled {background-color: #999999;' + 182 'color: #CC6666;}' + 183 '/* Day outside the current month */' + 184 'td.scwCellsExMonthDisabled {background-color: #999999;' + 185 'color: #666666;}' + 186 'td.scwFootDisabled {background-color: #611515;' + 187 'color: #FFFFFF;}' + 188 '</style>' 189 ); 190var scwTargetEle,scwTriggerEle,scwMonthSum = 0,scwBlnFullInputDate = false,scwPassEnabledDay = new Array(),scwSeedDate = new Date(),scwParmActiveToday = true,scwWeekStart = scwWeekStart%7,scwToday,scwDrag,scwArrMonthNames,scwArrWeekInits,scwInvalidDateMsg,scwOutOfRangeMsg,scwDoesNotExistMsg,scwInvalidAlert,scwDateDisablingError,scwRangeDisablingError; 191Date.prototype.scwFormat = function(scwFormat) 192 { 193 var charCount = 0,codeChar = '',result = ''; 194 for (var i=0;i<=scwFormat.length;i++) 195 { 196 if (i<scwFormat.length && scwFormat.charAt(i)==codeChar) {charCount++;} 197 else 198 { 199 switch (codeChar) 200 { 201 case 'y': case 'Y': result += (this.getFullYear()%Math.pow(10,charCount)).toString().scwPadLeft(charCount); 202 break; 203 case 'm': case 'M': result += (charCount<3)?(this.getMonth()+1).toString().scwPadLeft(charCount):scwArrMonthNames[this.getMonth()]; 204 break; 205 case 'd': case 'D': result += this.getDate().toString().scwPadLeft(charCount); 206 break; 207 default: 208 while (charCount-- > 0) {result += codeChar;} 209 } 210 if (i<scwFormat.length) 211 { 212 codeChar = scwFormat.charAt(i); 213 charCount = 1; 214 } 215 } 216 } 217 return result; 218 } 219String.prototype.scwPadLeft = function(padToLength) {var result = ''; for (var i=0;i<(padToLength - this.length);i++) {result += '0';} return (result + this);} 220Function.prototype.runsAfterSCW = function() 221 { 222 var func = this, args = new Array(arguments.length); 223 for (var i=0;i<args.length;++i) {args[i] = arguments[i];} 224 return function() 225 { 226 for (var i=0;i<arguments.length;++i) {args[args.length] = arguments[i];} 227 return (args.shift()==scwTriggerEle)?func.apply(this, args):null; 228 } 229 }; 230var scwNextActionReturn, scwNextAction; 231function showCal(scwEle,scwSourceEle) {scwShow(scwEle,scwSourceEle);} 232function scwShow(scwEle,scwSourceEle) 233 { 234 scwTriggerEle = scwSourceEle; 235 scwParmActiveToday = true; 236 for (var i=0;i<7;i++) 237 { 238 scwPassEnabledDay[(i+7-scwWeekStart)%7] = true; 239 for (var j=2;j<arguments.length;j++) 240 { 241 if (arguments[j]==i) 242 { 243 scwPassEnabledDay[(i+7-scwWeekStart)%7] = false;
244 if (scwDateNow.getDay()==i) scwParmActiveToday = false; 245 } 246 } 247 } 248 var sDay = scwDateNow.getDate()-1; 249 var sMonth = scwDateNow.getMonth(); 250 var sYear = scwDateNow.getFullYear(); 251 scwDisabledDates[0] = [new Date(2005,0,1),new Date(sYear,sMonth,sDay)]; 252 if(document.getElementById('pDate').value != "dd/mm/yyyy") 253 { 254 scwEle.value = scwEle.value.replace(/^\s+/,'').replace(/\s+$/,''); 255 } 256 else 257 { 258 scwEle.value = ""; 259 } 260 if(document.getElementById('dDate').value != "dd/mm/yyyy") 261 { 262 scwEle.value = scwEle.value.replace(/^\s+/,'').replace(/\s+$/,''); 263 } 264 else 265 { 266 scwEle.value = ""; 267 } 268 if((document.getElementById('pDate').value != "dd/mm/yyyy")) 269 { 270 if(scwEle == document.getElementById('dDate')) 271 { 272 var arrayDate = Array(); 273 arrayDate = document.getElementById('pDate').value.split("/"); 274 scwDisabledDates[1] = [new Date(2005,0,1),new Date(arrayDate[2],(arrayDate[1]-1),(arrayDate[0]-1))]; 275 scwSeedDate = new Date(Date.parse(new Date(arrayDate[2],(arrayDate[1]-1),(arrayDate[0]-1)))); 276 } 277 else 278 { 279 if(scwEle == document.getElementById('pDate')) 280 { 281 scwDisabledDates = Array(); 282 scwDisabledDates[0] = [new Date(2005,0,1),new Date(sYear,sMonth,sDay)]; 283 scwSeedDate = scwDateNow; 284 } 285 } 286 } 287 scwEle.value = scwEle.value.replace(/^\s+/,'').replace(/\s+$/,''); 288 scwSetDefaultLanguage(); 289 document.getElementById('scwDragText').innerHTML = scwDrag; 290 document.getElementById('scwMonths').options.length = 0; 291 for (i=0;i<scwArrMonthNames.length;i++) document.getElementById('scwMonths').options[i] = new Option(scwArrMonthNames[i],scwArrMonthNames[i]); 292 document.getElementById('scwYears').options.length = 0; 293 for (i=0;i<scwDropDownYears;i++) document.getElementById('scwYears').options[i] = new Option((scwBaseYear+i),(scwBaseYear+i)); 294 for (i=0;i<scwArrWeekInits.length;i++) document.getElementById('scwWeekInit' + i).innerHTML = scwArrWeekInits[(i+scwWeekStart)%scwArrWeekInits.length]; 295 if (document.getElementById('scwFoot')) document.getElementById('scwFoot').innerHTML = scwToday + " " + scwDateNow.scwFormat(scwDateDisplayFormat); 296 if (scwEle.value.length==0) 297 { 298 scwBlnFullInputDate=false; 299 } 300 else 301 { 302 function scwInputFormat(scwEleValue) 303 { 304 var scwArrSeed = new Array(), scwArrInput = scwEle.value.split(new RegExp('[\\'+scwArrDelimiters.join('\\')+']+','g')); 305 if (scwArrInput[0].length==0) scwArrInput.splice(0,1); 306 if (scwArrInput[scwArrInput.length-1].length==0) scwArrInput.splice(scwArrInput.length-1,1); 307 scwBlnFullInputDate = false; 308 switch (scwArrInput.length) 309 { 310 case 1: 311 { 312 scwArrSeed[0] = parseInt(scwArrInput[0],10); 313 scwArrSeed[1] = '6'; 314 scwArrSeed[2] = 1; 315 break; 316 } 317 case 2: 318 { 319 scwArrSeed[0] = parseInt(scwArrInput[scwDateInputSequence.replace(/D/i,'').search(/Y/i)],10); 320 scwArrSeed[1] = scwArrInput[scwDateInputSequence.replace(/D/i,'').search(/M/i)]; 321 scwArrSeed[2] = 1; 322 break; 323 } 324 case 3: 325 { 326 scwArrSeed[0] = parseInt(scwArrInput[scwDateInputSequence.search(/Y/i)],10); 327 scwArrSeed[1] = scwArrInput[scwDateInputSequence.search(/M/i)]; 328 scwArrSeed[2] = parseInt(scwArrInput[scwDateInputSequence.search(/D/i)],10); 329 scwBlnFullInputDate = true; 330 break; 331 } 332 default: 333 { 334 scwArrSeed[0] = 0; 335 scwArrSeed[1] = 0; 336 scwArrSeed[2] = 0; 337 } 338 } 339 var scwExpValDay = /^(0?[1-9]|[1-2]\d|3[0-1])$/, scwExpValMonth = new RegExp("^(0?[1-9]|1[0-2]|"+scwArrMonthNames.join("|")+")$","i"), scwExpValYear = /^(\d{1,2}|\d{4})$/; 340 if (scwExpValYear.exec(scwArrSeed[0]) == null || scwExpValMonth.exec(scwArrSeed[1]) == null || scwExpValDay.exec(scwArrSeed[2]) == null) 341 { 342 if (scwShowInvalidDateMsg) 343 alert(scwInvalidDateMsg + scwInvalidAlert[0] + scwEleValue + scwInvalidAlert[1]); 344 scwBlnFullInputDate = false;
345 scwArrSeed[0] = scwBaseYear + Math.floor(scwDropDownYears/2); 346 scwArrSeed[1] = '6'; 347 scwArrSeed[2] = 1; 348 } 349 return scwArrSeed; 350 } 351 scwArrSeedDate = scwInputFormat(scwEle.value); 352 if (scwArrSeedDate[0]<100) scwArrSeedDate[0] += (scwArrSeedDate[0]>50)?1900:2000; 353 if (scwArrSeedDate[1].search(/\d+/)!=0) 354 { 355 month = scwArrMonthNames.join('|').toUpperCase().search(scwArrSeedDate[1].substr(0,3).toUpperCase()); 356 scwArrSeedDate[1] = Math.floor(month/4)+1; 357 } 358 scwSeedDate = new Date(scwArrSeedDate[0], 359 scwArrSeedDate[1]-1, 360 scwArrSeedDate[2]); 361 } 362 if (isNaN(scwSeedDate)) 363 { 364 if (scwShowInvalidDateMsg) alert( scwInvalidDateMsg + scwInvalidAlert[0] + scwEle.value + scwInvalidAlert[1]); 365 scwSeedDate = new Date(scwBaseYear + Math.floor(scwDropDownYears/2),5,1); 366 scwBlnFullInputDate=false; 367 } 368 else 369 { 370 if ((new Date(scwBaseYear,0,1)) > scwSeedDate) 371 { 372 if (scwBlnStrict && scwShowOutOfRangeMsg) alert(scwOutOfRangeMsg); 373 scwSeedDate = new Date(scwBaseYear,0,1); 374 scwBlnFullInputDate=false; 375 } 376 else 377 { 378 if ((new Date(scwBaseYear+scwDropDownYears-1,11,31))<scwSeedDate) 379 { 380 if (scwBlnStrict && scwShowOutOfRangeMsg) alert(scwOutOfRangeMsg); 381 scwSeedDate = new Date(scwBaseYear + Math.floor(scwDropDownYears)-1,11,1); 382 scwBlnFullInputDate=false; 383 } 384 else 385 { 386 if (scwBlnStrict && scwBlnFullInputDate && (scwSeedDate.getDate() != scwArrSeedDate[2] || (scwSeedDate.getMonth()+1) != scwArrSeedDate[1] || scwSeedDate.getFullYear() != scwArrSeedDate[0])) 387 { 388 if (scwShowDoesNotExistMsg) alert(scwDoesNotExistMsg); 389 scwSeedDate = new Date(scwSeedDate.getFullYear(),scwSeedDate.getMonth()-1,1); 390 scwBlnFullInputDate=false; 391 } 392 } 393 } 394 } 395 for (var i=0;i<scwDisabledDates.length;i++) 396 { 397 if (!((typeof scwDisabledDates[i] == 'object') && (scwDisabledDates[i].constructor == Date))) 398 { 399 if ((typeof scwDisabledDates[i] == 'object') && (scwDisabledDates[i].constructor == Array)) 400 { 401 var scwPass = true; 402 if (scwDisabledDates[i].length !=2) 403 { 404 if (scwShowRangeDisablingError) alert(scwRangeDisablingError[0] + scwDisabledDates[i] + scwRangeDisablingError[1]); 405 scwPass = false; 406 } 407 else 408 { 409 for (var j=0;j<scwDisabledDates[i].length;j++) 410 { 411 if (!((typeof scwDisabledDates[i][j] == 'object') && (scwDisabledDates[i][j].constructor == Date))) 412 { 413 if (scwShowRangeDisablingError) alert(scwDateDisablingError[0] + scwDisabledDates[i][j] + scwDateDisablingError[1]); 414 scwPass = false; 415 } 416 } 417 } 418 if (scwPass && (scwDisabledDates[i][0] > scwDisabledDates[i][1])) {scwDisabledDates[i].reverse();} 419 } 420 else 421 { 422 if (scwShowRangeDisablingError) alert(scwDateDisablingError[0] + scwDisabledDates[i] + scwDateDisablingError[1]); 423 } 424 } 425 } 426 scwMonthSum = 12*(scwSeedDate.getFullYear()-scwBaseYear)+ 427 scwSeedDate.getMonth(); 428 document.getElementById('scwYears').options.selectedIndex = Math.floor(scwMonthSum/12); 429 document.getElementById('scwMonths').options.selectedIndex = (scwMonthSum%12); 430 var offsetTop =parseInt(scwEle.offsetTop ,10) + parseInt(scwEle.offsetHeight,10),offsetLeft=parseInt(scwEle.offsetLeft,10); 431 scwTargetEle=scwEle; 432 do 433 { 434 scwEle=scwEle.offsetParent; 435 offsetTop +=parseInt(scwEle.offsetTop,10); 436 offsetLeft+=parseInt(scwEle.offsetLeft,10); 437 } 438 while (scwEle.tagName!='BODY' && scwEle.tagName!='HTML'); 439 document.getElementById('scw').style.top =offsetTop +'px'; 440 document.getElementById('scw').style.left=offsetLeft+'px'; 441 if (document.getElementById('scwIframe')) 442 { 443 document.getElementById('scwIframe').style.top=offsetTop +'px'; 444 document.getElementById('scwIframe').style.left=offsetLeft+'px'; 445 document.getElementById('scwIframe').style.width=(document.getElementById('scw').offsetWidth-2)+'px'; 446 document.getElementById('scwIframe').style.height=(document.getElementById('scw').offsetHeight-2)+'px'; 447 document.getElementById('scwIframe').style.visibility='visible'; 448 } 449 document.getElementById('scwDrag').style.display=(scwAllowDrag)?((document.getElementById('scwIFrame')||document.getElementById('scwIEgte7'))?'block':'table-row'):'none'; 450 scwShowMonth(0); 451 document.getElementById('scw').style.visibility='visible'; 452 if (typeof event=='undefined') 453 {
454 scwSourceEle.parentNode.addEventListener("click",scwStopPropagation,false); 455 } 456 else {event.cancelBubble = true;} 457 } 458function scwHide() 459 { 460 document.getElementById('scw').style.visibility='hidden'; 461 if (document.getElementById('scwIframe')) 462 { 463 document.getElementById('scwIframe').style.visibility='hidden'; 464 } 465 if (typeof scwNextAction!='undefined' && scwNextAction!=null) 466 { 467 scwNextActionReturn = scwNextAction(); 468 scwNextAction = null; 469 } 470 } 471function scwCancel(scwEvt) 472 { 473 if (scwClickToHide) scwHide(); 474 scwStopPropagation(scwEvt); 475 } 476function scwStopPropagation(scwEvt) 477 { 478 if (scwEvt.stopPropagation) scwEvt.stopPropagation(); 479 else scwEvt.cancelBubble = true; 480 } 481function scwBeginDrag(event) 482 { 483 var elementToDrag = document.getElementById('scw'); 484 var deltaX = event.clientX, 485 deltaY = event.clientY, 486 offsetEle = elementToDrag; 487 do 488 { 489 deltaX -= parseInt(offsetEle.offsetLeft,10); 490 deltaY -= parseInt(offsetEle.offsetTop ,10); 491 offsetEle = offsetEle.offsetParent; 492 } 493 while (offsetEle.tagName!='BODY' && offsetEle.tagName!='HTML'); 494 if (document.addEventListener) 495 { 496 document.addEventListener('mousemove',moveHandler,true); 497 document.addEventListener('mouseup',upHandler,true); 498 } 499 else 500 { 501 elementToDrag.attachEvent('onmousemove',moveHandler); 502 elementToDrag.attachEvent('onmouseup',upHandler); 503 elementToDrag.setCapture(); 504 } 505 scwStopPropagation(event); 506 function moveHandler(scwEvt) 507 { 508 if (!scwEvt) scwEvt = window.event; 509 elementToDrag.style.left = (scwEvt.clientX - deltaX) + 'px'; 510 elementToDrag.style.top = (scwEvt.clientY - deltaY) + 'px'; 511 if (document.getElementById('scwIframe')) 512 { 513 document.getElementById('scwIframe').style.left = (scwEvt.clientX - deltaX) + 'px'; 514 document.getElementById('scwIframe').style.top = (scwEvt.clientY - deltaY) + 'px'; 515 } 516 scwStopPropagation(scwEvt); 517 } 518 function upHandler(scwEvt) 519 { 520 if (!scwEvt) scwEvt = window.event; 521 if (document.removeEventListener) 522 { 523 document.removeEventListener('mousemove',moveHandler,true); 524 document.removeEventListener('mouseup',upHandler,true); 525 } 526 else 527 { 528 elementToDrag.detachEvent('onmouseup',upHandler); 529 elementToDrag.detachEvent('onmousemove',moveHandler); 530 elementToDrag.releaseCapture(); 531 } 532 scwStopPropagation(scwEvt); 533 } 534 } 535function scwShowMonth(scwBias) 536 { 537 var scwShowDate = new Date(Date.parse(new Date().toDateString())), scwStartDate = new Date(); 538 scwSelYears = document.getElementById('scwYears'); 539 scwSelMonths = document.getElementById('scwMonths'); 540 if (scwSelYears.options.selectedIndex>-1) 541 { 542 scwMonthSum=12*(scwSelYears.options.selectedIndex)+scwBias; 543 if (scwSelMonths.options.selectedIndex>-1) {scwMonthSum+=scwSelMonths.options.selectedIndex;} 544 } 545 else 546 { 547 if (scwSelMonths.options.selectedIndex>-1){scwMonthSum+=scwSelMonths.options.selectedIndex;} 548 } 549 scwShowDate.setFullYear(scwBaseYear + Math.floor(scwMonthSum/12), (scwMonthSum%12), 1); 550 document.getElementById("scwWeek_").style.display=(scwWeekNumberDisplay)?((document.getElementById('scwIFrame')||document.getElementById('scwIEgte7'))?'block':'table-cell'):'none'; 551 if ((12*parseInt((scwShowDate.getFullYear()-scwBaseYear),10)) + parseInt(scwShowDate.getMonth(),10) < (12*scwDropDownYears) && (12*parseInt((scwShowDate.getFullYear()-scwBaseYear),10)) + parseInt(scwShowDate.getMonth(),10) > -1) 552 { 553 scwSelYears.options.selectedIndex=Math.floor(scwMonthSum/12); 554 scwSelMonths.options.selectedIndex=(scwMonthSum%12); 555 scwCurMonth = scwShowDate.getMonth(); 556 scwShowDate.setDate((((scwShowDate.getDay()-scwWeekStart)<0)?-6:1)+scwWeekStart-scwShowDate.getDay()); 557 scwStartDate = new Date(scwShowDate); 558 var scwFoot = document.getElementById('scwFoot'); 559 function scwFootOutput() {scwSetOutput(scwDateNow);} 560 if (scwDisabledDates.length==0) 561 { 562 if (scwActiveToday && scwParmActiveToday) 563 { 564 scwFoot.onclick = scwFootOutput; 565 scwFoot.className = 'scwFoot'; 566 if (document.getElementById('scwIFrame')) 567 {
568 scwFoot.onmouseover = scwChangeClass; 569 scwFoot.onmouseout = scwChangeClass; 570 } 571 } 572 else 573 { 574 scwFoot.onclick = null; 575 scwFoot.className = 'scwFootDisabled'; 576 if (document.getElementById('scwIFrame')) 577 { 578 scwFoot.onmouseover = null; 579 scwFoot.onmouseout = null; 580 } 581 if (document.addEventListener) 582 { 583 scwFoot.addEventListener('click',scwStopPropagation,false); 584 } 585 else 586 { 587 scwFoot.attachEvent('onclick',scwStopPropagation); 588 } 589 } 590 } 591 else 592 { 593 for (var k=0;k<scwDisabledDates.length;k++) 594 { 595 if (!scwActiveToday || !scwParmActiveToday || ((typeof scwDisabledDates[k] == 'object') && (((scwDisabledDates[k].constructor == Date) && scwDateNow.valueOf() == scwDisabledDates[k].valueOf()) || ((scwDisabledDates[k].constructor == Array) && scwDateNow.valueOf() >= scwDisabledDates[k][0].valueOf() && scwDateNow.valueOf() <= scwDisabledDates[k][1].valueOf())))) 596 { 597 scwFoot.onclick = null; 598 scwFoot.className = 'scwFootDisabled'; 599 if (document.getElementById('scwIFrame')) 600 { 601 scwFoot.onmouseover = null; 602 scwFoot.onmouseout = null; 603 } 604 if (document.addEventListener) 605 { 606 scwFoot.addEventListener('click',scwStopPropagation,false); 607 } 608 else {scwFoot.attachEvent('onclick',scwStopPropagation);} 609 break; 610 } 611 else 612 { 613 scwFoot.onclick=scwFootOutput; 614 scwFoot.className='scwFoot'; 615 if (document.getElementById('scwIFrame')) 616 { 617 scwFoot.onmouseover = scwChangeClass; 618 scwFoot.onmouseout = scwChangeClass; 619 } 620 } 621 } 622 } 623 function scwSetOutput(scwOutputDate) 624 { 625 scwTargetEle.value = scwOutputDate.scwFormat(scwDateOutputFormat); 626 scwHide(); 627 } 628 function scwCellOutput(scwEvt) 629 { 630 var scwEle = scwEventTrigger(scwEvt), 631 scwOutputDate = new Date(scwStartDate); 632 if (scwEle.nodeType==3) scwEle=scwEle.parentNode; 633 scwOutputDate.setDate(scwStartDate.getDate() + parseInt(scwEle.id.substr(8),10)); 634 scwSetOutput(scwOutputDate); 635 } 636 function scwChangeClass(scwEvt) 637 { 638 var scwEle = scwEventTrigger(scwEvt); 639 if (scwEle.nodeType==3) scwEle=scwEle.parentNode; 640 switch (scwEle.className) 641 { 642 case 'scwCells': 643 scwEle.className = 'scwCellsHover'; 644 break; 645 case 'scwCellsHover': 646 scwEle.className = 'scwCells'; 647 break; 648 case 'scwCellsExMonth': 649 scwEle.className = 'scwCellsExMonthHover'; 650 break; 651 case 'scwCellsExMonthHover': 652 scwEle.className = 'scwCellsExMonth'; 653 break; 654 case 'scwCellsWeekend': 655 scwEle.className = 'scwCellsWeekendHover'; 656 break; 657 case 'scwCellsWeekendHover': 658 scwEle.className = 'scwCellsWeekend'; 659 break; 660 case 'scwFoot': 661 scwEle.className = 'scwFootHover'; 662 break; 663 case 'scwFootHover': 664 scwEle.className = 'scwFoot'; 665 break; 666 case 'scwInputDate': 667 scwEle.className = 'scwInputDateHover'; 668 break; 669 case 'scwInputDateHover': 670 scwEle.className = 'scwInputDate'; 671 } 672 return true; 673 } 674 function scwEventTrigger(scwEvt) 675 { 676 if (!scwEvt) scwEvt = event; 677 return scwEvt.target||scwEvt.srcElement; 678 } 679 function scwWeekNumber(scwInDate) 680 { 681 var scwInDateWeekBase = new Date(scwInDate); 682 scwInDateWeekBase.setDate(scwInDateWeekBase.getDate() - scwInDateWeekBase.getDay() + scwWeekNumberBaseDay + ((scwInDate.getDay()>scwWeekNumberBaseDay)?7:0)); 683 var scwFirstBaseDay = new Date(scwInDateWeekBase.getFullYear(),0,1); 684 scwFirstBaseDay.setDate(scwFirstBaseDay.getDate() - scwFirstBaseDay.getDay() + scwWeekNumberBaseDay); 685 if (scwFirstBaseDay < new Date(scwInDateWeekBase.getFullYear(),0,1)) 686 { 687 scwFirstBaseDay.setDate(scwFirstBaseDay.getDate()+7); 688 } 689 var scwStartWeekOne = new Date(scwFirstBaseDay - scwWeekNumberBaseDay + scwInDate.getDay()); 690 if (scwStartWeekOne > scwFirstBaseDay) 691 { 692 scwStartWeekOne.setDate(scwStartWeekOne.getDate()-7); 693 } 694 var scwWeekNo = "0" + (Math.round((scwInDateWeekBase - scwFirstBaseDay)/604800000,0) + 1); 695 return scwWeekNo.substring(scwWeekNo.length-2,scwWeekNo.length); 696 } 697 var scwCells = document.getElementById('scwCells'); 698 for (i=0;i<scwCells.childNodes.length;i++) 699 { 700 var scwRows = scwCells.childNodes[i]; 701 if (scwRows.nodeType==1 && scwRows.tagName=='TR') 702 {
703 if (scwWeekNumberDisplay) 704 { 705 scwRows.childNodes[0].innerHTML = scwWeekNumber(scwShowDate); 706 scwRows.childNodes[0].style.display = (document.getElementById('scwIFrame')||document.getElementById('scwIEgte7'))?'block':'table-cell'; 707 } 708 else {scwRows.childNodes[0].style.display='none';} 709 for (j=1;j<scwRows.childNodes.length;j++) 710 { 711 var scwCols = scwRows.childNodes[j]; 712 if (scwCols.nodeType==1 && scwCols.tagName=='TD') 713 { 714 scwRows.childNodes[j].innerHTML=scwShowDate.getDate(); 715 var scwCell=scwRows.childNodes[j],scwDisabled=(scwOutOfRangeDisable&&(scwShowDate < (new Date(scwBaseYear,0,1))||scwShowDate > (new Date(scwBaseYear+scwDropDownYears-1,11,31))))?true:false; 716 for (var k=0;k<scwDisabledDates.length;k++) 717 { 718 if ((typeof scwDisabledDates[k]=='object')&&(scwDisabledDates[k].constructor==Date)&&scwShowDate.valueOf()==scwDisabledDates[k].valueOf()) {scwDisabled = true;} 719 else 720 { 721 if ((typeof scwDisabledDates[k]=='object') && (scwDisabledDates[k].constructor == Array) && scwShowDate.valueOf() >= scwDisabledDates[k][0].valueOf() && scwShowDate.valueOf() <= scwDisabledDates[k][1].valueOf()) {scwDisabled = true;} 722 } 723 } 724 if (scwDisabled||!scwEnabledDay[j-1+(7*((i*scwCells.childNodes.length)/6))]||!scwPassEnabledDay[(j-1+(7*(i*scwCells.childNodes.length/6)))%7]) 725 { 726 scwRows.childNodes[j].onclick = null; 727 if (document.getElementById('scwIFrame')) 728 { 729 scwRows.childNodes[j].onmouseover = null; 730 scwRows.childNodes[j].onmouseout = null; 731 } 732 scwCell.className=(scwShowDate.getMonth()!=scwCurMonth)?'scwCellsExMonthDisabled':(scwBlnFullInputDate && scwShowDate.toDateString()==scwSeedDate.toDateString())?'scwInputDateDisabled':(scwShowDate.getDay()%6==0)?'scwCellsWeekendDisabled':'scwCellsDisabled'; 733 } 734 else 735 { 736 scwRows.childNodes[j].onclick=scwCellOutput; 737 if (document.getElementById('scwIFrame')) 738 { 739 scwRows.childNodes[j].onmouseover = scwChangeClass; 740 scwRows.childNodes[j].onmouseout = scwChangeClass; 741 } 742 scwCell.className=(scwShowDate.getMonth()!=scwCurMonth)?'scwCellsExMonth':(scwBlnFullInputDate && scwShowDate.toDateString()==scwSeedDate.toDateString())?'scwInputDate':(scwShowDate.getDay()%6==0)?'scwCellsWeekend':'scwCells'; 743 } 744 scwShowDate.setDate(scwShowDate.getDate()+1); 745 } 746 } 747 } 748 } 749 } 750 document.getElementById('scw').style.visibility='hidden'; 751 document.getElementById('scw').style.visibility='visible'; 752 } 753document.write 754 ( 755 "<!--[if gte IE 7]>" + 756 "<div id='scwIEgte7'></div>" + 757 "<![endif]-->" + 758 "<!--[if lt IE 7]>" + 759 "<iframe class='scw' src='scwblank.html' " + 760 "id='scwIframe' name='scwIframe' " + 761 "frameborder='0'>" + 762 "</iframe>" + 763 "<![endif]-->" + 764 "<table id='scw' class='scw' onclick='scwCancel(event);'>" + 765 "<tr class='scw'>" + 766 "<td class='scw'>" + 767 "<table class='scwHead' id='scwHead' width='100%' " + 768 "onClick='scwStopPropagation(event);' " + 769 "cellspacing='0' cellpadding='0'>" + 770 "<tr id='scwDrag' style='display:none;'>" + 771 "<td colspan='4' class='scwDrag' " + 772 "onmousedown='scwBeginDrag(event);'>" + 773 "<div id='scwDragText'></div>" + 774 "</td>" + 775 "</tr>" + 776 "<tr class='scwHead'>" + 777 "<td class='scwHead'>" + 778 "<input class='scwHead' type='button' value='<' " + 779 "onclick='scwShowMonth(-1);' /></td>" + 780 "<td class='scwHead'>" + 781 "<select id='scwMonths' style='width: 55px;' class='scwHead' " + 782 "onChange='scwShowMonth(0);'>" + 783 "</select>" + 784 "</td>" + 785 "<td class='scwHead'>" + 786 "<select id='scwYears' style='width: 55px;' class='scwHead' " + 787 "onChange='scwShowMonth(0);'>" + 788 "</select>" + 789 "</td>" + 790 "<td class='scwHead'>" + 791 "<input class='scwHead' type='button' value='>' " + 792 "onclick='scwShowMonth(1);' /></td>" + 793 "</tr>" + 794 "</table>" + 795 "</td>" + 796 "</tr>" + 797 "<tr class='scw'>" + 798 "<td class='scw'>" + 799 "<table class='scwCells' align='center'>" + 800 "<thead>" + 801 "<tr><td class='scwWeekNumberHead' id='scwWeek_' ></td>" 802 ); 803for (i=0;i<7;i++) document.write( "<td class='scwWeek' id='scwWeekInit" + i + "'></td>"); 804document.write 805 ( 806 "</tr>" + 807 "</thead>" + 808 "<tbody id='scwCells' " + 809 "onClick='scwStopPropagation(event);'>" 810 ); 811for (i=0;i<6;i++) 812 { 813 document.write 814 ( 815 "<tr>" + 816 "<td class='scwWeekNo' id='scwWeek_" + i + "'></td>" 817 ); 818 for (j=0;j<7;j++) 819 { 820 document.write 821 ( 822 "<td class='scwCells' id='scwCell_" + (j+(i*7)) + 823 "'></td>" 824 ); 825 } 826 document.write("</tr>"); 827 } 828document.write("</tbody>"); 829if ((new Date(scwBaseYear + scwDropDownYears, 11, 32)) > scwDateNow && (new Date(scwBaseYear, 0, 0)) < scwDateNow) 830 { 831 document.write 832 ( 833 "<tfoot class='scwFoot'>" + 834 "<tr class='scwFoot'>" + 835 "<td class='scwFoot' id='scwFoot' colspan='8'>" + 836 "</td>" + 837 "</tr>" + 838 "</tfoot>" 839 ); 840 } 841document.write 842 ( 843 "</table>" + 844 "</td>" + 845 "</tr>" + 846 "</table>" 847 ); 848if (document.addEventListener) {document.addEventListener('click',scwHide, false);} 849else {document.attachEvent('onclick',scwHide);}
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.