

FCAL_LAYER='FCAL';FCAL_OPEN=null;FCAL_FIELD=null;FCAL_DATE=new Date();FCAL_STARTDATE=new Date();

function f_open(a){var o=getObject(FCAL_LAYER);var n=(FCAL_OPEN==null);if(FCAL_FIELD&&(a==FCAL_FIELD))return false;if(!n)hideObject(FCAL_OPEN);FCAL_OPEN=o;FCAL_FIELD=a;var d;if(a.name=='FDepart'){d=new Date();d.setDate(d.getDate()+14);FCAL_STARTDATE=new Date();}else{d=new Date(FCAL_DATE.getFullYear(),FCAL_DATE.getMonth(),FCAL_DATE.getDate());d.setDate(d.getDate()+0);FCAL_STARTDATE=d;}f_renderMonth(d.getMonth()+1,d.getFullYear());moveObject(o,getX(a)+getW(a),getY(a));showObject(o);if(n)trackMouseClick(f_checkClose);}
function f_checkClose(e){if(FCAL_OPEN==null)return;var x=getEventX(e);var y=getEventY(e);if(!(isInside(FCAL_FIELD,x,y,0,0,4,0)||isInside(FCAL_OPEN,x,y)))f_close();}
function f_setDate(y,m,d){if(FCAL_OPEN==null)return;FCAL_FIELD.value=(m<10?'0':'')+m+'/'+(d<10?'0':'')+d+'/'+y;if(FCAL_FIELD.name=='FDepart')FCAL_DATE=new Date(y,m-1,d-1);f_close();}
function f_close(){hideObject(FCAL_OPEN);if(FCAL_OPEN!=null)untrackMouseClick();FCAL_OPEN=null;FCAL_FIELD=null;}
function f_renderMonth(month,year){if(FCAL_OPEN==null)return;var t_y=FCAL_STARTDATE.getFullYear();var t_m=FCAL_STARTDATE.getMonth()+1;var t_d=FCAL_STARTDATE.getDate();var d=new Date(year,month-1,1);var max=(month==2?28+((year%4==0)&&((year%100!=0)||(year%400==0))?1:0):30+(month<8?1-((month-1)%2):(month-1)%2));var html='<table border=0 cellpadding=1 cellspacing=0 bgcolor="#305799"><tr><td><table border=0 cellpadding=3 cellspacing=1 width=150><tr bgcolor="#305799"><td align=center><a href="javascript:void(0)" onclick="f_renderMonth('+(month>1?month-1:12)+','+(month>1?year:year-1)+')"><img src="a_left.gif" width=8 height=8 border=0></a></td><td colspan=5 align=center><font size=1 face="arial,helvetica" color=white><b>'+MONTHS[month-1].toUpperCase()+' '+year+'</b></font></td><td align=center><a href="javascript:void(0)" onclick="f_renderMonth('+(month<12?month+1:1)+','+(month<12?year:year+1)+')"><img src="a_right.gif" width=8 height=8 border=0></a></td></tr><tr bgcolor="#e1e1e1"><td align=center><font size=1 face="arial,helvetica">S</font></td><td align=center><font size=1 face="arial,helvetica">M</font></td><td align=center><font size=1 face="arial,helvetica">T</font></td><td align=center><font size=1 face="arial,helvetica">W</font></td><td align=center><font size=1 face="arial,helvetica">T</font></td><td align=center><font size=1 face="arial,helvetica">F</font></td><td align=center><font size=1 face="arial,helvetica">S</font></td></tr>';var offset=d.getDay()+1;var count=1, i, a;for (i=1;i<=max;i++){if(count==1)html+='<tr bgcolor=white>';if((i==1)&&(offset>1)){html+='<td colspan='+(offset-1)+' bgcolor="#e1e1e1"><font size=1>&nbsp;</font></td>';count=offset;}a=((year>t_y)||((year==t_y)&&((month>t_m)||((month==t_m)&&(i>=t_d)))));html+='<td align=center><font face="arial,helvetica" size=1'+(a?'><a href="javascript:void(0)" onclick="f_setDate('+year+','+month+','+i+')"><b>':' color=gray>')+i+(a?'</b></a>':'')+'</font></td>';if((i==max)&&(count<7)){html+='<td colspan='+(7-count)+' bgcolor="#e1e1e1"><font size=1>&nbsp;</font></td>';count=7;}count++;if(count>7){count=1;html+='</tr>';}}html+='</table></td></tr></table>';writeObject(FCAL_OPEN,html);}

//-->
