//---------------------------------------------------------------------------
//
var maEvents = new Array();
var mobjXml;
var msKey = "k1!2db/84$j4ertw!nloezkt4ieoxgwt5nloh5locslt9xp3.lz9";

function Calendar (name) {
	var dteNow = new Date();
	this.r = "\r\n";
	this.q = "\"";
	this.name = name;
	this.initialMonth = dteNow.getMonth();
	this.initialYear = dteNow.getFullYear();
	this.slotCount = 3;
	this.xmlFile = "";
	this.cellWidth  = 91;
	this.cellHeight = 50;
	this.borderWidth = 1;
	this.beginMonday = false;
	this.displayDeadText = false;
	this.displayDeadNumber = false;
	this.displayMonthCombo = true;
	this.displayYearCombo = true;
	this.todayText = null;
	this.bottomHeading= false;
	this.dateBreak = true;
	this.trackSelectedDate= true;
	this.clrTable= "#fffffe";
	this.clrDead= "#c0c0c0";
	this.clrNow= "#ffffc0";
	this.clrPast= "#e0e0e0";
	this.clrFuture= "#ffffff";
	this.clrWeekend= null;
	this.clrBorder= "#666666";
	this.clrHdrBg   = "#666666";
	this.clrHdrText= "#ffffff";
	this.clrCellText= "#800000";
	var szFont = "Arial";
	this.hdrFace= szFont;
	this.hdrSize= "1";
	this.numFace= szFont;
	this.numSize= "1";
	this.cellFace= szFont;
	this.cellSize= "1";
	//mnOmed=6 + 4;
	this.monthStartDate = new Array(1,1,1,1,1,1,1,1,1,1,1,1);
	this.longDays = new Array( "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" );
	this.daysPerMonth = new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
	this.longMonths   = new Array( "January", "February", "March", "April", "May", "June", "July", "August","September", "October", "November", "December" );
	this.createDateSelect = dcCreateDateSelect;
	this.fillMonth = dcFillMonth;
	this.fillYear = dcFillYear;
	this.chkLeapYear = dcChkLeapYear;
	this.createCalendar = dcCreateCalendar;
	this.calendarHTML = dcCalendarHTML;
	this.chkColor = dcChkColor;
	this.getDay = dcGetDay;
	this.isWeekday = dcIsWeekday;
	this.readDate = dcReadDate;
	this.getFormElement = dcGetFormElement;
	this.chkForEvent = evChkForEvent;
	this.chkForEvent2 = evChkForEvent2;
	this.month = dcMonth;
	this.year = dcYear;
	};
	function dcCreateDateSelect() {
		var szHTML;
		var szTag;
		var szHide;
		var szOutput = "";
		var dteCurr = new Date();
		var cy = dteCurr.getFullYear();
		var m = this.readDate("m");
		var y = this.readDate("y");
		if (this.xmlFile.length!=0) 
		{
			mobjXml = new ActiveXObject("Microsoft.XMLDOM");
			mobjXml.async = false;
			mobjXml.load(this.xmlFile);
			
		};
		if (this.displayMonthCombo==false&& this.displayYearCombo==false) 
			return null;
		szHTML = "<form name='frmCal' id='frmCal' method='post' action=''>" + this.r;
		szOutput = szOutput + szHTML;
		szHTML = "<table"+ " align=center"+ " width='" + ((this.cellWidth) * 7) + "'"+ " border='1'"+ " bordercolor='" + this.clrBorder + "'"+ " bordercolordark='" + this.clrBorder + "'"+ " bordercolorlight='" + this.clrBorder + "'"+ " cellspacing=0"+ " >" + this.r;
		szOutput = szOutput + szHTML;
		szHTML = "<tr><td"+ " align=center"+ " bgcolor=" + this.clrHdrBg+ " >" + this.r + this.r;
		szOutput = szOutput + szHTML;
		szTemp = " cboYear.options[frmCal.cboYear.selectedIndex].value";
		if (this.displayYearCombo==false) 
			szTemp = y.toString();
		//szHTML="<input name='goButton' type="submit" value='next'>"
		var pparams="'dcupdate(cal,10,5)'";
		szHTML = "<select name='cboMonth' id='cboMonth'"+ " onchange='dcUpdate(" + this.name + ", " + this.r+ " cboMonth.options[frmCal.cboMonth.selectedIndex].value"+ "," + this.r+ szTemp+ ");'> " + this.r+ this.fillMonth(m)+ "</select>  " + this.r + this.r;
		if (this.displayMonthCombo==true) 
			szOutput = szOutput + szHTML;
		szTemp = " cboMonth.options[frmCal.cboMonth.selectedIndex].value";
		if (this.displayMonthCombo==false) 
			szTemp = m.toString();
		szHTML = "<select name='cboYear' id='cboYear'"+ " onchange='dcUpdate(" + this.name + ", " + this.r+ szTemp+ "," + this.r+ " cboYear.options[frmCal.cboYear.selectedIndex].value"+ ");'>" + this.r+ this.fillYear(y, cy)+ "</select>" + this.r + this.r;
		if (this.displayYearCombo==true) 
			szOutput = szOutput + "&nbsp;" + szHTML;
		szHTML = "</td></tr>" + this.r;
		szOutput = szOutput + szHTML;szOutput = szOutput + "</table></form>" + this.r + this.r;
		document.writeln(szOutput);
		return szOutput;
	};
	function dcCreateCalendar(m, y) 
	{
		var obj;
		var szHTML;
		var bRedraw = true;
		var szBrowName = dcBrowserName();
		var szBrowVer = dcBrowserVer();
		if (m==null && y==null) 
		{
			bRedraw = false;
			if (this.trackSelectedDate) 
			{
				m = this.readDate("m");
				y = this.readDate("y");
			} 
			else 
			{
				m = this.initialMonth;
				y = this.initialYear;
			};
		};
		var cboMonth = this.getFormElement("frmCal", "cboMonth");
		var cboYear = this.getFormElement("frmCal", "cboYear");
		if (cboMonth!=null) 
			cboMonth.selectedIndex = m;
		if (cboYear!=null) 
			cboYear.value = y;
		dcSaveDate(m, y);
		szHTML = this.calendarHTML( m, y );
		if ( szBrowName=="IE" ) 
		{
			if (bRedraw==true) 
			{
				obj = dcGetObj("MSIE");
				obj.innerHTML = szHTML;
			} 
			else 
			{
				document.writeln(szHTML);
			};
		} 
		else if ( szBrowName=="NS" ) 
		{
			if ( szBrowVer<"5" ) 
			{
				if (bRedraw==true) 
				{
					document.NSALIGN.document.NSLAYER.document.write(szHTML);
					document.NSALIGN.document.NSLAYER.document.close();
				} 
				else 
				{
					document.NSALIGN.document.NSLAYER.document.writeln(" ");
					document.NSALIGN.document.NSLAYER.document.writeln(szHTML);
					document.NSALIGN.document.NSLAYER.document.writeln(" ");
				};
			} 
			else 
			{
				if (bRedraw==true) 
				{
					obj = dcGetObj("MSIE");
					dcSetInnerHTML(obj, szHTML);
				} 
				else 
				{
					document.writeln(szHTML);
				};
			};
		};
	};
	function dcChkColor( nRow, nCol, dteCal, dteNow, m )
	{
		var currD = dteCal.getDate() ;
		var currM = this.month(dteCal);
		var currY = this.year(dteCal);
		var dteNowSansTime = new Date(dteNow.getFullYear(), dteNow.getMonth(), dteNow.getDate());
		if ( currD > nCol + (nRow * 7) + this.monthStartDate[m] || currM != m ) 
		{
			return this.clrDead;
		};
		if (this.clrWeekend!=null && this.isWeekday(dteCal)==false) 
			return this.clrWeekend;
		if (currY < this.year(dteNow) ) 
			return this.clrPast;
		if (currY > this.year(dteNow) ) 
			return this.clrFuture;
		if (currM < this.month(dteNow) ) 
			return this.clrPast;
		if (currM > this.month(dteNow) ) 
			return this.clrFuture;
		if (dteCal < dteNowSansTime) 
			return this.clrPast;
		if (dteCal > dteNowSansTime) 
			return this.clrFuture;
		return this.clrNow;
	};
	function dcCalendarHTML( m, y ) 
	{
		var chkM;
		var chkD;
		var chkY;
		var szBackcolor;
		var szEvText;
		var szEvForecolor;
		var szEvBackcolor;
		var szSaveColor;
		var nEvSlot;
		var nSlot;
		var szSlotClass;
		var szOutput;
		var szCell;
		var szNum;
		var szText;
		var szTag;
		var nRow;
		var nCol;
		var nDeadDay;
		var nWidth;
		var bGoodDate=false;
		var dteNow = new Date();
		var dteCal = new Date(y, m, 1);
		var dteMonth = new Date(y, m, 1);
		var dteDead;dteNow = new Date( dteNow.getFullYear(), dteNow.getMonth(), dteNow.getDate());
		var szQueryString;
		var szChar;
		var szURL;
		var szRight;
		var szLeft;
		var i;
		var szHTML = this.clrBorder + " " + this.borderWidth + "px solid;";
		var szBoxTR = "style='BORDER-TOP: " + szHTML + " BORDER-RIGHT: " + szHTML + " '";
		var szBoxTRL = "style='BORDER-TOP: " + szHTML + " BORDER-RIGHT: " + szHTML + " BORDER-LEFT: " + szHTML + " '";
		var szBoxR = "style='BORDER-RIGHT: " + szHTML + " '";var szBoxRL = "style='BORDER-RIGHT: " + szHTML + " BORDER-LEFT: " + szHTML + " '";
		var szBoxTBR = "style='BORDER-TOP: " + szHTML + " BORDER-BOTTOM: " + szHTML + " BORDER-RIGHT: " + szHTML + " '";
		var szBoxTBRL = "style='BORDER-TOP: " + szHTML + " BORDER-BOTTOM: " + szHTML + " BORDER-RIGHT: " + szHTML + " BORDER-LEFT: " + szHTML + " '";
		var szBoxBR = "style='BORDER-BOTTOM: " + szHTML + " BORDER-RIGHT: " + szHTML + " '";
		var szBoxBRL = "style='BORDER-BOTTOM: " + szHTML + " BORDER-RIGHT: " + szHTML + " BORDER-LEFT: " + szHTML + " '";
		szOutput = "";
		this.chkLeapYear(m, y);
		dteCal.setDate( dteCal.getDate() + this.monthStartDate[m] -1 );
		nDeadDay = 1 - this.getDay(dteCal);dteCal.setDate( dteCal.getDate() - this.getDay(dteCal) );
		if ( dteCal.getDate() == 2 ) 
			dteCal.setDate( dteCal.getDate() - 7 );
		nWidth = this.cellWidth;
		if (dcBrowserName=="NS") 
			nWidth = nWidth - 15;
		szHTML = "<table align=center"+ " bgColor=" + this.clrTable+ " border='0'"+ " bordercolor='" + this.clrBorder + "'"+ " bordercolordark='" + this.clrBorder + "'"+ " bordercolorlight='" + this.clrBorder + "'"+ " width='" + (this.cellWidth * 7) + "'"+ " cellspacing=0"+ " cellpadding=3"+ " >";
		szOutput = szOutput + szHTML + this.r + this.r;szOutput = szOutput + "<tr>" + this.r;
		for (nCol=0; nCol<7; nCol++) 
		{
			szHTML = "<td align=center"+ " width=" + nWidth+ " bgcolor=" + this.clrHdrBg+ " nowrap "+ " >"+ dcFontStr( this.hdrFace, this.hdrSize, this.clrHdrText )+ " <b><center>" + this.longDays[nCol]+ " </center></b></font></td>";
			szOutput = szOutput + szHTML + this.r;}szOutput = szOutput + "</tr>" + this.r + this.r;
			for (nRow=0; nRow<6; nRow++) 
			{
				for (nSlot=1; nSlot<=parseInt(this.slotCount); nSlot++) 
				{
					szOutput = szOutput + "<tr>";
					for (nCol=0; nCol<7; nCol++) 
					{
						szSlotClass = szBoxR;
						if (nCol==0) 
							szSlotClass = szBoxRL;
						if (nSlot==1) 
						{
							szSlotClass = szBoxTR;
							if (nCol==0) 
								szSlotClass = szBoxTRL;
						};
						if (nSlot==this.slotCount && nRow==5) 
						{
							if (this.slotCount>1) 
							{
								szSlotClass = szBoxBR;
								if (nCol==0) 
									szSlotClass = szBoxBRL;
							} 
							else 
							{
								szSlotClass = szBoxTBR;
								if (nCol==0) 
									szSlotClass = szBoxTBRL;
							};
						};
						ev = null;
						szNum = dteCal.getDate();
						szBackcolor = this.chkColor( nRow, nCol, dteCal, dteNow, m );
						ev = this.chkForEvent2(dteCal, nSlot);
						if (szBackcolor == this.clrDead) 
						{
							if (this.displayDeadText==false) 
							{
								if (this.displayDeadNumber==false) 
									szNum="&nbsp;";
									ev = this.chkForEvent(m, nDeadDay, parseInt(y), nSlot);
									if (m != this.month(dteCal) ) 
									{
										ev = this.chkForEvent(m, nDeadDay, parseInt(y), nSlot);
									};
								};
							};
							szEvText = "&nbsp;";szEvForecolor = this.clrCellText;szEvBackcolor = szBackcolor;nEvSlot = -1;
							var checkIt=new Date(dteCal);
							if (m==checkIt.getMonth()&&ev!=null)
							{
								{
									if (ev.text!="" && ev.text!=null) 
										szEvText= ev.text;
									if (ev.forecolor!="" && ev.forecolor!=null) 
										szEvForecolor = ev.forecolor;
									if (ev.backcolor!="" && ev.backcolor!=null) 
										szEvBackcolor = ev.backcolor;
									if (ev.slot!="" && ev.slot!=null) 
										nEvSlot = ev.slot;
								};
							};
							if (dteCal.getDate()==dteNow.getDate() && dteCal.getMonth()==dteNow.getMonth() && dteCal.getMonth()==m) 
							{
								if (szEvText=="&nbsp;" && nSlot==1) 
								{
									if (this.todayText!="" && this.todayText!=null) 
									{
										szEvText = this.todayText;
										if (ev!=null) 
											ev.popuplink=null;
									};
								};
							};
							if (ev!=null) 
							{
								if (ev.popuplink!=null && szEvText!="&nbsp;" && szEvText.length>0) 
								{
									szQueryString = (m+1) + "/" + dteCal.getDate() + "/" + y;szQueryString = URLEncode(szQueryString);szQueryString = "date=" + szQueryString;szURL = ev.popuplink;szChar = "&";
									if (szURL.indexOf("?")==-1) 
										szChar = "?";szQueryString = szChar + szQueryString;i = szURL.indexOf("#");
										if (i==-1) 
										{
											szURL = szURL + szQueryString;
										} 
										else 
										{
											szLeft = szURL.substr(0,i);szRight = szURL.substr(i, szURL.length - i);szURL = szLeft + szQueryString + szRight;
										};
										szEvText="<a href='javascript:dcPopUp(&#34;" + szURL + "&#34;)'>"+ szEvText + "</a>";
									};
								};
								szCell = "";
								if (nSlot==1) 
								{
									szCell = "&nbsp;"+ dcFontStr(this.numFace, this.numSize, szEvForecolor)+ "<strong>" + szNum + "</strong></font>" + this.r;
									if (this.dateBreak) 
										szCell = szCell + "<br/>";
								};
								szCell = szCell + dcFontStr(this.cellFace, this.cellSize, szEvForecolor)+ szEvText + "</font>" + this.r;
								szHTML = "<td " + szSlotClass+ " valign=top"+ " width=" + nWidth+ " height=" + this.cellHeight / parseInt(this.slotCount)+ " bgcolor=" + szEvBackcolor+ " nowrap"+ " >" + this.r;
								szTemp =  szHTML + szCell + "</td>" + this.r;
								szOutput = szOutput + szTemp;dteCal.setDate( dteCal.getDate() + 1 );nDeadDay++;				
							};
							szOutput = szOutput + "</tr>" + this.r + this.r;
							if (nSlot!=parseInt(this.slotCount)) 
							{
								dteCal.setDate( dteCal.getDate() - 7 );
								nDeadDay=nDeadDay-7;
							};
						};
					};
					if (this.bottomHeading) 
					{
						szOutput = szOutput + "<tr>" + this.r;
						for (nCol=0; nCol<7; nCol++) 
						{
							szHTML = "<td align=center"+ " width=" + nWidth+ " bgcolor=" + this.clrHdrBg+ " nowrap "+ " >"+ dcFontStr( this.hdrFace, this.hdrSize, this.clrHdrText )+ " <b><center>" + this.longDays[nCol]+ " </center></b></font></td>";
							szOutput = szOutput + szHTML + this.r;
						}
						szOutput = szOutput + "</tr>" + this.r + this.r;
					};
					szOutput = szOutput + "</table>";
					return szOutput;
				};
				
