<!--

//
// Originally written by Keith Jenci
// www.mredkj.com
//
// June 08, 2002 - version 1.0.0
// November 14, 2002 - version 1.1.0
//

// Constants - v.1.1.0 - these were taken out of CalendarFormatter and made global.
var NO_DAY_CALENDAR = 99; // set to something other than a valid day (1-31). For example, 99
var NO_NAV_MONTH = -1;
var MONTHS_CALENDAR = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var	DAYS_1_CALENDAR = new Array("S", "M", "T", "W", "T", "F", "S", "S");
var DAYS_2_CALENDAR = new Array("Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su");
var DAYS_3_CALENDAR = new Array("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT","SUN");
var DAYS_FULL_CALENDAR = new Array( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday","Sunday");


calendarTry = new CalendarDisplay();
calendarTry.setNavigationOn("calendarTry");
calendarTry.setOpenOn(true);
calendarTry.setAutoCloseOn();
calendarTry.setLinkOn("fillInFields");
calendarTry.setDayFormat(calendarTry.TWO_LETTER);
calendarTry.dv="";
	
function calendarOpener(dateval,objcal)
{
	var str="";
	if(dateval.type=="text") calendarTry.setOpenOn(true);
	else calendarTry.setOpenOn(false);
	if(objcal) calendarTry.setObjcal(objcal);
	dateformat(dateval);
	str=readInFieldsType(dateval);
	str=str.split("/");
	var calendarWindowInternal="";
	var aDate = new Date(str[2], str[1]-1, str[0]);
	//alert (aDate);
	var y = aDate.getFullYear();
	var m = aDate.getMonth();
	var d = aDate.getDate();
	//var m = frm.month.options[frm.month.selectedIndex].value;
	//var d = frm.day.value;
	//var y = frm.year.value;
	var showMonth = true;
	//if (frm.yearMonth[1].checked)
	//{
	//	showMonth = false;
	//}
		
	if (showMonth)
	{
		calendarTry.dv=dateval;
		calendarWindowInternal=calendarTry.createMonth(m, d, y);
	}
	else
	{
		calendarWindowInternal=calendarTry.createYear(m, d, y);
	}
	if(!calendarTry.openIsOn) return(calendarWindowInternal);
}
function dateformat(dateval,nolimit)
{
	if (inmediate == "NaN") inmediate="inmediatesss"; 	
	//str[2]=1*str[2];
	var str="";
	//alert(dateval.type);
	str=readInFieldsType(dateval);
	var str=str.replace("\s","");
	var str=str.replace("\D","");
	if (str=="" || str==inmediate){
		fillInFieldsType(dateval,'');
		aDate=hoy;
	}else{
		var str=str.split("/");
		if(str.length>2) if (str[2].length<4) str[2]=2000+(1*str[2]);
		if(!str[2] || str[2]!=Number(str[2])) str[2]=hoy.getFullYear();
		if(!str[1] || str[1]!=Number(str[1])) str[1]=1+hoy.getMonth();
		if(!str[0] || str[0]!=Number(str[0])) str[0]=hoy.getDate();
		var aDate = new Date(str[2], str[1]-1, str[0]);
		aDate.setDate(aDate.getDate());
		if(nolimit && aDate>maxfecha) {
			aDate=maxfecha;
			//alert(maxfecha);
		}
		var aYear = aDate.getFullYear();
		var aMonth = 1+aDate.getMonth();
		var aDay = aDate.getDate();
		fillInFieldsType(dateval,aDay+"/"+aMonth+"/"+aYear);
	}
	if(nolimit && aDate<hoy) {
		fillInFieldsType(dateval,'');
		//alert(hoy);
	}
}
function fillInFields(month, day, year)
{
	month++;
	fillInFieldsType(calendarTry.dv,day+"/"+month+"/"+year);
	dateformat(calendarTry.dv);
}

function fillInFieldsType(dateval,texto)
{
	if(!calendarTry.openIsOn) document.getElementById(dateval).innerText=texto;
	else dateval.value=texto;
}
function readInFieldsType(dateval)
{
	if(!calendarTry.openIsOn) texto=document.getElementById(dateval).innerText;
	else texto=dateval.value;
	return(texto);
}



/*
 * Use this to construct a CalendarDisplay object.
 * There are other functions in this JavaScript file
 * that act as instance methods for CalendarDisplay.
 *
 * Example:
 * var calendarEx = new CalendarDisplay();
 *
 * Also refer to example in setNavigationOn
 *
 * v.1.1.0 - modified - Added link and open functionality.
 */
function CalendarDisplay()
{
	// Day Format constants. The actual number values aren't important.
	// setDayFormat uses these.
	this.ONE_LETTER = 1;
	this.TWO_LETTER = 2;
	this.THREE_LETTER = 3;
	this.FULL_LETTER = 4;
	
	// The name is used when constructing links for navigation
	this.name = "";
	
	// general settings and methods
	this.dayFormat = this.ONE_LETTER;
	this.setDayFormat = setDayFormatCD;
	this.createYear = createYearCD;
	this.createMonth = createMonthCD;
	this.createMonthInternal = createMonthInternalCD;
	this.formatter;
	this.monthValidated = "";
	this.dayValidated = "";
	this.yearValidated = "";
	this.errorThrown = false;
	
	// settings and methods for links
	this.linkIsOn = false;
	this.linkDayHandlerName = ""; // This is set by implementing logic when calling setLinkOn
	this.setLinkOn = setLinkOnCD;
	this.setLinkOff = setLinkOffCD;
	
	this.objcal = false;
	this.setObjcal = setObjcalCD;
	// settings and methods for open window
	this.openIsOn = false;
	this.setOpenOn = setOpenOnCD;
	this.setOpenOff = setOpenOffCD;
	this.autoCloseIsOn = false;
	this.setAutoCloseOn = setAutoCloseOnCD;
	this.setAutoCloseOff = setAutoCloseOffCD;
	this.windowWidth = 20; // This is adjusted in setDayFormat
	this.windowHeight = 160;
	this.windowWidthYear = 690; // This is adjusted in setDayFormat
	this.windowHeightYear = 600;
	
	// navigation settings and methods
	this.navigateMonth = navigateMonthCD;
	this.navigateYear = navigateYearCD;
	this.navigationIsOn = false;
	this.setNavigationOn = setNavigationOnCD;
	this.setNavigationOff = setNavigationOffCD;
}

/*
 * Set the day name format.
 * Once a CalendarDisplay object is created, can use the variables:
 * ONE_LETTER, TWO_LETTER, THREE_LETTER, FULL_LETTER
 *
 * Example:
 * var calendarEx = new CalendarDisplay();
 * calendarEx.setDayFormat(calendarEx.TWO_LETTER);
 *
 * v.1.1.0 - modified - Validate specifically for each format instead of using a range.
 * 
 */
function setDayFormatCD(dayF)
{
	this.dayFormat = dayF;
	if (dayF == this.ONE_LETTER || dayF == this.TWO_LETTER)
	{
		this.windowWidth = 190;
		this.windowWidthYear = 690;
	}
	else if (dayF == this.THREE_LETTER)
	{
		this.windowWidth = 280;
		this.windowWidthYear = 750;
	}
	else if (dayF == this.FULL_LETTER)
	{
		this.windowWidth = 430;

		// not recommended to use full letter with the year calendar
		this.windowWidthYear = 800;
	}
	else
	{
		// Could validate here, but let the formatter display #ERR
	}

}

/*
 * Create and return the HTML for all the months in a calendar year,
 * given the month, day, and year.
 * Month is zero based, which means January is 0, February is 1, etc.
 *
 * The year should be valid, but month and day are not required,
 * so they can be set to any value out of range.
 * It's recommended to use "" or NO_DAY_CALENDAR.
 * If a valid month and day are passed in, then that day will be highlighted.
 *
 * If setOpenOn() has been called, then the year is also opened in a separate window.
 *
 * Example (for December 21, 2002):
 * var calendarEx = new CalendarDisplay();
 * document.writeln(calendarEx.createYear(11, 21, 2002));
 *
 * v.1.1.0 - modified - Added open window logic.
 */
function createYearCD(cdMonth, cdDay, cdYear)
{
	this.formatter = new CalendarFormatter();
	
	var r;
	var c;
	var incr = 0;
	
	this.formatter.setupCalendarYear();
	
	for (r=0; r<3; r++)
	{
		this.formatter.startRow();
		
		for (c=0; c<4; c++)
		{
			this.formatter.startColumn();
			var dd = (cdMonth == incr) ? cdDay : NO_DAY_CALENDAR;
			this.createMonthInternal(incr, dd, cdYear);
			this.formatter.endColumn();
			incr++;
		}
		
		this.formatter.endRow();
	}
	
	this.formatter.concludeCalendarYear();
	
	if (this.openIsOn)
	{
		// setup navigation
		var prefixFormatter = new CalendarFormatter();
		if (this.navigationIsOn && !this.errorThrown)
		{
			var aYear = this.yearValidated;
			prefixFormatter.addNavigationYear(aYear, this.name);
		}
	
		var settings = "scrollbars=yes,menubar=no,resizable=no,width=" + this.windowWidthYear + ",height=" + this.windowHeightYear;
		var calendarWindowYear = window.open("","CalendarWindowYear", settings);
		calendarWindowYear.document.open();
		calendarWindowYear.document.writeln("<HTML><HEAD><TITLE>Calendar</TITLE><link href=\"xtr/CalendarDisplay.css\" rel=\"stylesheet\" type=\"text/css\"></HEAD>");
		calendarWindowYear.document.writeln("<BODY onLoad='self.focus()'>");
		calendarWindowYear.document.writeln(prefixFormatter.results);	
		calendarWindowYear.document.writeln(this.formatter.results);
		calendarWindowYear.document.writeln("</BODY></HTML>");
		calendarWindowYear.document.close();
	}

	return this.formatter.results;
}

/*
 * Create a month and return the HTML for a month,
 * given a month, day, and year.
 * Month is zero based, which means January is 0, February is 1, etc.
 *
 * The year and month should be valid, but day is not required,
 * so it can be set to any value out of range.
 * It's recommended to use "" or NO_DAY_CALENDAR.
 * If a day is passed in, then that day will be highlighted.
 *
 * If setOpenOn() has been called, then the month is also opened in a separate window.
 *
 * Example (for December 21, 2002):
 * var calendarEx = new CalendarDisplay();
 * document.writeln(calendarEx.createMonth(11, 21, 2002));
 *
 * v.1.1.0 - modified - Added open window logic.
 */
function createMonthCD(cdMonth, cdDay, cdYear)
{
	// this formatter is used in createMonthInternal
	this.formatter = new CalendarFormatter();

	// createMonthInternal does validation, so call it first
		var calendarWindowInternal = this.createMonthInternal(cdMonth, cdDay, cdYear);
	
	if (this.openIsOn)
	{
		// setup navigation
		var prefixFormatter = new CalendarFormatter();
		if (this.navigationIsOn && !this.errorThrown)
		{
			//var aMonth = this.monthValidated;
			//var aYear = this.yearValidated;
			//prefixFormatter.addNavigation(aMonth, aYear, this.name);
		}
	
		// open window
		var x=(screen.width-this.windowWidth)/2;
		var y=(screen.height-this.windowHeight)/2;
		var settings = "scrollbars=no,menubar=no,resizable=no,left="+x+",top="+y+",width=" + this.windowWidth + ",height=" + this.windowHeight;
		var calendarWindow = window.open("","CalendarWindowMonth", settings);
		calendarWindow.document.open();
		calendarWindow.document.writeln("<HTML><HEAD><TITLE>Calendar</TITLE><link href=\"xtr/CalendarDisplay.css\" rel=\"stylesheet\" type=\"text/css\"></HEAD>");
		calendarWindow.document.writeln("<BODY onLoad='self.focus()'><div align=\"center\">");
	 	calendarWindow.document.writeln(prefixFormatter.results);		
		calendarWindow.document.writeln(calendarWindowInternal);
		calendarWindow.document.writeln("</div></BODY></HTML>");
		calendarWindow.document.close();
	}
	//alert(calendarWindowInternal);
	return calendarWindowInternal;
}

/*
 * This function is a middle man to call createMonth for the navigation in createMonth.
 *
 * Original purpose: If the navigation buttons are recoded to be href links,
 * then will need this so the return value doesn't attempt to load an invalid page.
 * The href navigation links were slow in Netscape 4.
 *
 * Now this method is used so the buttons don't have to include a dummy day.
 *
 * v.1.1.0 - new
 */
function navigateMonthCD(cdMonth, cdYear, cdDay)
{
	//var cdDay = NO_DAY_CALENDAR;
	document.getElementById(this.objcal).innerHTML=this.createMonth(cdMonth, cdDay, cdYear);
}

function navigateYearCD(cdYear)
{
	var cdMonth = NO_NAV_MONTH;
	var cdDay = NO_DAY_CALENDAR;
	this.createYear(cdMonth, cdDay, cdYear);
}

/*
 * Create a month and return it.
 * Used internally by createMonth and createYear.
 *
 * v.1.1.0 - modified - Using addFormattedLinkDay now instead of addFormattedDay.
 */
function createMonthInternalCD(cdMonth, cdDay, cdYear)
{
	if (isNaN(cdDay) || cdDay == "")
	{
		cdDay = hoy.getDate();
	}

	this.dayValidated = cdDay;
	this.formatter.dayChosen = cdDay;
	
	if (isNaN(cdMonth) || cdMonth < 0 || cdMonth >= MONTHS_CALENDAR.length)
	cdMonth=hoy.getMonth()
	{
		//this.errorThrown = true;
		//this.monthValidated = 0; // monthValidated is set to 0 to limit JavaScript errors
		//return "Not a valid month.";
	}
	this.errorThrown = false;
	this.monthValidated = cdMonth;
	
	if (isNaN(cdYear) || cdYear == "")
	{
		cdYear = hoy.getFullYear();
		//this.errorThrown = true;
		//this.yearValidated = 0; // yearValidated is set to 0 to limit JavaScript errors
		//return "Not a valid year.";
	}
	this.errorThrown = false;
	this.yearValidated = cdYear;
	
	var startingDay = 1;
	var aDate = new Date(cdYear, cdMonth, startingDay);
		
	var DAY_ROW = 0;
	var SPACE_BEFORE = 1;
	var DAYS_BETWEEN = 2;
	var SPACE_AFTER = 3;
	var phase = DAY_ROW;

	this.formatter.setupCalendarMonth(cdMonth, cdYear, this.name, cdDay);
	this.formatter.Line(7);
	
	var rows;
	for (rows = 0; rows < 7; rows++)
	{
		this.formatter.startRow();

		var cols, line;
		for (cols =1; cols < 8; cols++)
		{
			line=false;
			if (phase == DAY_ROW)
			{
				this.formatter.addFormattedDayName(this, cols);
				if (cols >= 7) phase = SPACE_BEFORE;
				//line=true;
			}
			else if (phase == SPACE_BEFORE)
			{
				var tempDay = aDate.getDay();
				if (cols == tempDay)
				{
					var autoCloseReallyOn = (this.autoCloseIsOn && this.openIsOn);
					this.formatter.addFormattedLinkDay(1, this.linkIsOn, this.linkDayHandlerName, this.openIsOn, autoCloseReallyOn, this.objectName, aDate);
					aDate.setDate(2);
					phase = DAYS_BETWEEN;
				}
				else
				{
					this.formatter.addFormattedDayBlank();
				}
			}
			else if (phase == DAYS_BETWEEN)
			{
				// After using setDate, calling getMonth will
				// verify we're still in the current month
				if (aDate.getMonth() == cdMonth)
				{
					var dayOfMonth = aDate.getDate();
					var autoCloseReallyOn = (this.autoCloseIsOn && this.openIsOn);
					this.formatter.addFormattedLinkDay(dayOfMonth, this.linkIsOn, this.linkDayHandlerName, this.openIsOn, autoCloseReallyOn, this.objectName, aDate);
					aDate.setDate(dayOfMonth + 1);
				}
				else
				{
					this.formatter.addFormattedDayBlank();
					phase = SPACE_AFTER;
				}
			}
			else if (phase == SPACE_AFTER)
			{
				this.formatter.addFormattedDayBlank();
			}
		} // end for cols
		
		this.formatter.endRow();
		if (line) this.formatter.Line(7);
		
	} // end for rows
	
	this.formatter.concludeCalendarMonth();
	
	return this.formatter.results;

}

/*
 * Set a switch on so days in the calendar will show up as links.
 *
 * The handlerName should be the name of a method that is available
 * from any link that has javascript: in it.
 *
 * It should expect the arguments in the order: month, day, year.
 * Month is the zero based month (from 0 to 11).
 * Day is the number day (from 1 to 31)
 * Year is the full year (example 2002).
 *
 * Right now, it is not set up to call a method within CalendarDisplay,
 * so CalendarDisplay does not know which date link was clicked.
 * That information must be maintained in the implementing logic.
 *
 * v.1.1.0 - new
 */
function setLinkOnCD(handlerName)
{
	this.linkIsOn = true;
	this.linkDayHandlerName = handlerName;
}

/*
 * Set a switch off so days in the calendar will not show up as links.
 *
 * v.1.1.0 - new
 */
function setLinkOffCD()
{
	this.linkIsOn = false;
}

/*
 * Turn navigation on for the month or year calendar.
 *
 * For a month calendar, there will be buttons like << < > >>
 * For a year calendar, there will buttons like << >>
 * which are:
 * << previous year
 * <  previous month
 * >  next month
 * >> next year
 *
 * To include navigation buttons, provide the name of the object that was instantiated.
 *
 * Make sure the calendar object is global by constructing it without a var if it is inside a function.
 * If the object is declared outside a function, then it will be global either way.
 * It needs to be global so the navigation button's onclick event will be able to reference the object.
 *
 * Example:
 * calendarWithNavEx = new CalendarDisplay();
 * calendarWithNavEx.setNavigationOn("calendarWithNavEx");
 *
 * v.1.1.0 - new
 */
function setNavigationOnCD(objectName)
{
	this.navigationIsOn = true;
	this.name = objectName;
	if (this.name == null) this.name = "";
}

/*
 * Turn navigation off.
 *
 * v.1.1.0 - new
 */
function setNavigationOffCD()
{
	this.navigationIsOn = false;
}

/*
 * Set a switch on so the calendar will open in a new window.
 * It will still return the calendar result.
 *
 * v.1.1.0 - new
 */
function setOpenOnCD(value)
{
	this.openIsOn = value;//ventana+form-texto ó layer+div
}

function setObjcalCD(objcal)
{
	this.objcal = objcal;// layer+div
}
/*
 * Set a switch off so the calendar will not open in a new window.
 * It will just return the calendar result.
 *
 * v.1.1.0 - new
 */
function setOpenOffCD()
{
	this.openIsOn = false;
}

/*
 * Set that the opened window should be closed when a date is selected.
 *
 * v.1.1.0 - new
 */
function setAutoCloseOnCD()
{
	this.autoCloseIsOn = true;
}

/*
 * Set that the opened window should not be closed when a date is selected.
 *
 * v.1.1.0 - new
 */
function setAutoCloseOffCD()
{
	this.autoCloseIsOn = false;
}

/*
 * CalendarDisplay uses this to construct a CalendarFormatter object
 * which it uses to form the HTML for the calendar.
 *
 * There are other functions in this JavaScript file
 * that act as instance methods for CalendarFormatter.
 */
function CalendarFormatter()
{
	this.results = "";
	
	this.dayChosen = NO_DAY_CALENDAR;

	this.setupCalendarYear = setupCalendarYearCF;
	this.setupCalendarMonth = setupCalendarMonthCF;
	this.concludeCalendarYear = concludeCalendarYearCF;
	this.concludeCalendarMonth = concludeCalendarMonthCF;
	this.addFormattedDay = addFormattedDayCF;
	this.addFormattedLinkDay = addFormattedLinkDayCF;
	this.addFormattedNonDay = addFormattedNonDayCF;
	this.addFormattedDayName = addFormattedDayNameCF;
	this.addFormattedDayBlank = addFormattedDayBlankCF;
	this.startRow = startRowCF;
	this.endRow = endRowCF;
	this.Line = LineCCF;
	this.startColumn = startColumnCF;
	this.endColumn = endColumnCF;
	
	this.addNavigation = addNavigationCF;
	this.addNavigationYear = addNavigationYearCF;
	this.getPreviousYearLink = getPreviousYearLinkCF;
	this.getPreviousMonthLink = getPreviousMonthLinkCF;
	this.getNextMonthLink = getNextMonthLinkCF;
	this.getNextYearLink = getNextYearLinkCF;

}

function setupCalendarYearCF(month, year)
{
	this.results = this.results + '<table border="1" cellpadding="5" cellspacing="0">';
}

function setupCalendarMonthCF(month, year, aName, cdDay)
{
	this.results = this.results + '<table><tr><td>'+this.getPreviousMonthLink(month, year, aName, cdDay)+'</td><td colspan="5"  class="nor" align="center">' + MONTHS_CALENDAR[month] + ', ' + year + '</td><td>'+this.getNextMonthLink(month, year, aName, cdDay)+'</td></tr>';
}

function concludeCalendarYearCF()
{
	this.results = this.results + "</table>";
}

function concludeCalendarMonthCF()
{
	this.results = this.results + "</table>";
}

/*
 * Add a formatted day to the results with no link.
 *
 * This function isn't used internally in CalendarDisplay in v.1.1.0.
 * The code has been moved to addFormattedLinkDay.
 *
 * v.1.1.0 - modified
 */
function addFormattedDayCF(num)
{
	var isLinkOn = false;
	var objectName = ""; // ignored when link is off
	var month; // ignored when link is off
	var day; // ignored when link is off
	var year; // ignored when link is off
	this.addFormattedLinkDay(num, isLinkOn);
}

/*
 * Add a formatted day to the results with a link, if isLinkOn is true.
 * The way the link is constructed, the function specified by handlerName is referenced
 * with the zero based month, day, and full year.
 * Keep in mind the handlerName needs to be referenced globally.
 *
 * Also, it will refer to the opener if isWindowOpen is true,
 * which means the calendar is in an opened window.
 *
 * v.1.1.0 - added
 */
function addFormattedLinkDayCF(num, isLinkOn, handlerName, isWindowOpen, autoCloseIsOn, objectName, aDate)
{
	var linkStart = "";
	var linkEnd = "";
	if (isLinkOn)
	{
		var aYear = aDate.getFullYear();
		var aMonth = aDate.getMonth();
		var aDay = aDate.getDate();
		linkStart = "<a href=\"javascript:"
			+ ((isWindowOpen) ? "window.opener." : "")
			+ handlerName + "("
			+ aMonth + ","
			+ aDay + ","
			+ aYear + ");"
			+ ((autoCloseIsOn) ? "window.close();" : "")
			+ "\">";
		linkEnd = "</a>";
	}
	
	if (num == this.dayChosen)
	{
		this.results = this.results + '<td align="center" bgcolor="#0099CC"><b>' + linkStart + num + linkEnd + '</b></td>';
	}
	else
	{
		this.results = this.results + '<td align="center">' + linkStart + num + linkEnd + '</td>';
	}
}

function addFormattedNonDayCF(contents)
{
	this.results = this.results + '<td align="center" class="nor">' + contents + '</td>';
}

function addFormattedDayNameCF(cal, num)
{
	if (cal.dayFormat == cal.ONE_LETTER)
	{
		this.addFormattedNonDay(DAYS_1_CALENDAR[num]);
	}
	else if (cal.dayFormat == cal.TWO_LETTER)
	{
		this.addFormattedNonDay(DAYS_2_CALENDAR[num]);
	}
	else if (cal.dayFormat == cal.THREE_LETTER)
	{
		this.addFormattedNonDay(DAYS_3_CALENDAR[num]);
	}
	else if (cal.dayFormat == cal.FULL_LETTER)
	{
		this.addFormattedNonDay(DAYS_FULL_CALENDAR[num]);
	}
	else
	{
		this.addFormattedNonDay("#ERR");
	}
}

function addFormattedDayBlankCF()
{
	this.addFormattedNonDay("&nbsp;");
}

function startRowCF()
{
	this.results = this.results + "<tr>";
}

function endRowCF()
{
	this.results = this.results + "</tr>";
}

function LineCCF(cols)
{
	//this.results = this.results + "<tr><td colspan='"+cols+"'></td></tr>";
	this.results = this.results + '<tr><td colspan="'+cols+'" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="#999999"><img src="pix.gif" width="1" height="1"></td></tr></table></td></tr>';
}

function startColumnCF()
{
	this.results = this.results + "<td>";
}

function endColumnCF()
{
	this.results = this.results + "</td>";
}

function addNavigationCF(aMonth, aYear, aName)
{
	this.results = this.results
		+ "<p><form name=\"navigationCalendar\">"
		//+ this.getPreviousYearLink(aMonth, aYear, aName)
		+ "&nbsp;&nbsp;" + this.getPreviousMonthLink(aMonth, aYear, aName)
		+ "&nbsp;&nbsp;" + this.getNextMonthLink(aMonth, aYear, aName)
		//+ "&nbsp;&nbsp;" + this.getNextYearLink(aMonth, aYear, aName)
		+ "</form></p>";
}

function addNavigationYearCF(aYear, aName)
{
	var aMonth = NO_NAV_MONTH;
	this.results = this.results
		+ "<p><form name=\"navigationCalendar\">"
		+ this.getPreviousYearLink(aMonth, aYear, aName)
		+ "&nbsp;&nbsp;" + this.getNextYearLink(aMonth, aYear, aName)
		+ "</form></p>";
}

function getPreviousYearLinkCF(aMonth, aYear, aName)
{
	var previousYear = aYear;
	previousYear--;
	var previousYearLink = "<input name=\"imageField\" type=\"image\" src=\"img/Calendar_p.gif\" width=\"14\" height=\"13\" border=\"0\" onclick=\"javascript:"+((calendarTry.openIsOn) ? "window.opener." : "");
	if (aMonth == NO_NAV_MONTH)
	{
		previousYearLink += aName + ".navigateYear(";
	}
	else
	{
		previousYearLink += aName + ".navigateMonth(" + aMonth + ",";
	}
	previousYearLink += previousYear + ")\" />";
		
	return previousYearLink;
}

function getPreviousMonthLinkCF(aMonth, aYear, aName, cdDay)
{
	var previousMonth = aMonth;
	var previousYear = aYear;
	previousMonth--;
	if (previousMonth < 0)
	{
		previousMonth = 11;
		previousYear--;
	}
	var previousMonthLink = "<input name=\"imageField\" type=\"image\" src=\"img/Calendar_p.gif\" width=\"14\" height=\"13\" border=\"0\" onclick=\"javascript:"+((calendarTry.openIsOn) ? "window.opener." : "")
		+ aName + ".navigateMonth("
		+ previousMonth + ","
		+ previousYear + ","
		+ cdDay + ")\" />";
		
	return previousMonthLink;
}

function getNextMonthLinkCF(aMonth, aYear, aName, cdDay)
{
	var nextMonth = aMonth;
	var nextYear = aYear;
	
	// note: use nextMonth++ instead of nextMouth = nextMonth + 1,
	// because the second one treats nextMonth as a string.
	nextMonth++;
	if (nextMonth > 11)
	{
		nextMonth = 0;
		nextYear++;
	}
	var nextMonthLink = "<input name=\"imageField\" type=\"image\" src=\"img/Calendar_n.gif\" width=\"14\" height=\"13\" border=\"0\"  onclick=\"javascript:"+((calendarTry.openIsOn) ? "window.opener." : "")
		+ aName + ".navigateMonth("
		+ nextMonth + ","
		+ nextYear + ","
		+ cdDay + ")\" />";
	
	return nextMonthLink;
}

function getNextYearLinkCF(aMonth, aYear, aName)
{
	var nextYear = aYear;
	nextYear++;
	
	var nextYearLink = "<input name=\"imageField\" type=\"image\" src=\"img/Calendar_n.gif\" width=\"14\" height=\"13\" border=\"0\"  onclick=\"javascript:"+((calendarTry.openIsOn) ? "window.opener." : "")
	if (aMonth == NO_NAV_MONTH)
	{
		nextYearLink += aName + ".navigateYear(";
	}
	else
	{
		nextYearLink += aName + ".navigateMonth(" + aMonth + ",";
	}
	nextYearLink += nextYear + ")\" />";
		
	return nextYearLink;
}

//http://www.kangoojumps.com/pags.php?doc=419&yearID=2007&monthID=7&dayID=17
function ve_calendar(aYear,aMonth,aDay)
{
	ve("R&yearID="+aYear+"&monthID="+aMonth+"&dayID="+aDay);
}
//-->