<!--
	// See KB article about changing this dynamic HTML
	dynamicanimAttr = "dynamicanimation"
	animCancel = "skipanim"
	fpanimationPrefix = "fpAnim"
	animateElements = new Array()
	currentElement = 0
	speed = 1
	stepsZoom = 8
	stepsWord = 8
	stepsFly = 17
	stepsSpiral = 16
	stepsSpiralWord = 19
	stepsElastic = 32
	steps = stepsZoom
	step = 0
	cornerPhase=0
	outEffect=0
	function remSuffix(str)
	{
		ind=str.indexOf("FP")
		str = str.substring(0,ind)
		return str
	}
	function dynAnimOut(el)
	{
		outEffect=1
		dynAnimation(el)
		outEffect=0
	}
	function dynAnimation(obj)
	{		
		animateElements = new Array()
		var ms = navigator.appVersion.indexOf("MSIE")
		var macness = navigator.appVersion.indexOf("Macintosh")

		ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4)
		ns6 = false
		if(!ie4)
		{
			if((navigator.appName == "Netscape") &&
				(parseInt(navigator.appVersion.substring(0, 1)) >= 5))
			{
				ns6=true
				doc_els=document.getElementsByTagName('*')
			}
			else if((navigator.appName == "Netscape") &&
				(parseInt(navigator.appVersion.substring(0, 1)) == 4))
			{
				doc_els=document.layers
			}
			else
				return
		}
		else
			doc_els=document.all
        if(outEffect && !ie4)
            return
		if(ie4)
		{
		    for (index=document.all.length-1; index >= document.body.sourceIndex; index--)
			{
				el = document.all[index]
				if(outEffect && el != obj)
					continue
				if(outEffect)
					animationId = el.id.substring(9,el.id.length)
				else
					animationId = el.id.substring(6,el.id.length)
				animation=remSuffix(animationId)
				if(null != animation)
				{
					altcnt=0
					if(	animation == "dropWord"				||
						animation == "flyTopRightWord"			||
						animation == "flyBottomRightWord"		||
						animation == "waveWords"			||
						animation == "hopWords")
					{
						ih = el.innerHTML
						outString = ""
						i1 = 0
						iend = ih.length
						while(true)
						{
							i2 = startWord(ih, i1)
							if(i2 == -1)
							i2 = iend
							outWord(ih, i1, i2, false, "", outEffect ? obj.id : el.id)
							if(i2 == iend)
								break
							i1 = i2
							i2 = endWord(ih, i1)
							if(i2 == -1)
								i2 = iend
							if (animation == "waveWords")
								outWordAlt(ih, i1, i2, true, animation, altcnt)
							else
								outWord(ih, i1, i2, true, (outEffect ? "Out" : "") + animation,
									outEffect ?  obj.id : el.id)

							if(i2 == iend)
								break
							i1 = i2
							altcnt++
						}
						document.all[index].innerHTML = outString
						document.all[index].style.posLeft = 0
						document.all[index].setAttribute(animCancel, true)
						document.all[index].style.visibility="visible"
					}
				}
			}
		}
		i = 0
		for (index=0; index < doc_els.length; index++)
		{
			el = doc_els[index]
			if(0 != el.id.indexOf(fpanimationPrefix))
				continue
			if (ie4)
			{
				elprops=el.style
				scrollOffsetTop=document.body.scrollTop
				docHeight=document.body.offsetHeight
				docWidth=document.body.offsetWidth
				elW=100
				elH=el.offsetHeight
			}
			else
			{
				scrollOffsetTop=window.pageYOffset
				docHeight=window.innerHeight
				docWidth=window.innerWidth
				if (ns6)
				{
					elprops=el.style
					elW=100
					elH=el.offsetHeight
				}
				else{
					elprops=el
					elW=el.clip.width
					elH=el.clip.height
				}
			}
			if(outEffect)
				animationId = el.id.substring(9,el.id.length)
			else
				animationId = el.id.substring(6,el.id.length)
			animation=remSuffix(animationId)
			if(outEffect && (obj != el))
			{
				if(el.SRCID != obj.id)
					continue
			}
			if (null != animation )
			{
				if(ie4 && null!=el.getAttribute(animCancel, false))
					continue
				if(!ie4)
				{
					elprops.posLeft=elprops.left
					elprops.posTop=elprops.top
				}
				el.startL=offsetLeft(el)
				if(animation == "flyLeft")
				{
					elprops.posLeft = -offsetLeft(el)-elW
					elprops.posTop = 0
				}
				else if(animation == "flyRight" || animation=="elasticRight")
				{
					elprops.posLeft = -offsetLeft(el)+docWidth
					elprops.posTop = 0
				}
				else if(animation == "flyTop" || animation == "dropWord")
				{
					elprops.posLeft = 0
					elprops.posTop = scrollOffsetTop-offsetTop(el)-elH
				}
				else if(animation == "flyBottom" || animation == "elasticBottom")
				{
					elprops.posLeft = 0
					elprops.posTop = scrollOffsetTop-offsetTop(el)+docHeight 
				}
				else if(animation == "flyTopLeft")
				{
					elprops.posLeft = -offsetLeft(el)-elW
					elprops.posTop = scrollOffsetTop-offsetTop(el)-elH
				}
				else if(animation == "flyTopRight" || animation == "flyTopRightWord")
				{
					elprops.posLeft = -offsetLeft(el)+docWidth
					elprops.posTop = scrollOffsetTop-offsetTop(el)-elH
				}
				else if(animation == "flyCorner")
				{
					elprops.posLeft = docWidth*0.2-offsetLeft(el)
					
					elprops.posTop = scrollOffsetTop-offsetTop(el)+docHeight 
				}
				else if(animation == "flyBottomLeft")
				{
					elprops.posLeft = -offsetLeft(el)-elW
					elprops.posTop = scrollOffsetTop-offsetTop(el)+docHeight
				}
				else if(animation == "flyBottomRight" || animation == "flyBottomRightWord")
				{
					elprops.posLeft = -offsetLeft(el)+docWidth
					elprops.posTop = scrollOffsetTop-offsetTop(el)+docHeight
				}
				else if(animation == "spiral")
				{
					elprops.posLeft = -offsetLeft(el)+docWidth
					elprops.posTop = scrollOffsetTop-offsetTop(el)+docHeight
				}
				else if((animation.indexOf("waveWords") != -1) || animation=="hopWords")
				{
					if(i)
					{
						prevEl=animateElements[i-1]
						elprops.r = offsetLeft(el)-prevEl.startL
					}
					else
						elprops.r = offsetLeft(el)
				}
				else if(animation == "wipeLR" || animation == "wipeMID")
				{
					if (ie4 && elprops.position=="absolute")
					{
						el.sizeW=el.offsetWidth

						if(macness < 0)
							elprops.clip="rect(0 0 0 0)"
					}
					else if (!ie4)
					{
						if (ns6)
						{
							elprops.clip="rect(0 0 0 0)"
						}
						else{
							el.sizeW=el.clip.width
							el.clip.width=0
						}
					}
				}
				else if(animation == "wipeTB")
				{
					if (ie4 && elprops.position=="absolute")
					{
						elprops.clip="rect(0 0 0 0)"
					}
					else if(!ie4)
					{
						if (ns6)
						{
							elprops.clip="rect(0 0 0 0)"
						}
						else{
							el.sizeH=el.clip.height
							el.clip.height=0
						}
					}
				}
				else if(animation == "zoomIn")
				{
					elprops.posLeft = 0
					elprops.posTop = 0
				}
				else if(animation == "zoomOut")
				{
					elprops.posLeft = 0
					elprops.posTop = 0
				}
				else
				{
					continue
				}
				if(!outEffect)
				{
					el.initLeft = elprops.posLeft
					el.initTop  = elprops.posTop
					el.endLeft  = 0
					el.endTop   = 0
					elprops.visibility = "hidden"
				}
				else
				{
					el.initLeft = 0
					el.initTop  = 0
					el.endLeft = elprops.posLeft
					el.endTop  = elprops.posTop
					elprops.posTop = 0
					elprops.posLeft = 0
				}
				if(!ie4)
				{
					elprops.left=elprops.initLeft
					elprops.top =elprops.initTop
				}
				animateElements[i++] = el
			}
		}
		if(animateElements.length > 0)
		{
			if(outEffect)
				window.setTimeout("animate(1);", speed, "Javascript")
			else
				window.setTimeout("animate(0);", speed, "Javascript")
		}
	}
	function offsetLeft(el)
	{
		if(ie4 || ns6)
		{
			x = el.offsetLeft
			for (e = el.offsetParent; e; e = e.offsetParent)
				x += e.offsetLeft
			return x
		}
		else
		{
			x = el.pageX
			return x
		}
	} 
	function offsetTop(el)
	{
		if(ie4 || ns6)
		{
			y = el.offsetTop
			for (e = el.offsetParent; e; e = e.offsetParent)
				y += e.offsetTop;
			return y
		}
		else
		{
			y = el.pageY
			return y	
		}
	}
	function startWord(ih, i)
	{
		for(tag = false; i < ih.length; i++)
		{
			c = ih.charAt(i)
			if(c == '<')
			{
				if(ih.substring(i+1, i+4) == "IMG")
				return i;
				tag = true
			}
			if(!tag)
				return i
			if(c == '>')
				tag = false
		}
		return -1
	}
	function endWord(ih, i)
	{
		nonSpace = false
		space = false
		img = false
		if(ih.charAt(i) == '<')
		{
			img = true
			i++;
		}
		while(i < ih.length)
		{
			c = ih.charAt(i)
			if(c != ' ')
				nonSpace = true
			if(img && c == '>')
				img = false;
			if(nonSpace && !img && c == ' ')
				space = true
			if(c == '<')
				return i
			if(space && c != ' ')
				return i
			i++
		}
		return -1
	}
	function outWord(ih, i1, i2, dyn, anim, srcID)
	{
		if(dyn)
			if(!outEffect)
				outString += "<SPAN ID=\"" +  fpanimationPrefix + anim + "FP\" style=\"position: relative; visibility: hidden;\">"
			else
				outString += "<SPAN SRCID=\"" + srcID + "\"ID=\"" +  fpanimationPrefix + anim + "FP\" style=\"position: relative;\">"
		outString += ih.substring(i1, i2)
		if(dyn)
			outString += "</SPAN>"
	}
	function outWordAlt(ih, i1, i2, dyn, anim, altcnt)
	{
		if(dyn)
		{
			if(altcnt%2)
				outString += "<SPAN ID=\"" +  fpanimationPrefix + anim + "LFP\" style=\"position: relative;  visibility: hidden;\">"
			else
				outString += "<SPAN ID=\"" +  fpanimationPrefix + anim + "RFP\" style=\"position: relative;  visibility: hidden;\">"
		}
			
		outString += ih.substring(i1, i2)
		if(dyn)
			outString += "</SPAN>"
	}
	function animate(animOut)
	{
		{
			el = animateElements[currentElement]

			if(animOut)
				animationId = el.id.substring(9,el.id.length);
			else
				animationId = el.id.substring(6,el.id.length);
			animation=remSuffix(animationId)
			if (ie4)
				elprops=el.style
			else{
				if (ns6)
					elprops=el.style
				else
					elprops=el
			}

			if(!step && !animOut)
				elprops.visibility="visible"
			step++
			if(animation == "spiral")
			{
				steps = stepsSpiral
				v = step/steps
				rf = 1.0 - v
				t = v * 2.0*Math.PI
				rx = Math.max(Math.abs(el.initLeft), 200)
				ry = Math.max(Math.abs(el.initTop),  200)
				elprops.posLeft = Math.ceil(-rf*Math.cos(t)*rx)
				elprops.posTop  = Math.ceil(-rf*Math.sin(t)*ry)
			}
			else if(animation == "waveWordsL" || animation=="hopWords" || animation == "waveWords")
			{
				steps = stepsSpiralWord
				v = step/steps
				rf = (1.0 - v)
				t = v * 1.0*Math.PI
				elprops.posLeft = Math.ceil(-rf*Math.cos(t)*elprops.r)
				elprops.posTop  = Math.ceil(-rf*Math.sin(t)*elprops.r)
			}
			else if(animation == "waveWordsR")
			{
				steps = stepsSpiralWord
				v = step/steps
				rf = (1.0 - v)
				t = v * 1.0*Math.PI
				elprops.posLeft = Math.ceil(-rf*Math.cos(t)*elprops.r)
				elprops.posTop  = Math.ceil( rf*Math.sin(t)*elprops.r)
			}
			else if(animation == "zoomIn")
			{
				steps = stepsZoom
				elprops.fontSize = Math.ceil(50+50*step/steps) + "%"
				elprops.posLeft = 0
			}
			else if(animation == "zoomOut")
			{
				steps = stepsZoom
				fontSz=Math.ceil(100+200*(steps-step)/steps) + "%"
				elprops.fontSize = fontSz
				elprops.posLeft = 0
			}
			else if(animation == "elasticRight")
			{
				steps = stepsElastic
				v = step/steps
				rf=Math.exp(-v*7)
				t = v * 1.5*Math.PI
				rx =Math.abs(el.initLeft)
				elprops.posLeft = rf*Math.cos(t)*rx
				elprops.posTop  = 0
			}
			else if(animation == "elasticBottom")
			{
				steps = stepsElastic
				v = step/steps
				rf=Math.exp(-v*7)
				t = v * 2.5*Math.PI
				ry =Math.abs(el.initTop)
				elprops.posLeft = 0
				elprops.posTop  = rf*Math.cos(t)*ry
			}
			else if(animation == "wipeLR")
			{
				steps = stepsElastic
				if(ie4 && elprops.position=="absolute")
					elprops.clip = "rect(0 "+ step/steps*100 +"% 100% 0)"
				else if (!ie4)
				{
					if (ns6)
					{
						postop = elprops.top
						posleft = elprops.left
						str="position:absolute;top:"+postop+";left:"+posleft+";clip:rect(0px " + step/steps*el.offsetWidth + "px "+el.offsetHeight+"px 0px)";
						el.setAttribute("style",str);
					}
					else
						elprops.clip.right=step/steps*el.sizeW
				}
			}
			else if(animation == "wipeTB")
			{
				steps = stepsElastic
				if(ie4 && elprops.position=="absolute")
					elprops.clip = "rect(0 100% "+step/steps*el.offsetHeight+"px 0)"
				else{
					if (ns6)
					{
						postop = elprops.top
						posleft = elprops.left
						str="position:absolute;top:"+postop+";left:"+posleft+";clip:rect(0px "+ el.offsetWidth + "px " +step/steps*el.offsetHeight+"px 0px)";
						el.setAttribute("style",str);
					}
					else{
						elprops.clip.bottom=step/steps*el.sizeH		
					}
				}
			}
			else if(animation == "wipeMID")
			{
				steps = stepsElastic
				if(ie4 && elprops.position=="absolute")
				{
					elprops.clip = "rect(0 "+el.sizeW/2*(1+step/steps)+"px 100% "+el.sizeW/2*(1-step/steps)+")"
				}
				else if(!ie4)
				{
					if (ns6)
					{
						postop = elprops.top
						posleft = elprops.left
						str="position:absolute;top:"+postop+";left:"+posleft+";clip:rect(0px "+ el.offsetWidth/2*(1+step/steps) + "px "+el.offsetHeight+"px "+el.offsetWidth/2*(1-step/steps)+"px)";
						el.setAttribute("style",str);	
					}
					else{
						elprops.clip.right=el.sizeW/2*(1+step/steps)
						elprops.clip.left=el.sizeW/2*(1-step/steps)
					}
				}
			}
			else if(animation == "flyCorner")
			{
				if(!cornerPhase)
				{
					steps = stepsElastic/2
					v = step/steps
					rf=Math.exp(-v*7)
					t = v * 2.5*Math.PI
					ry =Math.abs(el.initTop)
					elprops.posTop  = Math.ceil(rf*Math.cos(t)*ry)
				}
				else
				{
					steps = stepsFly
					dl = el.initLeft / steps
					elprops.posLeft = elprops.posLeft - dl
					elprops.posTop = 0
				}
			}
			else
			{
				steps = stepsFly
				if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord")
					steps = stepsWord
				dl = (el.endLeft - el.initLeft) / steps
				dt = (el.endTop  - el.initTop)  / steps
				elprops.posLeft = elprops.posLeft + dl
				elprops.posTop = elprops.posTop + dt
			}
			if (step >= steps) 
			{
				if(!(animation == "wipeLR"	||
					animation  == "wipeTB"	||
					animation  == "wipeMID"	||
					(animation == "flyCorner" && !cornerPhase)))
				{
					elprops.posLeft = el.endLeft
					elprops.posTop = el.endTop
				}
				if(animOut)
				{
					elprops.visibility="hidden"
				}

				step = 0
				if(animation=="flyCorner" && !cornerPhase)
					cornerPhase=1
				else
				{
					cornerPhase=0
					currentElement++
				}

			}
			if(!ie4)
			{
				elprops.left = elprops.posLeft
				elprops.top = elprops.posTop
			}
			if(currentElement < animateElements.length)
			{
				if(animOut)
					window.setTimeout("animate(1);", speed, "Javascript")
				else					
					window.setTimeout("animate(0);", speed, "Javascript")
			}
			else
				currentElement=0
		}
	}
	function rollIn(el)
	{
		var ms = navigator.appVersion.indexOf("MSIE")
		ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4)
		if(ie4)
		{
			el.initstyle=el.style.cssText;el.style.cssText=el.fprolloverstyle
		}
	}
	function rollOut(el)
	{
		var ms = navigator.appVersion.indexOf("MSIE")
		ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4)
		if(ie4)
		{
			el.style.cssText=el.initstyle
		}
	}
	function clickSwapStyle(el)
	{
		var ms = navigator.appVersion.indexOf("MSIE")
		ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4)
		if(ie4)
		{
			ts=el.style.cssText
			el.style.cssText=el.fprolloverstyle
			el.fprolloverstyle=ts
		}
	}
	function clickSwapImg(el)
	{
        if(document.all || document.layers)
        {
    		ts=el.src
    		el.src=el.lowsrc
    		el.lowsrc=ts
        }
	}
