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(""); 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 ('
'); document.write (''); } } 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 = ' ');
sTmp = sTmp.replace ('mmm',' ',__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 = '' + sName + '';
}
sHTML += ' ';
}
document.getElementById('__popcal4js_selectMonth').innerHTML = ' ' + sName + ' ' + sHTML + '
';
__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 = ' ' + newYear + ' ';
else
txtYear = ' ' + newYear + ' ';
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 = ' ' + newYear + ' ';
else
txtYear = ' ' + newYear + ' ';
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 = ' ';
j = 0;
__popcal4js_nStartingYear = __popcal4js_yearSelected - 3;
for ( i = (__popcal4js_yearSelected-3); i <= (__popcal4js_yearSelected+3); i++ ) {
sName = i;
if (i == __popcal4js_yearSelected) sName = '' + sName + '';
sHTML += '- ';
j++;
}
sHTML += ' ' + sName + ' ';
document.getElementById('__popcal4js_selectYear').innerHTML = '+ ' + sHTML + '
';
__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 = '';
if (__popcal4js_showWeekNumber == 1) {
sHTML += ' ' + __popcal4js_weekString[__popcal4js_language] + ' ';
}
for (i = 0; i<7; i++) {
sHTML += '' + __popcal4js_dayName[__popcal4js_language][i] + ' ';
}
sHTML += '';
if (__popcal4js_showWeekNumber == 1) {
sHTML += ' ' + WeekNbr_popcal4js(startDate) + ' ';
}
for ( var i=1; i<=dayPointer;i++ ) {
sHTML += ' ';
}
for ( datePointer=1; datePointer <= numDaysInMonth; datePointer++ ) {
dayPointer++;
sHTML += '';
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 += " " + datePointer + " ";
} else if (dayPointer % 7 == (__popcal4js_startAt * -1)+1) { ///// SI ES DOMINGO
if (__popcal4js_isPast==1)
sHTML += " " + datePointer + " ";
else
sHTML += " " + datePointer + " ";
} 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 += " " + datePointer + " ";
else
sHTML += " " + datePointer + " ";
} else { ///// CUALQUIER OTRO DIA
if (__popcal4js_isPast==1)
sHTML += " " + datePointer + " ";
else
sHTML += " " + datePointer + " ";
}
sHTML += '';
if ((dayPointer+__popcal4js_startAt) % 7 == __popcal4js_startAt) {
sHTML += ' ';
if ((__popcal4js_showWeekNumber == 1) && (datePointer < numDaysInMonth)) {
sHTML += ' ' + (WeekNbr_popcal4js(new Date(__popcal4js_yearSelected,__popcal4js_monthSelected,datePointer+1))) + ' ';
}
}
}
document.getElementById('__popcal4js_content').innerHTML = sHTML
document.getElementById('__popcal4js_spanMonth').innerHTML = ' ' + __popcal4js_monthName[__popcal4js_language][__popcal4js_monthSelected] + ' '
document.getElementById('__popcal4js_spanYear').innerHTML = ' ' + __popcal4js_yearSelected + '
';
}
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 = '' + __popcal4js_todayString[__popcal4js_language] + ''+__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+'';
if(__popcal4js_language == 'cn')
document.getElementById('__popcal4js_lblToday').innerHTML = '' + __popcal4js_todayString[__popcal4js_language] + ''+__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+'日';
}
if (format.indexOf("tt") >= 0) {
document.getElementById('__popcal4js_lblToday').innerHTML += '
' + __popcal4js_timeString[__popcal4js_language] + '';
}
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 = "";
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;
}
}