var fixedX = -1 // x position (-1 if to appear below control)
var fixedY = -1 // y position (-1 if to appear below control)
var startAt = 0 // 0 - sunday ; 1 - monday
var showWeekNumber = 0 // 0 - don't show; 1 - show
var showToday = 1 // 0 - don't show; 1 - show
var imgDir = "images/" // directory for images ... e.g. var
imgDir="/img/"
var gotoString = "Go To Current Month"
var todayString = "Today is"
var weekString = "Wk"
var scrollLeftMessa ge = "Click to scroll to previous month. Hold mouse
button to scroll automatically."
var scrollRightMess age = "Click to scroll to next month. Hold mouse
button to scroll automatically."
var selectMonthMess age = "Click to select a month."
var selectYearMessa ge = "Click to select a year."
var selectDateMessa ge = "Select [date] as date." // do not replace
[date], it will be replaced by date.
var crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected,
dateSelected, omonthSelected, oyearSelected, odateSelected,
monthConstructe d, yearConstructed , intervalID1, intervalID2, timeoutID1,
timeoutID2, ctlToPlaceValue , ctlNow, dateFormat, nStartingYear
var bPageLoaded=fal se
var ie=document.all
var dom=document.ge tElementById
var ns4=document.la yers
var today = new Date()
var dateNow = today.getDate()
var monthNow = today.getMonth( )
var yearNow = today.getYear()
var imgsrc = new
Array("drop1.gi f","drop2.gif", "left1.gif","le ft2.gif","right 1.gif","righ
t2.gif")
var img = new Array()
var bShow = false;
function hideElement( elmID, overDiv )
{
if( ie )
{
for( i = 0; i < document.all.ta gs( elmID ).length; i++ )
{
obj = document.all.ta gs( elmID )[i];
if( !obj || !obj.offsetPare nt )
{
continue;
}
objLeft = obj.offsetLeft;
objTop = obj.offsetTop;
objParent = obj.offsetParen t;
while( objParent.tagNa me.toUpperCase( ) != "BODY" )
{
objLeft += objParent.offse tLeft;
objTop += objParent.offse tTop;
objParent = objParent.offse tParent;
}
objHeight = obj.offsetHeigh t;
objWidth = obj.offsetWidth ;
if(( overDiv.offsetL eft + overDiv.offsetW idth ) <= objLeft );
else if(( overDiv.offsetT op + overDiv.offsetH eight ) <=
objTop );
else if( overDiv.offsetT op >= ( objTop + objHeight ));
else if( overDiv.offsetL eft >= ( objLeft + objWidth ));
else
{
obj.style.visib ility = "hidden";
}
}
}
}
function showElement( elmID )
{
if( ie )
{
for( i = 0; i < document.all.ta gs( elmID ).length; i++ )
{
obj = document.all.ta gs( elmID )[i];
if( !obj || !obj.offsetPare nt )
{
continue;
}
obj.style.visib ility = "";
}
}
}
function HolidayRec (d, m, y, desc)
{
this.d = d
this.m = m
this.y = y
this.desc = desc
}
function addHoliday (d, m, y, desc)
{
Holidays[HolidaysCounter ++] = new HolidayRec ( d, m, y, desc )
}
var HolidaysCounter = 0
var Holidays = new Array()
if (dom)
{
for(i=0;i<imgsr c.length;i++)
{
img[i] = new Image
img[i].src = imgDir + imgsrc[i]
}
document.write ("<div onclick='bShow= true' name='calendar'
id='calendar'
style='z-index:+999;posi tion:absolute;v isibility:hidde n;'><table width="
+((showWeekNumb er==1)?250:220) +"
style='font-family:arial;fo nt-size:11px;borde r-width:1;border-style:soli
d;border-color:#a0a0a0;f ont-family:arial; font-size:11px}'
bgcolor='#fffff f'><tr bgcolor='#B5BEC 5'><td><table
width='"+((show WeekNumber==1)? 248:218)+"'><tr ><td
style='padding: 2px;font-family:arial; font-size:11px;'><fo nt
color='#000000' ><B><span id='caption'></span></B></font></td><td
align=right><a href='javascrip t:hideCalendar( )'><IMG
SRC='"+imgDir+" close.gif' WIDTH='15' HEIGHT='13' BORDER='0' ALT='Close
the Calendar'></a></td></tr></table></td></tr><tr><td
style='padding: 5px' bgcolor=#ffffff ><span
id='content'></span></td></tr>")
if (showToday==1)
{
document.write ("<tr bgcolor=#f0f0f0 ><td style='padding: 5px'
align=center><s pan id='lblToday'></span></td></tr>")
}
document.write ("</table></div><div id='selectMonth ' name='selectMon th'
style='z-index:+999;posi tion:absolute;v isibility:hidde n;'></div><div
id='selectYear'
style='z-index:+999;posi tion:absolute;v isibility:hidde n;'></div>");
}
var monthName =new
Array("JAN","FE B","MAR","APR", "MAY","JUN","JU L","AUG","SEP", "OCT","NOV" ,
"DEC")
if (startAt==0)
{
dayName = new Array ("Sun","Mon","T ue","Wed","Thu" ,"Fri","Sat" )
}
else
{
dayName = new Array ("Mon","Tue","W ed","Thu","Fri" ,"Sat","Sun" )
}
var styleAnchor="te xt-decoration:none ;color:green;"
var
styleLightBorde r="border-style:solid;bor der-width:1px;borde r-color:black
;"
function swapImage(srcIm g, destImg)
{
if (ie)
{
document.getEle mentById(srcImg ).setAttribute( "src",imgDi r +
destImg)
}
}
function init()
{
if (!ns4)
{
if (!ie)
{
yearNow += 1900
}
crossobj=(dom)? document.getEle mentsByName("ca lendar").style:
ie?document.all .calendar:docum ent.calendar
hideCalendar()
crossMonthObj=( dom)?document.g etElementsByNam e("selectMonth" ).style :
ie? document.all.se lectMonth : document.select Month
crossYearObj=(d om)?document.ge tElementsByName ("selectYear"). style :
ie? document.all.se lectYear : document.select Year
monthConstructe d=false;
yearConstructed =false;
if (showToday==1)
{
document.getEle mentsByName("lb lToday").innerH TML = todayString + "
<a onmousemove='wi ndow.status=\"" +gotoString+"\" '
onmouseout='win dow.status=\"\" ' title='"+gotoSt ring+"'
style='"+styleA nchor+"'
href='javascrip t:monthSelected =monthNow;yearS elected=yearNow ;constructCa
lendar();'>"+da yName[(today.getDay()-startAt==-1)?6:(today.get Day()-star
tAt)]+", " + dateNow + " " + monthName[monthNow].substring(0,3) + " "
+ yearNow + "</a>"
}
sHTML1="<span
id='spanLeft' style='border-style:solid;bor der-width:1;border-color:#B5B
EC5;cursor:poin ter'
onmouseover='sw apImage(\"chang eLeft\",\"left2 .gif\");this.st yle.borderCo
lor=\"#B5BEC5\" ;window.status= \""+scrollLeftM essage+"\"'
onclick='javasc ript:decMonth() '
onmouseout='cle arInterval(inte rvalID1);swapIm age(\"changeLef t\",\"left1.
gif\");this.sty le.borderColor= \"#B5BEC5\";win dow.status=\"\" '
onmousedown='cl earTimeout(time outID1);timeout ID1=setTimeout( \"StartDecMo
nth()\",500)' onmouseup='clea rTimeout(timeou tID1);clearInte rval(interval
ID1)'> <IMG id='changeLeft' SRC='"+imgDir+" left1.gif' width=10
height=11 BORDER=0> </span> "
sHTML1+="<span id='spanRight'
style='border-style:solid;bor der-width:1;border-color:#B5BEC5;c ursor:poi
nter' onmouseover='sw apImage(\"chang eRight\",\"righ t2.gif\");this. style.
borderColor=\"# B5BEC5\";window .status=\""+scr ollRightMessage +"\"'
onmouseout='cle arInterval(inte rvalID1);swapIm age(\"changeRig ht\",\"right
1.gif\");this.s tyle.borderColo r=\"#B5BEC5\";w indow.status=\" \"'
onclick='incMon th()'
onmousedown='cl earTimeout(time outID1);timeout ID1=setTimeout( \"StartIncMo
nth()\",500)' onmouseup='clea rTimeout(timeou tID1);clearInte rval(interval
ID1)'> <IMG id='changeRight ' SRC='"+imgDir+" right1.gif' width=10
height=11 BORDER=0> </span> "
sHTML1+="<span id='spanMonth'
style='border-style:solid;bor der-width:1;border-color:#B5BEC5;c ursor:poi
nter' onmouseover='sw apImage(\"chang eMonth\",\"drop 2.gif\");this.s tyle.b
orderColor=\"#B 5BEC5\";window. status=\""+sele ctMonthMessage+ "\"'
onmouseout='swa pImage(\"change Month\",\"drop1 .gif\");this.st yle.borderCo
lor=\"#B5BEC5\" ;window.status= \"\"'
onclick='popUpM onth()'></span> "
sHTML1+="<span id='spanYear'
style='border-style:solid;bor der-width:1;border-color:#B5BEC5;c ursor:poi
nter'
onmouseover='sw apImage(\"chang eYear\",\"drop2 .gif\");this.st yle.borderCo
lor=\"#B5BEC5\" ;window.status= \""+selectYearM essage+"\"' onmouseout='swa
pImage(\"change Year\",\"drop1. gif\");this.sty le.borderColor= \"#B5BEC5\";
window.status=\ "\"' onclick='popUpY ear()'></span> "
document.getEle mentsByName("ca ption").innerHT ML = sHTML1
bPageLoaded=tru e
}
}
function hideCalendar()
{
crossobj.visibi lity="hidden"
if (crossMonthObj != null)
{
crossMonthObj.v isibility="hidd en"
}
if (crossYearObj != null)
{
crossYearObj.vi sibility="hidde n"
}
showElement( 'SELECT' );
showElement( 'APPLET' );
}
function padZero(num)
{
return (num < 10)? '0' + num : num ;
}
function constructDate(d ,m,y)
{
sTmp = dateFormat
sTmp = sTmp.replace ("dd","<e>")
sTmp = sTmp.replace ("d","<d>")
sTmp = sTmp.replace ("<e>",padZero( d))
sTmp = sTmp.replace ("<d>",d)
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( m+1))
sTmp = sTmp.replace ("<o>",monthNam e[m])
return sTmp.replace ("yyyy",y)
}
function closeCalendar()
{
var sTmp
hideCalendar();
ctlToPlaceValue .value
= constructDate(d ateSelected,mon thSelected,year Selected)
}
function StartDecMonth()
{
intervalID1=set Interval("decMo nth()",80)
}
function StartIncMonth()
{
intervalID1=set Interval("incMo nth()",80)
}
function incMonth ()
{
monthSelected++
if (monthSelected> 11)
{
monthSelected=0
yearSelected++
}
constructCalend ar()
}
function decMonth ()
{
monthSelected--
if (monthSelected< 0)
{
monthSelected=1 1
yearSelected--
}
constructCalend ar()
}
function constructMonth( )
{
popDownYear()
if (!monthConstruc ted)
{
sHTML = ""
for(i=0; i<12; i++)
{
sName = monthName[i];
if (i==monthSelect ed)
{
sName = "<B>" + sName + "</B>"
}
sHTML += "<tr><td id='m" + i + "'
onmouseover='th is.style.backgr oundColor=\"lav ender\"'
onmouseout='thi s.style.backgro undColor=\"\"' style='cursor:p ointer'
onclick='monthC onstructed=fals e;monthSelected =" + i +
";constructCale ndar();popDownM onth();event.ca ncelBubble=true '> " +
sName + " </td></tr>"
}
document.getEle mentById("selec tMonth").innerH TML = "<table
width=70 style='font-family:arial; font-size:11px; border-width:1;
border-style:solid; border-color:#a0a0a0;' bgcolor='#FFFFD D'
cellspacing=0
onmouseover='cl earTimeout(time outID1)' onmouseout='cle arTimeout(timeo utI
D1);timeoutID1= setTimeout(\"po pDownMonth()\", 100);event.canc elBubble=tru
e'>" + sHTML + "</table>"
monthConstructe d=true
}
}
function popUpMonth()
{
constructMonth( )
crossMonthObj.v isibility = (dom||ie)? "visible" : "show"
crossMonthObj.l eft = parseInt(crosso bj.left) + 50
crossMonthObj.t op = parseInt(crosso bj.top) + 26
hideElement( 'SELECT', document.getEle mentById("selec tMonth") );
hideElement( 'APPLET', document.getEle mentById("selec tMonth") );
}
function popDownMonth()
{
crossMonthObj.v isibility= "hidden"
}
function incYear()
{
for(i=0; i<7; i++)
{
newYear = (i+nStartingYea r)+1
if (newYear==yearS elected)
{
txtYear = " <B>" + newYear + "</B> "
}
else
{
txtYear = " " + newYear + " "
}
document.getEle mentById("y"+i) .innerHTML = txtYear
}
nStartingYear ++;
bShow=true
}
function decYear()
{
for(i=0; i<7; i++)
{
newYear = (i+nStartingYea r)-1
if (newYear==yearS elected)
{
txtYear = " <B>" + newYear + "</B> "
}
else
{
txtYear = " " + newYear + " "
}
document.getEle mentById("y"+i) .innerHTML = txtYear
}
nStartingYear --;
bShow=true
}
function selectYear(nYea r)
{
yearSelected=pa rseInt(nYear+nS tartingYear);
yearConstructed =false;
constructCalend ar();
popDownYear();
}
function constructYear()
{
popDownMonth()
sHTML = ""
if (!yearConstruct ed)
{
sHTML = "<tr><td
align='center' onmouseover='th is.style.backgr oundColor=\"#FF CC99\"'
onmouseout='cle arInterval(inte rvalID1);this.s tyle.background Color=\"\"'
style='cursor:p ointer' onmousedown='cl earInterval(int ervalID1);inter valI
D1=setInterval( \"decYear()\",3 0)'
onmouseup='clea rInterval(inter valID1)'>-</td></tr>"
j = 0
nStartingYear = yearSelected-3
for (i=(yearSelecte d-3); i<=(yearSelecte d+6); i++)
{
sName = i;
if (i==yearSelecte d)
{
sName = "<B>" + sName + "</B>"
}
sHTML += "<tr><td id='y" + j + "'
onmouseover='th is.style.backgr oundColor=\"#FF CC99\"'
onmouseout='thi s.style.backgro undColor=\"\"' style='cursor:p ointer'
onclick='select Year("+j+");eve nt.cancelBubble =true'> " + sName +
" </td></tr>"
j ++;
}
sHTML += "<tr><td align='center'
onmouseover='th is.style.backgr oundColor=\"#FF CC99\"'
onmouseout='cle arInterval(inte rvalID2);this.s tyle.background Color=\"\"'
style='cursor:p ointer'
onmousedown='cl earInterval(int ervalID2);inter valID2=setInter val(\"incYea
r()\",30)' onmouseup='clea rInterval(inter valID2)'>+</td></tr>"
document.getEle mentById("selec tYear").innerHT ML = "<table width=44
style='font-family:arial; font-size:11px; border-width:1;
border-style:solid; border-color:#a0a0a0;' bgcolor='#FFFFD D'
onmouseover='cl earTimeout(time outID2)'
onmouseout='cle arTimeout(timeo utID2);timeoutI D2=setTimeout(\ "popDownYea r
()\",100)' cellspacing=0>" + sHTML + "</table>"
yearConstructed = true
}
}
function popDownYear()
{
clearInterval(i ntervalID1)
clearTimeout(ti meoutID1)
clearInterval(i ntervalID2)
clearTimeout(ti meoutID2)
crossYearObj.vi sibility= "hidden"
}
function popUpYear()
{
var leftOffset
constructYear()
crossYearObj.vi sibility= (dom||ie)? "visible" : "show"
leftOffset = parseInt(crosso bj.left) +
document.getEle mentById("spanY ear").offsetLef t
if (ie)
{
leftOffset += 6
}
crossYearObj.le ft = leftOffset
crossYearObj.to p = parseInt(crosso bj.top) + 26
}
function WeekNbr(n)
{
year = n.getFullYear() ;
month = n.getMonth() + 1;
if (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 constructCalend ar ()
{
var aNumDays = Array (31,0,31,30,31, 30,31,31,30,31, 30,31)
var dateMessage
var startDate = new Date (yearSelected,m onthSelected,1)
var endDate
if (monthSelected= =1)
{
endDate = new Date (yearSelected,m onthSelected+1, 1);
endDate = new Date (endDate - (24*60*60*1000) );
numDaysInMonth = endDate.getDate ()
}
else
{
numDaysInMonth = aNumDays[monthSelected];
}
datePointer = 0
dayPointer = startDate.getDa y() - startAt
if (dayPointer<0)
{
dayPointer = 6
}
sHTML ="<table border=0
style='font-family:verdana; font-size:10px;'><tr >"
if (showWeekNumber ==1)
{
sHTML += "<td width=27><b>" + weekString + "</b></td><td width=1
rowspan=7 bgcolor='#d0d0d 0' style='padding: 0px'><img
src='"+imgDir+" divider.gif' width=1></td>"
}
for(i=0; i<7; i++)
{
sHTML += "<td width='27' align='right'>< B>"+ dayName[i]+"</B></td>"
}
sHTML +="</tr><tr>"
if (showWeekNumber ==1)
{
sHTML += "<td align=right>" + WeekNbr(startDa te) + " </td>"
}
for( var i=1; i<=dayPointer;i ++ )
{
sHTML += "<td> </td>"
}
for( datePointer=1; datePointer<=nu mDaysInMonth; datePointer++ )
{
dayPointer++;
sHTML += "<td align=right>"
sStyle=styleAnc hor
if ((datePointer== odateSelected)
&& (monthSelected= =omonthSelected ) && (yearSelected== oyearSelected))
{
sStyle+=styleLi ghtBorder
}
sHint = ""
for (k=0;k<Holidays Counter;k++)
{
if
((parseInt(Holi days[k].d)==datePointe r)&&(parseInt(H olidays[k].m)==(mont
hSelected+1)))
{
if
((parseInt(Holi days[k].y)==0)||((pars eInt(Holidays[k].y)==yearSelect ed)&
&(parseInt(Holi days[k].y)!=0)))
{
sStyle+="backgr ound-color:#FFDDDD;"
sHint+=sHint==" "?Holidays[k].desc:"\n"+Holi days[k].desc
}
}
}
var regexp= /\"/g
sHint=sHint.rep lace(regexp,"&q uot;")
dateMessage =
"onmousemove='w indow.status=\" "+selectDateMes sage.replace("[date]",const
ructDate(datePo inter,monthSele cted,yearSelect ed))+"\"'
onmouseout='win dow.status=\"\" ' "
if
((datePointer== dateNow)&&(mont hSelected==mont hNow)&&(yearSel ected==yearN
ow))
{ sHTML += "<b><a "+dateMessa ge+" title=\"" + sHint + "\"
style='"+sStyle +"'
href='javascrip t:dateSelected= "+datePointer+" ;closeCalendar( );'><font
color=#ff0000>& nbsp;" + datePointer + "</font> </a></b>"}
else if (dayPointer % 7 == (startAt * -1)+1)
{ sHTML += "<a "+dateMessa ge+" title=\"" + sHint + "\"
style='"+sStyle +"' href='javascrip t:dateSelected= "+datePoint er +
";closeCalendar ();'> <fon t color=#909090>" + datePointer +
"</font> </a>" }
else
{ sHTML += "<a "+dateMessa ge+" title=\"" + sHint + "\"
style='"+sStyle +"' href='javascrip t:dateSelected= "+datePoint er +
";closeCalendar ();'> " + datePointer + " </a>" }
sHTML += ""
if ((dayPointer+st artAt) % 7 == startAt)
{
sHTML += "</tr><tr>"
if ((showWeekNumbe r==1)&&(datePoi nter<numDaysInM onth))
{
sHTML += "<td align=right>" + (WeekNbr(new
Date(yearSelect ed,monthSelecte d,datePointer+1 ))) + " </td>"
}
}
}
document.getEle mentById("conte nt").innerHTM L = sHTML
document.getEle mentById("spanM onth").innerHTM L = " "
+ monthName[monthSelected] + " <IMG id='changeMonth '
SRC='"+imgDir+" drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>"
document.getEle mentById("spanY ear").innerHTM L = " " +
yearSelected + " <IMG id='changeYear' SRC='"+imgDir+" drop1.gif'
WIDTH='12' HEIGHT='10' BORDER=0>"
}
function popUpCalendar(c tl,ctl2,format)
{
var leftpos=-50;
var toppos=-120;
if (bPageLoaded)
{
if ( crossobj.visibi lity == "hidden" )
{
ctlToPlaceValue = ctl2
dateFormat=form at;
formatChar = " "
aFormat = dateFormat.spli t(formatChar)
if (aFormat.length <3)
{
formatChar = "/"
aFormat = dateFormat.spli t(formatChar)
if (aFormat.length <3)
{
formatChar = "."
aFormat = dateFormat.spli t(formatChar)
if (aFormat.length <3)
{
formatChar = "-"
aFormat = dateFormat.spli t(formatChar)
if (aFormat.length <3)
{
// invalid date format
formatChar=""
}
}
}
}
tokensChanged = 0
if ( formatChar != "" )
{
// use user's date
aData = ctl2.value.spli t(formatChar)
for (i=0;i<3;i++)
{
if ((aFormat[i]=="d") || (aFormat[i]=="dd"))
{
dateSelected = parseInt(aData[i], 10)
tokensChanged ++
}
else if ((aFormat[i]=="m") || (aFormat[i]=="mm"))
{
monthSelected = parseInt(aData[i], 10) - 1
tokensChanged ++
}
else if (aFormat[i]=="yyyy")
{
yearSelected = parseInt(aData[i], 10)
tokensChanged ++
}
else if (aFormat[i]=="mmm")
{
for (j=0; j<12; j++)
{
if (aData[i]==monthName[j])
{
monthSelected=j
tokensChanged ++
}
}
}
}
}
if
((tokensChanged !=3)||isNaN(dat eSelected)||isN aN(monthSelecte d)||isNaN(ye
arSelected))
{
dateSelected = dateNow
monthSelected = monthNow
yearSelected = yearNow
}
odateSelected=d ateSelected
omonthSelected= monthSelected
oyearSelected=y earSelected
aTag = ctl
do {
aTag = aTag.offsetPare nt;
leftpos += aTag.offsetLeft ;
toppos += aTag.offsetTop;
}
while(aTag.tagN ame!="BODY");
crossobj.left = fixedX==-1 ? ctl.offsetLeft + leftpos + 52 : fixedX
+ 52
crossobj.top = fixedY==-1 ? ctl.offsetTop + toppos +
ctl.offsetHeigh t + 105 : fixedY + 105
constructCalend ar (1, monthSelected, yearSelected);
crossobj.visibi lity=(dom||ie)? "visible" : "show"
hideElement( 'SELECT', document.getEle mentById("calen dar") );
hideElement( 'APPLET', document.getEle mentById("calen dar") );
bShow = true;
}
else
{
hideCalendar()
if (ctlNow!=ctl) {popUpCalendar( ctl, ctl2, format)}
}
ctlNow = ctl
}
}
document.onkeyp ress = function hidecal1 () {
if (event.keyCode= =27)
{
hideCalendar()
}
}
document.onclic k = function hidecal2 () {
if (!bShow)
{
hideCalendar()
}
bShow = false
}
function popUpCalendar_t op(ctl, ctl2, format,toppos)
{
var leftpos=-250;
var toppos=-toppos;
if (bPageLoaded)
{
if ( crossobj.visibi lity == "hidden" ) {
ctlToPlaceValue = ctl2
dateFormat=form at;
formatChar = " "
aFormat = dateFormat.spli t(formatChar)
if (aFormat.length <3)
{
formatChar = "/"
aFormat = dateFormat.spli t(formatChar)
if (aFormat.length <3)
{
formatChar = "."
aFormat = dateFormat.spli t(formatChar)
if (aFormat.length <3)
{
formatChar = "-"
aFormat = dateFormat.spli t(formatChar)
if (aFormat.length <3)
{
// invalid date format
formatChar=""
}
}
}
}
tokensChanged = 0
if ( formatChar != "" )
{
// use user's date
aData = ctl2.value.spli t(formatChar)
for (i=0;i<3;i++)
{
if ((aFormat[i]=="d") || (aFormat[i]=="dd"))
{
dateSelected = parseInt(aData[i], 10)
tokensChanged ++
}
else if ((aFormat[i]=="m") || (aFormat[i]=="mm"))
{
monthSelected = parseInt(aData[i], 10) - 1
tokensChanged ++
}
else if (aFormat[i]=="yyyy")
{
yearSelected = parseInt(aData[i], 10)
tokensChanged ++
}
else if (aFormat[i]=="mmm")
{
for (j=0; j<12; j++)
{
if (aData[i]==monthName[j])
{
monthSelected=j
tokensChanged ++
}
}
}
}
}
if
((tokensChanged !=3)||isNaN(dat eSelected)||isN aN(monthSelecte d)||isNaN(ye
arSelected))
{
dateSelected = dateNow
monthSelected = monthNow
yearSelected = yearNow
}
odateSelected=d ateSelected
omonthSelected= monthSelected
oyearSelected=y earSelected
aTag = ctl
do {
aTag = aTag.offsetPare nt;
leftpos += aTag.offsetLeft ;
toppos += aTag.offsetTop;
} while(aTag.tagN ame!="BODY");
crossobj.left = fixedX==-1 ? ctl.offsetLeft + leftpos : fixedX
crossobj.top = fixedY==-1 ? ctl.offsetTop + toppos +
ctl.offsetHeigh t + 2 : fixedY
constructCalend ar (1, monthSelected, yearSelected);
crossobj.visibi lity=(dom||ie)? "visible" : "show"
hideElement( 'SELECT', document.getEle mentById("calen dar") );
hideElement( 'APPLET', document.getEle mentById("calen dar") );
bShow = true;
}
else
{
hideCalendar()
if (ctlNow!=ctl) {popUpCalendar( ctl, ctl2, format)}
}
ctlNow = ctl
}
}
document.onkeyp ress = function hidecal1 () {
if (this.keyCode== 27)
{
hideCalendar()
}
}
document.onclic k = function hidecal2 () {
if (!bShow)
{
hideCalendar()
}
bShow = false
}
init()
*** Sent via Developersdex
http://www.developersdex.com ***