//-->




	var	fixedX = -1 // x position (-1 if to appear below control)
	var	fixedY = -1 // y position (-1 if to appear below control)
	var startAt = 1 // 0 - sunday ; 1 - monday
	var showWeekNumber = 1	// 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 scrollLeftMessage = "Click to scroll to previous month. Hold mouse button to scroll automatically."
	var scrollRightMessage = "Click to scroll to next month. Hold mouse button to scroll automatically."
	var selectMonthMessage = "Click to select a month."
	var selectYearMessage = "Click to select a year."
	var selectDateMessage = "Select [date] as date." // do not replace [date], it will be replaced by date.

	var	crossobj, crossMonthObj, crossYearObj, monthSelected, yearSelected, dateSelected, omonthSelected, oyearSelected, odateSelected, monthConstructed, yearConstructed, intervalID1, intervalID2, timeoutID1, timeoutID2, ctlToPlaceValue, ctlNow, dateFormat, nStartingYear

	var	bPageLoaded=false
	var	ie=document.all
	var	dom=document.getElementById

	var	ns4=document.layers
	var	today =	new	Date()
	var	dateNow	 = today.getDate()
	var	monthNow = today.getMonth()
	var	yearNow	 = today.getYear()
	var	imgsrc = new Array(".\\images\\drop1.gif",".\\images\\drop2.gif",".\\images\\left1.gif",".\\images\\left2.gif",".\\images\\right1.gif",".\\images\\right2.gif")
	var	img	= new Array()

	function HolidayRec (d, m, y, desc)
	{
		this.d = d
		this.m = m
		this.y = y
		this.desc = desc
	}

	var HolidaysCounter = 0
	var Holidays = new Array()

	function addHoliday (d, m, y, desc)
	{
		Holidays[HolidaysCounter++] = new HolidayRec ( d, m, y, desc )
	}


	if (dom)
	{
		for	(i=0;i<imgsrc.length;i++)
		{
			img[i] = new Image
			img[i].src=imgDir+imgsrc[i]
		}
		document.write ("<div id='calendar'	style='position:absolute;visibility:hidden;'><table	width="+((showWeekNumber==1)?250:220)+" style='font-family:arial;font-size:11px;border-width:1;border-style:solid;border-color:#a0a0a0;font-family:arial; font-size:11px}' bgcolor='#ffffff'><tr bgcolor='#0000aa'><td><table width='"+((showWeekNumber==1)?248:218)+"'><tr><td style='padding:2px;font-family:arial; font-size:11px;'><font color='#ffffff'><B><span id='caption'></span></B></font></td><td align=right><a href='javascript:clearCalendar()'><IMG SRC='"+imgDir+"clear.gif' WIDTH='15' HEIGHT='13' BORDER='0' ALT='Clear the Calendar'></a></td><td align=right><a href='javascript: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><span id='lblToday'></span></td></tr>")
		}
			
		document.write ("</table></div><div id='selectMonth' style='position:absolute;visibility:hidden;'></div><div id='selectYear'	style='position:absolute;visibility:hidden;'></div>");
	}

	//var	monthName =	new	Array("January","February","March","April","May","June","July","August","September","October","November","December")
	var	monthName =	new	Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
	if (startAt==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:#a0a0a0;"

	function swapImage(srcImg, destImg){
		if (ie)	{ document.getElementById(srcImg).setAttribute("src",imgDir + destImg) }
	}

	function init()	{
		
		if (!ns4)
		{
			if (!ie) { yearNow += 1900	}
		
			crossobj=(dom)?document.getElementById("calendar").style : ie? document.all.calendar : document.calendar
			hideCalendar()

			crossMonthObj=(dom)?document.getElementById("selectMonth").style : ie? document.all.selectMonth	: document.selectMonth

			crossYearObj=(dom)?document.getElementById("selectYear").style : ie? document.all.selectYear : document.selectYear

			monthConstructed=false;
			yearConstructed=false;

			if (showToday==1)
			{
				document.getElementById("lblToday").innerHTML =	todayString + " <a onmousemove='window.status=\""+gotoString+"\"' onmouseout='window.status=\"\"' title='"+gotoString+"' style='"+styleAnchor+"' href='javascript:monthSelected=monthNow;yearSelected=yearNow;constructCalendar();'>"+dayName[(today.getDay()-startAt==-1)?6:(today.getDay()-startAt)]+", " + dateNow + " " + monthName[monthNow].substring(0,3)	+ "	" +	yearNow	+ "</a>"
			}

			sHTML1="<span id='spanLeft'	style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\"changeLeft\",\"left2.gif\");this.style.borderColor=\"#88AAFF\";window.status=\""+scrollLeftMessage+"\"' onclick='javascript:decMonth()' onmouseout='clearInterval(intervalID1);swapImage(\"changeLeft\",\"left1.gif\");this.style.borderColor=\"#3366FF\";window.status=\"\"' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"StartDecMonth()\",500)'	onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'>&nbsp<IMG id='changeLeft' SRC='"+imgDir+"left1.gif' width=10 height=11 BORDER=0>&nbsp</span>&nbsp;"
			sHTML1+="<span id='spanRight' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer'	onmouseover='swapImage(\"changeRight\",\"right2.gif\");this.style.borderColor=\"#88AAFF\";window.status=\""+scrollRightMessage+"\"' onmouseout='clearInterval(intervalID1);swapImage(\"changeRight\",\"right1.gif\");this.style.borderColor=\"#3366FF\";window.status=\"\"' onclick='incMonth()' onmousedown='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"StartIncMonth()\",500)'	onmouseup='clearTimeout(timeoutID1);clearInterval(intervalID1)'>&nbsp<IMG id='changeRight' SRC='"+imgDir+"right1.gif'	width=10 height=11 BORDER=0>&nbsp</span>&nbsp"
			sHTML1+="<span id='spanMonth' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer'	onmouseover='swapImage(\"changeMonth\",\"drop2.gif\");this.style.borderColor=\"#88AAFF\";window.status=\""+selectMonthMessage+"\"' onmouseout='swapImage(\"changeMonth\",\"drop1.gif\");this.style.borderColor=\"#3366FF\";window.status=\"\"' onclick='popUpMonth()'></span>&nbsp;"
			sHTML1+="<span id='spanYear' style='border-style:solid;border-width:1;border-color:#3366FF;cursor:pointer' onmouseover='swapImage(\"changeYear\",\"drop2.gif\");this.style.borderColor=\"#88AAFF\";window.status=\""+selectYearMessage+"\"'	onmouseout='swapImage(\"changeYear\",\"drop1.gif\");this.style.borderColor=\"#3366FF\";window.status=\"\"'	onclick='popUpYear()'></span>&nbsp;"
			
			document.getElementById("caption").innerHTML  =	sHTML1

			bPageLoaded=true
		}
	}

	function hideCalendar()	{
		crossobj.visibility="hidden"
		if (crossMonthObj != null){crossMonthObj.visibility="hidden"}
		if (crossYearObj !=	null){crossYearObj.visibility="hidden"}
	}

	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>",monthName[m])
		return sTmp.replace ("yyyy",y)
	}

	function closeCalendar() {
		var	sTmp

		hideCalendar();
		
		ctlToPlaceValue.value =	constructDate(dateSelected,monthSelected,yearSelected)
	}

	function clearCalendar() {
		var	sTmp

		hideCalendar();
		ctlToPlaceValue.value =	"";
	}	

	/*** Month Pulldown	***/

	function StartDecMonth()
	{
		intervalID1=setInterval("decMonth()",80)
	}

	function StartIncMonth()
	{
		intervalID1=setInterval("incMonth()",80)
	}

	function incMonth () {
		monthSelected++
		if (monthSelected>11) {
			monthSelected=0
			yearSelected++
		}
		constructCalendar()
	}

	function decMonth () {
		monthSelected--
		if (monthSelected<0) {
			monthSelected=11
			yearSelected--
		}
		constructCalendar()
	}

	function constructMonth() {
		popDownYear()
		if (!monthConstructed) {
			sHTML =	""
			for	(i=0; i<12;	i++) {
				sName =	monthName[i];
				if (i==monthSelected){
					sName =	"<B>" +	sName +	"</B>"
				}
				sHTML += "<tr><td id='m" + i + "' onmouseover='this.style.backgroundColor=\"#FFCC99\"' onmouseout='this.style.backgroundColor=\"\"' style='cursor:pointer' onclick='monthConstructed=false;monthSelected=" + i + ";constructCalendar();popDownMonth();event.cancelBubble=true'>&nbsp;" + sName + "&nbsp;</td></tr>"
			}

			document.getElementById("selectMonth").innerHTML = "<table width=70	style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;' bgcolor='#FFFFDD' cellspacing=0 onmouseover='clearTimeout(timeoutID1)'	onmouseout='clearTimeout(timeoutID1);timeoutID1=setTimeout(\"popDownMonth()\",100);event.cancelBubble=true'>" +	sHTML +	"</table>"

			monthConstructed=true
		}
	}

	function popUpMonth() {
		constructMonth()
		crossMonthObj.visibility = (dom||ie)? "visible"	: "show"
		crossMonthObj.left = parseInt(crossobj.left) + 50
		crossMonthObj.top =	parseInt(crossobj.top) + 26
	}

	function popDownMonth()	{
		crossMonthObj.visibility= "hidden"
	}

	/*** Year Pulldown ***/

	function incYear() {
		for	(i=0; i<7; i++){
			newYear	= (i+nStartingYear)+1
			if (newYear==yearSelected)
			{ txtYear =	"&nbsp;<B>"	+ newYear +	"</B>&nbsp;" }
			else
			{ txtYear =	"&nbsp;" + newYear + "&nbsp;" }
			document.getElementById("y"+i).innerHTML = txtYear
		}
		nStartingYear ++;
	}

	function decYear() {
		for	(i=0; i<7; i++){
			newYear	= (i+nStartingYear)-1
			if (newYear==yearSelected)
			{ txtYear =	"&nbsp;<B>"	+ newYear +	"</B>&nbsp;" }
			else
			{ txtYear =	"&nbsp;" + newYear + "&nbsp;" }
			document.getElementById("y"+i).innerHTML = txtYear
		}
		nStartingYear --;
	}

	function selectYear(nYear) {
		yearSelected=parseInt(nYear+nStartingYear);
		yearConstructed=false;
		constructCalendar();
		popDownYear();
	}

	function constructYear() {
		popDownMonth()
		sHTML =	""
		if (!yearConstructed) {

			sHTML =	"<tr><td align='center'	onmouseover='this.style.backgroundColor=\"#FFCC99\"' onmouseout='clearInterval(intervalID1);this.style.backgroundColor=\"\"' style='cursor:pointer'	onmousedown='clearInterval(intervalID1);intervalID1=setInterval(\"decYear()\",30)' onmouseup='clearInterval(intervalID1)'>-</td></tr>"

			j =	0
			nStartingYear =	yearSelected-3
			for	(i=(yearSelected-3); i<=(yearSelected+3); i++) {
				sName =	i;
				if (i==yearSelected){
					sName =	"<B>" +	sName +	"</B>"
				}

				sHTML += "<tr><td id='y" + j + "' onmouseover='this.style.backgroundColor=\"#FFCC99\"' onmouseout='this.style.backgroundColor=\"\"' style='cursor:pointer' onclick='selectYear("+j+");event.cancelBubble=true'>&nbsp;" + sName + "&nbsp;</td></tr>"
				j ++;
			}

			sHTML += "<tr><td align='center' onmouseover='this.style.backgroundColor=\"#FFCC99\"' onmouseout='clearInterval(intervalID2);this.style.backgroundColor=\"\"' style='cursor:pointer' onmousedown='clearInterval(intervalID2);intervalID2=setInterval(\"incYear()\",30)'	onmouseup='clearInterval(intervalID2)'>+</td></tr>"

			document.getElementById("selectYear").innerHTML	= "<table width=44 style='font-family:arial; font-size:11px; border-width:1; border-style:solid; border-color:#a0a0a0;'	bgcolor='#FFFFDD' onmouseover='clearTimeout(timeoutID2)' onmouseout='clearTimeout(timeoutID2);timeoutID2=setTimeout(\"popDownYear()\",100)' cellspacing=0>"	+ sHTML	+ "</table>"

			yearConstructed	= true
		}
	}

	function popDownYear() {
		clearInterval(intervalID1)
		clearTimeout(timeoutID1)
		clearInterval(intervalID2)
		clearTimeout(timeoutID2)
		crossYearObj.visibility= "hidden"
	}

	function popUpYear() {
		var	leftOffset

		constructYear()
		crossYearObj.visibility	= (dom||ie)? "visible" : "show"
		leftOffset = parseInt(crossobj.left) + document.getElementById("spanYear").offsetLeft
		if (ie)
		{
			leftOffset += 6
		}
		crossYearObj.left =	leftOffset
		crossYearObj.top = parseInt(crossobj.top) +	26
	}

	/*** calendar ***/

	function WeekNbr(n) {
		var P3D=259200000, P7D=604800000, y=n.getYear(), y=(y<1000?1900+y:y);
		var s=Math.floor((Date.UTC(y,n.getMonth(),n.getDate())+P3D)/P7D);
		tmp=new Date(s*P7D); j=tmp.getYear(); j=(j<1000?1900+j:j);
		return 1+s-Math.floor((Date.UTC(j,0,4)+P3D)/P7D)
	}


	function constructCalendar () {
		var aNumDays = Array (31,0,31,30,31,30,31,31,30,31,30,31)

		var dateMessage
		var	startDate =	new	Date (yearSelected,monthSelected,1)
		var endDate

		if (monthSelected==1)
		{
			endDate	= new Date (yearSelected,monthSelected+1,1);
			endDate	= new Date (endDate	- (24*60*60*1000));
			numDaysInMonth = endDate.getDate()
		}
		else
		{
			numDaysInMonth = aNumDays[monthSelected];
		}

		datePointer	= 0
		dayPointer = startDate.getDay() - 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='#d0d0d0' 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(startDate) + "&nbsp;</td>"
		}

		for	( var i=1; i<=dayPointer;i++ )
		{
			sHTML += "<td>&nbsp;</td>"
		}
	
		for	( datePointer=1; datePointer<=numDaysInMonth; datePointer++ )
		{
			dayPointer++;
			sHTML += "<td align=right>"
			sStyle=styleAnchor
			if ((datePointer==odateSelected) &&	(monthSelected==omonthSelected)	&& (yearSelected==oyearSelected))
			{ sStyle+=styleLightBorder }

			sHint = ""
			for (k=0;k<HolidaysCounter;k++)
			{
				if ((parseInt(Holidays[k].d)==datePointer)&&(parseInt(Holidays[k].m)==(monthSelected+1)))
				{
					if ((parseInt(Holidays[k].y)==0)||((parseInt(Holidays[k].y)==yearSelected)&&(parseInt(Holidays[k].y)!=0)))
					{
						sStyle+="background-color:#FFDDDD;"
						sHint+=sHint==""?Holidays[k].desc:"\n"+Holidays[k].desc
					}
				}
			}

			var regexp= /\"/g
			sHint=sHint.replace(regexp,"&quot;")

			dateMessage = "onmousemove='window.status=\""+selectDateMessage.replace("[date]",constructDate(datePointer,monthSelected,yearSelected))+"\"' onmouseout='window.status=\"\"' "

			if ((datePointer==dateNow)&&(monthSelected==monthNow)&&(yearSelected==yearNow))
			{ sHTML += "<b><a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer+";closeCalendar();'><font color=#ff0000>&nbsp;" + datePointer + "</font>&nbsp;</a></b>"}
			else if	(dayPointer % 7 == (startAt * -1)+1)
			{ sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer + ";closeCalendar();'>&nbsp;<font color=#909090>" + datePointer + "</font>&nbsp;</a>" }
			else
			{ sHTML += "<a "+dateMessage+" title=\"" + sHint + "\" style='"+sStyle+"' href='javascript:dateSelected="+datePointer + ";closeCalendar();'>&nbsp;" + datePointer + "&nbsp;</a>" }

			sHTML += ""
			if ((dayPointer+startAt) % 7 == startAt) { 
				sHTML += "</tr><tr>" 
				if ((showWeekNumber==1)&&(datePointer<numDaysInMonth))
				{
					sHTML += "<td align=right>" + (WeekNbr(new Date(yearSelected,monthSelected,datePointer+1))) + "&nbsp;</td>"
				}
			}
		}

		document.getElementById("content").innerHTML   = sHTML
		document.getElementById("spanMonth").innerHTML = "&nbsp;" +	monthName[monthSelected] + "&nbsp;<IMG id='changeMonth' SRC='"+imgDir+"drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>"
		document.getElementById("spanYear").innerHTML =	"&nbsp;" + yearSelected	+ "&nbsp;<IMG id='changeYear' SRC='"+imgDir+"drop1.gif' WIDTH='12' HEIGHT='10' BORDER=0>"
	}

	function popUpCalendar(ctl,	ctl2, format) {
		
		var	leftpos=0
		var	toppos=0
		if (bPageLoaded)
		{
			
			if ( crossobj.visibility ==	"hidden" ) {
				ctlToPlaceValue	= ctl2
				dateFormat=format;

				formatChar = " "
				aFormat	= dateFormat.split(formatChar)
				if (aFormat.length<3)
				{
					formatChar = "/"
					aFormat	= dateFormat.split(formatChar)
					if (aFormat.length<3)
					{
						formatChar = "."
						aFormat	= dateFormat.split(formatChar)
						if (aFormat.length<3)
						{
							formatChar = "-"
							aFormat	= dateFormat.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"))
						{
							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(dateSelected)||isNaN(monthSelected)||isNaN(yearSelected))
				{
					dateSelected = dateNow
					monthSelected =	monthNow
					yearSelected = yearNow
				}

				odateSelected=dateSelected
				omonthSelected=monthSelected
				oyearSelected=yearSelected

				aTag = ctl
				do {
					aTag = aTag.offsetParent;
					leftpos	+= aTag.offsetLeft;
					toppos += aTag.offsetTop;					
					//alert(aTag + ", " + leftpos + ", " + toppos);
				} while(aTag.tagName!="BODY");

				crossobj.left =	fixedX==-1 ? ctl.offsetLeft	+ leftpos :	fixedX
				//crossobj.left =	(ctl.offsetLeft	+ leftpos) + "px"
				//-163 added by me
				crossobj.top = fixedY==-1 ?	ctl.offsetTop +	toppos + ctl.offsetHeight +	2 :	fixedY
				//crossobj.top = ctl.offsetTop +	toppos + ctl.offsetHeight +	2 
				
				//alert((ctl.offsetLeft	+ leftpos) + "px");
				//alert(ctl.offsetTop +	toppos + ctl.offsetHeight +	2 );
				
				constructCalendar (1, monthSelected, yearSelected);
				
				crossobj.visibility=(dom||ie)? "visible" : "show"
			}
			else
			{
				hideCalendar()
				if (ctlNow!=ctl) {popUpCalendar(ctl, ctl2, format)}
			}
			ctlNow = ctl
		}
	}
	window.onload=init;//();


