var fixedX0 = -1		// x position (-1 if to appear below control)
	var	fixedY0 = -1			// y position (-1 if to appear below control)
	var startAt0 = 0			// 0 - sunday ; 1 - monday
	var showWeekNumber0 = 0	// 0 - don't show; 1 - show
	var showToday0 = 0		// 0 - don't show; 1 - show
	var imgDir0 = ""			// directory for images ... e.g. var imgDir="/img/"

	var gotoString0 = "Go To Current Month"
	var todayString0 = "Today is"
	var weekString0 = "Wk"
	var scrollLeftMessage0 = "Click to scroll to previous month. Hold mouse button to scroll automatically."
	var scrollRightMessage0 = "Click to scroll to next month. Hold mouse button to scroll automatically."
	var selectMonthMessage0 = "Click to select a month."
	var selectYearMessage0 = "Click to select a year."
	var selectDateMessage0 = "Select [date] as date." // do not replace [date], it will be replaced by date.

	var	crossobj0, crossMonthObj0, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingYear

	var	bPageLoaded0=false
	var	ie0=document.all
	var	dom0=document.getElementById

	var	ns40=document.layers
	var	today0 =	new	Date()
	var	dateNow0	 = today0.getDate()
	var	monthNow0 = today0.getMonth()
	var	yearNow0	 = today0.getYear()
	var	imgsrc0 = new Array("drop1.gif","drop2.gif","left1.gif","left2.gif","right1.gif","right2.gif")
	var	img0	= new Array()

	if (dom0)
	{
		for	(i=0;i<imgsrc0.length;i++)
		{
			img0[i] = new Image
			img0[i].src = imgDir0 + imgsrc0[i]
		}
		/*Change color here*/
		var table0 = "<table width='150' border='0' cellspacing='0' cellpadding='0'><tr><td id='calendar0'><table cellspacing='0' cellpadding='0'><tr><td width='100%'><table class='cellTLRB' width='100%' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'><tr><td width='100%'><span id='caption0'></span></td></tr></table></td></tr><tr><td bgcolor='#FFFFFF' width='100%'><span id='content0'></span></td></tr></table></td></tr></table>";
		document.write (table0);
	}

	var	monthName0 =	new	Array("January","February","March","April","May","June","July","August","September","October","November","December")
	if (startAt0==0)
	{
		dayName0 = new Array	("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
	}
	else
	{
		dayName0 = new Array	("Mon","Tue","Wed","Thu","Fri","Sat","Sun")
	}
	var	styleAnchor0="text-decoration:none;color:black;"
	var	styleLightBorder0="border-style:solid;border-width:1px;border-color:#a0a0a0;"

	function swapImage0(srcImg, destImg){
		if (ie0)	{ document.getElementById(srcImg0).setAttribute("src",imgDir0 + destImg0) }
	}

	function init0()	{
		if (!ns40)
		{
			if (!ie0) { yearNow0 += 1900	}

			monthConstructed0=false;
			yearConstructed0=false;

			sHTML1 = "<table width='100%' cellspacing='0' class='dateFormat'><tr><td onclick='javascript:decMonth0()' class='nextFormat'><font class='dateFormat'>&nbsp; < &nbsp;</font></td><td align='center' width='66%' id='spanMonth0'></td><td class='nextFormat' onclick='incMonth0()'>&nbsp > &nbsp</td></tr></table>";
			
			document.getElementById("caption0").innerHTML  =	sHTML1

			bPageLoaded0=true

			//Calling a calendar function and passing the name of the text 
			//box which holds the date field. Added by D.T.

			//Initialize calendar to current date. (11-14 ET)
			dateFormat0='m/d/yyyy';
			
            dateSelected0 = dateNow0
			     monthSelected0 = monthNow0
			     yearSelected0 = yearNow0

			odateSelected0=dateSelected0
			omonthSelected0=monthSelected0
			oyearSelected0=yearSelected0
		
	
			constructCalendar0(1, monthSelected0, yearSelected0);
		}
	}

	function padZero0(num) {
		return (num	< 10)? '0' + num : num ;
	}

	function constructDate0(d,m,y)
	{
		sTmp = dateFormat
		sTmp = sTmp.replace	("dd","<e>")
		sTmp = sTmp.replace	("d","<d>")
		sTmp = sTmp.replace	("<e>",padZero0(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>",padZero0(m+1))
		sTmp = sTmp.replace	("<o>",monthName0[m])
		return sTmp.replace ("yyyy",y)
	}

	/*** Month Pulldown	***/
	function incMonth0() {
		monthSelected0++
		if (monthSelected0>11) {
			monthSelected0=0
			yearSelected0++
		}
		constructCalendar0()
	}

	function decMonth0() {
		monthSelected0--
		if (monthSelected0<0) {
			monthSelected0=11
			yearSelected0--
		}
		constructCalendar0()
	}


	/*** calendar ***/

	function WeekNbr0(today)
    {
		Year0 = takeYear0(today);
		Month0 = today0.getMonth();
		Day0 = today0.getDate();
		now0 = Date.UTC(Year0,Month0,Day0+1,0,0,0);
		var Firstday = new Date();
		Firstday.setYear0(Year);
		Firstday.setMonth0(0);
		Firstday.setDate0(1);
		then = Date.UTC(Year,0,1,0,0,0);
		var Compensation = Firstday.getDay();
		if (Compensation > 3) Compensation -= 4;
		else Compensation += 3;
		NumberOfWeek =  Math.round((((now-then)/86400000)+Compensation)/7);
		return NumberOfWeek;
	}

	function takeYear0(theDate)
	{
		x = theDate.getYear();
		var y = x % 100;
		y += (y < 38) ? 2000 : 1900;
		return y;
	}


    function formSubmit(day, month, year)
    {
        document.eventCalForm0.dd.value = day;
        document.eventCalForm0.mm.value = month;
        document.eventCalForm0.yy.value = year;
        document.eventCalForm0.submit(); 
    }

	function constructCalendar0() {
		var aNumDays = Array (31,0,31,30,31,30,31,31,30,31,30,31)

		var dateMessage
		var	startDate =	new	Date (yearSelected0,monthSelected0,1)
		var endDate

        /*used for event days*/
        var eventDay = false;

		if (monthSelected0==1)
		{
			endDate	= new Date (yearSelected0,monthSelected0+1,1);
			endDate	= new Date (endDate	- (24*60*60*1000));
			numDaysInMonth = endDate.getDate()
		}
		else
		{
			numDaysInMonth = aNumDays[monthSelected0];
		}

		datePointer	= 0
		dayPointer = startDate.getDay() - startAt0
		
		if (dayPointer<0)
		{
			dayPointer = 6
		}

		sHTML =	"<table width='100%' cellspacing='0' cellpadding='1' border=0 style='font-family:arial;font-size:10px;'><tr>";

		for	(i=0; i<7; i++)	{
			if (i==6)
				sHTML += "<td class='cellTLRB' align='right'><B>"+ dayName0[i]+"</B></td>"
			else
				sHTML += "<td class='cellTLB' align='right'><B>"+ dayName0[i]+"</B></td>"
		}
		sHTML +="</tr><tr>"
		
		if (showWeekNumber0==1)
		{
			sHTML += "<td align='center'>" + WeekNbr0(startDate) + "&nbsp;</td>"
		}

		for	( var i=1; i<=dayPointer;i++ )
		{
			sHTML += "<td class='cellLB'>&nbsp;</td>"
		}
	
		for	(datePointer=1; datePointer<=numDaysInMonth; datePointer++)
		{
            /*check to see if its an event day*/
            eventDay = false;
            for(j=0;j<document.arraycount;j++)
            {
                
                if(document.arrayYear[j]==yearSelected0 && document.arrayMonth[j]==monthSelected0+1 &&                      document.arrayDay[j]==datePointer)
                {
                    eventDay = true;
                }
            }
			dayPointer++;
			if (dayPointer%7 == 0)
            {
                //check to see if its an event day
                if(eventDay)
				    sHTML += "<td class='cellLRBcolor' align='right'>";
                else
                    sHTML += "<td class='cellLRB' align='right'>";
            }
			else
            {
                if(eventDay)
				    sHTML += "<td class='cellLBcolor' align='right'>";
                else
                    sHTML += "<td class='cellLB' align='right'>";

            }
			sStyle=styleAnchor0
			

			dateMessage = "onmousemove='window.status=\'selectDateMessage.replace(\"[date]\",constructDate0(datePointer,monthSelected0,yearSelected0))\' onmouseout='window.status=\'\''"
            var sHint0 = "";
			
            if(eventDay)
            {
                sHTML += "<a \"+dateMessage+\" title='" + sHint0 + "' style='"+sStyle+"' href='javascript:formSubmit("+datePointer + ", " + (monthSelected0) + ", " + yearSelected0 + ");'>&nbsp;<font color=#A04540>" + datePointer + "</font>&nbsp;</a>"
            }
            else if(dayPointer % 7 == (startAt0 * -1)+1)
			{       
                sHTML += "<a \"+dateMessage+\" title='" + sHint0 + "' style='"+sStyle+"' href='javascript:formSubmit("+datePointer + ", " + (monthSelected0) + ", " + yearSelected0 + ");'>&nbsp;<font color=#909090>" + datePointer + "</font>&nbsp;</a>"
            }
			else
			{ 
                sHTML += "<a \"+dateMessage+\" title='" + sHint0 + "' style='"+sStyle+"' href='javascript:formSubmit("+datePointer + ", " + (monthSelected0) + ", " + yearSelected0 + ");'>&nbsp;" + datePointer + "&nbsp;</a>"
            }

			sHTML += ""
			if ((dayPointer+startAt0) % 7 == startAt0) 
            { 
				sHTML += "</tr><tr>" 
				if ((showWeekNumber0==1)&&(datePointer<numDaysInMonth))
				{
					sHTML += "<td align=right>" + (WeekNbr0(new Date(yearSelected0,monthSelected0,datePointer+1))) + "&nbsp;</td>"
				}
			}
		}

        //pad any cells remaininng into calendar
		for(i=(dayPointer%7);i<7;i++)
		{
			
            if(i==6)
               sHTML += "<td class='cellLRB'>&nbsp;</td>";
            else
                sHTML += "<td class='cellLB'>&nbsp;</td>";

		}

		document.getElementById("content0").innerHTML   = sHTML
		document.getElementById("spanMonth0").innerHTML = monthName0[monthSelected0] + " " + yearSelected0;
	}