	var flag = 0
	var	fixedX1 = -1			// x position (-1 if to appear below control)
	var	fixedY1 = -1			// y position (-1 if to appear below control)
	var startAt1 = 1				// 0 - sunday ; 1 - monday
	var showWeekNumber1 = 1			// 0 - don't show; 1 - show
	var showtoday1 = 1			// 0 - don't show; 1 - show
	if (!imgDir) var imgDir = ""			// directory for images ... e.g. var imgDir="/img/"

	var gotoString1 = "Go To Current Month"
	var today1String1 = "today1 is"
	var weekString1 = "Wk"
	var scrollLeftMessage1 = "Click to scroll to previous month. Hold mouse button to scroll automatically in js."
	var scrollRightMessage1 = "Click to scroll to next month. Hold mouse button to scroll automatically."
	var selectMonthMessage1 = "Click to select a month."
	var selectYearMessage1 = "Click to select a year."
	var selectDateMessage1 = "Select [date] as date." // do not replace [date], it will be replaced by date.

	var	crossobj1, crossMonthObj1, crossYearObj1, monthSelected1, yearSelected1, dateSelected1, omonthSelected1, oyearSelected1, odateSelected1, monthConstructed1, yearConstructed1, intervalID11, intervalID21, timeoutID11, timeoutID21, ctlToPlaceValue1, ctlNow1, dateFormat1, nStartingYear1

	var	bPageLoaded1=false
	var	ie=document.all
	var	dom1=document.getElementById

	var	ns41=document.layers
	var	today1 =	new	Date()
	var	dateNow1	 = today1.getDate()
	var	monthNow1 = today1.getMonth()
	var	yearNow1	 = today1.getYear()
	var	imgsrc = new Array("drop1.gif","drop2.gif","left1.gif","left2.gif","right1.gif","right2.gif")
	var	img	= new Array()

	var bshow1 = false;

    /* hides <select> and <applet> objects (for IE only) */
    function hideElement1( elmID, overDiv )
    {
      if( 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" )
          {
            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 );
          else if( overDiv.offsetTop >= ( objTop + objHeight ));
          else if( overDiv.offsetLeft >= ( objLeft + objWidth ));
          else
          {
            obj.style.visibility = "hidden";
          }
        }
      }
    }
    /*
    * unhides <select> and <applet> objects (for IE only)
    */
    function showElement1( elmID )
    {
      if( 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 HolidayRec1 (d, m, y, desc)
	{
		this.d = d
		this.m = m
		this.y = y
		this.desc = desc
	}

	var HolidaysCounter = 0
	var Holidays = new Array()

	function addHoliday1 (d, m, y, desc)
	{
		Holidays[HolidaysCounter++] = new HolidayRec1 ( d, m, y, desc )
	}

	if (dom1)
	{
		for	(i=0;i<imgsrc.length;i++)
		{
			img[i] = new Image
			img[i].src = imgDir + imgsrc[i]
		}
		
//		document.write ("<div onclick='bshow1=true' id='calendar1'	style='z-index:+999;position:absolute;visibility:hidden;'><table	width="+((showWeekNumber1==1)?250:220)+" style='font-family:arial;font-size:11px;border-width:1;border-style:solid;border-color:#8CA6C6;font-family:arial; font-size:11px}' bgcolor='#ffffff'><tr bgcolor='#006F5C'><td><table width='"+((showWeekNumber1==1)?248:218)+"'><tr><td style='padding:2px;font-family:arial; font-size:11px;'><font color='#ffffff'><B><span id='caption1'></span></B></font></td><td align=right><a href='javascript:hideCalendar1()'><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='content1'></span></td></tr>")
		document.write ("<div onclick='bshow1=true' id='calendar1'	style='z-index:+999;position:absolute;visibility:hidden;'><table	width="+((showWeekNumber1==1)?250:220)+" style='font-family:arial;font-size:11px;border-width:1;border-style:solid;border-color:#8CA6C6;font-family:arial; font-size:11px}' bgcolor='#ffffff'><tr bgcolor='#3e3432'><td><table width='"+((showWeekNumber1==1)?248:218)+"'><tr><td style='padding:2px;font-family:arial; font-size:11px;'><font color='#ffffff'><B><span id='caption1'></span></B></font></td><td align=right><a href='javascript:hideCalendar1()' style='color:White; font-weight:bold;'>X</a></td></tr></table></td></tr><tr><td style='padding:5px' bgcolor=#ffffff><span id='content1'></span></td></tr>")
			
		if (showtoday1==1)
		{
			document.write ("<tr bgcolor=#EFEFEF><td style='padding:5px' align=center><span id='lbltoday1'></span></td></tr>")
		}
			
		document.write ("</table></div><div id='selectMonth1' style='z-index:+999;position:absolute;visibility:hidden;'></div><div id='selectYear1' style='z-index:+999;position:absolute;visibility:hidden;'></div>");
	}

	var	monthName =	new	Array("January","February","March","April","May","June","July","August","September","October","November","December")
	if (startAt1==0)
	{
		dayName = new Array	("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
	}
	else
	{
		dayName = new Array	("Mon","Tue","Wed","Thu","Fri","Sat","Sun")
	}
	var	styleAnchor="text-decoration:none;color:black;"
	var	styleLightBorder="border-style:solid;border-width:1px;border-color:#043580;"

	function swapImage1(srcImg, destImg){
		if (ie)	{ document.getElementById(srcImg).setAttribute("src",imgDir + destImg) }
	}

	function init1()	{
		
		if (!ns41)
		{
			
			if (!ie) { yearNow1 += 1900	}

			crossobj1=(dom1)?document.getElementById("calendar1").style : ie? document.all.calendar : document.calendar
			hideCalendar1()

			crossMonthObj1=(dom1)?document.getElementById("selectMonth1").style : ie? document.all.selectMonth	: document.selectMonth

			crossYearObj1=(dom1)?document.getElementById("selectYear1").style : ie? document.all.selectYear : document.selectYear

			monthConstructed1=false;
			yearConstructed1=false;

			if (showtoday1==1)
			{
				document.getElementById("lbltoday1").innerHTML =	today1String1 + " <a onmousemove='window.status=\""+gotoString1+"\"' onmouseout='window.status=\"\"' title='"+gotoString1+"' style='"+styleAnchor+"' href='javascript:monthSelected1=monthNow1;yearSelected1=yearNow1;constructCalendar1();'>"+dayName[(today1.getDay()-startAt1==-1)?6:(today1.getDay()-startAt1)]+", " + dateNow1 + " " + monthName[monthNow1].substring(0,3)	+ "	" +	yearNow1	+ "</a>"
			}

		//	sHTML1="<span id='spanLeft'	style='border-style:solid;border-width:1;border-color:#043580;cursor:pointer' onmouseover='swapImage1(\"changeLeft\",\"left2.gif\");this.style.borderColor=\"#043580\";window.status=\""+scrollLeftMessage1+"\"' onclick='javascript:decMonth1()' onmouseout='clearInterval(intervalID11);swapImage1(\"changeLeft\",\"left1.gif\");this.style.borderColor=\"#043580\";window.status=\"\"' onmousedown='clearTimeout(timeoutID11);timeoutID11=setTimeout(\"StartDecMonth1()\",500)'	onmouseup='clearTimeout(timeoutID11);clearInterval(intervalID11)'>&nbsp<IMG id='changeLeft' SRC='"+imgDir+"left1.gif' width=10 height=11 BORDER=0>&nbsp<</span>&nbsp;"
		//	sHTML1+="<span id='spanRight1' style='border-style:solid;border-width:1;border-color:#043580;cursor:pointer'	onmouseover='swapImage1(\"changeRight\",\"right2.gif\");this.style.borderColor=\"#043580\";window.status=\""+scrollRightMessage1+"\"' onmouseout='clearInterval(intervalID11);swapImage1(\"changeRight\",\"right1.gif\");this.style.borderColor=\"#043580\";window.status=\"\"' onclick='incMonth1()' onmousedown='clearTimeout(timeoutID11);timeoutID11=setTimeout(\"StartIncMonth1()\",500)'	onmouseup='clearTimeout(timeoutID11);clearInterval(intervalID11)'>&nbsp<IMG id='changeRight' SRC='"+imgDir+"right1.gif'	width=10 height=11 BORDER=0>&nbsp<<</span>&nbsp"
		//	sHTML1+="<span id='spanMonth1' style='border-style:solid;border-width:1;border-color:#043580;cursor:pointer'	onmouseover='swapImage1(\"changeMonth\",\"drop2.gif\");this.style.borderColor=\"#043580\";window.status=\""+selectMonthMessage1+"\"' onmouseout='swapImage1(\"changeMonth\",\"drop1.gif\");this.style.borderColor=\"#043580\";window.status=\"\"' onclick='popUpMonth1()'></span>&nbsp;"
		//	sHTML1+="<span id='spanYear1' style='border-style:solid;border-width:1;border-color:#043580;cursor:pointer' onmouseover='swapImage1(\"changeYear\",\"drop2.gif\");this.style.borderColor=\"#043580\";window.status=\""+selectYearMessage1+"\"'	onmouseout='swapImage1(\"changeYear\",\"drop1.gif\");this.style.borderColor=\"#043580\";window.status=\"\"'	onclick='popUpYear1()'></span>&nbsp;"
			
			sHTML1="<span id='spanLeft'	style='border-style:solid;border-width:1;border-color:#043580;cursor:pointer' onmouseover='swapImage1(\"changeLeft\",\"left2.gif\");this.style.borderColor=\"#043580\";window.status=\""+scrollLeftMessage1+"\"' onclick='javascript:decMonth1()' onmouseout='clearInterval(intervalID11);swapImage1(\"changeLeft\",\"left1.gif\");this.style.borderColor=\"#043580\";window.status=\"\"' onmousedown='clearTimeout(timeoutID11);timeoutID11=setTimeout(\"StartDecMonth1()\",500)'	onmouseup='clearTimeout(timeoutID11);clearInterval(intervalID11)'>&nbsp&nbsp<<</span>&nbsp;"
			sHTML1+="<span id='spanRight1' style='border-style:solid;border-width:1;border-color:#043580;cursor:pointer'	onmouseover='swapImage1(\"changeRight\",\"right2.gif\");this.style.borderColor=\"#043580\";window.status=\""+scrollRightMessage1+"\"' onmouseout='clearInterval(intervalID11);swapImage1(\"changeRight\",\"right1.gif\");this.style.borderColor=\"#043580\";window.status=\"\"' onclick='incMonth1()' onmousedown='clearTimeout(timeoutID11);timeoutID11=setTimeout(\"StartIncMonth1()\",500)'	onmouseup='clearTimeout(timeoutID11);clearInterval(intervalID11)'>&nbsp&nbsp>></span>&nbsp"
			sHTML1+="<span id='spanMonth1' style='border-style:solid;border-width:1;border-color:#043580;cursor:pointer'	onmouseover='swapImage1(\"changeMonth\",\"drop2.gif\");this.style.borderColor=\"#043580\";window.status=\""+selectMonthMessage1+"\"' onmouseout='swapImage1(\"changeMonth\",\"drop1.gif\");this.style.borderColor=\"#043580\";window.status=\"\"' onclick='popUpMonth1()'></span>&nbsp;"
			sHTML1+="<span id='spanYear1' style='border-style:solid;border-width:1;border-color:#043580;cursor:pointer' onmouseover='swapImage1(\"changeYear\",\"drop2.gif\");this.style.borderColor=\"#043580\";window.status=\""+selectYearMessage1+"\"'	onmouseout='swapImage1(\"changeYear\",\"drop1.gif\");this.style.borderColor=\"#043580\";window.status=\"\"'	onclick='popUpYear1()'></span>&nbsp;"
			
			document.getElementById("caption1").innerHTML  =	sHTML1

			bPageLoaded1=true
		}
	}

	function hideCalendar1()	{
		crossobj1.visibility="hidden"
		if (crossMonthObj1 != null){crossMonthObj1.visibility="hidden"}
		if (crossYearObj1 != null){crossYearObj1.visibility="hidden"}

	    showElement1( 'SELECT' );
		showElement1( 'APPLET' );
	}

	function padZero1(num) {
		return (num	< 10)? '0' + num : num ;
	}

	function constructDate1(d,m,y)
	{
		sTmp = dateFormat1
		sTmp = sTmp.replace	("dd","<e>")
		sTmp = sTmp.replace	("d","<d>")
		sTmp = sTmp.replace	("<e>",padZero1(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>",padZero1(m+1))
		sTmp = sTmp.replace	("<o>",monthName[m])
		return sTmp.replace ("yyyy",y)
	}

	function closeCalendar1() {
		var	sTmp
		hideCalendar1();
		ctlToPlaceValue1.value =  constructDate1(dateSelected1,monthSelected1,yearSelected1)
	}

	/*** Month Pulldown	***/

	function StartDecMonth1()
	{
		intervalID11=setInterval("decMonth1()",80)
	}

	function StartIncMonth1()
	{
		intervalID11=setInterval("incMonth1()",80)
	}

	function incMonth1 () {
		monthSelected1++
		if (monthSelected1>11) {
			monthSelected1=0
			yearSelected1++
		}
		constructCalendar1()
	}

	function decMonth1() {
		monthSelected1--
		if (monthSelected1<0) {
			monthSelected1=11
			yearSelected1--
		}
		
		constructCalendar1()
	}

	function constructMonth1() {
		popDownYear1()
		if (!monthConstructed1) {
			sHTML1 =	""
			for	(i=0; i<12;	i++) {
				sName =	monthName[i];
				if (i==monthSelected1){
					sName =	"<B>" +	sName +	"</B>"
				}
				
				//COLOR OF SCROLLING MTHS : #FFCC99[OLD] = #EFEFEF[NEW]/#FFFFDD[OLD] = #FFFFFF[NEW]
				sHTML1 += "<tr><td id='m" + i + "' onmouseover='this.style.backgroundColor=\"#EFEFEF\"' onmouseout='this.style.backgroundColor=\"\"' style='cursor:pointer' onclick='monthConstructed1=false;monthSelected1=" + i + ";constructCalendar1();popDownMonth1();event.cancelBubble=true'>&nbsp;" + sName + "&nbsp;</td></tr>"
			}

			//COLOR OF SCROLLING MTHS : #FFFFDD[OLD] = #FFFFFF[NEW]
			document.getElementById("selectMonth1").innerHTML = "<table width=70	style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#043580;' bgcolor='#FFFFFF' cellspacing=0 cellpadding=0 onmouseover='clearTimeout(timeoutID11)'	onmouseout='clearTimeout(timeoutID11);timeoutID11=setTimeout(\"popDownMonth1()\",100);event.cancelBubble=true'>" +	sHTML1 +	"</table>"

			monthConstructed1=true
		}
	}

	function popUpMonth1() {
		constructMonth1()
		crossMonthObj1.visibility = (dom1||ie)? "visible"	: "show"
		crossMonthObj1.left = parseInt(crossobj1.left) + 50
		crossMonthObj1.top =	parseInt(crossobj1.top) + 26

		hideElement1( 'SELECT', document.getElementById("selectMonth1") );
		hideElement1( 'APPLET', document.getElementById("selectMonth1") );			
	}

	function popDownMonth1()	{
		crossMonthObj1.visibility= "hidden"
	}

	/*** Year Pulldown ***/

	function incYear1() {
		for	(i=0; i<7; i++){
			newYear	= (i+nStartingYear1)+1
			if (newYear==yearSelected1)
			{ txtYear =	"&nbsp;<B>"	+ newYear +	"</B>&nbsp;" }
			else
			{ txtYear =	"&nbsp;" + newYear + "&nbsp;" }
			document.getElementById("y"+i).innerHTML = txtYear
		}
		nStartingYear1 ++;
		bshow1=true
	}

	function decYear1() {
		for	(i=0; i<7; i++){
			newYear	= (i+nStartingYear1)-1
			if (newYear==yearSelected1)
			{ txtYear =	"&nbsp;<B>"	+ newYear +	"</B>&nbsp;" }
			else
			{ txtYear =	"&nbsp;" + newYear + "&nbsp;" }
			document.getElementById("y"+i).innerHTML = txtYear
		}
		nStartingYear1 --;
		bshow1=true
	}

	function selectYear1(nYear) {
		yearSelected1=parseInt(nYear+nStartingYear1);
		yearConstructed1=false;
		constructCalendar1();
		popDownYear1();
	}

	function constructYear1() {
		popDownMonth1()
		sHTML1 =	""
		if (!yearConstructed1) {

			//COLOR OF SCROLLING MTHS : #FFCC99[OLD] = #EFEFEF[NEW}]/#FFFFDD[OLD] = #FFFFFF[NEW]
			sHTML1 =	"<tr><td align='center'	onmouseover='this.style.backgroundColor=\"#EFEFEF\"' onmouseout='clearInterval(intervalID11);this.style.backgroundColor=\"\"' style='cursor:pointer'	onmousedown='clearInterval(intervalID11);intervalID11=setInterval(\"decYear1()\",30)' onmouseup='clearInterval(intervalID11)'>-</td></tr>"

			j =	0
			nStartingYear1 =	yearSelected1-3
			for	(i=(yearSelected1-3); i<=(yearSelected1+3); i++) {
				sName =	i;
				if (i==yearSelected1){
					sName =	"<B>" +	sName +	"</B>"
				}

				//COLOR OF SCROLLING MTHS : #FFCC99[OLD] = #EFEFEF[NEW]/#FFFFDD[OLD] = #FFFFFF[NEW]
				sHTML1 += "<tr><td id='y" + j + "' onmouseover='this.style.backgroundColor=\"#EFEFEF\"' onmouseout='this.style.backgroundColor=\"\"' style='cursor:pointer' onclick='selectYear1("+j+");event.cancelBubble=true'>&nbsp;" + sName + "&nbsp;</td></tr>"
				j ++;
			}

			//COLOR OF SCROLLING MTHS : #FFCC99[OLD] = #EFEFEF[NEW]/#FFFFDD[OLD] = #FFFFFF[NEW]
			sHTML1 += "<tr><td align='center' onmouseover='this.style.backgroundColor=\"#EFEFEF\"' onmouseout='clearInterval(intervalID21);this.style.backgroundColor=\"\"' style='cursor:pointer' onmousedown='clearInterval(intervalID21);intervalID21=setInterval(\"incYear1()\",30)'	onmouseup='clearInterval(intervalID21)'>+</td></tr>"

			//COLOR OF SCROLLING MTHS : #FFFFDD[OLD] = #FFFFFF[NEW]
			document.getElementById("selectYear1").innerHTML	= "<table width=44 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;'	bgcolor='#FFFFFF' onmouseover='clearTimeout(timeoutID21)' onmouseout='clearTimeout(timeoutID21);timeoutID21=setTimeout(\"popDownYear1()\",100)' cellspacing=0 cellpadding=0>"	+ sHTML1	+ "</table>"

			yearConstructed1	= true
		}
	}

	function popDownYear1() {
		clearInterval(intervalID11)
		clearTimeout(timeoutID11)
		clearInterval(intervalID21)
		clearTimeout(timeoutID21)
		crossYearObj1.visibility= "hidden"
	}

	function popUpYear1() {
		var	leftOffset

		constructYear1()
		crossYearObj1.visibility	= (dom1||ie)? "visible" : "show"
		leftOffset = parseInt(crossobj1.left) + document.getElementById("spanYear1").offsetLeft
		if (ie)
		{
			leftOffset += 6
		}
		crossYearObj1.left =	leftOffset
		crossYearObj1.top = parseInt(crossobj1.top) +	26
	}

	/*** calendar ***/
   function WeekNbr1(n) {
      // Algorithm used:
      // From Klaus Tondering's Calendar document (The Authority/Guru)
      // hhtp://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 (startAt1 == 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 constructCalendar1 () {
		
		var aNumDays = Array (31,0,31,30,31,30,31,31,30,31,30,31)

		var dateMessage1
		var	startDate =	new	Date (yearSelected1,monthSelected1,1)
		var endDate
        
		if (monthSelected1==1)
		{
			endDate	= new Date (yearSelected1,monthSelected1+1,1);
			endDate	= new Date (endDate	- (24*60*60*1000));
			numDaysInMonth = endDate.getDate()
		}
		else
		{
			numDaysInMonth = aNumDays[monthSelected1];
			
		}

		datePointer	= 0
		dayPointer = startDate.getDay() - startAt1
		
		if (dayPointer<0)
		{
			dayPointer = 6
		}

		sHTML1 =	"<table	 border=0 style='font-family:verdana;font-size:10px; '><tr bgcolor='#EFEFEF'>"
        
		if (showWeekNumber1==1)
		{
			sHTML1 += "<td width=27 align=center><b>" + weekString1 + "</b></td><td width=1 rowspan=7 bgcolor='#000000' style='padding:0px'><img src='"+imgDir+"divider.gif' width=1></td>"
		}

		for	(i=0; i<7; i++)	{
			sHTML1 += "<td width='27' align=center><B>"+ dayName[i]+"</B></td>"
		}
		sHTML1 +="</tr><tr>"
		
		if (showWeekNumber1==1)
		{
			sHTML1 += "<td align=right>" + WeekNbr1(startDate) + "&nbsp;</td>"
		}

		for	( var i=1; i<=dayPointer;i++ )
		{
			sHTML1 += "<td>&nbsp;</td>"
		}
	   
		for	( datePointer=1; datePointer<=numDaysInMonth; datePointer++ )
		{  
			dayPointer++;
			sHTML1 += "<td align=right>"
			sStyle=styleAnchor
			if ((datePointer==odateSelected1) && (monthSelected1==omonthSelected1)	&& (yearSelected1==oyearSelected1))
			{ sStyle+=styleLightBorder }

			sHint = ""
			
			for (k=0;k<HolidaysCounter;k++)
			{
				if ((parseInt(Holidays[k].d)==datePointer)&&(parseInt(Holidays[k].m)==(monthSelected1+1)))
				{
					if ((parseInt(Holidays[k].y)==0)||((parseInt(Holidays[k].y)==yearSelected1)&&(parseInt(Holidays[k].y)!=0)))
					{
						sStyle+="background-color:#EFEFEF;"
						sHint+=sHint==""?Holidays[k].desc:"\n"+Holidays[k].desc
					}
				}
			}

			var regexp= /\"/g
			sHint=sHint.replace(regexp,"&quot;")
			
			dateMessage1 = "onmousemove='window.status=\""+selectDateMessage1.replace("[date]",constructDate1(datePointer,monthSelected1,yearSelected1))+"\"' onmouseout='window.status=\"\"' "
             
			if ((datePointer==dateNow1)&&(monthSelected1==monthNow1) &&(yearSelected1==yearNow1))
			{ sHTML1 += "<b><a "+dateMessage1+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected1="+datePointer+";closeCalendar1();'><font color=#ff0000>&nbsp;" + datePointer + "</font>&nbsp;</a></b>"}
			else if	(dayPointer % 7 == (startAt1 * -1)+1)
			{ sHTML1 += "<a "+dateMessage1+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected1="+datePointer + ";closeCalendar1();'>&nbsp;<font color=#909090>" + datePointer + "</font>&nbsp;</a>" }
			else
			{ sHTML1 += "<a "+dateMessage1+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected1="+datePointer + ";closeCalendar1();'>&nbsp;" + datePointer + "&nbsp;</a>" }

			sHTML1 += ""
			if ((dayPointer+startAt1) % 7 == startAt1) { 
				sHTML1 += "</tr><tr>" 
				if ((showWeekNumber1==1)&&(datePointer<numDaysInMonth))
				{
					sHTML1 += "<td align=right>" + (WeekNbr1(new Date(yearSelected1,monthSelected1,datePointer+1))) + "&nbsp;</td>"
				}
			}
		}

		document.getElementById("content1").innerHTML   = sHTML1
//		document.getElementById("spanMonth1").innerHTML = "&nbsp;" +	monthName[monthSelected1] + "&nbsp;<IMG id='changeMonth' SRC='"+imgDir+"drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>"
//		document.getElementById("spanYear1").innerHTML =	"&nbsp;" + yearSelected1	+ "&nbsp;<IMG id='changeYear' SRC='"+imgDir+"drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>"
		document.getElementById("spanMonth1").innerHTML = "&nbsp;" +	monthName[monthSelected1] + "&nbsp;v"
		document.getElementById("spanYear1").innerHTML =	"&nbsp;" + yearSelected1	+ "&nbsp;v"

	}

  function popUpCalendar1(ctl,ctl2, format) {
  		
  	 // 	flag = 1;	
		var	leftpos=0
		var	toppos=0
			
	if (bPageLoaded1)
		{
			
			//if ( crossobj1.visibility != "hidden" ) {
				if (1) {
				
				ctlToPlaceValue1	= ctl2
				dateFormat1=format;
                formatChar = " "
				aFormat	= dateFormat1.split(formatChar)
				
				if (aFormat.length<3)
				{  
					formatChar = "/"
					aFormat	= dateFormat1.split(formatChar)
				  if (aFormat.length<3)
				  { 
						formatChar = "."
						aFormat	= dateFormat1.split(formatChar)
						if (aFormat.length<3)
						{
							formatChar = "-"
							aFormat	= dateFormat1.split(formatChar)
							if (aFormat.length<3)
							{
								// invalid date	format
								formatChar=""
							}
						}
					}
				}

				tokensChanged =	0
				
				if ( formatChar	!= "" )
				{
					// use user's date
					aData =	ctl2.value.split(formatChar)

					for	(i=0;i<3;i++)
					{
						if ((aFormat[i]=="d") || (aFormat[i]=="dd"))
						{
							dateSelected1 = parseInt(aData[i], 10)
							tokensChanged ++
						}
						else if	((aFormat[i]=="m") || (aFormat[i]=="mm"))
						{
							monthSelected1 =	parseInt(aData[i], 10) - 1
							tokensChanged ++
						}
						else if	(aFormat[i]=="yyyy")
						{
							yearSelected1 = parseInt(aData[i], 10)
							tokensChanged ++
						}
						else if	(aFormat[i]=="mmm")
						{
							for	(j=0; j<12;	j++)
							{
								if (aData[i]==monthName[j])
								{
									monthSelected1=j
									tokensChanged ++
								}
							}
						}
					}
				}
				
				if ((tokensChanged!=3)||isNaN(dateSelected1)||isNaN(monthSelected1)||isNaN(yearSelected1))
				{
					dateSelected1 = dateNow1
					monthSelected1 =	monthNow1
					yearSelected1 = yearNow1
				}

				odateSelected1=dateSelected1
				omonthSelected1=monthSelected1
				oyearSelected1=yearSelected1

				aTag = ctl
				do {
					aTag = aTag.offsetParent;
					leftpos	+= aTag.offsetLeft;
					toppos += aTag.offsetTop;
				} while(aTag.tagName!="BODY");

				crossobj1.left =	fixedX1==-1 ? ctl.offsetLeft	+ leftpos :	fixedX1
				crossobj1.top = fixedY1==-1 ?	ctl.offsetTop +	toppos + ctl.offsetHeight +	2 :	fixedY1
				constructCalendar1 (1, monthSelected1, yearSelected1);
				crossobj1.visibility=(dom1||ie)?  "visible" :  "show"
				//crossobj1.visibility=(dom1||ie)?  "show" :  "show"

				hideElement1( 'SELECT', document.getElementById("calendar1") );
				hideElement1( 'APPLET', document.getElementById("calendar1") );			

				bshow1 = true;
			}
			 
			else
			{  
				hideCalendar1()
				if (ctlNow1!=ctl) { popUpCalendar1(ctl, ctl2, format) }
			}
			ctlNow1 = ctl
		}
	
		
	}
	
	


	
	document.onkeypress = function hidecal11() { 
		
		if (event.keyCode==27) 
		{
			hideCalendar1()
		}
	}
	document.onclick = function hidecal22() { 		
		if (!bshow1)
		{
			hideCalendar1()
		}	
		bshow1 = false
	}

	if(ie)
	{
		init1()
	}
	else
	{
		window.onload=init1
	} 


	
	

