var gdCtrl = new Object(); var goSelectTag = new Array(); var gcGray = "#808080"; var gcToggle = "#ffff00"; var gcBG = "#cccccc"; var gdCurDate = new Date(); var giYear = gdCurDate.getFullYear(); var giMonth = gdCurDate.getMonth()+1; var giDay = gdCurDate.getDate(); var gMonths = new Array(" 一月"," 二月"," 三月"," 四月"," 五月"," 六月"," 七月"," 八月"," 九月"," 十月","十一月","十二月"); function fPopCalendar(popCtrl, dateCtrl) { event.cancelBubble=true; gdCtrl = dateCtrl; fSetYearMon(giYear, giMonth); var point = fGetXY(popCtrl); with (VicPopCal.style) { //left = point.x; //top = point.y+popCtrl.offsetHeight+1; left = point.x + popCtrl.offsetWidth +1; top = point.y +popCtrl.offsetHeight - VicPopCal.offsetHeight/2; width = VicPopCal.offsetWidth; height = VicPopCal.offsetHeight; fToggleTags(point); visibility = 'visible'; } VicPopCal.focus(); } function fSetDate(iYear, iMonth, iDay) { var iMonthNew = new String(iMonth); var iDayNew = new String(iDay); if(iMonthNew.length < 2 ) iMonthNew = "0" + iMonthNew; if(iDayNew.length < 2 ) iDayNew = "0" + iDayNew; gdCtrl.value = iYear+"-"+iMonthNew+"-"+iDayNew; fHideCalendar(); } function fHideCalendar() { VicPopCal.style.visibility = "hidden"; for (i in goSelectTag) goSelectTag[i].style.visibility = "visible"; goSelectTag.length = 0; } function fSetSelected(aCell) { var iOffset = 0; var iYear = parseInt(tbSelYear.value); var iMonth = parseInt(tbSelMonth.value); aCell.bgColor = gcBG; with (aCell.children["cellText"]) { var iDay = parseInt(innerText); if (color==gcGray) iOffset = (Victor<10)?-1:1; iMonth += iOffset; if (iMonth<1) { iYear--; iMonth = 12; } else if (iMonth>12) { iYear++; iMonth = 1; } } fSetDate(iYear, iMonth, iDay); } function Point(iX, iY) { this.x = iX; this.y = iY; } function fBuildCal(iYear, iMonth) { var aMonth=new Array(); for(i=1;i<7;i++) aMonth[i]=new Array(i); var dCalDate=new Date(iYear, iMonth-1, 1); var iDayOfFirst=dCalDate.getDay(); var iDaysInMonth=new Date(iYear, iMonth, 0).getDate(); var iOffsetLast=new Date(iYear, iMonth-1, 0).getDate()-iDayOfFirst+1; var iDate = 1; var iNext = 1; for (d = 0; d < 7; d++) aMonth[1][d] = (d" + WeekDay[i] + ""); write(""); for (w = 1; w < 7; w++) //for (w = 1; w < 6; w++) { write(""); for (d = 0; d < 7; d++) { write(""); write(" "); write("") } write(""); } } } function fUpdateCal(iYear, iMonth) { myMonth = fBuildCal(iYear, iMonth); var i = 0; for (w = 0; w < 6; w++) //for (w = 0; w < 5; w++) for (d = 0; d < 7; d++) with (cellText[(7*w)+d]) { Victor = i++; if (myMonth[w+1][d]<0) { color = gcGray; innerText = -myMonth[w+1][d]; }else { color = ((d==0)||(d==6))?"red":"black"; innerText = myMonth[w+1][d]; } } } function fSetYearMon(iYear, iMon) { tbSelMonth.options[iMon-1].selected = true; for (i = 0; i < tbSelYear.length; i++) if (tbSelYear.options[i].value == iYear) tbSelYear.options[i].selected = true; fUpdateCal(iYear, iMon); } function fPrevMonth() { var iMon = tbSelMonth.value; var iYear = tbSelYear.value; if (--iMon<1) { iMon = 12; iYear--; } fSetYearMon(iYear, iMon); } function fNextMonth() { var iMon = tbSelMonth.value; var iYear = tbSelYear.value; if (++iMon>12) { iMon = 1; iYear++; } fSetYearMon(iYear, iMon); } function fToggleTags(){ with (document.all.tags("SELECT")) { for (i=0; ir)||(ptLT.x+aTag.offsetWidthb)||(ptLT.y+aTag.offsetHeight