//<![CDATA[

/**
 * Marca con CSS la sección del menú que sea la activa en ese momento.
 * @param color string El color en que se marcará el enlace
 */
function marcarSeccionActiva(color)
{
	var h = location.href;
	var url = h.substring(h.lastIndexOf("/") + 1);
	$("#menu a[href$=" + url + "]").addClass("actual").css("color",color);
}

/**
 * Activa los pop-ups de los enlaces con class="externo", y centra el pop-up en la pantalla. 
 * Hace uso de la biblioteca jQuery. 
 * @param {int} ancho
 * @param {int} alto
 */
function activarPopups(ancho, alto)
{
	var x = (screen.width - ancho) / 2;
	var y = ((screen.height - alto) / 2) - 30;
	$(".externo").click(function(e) // Activamos el popup al hacer clic.  
	{
		window.open(this.href, "popup", "width=" + ancho + ",height=" + alto + ",left=" + x + ",top=" + y + ",resizable=yes");
		return false;
	});
}

function activarRollover()
{
	$(".rollover").hover(
		function()
		{
			var nombre = $(this).attr("src").substr($(this).attr("src").lastIndexOf("/") + 1);
			$(this).attr("src", $(this).attr("src").replace(nombre, "_" + nombre));
		},
		function ()
		{
			var nombre = $(this).attr("src").substr($(this).attr("src").lastIndexOf("/") + 1);
			$(this).attr("src", $(this).attr("src").replace("_",  ""));
		}
	);
}

$(document).ready(function (e)
{
	marcarSeccionActiva("#666");
	activarRollover();
});

//]]>

