date.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. var __popcal4js_language = 'en';
  2. var __popcal4js_enablePast = 0;
  3. var __popcal4js_fixedX = -1;
  4. var __popcal4js_fixedY = -1;
  5. var __popcal4js_startAt = 1;
  6. var __popcal4js_showWeekNumber = 0;
  7. var __popcal4js_showToday = 1;
  8. var __popcal4js_imgDir = 'static/images/ucenter/';
  9. var __popcal4js_gotoString = {
  10. en : 'Current Date',
  11. cn : '当前日期'
  12. };
  13. var __popcal4js_todayString = {
  14. en : 'Today: ',
  15. cn : '今天:'
  16. };
  17. var __popcal4js_weekString = {
  18. en : 'W',
  19. cn : '周'
  20. };
  21. var __popcal4js_timeString = {
  22. en : 'Time: ',
  23. cn : '时间:'
  24. };
  25. var __popcal4js_scrollLeftMessage = {
  26. en : 'Last Month',
  27. cn : '上月'
  28. };
  29. var __popcal4js_scrollRightMessage = {
  30. en : 'Next Month',
  31. cn : '下月'
  32. };
  33. var __popcal4js_selectMonthMessage = {
  34. en : 'Select Month.',
  35. cn : '选择月份.'
  36. };
  37. var __popcal4js_selectYearMessage = {
  38. en : 'Select Year.',
  39. cn : '选择年份.'
  40. };
  41. var __popcal4js_selectDateMessage = {
  42. en : 'Go',
  43. cn : 'Go'
  44. };
  45. var __popcal4js_monthName = {
  46. en : new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'),
  47. cn : new Array('1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月')
  48. };
  49. var __popcal4js_monthName2 = {
  50. en : new Array('1','2','3','4','5','6','7','8','9','10','11','12'),
  51. cn : new Array('1','2','3','4','5','6','7','8','9','10','11','12')
  52. };
  53. var __popcal4js_dayNameTmp = {
  54. en : new Array('Sun','Mon','Tue','Wed','Thu','Fir','Sat'),
  55. cn : new Array('日','一','二','三','四','五','六')
  56. };
  57. var __popcal4js_dayNameAllTmp = {
  58. en : new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Firday','Saturday'),
  59. cn : new Array('星期日','星期一','星期二','星期三','星期四','星期五','星期六')
  60. };
  61. var __popcal4js_dayName = {
  62. en : new Array('','','','','','',''),
  63. cn : new Array('','','','','','','')
  64. };
  65. var __popcal4js_dayNameAll = {
  66. en : new Array('','','','','','',''),
  67. cn : new Array('','','','','','','')
  68. };
  69. var __popcal4js_dayNameIndex = 0;
  70. while(__popcal4js_dayNameIndex<7)
  71. {
  72. var __popcal4js_dayNameIndexTmp = __popcal4js_dayNameIndex+__popcal4js_startAt;
  73. if(__popcal4js_dayNameIndexTmp>6)
  74. {
  75. __popcal4js_dayNameIndexTmp = __popcal4js_dayNameIndexTmp-7;
  76. }
  77. __popcal4js_dayName['en'][__popcal4js_dayNameIndex] = __popcal4js_dayNameTmp['en'][__popcal4js_dayNameIndexTmp];
  78. __popcal4js_dayName['cn'][__popcal4js_dayNameIndex] = __popcal4js_dayNameTmp['cn'][__popcal4js_dayNameIndexTmp];
  79. __popcal4js_dayNameAll['en'][__popcal4js_dayNameIndex] = __popcal4js_dayNameAllTmp['en'][__popcal4js_dayNameIndexTmp];
  80. __popcal4js_dayNameAll['cn'][__popcal4js_dayNameIndex] = __popcal4js_dayNameAllTmp['cn'][__popcal4js_dayNameIndexTmp];
  81. __popcal4js_dayNameIndex++;
  82. }
  83. var __popcal4js_crossobj, __popcal4js_crossMonthObj, __popcal4js_crossYearObj;
  84. var __popcal4js_monthSelected, __popcal4js_yearSelected, __popcal4js_dateSelected;
  85. var __popcal4js_omonthSelected, __popcal4js_oyearSelected, __popcal4js_odateSelected;
  86. var __popcal4js_monthConstructed, __popcal4js_yearConstructed;
  87. var __popcal4js_intervalID1, __popcal4js_intervalID2, __popcal4js_timeoutID1, __popcal4js_timeoutID2;
  88. var __popcal4js_ctlToPlaceValue, __popcal4js_ctlNow, __popcal4js_dateFormat, __popcal4js_nStartingYear, __popcal4js_selDayAction, __popcal4js_isPast;
  89. var __popcal4js_visYear = 0;
  90. var __popcal4js_visMonth = 0;
  91. var __popcal4js_bPageLoaded = false;
  92. var __popcal4js_ie = document.all;
  93. var __popcal4js_dom = document.getElementById;
  94. var __popcal4js_ns4 = document.layers;
  95. var __popcal4js_today = new Date();
  96. var __popcal4js_dateNow = __popcal4js_today.getDate();
  97. var __popcal4js_monthNow = __popcal4js_today.getMonth();
  98. var __popcal4js_yearNow = __popcal4js_today.getYear();
  99. var __popcal4js_timeNow = __popcal4js_today.getHours() + ":" + __popcal4js_today.getMinutes() +":" + __popcal4js_today.getSeconds();
  100. var __popcal4js_imgsrc = new Array('./static/images/ucenter/popcal4js_drop1.gif','./static/images/ucenter/popcal4js_left1.gif','./static/images/ucenter/popcal4js_right1.gif');
  101. var __popcal4js_img = new Array();
  102. var __popcal4js_bShow = false;
  103. function hideElement_popcal4js( elmID, overDiv ) {
  104. if(__popcal4js_ie) {
  105. for(i = 0; i < document.all.tags( elmID ).length; i++) {
  106. obj = document.all.tags( elmID )[i];
  107. if(!obj || !obj.offsetParent) continue;
  108. // Find the element's offsetTop and offsetLeft relative to the BODY tag.
  109. objLeft = obj.offsetLeft;
  110. objTop = obj.offsetTop;
  111. objParent = obj.offsetParent;
  112. while(objParent.tagName.toUpperCase() != 'BODY' && objParent.tagName.toUpperCase() != 'HTML') {
  113. objLeft += objParent.offsetLeft;
  114. objTop += objParent.offsetTop;
  115. objParent = objParent.offsetParent;
  116. }
  117. objHeight = obj.offsetHeight;
  118. objWidth = obj.offsetWidth;
  119. if((overDiv.offsetLeft + overDiv.offsetWidth) <= objLeft);
  120. else if((overDiv.offsetTop + overDiv.offsetHeight) <= objTop);
  121. /* CHANGE by Charlie Roche for nested TDs*/
  122. else if(overDiv.offsetTop >= (objTop + objHeight + obj.height));
  123. /* END CHANGE */
  124. else if(overDiv.offsetLeft >= (objLeft + objWidth));
  125. else {
  126. obj.style.visibility = 'hidden';
  127. }
  128. }
  129. }
  130. }
  131. function showElement_popcal4js(elmID) {
  132. if(__popcal4js_ie) {
  133. for(i = 0; i < document.all.tags( elmID ).length; i++) {
  134. obj = document.all.tags(elmID)[i];
  135. if(!obj || !obj.offsetParent) continue;
  136. obj.style.visibility = '';
  137. }
  138. }
  139. }
  140. function HolidayRec_popcal4js (d, m, y, desc) {
  141. this.d = d;
  142. this.m = m;
  143. this.y = y;
  144. this.desc = desc;
  145. }
  146. var __popcal4js_HolidaysCounter = 0;
  147. var __popcal4js_Holidays = new Array();
  148. function addHoliday_popcal4js (d, m, y, desc) {
  149. __popcal4js_Holidays[__popcal4js_HolidaysCounter++] = new HolidayRec_popcal4js (d, m, y, desc);
  150. }
  151. function startCalendar_popcal4js(imgDir)
  152. {
  153. document.write("<style>");
  154. document.write(".popcal4js_onDate{line-height:15px;height:12px;verdana;font-size:12px;}");
  155. document.write(".popcal4js_onDate:link,.popcal4js_onDate:visited,.popcal4js_onDate:active{line-height:15px;height:12px;verdana;font-size:12px;}");
  156. document.write(".popcal4js_onDate:hover{background:#00ff00;line-height:15px;height:12px;verdana;font-size:12px;");
  157. document.write("</style>");
  158. if(imgDir != null) __popcal4js_imgDir = imgDir;
  159. if (__popcal4js_dom) {
  160. for (i=0;i<__popcal4js_imgsrc.length;i++) {
  161. __popcal4js_img[i] = new Image;
  162. __popcal4js_img[i].src = __popcal4js_imgDir + __popcal4js_imgsrc[i];
  163. }
  164. // iframe
  165. document.write ('<div id="__popcal4js_calendar_iframe" style="z-index:+998;position:absolute;visibility:hidden;"></div>');
  166. 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>');
  167. if (__popcal4js_showToday == 1) {
  168. 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>');
  169. }
  170. 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>');
  171. }
  172. }
  173. var __popcal4js_styleAnchor = 'text-decoration:none;color:black;line-height:15px;height:12px;verdana;font-size:12px;';
  174. var __popcal4js_styleLightBorder = 'border:1px solid #a0a0a0;';
  175. function swapImage_popcal4js(srcImg, destImg) {
  176. if (__popcal4js_ie) document.getElementById(srcImg).setAttribute('src',__popcal4js_imgDir + destImg);
  177. }
  178. function init_popcal4js() {
  179. if (!__popcal4js_ns4)
  180. {
  181. if (!__popcal4js_ie) __popcal4js_yearNow += 1900;
  182. __popcal4js_crossobj=(__popcal4js_dom)?document.getElementById('__popcal4js_calendar').style : __popcal4js_ie? document.all.__popcal4js_calendar : document.__popcal4js_calendar;
  183. hideCalendar_popcal4js();
  184. __popcal4js_crossMonthObj = (__popcal4js_dom) ? document.getElementById('__popcal4js_selectMonth').style : __popcal4js_ie ? document.all.__popcal4js_selectMonth : document.__popcal4js_selectMonth;
  185. __popcal4js_crossYearObj = (__popcal4js_dom) ? document.getElementById('__popcal4js_selectYear').style : __popcal4js_ie ? document.all.__popcal4js_selectYear : document.__popcal4js_selectYear;
  186. __popcal4js_monthConstructed = false;
  187. __popcal4js_yearConstructed = false;
  188. 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)">&nbsp<img id="__popcal4js_changeLeft" src="./static/images/ucenter/popcal4js_left1.gif" width="10" height="11" border="0">&nbsp</span>&nbsp;';
  189. 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)">&nbsp<img id="__popcal4js_changeRight" src="./static/images/ucenter/popcal4js_right1.gif" width="10" height="11" border="0">&nbsp</span>&nbsp;';
  190. sHTML1 += '<span id="__popcal4js_spanMonth" style="border:1px solid #36f;cursor:pointer" onclick="popUpMonth_popcal4js()"></span>&nbsp;';
  191. sHTML1 += '<span id="__popcal4js_spanYear" style="border:1px solid #36f;cursor:pointer" onclick="popUpYear_popcal4js()"></span>&nbsp;';
  192. document.getElementById('__popcal4js_caption').innerHTML = sHTML1;
  193. __popcal4js_bPageLoaded=true;
  194. }
  195. }
  196. function hideCalendar_popcal4js() {
  197. __popcal4js_crossobj.visibility = 'hidden';
  198. if (__popcal4js_crossMonthObj != null) __popcal4js_crossMonthObj.visibility = 'hidden';
  199. if (__popcal4js_crossYearObj != null) __popcal4js_crossYearObj.visibility = 'hidden';
  200. showElement_popcal4js('SELECT');
  201. showElement_popcal4js('APPLET');
  202. // iframe
  203. document.getElementById("__popcal4js_calendar_iframe").innerHTML = '';
  204. document.getElementById("__popcal4js_calendar_iframe").style.visibility = 'hidden';
  205. }
  206. function padZero_popcal4js(num) {
  207. return (num < 10) ? '0' + num : num;
  208. }
  209. function constructDate_popcal4js(d,m,y, t) {
  210. sTmp = __popcal4js_dateFormat;
  211. sTmp = sTmp.replace ('dd','<e>');
  212. sTmp = sTmp.replace ('d','<d>');
  213. sTmp = sTmp.replace ('<e>',padZero_popcal4js(d));
  214. sTmp = sTmp.replace ('<d>',d);
  215. sTmp = sTmp.replace ('mmmm','<p>');
  216. sTmp = sTmp.replace ('mmm','<o>');
  217. sTmp = sTmp.replace ('mm','<n>');
  218. sTmp = sTmp.replace ('m','<m>');
  219. sTmp = sTmp.replace ('<m>',m+1);
  220. sTmp = sTmp.replace ('<n>',padZero_popcal4js(m+1));
  221. sTmp = sTmp.replace ('<o>',__popcal4js_monthName[__popcal4js_language][m]);
  222. sTmp = sTmp.replace ('<p>',__popcal4js_monthName2[__popcal4js_language][m]);
  223. sTmp = sTmp.replace ('yyyy',y);
  224. sTmp = sTmp.replace ('yy',padZero_popcal4js(y%100));
  225. sTmp = sTmp.replace ('tt',t);
  226. return sTmp;
  227. }
  228. function closeCalendar_popcal4js() {
  229. var tt = "";
  230. if (__popcal4js_dateFormat.indexOf("tt") >= 0) {
  231. tt = document.getElementById('__popcal4js_txtNowTime').value;
  232. }
  233. hideCalendar_popcal4js();
  234. __popcal4js_ctlToPlaceValue.value = constructDate_popcal4js(__popcal4js_dateSelected,__popcal4js_monthSelected,__popcal4js_yearSelected, tt );
  235. }
  236. /*** Month Pulldown ***/
  237. function StartDecMonth_popcal4js() {
  238. __popcal4js_intervalID1 = setInterval("decMonth_popcal4js()",80);
  239. }
  240. function StartIncMonth_popcal4js() {
  241. __popcal4js_intervalID1 = setInterval("incMonth_popcal4js()",80);
  242. }
  243. function incMonth_popcal4js () {
  244. __popcal4js_monthSelected++;
  245. if (__popcal4js_monthSelected > 11) {
  246. __popcal4js_monthSelected = 0;
  247. __popcal4js_yearSelected++;
  248. }
  249. constructCalendar_popcal4js();
  250. }
  251. function decMonth_popcal4js () {
  252. __popcal4js_monthSelected--;
  253. if (__popcal4js_monthSelected < 0) {
  254. __popcal4js_monthSelected = 11;
  255. __popcal4js_yearSelected--;
  256. }
  257. constructCalendar_popcal4js();
  258. }
  259. function constructMonth_popcal4js() {
  260. popDownYear_popcal4js()
  261. if (!__popcal4js_monthConstructed) {
  262. sHTML = "";
  263. for (i=0; i<12; i++) {
  264. sName = __popcal4js_monthName[__popcal4js_language][i];
  265. if (i == __popcal4js_monthSelected){
  266. sName = '<b>' + sName + '</b>';
  267. }
  268. 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">&nbsp;' + sName + '&nbsp;</font></td></tr>';
  269. }
  270. 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>';
  271. __popcal4js_monthConstructed = true;
  272. }
  273. }
  274. function popUpMonth_popcal4js() {
  275. if (__popcal4js_visMonth == 1) {
  276. popDownMonth_popcal4js();
  277. __popcal4js_visMonth--;
  278. } else {
  279. constructMonth_popcal4js();
  280. __popcal4js_crossMonthObj.visibility = (__popcal4js_dom||__popcal4js_ie) ? 'visible' : 'show';
  281. __popcal4js_crossMonthObj.left = parseInt(__popcal4js_crossobj.left) + 50 + "px";
  282. __popcal4js_crossMonthObj.top = parseInt(__popcal4js_crossobj.top) + 26 + "px";
  283. if(browser.isIE && browser.version<7)//在ie6及以下版本隐藏select和增加ifreame
  284. {
  285. hideElement_popcal4js('SELECT', document.getElementById('__popcal4js_selectMonth'));
  286. }
  287. hideElement_popcal4js('APPLET', document.getElementById('__popcal4js_selectMonth'));
  288. __popcal4js_visMonth++;
  289. }
  290. }
  291. function popDownMonth_popcal4js() {
  292. __popcal4js_crossMonthObj.visibility = 'hidden';
  293. __popcal4js_visMonth = 0;
  294. }
  295. /*** Year Pulldown ***/
  296. function incYear_popcal4js() {
  297. for (i=0; i<7; i++) {
  298. newYear = (i + __popcal4js_nStartingYear) + 1;
  299. if (newYear == __popcal4js_yearSelected)
  300. txtYear = '<font style="color:#006;font-weight:bold;">&nbsp;' + newYear + '&nbsp;</font>';
  301. else
  302. txtYear = '<font style="color:#006;">&nbsp;' + newYear + '&nbsp;</font>';
  303. document.getElementById('__popcal4js_y'+i).innerHTML = txtYear;
  304. }
  305. __popcal4js_nStartingYear++;
  306. __popcal4js_bShow=true;
  307. }
  308. function decYear_popcal4js() {
  309. for (i=0; i<7; i++) {
  310. newYear = (i + __popcal4js_nStartingYear) - 1;
  311. if (newYear == __popcal4js_yearSelected)
  312. txtYear = '<font style="color:#006;font-weight:bold">&nbsp;' + newYear + '&nbsp;</font>';
  313. else
  314. txtYear = '<font style="color:#006;">&nbsp;' + newYear + '&nbsp;</font>';
  315. document.getElementById('__popcal4js_y'+i).innerHTML = txtYear;
  316. }
  317. __popcal4js_nStartingYear--;
  318. __popcal4js_bShow=true;
  319. }
  320. function selectYear_popcal4js(nYear) {
  321. __popcal4js_yearSelected = parseInt(nYear + __popcal4js_nStartingYear);
  322. __popcal4js_yearConstructed = false;
  323. constructCalendar_popcal4js();
  324. popDownYear_popcal4js();
  325. }
  326. function constructYear_popcal4js() {
  327. popDownMonth_popcal4js();
  328. sHTML = '';
  329. if (!__popcal4js_yearConstructed) {
  330. 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>';
  331. j = 0;
  332. __popcal4js_nStartingYear = __popcal4js_yearSelected - 3;
  333. for ( i = (__popcal4js_yearSelected-3); i <= (__popcal4js_yearSelected+3); i++ ) {
  334. sName = i;
  335. if (i == __popcal4js_yearSelected) sName = '<b>' + sName + '</b>';
  336. 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">&nbsp;' + sName + '&nbsp;</font></td></tr>';
  337. j++;
  338. }
  339. 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>';
  340. 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>';
  341. __popcal4js_yearConstructed = true;
  342. }
  343. }
  344. function popDownYear_popcal4js() {
  345. clearInterval(__popcal4js_intervalID1);
  346. clearTimeout(__popcal4js_timeoutID1);
  347. clearInterval(__popcal4js_intervalID2);
  348. clearTimeout(__popcal4js_timeoutID2);
  349. __popcal4js_crossYearObj.visibility= 'hidden';
  350. __popcal4js_visYear = 0;
  351. }
  352. function popUpYear_popcal4js() {
  353. var leftOffset
  354. if (__popcal4js_visYear==1) {
  355. popDownYear_popcal4js();
  356. __popcal4js_visYear--;
  357. } else {
  358. constructYear_popcal4js();
  359. __popcal4js_crossYearObj.visibility = (__popcal4js_dom||__popcal4js_ie) ? 'visible' : 'show';
  360. leftOffset = parseInt(__popcal4js_crossobj.left) + document.getElementById('__popcal4js_spanYear').offsetLeft;
  361. if (__popcal4js_ie) leftOffset += 6;
  362. __popcal4js_crossYearObj.left = leftOffset + "px";
  363. __popcal4js_crossYearObj.top = parseInt(__popcal4js_crossobj.top) + 26 + "px";
  364. __popcal4js_visYear++;
  365. }
  366. }
  367. /*** calendar ***/
  368. function WeekNbr_popcal4js(n) {
  369. // Algorithm used:
  370. // From Klaus Tondering's Calendar document (The Authority/Guru)
  371. // http://www.tondering.dk/claus/calendar.html
  372. // a = (14-month) / 12
  373. // y = year + 4800 - a
  374. // m = month + 12a - 3
  375. // J = day + (153m + 2) / 5 + 365y + y / 4 - y / 100 + y / 400 - 32045
  376. // d4 = (J + 31741 - (J mod 7)) mod 146097 mod 36524 mod 1461
  377. // L = d4 / 1460
  378. // d1 = ((d4 - L) mod 365) + L
  379. // WeekNumber = d1 / 7 + 1
  380. year = n.getFullYear();
  381. month = n.getMonth() + 1;
  382. if (__popcal4js_startAt == 0) {
  383. day = n.getDate() + 1;
  384. } else {
  385. day = n.getDate();
  386. }
  387. a = Math.floor((14-month) / 12);
  388. y = year + 4800 - a;
  389. m = month + 12 * a - 3;
  390. b = Math.floor(y/4) - Math.floor(y/100) + Math.floor(y/400);
  391. J = day + Math.floor((153 * m + 2) / 5) + 365 * y + b - 32045;
  392. d4 = (((J + 31741 - (J % 7)) % 146097) % 36524) % 1461;
  393. L = Math.floor(d4 / 1460);
  394. d1 = ((d4 - L) % 365) + L;
  395. week = Math.floor(d1/7) + 1;
  396. return week;
  397. }
  398. function constructCalendar_popcal4js () {
  399. var aNumDays = Array (31,0,31,30,31,30,31,31,30,31,30,31);
  400. var dateMessage;
  401. var startDate = new Date (__popcal4js_yearSelected,__popcal4js_monthSelected,1);
  402. var endDate;
  403. if (__popcal4js_monthSelected==1) {
  404. endDate = new Date (__popcal4js_yearSelected,__popcal4js_monthSelected+1,1);
  405. endDate = new Date (endDate - (24*60*60*1000));
  406. numDaysInMonth = endDate.getDate();
  407. } else {
  408. numDaysInMonth = aNumDays[__popcal4js_monthSelected];
  409. }
  410. datePointer = 0;
  411. dayPointer = startDate.getDay() - __popcal4js_startAt;
  412. if (dayPointer<0) dayPointer = 6;
  413. sHTML = '<table border="0" cellSpacing="0" cellPadding="1" width="100%" style="font-family:verdana;font-size:12px;"><tr>';
  414. if (__popcal4js_showWeekNumber == 1) {
  415. 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>';
  416. }
  417. for (i = 0; i<7; i++) {
  418. 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>';
  419. }
  420. sHTML += '</tr><tr>';
  421. if (__popcal4js_showWeekNumber == 1) {
  422. sHTML += '<td align="right" style="line-height:15px;height:12px;font-family:verdana;font-size:12px;">' + WeekNbr_popcal4js(startDate) + '&nbsp;</td>';
  423. }
  424. for ( var i=1; i<=dayPointer;i++ ) {
  425. sHTML += '<td style="line-height:15px;height:12px;font-family:verdana;font-size:12px;">&nbsp;</td>';
  426. }
  427. for ( datePointer=1; datePointer <= numDaysInMonth; datePointer++ ) {
  428. dayPointer++;
  429. sHTML += '<td align="right" style="line-height:15px;height:12px;font-family:verdana;font-size:12px;">';
  430. var sStyle=__popcal4js_styleAnchor;
  431. var sClass = 'popcal4js_onDate';
  432. if ((datePointer == __popcal4js_odateSelected) && (__popcal4js_monthSelected == __popcal4js_omonthSelected) && (__popcal4js_yearSelected == __popcal4js_oyearSelected))
  433. {
  434. sStyle+=__popcal4js_styleLightBorder;
  435. sClass = 'popcal4js_onDate';
  436. }
  437. sHint = '';
  438. for (k = 0;k < __popcal4js_HolidaysCounter; k++) {
  439. if ((parseInt(__popcal4js_Holidays[k].d) == datePointer)&&(parseInt(__popcal4js_Holidays[k].m) == (__popcal4js_monthSelected+1))) {
  440. if ((parseInt(__popcal4js_Holidays[k].y)==0)||((parseInt(__popcal4js_Holidays[k].y)==__popcal4js_yearSelected)&&(parseInt(__popcal4js_Holidays[k].y)!=0))) {
  441. sStyle+= 'background-color:#fdd;';
  442. sHint += sHint=="" ? __popcal4js_Holidays[k].desc : "\n"+__popcal4js_Holidays[k].desc;
  443. }
  444. }
  445. }
  446. sHint = sHint.replace('/\"/g', '&quot;');
  447. dateMessage = 'onmousemove="window.status=\''+__popcal4js_selectDateMessage[__popcal4js_language].replace('[date]',constructDate_popcal4js(datePointer,__popcal4js_monthSelected,__popcal4js_yearSelected, __popcal4js_timeNow))+'\'" onmouseout="window.status=\'\'" ';
  448. 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))) {
  449. //__popcal4js_selDayAction = '';
  450. __popcal4js_selDayAction = 'href="javascript:__popcal4js_dateSelected=' + datePointer + ';closeCalendar_popcal4js();"';
  451. __popcal4js_isPast = 1;
  452. } else {
  453. __popcal4js_selDayAction = 'href="javascript:__popcal4js_dateSelected=' + datePointer + ';closeCalendar_popcal4js();"';
  454. __popcal4js_isPast = 0;
  455. }
  456. if ((datePointer == __popcal4js_dateNow) && (__popcal4js_monthSelected == __popcal4js_monthNow) && (__popcal4js_yearSelected == __popcal4js_yearNow)) { ///// today
  457. sHTML += "<b><a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+">&nbsp;<font color=#ff0000><strong>" + datePointer + "</strong></font>&nbsp;</a></b>";
  458. } else if (dayPointer % 7 == (__popcal4js_startAt * -1)+1) { ///// SI ES DOMINGO
  459. if (__popcal4js_isPast==1)
  460. sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+">&nbsp;<font color=#909090 style='font-family:verdana;font-size:12px;'>" + datePointer + "</font>&nbsp;</a>";
  461. else
  462. sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+">&nbsp;<font color=#ff3535>" + datePointer + "</font>&nbsp;</a>";
  463. } else if ((dayPointer % 7 == (__popcal4js_startAt * -1)+7 && __popcal4js_startAt==1) || (dayPointer % 7 == __popcal4js_startAt && __popcal4js_startAt==0)) { ///// SI ES SABADO
  464. if (__popcal4js_isPast==1)
  465. sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+">&nbsp;<font color=#909090 style='font-family:verdana;font-size:12px;'>" + datePointer + "</font>&nbsp;</a>";
  466. else
  467. sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+">&nbsp;<font color=#ff3535 style='font-family:verdana;font-size:12px;'>" + datePointer + "</font>&nbsp;</a>";
  468. } else { ///// CUALQUIER OTRO DIA
  469. if (__popcal4js_isPast==1)
  470. sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+">&nbsp;<font color=#909090 style='font-family:verdana;font-size:12px;'>" + datePointer + "</font>&nbsp;</a>";
  471. else
  472. sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' class='"+sClass+"' "+__popcal4js_selDayAction+">&nbsp;<font color=#000066 style='font-family:verdana;font-size:12px;'>" + datePointer + "</font>&nbsp;</a>";
  473. }
  474. sHTML += '';
  475. if ((dayPointer+__popcal4js_startAt) % 7 == __popcal4js_startAt) {
  476. sHTML += '</tr><tr>';
  477. if ((__popcal4js_showWeekNumber == 1) && (datePointer < numDaysInMonth)) {
  478. 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))) + '&nbsp;</td>';
  479. }
  480. }
  481. }
  482. document.getElementById('__popcal4js_content').innerHTML = sHTML
  483. document.getElementById('__popcal4js_spanMonth').innerHTML = '&nbsp;<font style="color:#ffffff;">' + __popcal4js_monthName[__popcal4js_language][__popcal4js_monthSelected] + '</font>&nbsp;<img id="__popcal4js_changeMonth" src="./static/images/ucenter/popcal4js_drop1.gif" width="12" height="10" border="0">'
  484. document.getElementById('__popcal4js_spanYear').innerHTML = '&nbsp;<font style="color:#ffffff;">' + __popcal4js_yearSelected + '</font>&nbsp;<img id="__popcal4js_changeYear" src="./static/images/ucenter/popcal4js_drop1.gif" width="12" height="10" border="0">';
  485. }
  486. function showCalendar_popcal4js(ctl, ctl2, format, lang, past, fx, fy, startAt, showWeekNumber, showToday) {
  487. if (lang != null && lang != '') __popcal4js_language = lang;
  488. if (past != null) __popcal4js_enablePast = past;
  489. if (fx != null) __popcal4js_fixedX = fx;
  490. if (fy != null) __popcal4js_fixedY = fy;
  491. if(startAt != null) __popcal4js_startAt = startAt;
  492. if(showWeekNumber != null) __popcal4js_showWeekNumber = showWeekNumber;
  493. if(showToday != null) __popcal4js_showToday = showToday;
  494. if (__popcal4js_showToday == 1) {
  495. if(__popcal4js_language == 'en')
  496. 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>';
  497. if(__popcal4js_language == 'cn')
  498. 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>';
  499. }
  500. if (format.indexOf("tt") >= 0) {
  501. 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;">';
  502. }
  503. popUpCalendar_popcal4js(ctl, ctl2, format);
  504. }
  505. function popUpCalendar_popcal4js(ctl, ctl2, format) {
  506. var leftpos = 0;
  507. var toppos = 0;
  508. if (__popcal4js_bPageLoaded) {
  509. if (__popcal4js_crossobj.visibility == 'hidden') {
  510. __popcal4js_ctlToPlaceValue = ctl2;
  511. __popcal4js_dateFormat = format;
  512. var format_date = __popcal4js_dateFormat.split(' ')[0]; // get date, no time
  513. formatChar = ' ';
  514. aFormat = format_date.split(formatChar);
  515. if (aFormat.length < 3) {
  516. formatChar = '/';
  517. aFormat = format_date.split(formatChar);
  518. if (aFormat.length < 3) {
  519. formatChar = '.';
  520. aFormat = format_date.split(formatChar);
  521. if (aFormat.length < 3) {
  522. formatChar = '-';
  523. aFormat = format_date.split(formatChar);
  524. if (aFormat.length < 3) {
  525. formatChar = ''; // invalid date format
  526. }
  527. }
  528. }
  529. }
  530. tokensChanged = 0;
  531. if (formatChar != "") {
  532. var aDataTmp = ctl2.value.split(' ')[0]; // get date, no time
  533. aData = aDataTmp.split(formatChar); // use user's date
  534. for (i=0; i<3; i++) {
  535. if ((aFormat[i] == "d") || (aFormat[i] == "dd")) {
  536. __popcal4js_dateSelected = parseInt(aData[i], 10);
  537. tokensChanged++;
  538. } else if ((aFormat[i] == "m") || (aFormat[i] == "mm")) {
  539. __popcal4js_monthSelected = parseInt(aData[i], 10) - 1;
  540. tokensChanged++;
  541. } else if (aFormat[i] == "yyyy") {
  542. __popcal4js_yearSelected = parseInt(aData[i], 10);
  543. tokensChanged++;
  544. } else if (aFormat[i] == "mmm") {
  545. for (j=0; j<12; j++) {
  546. if (aData[i] == __popcal4js_monthName[__popcal4js_language][j]) {
  547. __popcal4js_monthSelected=j;
  548. tokensChanged++;
  549. }
  550. }
  551. } else if (aFormat[i] == "mmmm") {
  552. for (j=0; j<12; j++) {
  553. if (aData[i] == __popcal4js_monthName2[__popcal4js_language][j]) {
  554. __popcal4js_monthSelected = j;
  555. tokensChanged++;
  556. }
  557. }
  558. }
  559. }
  560. }
  561. if ((tokensChanged != 3) || isNaN(__popcal4js_dateSelected) || isNaN(__popcal4js_monthSelected) || isNaN(__popcal4js_yearSelected)) {
  562. __popcal4js_dateSelected = __popcal4js_dateNow;
  563. __popcal4js_monthSelected = __popcal4js_monthNow;
  564. __popcal4js_yearSelected = __popcal4js_yearNow;
  565. }
  566. __popcal4js_odateSelected = __popcal4js_dateSelected;
  567. __popcal4js_omonthSelected = __popcal4js_monthSelected;
  568. __popcal4js_oyearSelected = __popcal4js_yearSelected;
  569. aTag = ctl;
  570. do {
  571. //alert(aTag.offsetParent.tagName);
  572. aTag = aTag.offsetParent;
  573. leftpos += aTag.offsetLeft;
  574. toppos += aTag.offsetTop;
  575. } while (aTag.tagName != 'BODY' && aTag.offsetParent.tagName!='HTML');
  576. //在top和left数值后面加px,已保证在XHTML 1.0下FireFox中正常显示
  577. __popcal4js_crossobj.left = (__popcal4js_fixedX == -1) ? ctl.offsetLeft + leftpos + "px" : __popcal4js_fixedX + "px";
  578. __popcal4js_crossobj.top = (__popcal4js_fixedY == -1) ? ctl.offsetTop + toppos + ctl.offsetHeight + 2 + "px" : __popcal4js_fixedY + "px";
  579. constructCalendar_popcal4js (1, __popcal4js_monthSelected, __popcal4js_yearSelected);
  580. __popcal4js_crossobj.visibility = (__popcal4js_dom||__popcal4js_ie) ? "visible" : "show";
  581. var browser = new Browser_popcal4js();
  582. hideElement_popcal4js('APPLET', document.getElementById('__popcal4js_calendar'));
  583. if(browser.isIE && browser.version<7)//在ie6及以下版本隐藏select和增加ifreame
  584. {
  585. hideElement_popcal4js('SELECT', document.getElementById('__popcal4js_calendar'));
  586. // iframe
  587. 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>";
  588. document.getElementById("__popcal4js_calendar_iframe").style.visibility = "";
  589. document.getElementById("__popcal4js_calendar_iframe").style.left = __popcal4js_crossobj.left;
  590. document.getElementById("__popcal4js_calendar_iframe").style.top = __popcal4js_crossobj.top
  591. }
  592. __popcal4js_bShow = true;
  593. } else {
  594. hideCalendar_popcal4js();
  595. if (__popcal4js_ctlNow!=ctl) popUpCalendar_popcal4js(ctl, ctl2, format);
  596. }
  597. __popcal4js_ctlNow = ctl;
  598. }
  599. }
  600. document.onkeypress = function hidecal1 (ev) {
  601. var ev = window.event || ev;
  602. var k = ev.keyCode || ev.which;
  603. if (k == 27) hideCalendar_popcal4js();
  604. }
  605. document.onclick = function hidecal2 () {
  606. if (!__popcal4js_bShow) hideCalendar_popcal4js();
  607. __popcal4js_bShow = false;
  608. }
  609. /*
  610. if(__popcal4js_ie) {
  611. init_popcal4js();
  612. } else {
  613. window.onload = init_popcal4js;
  614. }
  615. */
  616. if (document.all){
  617. window.attachEvent('onload',init_popcal4js)
  618. }
  619. else{
  620. window.addEventListener('load',init_popcal4js,false);
  621. }
  622. // 判断浏览器版本信息
  623. function Browser_popcal4js() {
  624. var ua, s, i;
  625. this.isIE = false; // Internet Explorer
  626. this.isNS = false; // Netscape
  627. this.version = null;
  628. ua = navigator.userAgent;
  629. s = "MSIE";
  630. if ((i = ua.indexOf(s)) >= 0) {
  631. this.isIE = true;
  632. this.version = parseFloat(ua.substr(i + s.length));
  633. return;
  634. }
  635. s = "Netscape6/";
  636. if ((i = ua.indexOf(s)) >= 0) {
  637. this.isNS = true;
  638. this.version = parseFloat(ua.substr(i + s.length));
  639. return;
  640. }
  641. // Treat any other "Gecko" browser as NS 6.1.
  642. s = "Gecko";
  643. if ((i = ua.indexOf(s)) >= 0) {
  644. this.isNS = true;
  645. this.version = 6.1;
  646. return;
  647. }
  648. }