function dcUpdate(obj, m, y) 
{
	obj.createCalendar(m, y);
};
function dcChkLeapYear(m, y) 
{
	var x = 2;
	if (( m == x )&& ( y % 4 == 0 )&& ( y % 100 == 0)) 
	{
		if ( y % 400 == 0) 
			this.daysPerMonth[x] = 29;
	}
	else 
	{
			this.daysPerMonth[x] = 29;
	};
};
function dcFillMonth( m ) 
{
	var szSelected;
	var szHTML = "";
	for ( i=0; i<=11; i++ ) 
	{
		szSelected = "";
		if ( i==m ) 
			szSelected = "selected";
		szHTML = szHTML + "<option value='" + i + "' " + szSelected + " >" + this.longMonths[i] + "</option>" + this.r;
	};
	return szHTML;
};
function dcFillYear( y, cy ) 
{
	var szSelected;var szHTML = "";
	for ( i=cy-1; i<=cy+5; i++ ) 
	{
		szSelected = "";
		if ( i==y ) 
			szSelected = "selected";szHTML = szHTML + "<option value='" + i + "' " + szSelected + " >" + i + "</option>" + this.r;
	};
	return szHTML;
};
function dcFontStr ( szFace, szSize, szColor ) 
{
	return szHTML = "<font"+ " face='"  + szFace  + "'"+ " size='"  + szSize  + "'"+ " color='" + szColor + "'"+ " >";
};
function Event (nMonth, nDay, nYear, szWeekday, szText, szPopuplink, szForecolor, szBackcolor, nSlot) 
{
	this.month = nMonth;
	this.day = nDay;
	this.year = nYear;
	this.weekday = szWeekday;
	this.text = szText;
	this.popuplink = szPopuplink;
	this.forecolor = szForecolor;
	this.backcolor = szBackcolor;
	this.slot = nSlot;
	this.weekdayNo = evWeekdayNo;
};
function evWeekdayNo () 
{
	var nNum = -1;
	var szWeekday;
	szWeekday = this.weekday;
	if (szWeekday==null) 
		return nNum;
	szWeekday = szWeekday.toLowerCase();
	if (szWeekday=="sunday") 
		nNum=0;
	if (szWeekday=="monday") 
		nNum=1;
	if (szWeekday=="tuesday") 
		nNum=2;
	if (szWeekday=="wednesday")
		nNum=3;
	if (szWeekday=="thursday") 
		nNum=4;
	if (szWeekday=="friday") 
		nNum=5;
	if (szWeekday=="saturday")
		nNum=6;
	return nNum;
};
function getWeekdayNo (szWeekday) 
{
	var nNum = -1;
	var szWeekday;
	if (szWeekday==null) 
		return nNum;
		szWeekday = szWeekday.toLowerCase();if (szWeekday=="sunday") nNum=0;if (szWeekday=="monday") nNum=1;if (szWeekday=="tuesday") nNum=2;if (szWeekday=="wednesday") nNum=3;if (szWeekday=="thursday") nNum=4;if (szWeekday=="friday") nNum=5;if (szWeekday=="saturday") nNum=6;
	return nNum;
};
function evChkForEvent2(dte, slot) 
{
	var d = dte.getDate();
	var m = this.month(dte);
	var y = this.year(dte);
	return this.chkForEvent(m,d,y,slot);
};
function evChkForEvent(m,d,y,slot) 
{
	var ev=null;
	var bln;
	var result;
	var nEvent;
	var ny;
	var nm;
	var nd;
	var nslot;
	var nweekday;
	var nforecolor;
	var nbackcolor;
	var ntext;
	if (this.xmlFile.length!=0) 
	{
		for (i=0; i < mobjXml.selectSingleNode("/events").childNodes.length; i++) 
		{
			nEvent = mobjXml.selectSingleNode("/events").childNodes[i];
			ny = getXmlValue(nEvent.selectSingleNode("year"), true);
			nm = getXmlValue(nEvent.selectSingleNode("month"), true);
			nd = getXmlValue(nEvent.selectSingleNode("day"), true);
			nslot = getXmlValue(nEvent.selectSingleNode("slot"), true);
			nweekday = getXmlValue(nEvent.selectSingleNode("weekday"), false);
			nforecolor = getXmlValue(nEvent.selectSingleNode("forecolor"), false);
			nbackcolor = getXmlValue(nEvent.selectSingleNode("backcolor"), false);
			ntext = getXmlValue(nEvent.selectSingleNode("text"), false);
			nlink = getXmlValue(nEvent.selectSingleNode("popuplink"), false);
			bln = matchDate(m,d,y,slot, nm, nd, ny, nslot, getWeekdayNo(nweekday) );
			if (bln==true) 
			{
				result = new Event(m,d,y,nweekday,ntext,nlink,nforecolor,nbackcolor,nslot);
				return result
			};
		};
	} 
	else 
	{
		for (i=0; i<maEvents.length; i++) 
		{
			ev = maEvents[i];
			bln = matchDate(m,d,y,slot, ev.month,ev.day,ev.year,ev.slot,ev.weekdayNo() );
			if (bln==true) 
			return ev;
		};
	};
};
function matchDate(m,d,y,slot, evm, evd, evy, evslot, evweekday) 
{
	var dte=null;
	if ( dcIsDate(m,d,y) ) 
		dte = new Date(y,m,d);
	var bln=false;
	if ( ( y == evy || evy == null )&& (parseInt(m)+1 == evm || evm == null )&& ( d == evd )&& ( slot == evslot || slot == null ) ) bln=true;/* debugging codeif (d==32) {alert( "year:" + y + "  event year:" + evy+ "\nmonth:" + (parseInt(m)+1) + "  event month:" + evm+ "\nday:" + d + "  event day:" + evd+ "\nslot:" + slot + "  event slot:" + evslot+ "\n" + bln);};*/
	if (bln==true)
		return true;
	if (dte!=null)
	{
		if (dte.getDay() == evweekday&& ( slot == evslot || slot == null ) )
			return true
	};
	return false;
};
function pmaEvent(m,d,y,szWeekday,szText,szPopuplink,szForecolor,szBackcolor,slot) 
{
	var ev;
	//if ( (parseInt(d)<=10 || d==null || decode(msKey)==document.location) ) 
	//{
	if (slot==null) 
		slot=1;
	ev = new Event(m,d,y,szWeekday,szText,szPopuplink,szForecolor,szBackcolor,slot);
	maEvents[maEvents.length] = ev;
	//};
};
function getXmlValue(node, blnNumeric) 
{
	var result;result = node.text;
	if (result.length==0) return null;
	if (blnNumeric==true) result = parseInt(result);
	return result;
};
function dcIsDate(m,d,y) 
{
	var dte = new Date(y,m,d);
	if ( (dte.getFullYear() == y)&& (dte.getMonth() == m)&& (dte.getDate() == d) ) return true;
	return false;
};
function dcGetDay (dte) 
{
	var d = dte.getDay();
	if (this.beginMonday) d--;
	if (d==-1) d=6;
	return d;
};
function dcIsWeekday (dte) 
{
	var m;
	var d;
	m = dte.getMonth();
	d = dte.getDay();
	if (d == 0 || d == 6) return false;
	return true;
};
function dcMonth (dte, obj) 
{
	var nEnd;
	var d = dte.getDate();
	var m = dte.getMonth();
	var y = dte.getFullYear();
	nStart = this.monthStartDate[m];
	if ( d<nStart ) 
	{
		if ( m==0 ) return 11;
		return m-1;
	};
	return m;
};
function dcYear (dte, obj) 
{
	var nStart;
	var nEnd;
	var d = dte.getDate();
	var m = dte.getMonth();
	var y = dte.getFullYear();
	nStart = this.monthStartDate[m];
	if ( d<nStart ) 
	{
		if ( m==0 ) return y-1;
	};
	return y;
};
function dcSaveDate (m, y) {var mm = parseInt(m) + 1;var szYear =  y.toString();var szMonth = mm.toString();if (szMonth.length==1) szMonth = "0" + szMonth;dcCookieSet("dhtmlcal", szYear + szMonth);};
function dcReadDate (szOption) {var m;var y;var szMonth;var szYear;var szValue = dcCookieGet("dhtmlcal");if (szValue==false || this.trackSelectedDate==false) {m = this.initialMonth;y = this.initialYear;} else {szMonth = szValue.substring(4, 6);szYear = szValue.substring(0, 4);m = parseInt(szMonth);y = parseInt(szYear);if (szMonth != m.toString()) {szMonth = szMonth.substring(szMonth.lastIndexOf("0")+1,szMonth.lastIndexOf("0")+2);m = parseInt(szMonth);};m--;};if (szOption=="m") return m;if (szOption=="y") return y;return -1;};
function dcCookieSet (szName, szValue, hours, szPath, szDomain, szSecure) {var numHours;if ( (typeof(hours) == 'string') && Date.parse(hours) ) {numHours = hours;} else if (typeof(hours) == 'number') {numHours = (new Date((new Date()).getTime() + hours*3600000)).toGMTString();};document.cookie = szName + "=" + escape(szValue)+ ((numHours == null) ? "" : "; expires=" + numHours)+ ((szPath == null) ? "" : "; path=" + szPath)+ ((szDomain == null) ? "" : "; domain=" + szDomain)+ ((szSecure == null) ? "" : "; secure");};
function dcCookieGet (szName) {var szData;var nBegin;var nEnd;var MyCookie = document.cookie;if (MyCookie.length>0) {nBegin = MyCookie.indexOf(szName);if (nBegin != -1) {nBegin += szName.length;nEnd = MyCookie.indexOf(";", nBegin);if (nEnd==-1) nEnd = MyCookie.length;szData = unescape(MyCookie.substring(nBegin+1, nEnd));return szData;} else {return false;};} else {return false;};};
function dcSetOuterHTML (obj, szHTML) {var range = document.createRange();range.setStartBefore(obj);var df = range.createContextualFragment(szHTML);obj.parentNode.replaceChild(df, this);};
function dcSetInnerHTML (obj, szHTML) {var range = document.createRange();range.selectNodeContents(obj);range.deleteContents();var df = range.createContextualFragment(szHTML);obj.appendChild(df);};
function dcBrowserName () {var szOutput="";var szBrowser = navigator.appName;if ( szBrowser=="Microsoft Internet Explorer" ) {szOutput = "IE";} else if ( szBrowser=="Netscape" ) {szOutput = "NS";};return szOutput;};
function dcBrowserVer () {return navigator.appVersion.charAt(0);};
function dcGetObj(name) {if (document.getElementById) {return document.getElementById(name);} else if (document.all) {return document.all[name];} else if (document.layers) {return document.layers[name];} else {return false;};};
function dcGetFormElement(formName, objectName) {if (formName.name!=null) formName = formName.name;if (document.getElementById) {return document.getElementById(objectName);} else if (document.all) {return document.all[objectName];} else if (document.layers) {return document.forms[formName].elements[objectName];} else {return false;};};
function dcPopUp (strHREF) {var winPopup;var strValues="width=600,height=400,scrollbars=yes,resizable=yes,titlebar=yes,toolbar=yes,menubar=yes,location=yes,status=yes";winPopup = window.open(strHREF, "_blank", strValues);};
function decode(szCode) {var szAlpha = "abcdefghijklmonpqrstuvwxyz1234567890~`!@#$%^&*()_-+={[}]|\:;<,>.?/";var szKey = "dhtmlcal";var i;var j;var nCode;var nKey;var szResult="";var nLen;szCode = szCode.toLowerCase();j = 0;nLen = szAlpha.length;for ( i=0; i<szCode.length; i++ ) {szChar = szCode.charAt(i);nCode = szAlpha.indexOf(szChar);szChar = szKey.charAt(j);nKey = szAlpha.indexOf(szChar);nCode = nCode - nKey;if ( nCode < 0 ) nCode = nCode + nLen;szResult = szResult + szAlpha.charAt(nCode);j++;if ( j >= szKey.length ) j=1;};return szResult;};
function ShowProperties(obj) {var i;var strOutput;var strTerm;var strData;var strSpace;var lngCols;lngCols=4;if (document.layers) lngCols=3;strSpace = "                                        ";strOutput = obj.name + "\n\n";i=1;for (var prop in obj) {strTerm = "\t";if (i==lngCols) strTerm = "\n";i=i+1;if (i>lngCols) i=1;strData = "." + prop + " = " + obj[prop];if (strData.length<30) strData += strSpace.substring(0, 30-strData.length);if (strData.length>30) strData = strData.substring(0, 30);strOutput += strData + strTerm;};alert(strOutput);return strOutput;};
function URLEncode(szData){var SAFECHARS = "0123456789" +"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +"abcdefghijklmnopqrstuvwxyz" +"-_.!~*'()";var HEX = "0123456789ABCDEF";var plaintext = szData;var encoded = "";for (var i = 0; i < plaintext.length; i++ ) {var ch = plaintext.charAt(i);    if (ch == " ") {    encoded += "+";} else if (SAFECHARS.indexOf(ch) != -1) {    encoded += ch;} else {    var charCode = ch.charCodeAt(0);if (charCode > 255) {    alert( "Unicode Character '" + ch + "' cannot be encoded using standard URL encoding.\n" +        "(URL encoding only supports 8-bit characters.)\n" +"A space (+) will be substituted." );encoded += "+";} else {encoded += "%";encoded += HEX.charAt((charCode >> 4) & 0xF);encoded += HEX.charAt(charCode & 0xF);}}}return encoded;};
function URLDecode(szData){var HEXCHARS = "0123456789ABCDEFabcdef";var encoded = szData;var plaintext = "";var i = 0;while (i < encoded.length) {var ch = encoded.charAt(i);   if (ch == "+") {       plaintext += " ";   i++;   } else if (ch == "%") {if (i < (encoded.length-2)&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {plaintext += unescape( encoded.substr(i,3) );i += 3;} else {alert( 'Bad escape combination near ...' + encoded.substr(i) );plaintext += "%[ERROR]";i++;}} else {   plaintext += ch;   i++;}}return plaintext;};

