/******************************************************************************/

var IMG_NEW =
	"<img src=\"/imagen/nuevo.gif\" hspace=5 width=\"33\" height=\"9\" align=\"absmiddle\" border=\"0\">";
var IMG_UPDATED =
	"<img src=\"/imagen/actualiz.gif\" hspace=2 width=\"55\" height=\"9\" align=\"absmiddle\" border=\"0\">";
var IMG_BICSI =
	"<img src=\"/imagen/bicsi44.gif\" hspace=2 width=\"35\" height=\"12\" align=\"absmiddle\" border=\"0\">" +
	" - Ver <a href=\"/cursos/gbicsi.pdf\" target=\"_blank\">Gu&iacute;a</a>";
var IMG_AGENDA =
	"<img src=\"/images/kugar.gif\" align=\"absmiddle\" border=\"0\" width=\"32\">";
var IMG_REGISTRATION =
	"<img src=\"/images/kwrite.gif\" align=\"absmiddle\" border=\"0\" width=\"32\">";

function checkBrowser()
{
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}

function printCourseOutline(idCourse)
{
	var idx = -1;
	for (var i = 0; i < course_ids.length && idx == -1; i++)
			if (course_ids[i] == idCourse)
				idx = i;
	if (idx == -1) return;
	var idArea = course_area[idx];
	var idxArea = -1;
	for (var i = 0; i < area_ids.length && idxArea == -1; i++)
			if (area_ids[i] == idArea)
				idxArea = i;
	if (idxArea == -1) return;
	var img = "";
	if (course_flags[idx] == 1)
		img = IMG_NEW;
	else if (course_flags[idx] == 2)
		img = IMG_UPDATED;
	document.write(
		"<table class=\"agins + " + idArea + "\" style=\"color: black; " +
			"margin-top: 2px; padding-right: 4px; padding-left: 4px;\"><tr><td>" + 
//		"<p class=\"agins + " + idArea + "\" style=\"color: black;\">" +
		"<img src=\"images/bullets/" + area_bullets[idxArea] +
		"\" width=16 height=16><b><font size=+1>" +
		"&nbsp;<A href=\"course.html?" + idCourse + "\" target=\"_self\" " +
		"class=\"areasps\">" + course_titles[idx] + img + "</a></font></b>" +
		"<br><b>Nivel</b>: " + course_levels[idx] +
		" - <b>Duración y Horario</b>: " + course_days[idx] +
		" días, " + timetables[course_timetables[idx]] + "<br>" +
		course_descriptions[idx] + ""
	);
	// print butons
	document.write(
		"</td></tr><tr><td  align=\"center\"><a href=\"course.html?" + idCourse +
		"\" target=\"_self\">" + IMG_AGENDA + "&nbsp;Temario</A>" +
		"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"agenda2.html#" + idArea.toUpperCase() + "\">" +
		IMG_REGISTRATION + "&nbsp;Inscripciones</a></td>" +
		"</td></tr></table>"
	);
}
function printCourseOutlines(idArea)
{
	for (var i = 0; i < course_ids.length; i++)
		if (course_area[i] == idArea)
			printCourseOutline(course_ids[i]);
}
function getAreaIdx()
{
	var idx = location.href.indexOf('?');
	if (idx != -1)
	{
		var _id = location.href.substring(idx + 1);
		for (var i = 0; i < area_ids.length; i++)
			if (area_ids[i] == _id)
				return i;
	}
	return -1;
}
function getAreaIdxFromURL()
{
	var idx = self.location.href.lastIndexOf('/');
	if (idx != -1)
	{
		var _id = self.location.href.substring(idx + 1, self.location.href.lastIndexOf('.'));
		for (var i = 0; i < area_ids.length; i++)
			if (area_ids[i] == _id)
				return i;
	}
	return -1;
}
function getAreaIdxFromCourseIdx(idx)
{
	if (idx != -1)
	{
		var _id = course_area[idx];
		for (var i = 0; i < area_ids.length; i++)
			if (area_ids[i] == _id)
				return i;
	}
	return -1;
}
function getCourseIdx()
{
	var idx = location.href.indexOf('?');
	if (idx != -1)
	{
		var _id = location.href.substring(idx + 1);
		for (var i = 0; i < course_ids.length; i++)
			if (course_ids[i] == _id)
				return i;
	}
	alert("Curso no encontrado. Por favor, contacte con L&M Data Communications.");
	return -1;
}
function getCourseIdxFromURL()
{
	var idx = self.location.href.lastIndexOf('/');
	if (idx != -1)
	{
		var _id = self.location.href.substring(idx + 1, self.location.href.lastIndexOf('.'));
		for (var i = 0; i < course_ids.length; i++)
			if (course_ids[i] == _id)
				return i;
	}
	alert("Curso no encontrado. Por favor, contacte con L&M Data Communications.");
	return -1;
}
function printAreaTitle(idx)
{
	document.writeln(
		"<title>L&amp;M - " + area_titles[idx] + "</title>"
	);
}
function printCourseTitle(idx)
{
	document.writeln(
		"<title>L&amp;M - " + course_titles[idx] + "</title>"
	);
}
function printAreaHeader(id)
{
	var idx = -1;
	for (i = 0; i < area_ids.length && idx == -1; i++)
			if (area_ids[i] == id)
				idx = i;
	if (idx == -1) return;
	printHeader("");
	document.write(
//		"<p><a href=\"../inicio.htm\"><img src=\"../imagen/dcverde.gif\"\n" +
//		"alt=\"L&amp;M Data Communications\" border=\"0\"></a>" +
//		"<img src=\"../imagen/pt.gif\" height=\"1\" width=\"100\">" +
//		"<a href=\"ccpc.html\" target=\"_self\">" +
//		"<img src=\"../imagen/bcatalog.gif\" border=\"0\"></a></p>" +

		"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" +
			"<tr class = \"" + area_ids[idx] + "\" " +
				"style=\"padding-top: 4px; padding-bottom: 4px; " +
				"padding-right: 100px; padding-left: 10px;\">" +
			"<td align=\"left\">" +
			"<img src=\"images/" + area_images[idx] + "\"></td>" +
			"<td align=\"center\" class=\"areastit\"><u>" + area_titles[idx].toUpperCase() +
			"</u><br><span class=\"areasdsc\">Descripción: " +
			"<a href=\"#obj\" target=\"_self\">Objetivos</a>" +
			" - <a href=\"#dyh\" target=\"_self\">Duración y Horario</a>" +
			" - <a href=\"#dir\" target=\"_self\">Dirigido a</a>" +
			" - <a href=\"#met\" target=\"_self\">Metodología</a>" +
			" - <a href=\"#doc\" target=\"_self\">Documentación</a>" +
			"</span></td>" +
			"<td align=\"right\"><img src=\"images/" + area_images[idx] + "\"></td></tr></table>" +
			"<p class=\"texto2\">El Area consta de los siguientes cursos: " +
			"<font color=\"red\" size=-1>" +
			"(a los que se puede asistir de forma individual)</font></p>"
	);
}
function printAreaBottom()
{
	document.write(
		"<table align=\"center\" border cellspacing=\"1\" bordercolor=\"black\" cellpadding=\"10\">" +
		"<tr><td valign=\"middle\" bgcolor=\"palegreen\" class=\"agins\">" +
		"<b>Volver a: <a href=\"areas.html\" target=\"_self\" >" +
		"<img src=\"../menu/images/n_areas.gif\" border=\"0\" width=\"120\" " +
		"height=\"20\" align=\"absmiddle\" alt=\"Áreas de formación\">" +
		"</a></b></td></tr></table>" +
		"<p align=\"center\" class=\"texto2\">[<a href=\"../inicio.htm\">Inicio</a>] " +
		"[<a href=\"../quien.htm\">L&amp;M</A>] " +
		"[<a href=\"agenda.html\">Agenda</a>] " +
		"[<a href=\"../buscar.htm\">Buscar</a>] " +
		"[<a href=\"https://ssl.acens.com/lmdata.es/masinfo.htm\">Más Información</A>]"
	);
}
function printAreaTable2Old(idxArea)
{
	var bw=new checkBrowser()
	var ulmargin = 	(bw.ns4 || bw.ns5)?-25:15;
	var idArea = area_ids[idxArea];

	document.write(
		"<table " +
		"width=\"100%\" class=\"" + idArea + "\" style=\"margin-bottom: 12px;\"><tr>" +
		"<td width=\"68\" valign=\"middle\" align=\"center\">" +
		"<img src=\"imagen/" + area_images[idxArea] + "\"></td>" +
		"<td style=\"padding-left: 20px\">"
	);

	if (area_group[idxArea] > 0)
	{
		for (var i = 0; i < course_ids.length; i++)
			if (course_area[i] == idArea)
			{
				var idGroup = course_ids[i]
				var ncourses = 0;
				for (var j = 0; j < group_ids.length; j++)
					if (group_ids[j] == idGroup)
						ncourses++;

//	_printAreaHeader(idArea);
				document.write(
					"<span class=\"areasps\"><a class=\"" + idArea + "\" href=\"" + course_ids[i] + ".htm\">" +
					course_titles[i] + "</a></span> " +
					"<span class=\"agins\">(" + ncourses + " cursos, total " + course_days[i] + " días)</span>"
				);
//	_printCourseUL(idArea);
				document.write("<ul class=\"" + idArea + "\" style=\"margin-left: " + ulmargin + 
					"px; margin-top: 0px; margin-bottom: 2px;\">");
				var img = "";
				if (course_flags[i] == 1)
					img = IMG_NEW;
				else if (course_flags[i] == 2)
					img = IMG_UPDATED;
				else if (course_flags[i] == 3)
					img = IMG_BICSI;
				var inline = "";
				if (course_inline[i] == 1)
					inline = " display: inline;" ;
				for (var j = 0; j < group_ids.length; j++)
				{
					if (group_ids[j] == idGroup)
					{
						document.write(
							"<li STYLE=\"font-size: 12px; padding: 0px 6px 0px 6px; margin: 0px;" + inline + "\">" +
							"<img src=\"imagen/" + area_bullets[idxArea] + "\" hspace=\"5\" align=\"absmiddle\">" +
							"<a href=\"cursos/curso.htm?" + group_ids[j] + "\" " +
							"class=\"" + idArea + "\">" + group_titles[j] +
							"</a>&nbsp;" + img + " (" + group_days[j] + " días)"
						);
						document.write(
							"</li>");
					}
				}
				document.write("</ul>");
			}
	}
	else
	{
		var ncourses = 0;
		for (var i = 0; i < course_ids.length; i++)
			if (course_area[i] == idArea)
				ncourses++;

//	_printAreaHeader(idArea);
		document.write(
			"<span class=\"areasps\"><a class=\"" + idArea + "\" href=\"" + idArea + ".htm\">" +
			area_titles[idxArea] + "</a></span> " +
			"<span class=\"agins\">(" + ncourses + " cursos)</span>"
		);
//	_printCourseUL(idArea);
		document.write("<ul class=\"" + idArea + "\" style=\"margin-left: " + ulmargin + 
			"px; margin-top: 2px; margin-bottom: 2px;\">");
		for (var i = 0; i < course_ids.length; i++)
		{
			if (course_area[i] == idArea)
			{
				var img = "";
				if (course_flags[i] == 1)
					img = IMG_NEW;
				else if (course_flags[i] == 2)
					img = IMG_UPDATED;
				else if (course_flags[i] == 3)
					img = IMG_BICSI;
				document.write(
					"<li STYLE=\"font-size: 12px; padding: 0px 6px 0px 6px; margin: 0px;\">" +
					"<img src=\"imagen/" + area_bullets[idxArea] + "\" hspace=\"5\" align=\"absmiddle\">" +
					"<a href=\"cursos/curso.htm?" + course_ids[i] + "\" " +
					"class=\"" + idArea + "\">" + course_titles[i] +
					"</a>&nbsp;" + img + " (" + course_days[i] + " días)</li>"
				);
			}
		}
		document.write("</ul>");
	}
	document.write("</td></tr></tr></table>");
}
function printAreaPageOld(idxArea)
{
	var idArea = area_ids[idxArea];

//	_printCourse(idArea);
	for (var i = 0; i < course_ids.length; i++)
	{
		if (course_area[i] == idArea)
		{
			var img = "";
			if (course_flags[i] == 1)
				img = IMG_NEW;
			else if (course_flags[i] == 2)
				img = IMG_UPDATED;
			else if (course_flags[i] == 3)
				img = IMG_BICSI;
			document.writeln(
				"<P CLASS=\"agins\"><IMG SRC=\"imagen/" + area_bullets[idxArea] + "\" WIDTH=\"12\" HEIGHT=\"12\"><B>" +
				"<FONT SIZE=\"+1\"><A HREF=\"cursos/curso.htm?" + course_ids[i] + "\" CLASS=\"areasps\">" +
				course_titles[i] + "</A> " + img + "</FONT></B><BR>"
			);
			document.write( "<B>Nivel</B>: " );
			for (var nw = 0; nw < text_from_to_levels.length / 2; nw++)
				if (course_levels[i] == text_from_to_levels[nw * 2 + 1])
					document.write( text_from_to_levels[nw * 2] );
			document.writeln(
				" - <B>Duraci&oacute;n y Horario</B>: " + course_days[i] + " días, " + timetables[course_timetables[i]] +
				"<BR>" + course_descriptions[i] + "<BR>"
			);
			document.writeln(
				"<CENTER CLASS=\"agins\"><A HREF=\"cursos/curso.htm?" + course_ids[i] + "\"><IMG " +
				"SRC=\"imagen/diploma.gif\" BORDER=\"0\" WIDTH=\"40\" HEIGHT=\"27\" ALIGN=\"ABSMIDDLE\">Temario</A>" +
				" &nbsp; &nbsp; &nbsp; <A HREF=\"agenda2.htm#" + idArea.toUpperCase() + "\"><IMG " +
				"SRC=\"imagen/comments.gif\" BORDER=\"0\" ALIGN=\"ABSMIDDLE\" WIDTH=\"27\" HEIGHT=\"27\">Inscripciones</A></CENTER></P>"
			);
		}
	}
}
function printGroupPage(idxGroup)
{
	var idGroup = course_ids[idxGroup];
	var idxArea = getAreaIdxFromCourseIdx(idxGroup);
      	var img = "";
      	if (course_flags[idxGroup] == 1)
      		img = IMG_NEW;
      	else if (course_flags[idxGroup] == 2)
      		img = IMG_UPDATED;
      	else if (course_flags[idxGroup] == 3)
      		img = IMG_BICSI;

//	_printCourse(idGroup);
	for (var i = 0; i < group_ids.length; i++)
	{
		if (group_ids[i] == idGroup)
		{
			document.writeln(
				"<P CLASS=\"agins\"><IMG SRC=\"imagen/" + area_bullets[idxArea] + "\" WIDTH=\"12\" HEIGHT=\"12\"><B>" +
				"<FONT SIZE=\"+1\"><A HREF=\"cursos/curso.htm?" + group_ids[i] + "\" CLASS=\"areasps\">" +
				group_titles[i] + "</A> " + img + "</FONT></B><BR>"
			);
			document.write( "<B>Nivel</B>: " );
			for (var nw = 0; nw < text_from_to_levels.length / 2; nw++)
				if (course_levels[idxGroup] == text_from_to_levels[nw * 2 + 1])
					document.write( text_from_to_levels[nw * 2] );
			document.writeln(
				" - <B>Duraci&oacute;n y Horario</B>: " + group_days[i] + " días, " + timetables[course_timetables[idxGroup]] +
				"<BR>" + group_descriptions[i] + "<BR>"
			);
			document.writeln(
				"<CENTER CLASS=\"agins\"><A HREF=\"cursos/curso.htm?" + group_ids[i] + "\"><IMG " +
				"SRC=\"imagen/diploma.gif\" BORDER=\"0\" WIDTH=\"40\" HEIGHT=\"27\" ALIGN=\"ABSMIDDLE\">Temario</A>" +
				" &nbsp; &nbsp; &nbsp; <A HREF=\"agenda2.htm#" + course_area[idxGroup].toUpperCase() + "\"><IMG " +
				"SRC=\"imagen/comments.gif\" BORDER=\"0\" ALIGN=\"ABSMIDDLE\" WIDTH=\"27\" HEIGHT=\"27\">Inscripciones</A></CENTER></P>"
			);
		}
	}
}
function printMaskedAreaTableOld(idxArea, mask2)
{
	if (mask2 == 0) return;		// nothing to print
	var idArea = area_ids[idxArea];

	document.write(
		"<center><table width=\"95%\" class=\"" + idArea +
			"\" style=\"margin-top: 4px;\"><tr>" +
		"<td style=\"padding-left: 20px\">"
	);

	document.write(
		"<a class=\"" + idArea + " area\" href=" + "\"../" + idArea +
			".htm\">" + area_titles[idxArea] + "</a>"
	);

	document.write("<ul class=\"" + idArea + "\" style=\"margin-top: 2px; margin-bottom: 10px;\">");
	var bit = 0;
	for (var i = 0; i < course_ids.length; i++)
	{
		if (course_area[i] == idArea)
		{
			if ((mask2 & (0x1 << bit++)) != 0)
			{
				var img = "";
				if (course_flags[i] == 1)
					img = IMG_NEW;
				else if (course_flags[i] == 2)
					img = IMG_UPDATED;
				document.write(
					"<li STYLE=\"font-size: smaller; line-height: 16px;\">" +
					"<a href=\"../cursos/curso.htm?" + course_ids[i] + 
					"\" class=\"" + idArea + "\">" + course_titles[i] +
					"</a>&nbsp;" + img + " (" + course_days[i] + " días)</li>"
				);
			}
		}
	}
	document.write("</ul></td></tr></tr></table></center>");
}
// Versión 2, con nivel
function printMaskedAreaTable2Old(idxArea, mask2)
{
	if (mask2 == 0) return;		// nothing to print
	var idArea = area_ids[idxArea];

	document.write(
		"<center><table width=\"95%\" class=\"" + idArea +
			"\" style=\"margin-top: 4px;\"><tr>" +
		"<td style=\"padding-left: 20px\">"
	);

	document.write(
		"<a class=\"" + idArea + " area\" href=" + "\"../" + idArea +
			".htm\">" + area_titles[idxArea] + "</a>"
	);

	document.write("<ul class=\"" + idArea + "\" style=\"margin-top: 2px; margin-bottom: 10px;\">");
	var bit = 0;
	for (var i = 0; i < course_ids.length; i++)
	{
		if (course_area[i] == idArea)
		{
			if ((mask2 & (0x1 << bit++)) != 0)
			{
				var img = "";
				if (course_flags[i] == 1)
					img = IMG_NEW;
				else if (course_flags[i] == 2)
					img = IMG_UPDATED;
				document.write(
					"<li STYLE=\"font-size: smaller; line-height: 16px;\">" +
					"<a href=\"../cursos/curso.htm?" + course_ids[i] + 
					"\" class=\"" + idArea + "\">" + course_titles[i] +
					"</a>&nbsp;" + img + " (" + course_days[i] + " d&iacute;as, nivel " +
					course_levels[i] + ")</li>"
				);
			}
		}
	}
	document.write("</ul></td></tr></tr></table></center>");
}
function printAreaMapOld(idxArea)
{
	var idArea = area_ids[idxArea];

//	_printAreaHeader(idArea);
	document.write(
		"<TR>" +
		"<TD CLASS=\"mapalink\" BGCOLOR=\"#9484b5\"><IMG SRC=\"imagen/pt.gif\" WIDTH=\"6\" HEIGHT=\"6\"></TD>" +
		"<TD>" +
		"<TABLE BORDER=\"0\" CELLSPACING=\"1\" CELLPADDING=\"0\" WIDTH=\"120\">" +
		"<TR bgcolor=\"#b9aecf\">" +
		"<TD colspan=\"2\" CLASS=\"mapalink\"><IMG SRC=\"imagen/pt.gif\" WIDTH=\"6\" HEIGHT=\"6\"><A HREF=\"" +
		idArea +".htm\" CLASS=\"mapalink\">" + area_titles_short[idxArea] + "</A></TD></TR>"
	);

//	_printCourseUL(idArea);
	for (var i = 0; i < course_ids.length; i++)
	{
		if (course_area[i] == idArea)
		{
			document.write(
				"<TR>" +
				"<TD WIDTH=\"6\" CLASS=\"mapalink\" BGCOLOR=\"#9484b5\"><IMG SRC=\"imagen/pt.gif\" WIDTH=\"6\" HEIGHT=\"6\"></TD>" +
				"<TD WIDTH=\"100%\" VALIGN=\"top\" CLASS=\"mapalink\" BGCOLOR=\"#ded9e9\">" +
				"<IMG SRC=\"imagen/pt.gif\" WIDTH=\"6\" HEIGHT=\"6\"><A HREF=\"cursos/curso.htm?" + course_ids[i] +
				"\" CLASS=\"mapalink\">" + course_titles_short[i] + "</A></TD></TR>"
			);
		}
	}
	document.write("</TABLE></TD></TR>");
}
function getCourseDate(idxCourse)
{
	var date = "Sin convocatoria";
	var city ="";
	if (course_agenda[idxCourse] != "")
	{
		date = course_agenda[idxCourse];
		city = date.charAt(0);
		if (city == "M") city = "Madrid"; 
		else if (city == "B") city = "Barcelona"; 
		else city = "Unknown";
		city += ", ";
//		date = date.substring(1);
		date = new Date(date.substring(1));
		var nmonth = date.getMonth();
		for (var day = 0; day < course_days[idxCourse]; day++)
		{
			if (day > 0)
				if (day < course_days[idxCourse] - 1)
					city += ", ";
				else
					city += " y ";
			city += date.getDate();
//			date = new Date(date.getTime() + 86400000);
			date.setDate(date.getDate() + 1);
			if (nmonth != date.getMonth() && day < course_days[idxCourse] - 1)
			{
				city += " de " + months[nmonth];
				nmonth = date.getMonth();
			}
		}
		city += " de " + months[nmonth] + " de ";
		city += date.getFullYear();
		return city;
	}
	return date;
}
function printAreaAgenda(idArea)
{
	var idx = -1;
	for (var i = 0; i < area_ids.length && idx == -1; i++)
		if (area_ids[i] == idArea)
			idx = i;
	if (idx == -1) return;

	document.write(
		"<table cellspacing=\"0\" border=\"1\" width = \"100%\"><tr><td>" +
		"<table border=\"0\" cellspacing=\"0\"  width=\"100%\">" +
		"<tr class=\"" + idArea + "\">" +
		"<td valign=\"middle\" align=\"left\" class=\"agenda\">" +
		"<a name=\"" + idArea.toUpperCase() + "\">" +
			area_titles[idx].toUpperCase() + "</a></td>" +
		"<td valign=\"middle\" align=\"right\">" +
		"<a href=\"c_" + idArea + ".html\">" +
		"<img src=\"images/kindex32.gif\" border=\"0\" width=\"32\">Más información</a>&nbsp;&nbsp;" +
		"<a href=\"../plano.htm\" class=\"foscuro\">" +
		"<img border=0 align=top src=\"images/khome32.gif\" width=\"32\">" +
		"Plano de situación</a></td></tr>"
	);
	for (var i = 0; i < course_ids.length; i++)
	{
		if (course_area[i] == idArea)
		{
			var date = getCourseDate(i);
/*			var date = "Sin convocatoria";
			var city ="";
			if (course_agenda[i] != "")
			{
				date = course_agenda[i];
				city = date.charAt(0);
				if (city == "M") city = "Madrid"; 
				else if (city == "B") city = "Barcelona"; 
				else city = "Unknown";
				city += ", ";
				date = date.substring(1);
				var date2 = new Date(date);
				date = date2.getDate() + " de " + months[date2.getMonth()] + " de ";
				date += date2.getFullYear();
			}*/
			var img = "";
			if (course_flags[i] == 1)
				img = IMG_NEW;
			else if (course_flags[i] == 2)
				img = IMG_UPDATED;
			document.write(
				"<tr><td><img src=\"images/pt.gif\" width=\"1\" height=\"10\"></td></tr>" +
				"<tr class=\"" + idArea + "\" valign=\"middle\">" +
				"<td valign=\"middle\" style=\"padding-left: 10px\">" +
				"<a href=\"course.html?" + course_ids[i] + "\">" +
				"<img align=\"left\" src=\"images/grad5.gif\" border=\"0\" width=\"32\">" +
					course_titles[i] + "</a>&nbsp;" + img + "<span><br>" +
				"<span class=\"agins\">&nbsp;&nbsp;" + date + "</span></span></td>" +
				"<td class=\"agins\" align=\"right\" style=\"padding-right: 10px\">" +
				"<a href=\"course.html?" + course_ids[i] +
				"\" target=\"_self\">" + IMG_AGENDA + "&nbsp;Temario</a>" +
				"</td></tr>"
			);
		}
	}
	document.write("</table></td></tr></table>");
}
function sortDate(a, b)
{
  return new Date(course_agenda[a].substring(1)) -
	  new Date(course_agenda[b].substring(1));
}
function getAgendaDays()
{
	var sdays = new Array();

	for (var i = 0; i < course_agenda.length; i++)
		if (course_agenda[i] != "")
			sdays.push(i);
	sdays.sort(sortDate);
	return sdays;
}
function getAgendaMonths(sdays)
{
//	var sdays = getAgendaDays();
	var smonths = new Array();

	for (var j = 0; j < sdays.length; j++)
	{
		d = new Date(course_agenda[sdays[j]].substring(1));
		if (smonths.length == 0 || smonths[smonths.length - 1] != d.getMonth())
			smonths.push(d.getMonth());
	}
	return smonths;
}
function printDateAgenda()
{
	var _months = new Array(
		"jan", "feb", "mar", "apr", "may", "jun",
		"jul", "aug", "sep", "oct", "nov", "dec"
	);
	var sdays = getAgendaDays();
	var smonths = getAgendaMonths(sdays);
/*
	var sdays = new Array();

	for (var i = 0; i < course_agenda.length; i++)
		if (course_agenda[i] != "")
			sdays.push(i);
	sdays.sort(sortDate);
	var smonths = new Array();

	for (var j = 0; j < sdays.length; j++)
	{
		d = new Date(course_agenda[sdays[j]].substring(1));
		if (smonths.length == 0 || smonths[smonths.length - 1] != d.getMonth())
			smonths.push(d.getMonth());
	}
	*/
	document.write("<table cellspacing=\"0\" border=\"0\" width=\"100%\">");
	for (var _m = 0; _m < _months.length; _m++)
	{
		document.write("<tr class = \"" + _months[_m] + "\"><td>" +  _months[_m] + "</td></tr>");
	}
	document.write("</table>");
	var nday = 0;
	var nextDay = new Date(course_agenda[sdays[nday]].substring(1));
	for (var m = 0; m < smonths.length; m++)
	{
//		document.write("<p>" + months[smonths[m]] + "</p>");
		document.write(
			"<table cellspacing=\"0\" border=\"2\" width=\"100%\" cellpadding=\"10\" class=\"" + _months[smonths[m]] + "\">" +
			"<tr><td><table cellspacing=\"0\" hspace=\"8\" border=\"0\" width=\"100%\" class=\"" + _months[smonths[m]] + "\">" +
			"<tr class=\"" + _months[smonths[m]] + "\">" + 
			"<td valign=\"middle\" class=\"agenda\">" +
			"<a name=\"" + _months[smonths[m]] + "\">CURSOS " +
			months[smonths[m]].toUpperCase() + " " + nextDay.getFullYear() + "</a></td>" +
			"<td valign=\"middle\" align=\"right\">" +
			"<a href=\"../plano.htm\">" +
			"<img border=\"0\" src=\"images/khome32.gif\" align=\"middle\" width=\"32\">" +
			"&nbsp;&nbsp;Plano de situación_</a></td>" +
			"</tr>"
		);
		while (nextDay.getMonth() == smonths[m])
		{
			var img = "";
			if (course_flags[sdays[nday]] == 1)
				img = IMG_NEW;
			else if (course_flags[sdays[nday]] == 2)
				img = IMG_UPDATED;

			document.write(
				"<tr height=\"10\"><td></td></tr>" +
				"<tr class = \"" + course_area[sdays[nday]] + "\">" +
				"<td valign=\"middle\" style=\"padding-left: 10px\">" +
				"<a href=\"course.html?" + course_ids[sdays[nday]] + "\">" +
				"<img align=\"left\" src=\"images/grad5.gif\" border=\"0\">" +
				course_titles[sdays[nday]] + "</a>&nbsp;" + img +
				"<span class=\"agins\"><br>&nbsp; &nbsp; &nbsp;" +
				getCourseDate([sdays[nday]]) + "</span></td>" +
				"<td class=\"agins\" align=\"right\" style=\"padding-right: 10px\"><a href=\"course.html?" + course_ids[sdays[nday]] +
				"\" target=\"_self\"><img src=\"images/kugar.gif\" border=\"0\" width=\"24\" height=\"24\" align=\"middle\">&nbsp;Temario</a>" +
				"&nbsp;&nbsp;&nbsp;<a href=\"pdfs/050620_movilidad.pdf\">" +
				"<img src=\"images/pdf.gif\" border=\"0\" align=\"middle\">Convocatoria</a><br>" +
				"<a href=\"https://ssl.acens.com/lmdata.es/ins20jun.htm\">" +
				"<img border=\"0\" align=\"middle\" src=\"images/kwrite.gif\" width=\"24\" height=\"24\">" + 
				"Precios e Inscripciones</a>&nbsp;&nbsp;&nbsp;</td></tr>"
			);
			if (++nday < sdays.length)
				nextDay = new Date(course_agenda[sdays[nday]].substring(1));
			else
				break;
		}
		document.write(
			"</table></td></tr></table><br>"
		);
	}
}
function printLinkBox()
{
	document.write(
		"<table width=\"172\" border=\"2\" bgcolor=\"#0080ff\">" +
		"<tr><td><table width=\"168\" bgcolor=\"#80ffff\"><tr>" +
		"<td width=\"52\"><img src=\"images/gpdf.gif\" alt=\"pdf\" " +
		"width=\"48\" height=\"52\" border=\"0\" align=\"middle\"></td>" +
		"<td><a href=\"../catalogo.htm\"><font size=\"+1\">" +
		"Catálogo<BR>de Cursos</font></a>" +
		"</td></tr></table></td></tr></table>"
	);
}

