123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757 |
- var __popcal4js_language = 'en';
- var __popcal4js_enablePast = 0;
- var __popcal4js_fixedX = -1;
- var __popcal4js_fixedY = -1;
- var __popcal4js_startAt = 1;
- var __popcal4js_showWeekNumber = 0;
- var __popcal4js_showToday = 1;
- var __popcal4js_imgDir = 'static/images/ucenter/';
- var __popcal4js_gotoString = {
- en : 'Current Date',
- cn : '当前日期'
- };
- var __popcal4js_todayString = {
- en : 'Today: ',
- cn : '今天:'
- };
- var __popcal4js_weekString = {
- en : 'W',
- cn : '周'
- };
- var __popcal4js_timeString = {
- en : 'Time: ',
- cn : '时间:'
- };
- var __popcal4js_scrollLeftMessage = {
- en : 'Last Month',
- cn : '上月'
- };
- var __popcal4js_scrollRightMessage = {
- en : 'Next Month',
- cn : '下月'
- };
- var __popcal4js_selectMonthMessage = {
- en : 'Select Month.',
- cn : '选择月份.'
- };
- var __popcal4js_selectYearMessage = {
- en : 'Select Year.',
- cn : '选择年份.'
- };
- var __popcal4js_selectDateMessage = {
- en : 'Go',
- cn : 'Go'
- };
- var __popcal4js_monthName = {
- en : new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'),
- cn : new Array('1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月')
- };
- var __popcal4js_monthName2 = {
- en : new Array('1','2','3','4','5','6','7','8','9','10','11','12'),
- cn : new Array('1','2','3','4','5','6','7','8','9','10','11','12')
- };
- var __popcal4js_dayNameTmp = {
- en : new Array('Sun','Mon','Tue','Wed','Thu','Fir','Sat'),
- cn : new Array('日','一','二','三','四','五','六')
- };
- var __popcal4js_dayNameAllTmp = {
- en : new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Firday','Saturday'),
- cn : new Array('星期日','星期一','星期二','星期三','星期四','星期五','星期六')
- };
- var __popcal4js_dayName = {
- en : new Array('','','','','','',''),
- cn : new Array('','','','','','','')
- };
- var __popcal4js_dayNameAll = {
- en : new Array('','','','','','',''),
- cn : new Array('','','','','','','')
- };
- var __popcal4js_dayNameIndex = 0;
- while(__popcal4js_dayNameIndex<7)
- {
- var __popcal4js_dayNameIndexTmp = __popcal4js_dayNameIndex+__popcal4js_startAt;
- if(__popcal4js_dayNameIndexTmp>6)
- {
- __popcal4js_dayNameIndexTmp = __popcal4js_dayNameIndexTmp-7;
- }
- __popcal4js_dayName['en'][__popcal4js_dayNameIndex] = __popcal4js_dayNameTmp['en'][__popcal4js_dayNameIndexTmp];
- __popcal4js_dayName['cn'][__popcal4js_dayNameIndex] = __popcal4js_dayNameTmp['cn'][__popcal4js_dayNameIndexTmp];
- __popcal4js_dayNameAll['en'][__popcal4js_dayNameIndex] = __popcal4js_dayNameAllTmp['en'][__popcal4js_dayNameIndexTmp];
- __popcal4js_dayNameAll['cn'][__popcal4js_dayNameIndex] = __popcal4js_dayNameAllTmp['cn'][__popcal4js_dayNameIndexTmp];
- __popcal4js_dayNameIndex++;
- }
- var __popcal4js_crossobj, __popcal4js_crossMonthObj, __popcal4js_crossYearObj;
- var __popcal4js_monthSelected, __popcal4js_yearSelected, __popcal4js_dateSelected;
- var __popcal4js_omonthSelected, __popcal4js_oyearSelected, __popcal4js_odateSelected;
- var __popcal4js_monthConstructed, __popcal4js_yearConstructed;
- var __popcal4js_intervalID1, __popcal4js_intervalID2, __popcal4js_timeoutID1, __popcal4js_timeoutID2;
- var __popcal4js_ctlToPlaceValue, __popcal4js_ctlNow, __popcal4js_dateFormat, __popcal4js_nStartingYear, __popcal4js_selDayAction, __popcal4js_isPast;
- var __popcal4js_visYear = 0;
- var __popcal4js_visMonth = 0;
- var __popcal4js_bPageLoaded = false;
- var __popcal4js_ie = document.all;
- var __popcal4js_dom = document.getElementById;
- var __popcal4js_ns4 = document.layers;
- var __popcal4js_today = new Date();
- var __popcal4js_dateNow = __popcal4js_today.getDate();
- var __popcal4js_monthNow = __popcal4js_today.getMonth();
- var __popcal4js_yearNow = __popcal4js_today.getYear();
- var __popcal4js_timeNow = __popcal4js_today.getHours() + ":" + __popcal4js_today.getMinutes() +":" + __popcal4js_today.getSeconds();
- var __popcal4js_imgsrc = new Array('./static/images/ucenter/popcal4js_drop1.gif','./static/images/ucenter/popcal4js_left1.gif','./static/images/ucenter/popcal4js_right1.gif');
- var __popcal4js_img = new Array();
- var __popcal4js_bShow = false;
- function hideElement_popcal4js( elmID, overDiv ) {
- if(__popcal4js_ie) {
- for(i = 0; i < document.all.tags( elmID ).length; i++) {
- obj = document.all.tags( elmID )[i];
- if(!obj || !obj.offsetParent) continue;
- // Find the element's offsetTop and offsetLeft relative to the BODY tag.
- objLeft = obj.offsetLeft;
- objTop = obj.offsetTop;
- objParent = obj.offsetParent;
- while(objParent.tagName.toUpperCase() != 'BODY' && objParent.tagName.toUpperCase() != 'HTML') {
- objLeft += objParent.offsetLeft;
- objTop += objParent.offsetTop;
- objParent = objParent.offsetParent;
- }
- objHeight = obj.offsetHeight;
- objWidth = obj.offsetWidth;
- if((overDiv.offsetLeft + overDiv.offsetWidth) <= objLeft);
- else if((overDiv.offsetTop + overDiv.offsetHeight) <= objTop);
- /* CHANGE by Charlie Roche for nested TDs*/
- else if(overDiv.offsetTop >= (objTop + objHeight + obj.height));
- /* END CHANGE */
- else if(overDiv.offsetLeft >= (objLeft + objWidth));
- else {
- obj.style.visibility = 'hidden';
- }
- }
- }
- }
- function showElement_popcal4js(elmID) {
- if(__popcal4js_ie) {
- for(i = 0; i < document.all.tags( elmID ).length; i++) {
- obj = document.all.tags(elmID)[i];
- if(!obj || !obj.offsetParent) continue;
- obj.style.visibility = '';
- }
- }
- }
- function HolidayRec_popcal4js (d, m, y, desc) {
- this.d = d;
- this.m = m;
- this.y = y;
- this.desc = desc;
- }
- var __popcal4js_HolidaysCounter = 0;
- var __popcal4js_Holidays = new Array();
- function addHoliday_popcal4js (d, m, y, desc) {
- __popcal4js_Holidays[__popcal4js_HolidaysCounter++] = new HolidayRec_popcal4js (d, m, y, desc);
- }
- function startCalendar_popcal4js(imgDir)
- {
- document.write("<style>");
- document.write(".popcal4js_onDate{line-height:15px;height:12px;verdana;font-size:12px;}");
- document.write(".popcal4js_onDate:link,.popcal4js_onDate:visited,.popcal4js_onDate:active{line-height:15px;height:12px;verdana;font-size:12px;}");
- document.write(".popcal4js_onDate:hover{background:#00ff00;line-height:15px;height:12px;verdana;font-size:12px;");
- document.write("</style>");
-
- if(imgDir != null) __popcal4js_imgDir = imgDir;
-
- if (__popcal4js_dom) {
- for (i=0;i<__popcal4js_imgsrc.length;i++) {
- __popcal4js_img[i] = new Image;
- __popcal4js_img[i].src = __popcal4js_imgDir + __popcal4js_imgsrc[i];
- }
- // iframe
- document.write ('<div id="__popcal4js_calendar_iframe" style="z-index:+998;position:absolute;visibility:hidden;"></div>');
-
- document.write ('<div onclick="__popcal4js_bShow=true" id="__popcal4js_calendar" style="z-index:+999;position:absolute;visibility:hidden;left:100px; top:100px;"><table width="'+((__popcal4js_showWeekNumber==1)?250:220)+'" style="font-family:ms shell dlg;font-size:12px;border: 1px solid #A0A0A0;" bgcolor="#ffffff"><tr style="background:#000066;"><td style="background:#000066;line-height:15px;height:12px;font-family:verdana;font-size:12px;"><table width="'+((__popcal4js_showWeekNumber==1)?248:218)+'"><tr><td style="padding:2px;font-family:ms shell dlg;font-size:12px;line-height:15px;height:12px;font-family:verdana;font-size:12px;background:#000066;"><font color="#ffffff' + '' /*C9D3E9*/ +'"><b><span id="__popcal4js_caption"></span></b></font></td><td align="right" style="background:#000066;line-height:15px;height:12px;font-family:verdana;font-size:12px;"><a href="javascript:hideCalendar_popcal4js()"><img src="./static/images/ucenter/popcal4js_close.gif" width="15" height="13" border="0" /></a></td></tr></table></td></tr><tr><td style="padding:5px;line-height:15px;height:12px;font-family:verdana;font-size:12px;" bgcolor="#ffffff"><span id="__popcal4js_content"></span></td></tr>');
- if (__popcal4js_showToday == 1) {
- document.write ('<tr bgcolor="#f0f0f0"><td style="background:#f0f0f0;padding:5px;line-height:15px;height:12px;font-family:verdana;font-size:12px;" align="center"><span id="__popcal4js_lblToday"></span></td></tr>');
- }
- document.write ('</table></div><div id="__popcal4js_selectMonth" style="z-index:+999;position:absolute;visibility:hidden;"></div><div id="__popcal4js_selectYear" style="z-index:+999;position:absolute;visibility:hidden;"></div>');
- }
- }
- var __popcal4js_styleAnchor = 'text-decoration:none;color:black;line-height:15px;height:12px;verdana;font-size:12px;';
- var __popcal4js_styleLightBorder = 'border:1px solid #a0a0a0;';
- function swapImage_popcal4js(srcImg, destImg) {
- if (__popcal4js_ie) document.getElementById(srcImg).setAttribute('src',__popcal4js_imgDir + destImg);
- }
- function init_popcal4js() {
- if (!__popcal4js_ns4)
- {
- if (!__popcal4js_ie) __popcal4js_yearNow += 1900;
- __popcal4js_crossobj=(__popcal4js_dom)?document.getElementById('__popcal4js_calendar').style : __popcal4js_ie? document.all.__popcal4js_calendar : document.__popcal4js_calendar;
- hideCalendar_popcal4js();
- __popcal4js_crossMonthObj = (__popcal4js_dom) ? document.getElementById('__popcal4js_selectMonth').style : __popcal4js_ie ? document.all.__popcal4js_selectMonth : document.__popcal4js_selectMonth;
- __popcal4js_crossYearObj = (__popcal4js_dom) ? document.getElementById('__popcal4js_selectYear').style : __popcal4js_ie ? document.all.__popcal4js_selectYear : document.__popcal4js_selectYear;
- __popcal4js_monthConstructed = false;
- __popcal4js_yearConstructed = false;
- sHTML1 = '<span id="__popcal4js_spanLeft" style="border:1px solid #36f;cursor:pointer" onclick="decMonth_popcal4js()" onmousedown="clearTimeout(__popcal4js_timeoutID1);__popcal4js_timeoutID1=setTimeout(\'StartDecMonth_popcal4js()\',500)" onmouseup="clearTimeout(__popcal4js_timeoutID1);clearInterval(__popcal4js_intervalID1)"> <img id="__popcal4js_changeLeft" src="./static/images/ucenter/popcal4js_left1.gif" width="10" height="11" border="0"> </span> ';
- sHTML1 += '<span id="__popcal4js_spanRight" style="border:1px solid #36f;cursor:pointer" onclick="incMonth_popcal4js()" onmousedown="clearTimeout(__popcal4js_timeoutID1);__popcal4js_timeoutID1=setTimeout(\'StartIncMonth_popcal4js()\',500)" onmouseup="clearTimeout(__popcal4js_timeoutID1);clearInterval(__popcal4js_intervalID1)"> <img id="__popcal4js_changeRight" src="./static/images/ucenter/popcal4js_right1.gif" width="10" height="11" border="0"> </span> ';
- sHTML1 += '<span id="__popcal4js_spanMonth" style="border:1px solid #36f;cursor:pointer" onclick="popUpMonth_popcal4js()"></span> ';
- sHTML1 += '<span id="__popcal4js_spanYear" style="border:1px solid #36f;cursor:pointer" onclick="popUpYear_popcal4js()"></span> ';
- document.getElementById('__popcal4js_caption').innerHTML = sHTML1;
- __popcal4js_bPageLoaded=true;
- }
- }
- function hideCalendar_popcal4js() {
- __popcal4js_crossobj.visibility = 'hidden';
- if (__popcal4js_crossMonthObj != null) __popcal4js_crossMonthObj.visibility = 'hidden';
- if (__popcal4js_crossYearObj != null) __popcal4js_crossYearObj.visibility = 'hidden';
- showElement_popcal4js('SELECT');
- showElement_popcal4js('APPLET');
-
- // iframe
- document.getElementById("__popcal4js_calendar_iframe").innerHTML = '';
- document.getElementById("__popcal4js_calendar_iframe").style.visibility = 'hidden';
- }
- function padZero_popcal4js(num) {
- return (num < 10) ? '0' + num : num;
- }
- function constructDate_popcal4js(d,m,y, t) {
- sTmp = __popcal4js_dateFormat;
- sTmp = sTmp.replace ('dd','<e>');
- sTmp = sTmp.replace ('d','<d>');
- sTmp = sTmp.replace ('<e>',padZero_popcal4js(d));
- sTmp = sTmp.replace ('<d>',d);
- sTmp = sTmp.replace ('mmmm','<p>');
- sTmp = sTmp.replace ('mmm','<o>');
- sTmp = sTmp.replace ('mm','<n>');
- sTmp = sTmp.replace ('m','<m>');
- sTmp = sTmp.replace ('<m>',m+1);
- sTmp = sTmp.replace ('<n>',padZero_popcal4js(m+1));
- sTmp = sTmp.replace ('<o>',__popcal4js_monthName[__popcal4js_language][m]);
- sTmp = sTmp.replace ('<p>',__popcal4js_monthName2[__popcal4js_language][m]);
- sTmp = sTmp.replace ('yyyy',y);
- sTmp = sTmp.replace ('yy',padZero_popcal4js(y%100));
- sTmp = sTmp.replace ('tt',t);
- return sTmp;
-
- }
- function closeCalendar_popcal4js() {
- var tt = "";
- if (__popcal4js_dateFormat.indexOf("tt") >= 0) {
- tt = document.getElementById('__popcal4js_txtNowTime').value;
- }
-
- hideCalendar_popcal4js();
- __popcal4js_ctlToPlaceValue.value = constructDate_popcal4js(__popcal4js_dateSelected,__popcal4js_monthSelected,__popcal4js_yearSelected, tt );
- }
- /*** Month Pulldown ***/
- function StartDecMonth_popcal4js() {
- __popcal4js_intervalID1 = setInterval("decMonth_popcal4js()",80);
- }
- function StartIncMonth_popcal4js() {
- __popcal4js_intervalID1 = setInterval("incMonth_popcal4js()",80);
- }
- function incMonth_popcal4js () {
- __popcal4js_monthSelected++;
- if (__popcal4js_monthSelected > 11) {
- __popcal4js_monthSelected = 0;
- __popcal4js_yearSelected++;
- }
- constructCalendar_popcal4js();
- }
- function decMonth_popcal4js () {
- __popcal4js_monthSelected--;
- if (__popcal4js_monthSelected < 0) {
- __popcal4js_monthSelected = 11;
- __popcal4js_yearSelected--;
- }
- constructCalendar_popcal4js();
- }
- function constructMonth_popcal4js() {
- popDownYear_popcal4js()
- if (!__popcal4js_monthConstructed) {
- sHTML = "";
- for (i=0; i<12; i++) {
- sName = __popcal4js_monthName[__popcal4js_language][i];
- if (i == __popcal4js_monthSelected){
- sName = '<b>' + sName + '</b>';
- }
- sHTML += '<tr><td id="__popcal4js_m' + i + '" style="background:#f0f0f0;cursor:pointer;line-height:15px;height:12px;font-family:verdana;font-size:12px;" onclick="__popcal4js_monthConstructed=false;__popcal4js_monthSelected=' + i + ';constructCalendar_popcal4js();popDownMonth_popcal4js();event.cancelBubble=true"><font color="#000066"> ' + sName + ' </font></td></tr>';
- }
- document.getElementById('__popcal4js_selectMonth').innerHTML = '<table width="70" style="font-family:ms shell dlg;font-size:12px;border:1px solid #a0a0a0;background:#f0f0f0;" bgcolor="#f0f0f0" cellspacing="0" >' + sHTML + '</table>';
- __popcal4js_monthConstructed = true;
- }
- }
- function popUpMonth_popcal4js() {
- if (__popcal4js_visMonth == 1) {
- popDownMonth_popcal4js();
- __popcal4js_visMonth--;
- } else {
- constructMonth_popcal4js();
- __popcal4js_crossMonthObj.visibility = (__popcal4js_dom||__popcal4js_ie) ? 'visible' : 'show';
- __popcal4js_crossMonthObj.left = parseInt(__popcal4js_crossobj.left) + 50 + "px";
- __popcal4js_crossMonthObj.top = parseInt(__popcal4js_crossobj.top) + 26 + "px";
- if(browser.isIE && browser.version<7)//在ie6及以下版本隐藏select和增加ifreame
- {
- hideElement_popcal4js('SELECT', document.getElementById('__popcal4js_selectMonth'));
- }
- hideElement_popcal4js('APPLET', document.getElementById('__popcal4js_selectMonth'));
- __popcal4js_visMonth++;
- }
- }
- function popDownMonth_popcal4js() {
- __popcal4js_crossMonthObj.visibility = 'hidden';
- __popcal4js_visMonth = 0;
- }
- /*** Year Pulldown ***/
- function incYear_popcal4js() {
- for (i=0; i<7; i++) {
- newYear = (i + __popcal4js_nStartingYear) + 1;
- if (newYear == __popcal4js_yearSelected)
- txtYear = '<font style="color:#006;font-weight:bold;"> ' + newYear + ' </font>';
- else
- txtYear = '<font style="color:#006;"> ' + newYear + ' </font>';
- document.getElementById('__popcal4js_y'+i).innerHTML = txtYear;
- }
- __popcal4js_nStartingYear++;
- __popcal4js_bShow=true;
- }
- function decYear_popcal4js() {
- for (i=0; i<7; i++) {
- newYear = (i + __popcal4js_nStartingYear) - 1;
- if (newYear == __popcal4js_yearSelected)
- txtYear = '<font style="color:#006;font-weight:bold"> ' + newYear + ' </font>';
- else
- txtYear = '<font style="color:#006;"> ' + newYear + ' </font>';
- document.getElementById('__popcal4js_y'+i).innerHTML = txtYear;
- }
- __popcal4js_nStartingYear--;
- __popcal4js_bShow=true;
- }
- function selectYear_popcal4js(nYear) {
- __popcal4js_yearSelected = parseInt(nYear + __popcal4js_nStartingYear);
- __popcal4js_yearConstructed = false;
- constructCalendar_popcal4js();
- popDownYear_popcal4js();
- }
- function constructYear_popcal4js() {
- popDownMonth_popcal4js();
- sHTML = '';
- if (!__popcal4js_yearConstructed) {
- sHTML = '<tr><td align="center" style="background:#f0f0f0;cursor:pointer;line-height:15px;height:12px;font-family:verdana;font-size:12px;" onmousedown="clearInterval(__popcal4js_intervalID1);__popcal4js_intervalID1=setInterval(\'decYear_popcal4js()\',30);" onmouseup="clearInterval(__popcal4js_intervalID1)"><font color="#000066">-</font></td></tr>';
- j = 0;
- __popcal4js_nStartingYear = __popcal4js_yearSelected - 3;
- for ( i = (__popcal4js_yearSelected-3); i <= (__popcal4js_yearSelected+3); i++ ) {
- sName = i;
- if (i == __popcal4js_yearSelected) sName = '<b>' + sName + '</b>';
- sHTML += '<tr><td height="25" id="__popcal4js_y' + j + '" style="background:#f0f0f0;cursor:pointer;line-height:15px;height:12px;font-family:verdana;font-size:12px;" onclick="selectYear_popcal4js('+j+');event.cancelBubble=true"><font color="#000066"> ' + sName + ' </font></td></tr>';
- j++;
- }
- sHTML += '<tr><td height="25" align="center" style="background:#f0f0f0;cursor:pointer;line-height:15px;height:12px;font-family:verdana;font-size:12px;" onmousedown="clearInterval(__popcal4js_intervalID2);__popcal4js_intervalID2=setInterval(\'incYear_popcal4js()\',30);" onmouseup="clearInterval(__popcal4js_intervalID2)"><font color="#000066">+</font></td></tr>';
- document.getElementById('__popcal4js_selectYear').innerHTML = '<table width="44" cellspacing="0" bgcolor="#f0f0f0" style="font-family:ms shell dlg;font-size:12px;border:1px solid #a0a0a0;" >' + sHTML + '</table>';
- __popcal4js_yearConstructed = true;
- }
- }
- function popDownYear_popcal4js() {
- clearInterval(__popcal4js_intervalID1);
- clearTimeout(__popcal4js_timeoutID1);
- clearInterval(__popcal4js_intervalID2);
- clearTimeout(__popcal4js_timeoutID2);
- __popcal4js_crossYearObj.visibility= 'hidden';
- __popcal4js_visYear = 0;
- }
- function popUpYear_popcal4js() {
- var leftOffset
- if (__popcal4js_visYear==1) {
- popDownYear_popcal4js();
- __popcal4js_visYear--;
- } else {
- constructYear_popcal4js();
- __popcal4js_crossYearObj.visibility = (__popcal4js_dom||__popcal4js_ie) ? 'visible' : 'show';
- leftOffset = parseInt(__popcal4js_crossobj.left) + document.getElementById('__popcal4js_spanYear').offsetLeft;
- if (__popcal4js_ie) leftOffset += 6;
- __popcal4js_crossYearObj.left = leftOffset + "px";
- __popcal4js_crossYearObj.top = parseInt(__popcal4js_crossobj.top) + 26 + "px";
- __popcal4js_visYear++;
- }
- }
- /*** calendar ***/
- function WeekNbr_popcal4js(n) {
- // Algorithm used:
- // From Klaus Tondering's Calendar document (The Authority/Guru)
- // http://www.tondering.dk/claus/calendar.html
- // a = (14-month) / 12
- // y = year + 4800 - a
- // m = month + 12a - 3
- // J = day + (153m + 2) / 5 + 365y + y / 4 - y / 100 + y / 400 - 32045
- // d4 = (J + 31741 - (J mod 7)) mod 146097 mod 36524 mod 1461
- // L = d4 / 1460
- // d1 = ((d4 - L) mod 365) + L
- // WeekNumber = d1 / 7 + 1
- year = n.getFullYear();
- month = n.getMonth() + 1;
- if (__popcal4js_startAt == 0) {
- day = n.getDate() + 1;
- } else {
- day = n.getDate();
- }
- a = Math.floor((14-month) / 12);
- y = year + 4800 - a;
- m = month + 12 * a - 3;
- b = Math.floor(y/4) - Math.floor(y/100) + Math.floor(y/400);
- J = day + Math.floor((153 * m + 2) / 5) + 365 * y + b - 32045;
- d4 = (((J + 31741 - (J % 7)) % 146097) % 36524) % 1461;
- L = Math.floor(d4 / 1460);
- d1 = ((d4 - L) % 365) + L;
- week = Math.floor(d1/7) + 1;
- return week;
- }
- function constructCalendar_popcal4js () {
- var aNumDays = Array (31,0,31,30,31,30,31,31,30,31,30,31);
- var dateMessage;
- var startDate = new Date (__popcal4js_yearSelected,__popcal4js_monthSelected,1);
- var endDate;
- if (__popcal4js_monthSelected==1) {
- endDate = new Date (__popcal4js_yearSelected,__popcal4js_monthSelected+1,1);
- endDate = new Date (endDate - (24*60*60*1000));
- numDaysInMonth = endDate.getDate();
- } else {
- numDaysInMonth = aNumDays[__popcal4js_monthSelected];
- }
- datePointer = 0;
- dayPointer = startDate.getDay() - __popcal4js_startAt;
-
- if (dayPointer<0) dayPointer = 6;
- sHTML = '<table border="0" cellSpacing="0" cellPadding="1" width="100%" style="font-family:verdana;font-size:12px;"><tr>';
- if (__popcal4js_showWeekNumber == 1) {
- sHTML += '<td width="27" style="line-height:15px;height:12px;font-family:verdana;font-size:12px;"><b>' + __popcal4js_weekString[__popcal4js_language] + '</b></td><td width="1" rowspan="7" bgcolor="#d0d0d0" style="padding:0px;line-height:15px;height:12px;font-family:verdana;font-size:12px;"><img src="./static/images/ucenter/divider.gif" width="1"></td>';
- }
- for (i = 0; i<7; i++) {
- sHTML += '<td width="27" align="right" style="line-height:15px;height:12px;font-family:verdana;font-size:12px;"><b><font color="#000066">' + __popcal4js_dayName[__popcal4js_language][i] + '</font></b></td>';
- }
- sHTML += '</tr><tr>';
-
- if (__popcal4js_showWeekNumber == 1) {
- sHTML += '<td align="right" style="line-height:15px;height:12px;font-family:verdana;font-size:12px;">' + WeekNbr_popcal4js(startDate) + ' </td>';
- }
- for ( var i=1; i<=dayPointer;i++ ) {
- sHTML += '<td style="line-height:15px;height:12px;font-family:verdana;font-size:12px;"> </td>';
- }
-
- for ( datePointer=1; datePointer <= numDaysInMonth; datePointer++ ) {
- dayPointer++;
- sHTML += '<td align="right" style="line-height:15px;height:12px;font-family:verdana;font-size:12px;">';
-
- var sStyle=__popcal4js_styleAnchor;
- var sClass = 'popcal4js_onDate';
- if ((datePointer == __popcal4js_odateSelected) && (__popcal4js_monthSelected == __popcal4js_omonthSelected) && (__popcal4js_yearSelected == __popcal4js_oyearSelected))
- {
- sStyle+=__popcal4js_styleLightBorder;
- sClass = 'popcal4js_onDate';
- }
- sHint = '';
- for (k = 0;k < __popcal4js_HolidaysCounter; k++) {
- if ((parseInt(__popcal4js_Holidays[k].d) == datePointer)&&(parseInt(__popcal4js_Holidays[k].m) == (__popcal4js_monthSelected+1))) {
- if ((parseInt(__popcal4js_Holidays[k].y)==0)||((parseInt(__popcal4js_Holidays[k].y)==__popcal4js_yearSelected)&&(parseInt(__popcal4js_Holidays[k].y)!=0))) {
- sStyle+= 'background-color:#fdd;';
- sHint += sHint=="" ? __popcal4js_Holidays[k].desc : "\n"+__popcal4js_Holidays[k].desc;
- }
- }
- }
- sHint = sHint.replace('/\"/g', '"');
- dateMessage = 'onmousemove="window.status=\''+__popcal4js_selectDateMessage[__popcal4js_language].replace('[date]',constructDate_popcal4js(datePointer,__popcal4js_monthSelected,__popcal4js_yearSelected, __popcal4js_timeNow))+'\'" onmouseout="window.status=\'\'" ';
-
- if (__popcal4js_enablePast == 0 && ((__popcal4js_yearSelected < __popcal4js_yearNow) || (__popcal4js_monthSelected < __popcal4js_monthNow) && (__popcal4js_yearSelected == __popcal4js_yearNow) || (datePointer < __popcal4js_dateNow) && (__popcal4js_monthSelected == __popcal4js_monthNow) && (__popcal4js_yearSelected == __popcal4js_yearNow))) {
- //__popcal4js_selDayAction = '';
- __popcal4js_selDayAction = 'href="javascript:__popcal4js_dateSelected=' + datePointer + ';closeCalendar_popcal4js();"';
- __popcal4js_isPast = 1;
- } else {
- __popcal4js_selDayAction = 'href="javascript:__popcal4js_dateSelected=' + datePointer + ';closeCalendar_popcal4js();"';
- __popcal4js_isPast = 0;
- }
- if ((datePointer == __popcal4js_dateNow) && (__popcal4js_monthSelected == __popcal4js_monthNow) && (__popcal4js_yearSelected == __popcal4js_yearNow)) { ///// today
- sHTML += "<b><a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+"> <font color=#ff0000><strong>" + datePointer + "</strong></font> </a></b>";
- } else if (dayPointer % 7 == (__popcal4js_startAt * -1)+1) { ///// SI ES DOMINGO
- if (__popcal4js_isPast==1)
- sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+"> <font color=#909090 style='font-family:verdana;font-size:12px;'>" + datePointer + "</font> </a>";
- else
- sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+"> <font color=#ff3535>" + datePointer + "</font> </a>";
- } else if ((dayPointer % 7 == (__popcal4js_startAt * -1)+7 && __popcal4js_startAt==1) || (dayPointer % 7 == __popcal4js_startAt && __popcal4js_startAt==0)) { ///// SI ES SABADO
- if (__popcal4js_isPast==1)
- sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+"> <font color=#909090 style='font-family:verdana;font-size:12px;'>" + datePointer + "</font> </a>";
- else
- sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+"> <font color=#ff3535 style='font-family:verdana;font-size:12px;'>" + datePointer + "</font> </a>";
- } else { ///// CUALQUIER OTRO DIA
- if (__popcal4js_isPast==1)
- sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+"> <font color=#909090 style='font-family:verdana;font-size:12px;'>" + datePointer + "</font> </a>";
- else
- sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+"> <font color=#000066 style='font-family:verdana;font-size:12px;'>" + datePointer + "</font> </a>";
- }
-
- sHTML += '';
- if ((dayPointer+__popcal4js_startAt) % 7 == __popcal4js_startAt) {
- sHTML += '</tr><tr>';
- if ((__popcal4js_showWeekNumber == 1) && (datePointer < numDaysInMonth)) {
- sHTML += '<td align="right" style="line-height:15px;height:12px;font-family:verdana;font-size:12px;">' + (WeekNbr_popcal4js(new Date(__popcal4js_yearSelected,__popcal4js_monthSelected,datePointer+1))) + ' </td>';
- }
- }
- }
- document.getElementById('__popcal4js_content').innerHTML = sHTML
- document.getElementById('__popcal4js_spanMonth').innerHTML = ' <font style="color:#ffffff;">' + __popcal4js_monthName[__popcal4js_language][__popcal4js_monthSelected] + '</font> <img id="__popcal4js_changeMonth" src="./static/images/ucenter/popcal4js_drop1.gif" width="12" height="10" border="0">'
- document.getElementById('__popcal4js_spanYear').innerHTML = ' <font style="color:#ffffff;">' + __popcal4js_yearSelected + '</font> <img id="__popcal4js_changeYear" src="./static/images/ucenter/popcal4js_drop1.gif" width="12" height="10" border="0">';
- }
- function showCalendar_popcal4js(ctl, ctl2, format, lang, past, fx, fy, startAt, showWeekNumber, showToday) {
- if (lang != null && lang != '') __popcal4js_language = lang;
- if (past != null) __popcal4js_enablePast = past;
- if (fx != null) __popcal4js_fixedX = fx;
- if (fy != null) __popcal4js_fixedY = fy;
- if(startAt != null) __popcal4js_startAt = startAt;
- if(showWeekNumber != null) __popcal4js_showWeekNumber = showWeekNumber;
- if(showToday != null) __popcal4js_showToday = showToday;
- if (__popcal4js_showToday == 1) {
- if(__popcal4js_language == 'en')
- document.getElementById('__popcal4js_lblToday').innerHTML = '<font color="#000066">' + __popcal4js_todayString[__popcal4js_language] + '<a onmousemove="window.status=\''+__popcal4js_gotoString[__popcal4js_language]+'\'" onmouseout="window.status=\'\'" title="'+__popcal4js_gotoString[__popcal4js_language]+'" style="'+__popcal4js_styleAnchor+'" href="javascript:__popcal4js_monthSelected=__popcal4js_monthNow;__popcal4js_yearSelected=__popcal4js_yearNow;constructCalendar_popcal4js();">'+__popcal4js_dayNameAll[__popcal4js_language][(__popcal4js_today.getDay()-__popcal4js_startAt==-1)?6:(__popcal4js_today.getDay()-__popcal4js_startAt)]+' '+__popcal4js_monthName[__popcal4js_language][__popcal4js_monthNow].substring(0,3)+'. '+__popcal4js_dateNow+' '+__popcal4js_yearNow+'</a></font>';
- if(__popcal4js_language == 'cn')
- document.getElementById('__popcal4js_lblToday').innerHTML = '<font color="#000066">' + __popcal4js_todayString[__popcal4js_language] + '<a onmousemove="window.status=\''+__popcal4js_gotoString[__popcal4js_language]+'\'" onmouseout="window.status=\'\'" title="'+__popcal4js_gotoString[__popcal4js_language]+'" style="'+__popcal4js_styleAnchor+'" href="javascript:__popcal4js_monthSelected=__popcal4js_monthNow;__popcal4js_yearSelected=__popcal4js_yearNow;constructCalendar_popcal4js();">'+__popcal4js_dayNameAll[__popcal4js_language][(__popcal4js_today.getDay()-__popcal4js_startAt==-1)?6:(__popcal4js_today.getDay()-__popcal4js_startAt)]+' '+__popcal4js_yearNow+'年'+ __popcal4js_monthName[__popcal4js_language][__popcal4js_monthNow].substring(0,3)+__popcal4js_dateNow+'日</a></font>';
- }
-
- if (format.indexOf("tt") >= 0) {
- document.getElementById('__popcal4js_lblToday').innerHTML += '<br>' + __popcal4js_timeString[__popcal4js_language] + '<input type="text" id="__popcal4js_txtNowTime" name="__popcal4js_txtNowTime" value="' + __popcal4js_timeNow + '" style="width:65px;border:0px;">';
- }
-
- popUpCalendar_popcal4js(ctl, ctl2, format);
- }
- function popUpCalendar_popcal4js(ctl, ctl2, format) {
- var leftpos = 0;
- var toppos = 0;
- if (__popcal4js_bPageLoaded) {
- if (__popcal4js_crossobj.visibility == 'hidden') {
- __popcal4js_ctlToPlaceValue = ctl2;
- __popcal4js_dateFormat = format;
-
- var format_date = __popcal4js_dateFormat.split(' ')[0]; // get date, no time
- formatChar = ' ';
- aFormat = format_date.split(formatChar);
- if (aFormat.length < 3) {
- formatChar = '/';
- aFormat = format_date.split(formatChar);
- if (aFormat.length < 3) {
- formatChar = '.';
- aFormat = format_date.split(formatChar);
- if (aFormat.length < 3) {
- formatChar = '-';
- aFormat = format_date.split(formatChar);
- if (aFormat.length < 3) {
- formatChar = ''; // invalid date format
- }
- }
- }
- }
-
- tokensChanged = 0;
- if (formatChar != "") {
- var aDataTmp = ctl2.value.split(' ')[0]; // get date, no time
- aData = aDataTmp.split(formatChar); // use user's date
- for (i=0; i<3; i++) {
- if ((aFormat[i] == "d") || (aFormat[i] == "dd")) {
- __popcal4js_dateSelected = parseInt(aData[i], 10);
- tokensChanged++;
- } else if ((aFormat[i] == "m") || (aFormat[i] == "mm")) {
- __popcal4js_monthSelected = parseInt(aData[i], 10) - 1;
- tokensChanged++;
- } else if (aFormat[i] == "yyyy") {
- __popcal4js_yearSelected = parseInt(aData[i], 10);
- tokensChanged++;
- } else if (aFormat[i] == "mmm") {
- for (j=0; j<12; j++) {
- if (aData[i] == __popcal4js_monthName[__popcal4js_language][j]) {
- __popcal4js_monthSelected=j;
- tokensChanged++;
- }
- }
- } else if (aFormat[i] == "mmmm") {
- for (j=0; j<12; j++) {
- if (aData[i] == __popcal4js_monthName2[__popcal4js_language][j]) {
- __popcal4js_monthSelected = j;
- tokensChanged++;
- }
- }
- }
- }
- }
- if ((tokensChanged != 3) || isNaN(__popcal4js_dateSelected) || isNaN(__popcal4js_monthSelected) || isNaN(__popcal4js_yearSelected)) {
- __popcal4js_dateSelected = __popcal4js_dateNow;
- __popcal4js_monthSelected = __popcal4js_monthNow;
- __popcal4js_yearSelected = __popcal4js_yearNow;
- }
- __popcal4js_odateSelected = __popcal4js_dateSelected;
- __popcal4js_omonthSelected = __popcal4js_monthSelected;
- __popcal4js_oyearSelected = __popcal4js_yearSelected;
- aTag = ctl;
- do {
- //alert(aTag.offsetParent.tagName);
- aTag = aTag.offsetParent;
- leftpos += aTag.offsetLeft;
- toppos += aTag.offsetTop;
- } while (aTag.tagName != 'BODY' && aTag.offsetParent.tagName!='HTML');
-
- //在top和left数值后面加px,已保证在XHTML 1.0下FireFox中正常显示
- __popcal4js_crossobj.left = (__popcal4js_fixedX == -1) ? ctl.offsetLeft + leftpos + "px" : __popcal4js_fixedX + "px";
- __popcal4js_crossobj.top = (__popcal4js_fixedY == -1) ? ctl.offsetTop + toppos + ctl.offsetHeight + 2 + "px" : __popcal4js_fixedY + "px";
-
- constructCalendar_popcal4js (1, __popcal4js_monthSelected, __popcal4js_yearSelected);
- __popcal4js_crossobj.visibility = (__popcal4js_dom||__popcal4js_ie) ? "visible" : "show";
- var browser = new Browser_popcal4js();
- hideElement_popcal4js('APPLET', document.getElementById('__popcal4js_calendar'));
- if(browser.isIE && browser.version<7)//在ie6及以下版本隐藏select和增加ifreame
- {
- hideElement_popcal4js('SELECT', document.getElementById('__popcal4js_calendar'));
- // iframe
- document.getElementById("__popcal4js_calendar_iframe").innerHTML = "<iframe scr='' name='__popcal4js__iframe' width='"+((__popcal4js_showWeekNumber==1)?248:218)+"' height='180' border=0 NORESIZE=NORESIZE SCROLLING=no MARGINWIDTH=0 MARGINHEIGHT=0 FRAMESPACING=0 FRAMEBORDER=0></iframe>";
- document.getElementById("__popcal4js_calendar_iframe").style.visibility = "";
- document.getElementById("__popcal4js_calendar_iframe").style.left = __popcal4js_crossobj.left;
- document.getElementById("__popcal4js_calendar_iframe").style.top = __popcal4js_crossobj.top
- }
- __popcal4js_bShow = true;
- } else {
- hideCalendar_popcal4js();
- if (__popcal4js_ctlNow!=ctl) popUpCalendar_popcal4js(ctl, ctl2, format);
- }
- __popcal4js_ctlNow = ctl;
- }
- }
- document.onkeypress = function hidecal1 (ev) {
- var ev = window.event || ev;
- var k = ev.keyCode || ev.which;
- if (k == 27) hideCalendar_popcal4js();
- }
- document.onclick = function hidecal2 () {
- if (!__popcal4js_bShow) hideCalendar_popcal4js();
- __popcal4js_bShow = false;
- }
- /*
- if(__popcal4js_ie) {
- init_popcal4js();
- } else {
- window.onload = init_popcal4js;
- }
- */
- if (document.all){
- window.attachEvent('onload',init_popcal4js)
- }
- else{
- window.addEventListener('load',init_popcal4js,false);
- }
- // 判断浏览器版本信息
- function Browser_popcal4js() {
- var ua, s, i;
- this.isIE = false; // Internet Explorer
- this.isNS = false; // Netscape
- this.version = null;
- ua = navigator.userAgent;
- s = "MSIE";
- if ((i = ua.indexOf(s)) >= 0) {
- this.isIE = true;
- this.version = parseFloat(ua.substr(i + s.length));
- return;
- }
- s = "Netscape6/";
- if ((i = ua.indexOf(s)) >= 0) {
- this.isNS = true;
- this.version = parseFloat(ua.substr(i + s.length));
- return;
- }
- // Treat any other "Gecko" browser as NS 6.1.
- s = "Gecko";
- if ((i = ua.indexOf(s)) >= 0) {
- this.isNS = true;
- this.version = 6.1;
- return;
- }
- }
|